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

Mick Champion wrote:

> Sorry, I should have done PLP there as opposed to PLA. So if I wanted to 
> save A and its flags and do something else
> 
> PHA
> PHP
> //do other code
> PLA
> PLP

Sorry...

Think of it using "the traditional metaphor": It's a big stack of 
dishes, all piled up. You can put dishes on top, you can take off the 
top dish. You can't pull out dishes from elsewhere in the stack, or 
crockery will get broken and wife/girlfriend/mom/nosy-biddy-next-door 
will shout.


Your stack:
    .----------------.
    |----------------|
    |----------------|
    |----------------|
    |\/\/\/\/\/\/\/\/|

After PHA:
    .----------------.   <--- A is here
    |----------------|   <--- the rest of your stack
    |----------------|
    |----------------|
    |----------------|
    |\/\/\/\/\/\/\/\/|

After PHP:
    .----------------.   <--- Status is here
    |----------------|   <--- A is here
    |----------------|   <--- the rest of your stack
    |----------------|
    |----------------|
    |----------------|
    |\/\/\/\/\/\/\/\/|


I'm sure you see where this is going...

 > PLA
 > PLP

Must be:
   PLP     <--- status is the top thing on the stack, grab it first
   PLA     <--- then grab A

However, I am thinking that PLA might alter flags in response to what 
'A' is, which could maybe mess up the stored status? I don't know, might 
be better to PHP first and PLA last?

You see why "flags are difficult"? Hidden Gotchas. :-)


> could have been a lot smaller than it is though. Machine code is so much 
> faster than basic that it makes it worth while for many projects.

And if you plan to bit-bash (talk hardware), it is virtually indispensible.


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...
 >> 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 >>