1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2024-11-02 13:08:13 +00:00

Clean up DGRlib

This commit is contained in:
David Schmenk 2019-12-19 10:22:26 -08:00
parent 04139858fc
commit 72f7dea67f
6 changed files with 101 additions and 149 deletions

View File

@ -1,25 +1,17 @@
import dgr
import dgrlib
word[] dgrbuff
predef dgrPlotBuf(x, y, bufptr)#0
predef dgrHLinBuf(x1, x2, y, bufptr)#0
predef dgrVLinBuf(x, y1, y2, bufptr)#0
predef dgrBLTBuf(bufptr, x, y, width, height, src)#0
predef dgrTileBuf(bufptr, x, y, src)#0
predef dgrTileStrBuf(bufptr, x, y, tilestr, strlen, tilebuff)#0
predef dgrFillBuf(bufptr, x, y, tile)#0
predef dgrMode#1
predef txtMode#0
predef dgrShow(page)#1
predef dgrSwap#0
predef dgrDrawBuf(page)#0
predef dgrClearBuf(bufptr, clr)#0
predef dgrClear(clr)#0
predef dgrPlot(x, y)#0
predef dgrColor(clr)#0
predef dgrHLin(x1, x2, y)#0
predef dgrVLin(y1, y2, x)#0
predef dgrBLT(x, y, width, height, src)#0
predef dgrTile(x, y, src)#0
predef dgrTileStr(x, y, tilestr, strlen, tilebuff)#0
predef dgrFill(x, y, tile)#0
predef dgrClear(clr)#0
predef dgrMode#1
predef txtMode#0
predef dgrShow(page)#1
predef dgrSwap#0
predef dgrDrawBuf(page)#0
predef dgrColor(clr)#0
end

View File

