Re: [stella] Hello from Square One

Subject: Re: [stella] Hello from Square One
From: John Harvey <jkharvey@xxxxxxxxxxxxxxxxx>
Date: Wed, 06 Jan 1999 19:25:25 -0600
>Hello there, everybody, from a newbie.  I have shaved my head and put
>on my Shoalin robes.  I have a few questions, and one comment to make.
> (I know these may seem trivial to those of you who know what you're
>doing, but I gotta start somewhere.)  Please red pencil where I am

Welcome aboard.

>2)  I was reading a book on programming the Apple IIe (6502 processor,
>doncha know), and it mentions that the branch commands only go 127 (or
>128, depending on direction) bytes at the most.  Has anybody ever run
>into a situation where branches are required further than this?
I have before.  This happens a lot when you have no idea where to place all
the subroutines in code.  Basically, I reorganized my code to fit the
branch (move some subroutines around), or I branched to a small subroutine
as in this case:

	;do stuff
	BEQ Next
	;do more stuff
	JMP Destination
;more subroutines


Yes, it may seem a bit sloppy, but it's an easy way to get more distance
out of a branching command.  JMP has a heck of a lot more range than a

>3)  Please explain the Stack Pointer with regards to the subroutines. 
>What location in memory is it?  How big is it?

The stack pointer is generally set to $FF.  It counts down, all the way to
$80.  $80 is also where you set up your memory variables though.  This is
generally not a problem unless you have a lot of memory variables or some
form of recursion in your program.  
You have to set the stack pointer to $FF yourself.  

>4)  Supposing I JSR to a JMP command.  Will a RTS send the program
>back to the command after JSR, or will I screw up the program?

Yes indeed.  Works fine.  (If your asking if one can RTS from a JMP).  It
may be a bit ugly, but it still works.

>5)  When the Atari powers up, are all the memory locations, flags,
>etc. reset automatically, or in some random state so the programmer
>needs to reset them himself?

All random.  It is good practice to set them all to zero.  Oherwise WEIRD
things can happen.  

>6)  Is there a way to produce text for a few words on the Atari, or do
>any words have to be drawn out by the graphics engine (is that the
>right term?)?

Nope.  Graphics all have to be drawn by yourself and set in sprites.  No
ASCII here.

>Whew!  Sorry if I've gone over already trod ground, and sorry if I ask
>so many questions.  But any help will be appreciated.  (P.S. I will no
>doubt have more questions as I learn, so this is your only chance to
>not encourage me.)

Not a problem at all.  Glad to have ya aboard.

If you're just starting out (which I did recently), the first things I did
was find the Stella Manual online, and the "How to Draw a Playfield" info
by Nick Bensema.  The best place to get these is at Nick's website.

Also, you probably want a copy of vcs.h.   It's on my website:

	-John K. Harvey

Archives (includes files) at
Unsub & more at

Current Thread