Basic "poof" animation

(Yak shaving)
This commit is contained in:
Elliot Nunn 2021-03-15 10:08:33 +08:00
parent c8efb91c62
commit 2d2b78f347
7 changed files with 452 additions and 74 deletions

View File

@ -10,20 +10,29 @@ args = args.parse_args()
bmp = open(args.bmp, 'rb').read()
sig, fsize, pixoffset = struct.unpack_from('<HLxxxxL', bmp)
sig, fsize, pixoffset, w, h = struct.unpack_from('<HLxxxxLxxxxLl', bmp)
h = abs(h)
pixels = [0] * 32 * 32
mask = [0] * 32 * 32
if w != 32: sys.exit('width must be 32')
for i in range(32*32):
px, = struct.unpack_from('<L', bmp, pixoffset+i*4)
white = int((px & 0x00FFFFFF) == 0x00FFFFFF)
clear = int((px & 0xFF000000) == 00)
pixels = []
mask = []
pixels[i] = int(0 if clear else not white)
mask[i] = int(not clear)
for row in range(h):
row_pix = ''
row_mask = ''
as_str = ''.join(str(x) for x in (pixels + mask))
for col in range(w):
px, = struct.unpack_from('<L', bmp, pixoffset + row*w*4 + col*4)
for i in range(0, 32*32*2, 32):
print(' dc.l %' + as_str[i:i+32])
white = bool(px & 0x00FFFFFF)
opaque = bool(px & 0xFF000000)
row_pix += str(int(opaque and not white))
row_mask += str(int(opaque))
pixels.append(row_pix)
mask.append(row_mask)
for i in pixels+mask:
print(' dc.l %' + i)

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -151,68 +151,10 @@ DoPeriodic
****************************** FONT METRICS *******************************
DrawWindow
MOVE.W #0,-(SP) ; SrcCopy source mode
DC.W $A889 ; __TextMode
MOVE.W #4,-(SP) ; Monaco Monaco
DC.W $A887 ; __TextFont
MOVE.W #9,-(SP) ; 9 point
DC.W $A88A ; __TextSize
MOVE.W #1,-(SP) ; bold
DC.W $A888 ; __TextFace
********************** WRITE APPLICATION HEAP FREEMEM *********************
MOVE.W #6,-(SP)
MOVE.W #10,-(SP)
DC.W $A893 ; __MoveTo
PEA s1 ; #'AppHeap: '
DC.W $A884 ; __DrawString
DC.W $A01C ; __FreeMem ; free memory -> D0
JSR PrintNum ; draw our free mem
************************* WRITE SYSTEM HEAP FREEMEM ***********************
PEA s2 ; #' SysHeap: '
DC.W $A884 ; __DrawString
DC.W $A41C ; __FreeMem SYS ; free memory -> D0
JSR PrintNum ; draw our free sys mem
***************************** WRITELN VOL INFO ****************************
PEA s3 ; #' Disk: '
DC.W $A884 ; __DrawString
MOVE.L #122,D0 ; HVolumeParam.sizeof size of HFS ParamBlock
DC.W $A31E ; __NewPtr CLEAR ; NewPtr -> A0
BNE.S Exit ; IF Error THEN Exit
MOVE.L A0,D7 ; save PBPtr in D7
MOVE.L $1A(A4),A1 ; DCtlEntry.DCtlWindow get window rec pointer
LEA aString,A1 ; address of string buffer
MOVE.L A1,$12(A0) ; ioNamePtr = Volume Name
DC.W $A207 ; __PBHGetVInfoSync ; _GetVolInfo info -> A0^
MOVE.L D7,A0
MOVE.L $30(A0),D1 ; HVolumeParam.ioVAlBlkSiz block size in D1
MOVE.W $3E(A0),D2 ; HVolumeParam.ioVFrBlk free blocks in D2
MOVE.W D1,D0 ; 32 bit * 16 bit multiply
MULU.W D2,D0 ; right half of size
SWAP D1
MOVE.W D1,D3
MULU.W D2,D3 ; left half of size
SWAP D3
ADD.L D3,D0 ; total bytes free on vol
JSR PrintNum ; write # bytes free
PEA s4 ; #' free on '
DC.W $A884 ; __DrawString
MOVE.W #4,-(SP) ; underlined
DC.W $A888 ; __TextFace
MOVE.L D7,A0
MOVE.L $12(A0),-(SP) ; HVolumeParam.ioNamePtr offset for volName
DC.W $A884 ; __DrawString
MOVE.L D7,A0 ; free the memory
DC.W $A01F ; __DisposePtr
movem.l A0-A5/D0-D7,-(SP)
move.l #$00500050,D0
bsr Poof
movem.l (SP)+,A0-A5/D0-D7
Exit
RTS
@ -260,3 +202,430 @@ aString DCB.B 28 ; vol names must be < 28 char
aNumStr DCB.B 10 ; sufficient for 10 GB of space
;GlobalSize EQU *-GlobalVars ; size of my globals
; ENDR
Poof ; animation, takes D0
link A6,#-0
move.l D0,-(SP) ; D3 = screen rect
add.l #$00200020,(SP)
move.l D0,-(SP)
move.l SP,D3
move.l #$00200020,-(SP) ; D4 = bitmap rect (0,0,32,32)
clr.l -(SP)
move.l SP,D4
bsr PushBitmapToStack ; D5 = "save screen" bitmap
move.l SP,D5
bsr PushBitmapToStack ; D6 = "scratch" bitmap
move.l SP,D6
; A3 = "artwork" bitmap (changeable)
move.l #$00200020,-(SP) ; bounds.botRight
clr.l -(SP) ; bounds.topLeft
move.w #4,-(SP) ; rowBytes
subq #4,SP ; baseAddr!!!
move.l SP,A3
; A4 = screenBits bitmap
move.l (A5),A4 ; QD globals
lea -122(A4),A4
move.l A4,-(SP) ; srcBits = screenBits
move.l D5,-(SP) ; dstBits = "save screen" bitmap
move.l D3,-(SP) ; srcRect = screen rect
move.l D4,-(SP) ; dstRect = bitmap rect
clr.w -(SP) ; mode = srcCopy
clr.l -(SP) ; no maskRgn
dc.w $A8EC ; _CopyBits
; this is where the loop will start (very cutesy)
clr.l D7 ; loop counter!
.loop
tst.l D7
beq.s .dontwait
.dontwait
move.l D5,-(SP) ; srcBits = "save screen" bitmap
move.l D6,-(SP) ; dstBits = "scratch" bitmap
move.l D4,-(SP) ; srcRect = bitmap rect
move.l D4,-(SP) ; dstRect = bitmap rect
clr.w -(SP) ; mode = srcCopy
clr.l -(SP) ; no maskRgn
dc.w $A8EC ; _CopyBits
lea PoofData,A0
add.l #(PoofDataEnd-PoofData)/2,A0
move.l A0,(A3)
move.l A3,-(SP) ; srcBits = "artwork" bitmap
move.l D6,-(SP) ; dstBits = "scratch" bitmap
move.l D4,-(SP) ; srcRect = bitmap rect
move.l D4,-(SP) ; dstRect = bitmap rect
move.w #3,-(SP) ; mode = srcBic (erase)
clr.l -(SP) ; no maskRgn
dc.w $A8EC ; _CopyBits
lea PoofData,A0
move.l A0,(A3)
move.l A3,-(SP) ; srcBits = "artwork" bitmap
move.l D6,-(SP) ; dstBits = "scratch" bitmap
move.l D4,-(SP) ; srcRect = bitmap rect
move.l D4,-(SP) ; dstRect = bitmap rect
move.w #1,-(SP) ; mode = srcOr
clr.l -(SP) ; no maskRgn
dc.w $A8EC ; _CopyBits
move.l D6,-(SP) ; srcBits = "scratch" bitmap
move.l A4,-(SP) ; dstBits = screenBits
move.l D4,-(SP) ; srcRect = bitmap rect
move.l D3,-(SP) ; dstRect = screen rect
clr.w -(SP) ; mode = srcCopy
clr.l -(SP) ; no maskRgn
dc.w $A8EC ; _CopyBits
unlk A6
rts
PushBitmapToStack ; assumes 32x32, leaves bitmap structure on stack
move.l (SP)+,A0
sub #32*32/8,SP ; the actual data
move.l #$00200020,-(SP) ; bounds.botRight
clr.l -(SP) ; bounds.topLeft
move.w #32/8,-(SP) ; rowBytes
pea 10(SP) ; baseAddr
jmp (A0) ; return
PoofData
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000001111100000000000
dc.l %00000000000000110000011000000000
dc.l %00000000011110100000000100000000
dc.l %00001111100001101101011010000000
dc.l %00010000100000010010101001111000
dc.l %00100000000000100000000010001100
dc.l %00100000000000100000000010000010
dc.l %00100000000111001111100000000010
dc.l %00100000001000110000010000000001
dc.l %00100000000000100000010000000001
dc.l %01010000000000000000010000000010
dc.l %01010001100000000000010000000010
dc.l %10001110100000000000001000001100
dc.l %10000000100000000000001000000100
dc.l %01000000010000000000001000000010
dc.l %01000000001000000010010000000010
dc.l %01110000001000000010010000000010
dc.l %00010000000110000101100000000100
dc.l %00010010010001111100000001111000
dc.l %00001101100000000000001001000000
dc.l %00001000000000000000001101000000
dc.l %00001000000000000001000101000000
dc.l %00000100010000000110111001000000
dc.l %00000011110000001100000010000000
dc.l %00000001000000001011111100000000
dc.l %00000000111000110000000000000000
dc.l %00000000000111000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000110000011101111000000
dc.l %00000000011001100100010001000000
dc.l %00000000010000101000000001000000
dc.l %00001110100000010000000001100000
dc.l %00010001100000010000100000010000
dc.l %00010000000000101001000110100000
dc.l %00100000111100100110000010010000
dc.l %00010001000101010010000110010000
dc.l %00011000000010010100000001010000
dc.l %00001000100010001000010000100000
dc.l %00001000011100010100001000100000
dc.l %00001011100001100011111111000000
dc.l %00000100100010000000000000000000
dc.l %00001110111110000111100111011000
dc.l %00010001000001001000011000100100
dc.l %00100000000001010000000010001000
dc.l %00100000000000110000001101011000
dc.l %00100100111110010000000001000100
dc.l %00011101001010001000000000100010
dc.l %00100001000000010111000000010010
dc.l %00100001000000100100000000100010
dc.l %00010000100010100100000111001100
dc.l %00001101000100010100000000001000
dc.l %00001001001000010011110000111000
dc.l %00001001110011001000100000100000
dc.l %00001100000100110000010001000000
dc.l %00000011111000000000001110000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000001110000001100000000000
dc.l %00000000001010000010010000000000
dc.l %00000000000110111011010000000000
dc.l %00000000001001000101101100000000
dc.l %00000001110101000010010010000000
dc.l %00000010000110111110100110000000
dc.l %00000010000001000000100001000000
dc.l %00000011100010011110010001010000
dc.l %00000001000110100010010010101000
dc.l %00000001001001000001101101001000
dc.l %00001110110010000010010000110000
dc.l %00010010001110000000001000000000
dc.l %00011110010010001000000100110000
dc.l %00000000100001110000000101001000
dc.l %00001111000001001000000101000100
dc.l %00010010101110000100001001000010
dc.l %00100010010011000111110110111100
dc.l %00010011000001000100001001000000
dc.l %00001100110000111010010001000000
dc.l %00000001101111000001010110100000
dc.l %00000010010001001101010000010000
dc.l %00000100010001010000101000001000
dc.l %00000011100000110111100100001000
dc.l %00000000011100001010010010010000
dc.l %00000000010010000010001001100000
dc.l %00000000010010000001110000000000
dc.l %00000000001100000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000010000000000000000000000
dc.l %00000000011000000000000000000000
dc.l %00000000000001110001000000000000
dc.l %00000000000010001000010000000000
dc.l %00000000000010010000101000000000
dc.l %00000011100001100001001000000000
dc.l %00000100010000000000110010000000
dc.l %00000110001000000000000101000000
dc.l %00000100001001111000110010000000
dc.l %00000100001001000101001000000000
dc.l %00000011010001000010001000000000
dc.l %00000000100001000101110000000000
dc.l %00000010000001101000000000000000
dc.l %00000000000000011111000000000000
dc.l %00000011101110001000100001000000
dc.l %00000100010010001100100100000000
dc.l %00000010100001000111000000000000
dc.l %00000001010001000000111100000000
dc.l %00000000001110000100100010000000
dc.l %00000000000000001010100110000000
dc.l %00000000010010000101011101000000
dc.l %00000000001100001010001000100000
dc.l %00000000000000000100000100100000
dc.l %00000000000010000000000011000000
dc.l %00000000000000000001000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000110000000000000000
dc.l %00000000000001010000001100000000
dc.l %00000000000001100000000100000000
dc.l %00000000000000000000001000000000
dc.l %00000011000000000000000000000000
dc.l %00000000011000000001000000000000
dc.l %00000000100100000010100000000000
dc.l %00000000100101110100010000000000
dc.l %00000000011010001011100000000000
dc.l %00000000000001010000000000000000
dc.l %00000000000000110000000000000000
dc.l %00000000000000101100000000000000
dc.l %00000000000000011000000000000000
dc.l %00000001011100000000000000000000
dc.l %00000000100010000000000000000000
dc.l %00000000100010000000000000000000
dc.l %00000000011010000000000000000000
dc.l %00000000000100000000000010000000
dc.l %00000000010000001100000000000000
dc.l %00000000000000010010000000000000
dc.l %00000000000000001100000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000001111100000000000
dc.l %00000000000000111111111000000000
dc.l %00000000011110111111111100000000
dc.l %00001111111111111111111110000000
dc.l %00011111111111111111111111111000
dc.l %00111111111111111111111111111100
dc.l %00111111111111111111111111111110
dc.l %00111111111111111111111111111110
dc.l %00111111111111111111111111111111
dc.l %00111111111111111111111111111111
dc.l %01111111111111111111111111111110
dc.l %01111111111111111111111111111110
dc.l %11111111111111111111111111111100
dc.l %11111111111111111111111111111100
dc.l %01111111111111111111111111111110
dc.l %01111111111111111111111111111110
dc.l %01111111111111111111111111111110
dc.l %00011111111111111111111111111100
dc.l %00011111111111111111111111111000
dc.l %00001111111111111111111111000000
dc.l %00001111111111111111111111000000
dc.l %00001111111111111111111111000000
dc.l %00000111111111111111111111000000
dc.l %00000011111111111111111110000000
dc.l %00000001111111111011111100000000
dc.l %00000000111111110000000000000000
dc.l %00000000000111000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000110000011101111000000
dc.l %00000000011111100111111111000000
dc.l %00000000011111101111111111000000
dc.l %00001110111111111111111111100000
dc.l %00011111111111111111111111110000
dc.l %00011111111111101111111111100000
dc.l %00111111111111100111111111110000
dc.l %00011111111111110011111111110000
dc.l %00011111111111110111111111110000
dc.l %00001111111111111111111111100000
dc.l %00001111111111110111111111100000
dc.l %00001111111111100011111111000000
dc.l %00000100111110000000000000000000
dc.l %00001110111110000111100111011000
dc.l %00011111111111001111111111111100
dc.l %00111111111111011111111111111000
dc.l %00111111111111111111111111111000
dc.l %00111111111111111111111111111100
dc.l %00011111111111111111111111111110
dc.l %00111111111111110111111111111110
dc.l %00111111111111100111111111111110
dc.l %00011111111111100111111111111100
dc.l %00001111111111110111111111111000
dc.l %00001111111111110011111111111000
dc.l %00001111111111111000111111100000
dc.l %00001111111100110000011111000000
dc.l %00000011111000000000001110000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000001110000001100000000000
dc.l %00000000001110000011110000000000
dc.l %00000000000110111011110000000000
dc.l %00000000001001111101101100000000
dc.l %00000001111101111110011110000000
dc.l %00000011111110111110111110000000
dc.l %00000011111111000000111111000000
dc.l %00000011111110011110011111010000
dc.l %00000001111110111110011110111000
dc.l %00000001111001111111101101111000
dc.l %00001110110011111111110000110000
dc.l %00011110001111111111111000000000
dc.l %00011110011111111111111100110000
dc.l %00000000111111111111111101111000
dc.l %00001111111111001111111101111100
dc.l %00011111111110000111111001111110
dc.l %00111111111111000111110110111100
dc.l %00011111111111000100001111000000
dc.l %00001100111111111110011111000000
dc.l %00000001101111111111011111100000
dc.l %00000011110001111111011111110000
dc.l %00000111110001111111101111111000
dc.l %00000011100000111111100111111000
dc.l %00000000011100001011110011110000
dc.l %00000000011110000011111001100000
dc.l %00000000011110000001110000000000
dc.l %00000000001100000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000010000000000000000000000
dc.l %00000000011000000000000000000000
dc.l %00000000000001110001000000000000
dc.l %00000000000011111000010000000000
dc.l %00000000000011110000111000000000
dc.l %00000011100001100001111000000000
dc.l %00000111110000000000110010000000
dc.l %00000111111000000000000111000000
dc.l %00000111111001111000110010000000
dc.l %00000111111001111101111000000000
dc.l %00000011110001111111111000000000
dc.l %00000000100001111101110000000000
dc.l %00000010000001111000000000000000
dc.l %00000000000000011111000000000000
dc.l %00000011101110001111100001000000
dc.l %00000111111110001111100100000000
dc.l %00000011111111000111000000000000
dc.l %00000001011111000000111100000000
dc.l %00000000001110000100111110000000
dc.l %00000000000000001110111110000000
dc.l %00000000011110000111011111000000
dc.l %00000000001100001110001111100000
dc.l %00000000000000000100000111100000
dc.l %00000000000010000000000011000000
dc.l %00000000000000000001000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000110000000000000000
dc.l %00000000000001110000001100000000
dc.l %00000000000001100000001100000000
dc.l %00000000000000000000001000000000
dc.l %00000011000000000000000000000000
dc.l %00000000011000000001000000000000
dc.l %00000000111100000011100000000000
dc.l %00000000111101110111110000000000
dc.l %00000000011011111011100000000000
dc.l %00000000000001110000000000000000
dc.l %00000000000000110000000000000000
dc.l %00000000000000111100000000000000
dc.l %00000000000000011000000000000000
dc.l %00000001011100000000000000000000
dc.l %00000000111110000000000000000000
dc.l %00000000111110000000000000000000
dc.l %00000000011110000000000000000000
dc.l %00000000000100000000000010000000
dc.l %00000000010000001100000000000000
dc.l %00000000000000011110000000000000
dc.l %00000000000000001100000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
dc.l %00000000000000000000000000000000
PoofDataEnd