我正在为NES学习程序集,并且已经编写了以下程序:
.org $8000 ; set code to start of rom
Start: ; make a label called start
lda #$ff ; set acc to 0xff
sta $0000 ; store address 0x0000 to acc which is 0xff
jmp Start ; jump to label start
我用NESASM3编译了程序,编译成功,然后在模拟器中运行,当我转到模拟器中的内存查看器时,查看地址$ 0000,它是01,而不是FF,就像我将其编程为
答案 0 :(得分:4)
您的代码缺少大量信息,这些信息对于仿真器知道这是什么类型的ROM,以及让NES知道它应该在哪里开始执行是必需的。
一个工作示例可能看起来像这样(在FCEU中测试):
; ROM header
.inesprg 2 ; Two 16k PRG-ROM banks
.ineschr 1 ; One 8k CHR-ROM bank
.inesmir 1 ; Vertical mirroring
.inesmap 0 ; Mapper 0 (none)
.bank 0
.org $8000 ; set code to start of rom
Start: ; make a label called start
lda #$ff ; set acc to 0xff
sta $0000 ; store address 0x0000 to acc which is 0xff
jmp Start ; jump to label start
; Dummy interrupt handlers
nmi:
irq:
rti
; Specify reset and interrupt vectors
.bank 3 ; The .bank directive uses 8kB granularity, so bank 3
; is final 8kB chunk of our 32kB PRG-ROM.
.org $fffa
.dw nmi
.dw Start
.dw irq