Friday, December 14, 2018

ESP32 internet modem with PPPD and secure Contiki webbrowser

I have been working on a internet modem for the ESP32 that can be used with a wide variety of computers, some more retro than others. Here are some expected use cases:

  • Apple II without TCP/IP connects with a VT52 or VT100 terminal.
  • Old Macintosh with TCP/IP stack, but no ethernet card, connects with PPP.

Basically, since the ESP32 is so cheap, it is much more affordable than a dedicated Raspberry Pi + interface card. One of the big issues is connecting to the modern web with SSL and complicated web pages. Although connecting to a computer running Lynx is certainly feasible, I was looking for something more lightweight. So, here is a sample of some of the applications:

Webbrowser

AT+WEB=<URL>

Above is a screen shot of Virtual ][ (an Apple II emulator) running DCOM 3.3 (a VT100 terminal emulator) connected the esp32 contiki webbrowser. This setup can be used to connect an Apple II to the internet.


And this is the same browser running in the Mac terminal. In the lower right, you can see the Mac has a terminal window that is connected to the ESP32 and showing a https secure web page. The HTML is parsed by the Contiki webbrowser, which I modified to use the ESP32 web client that includes SSL encryption. The ANSI/VT100 colors are added by my Contiki console i/o module that detects the VT terminal type.

PPPd

AT+PPPD

For computers with TCP/IP stacks, but no ethernet card, use the PPPD command, making a serial TCP/IP connection, so all your existing internet programs will work:

Telnet

AT+CIPSTART=<IP Address>

Of course, since it uses the standard ESP32 AT commands, you can do all the normal connections to telnet-based BBSs.

Some of the code is on my GitHub page, with more to come!

Tuesday, November 13, 2018

Using the Apple II as a 28C16 EEPROM Burner

This is a tutorial on how to use an Apple II with a Super Serial Card as a 28C16 EEPROM programmer. For the purposes of this tutorial, I will be giving instructions on programming a lowercase character ROM for the Apple II+ Rev 7. You can use an earlier Apple II for general EEPROM programming though. The simplest way to transfer the data from a binary file to the EEPROM without extra hardware is to use the Mac's headphone port connected to the Apple II Cassette input port, and that method is what I will demonstrate here. Alternatively, you could use a virtual disk, TCP/IP card, or another Super Serial Card to transfer the data to the Apple II.

Supplies:

  • Apple II+ Rev 7 (minimum to accept the finished lowercase character ROM)
  • Apple Super Serial Card (SSC)
  • Atmel 28C16 EEPROM
  • ROM binary file
  • Macintosh running OS X

Process:

Install c2t on your Mac
c2t will convert a binary file to the audio format that the Apple II can use. You can find instructions to install on the c2t GitHub page. However, due to an HTML redirect and a typo, some of the instructions did not work correctly for meThe instructions are now correct, and I had to use the Terminal commands:
sudo curl -L https://github.com/datajerk/c2t/raw/master/bin/c2t >/usr/local/bin/c2t
sudo chmod 755 /usr/local/bin/c2t
Get and convert the ROM binary file to audio format

Apple ROM files are fairly easy to find. Once the archive is downloaded to your Downloads folder, extract the files and convert to audio using the Terminal commands:

open ~/Downloads/APPLE+II+ROMS.zip
cd ~/Downloads/APPLE\ II\ ROMS/APPLE\ II+/
c2t -2 APPLE\ II+\ -\ LOWERCASE\ CHARACTER\ GENERATOR\ -\ 2716.bin,8000 ~/Downloads/LOWERCASE_ROM.aif

This creates an audio file in your Downloads folder named "LOWERCASE_ROM.aif", which can be used to transfer the ROM data to your Apple II. This audio file is available for download, if you want to skip installing c2t.
Modify the Super Serial Card

The Apple SSC manual documents how to modify the card to accept an SRAM chip, which is compatible with the pinout of a 28C16 EEPROM. I have a clone of the SSC which is slightly different and will allow me to easily enable and disable this function.

First, I removed the ROM (the lower big chip) so I didn't accidentally damage it. Then, I cut the traces that link the some of the vias in the center of the card, and removed the solder in the vias.

These vias correspond to the bow-ties and solder pads on the SSC card. I soldered in gold and silver double row header pins so I can easily see which pins should be jumped at the same time.

If you have an SSC, card just cut the bowties and solder across the jumper pads, according to the instructions in the manual. Note that you will have to undo this modification to use the original SSC ROM

With the pins soldered in, I can use jumpers to configure the card for the original ROM, for EEPROM, and to set the write enable separately for the EEPROM (black jumper cap).

Now, install the 28C16 EEPROM into the ROM location (double check the orientation of the EEPROM chip!) and insert the card into slot 2 of the Apple II.

Connect the Computers
Use a 3.5mm Male to Male Audio Aux Cable to connect the Mac headphone jack to the Apple II Cassette Input port. The cable can can be stereo or mono, although stereo is easier to find nowadays. Turn the Mac volume up to the maximum level.
Transfer and Write the ROM Data

It would be really simple if we could just transfer the audio data directly into the memory locations of the EEPROM. Unfortunately, I was unable to do this. I believe that the EEPROM needs more time to write than is given to it by the Apple II Monitor, so maybe the faster AT28C16E would work better for direct writing. I could only successfully write about 16 bytes at a time reading audio or copying directly to the AT28C16.

Instead, we will copy to the Apple II memory, then slowly POKE it into the EEPROM using AppleSoft BASIC. On the Apple II, assuming 64K of RAM:

] CALL -151
* 8000.87FFR

Play the LOWERCASE_ROM.aif file on your Mac. When it is loaded, you should hear a beep on the Apple II, and get another * prompt.

At this point, you could try directly copying to the EEPROM by:

* CFFF
* C200
* C800<8000.86FFM
* C200<8700.87FFM
But, I received errors when verifying:
* C200<8700.87FFV

So, if that doesn't work, let's load an AppleSoft BASIC program to get the data into the EEPROM. To load it, return to BASIC by hitting:

<CTRL><RESET>
Enter the BASIC command:
] LOAD
Then use the Mac to download and play the audio file for the ROM transfer BASIC program or, skip the LOAD command and enter it by hand:

5 REM ?"TRANSFER BIN FROM $8000 TO SSC CARD"
10 S = 2 : REM ?"SLOT 2, DO NOT USE 0, 1, 3" 
20 LM = 49152 + (S*256) : REM ?"SLOT IOSEL"
30 HM = 51200 : REM ?"$C800"
40 ST = 32768 : REM ?"$8000"
50 X=PEEK(53247) : REM ?"$CFFF"
60 X=PEEK(LM) : REM ?"ENABLE HM"
70 BL = 1792 : REM ?"IOSEL SIZE"
80 LM=LM-BL
100 FOR X= 0 TO 2047
110 V= PEEK(ST+X)
120 IF X < BL THEN EA = (HM+X) : GOTO 140
130 EA = (LM+X)
140 POKE EA,V
150 ? EA; ": ";V
160 NEXT X
170 ? "TRANSFERRED ";X;" BYTES" 
200 END
After the beeps, run the loaded BASIC program:
] RUN
This will slowly write the data you previously stored in the $8000 memory range to the I/O shared $C800.$CEFF range, and the slot 2 $C200.$C2FF range. The process should take less than 2 minutes (1 min 45 secs). You can edit the BASIC program to change slots if you need to, but don't use slot 1 on any Apple, or slot 3 on an Apple //e, as the IOSEL area we are using is not normally addressable in those slots.

Once the program runs, turn off the Apple II, remove the EEPROM and insert it into the "ROM_SPCL" location at the bottom of the logic board (double check the orientation of the EEPROM chip!). You will normally have to disassemble the computer case to reach down there.

Monday, November 5, 2018

64K 4164 DRAM Decoding Integration

I integrated the 4164 DRAM decoder wiring into the logic board this weekend. It was very difficult to troubleshoot, and on retrospect, I think an adapter board would have been easier and less problematic. The main hangup was that the A14 signal to pin 10 of the J1 socket is connected on both sides of the logic board. One side in from expansion slot 7, and the other side goes out to H1 socket which creates the (A14&A15) signal. I had routed the (A14&A15) back to the J1 socket to decode the upper 16K of RAM. After disconnecting the A14 line from pin 10 and re-connecting pin 10 to a new video decoder signal (HIRES&PAGE2), the video decoder signal was getting sent through to H1 to give (HIRES&PAGE2&A15), which is wrong and caused computer to not be able to access the ROM.

Anyway, I fixed the problems and 74ls153 now sits in the J1 socket like it was always supposed to be there. The signals to decode the upper 16K of memory in the 4164 DRAMs are now available. I need to build circuit with registers to set to enable the upper bank and bank switch the 4K that overlaps the I/O area of the Apple II+. It will basically be 1/2 of an Apple 16K RAM/Language card.

