Serial Binary loader for 1802 Membership Card


Last updated Oct 13 2019. Edited by Herb Johnson, (c) Herb Johnson, from notes and content by others as named.

Details on the COSMAC 1802 Membership Card are on the linked Web page.

Introduction

A binary loader is a program used to load binary executables into a computer, from "the old days". It's traditionally small enough to toggle in, manually, into a computer. Here's a ZIP file of a self-relocating binary loader for the 1802, as source, assembled listing, and Intel hex records. The source in this ZIP file is brief for convenient use, and presumes the use of the 1802 Membership Card, which has means to hand-load (toggle) directly into memory.

On this Web page: I describe what a binary loader is; what it has to do and what YOU need to do to use it; and the history of this particular set of code - including versions of the original program as it was adapted or improved. Thanks to all those developers, and for their permission for use.

History

Late in Oct 2015, Jonathan Mordosky posted in the Yahoo cosmacelf discussion list, a bit of COSMAC 1802 code to hand-toggle a binary loader into the 1802 Membership card, to binary-load programs from the serial port. Lee Hart was intriegued by the code and set about tweaking it to autobaud a bit better. He discussed his results with Bill Rowe, Josh Bensadon and Herb Johnson; and Lee Hart made further refinements. Later, Chuck Yakym incorporated code to move the loader, so it can load at 0000H or 8000H, to support his extended ROM and RAM monitor.

This Web page has those versions, with discussion and documentation on this Web page, and with permission of all persons. Why? For those interested in learning about 1802 code; and for those who need to modify the code for other purposes. And of course, to give due credit to those coders! See their code and discussions elsewhere on this Web page.

General descriptions and how-to-use

A binary loader is a program used to load binary executables into a computer; it's a legacy going back to minicomputers and mainframes of the 70's, and the first microcomputers of the mid-1970's. A serial binary loader, uses a terminal serial port to transfer the binary from some storage device - in modern times, a personal computer. The 1802 Membership Card can be operated from a hardware front-panel, with or without ROM. So a small toggle-in binary loader can be entered by hand, to load into memory a ROM monitor or other programs of interest.

What is a "bit-banged UART"? Since the 1802 Membership Card (and many other 1802 computers) lack a hardware UART, the processor must convert the serial binary stream into bytes, and load those bytes into a selected portion of memory. There's a number of choices to be made about this operation, so this introduction explains the loader and provides some guidance. Look hard at the assembly source to understand the details. Also, the history of this code and contributed examples provide even more insight into how all these features work. "Bit-bang UARTS" and "binary loaders" are of the same tradition as the early use of the COSMAC 1802.

HOw do you use a binary loader? The loaders on this Web page, are small enough to toggle in, byte by byte. That's how it was done with minicomputers and microcomputers of the 1970's. The binary loader converts serial data into bytes, and loads it into selected memory. To use it, you have to decide: 1) where will the binary be loaded? 2) if the loader gets in the way, where can the loader be placed? 3) serial hardware conditions may require changes to the program to accomodate them. The program is simple enough that these conditions can be changed in the hexadecimal "dump" of the program, which is hand-toggled by the user. Or, with the assembler source, the user can change the source code.

By where to load the binary, I mean the page-location in memory where the serial loader will load the binary file. The source code has an EQU for that value, which must be changed to suit the binary in use. To execute the binary, it's typical to toggle in a JMP XXXX instruction into low memory, where of course XXXX is the desired start address. Or, you could add that jump to the end of the loader and it would jump there after loading - your call.

By serial hardware conditions, I mean that the 1802 Q is used for serial output, and EF3 is used as a serial input. The digital input can be active high, or active low, for whatever serial input hardware is in use. To reverse the sense of reading EF3, the 1802 EF3 branch instructions B3 (branch on EF3 high) and BN3 (branch on EF3 not-high or low) in this program must be "swapped" in every instance in the code. The source code includes these notes. (I thought it was simpler to describe this change, than to provide two sets of sources. Change and reassemble the source; or hand-change the hex dump - your call.)

If you need to create serial interface hardware, there's numerous discussions of such hardware on this Web site, and elsewhere. Check my 1802 hardware index under "serial and USB" for all the flavors of possible serial hardware. Yes, it's a little complicated if you are building your own 1802 board. If you are using or replicating a COSMAC design, review that documentation.

By placing the loader, I mean additional code to move ore relocate the loader from where it's toggled in (usually 0000H) to some location out of the way of loaded programs. There's an EQU in the source code for that location. The start of the binary loader program, therefore, is a short loop to move the loader code to other memory. If you don't want to move the loader, eliminate that loop and toggle in fewer bytes. But obviously, a loader "stuck" at 0000H, can't load a binary which starts at 0000H. Again - your call.

Locations for loading the binary and relocating the loader, are represented as a "memory page", the high-order byte of the 16-bit memory address. The low-order byte is presumed to be 00H; so pages are 0000H, 0100H, 0200H, etc.

A hex dump of the loader is part of the source, as comments. Note that page values for loading the binary and relocating the loader are identified in that dump, and must be added by the user. The assembled source has example values.

Assemblers for the 1802 are available on this site as follows:
A18 cross assembler
ASMX 2.0 macro cross assembler

Please contact me about any errors or suggested changes. Thanks go to those who developed this set of code for the 1802 Membership Card, as described and provided below. - Herb Johnson

History

Here's Jonathan Mordosky's original binary loader code. It's a simple loader program, to operate the EF3 as a serial input port, to load in a binary program above the loader. Jonathan said to me later: "A main goal for me in the design of the program, was to keep it as short as possible so that it is easier to toggle in, thus cutting out all the bells and whistles. Hopefully, the code is understandable enough that it will be possible to add any desired extra features on the fly as needed."

Lee Hart's refined version of Jonathan's code.

Assembled listings of both versions.

Edited commentary by Lee, Josh, Herb

Another refinement by Chuck Yakym. Chuck adds a code loop, to relocate the loader to higher memory, so it can load a binary into lower memory. Also he adds a delay from the last data bit to the stop bit, to improve baud rate. He includes two sources, to load into either low memory (from 0000H) or high memory (from 8000H). He provides hex dumps, which operate with "normal" or "inverted" logic on the EF3 serial line; the sources for that change, which would switch all the BN3 and B3 instructions, are not provided.

For more about Chuck's monitor program, there are several locations. Lee Hart distributed a version on his site for the 1802 Membership Card. Also check the cosmacelf groups.io file archive for "The Eagle" [Chuck Yakym's] folder. Also check Yahoo's now-abandoned cosmacelf group's files sections for earlier versions.


Contact information:
Herb Johnson
New Jersey, USA
To email @ me, see
see my home Web page.

This page of edited content is copyright Herb Johnson (c) 2019. Copyright of other contents beyond brief quotes, is held by those authors. Contact Herb at www.retrotechnology.com, an email address is available on that page..