Friday, January 9, 2015

Debugging the Debugging

I have been working on a way to get the proper debug logs out of ElWhip without using the modal dialog boxes which cause the program to stall until a user presses the 'OK' button. I have decided to just dump the logging output through the printer port, since I already have serial port code for ppp and the modem port. Unfortunately, that means I would need another serial connection between the Macintoshes. But, feeling inspired by another Retrochallenge project, I set up a bluetooth rs232 adapter for a wireless connection. I initially had a problem where bringing up the serial connection to the printer port would bring down the connection to the modem port, but I worked through a couple of bugs to get it working.

This should make it much easier to troubleshoot some of the intermittent problems I have had establishing the ppp connection and retrieving the web page.

 Wireless Logging with Bolutek RS232 - Bluetooth Adapter 

Monday, January 5, 2015

Virtual Distractions

I had a major distraction last night that kept me up way too late. One of the major limitations of the Classic Macintosh emulator Mini vMac is the lack of serial port realization (is that the right word?). There is a hack at spritesmods.com that includes a virtual tty connection from Mini vMac. The code is for an older version of Mini vMac and has a few bugs that prevent it from working on Mac OS X. This would be a perfect testing platform for ElWhip, if I could get the serial ports working. A lot of troubleshooting got me to here:

Mac Terminal in Mini vMac with tty to host computer

Unfortunately, it won't drain the incoming data until I press a key, so it is often displaying the input a little bit behind the output (eg: you have to start typing the username before the prompt appears). I think it needs a polled function to check for available data. I don't think it will work with ppp as-is. Hopefully, I can figure it out tonight.

Update: That was easy, I re-implemented an unused SCC_Update() function in the main run loop and it works great! Now to test ElWhip on it!

Update: Mind blown:

Elwhip running in Mini vMac with ppp connection to host
No web page though. Going to bed before I create some sort of causality loop. On that note, weirdest thing about Mini vMac: its build environment is a Mac 68k application that runs within Mini vMac.

Sunday, January 4, 2015

Uptime On Old Time Macs

Too many chores to do today, so I just let the web server run on the Macintosh SE, checking to see how stable it is. Running ping -i 60 192.168.11.130 | cat -n from the Mac OS X terminal pings every minute and lets me know how many minutes the TCP/IP stack stays up. It started losing pings around 65 minutes and eventually timed out altogether. This seemed to correspond with the After Dark screensaver on the Mac SE. I turned off the screen saver (and turned down the brightness knob), and the server ran for 174 minutes before I turned it off. There were with no dropped pings and it was still serving the web page when I stopped it.

After that, I ran the web server on the original Macintosh (still with 512K RAM), and had similar success. As far as I know, this is the first Macintosh web server with 64K ROMs or 512K RAM, ever! Certainly the first on System 2.0 and Finder 1.1g.

Saturday, January 3, 2015

Web Serving! - barely

I can serve a web page from the Macintosh SE! There was a problem where lwIP does not seem to be detecting the first CRLF (Character Return + Line Feed) required by the HTTP spec. So, when I used Telnet, I had to hit return 3 times before the HTML appeared. Web browsers will only send 2 CRLFs, then wait. I ended up deleting one of the checks for a CRLF from the code, and it worked! However, that doesn't explain why it isn't detecting the first CRLF. I think it could losing the last character of the buffer (LF) or something.

The process of dealing with this made me realize I can't keep overlooking a few problems I have seen:

  • Getting PPP to connect is too timing-sensitive and flakey
  • I can't always get the web browser to connect
  • PPP is a memory hog
  • I need to actually fix all of the "FIX ME"s I have been inserting into the code
  • I need a better logging / debugging system
Some of these problems are related. I need a good debugging system system before I can fix any of them. Enabling debugging currently causes a bunch of modal dialog boxes to appear. This causes further timing problems and does not allow logging for analysis.

Once I get some of these issues sorted out, I will test it out in 128K and make a download available.

Friday, January 2, 2015

HAKKO, how have I lived without you?!

Repaired Solder Joints
MacMemory Address Decoder Board

My Hakko Soldering station arrived today, and although I had intended on waiting until this weekend to do more RetroChallenge labor, new tools make it hard to wait. Anyway, this thing is amazing. It melted the solder joints so fast, I couldn't believe it. I am used to using dollar store soldering pens - NEVER AGAIN!

My Mac liked it too! Video came back on boot.

In other news, I took a close look at the RAM expansion circuit that was added to my Macintosh to address the additional RAM. I think I can just connect riser Pin 1 and 2 to make it a 128K Macintosh again for testing.

Edit: Actually, I will remove the 47 Ohm resistor too, just in case.

Thursday, January 1, 2015

Macintosh Webserver Recap and Restart

lwIP is a lightweight TCP/IP stack that was designed for embedded systems with, or without an Operating System. During RetroChallenge 2014WW, I was able to get MPW 3.5 compiling programs for old Macintosh System versions, port lwIP, and get a TCP/IP stack running on my Macintosh with 512K RAM. For RetroChallenge 2014SC, I was able to update my working version of lwIP and compile the webserver before life interfered.


I woke up this morning without much of a hangover, allowing for an early start on the challenge.

I updated my local copy of the lwIP source which has now incorporated the ppp-new branch into the main branch. It is nice to see continued development on lwIP. This updated ppp code was important because it allowed for ppp without multithreading, which is necessary for the early versions of Macintosh OS. With git installed, two quick commands did the trick: /usr/local/bin/git clone git://git.savannah.nongnu.org/lwip/lwip-contrib.git /usr/local/bin/git clone git://git.sv.gnu.org/lwip.git

After copying over my additions, and converting the end of line characters to be Mac friendly, I was able to compile it with MPW again.

