1401 Disassembler

Table of Contents

And I have a new project :-((

I wanna make a disassembler for the 1401


1401 system
1440 system, cost/performance reduced 1401

"programs easily adopted to 1401"
1460 system, logically but not physically identical to 1401
1410-7010 system, 1401 with 5 character memory address
up to 80,000 characters max
http://www.bitsavers.org/pdf/ibm/140x/C28-0318-3_1410_basicConcep.pdf

input

- card images (alphanumeric :-))
- something called "compressed"?
- line printer dump?
and output
- AutoCoder?,
- SPS? Symbolic Programming System
with the better possibility of
- manually labeling addresses with human oriented names
can generate pseudo named addresses as well as absolute addresses
ie 1st detected addresses can be ZZ0000, ZZ0001, etc
- manually reconstituting storage areas,
RECF DCW # 10
SALEF DCW # 12
? from I/O instructions?
? from flag and zone set instructions?
? common technique of using part of an instruction as a constant ...
- more clearly labeling indexing, etc
- instruction address modification by other instructions is acceptable ;-|
- Autocoder allows overlays,
- Autocoder allows literals, automatically assigning storage and word marks
- Area-defining Literals are represented by a DCW entry
- un-wordmarked areas may be confusing
- about Record Marks?
- about Group Marks? Group Mark with word mark?
- manually adding comments helpful to humans
I usually do a disassembler for machines I wish to learn
Fortunately it promises to be a *GREAT* deal easier than
trying to do it for that $%^&* Intel 486 !!!!
(Well - except for the krazy I/O instructions :-((

Inputs
a) non-binary card images - 026 conventions?
converted to ASCII
b) 1403 printer memory dumps
- internally converted to non-binary card images?
c) http://www.bitsavers.org/pdf/ibm/140x/1401-UT-026_TapeToPrntrPgm.pdf
"Tape to Printer Program" mentions " page 15, mentions
"eliminate the need to condense the assembled patch."
What is "condense"?
End of document shows listing - SPS or Autocoder?
listing of program (object) deck

what is the format for

Several passes of input, or 2nd pass
pass 1, assign op codes, indexing, ... , absolute addresses, look for transfer
make separate files of absolute defs and refs
http://www.bitsavers.org/pdf/ibm/140x/1401ReferenceCard.pdf
lists many instructions, nmunonics, opcodes, etc
see INSTRUCTION LIST below
pass 2 sort defs and refs,
merge into cross reference file
making 6 digit provisional names
CCCnnn code names
DDDnnn data names
IOInnn I/O names
XXXnnn index register names
pass 3 make autocoder source with provisional names ,
comment card after source card with provisional name == absolute address
Outputs
   a) autocoder source - in ASCII character set
         - optional output conversion to ??

Controls
   a) input path
   b) input type, card image, card text image, printer text image
   b) output path

Challenges
   BCD to/from ASCII
     alphabetic conversion , print conventions
   language

   find DataProducts image conventions

   how to convert program output to effective AutoCoder input


Resources
 can't find 1401 autocoder?
  http://www.bitsavers.org/pdf/ibm/140x/
  http://www.bitsavers.org/pdf/ibm/140x/R29-0044-2_1401SPStraining.pdf
       SPS Training Manual  
  http://www.bitsavers.org/pdf/ibm/140x/J24-1434-2_autocoderSpec_61.pdf
     Autocoder has macros, requires minimum 4,000 character, 4 tapes
         I am up to about page 10 in this manual
  http://www.bitsavers.org/pdf/ibm/140x/TIE4-0064_1401codingTechniq.pdf

error messages
  - illegal input character
         
  - illegal input format

Probable/possible card format on media
   x,y,0,1,2,3,4,5,6,7,8,9
punches hi to low order in a byte pair.



A goal -
   get 1401 decks read into media, 
      say floppy or CD-ROM
File system?
    FAT16 or FAT32?

file naming conventions ???
  each directory have a .txt file giving as full 
  description as practical


