# Compaq Portable 386

I saved [1]this computer from being dumped in a skip many years ago 
after learning of its impending demise on a newsgroup. After I got 
it home I played with it for a week or so before putting it away. 

From memory it had DOS and windows 3.11 for workgroups installed. 
Everything worked, the motherboard battery was OK, so too was the 
original connor 40mb harddrive.

The machine specs were:
6mb Ram
40mb harddrive
5.25 inch floppy
ISA expansion box containing:
* 10Mbit Network card
* Full length soundblaster with a speaker held in place with blutak

I removed the small speaker, blutak and soundblaster as it looked a 
bit of a mess. I still have the soundcard but not the speaker.


## The second inspiration

Some years later I fired it up again, I can't remember why. Maybe just
to see if it still worked. Unfortunately at this point both the CMOS 
battery and the harddrive had died. 

These systems have no BIOS to speak of and need configuring using a 
utility disk. Luckily I managed to find disk images in both 5.25 and 
3.5 format which allowed me to set the time and drive parameters. 

I had a few old ide drives laying around and managed to find one that 
would work with the unusual disk numbering system. From memory I 
installed a 500mb hard drive, but it wasn't recognized as the full 
volume of the disk. It allowed me to install windows 3.11 again and 
I remember spending a lot of time trying to find and install a 
very small linux distro. 

I used it for a while but quickly tired of having to set the drive 
parameters using the floppy utility every cold boot.


## Jump forward to 2021

COVID lockdown, boredom, reminiscing about old computers and that they
could still be useful. Lets see what I can do with the old girl!

Planned fixes and upgrades:
* CMOS battery, retrofit with CR2032 battery and carrier.
* Install soundblaster card and hidden speakers.
* Replace 5.25 floppy with more standard 3.5 (half height full width)
* IDE to CF card adapter with CF card as main drive.
* Install DOS, windows 3.11 and NetBSD 4.0.1 (last 80386)
* [2]Cat5 to WIFI bridge (hidden inside the expansion box)

The idea is to get the most out of her without making any structural
modifications. No cutting of any of the plastic casings and remain
externally original to the period.


## Update 21/01/2021

The CR2032 carrier and batteries arrived over the past couple of days 
so today, having all the parts, I set to replacing the CMOS battery.

The original EAGLE PICHER LTC-16P-CO-F-S3 battery was fitted deep 
[3]inside the unit requiring removal of the harddrive and floppy 
assembly for access. This isn't ideal, so I decided to make a new one
that was more easily accessible.

I had spotted a handy vacant space down next to the psu that looked 
a perfect size for the battery carrier, with a little padding added 
to stop it sliding around. 

After making sure the assembly fitted snuggly in the [4]space, I cut 
the wires to the required length and refitted the original motherboard 
connector. The [5]replacement carrier wiring and battery, were checked 
with a multimeter before final assembly.


## Update 23/01/2021

The past two days are a blur as there have been many obstacles to 
overcome.

I searched the entire house, including the loft space, but I couldn't 
find the 5.25" system disks anywhere. This meant I had to find the 
[6]DOS utility program again to create new ones. The 500mb harddrive
was in fact only 120mb, so I was far more space constrained than I 
thought. This meant I had to settle on just installing NetBSD, as I 
was more likely to use it than either windows 3.11 or DOS. I could 
always boot DOS from floppy disk for games. 


### Creating a utility disk

It sounds like a trivial thing to do, apart from I no longer have any
5.25" disks. I managed to find a [7]3.5" disk image, but that needed 
to be a low density 720k variety which I also nolonger have. After 
much experimentation with various floppy drives and floppy disks I 
found that I could fool the drive using an old trick of putting tape 
over the right hand hole in the floppy and formatting it a particular
way. Thankfully I had a USB floppy drive for such emergencies!

To format the freshly taped floppy:

  linux:
    $ufiformat -f 720

  DOS/Windows:
    format a: /T:80 /N:9

After that writing the disk image was straight forward:

  linux:
    $dd if=compaq-720.img of=/dev/<floppy>

  DOS/Windows:
    RAWRITE.EXE

After practically a day of trying, this allowed me to run the utility
to set the date; and then spend several more hours trying to guess the 
correct hard drive type from the 47 available options...


### Installing NetBSD 

With only a 120mb (unformatted) hard drive and 6mb of RAM I knew that
this would be a challenge. I was not wrong!

NetBSD 4.0.1 was the last to support 80386 processors. The minimum 
requirements were 4mb ram and 50mb hard disk space. Though there is a 
disclaimer of sorts "we do not know of anyone running with a system 
quite this minimal today.". I tried, the memory requirement was too 
high... 

Going back a little further, to 3.1.1, there is a boot-tiny.fs 
floppy image which had a GENERIC_TINY kernel. This booted and got me 
to the installation menu. I proceeded through the install, partitioned
the hard disk (manually set the geometry because it was incorrect) and 
tried to configure the networking but I could not get the network to 
come up. Eventually I gave up and shut down the machine. Shutting down 
gave me opportunity to swap out the Kingston KNE2000 for a 3com 3c509.

I tried installing again. This time I succeeded in configuring the
network card and, with some modification of URL paths due to these 
old BSD's being archived, I could now install the basic package sets 
(base, kernel and etc). I finished up the install and rebooted.

