Apple II Pi

35 replies [Last post]
resman's picture
Offline
Joined: Feb 9 2006
Posts: 180

This week's project brings together the old with the new. But in perfect harmony.

http://youtu.be/Kx_ggKHWaxA

I actually surprised myself with how much I enjoy the retro feel of my Apple //c working as a modern computer.

Source on GitHub, but you have to put a little effort in configuration. github.com:/dschmenk/apple2pi

Dave...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gsmcten's picture
Offline
Joined: Oct 4 2005
Posts: 1593
Re: Apple II Pi

Resman (Dave),

ASOLUTELY OUTSTANDING!

You are going to have to write down the steps to do this.

Steven Smile

__________________

Steven (gsmcten)

"Apple ][.....It's ALIVE!!!!!"

Offline
Joined: Apr 24 2012
Posts: 213
Re: Apple II Pi

Could you please elaborate more? I'm dying to do the same with my //c and RasPI!
Thanks!
Javster

resman's picture
Offline
Joined: Feb 9 2006
Posts: 180
Re: Apple II Pi

Javster, here is the README I just updated on GitHub. Hopefully it answers some questions:

Apple II client/server for Raspberry Pi

Apple II Pi works by connecting an Apple II to a Raspberry Pi using a RS232 serial connection. In order to get the Raspberry Pi to talk RS232 from it's 3.3V GPIO serial port, you will need to build or buy a converter. They are very cheap on eBay, so I would recommend going that route. To ensure you've hooked the converter up correctly, try loggin into the Raspberry Pi from another modern-ish computer. Raspbian, the default Debian based Linux for the Raspberry Pi, opens up a login (getty) session on the serial port at 115.2K baud. You will probably need a null modem or cross-over cable to login from another computer. Once it all checks out, time to connect your Apple II. All the 3.3V converters I see have a DB-9 connector and many of the Apple II era connectors are DB-25 so you may need a DB-9 to DB-25 converter.

Installing and configuring the Apple II: You will need an Apple //c or Apple //e w/ SuperSerial Card. An Apple II Mouse is recommended for that full-on retro feel, but not required. Download and install the A2PI.DSK disk image onto a 5 1/4 floppy. ADTPro would be the recommended tool for that operation.

Installing and configuring the Raspberry Pi: Download the a2pid.c to your Raspberry Pi. Compile the daemon with 'cc a2pid.c -o a2pid' and copy the result with 'sudo cp a2pid /usr/bin'. You will need to disable the Raspbain serial login by editing /etc/inittab and commenting out the line (probably at the very bottom) that looks like:

T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

To adjust the NTSC output so it fits nicely on my //c monitor, I edited the setting in /boot/config.txt such that:

overscan_left=26
overscan_right=-8
overscan_top=-8
#overscan_bottom=16

To run the a2pid daemon automatically at boot time, edit /etc/rc.local and add:

a2pid --daemon

right before the line:

exit 0

followed by rebooting the Raspberry Pi.

Reboot the Apple II with the newly created floppy in the start-up drive. If everything is configured correctly, you should be able to login to the Raspberry Pi with your Apple II keyboard. If you have an Apple II Mouse, that should control the cursor in X, or in the console if you have gdm installed.

Using a2pi: The Apple //c and //e keyboards are pretty minimal compared to modern keyboards, and the Apple II Mouse only has one button. In order to provide most of the funcitonality required of modern OSes, the Open-Apple and Closed-Apple keys are used as modifiers to enhance the keyboard and mouse. On the keyboard, Open-Apple acts just like the Alt key. The Closed-Apple key acts like a Fn key, changing the actual key codes. Currently, the Closed-Apple key will modify the number keys 1-0 as funciton keys F1-F10 and the arrow keys as Left-Arrow=Home, Right-Arrow=End, Up-Arrow=PgUp, Down-Arrow=PgDn. For the mouse, when you click the mouse button by itself, that is the left(default)-click. Open-Apple along with the mouse button will return the right-click, and Closed-Apple along with the mouse button will return the middle-click. If you should ever need to exit a2pi, press Closed-Apple ESC on the Apple II keyboard. This will exit both the code on the Apple II and the Raspberry Pi. This is useful when developing and debugging the drivers/daemons. a2pid can be run directly (not as a daemon) by leaving off the '--daemon' option. Enabling printf's in the code allows one to watch the packets arrive and get processed when run from a network ssh session.

