1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-03-27 18:35:06 +00:00

Fix XORing of BLT with ORing. Better COPY message and add ZIP Chip

utility
This commit is contained in:
Dave Schmenk 2020-01-04 12:52:31 -08:00
parent c1b6741cfd
commit 69733fd37f
8 changed files with 227 additions and 112 deletions

View File

@ -1,6 +1,7 @@
import hgrlib
predef divmod7(x)#2
predef hgrPlot(x, y)#0
predef hgrOrPlot(x, y)#0
predef hgrXorPlot(x, y)#0
predef hgrHLin(x1, x2, y)#0
predef hgrVLin(y1, y2, x)#0

View File

@ -17,6 +17,32 @@ const hgr2 = $4000
const page1 = 0
const page2 = 1
word hgrbuff[] = hgr1, hgr2
//word hgrscan[] = $0000,$0400,$0800,$0C00,$1000,$1400,$1800,$1C00
//word = $0080,$0480,$0880,$0C80,$1080,$1480,$1880,$1C80
//word = $0100,$0500,$0900,$0D00,$1100,$1500,$1900,$1D00
//word = $0180,$0580,$0980,$0D80,$1180,$1580,$1980,$1D80
//word = $0200,$0600,$0A00,$0E00,$1200,$1600,$1A00,$1E00
//word = $0280,$0680,$0A80,$0E80,$1280,$1680,$1A80,$1E80
//word = $0300,$0700,$0B00,$0F00,$1300,$1700,$1B00,$1F00
//word = $0380,$0780,$0B80,$0F80,$1380,$1780,$1B80,$1F80
//word = $0028,$0428,$0828,$0C28,$1028,$1428,$1828,$1C28
//word = $00A8,$04A8,$08A8,$0CA8,$10A8,$14A8,$18A8,$1CA8
//word = $0128,$0528,$0928,$0D28,$1128,$1528,$1928,$1D28
//word = $01A8,$05A8,$09A8,$0DA8,$11A8,$15A8,$19A8,$1DA8
//word = $0228,$0628,$0A28,$0E28,$1228,$1628,$1A28,$1E28
//word = $02A8,$06A8,$0AA8,$0EA8,$12A8,$16A8,$1AA8,$1EA8
//word = $0328,$0728,$0B28,$0F28,$1328,$1728,$1B28,$1F28
//word = $03A8,$07A8,$0BA8,$0FA8,$13A8,$17A8,$1BA8,$1FA8
//word = $0050,$0450,$0850,$0C50,$1050,$1450,$1850,$1C50
//word = $00D0,$04D0,$08D0,$0CD0,$10D0,$14D0,$18D0,$1CD0
//word = $0150,$0550,$0950,$0D50,$1150,$1550,$1950,$1D50
//word = $01D0,$05D0,$09D0,$0DD0,$11D0,$15D0,$19D0,$1DD0
//word = $0250,$0650,$0A50,$0E50,$1250,$1650,$1A50,$1E50
//word = $02D0,$06D0,$0AD0,$0ED0,$12D0,$16D0,$1AD0,$1ED0
//word = $0350,$0750,$0B50,$0F50,$1350,$1750,$1B50,$1F50
//word = $03D0,$07D0,$0BD0,$0FD0,$13D0,$17D0,$1BD0,$1FD0
//word hmask = $8081,$8082,$8084,$8088,$8090,$80A0,$80C0
//word = $8180,$8280,$8480,$8880,$9080,$A080,$C080
byte hgrscanl[]= $00,$00,$00,$00,$00,$00,$00,$00
byte = $80,$80,$80,$80,$80,$80,$80,$80
byte = $00,$00,$00,$00,$00,$00,$00,$00
@ -65,32 +91,6 @@ byte = $02,$06,$0A,$0E,$12,$16,$1A,$1E
byte = $02,$06,$0A,$0E,$12,$16,$1A,$1E
byte = $03,$07,$0B,$0F,$13,$17,$1B,$1F
byte = $03,$07,$0B,$0F,$13,$17,$1B,$1F
//word hgrscan[] = $0000,$0400,$0800,$0C00,$1000,$1400,$1800,$1C00
//word = $0080,$0480,$0880,$0C80,$1080,$1480,$1880,$1C80
//word = $0100,$0500,$0900,$0D00,$1100,$1500,$1900,$1D00
//word = $0180,$0580,$0980,$0D80,$1180,$1580,$1980,$1D80
//word = $0200,$0600,$0A00,$0E00,$1200,$1600,$1A00,$1E00
//word = $0280,$0680,$0A80,$0E80,$1280,$1680,$1A80,$1E80
//word = $0300,$0700,$0B00,$0F00,$1300,$1700,$1B00,$1F00
//word = $0380,$0780,$0B80,$0F80,$1380,$1780,$1B80,$1F80
//word = $0028,$0428,$0828,$0C28,$1028,$1428,$1828,$1C28
//word = $00A8,$04A8,$08A8,$0CA8,$10A8,$14A8,$18A8,$1CA8
//word = $0128,$0528,$0928,$0D28,$1128,$1528,$1928,$1D28
//word = $01A8,$05A8,$09A8,$0DA8,$11A8,$15A8,$19A8,$1DA8
//word = $0228,$0628,$0A28,$0E28,$1228,$1628,$1A28,$1E28
//word = $02A8,$06A8,$0AA8,$0EA8,$12A8,$16A8,$1AA8,$1EA8
//word = $0328,$0728,$0B28,$0F28,$1328,$1728,$1B28,$1F28
//word = $03A8,$07A8,$0BA8,$0FA8,$13A8,$17A8,$1BA8,$1FA8
//word = $0050,$0450,$0850,$0C50,$1050,$1450,$1850,$1C50
//word = $00D0,$04D0,$08D0,$0CD0,$10D0,$14D0,$18D0,$1CD0
//word = $0150,$0550,$0950,$0D50,$1150,$1550,$1950,$1D50
//word = $01D0,$05D0,$09D0,$0DD0,$11D0,$15D0,$19D0,$1DD0
//word = $0250,$0650,$0A50,$0E50,$1250,$1650,$1A50,$1E50
//word = $02D0,$06D0,$0AD0,$0ED0,$12D0,$16D0,$1AD0,$1ED0
//word = $0350,$0750,$0B50,$0F50,$1350,$1750,$1B50,$1F50
//word = $03D0,$07D0,$0BD0,$0FD0,$13D0,$17D0,$1BD0,$1FD0
//word hmask = $8081,$8082,$8084,$8088,$8090,$80A0,$80C0
//word = $8180,$8280,$8480,$8880,$9080,$A080,$C080
byte hbmask = $81,$82,$84,$88,$90,$A0,$C0
byte hlmask = $FF,$FE,$FC,$F8,$F0,$E0,$C0
byte hrmask = $81,$83,$87,$8F,$9F,$BF,$FF
@ -609,6 +609,51 @@ asm _hgrXorPlotD
INX
RTS
end
//export def hgrOrPlot(x, y)#0
// word pixptr
// byte ofst, pixofst, pmask
//
// ofst, pixofst = divmod7(x)
// pixptr = hgrscan[y] + drawbuff + ofst
// pmask = hbmask[pixofst]
// ^pixptr = ^pixptr | (curhclr.[ofst & 1] & pmask)
//end
export asm hgrOrPlot(x, y)#0
LDY ESTKL+0,X ; Y COORD
CPY #192
BCS +
end
asm _hgrOrPlotA
LDA $8000,Y ; HGRSCANL
STA DSTL
LDA $1000 ; DRAWBUFFH
ORA $9000,Y ; HGRSCANH
STA DSTH
INX
end
asm _hgrOrPlotB
JSR 1000 ; DIVMOD7
LDY ESTKL+0,X ; PIXEL OFFSET
end
asm _hgrOrPlotC
LDA $1000,Y ; HBMASK
STA TMPL
LDA ESTKL+1,X ; HORIZ OFFSET
CMP #40
BCS +
AND #$01
TAY
end
asm _hgrOrPlotD
LDA $2000,Y ; CURHCLR
AND TMPL
LDY ESTKL+1,X ; HORIZ OFFSET
ORA (DST),Y
STA (DST),Y
+ INX
INX
RTS
end
//export def hgrHLin(x1, x2, y)#0
// word pixptr, x
// byte lofst, lpixofst, lpmask
@ -801,7 +846,7 @@ asm _hgrVLinC
RTS
end
//
// BLT scanline of pixmap
// Masked BLT scanline of pixmap
//
asm scanBLT(x, y, w, srcptr)#0
LDA ESTKL+0,X ; SRC PTR
@ -841,7 +886,7 @@ asm _scanBLTB
JSR $D000 ; HPLOT
BEQ ++
BNE ++
+ JSR $E000 ; HPLOTX
+ JSR $E000 ; HPLOTOR
++ INC ESTKL+3,X ; X COORDL
BNE +
INC ESTKH+3,X ; X COORDH
@ -878,7 +923,7 @@ asm _scanBLTD
JSR $D000 ; HPLOT
BEQ ++
BNE ++
+ JSR $E000 ; HPLOTX
+ JSR $E000 ; HPLOTOR
++ INC ESTKL+3,X ; X COORDL
BNE +
INC ESTKH+3,X ; X COORDH
@ -917,7 +962,7 @@ export def hgrBLT(x, y, w, h, srcptr)#0
// if i & 1
// hgrColor(c)
// if c & $08
// hgrXorPlot(x + i, j)
// hgrOrPlot(x + i, j)
// else
// hgrPlot(x + i, j)
// fin
@ -1005,6 +1050,12 @@ _hgrXorPlotA:9 = @hgrscanh
_hgrXorPlotB:1 = @divmod7
_hgrXorPlotC:1 = @hbmask
_hgrXorPlotD:1 = @curhclr
_hgrOrPlotA:1 = @hgrscanl
_hgrOrPlotA:6 = @drawbuff.1
_hgrOrPlotA:9 = @hgrscanh
_hgrOrPlotB:1 = @divmod7
_hgrOrPlotC:1 = @hbmask
_hgrOrPlotD:1 = @curhclr
_hgrHLinA:1 = @hgrPlot
_hgrHLinB:1 = @hgrscanl
_hgrHLinB:6 = @drawbuff.1
@ -1029,8 +1080,8 @@ hgrColor:13 = @hcolor.1
hgrColor:16 = @curhclr.1
_scanBLTA:1 = @hgrColor
_scanBLTB:1 = @hgrPlot
_scanBLTB:8 = @hgrXorPlot
_scanBLTB:8 = @hgrOrPlot
_scanBLTC:1 = @hgrColor
_scanBLTD:1 = @hgrPlot
_scanBLTD:8 = @hgrXorPlot
_scanBLTD:8 = @hgrOrPlot
done