I fixed the error about the fsdata source file not needed for link. As it turns out, that file is included through one of the header files, and does not need to be compiled separately as a source file.

Finally, I transferred the program to my Macintosh SE for testing (thanks ZIP drive). The PPP and TCP/IP connections come up fairly reliably, but, I couldn't connect to the webpage using Safari.

I Telnetted to port 80:
PowerMac-G4:/Volumes/Mac OS 9/Maclwip151 epooch$ telnet 192.168.11.130 80 Trying 192.168.11.130... Connected to 192.168.11.130. Escape character is '^]'. GET / HTTP/1.0 404 File not found Server: lwIP/1.3.1 (http://savannah.nongnu.org/projects/lwip) Content-type: text/html <html> <head><title>lwIP - A Lightweight TCP/IP Stack</title></head> [...]
And it seems to have worked! I will have to keep testing this evening and look through the code a bit to see why it is not loading with Safari (or FireFox).

I am already further along than RetroChallenge 2014SC!

Saturday, December 27, 2014

Pre RetroChallenge Spending Spree

Macintosh Floppy Emu
Hakko FX888D
Original AirPort Card
To satiate my excitement for the upcoming RetroChallenge, I have resorted to buying stuff for my computers. The idea of my 400k floppy disk drive grinding away every time the web server had a hit concerned me, so I reserved a Macintosh Floppy Emu floppy and hard disk drive emulator for vintage Macs. A new batch is expected mid January.

While browsing around that website, I noticed a review for a Bus Pirate interface. I remember seeing these on hackaday a while ago, but I didn't realize you could buy them on ebay now. So, I got one.

Since I need to do some soldering on the original Macintosh, I decided that the dollar store soldering iron wasn't good enough, so I splurged on a Hakko FX888D-23BY Digital Soldering Station.

I bought a $3 Airport card for my G4, just for the heck of it.

Because my Inside Macintosh book made for some interesting reading, I bought the Apple publication Designing Cards and Drivers for the Macintosh Family.

RetroChallenge, please come quickly before I spend all of my Christmas money!

Sunday, December 21, 2014

Retro Prep Problems

Macintosh analog board connection cable
The analog board connection cable.



Macintosh analog board connector solder joint
The top and bottom large solder joints are suspect.
I had some free time this weekend to make sure all the retro Macs were working before the start of Retrochallenge 2015/01. The G4 booted up as expected (I use it semi-regularly). The SE booted up as expected (it has proven very reliable). The original Macintosh booted up, but there was no video. I could tell it was limited to a video problem because clicking the mouse around would cause some disk activity.

I opened the computer up to investigate, but I didn't see anything obvious. I started it up while open (DANGER!) and noticed that slight pressure on the analog board connection cable would cause the video to come back temporarily.

I looked closer and noticed a questionable solder joint which seems to correspond to video out, according to this Macintosh Schematic (J7, pin 1, VIDOUT).

I'm not sure I will have time to fix it before January, but it looks like it might be an easy fix.

Tuesday, December 16, 2014

RetroChallenge preparation

I recovered from the hard drive crash pretty well. I was able to make a disk image of the slowly dying drive, which I restored onto a newer drive. Fortunately, it retained all of my licensing information for the Adobe Creative Suite I have installed. I don't think the Adobe CS2 registration servers work anymore, so that would have been a real pain.

The Dual processor PowerMac G4 with Mac OS X Tiger is a real joy to work on, even though it is now 15 years old. The user interface is far more appealing than OS X Yosemite, and compiling programs proved quite snappy. The Mac OS 9 compatibility mode is nearly flawless. Plus, parts are dirt cheap for the old G3 and G4 towers.

On that note, I just received a new (to me) Belkin F5U220 USB 2.0 card to replace the old USB 1.0 card which temporarily replaced the OrangeMicro USB Firewire card that would crash on wake with the G4. It works great, and only $10.

No more excuses to not backup my drives!

Monday, December 15, 2014

Early Christmas gift: Fire in the Valley

Early christmas gift from a thrift-shopper friend. First edition!

Monday, December 8, 2014

Hard Drive crash!

I have already had a major setback for the RetroChallenge. While getting things organized, my hard drive started clicking and slowing down. Unfortunately, I backed up the wrong drive. By the time I figured out which drive was making the noise, it was too late to backup.
I ended up putting it in the freezer for a while and had a few error free minutes to get the most important stuff off. After tightening up the screws on the top and sending it in and out of the freezer, it seems to have shaped up considerably though, but it is running very slowly. I am now backing up the entire disk which, by the progress indicator, will take several days. So, at least there is some hope.

Tuesday, December 2, 2014

Retrochallenge 2015/01 Entry

Retrochallenge is back!
I seem to be able to get more done during the Winter Warm up than the Summer Challenge, so I am feeling ambitious. I still want to get a web server working on my Mac 128K, so that is my primary goal.  I have renewed my interest in working on my 1991 Nissan, and interfacing with the ECU using the Nissan CONSULT protocol.  It is a JECS microprocessor which is either a Motorola 6802 or Hitachi 6303 equivalent. It isn't the typical retro computer, but it seems to qualify.

Thursday, July 31, 2014

Slow End

Between work, vacation, having my car stolen, recovering it myself (long story) and working on my new (to me) car, I haven't done anything on my RetroChallenge entry. Total retro Macintosh failure.

I did spend some time working on the car I bought, specifically the computer and sensor system. It is 1990 Infiniti Q45, so its computer system technically qualifies as retro, I guess. The previous owner had put a piece of black tape over the diagnostic information display to hide the "STOP LAMP INOPERATIVE" error. Unfortunately, that was one of the most minor abuses that he put this car through. Anyway, a few minutes of soldering on the stop lamp sensor to fix some damaged solder joints, and I was greeted with "OK"!

It actually took less time to fix the sensor than to open up the dash and get the black tape off!




So that's it. I compiled the new lwip code, made an application, but never tested it, and made my old car computer say "OK".

Sunday, July 6, 2014

Slow Start

Between 4th of July, World Cup, and the British Grand Prix, I haven't spent much time on my RetroChallenge project. I spent way more time reading about other people's projects than working on my own! I did manage to compile the latest lwip sources and the lwip httpserver into an application, but I haven't tested it yet. The MPW build option to use unix #include paths worked perfectly.  I wish I had know about it last time around, as it would have saved me some time.
SetDirectory "{MPW}Maclwip2:lwip-contrib-ppp-new:ports:mac:"; BuildProgram ElWhip # 2:50:02 PM ----- Build of ElWhip. # 2:50:02 PM ----- Analyzing dependencies. # 2:50:02 PM ----- Executing build commands.   SC [...]   Link -o ElWhip [...] ## Link: Warning: File was not needed for link: (Error 52) :::apps:httpserver_raw:fsdata.c.t.o   Rez -rd -o ElWhip ElWhip.r -append   DeRez "Mac OS 9:MPW:Libraries:Libraries:SERD" -only SERD   Rez -o ElWhip -append # 2:51:51 PM ----- Done. ElWhip The warning about the file not needed for link is troubling because that is where the html for the web server is stored. I will test it all out tonight.

Monday, June 30, 2014

Making an lwip web server

Looks pretty easy:
http://lwip.wikia.com/wiki/Sample_Web_Server
although the nonstandard file system seems weird.

Both the lwip core and the ppp-new branch have been updated since January, so I will try to update them first. Also, I will try to use the MPW compiler flag for using Unix paths.  I had no idea this existed when I ported the code in January. Hopefully, this will make my implementation standard enough to include in the lwip contributions branch.

Also, I did some research on how I can test the web server with 128K of memory (rather than the 512K my computer was upgraded to).  It looks like I can just solder a jumper to disable one of the RAM address lines, making it 128K.

Thursday, June 26, 2014

Spending Spree, part 3

Since I was never able to get the ethernet card working on my Mac SE during the last Retrochallenge, I decided I need a better way to transfer files than a serial terminal and ZModem. So, I bought an internal Zip drive on ebay. Adding it to the G4 was cheap and easy.  I am still using an old SCSI Zip drive to boot my Mac SE and my Mac SE/30. These drives are great, and I have never had any data corruption, even after long periods of storage.

Saturday, June 21, 2014

Spending Spree, part 2

Earlier this year, I took a chance on buying one of these poorly documented Chinese BOLUTEK RS232 / Bluetooth modules. I followed these instructions, and to my surprise, it worked great for a basic wireless serial terminal between my G4 (with USB Bluetooth adapter) and Mac SE. Hopefully, I can use it to establish a wireless PPP link to my Macintosh 128k. First, I need to re-solder my broken RS422 to RS232 adapter, though. Wireless internet, here I come!

Oh, and the Fanny Mac arrived already. It fits and works great!

Wednesday, June 18, 2014

Spending Spree

Just bought a fan on eBay for the Mac. I figured that if I will be leaving it on for 24 hrs a day for a month, this is a necessary purchase. The fans for these Macs are expensive on eBay, especially the "Kensington System Saver". Fortunately, I found this "Fanny Mac" on sale.

Tuesday, June 17, 2014

RetroChallenge 2014SC Intro

I won't have all of July to work on the RC 2014 SC, so I will try to keep it manageable. Building off of my RetroChallenge 2014 Winter Warmup Project, I will compile a web server for the original Macintosh 128K. I may need a few hardware upgrades (like a fan) to keep this going. In the unlikely event I have some extra time, I will get soldering on my Standalone Apple IIe Disk Emulator.

Tuesday, February 18, 2014

Hello 1985!

ebay order just arrived:
Inside Macintosh Vols I, III, III
Inside Macintosh Vols I, II, III. $75 new, $4 used!

Saturday, February 1, 2014

RC2014WW Wrap-up

ElWhip on 512K Macintosh running System 2.0 and Finder 1.1g
ElWhip on 512K Macintosh running System 2.0 and Finder 1.1g
ElWhip application and basic instructions are available for download!  Unfortunately, I didn't have enough time to add any really useful functionality.  A web server would be relatively easy to add and would give the application some real purpose.  All it does is respond to pings and run a telnet echo server.  Also, I'm not totally sure it will run on a real Macintosh 128K, since I found out that I don't have one.  I included a really stripped-down version that will probably run in less than 96K of available memory.
This was a fun exercise, and it is my very first classic Macintosh application.  If anyone gets it running or needs some tips, leave a comment!
I will try to take some time tomorrow to get a final video posted.  Until then, take some time  to check out the other RetroChallenge entries.

Friday, January 31, 2014

Last Minute Changes

My menu and window drawing problems turned out to be a bug that was only revealing itself on the virtual Mini vMac Macintosh 128k. I'm not sure what it was, but it disappeared when I spent some time cleaning up the Mac specific code last night. So, the menus and dialogs all work. I need to do some final testing tonight and I will get a download available!

Monday, January 27, 2014

Fighting with MPW

ElWhip application with empty menus on 64K ROMs
I spent Saturday trying to get lwip to load on a virtual 128K with 64K ROMs. I think I managed it by building a program with no user interface or feedback at all. I can't test it though because Mini vMac doesn't link to a real serial port or tty. Anyway, with a limited user interface on the 128K, I can run PPP and ICMP (eg: ping), but not TCP. I set it up so it will load as much as it can, then provide an error if it cant load the next module/protocol (rather than a hard crash).
I spent the rest of the weekend trying to get a simple interface programmed for the application. Unfortunately, MPW versions 3.0 to 3.5 do not seem to be able to generate menubar or window resources that a Macintosh with 68K ROMs can use. The menus are there, but they just show up as white blocks (see screen shot above). I don't think I can figure out a solution in time, but at least command-q actually quits the application now. Good enough.
Mini vMac has been great for testing just to make sure the program basically works. I will spend the last few days testing on my real Macs and getting a download together with all of the required licensing info for PPP and lwip.

Saturday, January 25, 2014

Happy Birthday Macintosh!

30 years old and still no TCP/IP. I think I am getting close, but there is a lot of code to trace through to make sure I segment everything properly and load everything in the right order to keep the memory footprint low, and avoid segmentation of the memory. I have reserved a few hours this weekend to work on this, so hopefully I will make some progress.

Monday, January 20, 2014

Too Big!

Sorry, a system error occurred. (Restart) (-Resume-)

Uh, oh. I wanted to make sure my lwIP application would work on a real 128K Macintosh (I discovered mine was upgraded to 512K), and none of my old Macs have just 128K RAM. So, I recompiled Mini vMac to be a 128K Macintosh, rather than the default Macintosh Plus. After it starts PPP, it gives a system error ID=15. This is a segment loader error, which probably means it is out of RAM trying to load the lwIP core.
In better news, I eliminated most of the debug messages so I don't have to hit the enter key so many times to dismiss the debug dialog boxes.

Saturday, January 18, 2014

Success and Video Update



Got it! Hitting the enter key rather than clicking the mouse on the dialog boxes makes the connection. That's either a timing or mouse port serial interrupt issue. Oddly, the return key doesn't do anything. I have TCP/IP networking on my original (modified) Macintosh! I think the memory use is low enough, it should work on a real 128K Macintosh. Is it pronounced "El whip" or "l.w. I.P."? I like the Mexican flair of El Whip! (Actually, it's pronounced "lightweight IP" - boring…)

Old System Success, and Old Hardware Fail

Macintosh -192 error: resource not found
My lwip application seems to run fine on System 2.0 and Finder 1.1g on the Macintosh SE. That's great because that is probably about the maximum system version that the Mac 128K can run. Unfortunately, the Mac 128K gives the above error when opening the serial port.

Wednesday, January 15, 2014

Pre-System 7 software from MPW 3.5

lwip PPP IP address dialog in Macintosh System 6.0.8
lwip PPP IP address in System 6.0.8
I spent way too long the last couple of nights trying to get MPW to build an application that could be run on pre-System 7 (even System 6.0.8). I tried using MPW 3.1 (System 6 only) and MPW 3.5 (System 7.1 - Mac OS 9) in different ways to get it to work. Here were all of my attempts and results:

Monday, January 13, 2014

Detour - RetroChallenge 2014SC ?

I saw this Apple II prototyping card on ebay tonight and HAD to buy two. These haven't been available for a while. I resorted to buying an IBM XT prototype card in the past which is bigger but has the same trace spacing on the slot connector. I have never gotten around to actually making an Apple II card though. This looks perfect for some future project.

Sunday, January 12, 2014

MakeFile Overhaul

Tonight, I investigated how to fix the issue of the Main code segment being too large for a normal build/link without using --model far which may be causing compatibility problems. There is a #pragma segment segname directive that I thought could work to break up the segments. However, every function needs a directive before it to put it in a segment! That would require way too many code edits. After some research, I found out that MPW's compiler will also take a -seg segname option to assign the object code to the specified segment name. This is the way to specify a segment for an entire source file.
After reading a bit of Building and Managing Programs in MPW, I realized my Makefile is not using any of the complex features available in MPW. So, I incorporated some path constants and Directory Based Dependency Rules, and eliminated a lot of the hard-coded paths and dependencies in my make file.
I figured out that the key to using Directory Based Dependency Rules and code segments in the Makefile is to add a modified extension to the list of object files you want to put in a separate code segment. Then, add a new default build rule for that extension. Code segments are way easy now! I can now remove the --model far option which seems like it might be incompatible with older Macintosh System versions. The main segment with the PPP interface comes in about 31K and the rest of lwip is just 28K, each fitting nicely in a code segment.
Here is an example section of an MPW Makefile (new extension in yellow and segment name option in blue): ObjFiles-68K = "{SrcDir}ip_frag.c.o" ∂ "{NetISrc}etharp.c.n.o" ### Default Rules ### {NetISrc} ƒ {NetISrc} {PPPISrc} {SrcDir} ƒ {CoreSrc} {IPV4Src} {APISrc} .c.o ƒ .c {•MondoBuild•} {C} {depDir}{default}.c -o {targDir}{default}.c.o {COptions} .c.n.o ƒ .c {•MondoBuild•} {C} {depDir}{default}.c -o {targDir}{default}.c.n.o {COptions} -seg NetIf

Wednesday, January 8, 2014

Motorola 68000 uses 32 bit addressing. Don't forget it!

Fixed the not enough space for new header size error.
For some reason, I thought the 68K processor was 16-bit, so I told lwip a pointer uses 16 bits in the cc.h header file. (It has a 16 bit data bus, 24-bit external address bus, but is 32 bits internally.) Now, you would think I would have figured this out after using 32-bit addressing to get past the previous link error. Or, maybe I would have looked at the lwip cc.h for the coldfire processor, which is a 68K at heart. Or, maybe I would have read the Apple SC/SCpp Reference more thoroughly the first time around. Anyway, MPW for 68K uses 32 bit pointers.
Quick fix to the code:
typedef u32_t mem_ptr_t;
And... no assertion errors at run-time! It still isn't completing the PPP negotiation, but it is trying so hard: PowerMac-G4 pppd[777] <notice>: pppd 2.4.2 (Apple version 233-0-8) started by epooch, uid 0 PowerMac-G4 pppd[777] <notice>: Connect: ppp0 <--> /dev/cu.usbserial PowerMac-G4 pppd[777] <error>: Received bad configure-ack: 02 06 00 00 00 00 05 06 bf 68 ca 18 07 02 08 02 PowerMac-G4 pppd[777] <warning>: IPCP: timeout sending Config-Requests; PowerMac-G4 pppd[777] <warning>: acscp: timeout sending Config-Requests; PowerMac-G4 pppd[777] <notice>: Connection terminated.

Saturday, January 4, 2014

Killing Bugs

MacPaint on Macintosh System 2.0
ZTerm on System 7.1

Click "Read more" for details...

Friday, January 3, 2014

Link Error with PPP

I realize that posts about porting code must horribly boring to read. However, the boring details will hopefully help someone who attempts some similar feat of folly. As a result, I will try to post a picture or two of a Macintosh or Mac GUI element that summarizes my progress. The details of which can be read by clicking the "Read more >>" link at the bottom of the post. First installment:
Before:
16-bit addressing can only reach 32K of code.

After:
32-bit addressing can access many more K of code!

Thursday, January 2, 2014

Sibling Rivalry

Macintosh SE harassing sad Macintosh 128k for lack of internet connectivity…

Wednesday, January 1, 2014

Importing and Porting

The ppp-new branch of lwip is available for download here: lwip-ppp-new.tar.gz . Of course, I couldn't find the zip download at first, so I had to download git, compile and install it, then check-out the ppp-new branch of lwip. Oh well, now I have git installed.

In 2006, according to my old makefile, I tried to port lwip to the Mac OS, but I had no luck. I did a lot of hand editing of source code files to convert them to Mac paths and line-feeds. So this time, I took a few hours to write a short MPW Script to fix the line-feeds and paths of all of the source files at once.

I just realized the MPW compiler has an option -includes unix which solves the path issue. Oh well, at least I don't have to worry about the line-feeds.

So the lwip code is Macified, I just need to set up the architecture specific options and write a program to use it. I have a feeling I will have a lot more "Oh well"s in my future.

Tuesday, December 31, 2013

Setting Up the Work Environment

I couldn't wait any longer! I dusted off my Macs and booted them all up to make sure I wouldn't spend the whole month fixing hardware. They all work!

Mac G4, 128K, SE

Hardware

Basically, I will be using a PowerMac G4 to do the software development and the Macintosh SE for initial testing. I decided to do testing on the Mac SE for a few reasons:

  • faster serial ports for data transfer;
  • ethernet card installed (broken?);
  • MacTCP and FreePPP installed for comparison testing;
  • SCSI port and a harddrive;
  • more robust System software (System 7.1);
  • same Motorola 68k processor as the 128K.
This should make testing much less painful. If I get anything working on the SE, I can give it a try on the Mac 128K. I have an external SCSI zip drive that seems to work well as an external harddrive (and lots of zip disks!).

Sunday, December 29, 2013

Gearing up for RetroChallenge!

These beauties just came in the mail:
Why buy one when you can buy 10 at 10 times the price? $20 on ebay seemed like pretty good deal. I've had good luck with zip drives. They are easy to find at thrift stores, and protocols span from SCSI to ATA to USB which makes them good for data transfer between old and new systems. They work great as a boot drive for classic macs (back to the Macintosh Plus) and let you organize a lot of data in a small space. I've had enough CDs fail that I actually prefer these guys for long term storage of retro software.

Wednesday, December 4, 2013

RetroChallenge 2014WW Entry

I have again entered the RetroChallenge! This time I will be using my Apple Power Macintosh G4 500 DP from the year 2000 to compile some programs. Now, even though this computer is technically eligible for the RetroChallenge, the real "retro" part is that the program I will be compiling is for the Apple Macintosh, as in, the original 128K Macintosh from 1984. I will be using the Classic Environment of Mac OS X 10.4 running MPW as my development environment.

As for the programming, I will attempt to port the lwIP TCP/IP stack to the original Macintosh. This Macintosh is unique because it did not have enough memory to run any commercially available networking stack. Even the 512K Macintosh had some networking possibilities. I attempted this project a number of years ago but couldn't get past the multi-thread requirement of the lwip PPP implementation. As far as I know, the original Macintosh operating system does not have any multithreading libraries or routines. I recently noticed that a branch of the lwIP code includes a PPP module that claims to not require multiple threads! So I will give this another shot. If PPP fails, I can try to get SLIP working instead.

Here is my target hardware/software flow:

Macintosh -> lwIP -> ppp ->  RS-422 -> RS-232 -> USB -> PowerMac G4 -> getty -> pppd -> THE WORLD!

Having worked on this before, and having struggled to understand how to use the code, I have a feeling I will get stuck at some point. If that happens, I will probably work on building a ROM burner to flash some Apple II ROMS or work in my Apple IIgs.

Saturday, November 23, 2013

RetroChallenge 2014WW Prizes

Not totally sure what I am going to do yet, but I am definitely offering these items up as prizes:

I can't guarantee that the keyboard still works, but it did 5 months ago!

Thursday, August 1, 2013

Major Setback and final Push to the End

Last weekend as I was adding some features to my BAM program, I started having keyboard issues again. I found some new continuity problems on the ribbon cable due to stress from bending. I tried a few things to fix the problem, as I didn't want to keep cutting back the ribbon cable. I thought I could solder a little bridge on the cable, but the soldering pen melted right through the plastic. The traces are too thin to solder. I tried taping on aluminum foil traces with mixed results. In the end, I had to just keep cutting the ribbon cable back to an area without cracks. I barely finished that tonight.

I had some new features I wanted to add to BAM, but I quickly ran out of memory, so I couldn't implement scoring, marking mines or verifying that you found them all. So the game is pretty incomplete, but that's all I could fit in memory. I also picked up some pretty horrible coding practices from tricks to save memory on the TS1000. Things like: 10 LET O=PI-PI 20 LET I=PI/PI
Then using "O" and "I" instead of 0 and 1. Apparently, this saves memory by evaluating math with the constant PI, rather than the 5 byte long numbers for 1 and 0.

Anyway, I'm done. The BAM game is available for download as a .P file, but it's not that exciting. It's really quite sad considering the time I spent on it. I just found myself unable to be productive with only 2k of memory and a difficult to use BASIC editor. The source is listed below in image grabs from the impressive TapeConverter program for ZX81.

I never got around to making the memory expansion card with all of the keyboard issues, although I do have the parts ready to solder.

As promised, I am also offering up the working TS1000 as a prize in the RetroChallenge. I wouldn't mind keeping it for 6 months and giving it away at the end of next year's Winter Warmup, but I'll leave that up to the organizers.

Thanks for the memories TS1000!

Thursday, July 25, 2013

Working BAM

I have a working game! Lots of features aren't implemented yet, like scoring and auto clearing areas, but it works! I learned some interesting tricks to reduce the memory size. One of the most novel I found online is for moving a cursor:

20 LET Y=Y+(INKEY$="6")-(INKEY$="7") 25 LET X=X+(INKEY$="8")-(INKEY$="5")

This little snippet replaces 4 lines of normal IF, THEN code by taking advantage of the fact that the INKEY$ comparison resolves to 1 or 0. Adding and subtracting the result for the various keys moves the stored cursor coordinates. I have to say, I really like the Sinclair implementation of BASIC. It has some printing and comparison features that are lacking in Applesoft BASIC. However, the only thing that made programming bearable was writing out the entire program before trying to enter it. Data entry and minor editing is not too bad, but trying to think out a program on the TS1000 is not fun. I will make the source and a download available shortly.

Wednesday, July 24, 2013

3 Revelations

Programming the TS1000 is like programming punch cards

Well, I have never programmed a punch card computer, but after several days of total frustration trying to enter, test and edit a BASIC program on the TS1000, I gave up. I haven't completely given up *BAM*, I am just writing it on my MacBook, in a text editor, and then entering it into the TS1000. This reminds me of how programmers used to have to write out their programs before trying to enter them on a punch card. The TS1000 is too slow to provide a good interface for stream of consciousness BASIC program editing. By the time I get a line entered, I forget what I was trying to do. I have spent many hours working on a simple program which I could have probably finished in just a few hours on an Apple II. I'm sure that machine language programs for the Z80 processor are really the TS1000's strong suit, but unfortunately, that's not what I'm working on.

Know your data types

I was running out of memory very quickly when setting up the game board for minesweeper. The board is represented by a 12x12 2-dimensional array of numbers with values 0 to 9. Little did I know that a number in Sinclair BASIC is represented by 5 bytes. As a result, I was using 720 bytes of memory, over a third of the memory of the TS1000, just to do some basic addition on the numbers. Instead I will use an array of strings. It too is a 2-dimensional array, but should only take up 144 bytes, plus some overhead. The result will be a slower program (to convert from character to number and back), but way less memory use.

Minesweeper has been done on the ZX81

Finding some existing minesweeper programs online for the ZX81 was a bit disappointing. However, I don't think either of them run in the standard 2k of memory for the TS1000 (although I haven't tried either of them). Even though I received my RAM chip for the upgrade, I really want to get this running in the standard configuration. So I'll keep working on this thing.

Sunday, July 21, 2013

Report Code 4

...means "Not enough room in memory." Great. My menus were working perfectly, and I started on the actual minesweeper game logic, when I started getting report code 4 errors. So, there isn't enough room in RAM for a menu and the game. Even reducing the size of the menu names didn't help much. I will be spending the next hour deleting my last 2 days worth of work. One last picture of completed menus for posterity:

Saturday, July 20, 2013

Even FAST is SLOW

My BAM minesweeper menu system is now fully functional. Ugh, I should be done with the whole program by now. Keyboard entry on the TS1000 BASIC editor is incredibly slow. I am used to the membrane keyboard now, but you still have to wait for the screen to refresh before entering a new character, even in fast mode. Also, the editor is acting funny lately and not allowing me to EDIT existing lines. Maybe I am having memory issues?

SAVEing and LOADing is working extremely well with Audacity. I have set up a sort of version control with the audio clips. Audacity lets you mute and minimize clips as you go, and save many clips in the same project. So, I can keep all of my old saves in one project, and still play and record just the latest audio clip.

Finally, I ordered the SRAM chip I need to upgrade the RAM on the TS1000. That should be a fun project, if it arrives in time.

Friday, July 19, 2013

BASIC Programming TS1000 Style

I've picked a name for my Minesweeper program: "**BAM**" (British American Minesweeper). This is a nod to the British/American collaboration that is the Timex/Sinclair 1000, the British/American nature of my American entry into the British organized Retrochallenge, and the British American Minesweepers of WWII, known as BAMs. And of course, when you hit a mine it goes "BAM!" Well, maybe not on the TS1000, because it doesn't have a speaker. The screenshot shows my menu system up and running.

I'm getting the hang of programming on the TS1000. Progress is SLOW. A few tips I have learned:

  • Enter the FAST command to greatly speed up screen refresh during BASIC program editing. Also, the resulting screen flash during redraw gives some feedback as to whether the computer received the key you are typing.
  • Use the LIST command with a line number to jump to that line and scroll the editor there.
  • If the program is no longer outputting text, it is probably because you spelled out "AT" or some other keyword, rather than using the correct key.

I really hope game play is faster than BASIC program editing.

Thursday, July 18, 2013

Success SAVEing & LOADing

I bought the adapter I needed to convert from the mono headphone jack on the TS1000 to the RCA/phono jack on my iGrabber USB audio/video capture device, and then I promptly lost it before I could get it home. I borrowed another one and was finally able to get everything hooked up to my satisfaction. After a lot of experimentation I figured out a setup that gave me reliable results on my MacBook Air. I used Audacity to record and playback the audio clips.

  1. On the TS1000, input SAVE "X"
  2. In Audacity, record with the "Input Volume" at 1.0 (max)
  3. Select the clip and use the "Amplify" effect with a setting of 40dB. This gives a "New Peak Amplitude" of about -10.8 dB. (How can you have negative dB?)
  4. On the TS1000, input LOAD "X"
  5. Back in Audacity, play back at 1.0 "Output Volume" (max) and full system volume.
You can get a pretty good idea of when the TS1000 is LOADing the data by when the video changes. However, using the full 50dB Amplify Effect caused the TS1000 to appear to LOAD without error, but no data was actually there when I pressed LIST. That could have been a SAVE error though.

Finally I can start writing an actual program!

Thursday, July 11, 2013

Harsh, High Pitched Buzz!

After a little research, I learned you can't break your TS1000 by putting the 9v power plug in the wrong jack. This makes sense considering the 3 identical jacks on the TS1000 and how close they are.

I couldn't find any help with my audio problem online, so I started experimenting with the mini phone plug to phono (headphone to RCA) adapter that connects to my USB A/V capture dongle. As it turns out, the problem is with how the stereo adapter connects to the mono jack of the TS1000. One of the lines is crossed or grounded which is making a humming buzz loud enough to cover up the data audio. Connecting the tip of one of the phono plugs to the collar of the phono jack on my USB capture device gets rid of the humming. The data audio is then clearly audible (sounds like a modem). In the end, I was eventually able to SAVE a program on my laptop using Audacity, amplify it, then play it back. I haven't been able to get the TS1000 to LOAD the data again though. I'm sure many people have done this before, so I will do some more research. Also, I will try to pick up the correct mono adapter plug tomorrow.

Wednesday, July 10, 2013

Stable at Last

Sorry for the lack of updates. I suffered a particularly gruesome injury to my finger this past weekend while working on another project. Nothing a little super glue and duct tape couldn't fix.

I fixed the loose ground strap tonight. I used a soldering attachment for a propane torch which worked perfectly. My little soldering iron was not going to get hot enough to heat everything up. The TS1000 is much more stable with the strap secured, but I still don't have audio output during a SAVE command.

The three jacks on the TS1000 are identical 3.5 mm phone connectors. It seems possible that a previous owner connected the 9v power cord to the MIC jack, frying some component. I will do some research and testing tonight to try and track down the problem.

Thursday, July 4, 2013

4th of July with the TS1000

10 PRINT "HAPPY 4TH OF JULY!"

Very close to 200 years after the end of the American Revolutionary War, the American Timex Corporation and the British company Sinclair Research came together to introduce the Timex Sinclair 1000 to America. Finally, the British had brought us affordable computer technology rather than exorbitant taxes on tea.

I spent some time today updating my blog and programming on the TS1000. I am still getting used to the membrane keyboard. It is hard to touch-type without any feedback. Although I like only having to hit one key for a BASIC command, I seem to usually end up spelling out the command anyway, then having to delete my extra typing. It can be a little hard to find some of the commands the first time also.

My biggest problem is figuring out how to save my programs. I have the MIC jack of the TS1000 hooked up to my laptop, but I just hear a "soft, humming buzz", not the "very harsh, high pitched buzz" I should expect. While the humming is certainly more pleasant sounding than the alternative, I am pretty sure there is no data in there. I haven't fixed that ground strap yet, besides taping it in place, so maybe that is part of the issue.

I think I may write a Mine Sweeper type game for this little guy. It would lend itself well to text and simple BASIC programming.

Wednesday, July 3, 2013

HELLO WORLD

Let's try this again. Type:
P "HELLO WORLD"
and the screen shows:
PRINT "HELLO WORLD"
Press the ENTER key and:
HELLO WORLD 0/0

Success!

Tuesday, July 2, 2013

Back From the Dead

Wow, the TS1000 almost went into the trash can tonight. After trying to repair the keyboard ribbon cable, I plugged it back in to test my work. Unfortunately, nothing happened. I couldn't get the TS1000 to do anything at all for about 20 minutes. I thought I had killed it for sure. As it turns out, the loose end of that poorly soldered ground strap was making a connection with another component and grounding out the TS1000. Repositioning the ground strap and applying some pressure caused it to spring back to life!

Back to the keyboard... I cut the ribbon connector back slightly to undamaged traces and cut back the the surrounding plastic to fit into the circuit board connectors.

The biggest challenge was getting the old broken bits of ribbon cable out of the circuit board connector. I kept trying to insert one of the ribbon cables into the connector but there were still some tiny plastic pieces in there blocking it. I used a thin blade to get the final bits out. I ran a test and everything but keys Q-T worked! Some continuity testing showed that the ribbon cable was not making contact on pin #2 of the connector. I had bent one of the pins slightly trying get the plastic bits out so that it was no longer making contact with the ribbon cable. I used a sewing needle to bend the pin back into place and... All the keys work! I will be adding some clear packing tape to the ribbon cable to re-enforce it for the future.

TS1000 Disassembly

Well, my statement regarding the ease of this keyboard repair was apparently premature.

I am going to stay optomistic that it is just the ribbon cable at fault because this unit looks practically new and was very complete. If the issue is stress on the ribbon cable rather than damage to the membrane, I hope I can still make a repair. Otherwise, I don't think I have the fortitude to fix this thing. Onwards...

I flip the little TS1000 over to investigate opening it up only to find the warning "No user serviceable parts inside." We'll see about that... Peel the feet off, remove the 5 screws and look inside.

At first glance, I see what appears to be a ground strap that is not connected properly. It looks like a dry solder joint due to insufficient heat on the thick strap. This is almost certainly not the cause of our keyboard issues, but it will get fixed before the TS1000 is reassembled. 2 more screws to remove the circuit board and the problem is apparent.

I had thought that the ribbon cable was a separate set of wires that connected the membrane to the circuit board. However the damaged ribbon cable is part of the membrane keyboard. Fortunately, it broke right at the circuit board, leaving plenty of good ribbon cable.

Early Problems

Turning on the TS1000 is a bit disappointing. There is no boot chime, no clattering of disk drives, not even the 'click' of a switch. You just plug it in and it's on. Very appliance-like. What you do get is black text on white screen with a [K] cursor. "Now you're ready to use your Timex/Sinclair 1000!"

The keyboard layout of the TS1000 is interesting and makes writing a BASIC program quite intuitive. Each of the letter keys, when pressed at the start of a line, represents a complete BASIC command. The keys are well marked so the keyboard acts as a summary of all the available BASIC commands.

To start, I type:
P "HELLO WORLD"
and the screen shows:
PRINT "HLLO OL"

Hmm, that's not right. Clearly my membrane keyboard is having problems. About half of the keyboard works. The number row does not work at all, the second row works starting at the 'Y' key, the third row work starting at the 'H' key, and the bottom row works until the 'B' key.

I hit the Enter key and:
HLLO OL
is dutifully printed at the top of the screen.

A review of a TS1000 keyboard wiring diagram indicates that the keys that don't work are consistent with damage to several wires on the keyboard ribbon connector. It seems my "working" TS1000 purchase doesn't work so well. Apparently, this is a pretty common problem and should be an easy fix.

Thursday, June 20, 2013

TS1000 Meets a Modern TV

So you want a Timex Sinclair 1000 but need to hook it up to a modern TV (in the U.S.). Well, there's an RCA/phono jack on it, so you can just hook it up to the composite video connection on the TV, right? Not so fast! Phono plugs were used for many RF applications in the 80's. The video from the TS1000 is an RF signal that we would expect to see from a modern CATV/antenna cable (coax with an 'F' connector). We need an adapter to plug it into the CATV/antenna jack of a modern TV. The adapters provided with the TS1000 won't work. Fortunately, you can buy the correct 'F'/RCA adapter from RadioShack for less than $4. This adapter plugs into the back of the TS1000 and you can use a standard CATV/coax patch cable to connect from the adapter to the TV. Then set the TV to channel 2 or 3 depending on the position of the channel selection switch at the bottom of the TS1000.

You can modify the TS1000 to output composite video, but the RF signal is good enough for most purposes.

Ok, now you know you can buy a TS1000 for less than $40, and you know how to hook it up to your TV. So, if you don't have one, go out, get one, and join me for the RetroChallenge!

Sunday, June 16, 2013

Timex Sinclair 1000 Background

Yes, the power is overwhelming.

The Timex Sinclair 1000 is pretty much a Sinclair ZX81 made for the North American market with 2kB of RAM and NTSC RF video output. Like the ZX81, it has a 3.5 MHz Z80A 8-bit processor and 8kB ROM with a BASIC interpreter. Its quite simple and very small compared to an Apple II. It is about the size and weight of a Kindle Fire HD. At a list price of $99.95 when introduced in 1982, it also cost about the same as a Kindle in 2013 dollars. Its small size and low price led to some limitations, most notably the small membrane keyboard, limited graphics and no sound.

I don't think I had ever heard of a Timex Sinclair until very recently, most likely due to following some of the RetroChallenge entries. You can get a working TS1000 for about $40 on ebay without trying hard. I found a fairly complete setup, advertised as working (more on that later), for less than $25 shipped so I just bought it. A Zilog Z80 based computer at such a low price was too much for me to resist. Considering the prices Apple IIs are fetching on ebay, the TS1000 is an affordable introduction to retro-computing, just as it was an affordable introduction to modern computing back in the 80's. This is the first vintage computer I have owned that isn't an Apple. I don't think my marriage can afford me expanding my computer inventory, so I don't plan on keeping this guy very long. (It is small enough to hide inside an Apple II though...)

Friday, June 14, 2013

RetroChallenge 2013SC

Welcome to my new blog. The RetroChallenge inspired me to start a new retrocomputing specific blog here. I will be moving my previous retrochallenge stuff from my other blog MacLCD over to here in the coming weeks. First, a list of goals for RetroChallenge 2013 Summer Challenge:
  • Repair the Timex Sinclair 1000 that I recently bought on a whim (and for less than $25 shipped!) from ebay. Then I will try to write a game for it in BASIC. Assuming I get it all working I will offer the computer up as a prize in the RetroChallenge.
  • Finish fixing my Apple IIGS Upgrade computer.
Since I have a busy month at work I'm going to keep my goals within reach for this challenge.