phantom bits?
-
jeffythedragonslayer
- Posts: 114
- Joined: 03 Oct 2021
phantom bits?
What is a phantom bit? I see that the e bit on the 65816 is referred to as a "phantom" bit. Does it not actually exist as flip flop in hardware anywhere?
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: phantom bits?
It exists, but since the processor-status register P is only 8 bits wide and there are 9 status bits on the '816 and the emulation bit is seldom accessed or needed to be pushed and pulled, you have to set or clear the carry bit and then exchange it with the emulation bit with XCE.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
-
jeffythedragonslayer
- Posts: 114
- Joined: 03 Oct 2021
Re: phantom bits?
Ok thanks, so it's like musical chairs trying to cram more bits in there.
- BigDumbDinosaur
- Posts: 9426
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: phantom bits?
jeffythedragonslayer wrote:
Ok thanks, so it's like musical chairs trying to cram more bits in there.
Correct.
The reason SR (aka P, which it is hardly ever called in machine language monitors) is 8-bits wide has to do with the 65C02 emulation mode and Apple's influence (meddling, some might say) in the 65C816's design process. Already having a 16-bit ALU, it would have been trivial to give the 816 a 16-bit SR and thus expose the e bit as a separate entity. However, that would have meant SR would always be a 16-bit register, even in emulation mode. Ergo emulation mode would not have been (almost-true) CO2 emulation, as the sequence of PHP - PLA, for instance, would have not worked as it would in a real 65C02.
As Garth noted, software seldom does anything with e. Most native-mode software immediately switches the 816 to native mode with the CLC - XCE sequence, and that is the only time e is touched. As the 816 comes out of reset in emulation mode, the programmer doesn't have to do anything if he wants to stay in emulation mode.
x86? We ain't got no x86. We don't NEED no stinking x86!
-
jeffythedragonslayer
- Posts: 114
- Joined: 03 Oct 2021
Re: phantom bits?
Cool. I suppose the B flag is another one of these phantom bits?
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: phantom bits?
Not in the same way. The b flag is only a position in the status byte pushed onto the stack when there's an interrupt, so you can tell, by reading the stacked status byte, if the interrupt was caused by a BReaK instruction. (See my 6502 interrupts primer.) The e flag does exist on the processor though.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
- BigDumbDinosaur
- Posts: 9426
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: phantom bits?
GARTHWILSON wrote:
Not in the same way. The b flag is only a position in the status byte pushed onto the stack when there's an interrupt, so you can tell, by reading the stacked status byte, if the interrupt was caused by a BReaK instruction. (See my 6502 interrupts primer.) The e flag does exist on the processor though.
Since the 65C816 has no b bit in native mode, it differentiates between an IRQ and a BRK instruction by giving the two separate vectors. Hence the stack sniffing required in a 65C02 interrupt handler to figure out if the interrupt was hardware or software is unnecessary.
x86? We ain't got no x86. We don't NEED no stinking x86!
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: phantom bits?
...further improving the efficiency of the '816.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
- BigDumbDinosaur
- Posts: 9426
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: phantom bits?
GARTHWILSON wrote:
...further improving the efficiency of the '816.
x86? We ain't got no x86. We don't NEED no stinking x86!