View File

@ -108,7 +108,7 @@ end
def spriteBLTMask(x, y, w, h, srcptr)#0
word i, j
byte pitch
// byte c
byte c
pitch = (w + 1) / 2
for j = y to y + h - 1
@ -141,14 +141,14 @@ export def spriteCompile(w, h, xcenter, ycenter, srcptr)#1
for i = 0 to 13
sprtptr=>s_map[i] = heapalloc(spritesize)
sprtptr=>s_mask[i] = heapalloc(spritesize)
hgrColor(0)
hgrRect(0, 0, w + 21, h - 1)
hgrBLT(i, 0, w, h, srcptr)
hgrCopyDst(i > 6 ?? 1 :: 0, 0, bytewidth, h, sprtptr=>s_map[i])
hgrColor(7)
hgrRect(0, 0, w + 21, h - 1)
spriteBLTMask(i, 0, w, h, srcptr)
hgrCopyDst(i > 6 ?? 1 :: 0, 0, bytewidth, h, sprtptr=>s_mask[i])
hgrColor(0)
hgrRect(0, h, w + 21, h * 2 - 1)
spriteBLTMask(i, h, w, h, srcptr)
hgrCopyDst(i > 6 ?? 1 :: 0, h, bytewidth, h, sprtptr=>s_mask[i])
hgrBLT(i, h, w, h, srcptr)
hgrCopyDst(i > 6 ?? 1 :: 0, h, bytewidth, h, sprtptr=>s_map[i])
next
return sprtptr
end