On booting up it just stopped, as if there was no bootloader installed.
I remembered that I had manually altered the drive geometry because it 
was reading incorrectly from the BIOS. I thought maybe this was the 
problem so I rebooted to perform the install again, this time leaving
the disk as recognized by the BIOS. Unfortunately this reduced the 
available drive size to around 70mb which was not enough to do the 
install. 

I decided to try selecting another drive type using the utility disk 
to see if I could find one that showed more space when running the 
installer. 

The result was much better, with closer to 100mb available without 
manually changing the disk geometry. I made a swap partition of 12mb 
(twice the ram) and used the rest for /. I proceeded to install the 
sets via the network and finished up the install. 

As I saw the NetBSD boot loader come up on screen and scroll through
to a login prompt, I was so happy! My efforts had not been in vain and 
I had managed to get NetBSD installed on a 386 class computer with only 
6mb of ram and in less than 100mb of hard disk space. [8]A success!

There is still some tweaking required but I'm happy with how it's gone
so far. Now I just need to get a dvorak keymap on there...


## Update 24/1/2020

I modified the network configuration to use DHCP. This required setting
dhclient=YES in /etc/rc.conf and modifying the static ifconfig line
in /etc/ifconfig.ep0 to read 'media 10baseT'. I discovered during the
install that media type is not detected automatically on some older
multi-media (BNC, AUI, 10baseT) network cards.

The keymap has been a struggle. Aparently the GENERIC_TINY kernel 
doesn't have wsmux, which would ordinarily link to wskbd. The end fix
was 'wsconsctl -f /dev/wskbd0 -k -w encoding=us.dvorak'. I have added
the line to /etc/rc.conf for now to set it at boot.

ksh needed a .kshrc to make arrow keys and command history work :
set -o emacs
HOME=/home/<my_user>
export HOME
HISTFILE=$HOME/.sh_history 
export HISTFILE

While not essential, the above tweaks have made further configuration
of the system much more efficient.


## Update 30/1/2021

The CF to IDE adaptor arrived today. I connected everything up and 
hoped that a CF to SD card adaptor with a 2gb SD card would do for 
testing. However, the system refuses to boot with the card fitted.
I have ordered a 512mb CF card to see if it is the card or the adaptor
that is the problem.


## Update 04/2/2021

The 512mb CF card arrived today, so I tested the CF adapter with the 
new card. After some time spent trying the various drive types I found 
one that seemed to give me close to the full drive capacity (type 41). 
After installing DOS it successfully booted from the CF card.

Now that I was sure everything was going to work, I could start work
to mount the CF adapter. The adapter came only with a steel bracket
to mount it into the back of an ATX case. I figured that I could bend
and drill the [9]bracket to fit into the drive rails without drilling
any extra holes. This worked quite well until the point I realized
the power connector was too close to the rail to fit. After some time
thinking of a solution, it stuck me that I could unsolder the connector
and place it on the back of the adapter which would make it face away 
from the rail. I was pleased with the [10]final assembly.

I then cut one connector off an old HD ribbon cable for a best fit as
the original was too short to reach the CF adapter. I then trial fitted
and tested the adapter in situ. All was well, so I decided to install
Windows 3.11 for workgroups. This was a little tricky as I had to 
modify the disk images to add support for the Compaq Plasma screen
and CGA adapter. This makes the installation more straight forward
though as you don't have to install drivers from alternative disks
should it need to be reinstalled in future. To complete the retrofit
I installed a soundblaster 1.5 that came with the machine and installed
prince of persia and lemmings which would allow me to test the card.
After making an IRQ jumper change everything worked great. I was quite
impressed by the sound from this old card, despite nearly deafening 
myself when testing it with earphones!

I reassembled the unit and gave it a final test by playing a few levels
of lemmings with some powered speakers plugged in. The experience took
me back to my teens when we had an Amstrad PC1512. 


## Conclusion

It was nice to have retrofitted the Compaq and have it working again
without harming the integrity of the original system. I had ambitions
when I started the project about maybe using it myself and installing
WIFI and speakers in it. But really it belongs in a museum or with 
someone who will use it and appreciate it more. That is why I installed
DOS and Windows 3.11 rather than NetBSD in the end. I set it up for
a new owner rather than for myself as through the process I sadly 
realized that I would rarely, if ever, use it.

1. [Compaq Portable 386]( gopher://gopherpedia.com/0/Compaq%20Portable%20386 )
2. [Cat 5 to WIFI bridge]( https://www.amazon.co.uk/Convert-Ethernet-Wireless-Repeater-Multi-Functional/dp/B07PMR673M )
3. [Original battery location]( gopher://gopher.icu/I/phlog/Computing/images/old-battery.jpg )
4. [Trial fitting new battery]( gopher://gopher.icu/I/phlog/Computing/images/trial-fit.jpg )
5. [Finished assembly]( gopher://gopher.icu/I/phlog/Computing/images/new-battery.jpg )
6. [Utility disk programs (3.5" & 5.25")]( gopher://gopher.icu/9/files/compaq-portable-386-utils.zip )
7. [3.5" 720k floppy utility disk image]( gopher://gopher.icu/9/files/compaq386-cmosdiskimg.zip )
8. [NetBSD Installed]( gopher://gopher.icu/I/phlog/Computing/images/install.jpg )
9. [CF Card Adapter Bracket](gopher://gopher.icu/I/phlog/Computing/images/cf-bracket.jpg )
10. [CF Assembly](gopher://gopher.icu/I/phlog/Computing/images/cf-assembly.jpg )