home *** CD-ROM | disk | FTP | other *** search
/ ticalc.org / ticalc_org_rev_b.iso / archives / 82 / asm / source / ash / int82.asm < prev    next >
Encoding:
Assembly Source File  |  2001-07-01  |  3.1 KB  |  123 lines

  1. ;***************  IntTest82 ver 1.0  ***************
  2. ;
  3. ; This program is a small demo of how interrupts can
  4. ; be used on the TI82 under Ash. The interrupt rutine
  5. ; ounts from o to 7 in ASCII, all the time storing
  6. ; the current value in a fix location in mem. This
  7. ; counter is shown in the top right corner of the
  8. ; display when you run IntTest82.
  9. ;
  10. ; To start the program, run it from Ash and press
  11. ; ENTER to initialize the interrupt rutine. You can
  12. ; stop the rutine by entering the program and then
  13. ; pressing DEL. Pressing MODE will exit the program.
  14. ;
  15. ; DO NOT ENTER GRAPH SCREEN WHILE RUNING THE PROGAM!
  16. ; The interrupt rutine is stored in the graph and will
  17. ; be overwrite if the graph mem is used for anything
  18. ; else.
  19. ;
  20. ; TURN OFF THE PROGRAM BEFORE TURNING OFF THE CALC!
  21. ; The interrupt vectors are stored in the backup buffer
  22. ; which is used when the calc is turned off (or on APD).
  23. ;
  24. ; If you do use the graph mem or turn off the calc, the
  25. ; calculator will crash.
  26. ;
  27. ; The reason that the program does not display the counter
  28. ; when you are not runing the program is that the build in
  29. ; display rutines sometime causes problems when used in
  30. ; an interrupt (i have never seen the calc crash because
  31. ; of this).
  32. ;
  33. ;
  34. ; Dines Justesen, (C) 1997
  35.  
  36. #INCLUDE "ti82.h"
  37.  
  38. Char    = $82FE                       ; Char to be shown
  39. Counter = $8583                       ; Counter in start of graph mem
  40.  
  41. .ORG START_ADDR
  42. .DB "IntTest82 1.0 by DJ",0
  43.     TEXT_START
  44.     LD HL,TScreen                      ; Display text
  45.     ROM_CALL(D_ZT_STR)
  46. KeyLoop:                               ; Wait for keypress
  47.     LD HL,$0F00
  48.     LD ($800C),HL
  49.     LD HL,Char
  50.     ROM_CALL(D_ZT_STR)
  51.     CALL GET_KEY
  52.     CP $9
  53.     JR Z,SetupInt
  54.     CP $38
  55.     JR Z,RemoveInt
  56.     CP $37
  57.     JR Z,End
  58.     JR KeyLoop
  59.  
  60. RemoveInt:
  61.     IM 1                     ; Normal interrupt mode
  62.     SET 0,(IY+3)             ; Graph is dirty
  63.     JR KeyLoop
  64.  
  65. End:
  66.     TEXT_END
  67.     RET
  68.  
  69. SetupInt:
  70.     LD HL,$8300              ; Setup interrupt vector table in backup
  71.     LD DE,$8301              ; buffer (only used for APD). The Int
  72.     LD (HL),$85              ; rutine is placed in graph mem to have
  73.     LD BC,257                ; as much space as possible.
  74.     LDIR
  75.  
  76.     LD HL,IntProcStart       ; Get pointer to interrupt rutine
  77.     LD DE,$8585              ; Start of int rutine, and length of it
  78.     LD BC,IntProcEnd-IntProcStart+1
  79.     LDIR
  80.  
  81.     XOR A                    ; Init vars
  82.     LD (Counter),A
  83.     LD (Char+1),A
  84.     LD A,$30
  85.     LD (Char),A
  86.  
  87.     LD A,$83                 ; Point to the new table
  88.     LD I,A
  89.     IM 2
  90.  
  91.     JR KeyLoop
  92.  
  93. IntProcStart:
  94.     EX AF,AF'
  95.     EXX
  96.     LD HL,Counter
  97.     INC (HL)
  98.     LD A,(HL)
  99.     AND %00111111
  100.     JR NZ,ExitInt
  101.     LD HL,Char
  102.     LD A,(HL)
  103.     INC A
  104.     AND $37
  105.     LD (HL),A
  106. ExitInt:
  107.     EXX
  108.     EX AF,AF'
  109.     JP $0038                 ; Call Std inetrrupt handler
  110.  
  111. IntProcEnd:
  112.  
  113. TScreen:
  114. .DB "   IntTest82    "
  115. .DB "    ver 1.0     "
  116. .DB "Press:          "
  117. .DB "ENTER to start  "
  118. .DB "DEL to end      "
  119. .DB "MODE to exit    "
  120. .DB "(c) 1997 by     "
  121. .DB "Dines Justesen  ",0
  122. .END
  123.