COSMAC 1802 "IDIOT" monitor Software


Last updated Feb 21 2022. Edited by Herb Johnson, (c) Herb Johnson. Contact Herb at www.retrotechnology.com, an email address is on that page..

Introduction

This page is about "IDIOT", a ROM monitor software for Lee Hart's COSMAC 1802 "Membership Card". IDIOT is based on RCA's UT4 ROM monitor. People have worked intermittantly on UT4 and IDIOT since about 2010, as Lee Hart's 1802 Membership Card revived interest in the COSMAC 1802 processor. So there's several variations of IDIOT on this Web page, and another elsewhere as linked. That's simply the history of this ROM monitor.

For more 1802 M/S card software, This links to a list of software on this Web site. For the "home page" of the 1802 Membership Card, follow this link and see the current status of the product and support on this Web site.. - Herb Johnson

IDIOT monitor and the 1802

Ownership and restrictions

Lee Hart wrote a ROM monitor for the 1802, called "IDIOT", in 1982 for his BASYS product. When asked, Lee said in 2019: "IDIOT was derived from RCA's UT4, who published its source code without a copyright notice. It provided a building block and learning tool, to aid and encourage others working with the 1802. It was an early form of 'open source', I guess. This code was used not only by me, but many other early 1802 system designers." When asked about rights to modify by someone in 2019, Lee said "I have no problem at all with you modifying my IDIOT monitor and posting the results. It is giving back to the community."

Lee added: "I see your work in the same light. Creating quick-n-dirty software is easy (in fact, it's easier today than ever before). But creating really good software is hard work! The only practical way to do it is by the combined efforts of many people, each making his contributions and passing it on to the next."

Work done "here"

Lee Hart originally assembled it with an Avocet brand CP/M cross assembler, which supports RCA like syntax. Decades later, Lee provided the code to the cosmacelf Yahoo group archive. In 2010, with Lee Hart's support I grabbed a copy and re-sourced it into ASM code compatible with the A18 cross assembler. Also I extracted a document from his use of the monitor in his Tiny BASIC product, also originally written for the BASYS.

A listing of the UT4 ROM monitor was available to me, in a poor copy of the manual "Designs Idea Book for the CPD1802 COSMAC Microprocessor" BMP 802. A PDF copy of that document is available on the cosmacelf.com Web site file archive. In early Oct 2016, I OCR'ed the BMP-802's descriptions of UT4, and added that text file to the UT4 ZIP file. That UT4 manual should largely apply to IDIOT.

IDIOT, notes for use, related programs provided

Here's a link to the ZIP file for the "current" version of the IDIOT monitor for the 1802. It has the Avocet (RCA) assembled version, and the version assembled with the A18 MS-DOS cross assembler. There's notes with the ZIP file, and below, about adaptations I've made to Lee Hart's earlier work.

IDIOT has a number of virtues. It's pretty simple, pretty small. If you can run it - then your 1802 M/S card is working. :) It uses the 1802 as a UART, in software - EF3 and Q are recieve and transmit. It figures out its own baud rate; that makes it somewhat CPU clock independent. The 512 binary bytes of IDIOT can be loaded at ANY pair of 256-byte pages and run, without reassembly. Code can be saved and loaded as a set of ASCII hex bytes - a text file. And if you want something better - you can use it to load in a better monitor. IDIOT doesn't get in the way, very much.

Features of IDIOT match features of RCA's UT4. A document in the ZIP file describes those features. I"ll describe below, how to use IDIOT to load code into RAM, a common use for a monitor program. RCA evolved UT4 into another monitor, UT20. Check the UT20 Web page I have about UT20. On that page is an extract of a MPM-216 RCA manual, which describes UT20 features in detail, and which largely applies to UT4.

IDIOT commands: The command "?Maaaa xx" will dump memory from address aaaa, for xx bytes, in hex of course. A related command "!Maaaa dd..dd;" will load memory from address aaaa forward with data bytes dd dd etc.. A semicolon continues the load on the next text line. The "dump" format if captured at the terminal as a file, duplicates the "load" command to restore that same content from that file. The $Paaaa command runs a program at address aaaaH, with interrupts enabled and P=X=00. The "$Rxp" command, restores the registers and also sets X=x and P=p. Therefore execution will begin at the address in the P-specified register. Compare IDIOT to the UT4 monitor source and manual to get information on more features (I'll edit an IDIOT version of the UT4 manual when I get around to it.)

Idiothex: In the IDIOT ZIP fileset, I provide a utility called "idiothex", to convert Intel Hex format - the output of most assemblers including A18 - to "idiot load" format. Then, assembled 1802 programs as Intel hex records, can be converted and downloaded by using IDIOT. The IDIOTHEX.EXE program runs as a 32-bit MS-DOS program, on the Windows "command line" also called the "MS-DOS window". The C source, compiled with lcc-win32, is also provided. You can recompile the source for other operating systems. Turbo C will work for 16-bit MS-DOS for instance.

IDIOT fixes, adjustments

In Jan-Feb 2014, I first debugged IDIOT ROM monitor code and baud rates for the 1802 M/S Card..

I added "IF" statements in the IDIOT source, to switch code for Q or EF3 as "active high" or "active low", to allow different kinds of serial interfaces.

The IDIOT code provided is stand-alone and can be executed from any address "page" (256 byte segment like 0000, 0100, 0200...). The code generates a "long branch" address at the end of the "RHERE" procedure, and puts the jump code into RAM. It's very hard to "decypher" how it does that, but as far as I can tell it succeeds. The IDIOT version in "Tiny BASIC" is in a fixed ROM location and has a fixed long-branch address at assembly time. - Herb Johnson

IDIOT with a UART

In late 2019, "cmdrcosmac" produced a version of IDIOT (in RCA syntax) which replaces the bit-bang serial with RCA 1854 UART code. cmdrcosmac is the posting name of "Chuck" or "CAM" (not Chuck Yakym) in the cosmacelf groups.io discussion list. In May 2020, Bob Kircher converted Chuck's code to A18 syntax. In Dec 2021, Mark Clegg reported a bug in stack handling for UART input and output, and that the stack R2 wasn't initalized in the low-byte. I contacted him in Feb 2022 to confirm fixes. Here's a zip file of both versions, Mark's bug and fix report, and some notes and links to the groups.io file archive. - Herb Johnson

IDIOT and SCRT

In Jan 22 2019, Mark Abene provided his additions to the IDIOT ROM monitor program. His code provides serial character I/O with IDIOT from calling programs, and provides COSMAC 1802 SCRT support. No modifications of IDIOT are needed, the code can be assembled independently of IDIOT in use except as noted and documented. Code and documents are in this ZIPped file. For discussion and notes on SCRT, here's a Web page on SCRT from RCA's literature and from use.

Mark's code only calls IDIOT READ and TYPE routines in operation. So when assembled those addresses in his assembled code, must match those IDIOT routines where IDIOT resides in the target 1802 system. These routines requires IDIOT to run first, then a call to Mark's routine "INITCALL", before use of his serial-character routines or his SCRT routines.

Mark's code follows the SCALL=R4 SRET=R5 LINK=R6 X=R2 conventions among others and provides Standard Call and Return (SCRT) support. Included is a sample "hello" program to exercise his code with an IDIOT monitor. Again: use of his codes requires specific calls to a resident IDIOT monitor and follows specific conventions which are generally part of RCA/COSMAC conventional 1802 programs. THanks to Mark Abene for sharing his use of IDIOT and making it easier for others to incorporate IDIOT into their COSMAC programs. - Herb

IDIOT with the 1802 Membership Card

Operational details: Q is serial out, EF3 is serial in. Hardware on the 1802 MC, in various versions, interfaces these pins to either TTL or RS-232 type serial connections.

When running IDIOT with the 1802 Membership Card Rev F or later with ceramic resonator, you need to adjust the trimpot R1 to maximum clock rate. It will "lock in" to the maximum resonator frequency, with R1 turned fully counter-clockwise until it "clicks", then turned clockwise 3/4 turn (or 1/2 turn, but no more than one turn).

baud rate: When the IDIOT monitor is started, it attempts to find the baud rate, based on the first character sent by the "terminal" to the Membership Card. "Type" either a [CR] character for full duplex (no echo) operation, or a [LF] character for half duplex (echo) operation.

IDIOT (like RCA's UT4) supports 7-bit serial communications, not 8-bit; no parity; one or two stop bits. On serial recieve, IDIOT ignores the parity or 8th bit. On serial transmit, the 8th bit may be "set" or have "mark" parity. So, set your terminal or comm program for either "7 bit, mark parity, one stop" or "8 bit, no parity, one stop AND ignore/strip the 8th bit on recieve". There's more notes about 7-bit serial, later in this document.

Supported baud rates for IDIOT depend on the CPU clock speed, and other factors. In principle, the faster the CPU clock, the higher the possible baud rate. Here's some results of tests of a modified Membership Card rev J CPU with ceramic resonators to set the CPU clock speed. A "+" means that baud rate works; an X or blank means it doesn't work.

at 5V	300 1200 2400 4800 9600
2MHz     +   +
4Mhz     +   +   +
6Mhz     +   +   +     X    X
8Mhz     +   +   +     +    X
10Mhz    +   +   +     +    +
12Mhz    +   +   +     X    X

Active high or low serial?I've run IDIOT with the Rev F and rev G 1802 Membership Card with added RAM under the ROM, and a serial interface using Q and EF3; to a terminal program on a PC with a hardware serial port. Rev G and later, brings out EF3 and Q into a serial interface. One assembled version of IDIOT I provide, "idiot.hex", works with the "inverted" serial in and serial out interfaces - the transistor for each "inverts" the logic of the signal. Look at the Rev F suppport page or the Rev G support Web page for discussions of serial interfaces, and links to further information.

There are four ways to configure the Q and EF3 serial hardware. They are: invert or not /EF3; invert or not Q. I've included a hex file "idiotx4.hex", which has FOUR versions of IDIOT at 8000H, 8400H, 8800H, 8C00H. (Or, 0000H, 0400H, 0800H, 0C00H; wherever the ROM is addressed.) Each supports one "way". So, however you set up your Membership Card serial interface, *one of these MUST WORK*. If you make a PROM and set RAM at 0000H, and ROM at 8000H, you can toggle in at 0000H a "jump to 8?00H" - C0 8? 00 - and try each one. OK? Thus all bases should be covered. But there's a problem, in how UT4 handles 7-bit serial and "parity". Look at the end of this Web page for details.

Serial interfaces: I made a Web page in 2015, on how to build a "PC compatible serial interface" for Rev G and later. I used that four-way IDIOT ROM, with a RAM and some connectors. That page may not be "simple" but I've tried to describe my work. The "IDIOT serial kit" Web page shows a kit of those parts, and how to assemble and use them, with serial or USB/serial interfaces. For Rev F and earlier, in 2014 I built and debugged an external serial interface in 2014 on a Rev F.

PC "hardware" serial ports: Legacy PC's have hardware UARTS and bring out serial ports on IBM-PC standard 9-pin connectors. Legacy PC communications software, provides direct operation of those ports and features of hardware and software "flow control". In a few words: that hardware and softare is patient with the slow 2Mhz 1802 Membership Card. For Card users with modest modern computer skills, these may be the preferred serial option. The alternative is discussed below.

USB to serial: In 2016 and 2017, several owners of the 1802 M/S card and Lee Hart, discussed the issues of using a USB to serial device instead of classic PC serial hardware UARTS and "serial ports". It emerged, that there are problems of use and setup, of the USB device drivers under Windows (and presumably Linux). These USB devices, have their own processor, serial buffering, hardware and software handshaking - which are under the driver's control. Those USB features are NOT under control of traditional MS-DOS or Windows terminal programs; and the controls of those serial programs, might not "operate" or access those features in the USB device and driver. I"ve republished that discussion of those M/S card owners and developers, about USB serial features and problems.

That's a long way of saying "USB serial dongles don't all play well with the slow 1802 M/S Card.". As of early 2018 I summarized work in progress on USB/TTL versus RS-232/TTL.. But as of mid-2018, an FTDI-brand USB/TTL chip seem to work reasonably well. Review these documents for details.

- Herb Johnson

More about 7-bit serial

There's a problem, in how TinyBASIC (UT4, IDIOT, UT20) handles 7-bit serial and "parity". These old RCA programs, use "7 bits Mark parity" and so do confusing things with the 8th "parity" bit. Careful and painful oscilloscope work, showed me that IDIOT/UT4/TinyBASIC will "produce" ASCII characters with 7 bits and "mark" parity for the 8th bit, which looks like ordinary 8-bit ASCII. But they "echo" 7 or 8-bit characters with bit 8 "on" and so those may display on your PC communications program, like old-school IBM PC graphics characters.

So you need to set your comm program for 8-bit no-parity ASCII *and* ignore the 8th bit on recieve, to avoid this problem. For Windows Hyperterminal communications program, I set it for "8 bits no parity 1 stop" and also changed "settings" under "ASCII setup" to "force incoming data to 7 bit ASCII". Other comm programs may have similar features. Sorry I did not see this sooner - Herb

It's tricky to set up the Membership Card to operate the software serial UART in IDIOT, or for that matter in other COSMAC monitors like UT4, UT20, in the ELF2K ROM, and so on. Here are detailed notes on the subject of serial interfaces. Also look for serial test programs among the M/S card simple testing programs. There are also notes on the Revision G Web page about using Rev G serial hardware. For Rev F and earlier that does not have a serial interface, look at the Rev F support page for links to notes about building your own interface on earlier revision M/S cards.

Serial was difficult to achieve in the mid-1970's, before development of a hardware UART and RS-232 interface chips. In the 21st century, with serial devices almost extinct, re-working mid-70's technology like the ELF, into current serial use, via the 1802 Membership Card, is again a challenge. One point of the 1802 M/S Card kits, is to demonstrate issues from that time. Another point, is to offer challenges for use. - Herb Johnson


Contact information:
Herb Johnson
New Jersey, USA

This page and edited content is copyright Herb Johnson (c) 2021 . Contact Herb at www.retrotechnology.com, an email address is available on that page..