View File

@ -15,6 +15,7 @@ CMDJIT = rel/apple/CMD128\#061000
PLVMZP_C64 = vmsrc/c64/plvmzp.inc
PLVMC64 = rel/c64/PLASMA
ED = rel/ED\#FE1000
ZIP = rel/apple/ZIP\#FE1000
JIT = rel/apple/JIT\#FE1000
JIT16 = rel/apple/JIT16\#FE1000
JITUNE = rel/apple/JITUNE\#FE1000
@ -103,7 +104,7 @@ TXTTYPE = .TXT
#SYSTYPE = \#FF2000
#TXTTYPE = \#040000
apple: $(PLVMZP_APL) $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVMJIT) $(PLVM802) $(PLVM03) $(PLVMJIT03) $(CMD) $(CMDJIT) $(JIT) $(JIT16) $(JITUNE) $(SOSCMD) $(SOSCMDJIT) $(PLASMAPLASM) $(CODEOPT) $(MATCHFILES) $(ARGS) $(MEMMGR) $(MEMTEST) $(FIBER) $(FIBERTEST) $(LONGJMP) $(ED) $(MON) $(COPY) $(DEL) $(REN) $(CAT) $(NEWDIR) $(TYPE) $(SOS) $(ROD) $(SIEVE) $(PRIMEGAP) $(MOUSE) $(UTHERNET2) $(UTHERNET) $(ETHERIP) $(INET) $(DHCP) $(HTTPD) $(TFTPD) $(ROGUE) $(ROGUEMAP) $(ROGUECOMBAT) $(GRAFIX) $(GFXDEMO) $(LINES) $(HGRSPRITE) $(HGRLIB) $(HGRTEST) $(GRLIB) $(DGRLIB) $(GRTEST) $(DGRTEST) $(HGRTEST) $(FILEIO_APL) $(CONIO_APL) $(JOYBUZZ) $(PORTIO) $(SPIPORT) $(SDFAT) $(FATCAT) $(FATGET) $(FATPUT) $(FATWDSK) $(FATRDSK) $(INT32) $(INT32TEST) $(SANE) $(FPSTR) $(FPU) $(SANITY) $(LZ4) $(LZ4CAT) $(RPNCALC) $(SNDSEQ) $(PLAYSEQ)
apple: $(PLVMZP_APL) $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVMJIT) $(PLVM802) $(PLVM03) $(PLVMJIT03) $(CMD) $(CMDJIT) $(JIT) $(JIT16) $(JITUNE) $(SOSCMD) $(SOSCMDJIT) $(PLASMAPLASM) $(CODEOPT) $(ZIP) $(MATCHFILES) $(ARGS) $(MEMMGR) $(MEMTEST) $(FIBER) $(FIBERTEST) $(LONGJMP) $(ED) $(MON) $(COPY) $(DEL) $(REN) $(CAT) $(NEWDIR) $(TYPE) $(SOS) $(ROD) $(SIEVE) $(PRIMEGAP) $(MOUSE) $(UTHERNET2) $(UTHERNET) $(ETHERIP) $(INET) $(DHCP) $(HTTPD) $(TFTPD) $(ROGUE) $(ROGUEMAP) $(ROGUECOMBAT) $(GRAFIX) $(GFXDEMO) $(LINES) $(HGRSPRITE) $(HGRLIB) $(HGRTEST) $(GRLIB) $(DGRLIB) $(GRTEST) $(DGRTEST) $(HGRTEST) $(FILEIO_APL) $(CONIO_APL) $(JOYBUZZ) $(PORTIO) $(SPIPORT) $(SDFAT) $(FATCAT) $(FATGET) $(FATPUT) $(FATWDSK) $(FATRDSK) $(INT32) $(INT32TEST) $(SANE) $(FPSTR) $(FPU) $(SANITY) $(LZ4) $(LZ4CAT) $(RPNCALC) $(SNDSEQ) $(PLAYSEQ)
-rm vmsrc/plvmzp.inc
@ -437,43 +438,43 @@ $(HGRSPRITE): libsrc/apple/hgrsprite.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/hgrsprite.pla > libsrc/apple/hgrsprite.a
acme --setpc 4094 -o $(HGRSPRITE) libsrc/apple/hgrsprite.a
$(HGRTEST): samplesrc/hgrtest.pla $(PLVM02) $(PLASM)
$(HGRTEST): samplesrc/hgrtest.pla $(HGRLIB) $(PLASM)
./$(PLASM) -AMOW < samplesrc/hgrtest.pla > samplesrc/hgrtest.a
acme --setpc 4094 -o $(HGRTEST) samplesrc/hgrtest.a
$(GRTEST): samplesrc/grtest.pla $(PLVM02) $(PLASM)
$(GRTEST): samplesrc/grtest.pla $(GRLIB) $(PLASM)
./$(PLASM) -AMOW < samplesrc/grtest.pla > samplesrc/grtest.a
acme --setpc 4094 -o $(GRTEST) samplesrc/grtest.a
$(DGRTEST): samplesrc/dgrtest.pla $(PLVM02) $(PLASM)
$(DGRTEST): samplesrc/dgrtest.pla $(DGRLIB) $(PLASM)
./$(PLASM) -AMOW < samplesrc/dgrtest.pla > samplesrc/dgrtest.a
acme --setpc 4094 -o $(DGRTEST) samplesrc/dgrtest.a
$(MON): utilsrc/apple/mon.pla $(PLVM02) $(PLASM)
$(MON): utilsrc/apple/mon.pla $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/mon.pla > utilsrc/apple/mon.a
acme --setpc 4094 -o $(MON) utilsrc/apple/mon.a
$(COPY): utilsrc/apple/copy.pla $(PLVM03) $(PLASM)
$(COPY): utilsrc/apple/copy.pla $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/copy.pla > utilsrc/apple/copy.a
acme --setpc 4094 -o $(COPY) utilsrc/apple/copy.a
$(DEL): utilsrc/apple/del.pla $(PLVM03) $(PLASM)
$(DEL): utilsrc/apple/del.pla $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/del.pla > utilsrc/apple/del.a
acme --setpc 4094 -o $(DEL) utilsrc/apple/del.a
$(REN): utilsrc/apple/ren.pla $(PLVM03) $(PLASM)
$(REN): utilsrc/apple/ren.pla $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/ren.pla > utilsrc/apple/ren.a
acme --setpc 4094 -o $(REN) utilsrc/apple/ren.a
$(CAT): utilsrc/apple/cat.pla $(PLVM03) $(PLASM)
$(CAT): utilsrc/apple/cat.pla $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/cat.pla > utilsrc/apple/cat.a
acme --setpc 4094 -o $(CAT) utilsrc/apple/cat.a
$(NEWDIR): utilsrc/apple/newdir.pla $(PLVM03) $(PLASM)
$(NEWDIR): utilsrc/apple/newdir.pla $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/newdir.pla > utilsrc/apple/newdir.a
acme --setpc 4094 -o $(NEWDIR) utilsrc/apple/newdir.a
$(TYPE): utilsrc/apple/type.pla $(PLVM03) $(PLASM)
$(TYPE): utilsrc/apple/type.pla $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/type.pla > utilsrc/apple/type.a
acme --setpc 4094 -o $(TYPE) utilsrc/apple/type.a
@ -481,6 +482,10 @@ $(SOS): utilsrc/apple/sos.pla $(PLVM03) $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/sos.pla > utilsrc/apple/sos.a
acme --setpc 4094 -o $(SOS) utilsrc/apple/sos.a
$(ZIP): utilsrc/apple/zip.pla $(PLASM)
./$(PLASM) -AMOW < utilsrc/apple/zip.pla > utilsrc/apple/zip.a
acme --setpc 4094 -o $(ZIP) utilsrc/apple/zip.a
$(JIT): libsrc/apple/jit.pla libsrc/jitcore.pla $(PLVMJIT) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/jit.pla > libsrc/apple/jit.a
acme --setpc 4094 -o $(JIT) libsrc/apple/jit.a

