Ported to C
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.


Hehe, just a bit simpler, yes.
Speaking of which, I just got my 8×8 displays in the mail today - I’ve got some transistors, a cpld, and a microcontroller just waiting to be hooked up… will post on my blog when I finish it
Comment by Stephen — March 25, 2006 @ 11:17 pm
Uh oh…I better get back to work, or you’re going to show me up with your 4 bits of brightness plasma routines
Comment by davr — March 29, 2006 @ 12:54 pm
I’m really impressed!
Comment by bezdar1 — July 5, 2006 @ 2:53 pm
how about plugging in an Ageia PhysX card? will make life simpler
Comment by alon jacoby — March 21, 2008 @ 10:06 am