Theory of operation: Apple II Pi works by running code on the Apple II and the Raspberry Pi, talking to each other with a simple protocol. The Apple II basically appears to the Raspberry Pi as an external peripheral, not unlike a USB keyboard and mouse. The Apple II floppy boots into ProDOS and runs a simple machine language program that scans the keyboard, and mouse if present, sending the events out the serial port to the Raspberry Pi. It is a very simple protocol and the serial port is running at 115.2K baud, so it is fast and low overhead. On the Raspberry Pi, a little daemon runs, waiting for packets on the serial port, converts the Apple II events into Linux compatible events, and inserts them into the input subsystem.

Enjoy,

Dave Schmenk

resman's picture
Offline
Joined: Feb 9 2006
Posts: 180
Re: Apple II Pi

Part 2: The Apple IIe Pi

http://youtu.be/BX2VWZQCtkU

Is it an Apple II upgrade or a bizarre Raspberry Pi case?
Dave...

Offline
Joined: Feb 15 2013
Posts: 4
Re: Apple II Pi

Hi - can you briefly explain why (or if) the Apple II+ can't be used for this? Thank you so much!

resman's picture
Offline
Joined: Feb 9 2006
Posts: 180
Re: Apple II Pi

micki001 wrote:

Hi - can you briefly explain why (or if) the Apple II+ can't be used for this? Thank you so much!

It is possible to use an Apple II+, but you will need a USB keyboard. I just don't know how to get all the keycodes to map to effectively use Linux. The IIe and IIc have a full ASCII keyboard plus the Open-Apple and Closed-Apple keys for modifiers.

So, you can use an Apple II+, but it really would be just a power supply.

Dave...

Offline
Joined: Feb 15 2013
Posts: 4
Re: Apple II Pi

Thanks Dave - I've got a SuperEncoder board: http://www.brielcomputers.com/superencoder.html

So that might get around the encoding issue or at least, help determine the differences in keyboard encoding between the II+ and the IIe/IIc...

Sound at all feasible?

resman's picture
Offline
Joined: Feb 9 2006
Posts: 180
Re: Apple II Pi

micki001 wrote:

Thanks Dave - I've got a SuperEncoder board: http://www.brielcomputers.com/superencoder.html

So that might get around the encoding issue or at least, help determine the differences in keyboard encoding between the II+ and the IIe/IIc...

Sound at all feasible?

Certainly worth a try. No harm in connecting a serial cable! I do use the Open-Apple key as ALT, and the Closed-Apple as Fn (to modify the other keys), but these are really just the joystick/paddle buttons. Give it a go!

Dave...

Offline
Joined: Feb 15 2013
Posts: 4
Re: Apple II Pi

Cool - I will, thanks Dave!

- and as a bizarre aside I wonder if the numeric keypad might be brought into service to provide a wider range of modifier keys...

resman's picture
Offline
Joined: Feb 9 2006
Posts: 180
Re: Apple II Pi

micki001 wrote:

Cool - I will, thanks Dave!

- and as a bizarre aside I wonder if the numeric keypad might be brought into service to provide a wider range of modifier keys...

Probably not. The way the Apple II works is by presenting the ASCII code of the key combination entered on the keyboard. Ever since the early '80s, the standard has been to send key up/down events and have the OS decipher the actual character based on modifier keys, locale, and such. So when Apple II Pi inserts keycodes into the Linux input subsystem, it has to recreate any SHIFT and CTRL key modifiers from the ASCII code. They keyboard encoder you have that accepts the PS/2 keyboard is doing the work of translating the keycodes into ASCII. So you can see a lot of information gets lost in the process of converting key codes->ASCII->key codes. Not all the keys on a PS/2 keyboard are nicely represented in ASCII, either. But there is no harm in trying it out. Worst case is you use a USB keyboard attached to the RPi.

Dave...

Offline
Joined: May 26 2009
Posts: 21
Re: Apple II Pi

HI Dave -

