fork download
  1. #include <v2_18g3.asm>
  2.  
  3. #define PACTL REGBASE+0x26
  4. #define PACNT REGBASE+0x27
  5. #define TMSK2 REGBASE+0x24
  6. #define TFLG2 REGBASE+0x25
  7.  
  8.  
  9. .sect .data
  10. msg: .asciz "Pulse Accumulator Test Program\n\n"
  11.  
  12.  
  13. .sect .text
  14. main:
  15. ldx #msg // pointer to output message
  16. jsr OUTSTRING // write program name out
  17.  
  18. ldx #BUTTONISR // interrupt for interrupt button press
  19. stx ISR_JUMP15
  20.  
  21. ldx #PA_OVRISR // interrupt for pulse accumulator overflow
  22. stx ISR_JUMP4 // called when PACNT goes from 255 to 0
  23.  
  24. ldaa #0xf0 // Turn on pulse accumulator
  25. staa PACTL
  26. ldaa TMSK2 // Turn on overflow interrupts
  27. oraa #0x20
  28. staa TMSK2
  29.  
  30. /* Event spin loop */
  31. loop:
  32. // every time PACNT is 0 (every 256 ticks), we print '.'
  33. // Gives you an idea of how fast the pulse accumulator is.
  34. ldaa PACNT
  35. bne loop
  36.  
  37. ldaa #'.'
  38. jsr OUTCHAR
  39. bra loop
  40.  
  41. /* Interrupt Service Routine called each time the pulse accumlator
  42. overflows or about every 10 ms. */
  43. PA_OVRISR:
  44. // if you don't reset these flags (see description in HC11 manual),
  45. // nasty stuff happens, e.g. Ctrl-X reset can get disabled
  46. ldaa TFLG2
  47. oraa #0xc0 // clear PAOVF
  48. staa TFLG2
  49. rti
  50.  
  51. /* ISR called each time the IRQ pin is pulled low (button pushed). Do
  52. as little as possible in this interrupt; LCD functions called here may
  53. crash. Could use this interrupt to save current value of PACNT as a
  54. "random" number. */
  55. BUTTONISR:
  56. ldab PACNT
  57. clra
  58. jsr CONSOLEINT // output value of pulse accumulator count (PACNT)
  59. rti
  60.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.asm:1: error: label or instruction expected at start of line
prog.asm:3: error: label or instruction expected at start of line
prog.asm:4: error: label or instruction expected at start of line
prog.asm:5: error: label or instruction expected at start of line
prog.asm:6: error: label or instruction expected at start of line
prog.asm:9: error: attempt to define a local label before any non-local labels
prog.asm:9: error: parser: instruction expected
prog.asm:10: error: parser: instruction expected
prog.asm:13: error: parser: instruction expected
prog.asm:15: error: parser: instruction expected
prog.asm:16: error: parser: instruction expected
prog.asm:18: error: symbol `ldx' redefined
prog.asm:18: error: parser: instruction expected
prog.asm:19: error: parser: instruction expected
prog.asm:21: error: symbol `ldx' redefined
prog.asm:21: error: parser: instruction expected
prog.asm:22: error: symbol `stx' redefined
prog.asm:22: error: parser: instruction expected
prog.asm:24: error: parser: instruction expected
prog.asm:25: error: parser: instruction expected
prog.asm:26: error: symbol `ldaa' redefined
prog.asm:26: error: parser: instruction expected
prog.asm:27: error: parser: instruction expected
prog.asm:28: error: symbol `staa' redefined
prog.asm:28: error: parser: instruction expected
prog.asm:30: error: label or instruction expected at start of line
prog.asm:32: error: label or instruction expected at start of line
prog.asm:33: error: label or instruction expected at start of line
prog.asm:34: error: symbol `ldaa' redefined
prog.asm:34: error: parser: instruction expected
prog.asm:37: error: symbol `ldaa' redefined
prog.asm:37: error: parser: instruction expected
prog.asm:38: error: symbol `jsr' redefined
prog.asm:38: error: parser: instruction expected
prog.asm:41: error: label or instruction expected at start of line
prog.asm:42: error: comma, colon or end of line expected
prog.asm:44: error: label or instruction expected at start of line
prog.asm:45: error: label or instruction expected at start of line
prog.asm:46: error: symbol `ldaa' redefined
prog.asm:46: error: parser: instruction expected
prog.asm:47: error: symbol `oraa' redefined
prog.asm:47: error: parser: instruction expected
prog.asm:48: error: symbol `staa' redefined
prog.asm:48: error: parser: instruction expected
prog.asm:51: error: label or instruction expected at start of line
prog.asm:52: error: parser: instruction expected
prog.asm:53: error: parser: instruction expected
prog.asm:54: error: label or instruction expected at start of line
prog.asm:56: error: parser: instruction expected
prog.asm:58: error: symbol `jsr' redefined
prog.asm:58: error: parser: instruction expected
prog.asm:59: error: symbol `rti' redefined
stdout
Standard output is empty