Registered User
Join Date: Sep 2008
Location: Gainesville U.S.A.
Posts: 771
|
Road Runner [and Wile E. Coyote] - Commodore 64
C64 sprites are easy compared to Amiga:
- Only 64k to search
- Always the same size
- Always start on 64 byte boundary
- Live on only 1 "plane"
Maptapper settings:
Code:
[Gfx]
Address=$5000
PaletteAddress=$0
TileWidth=24
TileHeight=21
Bitplanes=1
SkipBytes=1 *** because sprites are 63 bytes but begin every 64th
SkipMode=0
RipWidth=336
RipHeight=294
Bottom left is what Maptapper produces. The stripes indicate these are multicolor so they need further processing. Here is a Blitz program to do that. Parameters to be filled in are between asterisks. Difference between sheet 2 and 3 is idx(1) value. An advanced paint program can make multiple selections and paste them on the opposite one. Also these iffs are 4 planes so they have a full C64 palette. (as close as 12-bit could get). Finally the painted sheet and another to show the palette.
Code:
WBStartup
Dim p0.w(15)
blk=$0: whi=$1: xred=$2: cyn=$3: pur=$4: grn=$5: blu=$6: yel=$7
org=$8: brn=$9: lred=$a: dgry=$b: mgry=$c: lgrn=$d: lblu=$e: lgry=$f
.params
;****************
LoadBank 0,"dh1:ram" ; 64k C64 memory dump
f$="dh1:sprites.iff" ; file to save
Poke.l ?offs,$5000 ; hex = sprites offset
Poke.b ?m,1 ; <>0 = multicolor
Poke.b ?rip,192 ; how many sprites (14^2 max)
Poke.b ?idx+0,mgry ; background color
Poke.b ?idx+1,brn ; sprite color
Poke.b ?idx+2,yel ; multicolor 0
Poke.b ?idx+3,blk ; multicolor 1
;****************
BitMap 0,336,294,4 ; width divisible by 24 and 16
; ~ C64 Palette
Data.w $000,$fff,$e44,$6ff,$e6e,$4e4,$44e,$ff4
Data.w $ea4,$a75,$faa,$555,$999,$afa,$aaf,$ccc
For j=0 To 15
Read p0(j):c=p0.w(j)
r=c/256 AND 15:g=c/16 AND 15:b=c AND 15
PalRGB 0,j,r,g,b
Next j
InitBank 1,512,1 ;expand 504 bits to bytes (0-3) color index
Poke.l ?bm0,Peek.l (Addr BitMap(0)+8)
Poke.l ?ptr0,Peek.l (Addr Bank(0))
Poke.l ?ptr1,Peek.l (Addr Bank(1))
InitCopList 0,44,256,$4,8,16,0
DisplayAdjust 0,2,-8,0,-16,0 ;***** overscan for extra column
DisplayPalette 0,0
DisplayBitMap 0,0
BLITZ
CreateDisplay 0
MOVEM.l d0-d7/a0-a6,-(a7)
CLR.w col
MOVE.l offs,d0
ADD.l d0,ptr0
row:
MOVE.b m,d4
MOVE.l bm0,d5
MOVE.l ptr0,a0
MOVE.l ptr1,a1
MOVE.l a1,a3
MOVEQ #62,d1
m1:
MOVE.b (a0)+,d0
MOVEQ #7,d2
TST.b d4 ; multicolor ?
BEQ m2
MOVEQ #3,d2
m2:
MOVEQ #0,d3
LSL.b #1,d0
BCC m3
OR.b #%01,d3
m3:
TST.b d4
BEQ m5
LSL.b #1,d0
BCC m4
OR.b #%10,d3
m4:
MOVE.b d3,(a1)+
m5:
MOVE.b d3,(a1)+
DBF d2,m2
DBF d1,m1
MOVE.l a3,a0
MOVE.l d5,a1
LEA 12348(a1),a2
LEA 12348(a2),a3
LEA 12348(a3),a4
MOVE.l #idx,a5
CLR.w d0
MOVEQ #20,d7
l0:
MOVEQ #2,d5
l1:
MOVEQ #7,d6 ; pull 8 pixels
CLR.B d1
CLR.B d2
CLR.B d3
CLR.B d4
l2:
MOVE.b (a0)+,d0
MOVE.b 0(a5,d0.w),d0
l3:
LSR.b #1,d0
BCC l4
BSET d6,d1
l4:
LSR.b #1,d0
BCC l5
BSET d6,d2
l5:
LSR.b #1,d0
BCC l6
BSET d6,d3
l6:
LSR.b #1,d0
BCC l7
BSET d6,d4
l7:
DBF d6,l2
MOVE.b d1,(a1)+
MOVE.b d2,(a2)+
MOVE.b d3,(a3)+
MOVE.b d4,(a4)+
DBF d5,l1
LEA 39(a1),a1 ; new sprite line
LEA 39(a2),a2
LEA 39(a3),a3
LEA 39(a4),a4
DBF d7,l0
SUB.b #1,rip
BEQ all
ADDI.l #$40,ptr0
ADDQ.l #3,bm0
ADDQ.w #1,col
CMPI.w #14,col
BNE row
CLR.w col
ADDI.l #840,bm0 ; new sprite row
BRA row
bm0: Dc.l 0
ptr0: Dc.l 0
ptr1: Dc.l 0
idx: Dc.l 0
col: Dc.w 0
rip: Dc.w 0
m: Dc.w 0
offs: Dc.l 0
all:
MOVEM.l (a7)+,d0-d7/a0-a6
MouseWait
AMIGA
SaveBitmap 0,f$,0
Last edited by clenched; 25 April 2019 at 02:44.
Reason: Touch up sprite sheet. Top row #7, Bottom row #5 not encountered for correct painting.
|