Wednesday, September 08, 2021

Abusing FORTRAN

I've been having fun with Microsoft FORTRAN-80 and Nevada FORTRAN on my Kaypro 4/83.

When I was in college, we did a class on FORTRAN abuse - mainly using some design decisions in FORTRAN that cause interesting things to happen.

Consider this code:

c bad program
      integer i
      i=3+5
      write(1,5) i
      call xxx(5)
      i=3+5
      write(1,5) i
    5 format(1x,i4)
      end

      subroutine xxx(n)
      integer n
      n=3
      return
      end

Under Nevada FORTRAN, this prints:

8

6

Why?  Because "5" was passed in to xxx by reference, which was changed to have a value 3.  Yes, under FORTRAN, I could change a constant.

Under Microsoft FORTRAN-80, this did not happen.  Both values stayed at 8.


Tuesday, August 17, 2021

Kaypro "1" set back (momentary)

Background: I call this machine my Kaypro "1" because the case says it's a "1" on the outside, but there's a sticker on the back that says it's a 2/84 and it has the 2/84 ROM, not the 1's ROM.  This machine was one of the "slap together out of the parts we have" as Kaypro was going out.

I don't have desk space yet for all my vintage computers, so when I rotated the Kaypro "1" onto the desk to use, I noticed that the B: drive was no longer working.

The first thing that I did was power off and pull the USB stick that was the B: drive and it was warm - abnormally warm.  Red flag time.

When I tried to read the USB stick in my PC, it wouldn't recognize it.  Uh, oh.

So back the Kaypro "1" goes back on the bench and time to take a look.

First thing I checked was the MOLEX to 3.5 floppy power cable.  It was pinned correctly.  Everything looked good.

Next, the multi-meter comes out and I check the voltages.  To make sure that everything was correct, I removed the MOLEX pig tail and checked the voltages at the MOLEX end.  The 5V line had 10V and the 12V line had 4V.

This power connector had the lines swapped!

I swapped the pin on the MOLEX pigtail and pulled the now 10V pin completely out of the pigtail so there was no connection to the OpenFlops.  I verified the voltages and plugged everything back in.  It works.  The old USB stick is toast, though.

Kudos to the OpenFlops guys for building something that takes twice the voltage and still works.

But this is a lesson with the "newer" Kaypros:  They weren't exactly the best made and there are surprises everywhere.

The "1" is still on the bench.  I'm getting better 5.25-3.5" bay adapters that fit better.  I'll swap them out this weekend.

Compaq Portable 386 - adventures in FreeDOS

I had a spare CF card, so I decided to give FreeDOS a try.

They had a set of floppy images that I could use so I popped in the CF card and booted the boot image and started the install.

Issue: The setup formatted and set up the non-active DOS partition to be bootable.  It took me a bit to figure that out and why it wasn't booting from the CF card, but that was easy to fix.

There are some more things I need to configure about it to get it 100%, but I decided it wasn't worth it at this time.

Bottom line: I saw no benefit to using FreeDOS over DOS 3.30 for the Compaq (at least for my use).


Wednesday, August 11, 2021

FORTRAN on the personal computer

For the last few months, I've been binging on FORTRAN.

FORTRAN was the first language I learned after BASIC.  I actually did a little FORTRAN in high school - before they kicked me off the school system's IBM mainframe.

FORTRAN was the first language that I did in college.  My year was actually the last that did FORTRAN for Computer Science.  But that FORTRAN "experience" got me a job at the GM Proving Grounds working on the FORTRAN programs that process data from crash tests.

Later, after some years of COBOL and then C, I went back to FORTRAN in GM on the HP 1000 at Powertrain (Systematic Engine Calibration).

So I've spent plenty of time with FORTRAN.

I picked up Microsoft FORTRAN 5.1 for the MS-DOS.  This is based on FORTRAN 77.  I was also able to locate Waterloo FORTRAN 77 too.

But I wanted to experiment with FORTRAN for CP/M and what I found was interesting.

