Re: Re: [stella] Climber5 source and binary

Subject: Re: Re: [stella] Climber5 source and binary
From: Dennis Debro <ddebro@xxxxxxxxxxxxx>
Date: Thu, 17 Apr 2003 10:49:46 -0400
Hi Andrew,

If I keep going with you guys you'll probably have this whole thing down to 2K :)

> Firstly, it's really clearing RAM *and* hardware registers.  If you just
> wanted to clear RAM, then you could change the bne .clearRAM to a bmi
> .clearRAM (keeping in mind that X would be $7F at the end of that, instead
> of 0 - but it doesn't seem to be used anyway).  But clearing all of RAM (but
> 1) seems kind of hackish.  Either clear it all, or clear RAM.

:) This of course comes from How To Draw a Playfield. I've seen your code before but didn't implement it. I figured this was okay. After reading this you have convinced me otherwise.

> One thing I've noticed about your code, Dennis, is your use of two-digits
> for hex bytes, *ALWAYS*.

Yeah, this is just something I picked up. I've looked at a lot of 6502 lately (2600/5200/A8/NES) and this kind of stuck with me. Plus it makes the code line up for me. Also I prefer using either hex or decimal in the code and not switching between the two. It can get confusing if you're not careful. I've seen this happen once before. Of course I don't stick to this 100%. I'm switching between the two but not a lot.

> You init the random number from INTIM - yet you don't check if this is 0.
> The RandomByte routine documents this must *not* be zero.  Looking at the
> routine, it should cope with 0 OK - but you should either fix the code or
> the comments.

Comments fixed :)

> You tend to do a lot of NTSC/PAL checking, with branching sections of code
> for loading NTSC or PAL conditions/colours/states.  This strikes me as
> inefficient.  I'd probably check the switch at startup and save the relevant
> bit as D0 of a variable (or D1 - see later in this post).  Then you could
> use that variable as an index to tables.

That's what I did in the prototype I did back in October. I thought about going back to this since I'm currently using 79 bytes of RAM. I was so concerned about RAM usage before, I went straight to reading SWCHB. I agree that it would help. I do hate wasting 7 bits though. I'd have to see if I could reclaim those somewhere.

> By the way, your use of SUBROUTINE is interesting.

This is an example of an observer Stella list lurker. I think at the beginning I was a little better at using SUBROUTINE. Toward the end things kind of started to run together.

> Here's a minor optimisation...
> OK, so instead of having two tables, have one word-table, and save on the
> lsr.

After Manuel's post about animation this morning I went back to looked at that. Thanks.

> Just below that is another example of SWCHB optimisation with a variable.

More ROM bytes...I'm foaming at the mouth :)

> Finally, your code had....
> overlay              ds 27          ; overlay place holder (thank you
> Andrew)
> You are very welcome.  Seeing a comment like that makes it all worthwhile -
> thank you!

I gain so much from examples and snipplets here on the list. You and others are invaluable!!

Take care,

Archives (includes files) at
Unsub & more at

Current Thread