The processor referenced will be the 6502 and 65c02 unless otherwise noted. There will be references to the 65816 in section 13 and many other isolated places. The language is 65c02 assembly language. A few sections have a lot of references to Forth because of how the programmer is in constant contact with its stacks, and because of what we can learn from Forth to apply in our assembly-language work. There are other such languages, like RPL (reverse-polish Lisp) and PostScript which I am not qualified to speak on.
The reader should already be familiar with the 6502's programmer's model (ie, register types and sizes, etc.), instruction sets and addressing modes, and of course basic things like hexadecimal number notation, signed two's-complement numbers, what a subroutine is, and what an interrupt is. (There are links to my articles on interrupts at the top of this page.) There are mentions and examples of macros. It is not necessary for the reader to be familiar with macros yet, but I want to keep encouraging their use, as they make the programmer more productive, reduce bugs, and make code more maintainable, with absolutely no penalty in run speed or memory consumption in most cases.
Looking at other people's code can be a pain, but OTOH examples are a must; so I try to make them as generic and clear as possible. Actually, the hardest part of writing this was coming up with simple, general-purpose examples that don't require giving a lot of background in a specialized application in order for the reader to understand them. I hope to keep adding or improving examples. Email me with suggestions.
Index to sections:
Subject to constant improvements! If you find errors, typos, dead links, or inconsistencies, or want something else covered or something clarified, or want to suggest additional links, material, examples, photos, or diagrams, please email me at wilsonminesBdslextremeBcom (replacing the B's with @ and .). For discussion, use the forum. For the reasons I do the website the way I do, see the end of this page.
As usual, there's no warranty on any of this material. Not all of the subroutines are tested as-is, but other than the very shortest and simplest ones, most are at least a 1:1 translation from known-working material. If you build a whole system from Appendix A or B, I can almost guarantee you will have some debugging to do. It will still be worth it for many situations though, since much of the subroutine-writing has already been done for you. (* * * * * Note: These two appendices are not finished, but I have not been able to work on them recently and I did not want to hold up the publication of the whole stacks treatise just for these. Appendix A is about 75% done, and viewable.)
A special thanks goes toJeff Laughton who made the
attractive animated diagrams!
Next--> definition and very basics
this index page last updated Mar 5, 2022 Written in 2013-2015. Garth Wilson email: wilsonminesBdslextremeBcom (replace the B's with @ and .)