SPS Source Format
SPS input format -
   from http://www.bitsavers.org/pdf/ibm/140x/R29-0044-2_1401SPStraining.pdf
   Col     Name       Usage
   03-05   Line
   06-07   Count
   08-13   Label      if asterix in col 8, a comment card
   14-16   Operation
   17-22   (A) Operand Address
   23      (A) Operand +_
   24-26   (A) Operand Char. Adj.
   27      (A) Operand Ind.
   28-33   (B) Operand Address
   34      (B) Operand +_
   35-37   (B) Operand Char. Adj.
   38      (B) Operand Ind.
   39      d
   40-55   Comments
   56-80   must not be punched




AutoCoder Source Format
1401/1410 Autocoder Coding format -
http://www.bitsavers.org/pdf/ibm/140x/J24-1434-2_autocoderSpec_61.pdf
   Col     Name       Usage
   (01-02) page #     Any alphamerical characters, use standard 1401 collating sequence
   03-05   Line       first 2 characters pre-numbered
   06-15   Label              a dotted line between columns 11&12 - 6 char max
   16-20   Operation
   21-72   Operand
   73-75     reserved for processor
   76-80   program or section id if included





AutoCoder Samples
Example - Figure 3
           A          3101,140
creates    
           A_ A01 140   ; note that leading zeros cam be eliminated in Autocoder

Another example - Figure 4
	   MLC   TOTAL,ACCUM+X2
creates
	   M_	  A01  1M0
causing contents of the location labeled TOTAL to be placed in an area labeled
	ACCUM as modified by the contents of inndex location 2.
	TOTAL is the label for location 3101 and ACCUM is the label for location
	140.  The M in the tens position of the B-address is a 4-punch with
	an 11-overpunch.  The 11-overpunch is the B-bit tag for index location 2.

A  remark can be included anywhere in the operand field 
  if at least two non-significant spaces separate it from the operands.
Also, an asterix in column 6 (first column of label) makes rest of card comments.
IBM CARD CHARACTER CODE
from http://www.bitsavers.org/pdf/ibm/140x/R29-0044-2_1401SPStraining.pdf ZONE
PUNCH
NO 0 1 2 3 4 5 6 7 8 9 3-8 4-8
12 & +0 A B C D E F G H I . square
11 - -0 J K L M N O P Q R $ *
0 xxx xxx / S T U V W X Y Z , %
NO blnk0 1 2 3 4 5 6 7 8 9 # @
Notes:
xxx is illegal punch combination
# is an = in the Fortran character set
a record mark ++ is not included in the above card code


Memory Addressing

http://www.bitsavers.org/pdf/ibm/140x/A24-1403-5_1401RefMan_Apr62.pdf - page 18
Decimal 1401
000 - 999 000 - 999 No zone bits
1000 - 1099 +00 - +99 A-bit, using 0 zone
1100 - /00 - "
1200 - S00 - "
1300 - T00 - "
1400 - U00 - "
1500 - V00 - "
1600 - W00 - "
1700 - X00 - "
1800 - Y00 - "
1900 - Z00 - "
2000 - I00 - B bit using 11-zone
2100 - J00 - "
2200 - K00 - "
2300 - L00 - "
2400 - M00 - "
2500 - N00 - "
2600 - O00 - "
2700 - P00 - "
2800 - Q00 - "
2900 - R00 - "
3000 - ?00 - A-B using 12 zone
3100 - A00 - "
3200 - B00 - "
3300 - C00 - "
3400 - D00 - "
3500 - E00 - "
3600 - F00 - "
3700 - G00 - "
3800 - H00 - "
3900 - I00 - I99 "
4000 - 00+ - x
5000 - 00+ - x
6000 - 00+ - x
7000 - 00+ - x
8000 - 00+ - x
9000 - 00+ - x
9000 - 00+ - x
10000 - 00+ - x
11000 - 00+ - x
12000 - 00+ - x
13000 - 00+ - x
14000 - 00+ - x
15000 - 00+ - x


1401 Colating Sequence


** INSTRUCTION LIST from

