hi all
our project aims to build a game which uses zapper, but unfortunately there is test code or tutorials explaining this. So, we started hunting to make a test code which just detects the white or black
when we click the mouse on screen.But I'm unable to make it work, as it is always detecting white even if we had pressed on black.
here is the code I have written.....
gun_trigger_check:
lda $4017
AND #%00010000
bne gun_triggered
rts
gun_triggered:
lda #2
sta #Detection_start
rts
check_white:
lda #Detection_start
cmp #2
bne dwn2rts
poll:
lda $4017
and #%00001000
beq white
JMP poll
white:
jsr duckmaro //// this code is executed if detected
dwn2rts rts
NMI:
jsr gun_trigger_check
jsr check_white
can anyone please tell me where the error is.....
thanks in advace....
our project aims to build a game which uses zapper, but unfortunately there is test code or tutorials explaining this. So, we started hunting to make a test code which just detects the white or black
when we click the mouse on screen.But I'm unable to make it work, as it is always detecting white even if we had pressed on black.
here is the code I have written.....
gun_trigger_check:
lda $4017
AND #%00010000
bne gun_triggered
rts
gun_triggered:
lda #2
sta #Detection_start
rts
check_white:
lda #Detection_start
cmp #2
bne dwn2rts
poll:
lda $4017
and #%00001000
beq white
JMP poll
white:
jsr duckmaro //// this code is executed if detected
dwn2rts rts
NMI:
jsr gun_trigger_check
jsr check_white
can anyone please tell me where the error is.....
thanks in advace....