<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Wed, 25 Nov 2009 02:07:34 +0100
From   : rick@... (Rick Murray)
Subject: Quine

Anders Carlsson wrote:

> Machine code is tricky. It took me ten years to get going, and
> another five years before feeling safe enough to test the waters.

Machine code is easy. [*]

It's knowing how the flags work that causes untold distress and takes 
ages to get right.

Especially with the 6502 where you can't just add and subtract something 
from something. Oh no. You need to mess around with the Carry flag.


Open question to the floor:

This is mostly a minor thing, but a matter of small interest.

If a BRK instruction is executed, how/where/when is the B flag set? I 
have a source that says that BRK sets the B flag, and I have another 
that says the B flag doesn't actually exist, and it is only 'set' if 
necessary when the processor status is pushed to the stack.

I don't have suitable code on my Beeb to experiment, and I don't want to 
use an emulator or simulator as that might depend upon what the 
programmer thought should happen instead of what should happen.


This leads to another question. I, personally, like the "B flag doesn't 
really exist" theory, for ask yourself - what does the B flag represent? 
While the other flags set up a status that can be used in conditionals 
and such, or an option (Irq disable, Decimal mode), what does Break flag 
do except advise you of something?
Thus... if you:
   Push PS to the stack
   Pull that into Acc
   Set the B flag
   Push that to the stack
   Pull it into PS
(i.e. manually 'set' the B flag)
What happens?
What happens at the next interrupt?


Best wishes,

Rick.


* - very much so for the ARM, fairly for the 6502. I am led to believe 
that x86 code is a bit naff (not well planned), and the king of 
obscurity in consumer circles [#] is the ST20 which is used in some 
incarnation or other in the majority of digital satellite receivers, 
possibly DTT too.

# - that means "something you can buy today" to stop people pointing out 
freakishness like that processor from the 70s that worked with 12 bit 
words and had memory addressing like Beeb screenmodes.

-- 
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...
 >> TO PRIVATE MAIL ME, REMOVE [BBC-Micro] FROM SUBJECT <<
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>