Showing posts with label Serial / RS232. Show all posts
Showing posts with label Serial / RS232. Show all posts

Monday, January 22, 2018

Mystic BBSing with WiModem232s Zeddynets and Pi

3 comments

Or Networking Disperate Retro Computers?


I've been meaning to write something about the ZX81 Ethernet adapter Zeddynet for a while now, but hadn't got around to it for various reasons. In the last week or so another more general purpose retro network device in the form of a Serial to WiFi modem / network adapter, the WiModem232 crossed my threshold rekindling ideas around networking old computers.

Now we have the basis for a slightly confused and conjoined blog post, one that ends up being not quite a review, mostly not a tutorial and a slightly random collection of ideas on network hardware and software, in which I get a number of ancient machines on-line connected to a BBS, a BBS that ends up being my own local BBS.

Some Networking Hardware Required


Now for a brief look into the networking devices I'm using. Both interfaces are specific to my needs (and small retro collection), the WiModem232 is certainly of much use to the general retro community, where as the Zeddynet is obviously of more limited one machine appeal.

Zeddynet - for a ZX81


Starting with Zeddynet and the ZX81: The Zeddynet board mounts onto a ZX81XT extender / extension board, and combined plugs into the ZX81s expansion bus. The card is quite tall with the Ethernet port located at the top. This arrangement is a little cumbersome, particularly once a network cable is plugged as the cable and the card tend to get in the way of a low-ish sitting desktop monitor. Still we're about to plug a ZX81 into a network, a few aesthetics issues and minor viewing discomforts are hardly of major issue compared to the achievements realised.

Zeddynet Interface
Available sporadically from and designed by the German ZX-Team, Zeddynet as the name implies connects a humble ZX81 to a TCP/IP network via Ethernet cable. Zeddynets first appeared back in 2012, I procured mine mid 2017, unfortunately no more have been produced since then (at the time of writing). Still, keep an eye out on SinclairWorld forums should you desire a fully assembled Zeddynet.

In order to configure and use the Zeddynet expansion on the ZX81 some software is required. At minimum in order  to get a ZX81 connected to online BBSs software in the form of ipconfig and telnet are required. Telneting is only one small part, there are web-browsers and network file managers and more. The German Sinclair forum.tlienhard.com has links to all software and sources.

WiModem232 for Anything with a Serial Port


Around the middle of 2017 Paul Rickards released the WiFi232 Internet Hayes Modem for retro computers, the perfect solution for networking old computers. Sadly the device has remained sold out for months, and may now be permanently unavailable. Luckily and possibly inspired by the original WiFi232, two new solutions have recently hit the market from CBMStuff, the WiModem232 and WiModem232 w/OLED.

WiModem232 w/OLED display
Functionality wise, the only real difference between the WiModem232 and WiModem232 w/OLED is the rather obvious OLED screen. The choice of adapter comes down to a desire for a handy information display or a need for the milliamp power savings brought about by not including it. Note that on both variants an RGB LED provides a status indication allowing you to easily live without the OLED screen.

The modem is configured and connected to a WiFi network by Hayes Modem command extensions. Similarly Hayes commands are used to connect to telnet instances on a local network or further a field.

In order to use the WiModem232 simple terminal software is required. The machines I've tested the WiModem232 with (TRS-80 model 100/102 and an NEC PC-8401) have terminal software built into their ROMs, in all cases this worked perfectly.

BBSs Are Out There


Dial up BBSs were a major thing before the Internet age, but sadly faded into slight irrelevance in the late 90s, but now they're back and on the Internet. In fact there is a whole new (old) world out there waiting to be connected.

Perhaps the best resource for finding BBSs is the Telnet BBS Guide. Telneting to any of the BBSs listed from a modern PC is fairly trivial, being able to telnet from a vintage micro computer is (whoo hoo) exciting.

Testing Interfaces a DIY BBS


Despite the wealth of BBS out there, I wanted to try out Zeddynet and the WiModem232 on my micros' without burdening the various online resources. Possibly I'd rather like keep the BBS running, with a view to opening it up for others to log on at some point. For these reasons I decided to to deploy a Raspberry PI and install some BBS software.

