[A83] Re: ugly symbols with an directory list
[Prev][Next][Index][Thread]
[A83] Re: ugly symbols with an directory list
> into:
>
> push af
> ld a,(skipcounter)
> dec a ;is skipcounter=1?
> jr nz,badprog ;if no, skip this program
> pop af
>
> Now, I can see if a prgm is protected or not, but now, the program seems
> to
> make my calculator a bit messy, it seems to crash, and the program run
> strange after the first run. So how can I fix this? I think it has
> something
> to do with push af and pop af, because I haven't use the F register.
>
Ask yourself the question what happens if the jump is actually taken, and
when pop af will be executed in that case... To avoid corrupting the
stack, you could as well put the accumulator away into a memory variable
or an unused register:
ld (tempvar),a
ld a,(skipcounter)
dec a ; is skipcounter=1?
ld a,(tempvar) ; (you can do this, because it doesn't affect the flags)
jr nz,badprog ; if no, skip this program
An unused 8-bit register would be better though.
PG
--
http://www.fastmail.fm - Or how I learned to stop worrying and
love email again
Follow-Ups:
References: