diff --git a/images/apple/PLEIADES-2.21.po b/images/apple/PLEIADES-2.21.po index da5063f..1bfba06 100644 Binary files a/images/apple/PLEIADES-2.21.po and b/images/apple/PLEIADES-2.21.po differ diff --git a/src/libsrc/apple/shrlib.pla b/src/libsrc/apple/shrlib.pla deleted file mode 100644 index 418ccee..0000000 --- a/src/libsrc/apple/shrlib.pla +++ /dev/null @@ -1,183 +0,0 @@ -include "inc/cmdsys.plh" -// -// Apple II hardware constants. -// -const store80dis = $C000 -const store80en = $C001 -const vidctl = $C029 -const showgraphics = $C050 -const showtext = $C051 -const showfull = $C052 -const showmix = $C053 -const showpage1 = $C054 -const showpage2 = $C055 -const showlores = $C056 -const showhires = $C057 -const show40 = $C00C -const show80 = $C00D -const mapmain = $C000 -const mapaux = $C001 -const an3on = $C05E -const an3off = $C05F -const ena80 = $C07E -const dis80 = $C07F -const pixbuf = $2000 -const scbbuf = $9D00 -const palbuf = $9E00 -const scb640 = $80 // 640 PIXEL SUPER-HIRES -const scb320 = $00 // 320 PIXEL SUPER-HIRES - -word palette = $0000, $0007, $0070, $0077, $0700, $0707, $0770, $0 -word = $0CCC, $000F, $00F0, $00FF, $0F00, $0F0F, $0FF0, $0FFF - - -asm shrInc(buff) -!SOURCE "vmsrc/plvmzp.inc" -GBASL = $26 -GBASH = $27 -GBASE = GBASL -GCLR = $30 -STORE80DIS = $C000 -STORE80EN = $C001 -MAINWRT = $C004 -AUXWRT = $C005 -VIDCTL = $C029 -SHADOW = $C035 -end -// -// This gets copied to $0100!!! -// -asm auxRead - STA $C003 ; READ AUX MEM - LDA (GBASE),Y - STA $C002 ; READ MAIN MEM - RTS -end -// -// Peek byte from SHR memory -// -asm shrPeek(addr) - LDA ESTKL,X - STA GBASL - LDA ESTKH,X - STA GBASH - LDY #$00 - STY ESTKH,X - PHP - SEI - LDA SHADOW - AND #$F7 - STA SHADOW - JSR $0100 - STA ESTKL,X - LDA SHADOW - ORA #$08 - STA SHADOW - PLP - RTS -end -// -// Poke byte into SHR memory -// -asm shrPoke(addr, data)#0 - LDA ESTKL+1,X - STA GBASL - LDA ESTKH+1,X - STA GBASH - LDY #$00 - PHP - SEI - LDA SHADOW - AND #$F7 - STA SHADOW - LDA ESTKL+0,X - STA AUXWRT - STA (GBASE),Y - STA MAINWRT - LDA SHADOW - ORA #$08 - STA SHADOW - PLP - INX - INX - RTS -end -// -// Fill byte into SHR memory -// -asm shrFill(addr, data, len)#0 - LDA ESTKL+2,X - STA GBASL - LDA ESTKH+2,X - STA GBASH - LDY #$00 - PHP - SEI - LDA SHADOW - AND #$F7 - STA SHADOW - LDA ESTKL+1,X - STA AUXWRT -- STA (GBASE),Y - INY - BNE + - INC GBASH -+ DEC ESTKL+0,X - BNE - - DEC ESTKH+0,X - BNE - - STA MAINWRT - LDA SHADOW - ORA #$08 - STA SHADOW - PLP - INX - INX - RTS -end -export def shrPalette(pal, rgbptr)#0 - word palptr - byte i - - palptr = palbuf + pal * 32 - for i = 0 to 31 - shrPoke(palptr + i, ^(rgbptr + i)) - next -end -export def shrMode(mode)#0 - byte row, scb - if mode - // - // Set super hires graphics - // - if mode == 640 - scb = scb640 - else - scb = scb320 - fin - for row = 0 to 199 - shrPoke(scbbuf + row, scb) - shrRowPalette(row, palette) - next - ^store80dis = 0 // Turn off 80 column mode - ^vidctl = ^vidctl | $80 // Turn on SHR mode - return - fin - // - // Set text mode - // - ^vidctl = ^vidctl & $7F - ^showtext - ^showpage1 - ^ena80 = 0 - ^show40 = 0 - ^mapmain = 0 - ^an3off - call($FC58, 0, 0, 0, 0) // home() -end -// Put read AUX mem routine in scary location -memcpy($0100, @auxRead, 9) -// -// Keep module in memory -// -done diff --git a/src/mkrel b/src/mkrel index 9fd2c5c..e7fb153 100755 --- a/src/mkrel +++ b/src/mkrel @@ -275,3 +275,5 @@ cp inc/extheader.inc prodos/bld/inc/EXTHEADER.INC.TXT cp inc/extdefseg.inc prodos/bld/inc/EXTDEFSEG.INC.TXT make -f dhgr.tk/makefile all + +make -f shr.tk/makefile all diff --git a/src/shr.tk/inc/shrlib.plh b/src/shr.tk/inc/shrlib.plh new file mode 100644 index 0000000..7cc11de --- /dev/null +++ b/src/shr.tk/inc/shrlib.plh @@ -0,0 +1,10 @@ +import shrlib + predef shrPeek(addr)#1 + predef shrPoke(addr, data)#0 + predef shrSet(addr, data, len)#0 + predef shrPixel(x, y)#0 + predef shrColor(clr)#0 + predef shrSCB(row, scb)#0 + predef shrPalette(pal, rgbptr)#0 + predef shrMode(mode)#0 +end \ No newline at end of file diff --git a/src/shr.tk/libs/shrlib.pla b/src/shr.tk/libs/shrlib.pla new file mode 100644 index 0000000..69a91fc --- /dev/null +++ b/src/shr.tk/libs/shrlib.pla @@ -0,0 +1,199 @@ +include "inc/cmdsys.plh" +// +// Apple II hardware constants. +// +const vidctl = $C029 +const shadow = $C035 +const pixbuf = $2000 +const scbbuf = $9D00 +const palbuf = $9E00 +const scb640 = $80 // 640 PIXEL, PAL 0, NO INT +const scb320 = $00 // 320 PIXEL, PAL 0, NO INT, NO FILL + +word pal4BPP = $0000, $0007, $0070, $0077, $0700, $0707, $0770, $0777 +word = $0CCC, $000F, $00F0, $00FF, $0F00, $0F0F, $0FF0, $0FFF +word pal2BPP = $0000, $0777, $0CCC, $0FFF, $0000, $0777, $0CCC, $0FFF +word = $0000, $0777, $0CCC, $0FFF, $0000, $0777, $0CCC, $0FFF +byte mask4BPP = $F0, $0F +byte mask2BPP = $C0, $30, $0C, $03 +byte clr4BPPExp = $00, $11, $22, $33, $44, $55, $66, $77, $88, $99, $AA, $BB, $CC, $DD, $EE, $FF +byte clr2BPPExp = $00, $55, $AA, $FF +byte _clr +word shrScanline[200] + +asm shrInc(buff) +!SOURCE "vmsrc/apple/plvmzp.inc" +SHADOW = $C035 +MAINRD = $C002 +AUXRD = $C003 +MAINWRT = $C004 +AUXWRT = $C005 +end +// +// Peek byte from AUX memory +// This gets copied to $0100!!! +// +asm _auxPeek(addr)#1 + STA AUXRD ; $0100 + LDA (ESTKH-1,X) ; $0103 + STA MAINRD ; $0105 + RTS ; $0108 +end +asm _shrSetBits(addr, data, mask)#0 + LDY SHADOW ; $0109 + TYA + AND #$F7 + STA SHADOW + LDA ESTKL+2,X + STA ESTKH+1,X + LDA ESTKL+1,X + STA AUXRD + STA AUXWRT + EOR (ESTKH+1,X) + AND ESTKL+0,X + EOR (ESTKH+1,X) + STA (ESTKH+1,X) + STA MAINRD + STA MAINWRT + STY SHADOW + INX + INX + INX + RTS +end +export asm shrPeek(addr)#1 + LDY SHADOW + TYA + AND #$F7 + STA SHADOW + LDA ESTKL,X + STA ESTKH-1,X + JSR $0100 + STA ESTKL,X + STY SHADOW + LDY #$00 + STY ESTKH,X + RTS +end +export asm shrSetBits(addr, data, mask)#0 + JMP $0109 +end +// +// Poke byte into SHR memory +// +export asm shrPoke(addr, data)#0 + LDY SHADOW + TYA + AND #$F7 + STA SHADOW + LDA ESTKL+1,X + STA ESTKH+0,X + LDA ESTKL+0,X + STA AUXWRT + STA (ESTKH+0,X) + STA MAINWRT + STY SHADOW + INX + INX + RTS +end +export asm shrSet(addr, data, len)#0 + LDA SHADOW + AND #$F7 + STA SHADOW + LDY ESTKL+2,X + LDA #$00 + STA DSTL + LDA ESTKH+2,X + STA DSTH + LDA ESTKL+1,X + INC ESTKH+0,X + STA AUXWRT +- STA (DST),Y + INY + BNE + + INC DSTH ++ DEC ESTKL+0,X + BNE - + DEC ESTKH+0,X + BNE - + STA MAINWRT + LDA SHADOW + ORA #$08 + STA SHADOW + INX + INX + INX + RTS +end +export asm shrPixel(x, y)#0 + JMP $2000 +end +export asm shrColor(clr)#0 + JMP $2000 +end +def shrColor4BPP(clr)#0 + _clr = clr4BPPExp[clr & $0F] +end +def shrColor2BPP(clr)#0 + _clr = clr2BPPExp[clr & $03] +end +def shrPixel4BPP(x, y)#0 + shrSetBits(shrScanline[y] + (x >> 1), _clr, mask4BPP[x & 1]) +end +def shrPixel2BPP(x, y)#0 + shrSetBits(shrScanline[y] + (x >> 2), _clr, mask2BPP[x & 3]) +end +export def shrSCB(row, scb)#0 + shrPoke(scbbuf + row, scb) +end +export def shrPalette(idx, rgbptr)#0 + word palptr + byte i + + palptr = palbuf + idx * 32 + for i = 0 to 31 + shrPoke(palptr + i, ^(rgbptr + i)) + next +end +export def shrMode(mode)#0 + byte row, scb + + if mode + // + // Set super hires graphics + // + ^vidctl = ^vidctl | $C0 // Turn on linear SHR mode + if mode == 640 + scb = scb640 + *(@shrPixel + 1) = @shrPixel2BPP + *(@shrColor + 1) = @shrColor2BPP + shrPalette(0, @pal2BPP) + else + scb = scb320 + *(@shrPixel + 1) = @shrPixel4BPP + *(@shrColor + 1) = @shrColor4BPP + shrPalette(0, @pal4BPP) + fin + for row = 0 to 199 + shrScanline[row] = $2000 + row * 160 + shrPoke(scbbuf + row, scb) + next + shrSet(pixbuf, 0, $7D00) + else + // + // Set text mode + // + ^vidctl = ^vidctl & $3F + call($FC58, 0, 0, 0, 0) // home() + fin +end +// +// Put read AUX/SHR mem routines in scary location +// +memcpy($0100, @_auxPeek, @shrPeek - @_auxPeek) +// +// Keep module in memory +// +return modkeep +done diff --git a/src/shr.tk/makefile b/src/shr.tk/makefile new file mode 100644 index 0000000..0256053 --- /dev/null +++ b/src/shr.tk/makefile @@ -0,0 +1,22 @@ +.SUFFIXES = +AFLAGS = -o $@ + +SHRLIB = shr.tk/libs/SHRLIB.REL + +libs: $(SHRLIB) + cp $(SHRLIB) prodos/sys + +bld: $(SHRLIB) + -mkdir prodos/bld/shr.tk/ + -mkdir prodos/bld/shr.tk/inc/ + cp shr.tk/inc/shrlib.plh prodos/bld/shr.tk/inc/SHRLIB.PLH.TXT + cp shr.tk/shrtest.pla prodos/bld/shr.tk/SHRTEST.PLA.TXT + +all: libs bld + +clean: + +$(SHRLIB): shr.tk/libs/shrlib.pla shr.tk/inc/shrlib.plh + ./xplasm -AMOW shr.tk/libs/shrlib.pla + acme --setpc 4094 -o $(SHRLIB) shr.tk/libs/shrlib.a + diff --git a/src/shr.tk/shrtest.pla b/src/shr.tk/shrtest.pla new file mode 100644 index 0000000..ead457c --- /dev/null +++ b/src/shr.tk/shrtest.pla @@ -0,0 +1,31 @@ +include "inc/cmdsys.plh" +include "inc/lines.plh" +include "shr.tk/inc/shrlib.plh" + +////////////////////////////////////////// +// // +// Test Harness // +// // +////////////////////////////////////////// +def shrTest#0 + word i + + // + // Super Hires Lines + // + setlineplot(@shrPixel) + for i = 0 to 199 step 3 + shrColor(i) + line(0,0,319,i) + next + for i = 319 downto 0 step 3 + shrColor(i) + line(0,0,i,199) + next +end + +shrMode(320) +shrTest +getc +shrMode(0) +done