Crazy Balloon - 19th Nervous Breakdown

Subject: Crazy Balloon - 19th Nervous Breakdown
From: Manuel Rotschkar <cybergoth@xxxxxxxx>
Date: Sat, 08 Jan 2005 16:43:37 +0100
Hi there!

So wow. Here I come, presenting you a binary that looks precisely like the one posted two days ago. All I did the last to days was freeing more cycles for the kernel. Now, the last binary had 10 free kernel cycles, and the current one has 17 :-)

How did I do that? Well, let's see what the old kernel did:

It was a 2LK drawing the balloon on both lines at 1LK precission, the PF on the first line at 6LK precission and the (enemy-)sprite on the second line with 2LK precission.
It also had a counter counting every single line to draw the balloon.


Now, I despreately needed more cycles, so what could I do?

I finally had an idea: To draw the balloon, I was doing something like this each scannline:

        LDA #BALLOON_HEIGHT-1
        DCP balloonOffset
        BCC SkipBalloon
        LDA (balloonmovPtr),Y
        STA HMP0
        LDA (balloonPtr),Y
        STA GRP0

Now, my basic idea was to do the draw/notdraw descision only once every two lines. That means I had to split all my sprite and HMOVE data into pairs of tables, so I could have two pointers:

First:
data .byte 1,2,3,4,5,6

Then:
data1 .byte 1,3,5
data2 .byte 2,4,6

So much the simple things. It also had the advantage that my counter now could live with counting every other scanline only.

So far so good. You'll notice a disadvantage of this method: You lose the positioning precission, as your scanline counter will only increase every other scannline. And here the nightmare began... ;-)

Well, in the end I succeeded geting my vertical precission back. Its gotten somewhat complicated though. When having the double resolution outside the kernel, you need to shift your data pointers every other "position" and swap them, also making your data "one" bigger and pad it with zeros like in:

data1 .byte 1,3,5,0
data2 .byte 0,2,4,6,0

Now for an even height, you just start normal with data1 and shift the pointer for data 2 by one, so you get this in the first frame:

<1> <2> <3> <4>
1,2,3,4,5,6,0,0

For the second frame, you need to swap your pointers:
<1> <2> <3> <4>
0,1,2,3,4,5,6,0

Ah, well... anyone following me? At least the bin shows that it's working ;-)
Didn't even cost much ROM, since now my divideby3 table is only half as big, as I'm only counting every other scannline now. (Actually, thinking of it, it originally was a divideby6 table anyway... ;-))


Ok, whatever, Now I can go on with the project... :-)

Greetings,
Manuel

Attachment: crazy.zip
Description: Zip archive

Current Thread