Re: [stella] Putting it all togather (another newbie question)

Subject: Re: [stella] Putting it all togather (another newbie question)
From: Christopher Tumber <christophertumber@xxxxxxxxxx>
Date: Tue, 08 Apr 2003 12:03:11 -0400
>In my understanding.. The VCS memory map is kinda like a grid... each little box represents an address from $0000-$FFFF.. it this listed somewhere?? What address >are locked for specific functions?? 

Get the Stella Programmer's Guide at www.atarihq.com/danb/files/stella.pdf  See pages 45 and 46 (Pages 38-44 explain them a little more. For more details, read the guide...)

In a nutshell, in a 4K program, your program code starts at $F000. Hardware registers are $00-$2C and $280-$297.

>Do X,Y,A all have seperate "blocks" of "boxes"

Yes (bankswitching is irrelevant to this question). So does the Stack pointer, the Program Counter and the Processor Flags.

>And yet another thing... I have been looking at the differant sources from the games.. Is there any particular order to the layout of the source?? 

Not really, but kinda.

Some programs (particularly demo/tutorials) have a structure like this:

<Initialisation>
main_loop:
<vertical blank>
<display kernal>
<overscan>
jmp main_loop

<subroutines>
<data (bitmaps, song data)>


However, the display kernal often needs to be page aligned for timing purposes (If that doesn't mean anything to you, don't worry about it, it will) which gives rise to structures like this:

<Initialisation>
main_loop:
jsr vertical_blank
jsr display_kernal
jsr overscan
jmp main_loop

<subroutines including vertical blank and ovrscan>
<data (bitmaps, song data)>
<display kernal>


or like this:


<display kernal>
<Initialisation>
main_loop:
jsr vertical_blank
jsr display_kernal
jsr overscan
jmp main_loop

<subroutines including vertical blank and overscan>
<data (bitmaps, song data)>


So that <display kernal> can be anchored (with an ORG or because it's the very first part of code) so that it doesn't move around every time you add/remove new code. Game data (bitmaps and such) are often also anchored in this way for the same reason.

But there's really no hard and fast rule. Personally, I tend to go for very linear code (like the first example) because I have a phobia regarding the use of unnesessary JSR/RTS combinations (12 wasted cycles!) but structures like the last two are probably a lot more common, particularly among hombrewers.


Chris...

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


Current Thread