@ -1,5 +1,4 @@
include "inc/cmdsys.plh"
sysflags restxt1|restxt2|resxtxt1|resxtxt2 // Reserve all text pages
//
// Apple II hardware constants.
//
@ -51,13 +50,13 @@ end
//
// Plot pixel
//
export asm dgrPlotBuf(bufptr, x, y)#0
; GET BUFFER ADDRESS
STX ESP
LDA ESTKL+2,X
export asm dgrPlot(x, y)#0
; GET ROW BUFFER ADDRESSES
LDA $3000
STA SRCL
LDA ESTKH+2,X
STA SRCH
LDA $3001
STA SRCH
STX ESP
LDA ESTKL,X ; Y COORD
AND #$FE
TAY
@ -78,29 +77,21 @@ asm _dgrPlotPix
LDX ESP
INX
INX
INX
RTS
end
//
// Plot horizontal row of pixels
//
export asm dgrHLin(x1, x2, y)#0
DEX
LDA $3000
STA ESTKL,X
LDA $3001
STA ESTKH,X
end
export asm dgrHLinBuf(x1, x2, y, bufptr)#0
; GET BUFFER ADDRESS
STX ESP
LDA ESTKL,X
; GET ROW BUFFER ADDRESSES
LDA $3000
STA SRCL
LDA ESTKH,X
STA SRCH
LDA ESTKL+2,X ; X2 COORD
LDA $3001
STA SRCH
STX ESP
LDA ESTKL+1,X ; X2 COORD
STA TMPH
LDA ESTKL+1,X ; Y COORD
LDA ESTKL+0,X ; Y COORD
AND #$FE
TAY
LDA (SRC),Y
@ -108,10 +99,10 @@ export asm dgrHLinBuf(x1, x2, y, bufptr)#0
INY
LDA (SRC),Y
STA GBASH
LDY ESTKL+3,X ; X1 COORD
LDY ESTKL+2,X ; X1 COORD
PHP
SEI
- LDA ESTKL+1,X ; Y COORD
- LDA ESTKL+0,X ; Y COORD
LSR
TYA
LDX GCLR ; COLOR
@ -119,8 +110,8 @@ end
asm _dgrHLinPix
JSR $3000 ; _dgrSetPix
LDX ESP
INC ESTKL+3,X ; X1 COORD
LDY ESTKL+3,X
INC ESTKL+2,X ; X1 COORD
LDY ESTKL+2,X
CPY TMPH ; X2 COORD
BCC -
BEQ -
@ -128,27 +119,19 @@ asm _dgrHLinPix
INX
INX
INX
INX
RTS
end
//
// Plot horizontal row of pixels
//
export asm dgrVLin(y1, y2, x)#0
DEX
LDA $3000
STA ESTKL,X
LDA $3001
STA ESTKH,X
end
export asm dgrVLinBuf(y1, y2, x, bufptr)#0
; GET BUFFER ADDRESS
STX ESP
LDA ESTKL,X
; GET ROW BUFFER ADDRESSES
LDA $3000
STA SRCL
LDA ESTKH,X
STA SRCH
LDA ESTKL+3,X ; Y1 COORD
LDA $3001
STA SRCH
STX ESP
LDA ESTKL+2,X ; Y1 COORD
PHP
SEI
- AND #$FE
@ -158,38 +141,38 @@ export asm dgrVLinBuf(y1, y2, x, bufptr)#0
INY
LDA (SRC),Y
STA GBASH
LDA ESTKL+3,X
LDA ESTKL+2,X
LSR
LDA ESTKL+1,X ; X COORD
LDA ESTKL+0,X ; X COORD
LDX GCLR ; COLOR
end
asm _dgrVLinPix
JSR $3000 ; _dgrSetPix
LDX ESP
INC ESTKL+3,X ; Y1 COORD
LDA ESTKL+3,X
CMP ESTKL+2,X ; Y2 COORD
INC ESTKL+2,X ; Y1 COORD
LDA ESTKL+2,X
CMP ESTKL+1,X ; Y2 COORD
BCC -
BEQ -
PLP
INX
INX
INX
INX
RTS
end
//
// Draw sprite
//
export asm dgrBLTBuf(bufptr, x, y, width, height, src)#0
export asm dgrBLT(x, y, width, height, src)#0
; GET ROW BUFFER ADDRESSES
LDA $3000
STA DSTL
LDA $3001
STA DSTH
LDA ESTKL,X ; SPRITE
STA SRCL
LDA ESTKH,X
STA SRCH
LDA ESTKL+5,X
STA DSTL
LDA ESTKH+5,X
STA DSTH
LDA ESTKL+4,X ; X1 COORD
CMP #80
BPL ++++
@ -261,7 +244,6 @@ asm _dgrBLTPix
INX
INX
INX
INX
RTS
end
//
@ -342,16 +324,17 @@ end
//
// Draw 8x8 tile (forced to 2x2 block address)
//
export asm dgrTileBuf(bufptr, x, y, src)#0
export asm dgrTile(x, y, src)#0
; GET ROW BUFFER ADDRESSES
LDA $3000
STA DSTL
LDA $3001
STA DSTH
STX ESP
LDA ESTKL,X ; TILE
STA SRCL
LDA ESTKH,X
STA SRCH
LDA ESTKL+3,X
STA DSTL
LDA ESTKH+3,X
STA DSTH
LDA ESTKL+2,X ; X1 COORD
CMP #80
BPL ++++
@ -421,7 +404,6 @@ export asm dgrTileBuf(bufptr, x, y, src)#0
CMP ESTKH+1,X ; Y2 COORD
BCC -
++++ INX
INX
INX
INX
RTS
@ -429,22 +411,17 @@ end
//
// Draw a string of tiles
//
export asm dgrTileStrBuf(bufptr, x, y, tilestr, strlen, tilebuff)#0
export asm dgrTileStr(x, y, tilestr, strlen, tilebuff)#0
- DEX
DEX
DEX
DEX
LDA ESTKL+9,X ; BUFF
STA ESTKL+3,X
LDA ESTKH+9,X
STA ESTKH+3,X
LDA ESTKL+8,X ; X COORD
LDA ESTKL+7,X ; X COORD
STA ESTKL+2,X
LDA ESTKL+7,X ; Y COORD
LDA ESTKL+6,X ; Y COORD
STA ESTKL+1,X
LDA ESTKL+4,X ; TILE
LDA ESTKL+3,X ; TILE
STA ESTKL,X
LDA ESTKH+4,X ; TILE
LDA ESTKH+3,X ; TILE
STA ESTKH,X
end
asm _dgrTileTile
@ -457,16 +434,17 @@ asm _dgrTileTile
STA ESTKL+4,X
DEC ESTKL+1,X ; DEC STRLEN
BNE -
+ TXA
CLC
ADC #6
TAX
+ INX
INX
INX
INX
INX
RTS
end
//
// Fill a buffer with tiles
//
export asm dgrFillBuf(bufptr, x, y, tile)#0
export asm dgrFill(x, y, tile)#0
LDA ESTKL+2,X
AND #$0F
STA ESTKL+2,X
@ -485,18 +463,13 @@ export asm dgrFillBuf(bufptr, x, y, tile)#0
- DEX
DEX
DEX
DEX
LDA ESTKL+7,X ; BUFF
STA ESTKL+3,X
LDA ESTKH+7,X
STA ESTKH+3,X
LDA ESTKL+6,X ; X COORD
LDA ESTKL+5,X ; X COORD
STA ESTKL+2,X
LDA ESTKL+5,X ; Y COORD
LDA ESTKL+4,X ; Y COORD
STA ESTKL+1,X
LDA ESTKL+4,X ; TILE
LDA ESTKL+3,X ; TILE
STA ESTKL,X
LDA ESTKH+4,X ; TILE
LDA ESTKH+3,X ; TILE
STA ESTKH,X
end
asm _dgrFillTile
@ -518,7 +491,6 @@ asm _dgrFillTile
INX
INX
INX
INX
RTS
end
//
@ -532,6 +504,16 @@ asm vlbWait#0
RTS
end
//
// Clear the buffer
//
export def dgrClear(clr)#0
byte[32] clrtile
clr = evnclr[clr&$0F] | (oddclr[clr&$0F] << 8)
memset(@clrtile, clr, 32)
dgrFill(0, 0, @clrtile)
end
//
// Set double lores graphics, return draw buffer
//
export def dgrMode#1
@ -582,41 +564,6 @@ export def dgrColor(clr)#0
^$30 = clr & $0F
end
//
// Clear the buffer
//
export def dgrClearBuf(bufptr, clr)#0
byte[32] clrtile
clr = evnclr[clr&$0F] | (oddclr[clr&$0F] << 8)
memset(@clrtile, clr, 32)
dgrFillBuf(bufptr, 0, 0, @clrtile)
end
export def dgrClear(clr)#0
byte[32] clrtile
clr = evnclr[clr&$0F] | (oddclr[clr&$0F] << 8)
memset(@clrtile, clr, 32)
dgrFillBuf(drawbufptr, 0, 0, @clrtile)
end
//
// Draw functions
//
export def dgrPlot(x, y)#0
dgrPlotBuf(drawbufptr, x, y)
end
export def dgrBLT(x, y, width, height, src)#0
dgrBLTBuf(drawbufptr, x, y, width, height, src)
end
export def dgrTile(x, y, src)#0
dgrTileBuf(drawbufptr, x, y, src)
end
export def dgrTileStr(x, y, tilestr, strlen, tilebuff)#0
dgrTileStrBuf(drawbufptr, x, y, tilestr, strlen, tilebuff)
end
export def dgrFill(x, y, tile)#0
dgrFillBuf(drawbufptr, x, y, tile)
end
//
// Make sure we are a 128K //e or //c
//
if MACHID & $F0 <> $B0
@ -632,8 +579,8 @@ _dgrPlotPix:1 = @_dgrSetPix
_dgrHLinPix:1 = @_dgrSetPix
_dgrVLinPix:1 = @_dgrSetPix
_dgrBLTPix:1 = @_dgrSetPix
_dgrTileTile:1 = @dgrTileBuf
_dgrFillTile:1 = @dgrTileBuf
_dgrTileTile:1 = @dgrTile
_dgrFillTile:1 = @dgrTile
_dgrSetEvnEvn:1 = @evnclr
_dgrSetEvnOdd:1 = @oddclr
_dgrSetOddEvn:1 = @evnclr
@ -641,10 +588,16 @@ _dgrSetOddOdd:1 = @oddclr
//
// Fixups for drawbufptr
//
dgrHLin:2 = @drawbufptr
dgrHLin:7 = @drawbufptr+1
dgrVLin:2 = @drawbufptr
dgrVLin:7 = @drawbufptr+1
dgrPlot:1 = @drawbufptr
dgrPlot:6 = @drawbufptr+1
dgrHLin:1 = @drawbufptr
dgrHLin:6 = @drawbufptr+1
dgrVLin:1 = @drawbufptr
dgrVLin:6 = @drawbufptr+1
dgrBLT:1 = @drawbufptr
dgrBLT:6 = @drawbufptr+1
dgrTile:1 = @drawbufptr
dgrTile:6 = @drawbufptr+1
// Put read AUX mem routine in scary location
memcpy($0100, @auxRead, 9)
done

