Little demo, messing around

A place to discuss everything Dragon related that doesn't fall into the other categories.
Post Reply
sixxie
Posts: 1348
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Little demo, messing around

Post 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 :)
User avatar
rolfmichelsen
Posts: 299
Joined: Wed Apr 08, 2009 8:43 pm
Location: Oslo, Norway
Contact:

Re: Little demo, messing around

Post by rolfmichelsen »

Very cool! Especially the spinning rocks! I only found controls for spinning the ship. Did I miss anything?

-- Rolf
sixxie
Posts: 1348
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Re: Little demo, messing around

Post 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" ;) ).

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
jmk
Posts: 65
Joined: Fri Mar 20, 2009 1:12 am

Re: Little demo, messing around

Post 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. :)
sixxie
Posts: 1348
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Re: Little demo, messing around

Post 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. :)
Heh, one day! I need some graphics to reboot my interest there I think...
sixxie
Posts: 1348
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Re: Little demo, messing around

Post by sixxie »

So, following that rather good suggestion, here's a new demo!
jmk
Posts: 65
Joined: Fri Mar 20, 2009 1:12 am

Re: Little demo, messing around

Post by jmk »

Aha, very nice!

Much busier on-screen. 8-)
Post Reply