Re: [stella] My demo...

Subject: Re: [stella] My demo...
From: Thomas Jentzsch <tjentzsch@xxxxxx>
Date: Sat, 26 May 2001 23:52:09 +0200
At 26.04.2001, 17:41, Gonzalo wrote:
> Hi everyone! I think I was reading too much messages
> from you all and it's time to do something by my
> self....

Great idea!!!

> My demo try to show an aeroplane crossing a river and
> I'm doing the movement effect whit the Background
> register, but I think that the routine is very long
> and is taking too many cycles. The horizontal blue
> bars are waves in the river (put some imagination on
> it). It has 2 velocities (controlable by joystick)
> and you can shoot a missile. It is a 2LKernel, I'm
> not using the first scanline yet but the second is
> full used only by the plane, its Misile and the
> background!! What I'm going to do if I want to put
> some islands, ships, enemies... I'll have no time in
> the first scanline!! Please take a look at it...

Ok, I had a look. Here are my suggestions:

1. It's not necessary to reset the stack pointer back
to #$ff during the kernel, so you can save 4 cycles

2a. Testing for zero is (nearly) always the fastest way.
So should initialize banda with #$0f and decrease it to
zero. That would save 5 cycles.

2b. You don't have to set the background color every
kernel loop. It's only necessary to change it every
16th line (or when you have spare time, see below :)

2c. Try to move the jumps out of your loop (like you
did with Noplane). When you update the background
color variable, you can easily avoid the jump to f2.

2d. When decreasing banda you can test for -1 very fast
too. So you have to easy testing values. Now you can
use zero for updating the color variable and -1 for
resetting banda to #$0f.

The code could look like this:

         dec banda               ;5
         beq f2                  ;2³
         bpl f1                  ;2³
         lda #$0f                ;2
         sta banda               ;3
         jmp f2                  ;3
f1       "do something useful here:"
         lda colorBk1            ;3
         sta COLUBK              ;3
         "or just wait"
         jmp f3                  ;3

f2       lda #%00000010          ;2
         eor colorBk1            ;3
         sta colorBk1            ;3

This code needs a maximum of 17 cycles (12 cycles
saved). And I'm quite sure, we could find one or two
more extra cycles here, if they are really needed ;)

3. if you time your code perfectly(!) to 76 cycles, you
can remove WSYNC and get 3 extra cycles.

> I tried to make the comments in english, but is
> difficult to me (I'm not a good english speaker as
> you see), so if you don't understand something ask me
> for it...

I know that problem :)

> I'm using Z26 as the emulator in my DK, the color of
> the river is blue but in StellaX and PCAE is green
> (or something like green)... who has the truth?

Yes, there's quite a big difference between the
palettes of the various emulators and I would like to
know the truth too.

> The missile in StellaX don't work, why?

I didn't see it in z26 too, but I haven't checked your
code there.

Have fun!
Thomas Jentzsch         | *** Every bit is sacred ! ***
tjentzsch at web dot de |

Archives (includes files) at
Unsub & more at

Current Thread
  • [stella] My demo...
    • Gonzalo - Sat, 26 May 2001 11:36:49 -0400 (EDT)
      • Thomas Jentzsch - Sat, 26 May 2001 17:51:38 -0400 (EDT) <=
        • Gonzalo - Mon, 28 May 2001 01:00:21 -0400 (EDT)