Dog Cow
Well-known member
A few years ago I wrote a TCP/IP stack called Marina for Apple II.
I've spent the past two days looking into how to get TCP/IP on the original Mac 128K and 512K in a way that makes it accessible the greatest number of people, but also affords opportunities for application development: telnet, FTP, etc...
Hardware
The biggest problem to overcome seems to be link-layer connectivity. The historic route was to wrap IP datagrams within AppleTalk DDP packets, and route them to a DDP-> IP gateway such as Seagate, Kinetics FastPath, or Cayman Gatorbox (to name just a few routers of the day).
Classic AppleTalk DDP has an MTU of just under 600 bytes, which is about 1/3 of Ethernet's standard MTU, so we're limited on throughput...
But moreover, requiring AppleTalk now introduces additional requirements for hardware or routers. And AppleTalk itself is obsolete.
Trying to build a RS422-to-Ethernet adapter for the serial ports is one option, but again that's a hardware solution that will limit accessibility of the TCP/IP stack.
The solution then falls to using the serial ports as serial ports, and connect using SLIP or PPP. I didn't know anything about PPP until recently, and it seems to be the way to go. I installed MacPPP on my Mac SE/30 and analyzed the packets to see how the encapsulation works. I think a PPP implementation over 57600 baud serial will be accessible to the greatest number of people. That would allow for about 5 kilobytes per second throughput, about 4 times slower than LocalTalk.
There are still plenty of PPP daemons, and you can still readily get USB to serial adapters if your PPP server doesn't have RS232.
Software
Once the hardware connectivity is decided on, the next step is to write the software drivers. There is ElWhip written in C, but I think we need to write TCP in assembly to get the smallest possible code. There is already a TCP for Mac 128K and 512K, written in 1984-85, but it is written in Lisa Pascal (making it difficult to maintain) and uses AppleTalk. Thus it requires a DDP to IP gateway.
If we're not using AppleTalk DDP, that means we need to interface to the Serial Driver directly. I estimate a basic PPP implementation could be written in about 2K of assembly.
I looked at some other existing TCP/IP stacks: MacTCP and TopsTCP. The average size seems to be around 31K of code. MacTCP is designed as a RAM-based driver that is accessed using _Control calls from the application.
Let's say we write a really bare-bones, crunched TCP stack and it comes out to be 25K of code, plus the 2K for PPP.
If we're targeting a Mac 128K, that leaves about 128K - 38K - 27K = 63 Kilobytes. We also need room for buffers. Let's figure 8K for buffers. Now we're down to 55K for an application.
What can we do in 55K? Probably not a web browser. But we could probably do a small but respectable telnet. FTP would be more than possible. You could write a really simple Usenet newsreader. On a Mac 512K you could definitely do a text-mode, lynx style web browser.
Motivation
So after this back of the envelope math, it looks like a TCP/IP with a small suite of practical applications is possible for the Mac 128K. And we already know this to be true, because Mark Sherman wrote a TCP for the Mac 128K in Lisa Pascal in 1984 with working Telnet and TFTP. So targeting a Mac 512K should be no sweat.
The last factor is motivation, or the actual applications. A web server isn't going to cut it. That gets boring after the first day or two. It's a lot of effort, but I could write a TCP for Mac 128K and 512K, and an application or two to go with it, but I don't want to do it if almost no one is using it.
Any thoughts or ideas?
I've spent the past two days looking into how to get TCP/IP on the original Mac 128K and 512K in a way that makes it accessible the greatest number of people, but also affords opportunities for application development: telnet, FTP, etc...
Hardware
The biggest problem to overcome seems to be link-layer connectivity. The historic route was to wrap IP datagrams within AppleTalk DDP packets, and route them to a DDP-> IP gateway such as Seagate, Kinetics FastPath, or Cayman Gatorbox (to name just a few routers of the day).
Classic AppleTalk DDP has an MTU of just under 600 bytes, which is about 1/3 of Ethernet's standard MTU, so we're limited on throughput...
But moreover, requiring AppleTalk now introduces additional requirements for hardware or routers. And AppleTalk itself is obsolete.
Trying to build a RS422-to-Ethernet adapter for the serial ports is one option, but again that's a hardware solution that will limit accessibility of the TCP/IP stack.
The solution then falls to using the serial ports as serial ports, and connect using SLIP or PPP. I didn't know anything about PPP until recently, and it seems to be the way to go. I installed MacPPP on my Mac SE/30 and analyzed the packets to see how the encapsulation works. I think a PPP implementation over 57600 baud serial will be accessible to the greatest number of people. That would allow for about 5 kilobytes per second throughput, about 4 times slower than LocalTalk.
There are still plenty of PPP daemons, and you can still readily get USB to serial adapters if your PPP server doesn't have RS232.
Software
Once the hardware connectivity is decided on, the next step is to write the software drivers. There is ElWhip written in C, but I think we need to write TCP in assembly to get the smallest possible code. There is already a TCP for Mac 128K and 512K, written in 1984-85, but it is written in Lisa Pascal (making it difficult to maintain) and uses AppleTalk. Thus it requires a DDP to IP gateway.
If we're not using AppleTalk DDP, that means we need to interface to the Serial Driver directly. I estimate a basic PPP implementation could be written in about 2K of assembly.
I looked at some other existing TCP/IP stacks: MacTCP and TopsTCP. The average size seems to be around 31K of code. MacTCP is designed as a RAM-based driver that is accessed using _Control calls from the application.
Let's say we write a really bare-bones, crunched TCP stack and it comes out to be 25K of code, plus the 2K for PPP.
If we're targeting a Mac 128K, that leaves about 128K - 38K - 27K = 63 Kilobytes. We also need room for buffers. Let's figure 8K for buffers. Now we're down to 55K for an application.
What can we do in 55K? Probably not a web browser. But we could probably do a small but respectable telnet. FTP would be more than possible. You could write a really simple Usenet newsreader. On a Mac 512K you could definitely do a text-mode, lynx style web browser.
Motivation
So after this back of the envelope math, it looks like a TCP/IP with a small suite of practical applications is possible for the Mac 128K. And we already know this to be true, because Mark Sherman wrote a TCP for the Mac 128K in Lisa Pascal in 1984 with working Telnet and TFTP. So targeting a Mac 512K should be no sweat.
The last factor is motivation, or the actual applications. A web server isn't going to cut it. That gets boring after the first day or two. It's a lot of effort, but I could write a TCP for Mac 128K and 512K, and an application or two to go with it, but I don't want to do it if almost no one is using it.
Any thoughts or ideas?