View File

@ -38,6 +38,7 @@ cp rel/apple/SNDSEQ#FE1000 prodos/sys/SNDSEQ.REL
cp rel/apple/JIT#FE1000 prodos/sys/JIT.REL
cp rel/apple/JIT16#FE1000 prodos/sys/JIT16.REL
cp rel/apple/JITUNE#FE1000 prodos/sys/JITUNE.REL
cp rel/apple/ZIP#FE1000 prodos/sys/ZIP.REL
cp rel/LZ4#FE1000 prodos/sys/LZ4.REL
cp rel/TFTPD#FE1000 prodos/sys/TFTPD.REL
cp rel/INT32#FE1000 prodos/sys/INT32.REL

View File

@ -11,3 +11,4 @@ echo "SYS/NEWDIR"; atftp $1 --put -l rel/apple/NEWDIR#FE1000 -r $2/SYS/NEWDIR#
echo "SYS/TYPE"; atftp $1 --put -l rel/apple/TYPE#FE1000 -r $2/SYS/TYPE#FE1000
echo "SYS/MON"; atftp $1 --put -l rel/apple/MON#FE1000 -r $2/SYS/MON#FE1000
echo "SYS/SOS"; atftp $1 --put -l rel/apple/SOS#FE1000 -r $2/SYS/SOS#FE1000
echo "SYS/ZIP"; atftp $1 --put -l rel/apple/ZIP#FE1000 -r $2/SYS/ZIP#FE1000

