1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-01-15 09:30:29 +00:00

Wholesale DHGR Toolkit project reconfiguration

This commit is contained in:
David Schmenk 2024-11-27 15:58:02 -08:00
parent 2c884102bb
commit 54c14a6112
27 changed files with 541 additions and 315 deletions

View File

@ -1,78 +0,0 @@
.SUFFIXES =
AFLAGS = -o $@
DCGRLIB = dcgr.tk/libs/DCGRLIB.REL
DCGRUTILS = dcgr.tk/libs//DCGRUTILS.REL
DCGRTEST = dcgr.tk/test/DCGRTEST.REL
DCGRSPRED = dcgr.tk/utils/DCGRSPRED.REL
DCGREASY = dcgr.tk/utils/DCGREASY.REL
DCGRRGB = dcgr.tk/utils/DCGRRGB.REL
DCGRSHOW = dcgr.tk/utils/DCGRSHOW.REL
PENGUINS = dcgr.tk/demos/penguins/PENGUINS.REL
libs: $(DCGRLIB) $(DCGRUTILS)
cp $(DCGRLIB) prodos/sys
cp $(DCGRUTILS) prodos/sys
test: $(DCGRTEST)
-mkdir prodos/dcgr.tk/
-mkdir prodos/dcgr.tk/test
cp $(DCGRTEST) prodos/dcgr.tk/test
cp dcgr.tk/test/*.BIN prodos/dcgr.tk/test
utils: $(DCGRSPRED) $(DCGREASY) $(DCGRRGB) $(DCGRSHOW)
-mkdir prodos/dcgr.tk/
-mkdir prodos/dcgr.tk/utils
-mkdir prodos/dcgr.tk/utils/samples
cp $(DCGREASY) prodos/dcgr.tk/utils
cp $(DCGRSPRED) prodos/dcgr.tk/utils
cp $(DCGRRGB) prodos/dcgr.tk/utils
cp $(DCGRSHOW) prodos/dcgr.tk/utils
cp dcgr.tk/utils/samples/* prodos/dcgr.tk/utils/samples
demos: $(PENGUINS)
-mkdir prodos/dcgr.tk/
-mkdir prodos/dcgr.tk/demos/
-mkdir prodos/dcgr.tk/demos/penguins/
cp $(PENGUINS) prodos/dcgr.tk/demos/penguins/
cp dcgr.tk/demos/penguins/*.BIN prodos/dcgr.tk/demos/penguins/
all: libs test utils demos
clean:
-rm dcgr.tk/demos/pengiuns/*.o dcgr.tk/demos/pengiuns/*.REL dcgr.tk/demos/pengiuns/*.a
-rm dcgr.tk/test/*.o dcgr.tk/test/*.REL dcgr.tk/test/*.a
-rm dcgr.tk/utils/*.o dcgr.tk/utils/*.REL dcgr.tk/utils/*.a
$(DCGRLIB): dcgr.tk/libs/dcgrlib.pla
./plasm -AMOW dcgr.tk/libs/dcgrlib.pla
acme --setpc 4094 -o $(DCGRLIB) dcgr.tk/libs/dcgrlib.a
$(DCGRUTILS): dcgr.tk/libs/dcgrutils.pla $(DCGRLIB)
./plasm -AMOW dcgr.tk/libs/dcgrutils.pla
acme --setpc 4094 -o $(DCGRUTILS) dcgr.tk/libs/dcgrutils.a
$(DCGRTEST): dcgr.tk/test/dcgrtest.pla $(DCGRLIB) $(DCGRUTILS)
./plasm -AMOW dcgr.tk/test/dcgrtest.pla
acme --setpc 4094 -o $(DCGRTEST) dcgr.tk/test/dcgrtest.a
$(DCGRSPRED): dcgr.tk/utils/dcgrspred.pla $(DCGRLIB) $(DCGRUTILS)
./plasm -AMOW dcgr.tk/utils/dcgrspred.pla
acme --setpc 4094 -o $(DCGRSPRED) dcgr.tk/utils/dcgrspred.a
$(DCGREASY): dcgr.tk/utils/dcgreasy.pla $(DCGRLIB) $(DCGRUTILS)
./plasm -AMOW dcgr.tk/utils/dcgreasy.pla
acme --setpc 4094 -o $(DCGREASY) dcgr.tk/utils/dcgreasy.a
$(DCGRSHOW): dcgr.tk/utils/dcgrshow.pla $(DCGRLIB) $(DCGRUTILS)
./plasm -AMOW dcgr.tk/utils/dcgrshow.pla
acme --setpc 4094 -o $(DCGRSHOW) dcgr.tk/utils/dcgrshow.a
$(DCGRRGB): dcgr.tk/utils/dcgrrgb.pla $(DCGRLIB) $(DCGRUTILS)
./plasm -AMOW dcgr.tk/utils/dcgrrgb.pla
acme --setpc 4094 -o $(DCGRRGB) dcgr.tk/utils/dcgrrgb.a
$(PENGUINS): dcgr.tk/demos/penguins/penguins.pla
./plasm -AMOW dcgr.tk/demos/penguins/penguins.pla
acme --setpc 4094 -o $(PENGUINS) dcgr.tk/demos/penguins/penguins.a

View File

@ -1,4 +1,4 @@
import dcgrlib
import dhgrlib
const DST_SCREEN = 0
const DST_MEMORY = 1
const SCR_WIDTH7 = 20
@ -26,6 +26,11 @@ import dcgrlib
const CLR_AQUA = 14
const CLR_WHITE = 15
const DHGR_MONO_MODE = 2
const DHGR_COLOR_MODE = 0
const DHGR_MIXED_MODE = 1
const DHGR_TEXT_MODE = -1
predef dcgrColor(c)#0
predef dcgrPixel(x, y)#0
predef dcgrGetPixel(x, y)#1
@ -34,14 +39,16 @@ import dcgrlib
predef dcgrBitMap(x, y, bitw, bith, bitptr)#0
predef dcgrPixMap(x, y, pixw, pixh, pixptr)#0
predef dcgrRleMap(x, y, pixw, pixh, pixptr)#0
predef dcgrScrBl7(x7, y, w7, h)#0
predef dcgrMemBl7(x7, y, w7, h, memptr, memspan)#0
predef dcgrClearBl7(x7, y, w7, h)#0
predef dcgrTiles(x7, y8, strptr, strlen, tileset)#0
predef dcgrMemBl7Tile(x7, y, memptr, memspan, tileptr)#0
predef dcgrVLB#0
predef dcgrOp(op)#0
predef dcgrSurfScr(op)#0
predef dcgrSurfMem(op, memh, memptr, memspan)#0
predef dcgrMode(mode)#1
predef dhgrScrBl7(x7, y, w7, h)#0
predef dhgrMemBl7(x7, y, w7, h, memptr, memspan)#0
predef dhgrClearBl7(x7, y, w7, h)#0
predef dhgrTiles(x7, y8, strptr, strlen, tileset)#0
predef dhgrMemBl7Tile(x7, y, memptr, memspan, tileptr)#0
predef dhgrSet(dhx, y)#0
predef dhgrUnset(dhx, y)#0
predef dhgrVLB#0
predef dhgrOp(op)#0
predef dhgrSurfScr(op)#0
predef dhgrSurfMem(op, memh, memptr, memspan)#0
predef dhgrMode(mode)#1
end

View File

@ -1,15 +1,13 @@
import dcgrutils
import dhgrutils
const FONT_WIDE = 0
const FONT_THIN = 1
predef dcgrAllocBl7Mem(w, h)#2
predef dhgrAllocBl7Mem(w, h)#2
predef dcgrStr(x, y, strptr)#0
predef dcgrBoldStr(clr, x, y, strptr)#0
predef dcgrFont(font)#0
predef dcgrRect(x, y, w, h)#0
predef dcgrGetPixMap(x, y, w, h)#1
predef dcgrEncPixMap(w, h, pixmap, rlemap)#1
predef dhgrSet(dhx, y)#0
predef dhgrUnset(dhx, y)#0
predef spriteRead(filestr)#5
predef spriteWrite(filestr, xorg, yorg, width, height, sprptr)#1
predef screenRead(filestr)#1

View File

@ -202,13 +202,18 @@ byte = 224+0, 224+1, 224+2, 224+3, 224+4, 224+5, 224+6
byte = 232+0, 232+1, 232+2, 232+3, 232+4, 232+5, 232+6
byte = 240+0, 240+1, 240+2, 240+3, 240+4, 240+5, 240+6
byte = 248+0, 248+1, 248+2, 248+3, 248+4, 248+5, 248+6
//
// Color -> DHGR pixel
//
byte[] dhgrPix = 2, 4, 8, 1
byte[] dhgrMask = 13, 12, 7, 14
///
// Destination surface values
//
const DST_SCREEN = 0
const DST_MEMORY = 1
word surfWidth, surfWidth7, surfHeight, surfPtr, surfSpan
byte dcgrSurface, opScr, opMem
byte dhgrSurface, opScr, opMem
//
// Surface independent entrypoints
//
@ -233,16 +238,16 @@ end
export asm dcgrRleMap(x, y, pixw, pixh, pixptr)#0
JMP $1000
end
export asm dcgrScrBl7(x7, y, w7, h)#0
export asm dhgrScrBl7(x7, y, w7, h)#0
JMP $1000
end
export asm dcgrMemBl7(x7, y, w7, h, memptr, memspan)#0
export asm dhgrMemBl7(x7, y, w7, h, memptr, memspan)#0
JMP $1000
end
export asm dcgrClearBl7(x7, y, w7, h)#0
export asm dhgrClearBl7(x7, y, w7, h)#0
JMP $1000
end
export asm dcgrTiles(x7, y8, strptr, strlen, tileset)#0
export asm dhgrTiles(x7, y8, strptr, strlen, tileset)#0
JMP $1000
end
//
@ -364,11 +369,11 @@ asm _dcgrColorA
STA $5003 ; MEMCLRH
RTS
end
//==================\\
// \\
// Pixel operations \\
// \\
//==================\\
//===============================\\
// \\
// Double Color pixel operations \\
// \\
//===============================\\
//
// Screen functions
//
@ -1360,7 +1365,7 @@ end
//
// Screen -> Memory Block7 Transfer
//
asm dcgrScrBl7Mem(x7, y, w7, h, memptr, memspan)#0
asm dhgrScrBl7Mem(x7, y, w7, h, memptr, memspan)#0
TXA
CLC
ADC #6
@ -1427,7 +1432,7 @@ end
//
// Memory -> Screen Block7 Transfer
//
asm dcgrMemBl7Scr(x7, y, w7, h, memptr, memspan)#0
asm dhgrMemBl7Scr(x7, y, w7, h, memptr, memspan)#0
TXA
CLC
ADC #6
@ -1584,7 +1589,7 @@ end
//
// Memory -> Memory Block7 function
//
asm dcgrMemBl7Mem(x7, y, srcw7, srch, srcptr, srcspan, dstw7, dsth, dstptr)#0
asm dhgrMemBl7Mem(x7, y, srcw7, srch, srcptr, srcspan, dstw7, dsth, dstptr)#0
TXA
CLC
ADC #9
@ -1783,7 +1788,7 @@ end
//
// Clear Screen/Memory Block7
//
asm dcgrClearBl7Scr(x7, y, w7, h)#0
asm dhgrClearBl7Scr(x7, y, w7, h)#0
INX
INX
INX
@ -1841,7 +1846,7 @@ asm _dcgrClearBl7ScrC
BNE YFILS
RETFILS RTS
end
asm dcgrClearBl7Mem(x7, y, w7, h, memptr, memspan)#0
asm dhgrClearBl7Mem(x7, y, w7, h, memptr, memspan)#0
TXA
CLC
ADC #6
@ -1915,7 +1920,7 @@ end
//
// Tile -> Screen Transfer
//
asm dcgrTilesScr(x7, y8, strptr, strlen, tileset)#0
asm dhgrTilesScr(x7, y8, strptr, strlen, tileset)#0
INX
INX
INX
@ -2032,7 +2037,7 @@ end
//
// Wait for VLB
//
export asm dcgrVLB#0
export asm dhgrVLB#0
PHP
SEI
STA $C079 ; Enable IOU access and reset VBL int on //c
@ -2050,7 +2055,7 @@ end
//
// Slow implementation of Tiles -> Mem
//
def dcgrTileMem(tileptr, memptr, memspan)#0
def dhgrTileMem(tileptr, memptr, memspan)#0
byte h, v
word rowptr
@ -2078,12 +2083,12 @@ def dcgrTileMem(tileptr, memptr, memspan)#0
tileptr = tileptr + 8
next
end
def dcgrTilesMem(x7, y8, strptr, strlen, tileset, memptr, memspan)#0
def dhgrTilesMem(x7, y8, strptr, strlen, tileset, memptr, memspan)#0
if y8; memptr = memptr + y8 * 8 * memspan; fin
memptr = memptr + x7 * 2
while strlen
dcgrTileMem(tileset + ^strptr * 32, memptr, memspan)
dhgrTileMem(tileset + ^strptr * 32, memptr, memspan)
strptr++
strlen--
loop
@ -2091,7 +2096,7 @@ end
//
// Convert Block7 to Tile format
//
export def dcgrMemBl7Tile(x7, y, memptr, memspan, tileptr)#0
export def dhgrMemBl7Tile(x7, y, memptr, memspan, tileptr)#0
byte h, v
word rowptr
@ -2122,35 +2127,6 @@ export def dcgrMemBl7Tile(x7, y, memptr, memspan, tileptr)#0
next
end
//
// Read pixel and return color
//
export def dcgrGetPixel(x, y)#1
byte x7, m7, i
word[2] pix7
word amask, mmask
x7 = divmod7[x] >> 3
if dcgrSurface // Memory
dcgrMemBl7Mem(x7, y, surfWidth, surfHeight, surfPtr, surfSpan, 1, 1, @pix7)
else // Screen
dcgrScrBl7Mem(x7, y, 1, 1, @pix7, 4)
fin
m7 = divmod7[x] & $07
amask = auxclrmsk[m7]
if amask & $80; amask = (amask & $7F) << 8; fin
pix7[0] = amask & pix7[0]
mmask = memclrmsk[m7]
if mmask & $80; mmask = (mmask & $7F) << 8; fin
pix7[1] = mmask & pix7[1]
for i = 0 to 15
if pix7[0] == (auxclrsl[i] | (auxclrsh[i] << 8)) & amask
if pix7[1] == (memclrsl[i] | (memclrsh[i] << 8)) & mmask
return i // Color match
fin; fin
next
return 15
end
//
// Hack to extend parameters for memory functions
//
def extPlotMem#0
@ -2172,18 +2148,18 @@ def extRleMapMem#0
(@dcgrRlemapMem)(surfWidth, surfHeight, surfPtr, surfSpan)#0
end
def extScrBl7Mem#0
(@dcgrScrBl7Mem)(surfPtr, surfSpan)#0
(@dhgrScrBl7Mem)(surfPtr, surfSpan)#0
end
def extMemBl7Mem#0
(@dcgrMemBl7Mem)(surfWidth7, surfHeight, surfPtr)#0
(@dhgrMemBl7Mem)(surfWidth7, surfHeight, surfPtr)#0
end
def extTilesMem#0
(@dcgrTilesMem)(surfPtr, surfSpan)#0
(@dhgrTilesMem)(surfPtr, surfSpan)#0
end
def extClearBl7Mem#0
(@dcgrClearBl7Mem)(surfPtr, surfSpan)#0
(@dhgrClearBl7Mem)(surfPtr, surfSpan)#0
end
def dcgrOpScr(op)#0
def dhgrOpScr(op)#0
byte opcode
//
@ -2225,7 +2201,7 @@ def dcgrOpScr(op)#0
wend
end
def dcgrOpMem(op)#0
def dhgrOpMem(op)#0
byte opcode
//
@ -2268,67 +2244,109 @@ def dcgrOpMem(op)#0
_jmpOpMemBl7Mem:1 = @_dcgrMemBl7MemB
wend
end
export def dcgrOp(op)#0
if dcgrSurface // Memory
export def dhgrOp(op)#0
if dhgrSurface // Memory
if op <> opMem
opMem = op
dcgrOpMem(opMem)
dhgrOpMem(opMem)
fin
else // Screen
if op <> opScr
opScr = op
dcgrOpScr(opScr)
dhgrOpScr(opScr)
fin
fin
end
export def dcgrSurfScr(op)#0
export def dhgrSurfScr(op)#0
surfWidth = 140
surfWidth7 = 20
surfHeight = 192
surfPtr = $2000
surfSpan = 10
if dcgrSurface == DST_MEMORY
dcgrSurface = DST_SCREEN
if dhgrSurface == DST_MEMORY
dhgrSurface = DST_SCREEN
dcgrPixel:1 = @dcgrPlotScr
dcgrHLin:1 = @dcgrHLinScr
dcgrVLin:1 = @dcgrVLinScr
dcgrBitMap:1 = @dcgrBitMapScr
dcgrPixMap:1 = @dcgrPixMapScr
dcgrRleMap:1 = @dcgrRleMapScr
dcgrMemBl7:1 = @dcgrMemBl7Scr
dcgrClearBl7:1 = @dcgrClearBl7Scr
dcgrTiles:1 = @dcgrTilesScr
dhgrMemBl7:1 = @dhgrMemBl7Scr
dhgrClearBl7:1 = @dhgrClearBl7Scr
dhgrTiles:1 = @dhgrTilesScr
fin
if op <> opScr
opScr = op
dcgrOpScr(opScr)
dhgrOpScr(opScr)
fin
end
export def dcgrSurfMem(op, memh, memptr, memspan)#0
export def dhgrSurfMem(op, memh, memptr, memspan)#0
surfWidth7 = memspan >> 2
surfWidth = surfWidth7 * 7
surfHeight = memh
surfPtr = memptr
surfSpan = memspan
if dcgrSurface == DST_SCREEN
dcgrSurface = DST_MEMORY
if dhgrSurface == DST_SCREEN
dhgrSurface = DST_MEMORY
dcgrPixel:1 = @extPlotMem
dcgrHLin:1 = @extHLinMem
dcgrVLin:1 = @extVLinMem
dcgrBitMap:1 = @extBitMapMem
dcgrPixMap:1 = @extPixMapMem
dcgrRleMap:1 = @extRleMapMem
dcgrScrBl7:1 = @extScrBl7Mem
dcgrMemBl7:1 = @extMemBl7Mem
dcgrClearBl7:1 = @extClearBl7Mem
dcgrTiles:1 = @extTilesMem
dhgrScrBl7:1 = @extScrBl7Mem
dhgrMemBl7:1 = @extMemBl7Mem
dhgrClearBl7:1 = @extClearBl7Mem
dhgrTiles:1 = @extTilesMem
fin
if op <> opMem
opMem = op
dcgrOpMem(opMem)
dhgrOpMem(opMem)
fin
end
export def dcgrMode(mode)#1
//
// Set/Unset DHGR pixels
//
export def dhgrSet(dhx, y)#0
dcgrColor(dhgrPix[dhx & $03])
dhgrOp(OP_OR)
dcgrPixel(dhx >> 2, y)
end
export def dhgrUnset(dhx, y)#0
dcgrColor(dhgrMask[dhx & $03])
dhgrOp(OP_AND)
dcgrPixel(dhx >> 2, y)
end
//
// Read pixel and return color
//
export def dcgrGetPixel(x, y)#1
byte x7, m7, i
word[2] pix7
word amask, mmask
x7 = divmod7[x] >> 3
if dhgrSurface // Memory
dhgrMemBl7Mem(x7, y, surfWidth, surfHeight, surfPtr, surfSpan, 1, 1, @pix7)
else // Screen
dhgrScrBl7Mem(x7, y, 1, 1, @pix7, 4)
fin
m7 = divmod7[x] & $07
amask = auxclrmsk[m7]
if amask & $80; amask = (amask & $7F) << 8; fin
pix7[0] = amask & pix7[0]
mmask = memclrmsk[m7]
if mmask & $80; mmask = (mmask & $7F) << 8; fin
pix7[1] = mmask & pix7[1]
for i = 0 to 15
if pix7[0] == (auxclrsl[i] | (auxclrsh[i] << 8)) & amask
if pix7[1] == (memclrsl[i] | (memclrsh[i] << 8)) & mmask
return i // Color match
fin; fin
next
return 15
end
export def dhgrMode(mode)#1
if mode >= 0
^page1m
^showfull
@ -2338,12 +2356,12 @@ export def dcgrMode(mode)#1
^show80col = 0
^dhresena
^store80ena = 0
dcgrOpMem(OP_SRC)
dcgrOpScr(OP_SRC)
dcgrSurface = DST_MEMORY
dcgrSurfScr(OP_SRC)
dhgrOpMem(OP_SRC)
dhgrOpScr(OP_SRC)
dhgrSurface = DST_MEMORY
dhgrSurfScr(OP_SRC)
dcgrColor(0)
dcgrClearBl7(0, 0, 20, 192)
dhgrClearBl7(0, 0, 20, 192)
else
^store80dis = 0
^dhresdis

View File

@ -1,15 +1,10 @@
include "inc/cmdsys.plh"
include "inc/fileio.plh"
include "inc/dcgrlib.plh"
include "dhgr.tk/inc/dhgrlib.plh"
const page1m = $C054
const page1x = $C055
//
// Color -> DHGR pixel
//
byte[] dhgrPix = 2, 4, 8, 1
byte[] dhgrMask = 13, 12, 7, 14
//
// Apple //e hires character font
//
byte fontWide[]
@ -169,16 +164,6 @@ export def dcgrEncPixMap(w, h, pixmap, rlemap)#1
next
return rleptr - rlemap
end
export def dhgrSet(dhx, y)#0
dcgrColor(dhgrPix[dhx & $03])
dcgrOp(OP_OR)
dcgrPixel(dhx >> 2, y)
end
export def dhgrUnset(dhx, y)#0
dcgrColor(dhgrMask[dhx & $03])
dcgrOp(OP_AND)
dcgrPixel(dhx >> 2, y)
end
export def spriteRead(filestr)#5
var sprptr, sprsize, xorg, yorg
byte refnum, width, height

80
src/dhgr.tk/makefile Normal file
View File

@ -0,0 +1,80 @@
.SUFFIXES =
AFLAGS = -o $@
DHGRLIB = dhgr.tk/libs/DHGRLIB.REL
DHGRUTILS = dhgr.tk/libs//DHGRUTILS.REL
DHGRTEST = dhgr.tk/test/DHGRTEST.REL
DHGRSPRED = dhgr.tk/utils/DHGRSPRED.REL
DHGREASY = dhgr.tk/utils/DHGREASY.REL
DHGRRGB = dhgr.tk/utils/DHGRRGB.REL
DHGRSHOW = dhgr.tk/utils/DHGRSHOW.REL
DLGRSHOW = dhgr.tk/utils/DLGRSHOW.REL
PENGUINS = dhgr.tk/demos/penguins/PENGUINS.REL
libs: $(DHGRLIB) $(DHGRUTILS)
cp $(DHGRLIB) prodos/sys
cp $(DHGRUTILS) prodos/sys
test: $(DHGRTEST)
-mkdir prodos/dhgr.tk/
-mkdir prodos/dhgr.tk/test
cp $(DHGRTEST) prodos/dhgr.tk/test
cp dhgr.tk/test/*.BIN prodos/dhgr.tk/test
utils: $(DHGRSPRED) $(DHGREASY) $(DHGRRGB) $(DHGRSHOW) $(DLGRSHOW)
-mkdir prodos/dhgr.tk/
-mkdir prodos/dhgr.tk/utils
-mkdir prodos/dhgr.tk/utils/samples
cp dhgr.tk/utils/*.REL prodos/dhgr.tk/utils
cp dhgr.tk/utils/samples/* prodos/dhgr.tk/utils/samples
demos: $(PENGUINS)
-mkdir prodos/dhgr.tk/
-mkdir prodos/dhgr.tk/demos/
-mkdir prodos/dhgr.tk/demos/penguins/
cp $(PENGUINS) prodos/dhgr.tk/demos/penguins/
cp dhgr.tk/demos/penguins/*.BIN prodos/dhgr.tk/demos/penguins/
all: libs test utils demos
clean:
-rm dhgr.tk/demos/pengiuns/*.o dhgr.tk/demos/pengiuns/*.REL dhgr.tk/demos/pengiuns/*.a
-rm dhgr.tk/test/*.o dhgr.tk/test/*.REL dhgr.tk/test/*.a
-rm dhgr.tk/utils/*.o dhgr.tk/utils/*.REL dhgr.tk/utils/*.a
$(DHGRLIB): dhgr.tk/libs/dhgrlib.pla dhgr.tk/inc/dhgrlib.plh
./plasm -AMOW dhgr.tk/libs/dhgrlib.pla
acme --setpc 4094 -o $(DHGRLIB) dhgr.tk/libs/dhgrlib.a
$(DHGRUTILS): dhgr.tk/libs/dhgrutils.pla $(DHGRLIB) dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./plasm -AMOW dhgr.tk/libs/dhgrutils.pla
acme --setpc 4094 -o $(DHGRUTILS) dhgr.tk/libs/dhgrutils.a
$(DHGRTEST): dhgr.tk/test/dhgrtest.pla $(DHGRLIB) $(DHGRUTILS) dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./plasm -AMOW dhgr.tk/test/dhgrtest.pla
acme --setpc 4094 -o $(DHGRTEST) dhgr.tk/test/dhgrtest.a
$(DHGRSPRED): dhgr.tk/utils/dhgrspred.pla $(DHGRLIB) $(DHGRUTILS) dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./plasm -AMOW dhgr.tk/utils/dhgrspred.pla
acme --setpc 4094 -o $(DHGRSPRED) dhgr.tk/utils/dhgrspred.a
$(DHGREASY): dhgr.tk/utils/dhgreasy.pla $(DHGRLIB) $(DHGRUTILS) dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./plasm -AMOW dhgr.tk/utils/dhgreasy.pla
acme --setpc 4094 -o $(DHGREASY) dhgr.tk/utils/dhgreasy.a
$(DHGRSHOW): dhgr.tk/utils/dhgrshow.pla $(DHGRLIB) $(DHGRUTILS) dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./plasm -AMOW dhgr.tk/utils/dhgrshow.pla
acme --setpc 4094 -o $(DHGRSHOW) dhgr.tk/utils/dhgrshow.a
$(DLGRSHOW): dhgr.tk/utils/dlgrshow.pla $(DHGRLIB) $(DHGRUTILS) dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./plasm -AMOW dhgr.tk/utils/dlgrshow.pla
acme --setpc 4094 -o $(DLGRSHOW) dhgr.tk/utils/dlgrshow.a
$(DHGRRGB): dhgr.tk/utils/dhgrrgb.pla $(DHGRLIB) $(DHGRUTILS) dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./plasm -AMOW dhgr.tk/utils/dhgrrgb.pla
acme --setpc 4094 -o $(DHGRRGB) dhgr.tk/utils/dhgrrgb.a
$(PENGUINS): dhgr.tk/demos/penguins/penguins.pla dhgr.tk/inc/dhgrlib.plh dhgr.tk/inc/dhgrutils.plh
./plasm -AMOW dhgr.tk/demos/penguins/penguins.pla
acme --setpc 4094 -o $(PENGUINS) dhgr.tk/demos/penguins/penguins.a

View File

@ -1,7 +1,7 @@
include "inc/cmdsys.plh"
include "inc/lines.plh"
include "inc/dcgrlib.plh"
include "inc/dcgrutils.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
sysflags resxtxt1|reshgr1|resxhgr1
//
@ -94,34 +94,34 @@ def dcgrCompSprite(offset)#0
byte i
for i = 0 to 6
sprite7[i],sprite7span = dcgrAllocBl7Mem(SPR_W+offset,SPR_H)
sprite7[i],sprite7span = dhgrAllocBl7Mem(SPR_W+offset,SPR_H)
sprite7w = sprite7span >> 2
dcgrSurfMem(OP_SRC,SPR_H,sprite7[i],sprite7span)
dhgrSurfMem(OP_SRC,SPR_H,sprite7[i],sprite7span)
dcgrColor(CLR_BLACK)
dcgrClearBl7(0,0,sprite7w,SPR_H)
dhgrClearBl7(0,0,sprite7w,SPR_H)
//dcgrPixMap(i + offset,0,SPR_W,SPR_H,@sprite)
//dcgrRleMap(i + offset,0,SPR_W,SPR_H,@rlesprt)
dcgrRleMap(i + offset,0,SPR_W,SPR_H,rlesprptr)
dcgrSurfScr(OP_SRC)
dcgrMemBl7(0,i*SPR_H,sprite7w,SPR_H,sprite7[i],sprite7span)
dhgrSurfScr(OP_SRC)
dhgrMemBl7(0,i*SPR_H,sprite7w,SPR_H,sprite7[i],sprite7span)
next
end
def dcgrCompMask(offset)#0
byte i
for i = 0 to 6
sprite7msk[i],sprite7span = dcgrAllocBl7Mem(SPR_W + offset,SPR_H)
sprite7msk[i],sprite7span = dhgrAllocBl7Mem(SPR_W + offset,SPR_H)
sprite7w = sprite7span >> 2
dcgrSurfMem(OP_SRC,SPR_H,sprite7msk[i],sprite7span)
dhgrSurfMem(OP_SRC,SPR_H,sprite7msk[i],sprite7span)
dcgrColor(CLR_WHITE)
dcgrClearBl7(0,0,sprite7w,SPR_H)
dhgrClearBl7(0,0,sprite7w,SPR_H)
//dcgrPixMap(i + offset,0,SPR_W,SPR_H,@sprite)
dcgrRleMap(i + offset,0,SPR_W,SPR_H,@rlesprt)
dcgrOp(OP_XOR)
dhgrOp(OP_XOR)
//dcgrPixMap(i + offset,0,SPR_W,SPR_H,@sprite)
dcgrRleMap(i + offset,0,SPR_W,SPR_H,@rlesprt)
dcgrSurfScr(OP_SRC)
dcgrMemBl7(sprite7w,i * SPR_H,sprite7w,SPR_H,sprite7msk[i],sprite7span)
dhgrSurfScr(OP_SRC)
dhgrMemBl7(sprite7w,i * SPR_H,sprite7w,SPR_H,sprite7msk[i],sprite7span)
next
end
def readEnterprise#0
@ -138,9 +138,9 @@ def readEnterprise#0
t_ptr=>spr_height = height
t_ptr=>spr_pixmap = pixptr
t_ptr=>spr_bl7 = heapalloc(ENT_SZ)
dcgrSurfMem(OP_SRC,ENT_H,t_ptr=>spr_bl7,ENT_W7*4)
dhgrSurfMem(OP_SRC,ENT_H,t_ptr=>spr_bl7,ENT_W7*4)
dcgrColor(CLR_BLACK)
dcgrClearBl7(0,0,ENT_W7,ENT_H)
dhgrClearBl7(0,0,ENT_W7,ENT_H)
dcgrPixmap(ENT_W7*7/2 - xorg,ENT_H/2 - yorg,width,height,pixptr)
t_ptr = t_ptr + t_sprite
f_ptr = f_ptr + 12
@ -157,7 +157,7 @@ def dhgrTest#0
//
// Double Hires Lines
//
dcgrSurfScr(OP_OR)
dhgrSurfScr(OP_OR)
setlineplot(@dhgrSet)
for i = 559 downto 0 step 20
line(0,0,i,191)
@ -174,20 +174,20 @@ def dcgrTest#0
//
// Use back buffer for tile set buffer
//
backblk,backspan = dcgrAllocBl7Mem(SCR_WIDTH,SPR_H)
backblk,backspan = dhgrAllocBl7Mem(SCR_WIDTH,SPR_H)
j = 0
while ^$C000 < 128
//
// Convert compiled sprite into tile set
//
dcgrMemBl7Tile(0,0,sprite7[j],sprite7span,backblk)
dcgrMemBl7Tile(1,0,sprite7[j],sprite7span,backblk + 32)
dcgrMemBl7Tile(2,0,sprite7[j],sprite7span,backblk + 64)
dcgrMemBl7Tile(3,0,sprite7[j],sprite7span,backblk + 96)
dcgrMemBl7Tile(0,8,sprite7[j],sprite7span,backblk + 128)
dcgrMemBl7Tile(1,8,sprite7[j],sprite7span,backblk + 160)
dcgrMemBl7Tile(2,8,sprite7[j],sprite7span,backblk + 192)
dcgrMemBl7Tile(3,8,sprite7[j],sprite7span,backblk + 224)
dhgrMemBl7Tile(0,0,sprite7[j],sprite7span,backblk)
dhgrMemBl7Tile(1,0,sprite7[j],sprite7span,backblk + 32)
dhgrMemBl7Tile(2,0,sprite7[j],sprite7span,backblk + 64)
dhgrMemBl7Tile(3,0,sprite7[j],sprite7span,backblk + 96)
dhgrMemBl7Tile(0,8,sprite7[j],sprite7span,backblk + 128)
dhgrMemBl7Tile(1,8,sprite7[j],sprite7span,backblk + 160)
dhgrMemBl7Tile(2,8,sprite7[j],sprite7span,backblk + 192)
dhgrMemBl7Tile(3,8,sprite7[j],sprite7span,backblk + 224)
//
// Fill screen wil tiles matching compiled sprite
//
@ -197,10 +197,10 @@ def dcgrTest#0
for i = 0 to 19
tilestr[i + 20] = (i & $03) + 4
next
dcgrSurfScr(OP_SRC)
dhgrSurfScr(OP_SRC)
for i = 0 to 12 step 2
dcgrTiles(10,i, @tilestr, 10,backblk)
dcgrTiles(10,i + 1,@tilestr + 20,10,backblk)
dhgrTiles(10,i, @tilestr, 10,backblk)
dhgrTiles(10,i + 1,@tilestr + 20,10,backblk)
next
j++
if j == 7; j = 0; fin
@ -209,7 +209,7 @@ def dcgrTest#0
//
// Lines
//
dcgrSurfScr(OP_SRC)
dhgrSurfScr(OP_SRC)
setlineplot(@dcgrPixel)
setlinespans(@dcgrHLin,@dcgrVLin)
for i = 0 to 191 step 2
@ -221,7 +221,7 @@ def dcgrTest#0
linespans(0,0,i,191)
next
dcgrColor(CLR_BLACK)
dcgrClearBl7(21/7,30,100/7,132)
dhgrClearBl7(21/7,30,100/7,132)
dcgrColor(CLR_WHITE)
dcgrHLin((21/7)*7-1,(21/7)*7+(100/7)*7,29)
dcgrHLin((21/7)*7-1,(21/7)*7+(100/7)*7,29+133)
@ -235,17 +235,17 @@ def dcgrTest#0
i = 64; j = 64; k = 86
k7 = k/7
inci = 1; incj = 1; inck = 2
dcgrSurfMem(OP_SRC,SPR_H,backblk,backspan)
dcgrScrBl7(0,SLIDE_Y,backspan >> 2,SPR_H)
dcgrSurfScr(OP_SRC)
dhgrSurfMem(OP_SRC,SPR_H,backblk,backspan)
dhgrScrBl7(0,SLIDE_Y,backspan >> 2,SPR_H)
dhgrSurfScr(OP_SRC)
dcgrColor(CLR_WHITE)
dcgrHLin(0,139,SLIDE_Y)
dcgrHLin(0,139,SLIDE_Y+SPR_H-1)
dcgrVLin(SLIDE_Y,SLIDE_Y+SPR_H-1,0)
dcgrVLin(SLIDE_Y,SLIDE_Y+SPR_H-1,139)
getc
dcgrMemBl7(0,SLIDE_Y,backspan >> 2,SPR_H,backblk,backspan)
restrblk,restrspan = dcgrAllocBl7Mem(SPR_W,SPR_H)
dhgrMemBl7(0,SLIDE_Y,backspan >> 2,SPR_H,backblk,backspan)
restrblk,restrspan = dhgrAllocBl7Mem(SPR_W,SPR_H)
restr7w = restrspan >> 2
restrw = restr7w * 7
mode = 1
@ -262,55 +262,55 @@ def dcgrTest#0
fin
when mode
is 1
dcgrSurfScr(OP_SRC)
dcgrMemBl7(i7,j,s7w,SPR_H,sprite7[im7],sprite7span)
dhgrSurfScr(OP_SRC)
dhgrMemBl7(i7,j,s7w,SPR_H,sprite7[im7],sprite7span)
is 2
if k < 0 and km7 // Handle off left edge special case
k7--
km7 = 7 + km7
fin
dcgrSurfMem(OP_SRC,SPR_H,restrblk,restrspan)
dcgrMemBl7(0,0,restr7w,SPR_H,backblk + (k7 << 1),backspan)
dcgrOp(OP_AND)
dcgrMemBl7(0,0,sprite7w,SPR_H,sprite7msk[km7],sprite7span)
dcgrOp(OP_XOR)
dcgrMemBl7(0,0,sprite7w,SPR_H,sprite7[km7],sprite7span)
dcgrSurfScr(OP_SRC)
dcgrMemBl7(k7,SLIDE_Y,restr7w,SPR_H,restrblk,restrspan)
dhgrSurfMem(OP_SRC,SPR_H,restrblk,restrspan)
dhgrMemBl7(0,0,restr7w,SPR_H,backblk + (k7 << 1),backspan)
dhgrOp(OP_AND)
dhgrMemBl7(0,0,sprite7w,SPR_H,sprite7msk[km7],sprite7span)
dhgrOp(OP_XOR)
dhgrMemBl7(0,0,sprite7w,SPR_H,sprite7[km7],sprite7span)
dhgrSurfScr(OP_SRC)
dhgrMemBl7(k7,SLIDE_Y,restr7w,SPR_H,restrblk,restrspan)
break
is 3
dcgrSurfScr(OP_SRC)
dhgrSurfScr(OP_SRC)
dcgrPixMap(i,j,SPR_W,SPR_H,@sprite)
is 4
dcgrSurfMem(OP_SRC,SPR_H,restrblk,restrspan)
dcgrMemBl7(0,0,restr7w,SPR_H,backblk + (k7 << 1),backspan)
dhgrSurfMem(OP_SRC,SPR_H,restrblk,restrspan)
dhgrMemBl7(0,0,restr7w,SPR_H,backblk + (k7 << 1),backspan)
dcgrPixMap(km7 + 2,0,SPR_W,SPR_H,@sprite)
dcgrSurfScr(OP_SRC)
dcgrMemBl7(k7,SLIDE_Y,restr7w,SPR_H,restrblk,restrspan)
dhgrSurfScr(OP_SRC)
dhgrMemBl7(k7,SLIDE_Y,restr7w,SPR_H,restrblk,restrspan)
break
is 5
dcgrSurfScr(OP_SRC)
dhgrSurfScr(OP_SRC)
dcgrPixMap(i,j,SPR_W,SPR_H,@sprite)
is 6
dcgrSurfMem(OP_SRC,SPR_H,restrblk,restrspan)
dcgrMemBl7(0,0,restr7w,SPR_H,backblk + (k7 << 1),backspan)
dhgrSurfMem(OP_SRC,SPR_H,restrblk,restrspan)
dhgrMemBl7(0,0,restr7w,SPR_H,backblk + (k7 << 1),backspan)
dcgrColor(CLR_BLACK)
dcgrRect(km7 + 2,3,16 + 2,10)
dcgrColor(CLR_WHITE)
dcgrStr(km7 + 3,4,"DCGR")
dcgrSurfScr(OP_SRC)
dcgrMemBl7(k7,SLIDE_Y,restr7w,SPR_H,restrblk,restrspan)
dhgrSurfScr(OP_SRC)
dhgrMemBl7(k7,SLIDE_Y,restr7w,SPR_H,restrblk,restrspan)
break
is 7
dcgrSurfScr(OP_SRC)
dcgrMemBl7(i7,j,s7w,SPR_H,sprite7[im7],sprite7span)
dhgrSurfScr(OP_SRC)
dhgrMemBl7(i7,j,s7w,SPR_H,sprite7[im7],sprite7span)
break
is 8
dcgrSurfScr(OP_SRC)
dhgrSurfScr(OP_SRC)
dcgrPixMap(i,j,SPR_W,SPR_H,@sprite)
break
is 9
dcgrSurfScr(OP_XOR)
dhgrSurfScr(OP_XOR)
dcgrPixMap(i,j,SPR_W,SPR_H,@sprite)
dcgrPixMap(oi,oj,SPR_W,SPR_H,@sprite)
break
@ -326,10 +326,10 @@ def dcgrTest#0
//
// Rotate Enterprise
//
dcgrSurfScr(OP_SRC)
dhgrSurfScr(OP_SRC)
dcgrColor(CLR_BLACK)
dcgrClearBl7(21/7,30,100/7,132)
dcgrOp(OP_XOR)
dhgrClearBl7(21/7,30,100/7,132)
dhgrOp(OP_XOR)
k = 0
i = @ncc1701
oi = 73-i=>spr_xorg
@ -348,10 +348,10 @@ def dcgrTest#0
dcgrPixMap(oi,oj,i=>spr_width,i=>spr_height,i=>spr_pixmap)
loop
getc
dcgrOp(OP_SRC)
dhgrOp(OP_SRC)
while ^$C000 < 128
dcgrColor(CLR_BLACK)
dcgrClearBl7(60/7,75,5,43)
dhgrClearBl7(60/7,75,5,43)
oi = 73-i=>spr_xorg
oj = 96-i=>spr_yorg
dcgrPixMap(oi,oj,i=>spr_width,i=>spr_height,i=>spr_pixmap)
@ -364,7 +364,7 @@ def dcgrTest#0
loop
getc
while ^$C000 < 128
dcgrMemBl7(60/7,75,ENT_W7,ENT_H,i=>spr_bl7,ENT_W7*4)
dhgrMemBl7(60/7,75,ENT_W7,ENT_H,i=>spr_bl7,ENT_W7*4)
i = i + t_sprite
k++
if k > 7
@ -377,27 +377,27 @@ def dcgrTest#0
// Re-use the back buffer for a stipple pattern to mask the screen
//
for k = 0 to 2
dcgrSurfMem(OP_SRC,SPR_H,backblk,backspan)
dhgrSurfMem(OP_SRC,SPR_H,backblk,backspan)
dcgrColor(CLR_WHITE)
dcgrClearBl7(0,0,SCR_WIDTH7,SPR_H)
dhgrClearBl7(0,0,SCR_WIDTH7,SPR_H)
dcgrColor(CLR_BLACK)
for i = 0 to 139 step 16
dcgrBitMap(i,0,16,16,dither[k])
next
dcgrSurfScr(OP_AND)
dhgrSurfScr(OP_AND)
for j = 0 to 95 step 16
dcgrMemBl7(0,j,SCR_WIDTH7,16,backblk,backspan)
dcgrMemBl7(0,175 - j,SCR_WIDTH7,16,backblk,backspan)
dhgrMemBl7(0,j,SCR_WIDTH7,16,backblk,backspan)
dhgrMemBl7(0,175 - j,SCR_WIDTH7,16,backblk,backspan)
next
next
dcgrSurfScr(OP_SRC)
dcgrClearBl7(0,0,SCR_WIDTH7,SCR_HEIGHT)
dhgrSurfScr(OP_SRC)
dhgrClearBl7(0,0,SCR_WIDTH7,SCR_HEIGHT)
//
// Create color patterns
//
for i = 0 to 15
dcgrColor(i)
dcgrClearBl7(i,0,1,SCR_HEIGHT)
dhgrClearBl7(i,0,1,SCR_HEIGHT)
next
oj = 0
for j = 0 to 191 step 12
@ -412,7 +412,7 @@ def dcgrTest#0
getc
for i = 0 to 15
dcgrColor(i)
dcgrClearBl7(i,0,1,SCR_HEIGHT)
dhgrClearBl7(i,0,1,SCR_HEIGHT)
next
oj = 0
for j = 0 to 191 step 12
@ -427,7 +427,7 @@ def dcgrTest#0
getc
for i = 0 to 15
dcgrColor(i)
dcgrClearBl7(i,0,1,SCR_HEIGHT)
dhgrClearBl7(i,0,1,SCR_HEIGHT)
next
oj = 0
for j = 0 to 191 step 12
@ -444,15 +444,15 @@ end
rlesprptr = heapmark
heapalloc(dcgrEncPixMap(SPR_W,SPR_H,@sprite,rlesprptr))
dcgrMode(0)
dhgrMode(DHGR_COLOR_MODE)
dhgrTest
screenRead("splash.dhgr")
dcgrOp(OP_SRC)
dhgrOp(OP_SRC)
dcgrPixMap(10,10,20,20,dcgrGetPixMap(60,66,20,20))
getc
readEnterprise
dcgrCompSprite(2)
dcgrCompMask(2)
dcgrTest
dcgrMode(-1)
dhgrMode(DHGR_TEXT_MODE)
done

View File

@ -1,14 +1,18 @@
include "inc/cmdsys.plh"
include "inc/args.plh"
include "inc/dcgrlib.plh"
include "inc/dcgrutils.plh"
include "inc/fileio.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
sysflags restxt1|resxtxt1|reshgr1|resxhgr1 // Reserve all the pages
const PAUSE = 1
const HEIGHT_X2 = 2
char[64] greasyfile = ""
byte[20*40] frame
byte pause = FALSE
byte[40*96/2] frame
byte flags
byte frameHeight = 40
var arg
@ -17,14 +21,24 @@ def greasy2dcgr(pGreasy)#0
var pPixmap
pPixmap = @frame
for j = 0 to 39 step 2
for j = 0 to frameHeight-1 step 2
for i = 0 to 39 step 2
cl = ^(pGreasy + i)
ch = ^(pGreasy + i + 1)
^(pPixmap + i / 2) = (cl & $0F) | (ch << 4)
^(pPixmap + i / 2 + 20) = (cl >> 4) | (ch & $F0)
^(pPixmap + i / 2) = (cl & $0F) | (ch << 4)
if flags & HEIGHT_X2
^(pPixmap + i / 2 + 20) = (cl & $0F) | (ch << 4)
^(pPixmap + i / 2 + 40) = (cl >> 4) | (ch & $F0)
^(pPixmap + i / 2 + 60) = (cl >> 4) | (ch & $F0)
else
^(pPixmap + i / 2 + 20) = (cl >> 4) | (ch & $F0)
fin
next
pPixmap = pPixmap + 40
if flags & HEIGHT_X2
pPixmap = pPixmap + 80
else
pPixmap = pPixmap + 40
fin
pGreasy = pGreasy + 40
next
end
@ -36,7 +50,7 @@ def greasyRead(filestr, frame)#1
sprptr = 0
refnum = fileio:open(filestr)
if refnum
sprsize = 40 * 40 / 2
sprsize = 40 * frameHeight / 2
sprptr = heapalloc(sprsize)
if sprptr and fileio:read(refnum, @numframes, 1)
if numframes < frame
@ -60,22 +74,31 @@ end
def importGreasy#0
var grptr
byte screennum, framenum, i, j
byte screennum, framenum, i, j, numrows
char[64] screenfile
screennum = 1
framenum = 1
dcgrMode(0)
dhgrMode(DHGR_COLOR_MODE)
numrows = 192 / frameHeight
if flags & HEIGHT_X2
numrows = numrows / 2
fin
numrows--
while framenum
dcgrColor(CLR_GREY1)
dcgrClearBl7(0, 0, SCR_WIDTH7, SCR_HEIGHT)
for j = 0 to 3
dhgrClearBl7(0, 0, SCR_WIDTH7, SCR_HEIGHT)
for j = 0 to numrows
for i = 0 to 2
grptr = greasyRead(@greasyfile, framenum)
if grptr
greasy2dcgr(grptr)
heaprelease(grptr)
dcgrPixMap(i*40+20, j*40+20, 40, 40, @frame)
if flags & HEIGHT_X2
dcgrPixMap(i*42+8, j*(frameHeight+1)*2+2, 40, frameHeight*2, @frame)
else
dcgrPixMap(i*42+8, j*(frameHeight+2)+2, 40, frameHeight, @frame)
fin
framenum++
else
framenum = 0
@ -90,28 +113,36 @@ def importGreasy#0
screenfile[screenfile] = '0' + screennum
screennum++
if screenWrite(@screenfile)
dcgrMode(-1)
dhgrMode(DHGR_TEXT_MODE)
puts("Error writing: "); puts(@screenfile); putln
return
fin
if pause; getc; fin
if flags & PAUSE; getc; fin
loop
dcgrMode(-1)
dhgrMode(DHGR_TEXT_MODE)
end
arg = argNext(argFirst)
if ^arg
if ^(arg + 1) == '-'
if toupper(^(arg + 2)) == 'P'
pause = TRUE
fin
while arg and ^(arg + 1) == '-'
when toupper(^(arg + 2))
is 'P'
flags = flags | PAUSE
break
is '2'
flags = flags | HEIGHT_X2
break
is 'T'
frameHeight = 48
break
wend
arg = argNext(arg)
fin
loop
if ^arg
strcpy(@greasyfile, arg)
importGreasy
return 0
fin
fin
puts("Usage: DCGRGREASY [-P] FRAMEFILE\n")
puts("Usage: DHGRGREASY [-P] [-2] [-T] FRAMEFILE\n")
done

View File

@ -1,8 +1,8 @@
include "inc/cmdsys.plh"
include "inc/dcgrlib.plh"
include "inc/dcgrutils.plh"
include "inc/args.plh"
include "inc/fileio.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
sysflags resxtxt1|reshgr1|resxhgr1
@ -144,7 +144,7 @@ def rgbInit#0
gamma[i] = i / 4
next
fin
dcgrMode(0)
dhgrMode(DHGR_COLOR_MODE)
// Init error propogation array
rgbErr = heapalloc(561 * 3 * 2)
memset(rgberr, 0, 560 * 3 * 2)
@ -155,7 +155,7 @@ end
def rgbExit#0
heaprelease(rgbErr)
dcgrMode(-1)
dhgrMode(DHGR_TEXT_MODE)
end
def rgb3Spans(rs, gs, bs, re, ge, be, rm, gm, bm, y)#0
@ -254,5 +254,5 @@ if ^arg
fin
return 0
fin
puts("Usage: DCGRRGB [-T] [-L] [-E##] RGBFILE [DHGRFILE]\n")
puts("Usage: DHGRRGB [-T] [-L] [-E##] RGBFILE [DHGRFILE]\n")
done

View File

@ -1,10 +1,10 @@
include "inc/cmdsys.plh"
include "inc/dcgrlib.plh"
include "inc/dcgrutils.plh"
include "inc/args.plh"
include "inc/fileio.plh"
include "inc/matchfiles.plh"
include "inc/lz4.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
sysflags resxtxt1|reshgr1|resxhgr1|reshgr2
@ -12,8 +12,7 @@ const page1m = $C054
const page1x = $C055
byte dolz4, quit
char[64] wildfile
var arg, srcfilelist, srcfileptr, srccnt
var arg, srcfilelist, srcpath, srcexp, srccnt
var entrylist, entrycnt
//
@ -136,20 +135,28 @@ while ^arg
//
// Add to source list
//
struprcpy(@wildfile, arg)
entrylist, entrycnt = matchList(NULL, @wildfile)
srcpath, srcexp = splitPathFile(arg)
entrylist, entrycnt = matchList(srcpath, srcexp)
if not entrylist
puts(@wildfile); puts(" ???\n")
puts(arg); puts(" ???\n")
else
if not srcfilelist
srcfilelist = entrylist
fin
srccnt = srccnt + entrycnt
while entrycnt
//
// Prepend path to filename
//
strcpy(entrylist, strcat(strcpy(heapmark, srcpath), entrylist))
entrylist = entrylist + t_fileentry
entrycnt--
loop
fin
arg = argNext(arg)
loop
if srccnt
dcgrMode(0)
dhgrMode(DHGR_COLOR_MODE)
if srccnt == 1
screenShow(srcfilelist)
getc
@ -166,8 +173,8 @@ if srccnt
loop
until quit
fin
dcgrMode(-1)
dhgrMode(DHGR_TEXT_MODE)
return 0
fin
puts("Usage: DCGRSHOW [-Z] <FILES>+\n")
puts("Usage: DHGRSHOW [-Z] <FILES>+\n")
done

View File

@ -1,9 +1,9 @@
include "inc/cmdsys.plh"
include "inc/args.plh"
include "inc/grlib.plh"
include "inc/dcgrlib.plh"
include "inc/dcgrutils.plh"
include "inc/fileio.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
sysflags restxt1|restxt2|resxtxt1|reshgr1|resxhgr1 // Reserve all the pages
@ -129,7 +129,7 @@ end
def importGreasy(frame)
var sprptr
sprptr = frameRead(@filename, frame)
if sprptr
heaprelease(sprptr)
@ -161,7 +161,7 @@ end
def strnum(strptr)
var num
num = 0
while ^strptr == ' '; strptr++; loop
while ^strptr >= '0' and ^strptr <= '9'
@ -261,7 +261,7 @@ def getCmd#1
filename = filename - 3
fin
fin
if frame
if frame
modified = importGreasy(frame)
if not modified
filename[filename + 1] = '.'
@ -394,9 +394,9 @@ def dcgrTestView(bounce)#0
i = 70-20; inci = bounce
j = 96-24; incj = bounce
grMode(grOff)
dcgrMode(0)
dhgrMode(DHGR_COLOR_MODE)
dcgrColor(clrCursor)
dcgrClearBl7(0, 0, SCR_WIDTH7, SCR_HEIGHT)
dhgrClearBl7(0, 0, SCR_WIDTH7, SCR_HEIGHT)
while ^$C000 < 128
dcgrPixMap(i, j, 40, 48, @dcgrSprite)
i = i + inci
@ -405,7 +405,7 @@ def dcgrTestView(bounce)#0
if j < 1 or j > 191-48; incj = -incj; fin
loop
^$C010
dcgrMode(-1)
dhgrMode(DHGR_TEXT_MODE)
grMode(grPage1)
grDrawBuf(grPage1)
grView

View File

@ -0,0 +1,160 @@
include "inc/cmdsys.plh"
include "inc/args.plh"
include "inc/fileio.plh"
include "inc/matchfiles.plh"
include "dhgr.tk/inc/dhgrlib.plh"
include "dhgr.tk/inc/dhgrutils.plh"
sysflags restxt1|resxtxt1|reshgr1|resxhgr1 // Reserve all the pages
const FRAME_WIDTH = 80
const FRAME_HEIGHT = 48
const FRAME_SIZE = FRAME_WIDTH * FRAME_HEIGHT / 2
const DLGRFRAME_SIZE = 2047
const PAUSE = 1
const HEIGHT_X2 = 2
var arg, srcfilelist, srcpath, srcexp, srccnt
var entrylist, entrycnt
byte[FRAME_SIZE*2] frame
byte flags
//
// Screen row address arrays.
//
word rowofst = $0000,$0080,$0100,$0180,$0200,$0280,$0300,$0380
word = $0028,$00A8,$0128,$01A8,$0228,$02A8,$0328,$03A8
word = $0050,$00D0,$0150,$01D0,$0250,$02D0,$0350,$03D0
byte rotclr = $00,$22,$44,$66,$888,$AA,$CC,$EE
byte = $11,$33,$55,$77,$99,$BB,$DD,$FF
def dlgr2dcgr(dlgrptr)#0
byte i, j, cl, ch
var pixptr, rowptr
pixptr = @frame
for j = 0 to 47 step 2
rowptr = dlgrptr + rowofst[j / 2]
for i = 0 to 39
cl = ^(rowptr + i + 1024)
cl = (rotclr[cl & $0F] & $0F) | (rotclr[cl >> 4] & $F0)
ch = ^(rowptr + i)
^(pixptr + i) = (cl & $0F) | (ch << 4)
if flags & HEIGHT_X2
^(pixptr + i + 40) = (cl & $0F) | (ch << 4)
^(pixptr + i + 80) = (cl >> 4) | (ch & $F0)
^(pixptr + i + 120) = (cl >> 4) | (ch & $F0)
else
^(pixptr + i + 40) = (cl >> 4) | (ch & $F0)
fin
next
if flags & HEIGHT_X2
pixptr = pixptr + 160
else
pixptr = pixptr + 80
fin
next
end
def dlgrRead(filestr)#1
var frameptr
byte refnum
frameptr = 0
refnum = fileio:open(filestr)
if refnum
frameptr = heapalloc(DLGRFRAME_SIZE)
if frameptr and fileio:read(refnum, frameptr, DLGRFRAME_SIZE) <> DLGRFRAME_SIZE
heaprelease(frameptr)
frameptr = NULL
fin
fileio:close(refnum)
fin
return frameptr
end
def dlgrImport(filename, framenum)#0
var dlgrptr
byte screennum, i, j, numrows
char[64] screenfile
screennum = framenum / 4
numrows = 192 / FRAME_HEIGHT
if flags & HEIGHT_X2
numrows = numrows / 2
fin
numrows--
j = framenum & ((flags & HEIGHT_X2) ?? 1 :: 3)
if not j
if framenum; getc; fin // Pause between frames
dcgrColor(CLR_GREY1)
dhgrClearBl7(0, 0, SCR_WIDTH7, SCR_HEIGHT)
fin
dlgrptr = dlgrRead(filename)
if dlgrptr
dlgr2dcgr(dlgrptr)
heaprelease(dlgrptr)
if flags & HEIGHT_X2
dcgrPixMap(30, j*FRAME_HEIGHT*2, FRAME_WIDTH, FRAME_HEIGHT*2, @frame)
else
dcgrPixMap(30, j*FRAME_HEIGHT, FRAME_WIDTH, FRAME_HEIGHT, @frame)
fin
fin
strcpy(@screenfile, filename)
strcat(@screenfile, ".SCR")
screenfile++
screenfile[screenfile] = '0' + screennum
screennum++
//if screenWrite(@screenfile)
// dhgrMode(DHGR_TEXT_MODE)
// puts("Error writing: "); puts(@screenfile); putln
// return
//fin
end
arg = argNext(argFirst)
while arg and ^(arg + 1) == '-'
when toupper(^(arg + 2))
is '2'
flags = flags | HEIGHT_X2
break
wend
arg = argNext(arg)
loop
while ^arg
//
// Add to source list
//
srcpath, srcexp = splitPathFile(arg)
entrylist, entrycnt = matchList(srcpath, srcexp)
if not entrylist
puts(arg); puts(" ???\n")
else
if not srcfilelist
srcfilelist = entrylist
fin
srccnt = srccnt + entrycnt
while entrycnt
//
// Prepend path to filename
//
strcpy(entrylist, strcat(strcpy(heapmark, srcpath), entrylist))
entrylist = entrylist + t_fileentry
entrycnt--
loop
fin
arg = argNext(arg)
loop
if srccnt
dhgrMode(DHGR_COLOR_MODE)
for entrycnt = 0 to srccnt - 1
dlgrImport(srcfilelist, entrycnt)
srcfilelist = srcfilelist + t_fileentry
entrycnt++
next
getc
dhgrMode(DHGR_TEXT_MODE)
return 0
fin
puts("Usage: DHGRGREASY [-P] [-2] [-T] FRAMEFILE\n")
done

View File

@ -3,4 +3,5 @@ import matchfiles
predef matchList(pathptr, exp)#2
predef isWildName(exp)#1
predef fileFromPath(filestr, pathstr)#0
predef splitPathFile(pathstr)#2
end

View File

@ -2,6 +2,9 @@ include "inc/cmdsys.plh"
include "inc/fileio.plh"
var dirbuf
char[64] srcpath
char[64] srcfile
//
// Match next section of source and expression
//
@ -127,4 +130,18 @@ export def fileFromPath(filestr, pathstr)#0
^filestr = ^pathstr - i
memcpy(filestr + 1, pathstr + 1 + i, ^filestr)
end
//
// Split path and filename apart
//
export def splitPathFile(pathstr)#2
byte i
for i = 0 to ^pathstr
srcpath[i] = toupper(^(pathstr + i))
next
fileFromPath(@srcfile, @srcpath)
srcpath = srcpath - srcfile
return @srcpath, @srcfile
end
done

View File

@ -248,4 +248,4 @@ cp inc/extheader.inc prodos/bld/inc/EXTHEADER.INC.TXT
cp inc/extdefseg.inc prodos/bld/inc/EXTDEFSEG.INC.TXT
make -f dcgr.tk/makefile all
make -f dhgr.tk/makefile all