View File

@ -1,7 +1,12 @@
include "inc/cmdsys.plh"
var hspan, vspan
predef nopLin(a, b, c)#0
var hspan = @nopLin
var vspan = @nopLin
var err, shorterr, shortlen, longerr, longlen
def nopLin(a, b, c)#0
end
export def setlinespans(h, v)#0
hspan = h
vspan = v

View File

@ -47,7 +47,7 @@ INET = rel/INET\#FE1000
DHCP = rel/DHCP\#FE1000
HTTPD = rel/HTTPD\#FE1000
TFTPD = rel/TFTPD\#FE1000
DGR = rel/apple/DGR\#FE1000
DGRLIB = rel/apple/DGRLIB\#FE1000
LINESPANS = rel/apple/LINESPANS\#FE1000
GRAFIX = rel/apple/GRAFIX\#FE1000
GFXDEMO = rel/apple/GFXDEMO\#FE1000
@ -88,7 +88,7 @@ TXTTYPE = .TXT
#SYSTYPE = \#FF2000
#TXTTYPE = \#040000
apple: $(PLVMZP_APL) $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVMJIT) $(PLVM802) $(PLVM03) $(CMD) $(CMDJIT) $(JIT) $(JIT16) $(JITUNE) $(SOSCMD) $(PLASMAPLASM) $(CODEOPT) $(ARGS) $(MEMMGR) $(MEMTEST) $(FIBER) $(FIBERTEST) $(LONGJMP) $(ED) $(MON) $(SOS) $(ROD) $(SIEVE) $(PRIMEGAP) $(MOUSE) $(UTHERNET2) $(UTHERNET) $(ETHERIP) $(INET) $(DHCP) $(HTTPD) $(TFTPD) $(ROGUE) $(ROGUEMAP) $(ROGUECOMBAT) $(GRAFIX) $(GFXDEMO) $(LINESPANS) $(DGR) $(DGRTEST) $(HGRTEST) $(FILEIO_APL) $(CONIO_APL) $(JOYBUZZ) $(PORTIO) $(SPIPORT) $(SDFAT) $(FATCAT) $(FATGET) $(FATPUT) $(FATWDSK) $(FATRDSK) $(SANE) $(FPSTR) $(FPU) $(SANITY) $(LZ4) $(LZ4CAT) $(RPNCALC) $(SNDSEQ) $(PLAYSEQ)
apple: $(PLVMZP_APL) $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVMJIT) $(PLVM802) $(PLVM03) $(CMD) $(CMDJIT) $(JIT) $(JIT16) $(JITUNE) $(SOSCMD) $(PLASMAPLASM) $(CODEOPT) $(ARGS) $(MEMMGR) $(MEMTEST) $(FIBER) $(FIBERTEST) $(LONGJMP) $(ED) $(MON) $(SOS) $(ROD) $(SIEVE) $(PRIMEGAP) $(MOUSE) $(UTHERNET2) $(UTHERNET) $(ETHERIP) $(INET) $(DHCP) $(HTTPD) $(TFTPD) $(ROGUE) $(ROGUEMAP) $(ROGUECOMBAT) $(GRAFIX) $(GFXDEMO) $(LINESPANS) $(DGRLIB) $(DGRTEST) $(HGRTEST) $(FILEIO_APL) $(CONIO_APL) $(JOYBUZZ) $(PORTIO) $(SPIPORT) $(SDFAT) $(FATCAT) $(FATGET) $(FATPUT) $(FATWDSK) $(FATRDSK) $(SANE) $(FPSTR) $(FPU) $(SANITY) $(LZ4) $(LZ4CAT) $(RPNCALC) $(SNDSEQ) $(PLAYSEQ)
-rm vmsrc/plvmzp.inc
c64: $(PLVMZP_C64) $(PLASM) $(PLVM) $(PLVMC64)
@ -382,9 +382,9 @@ $(PORTIO): libsrc/apple/portio.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/portio.pla > libsrc/apple/portio.a
acme --setpc 4094 -o $(PORTIO) libsrc/apple/portio.a
$(DGR): libsrc/apple/dgr.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/dgr.pla > libsrc/apple/dgr.a
acme --setpc 4094 -o $(DGR) libsrc/apple/dgr.a
$(DGRLIB): libsrc/apple/dgrlib.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/dgrlib.pla > libsrc/apple/dgrlib.a
acme --setpc 4094 -o $(DGRLIB) libsrc/apple/dgrlib.a
$(DGRTEST): samplesrc/dgrtest.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/dgrtest.pla > samplesrc/dgrtest.a

