Advertisement
Guest User

X.z80 by bb94

a guest
Jun 28th, 2013
177
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.     ld b,a
  46.     jr WriteHex8
  47.    
  48.     ; In:
  49.     ;  B: the number
  50.     ;  (curRow), (curCol): Obvious.
  51.     ; Out:
  52.     ;  Nothing.
  53.     ; Destroys:
  54.     ;  A,B,C,HL
  55. WriteHex8:
  56.     ld a,b
  57.     call GetHexDigit
  58.     push bc
  59.     bcall(_PutC)
  60.     pop bc
  61.     ld a,(curCol)
  62.     sub 2
  63.     ld (curCol),a
  64.     ld a,b
  65.     rra
  66.     rra
  67.     rra
  68.     rra
  69.     call GetHexDigit
  70.     push bc
  71.     bcall(_PutC)
  72.     pop bc
  73.     ret
  74. GetHexDigit: ; Thanks to Xeda for the optimization
  75.     and 0Fh
  76.     add a,30h
  77.     cp 3Ah
  78.     ret c
  79.     add a,7
  80.     ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement