[BITS 16] [ORG 0x7C00] cli jmp start balldir_x: db 0 balldir_y: db 0 ballpos: dw ((10 * 80) + 40) draw: mov word [ds:ebx+eax*2], dx ret drawbar: call draw inc ax cmp ax, cx jnz drawbar mov cx, ax add cx, 80 ret start: mov ebx, 0x0B8000 blankscreen: xor ax, ax mov cx, 0x0800 mov dx, 0x0000 blankscreen_loop: call draw inc ax cmp ax, cx jnz blankscreen_loop drawbars: xor ax, ax mov cx, 80 mov dx, 0x20 | (1 << 12) call drawbar mov dx, 0x20 | (2 << 12) call drawbar mov dx, 0x20 | (4 << 12) call drawbar logicloop: mov ax, [ballpos] mov dx, 0x20 | (15 << 12) call draw call ballcalc cmp ax, 0 jg no_xrico call ricochet no_xrico: cmp ax, 40 * 80 jl no_yrico call ricochet no_yrico: mov [ballpos], ax mov dx, 0x20 | (15 << 12) call draw jmp logicloop ballcalc: mov cx, [balldir_y] add ax, cx sub ax, 80 add al, [balldir_x] add ax, cx sub ax, 1 ret ricochet: mov dx, [balldir_y] xor dx, 160 mov [balldir_y], dx mov dx, [balldir_x] xor dx, 2 mov [balldir_x], dx ret