View File

@ -10,7 +10,7 @@ mkdir prodos/sys
cp rel/apple/FILEIO#FE1000 prodos/sys/FILEIO.REL
cp rel/apple/CONIO#FE1000 prodos/sys/CONIO.REL
cp rel/apple/LINESPANS#FE1000 prodos/sys/LINESPANS.REL
cp rel/apple/DGR#FE1000 prodos/sys/DGR.REL
cp rel/apple/DGRLIB#FE1000 prodos/sys/DGRLIB.REL
cp rel/ARGS#FE1000 prodos/sys/ARGS.REL
cp rel/ED#FE1000 prodos/sys/ED.REL
cp rel/FIBER#FE1000 prodos/sys/FIBER.REL
@ -138,7 +138,7 @@ cp inc/args.plh prodos/bld/inc/ARGS.PLH.TXT
cp inc/cmdsys.plh prodos/bld/inc/CMDSYS.PLH.TXT
cp inc/conio.plh prodos/bld/inc/CONIO.PLH.TXT
cp inc/linespans.plh prodos/bld/inc/LINESPANS.PLH.TXT
cp inc/dgr.plh prodos/bld/inc/DGR.PLH.TXT
cp inc/dgrlib.plh prodos/bld/inc/DGRLIB.PLH.TXT
cp inc/fiber.plh prodos/bld/inc/FIBER.PLH.TXT
cp inc/fileio.plh prodos/bld/inc/FILEIO.PLH.TXT
cp inc/fpstr.plh prodos/bld/inc/FPSTR.PLH.TXT

View File

@ -1,5 +1,7 @@
include "inc/dgr.plh"
include "inc/cmdsys.plh"
include "inc/dgrlib.plh"
include "inc/linespans.plh"
sysflags restxt1|restxt2|resxtxt1|resxtxt2 // Reserve all text pages
byte[] sprite1 = $80,$80,$00,$00,$00,$00,$80,$80
byte[] = $80,$00,$0A,$0A,$0A,$0A,$00,$80