Re: A83: NOW I REALLY DON'T KNOW WHAT'S GOING ON
[Prev][Next][Index][Thread]
Re: A83: NOW I REALLY DON'T KNOW WHAT'S GOING ON
Here is what's wrong...
> When I put this at the marked spot below, it unprotects the selected
> program. ITS SUPPOSED TO XOR THE FREAKIN PROGRAM STATUS, NOT UNPROTECT.
dec a ; 05h - 1 = 04h or 06h - 1 = 05h
cp PROTPROGOBJ ; 06h?
jp z,NextStep ; Never happen since it is 05h or 04h
ld a,PROGOBJ ; Always happens
> When I put this at the marked spot below, it protects the selected
> program. ITS SUPPOSED TO XOR THE FREAKIN PROGRAM STATUS, NOT PROTECT.
dec a ; 06h - 1 = 05h or 05h - 1 = 04h
cp PROGOBJ ; 05h?
jp z,NextStep ; If protected go on
ld a,PROTPROGOBJ ; If not then protect... therefore always
protected
You should use this to switch it back and forth:
cp PROGOBJ ;Unprotected?
jr z, protectIt ;If so, protectIt
ld a, PROGOBJ ;Else, Unprotect
jr NextStep ;Continue
protectIt:
ld a, PROTPROGOBJ ;Protect
BTW: It would be smaller code if you used jr instead of jp when it is
within 256 bytes of the jr. You should do like James said a while back
and turn your code to psuedo-code
-Revenant
References: