Friday, October 27, 2017

RetroChallenge 2017/10: Part 7

Leave a Comment

Developing Software on the NEC PC-8401?

Just a bit of fun for this entry. After experimenting with some software development last post, it quickly became apparent that writing software directly on the PC-8401 is a little inconvenient (at least without a memory expansion). This lead to the use of Z88dk for external development and a little cross-compiling to CPM to suite our purposes.

I couldn't help thinking that although the outcome was successful, it seemed a little like cheating. So lets cheat a tiny bit less.

As we know, the PC-8401 comes with a very capable Vt100 compatible Terminal program, one that's perfect for interfacing with LINUX. Now with minimal imagination required  lets pretend it's 1985 and we're developing on some extremely expensive time sharing remote platform tended by white coat wearing professionals.

There are many ways to configure serial / rs232 terminal sessions within LINIX, so here's one way, and one that's really simple although not a permanent on boot ready option.

First, we need to find the correct Serial Port. I'm using a USB to serial adaptor and need to know which exact device to target.

From the command line in LINUX issue: dmesg | grep USB

This yields a load of messages, but I'm looking for something as below.

[   22.444199] usbserial: USB Serial support registered for pl2303
[   22.444774] usb 1-10: pl2303 converter now attached to ttyUSB1

Now knowing knowing which USB device is the serial converter, it's an easy matter to setup a terminal console.

sudo stty -F /dev/ttyUSB1 cols 80 rows 15 1200
TERM=vt100 ksh </dev/ttyUSB1 > /dev/ttyUSB1 2>&1 &

Once that's all done, I can start up the PC-8401s Terminal program, configure it to 1200 baud 1 stop bit, no parity and 8 bit word length and I'm up and running a LINUX remote console. From there it's time to start up a text editor, VI, Emacs or Nano and get developing.

NEC-PC8401 with and open LINUX console running nano and editing code

Once some very impressive software has been developed, it'll need to be transferred to the PC-8401 to be executed in all it's glory, and LINUX provides a couple of easy to use xmodem commands to do just that.

To send files from LINUX via Xmodem:

To receive files from the PC-8401

Now there is absolutely no excuse, not in the slightest to use a 27 inch widescreen monitor to interact with a high powered modern PC to write applications.

Finally, thanks to Mike Spooner for indirectly generating the idea behind this post.

See RetroChallenge IntroPart 1Part_2Part 3Part 4, Part 5Part 6Part 7Part 8
Read More

Wednesday, October 25, 2017

RetroChallenge 2017/10: Part 6


Writting New Software for an NEC PC-8401

As noted previously, the PC-8401 came sans BASIC interpreter, which was quite an anathema in the day. This lack of BASIC presents no real impediment in producing new software for the machine today, even back in the 80s a CPM targeted variety of BASIC could be sourced for the machine (if not a specific PC-8401 version). 30 years on, being equipt with a Z80A processor and the CPM 2.2 operating systems puts this laptop a good position for some software development.

Getting into BASIC

To start we'll need to copy BASIC interpreters onto the PC-8401. AS with all software, BASIC will be taking up valuable chunks of the 32k reserved as drive space. Our own BASIC text files will then need to fit in whatever space remains. Ideally we'd have a RAM extension, either a PC-8406A 32K RAM pack or a PC-8407A 128K pack, in order to program something of a reasonable size. Still even without a RAM pack we can at least try out a number of BASIC flavors.

Both the versions of BASIC mentioned below are available from Gary J. Webes' excellent NEC PC-8201 support site WEB8201, where he holds a selection of software for the NEC PC-8401. NEC PC-8401. Check out the NEC 8401A / 8500 File Collection portion of the File Downloads page.

Microsoft BASIC

In the stakes to use the greatest amount of memory possible, Microsoft BASIC wins hands down. The last CPM version 5.29 will take up huge 23.4k of 'disk space' and when executed leaves a little over 1k of active memory on the PC-8401 to play around with. On the plus side, it's the version of BASIC that's the most familiar, and baring some commands unavailable in the CPM version, there are a wealth of examples laying around to learn from.

Unfortunately the size of MS BASIC makes it a non stater, it's more of a curiosity than something of practical usage. There are compilers available for MS BASIC, though a you still require libraries on the disk to run complied applications. Due to lack of disk space, compilation would need to be run on a host computer before moving the end product over to the PC-8401.


Luckily there are other options, ZBAS is quite a usable option only requiring 16.4k, leaving us with some room to write programs interactively, and some space to save these applications to disk.

Interestingly and extra fortunately when saving files, ZBAS tokenises BASIC Commands, much like on a 128k ZX Spectrum. Thus allowing for some larger than expected applications to be saved on our rather limited 'solid' state storage.

If your going to leave BASIC laying around on the System, then ZBAS is clearly the one to have.

Moving to Modern 'C' Developement

While there are plenty of period development platforms and languages available for CPM, including 'C's and Pascals, you'll need to run these in a emulated environment as there is no room on the PC-8401 for such niceties. A load of CPM software and utilities are available on the retroarchive, although none of these programs are specific to the PC-8401.


Perhaps the easiest way to pursue software development for a CPM machine and the PC-8401 today is via the use of Z88dk. Z88dk is a 'C' compiler targeting TRS80s, Commodore 128s, Sinclair ZX81s and just about any machine containing a Z80 processor. Specifically for out purposes there is a dedicated CPM library.

In order to test Z88DK out with the PC-8401 I borrowed from an older ZX81 program I wrote up some time ago, "ZX Roman Numeral-Izer". The program is a simple roman numeral format checker, it takes Roman numerals as an argument and then correctly formats them to the agreed standards (Standards that even the Romans didn't always adhere to). After a couple of minor changes to remove some specific ZX81 extensions and put in some specific PC-8401-isations the project compiled perfectly.

If you're interested then the full source is below, bit of a rush and there will be better ways to achieve the same result I'm sure, still proof of concept proven.

NEC PC-8401 Roman Numeral-iser Listing

// To Compile for CPM do as below.
// zcc +cpm -lm -o rome.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef enum { true = 0, false = !true } bool;

static short isaNumArab[7] = {1, 5, 10,50,100,500,1000};
static char csaNumRome[8] = "ivxlcdm";

// Function Get Arabic value of Roman Numeral
short GetArabValue(char csMyNumerals[15]){

 char csMyNumeral[2];
 char csNumRome[2];

 short iNumberNow = 0;
 short iNumberLast = 0;
 short iNumberTotal = 0;

 short iCount1 = 0;
 short iCount2 = 0;

 bool bTest = false;
 bool bNegative = false;

 //Go through sMyNumerals input string backwards for easier rule matching
 for (iCount1=strlen (csMyNumerals)-1; iCount1>=0; iCount1--){
  strncpy(csMyNumeral, csMyNumerals+(iCount1*1), 1);

  for (iCount2=0; iCount2<=strlen(csaNumRome)-1; iCount2++){
   strncpy(csNumRome, csaNumRome+(iCount2*1), 1);
   bTest = strnicmp(csMyNumeral, csNumRome,1);

   if (bTest == true){
    iNumberNow = isaNumArab[iCount2];

    if ((iNumberNow > iNumberLast) || ((iNumberNow == iNumberLast) && (bNegative == false))){
     iNumberTotal = iNumberTotal + iNumberNow;
     bNegative = false;
    } else {
     iNumberTotal = iNumberTotal - iNumberNow;
     bNegative = true;
   iNumberLast = iNumberNow;

 return iNumberTotal;

// Function Get Roman value of Arabic Numeral
void PrintRomeNumerals(int iMyNumberArab){
 char csNumRome[16];
 char csMyNumerals[16];
 char csMyNumeral[2];

 short iTemp[16];

 short iNumberNow;

 short iCount1 = 0;
 short iCount2 = 0;
 short iCount3 = 15;


 memset(iTemp, 0, sizeof(iTemp));

  strcpy(csNumRome,"Max Value 3999");
 } else {

  //Go through sMyNumerals input string backwards for easier rule matching

  for (iCount1=strlen(csMyNumerals)-1; iCount1>=0; iCount1--){

   strncpy(csMyNumeral, csMyNumerals+(iCount1*1), 1);
   iNumberNow = atoi(csMyNumeral);

   switch (iNumberNow) {
    case 1: case 2: case 3:
     for (iCount2=0;iCount2<iNumberNow;iCount2++){

      iTemp[iCount3] = csaNumRome[(strlen(csMyNumerals)-1)*2-iCount1*2];



    case 4:

      iTemp[iCount3] = csaNumRome[(strlen(csMyNumerals)-1)*2-iCount1*2+1];
      iTemp[iCount3-1] = csaNumRome[(strlen(csMyNumerals)-1)*2-iCount1*2];

    case 5: case 6: case 7: case 8:

     for (iCount2=0;iCount2<iNumberNow-5;iCount2++){

      iTemp[iCount3] = csaNumRome[(strlen(csMyNumerals)-1)*2-iCount1*2];
     iTemp[iCount3] = csaNumRome[(strlen(csMyNumerals)-1)*2-iCount1*2+1];

    case 9:

     iTemp[iCount3] = csaNumRome[(strlen(csMyNumerals)-1)*2-iCount1*2+2];
     iTemp[iCount3-1] = csaNumRome[(strlen(csMyNumerals)-1)*2-iCount1*2];


 printf("\n Correct Format: ");
 for (iCount2=0;iCount2<16;iCount2++){



void BannerLine(short iLength, char cCharter){
 short iCount1 = 0;
 for (iCount1=0; iCount1<iLength; iCount1++){

void BannerSet(void){
 short iCount1 = 0;
 printf( "\n PC-8401 Roman Numeral-iser\n" );


  printf("\n Numeral: %c = Numeric: %d",csaNumRome[iCount1],isaNumArab[iCount1]);
  if(iCount1 == strlen(csaNumRome)-1){


 printf("\n Roman Numeral Format Check\n");



short PressAnyKey(void){

 char chr;

 printf("\n Input Another Numeral? Y/N: ");
 chr = getchar();

 if(chr == 'n' || chr == 'N'){
  return 1;
 } else {
  return 0;


 char csMyNumerals[15];

 bool PressKey = true;

 char csMyNumberRome[15];
 int iMyNumberArab = 0;

 while( PressKey != false ) {


  printf("\n Roman Numerals: ");
  iMyNumberArab = GetArabValue(csMyNumerals);
  printf(" Numeric  Value: %d",iMyNumberArab);



  PressKey = PressAnyKey();


See RetroChallenge IntroPart 1Part_2Part 3Part 4, Part 5Part 6Part 7Part 8
Read More

Sunday, October 15, 2017

RetroChallenge 2017/10: Part 5

Leave a Comment

NEC PC-8401s' Capacitors & NiCd Sorted

Since discovering the leaky capacitors in the PC-8401s LCD module (last post, Part 4), I've replaced the problem components and the screen is now working without further issues. So, while had the main case opened I also decided to replace all the other potentially problem components and give the unit a good service.

I replaced all the capacitors with like for like values. The one exception being a 1200uf 25v, which is now a 1200uf 35v variety. The extra voltage level is not an issue, though the replacement capacitor is twice the length of the one it replaced, luckily there was space to lay it on it side.

The other remaining problem component was the 30 year old NiCd battery, which amazingly hadn't vomited it's guts all over the motherboard. The NiCd battery inside the PC-8401s is there to keep the DRAM and system clock ticking over should there be no main battery or indeed mains power. (No compact flash for 1985 user convenience).

1 Frand Super-Capacitor Battery Replacement

I decided to replace the battery with a 1 frand 5.5v super capacitor. I've previously made similar modifications to my Tandy M100 and M102 machines to good results, with RAM storage remaining intact for over a month before (until I got board waiting) I reapplied mains power. Similarly to the previous m100 modification, I bent the pins of the capacitor over horizontally before attaching wires which are the soldered on to the PCB. The capacitor itself is attached to the circuit board with double sided tape, keeping very firmly in place.

So next time it's back to doing something else arguably useful with a 30 year old computer.

See RetroChallenge IntroPart 1Part_2Part 3Part 4, Part 5Part 6Part 7Part 8
Read More

Wednesday, October 11, 2017

RetroChallenge 2017/10: Part 4

Leave a Comment

My NEC PC-8401s' LCD Module Faces Capacitor Issues

I'd noticed, well couldn't help noticing really that the PC-8401s' LCD screen would flicker, and every now again turn off unexpectedly after extended use. Over the last week the occurrences became more frequent. Interestingly or comfortingly the screen flickering has no effect on the Main Computer, everything stays resident, you can even continue typing while the screen is off. So what ever the problem? It is appeared localised to the LCD screen. Time to pry open the computer and see what's happening.

A quick look over the main board revealed nothing of immediate concern, though at some point I'll want to replace the NICAD backup battery and the 30 year old capacitors, thankfully though none of these components have been leaking. Semi confident the main board is okay it was time to crack open the LCD bezel, not the most convenient thing to do.

NEC PC-8401 Main Board

Unlike the main case the bezel is mostly held together with molded plastic clips, taking it apart took some considerable carefully spent time. Once off however it was immediately clear where the problem (hopefully the only problem) lay.

NEC PC-8401s' LCD Panel

We've got 2 exploded leaky electrolytic capacitors that need to be replacing, and while we're at it the other 10 should be swapped out for good measure. I guess considering the age of the computer this is not unexpected, all this is really part of the excitement of playing around with old hardware.

Some Picturesque Leaky Electrolytic Capacitors

Well then, before continuing any further it's of the the electronics supplier to procure some of these tiny caps, of which I have exactly none of in my parts draw.

As a quick aside the panel was manufactured by Epson.

Back view of the NEC PC-8401s' LCD Panel

See RetroChallenge IntroPart 1Part_2Part 3Part 4, Part 5Part 6Part 7Part 8

Read More

Sunday, October 08, 2017

RetroChallenge 2017/10: Part 3

Leave a Comment

NEC PC-8401's Software-To-Go on the Go

It's time try out some of the PC- 8401's inbuilt software. Ideally I'll be wanting to create files that are usable outside the NEC PC-8401 1980's bubble. The software included in ROM was all quite cabable for the time our NEC was realeased into the wild, we should be able to make use of it to some extent today.

There are four software packages provided in ROM:
  • Wordstar-To-Go: Micro Pro's word processing package, a portable version of the Wordstar. 
  • Calc-To-Go: Portable version of Calc Star, also by Micro Pro. 
  • Personal Filer: A flat file database program.
  • Telecom: Modem and Serial communication tools.

Of those, the two packages likely to be of most use in the modern context are Wordstar-To-Go and Telecom and I'll quickly look at those now. Telecom is arguably of most importance as it will be required to move files and additional software on and off the computer. The limited 64k of available RAM (32 for storage and 32 as active memory) makes Telecom a necessity if we plan on doing anything useful in the longer term.

Getting the files on and off with Telecom

The Telecom application is quite effective, and thankfully includes the XModem transfer protocol, making file transfers reliable. Connecting to a regular PC requires a USB to serial cable and a NULL modem cable. Nothing odd here, I used standard off the shelf parts.

PC-8401 and LINUX CuteCom Talking
For software on the modern LINUX computer I'm using CuteCom as it's a windowed terminal communication program, the command line based Minicom works just as well for this though.

I found the default Telecom configurations need some tweaking. The baud rate was best set to 1200 for plain ASCII file transfers and terminal emulation, else the buffer got full and text was lost. For XModem the baud rate value can be up to 19200 (with some issues), 9600 provides issue free transfers. Other than that I set Stop bits to 1, as is the default value for just about everything else out there. The configurations can be saved to memory, so once setup it's all good to go next time.

XModem transfers in both directions work perfectly, making the task of installing software and transferring other files a simple.

With a basic configuration setup all the networking capacity of 1985 is at our fingertips. If I want to take the PC-8401BM out on a field trip, or write up blog pages on the go, then we can rest easy knowing all that hard work is easily transfered back to a regular PC.

With basic communications configures it's time to look at using some of the built in productivity software.

NEC PC-8401BM Telecom Default Configuration
CONNECTIONRS-232CInternal Modem or RS-232C
PROTOCOLOFFON for modem7 / xmodem, OFF for ASCII transfers
SPEED9600150 - 19200 baud
WORD LENGTH87 or 8 bits per character
SI/SOONShift In/Shift Out sequence
STOP BITS21, 1.5 or 2/td>
PARITYNONO,EVEN,ODD,IGNORE. Ignore only effective when STOP BITS set to 8
PPS1010 or 20. Pulse Per Second, Used for modem dialing
LABELOFFON or OFF. Displays the Function key values
LF SUP.ONON or OFF. ON Suppresses LF codes ignored during uploads
LINE DELAY01 - 7. Delay ACK response.
PRINTOFFON or OFF. Echo session on a printer
SAVEOFFSave Telecom configuration on exit

Can we Wordstar-To-Go?

Wordstar may still be a perfectly usable as word processor, with one proviso, that we have some sort of document conversion utility. This is where we start running into problems on the modern PC side. It seems that we're now so far removed from Wordstars historical dominance in the marketplace that pre-existing conversion tools, even thoughs designed for 'newer' platforms are themselves so out of date emulation is required to run them. (I find this news a touch disturbing).

Over at the Way Back Machine (love that machine), the remains of the WordStar Resource Site provides downloads to various converters, Sadly, I've tried a number of the conversion utilities without any luck this far. They all specify conversion capabilities extending to DOS and Windows Wordstar files exclusively, so the PC-8401s Wordstar-To-Go files will need to undergo a CPM to DOS conversion first.

Failing conversion utilities, there are two other options available, both built into our trusty PC-8401. Firstly, Wordstar-To-Go can produce simple text files that need no conversion. This is the easiest option to use.

The second options is available during file transfers. When sending files with the Telecom package there is an option to convert Wordstar files to plain text. This produces a similar result to using plain text to start with, but not quite. Conversion ignores continuous paragraphs, so what appears to be the end of a line in a Wordstar file (lines are by default 65 character long) is the end of a line, meaning all paragraphs would have to reformatted to be contiguous. Note that Wordstar itself treats paragraphs the same way. The text will appear  exactly as formatted on screen in Wordstar, minus control characters and .dot commands.

The best explanation is a simple example, below are three version of the same file. The text was justified in the Wordstar formatted files.

RAW Wordstar File: 
Thå  quicë  browî dingï jumpeä oveò thå lazù  fox®  Thå  kangaroï 
jumped over the dingo.

No animals were harmed in the above test sentence.

Wordstar File with Special Characters Removed During File Transfer
The  quick  brown dingo jumped over the lazy  fox.  The  kangaroo 
jumped over the dingo.

No animals were harmed in the above test sentence.

 Plain Text File
The quick brown dingo jumped over the lazy fox. The kangaroo jumped over the dingo.

No animals were harmed in the above test sentence.

So is Wordstar on the PC-8401 still usable in the modern context? Yes, but with some serious limitations for the time being. There would be an interesting RetroChallenge project in writing a decent conversion utility.

See RetroChallenge IntroPart 1Part_2Part 3Part 4, Part 5Part 6Part 7Part 8
Read More

Monday, October 02, 2017

RetroChallenge 2017/10: Part 2


An NEC PC-8401 Quick Guide Book for the Internet Archive

As we know from the previous blog entry, there was absolutely no documentation on the NEC PC-8401BM contained within the Internet Archive. Today I thought it might be a good idea to start addressing this situation.

PC-8401BM Manuals
I have in my possession the 4 Australian Manuals and the Quick Start Guide originally packaged with the PC-8401BM. The easiest of these to scan and make available to the Archive is the Quick Start Guide, this being the only book conveniently with a ring style binding. So naturally I've started here.

Being in a spiral binder the pages were easy to remove, this has allowed for quite a nice scan overall. The other manuals however are going to be slightly more of a challenge to pull clean copies from. So after an hour or so plus some cleaning up time, I'm happy to report the Quick Start Guide is now available to all those who seek it's wisdom.

I should say the Guide is mostly available, there are unfortunately 2 pages missing, pages 34 and 35. These pages should form the first part of the Calc-To-Go section in the book. Not the best of situations, still the rest of the book is complete and pretty much gives all the information the casual PC-8401BM user is likely to require.

I'm not quite sure on the best way to proceed in scanning the remaining books. All the manuals are in exceptional condition, as such I don't wish to ruin them by either pressing the books to firmly against the scanner and cracking the spines, or indeed by removing the spines. It certainly would be handy to have access to a book scanner. (If anybody out there is feeling generous, please send your best book scanner free of charge ASAP).

As a bonus, I thought I'd clean up one of the pull out / fold down sections of the Guide illustrating the many extended devices NEC produced to dock and otherwise attach to the PC-8401BM. These include Data Recorders, Disk Drives, RAM Cartridges and CRT / Monitor adapters. The product codes of all these items is conveniently listed. For those interested in acquiring computer extensions today, the NEC product codes it could well make Ebay and Craigslist searches a little easier (you could try NEC directly in some sort of vain last hope of course).

The PC-8401BM Connection of Peripherals fold out, because everybody loves a good diagram.

The Guide Book is now avaliable and indexed at the Internet Archive:

See RetroChallenge IntroPart 1Part_2Part 3Part 4, Part 5Part 6Part 7Part 8
Read More

Sunday, October 01, 2017

RetroChallenge 2017/10: Part 1

1 comment

The NEC PC-8401 a Starlet in the Press?

NEC PC-8401A Review in Creative Computing Magazine
The NEC PC-8401, AKA the Starlet premiered at the November 1984 Comdex show, a year after the Tandy Model 100 made its splash. (As an aside, glimpse the Model 100 at the 1983 show in this remarkable footage). The rise of the portable computing has begun, and a new world order soon to be dominated by IBM compatibility is starting to play out. Where does our little NEC offering fit in?

Unfortunately for us, there are scant references to the PC-8401BM in its contemporary computer press, or so it would appear by the lack of articles available on the internet archive. This is a trend that continues, even against the current rise of 'retro' computing within the global consciousness. The 1984 Comex appearance of the PC-8401 is however noted in Infoworld 1984-12-17 magazine.

That the PC-8401 lacks a perceptible public success may not accurately indicate it market penetration, particularly considering its main reason for being was to serve a business oriented market. It is therefore not so unsurprising that hobbyists of the period may have ignored the PC-8401 as expensive business machine, with that the business positioning still limiting any appeal for today's retro collectors or enthusiast.

The only extensive review of the PC-8401 from the time period available over at the Internet Archive is a write up in the March 1985 issue of Creative Computing Magazine by David H Ahl's. The review is based around the model PC-8401A not the PC-8401BM which I'll be using over the course of the RetroChallenge.

Overall the Creative Computing review is a positive one, with the only major criticism levelled at the small display area on the Model 8401A, an issue addressed on the 8401BM. The included software, built into the machines ROMS is noted favourably, Wordstar-To-Go which is found to lacking in some of features available in the desktop version, a minor let down and scores only reluctant approval.

Interestingly what we could surmise as the reasons behind the failure of the 8401 to enter the popular consciousness are highlighted at the end of the Creative Computing article. Firstly NECs failure to include BASIC in ROM at once precludes the machine from hobbyist usage. While the lack of programming languages provided by default on computers today is a non-issue, in 1984 this was often the pathway for home hackers to explore a computers capacities. Secondly, and more interestingly it seems NEC had a less than stellar marketing division (at least outside of Japan).

In retrospect, NEC should possibly have paid close attention to Creative Computing closing summary, as now the trail and magazine reviews go cold. There are of course many gaps in the Internet Archives collection of 80s computer magazines, even so the range of coverage still available and the lack of NEC PC8401 mentions in them would seem to confirm David H Ahl's concerns.

Luckily the target business market did procure and use enough PC-8401s that they haven't all gone to landfill, and somehow a PC-8401BM even managed to keep it's manuals intact, make its way to me and so we'll have something more to examine for the month long RetroChallenge.

The rather colourful NEC PC-8401BM User Guides.

See RetroChallenge IntroPart 1Part_2Part 3Part 4, Part 5Part 6Part 7Part 8
Read More