A86: Re: Displaying a variable
[Prev][Next][Index][Thread]
A86: Re: Displaying a variable
here goes. I tried the code you sent me(included below) and it worked, except
for one minor problem. When it displays HL it always displays it towards the
bottom right hand corner, no matter what. I tried a <ld a,1><ld
(_curRow),a><ld (_curCol),a> right before the <call _vputs> but that didn't
do anything either. is there anyway to control where HL is displayed?
thanks,
BlAsTo1414
...
ld hl,MyVar
inc (hl)
call _ldhlind
call DisplayHL
...
;====================================================================
; DisplayHL: (idea from SCaBBy/Mardell) [Assembly Coder's Zenith]
; Display HL as a 5-digit decimal number with no leading zeros
; out: AF, HL, BC, DE destroyed
;====================================================================
DisplayHL:
ld c,'0' ; save ascii value for zero
ld de,_OP1+5 ; point to end of the buffer
xor a ; zero terminate string
ld (de),a ; set last byte to zero
DisplayHLl:
call UNPACK_HL ; next digit
dec de ; next position
add a,c ; convert to ascii
ld (de),a ; save digit
ld a,h ; load upper byte
or l ; check with lower byte for zero
jr nz,DisplayHLl ; loop
ex de,hl ; point to buffer
call _vputs ; print number
ret ; we're done