1. IBM 1401 simulator usage¶
- Date:
2015-03-31
- Revision:
$Format:%H$
- Copyright:
See LICENSE.txt for terms of use.
This memorandum documents the IBM 1401 simulator.
1.1. Simulator files¶
sim/
scp.h
sim_console.h
sim_defs.h
sim_fio.h
sim_rev.h
sim_sock.h
sim_tape.h
sim_timer.h
sim_tmxr.h
scp.c
sim_console.c
sim_fio.c
sim_sock.c
sim_tape.c
sim_timer.c
sim_tmxr.c
sim/i1401/
i1401_defs.h
i1401_dat.h
i1401_cpu.c
i1401_cd.c
i1401_iq.c
i1401_lp.c
i1401_dp.c
i1401_mt.c
i1401_sys.c
1.2. IBM 1401 features¶
The IBM 1401 simulator is configured as follows:
Device names |
Simulates |
---|---|
|
IBM 1401 CPU with 16K of memory |
|
IBM 1402 card reader/punch |
|
IBM 1403 line printer |
|
IBM 1407 inquiry terminal |
|
IBM 1311 disk pack with five drives |
|
IBM 729 7-track magnetic tape controller with six drives |
The IBM 1401 simulator implements many unique stop conditions. On almost any kind of error the simulator stops:
Unimplemented opcode
Reference to non-existent memory
Reference to non-existent device
No word mark under opcode
Invalid A address
Invalid B address
Invalid instruction length
Invalid modifier character
Invalid branch address
Invalid magtape unit number
Invalid magtape record length
Write to locked magtape drive
Skip to unpunched carriage control tape channel
Card reader hopper empty
Address register wrap-around
I/O check with I/O stop switch set
Invalid disk drive
Invalid disk sector address
Invalid disk sector count
Invalid disk address compare
The LOAD
command is used to load a line printer carriage-control tape.
The DUMP
command is not implemented.
1.2.1. CPU
¶
The CPU
options include a number of special features and the size of main memory.
Note that the Modify Address special feature is always included when memory size is greater than 4K.
SET CPU XSA Enable advanced programming special feature
SET CPU NOXSA Disable advanced programming
SET CPU HLE Enable high/low/equal special feature
SET CPU NOHLE Disable high/low/equal
SET CPU BBE Enable branch on bit equal special feature
SET CPU NOBBE Disable branch on bit equal
SET CPU MR Enable move record special feature
SET CPU NOMR Disable move record
SET CPU EPE Enable extended print edit special feature
SET CPU NOEPE Disable extended print edit
SET CPU MDV Enable multiply/divide special feature
SET CPU NOMDV Disable multiply/divide
SET CPU 4K Set memory size = 4K
SET CPU 8K Set memory size = 8K
SET CPU 12K Set memory size = 12K
SET CPU 16K Set memory size = 16K
If memory size is being reduced, and the memory being truncated contains non-zero data, the simulator asks for confirmation. Data in the truncated portion of memory is lost. Initially, memory size is 16K, and all special features are enabled.
Memory is implemented as 7-bit BCD characters, as follows:
6 5 4 3 2 1 0
╷ ╷ ╷ ╷ ╷ ╷ ╷
│ B A 8 4 2 1
│ bit bit │ │ │ │
│ ╘═══╤══╛ ╘═════╧══╤══╧═════╛
Word mark Zone Digit
In BCD, the decimal digits 0-9 are (octal) values 012
,
001
,
002
,
003
,
004
,
005
,
006
,
007
,
010
,
011
,
respectively.
Signs are encoded in the zone bits,
with 00
, 01
, and 11
being positive,
and 10
being negative.
CPU registers include the visible state of the processor. The 1401 has no interrupt system.
Name |
Size |
Comments |
---|---|---|
|
14 |
Instruction storage address register (PC) |
|
14 |
A storage address register |
|
14 |
B storage address register |
|
1 |
AS invalid flag |
|
1 |
BS invalid flag |
|
1 |
Sense switch A |
|
1 |
Sense switch B |
|
1 |
Sense switch C |
|
1 |
Sense switch D |
|
1 |
Sense switch E |
|
1 |
Sense switch F |
|
1 |
Sense switch G |
|
1 |
Equal compare indicator |
|
1 |
Unequal compare indicator |
|
1 |
High compare indicator |
|
1 |
Low compare indicator |
|
1 |
Overflow indicator |
|
1 |
I/O check switch |
|
1 |
Process check switch |
|
14 |
IS prior to last branch; most recent IS change first |
|
8 |
Interrupt character |
The CPU can maintain a history of the most recently executed instructions.
This is controlled by the SET CPU HISTORY
and SHOW CPU HISTORY
commands:
SET CPU HISTORY Clear history buffer
SET CPU HISTORY=0 Disable history
SET CPU HISTORY=n Enable history, length = n
SHOW CPU HISTORY Print CPU history
SHOW CPU HISTORY=n Print first 'n' entries of CPU history
The maximum length for the history is 65536 entries.
The original character encoding used by the 1401 simulator was revised to be compatible with the coding used by Paul Pierce’s 709X and 1401 simulators. The user can select between the original (old) and compatible (new) encodings, as follows:
SET CPU OLDCONVERSIONS Use original character encoding
SET CPU NEWCONVERSIONS Use compatible character encoding
NEWCONVERSIONS
is the default.
1.2.2. 1402 card reader/punch (CDR
, CDP
, STKR
)¶
The IBM 1402 card/reader punch is simulated as three independent devices:
the card reader (CDR
),
the card punch (CDP
),
and the reader and punch stackers (STKR
).
STKR
units 0, 1, 2, and 4 correspond to the reader normal stacker,
reader stacker 1,
shared stacker 2/8,
and punch stacker 4,
respectively.
Card punch and stacker units support both the business (1403 print chain A) and Fortran (1403 H chain) character sets:
SET CDP BUSINESS Business character set
SET CDP FORTRAN Fortran character set
The business character set is the default.
The card reader supports the BOOT
command.
BOOT CDR
reads a card image into locations 1-80,
sets a word mark under location 1,
clears storage,
and then transfers control to location 1.
The card reader normally reads data from disk files,
while the punch and stackers write data to disk files.
Text cards are simulated as ASCII text lines with terminating newlines;
column binary cards are simulated as ASCII text lines with adjacent characters supplying half of the 12b column code.
For each unit,
the POS
register specifies the number of the next data item to be read or written.
Thus, by changing POS
,
the user can backspace or advance these devices.
As a convenience for testing, the simulator supports entering cards from the console keyboard. To enable and disable default input from the keyboard:
SET CDR DEFAULT Default to keyboard if no file attached
SET CDP NODEFAULT Always take input from an attached file
The card reader signals its readiness to read a card by typing:
[ENTER CARD]
Input is terminated by a carriage return.
Backspace (rubout) will erase the previously entered character and echo backslash (\
).
^E
will interrupt the wait loop and return control to the simulator control package.
While taking input from the keyboard,
the card reader’s “last card” logic is disabled.
The card reader registers are:
Name |
Size |
Comments |
---|---|---|
|
1 |
Last card indicator |
|
1 |
Error indicator |
|
1 |
Stacker 1 select flag |
|
1 |
Stacker 2 select flag |
|
32 |
Position in reader input file |
|
24 |
Delay window for stacker select |
|
8 |
Reader buffer |
The card punch registers are:
Name |
Size |
Comments |
---|---|---|
|
1 |
Error indicator |
|
1 |
Stacker 4 select flag |
|
1 |
Stacker 8 select flag |
|
32 |
Position in punch output file |
The stacker registers are:
Name |
Size |
Comments |
---|---|---|
|
32 |
Position, normal reader stack |
|
32 |
Position, reader stacker 1 |
|
32 |
Position, shared stacker 2/8 |
|
32 |
Position, punch stacker 4 |
Error handling is as follows:
Device |
Error |
Processed as |
---|---|---|
Reader |
End-of-file |
If |
Reader punch |
Not attached |
Report error and stop |
OS I/O error |
Print error message if |
|
Stacker |
Not attached |
Ignored |
OS I/O |
Error print error message
if |
1.2.3. 1403 line printer (LPT
)¶
The IBM 1403 line printer (LPT
) writes its data,
converted to ASCII,
to a disk file.
The POS
register specifies the number of the next data item to be read or written.
Thus, by changing POS
,
the user can backspace or advance the printer.
The line printer implements both 48- and 64-character print chains:
SET LPT 64 64-character print chain
SET LPT 48 48-character print chain
The line printer also implements both the business (1403 print chain A) and Fortran (1403 H chain) character sets:
SET LPT BUSINESS Business print character set
SET LPT FORTRAN Fortran character set
The default is the 64-character print chain with the business set.
The line printer can be set to output to the console window if no file is attached:
SET LPT DEFAULT Default output to console if not attached
SET LPT NODEFAULT Always output to a file
In addition,
the line printer can be programmed with a carriage control tape.
The LOAD
command loads a new carriage control tape:
LOAD <file> Load carriage control tape file
The format of a carriage control tape consists of multiple lines. Each line contains an optional repeat count, enclosed in parentheses, optionally followed by a series of column numbers separated by commas. Column numbers must be between 1 and 12; a column number of zero denotes top of form. The following are all legal carriage control specifications:
|
No punch |
|
5 lines with no punches |
|
Columns 1, 5, 7, 8 punched |
|
10 lines with column 2 punched |
|
Column 1 punched; top of form |
The default form is 66 lines long, with column 1 and the top of form mark on line 1, and the rest blank.
The line printer registers are:
Name |
Size |
Comments |
---|---|---|
|
8 |
Number of newlines after next print |
|
1 |
Carriage control flag (1 = skip, 0 = space) |
|
8 |
Carriage control tape pointer |
|
8 |
Carriage control tape length (read-only) |
|
1 |
Error indicator |
|
32 |
Position in the output file |
|
32 |
Carriage control tape array |
Error handling is as follows:
Error |
Processed as |
---|---|
Not attached |
Report error and stop |
OS I/O error |
Print error message if |
1.2.4. 1407 inquiry terminal (INQ
)¶
The IBM 1407 inquiry terminal (INQ
) is a half-duplex console.
It polls the console keyboard periodically for inquiry requests.
The inquiry terminal supports both the business (1403 print chain A) and Fortran (1403 H chain) character sets for output:
SET INQ BUSINESS Business character set
SET INQ FORTRAN Fortran character set
The business character set is the default.
The inquiry terminal registers are:
Name |
Size |
Comments |
---|---|---|
|
7 |
Inquiry request character (initially |
|
1 |
Inquiry request indicator |
|
1 |
Inquiry cleared indicator |
|
24 |
Polling interval |
When the 1401 CPU requests input from the keyboard,
the message [Enter]
is printed out,
followed by a newline.
The CPU hangs waiting for input until either the return/enter key is pressed,
or the inquiry request character is typed in.
The latter cancels the type-in and sets INC
.
The inquiry terminal has no errors.
1.2.5. 1311 disk pack (DP
)¶
The disk pack controller supports 5 drives, numbered 0 through 4. Disk pack options include the ability to enable address writing (formatting).
SET DPn ADDROFF Set unit 'n' address enable off
SET DPn ADDRON Set unit 'n' address enable on
Units can also be set ENABLED
or DISABLED
.
Unlike most simulated disks, the 1311 includes explicit representation for sector addresses. This is to support non-standard formats, such as the inclusion of the drive number in the sector address. As a result, 1311 sectors are 106 characters long: 6 address characters and 100 data characters. If the 1311 has not been formatted, the addresses are blanks and are synthesized, if needed, based on the sector number.
The 1311 also supports two modes of operation: move mode and load mode. In move mode, word marks are ignored on writes and left untouched on reads, and sectors hold 100 characters. In load mode, word marks are included on writes and stored on reads, and sectors hold 90 characters. No attempt is made to deal with sectors written in load mode and read in move mode, or vice versa; on a real 1401, this causes a fatal parity error.
The disk pack controller implements these registers:
Name |
Size |
Comments |
---|---|---|
|
1 |
Access error indicator |
|
1 |
Parity or write check error indicator |
|
1 |
Wrong length record error indicator |
|
1 |
Unequal address compare error indicator |
|
1 |
Any disk error indicator |
|
1 |
Disk access busy indicator |
|
3 |
Most recent function |
|
24 |
Seek time |
The 1311 has a primitive overlapped seek capability.
If TIME
is set non-zero,
the 1311 will report itself busy for the specified amount of time following a seek.
This allows programs to utilize the seek time for processing.
Error handling is as follows:
Error |
Processed as |
---|---|
Not attached |
Set |
1311 data files are buffered in memory; therefore, end-of-file and OS I/O errors cannot occur.
1.2.6. 729 magnetic tape (MT
)¶
The magnetic tape controller supports six drives, numbered 1 through 6. Magnetic tape options include the ability to make units write enabled or write locked.
SET MTn LOCKED Set unit 'n' write locked
SET MTn WRITEENABLED Set unit 'n' write enabled
Magnetic tape units can be set to a specific reel capacity in MB, or to unlimited capacity:
SET MTn CAPAC=m Set unit 'n' capacity to 'm' MB (0 = unlimited)
SHOW MTn CAPAC Show unit 'n' capacity in MB
Units can also be set ENABLED
or DISABLED
.
The magnetic tape simulator supports the BOOT
command.
BOOT MT
reads the first record off tape,
starting at location 1,
and then branches to it.
BOOT -N MT
reads the next record off tape,
without rewinding,
starting at location 1,
and then branches to it.
The magnetic tape controller implements these registers:
Name |
Size |
Comments |
---|---|---|
|
1 |
End-of-file indicator |
|
1 |
Error indicator |
|
1 |
Parity error indicator |
|
32 |
Position, drives 1 to 6 |
Error handling is as follows:
Error |
Processed as |
---|---|
Not attached |
Report error and stop |
End-of-file |
Set error indicator |
OS I/O error |
Print error message,
set error indicator if |
1.3. Symbolic display and input¶
The IBM 1401 simulator implements symbolic display and input. Display is controlled by command-line switches:
|
Display as single character (BCD for |
|
Display as wordmark terminated BCD string ( |
|
Display instruction mnemonics ( |
|
Display 50 characters per line, with word marks denoted by “1” on the line below |
In a CPU
character display,
word marks are denoted by `
.
Input parsing is controlled by the first character typed in or by command-line switches:
|
|
Alphabetic |
Instruction mnemonic |
Numeric |
Octal number |
Instruction input is free format, with spaces separating fields. There are six instruction formats: 1, 2, 4, 5, 7, and 8 characters:
1 character |
|
2 character |
|
4 character |
|
5 character |
|
7 character |
|
8 character |
|
Addresses are always decimal,
except for special I/O addresses in the A field,
which may be specified as %xy
,
where x
denotes the device and y
the unit number.
For the CPU
,
string input may encompass multiple characters.
A word mark is denoted by `
and must precede the character to be marked.
All other devices can only accept single character input,
without word marks.
1.4. Character sets¶
The IBM 1401 uses a 6b character code called BCD (binary-coded decimal). Some of the characters have no equivalent in ASCII and require different representations:
BCD code |
representation |
character |
chains |
---|---|---|---|
|
space |
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
|
|
|
|
|
|
|
|
blank in A, H chains |
|
|
|
blank in A, H chains |
|
|
|
tape mark |
blank in A, H chains |
|
|
alternate blank |
blank in A, H chains |
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
record mark |
|
|
|
||
|
|
|
|
|
|
word mark |
blank in A, H chains |
|
|
blank in A, H chains |
|
|
|
blank in A, H chains |
|
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
blank in A, H chains |
|
|
|
blank in A, H chains |
|
|
|
delta |
blank in A, H chains |
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
lozenge |
|
|
|
blank in A, H chains |
|
|
|
blank in A, H chains |
|
|
|
group mark |
blank in A, H chains |
1.4.1. Old conversions¶
Starting with V3.5-1, the 1401 simulator was changed to use the same character set as the SIMH 7094 (and other 7094 simulators). This involved the following changes:
Code |
V3.5-0 or earlier |
V3.5-1 or later |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
In addition,
the word mark indicator was changed from ~
to `
.
The 1401 simulator can be set to operate with either set of conventions:
SET CPU OLDCONVERSIONS
SET CPU NEWCONVERSIONS
The default is NEWCONVERSIONS
.