<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Tue, 24 Nov 2009 15:05:29 +0000
From   : rs423@... (Mick Champion)
Subject: Quine

Anders Carlsson wrote:
> Mick Champion wrote:
>
>   
>> PHP         /// save flags expecially carry
>> ASL &4011   /// could change carry flag
>> PLA         /// return old flags
>>     
>
> Actually you "download" the flags to the accumulator.
>   

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

?



>
>
> Depending on what preceeds your code, you may actually want this:
>
> PHP
> ASL &4011
> LDA &4011
> PLP
> ADC #0
> STA &4011
>   
Yes that would be it. :-)



> A summary of the instructions used above:
>
> ASL - changes N, Z and C
> LDA - changes N, Z
> ADC - takes C input, changes N, V, Z and C
> STA - changes no flags
> PHP - changes no flags
> PLP - changes all flags
> PLA - changes N, Z
>
> I can't recall anyone posting a link to the instruction set,
> so I'll contribute a non-Beeb one:
>
> http://nesdev.parodius.com/6502.txt
>   
Great. Page bookmarked.



> Machine code is tricky. It took me ten years to get going, and
> another five years before feeling safe enough to test the waters.
I've pretty much worked the little I know from a book and tips from 
members here. I did a terminal in assembly a long time ago though it was 
never any good as I didn't get all the ANSI coding right. Now I can't 
find all the assembly programs to see about improving it. I expect it 
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.


Mick.
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>