I would love to do this project but I am stymied right out of the gate. You say, "In order to get the Raspberry Pi to talk RS232 from it's 3.3V GPIO serial port, you will need to build or buy a converter. They are very cheap on eBay, so I would recommend going that route." What exactly am I searching for on eBay? Can you post a picture of the converter and/or keywords for the search? I am trying to find it on eBay using "raspberry pi", "serial", "rs232" etc but can not get anything that looks appropriate.

Thanks much in advance for your help!

Ken
www.Apple2Online.com

__________________

drkenb
www.Apple2Online.com
_________________________

When I die, I want to go peacefully in my sleep like my grandfather...
Not screaming in terror like his passengers.

resman's picture
Offline
Joined: Feb 9 2006
Posts: 180
Re: Apple II Pi

drkenb wrote:

HI Dave -

I would love to do this project but I am stymied right out of the gate. You say, "In order to get the Raspberry Pi to talk RS232 from it's 3.3V GPIO serial port, you will need to build or buy a converter. They are very cheap on eBay, so I would recommend going that route." What exactly am I searching for on eBay? Can you post a picture of the converter and/or keywords for the search? I am trying to find it on eBay using "raspberry pi", "serial", "rs232" etc but can not get anything that looks appropriate.

Thanks much in advance for your help!

Ken
www.Apple2Online.com

Ken-

I've used this one with good results but it requires you to build a cable:
http://www.amazon.com/gp/product/B0088SNIOQ/ref=oh_details_o04_s00_i00?ie=UTF8&psc=1

You have another option to use one of those USB -> serial port cables. You will just need to pass in the /dev/ttyXXX device to the a2pid daemon.

Dave...

Offline
Joined: May 26 2009
Posts: 21
Re: Apple II Pi

Many thanks Dave - just ordered a few of them from Amazon. Making a cable is no problem for me.

Another question: the original post said that it would be nice to have an Apple II mouse, but if you're using the DB-9 serial port on the IIc for the adapter/Pi, there is no way to connect the mouse, is there?

Ken

__________________

drkenb
www.Apple2Online.com
_________________________

When I die, I want to go peacefully in my sleep like my grandfather...
Not screaming in terror like his passengers.

resman's picture
Offline
Joined: Feb 9 2006
Posts: 180
Re: Apple II Pi

drkenb wrote:

Many thanks Dave - just ordered a few of them from Amazon. Making a cable is no problem for me.

Another question: the original post said that it would be nice to have an Apple II mouse, but if you're using the DB-9 serial port on the IIc for the adapter/Pi, there is no way to connect the mouse, is there?

Ken

Ken-

That's not a serial port, that is the joystick/mouse port. The //c uses those screwy 5 pin DIN ports for the serial ports. A cabling nightmare.

Dave...

Offline
Joined: May 26 2009
Posts: 21
Re: Apple II Pi

Dave - Thanks for the clarification. I just sustained a neck injury and the pain meds are really screwing me up... which is why I am NOT doing anything at the moment (best way to screw up a project is to do it when your extremely tired or on pain meds!). The converter having the DB-9 pins threw me off.

I have the IIc serial printer cables in stock, so once I get the converter I should be good to go!

Many thanks for both pioneering this project as well as your assistance to us lesser beings - much appreciated!

Ken

__________________

drkenb
www.Apple2Online.com
_________________________

When I die, I want to go peacefully in my sleep like my grandfather...
Not screaming in terror like his passengers.

resman's picture
Offline
Joined: Feb 9 2006
Posts: 180
Re: Apple II Pi

Ken-

No worries. Keep us posted on your progress. Ivan Drucker was able to get his //c working at KFest without much incident, so there is a precedent for others than me for getting this working.

Dave...

Offline
Joined: May 26 2009
Posts: 21
Re: Apple II Pi

Dave - Will definitely do. I'm sure that Ivan and your knowledge & experience far far surpasses mine. When you hear "It's so simply a dummy can do it" I'm usually the dummy that they tested it against.

Ken

__________________

drkenb
www.Apple2Online.com
_________________________

When I die, I want to go peacefully in my sleep like my grandfather...
Not screaming in terror like his passengers.

Offline
Joined: May 26 2009
Posts: 21
Re: Apple II Pi

