[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 30, 2:04 pm, MdntTrain <j...@cimmeri.com> wrote:
> I'm confused.   "SPL" is a language, which Ron wrote in another
> language called "Python", that outputs 6502 assembler, and that output
> is then assembled by the C program, "AS6502"?    Not sure what happens
> after that.. but is that the gist?

This is exactly correct.  What happens next is that your output file
is either transferred to a real Apple II and run there as a binary
file or, if you chose a disk image file as output, you can load that
disk image file in any Apple II emulator and run the file there.

> Would someone be so generous as to describe the steps of taking a
> sample SPL program from start to actually running on an Apple so it
> can be seen how this all works?

Sure, no problem.

Say I have a PC running Linux (or Windows).  On that PC I download and
unpack the SPL compiler.  What I get is basically an executable for
as6502 and a file called spl.py plus a directory called lib with over
100 .s files in it.

Now I want to create a new SPL program to run on the Apple II.  I open
a text editor on the PC and enter something like this:

def main
  "Hello world!" disp cr
end

and save it to a file called hello.spl.  Now I can run the SPL
compiler on this file.  This is done from the command line by typing
something like:

python spl.py hello -o hello -t bin

Assuming that Python is installed (almost always true with any
standard Linux distribution, you have to get it and install it
yourself for Windows, see www.python.org.  Copy the python.exe file to
some place in your Windows path, I usually use C:\WINDOWS) I now have
two new output files, hello.s and hello.bin.  The first is the 6502
assembly code that is the application.  It was generated by Python
running the spl.py program.  The second is the binary data generated
by assembling hello.s using as6502.  The as6502 program was called for
you by the Python program.  This explains the lib directory.  In there
you will find disp.s and cr.s files.  These were simply appended to
the output file generated by spl.py so that the assembler would know
how to implement those words.

Now, we don't have to output only binary data, instead we can create a
disk image file for an emulator which has the binary data on it
already setup so that ProDOS will know it is a binary program.  To do
that use a command line like:

python spl.py hello -o hello -t dsk

which will create a hello.dsk file.  This is the 140k disk image
file.  If loaded into an Apple II emulator, I usually use AppleWin, it
will be seen that there is a single file on the disk, A.OUT.  This
file can be run using -A.OUT and we'll see "Hello world!" printed on
the screen.

To get the compiled program to an actual Apple II you can do one of
two things:

1.  Send the hello.bin file over to the Apple II as a BIN file.  Then
BLOAD hello.bin, A$900 where $900 is the ORG address used when
compiling (the default).  Then BSAVE to a new file.  This will then be
a file ProDOS can run.

or

2.  Compile using the -t a2t option.  This will make a text file
(hello.txt) that when transferred to the Apple II and EXEC-ed will
load the binary data into memory and BSAVE it as a binary program.

The second option is probably the easiest.

I hope this helps (?)  Please ask is something doesn't make sense, I'm
sure it is just my poor explanation.

Ron