Re: [stella] Reflex: Source of PAIN!

Subject: Re: [stella] Reflex: Source of PAIN!
From: "Andrew Davie" <atari2600@xxxxxxxxxxxxx>
Date: Tue, 6 Apr 2004 01:09:34 +1000
I've had a bit of a browse through this code.

It is very clear and well written, and an excellent example of how to code
things properly.  Intuitive use of subroutines, logical grouping of
functions and clear and easy to understand code.  This is an excellent piece
of code for use as a "how to".  It is also tackling a game concept which is
interesting, yet not too difficult as to be too tricky as a first project.
So, i admire the style - not to mention the speed of development.  Some of
that is due to the style, of course.

Looks to me like you're a Delphi/Pascal programmer, judging by your
first-letter lowercase, following words capitalised first letter format :)
Hungarian asm, here we come!  But seriously, the long label names are great
for readability.  I'd say comments are a tad sparse -- especially for
beginners.  It's great that you're becoming comfortable with the language,
but don't forget that comments are for others AND yourself, and someday
you'll come back to this code and wonder what the hell you were doing.  So,
don't be lazy.  Comment well.

The use of the standardised macros (eg: CLEAN_START) is pleasing.  The use
of 'subroutine' to identify subroutines -- totally not necessary, but
extremely good style because it aids readability.  The use of local labels
within subroutines -- again, not necessary, but does prevent unexpected
branches to inside routines, and clarifies the scope of labels/loops.  The
variable declarations are of a style I don't myself like (byte, word) -- but
that's just a style issue.  Overall, it's clear that you're a particularly
cautious programmer.

However (and there's always a however!), it is not always going to be
possible to code this way.  I wouldn't like people to think that this style
of coding is the norm and all the other programs are poorly written.  When
you are pushing the very limits of your ROM size, and you need to fix one
more bug, and you have 10 bytes left and you NEED 20, you find yourself
sacrificing clarity, readability and sanity to get those extra bytes.
Suddenly your structure goes to pieces and you start to realise the real
value in sphagetti code.... destroy the structure and run the threads of
execution in a knotted mess to save a byte?  sure, go for it!

Sometimes, even 2 levels of subroutines are just too expensive.  Sometimes,
the extra 12 cycles required for a subroutine call/return are out of the
question.  Now that you are very close to mastering the fundamental "how to"
program the '2600 (and, again, great job!) -- it will be interesting
watching you 'push the envelope' which is, of course, your next challenge.

Overally, I don't have anything to criticise in this effort.  You've clearly
studied other people's code and suggestions, and the stella posts carefully.
Well done!

Cheers
A

PS: I would love to see this program's source code included on the AtariAge
"2600 Programming for Newbies" forum as an example of clear and
understandable source code for beginners to learn from, or even on the
companion CD to my "Programming the '2600" book.

----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/


Current Thread