Dave - Got the connectors in today and one question I have: Using the plan I found for the adapter, its basically connecting four points: VCC, TXD, RXD and Ground. Are those the only 4 needed?

Ken

__________________

drkenb
www.Apple2Online.com
_________________________

When I die, I want to go peacefully in my sleep like my grandfather...
Not screaming in terror like his passengers.

resman's picture
Offline
Joined: Feb 9 2006
Posts: 180
Re: Apple II Pi

drkenb wrote:

Dave - Got the connectors in today and one question I have: Using the plan I found for the adapter, its basically connecting four points: VCC, TXD, RXD and Ground. Are those the only 4 needed?

Ken

VCC -> 3.3V, not the 5V.

Good to go. Now you just need the cable magic to connect the serial ports. Make sure you read the instructions on GitHub.

Good luck!

Dave...

Offline
Joined: May 26 2009
Posts: 21
Re: Apple II Pi

Dave - I'm stumped. I have a new CF card with a new installation of raspbian on it, booted up and got to the desktop. I used Midori to access your github page and have a few questions for you. Please realize I am not a linux person by any means and so I am dumber than ditchwater on linux.

The directions you give above in this forum are far different from those on the github page. I was following the directions from here, and when I do the "cc a2pid.c -o a2pid" it gives me all sorts of errors & warnings and does not create an "a2pid" file.

I then tried to understand and follow the directions on the github page, and am totally lost: "Download the apple2pi project to your Raspberry Pi." What project is this specifically? I thought it was the a2pid.c file, but after reading the next sentance I am not too sure: "Enter the apple2pi/src directory." I do not have an "apple2pi/src" directory on my Pi. Is that created when I "download the apple2pi project"?

The next statement is totally alien to me, so can you please walk me through it? "Compile the daemon and tools with 'make' and copy the results to /usr/local/bin with 'sudo make install'."

Finally, "You will need to disable the Raspbain serial login by editing /etc/inittab and commenting out the line (probably at the very bottom) to look like: #T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100." Is this done after I compile the daemon and tools with make... or before I do that?

Thanks much in advance for your help. Trying to learn linux and the raspberry pi at the same time is a bit daunting to me. The tutorials online for the newbie Raspberry Pi user contain a lot of circular directions, and its often difficult to figure out the proper order to do things in.

Ken

__________________

drkenb
www.Apple2Online.com
_________________________

When I die, I want to go peacefully in my sleep like my grandfather...
Not screaming in terror like his passengers.

resman's picture
Offline
Joined: Feb 9 2006
Posts: 180
Re: Apple II Pi

drkenb wrote:

Dave - I'm stumped. I have a new CF card with a new installation of raspbian on it, booted up and got to the desktop. I used Midori to access your github page and have a few questions for you. Please realize I am not a linux person by any means and so I am dumber than ditchwater on linux.

The directions you give above in this forum are far different from those on the github page. I was following the directions from here, and when I do the "cc a2pid.c -o a2pid" it gives me all sorts of errors & warnings and does not create an "a2pid" file.

I then tried to understand and follow the directions on the github page, and am totally lost: "Download the apple2pi project to your Raspberry Pi." What project is this specifically? I thought it was the a2pid.c file, but after reading the next sentance I am not too sure: "Enter the apple2pi/src directory." I do not have an "apple2pi/src" directory on my Pi. Is that created when I "download the apple2pi project"?

The next statement is totally alien to me, so can you please walk me through it? "Compile the daemon and tools with 'make' and copy the results to /usr/local/bin with 'sudo make install'."

Finally, "You will need to disable the Raspbain serial login by editing /etc/inittab and commenting out the line (probably at the very bottom) to look like: #T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100." Is this done after I compile the daemon and tools with make... or before I do that?

Thanks much in advance for your help. Trying to learn linux and the raspberry pi at the same time is a bit daunting to me. The tutorials online for the newbie Raspberry Pi user contain a lot of circular directions, and its often difficult to figure out the proper order to do things in.

Ken

Hi Ken-

First, do you know you have a properly working serial connection? If you aren't sure, everything else will be frustrating. A simple way to ensure your serial connection works is to try logging into the Pi with a term program on your //c like ProTERM. You will have to disable hardware handshaking in your term program. On your Pi, this line:

