Blitz Basic Sprite Ripping

That was easy enough. Got the latest version of AmiBlitz installed and spent a while hunting around for documentation on the Internets.  I eventually remembered that I did actually buy Blitz 2 back in the day and have the original manual on my bookshelf. Some time later and I’ve got the sprite ripper code written and the first set of sprites extracted.

“Sprite ripper” is probably a little overdramatic when you consider that all the program does is load the sprites, blit them to a bitmap and save it as an IFF, but hey - it’s all good.

This is the code:

;Start off in file access mode

;Create some vars
shapes1 = 23
shpHeight = 16
shpWidth = 32
bitmapWidth = 320
bitmapHeight = 256
outputNumber$ = "0"

;Load data to process
LoadShapes 0, shapes1, "Apps:Work/defender/defender/shapes"
LoadPalette 0, "Apps:Work/defender/defender/palette"

;Initialise gfx coprocessor
InitCopList 0, $00004

;Switch to high-speed gfx mode

;Initialise display
CreateDisplay 0
DisplayPalette 0,0

;Set up a bitmap to draw on
BitMap 0, bitmapWidth, bitmapHeight, 5
Use BitMap 0
BitMapOutput 0

;Display shapes1
x = 0
y = 0

;Loop through all shapes
For i = 0 To shapes1
;Output shape to screen
Blit i, x, y

;Move to next x position
x = x + shpWidth

;Have we hit the end of the bitmap?
If x + shpWidth > bitmapWidth
;Move to next column
x = 0
y = y + shpHeight
End If

;Display the bitmap
DisplayBitMap 0, 0, 0, 0

;Loop until mouse click
Until Joyb(0)

;Switch back to file access mode

;Save the bitmap to disk
SaveBitmap 0, "Apps:Work/Defender/SpriteRip" + outputNumber$ + ".iff", 0

And this is the output:

Defender Sprites #1