[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: apple ][ lo res mode colors?



In article <MMXXe.27$Tg5.103@news.oracle.com>,
 Martin Doherty <martin.doherty@undisclosed.com> wrote:
> [...]
> (I'm not sure which nibble corresponds 
> to the upper and lower pixels).
> Martin

Even rows use the low nibble and odd rows use the high nibble

F800: 4A        102  PLOT     LSR              ;Y-COORD/2
F801: 08        103           PHP              ;SAVE LSB IN CARRY
F802: 20 47 F8  104           JSR   GBASCALC   ;CALC BASE ADR IN GBASL,H
F805: 28        105           PLP              ;RESTORE LSB FROM CARRY
F806: A9 0F     106           LDA   #$0F       ;MASK $0F IF EVEN
F808: 90 02     107           BCC   RTMASK
F80A: 69 E0     108           ADC   #$E0       ;MASK $F0 IF ODD
F80C: 85 2E     109  RTMASK   STA   MASK
F80E: B1 26     110  PLOT1    LDA   (GBASL),Y  ;DATA
F810: 45 30     111           EOR   COLOR      ; EOR COLOR
F812: 25 2E     112           AND   MASK       ;  AND MASK
F814: 51 26     113           EOR   (GBASL),Y  ;   EOR DATA
F816: 91 26     114           STA   (GBASL),Y  ;    TO DATA
F818: 60        115           RTS

The LSR divides the Y-coordinate by two and saves the lowest bit in the 
carry. Later, the carry bit is used to determine which mask (#$0F or 
#$F0) will be used in this plot operation.

Any speculation on why Woz used ADC #$E0 at F80A instead of LDA #$F0?  
They both take two bytes and two cycles.

-- 
John
jmatthews at wright dot edu
www dot wright dot edu/~john.matthews/