T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

in the /etc/inittab file specifies the baud rate of the serial port login. The "115200" parameter is much too fast for a //c term program. Make it something like 1200 that you know the //c can handle. This is the same line you will comment out later, but for now just change the baud rate. Once that is done, you should be able to use your //c as a serial terminal into your Pi as long as the serial connection is good.

Then...

The instructions on GitHub will always supersede any previous instructions. From the https://github.com/dschmenk/apple2pi page, you should see a "download ZIP" button on the right. Click that. You should have a ZIP file on you computer that you will have to unzip (using 'unzip apple2pi-master.zip' from the command line) and you should have the full project tree. The project is now built with a makefile, so type in what the instructions say i.e. what is quoted is what you would type on the command line. The instructions on GitHub should get you going. If not, I'll make sure they get cleared up. Follow the order of the instructions and you should be fine.

Dave...

david__schmidt's picture
Offline
Joined: Apr 11 2006
Posts: 850
Re: Apple II Pi

I laughed out loud when I saw this. I must be old and crotchety or something... I don't like git much, and it doesn't like me much either.

resman's picture
Offline
Joined: Feb 9 2006
Posts: 180
Re: Apple II Pi

david__schmidt wrote:

I laughed out loud when I saw this. I must be old and crotchety or something... I don't like git much, and it doesn't like me much either.

Heh. Git can't decide if it is a web app, native GUI app, or a command line app. Give me good 'ol CVS. Subversion isn't too bad, it runs pretty much like CVS - better in some ways. Now git off my lawn, you pesky kids (pun intended).

Offline
Joined: May 26 2009
Posts: 21
Re: Apple II Pi

Hi Dave - I've had success with finally figuring out how to compile the tools and then use the "suko make install" file but ran into a wall when I edited the /etc/inittab file - I am unable to save it. Apparently I don't have the proper permissions to do so. Any helpful suggestions to get me over this speed-bump?

Thanks much!

Ken

__________________

drkenb
www.Apple2Online.com
_________________________

When I die, I want to go peacefully in my sleep like my grandfather...
Not screaming in terror like his passengers.

resman's picture
Offline
Joined: Feb 9 2006
Posts: 180
Re: Apple II Pi

drkenb wrote:

Hi Dave - I've had success with finally figuring out how to compile the tools and then use the "suko make install" file but ran into a wall when I edited the /etc/inittab file - I am unable to save it. Apparently I don't have the proper permissions to do so. Any helpful suggestions to get me over this speed-bump?

Thanks much!

Ken

Hi Ken-

Were you able to test the serial port yet? To edit files like /etc/inittab, use "sudo vi /etc/inittab" to edit it with proper permissions. It may still be read-only, so use "w!" to override the read-only settings.

Dave...

Offline
Joined: May 26 2009
Posts: 21
Re: Apple II Pi

Hi Dave -

I'm still not getting it. I tried the "sudo vi /etc/inittab" command in an LXTerminal window and what I saw might as well have been written in Russian. I had been trying to edit the file using Leafpad, and that is when I couldn't save the file. I may just have to give up on this one.

Update:
But being a stubborn SOB, I spent quite a bit of time online and finally found a site that is actually accessable that provides an easy-to-read-in-plain-English summary of commands in linux. I was able to change the permissions of the file so that it is readable-writable and make the changes, so now I continue...

Ken

__________________

drkenb
www.Apple2Online.com
_________________________

When I die, I want to go peacefully in my sleep like my grandfather...
Not screaming in terror like his passengers.

resman's picture
Offline
Joined: Feb 9 2006
Posts: 180
Re: Apple II Pi

Ugh. Time to document. I've made a first pass for "What is the Apple II Pi". Hopefully it will answer some questions about the various components.

http://schmenk.is-a-geek.com/wordpress/

Dave...

resman's picture
Offline
Joined: Feb 9 2006
Posts: 180
Re: Apple II Pi

drkenb wrote:

Hi Dave -

I'm still not getting it. I tried the "sudo vi /etc/inittab" command in an LXTerminal window and what I saw might as well have been written in Russian. I had been trying to edit the file using Leafpad, and that is when I couldn't save the file. I may just have to give up on this one.

