I ported the code to C. Now it is easier for me to work with.
This makes it easy to scale things, so now I have 10 boucing lights instead of one:
bounce3.mpg – 3MB
I’m no ASM master, so I could probably be doing it the hard way, but this code in ASM:
mov tmp1, ballX lsr tmp1 lsr tmp1 com tmp1 andi tmp1, 0b00000001 mov tmp2, ballY lsl tmp2 ; multiply by 2 add tmp1, tmp2 ldi tmp2, 0x60 add tmp1, tmp2 ldi yh, 0x00 mov yl, tmp1 ; Y now points at loc in VRAM mov tmp1, ballX andi tmp1, 0b00000011 lsl tmp1 ldi tmp2, 1 cpi tmp1, 0 brne shiftit rjmp shiftdone shiftit: lsl tmp2 dec tmp1 brne shiftit shiftdone: ld tmp1, y or tmp2, tmp1 st y, tmp2
Translates to this code in C:
VRAM[ballY] &= ~(1 << (ballX*2)); As you can see, it's a bit simpler now.