I like to use a monitor program when developing code for retro computers or any other sort of "small" target system. The low level interface a monitor program offers is great for taking full control of a system, manipulating hardware registers, loading code, etc. Fortunately for me, the Apple II machines actually shipped with such a monitor in the built-in ROMs! Even better, the Apple II makes it easy to control the system over a serial port...or so it seemed!
Like many people with an interest in retro computing, I'm old enough to remember when a serial port was a gateway to the world, or at least a gateway to the BBS on the other side of town. I'm no stranger to RS-232 communications, but talking to the serial console on the Apple II sprouted a few extra gray hairs on my head. "IN #2" and setting the baud rate caused the Apple II to accept input over the serial port, but "PR #2" only produced junk on my terminal screen. Adjusting the communications parameters seemed obvious, but none of the sane options worked. Ultimately I used settings of 7 data bits and "mark" parity, but 8 data bits and/or "space" parity seemed to work just as well. I wouldn't be surprised if technically I'm still using the wrong values and just getting lucky...?
That almost sorted the physical setup, except that my TV is on one side of the room and my desk is on the other side of the room. I could use a long cable, but that can be a bit awkward. Bluetooth provides a convenient means of replacing a cable with a wireless connection, and I happen to have an unused Bluetooth<->RS-232 adapter available. Deploying that device made the required connection from across the room.
|Super Serial Over Bluetooth|
Not all Apple II machines are the same! I knew that, of course. But I did not appreciate just how much variation there is even among similar models. What illustrated this for me was trying to run the Apple II mini-assembler. "Assembly Lines: The Complete Book" describes starting the mini-assembler by typing "F666G" from the monitor prompt. Unfortunately, this simply didn't work.
I was under the impression that the Apple IIe included the mini-assembler in its ROM. But deeper research uncovered that this was only true for the "Enhanced IIe" models. Closer inspection revealed that my IIe was in fact a non-enhanced model.
|Not An Enhanced IIe!|
I'm not sure what assembler most Apple II coders use these days, but for now any 6502 assembler that produces raw machine code will work for me. My development platform of choice is Fedora, and it so happens that there are (at least) three 6502 assemblers available in the Fedora repositories. I chose to install ATasm, mostly because I was somewhat familiar with it from earlier Atari 2600 dabbling. I realize that ATasm is geared toward the Atari 8-bit line of computers rather than the Apple II, but for now its raw output format will suffice.
How do I get the assembled code onto the Apple II? Well, I wrote a little Bash script to take the machine code binary from the assembler and format it into commands that can be typed into the Apple II monitor program. I then copy that command text and paste it into my terminal window connected to the Apple II -- voila! In the long run I may want a different or more traditional solution for loading my programs on the Apple II, but this works great right now.
So, now what? Well, I still have a lot of pages left for me to read in "Assembly Lines: The Complete Book". Along the way there will probably be some fun code experiments. If you want to see what happens, then I guess you will have to stay tuned!