Page 1 of 1
Little demo, messing around
Posted: Sun Dec 20, 2009 3:01 pm
by sixxie
This has been keeping me out of trouble for a couple of weeks:
http://www.6809.org.uk/tmp/da/demo/demo3.cas
It's all done "properly", with actual multiplies and actual line drawing. But any more on screen and it would slow down too much, so I don't think this can become an actual game without replacing everything with sprites
![Smile :)](./images/smilies/icon_e_smile.gif)
Re: Little demo, messing around
Posted: Sun Dec 20, 2009 10:10 pm
by rolfmichelsen
Very cool! Especially the spinning rocks! I only found controls for spinning the ship. Did I miss anything?
-- Rolf
Re: Little demo, messing around
Posted: Sun Dec 20, 2009 10:24 pm
by sixxie
No, that's all you can "do"... Just a proof of concept really (and *really* a proof of "I don't think I can do much with this concept"
![Wink ;)](./images/smilies/icon_e_wink.gif)
).
I like the spinning too, it would be a lot of sprite memory to store each "frame", so I'm a bit sad that I can't take it much further.
Unless anyone can think of a way of doing signed multiplies in < 25 cycles?
Edit: here's my "smul" macro - any ideas for cutting it down? &1 and &2 are macro arguments. I'm *pretty* sure a table based multiply (squares / 4) wouldn't be as fast, but I'm willing to be shown wrong!
Code: Select all
; signed multiply: d = &1 * &2
smul macro ; +A+B +A-B -A+B -A-B
lda &1
bmi 120F ; 3 3 3 3 2
110 ldb &2
bmi 112F ; 3 3 - - 2
111 mul ; 11 - - - 1
bra 200F ; 3 - - - 2
120 nega ; - - 2 2 1
ldb &2
bmi 122F ; - - 3 3 2
121 mul ; - - 11 - 2
coma ; - - 2 - 1
comb ; - - 2 - 1
addd #1 ; - - 4 - 3
bra 200F ; - - 3 - 2
122 negb ; - - - 2 1
mul ; - - - 11 1
bra 200F ; - - - 3 2
112 negb ; - 2 - - 1
mul ; - 11 - - 1
coma ; - 2 - - 1
comb ; - 2 - - 1
addd #1 ; - 4 - - 3
200 ; 20 27 30 24 30
endm ; average = 25.25 cycles
Re: Little demo, messing around
Posted: Mon Dec 21, 2009 5:19 pm
by jmk
Nice!
I can't think of any sensible multiply improvements, so here are some silly suggestions:
1. Rotate 2 asteroids on one frame and the other 2 on the next frame.
2. Precalculate the points for 1/4 of the rotation and then jiggle the x and y to make the full set. 12 points * 2 bytes * 64 angles? = 1536 bytes per asteroid (still hefty). You could reduce the number of angles, but that would reduce the smoothness. Your ship is only 4 points, so 512 bytes for it.
3. Do the R-Type game.
![Smile :)](./images/smilies/icon_e_smile.gif)
Re: Little demo, messing around
Posted: Mon Dec 21, 2009 6:48 pm
by sixxie
jmk wrote:
1. Rotate 2 asteroids on one frame and the other 2 on the next frame.
Thought about this earlier today, thought it might look a bit funny.
2. Precalculate the points for 1/4 of the rotation and then jiggle the x and y to make the full set. 12 points * 2 bytes * 64 angles? = 1536 bytes per asteroid (still hefty). You could reduce the number of angles, but that would reduce the smoothness. Your ship is only 4 points, so 512 bytes for it.
Ooh, I think this is the way forward. I'm only using 32 angles, too! Shall give it a go
Existing code won't be completely thrown out: I'll still need to calculate some bits for velocities when I do those properly.
3. Do the R-Type game.
![Smile :)](./images/smilies/icon_e_smile.gif)
Heh, one day! I need some graphics to reboot my interest there I think...
Re: Little demo, messing around
Posted: Tue Dec 22, 2009 8:59 am
by sixxie
So, following that rather good suggestion,
here's a new demo!
Re: Little demo, messing around
Posted: Tue Dec 22, 2009 3:34 pm
by jmk
Aha, very nice!
Much busier on-screen.
![Cool 8-)](./images/smilies/icon_cool.gif)