Sunday, November 19, 2017

The Sinclair ZX–Micro Computer: System Variables Comparison Chart

Leave a Comment
Sometimes when you've written an application for the ZX81 or ZX Spectrum you wish to port it to the other, or even back to the ZX80. Sometimes you've used a system variables and you need an easy reference chart to look up correct system address on the target system and move on. But you say, there is no chart, or there was no chart until now.

I got tired of looking through the manuals every time I need to check some System Variable values and decided to just put them all in a chart. Hopefully you might find it similarly useful. A PNG graphic is available below, and if preferred a PDF version can be downloaded.

If anybody notices some glaring or even slightly disturbing error, let me know and I get them ironed out and fixed up.


One final thought, It's quite interesting to see just how many changes were made to the ZX line of computers in the space of 3 or 4 years. There are the obvious physical differences of course, then there are changes witnessed in the System Variables above.

Read More

Wednesday, November 01, 2017

RetroChallenge 2017/10: Part 8

Leave a Comment

Keyboards Down on the NEC PC-8401 Challenge.



Sadly it's time to put the keyboard away on the RetroChallenge for October, but not before a quick summary. And did I mention the keyboard yet, it would be remiss to not to.

The PC-8401 has a truly wonderful keyboard, seriously it's a beauty. It seems that particular computer I ended up with has seen very minimal usage. The Alps SKFL series switches are in a fantastic condition, there is no grainy or worn out feel you'd associate with a 40 year old board. The keys themselves are double shot and feel very firm to type on. It would be nice if you could such a keyboard on a laptop today.

Some Closing Thoughts


I think I got to know the PC-PC8401 quite well over the past months activities, with the device proving to be quite a sturdy piece of kit and generally fun to work with. I've still got some more to do though, the big one being the scanning of the remaining manuals for the Internet archive.

Way back at the start I looked what the reviewers has to say on the NEC-PC8401, the major take away criticism being the neglect-ion to include BASIC in ROM. After playing around with the computer over the past month, that point is still a valid one, and hampers the retro usability of the machine, mostly due to memory constraints of adding BASIC to RAM.

Regardless of the above minor issue, the PC-8401 is a fun little device and it'll continue to sit on my desk and or lap for a while to come. I'm looking forward to finding some good uses for it outside the time constraints of the RetroChallenge and I'm certainly going to plan some future projects around it the  PC-840.

That's it for RetroChallange 2017/10, thanks to all involved and particularly to all the other projects, it maks very varied and fun experiance. Now it's back to our regular non-programed blogging experience.


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


Read More

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:
sx my_file.com

To receive files from the PC-8401
rx my_file.com

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

2 comments

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.


ZBAS


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.



Z88DK


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.com 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);
  csMyNumeral[1]='\0';

  for (iCount2=0; iCount2<=strlen(csaNumRome)-1; iCount2++){
   strncpy(csNumRome, csaNumRome+(iCount2*1), 1);
   csNumRome[1]='\0';
   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(csNumRome,0,strlen(csNumRome));

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

 if(iMyNumberArab>=4000){
  strcpy(csNumRome,"Max Value 3999");
 } else {

  itoa(iMyNumberArab,csMyNumerals,10);
  //csMyNumerals[15]='\0';
  //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];

      iCount3--;
     }

    break;

    case 4:

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

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

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

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

    case 9:

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

  }
 }

 printf("\n Correct Format: ");
 for (iCount2=0;iCount2<16;iCount2++){
  if(iTemp[iCount2]!=0){
   printf("%c",iTemp[iCount2]);
  }

 }
 printf("\n");

 return;
}


void BannerLine(short iLength, char cCharter){
 short iCount1 = 0;
 for (iCount1=0; iCount1<iLength; iCount1++){
   printf("%c",cCharter);
 }
}


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

 for(iCount1=0;iCount1<=strlen(csaNumRome)-1;iCount1++){

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

 BannerLine(32,149);

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

 BannerLine(32,149);

}


short PressAnyKey(void){

 char chr;

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

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


main(void)
{

 char csMyNumerals[15];

 bool PressKey = true;

 char csMyNumberRome[15];
 int iMyNumberArab = 0;

 while( PressKey != false ) {

  BannerSet();

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

  PrintRomeNumerals(iMyNumberArab);

  memset(csMyNumerals,0,strlen(csMyNumerals));
  memset(csMyNumberRome,0,strlen(csMyNumberRome));

  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
OPTIONDEFAULTDISCRIPTION
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
XON/XOFFONON or OFF
ECHOOFFON or OFF
CHAR WRAPONON or OFF
NEW LINEOFFON or OFF
PPS1010 or 20. Pulse Per Second, Used for modem dialing
LABELOFFON or OFF. Displays the Function key values
DEL CODE7F7FH (DEL) or 08H (BS)
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

5 comments

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: https://archive.org/details/NecPortableComputerPc-8401bmQuickGuide


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

Friday, September 29, 2017

RetroChallenge 2017/10: Getting to know the NEC PC-8401BM

Leave a Comment
It's almost time for RetroChallenge 2017/10, a month long opportunity to focus in on a single project, share and document your activities and finally share the results with the wider retro community. This sounded like a good excuse for some retro adventure, so I've thrown my hat into the ring and decided to spend the time focusing in on the portable 'powerhouse' that is the NEC PC-8401BM.

Portable computer out in the wild
My NEC PC-8401BM in the wilderness, Compute anywhere with 1985 style.

Strangely there is very little information on the inter-tubes about the NEC PC-8401BM, AKA the NEC PC-8401A and AKA NEC Starlet. As luck would have it one has fallen into my lap very recently, and just in time for the Retrochallenge.

During October I'll explore this tidy 'little' laptop styled machine, examin the available online articles, work through the machines manuals and generally explore how this computer can be used today, practically or otherwise.

Exact outcome unknown, we'll end up where curiosity takes us.


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

Sunday, September 24, 2017

The TRS-80 Model 100 MyTeSed is Alive

2 comments
After a bit of a wait the MyTeSed for the TSR-80 Model 100 enters the construction stage. A simple SD card reader is in sight, though not until a few challenges are met. Mostly the build went smoothly, mostly being down to one misguided assumption in turn inducing lot of time spent waiting.

TRS-80 Model 100 and a Model 102 with SD Card Reader Interfaces
Two MyTeSeds, one attached to a Model 102 and the other connected a Model 100

This is the first time I've had PCBs produced by a fabrication house, for every other project I've made them myself. The end result is a really impressed impressive sight, and the quality is quite amazing. The quality of the PCB lends a certain confidence to the endeavour of populating it.

Construction started out quite simply, first mounting all the loose components onto the PCB. A snag to the master plan appeared when it came time to mount the SD card module. I'd soldered some header pins to the PCB and added a couple of layered of doubled sided tape to hold the module firmly. The header pins I would very soon have to remove again.

I had assumed I'd be able to de-solder the right angled header pins from the micro SD module and then attach the module to the pins I'd soldered onto the main PCB. This of course turned out to be a very bad idea, leading ultimately to the complete destruction of a module. It seems the modules PCBs just aren't up to that kind of meddling. The lesson here I suppose is to never assume anything will work quite as planned.

My misguided assumption cost me a couple of weeks, I only had the one SD module to break, I found myself needing toprocure some more modules from China, leaving me floundering before proceeding any further. Oh well, live and learn.

A little wiser and with some new modules in hand, the easiest solution to my problem was to attach some cutoffs to the bottom of of an SD card module and then solder those into the PCB mounting holes as originally intended. I'd probably choose to mount the modules in the same way next time around as it worked near enough to originally planned.


I'd sensibly procured a number of spare SD modules, so decided to build up a second MyTeSed, allowing me to make one very minor change. The first build used a full length 26 pin IDC socket, this really isn't needed as there are only 3 pins in use, from pin 1 to 3 (GND,TX and RX). I switched to a 10 pin IDC socket, this makes the IDC cable a lot easier to construct, a lot easier to connect, easier to move around and ever so slightly cheaper to build (if a few cents are of concern).

Lastly I mounted the Arduino Nanos, I chose to solder the first Nano directly to the initial PCB build, on the second board I mounted on a couple of pin sockets first. This second option is the recommended choice if planning to re-use the Nanos' in other projects, though I figured I'll have at least one of these SD readers around for some time to come.

 The good news is that after all the waiting for parts the end result worked as expected. The only really major component of the initial project left to sort out is software, again as I'd managed to kill the original SD module I had nothing to test with until I got to this point. I've subsequently had some time move forwardon that, which will form the basis of the next post.

2 Versions of the TRS-80 Model 100 SD Card Reader Interface the MyTeSed.
The two versions of the MyTeSed, the first build with full 26 pin IDC cable (9v and battery attached)

Read More

Thursday, August 17, 2017

Model 100 micro SD Card reader, the MyTeSed

7 comments
After the initial testing with a full sized SD card reader shield and Ardunio Uno, I wanted to know how easy it would be to shrink the TRS-80 Model 100 SD card interfaces size down to something a little more acceptable. I thought about building the whole design from the ground up, in the end the abundance of cheap modules from China can't be beaten on price (or convenience).

Before getting into the excitement of the details, the other major half of the fun of building these projects is naming them, so I'm calling this interface the 'MyTeSed', standing for My Model 'T' Serial Drive. Now that out of the way, on with where I'm up to with the project to date.

Testing the functionality of the MyTeSed on a Breadboard 

The Hardware


I've gone with a Arduino Nano for the heart of the project, the footprint of the Nano is barely larger than a atmega328p chip and far smaller if including the ancillary components. The Nano also nicely takes care of power regulation, has a USB port for easy re-programming, and behaves identically to a Uno. Thus making the Nano one of the most inclusive of the reduced sized Arduinos' to use.

Micro SD Card Reader Module
The revised hardware also substitutes the full sized SD card shield with an all in one micro USB card module. The SD module accommodates either 5v or 3.3v signals, making it an ideal choice for use with the Nano. It's a standard module avaliable from just about anywhere, including Ebay and various online Chinese merchants of all things electronica.

After a little experimentation I've also decided to set up software serial on pins D8 and D9 of the Nano. Using software serial as the conduit to the T100 / T102 / T200 leaves the Nanos' standard serial pins D1 and D2 free to use as a pass-through (actually via the Nanos' USB) which will be used as direct connections to a PC. As in the previous version (blog entry Using SD Cards with the TRS-80 Model 100) a MAX323 IC handles the RS232 to TTL serial conversion.

The when complete the MyTeSeD can be powered from a 6v to 9v battery supply (like most Arduino projects), in addition usage of the Nano conveniently provides a means to power the interface via the mini USB port, allowing battery packs or a USB power source etc.


MyTeSed Circuit Diagram

Arduino Code


This is not by any measure the final code to be using with the interface, for the moment it serves as proof of concept. I'm still yet to go back a write up a more permanent solution, it does however work for now, just expect some drastic changes for the foreseeable future.

In essence the current idea is for MyTeSed to listen for instructions in plain text over the serial line, 'LOAD' and 'SAVE' for example, then either send data back or shift files around on the SD card. Regardless there is a lot left to implement, such as file deletion, access to directories and error checking.
// **************************************************************************
// **** MyTeSed: T100 SD Card Reader for Arduino Nano and SD Card Reader ****
// **************************************************************************
// ** David Stephenson 2017-08-23  **
// ** Version 0.01                 **
// **********************************
#include <SPI.h>
#include <SD.h>
#include <SoftwareSerial.h>

enum SERIAL_MODE {FREE, COMMAND, DATA_IN, DATA_OUT, FILES_OUT};

const byte LF=10;
const byte CR=13;
const byte EF=26;

SoftwareSerial mySerial(12, 13); // RX, TX

class CardReader {
 private:
  SERIAL_MODE eSerialMode = FREE;
  //DRIVE_COMMAND eDriveMode = NONE;

  File MyFile;
  
  String sFileName;
  String sInString;
  
  unsigned long TimeLastUpdate = 0;
  
  // Class Private Functions
  void LoadBas() {
   
   char cRead, cLast;

   if(eSerialMode == DATA_OUT){
    MyFile = SD.open(sFileName);

    if(MyFile){
     while(MyFile.available()){
      cRead=MyFile.read();
      if (cRead== LF){
       if (cLast != CR){
        mySerial.write(CR);
       }
       mySerial.write(LF);
      } else {
       mySerial.write(cRead);
       cLast = cRead;
      }
     }
    }
    MyFile.close();
    mySerial.write(EF);
    eSerialMode = FREE;
   }
  }

  void SaveBas(char cInChar) {
   
   if(eSerialMode == DATA_IN){
    if(cInChar != EF){
     MyFile.print(cInChar);
    } else { 
     MyFile.close();
     eSerialMode = FREE;
    }
   }  
  }
  
  void FilesOut() {
   
  }
  
  
  void commandIn(){
   String KEYWORDS[7] = {"LOAD","SAVE","KILL","FILES","MOVE","CP2SD","CP2R"};
   String sInSubString;

   sInString.trim();

   Serial.print(sInString);

   if (sInString.length() >= 3){
    for (byte bKeyword = 0 ; bKeyword < 8 ; bKeyword++){
     sInSubString = sInString.substring(0,KEYWORDS[bKeyword].length() );
     sInSubString.toUpperCase();
     if (sInSubString.indexOf(KEYWORDS[bKeyword])!=-1){
      if (KEYWORDS[bKeyword] == "LOAD") {
       sFileName = sInString.substring(4);
       sFileName.trim();
       delay(500);
       eSerialMode = DATA_OUT;
       LoadBas();
      }

      else if (KEYWORDS[bKeyword] == "SAVE" || KEYWORDS[bKeyword] == "CP2D") {
       sFileName = sInString.substring(4);
       sFileName.trim();
       if (SD.exists(sFileName)) {
        SD.remove(sFileName);
       }
       MyFile = SD.open(sFileName, FILE_WRITE);
       eSerialMode = DATA_IN;
      }
      
      else if (KEYWORDS[bKeyword] == "FILES") {
       eSerialMode = FILES_OUT;
       FilesOut();
      }
     }
    }
   }

   //sInCommand = false;
   sInString = "";
   
  }
 
 public:
 
 void SerialIn(char cInChar){
  switch(eSerialMode) {
   case FREE:
    if(cInChar == CR){
     eSerialMode = COMMAND;
     commandIn();
    } else {
     sInString += cInChar;
    }
    break;
   case DATA_IN:
     SaveBas(cInChar);
    break;
  }
 }

};

CardReader MyCard;

void setup()

{
  // Open serial communications and wait for port to open:
  Serial.begin(1200);
    //57I1D
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  // set the data rate for the SoftwareSerial port
  mySerial.begin(1200);

  if(!SD.begin(10)){
   mySerial.println("fail");
    return;
  } else {
 mySerial.println("mango");
 Serial.println("mangos");
  }
}



void loop()
{
 char cInChar;
 if (mySerial.available()) {
  cInChar = (char)mySerial.read();
  //sInString += cInChar;
  MyCard.SerialIn(cInChar);
  Serial.write(cInChar);
 }
}

Talking With a Model 100


Saving, loading and copying files from the micro SD card requires first sending a command and a filename to the serial port, then engaging the normal BASIC save / load to serial command. The COM port should be set to 1200 Baud, 7 Bit Word length, Ignore parity.

For example, saving the active BASIC file:
OPEN "COM:57I1D" FOR OUTPUT AS 1: PRINT #1,"SAVE MYFILE.BA": CLOSE 1: SAVE "COM:57I1D"

Or loading a BASIC file from the Interface:
OPEN "COM:57I1D" FOR OUTPUT AS 1: PRINT #1,"LOAD MYFILE.BA": CLOSE 1: LOAD "COM:57I1D"

Possibly the easiest method to save or load  BASIC program is to add some of the below lines to a program listings. Alternatively an option once the code base is a little more on the stable side would be the development of a menu-ing  system, but that's for latter.

Save a BASIC file to SD Card

900 OPEN "COM:57I1D" FOR OUTPUT AS 1
910 PRINT #1,"save testme.ba"
920 CLOSE 1
930 SAVE "COM:57I1D"

Load BASIC file to SD Card

10 OPEN "COM:57I1D" FOR OUTPUT AS 1
20 PRINT #1,"load testme.ba"
30 CLOSE 1
40 LOAD "COM:57I1D"

Copy a RAM Text File to the SD Card

10 MAXFILES=2
20 OPEN "RAM:TXT2RD.DO" FOR INPUT AS 1
30 OPEN "COM:57I1D" FOR OUTPUT AS 2
40 PRINT #2, "SAVE TXTFIL.DO"
50 LINE INPUT #1, Z$
60 PRINT #2,Z$
70 IF EOF(1) THEN GOTO 90
80 GOTO 50
90 PRINT #2, CHR$(26)
100 CLOSE 1: CLOSE 2

Copy a File from the SD Card to a RAM Text File

10 MAXFILES=2
20 OPEN "RAM:TXT2RD.DO" FOR OUTPUT AS 1
30 OPEN "COM:57I1D" FOR OUTPUT AS 2
40 PRINT #2, "LOAD TXTFIL.DO"
50 LINE INPUT #2, Z$
60 PRINT #1,Z$
70 IF EOF(1) THEN GOTO 90
80 GOTO 50
90 PRINT #1, CHR$(26)
100 CLOSE 1: CLOSE 2

Next Time


The next stage of proceedings is to design a circuit board, should be a simple enough task. Unlike all the other projects in this blog I'm planning on getting the PCB produced by a fabrication house, and hopefully all that will go well.


Read More

Monday, August 14, 2017

ZX81 Video Monitor Perfection?

3 comments
A while ago now I fitted the very cool and reasonably priced ZXCCB composite video mod into a ZX81, yielding a much improved video experience, yet this is only half the story in the quest for retro ZX81 video perfection.

There is many a web page or YouTube video devoted to video outputs on retro computers and gaming consoles. Mostly these deal with the somewhat later computing or console incarnations such as the Sega Mega Drive, Nintendo NES or Commodore 64s. There are some excellent write ups on the subject, and you can't go past RetroRGB.com for some solid information well beyond the scope of this article. The ZX81s video demands though are rather less unassuming than most, requiring only the display of a (hopefully) clear black and white image.

What kind of perfection are we after? I say video perfection, this is a perhaps a little misleading, as what I'm really after is a video experience, an experience that captures the heart of ZX81 usage. This is of course a rather esoteric requirement, if perhaps partially at the heart of using the real deal instead of a emulator to start with.

Below are some of the variations on a theme I've tried, this is not an extensive list of every possible configuration available. So this is not a guide, more of a primer before launching your own quest down the rabbit hole of ZX81 monitor selection.


To CRT or LCD?


Back in the 80s the best monitor for a stock ZX81 was a black and white television. The perfect monitor for a ZX81 with a composite mod in 2017 is probably a black and white monitor with composite inputs. Simply put, the ZX81 does not output a chomiance (colour) signal, only a luminance (black and white) signal, any colour induced into the picture is by pure accident. There are not a great deal of black and white monitors available these days, so what easily available monitor options are available in 2017 and beyond?

There are a whole host of options available these days, from old CRTs to video converter boxes and new LCD televisions. The choice is only limited user preferences and in some cases by the constraints of the ZX81s video signal and it's interaction with modern devices. My personal preference varies, on the whole though I'm rather taken by Sony Broadcast monitors as these induce that all important retro feeling.


Option 1: An LCD TV


ZX81 with LCD television as monitor.
Most (I'm not going to say all as there are weird regional variances) LCD TVs still have Composite video ports. The ZXCCB video mod, the ZXVid and others, are designed to take full advantage of the Composite inputs, outputting a stable and clear image to modern LCD TVs. Frankly the clarity of the ZX81s output on a decent TV is astounding, even on low rent LCD TVs the image quality is far sharper anything you've ever experienced on an unmodified ZX81.

At this point, If you're happy with LCD displays you can stop right here, your never going to get a clearer display out of a ZX81, still there are minor issues with the display, and your personal preferences play a part in the ultimate monitor selection.

It's difficult to find an LCD TV with a 4:3 aspect ratio, meaning that text and therefor the underlying pixels are always going to look elongated. This may or many not be a worry, certainly the enhanced video quality more than makes up for the distortion.  Then again anyone after retro video purity may well take some offence at lack of near squareness in the aspect ratio. Of course an LCD monitor may already fall into the abyss of impure horrors for those with high retro tastes.

I have found that some LCD televisions play up a little when loading tape, loading from the ZXpand or going into fast mode. Anytime the Sync signal is dropped by the ZX81 an LCD televisions may revert to a blue or black screen momentarily, where most CRT monitors will retain the greyish background or display the loading bars normally associated with a ZX81.


Option 2: The CRT Colour TV


Late model TV with the ZX81 using RF out.
The best part about these is that they are (at the time of writing) cheap, though a slowly disappearing resource. I was lucky enough to find a late model 32cm (14inch) xxxx on the side of the road a couple of months ago, I was initially quite happy about that. I say initially as while the general image clarity falls in the okay-ish zone, the refresh rate on the monitor is headache inducing.

Refresh rate is probably misleading here as technically speaking all PAL TVs and monitors are refreshed at 50htz. This may really be a phosphor persistence rating problem. The rating of particular coating thi inside particular model seems to be just high enough to mostly maintain an image between refresh cycles. Doubtlessly this is not the only reason for this units headache producing flaws.

On the positive side, the TV has AV inputs for a very clear image, though more interestingly it also has no issues in picking up a ZX81s RF signal, producing one of the clearest images I think I've ever seen RF wise. So if you're not keen on modifying a ZX81 for composite out a late model CRT TV might be the best video output option.

Regardless of the positives, using a standard TV as a computer monitor in 2017 is just plain awful, even if you're after that retro CRT experience. Sitting up close to a standard flickering television is underwhelming, did we really do this 30 years ago?


Option 3: A Professional / Broadcast CRT Video Monitors


Sony 9inch PVMs
Broadcast and Professional monitors are without doubt one of the better go ways to go if you're after an old school CRT feel without compromising high legibility. These monitors are designed for people who's job it is to make, view and breath Television 24 x 7, so the clarity gained, particularly from the high end editions of these monitors is breath taking for CRT.

Presently being discarded by the TV industry, PVMs and BVMs are highly coveted by many a serious retro gamer. Sought after PVMs are typically 20 inches plus, with extensive features including Composite, S-Video, RGB and YCbCr inputs. All this providing an expansive, high quality retro gaming experience suitable for most retro consoles. Of course a ZX81 in no way needs all the higher end features, we're just after a clear picture.

A ZX81 isn't going to be used from the couch or armchair, most likely it'll be desk based, so clarity is probably the foremost factor in choosing the monitor. Sizes over 14 inches aren't going to add much to experience, and RGB and YCbCr are nice to haves but not important unless using you're also planning on using the monitor with more advanced micros.

Nicely I have 2 Sony PVM monitors, a PVM-9040ME a PAL only monitor that has S-Video and Composite ports and a PVM-9042QM monitor with a full spectrum of video inputs available. Both monitors have screen sizes of 9inchs, a small size by today's standards but not so tiny by the standards of the day. These monitors provide a beautiful viewing experience.


Option 4: Video Upscalers and Converter Boxes


Given the vast supply of LCD VGA and HDMI monitors in circulation, video converter boxes seem like an obvious usage case. But, and this is a big but, not all converters are created equal. Finding a converter box that worked with my ZX81 has proven problematic at best, though individual mileage may vary considerably.

The ZX81s video output, even with a ZXCCB installed is dependent on the version of ULA inside. While the signal can be corrected for missing back porch, the underlay signal generation may not be exactly to PAL standards. I'm not am expert on the subject, but given the lack lustre results using various converter boxes which for all intensive purposes work fine other conversion duties I'd guess this is the cause of the problems I've encountered.

The best converter box I've found is a rather ancient one, an Aver Media TV Box 5. It's unfortunate that the maximum resolution this will pump out is 1024x800, somewhat below the capabilities current generation LCD VGA monitors. For this the TV Box suffers a little, as monitors perform best at their own native resolutions and the resulting image is just a touch blurry. Of course that does feel a little more retro.

I've put up a little video that highlights the problems or successes of various converter boxes at my disposal. The best I can say is buy one at your own risk, and at the end of the day a cheap LCD television seems by far a better option.




What is Monitor Perfection?


The choice of monitor really comes down to personal preferences. If after a clean and sharp emulator like quality, I've found even the least expensive LCD television is capable of delivering a stunning image (for a ZX81). For a that fuzzy feel good retro experience my preference falls defiantly in favour of PVMs and other broadcast monitors. Just remember that most of these video options are only available once the ZX81 is fitted with a composite modification such as the ZXCCB or ZXVid, both of which are regularly obtainable from the Sell My Retro web site.
Read More

Thursday, June 22, 2017

Using SD Cards with the TRS-80 Model 100

2 comments
Most retro-computers have some form of SD or Compact Flash storage options available these days. The TRS-80 Model 100, Tandy 102 and Tandy 200 were no exception, and these micros had such a device not so long ago, the NADSBox. Most unfortunately it appears the NADSBox can no longer be sourced. So what to do now? Well build my own, very cut-down version I suppose is the obvious answer.


Loading files into the Model 100


As an 80's portable computer with limited native storage, the Model 100 came with some nice features for file transfers built right into the standard ROM and hardware. These features allowed for connecting tape drives, a modem, or better for modern needs, a serial RS232 port for computer to computer transfers. The built in TELCOM package allows for some easy ways to transfers files, and nicer still, the built in BASIC also makes it quite easy to load programs directly from the serial port. So all that needs to be done (of course it'll all get much harder later) is to tap into the 100s native abilities and throw some files back and forth over the serial lines.

To start some hardware is needed for some initial testing, I used a Arduino UNO, an SD Card Shield and a MAX232 IC. The MAX232 is required to convert RS232 level signals to TTL serial suitable for interfacing with the Arduino board. There is not much to it, all that needs to be done is to connect the Arduinos TTL lines to the serial port on the Model 100 via the MAX232. There are a load of examples for wiring up the MAX232, this guide at StackExchange is the one I quickly referred to.

On the software side I wrote up a quick program for the Arduino to send some files from an SD card to the Model 100 (Note the SD and SP Atduino libraries are required). The Ardunio waits for the Model 100 to request a transfer and will then upload a file. On the Model 100 side of things a couple of lines of BASIC is need to first OPEN the COM port, send a request, then download / run the files sent by the Arduino.


In the tests I found a baud rate of 1200 is about the best that can be expected when loading BASIC files via the serial connection. The Model 100 tokenises the text being loaded directly into BASIC, and faster baud rates give errors during this process, I guess there is only so much a 2.4 MHz 80C85 CPU can handle.

Content that the serial SD card loading was quite successful, I'll move along with this project further and see how far I can get with it.
Read More

Saturday, June 10, 2017

USB Mouse For The ZX81 And ZXpand (Part 2)

Leave a Comment
It's been a while since the first part of this article, some exciting developments happened to the ZXpand in between and I wanted to test the interfaces functionality out on the brand new ZXpand+ hardware before posting. I've also given the interface a little moniker, "ZeaMouse". Anyway, enough fluffing around, down to the specifics.

As previously mentioned (in Part 1: USB Mouse For The ZX81 And ZXpand), the USB mouse interface relies on normal Atari digital joystick inputs as found on the ZXpand. Since that time, Charlie Robson unleashed the new ZXpand+ into the ZX81 world. With this comes some potential options, in particular a TTL serial port has been included on the ZXpand+ IDC header, this may be of use for sending proportional mouse data, promising true mouse functionality.

For now though, the Mouse interface maintains full compatibility with the original ZXpand while also making allowances for serial connection to the ZXpand+, connections  that will be used at a later date. Of note for those intending to use the interface on other Micro computers, the serial tracks on the ZeaMouse interfaces IDC header may need to be cut (or removed) in order to avoid potential damage to that Micro or the Interface itself.

ZeaMouse Firmware


Some things end up being a lot less complicated than you'd imagined they would be. The coding behind reading the mouse and passing directions to the ZXpands digital joystick port was one of those things. That's definitely a credit to those behind the USB host shield.

There is nothing overly complex in the code. Mouse movement tracked by time, if XY mouse movement is detected the appropriate joystick pin is set to OUTPUT, a debounce timeout then set to 15, milliseconds providing enough time for a 'button press' to be registered by the ZXpand. While mouse movement continues in the same direction the debounce timings are updated. Mouse button 1 and 2 are both setup to work as a standard joystick button press.

A regular Atari Joystick can be attached to the semi-pass-though port. Joystick movement is given priority and should override incidental mouse movements while using a joystick. The exception to this is where a mouse button is pressed as tracking mouse presses relies on the button being released again to clear the OUTPUT.

A large scope exists for future additions to the code. Provisions for USB joysticks and keyboards (with limited functionality) could also be added with some extra effort. As it is possible to attach the USB shield to a USB hub, allowances for multiple devices to be connected at the same time could also be made. Depending on updates to the ZXpand+ itself, and how the TTL serial lines are read, all manner of interfacing options could become available.

The Arduino Code Files can be found here: ZeaMouse_Arduino.tar.gz

ZeaMouse plugged into the ZXpand+ using a (delightful rainbow (thanks Charlie)) IDC cable, with USB mouse and Digital Joystick connected.


Programing the ATmega328P  / Arduino


Ideally it's easiest to purchase an ATmega328P IC with the Arduino boot loader pre-installed, these can be sourced quite easily. I recommend purchasing a kit that comes with the required crystal, such as this kit from Jaycar: ATMEGA328P MCU IC with Arduino UNO Bootloader and 16MHz Crystal (or a cheaper version from your favourite Chinese supplier).

The ATmega328P chip (with boot loader) will require sketch / code / firmware, this must be programmed outside of the USB joystick interface. To do this an Arduino UNO can be used, simply swap out the existing IC in the UNO, insert and program the new one, then transferring that to the interface.

Required Components


All components should be easily obtainable, there is nothing remotely exotic required to build the ZeaMouse. In addition to the construction components listed in the Main Contruction Shopping List, you will also need a USB host Shield.  Along with a 10 pin IDC cable (which may be split from a larger cable), cut to the length you require, proably not shorter that 10cm. 1 or 2 10 pin IDC sockets and or a 9 Pin D-SUB DB9 Female IDC Connector. The configuration of these cables is dependent on variant of ZXpand being used.
IDC Cables: Top Cable for ZXpand+, Bottom Cable for ZXpand.

You may be able to purchase IDC cables pre-made, however if manufacturing at home there is a nice video on how to make IDC (ribbon) cables over on YouTube thanks to The University of Manchester. The main thing to remember when building a cable is that pin 1 on 1 socket should always go to pin 1 on socket 2.

All parts required to build the actual ZeaMouse interface are listed in the table below.

Main Contruction Shopping List (Excluding the PCB & USB Shield)

Amount Part Type Properties
2 Capacitor variant pth2; package cap-pth-small2
1 Ceramic Capacitor package 200 mil [THT, multilayer]; capacitance 100nF; voltage 6.3V
1 Capacitor Polarized variant pth2; package cpol-radial-10uf-25v
1 Capacitor Polarized variant pth1; package cpol-radial-100uf-25v
5 Diode variant pth; package diode-1n4001
1 MICROCONTROLLER variant kit; package dil28-3-simon-kit; chip atmega8
1 AVR ISP 6 Pin variant pth; package 2x3; pins 6
1 10 Pin IDC Header variant variant 2; row double; package THT; pins 10; form ♂ (shrouded male); pin spacing 0.1in (2.54mm); hole size 1.0mm,0.508mm
1 Ardunio_Power_Header_8_Pins variant variant 3; row single; package THT; pins 8; form ♀ (female); pin spacing 0.1in (2.54mm); hole size 1.0mm,0.508mm
1 Ardunio_Analog_Header_6_Pins variant variant 4; row single; package THT; pins 6; form ♀ (female); pin spacing 0.1in (2.54mm); hole size 1.0mm,0.508mm
1 Ardunio_Digital_Header_10_Pins variant variant 5; row single; package THT; pins 10; form ♀ (female); pin spacing 0.1in (2.54mm); hole size 1.0mm,0.508mm
1 Ardunio_Digital_Header_8_Pins variant variant 6; row single; package THT; pins 8; form ♀ (female); pin spacing 0.1in (2.54mm); hole size 1.0mm,0.508mm
1Bucket DB9 Solder Bucket DB9
1 Red (633nm) LED package 3 mm [THT]; color Red (633nm); leg yes
1 10kΩ Resistor package THT; tolerance ±5%; bands 4; pin spacing 400 mil; resistance 10kΩ
1 220Ω Resistor package THT; tolerance ±5%; bands 4; pin spacing 400 mil; resistance 220Ω
1 Voltage Regulator - 3.3V package TO220 [THT]; voltage 3.3V; part # LM2936
1 Crystal package THT; frequency 16 Mhz; pin spacing 5.08mm; type crystal
1 Crystal package THT; frequency 16 Mhz; pin spacing 5.08mm; type crystal


ZeaMouse Board Assembly


ZeaMouse PCB Layout
All the files required files for ordering a PCB from a fabrication house, or for rolling your own board are contained in the ZeaMouse_Fritzing.tar.gz file. 

As mentioned in Part 1 of the USB Mouse For The ZX81 And ZXpand blog post, the mouse interface PCB is designed to allow easy one sided home fabrication, as well as double sided construction for the more adventurous, or ordering from fabrication houses.

The underside of the PCB is all that needs to be printed, with the top side consisting of only straight tracks and vias that can be linked with copper wire if you choose the one sided method. Linking wires are highlighted in red on the PCB layout figure / image.

All components are of the through hole variety for easy assembly, and there are not a great many of them. The only really tricky part in the whole process is attaching the solder bucket DB9 joystick socket. I used this particular part to save space and keep the interface an acceptable size. In attaching the DB9 connector to the PCB, I first soldered pin cutoffs from the long Ardunio Headers to the solder pads / buckets of the DB9, then inserted the pins through the PCB for soldering to the board. You could also use Generic male header pins in a similar fashion.

Assembly List

Label Part Type Properties
C1 Capacitor variant pth2; package cap-pth-small2
C2 Capacitor variant pth2; package cap-pth-small2
C3 Ceramic Capacitor package 200 mil [THT, multilayer]; capacitance 100nF; voltage 6.3V
C4 Capacitor Polarized variant pth2; package cpol-radial-10uf-25v
C5 Capacitor Polarized variant pth1; package cpol-radial-100uf-25v
D1 Diode variant pth; package diode-1n4001
D2 Diode variant pth; package diode-1n4001
D3 Diode variant pth; package diode-1n4001
D4 Diode variant pth; package diode-1n4001
D5 Diode variant pth; package diode-1n4001
IC1 MICROCONTROLLER variant kit; package dil28-3-simon-kit; chip atmega8
J1 AVR ISP 6 Pin variant pth; package 2x3; pins 6
J2 Atari Joystick IDC variant variant 2; row double; package THT; pins 10; form ♂ (shrouded male); pin spacing 0.1in (2.54mm); hole size 1.0mm,0.508mm
J3 Ardunio_Power_Header_8_Pins variant variant 3; row single; package THT; pins 8; form ♀ (female); pin spacing 0.1in (2.54mm); hole size 1.0mm,0.508mm
J5 Ardunio_Analog_Header_6_Pins variant variant 4; row single; package THT; pins 6; form ♀ (female); pin spacing 0.1in (2.54mm); hole size 1.0mm,0.508mm
J6 Ardunio_Digital_Header_10_Pins variant variant 5; row single; package THT; pins 10; form ♀ (female); pin spacing 0.1in (2.54mm); hole size 1.0mm,0.508mm
J7 Ardunio_Digital_Header_8_Pins variant variant 6; row single; package THT; pins 8; form ♀ (female); pin spacing 0.1in (2.54mm); hole size 1.0mm,0.508mm
J8 Generic male header - 5 pins Solder Bucket DB9, top row: See article for attachment guide
J9 Generic male header - 4 pins Solder Bucket DB9, bottom row: See article for attachment guide
LED1 Red (633nm) LED package 3 mm [THT]; color Red (633nm); leg yes
R1 10kΩ Resistor package THT; tolerance ±5%; bands 4; pin spacing 400 mil; resistance 10kΩ
R2 220Ω Resistor package THT; tolerance ±5%; bands 4; pin spacing 400 mil; resistance 220Ω
U1 Voltage Regulator - 3.3V package TO220 [THT]; voltage 3.3V; part # LM2936
XTAL1 Crystal package THT; frequency 16 Mhz; pin spacing 5.08mm; type crystal


Go Forth and Build


That's it for the moment, so go forth and build the ZeaMouse. I'll be updating and adding features to the firmware over the coming months, and hopefully some specifically ZXpand+ only enhancements that take advantage of the new hardware, so come back every now and again to check for that. As always feedback and suggestions are more than welcomed.

Read More