I got Microsoft FORTRAN-80 for CP/M and LDOS (TRS-80) and it's based on FORTRAN ANSI standard from 1966 and there are "differences".

I'm going to call this version FORTRAN 66.

First, FORTRAN 66 has no character data type.  You store characters in other data types.  You can print a character type, but you are storing it in something else.

Print is another one.  FORTRAN 77 supports the PRINT statement - which is basically no more than a shortcut for WRITE to the console device.

Unformatted output doesn't work under FORTRAN-80 (I don't know if this is a FORTRAN 66 issue).  If you don't specify a FORMAT statement, the data is printed as a "character" type!

Compiling FORTRAN-80 is multiple steps:

1. Edit the source in the text editor of your choice.  I'm so glad that I have TE (a modern CP/M program) with a full screen editor.  But back in the day, they probably used Wordstar.

2. Then run the compiler, F80.  But you can't just pass a command line parameter.  It's run F80, wait.  Then enter <program rel>=<program source> and wait some more.  Control-C out of the compiler.

3. Optionally fix any compiler errors.

4. Run the linker, L80.  But, again, no command line parameters.  Run L80 and wait.  Since I just want to run the program, I just do <rel file>/g to link (and wait) and run.

Edit: F80 and L80 do take the commands as parameters.  They didn't under the TRS-80, but they do under CP/M.

It's no wonder FORTRAN never took off on the PC.  BASIC works so much better.  Then, after testing your program, you can compile it into an executable.

And keep in mind that, at this time, Microsoft was a premier software developer.  They usually did a great job compared to other companies.

Now, to get some time to test Nevada FORTRAN.

Thursday, August 05, 2021

The Saga of the Floppy Emulators

I was playing with my Kaypro "1" and I was thinking about what I'm going to do with it long term.  Using real 5.25" floppies in it was a pain, and I know that the life span of those floppies were getting toward the end.

So I decided to to put a floppy emulator in.  Since I had already done OpenFlops I decided to do something different.  Lotharek has a nice floppy emulator.  The difference is that this one can emulate 2 floppy drives in 1 unit.  So I purchased it and waited.

When it arrived I started to get it hooked up.

Problem: the floppy emulator wouldn't power on.  On inspection, it looked like the Molex to 3.5" floppy power cable was wired backwards (spoiler: it wasn't).  It powered on, but the display only showed 2 rows of "blocks".  I spent a good amount of time trying to figure out what the issue was.

Solution: What I should have done was was checked the power output from the floppy power cable in the first place.  The 5V line was only 4V.  I thought the other line was "unused", but it wasn't.  It was the 12V line (really only outputting 10V) to run the floppy drive motors.  Yikes!  I was running that down the emulator's 5V line.  Lucky for me it was well made and suffered no problems.

But what to do?  There's certainly something wrong with the Kaypro "1"s power supply, but visual inspection shows nothing (i.e. no bulging capacitors or such).  I'm really leery about messing with 110V electronics without someone telling me what to do.  If there was a visually bad component, I have no problems replacing that, but I'm not poking around in something running at 110V.

As an experiment, I put the new floppy emulator in my Kaypro 4/83 - and it worked!  So I did some rearrangement.  The images I use on the OpenFlops just copied over - no conversion needed.  I replaced the B: drive with the original 5.25" full height drive - but it's not hooked up, decoration only.

Then I took the OpenFlops and put them into the Kaypro "1" and they work!  I had to rebuild all the images since the floppy images that I had were for the Kaypro 4/83, but that was mostly wait time and I could do that in between other things.

So that's done.  The 5.25"-3.5" adapters are supposed to arrive tomorrow, so hopefully I can get that a buttoned up.

Sunday, July 25, 2021

Compaq Portable 386 - Done

Final pictures are here.

2 of the common problems for this computer were the keyboard cable disintegration and floppy drive failure.

The insulation around the keyboard cable literally disintegrated.  Moving the cable makes pieces fall off.  There's no way that I know of to replace the insulation, so the cable needed to be replaced.

The keyboard connector is standard.  But the problem is that a standard keyboard plug is too wide to fit into the hole.  I had to look around for a cable with a "thin" connector so that it would fit.  I ended up getting a keyboard extension cable and cutting off the plug end.  It was then a matter of pinning out the cables (old and replacement) to see what wires go where.  Overall, about 30 minutes of work to replace the cable.

The 1/3 height 5.25" didn't work.  I decided it wasn't worthwhile to fix it and went straight to the Gotek.  This made getting boot media much easier.

The device I bought was something someone created on eBay.  It combines a Gotek (already set up with FlashFloppy) with a CF-IDE adapter in one half-height 5.25" 3D printed tray.  It fit where the hard drive used to be.  I only had to make a slight case modification for the CF card.

The hard drive set up was interesting.  I have to choose a hard drive type that the Compaq supports.  If I chose the 110 MB one (which Compaq had a real hard drive for), everything worked.  But if I chose a larger one (like the 320 MB), I get a 1790 drive 0 error - but after hitting F1 gets me into DOS.

One more interesting thing.  You can't "not select" a floppy in the Gotek.  So you have to have the USB drive out to boot from the hard drive.  Otherwise it tries to boot from the floppy chosen in the Gotek.  I did have an idea to make a switch and wire it into the Gotek power, but the only thing I need the Gotek for is loading diskette images, so I didn't see the value.  And it causes no problems to insert the USB drive after you've booted up.

Saturday, July 17, 2021

Compaq Portable 386 - 2

CMOS battery replaced.  Now just letting it charge.

Keyboard reassembled (mostly).  I'm still sourcing a cable replacement.  The one that I got had a plug that was too thick and wouldn't fit in the hole correctly.

I was able to pick up some setup disks from a reliable source, but none would read.  I think the 5.25" drive is bad (no surprise).

Someone on eBay 3D printed a 5.25" half-height case and put a CF-to-IDE and OpenFlops into it (with rotary switch and OLED).  So waiting on parts to be able to hook that all up.

But things are moving.  I was able to use the OpenFlops to boot a setup disk image and configure the CMOS - but the battery wasn't set up correctly so it didn't save.


Sunday, July 11, 2021

Compaq Portable 386

I picked up a Compaq Portable 386.

Triage done.

It's in pretty good shape.  CMOS battery is done (no surprise).  That means I need the setup disks before I can do anything.  So those are on order.

Surprisingly, the company that makes the CMOS battery is still in business and the battery was in wide use.  So getting a replacement was very easy.  That's on order.

I pulled the floppy drive to clean it, but inside the case is very clean.  So I just think I need to put in the 5.25" cleaning disk before I try out the setup disks will be good enough.

The hard drive is IDE.  So I hooked it up to my Rosewill IDE to USB setup.  No go.  The drive spins, but the heads don't seek.  No surprise there either.  That was getting replaced by a CF card anyway.

The main thing that I'm tackling is the keyboard.  While the keyboard itself is nice, the cable is disintegrating.  This is a known problem.  I have a cable on order that I'll have to pinout and solder in its place.  But I can use the keyboard from the failed lunchbox portable as a backup.


C-64 troubles solved

One of my C-64s developed an issue with the keyboard.  The "E" key stopped working.

So I set it aside to be repaired and pulled out the "backup" C-64.  Boot up and...  Out of memory error - and I didn't load anything.  Diagnostics showed 6510 or RAM issue.  *sigh*

The "E" key issue went away when I swapped the plungers for the "E" and "R" keys.  But that issue will probably come back.  So when I had it open, I changed the Caps Lock key to be a plug that I can disconnect.

The replacement 6510 and RAM arrived for the "backup" C-64.

Now, I've been inside of C-64s before, but this one surprised me by having the 6510 and **some** of the RAM socketed.  That means that this system had issues before.

I tried the easy stuff first.  I replaced the 6510.  No change.  So it's a RAM issue.

I pulled the socketed RAM and one of the chips was highly oxidized.  So I replaced that chip with one of the new ones.  Everything works.  The Dead Test cartridge showed everything passed.

