This is correct ? please tell me why. gentleman/lady thanks
BRK same as NOP in 2A03, right?
Moderator: Moderators
BRK same as NOP in 2A03, right?
http://www.thealmightyguru.com/Games/Ha ... ?title=BRK
This is correct ? please tell me why. gentleman/lady thanks
This is correct ? please tell me why. gentleman/lady thanks
Re: BRK same as NOP in 2A03, right?
In 6502 processors, BRK ($00 xx) calls the IRQ handler once. If the IRQ handler is just RTI, then it's the same as a NOP that just takes longer to run. But games may use the IRQ handler as a crash handler or to control raster splits.
So that page is incorrect. I encourage regulars of this board to do a few things:
So that page is incorrect. I encourage regulars of this board to do a few things:
- Figure out what Dragon Warrior 4 is doing with BRK.
- Dig up a test ROM that exercises BRK.
- Request an account through e-mail. I just sent my request at 2016-03-18T17:22:00Z.
Re: BRK same as NOP in 2A03, right?
That information is completely wrong.xuling93 wrote:http://www.thealmightyguru.com/Games/Ha ... ?title=BRK
Re: BRK same as NOP in 2A03, right?
That BRK in Dragon Warrior 4 is probably an inline argument to the JSR before it, and not actually executed as an instruction.
- rainwarrior
- Posts: 8062
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: BRK same as NOP in 2A03, right?
No, it's a valid instruction. It calls the IRQ handler, if executed. (How would it be an "inline argument" to the JSR?)AWJ wrote:That BRK in Dragon Warrior 4 is probably an inline argument to the JSR before it, and not actually executed as an instruction.
Last edited by rainwarrior on Fri Mar 18, 2016 11:45 am, edited 1 time in total.
Re: BRK same as NOP in 2A03, right?
Information at said page is completely incorrect. Do not heed.
Re: BRK same as NOP in 2A03, right?
I think the implication was that the $00 byte at that address is never executed. Instead, it is treated as data, and the called subroutine increases the program counter on the stack to skip the data after using it. The MLI system call interface in Apple ProDOS uses the same trick: each JSR $BF00 is followed by a syscall number and a pointer to the parameter block.rainwarrior wrote:No, it's a valid instruction. It calls the IRQ handler, if executed. (How would it be an "inline argument" to the JSR?)AWJ wrote:That BRK in Dragon Warrior 4 is probably an inline argument to the JSR before it, and not actually executed as an instruction.
But the registration information came back fairly quickly. This leaves finding test ROMs that rely on BRK not being NOP.
-
russellsprouts
- Posts: 53
- Joined: Sun Jan 31, 2016 9:55 pm
Re: BRK same as NOP in 2A03, right?
I saw this page last summer when I was working on an emulator, with no prior knowledge of nes programming. It confused me quite a bit.
- rainwarrior
- Posts: 8062
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: BRK same as NOP in 2A03, right?
Yeah, that makes sense. I guess that's actually the most compact way to create arguments for a function.tepples wrote:...the called subroutine increases the program counter on the stack to skip the data after using it.
Of course, Dragon Warrior IV is not doing that:
Code: Select all
1F:C52F:A9 00 LDA #$00
1F:C531:85 1F STA $001F = #$00
1F:C533:8D 0A 05 STA $050A = #$00
1F:C536:8D 0B 05 STA $050B = #$00
1F:C539:8D 08 05 STA $0508 = #$00
1F:C53C:8D 09 05 STA $0509 = #$00
1F:C53F:8D 13 05 STA $0513 = #$02
1F:C542:60 RTSRe: BRK same as NOP in 2A03, right?
I did a bunch of Google searches, trying to identify the source of this strange / incorrect page about BRK.
All of the 6502 (or derivative) chips have functioning BRK instructions.
I think,maybe, the misinformation comes from the fact that the B flag isn't saved...
http://nesdev.com/the%20'B'%20flag%20&% ... uction.txt
And, perhaps the author felt that without a B flag, the interrupt wouldn't trigger. ?
But. It is the i flag thattriggers allows an interrupt, and that flag works fine.
Edit, also...its 7 cycles for BRK and 6 for RTI...so, not even close to 2 cycle NOP.
All of the 6502 (or derivative) chips have functioning BRK instructions.
I think,maybe, the misinformation comes from the fact that the B flag isn't saved...
http://nesdev.com/the%20'B'%20flag%20&% ... uction.txt
And, perhaps the author felt that without a B flag, the interrupt wouldn't trigger. ?
But. It is the i flag that
Edit, also...its 7 cycles for BRK and 6 for RTI...so, not even close to 2 cycle NOP.
nesdoug.com -- blog/tutorial on programming for the NES
Re: BRK same as NOP in 2A03, right?
Also...
Did anyone notice that I pointed out an error in a document on the nesdev page?
Did anyone notice that I pointed out an error in a document on the nesdev page?
nesdoug.com -- blog/tutorial on programming for the NES
- rainwarrior
- Posts: 8062
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: BRK same as NOP in 2A03, right?
I don't know why that page still exists. There's a ton of misinformation on it. At the very least if we don't want to just get rid of it, we could shuffle all that information to a secondary page so that the nesdev.com main page primarily links to the Forum / Wiki and maybe a little less prominent link to all those legacy documents.
Re: BRK same as NOP in 2A03, right?
Hiryu no Ken Special uses BRK for inter-bank subroutine calls. Other Culture Brain games might do so as well.
Re: BRK same as NOP in 2A03, right?
I've updated the wiki page in question. Keep an eye on it to see if my change gets reverted. I need to think of a plan for the front page of nesdev.com.
Re: BRK same as NOP in 2A03, right?
Blargg's NES CPU instruction tests contain a test a case for BRK: 15-brktepples wrote:This leaves finding test ROMs that rely on BRK not being NOP.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi