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
Little demo, messing around
- rolfmichelsen
- Posts: 299
- Joined: Wed Apr 08, 2009 8:43 pm
- Location: Oslo, Norway
- Contact:
Re: Little demo, messing around
Very cool! Especially the spinning rocks! I only found controls for spinning the ship. Did I miss anything?
-- Rolf
-- Rolf
Re: Little demo, messing around
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" ).
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!
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
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.
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.
Re: Little demo, messing around
Thought about this earlier today, thought it might look a bit funny.jmk wrote: 1. Rotate 2 asteroids on one frame and the other 2 on the next frame.
Ooh, I think this is the way forward. I'm only using 32 angles, too! Shall give it a go2. 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.
Existing code won't be completely thrown out: I'll still need to calculate some bits for velocities when I do those properly.
Heh, one day! I need some graphics to reboot my interest there I think...3. Do the R-Type game.
Re: Little demo, messing around
So, following that rather good suggestion, here's a new demo!
Re: Little demo, messing around
Aha, very nice!
Much busier on-screen.
Much busier on-screen.