I think that this C-64 had been bought first, had a problem and was repaired.  Later, the guy got a new one and stored the old one in a more humid area, which caused that RAM chip (near to the edge of the case) to go bad over time.

So I'm back to 2 functioning C-64s.

Sunday, July 04, 2021

Lunch box portable - R.I.P.

The power supply blew.  This time there was smoke and it no longer works.

I'd like to fix it, but I think it's a lost cause - but mostly I don't want to experiment with high voltage stuff.

I examined the power supply closer trying to see if I can find the smoked component (no luck on that).  There's actually 2 power supplies there.

One is the standard PC power supply providing power to the motherboard and peripherals.  The other is just to supply power to the gas plasma display.  There was an extra power switch on the back of the PC that specifically controlled the display power supply.

I tried to source a replacement, but no luck so far.

It's not in the trash, but it is in storage for now.  I might find the parts useful for something in the future.  Or I may luck out and find a power supply.


Sunday, June 20, 2021

Lunch box Portable

So another neglected PC showed up on my doorstep recently.

A 386 "lunch box" portable.  The "lunch box" form factor was short lived as computer hardware and batteries got better and the "lunch box" was dropped in favor a regular laptop.

This old guy has an 80386, 80386sx co-processor, 5 GB RAM, 1.44 MB floppy, 40 GB MFM hard drive, red plasma monochrome display.

