Re: Debug DM_HL_DECI
[Prev][Next][Index][Thread]
Re: Debug DM_HL_DECI
On Fri, 15 Aug 1997 01:22:42 -0400, "Thomas J. Hruska"
<thruska@TIR.COM> wrote:
>After giving myself a headache, I have decided to release a section of my
>source from my "top secret" project. The only reason I'm doing this is
>because I need someone to debug it. This function works EXACTLY like the
>D_HL_DECI function except it has no whitespace and uses the small font. It
>works about 80% of the time. The rest of the time it crashes by running a
>series of digits on forever (i.e. when HL=510d). If anyone could fix it, I
>would appreciate it very much. TIA
> [snip loong code]
Ouch... that looked complicated... I won't even try to find the error.
You should make it something like this instead:
DM_HL_DECI:
push af
push de
push hl
ld de,string+5
xor a
ld (de),a
Repeat:
call UNPACK_HL
add a,'0'
dec de
ld (de),a
ld a,h
or l
jr nz,Repeat
ex de,hl
ROM_CALL(D_ZM_STR)
pop hl
pop de
pop af
ret
string is a 6 byte temporary storage.
Jimmy Merdell <mja@algonet.se>
http://www.algonet.se/~mja
References: