The IBM 5100/5110 MAME Emulators How-To [a2] DELETE ME DO NOT USE

It finally happened on April 25, 2024: an emulator for the IBM 5100 finally was made available to the public (in MAME build 0.265). The honor goes to Patrick Mackinlay for cracking the IBM architecture of this, after volunteering many hours to make this available, and in a way that takes advantage of all the debug and visualization capabilities of MAME.

Initially I had misunderstood Patrick, I thought he wanted to put the Corti-derived IBM 5110 emulator into MAME. But no, Patrick was trying to tell me that he had independently developed an IBM 5100 emulator (essentially “clean room” style on his own just from the available IBM documentation), and in fact he was having the opposite problem that we were having: we were struggling to emulate the 5100 after already having a 5110 emulator, while he was struggling (a bit, for one day) to emulate the 5110 after he had his 5100 emulator up and going. Very neat to see two independent approaches come to the same conclusion: there was some fundamental difference between these two systems!

Here is the link to one of the early 5100 emulation merges committed to MAME (note it is dated April 1st, 2024, but this is no Aprils Fools tease!):
https://github.com/mamedev/mame/commit/85a3c394d20e82da9e1dd6f40d2be6ac2ac3cece

Awesome job Patrick, many thanks! Though this does suggest the IBM 5100 is just “yet another Turing complete code crank” 🙂 But still, the 5100 is an example of how a microprocessor isn’t the only way to make a computer. That is, however the machine cycles through instructions (it could be a sewing machine for all that matter), emulation is just interpreting some instruction set that manipulates some registers or address space. But then beyond that, a “system” then coordinates that fundamental capability into user-features – and the speed/performance and utility of those system features is what sets one system apart from another. Did the features of the IBM 5100 make it worth over $6,000 in 1975? Maybe this emulator will now help examine that question. But by our estimates, only about 30,000 units of IBM 5100/5110’s were sold – but they were all sold and put to good use at small businesses (such as doctor offices or parts-production shops, where “small” to IBM still means dozens of employees to payroll).

It finally happened on April 25, 2024: an emulator for the IBM 5100 finally was made available to the public (in MAME build 0.265). The honor goes to Patrick Mackinlay for cracking the IBM architecture of this, after volunteering many hours to make this available, and in a way that takes advantage of all the debug and visualization capabilities of MAME.

Initially I had misunderstood Patrick, I thought he wanted to put the Corti-derived IBM 5110 emulator into MAME. But no, Patrick was trying to tell me that he had independently developed an IBM 5100 emulator (essentially “clean room” style on his own just from the available IBM documentation), and in fact he was having the opposite problem that we were having: we were struggling to emulate the 5100 after already having a 5110 emulator, while he was struggling (a bit, for one day) to emulate the 5110 after he had his 5100 emulator up and going. Very neat to see two independent approaches come to the same conclusion: there was some fundamental difference between these two systems!

Here is the link to one of the early 5100 emulation merges committed to MAME (note it is dated April 1st, 2024, but this is no Aprils Fools tease!):
https://github.com/mamedev/mame/commit/85a3c394d20e82da9e1dd6f40d2be6ac2ac3cece

Awesome job Patrick, many thanks! Though this does suggest the IBM 5100 is just “yet another Turing complete code crank” 🙂 But still, the 5100 is an example of how a microprocessor isn’t the only way to make a computer. That is, however the machine cycles through instructions (it could be a sewing machine for all that matter), emulation is just interpreting some instruction set that manipulates some registers or address space. But then beyond that, a “system” then coordinates that fundamental capability into user-features – and the speed/performance and utility of those system features is what sets one system apart from another. Did the features of the IBM 5100 make it worth over $6,000 in 1975? Maybe this emulator will now help examine that question. But by our estimates, only about 30,000 units of IBM 5100/5110’s were sold – but they were all sold and put to good use at small businesses (such as doctor offices or parts-production shops, where “small” to IBM still means dozens of employees to payroll).

HOW TO RUN THIS EMULATOR (on desktop PC)

Norbert integrated Corti’s original IBM 5110 emulator into a JavaScript for online usage (here), which also had a nice looking front end (and some limited file support for LOADing content). But this MAME version opens up a lot of new features to help exploring “behind the hood” of the address space, with breakpoints and debug monitors, etc.

In your MAME installation folder, under ROMS folder, create two sub-folders “ibm5100” and “ibm5110” and place the ROS/ROM binaries in those respective folders

Then, from the command-line, run MAME like this:

  • mame ibm5100 -window -nomax -ui_active -debug
  • mame ibm5110 -window -nomax -ui_active -debug

It should look like this:

  • Once the emulation is started, press F12 to just run and hide the debug window. Or don’t pass the -debug on command line.
  • Within the emulation window, press TAB and go to “Machine Configuration” to adjust settings like amount of RWS/RAM and BASIC vs APL.

Please understand the emulator will be a little difficult to use until you get used to a few keymap settings, there will be a bit of a learning curve since this system doesn’t use “normal” ASCII anywhere. Also, especially if you’ve never typed on one of the original keyboards, the arrangement is still different than anything after the 1981 IBM PC keyboard. Here is an initial guide that may help:

  5100 Key    Mapping        Rationale
  --------    -------        ---------
  +/-         -              closest key position, 
                               matching shifted symbol
  ×/÷         =              closest key position
  ←/→         ;              moved to row with two non-alpha keys
  =           '              moved to row with two non-alpha keys
  [/(         [              moved to row with three non-alpha keys,
                               matching unshifted symbol
  ]/)         ]              moved to row with three non-alpha keys,
                               matching unshifted symbol
  #/@         \              moved to row with three non-alpha keys
  &/$         `              available standard symbol key

  l/r/u/d     arrow keys     conceptual match
  Attention   Delete         available non-symbol, non-modal key
  Hold        Backspace      available non-symbol, non-modal key
  Execute     Enter          conceptual match
  Command     L/R Control    conceptual match

  ;           SHIFT+,
  :           SHIFT+.
  <           SHIFT+3
  >           SHIFT+7
  ^           SHIFT+Y       (exponential)
  

Some other tidbits and notes:

  • Note that apostrophe ` is also mapped to bring up the debug window in MAME, as well as a mapped key to the IBM 5100/5100 system. So, for example, after typing $ (dollar sign) using open apostrophe, you might need to press F12 again to resume the emulation.
  • TIP: Configure the machine with less RWS (RAM, memory) to boot it up faster.
  • If you type a mistake, the system will flash and show an error starting at the mistake. Press DELETE (translates to ATTN) to acknowledge the error and proceed to fix the syntax error.
  • To INSERT a space/blank, use CTRL+RIGHT ARROW.
  • There is no NEW keyboard, instead you type “LOAD 0” (basically “load nothing” tells BASIC to re-initialize itself – note this is why you see “LOAD 0” during startup of the system)
  • There is no double-quote, a quote on this system if SHIFT+K (single quote) which works for PRINT
  • Many APL symbols are entered by typing SHIFT A-Z.
  • You can PRINT any symbol using X (hex) like this: assign a string variable A$=X’00’ then PRINT A$.

  • To make an exclamation mark (!), first type “.” (dot, period) then cursor left and then type SHIFT+K (you can do this in reverse also, where you can type SHIFT+K first, cursor left back over, and then type “,”). For a list of other overstruck characters, refer to here.

HOW TO ENTER THE DCP

During the ROS checksum during startup for the 5100, you can press CTRL+DELETE to invoke the key COMMAND+ATTEN, and this will enter the DCP (Diagnostic Control Program). This is a program built into the System ROS (ROM) that essentially lets you activate a machine code monitor (so you can enter machine code into RWS/RAM and execute it). The DCP also has features to SAVE regions of RWS/RAM to cassette (and disk, for the 5110) and, of course, to LOAD file content back into RWS/RAM later. The machine code used here would be the PALM instruction set.

For the IBM 5110, so far CTRL+DEL during startup doesn’t seem to be working. Instead, use the regular documented way to enter the DCP. Which is, after the Language has booted, do CTRL+BACKUP (CMD+HOLD), keep holding CTRL (CMD) and then press CMD+MINUS (minus on the number pad). IMPORTANT: One more step – to actually get into DIAG mode where you use the BR command, keeping holding CMD and also press CMD+ASTERICK (star). At the top of the screen, it should now say “DIAG DCP.”

Below is one of the shortest PALM machine code examples, that is also visually interesting, that I came up with – it shows the entire display card character set, so you can see each encoded symbol. Once in DCP, you would type “A” to ALTER an address, and specify 2000 at the hex offset (you can use other addresses, but the example below was hard-coded to start at address 2000). Type in a couple lines of machine code (then SPACEBAR to finish on the 5100, use ENTER on the 5110). Use “DDISPLAY to verify the entry, then use “BR” (branch run) to execute the code.

The emulators do not yet support the tape or disk systems, but that’s still in work — hopefully someday we can exercise the SAVE and LOAD features of the DCP (the operations are described in the IBM MIM manuals).

Image

To examine the assembly that corresponds to this machine code:

ADDR   CODE       PALM ASSEMBLY     COMMENTS
----   ----       -------------     ----------
2000   D501 0200  LWI R5, #$0200  ; Begin of display buffer
2004   8606       LBI R6, #$06    ; High byte of end address
2006   8740       LBI R7, #' '    ; Blank (Hex $40) (use 8700 on 5100) 
2008   7750       MOVB (R5)+, R7 
200A   C567       SBSH R5, R6 
200C   F005       BRA $2008

200E   D501 0200  LWI R5, #$0200  ; Let REG[R5] = Begin of display 
                                    buffer 0x0200
2012   8604       LBI R6, #$04    ; High byte of end address  (256 only)
2014   8700       LBI R7, 00      ; start R7 at 0x00
2016   7750       MOVB (R5)+, R7  ; RWS[R5] = value in R7 
                                    (and increment R5)
2018   0772       INC R7,R7       ; increment R7
201A   0552       INC R5,R5       ; increment R5 (to skip a column)
201C   C567       SBSH R5, R6     ; SKIP if all bits in R6 are also 
                                    set in HI(R5)
201E   F009       BRA $2016       ; 8 bytes (4 instructions) plus one 
                                    extra byte
2020   0000       HALT 

More machine code examples will be at the end.


Some Technical Aspects and Examples

The following is my diagram from a couple years ago, which depicted my “best guess” of where the ROS/ROM code was arranged across the cards of the system. This shows 232KB of “free code” on the IBM 5100, and 284KB on the IBM 5110. “free code” meaning in what we later call a System ROM and available as-delivered with the system (and these would be “fully configured” systems, with both BASIC and APL).

IBM 5100

Tom originally had this extracted into three files: exeros.bin [64KB], binary_BCom.bin [54KB], binary_APL_LROS.bin [96KB]. This is all complete, except what was hard (for me) to realize is that the BCom (BASIC and Common) is both ROS Control/Common (in PALM) and BASIC (in System/3 code), and the last 18KB there is the ROS Control portion that actually resides in a different card slot (but is still accessed seamlessly “after BASIC NX” across the logical address space). Patrick organized the ROS/ROM by slot, which does align with my earlier diagram (where based on the SLM, the 18KB for the ROS Control had to be on that card, but at the time it seemed to me this had to be accessed as a different Device – but that turned out not to be necessary):

Leave a Reply