Tuesday, April 24, 2018

PPP server on ESP32

I spent some time working on my Wimos Lolin ESP32 this weekend. I recently wrote up a simple how-to about the ESP32 device on my other blog. Since I am pretty familiar with lwIP and PPP based on my work on the Macintosh 128k webserver, I also previously contributed a small amount of code to enable the PPP server in the lwip network stack that the ESP32 uses. But, without an interface to access the PPP server code, it was useless. So, I decided to integrate access to the PPP server into the ESP32's standard AT command interpreter. With a small amount of code, I think I have it working! My MacBook can connect to itself using PPP now. I need to get one of my classic macs set up to further test the connection. I should get code posted in the next few days.

Update!

Source and instructions are now on github!

Wednesday, April 18, 2018

Apple II "The Keyboard Company" Keyboard Repair

During my recent move, one of my Apple II+ computers didn't fare so well and broke 2 key posts. I really don't like the keyboard in this particular computer: it sticks, it often misses key strokes, and the feel is not very good. I didn't know how different the keyboard was until I took it apart and found... no Alps key switches! But, since Apple II+ keyboards are not cheap, I paid a few bucks for replacement key posts instead of replacing the keyboard. Process:

  1. Unscrew and remove the base plate of the computer
  2. Unscrew and remove keyboard
  3. Unscrew a bunch of tiny screws to remove the circuit board from the keyboard
  4. Push the broken post out the back
  5. Push in the new post
  6. Reassemble
  7. Continue hating how the keyboard feels

One repair completed!


Weird spring / contact matrix
I tried to repair the posts, and the one on the left worked OK, but I ended up replacing both of them.
6 and T are fixed!

Wednesday, April 11, 2018

Retro Loft Progress

One of my big RetroChallenge goals was to get my office organized after recently moving. However, I decided to just move everything to a storage loft in the house and add a workstation to get everything out of the way.

I spent last week working on a sketch of what it would look like and this past weekend doing some construction:

RetroLoft - Desk Area SketchUp
RetroLoft - SketchUp
RetroLoft  - Before
RetroLoft - Before
RetroLoft - In Progress
RetroLoft - During
RetroLoft - Desk Area

I installed a hand rail, moved the storage shelves over, installed a desk support, and more storage shelves. I used some old shelf standards I had on-hand and discovered that shelf standards are not 'standard'. The two sets had slots that were not quite aligned the same way. I still need to install the desk surface (an old interior slab door), then run a new power line, and set up some old computers. Its a little warm up there, but a large fan in the garage keeps the air moving now.

Monday, April 2, 2018

Parts!

Lots of parts have come in for RetroChallenge.

Tuesday, March 13, 2018

ElWhip is on GitHub

I uploaded my source code for ElWhip onto GitHub. Unfortunately, there are still some files that have Macintosh line endings, so some of the code can't really be viewed on GitHub unless you hit the "Raw" button. Hopefully it will inspire somebody to make a web browser for the original Macintosh. It will also make updates and additions to the code easier for me. Now that it is uploaded, it should make adding a log/status window quite a bit easier.

Tuesday, March 6, 2018

RetroChallenge 2018/04 entry!

It is that time of year again, again! RetroChallenge!

My objectives, by priority:

  1. Organize my office with old computers and identify stuff to eliminate.
    • Give away/sell computers that don't fit with my retrocomputing goals.
    • Set up an imaging machine and get all of my 800K and 1.4M disks transferred to images on Zip Disks
    • Sort through 400K disks
  2. Repair some damaged Apple II+ parts.
  3. Get ElWhip source code uploaded to GitHub.
  4. Test out an ESP32 (new version of ESP8266) as an internet modem / PPP server for old Macintoshes.
  5. Test out an ESP32 as virtual serial port for Apple II.
  6. Add SmartPort compatibility into a2usbdsk.

Thursday, January 11, 2018

a2usbdsk mostly working on Raspberry Pi!

