Re: A86: Quick question...


[Prev][Next][Index][Thread]

Re: A86: Quick question...




> A quick question for you guys. How would you display the contents of a
> register (like A) onto the screen? Probably someting simple, and I'm just
> making it too hard ;)

Different registers require different routines (8 or 16 bit).  This is
my 8 bit displayer, takes [A] as input, outputs a one to three digit
(leading zeroes removed) decimal result at the current pen coordinates,
and probably could be made more efficient but oh well.

There are also several routines that display HL, none of which have I
right now, and few of which have I ever had success with for some
reason.  Look for DispHL (i think).

Cassady Roop

AtoDEC:		(crazy name, I know)
  ld h, 0
  ld l, a
  ld b, 3
  ld de, tempnum+2
atodecmain:
  call _hldiv10   		
  add a, 48       		;convert to char code
  ld (de), a       		;store it to temp space
  dec de
  djnz atodecmain
  ld hl, tempnum
  xor a
  add a, 48			;char code for zero
  cp (hl)
  jr nz, atodecdisp
  inc hl
  cp (hl)
  jr nz, atodecdisp
  inc hl
atodecdisp:
  call _vputs     		;display it at current pen coords
  ret
tempnum:
	.db $00,$00,$00,0


References: