; PrintShop / MiniPix Unpacker and Viewer ; Version 5, March 31, 2019 ; Copyleft Michaelangel007 ; "Sharing is Caring" ; === Our Zero Page Variables === zSrcPtr = $F7 ; 16-bit pointr to source packed PrintShop graphic zSrcBits = $F9 zSrcMask = $FA ; counter 0 .. 7 zSrcCol = $FB ; cache of Y reg for lda (zSrcPtr),Y zDstPtr = $26 ; 16-bit pointer to dest; GBASL zDstRow = $FC zDstBits = $FD zDstColMod7 = $FE zDstRowMod3 = $FF ; === PrintShop === PrintShopSprite = $5800 ; Default load adddress ;LEN = 572 ; File size ; Dimensions W_PIXELS = 88 W_BYTES = 88/8 ; Source (Packed) Bytes/Row H_PIXELS = 52 X_SCALE = 2 ; Not actually used as hard-coded. For reference Y_SCALE = 3 ; === Applesoft/Monitor Zero Page Variables === MON_GBAS = $26 ; 16-bit Pointer to HGR scanline HGR_COLOR = $E4 ; HGR_HORIZ = $E5 ; X column / 7 = scanline byte offset HGR_PAGE = $E6 ; $20 or $40 ; === I/O Softswitches === TXTCLR = $C050 ; Graphics mode TXTSET = $C051 MIXCLR = $C052 ; Split screen MIXSET = $C053 ; Full screen PAGE1 = $C054 PAGE2 = $C055 LORES = $C056 HIRES = $C057 ; === Applesoft/Monitor ROM === HGR = $F3E2 ; Clear and View HGR with mixed text/graphics HCLR = $F3F2 HPOSN = $F411 ; Set GBASL, GBASH, MON.HMASK, HGR.BITS ; uses HGR.PAGE, MOVE.DOWN = $F505 ; Update GBASL, GBASH COLORTBL = $F6F6 ; byte colors[7] HCOLOR = $F6E9 HOME = $FC58 ; ===================================================================== ORG $6000 PrintShopViewer jsr HGR sta MIXCLR ; Full screen ldx #>PrintShopSprite ldy # col = Y,X ; sta (zDstPtr),Y ; Need last pixel on this scanline jsr PutHgrByte ; Repeat each src line 3 times inc zDstRow inc zDstRowMod3 ldx zDstRowMod3 cpx #3 bne :NextSrcRow ; Y = 0 --> col = Y,X clc ; Move to next linear source row lda #W_BYTES adc zSrcPtr + 0 sta zSrcPtr + 0 bcc :SameSrcPage :NextSrcPage inc zSrcPtr + 1 :SameSrcPage lda zDstRow cmp #H_PIXELS*Y_SCALE + CENTER_Y bne :NextTripleY :Done rts PutHgrByte pha ; Save High Bit and #$7f ; HGR = 7 bits/pixel as we don't want half-pixels ldy #0 ; Need Y=0 for :NextSrcRow --> col = Y,X sta (zDstPtr),Y ; Need last pixel on this scanline pla ; Restore High Bit rol ; C = Bit 7 propogate lda #0 ; into next dst byte bit 0 rol beq :NoCarry ; if we have high bit crossing even into odd column cpx #4 bne :NoCarry lda #3 ; then we also need to the bottom 2 bits :NoCarry rts ; Single Pixel to Double Pixel Column2ColorHGR DB %00000110 ; [0] = $06 Even Column DB %00011000 ; [1] = $18 DB %01100000 ; [2] = $60 DB %10000000 ; [3] = $80 DB %00001100 ; [4] = $0C Odd Column DB %00110000 ; [5] = $30 DB %11000000 ; [6] = $C0