Advertisement
Guest User

hello.z80

a guest
Sep 23rd, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include    "ti83plus.inc"
  2. #define     progStart   $9D95
  3. .org        progStart-2
  4. .db         $BB,$6D
  5.     ld de, $9D95 ;the address we're viewing (starts at the prog start just because)
  6.     ld hl, $0000
  7.     ld ($844B), hl ;make curRow and curCol 0 for PutS
  8.  
  9.     ;display the address
  10.     ld hl, $93B0
  11.     ld a, d
  12.     call Output1
  13.     ld a, e
  14.     call Output1
  15.    
  16.     ld (hl), $00 ;null terminate the string
  17.     ld hl, $9340
  18.     ld b, $38
  19. loop: ;main loop for displaying 0x38 bytes onscreen
  20.     ld a, (de)
  21.     call Output1
  22.     inc de
  23.     djnz loop
  24.    
  25.     push de
  26.     ld hl, $9340
  27.     bcall(_PutS)
  28.     bcall(_GetKey) ;waits for keypress
  29.  
  30.     cp $05 ;exit on enter
  31.     ret z
  32.  
  33.     ld de, $FFC8 ;default value for screen movement (goes back up after we displayed 0x38 bytes of memory)
  34.    
  35.     ;ensure key is 1, 2, 3, 4, 80, 81, 82, or 83 for moving the screen around
  36.     rlca ;a is now 1, 2, 3, 4, 5, 6, 7, or 8
  37.     cp $01
  38.     jr c, nomove
  39.     cp $09
  40.     jr nc, nomove
  41.     add a, a
  42.     add a, MoveTable-2-$9E00 ;as long as MoveTable is 9Exx this will work
  43.     ld l, a
  44.     adc a, (MoveTable-2)/256 ;this one doesn't depend on it being 9Exx >.>
  45.     sub l
  46.     ld h, a
  47.     ld d, (hl)
  48.     inc hl
  49.     ld e, (hl)
  50.     ;pushed the address into de earlier, we use hl for this and make de the offset
  51.     ;later we pop hl to add them up
  52.    
  53. nomove:
  54.     ;de is FFC8 for not moving the screen
  55.    
  56.     pop hl ;hl was the address, de is the offset for this addition
  57.     add hl, de
  58.     ld d,h
  59.     ld e,l
  60.    
  61.     ;next handle editing memory values
  62.     cp $85 ;left paren = decrement
  63.     .db $20, $01 ;jr nz +1
  64.     dec (hl)
  65.    
  66.     cp $86 ;right paren = increment
  67.     .db $20, $01
  68.     inc (hl)
  69.    
  70.     cp $B9 ;cos = -10
  71.     .db $20, $05
  72.     ld b, $10
  73.     dec (hl)
  74.     .db $10, $FD ;djnz -3
  75.    
  76.     cp $BB ;tan = +10
  77.     .db $20, $05
  78.     ld b, $10
  79.     inc (hl)
  80.     .db $10, $FD ;djnz -3
  81.    
  82.     jp $9D98
  83. Output1:
  84.     ld c, a
  85.     rrca
  86.     rrca
  87.     rrca
  88.     rrca
  89.     call Output2
  90. Output2:
  91.     and $0F
  92.     add a, $30
  93.     cp $3A
  94.     .db $38, $02 ;jr c +2
  95.     add a, $07
  96.     ld (hl), a
  97.     inc hl
  98.     ld a, c
  99.     ret
  100.  
  101. MoveTable:
  102. .dw $0FC8 ;plus = +1000
  103. .dw $FFC9 ;right = +1
  104. .dw $EFC8 ;minus = -1000
  105. .dw $FFC7 ;left = -1
  106. .dw $00C8 ;mult = +100
  107. .dw $FFC0 ;up = -8 (1 row)
  108. .dw $FEC8 ;div = -100
  109. .dw $FFD0 ;down = +8 (1 row)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement