Simh/i1401 with COBOL on docker(1)ではCOBOLコンパイラのテープイメージを作成しました。
これを使ってCOBOLプログラムを実行します。
cobol.iniはWindows用ですので、Linux用を用意します。
cobol_linux.ini
SET CPU 16K
set CPU NEWCONVERSIONS
SET CDP BUSINESS
SET LPT BUSINESS
at mt3 -n scratch.mt3
at mt4 -n scratch.mt4
at mt5 -n scratch.mt5
at mt6 -n scratch.mt6
at mt1 Cobol.tap
at cdr %1
; output printer output to a file
at lpt -n printer.txt
; output printer output to console
; SET LPT DEFAULT
d ssa 1
d ssb 0
d ssc 1
d ssd 0
d sse 0
; Sense Switch F: ON=if IOCS generation by cobol is not desired
d ssf 1
; Sense Switch G: ON=if the cobol source symbolic listing option is used
d ssg 1
boot mt1
; now compile cobol
; stops to ask for output
det lpt
echo
echo === Now cobol compilation printer output will be listed ===
echo
echo
!cat printer.txt
echo
echo === end of printer output ===
echo
at lpt printer.txt
; Sense Switch B: ON for punched autocoder
d ssb 1
; Sense Switch D: ON for printed listing
d ssd 1
at cdp -n obj_deck.s
cont
; now assemble the generated autocode program
; now generating object deck
det lpt
echo
echo === Now autocode generated program printer output will be listed ===
echo
echo
!cat printer.txt
echo
echo === end of printer output ===
echo
bye
:end
また、アセンブルするautocoder.iniもWindows用ですのでLinux用を用意します。
autocoder_linux.ini
SET CPU 16K
set CPU NEWCONVERSIONS
SET CDP BUSINESS
SET LPT BUSINESS
at mt1 Autocoder.cobol.tap
at mt3 -n scratch.mt3
at mt4 -n scratch.mt4
at mt5 -n scratch.mt5
at mt6 -n scratch.mt6
at cdr obj_deck.s
at cdp -n obj_deck.crd
; output printer output to a file
at lpt printer.txt
; output printer output to console
; SET LPT DEFAULT
dep ssa 1
boot mt1
; autocode assembling done.
; Reset the computer to load assembled program
dep ssf 0
cont
det lpt
echo
echo === Now autocode assembly printer output will be listed ===
echo
echo
!cat printer.txt
echo
echo === end of printer output ===
echo
det cdr
echo
echo
; Now run the compiled program
reset
at mt3 -n scratch.mt3
at mt4 -n scratch.mt4
at mt5 -n scratch.mt5
at mt6 -n scratch.mt6
at cdr obj_deck.crd
at cdp -n out_deck.crd
set lpt default
dep ssa 1
; set -n console log=a.log
echo
boot cdr
bye
:end
準備ができたので、COBOLプログラムをコンパイルします。
/simh/generation # cd ..
/simh # wget http://ibm-1401.info/pictures/000COBOL/i1401-Cobol.zip
Connecting to ibm-1401.info (45.40.183.1:80)
i1401-Cobol.zip 100% |****************************************************************| 170k 0:00:00 ETA
/simh # unzip i1401-Cobol.zip
Archive: i1401-Cobol.zip
inflating: Cobol/Autocoder.cobol.tap
inflating: Cobol/autocoder.ini
inflating: Cobol/cobol.ini
inflating: Cobol/Cobol.tap
inflating: Cobol/Hello.cob
inflating: Cobol/obj_deck.crd
inflating: Cobol/obj_deck.s
inflating: Cobol/out_deck.crd
inflating: Cobol/printer.txt
inflating: Cobol/run Cobol Hello World.bat
inflating: Cobol/scratch.mt3
inflating: Cobol/scratch.mt4
inflating: Cobol/scratch.mt5
inflating: Cobol/scratch.mt6
/simh # cd Cobol
/simh/Cobol # cp ../generation/Autocoder.cobol.tap .
/simh/Cobol # cp ../generation/Cobol.tap .
/simh/Cobol # cp ../cobol_linux.ini .
/simh/Cobol # dos2unix Hello.cob
dos2unix: converting file Hello.cob to Unix format...
/simh/Cobol # i1401 cobol_linux.ini Hello.cob
IBM 1401 simulator V4.0-0 Current git commit id: 9e719822
/simh/Cobol/cobol_linux.ini-7> at mt3 -n scratch.mt3
MT: creating new file: scratch.mt3
/simh/Cobol/cobol_linux.ini-8> at mt4 -n scratch.mt4
MT: creating new file: scratch.mt4
/simh/Cobol/cobol_linux.ini-9> at mt5 -n scratch.mt5
MT: creating new file: scratch.mt5
/simh/Cobol/cobol_linux.ini-10> at mt6 -n scratch.mt6
MT: creating new file: scratch.mt6
/simh/Cobol/cobol_linux.ini-12> at mt1 Cobol.tap
Tape Image 'Cobol.tap' scanned as SIMH format.
contains 254296 bytes of tape data (332 records, 1 tapemarks)
A potentially unreasonable number of record sizes(165) vs tape marks (1) have been found
The tape format (SIMH) might not be correct for the 'Cobol.tap' tape image
/simh/Cobol/cobol_linux.ini-16> at lpt -n printer.txt
LPT: creating new file: printer.txt
HALT instruction, IS: 2830 (B 2063 'B)
=== Now cobol compilation printer output will be listed ===
TAPE COBOL COMPILATION VER 2 MOD 11 16K
SEQUENCE CARD-IMAGE IDENTIFICATION
1 001010 IDENTIFICATION DIVISION. *
2 001020 PROGRAM-ID. @DISP-IBM-1401-SAMPLE@. *
3 001030 ENVIRONMENT DIVISION. *
4 001040 CONFIGURATION SECTION. *
5 001050 SOURCE-COMPUTER. IBM-1401 *
6 001060 MEMORY SIZE 8000 CHARACTERS *
7 001070 NO-RELEASE NO-PRINT-STORAGE. *
8 001080 OBJECT-COMPUTER. IBM-1401 *
9 001090 MEMORY SIZE ADDRESS 400 THRU 8000 *
10 001100 NO-OVERLAP NO-PRINT-STORAGE. *
11 002010 DATA DIVISION. *
12 002020 WORKING-STORAGE SECTION. **
13 002030 01 FIELD PICTURE X%4). **
14 003010 PROCEDURE DIVISION. **
15 003020 START. *
16 003030 DISPLAY @HOLA COBOL@. **
17 003040 MOVE @TEST@ TO FIELD. **
18 003050 DISPLAY FIELD. **
19 009999 STOP RUN. **
** COBOL DICTIONARY **
DATA NAMES
13 A10 FIELD
PROCEDURE NAMES
15 J01 START
IF EXTRA OUTPUT DESIRED
B ON FOR PUNCHED AUTOCODER
D ON FOR PRINTED LISTING
AND PRESS START
IF NO EXTRA OUTPUT DESIRED, PRESS START
=== end of printer output ===
/simh/Cobol/cobol_linux.ini-57> at cdp -n obj_deck.s
CDP: creating new file: obj_deck.s
HALT instruction, IS: 2830 (B 2063 'B)
=== Now autocode generated program printer output will be listed ===
0101 JOB DISP-IBM-1401-SAMPLE
0102 CTL 4411
0103 ORG 400
0104 S01 DCW @HOLA COBOL@
0105 S02 DCW @TEST@
0106 LA10 EQU *&1
0107 A10 DCW #4
0108 ORG
0109 DCW @}@
0110 INCLD ZDY
0111 INCLD ZZZ
0112 LTORG
0113 LTORGX EQU *&1
0114 ORG 87
0115 X1 DCW #03
0116 DC #02
0117 X2 DCW #03
0118 DC #02
0119 X3 DCW #03
0120 ORG LTORGX
0121 A05 DCW 00000
0122 SHR DCW #20
0123 ACM DC #20
0124 GNN DCW #20
0125 DC #20
0126 CNR DCW #05
0127 CNT DCW #03
0128 A0Q DCW @0@
0129 A0R DCW @@@
0130 A0K DCW @ @
0131 A0J DCW @9@
0132 DCW #15
0133 DA1 DC #50
0134 OVRLAY EQU *&1
0135 MVEOVR BAV *&1
* START.
* DISPLAY @HOLA COBOL@. *
* MOVE @TEST@ TO FIELD. *
* DISPLAY FIELD. *
* STOP RUN. *
0136 STARTS EQU *&1
0137 J01 EQU *&1
0138 B ZDY
0139 DCW 001
0140 DCW 004
0141 DCW 001
0142 DCW S01
0143 DCW @0@
0144 DCW 010
0145 MLC S02,A10
0146 B ZDY
0147 DCW 001
0148 DCW 004
0149 DCW 001
0150 DCW A10
0151 DCW @0@
0152 DCW 004
0153 L02005 H
0154 B L02005
0155 END STARTS
IF EXTRA OUTPUT DESIRED
B ON FOR PUNCHED AUTOCODER
D ON FOR PRINTED LISTING
AND PRESS START
IF NO EXTRA OUTPUT DESIRED, PRESS START
=== end of printer output ===
Goodbye
/simh/Cobol #
アセンブリ言語のソースができました。アセンブルして実行します。
/simh/Cobol # i1401 autocoder_linux.ini
IBM 1401 simulator V4.0-0 Current git commit id: 9e719822
/simh/Cobol/autocoder_linux.ini-7> at mt1 Autocoder.cobol.tap
Tape Image 'Autocoder.cobol.tap' scanned as SIMH format.
contains 474744 bytes of tape data (5312 records, 2 tapemarks)
A potentially unreasonable number of record sizes(37) vs tape marks (2) have been found
The tape format (SIMH) might not be correct for the 'Autocoder.cobol.tap' tape image
/simh/Cobol/autocoder_linux.ini-9> at mt3 -n scratch.mt3
MT: creating new file: scratch.mt3
/simh/Cobol/autocoder_linux.ini-10> at mt4 -n scratch.mt4
MT: creating new file: scratch.mt4
/simh/Cobol/autocoder_linux.ini-11> at mt5 -n scratch.mt5
MT: creating new file: scratch.mt5
/simh/Cobol/autocoder_linux.ini-12> at mt6 -n scratch.mt6
MT: creating new file: scratch.mt6
/simh/Cobol/autocoder_linux.ini-15> at cdp -n obj_deck.crd
CDP: creating new file: obj_deck.crd
HALT instruction, IS: 448 (B 593 'F)
SWITCH TO 1410 MODE, RESET START
HALT instruction, IS: 540 (DCW @J16365 @)
=== Now autocode assembly printer output will be listed ===
JOB DISP-IBM-1401-SAMPLE
PASS 3 COMPLETED
UNREFERENCED LABELS
A0R 1144
SHR 1074
(省略)
DISP-IBM-1401-SAMPLE PAGE 1
SEQ PG LIN LABEL OP OPERANDS SFX CT LOCN INSTRUCTION TYPE CARD
101 1 01 000 JOB DISP-IBM-1401-SAMPLE
102 1 02 CTL 4411
103 1 03 ORG 400 0400
104 1 04 S01 DCW @HOLA COBOL@ 10 0409 4
105 1 05 S02 DCW @TEST@ 4 0413 4
106 1 06 LA10 EQU *&1 0414
107 1 07 A10 DCW #4 4 0417 4
108 1 08 ORG 0418
109 1 09 DCW @}@ 1 0418 4
110 1 10 INCLD ZDY MACRO
111 1 11 INCLD ZZZ MACRO
112 1 12 ORG 0419
113 ZDY SBR DSYSBR STORE ADDR OF PARAMETER AREA 4 0419 H 930 GEN 4
114 MLC DSYSBR,X2 PICK UP PARAMETERS 7 0423 M 930 094 GEN 4
(省略)
276 1 54 B L02005 4 1265 B S64 34
277 1 55 END STARTS / S17 080 35
END OF ASSEMBLY
IF EXTRA OUTPUT DESIRED, SET SENSE SWITCH F ON, AND
B ON FOR CONDENSED CARDS
C ON FOR LOADABLE TAPE 6
D ON FOR LISTING TAPE 3
E ON TO SUPPRESS LISTING
G ON FOR NEW SOURCE DECK
AND PRESS START
IF NO EXTRA OUTPUT DESIRED, PRESS START
END OF JOB
INPUT FOR RE-ASSEMBLY ON TAPE UNIT 4
=== end of printer output ===
/simh/Cobol/autocoder_linux.ini-56> at mt3 -n scratch.mt3
MT: creating new file: scratch.mt3
/simh/Cobol/autocoder_linux.ini-57> at mt4 -n scratch.mt4
MT: creating new file: scratch.mt4
/simh/Cobol/autocoder_linux.ini-58> at mt5 -n scratch.mt5
MT: creating new file: scratch.mt5
/simh/Cobol/autocoder_linux.ini-59> at mt6 -n scratch.mt6
MT: creating new file: scratch.mt6
/simh/Cobol/autocoder_linux.ini-62> at cdp -n out_deck.crd
CDP: creating new file: out_deck.crd
HOLA COBOL
TEST
HALT instruction, IS: 1265 (B 1264)
Goodbye
/simh/Cobol #