[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 31 2007, 4:02 pm, rtk <oneelkr...@hotmail.com> wrote:
> 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, seewww.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
Ron, makes perfect sense now... I just needed that extra mental
framework since I've not had exposure to Python or AS6502. I think
you should add your email to your manual.. would be a nice "tutorial"
addition.
Thank you very much for your carefully crafted reply.
~ J