|
I know that this is something wrong with the NMI code, because if I put rti before all the rest of the nmi code, it works fine. Now with this code it cause blue and black flicker. I cannot find the problem:
nmi: ldy #$01 sty $4016 dey sty $4016 ldx #$08
read_buttons: lda $4016 sta a.button, y iny dex bne read_buttons
ensure_one: lda #$01 and a.button, x sta a.button, x inx dey bne ensure_one
lda #$00 dec up.button beq up dec down.button beq down dec left.button beq left dec right.button beq right sta y.move sta x.move jmp obstructions
up: sta x.move lda #$f8 sta y.move jmp obstructions
down: sta x.move lda #$08 sta y.move jmp obstructions
left: sta y.move lda #$f8 sta x.move jmp obstructions
right: sta y.move lda #$08 sta x.move
obstructions: lda #$00 sta address_hi lda x.pos adc x.move sta address_lo lda y.pos adc y.move adc #004 sta temp ldx #$03 ldy #$02
set_address_x: lsr address_lo dex bne set_address_x
set_address_y: asl temp rol address_hi dey bne set_address_y
lda temp ora address_lo sta address_lo
clc lda #low(mapdata) adc address_lo sta address_lo lda #high(mapdata) adc address_hi sta address_hi
lda [address_lo], y tax dex bne delete_move jmp process
delete_move: lda #$00 sta y.move sta x.move
process: clc lda y.pos adc y.move sta y.pos sta sprite.y clc lda x.pos adc x.move sta x.pos sta sprite.x
jsr time
lda #$07 sta $4014
rti
time: jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime jsr eattime rts
eattime: jsr timehog jsr timehog jsr timehog jsr timehog jsr timehog jsr timehog jsr timehog jsr timehog jsr timehog jsr timehog jsr timehog jsr timehog jsr timehog jsr timehog jsr timehog jsr timehog jsr timehog jsr timehog jsr timehog jsr timehog jsr timehog jsr timehog jsr timehog jsr timehog rts
timehog: nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop nop rts
If you can help me, then thanks. ^_^
|