View File

@ -119,72 +119,77 @@ def copyfiles(srcfile, dstfile)#0
srcpath = srcpath - wildname
fin
entrylist, entrycnt = matchList(@srcpath, @wildname)
entry = entrylist
while entrycnt
strcpy(@srcfilepath, @srcpath)
strcat(@srcfilepath, entry)
strcpy(@dstfilepath, dstfile)
if chkdstpath(@dstfilepath)
strcat(@dstfilepath, entry)
fin
if entry->entry_type == $0F
//
// Source is a directory and not referencing the destination
//
if pathdiff(@srcfilepath, dstfile)
fileio:create(@dstfilepath, $0F, $0000)
if not chkdstpath(@dstfilepath)
puts("Unable to create directory: "); puts(@dstfilepath); putln
throw(exit, TRUE)
fin
if recurse
copyfiles(@srcfilepath, @dstfilepath)
fin
if not entrylist
puts(srcfile); puts(" ???\n")
else
entry = entrylist
while entrycnt
strcpy(@srcfilepath, @srcpath)
strcat(@srcfilepath, entry)
strcpy(@dstfilepath, dstfile)
if chkdstpath(@dstfilepath)
strcat(@dstfilepath, entry)
fin
else
//
// Check if destination file exists
//
if fileio:getfileinfo(@dstfilepath, @dstfileinfo) == FILE_ERR_OK
fileio:destroy(@dstfilepath)
fin
//
// Create the destination file and open for writing
//
if fileio:create(@dstfilepath, entry->entry_type, entry=>entry_aux) <> FILE_ERR_OK
puts("Unable to create file: "); puts(@dstfilepath); putln
throw(exit, TRUE)
fin
srcref = fileio:open(@srcfilepath)
if not srcref
puts("Unable to open file: "); puts(@srcfilepath); putln
throw(exit, TRUE)
fin
dstref = fileio:open(@dstfilepath)
if not dstref
puts("Unable to open file: "); puts(@dstfilepath); putln
throw(exit, TRUE)
fin
//
// Let the copying begin
//
repeat
copyxfer = fileio:read(srcref, copybuff, copysize)
if copyxfer
if fileio:write(dstref, copybuff, copyxfer) <> copyxfer
puts("Error writing: "); puts(@dstfilepath); putln
if entry->entry_type == $0F
//
// Source is a directory and not referencing the destination
//
if pathdiff(@srcfilepath, dstfile)
fileio:create(@dstfilepath, $0F, $0000)
if not chkdstpath(@dstfilepath)
puts("Unable to create directory: "); puts(@dstfilepath); putln
throw(exit, TRUE)
fin
if recurse
copyfiles(@srcfilepath, @dstfilepath)
fin
fin
until copyxfer == 0
fileio:close(dstref)
fileio:close(srcref)
puts(@srcfilepath); puts(" ==> "); puts(@dstfilepath); putln
fin
entry = entry + t_fileentry
entrycnt--
loop
heaprelease(entrylist)
else
puts(@srcfilepath)
//
// Check if destination file exists
//
if fileio:getfileinfo(@dstfilepath, @dstfileinfo) == FILE_ERR_OK
fileio:destroy(@dstfilepath)
fin
//
// Create the destination file and open for writing
//
if fileio:create(@dstfilepath, entry->entry_type, entry=>entry_aux) <> FILE_ERR_OK
puts("\nUnable to create file: "); puts(@dstfilepath); putln
throw(exit, TRUE)
fin
srcref = fileio:open(@srcfilepath)
if not srcref
puts("\nUnable to open file: "); puts(@srcfilepath); putln
throw(exit, TRUE)
fin
dstref = fileio:open(@dstfilepath)
if not dstref
puts("\nUnable to open file: "); puts(@dstfilepath); putln
throw(exit, TRUE)
fin
//
// Let the copying begin
//
repeat
copyxfer = fileio:read(srcref, copybuff, copysize)
if copyxfer
if fileio:write(dstref, copybuff, copyxfer) <> copyxfer
puts("\nError writing: "); puts(@dstfilepath); putln
throw(exit, TRUE)
fin
fin
until copyxfer == 0
fileio:close(dstref)
fileio:close(srcref)
puts(" ==> "); puts(@dstfilepath); putln
fin
entry = entry + t_fileentry
entrycnt--
loop
heaprelease(entrylist)
fin
end
//
// Install error exit

