+
+ ; slow_sprite(int id, int x, int y)
+ ; assumptions: 32x32, one after the other, 0 is transparent
+ global slow_sprite
+slow_sprite:
+ push ebp
+ mov ebp, esp
+ pusha
+
+ mov eax, [ebp + 16] ; ax <- y
+ sub eax, 16 ; ax <- y - 16 (center sprite vertically)
+ mov ebx, eax
+ shl eax, 8
+ shl ebx, 6
+ add eax, ebx ; ax <- (y - 16) * 320
+ mov edi, [ebp + 12] ; di <- x
+ sub edi, 16 ; di <- x - 16 (center sprite horizontally)
+ add edi, eax ; di <- (y - 16) * 320 + (x - 16)
+ add edi, FRAMEBUF_ADDR
+
+ mov esi, sprsheet
+ ; calculate sprite id offset (each spr is 32*32=1k)
+ mov eax, [ebp + 8]
+ shl eax, 10
+ add esi, eax
+
+ mov ecx, 32
+.yloop:
+ xor ebx, ebx
+.xloop:
+ mov al, [esi]
+ cmp al, 0
+ ;jz .skip_pixel
+ mov [edi + ebx], al
+.skip_pixel:
+ inc esi
+ inc ebx
+ cmp ebx, 32
+ jnz .xloop
+
+ add edi, 320
+ dec ecx
+ jnz .yloop
+
+ popa
+ pop ebp
+ ret