X-Git-Url: https://eleni.mutantstargoat.com/git/?p=bootboot;a=blobdiff_plain;f=bb.asm;h=743dc9fce94ee2ffe6f08da2924f0cb48cc89f48;hp=4eb536e154e258f9672441d4b194c6e996b1f8f5;hb=5d0f7f94295e7a09e23dbf5b69ca965af0da3e8e;hpb=f950c9758ede9c9a2cb2889e4863cee546565a7b diff --git a/bb.asm b/bb.asm index 4eb536e..743dc9f 100644 --- a/bb.asm +++ b/bb.asm @@ -175,16 +175,33 @@ main_loop: jnz .static_loop ; draw lovebug - mov di, 32000 + mov di, (200 - 32) * 320 + 160 - 16 + mov ax, [num_frames] + shr ax, 2 ; /4 + cmp ax, 200 - 32 + jz .end + mov bx, ax + shl ax, 8 + shl bx, 6 + add ax, bx + sub di, ax + call rand + and ax, 3 ; random value in 0, 15 + sub ax, 1 ; random value in -3, 12 + add di, ax mov si, lovebug call blit32 ; wait for vblank -.vsync: +.vsync_blank: mov dx, 3dah in al, dx + and al, 8 + jnz .vsync_blank +.vsync_visible: + in al, dx and al, 8 ; the 4th bit is 1 when we are in the vertical blanking period - jnz .vsync + jz .vsync_visible ; copy backbuffer to video memory push es @@ -201,12 +218,16 @@ main_loop: pop es inc word [num_frames] +; moved above: +; cmp word [num_frames], 200 - 32 +; jz .end in al, 64h ; 60h = keyb data port, 64h = keyb status port and al, 1 ; 1 = OUTBUF_FULL = the keyb controller out buf is full jz main_loop ; no key pressed, loop back in al, 60h ; reads the keyb that was pressed to reset the flag +.end: ; re-enable all interrupts sti