The Telnet BBS Guide helpfully lists the software being used by various BBSs in it's site registry. Of the software listed 'Mystic' BBS seems by far the most popular and actively maintained kit going, plus it has Raspberry Pi versions available that work on all network enabled Pies. A logical choice then.

The setting up 'Mystic' is as easy as unzipping, running a minimal installation, and then starting a BBS server. In less than five minutes you can have a bare bones BBS up and running and telnet-able into. After that 'your mission, should you choose to except it', exposes a whole rabbit hole of configurations and text files to modify in order to tailor and craft a unique BBS experience.

Crafting An 8 Bit Mystic Experience


In its default state Mystic targets computers with 80 columns and full ASCII / ANSI support. This is great for Amigas, Atari STs and IBM clones, not so great for 8 bits micros. This situation is fixable, but it does require a full redesign of the built in theme. The task is not difficult, it does though require some dedication.

All BBS layout files can be altered with tools built into Mystic, thus allowing for complete customisation of a BBSs look and feel. It is even possible to create ASCII and ANSI versions of pages servicing general fallback requirements. As a general design rule in targeting older 8bit machines I found it wise to limit charter selection to the first 128 ASCII characters. Using above this limit you start running into compatibility issues between the various proprietary character sets employed by 80s micros. I'm going out on a limb here and suggesting that period telnet / dial up software should automatically transpose any basic character set incompatibilities if working within the 128 limitation.

Locally Connected


There is a long way to go and to start I've only scratched the service of setting up a BBS and using the Zeddynet and the WiModem232 interfaces. On the BBS side of things my only real attempt at customisation has been the Welcome Screens. For now though it serves as a proof of usability both software and hardware.

LINUX Console


Limiting the choice of characters, but allowing for ANSI colours, a LINUX logon to the ZX-AD BBS (as I've named it) looks plain as opposed to what is possible for a full ANSI/ASCII experience. It does help provide a similar experience across all platforms however.

LINUX Console Connected to the Mystic BBS Software Running Locally on a Raspberry Pi

Sinclair ZX81 with Zeddynet 


I limited the welcome screens width to 64 characters, this fits nicely with ZX81 hires modes (additional hardware required). I'd also created a ANSI and ASCII versions of the welcome screen the ZX81 is using the ASCII variant.

ZX81 with Zeddynet Connected to Local Mystic / ZX-AD BBS

Tandy TRS-80 Model 100 & 102 with WiModem232


The Tandy machines are limted to 40 character width screens. Mystic can support this, but I haven't tailored the welcome screen to the 40 character limit, and the screen therefor doubles around.

Using the Tandy machines I found that the WiModem232 baud rate could also be no higher than 1200 else I started experiencing character loss.

TRS-80 Model 102 Connected to Mystic, 40 columns is Problem at this Stage


NEC-PC8401 with WiModem232


Mystic attempts to verify if a connecting computer supports the ANSI standard, interestingly the NEC-PC8401 reports back that it does. This is of course a lie, as it does not. Regardless of this untruth it will render the display correctly if the first 128 ASCII characters limit is adhered to. Also as fully functional CP/M computer the PC8401 has a 80 column display, consequently there is no issue with screen width, screen length however may pose its own problems latter.


NEC-PC8401 Connected to Local Mystic / ZX-AD BBS


To Summarise


Thus ends a rather scattered post on networking 8bit machines and BBS software. On the hardware side of things I can uttery recommend the WiModem232, it really is very simple to use. Zeddynet is similarly fun in execution. In both cases the full possibilities have hardly been touched on by this post.

As for the running a BBS, it's entirely likely I'll refine and open my local experience up to the broader world. Coming Soon - ZX-AD BBS.

Addendum


In the total absence of ZX-AB BBS, being that it's confined to my local network for the moment, and if you're hankering for a Sinclair related BBS that's online right now, then you can't go past sinclair-retro-bbs:
  • Telnet: retrobbs.sinclair.homepc.it Port: 23
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 Intro, Part 1, Part_2, Part 3, Part 4, Part 5, Part 6, Part 7, Part 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 Intro, Part 1, Part_2, Part 3, Part 4, Part 5, Part 6, Part 7, Part 8
Read More

Sunday, September 24, 2017

The TRS-80 Model 100 MyTeSed is Alive

6 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

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