A86: Re: Help


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

A86: Re: Help




>Subject: A86: Help

Let's try some more descriptive subjects, ok?  ;-)

>
>Umm, how do i display the value of the "a" register?

I posted a routine to do this a few weeks, ago, but I'm posting it again for
everyone who missed it.  If you want to display A, call DispA.  If you want
to display HL, call DispHL.  The last line is a <jp _puts>, so it prints in
the big font.  If you need small font, change it to <jp _vputs>.  It prints
at the current cursor/pen position, to so change _curRow/_penCol
respectively before you call it.  It uses OP1 as a tempory buffer to store
the number as text, so if you need OP1 intact, change it to any 6 byte free
memory location.  _divHLby10 (.equ $4044) is the 86 name for the 85's
UNPACK_HL.  It's defined in the ACZ include files
(http://www.acz.org/programs/ACZinc.zip).

; in: a or hl = number to print at current cursor position
; out: value of A or HL printed in large font
; destroyed: AF, DE, HL, OP1  (23 bytes total)
DispA:
   ld l,a
   ld h,0
DispHL:
   ld de,_OP1+5
   sub a
   ld (de),a
 DispLoop:
   call _divHLby10
   add a,'0'
   dec de
   ld (de),a
   ld a,h
   or l
   jr nz,DispLoop
   ex de,hl
   jp _puts

--
David Phillips <david@acz.org>
http://www.acz.org/