After much experimenting, I figured out that an unusually low usb timeout setting was causing usb transfers to stall on the Raspberry Pi. After I raised that, I was able to easily load disk images! Unfortunately, Karateka does not work. During the boot sequence, Karateka does a very quick jump from track 7 to about track 27. It is cycling the Disk ][ phase lines very quickly to make this happen. Unfortunately, I don't think the Raspberry Pi Zero is currently able to sample the USB data fast enough to keep up. As a result, it is only jumping to track 15 or so. I was having a similar problem in earlier versions of a2usbdsk. I tried some tricks to speed things up, to no avail. But, good news is:


MOONPATROL!

So, as a proof of concept this is looking good. I should be able to move on to step 2 and get this running on the Raspberry Pi's native SPI port.

Tuesday, January 9, 2018

a2usbdsk not working on Raspberry Pi yet

Although my Apple IIe Platinum was not working correctly, I remembered that the color pattern I was seeing was actually a self-test mode that the Enhanced Apple IIe goes into without a keyboard connected. My keyboard was connected, but was also shattered and seriously damaged. Fortunately, another Apple IIe keyboard saved the day.

Unfortunately, a2usbdsk on the Raspberry Pi is not able to send data fast enough for the Apple IIe to read... yet. I have some code optimizations I need to test out which I think may help the situation. That said, even my old MacBook air was barely able to keep up. My newer 1.8 GHz dual-core Intel Core i5 MacBook Air seems to have no problem. I'll keep trying this weekend.

Update!

The Raspberry Pi is able to keep up! The problem is that the FT232H is stalling very often. I had this problem early on in the development of a2usbdsk on Mac OS X, but I worked around it by writing most of my own read/write loops and avoiding libmpsse for the most part. There must be some difference in how libusb or libftdi is handling the packets on the two operating systems. By frequently purging the buffers, I was able to get a disk to load! Need to find a better solution though. More testing should narrow down the problem.

Thursday, January 4, 2018

a2usbdsk ported to Raspberry Pi

I was able to port a2usbdsk to the Raspberry Pi quite easily due to it being based on libusb and libftdi. Really, I just had to set up a makefile. I had some issues getting it to open the FT232H though. libmpsse does not return any errors when attempting to open an FTDI device. This makes troubleshooting very difficult and frustrating. After adding some logging, I determined that the libftdi function ftdi_usb_open_desc_index() was returning error code -8, "get product description failed". Getting the product description is a pretty simple function and that error was not appearing on Mac OS X, so it left me baffled for a while. In the end, the issue was that Raspberry Pi/Linux strictly controls who can access USB devices. "sudo" got it running, but setting up a udev rule seems to be a better solution.

I have not tested this with a real Apple II yet, as my Platinum Apple //e was pretty much destroyed in a recent car accident due to air bag deployment. The case is shattered, but it may still work. I'll try this weekend.

Monday, January 1, 2018

Raspberry Pi A2-SPI-DSK

I received my first Raspberry Pi in the mail today. It is a Raspberry Pi Zero W. I am excited to really try it out. I have it running, but I need to get a USB keyboard and mouse hooked up to get everything installed.

The Raspberry Pi is pretty neat hardware that bridges the gap between a micro controller and a full desktop computer. I have done some micro controller development, but never got really engaged with it. Development on the Raspberry Pi looks a little more my speed. At $10 for the Raspberry Pi Zero W, it is significantly more powerful and cheaper than the Mega AVR Arduinos and the necessary add-on cards. Most of the cool stuff is already built in to the Pi!

So, my hope was to port a2usbdsk to Raspberry Pi, so that people never have to use 5.25" disks again. I love the nostalgia, but they are cumbersome to use and ADTpro transfers to and from the Apple II are fairly slow. Don't get me wrong, ADTpro is a wonderful piece of software that I have used and quite a bit myself. But if you don't want to actually use disks to use disk images on your Apple II, it seems like the wrong solution, and a piece that is missing in (and could easily supplement) other packages like Ivan Drucker's RASPPLE II.

To pull this off, I am going to attempt it in 2 steps:

  1. Port a2usbdsk to Raspberry Pi to run the FT232H adapter;
  2. Create a new program a2spidsk to run on the native SPI ports on the Raspberry Pi.

I am very concerned that the Raspberry Pi may not be able to analyze the incoming data fast enough from the USB adapter. There is quite a bit of latency between transmissions to the disk drive that I was barely able to overcome on my MacBook. This puts a long gap between sectors which the Apple II is pretty good about ignoring, but it will eventually give an I/O error.

I am also concerned that the SPI buffer for the bcm2708 in the Raspberry Pi is quite small (12-120 bytes) which could make it difficult to output the bytes fast enough and with the regularity needed by the Disk ][ interface card. Since the Disk ][ interface card doesn't really understand SPI, we need very regular SPI clock transitions and data to keep synced up with the card in order to match up the synchronous SPI bus to the asynchronous Disk ][ interface card connection.