http://www.bitsavers.org/pdf/ibm/140x/1401ReferenceCard.pdf
Op Code: This is always a single character which defines the basic operation being performed. A word mark is always associated with the operation code position of an instruction.
A-Address: This always consists of three characters. It can identify the units position of the A-field, or it can be used to select a special unit or feature (tape unit, 1412 magnetic character reader, column binary feature, disk storage, inauiry, etc.
I-Address: (in A-address position) Instructions that can cause program branches use the I-address to specify the location of the next instruction to be executed if a branch occurs.
B-Address: This is a Three-character storage address associated with the B-field. It usually addresses the units position of the B-field, byt in some operations, such as tape or disk record read and write, it specifies the high-order position of a record storage area.
d-Character: The d-character is used to modify an operation code. It is a single alphabetic, numerical, or special character, postioned as the last character of an instruction. It can be used with instructions of any length.


List of instruction decodes - 1407, Disk Storage, 1412, not included!!
includes Tape Operations - http://www.bitsavers.org/pdf/ibm/140x/A24-3069-1_1401_tapeIOinstr.pdf
OPERATION OP
CODE
nmunonic
Multiply* @ M
Divide* % D
Clear Word Mark ^ CW
Set Word Mark ,
Clear Storage / CS
Halt . H
Modify Address* # MA
Zero and Add +0 ZA
Zero and Subtract -0 ZS
Read a Card 1 R
Read Column Binary 1C - C is Modifier
Write a Line 2^  
Write a Word Marks 2 W
Write-Read 3 WR
Punch a Card 4 O
Punch Column Binary 4C - C is Modifier
Read-Punch Feed* 4R  
Read-Punch Feed and Branch* 4(I)R
Read-Punch 5 RP
Write-Punch 6 WP
Write-Read Punch Feed* 6R  
Write and Punch 6(I)R  
Write, Read and Punch 7 WRP
Start Read Feed* 8 SRF
Start Punch Feed* 9 SPF
Add A A
Branch B(I)B
Branch if Indicator ON B(I)d d is modifier
    +0 - Reader Error if I/O Check Stop Switch OFF
    -0 - Punch Error if I.O Check Stop Switch OFF
    + = {romter Errpr of I/O Check Stop Switch OFF
    @ - Carr. Chan #12
    % - Processing Check with Process Check Switch OFF
    / - Unequal Compare B <> A
    * - Inquiry Clear (1407)
    9 - Carr. Chan. #9
    A - "Last Card: Switch
    B - Sense Switch B*
    C - Sense Switch C*
    D - Sense Switch D*
    E - Sense Switch E*
    F - Sense Switch F*
    G - Sense Switch G*
    K - End of Reel*
    L - Tape Error*
    S - Equale Compare B=A*
    P - Printer Busy*
    Q - Inquiry Request (1407)
    R - Carriage Busy*
   
    T - Low Compare B < A*
    U - High compare B > A*
   
    Z - Overflow
   
Branch if Character is Equal B(I)(B)d Contents of B compared to d
Branch if WM and/ or Zone V(I)BWZ
Branch B(I)B
Branch B(I)B
Branch if End of Reel BxxxK SPS=B, A=BEF
Branch if Tape Error BxxxL SPS=b, A=BER
Compare C C
Move Numerical D MN
Move Characters and Edit E MCE
Control Carriage F CC
Store B-Address Register* H SBR
Select Stacker K SS
Load Character to A Word Mark L LCA
Read Tape with Word Marks L%UnxxxR SPS=LU, A=RTW
Write Tape with Word Marks L%UnxxxW SPS=LU, A=WTW
Move Characters to A or B Word Mark M MCW
Read Tape M%UnxxxR SPS=MU, A=RT
Write Tape M%UnxxxT SPS=MU, A=WT
No Operation N NOP
Store A-Address Register* Q SAR
Subtract S S
Diagnostic Read U%UnA SPS=CU, A=
Backspace Tape Record U%UnB SPS=CU, A=BSP
Skip and Blank Tape U%UnE SPS=CU, A=SKP
Write Tape Mark U%UnM SPS=CU, A=WTM
Rewind Tape U%UnR SPS=CU, A=RWD
Rewind Tape and Unload U%UnU SPS=CU, A=RWU
Move Zone Y MZ
Move Characters amd Suppress Zeros Z MCS


AutoCoder PseudoOPs
  Declarative Operations
DCW Define Constant with Word Mark
DC Define Constant (no Word Mark)
DS Define Symbol
DSA Define Symbol Address
DA Define Area
EQU Equate