diff --git a/images/apple/DCGR-TK.PO b/images/apple/DCGR-TK.PO index a0e21ea..72ba7ed 100755 Binary files a/images/apple/DCGR-TK.PO and b/images/apple/DCGR-TK.PO differ diff --git a/src/inc/dcgrutils.plh b/src/inc/dcgrutils.plh index d0682e0..98b8bd5 100644 --- a/src/inc/dcgrutils.plh +++ b/src/inc/dcgrutils.plh @@ -7,6 +7,7 @@ import dcgrutils 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 diff --git a/src/libsrc/apple/dcgrutils.pla b/src/libsrc/apple/dcgrutils.pla index 7044cc7..2d7d6d9 100644 --- a/src/libsrc/apple/dcgrutils.pla +++ b/src/libsrc/apple/dcgrutils.pla @@ -141,6 +141,34 @@ export def dcgrGetPixMap(x, y, w, h)#1 next return pixmap end +export def dcgrEncPixMap(w, h, pixmap, rlemap)#1 + var rleptr + byte i, j, run, pixrun + + rleptr = rlemap + w--; h-- + for j = 0 to h + run = 0 + for i = 0 to w step 2 + if run and ^pixmap == pixrun + run++ + else + if run + *rleptr = run*2 | (pixrun << 8) + //puth(*rleptr); putc(',') + rleptr = rleptr + 2 + fin + run = 1 + pixrun = ^pixmap + fin + pixmap++ + next + *rleptr = run*2 | (pixrun << 8) + //puth(*rleptr); putln + rleptr = rleptr + 2 + next + return rleptr - rlemap +end export def dhgrSet(dhx, y)#0 dcgrColor(dhgrPix[dhx & $03]) dcgrOp(OP_OR) diff --git a/src/samplesrc/dcgrtest.pla b/src/samplesrc/dcgrtest.pla index 34213dc..d2f8b43 100644 --- a/src/samplesrc/dcgrtest.pla +++ b/src/samplesrc/dcgrtest.pla @@ -42,6 +42,7 @@ byte[] = 2, $55, 4, $00, 4, $AA, 4, $00, 2, $55 byte[] = 4, $55, 8, $00, 4, $55 byte[] = 7, $55, 2, $00, 7, $55 +word rlesprptr word sprite7msk[7] word sprite7[7] word sprite7span, sprite7w @@ -99,7 +100,8 @@ def dcgrCompSprite(offset)#0 dcgrColor(CLR_BLACK) dcgrClearBl7(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, @rlesprt) + dcgrRleMap(i + offset, 0, SPR_W, SPR_H, rlesprptr) dcgrSurfScr(OP_SRC) dcgrMemBl7(0, i * SPR_H, sprite7w, SPR_H, sprite7[i], sprite7span) next @@ -330,23 +332,23 @@ def dcgrTest#0 dcgrOp(OP_XOR) k = 0 i = @ncc1701 - dcgrPixMap(70-i=>spr_xorg, 96-i=>spr_yorg, i=>spr_width, i=>spr_height, i=>spr_pixmap) + dcgrPixMap(73-i=>spr_xorg, 96-i=>spr_yorg, i=>spr_width, i=>spr_height, i=>spr_pixmap) while ^$C000 < 128 - dcgrPixMap(70-i=>spr_xorg, 96-i=>spr_yorg, i=>spr_width, i=>spr_height, i=>spr_pixmap) + dcgrPixMap(73-i=>spr_xorg, 96-i=>spr_yorg, i=>spr_width, i=>spr_height, i=>spr_pixmap) i = i + t_sprite k++ if k > 7 k = 0 i = @ncc1701 fin - dcgrPixMap(70-i=>spr_xorg, 96-i=>spr_yorg, i=>spr_width, i=>spr_height, i=>spr_pixmap) + dcgrPixMap(73-i=>spr_xorg, 96-i=>spr_yorg, i=>spr_width, i=>spr_height, i=>spr_pixmap) loop getc dcgrOp(OP_SRC) while ^$C000 < 128 dcgrColor(CLR_BLACK) dcgrClearBl7(60/7, 75, 5, 43) - dcgrPixMap(70-i=>spr_xorg, 96-i=>spr_yorg, i=>spr_width, i=>spr_height, i=>spr_pixmap) + dcgrPixMap(73-i=>spr_xorg, 96-i=>spr_yorg, i=>spr_width, i=>spr_height, i=>spr_pixmap) i = i + t_sprite k++ if k > 7 @@ -433,6 +435,9 @@ def dcgrTest#0 next getc end + +rlesprptr = heapmark +heapalloc(dcgrEncPixMap(SPR_W, SPR_H, @sprite, rlesprptr)) dcgrMode(0) dhgrTest screenRead("monarch")