It actually started up (but the first power up shot out a spark but didn't seem to cause any problems - more on that later) but would not boot.  As expected, the hard drive was done.  So on to the disassembly.

It was obvious that this had been stored on concrete.  Concrete is porous and allows moisture to flow through it.  If you need to store things on concrete, it needs to be on top of something between it on the concrete.

Rust.  Lots of rust and oxidation.  I had to completely dissemble the power supply and de-rust the housing.  Even then, I had to end up spraying it with Rust-oleom just to keep the rust down.  That's where the spark came from - a piece of rust across some high-voltage lines.

So, that done, I moved on to spraying some of the places with deox-it, reseating several chips.  The 386sx had lots of oxydation - which caused issues with booting and even getting into the CMOS.

Oh, that's another thing.  The CMOS battery had died long ago and the previous owner had replaced it with regular alkalines - which he never removed before storing.  Ya, that toxic mess went into the trash.  I've made another alkaline pack, but I'll figure out how to handle the long term after I get it all working again.

Now I get a consistent boot and into the CMOS.

The MFM controller is gone.  It was too hard to find an MFM replacement, so I got a IDE/floppy controller card.  I have an IDE/CF card adapter coming soon to replace the hard drive.

The floppy drive had issues.  I didn't look too far into that yet.  I just grabbed my old 1.44 floppy drive from the display case and tested that out.

I tried DOS 6.2 and no go.  I kept going down until I found that DOS 5 will work with some issues (but they seem disk drive related).

So at this point, I have a consistent boot from floppy.  I'm going to try to removing the external floppy setup to see if I can get more reliability from the floppy drive.

I also disassembled and cleaned the keyboard.  So reassembly is next on the list today.

Tuesday, June 08, 2021

Kaypro "1"

I picked up a Kaypro 1 on eBay.  I bid bare minimum and got it (which means no one else wanted it).

When it arrived, I did the usual tear down and evaluation.

  • Disk drives in good condition.  Cleaned.
  • RIFAs replaced - because you know they will blow up.
  • Deoxit in the brightness POT.
  • Replaced the keyboard cable since it had gone bad.  Interestingly, the cable from my 4/83 worked, but the replacement didn't.  But the replacement worked on my 4/83 so all is good.
  • Keyboard good.
  • Replaced the case screws.  The previous owner(s) had replaced many screws with mismatched versions.

But what was strange was the ROM chip.  Instead of being labeled with the version number, it had "2.2G" on it - meaning CP/M 2.2G.  Also, there was a label on the back of the case that said "Kaypro 2".

More research showed at least 2 other Kaypros in the same state.  It seems that kaypro offered a service to "downgrade" your Kaypro 1 to a Kaypro 2/84.

The next step was boot disks.  I stole an OpenFlops out of the 4/83 and got several disk images from the Internet.  One of those images worked perfectly, so I use that to make several boot floppies.  Then I put the floppy drive back in and the OpenFlops back in the 4/83.

tl;dr I made several more disks, copying what I had from other sources and downloaded many files.  So I now have a nice disk library for the "1".

I'll probably do a Gotek upgrade to this at some point.  But my 5.25" stash is pretty large right now.  So I don't see a need.  The half-height drives in the "1" aren't nearly as bad as the full height ones from the 4/83.

I did upgrade my version of Super Star Trek to include the additional screen attributes that the 1 supports (since they didn't downgrade the video chip).  Mainly the reverse screen and the blink modes.

Thursday, May 06, 2021

Tandy 1500HD - Complete failure

tl;dr

If you are interested in working with or restoring vintage computers, avoid the Tandy 1500HD.  You will only be wasting your time and money.


The full story:

I picked up a Tandy 1500HD from Goodwill recently.  It came with 2 power supplies, an extra battery (probably dead too), original diskettes, and original documentation.

Once it arrived, I triaged it.  The display wouldn't light up, but it would flicker.  No beeps from the machine as it tried to boot.  The hard drive would spin.

I took it apart to see what was going on.  No leaking capacitors.  Good sign.  The clock battery looked good (i.e. not leaking but probably dead).  The Tandy 1500HD kept it's config in flash, so the battery was only there to keep the real time clock going when powered off.

I wish I had done more research on this before I paid for it.  The drives (both floppy and hard) are completely proprietary and not replaceable - and you can't even update them to flash drives like many old computers today.  The interfaces are completely non-standard.

The floppy drive belt was almost goo.  It loosened over time and just came off.  I attempted to replace it, but no go.  I figured that maybe I could get at least something working on it.  I also found out that the system won't even POST unless the hard drive is hooked up.

The display problem was simple.  The cable inside the display came off.  The old foam simply had broken down over time, allowing the cable to be pulled from the connector enough to not make a good connection.  That, at least, was a simple fix.


The bottom line is that to get this back to working condition, I'd need to replace the hard drive and the floppy drive.  Either with old stock or refurbished parts, or with modern replacements.  Unfortunately, neither exist.

Trying to find technical documentation on this computer was not fruitful either.  The usual places simply had nothing on them.  No repair guide.  Just PDFs of the documentation that came with the computer and some jumper settings (which, BTW, were incorrect).


So I wasted my money on this.  Hopefully you'll read this and not waste yours too.

Thursday, April 08, 2021

S-BASIC vs. Turbo Pascal

My next experiment was to take some of those S-BASIC programs and convert them to Turbo Pascal.

It wasn't a surprise that the conversion was pretty easy.  Much easier than M-BASIC to S-BASIC.  S-BASIC has more in common with Pascal than MBASIC.

 

Overall, Turbo Pascal is much better than S-BASIC.

Turbo Pascal has an IDE.  With S-BASIC, I needed to use an external editor.  The one that I had was TE, but that's actually a relatively new program.   But I probably could have used Wordstar - to keep the Turbo Pascal comparison apples-to-apples.

Turbo Pascal can compile to memory.  This greatly increases the speed of which it tells you where your errors are and makes it able for you to test your program quicker.

With S-BASIC, it's save, exit the editor, run the compiler, go back into the editor - and remember the line that had the problem.

As far as creating an actual .COM file, Turbo Pascal might have a slight speed advantage, but not enough to really notice.

 

So the reason for S-BASIC star not rising is proven.  Turbo Pascal is so much better.

Please don't take this as meaning that S-BASIC is bad.  On the contrary, it's really good, and if Turbo Pascal hadn't come out, it probably would have gotten much more traction.


Monday, April 05, 2021

S-BASIC - Bunco game

 So we start with a simple Bunco game written in BASIC.

10 PRINT "BUNCO"
20 S=0:W=INT(RND(1)*200)+300
30 FOR R=1 TO 6
40 PRINT "ROLLING..."
50 FOR Q=1 TO W: X=RND(1): NEXT Q
60 D1=INT(RND(1)*6)+1:D2=INT(RND(1)*6)+1:D3=INT(RND(1)*6)+1
70 PRINT "ROUND:";R;"Rolls:";D1;D2;D3
80 IF (D1=D2) AND (D2=D3) THEN 150
90 IF D1=R THEN S=S+1
100 IF D2=R THEN S=S+1
110 IF D3=R THEN S=S+1
120 PRINT "SCORE ";S
125 INPUT "PRESS ENTER";A$
130 NEXT R
140 PRINT "FINAL SCORE=";S: END
150 IF D1=R THEN PRINT "BUNCO!": S=S+21: GOTO 120
160 PRINT "MINI BUNCO": S=S+5: GOTO 120

The original for this was probably written for my Pocket Computer 2.

The S-BASIC version looks like this:

var s,w,r,q,x,d1,d2,d3=integer
var a=char

PRINT "BUNCO"
S=0
W=INT(RND(1)*200)+300
FOR R=1 TO 6
    PRINT "ROLLING..."
    FOR Q=1 TO W
        X=RND(1)
    NEXT Q
    
    D1=INT(RND(1)*6)+1
    D2=INT(RND(1)*6)+1
    D3=INT(RND(1)*6)+1
    PRINT "ROUND:";R;" Rolls:";D1;D2;D3
    IF (D1=D2) AND (D2=D3) THEN BEGIN
        IF D1=R THEN begin
            PRINT "BUNCO!"
            S=S+21
            end
        else begin
            PRINT "MINI BUNCO"
            S=S+5
            end
        end
    else begin
        IF D1=R THEN S=S+1
        IF D2=R THEN S=S+1
        IF D3=R THEN S=S+1
    end
    
    PRINT "SCORE ";S
    INPUT "PRESS ENTER";A
NEXT R

PRINT "FINAL SCORE=";S

Now, it certainly is much easier to read and much of the original code is there, but there was a significant amount of change to make this work under S-BASIC.

One gotcha was the 

60 D1=INT(RND(1)*6)+1:D2=INT(RND(1)*6)+1:D3=INT(RND(1)*6)+1

The S-BASIC compiler did not flag that as an error, but the assignments to D2 and D3 were simply ignored.

But lines 150 and 160

150 IF D1=R THEN PRINT "BUNCO!": S=S+21: GOTO 120
160 PRINT "MINI BUNCO": S=S+5: GOTO 120

Did get a compiler error because they came after the PRINT.

Lines 150 and 160 also have a second gotcha: The way to those lines is a GOTO within the FOR loop.  Again, the S-BASIC compiler flagged no problem, but the FOR loop simply exited after the first iteration.

 

Sunday, April 04, 2021

S-BASIC

On the Kaypro, there was something called S-BASIC.  S-BASIC was an early attempt at creating a "structured BASIC" language.  Think of what C++ was to C.  S-BASIC is to BASIC.

But while C++ would compile C programs, S-BASIC would not compile Microsoft BASIC programs.

To convert an MBASIC program to S-BASIC, you need to:

  • Declare all variables before their use.  That means you need to go through your BASIC program, find all variables and declare their type.
  • Remove all multi-line statements.  S-BASIC doesn't support ":" between statements.  At best, it simply ignores all the code after the ":".  At worst, compiler errors.
  • You cannot GOTO out of a FOR loop, even if you GOTO back in.

Other downsides:

  • Compile time is slow.  So the amount of time between changing something and seeing if it works is a while.
  • No IDE.  You need a text editor to write your code.
  • It cannot READ data files written by MBASIC.
  • You can still write spaghetti code, but you have the option to not do so.

So to take your MBASIC program to S-BASIC will require a great deal of rewriting.  Even for the really simple programs that I did, it was not quick.

S-BASIC came out about the same time that Turbo Pascal was popular on CP/M.  Turbo Pascal had the IDE and is a much richer language.  So it's easy to see why S-BASIC didn't really rise in popularity.