In the check frame area I'm just trying to see if i_frame is equal to 2 or not, if it is I'd like to do frame 2 stuff else if it's 1 it would drop through to do frame 1 stuff then skip over the do frame 2 stuff to the end, then be repeated.
So basically I'm having trouble with the check frame part of my code. I can get this to work with two 16-bit constants (there are lots of tutorials and examples of this) but not an 8-bit variable and an imediate number, any help would be appreciated,
Thanks, Brian

Code: Select all
; variables
i_frame .byte 1 ; starting frame
main_loop:
; check frame
LD A,(i_frame) ; get current frame
CP 2 ; compare to see if it's 2
OR A ; reset carry flag
JP Z,frame_2_do ; if so...
; ...if not continue here
; do frame 1 stuff
JP after_check_frame ; then jump to...
; ...jump to here
frame_2_do:
; do frame 2 stuff
after_check_frame: ; ...here
JP main_loop ; return to start