Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ti83plus.inc"
- #define progStart $9D95
- .org progStart-2
- .db $BB,$6D
- ld de, $9D95 ;the address we're viewing (starts at the prog start just because)
- ld hl, $0000
- ld ($844B), hl ;make curRow and curCol 0 for PutS
- ;display the address
- ld hl, $93B0
- ld a, d
- call Output1
- ld a, e
- call Output1
- ld (hl), $00 ;null terminate the string
- ld hl, $9340
- ld b, $38
- loop: ;main loop for displaying 0x38 bytes onscreen
- ld a, (de)
- call Output1
- inc de
- djnz loop
- push de
- ld hl, $9340
- bcall(_PutS)
- bcall(_GetKey) ;waits for keypress
- cp $05 ;exit on enter
- ret z
- ld de, $FFC8 ;default value for screen movement (goes back up after we displayed 0x38 bytes of memory)
- ;ensure key is 1, 2, 3, 4, 80, 81, 82, or 83 for moving the screen around
- rlca ;a is now 1, 2, 3, 4, 5, 6, 7, or 8
- cp $01
- jr c, nomove
- cp $09
- jr nc, nomove
- add a, a
- add a, MoveTable-2-$9E00 ;as long as MoveTable is 9Exx this will work
- ld l, a
- adc a, (MoveTable-2)/256 ;this one doesn't depend on it being 9Exx >.>
- sub l
- ld h, a
- ld d, (hl)
- inc hl
- ld e, (hl)
- ;pushed the address into de earlier, we use hl for this and make de the offset
- ;later we pop hl to add them up
- nomove:
- ;de is FFC8 for not moving the screen
- pop hl ;hl was the address, de is the offset for this addition
- add hl, de
- ld d,h
- ld e,l
- ;next handle editing memory values
- cp $85 ;left paren = decrement
- .db $20, $01 ;jr nz +1
- dec (hl)
- cp $86 ;right paren = increment
- .db $20, $01
- inc (hl)
- cp $B9 ;cos = -10
- .db $20, $05
- ld b, $10
- dec (hl)
- .db $10, $FD ;djnz -3
- cp $BB ;tan = +10
- .db $20, $05
- ld b, $10
- inc (hl)
- .db $10, $FD ;djnz -3
- jp $9D98
- Output1:
- ld c, a
- rrca
- rrca
- rrca
- rrca
- call Output2
- Output2:
- and $0F
- add a, $30
- cp $3A
- .db $38, $02 ;jr c +2
- add a, $07
- ld (hl), a
- inc hl
- ld a, c
- ret
- MoveTable:
- .dw $0FC8 ;plus = +1000
- .dw $FFC9 ;right = +1
- .dw $EFC8 ;minus = -1000
- .dw $FFC7 ;left = -1
- .dw $00C8 ;mult = +100
- .dw $FFC0 ;up = -8 (1 row)
- .dw $FEC8 ;div = -100
- .dw $FFD0 ;down = +8 (1 row)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement