return to main page

Current Simulator Status

The goal of this page is to give the current status and capabilities of various 1401 emulators/simulators and software development tools, such as assemblers, that we can run on home PCs.

Also see Tricks for Simulating/Emulating the 1401 System

Items discussed
Simualtors

- SIMH Simulator 1st choice
- B1401 Simulator
- Morgan Simulator
Assemblers
- Autocoder Assembler 1st choice, new version Van Snyder Utilities.
- SPS Assembler
Disassembler
Van Snyder Utilities.
Development Environment
- Ron Mak's Graphical User's Development Enviornment "ROPE" 1st choice
- Punching object decks from ROPE to a keypunch
Coding Reference Documents

B1401 Simulator
IBM 1401 Emulator (under development)
This is a fun simulator of a 4 K 1401, with a useful Graphical User's Interface.

Dan McInnis figured out some of the script operations. Scripts can make it run the SPS assembler and then run your test program.

Currently the simulator does not do optional commands such as multiply or divide. Ron Mak reports (Jan 3)

" It has a very nice graphical display that shows core changing as you run or single-step a program. It can also display a trace of the instructions being executed along with register values.

However, the simulator is buggy. For example, it cannot handle the "CS 0" instruction (it doesn't wrap the B address register afterwards to the end of memory, so you can't figure out the memory size). When I tried to run Van Snyder's Mersenne prime program, I discovered that the simulator can only add numbers up to 256 characters in length. After that, the overflow flag never gets set. Oops. So, either I set this program up incorrectly, or I would use it only with great caution." -

Dan McInnis has created several tutorial exercises including one where you compile and run your own "Hello World" printout :-))

Here is the script for Lesson #6 which assembles and runs a payroll program
;
;  This script assembles [and runs] a 1401 SSPS source file
;  The program is the payroll program in IBM SPS manual 
;
Show PrinterWindow
;turbo On
;
; Load card decks
;
CharMap ' 1234567890#@    /STUVWXYZ\,%   -JKLMNOPQR)$*   &ABCDEFGHI(.<   '
Deck 'SSPS-1.CRD'
Deck 'payroll2.SPS'
Deck 'SSPS-2.CRD'
Deck 'payroll2.SPS'

; Setup for assembling
Switch A On
LoadCard
; Run first phase
Start
IARCheck 578
; Run second phase
Start
IARCheck 829
Start
IARCheck 1356

Save Punch'payroll2.CRD'
Save Print 'payroll2.LST'
Turbo Off

; Execute assembled program if required
;If &2<>1 Exit
Reset
Deck 'payroll2.CRD'
Deck 'samdata.crd'
LoadCard
Start 

The B1401 simulator is written in Delphi5. The originator, Rob Storey intabits@optushome.com.au , reports

  • although by no means complete, [it is] capable of running substantial programs.
  • that he is very busy and can't get back to it in the foreseeable future.

Morgan Simulator
Java applet, manual
A really nice Graphical User's Interface, but the operation seems quirky. It runs the example one card print greeting program, but I (Ed Thelen) get hung if the mode switch gets into "Memory Scan" status.

Van Snyder reports that it hangs on his 11 card program.

Dave Morgan has not yet (Jan 4, 2005) responded to my quiry.

SIMH Simulator
From The Computer History Simulation Project
SIMH documentation by Bob Supnik
Supplemented I1401 User Manual - locally generated -
SIMH Help file
This simulator is command line only, no GUI at all. Really Spartan!

Van Snyder says Jan 11, 2005
SIMH actually can interpret memory data either as BCD or disassembled, depending on options to the "examine" command. Yeah, AFAIK, deposit needs to be done in hex to set word marks. But then, on the 1401 console, you had to do it with toggle switches.

To examine locations a-b as machine code, use

  e -m a-b    or    e -m a:b
This will dump length-3 fields as DSA (i.e., machine address converted to decimal), and any other invalid-length or invalid-opcode field as DCW.

To dump in BCD with word marks, looking somewhat like the kind of dump one used to get from the IBM customer-contributed library dump, or the equivalent German one, i.e., with word marks represented by "1" on the next line, use

  e -d a-b    or    e -d a:b
It won't run Tape Autocoder. AFAIK, the only problem with SIMH has to do with load-mode tape I/O. At least when I try to run autocoder, it crashes in phase 3 with corrupted memory.
I think it's a problem with load-mode read, but there is a chance there's a mistake in load-mode write. I haven't gotten around to checking the "tape" that the installation "deck" produces since this idea stuck me. We need to ask the 1401 how load-mode tape I/O works, after it's running, and adjust simh accordingly.
I suspect the problem is in the handling of load-mode tape input. I don't think we can repair it until the 1401 is running and we can ask it some questions that aren't in the manuals.

Ron Mak reports (Jan 3)

" SIMH seems to work fine, although it has a very primitive MS-DOS command-line interface.
The E command lets you examine memory, as in E 100-200. There is another command that you can enter first to set the display to hex, but I don't remember it exactly. It was something like SET CPU HEX.
If you type H to the prompt, you'll get a terse list of all the commands.

SIMH will take the "card deck" output from Van Synder's Autocoder assembler directly, without the need for any character conversions.

Here's how to feed it the card deck "punched" by Van's Autocoder assembler.

First, "attach" file mersenne2.cd to the card reader "cdr". (I modified the prime program by adding a halt instruction at the start.)
Then "attach" file mersenne2.out to the line printer "lpt".
Then "boot" from the card reader. At the halt instruction which I added, you can single step ("s") or continue ("c") to the final halt. .The printout is then in mersenne2.out.
C:\IBM1401\SIMH>i1401

IBM 1401 simulator V3.2-3
sim> at cdr mersenne2.cd
sim> at lpt mersenne2.out
sim> b cdr

HALT instruction, IS: 91 (W)
sim> c

HALT instruction, IS: 199 (R 30* 15* ' )
sim> q
Goodbye

C:\IBM1401\SIMH>type mersenne2.out
23RD MERSENNE PRIME = 2**11213 - 1
   1: 281411201369737313339315297584258419181866238201 [and so on for a page]

C:\IBM1401\SIMH>

A final bit of silliness. Since I use Java at work, I'm somewhat adept with Borland's configurable JBuilder Java development environment. As you can see from the attached screen shot, I've incorporated Van's Autocoder assembler into JBuilder, so now I can edit and assemble within a nice environment under Linux. (I don't have it naming the .cd and .lst files quite right yet.)

Ron Mak made a program to compute Pi using a modern implementation (complicated). Full of multiplies and divides, and it works well to its tested 500 places :-))
The really tricky part of the pi program was getting the virtual decimal points of the intermediate values lined up properly, especially for the multiply and divide instructions. That involved lots of address offsets (both static and dynamic), scaling (appending the right number of zeros after a value), and dynamically setting and clearing word marks. Otherwise, the program is a fairly straightforward implementation of the Borwein algorithm, which I outlined in the comments at the beginning of the program. (You can also go to http://www.apropos-logic.com/nc/ and click the "13-1 Computing pi" link at the left. My 1401 computations deviate slightly from the table in the use of temporaries. See also http://www.joyofpi.com/pi.html and http://www.cecm.sfu.ca/organics/papers/borwein/index.html.)

An interesting thought: Since the Borwein brothers developed this pi algorithm in 1985, it is unlikely that it was ever run on the actual 1401 hardware. So perhaps we'll soon have a first!

A challenge: The version of my program that computes 500 digits uses over 12K of memory. I only expended a small amount of effort to use memory efficiently, and there are many large temporaries. Can anyone write a program that computes 1,000 digits of pi?


Maybe if we show interest, "Bob Supnik (bob AT supnik DOT org - anti-spam encoded)" , might fix the tape commands. Maybe he could use input from experts? Also Van Snyder apparently can update to code for Bob Supnik to add to distribution.

SPS Assembler
Runs under B1401 Emulator above just fine. See Don McInnis for tutorials :-))

Autocoder Assembler

A newer (October 2007) version of the autocoder assembler and disassembler is available Van Snyder Utilities.
"With lots of help from Van Snyder, "Ron Mak has successfully compiled Van Snyder's Fortran based Autocoder Assembler to run under DOS - in Windows PCs.

Also from Ron Mak: "Note that you cannot use the card deck output from the Autocoder assembler directly as input to B1401. You'll have to create an appropriate character map first, and I didn't play with it long enough to figure out how to do that."

From Ron Mak

Unzip the attached file 
   [ or on Randy Thelen's machine in
       http://www.madscientistroom.org/ethelen/
     see autocoder-van-ron-05-01-04.zip
   ]
into a directory, and you will find 
autocoder.exe and i1401.exe (the SIMH 1401 simulator), 
along with my programs pi1c.s and pi5c.s.  You can edit 
Autocoder source programs with your favorite text editor, 
or even with editors you don't particularly like.
 
Here's a sample session.  The autocoder program reads pi5c.s 
(the source program) as input and creates the object card 
deck pi5c.cd and the assembly listing pi5c.lst. 

 Next, in the simulator, attach the card deck pi5c.cd to 
the card reader and attach the output file pi5c.out to 
the line printer.  Then boot from the card reader.  
   [see  SIMH documentation by Bob Supnik ]
        SIMH Help file

The program runs until the final halt instruction, and 
if you continue from there, you'll see that it branches 
back to the same halt instruction (as per the program).
 
You can set the CPU (actually, memory) display to hex, 
and examine memory.  
For each memory location, the right hex character is the 
BCD character, and the left hex character is the word mark 
and zone bits.  

For example, 48 is the character 8 with a word mark, 
and 3A is the character 0 (2-8 punches) with the plus sign 
(11-12 zone punches). 
 
Quit the simulator.  
Display the contents of the output file pi5c.out.
 
C:\IBM1401\test>autocoder -b I2 -o pi5c.cd -l pi5c.lst pi5c.s
    [for a meaning of the parameters, click here]

C:\IBM1401\test>i1401
    [SIMH documentation by Bob Supnik]
IBM 1401 simulator V3.2-3
sim> at cdr pi5c.cd
sim> at lpt pi5c.out
sim> b cdr
 
HALT instruction, IS: 953 (H)
sim> c
 
HALT instruction, IS: 953 (H)
sim> set cpu hex
sim> e 310-319
310:    48
311:    03
312:    0A
313:    01
314:    01
315:    09
316:    04
317:    09
318:    01
319:    02
sim> q
Goodbye
 
C:\IBM1401\test>type pi5c.out  
   [extra linefeeds added by Ed Thelen]
     ***** PI TO 500 DECIMAL PLACES *****  
 
 0001:  3.1415926535 8979323846 2643383279 5028841971 6939937510 
          5820974944 5923078164 0628620899 8628034825 3421170679
 0101:    8214808651 3282306647 0938446095 5058223172 5359408128 
          4811174502 8410270193 8521105559 6446229489 5493038196
 0201:    4428810975 6659334461 2847564823 3786783165 2712019091 
          4564856692 3460348610 4543266482 1339360726 0249141273
 0301:    7245870066 0631558817 4881520920 9628292540 9171536436 
          7892590360 0113305305 4882046652 1384146951 9415116094
 0401:    3305727036 5759591953 0921861173 8193261179 3105118548 
          0744623799 6274956735 1885752724 8912279381 8301194912
 
The simulator also has single-step and breakpoint commands. 
The h command prints a brief help message for each of the commands.  
Sorry, this is all command-line stuff without a fancy GUI.  
But have fun!
 
-- Ron
 
Ronald Mak
University Affiliated Research Center (UARC)
University of California at Santa Cruz
Mail Stop 269-3
NASA Ames Research Center
Moffett Field, CA  94035-1000
 
Office: (650) 604-0727
FAX: (650) 604-4036
rmak@mail.arc.nasa.gov
 

from Dan McInnis
Just a small adjustment to your instructions:
 
From DOS box:
    Go to directory in which you Unzipped the file.
    at prompt enter:  autocoder -bI2 -opi5c.cd -lpi5c.lst pi5c.s
 
The spaces threw me for a loop.

from Van Snyder

You can also examine memory similarly to how the 1401 hardware 
would dump it, or many dump programs would dump it: As BCD with 
word marks under it.

Use the -d option for the "examine" (e) command, 
     e.g. "e -d 310-319".  
The hyphen can alternatively be a colon.  You can also ask for 
a disassembled version of the code by using the -m option, 
     e.g. "e -m 4297:4300".  In the
current version of simh, invalid instructions or invalid 
instruction lengths cause trouble.  In the next version, 
length-three fields will be displayed as DSA, which will decode 
the address to decimal.  Other invalid lengths, 
and invalid op codes, will display as DCW @...@ in BCD.

Unlike a 1403 with A or H chain, simh shows every character 
in BCD (except for blank, of course).  

Here's the translation table:

char bcd_to_ascii[64] = {
          ' ',   '1',   '2',   '3',   '4',   '5',   '6',   '7',
          '8',   '9',   '0',   '#',   '@',   ':',   '>',   '(',
          '^',   '/',   'S',   'T',   'U',   'V',   'W',   'X',
          'Y',   'Z',   '\'',  ',',   '%',   '=',   '\\',  '+',
          '-',   'J',   'K',   'L',   'M',   'N',   'O',   'P',
          'Q',   'R',   '!',   '$',   '*',   ']',   ';',   '_',
          '&',   'A',   'B',   'C',   'D',   'E',   'F',   'G',
          'H',   'I',   '?',   '.',   ')',   '[',   '<',   '"' };

The bit order to index the table is BA8421.  
       So group mark is 63, or ".

As of v3.3-0 there's also an instruction history.  I added logging, 
but I don't know if Bob Supnik has added that to the distribution.  
Try "set debug " and see if it logs everything, 
including details of instruction execution.

I've also added column binary I/O, but not Move-and-Binary-[De]Code,
but I don't know if that's in the distribution yet, either.

simh can do lots of other things, 
   like stop at breakpoints and single-step.
The source archive has the documentation.  Get the source from
   http://simh.trailing-edge.com/.

-- 
Van Snyder                    |  What fraction of Americans believe 
Van.Snyder@jpl.nasa.gov       |  Wrestling is real and NASA is fake?


Ron Mak's Graphical User's Development Environment "ROPE" - which can simulate running the 1403 printer

- latest update April 2008, v0.7, adapted for Linus
- Sam Sjogren says there is a Rope version for the MAC, RopeX
- ROPE Wish List

Ron Mak has made a Graphical Development Environment that combines
- a simple editor, with line and character positions displayed :-))
the editor operates and interacts with
- Van Snyder's Autocoder assembler
- control of Bob Supnik's SIMH very competent and complete 1401 simulator
linked with the Autocoder output listing
set/unset a breakpoint, just click the line in the listing
and wrapped the above in a Graphical User's Interface (GUI) that makes life easy. You don't have to remember and pound any command line commands to look at memory, start and step the simulation, it reminds one of say TurboPascal or TurboBasic. If you want to examine 1401 memory, just open a window or two, want to see printed output? it is in a window on screen, want an operator display? open a window, want to step one instruction? click a button. You should see a demo! much better than any typed description!

Ron calls his environment "ROPE" (Ron's Own Programming Environment)

and I think it is WONDERFUL.

BigPrint, v0.4

BigPrint, v0.4
on a dual monitor system

Here is early User Instructions and update instructions

OK - Autocoder - Instruction manuals

- scanned 1401 Autocoder manual
Here is an on-line pdf of IBM's 1401 Reference Manual A24-1403-5 with a good description of the commands.

latest update April 2008, v0.7, can use new Autocoder V3.1, rough 1401 running timer

Down load the zip file (for Windows only) at http://www.apropos-logic.com/ROPE1401v07.zip. This version incorporates Van Snyder's Autocoder assembler v. 3.1. -- Ron
LINUX Version (June 25, 2008)
Download it from http://www.apropos-logic.com/ROPE1401v07Linux.tar.gz. This matches the latest Windows version that I did last April (http://www.apropos-logic.com/ROPE1401v07.zip). Unzip and detar into your favorite directory. Then cd to the directory and run the shell script "./rope".
Note that I compiled the two binary executables "autocoder" and "i1401r" for an Intel box. This is version 3.1 of Autocoder and (sigh, still) version 3.3-1 of i1401 (simh) slightly modified to talk nicely with my Java code. -- Ron
New features of ROPE v0.7
-------------------------
 
The new assembler options of Autocoder v3.1 are supported.
 
  - In the EDIT window, click the "Assembler options ..." button.
 
  - In the Assembler Options dialog box:
 
      - You can select multiple directory paths for the
        macro library.  Click the "Browse ..." button and
        hold down the control key as you select directories
        (or use the shift key to select a range).  The
        assembler command will include a -I option for
        each directory.
 
      - You can now edit the assembler command directly.
 
There are new timers that indicate elapsed wallclock time,
elapsed simulator time, and estimated elapsed 1401 time
while your program is executing.
 
  - In the EXEC window, click the "Timers ..." button.
 
  - In the TIMERS window, click the "Set speed" button to
    set the speed of your host machine.  Then click the "OK" button.
 
  - The estimated elapsed 1401 time is a VERY rough estimate.
    It's useful only if you run your program without breakpoints
    and without single- or auto-stepping.
 
  - Sorry, the timer values don't update until SIMH releases control.


An example of using Ron's ROPE :-))

In about 4 days I had written my (Ed Thelen's) first 1401 program, calculating Pi to 5,000 places in a 16,000 character simulated 1401. This simulation in desktop takes about 8 seconds! :-)) (Not code to brag about, but what do ya want from a nubie 1st timer in a hurry;-)) The version here was done a few days later with subroutines.

Well - it seems that the 5,000 character version will take longer to run on our 11.5 microsecond memory cycletime 1401 than I care to wait. Here is the output listing of a 2,000 character version (that runs in 8,000 characters of memory that might take about 4 hours to run.


From Ron Mak


Folks,

Version 0.3 of ROPE/1401 is ready for beta testing under Windows and Linux. This is a Java-based GUI with an Edit window where you can edit and assemble an IBM 1401 Autocoder program, and then you run the program in an Exec window that allows you to set breakpoints, single-step, and auto-step -- the window highlights the currently executing statement. There are also windows that have live displays of the console, memory, and the printout. See screen shot (88 K bytes).

ROPE/1401 is a Java wrapper around Van Snyder's Autocoder assembler (written in FORTRAN 90) and the SIMH 1401 simulator (written in C). Ed Thelen has put ROPE up on his website at http://www.ed-thelen.org/1401Project/new.html. Direct links into Ed's site:

Windows edition
Linux edition
Installation and user guide
You need to download and install the free Java Runtime Engine (JRE) from Sun Microsystems in order to run ROPE. See the installation guide.

Do we want another meeting of the software group? We now have several Autocoder and SPS programs that we can use for demos and for teaching. I can give a demo of ROPE on my Windows laptop. Dan McInnis has put together a set of lessons for using the Delphi-based B1401 "emulator" to learn SPS. We need to start thinking about what sort of classes we can conduct. If there's sufficient interest for a meeting, I'll arrange a time.

In the meantime, please give ROPE a try and send me feedback.

-- Ron


On Jan 16, 2007, Dan McInnis wrote:


HI,
 
ROPE (Ron's Own Programming Environment) accepts an ascii file representing
a card per line autocoder source program.  It provides options for type of loader
and other functions.  It will assemble the source file and produce error listings,
final lislting and object deck via ascii files.  If the assembly is successful it can
run the object deck with SIMH.
 
[the other comments, limitations, are no longer valid :-)) ]
 
Dan
 

ROPE Wish List
ROPE is fully functional, but there is always a bell or whistle that might be useful -
- There is a known bug - pseudo memory location 201 (in the printer buffer) gets blanked when it shouldn't
  1. Access a '.ini' like file with the following entries: - from George
    • Path name to source file
    • Path name to card input file
    • Name of macro directory
    • Memory display 'from' and 'to' values
  2. 'Kill Simulator' resets to initial state. This to eliminate the need to exit ROPE after changes to source code - from George
  3. Ability to change simulated 1401 console switches during run time - from Ed


Punching object decks from ROPE to a keypunch - by Stan Paddock (Jan 17, 2008)
Overview

  • The Computer History Museum has one of the only operational IBM 1401 computers left in the world.

  • While the 1401 has the maximum 16,000 BCD characters of memory, we don’t have any native program development software. The most popular tool was called Autocoder.

  • Between Ronald Mak and Van Snyder, a version of Autocoder and a 1401 simulator was written for the IBM PC. This system will generate card images on the IBM PC disk drive. Until now, these cards would have to be printed out and punched by hand on an IBM keypunch.

How It's Done

  • In order to control an IBM keypunch, there are 14 lines that need to be activated to cause the keypunch to punch data; 12 row punches, a space and a release. These wires were added to the wiring of an IBM 026 and wired to a bank or relays controlled by the IBM PC. Software written for the IBM PC will open a card image file and command the IBM 026 keypunch top punch the cards.

  • The interface to the keypunch is by relay contact only to protect both the keypunch and the PC. The wires are added in additional to the normal wires in the keypunch and in no way impact the normal functionality of the keypunch.

How To Use The System

  • The IBM PC is located in the foyer leading to the main IBM 1401 restoration room. It is a normal PC running Windows XP.

  • There is a power master switch just under the monitor. Turn this on and press power on the front of the IBM PC.

  • Log on as a normal user (Ed’s picture).

  • The machine has two disk drives. If you don’t already have a folder on the D: drive, use the windows explorer, and go to the D: drive and create a folder with your name. You may then create any sub-folders that you want.

  • There is an IBMROPE ICON on the screen that, when double-clicked, will bring up ROPE. You can develop, assemble and test your code from here.

  • There is an RmtPunch ICON on the screen that, when double-clicked, will bring up RmtPunch. This is the program that will send your data to the keypunch. The program will open with a screen asking you to select the file you want to punch. If the data is verified, you will be asked if you want to Punch or Exit.

  • If you are going to punch, put as many cards as required in the keypunch and feed/release at least 10 to insure the keypunch is warmed up. The ‘Auto Feed’ switch must be on and it is suggested that the print switch be off. Before you enter Punch, empty the output stacker so the blank cards do not get confused with the punched cards. After you enter the “P”, the keypunch will start.

  • If you need to stop the punching, press any key and the punching will pause at the end of the current card. This gives you an opportunity to add more cards to the input hopper.

  • If you have had a problem while punching, notice the count on the IBM PC monitor. You can re-start the program and skip the number of cards that punched correctly.

Coding Reference Documents
For a listing of Van Snyder's Autocoder parameters & help file, click here.
SIMH documentation by Bob Supnik
SIMH Help file

We are blessed by having a large number of 1401 documents on line at

http://www.bitsavers.org/pdf/ibm/140x/
courtesy of Al Kossow.
Of particular interest to people wishing to code and simulate the 1401 are:
- Reference Manual - IBM 1401 Data Processing System - (A24-1403-5_1401RefMan_Apr62.pdf)
- Special Feature Instructions - including multiply and divide - (A24-3071-2_1401_specFeature.pdf)
- IBM 1401 Symbolic Programming Systems: SPS-1 and SPS-2 - (C24-1480-0_1401symbPgmSys.pdf)
Specifications and Operating Procedures
- Symbolic Programming System - Student Materials - (R29-0044-2_1401SPStraining.pdf)
- AutoCoder Specification - (J24-1434-2_autocoderSpec_61.pdf)
- Basic Coding Techniques for the 1401 Computer - (TIE4-0064_1401codingTechniq.pdf)
- IBM 1401,1440 AND 1460 Programming and Operating Techniques by Jack Melnick - (TIE5-0021_1401pgmgTechni.pdf)
- 1401 Programmers Guide by Paul Bartholet - (TIE6309-0235_1401pgmrsGuide.pdf)


Last updated Feb 23, 2009
Return to
main page
test stuff 1401-FORTRAN