diff --git a/applecorn.po b/applecorn.po index e0332a9..584e5b8 100644 Binary files a/applecorn.po and b/applecorn.po differ diff --git a/auxmem.init.s b/auxmem.init.s index 7759583..fe39cea 100644 --- a/auxmem.init.s +++ b/auxmem.init.s @@ -224,5 +224,5 @@ BYTE00 BEQ BYTE00A ; OSBYTE 0,0 - generate error RTS ; %000x1xxx host type, 'A'pple BYTE00A BRK DB $F7 -HELLO ASC 'Applecorn MOS 2022-01-12' +HELLO ASC 'Applecorn MOS 2022-01-13' DB $00 ; Unify MOS messages diff --git a/auxmem.shr.s b/auxmem.shr.s index 5543c4f..e52bda5 100644 --- a/auxmem.shr.s +++ b/auxmem.shr.s @@ -9,47 +9,6 @@ SCB320 EQU $00 ; SCB for 320 mode SCB640 EQU $80 ; SCB for 640 mode -* Colours in the following order. -* For 16 colour modes ... -* BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, ... -* For 4 colour modes ... -* BLACK, RED, YELLOW, WHITE - -* GB 0R -PALETTE320 DB $00, $00 ; BLACK - DB $00, $0F ; RED - DB $F0, $00 ; GREEN - DB $F0, $0F ; YELLOW - DB $0F, $00 ; BLUE - DB $0F, $0F ; MAGENTA - DB $FF, $00 ; CYAN - DB $FF, $0F ; WHITE - DB $44, $04 ; Dark grey - DB $88, $0F ; RED (light) - DB $F8, $08 ; GREEN (light) - DB $F8, $0F ; YELLOW (light) - DB $8F, $08 ; BLUE (light) - DB $8F, $0F ; MAGENTA (light) - DB $FF, $08 ; CYAN (light) - DB $AA, $0A ; Light grey - -PALETTE640 DB $00, $00 ; BLACK - DB $00, $0F ; RED - DB $F0, $0F ; YELLOW - DB $FF, $0F ; WHITE - DB $00, $00 ; BLACK - DB $00, $0F ; RED - DB $F0, $0F ; YELLOW - DB $F8, $0F ; WHITE - DB $00, $00 ; BLACK - DB $00, $0F ; RED - DB $F0, $0F ; YELLOW - DB $FF, $0F ; WHITE - DB $00, $00 ; BLACK - DB $00, $0F ; RED - DB $F0, $0F ; YELLOW - DB $FF, $0F ; WHITE - * Pixel masks for colours in 640 mode SHRCMASK640 DB %00000000 DB %01010101 @@ -742,81 +701,9 @@ SHRSETGCOL PHA >>> WRTAUX RTS -* Set up default palette -SHRDEFPAL LDY #00 ; Palette offset for 320 mode - LDA VDUPIXELS ; Pixels per byte - CMP #$02 ; 2 is 320-mode (MODE 1) - BEQ :S1 - LDY #32 ; Palette offset for 640 mode -:S1 LDX #$00 -:L1 LDA PALETTE320,Y ; Offset in Y computed above - STAL $E19E00,X ; Palettes begin at $9E00 in $E1 - INX - INY - CPX #32 ; 32 bytes in palette - BNE :L1 +* Wrapper to call SHRDEFPALM (which sets up default palette) +SHRDEFPAL >>> XF2MAIN,SHRDEFPALM +SHRDEFPALRET >>> ENTAUX RTS -* Assign a 'physical' colour from the 16 colour palette to a -* 'logical' colour for the current mode -* On entry: X=logical colour, Y=physical colour -SHRPALCHANGE TYA - AND #%00011110 ; Has already been shifted - TAY - LDA VDUPIXELS ; Pixels per byte - CMP #$02 ; 2 is 320-mode (MODE 1) - BEQ :MODE320 - TXA - AND #%00000110 ; Has already been shifted - TAX - LDA PALETTE320,Y ; Byte 1 of physical colour - STAL $E19E00,X ; Store in logical slot (4 copies) - STAL $E19E00+8,X - STAL $E19E00+16,X - STAL $E19E00+24,X - LDA PALETTE320+1,Y ; Byte 2 of physical colour - STAL $E19E00+1,X ; Store in logical slot (4 copies) - STAL $E19E00+9,X - STAL $E19E00+17,X - STAL $E19E00+25,X - RTS -:MODE320 TXA - AND #%00011110 ; Has already been shifted - TAX - LDA PALETTE320,Y ; Byte 1 of physical colour - STAL $E19E00,X ; Store in logical slot - LDA PALETTE320+1,Y ; Byte 2 of physical colour - STAL $E19E00+1,X ; Store in logical slot - RTS - - -* Assign a custom RGB colour to a 'logical' colour -* On entry: X=logical colour, A=GB components, Y=R component -SHRPALCUSTOM PHA ; Preserve GB components - LDA VDUPIXELS ; Pixels per byte - CMP #$02 ; 2 is 320-mode (MODE 1) - BEQ :MODE320 - TXA - AND #%00000110 ; Has already been shifted - TAX - PLA ; Recover GB components - STAL $E19E00,X ; Store in logical slot (4 copies) - STAL $E19E00+8,X - STAL $E19E00+16,X - STAL $E19E00+24,X - TYA ; R component - STAL $E19E00+1,X ; Store in logical slot (4 copies) - STAL $E19E00+9,X - STAL $E19E00+17,X - STAL $E19E00+25,X - RTS -:MODE320 TXA - AND #%00011110 ; Has already been shifted - TAX - PLA ; Recover GB components - STAL $E19E00,X ; Store in logical slot - TYA ; R component - STAL $E19E00+1,X ; Store in logical slot - RTS - diff --git a/auxmem.vdu.s b/auxmem.vdu.s index 2cb4dd8..2f30906 100644 --- a/auxmem.vdu.s +++ b/auxmem.vdu.s @@ -1102,7 +1102,8 @@ VDU19 LDA VDUQ+5 ; Second parm TAY ; Phys colour in X BIT VDUBANK ; Check if GS BPL :S1 ; If not, skip SHR call - JSR SHRPALCHANGE + TXA ; Copy log colour to A for call + >>> XF2MAIN,SHRPALCHANGE :S1 RTS :RGB LDA VDUQ+6 ; 3rd parm (red) AND #$0F @@ -1121,9 +1122,13 @@ VDU19 LDA VDUQ+5 ; Second parm AND #$0F ORA :TMP ; Green+Blue in A BIT VDUBANK ; Check if GS - BPL :S2 ; If not, skip SHR call - JSR SHRPALCUSTOM -:S2 RTS + BPL :S1 ; If not, just return + >>> WRTMAIN + STX SHRVDUQ ; Stash X for call to main + >>> WRTAUX + >>> XF2MAIN,SHRPALCUSTOM +VDU19RET >>> ENTAUX + RTS :TMP DB $00 diff --git a/mainmem.shr.s b/mainmem.shr.s index a0ddc27..2590494 100644 --- a/mainmem.shr.s +++ b/mainmem.shr.s @@ -33,6 +33,48 @@ SHRWINTOP EQU SHRZP+8 ; Gfx win - top (0-199) (word) SHRWINBTM EQU SHRZP+10 ; Gfx win - bottom (0-199) (word) +* Colours in the following order. +* For 16 colour modes ... +* BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, ... +* For 4 colour modes ... +* BLACK, RED, YELLOW, WHITE + +* GB 0R +PALETTE320 DB $00, $00 ; BLACK + DB $00, $0F ; RED + DB $F0, $00 ; GREEN + DB $F0, $0F ; YELLOW + DB $0F, $00 ; BLUE + DB $0F, $0F ; MAGENTA + DB $FF, $00 ; CYAN + DB $FF, $0F ; WHITE + DB $44, $04 ; Dark grey + DB $88, $0F ; RED (light) + DB $F8, $08 ; GREEN (light) + DB $F8, $0F ; YELLOW (light) + DB $8F, $08 ; BLUE (light) + DB $8F, $0F ; MAGENTA (light) + DB $FF, $08 ; CYAN (light) + DB $AA, $0A ; Light grey + +PALETTE640 DB $00, $00 ; BLACK + DB $00, $0F ; RED + DB $F0, $0F ; YELLOW + DB $FF, $0F ; WHITE + DB $00, $00 ; BLACK + DB $00, $0F ; RED + DB $F0, $0F ; YELLOW + DB $F8, $0F ; WHITE + DB $00, $00 ; BLACK + DB $00, $0F ; RED + DB $F0, $0F ; YELLOW + DB $FF, $0F ; WHITE + DB $00, $00 ; BLACK + DB $00, $0F ; RED + DB $F0, $0F ; YELLOW + DB $FF, $0F ; WHITE + + * Explode font to generate SHRFONTXPLD table * This is 2 bytes x 8 rows for each character in 640 mode * or 4 bytes x 8 rows for each character in 320 mode @@ -1330,6 +1372,90 @@ SHRVDU26 >>> ENTMAIN >>> XF2AUX,VDU26RET +* Set up default palette +SHRDEFPALM >>> ENTMAIN + LDY #00 ; Palette offset for 320 mode + LDA SHRPIXELS ; Pixels per byte + CMP #$02 ; 2 is 320-mode (MODE 1) + BEQ :S1 + LDY #32 ; Palette offset for 640 mode +:S1 LDX #$00 +:L1 LDA PALETTE320,Y ; Offset in Y computed above + STAL $E19E00,X ; Palettes begin at $9E00 in $E1 + INX + INY + CPX #32 ; 32 bytes in palette + BNE :L1 + >>> XF2AUX,SHRDEFPALRET + + +* Assign a 'physical' colour from the 16 colour palette to a +* 'logical' colour for the current mode +* On entry: A=logical colour, Y=physical colour +SHRPALCHANGE >>> ENTMAIN + TAX + TYA + AND #%00011110 ; Has already been shifted + TAY + LDA SHRPIXELS ; Pixels per byte + CMP #$02 ; 2 is 320-mode (MODE 1) + BEQ :MODE320 + TXA + AND #%00000110 ; Has already been shifted + TAX + LDA PALETTE320,Y ; Byte 1 of physical colour + STAL $E19E00,X ; Store in logical slot (4 copies) + STAL $E19E00+8,X + STAL $E19E00+16,X + STAL $E19E00+24,X + LDA PALETTE320+1,Y ; Byte 2 of physical colour + STAL $E19E00+1,X ; Store in logical slot (4 copies) + STAL $E19E00+9,X + STAL $E19E00+17,X + STAL $E19E00+25,X + RTS +:MODE320 TXA + AND #%00011110 ; Has already been shifted + TAX + LDA PALETTE320,Y ; Byte 1 of physical colour + STAL $E19E00,X ; Store in logical slot + LDA PALETTE320+1,Y ; Byte 2 of physical colour + STAL $E19E00+1,X ; Store in logical slot + >>> XF2AUX,VDU19RET + + +* Assign a custom RGB colour to a 'logical' colour +* On entry: A=GB components, Y=R component, SHRVDUQ=logical colour +SHRPALCUSTOM >>> ENTMAIN + LDX SHRVDUQ + PHA ; Preserve GB components + LDA SHRPIXELS ; Pixels per byte + CMP #$02 ; 2 is 320-mode (MODE 1) + BEQ :MODE320 + TXA + AND #%00000110 ; Has already been shifted + TAX + PLA ; Recover GB components + STAL $E19E00,X ; Store in logical slot (4 copies) + STAL $E19E00+8,X + STAL $E19E00+16,X + STAL $E19E00+24,X + TYA ; R component + STAL $E19E00+1,X ; Store in logical slot (4 copies) + STAL $E19E00+9,X + STAL $E19E00+17,X + STAL $E19E00+25,X + RTS +:MODE320 TXA + AND #%00011110 ; Has already been shifted + TAX + PLA ; Recover GB components + STAL $E19E00,X ; Store in logical slot + TYA ; R component + STAL $E19E00+1,X ; Store in logical slot + >>> XF2AUX,VDU19RET + + * Table of addresses of SHR rows (in reverse order) SHRROWSL DB <$9c60 DB <$9bc0