Home  Search  Games  Tapes  Covers  Cheats  Maps  Software  New Stuff 
 Hall Of Fame  HVTC  Game Endings  Solutions  Remakes  Publications  Magazines  Effects  Top List 
 Members  Groups  Features  Plus/4 Encyclopedia  Hardware  Tools  Options  Forum 
Back to forumReply To This TopicGo to last reply

Posted By

on 2017-09-22
 The B flag doesn't exist! :)


Learned something interesting about the B "flag" recently. We all know that there are no CLB, SEB instructions to clear or set the B flag or any branch instructions to test it. The only way to inspect B is pushing the status register to the stack with PHP. Opps, but PHP always pushes B=1! BRK also pushes B=1 to the stack (naturally) and hardware interrupts push B=0, so we can distinguish between them in the interrupt handler by checking what is on the stack.

So, I suspected that there are no physical representation of the B flag in the CPU and it's state is not stored at all. It's just that for hardware interrupts B=0 is pushed on the stack, and that's all.

I turned out to be right, you can learn more about it on the excellent wiki:

Btw, I am writing a small python 6502 emulator what I will use in my projects to test/profile (maybe disassembly) machine code, it's early stage, but you can find it here:

Posted By

on 2017-09-22
 Re: The B flag doesn't exist! :)

Yes me too, I think it's a simple fork flag in order to use the same vector.
Maybe it was added as a last minute patch to solve the problem.

BTW any info regarding the unused(?) bit 5 of the PR?

Back to topReply To This Topic

Copyright © Plus/4 World Team, 2001-2018