51
src/utilsrc/apple/zip.pla Normal file
View File

@ -0,0 +1,51 @@
include "inc/cmdsys.plh"
include "inc/args.plh"
//
// ZIP Chip control
//
var arg, status, slots, clock, state, cache
byte _unlock[]
byte = $A9, $5A // LDA #$5A
byte = $8D, $5A, $C0 // STA $C05A
byte = $8D, $5A, $C0 // STA $C05A
byte = $8D, $5A, $C0 // STA $C05A
byte = $8D, $5A, $C0 // STA $C05A
byte = $60 // RTS
def unlock#0
(@_unlock)()#0 // Unlock regs (has to be machine code)
end
def lock#0
^$C05A = $A5 // Lock regs
end
arg = argNext(argFirst)
if ^arg
when toupper(arg->[1])
is 'S' // Slow to 1 MHz
unlock
^$C05A = $00
lock
puts("Slow speed\n")
break
is 'F' // Enable acceleration
unlock
^$C05B = $FF
lock
puts("Fast speed\n")
break
wend
fin
unlock
status = ^$C05B
slots = ^$C05C
clock = ^$C05D
state = ^$C05E
cache = ^$C05F
lock
puts("Status: $"); puth(status); putln
puts("Slots: $"); puth(slots); putln
puts("Clock: $"); puth(clock); putln
puts("State: $"); puth(state); putln
puts("Cache: $"); puth(cache); putln
done