I was looking through Akumajou Densetsu's code and the reset code has a subroutine with sound initialization (most likely) at the end of it. What is weird about it is that after each register write it jumps to a subroutine that consists of nothing but NOP. Does anyone have some sort of explanation for this and does it have any functional purpose?
EDIT:
This is somewhat off topic from the original question, but I'm going to add this here anyway.
After the reset routine the game seems to go to the following loop:
As far as I can tell, there is no "break condition" meaning it'll be stuck doing that. NMI of course is a temporary break, but it'll return there after NMI is done. Is this game doing all game logic in NMI and using the non NMI time to wait for new NMI to happen? Or is there some other purpose to this? I haven't seen the game do anything else outside NMI so far.
Code:
...
LDA #$30
STA P1_VOLUME
JSR NoOperation
STA P2_VOLUME
JSR NoOperation
STA NOI_VOLUME
JSR NoOperation
LDA #$7F
STA P1_SWEEP
JSR NoOperation
STA P2_SWEEP
JSR NoOperation
LDA #$00
STA VRC6_P1_VOLUME
JSR NoOperation
STA VRC6_P2_VOLUME
JSR NoOperation
STA VRC6_SAW_VOLUME
JSR NoOperation
LDA #$0F
STA APU_STATUS
JSR NoOperation
RTS
NoOperation:
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
RTS
LDA #$30
STA P1_VOLUME
JSR NoOperation
STA P2_VOLUME
JSR NoOperation
STA NOI_VOLUME
JSR NoOperation
LDA #$7F
STA P1_SWEEP
JSR NoOperation
STA P2_SWEEP
JSR NoOperation
LDA #$00
STA VRC6_P1_VOLUME
JSR NoOperation
STA VRC6_P2_VOLUME
JSR NoOperation
STA VRC6_SAW_VOLUME
JSR NoOperation
LDA #$0F
STA APU_STATUS
JSR NoOperation
RTS
NoOperation:
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
RTS
EDIT:
This is somewhat off topic from the original question, but I'm going to add this here anyway.
After the reset routine the game seems to go to the following loop:
Code:
Loop:
INC $0020
CLC
LDA $0020
ADC $001B
STA $0020
JMP Loop
INC $0020
CLC
LDA $0020
ADC $001B
STA $0020
JMP Loop
As far as I can tell, there is no "break condition" meaning it'll be stuck doing that. NMI of course is a temporary break, but it'll return there after NMI is done. Is this game doing all game logic in NMI and using the non NMI time to wait for new NMI to happen? Or is there some other purpose to this? I haven't seen the game do anything else outside NMI so far.