Update:
But being a stubborn SOB, I spent quite a bit of time online and finally found a site that is actually accessable that provides an easy-to-read-in-plain-English summary of commands in linux. I was able to change the permissions of the file so that it is readable-writable and make the changes, so now I continue...

Ken

Ken-

I've added to the install process an automated script to make all the necessary changes to the Linux system files. When you download the latest zip file, type 'make' and 'sudo make install', you should have a working Linux setup. The Apple II side needs the latest floppy image. It should work out-of-the-box, but if you have more than one Super Serial Card, or have a //c and you want to use the printer port instead of the modem port, there is a CONFIG program that can force the slot # for the serial card/port. Hope that gets you going,

Dave...

Offline
Joined: May 26 2009
Posts: 21
Re: Apple II Pi

Dave - Many many thanks! I had to shelve the project due to a surgery I had last Friday, but hope to pick it up once I get over the surgery hump and get caught up on business. Will keep you posted on how I make out.

Ken

__________________

drkenb
www.Apple2Online.com
_________________________

When I die, I want to go peacefully in my sleep like my grandfather...
Not screaming in terror like his passengers.

resman's picture
Offline
Joined: Feb 9 2006
Posts: 180
Re: Apple II Pi

Update demonstrating the current state of hardware/software integration of Apple II and Raspberry Pi: http://youtu.be/tbqLEU35d0E

Software available on github link above.

Dave...

resman's picture
Offline
Joined: Feb 9 2006
Posts: 180
Re: Apple II Pi

drkenb wrote:

Dave - Many many thanks! I had to shelve the project due to a surgery I had last Friday, but hope to pick it up once I get over the surgery hump and get caught up on business. Will keep you posted on how I make out.

Ken

Ken, or anyone else that is interested-

I am looking for a few brave souls to try a new .deb package and repository I've put together. It is the same code as before, but now using Debian package management to install, configure, and track updates. A much better long term solution. If you already have a working Apple II Pi setup, or have an Apple II with a known working serial connection to a Pi, One simple edit to your /etc/apt/sources.list file will get you up-to-date, and keep you there. Contact me with a PM and I'll point you to the link.

Thanks,
Dave...

resman's picture
Offline
Joined: Feb 9 2006
Posts: 180
Re: Apple II Pi

After a long gestation period, I'm pleased to announce the Apple II Pi adapter card is available. Kind of a Swiss Army Knife product, it has expanded from my original idea into something with a life of it's own. Leveraging the skills of David Schmidt, Ivan Drucker, and a host of others, it takes the Apple II to the next level:

https://www.ultimateapple2.com/catalogzenQI/

The new forums will contain the most up-to-date information and help:

https://ultimateapple2.com/forum/index.php

Enjoy!

Dave...

P.S. these videos might help with figuring out just what the Apple II Pi is.

As it developed: http://www.youtube.com/playlist?list=PLlPKgUMQbJ7_bSF7wZ7aHwHC-JularURb

What is the A2Pi?: http://www.youtube.com/playlist?list=PLlPKgUMQbJ7_NYzv8teRtEAZZzydgqMWV

gsmcten's picture
Offline
Joined: Oct 4 2005
Posts: 1593
Re: Apple II Pi

Resman,

Yup!
I just read the announcement up on A2central.

Oh Joyousness!!!

Steven Smile

__________________

Steven (gsmcten)

"Apple ][.....It's ALIVE!!!!!"

ericF's picture
Offline
Joined: Sep 22 2013
Posts: 21
Re: Apple II Pi

I'm loving the a2pi, but is there any way to change the disk images besides changing the linked files in /etc/share/a2pi? Also, where is the physical drive device mounted (i.e. my S6 floppy)?

eF

resman's picture
Offline
Joined: Feb 9 2006
Posts: 180
Re: Apple II Pi

ericF wrote:

I'm loving the a2pi, but is there any way to change the disk images besides changing the linked files in /etc/share/a2pi? Also, where is the physical drive device mounted (i.e. my S6 floppy)?

eF

Your floppy disk is still in slot 6. There is a script to swap the links in a synchronous way: a2setvd. Check forums on ultimateapple2.com for more information/support.

Dave...