<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Sun, 15 Mar 2009 17:48:34 -0000
From   : mfirth@... (Michael Firth)
Subject: BBC register shuffling

I'm looking to write some 6502 assembler to swap from the B/B+ 1770 control 
register format of:

      Bit       Meaning
        -----------------
        7,6       Not used.
         5        Reset drive controller chip.
         4        Interrupt ?
         3        Double density select (0 = double, 1 = single).
         2        Side select (0 = side 0, 1 = side 1).
         1        Drive select 1.
         0        Drive select 0.

to the Master control register format of:

        Bit       Meaning
        -----------------
        7,6       Not used.
         5        Double density select (0 = double, 1 = single).
         4        Side select (0 = side 0, 1 = side 1).
         3        Drive select 2.
         2        Reset drive controller chip.
         1        Drive select 1.
         0        Drive select 0.

Obviously (assuming the value is to start and finish in A) something 
primitive like:

PHA
AND #&03
STA temp_loc
PLA
PHA
AND #&0C
ROL A
ROL A
ORA temp_loc
STA temp_loc
PLA
AND #&20
ROR A
ROR A
ROR A
ORA temp_loc

would do the job, but does anyone have a better suggestion for the code?

Thanks

Michael 
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>