[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ANN: New 6502 cross-compiler designed for the Apple II
On Dec 15, 6:19 pm, jonnosan <jonno...@gmail.com> wrote:
> Ron,
>
> What's the best way to define new words in assembly? (e.g. if I wanted
> to create a DOS 3.3 library)?
Yes, please to create a new library! I hadn't thought of it before,
but it might be nice to make it easier to add new library words in
assembly.
Here's how to do it:
1. Write your new word. Call "pop" to get the top stack item in A
and X (lo/hi). Call "push" to push A,X on the stack. Also useful is
"get_ta" and "get_tb" to put the top stack address into zero page
locations ta,ta+1 and tb,tb+1.
2. In the spl.py source code you need to update the DEPENDENCIES and
LIBRARYMAP dictionaries. They are near the top of the file. Even if
you are new to Python, you'll see how the syntax goes from what's
already there.
3. In DEPENDENCIES you need to put the names of all the routines that
your routine calls, like "pop" and "push", _if_ those routines exist
in a separate .s file. If you put all your routines in the same .s
file, then you can leave this entry set to an empty list ([]).
However, you are most likely going to call "pop" and "push", if
nothing else. The whole point of the dependencies dictionary is to
only copy the assembly code that is actually needed.
4. In LIBRARYMAP you need to set up the mapping between what you call
your new word in SPL, the left-hand value, and what the base file name
is that holds your routine's code on the right-hand side. You'll see
what I mean when you look at the code.
If you do make new library words and feel like sending them to me I'll
update the source on the web page. That might be best to keep
everything in one place. However, I did put the code out there for
any use, so you don't have to send me anything if you don't want to.
If you make the DOS library in SPL itself you can put it in the
include directory, but that might be difficult for DOS 3.3. I started
with the ProDOS interface in SPL and it was taking up too much memory
so I switched to assembly.
And, of course, do let me know if you run into bugs. I'm sure there
are a few.
Ron