Friday, July 06, 2007

Snasm: 65816

I've done most of the assembler stuff - not all, but most - to the point that I can now build simple programs. So I've built a simple 65816 program, and it appears to be falling over; and I've no idea why! These kinds of things suck coz I can't debug it at all - just try new things over and over until I get somewhere....

Heres the code....

opt prg
opt C64=START ; Insert BASIC header, and jump to start of the code
opt A65816 ; Set 65816 assembler mode

org $1000
longa off
longi off
clc ; Set processor to 65816
xce ; Set 16bit processor mode

rep #$30
longi on
longa on

lda #$0000
sta $20

lda $20
ldx #$1000
sta $0400,x
bne Here2

inc $20
jmp Here

If I dont put it into 16bit mode, it appears to work fine, but execute the rep #$30, and it dies.... I'm not sure why... If I didnt know better, Id say there was an interrupt going off - I wonder if the NMI's are still on....

No comments: