Advertisement
Guest User

Y.z80 by bb94

a guest
Jun 28th, 2013
105
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.     ; Input: {r, c, X}
  6.     ; if not in this format, then exits
  7.     ; First, get the list
  8.     ; Second, get row and col
  9.     ; Third, get number and store to hl
  10.     ; Last, draw the digits
  11.     ; WORKS FOR 8-BIT VALS
  12.     ; bcall(_AnsName) gets the name of Ans in OP1
  13.     ;
  14.     bcall(_RclAns)
  15.     and $1F ;masking
  16.     dec a
  17.     ret nz ;bail if not a list
  18.     ex de,hl ;now hl has the size and de has the symentry
  19.     ld c,(hl) ;I presume that c has the value?
  20.     inc hl
  21.     ld b,(hl)
  22.     inc hl ;Thanks to Xeda for this code!
  23.     ; "So the code I gave returns HL pointing to the data for the first element, BC is the number of elements"
  24.     ; Checks if bc == 3
  25.     ld a,c
  26.     cp 3
  27.     ret nz
  28.     ld a,b
  29.     or a
  30.     ret nz ;this basically exits if the number of elements is not equal to 3
  31.     rst rMov9ToOP1 ;What does this do?
  32.     push hl
  33.     bcall(_ConvOP1)
  34.     pop hl
  35.     ld (curRow),a
  36.     rst rMov9ToOP1 ;What does this do?
  37.     push hl
  38.     bcall(_ConvOP1)
  39.     pop hl
  40.     ld (curCol),a
  41.     rst rMov9ToOP1 ;What does this do?
  42.     push hl
  43.     bcall(_ConvOP1)
  44.     pop hl
  45.     jr WriteHex16
  46.    
  47.     ; In:
  48.     ;  DE: the number
  49.     ;  (curRow), (curCol): Obvious.
  50.     ; Out:
  51.     ;  Nothing.
  52.     ; Destroys:
  53.     ;  A,B,DE,HL
  54. WriteHex16:
  55.     ld b,e
  56.     call WriteHex8
  57.     call Rec2
  58.     ld b,d
  59.     jr WriteHex8
  60. WriteHex8:
  61.     ld a,b
  62.     call GetHexDigit
  63.     push bc
  64.     bcall(_PutC)
  65.     pop bc
  66.     call Rec2
  67.     ld a,b
  68.     rra
  69.     rra
  70.     rra
  71.     rra
  72.     call GetHexDigit
  73.     push bc
  74.     bcall(_PutC)
  75.     pop bc
  76.     ret
  77. GetHexDigit: ; Thanks to Xeda for the optimization
  78.     and 0Fh
  79.     add a,30h
  80.     cp 3Ah
  81.     ret c
  82.     add a,7
  83.     ret
  84. Rec2:
  85.     ld a,(curCol)
  86.     sub 2
  87.     ld (curCol),a
  88.     ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement