Jump to content
IGNORED

programming fundamentals


no attack

Recommended Posts

I'm fairly new to the Atari 800XL and I've been delving into some programming for the past few weeks. I've found the books on atariarchives to be very helpful, but there's a certain amount of common knowledge/terminology that's assumed, especially as it relates to computer architecture.

 

For example, I'm not familiar with terminology like stack, stack pointer, high and low bits, 1k and 2k boundaries, buffers, and so on. Any recommended tutorials/books/websites that might clue me in on some of the basics of computer architecture?

 

I've got a book on 6502 assembly on the way via ebay, which I think may help, but I thought I'd throw the question out as my first official query to the AA boards.

 

Thanks.

Link to comment
Share on other sites

For example, I'm not familiar with terminology like stack, stack pointer, high and low bits, 1k and 2k boundaries, buffers, and so on.  Any recommended tutorials/books/websites that might clue me in on some of the basics of computer architecture?

 

A stack is a section of memory that is used as a "last in-first out" buffer. On the 6502, the stack resides from $0100-$01FF (locations 256-511 in decimal) and has its own 8-bit index register called the Stack Pointer. Since each group of 256 bytes is called a "page," the stack occupies page one. The stack is used automatically by the processor for handling subroutines and interrupts. For example, when you call a subroutine with the JSR instruction, the CPU saves the address you jumped from on the stack, so it knows where to return to when it reaches an RTS instruction. You can also put values on the stack yourself, and pull them back off (PHA, PLA). The stack normally starts at $01FF and works backwards, so a Stack Pointer of $FF would indicate an empty stack, and a stack pointer of $FE would indicate that there is one value "pushed" on the stack.

 

-Bry

Link to comment
Share on other sites

Just to add a little bit extra to the information Bryan gave ...

 

He mentioned that a 'page' of memory was a group of 256 bytes and that Page One was indeed used for the 6502 stack. A little tip is to use Page Zero ($00 - $FF) for holding regularly accessed information. This is because it is supposedly quicker for the processor to access.

 

On the Atari, though, not all of Page Zero can be used by the programmer as half of it is used by the Operating System. And there lies a pitfall you need to be aware of if you're planning on getting into 6502 assembly language. You also need to know how your target machine works and how the various memory locations used by the Operating System and hardware works and what they do.

 

So, on the Atari 8-bit, you really need a copy of a memory map to go with your assembler handbook. You should look for a copy of either Mapping The Atari or (if you can find it), The Complete and Essential Map. The second book can be regarded as an enhancement to Mapping the Atari in that it corrects some errors in the old book. It's also a two volume set - the first volume is the memory map whilst the second contains more technical information, including a list of 6502 opcodes and an OS listing.

 

If you can't find either (Complete is now undoubtedly rare as it was only available through the Tyne and Wear Atari User Group some 7 - 10 years ago) then you can always access Mapping the Atari online at:

 

http://www.atariarchives.org/mapping/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...