diff --git a/src/inc/dcgrlib.plh b/src/inc/dcgrlib.plh index 9992777..0fd0ac9 100644 --- a/src/inc/dcgrlib.plh +++ b/src/inc/dcgrlib.plh @@ -10,19 +10,19 @@ import dcgrlib const OP_OR = 3 const CLR_BLACK = 0 const CLR_MAGENTA = 1 - const CLR_BROWN = 2 - const CLR_ORANGE = 3 + const CLR_DRKBLUE = 2 + const CLR_PURPLE = 3 const CLR_DRKGREEN = 4 const CLR_GREY1 = 5 const CLR_XPARENT = 5 - const CLR_GREEN = 6 - const CLR_YELLOW = 7 - const CLR_DRKBLUE = 8 - const CLR_PURPLE = 9 + const CLR_MEDBLUE = 6 + const CLR_LTBLUE = 7 + const CLR_BROWN = 8 + const CLR_ORANGE = 9 const CLR_GREY2 = 10 const CLR_PINK = 11 - const CLR_MEDBLUE = 12 - const CLR_LTBLUE = 13 + const CLR_GREEN = 12 + const CLR_YELLOW = 13 const CLR_AQUA = 14 const CLR_WHITE = 15 diff --git a/src/libsrc/apple/dcgrlib.pla b/src/libsrc/apple/dcgrlib.pla index 1bba877..f13ffdc 100644 --- a/src/libsrc/apple/dcgrlib.pla +++ b/src/libsrc/apple/dcgrlib.pla @@ -104,66 +104,66 @@ byte = $78|$80 // byte auxclrsl[] = $00 // black byte = $08 // magenta -byte = $44 // brown -byte = $4C // orange -byte = $22 // dark green -byte = $2A // gray 1 -byte = $66 // green -byte = $6E // yellow byte = $11 // dark blue byte = $19 // purple -byte = $55 // gray 2 -byte = $5D // pink +byte = $22 // dark green +byte = $2A // gray 1 byte = $33 // medium blue byte = $3B // light blue +byte = $44 // brown +byte = $4C // orange +byte = $55 // gray 2 +byte = $5D // pink +byte = $66 // green +byte = $6E // yellow byte = $77 // aqua byte = $7F // white byte auxclrsh[] = $00 // black byte = $22 // magenta -byte = $11 // brown -byte = $33 // orange -byte = $08 // dark green -byte = $2A // gray 1 -byte = $19 // green -byte = $3B // yellow byte = $44 // dark blue byte = $66 // purple -byte = $55 // gray 2 -byte = $77 // pink +byte = $08 // dark green +byte = $2A // gray 1 byte = $4C // medium blue byte = $6E // light blue +byte = $11 // brown +byte = $33 // orange +byte = $55 // gray 2 +byte = $77 // pink +byte = $19 // green +byte = $3B // yellow byte = $5D // aqua byte = $7F // white byte memclrsl[] = $00 // black byte = $11 // magenta -byte = $08 // brown -byte = $19 // orange -byte = $44 // dark green -byte = $55 // gray 1 -byte = $4C // green -byte = $5D // yellow byte = $22 // dark blue byte = $33 // purple -byte = $2A // gray 2 -byte = $3B // pink +byte = $44 // dark green +byte = $55 // gray 1 byte = $66 // medium blue byte = $77 // light blue +byte = $08 // brown +byte = $19 // orange +byte = $2A // gray 2 +byte = $3B // pink +byte = $4C // green +byte = $5D // yellow byte = $6E // aqua byte = $7F // white byte memclrsh[] = $00 // black byte = $44 // magenta -byte = $22 // brown -byte = $66 // orange -byte = $11 // dark green -byte = $55 // gray 1 -byte = $33 // green -byte = $77 // yellow byte = $08 // dark blue byte = $4C // purple -byte = $2A // gray 2 -byte = $6E // pink +byte = $11 // dark green +byte = $55 // gray 1 byte = $19 // medium blue byte = $5D // light blue +byte = $22 // brown +byte = $66 // orange +byte = $2A // gray 2 +byte = $6E // pink +byte = $33 // green +byte = $77 // yellow byte = $3B // aqua byte = $7F // white byte auxclrl, auxclrh, memclrl, memclrh @@ -2069,10 +2069,12 @@ export def dcgrMode(mode)#1 ^show80col = 0 ^dhresena ^store80ena = 0 - dcgrOpScr(OP_SRC) dcgrOpMem(OP_SRC) + dcgrOpScr(OP_SRC) + dcgrSurface = DST_MEMORY + dcgrSurfScr(OP_SRC) dcgrColor(0) - dcgrClearBl7Scr(0, 0, 20, 192) + dcgrClearBl7(0, 0, 20, 192) else ^store80dis = 0 ^dhresdis diff --git a/src/samplesrc/dcgrspred.pla b/src/samplesrc/dcgrspred.pla index 875e0e4..eed4edb 100644 --- a/src/samplesrc/dcgrspred.pla +++ b/src/samplesrc/dcgrspred.pla @@ -4,28 +4,139 @@ include "inc/dcgrlib.plh" sysflags restxt1|restxt2|resxtxt1|reshgr1|resxhgr1 // Reserve all the pages -byte[] sprite1 = $80,$80,$00,$00,$00,$00,$80,$80 -byte[] = $80,$00,$0A,$0A,$0A,$0A,$00,$80 -byte[] = $00,$0A,$0F,$0F,$0F,$0F,$0A,$00 -byte[] = $00,$0A,$0F,$80,$80,$0F,$0A,$00 -byte[] = $00,$0A,$0F,$80,$80,$0F,$0A,$00 -byte[] = $00,$0A,$0F,$0F,$0F,$0F,$0A,$00 -byte[] = $80,$00,$0A,$0A,$0A,$0A,$00,$80 -byte[] = $80,$80,$00,$00,$00,$00,$80,$80 +byte[8] sprite1 = $85,$85,$00,$00,$00,$00,$85,$85 +byte[8] = $85,$00,$0A,$0A,$0A,$0A,$00,$85 +byte[8] = $00,$0A,$0F,$0F,$0F,$0F,$0A,$00 +byte[8] = $00,$0A,$0F,$85,$85,$0F,$0A,$00 +byte[8] = $00,$0A,$0F,$85,$85,$0F,$0A,$00 +byte[8] = $00,$0A,$0F,$0F,$0F,$0F,$0A,$00 +byte[8] = $85,$00,$0A,$0A,$0A,$0A,$00,$85 +byte[8] = $85,$85,$00,$00,$00,$00,$85,$85 +byte[40*40] grSprite +byte[40*20] dcgrSprite +byte[8*4] tile -byte[] tile1 = $11,$11,$11,$11,$11,$11,$55,$00 -byte[] = $11,$11,$11,$11,$11,$11,$55,$00 -byte[] = $11,$11,$11,$11,$11,$11,$55,$00 -byte[] = $05,$05,$05,$05,$05,$05,$05,$00 +byte quit = 0 +byte xCursor = 20 +byte yCursor = 20 +byte clrCursor = 0 +byte bgTileOfst = 0 -def grTest#0 - grMode(grPage1) - grDrawBuf(grPage1) - grFill(0, 0, @tile1) - grBLT(10, 10, 8, 8, @sprite1) - getc - grMode(grOff) +def grViewClr#0 + word c + byte[5] str + + c = clrCursor | (clrCursor << 4) + c = c | (c << 8) + memset(@tile, c, 8*4) + str[0] = 0 + grTileStr(0, 40, @str, 1, @tile) end -grTest +def grView#0 + grClear(5) + grBLT(0, 0, 40, 40, @grSprite) + grViewClr +end + +def grGetKey#1 + byte c + + ^$C010 + c = 0 + while ^$C000 < 128 + grColor(c) + grPlot(xCursor, yCursor) + c++ + loop + grColor(grSprite[yCursor * 40 + xCursor] & $0F) + grPlot(xCursor, yCursor) + return ^$C010 & $7F +end + +def dcgrTestView(bounce)#0 + byte cl, ch, i, j, inci, incj + word pgrSpr, pdcgrSpr + + pgrSpr = @grSprite + pdcgrSpr = @dcgrSprite + for j = 0 to 39 + for i = 0 to 39 step 2 + cl = ^pgrSpr & $0F + pgrSpr++ + ch = ^pgrSpr & $0F + pgrSpr++ + ^pdcgrSpr = cl | (ch << 4) + pdcgrSpr++ + next + next + i = 70-20; inci = 0 + j = 96-20; incj = 0 + if bounce + inci = 1 + incj = 1 + fin + grMode(grOff) + dcgrMode(0) + while ^$C000 < 128 + dcgrPixMap(i, j, 40, 40, @dcgrSprite) + i = i + inci + if i < 1 or i > 139-40; inci = -inci; fin + j = j + incj + if j < 1 or j > 191-40; incj = -incj; fin + loop + ^$C010 + dcgrMode(-1) + grMode(grPage1) + grDrawBuf(grPage1) + grView +end + +memset(@grSprite, $8585, 40*40) +for quit = 0 to 8 + memcpy(@grSprite + quit*40 + 16*40 + 16, @sprite1 + quit*8, 8) +next +quit = 0 +grMode(grPage1) +grDrawBuf(grPage1) +grView +while not quit + when grGetKey + is 'i' + if yCursor > 0; yCursor--; fin + break + is 'm' + if yCursor < 39; yCursor++; fin + break + is 'j' + if xCursor > 0; xCursor--; fin + break + is 'k' + if xCursor < 39; xCursor++; fin + break + is ' ' + grSprite[yCursor*40 + xCursor] = clrCursor == 5 ?? $85 :: clrCursor + grView + break + is '+' + is '=' + if clrCursor < 15; clrCursor++; fin + grViewClr + break + is '-' + if clrCursor > 0; clrCursor--; fin + grViewClr + break + is 'v' + dcgrTestView(FALSE) + break + is 't' + dcgrTestView(TRUE) + break + is 'q' + quit = 1 + break + wend +loop +grMode(grOff) done diff --git a/src/samplesrc/dcgrtest.pla b/src/samplesrc/dcgrtest.pla index 0c011dd..8e72325 100644 --- a/src/samplesrc/dcgrtest.pla +++ b/src/samplesrc/dcgrtest.pla @@ -228,7 +228,7 @@ def dcgrCompSprite#0 dcgrClearBl7(0, 0, sprite7w, SPRH) dcgrPixMap(i + 2, 0, SPRW, SPRH, @sprite) dcgrSurfScr(OP_SRC) - dcgrMemBl7(0, i * SPRH, sprite7w, SPRH, sprite7[i], sprite7span) + dcgrMemBl7(0, i * SPRH, sprite7w, SPRH, sprite7[i], sprite7span) next end def dcgrCompMask#0