hello everyone, i'm making an FPGA-NES emulator and my "step one" goal is to run SMB.
Right now i've almost finish the cpu 6502 and decide to run a part of SMB for testing interrupts and instruments. my issues are below:
a few bytes i focus on in the PRG-ROM like this:
The signals showns on SignalTapII seem that the /RST works fine and the PC jumps to $8000 and loops between $800A-$800D because there's no PPU no VBlanks right now. this sequence seems work fine.
but when I try to test IRQ on this, the PC jumps to $FFF0 successfully, then i find the data around $FFF0 doesn't seem like instruments (musics or something else i guess, anyone who knows what's it would you plz tell me something?thx a lot.) and my cpu stoped at $FFF3 because $1A is not a offical opcode. so here come my questions:
1. Do NROM games like SMB NOT use IRQ?
2. when does an IRQ occur in NES subsystem? and what IRQs are used for? are there multiple IRQ sources(APU and mapper?)?
3. What really happens when cpu meets a undocumentd opcode? Is implementing undocumented opcodes necessary? (what i have already done is to let cpu stop and show the PC and opcode on the LEDs on my fpga board.)
thx!
Right now i've almost finish the cpu 6502 and decide to run a part of SMB for testing interrupts and instruments. my issues are below:
a few bytes i focus on in the PRG-ROM like this:
Code:
8000 : 78 sei ;
8001 : D8 cld ;
8002 : A9 10 lda #$10 ;
8004 : 8D 00 20 sta $2000 ;PPU 惂屼Reg.#1
8007 : A2 FF ldx #$FF ;
8009 : 9A txs ;
800A : AD 02 20 lda $2002 ;PPU Status Reg.
800D : 10 FB bpl $800A ;
...
...
FFE7 : 18 clc ;
FFE8 : 16 14 asl $14,x ;
FFEA : 15 16 ora $16,x ;
FFEC : 16 17 asl $17,x ;
FFEE : 17 db #$17 ;
FFEF : 18 clc ;
FFF0 : 19 19 1A ora $1A19,y ;
FFF3 : 1A db #$1A ;
FFF4 : 1C db #$1C ;
FFF5 : 1D 1D 1E ora $1E1D,x ;
FFF8 : 1E db #$1E ;
FFF9 : 1F db #$1F ;
FFFA : 82 80 dw $8082 ;NMI(VBlank)
FFFC : 00 80 dw $8000 ;Reset
FFFE : F0 FF dw $FFF0 ;IRQ/BRK
8001 : D8 cld ;
8002 : A9 10 lda #$10 ;
8004 : 8D 00 20 sta $2000 ;PPU 惂屼Reg.#1
8007 : A2 FF ldx #$FF ;
8009 : 9A txs ;
800A : AD 02 20 lda $2002 ;PPU Status Reg.
800D : 10 FB bpl $800A ;
...
...
FFE7 : 18 clc ;
FFE8 : 16 14 asl $14,x ;
FFEA : 15 16 ora $16,x ;
FFEC : 16 17 asl $17,x ;
FFEE : 17 db #$17 ;
FFEF : 18 clc ;
FFF0 : 19 19 1A ora $1A19,y ;
FFF3 : 1A db #$1A ;
FFF4 : 1C db #$1C ;
FFF5 : 1D 1D 1E ora $1E1D,x ;
FFF8 : 1E db #$1E ;
FFF9 : 1F db #$1F ;
FFFA : 82 80 dw $8082 ;NMI(VBlank)
FFFC : 00 80 dw $8000 ;Reset
FFFE : F0 FF dw $FFF0 ;IRQ/BRK
The signals showns on SignalTapII seem that the /RST works fine and the PC jumps to $8000 and loops between $800A-$800D because there's no PPU no VBlanks right now. this sequence seems work fine.
but when I try to test IRQ on this, the PC jumps to $FFF0 successfully, then i find the data around $FFF0 doesn't seem like instruments (musics or something else i guess, anyone who knows what's it would you plz tell me something?thx a lot.) and my cpu stoped at $FFF3 because $1A is not a offical opcode. so here come my questions:
1. Do NROM games like SMB NOT use IRQ?
2. when does an IRQ occur in NES subsystem? and what IRQs are used for? are there multiple IRQ sources(APU and mapper?)?
3. What really happens when cpu meets a undocumentd opcode? Is implementing undocumented opcodes necessary? (what i have already done is to let cpu stop and show the PC and opcode on the LEDs on my fpga board.)
thx!