Geekboy

Untitled

Mar 6th, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "ti83plus.inc"
  2.  
  3.     .org $9d93
  4. Start:
  5.     ; Clear the screen
  6.     bcall(_ClrLCDFull)
  7.    
  8.     ; Install interrupt for the counter
  9.     di              ; Disable interrupts while installing
  10.    
  11.     ld a, $9a       ; Fill $9900 to $9A00 with $9a
  12.     ld ($9900), a   ; ^
  13.     ld hl, $9900    ; ^
  14.     ld de, $9901    ; ^
  15.     ld bc, 256      ; ^
  16.     ldir            ; ^
  17.    
  18.     ld a, $99       ; Set the interrupt HSB to $99
  19.     ld i, a         ; ^
  20.     ld hl,9a9ah
  21.     ld (hl),Interrupt
  22.     im 2            ; Set interrupt mode 2
  23.     ei              ; Re-enable interrupts
  24.    
  25.     ; do stuff
  26.    
  27.     im 1
  28.    
  29.     ret
  30.    
  31. d_tick:
  32.     .dw $00
  33. Interrupt:
  34.     di              ; Disable interrupts to prevent interruptception
  35.  
  36.     ex af, af'      ; Swap all registers with their shadow registers
  37.     exx             ;   so we don't mess up data
  38.    
  39.     ld hl, (d_tick)
  40.     inc hl
  41.     ld (d_tick), hl
  42.    
  43.     ex af, af'      ; Swap back the registers
  44.     exx             ; ^
Advertisement
Add Comment
Please, Sign In to add comment