<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Fri, 23 Jul 2010 06:40:30 +0200
From   : rick@... (Rick Murray)
Subject: Spitting expletives

On 22/07/2010 18:54, Tom Walker wrote:

> Carry can be worked out as p.c=(a>=temp),

How does this work? A borrow occurs (carry clear) if the temp workspace 
value is less than Acc?
Surely it is if the calculated value is less than zero? Or am I missing 
something?


> Did notice you haven't attacked the BCD version, presumably that's
 > for sanity reasons.

Yes... and also because AFAIK the FileStore firmware does not make use 
of BCD, so there didn't seem to be much point including it.


> B is always set, except when pushed to the stack on an interrupt.

Mmmm... I don't think my code does that entirely correctly then.


--8<--------
The B flag
No actual "B" flag exists inside the 6502's processor status register. 
The B flag only exists in the status flag byte pushed to the stack. 
Naturally, when the flags are restored (via PLP or RTI), the B bit is 
discarded.

Depending on the means, the B status flag will be pushed to the stack as 
either 0 or 1.

software instructions BRK & PHP will push the B flag as being 1.
hardware interrupts IRQ & NMI will push the B flag as being 0.
--8<--------

BRK sets B, PHP sets B (it does now). IRQ/NMI do not set B, and when the 
status is popped off the stack, B is hardwired to false.

The snippet above is from:
 
http://nesdev.parodius.com/the%20%27B%27%20flag%20&%20BRK%20instruction.txt


B is ALWAYS set? I know PHP sets it, so:
   PHP
   PLA
will see the B flag set... but what about in normal code execution? 
Surely it is considered 'unset' except when flags are pushed to the 
stack in which case it is set except for an actual IRQ?


Best wishes,

Rick.

-- 
Rick Murray, eeePC901 & ADSL WiFI'd into it, all ETLAs!
BBC B: DNFS, 2 x 5.25" floppies, EPROM prog, Acorn TTX
E01S FileStore, A3000/A5000/RiscPC/various PCs/blahblah...
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>