1
0
mirror of https://github.com/pkimpel/retro-220.git synced 2026-04-14 07:49:53 +00:00

Commit BALGOL-Overlay.baca transcription WIP as of 2017-01-07.

Commit BALGOL-FLOAT.baca intrinsic function transcription.
Commit corrections to BALGOL-Main.baca discovered during debugging of BAC-Assembler.
Commit tools/BAC-Xscript-Reformatter.wsf script to extract card decks from transcription files.
Commit BAC-Assembler corrections and enhancements.
Commit minor additions to B220ControlConsole.
This commit is contained in:
Paul Kimpel
2017-01-07 06:22:12 -08:00
parent 77735afd4b
commit f30992a1de
12 changed files with 766 additions and 164 deletions

View File

@@ -0,0 +1,18 @@
.00.0 0000 FLOAT CRB
.00.0 0001 *B BFA 8 A+,22,0
.00.0 0002 SRA 1
.00.0 0003 IBB 8 B-,1
.00.0 0004 *A SRT 8
.00.0 0005 CAD 9 C+
.00.0 0006 SLT 8
.00.0 0007 FAD 8 D+
.00.0 0008 LDB 8 FLOAT
.00.0 0009 BUN - 0
.00.0 0010 *C CNST 58
.00.0 0011 +59
.00.0 0012 +60
.00.0 0013 *D +5800000000
.00.0 0014 CNST 40000990000
.00.0 0015 CNST $FLOAT,REAL(INTEGER) $
.00.0 0019 CNST 90000000000
.00.0 0020 FINI FLOAT

Binary file not shown.

View File

@@ -1029,7 +1029,7 @@
010 36 0 1015 *J CFR ARAMD,64 IF WE HAVE A NEW SYMBOL, AND WE ARENT
010 37 0 1016 DLB L,64,00 PROCESSING AN ARRAY DECLARATION,
010 38 0 1017 BCE S+ ITS A VARIABLE
010 39 0 1018 IFL - 011,1
010 39 0 1018 IFL - 0,11,1
010 40 0 1019 BUN I-
010 41 0 1020 *S IFL - 0,11,5 IN ARRAY DECLARATION, MARK THE PRESENT
010 42 0 1021 STP FRMEX SYMBOL AS AN ARRAY AND SEND IT AND AN
@@ -4271,7 +4271,7 @@
042 77 0 3910 LDB I
042 78 0 3911 CAA - V
042 79 0 3912 STA - V
042 80 0 3913 *V DLB - V,64,0 V(I) IS A CONSTANT.
042 80 0 3913 *X DLB - V,64,0 V(I) IS A CONSTANT.
042 81 0 3914 LDR - 1 CHECK IF IT IS A SPECIAL ONE
042 82 0 3915 BZR A+ IS IS ZERO
042 83 0 3916 CFR FONE+1
@@ -4331,7 +4331,7 @@
043 37 0 3970 ADL TEMP2
043 38 0 3971 CAD OPRTN
043 39 0 3972 BFA A+,41,0 ADD,MULTIPLY, DIVIDE OPS
043 40 0 3973 BFA 41,1 MAX, MIN OPS
043 40 0 3973 BFA B+,41,1 MAX, MIN OPS
043 41 0 3974 CAD J AND,OR,EQIV,IMPL OPS.
043 42 0 3975 ADL TEMP2
043 43 0 3976 CSU V1 CHECK FOR VALID BOOLEAN OPERANDS

Binary file not shown.

View File

@@ -1,5 +1,3 @@
Addr Sym Op - Address Comments
ASBML 2
REORD 100.0
01 00 0 0000 BUF DEFN 0002 TAPE OUTPUT BUFFER
@@ -1626,6 +1624,272 @@
017 20 0 2559 IFL LEVEL,81,1
017 21 0 2560 BFA B+,11,8 PROCEDURES(ONLY ONE STACK)
017 22 0 2561 BUN J- GET NEXT ITEM IF IT IS NONE OF ABOVE
017 23 0
017 24 0
017 25 0 2562 *A CFA +2000000,64
017 25 0 2562 *A CFA +2000000,64
017 26 0 2563 BCL J- SKIP SEGMENT NAMES
017 27 0 2564 *B STB VL,33 VECTOR LENGTH
017 28 0 2565 IFL VL,32,04 FOUR IS NORMAL(ARRAYS REQUIRE 6)
017 29 0 2566 STA VECTR+3 SAVE OPERAND
017 30 0 2567 CAA - 1
017 31 0 2568 LDR - 2 GET SYMBOL
017 32 0 2569 LDB SL
017 33 0 2570 DBB *+2,2
017 34 0 2571 CLR SYMBOL LENGTH LEQ 5 CHARACTERS
017 35 0 2572 BOF NUMLB NUMERIC LABEL
017 36 0 2573 STA VECTR+1
017 37 0 2574 STR VECTR+2 SAVE FIRST 10 CHARACTERS OF SYMBOL
017 40 0 2575 RETRN LDR VECTR+3
017 41 0 2576 CLA
017 42 0 2577 BFR P+,11,1
017 43 0 2578 BFR P+,11,9
017 44 0 2579 BFR *+3,11,5
017 45 0 2580 STA VECTR+3,89 PROCEDURE 02 FIELD IS LEVEL
017 46 0 2581 BUN P+
017 47 0 2582 LDB VECTR+3
017 48 0 2583 IFL VL,32,2 NEED TWO MORE FOR ARRAYS
017 49 0 2584 LDR - 0
017 50 0 2585 STR HOLD SAVE LINK
017 51 0 2586 SRT 4
017 52 0 2587 CAD VECTR+3
017 53 0 2588 CLL VECTR+3
017 54 0 2589 CLL VECTR+4
017 55 0 2590 CLL VECTR+5
017 56 0 2591 STR VECTR+3,04 LENGTH
017 57 0 2592 STA VECTR+5,67 SAVE OPERAND OF ARRAY
017 58 0 2593 CLL DIM
017 59 0 2594 LDB HOLD
017 60 0 2595 IBB C+,9999 LINK ZERO INDICATES WE HAVE LINEAR
017 61 0 2596 BUN D+ ARRAY
017 62 0 2597 *A LDB HOLD END OF DIMENSION LIST OF CONSTANTS
017 63 0 2598 IBB A+,9999 IF LINK IS ZERO
017 64 0 2599 *D LDR - 1
017 65 0 2600 DLB - 1,64,0
017 66 0 2601 STR HOLD SAVE OPERAND OF CONSTANT
017 67 0 2602 CAD - 1
017 68 0 2603 LDB DIM
017 69 0 2604 STA - DIMS PUT CONSTANT INTO DIMENSION LIST
017 70 0 2605 IFL DIM,00,1 INCREASE DIMENSION COUNT
017 71 0 2606 BUN A-
017 72 0 2607 *A LDR DIMS
017 73 0 2608 STR VECTR+4 SAVE LENGTH OF A ROW
017 74 0 2609 *B LDB DIM
017 75 0 2610 CAD - DIMS-1
017 76 0 2611 ADD +1
017 77 0 2612 MUL - DIMS-2 CALCULATE ADDRESS OF FIRST
017 78 0 2613 STR - DIMS-2 ELEMENT OF THE ARRAY
017 79 0 2614 DFL DIM,00,1
017 80 0 2615 DBB B-,3
017 81 0 2616 CAA DIMS
017 82 0 2617 ADD +1
017 83 0 2618 SLA 4
017 84 0 2619 ADA VECTR+5
017 85 0 2620 *F STA VECTR+5,64 STORE ACTUAL ADDRESS
017 86 0 2621 BUN P+
017 87 0 2622 *C LDR VECTR+3 LINEAR ARRAY
017 88 0 2623 STR VECTR+4 LENGTH OF ROW IS LENGTH OF ARRAY
017 89 0 2624 CAD VECTR+5
017 90 0 2625 ADD +10000 ACTUAL ADDRESS IS ONLY 1 GREATER
017 91 0 2626 BUN F-
017 94 0 2627 *P CAD +TBL
017 95 0 2628 ADD LEVEL
017 96 0 2629 STA LEVEL SET UP SEARCH OF PROPER STACK
017 97 0 2630 STA THROW (NOTICE EVERY STACK IS INITIALIZED
017 98 0 2631 TLU LDB LEVEL WITH THE SYMBOL 9999999999)
017 99 0 2632 CAD - 0
018 00 0 2633 STA HOLD SAVE LINK TO NEXT ITEM
018 01 0 2634 DLB HOLD,64,0
018 02 0 2635 LDR VECTR+1
018 03 0 2636 CFR - 0,00 COMPARE FIRST FIVE CHARACTERS
018 04 0 2637 BCL YES YES, INSERT IT
018 05 0 2638 BCE MAYBE COMPARISON ON NEXT 5 NEEDED
018 06 0 2639 *C LDR LEVEL
018 07 0 2640 STR THROW LAST OPERAND USED LINKS TO
018 08 0 2641 LDR HOLD THE OPERAND TO BE USED
018 09 0 2642 STR LEVEL
018 10 0 2643 BUN TLU
018 13 0 2644 YES LDR LEVEL
018 14 0 2645 CFR THROW IF THEY ARE EQUAL THEN THE SPECIAL
018 15 0 2646 BCE EH CASE WHERE THE HEAD OF THE STACK
018 16 0 2647 CAD LEVEL IS CHANGED
018 17 0 2648 STA VECTR,04
018 18 0 2649 STP GETX GET NEXT FREE CELLS
018 19 0 2650 BUN GET
018 20 0 2651 LDB THROW
018 21 0 2652 STA - 0,04 INSERT NEW OPERAND WITH
018 22 0 2653 ADD +1 ITS NICE INFORMATIN INTO STACK
018 23 0 2654 SLA 4
018 24 0 2655 STA VECTR,64
018 25 0 2656 LDB MEM
018 26 0 2657 VL RTF VECTR,4 ENTER THE VECTOR INTO THE STACK
018 27 0 2658 STB MEM
018 28 0 2659 BUN J-
018 29 0 2660 EH STP GETX GET NEXT FREE CELLS
018 30 0 2661 BUN GET
018 31 0 2662 ADD +1
018 32 0 2663 SLA 4
018 33 0 2664 ADD MEM
018 34 0 2665 LDB THROW DO AN INSERT FOR THIS SPECIAL CASE
018 35 0 2666 LDR - 0
018 36 0 2667 STA - 0
018 37 0 2668 STR VECTR
018 38 0 2669 BUN VL-1
018 41 0 2670 MAYBE LDR VECTR+2 COMPARE WITH
018 42 0 2671 CFR - 1,00 NEXT FIVE CHARACTERS
018 43 0 2672 BCH C-
018 44 0 2673 BUN YES
018 47 0 2674 NUMLB BZA A+ CONVERT PUBLIC NUMERIC LABELS
018 48 0 2675 SRT 10 TO ALFANUMERIC FORM
018 49 0 2676 CLL VECTR+1 WITH LEADING ZEROES
018 50 0 2677 BFR B+,55,0 SUPPRESSED
018 51 0 2678 STP SUPX
018 52 0 2679 BUN SUP
018 53 0 2680 STA VECTR+1
018 54 0 2681 STP NSUPX
018 55 0 2682 BUN NSUP
018 56 0 2683 STA VECTR+2
018 57 0 2684 BUN RETRN
018 58 0 2685 *B SLT 5
018 59 0 2686 STP SUPX
018 60 0 2687 BUN SUP
018 61 0 2688 STA VECTR+2
018 62 0 2689 BUN RETRN
018 63 0 2690 *A LDR +80
018 64 0 2691 BUN RETRN-2
018 67 0 2692 SUP SLT 1 CONVERT A 5 DIGIT NUMERIC
018 68 0 2693 BZA *+2 TO ALFA WITH SUPPRESSION
018 69 0 2694 ADD +80 OF LEADING ZEROES
018 70 0 2695 IFL *-1,11,2
018 71 0 2696 SUPX BOF *
018 72 0 2697 SLA 1
018 73 0 2698 BUN SUP
018 76 0 2699 NSUP SLT 1 CONVERT A 5 DIGIT NUMERIC
018 77 0 2700 ADD +80 TO ALFA - DO NOT SUPPRESS
018 78 0 2701 NSUPX BFA *,11,8 LEADING ZEROES
018 79 0 2702 SLA 1
018 80 0 2703 BUN NSUP
018 83 0 2704 END1 MLS 4 OT+10 MEMORY DUMP GOES ON ODD LANE
018 84 0 2705 MPF 4 OT,4
018 85 0 2706 *A LDB +DUMBS
018 86 0 2707 STP REMX ENTRY IN DUMP STACK IS N NNNN LL LINK
018 87 0 2708 BUN REM WHERE NNNN= NUMBER OF ITEMS IN LIST
018 88 0 2709 BUN ACTUA LL= LEVEL NUMBER FOR THE
018 89 0 2710 LDB +SBMUD PROCEDURE WHICH CONTAINS
018 90 0 2711 STP INSX THE DUMP LIST
018 91 0 2712 BUN INS
018 92 0 2713 BUN A- INVERT STACK OF NECESSARY DUMPS
018 93 0 2714 ACTUA LDB +SBMUD
018 94 0 2715 STP REMX
018 95 0 2716 BUN REM
018 96 0 2717 BUN FIN END OF DUMPS
018 97 0 2718 CLL IDEX
018 98 0 2719 STA HOLD SAVE DUMP ENTRY
018 99 0 2720 BFA C+,62,0 IF ZERO - DUMP FOR PROGRAM
019 00 0 2721 SRA 4 IF NON-ZERO
019 01 0 2722 STA IDEX,02 SAVE LEVEL AND GET ASSOCIATED
019 02 0 2723 CAD TBL+300 PROCEDURE NAME
019 03 0 2724 *B STA DIM
019 04 0 2725 DLB DIM,64,0
019 05 0 2726 CAD - 2
019 06 0 2727 CFA IDEX,02
019 07 0 2728 BCE A+ PROCEDURE NAME FOUND
019 08 0 2729 LDB DIM GET NEXT ITEM FROM PROCEDURE STACK
019 09 0 2730 CAD - 0
019 10 0 2731 BUN B-
019 11 0 2732 *A CAD - 0
019 12 0 2733 LDR - 1
019 13 0 2734 STA J++4,00
019 14 0 2735 STR J++5,00
019 15 0 2736 LDR +EN
019 16 0 2737 STR EM,04
019 17 0 2738 MOW 4 Q+,OT,3
019 18 0 2739 *C STB PRSW1,62
019 19 0 2740 STB PRSW2,62
019 20 0 2741 CAD HOLD
019 21 0 2742 BFA *+3,45,0 IF THE DUMP LIST WAS NULL
019 22 0 2743 IFL PRSW1,62,29 SET SOME SWITCHES SO THAT
019 23 0 2744 IFL PRSW2,62,29 EVERY TABLE ITEM OUTPUT TO TAPE
019 24 0 2745 IFL PRSW1,62,1 WILL HAVE A SIGN OF 4
019 25 0 2746 IFL PRSW2,62,1
019 26 0 2747 DLB SCRTB+114,64,0
019 27 0 2748 STB TRCE,04
019 28 0 2749 BUN END15
019 31 0 2750 LOD3 DEFN *
019 32 0 2750 *Q BCS V+-LOD3+100,9
019 33 0 2751 *Z1 STP *,2438
019 34 0 2752 *Z2 BUN *,J+-LOD3+100
019 35 0 2753 *V NOP LOD1-100
019 36 0 2754 NOP 1
019 37 0 2755 LDB *-1-LOD3+100
019 38 0 2756 RTF *+2-LOD3+100,3
019 39 0 2757 BUN 1
019 40 0 2758 LBC V--LOD3+100
019 41 0 2759 MRD 4 100,OT,3,BMOD
019 42 0 2760 BUN 100
019 43 0 2761 *J CNST $ PROCEDURE
019 44 0 2771
019 45 0 2782 $
019 46 0 2785 LOCN *+10
019 49 0 2795 END15 MOW 4 Q+,OT,3
019 50 0 2796 LDB IDEX DUMP
019 51 0 2797 CAD - TBL+200
019 52 0 2798 *C STA HOLD
019 53 0 2799 LDB HOLD
019 54 0 2800 IBB END2,9999 END OF THIS LABEL STACK
019 55 0 2801 DLB HOLD,64,0
019 56 0 2802 CAD - 2 GET OPERAND OF THE LABEL
019 57 0 2803 STB STOX1,62
019 58 0 2804 BPA PRSW1 SIGN OF 0 MEANS NOT BEING DUMPED
019 59 0 2805 IFL STOX1,62,1
019 60 0 2806 BUN B+
019 61 0 2807 PRSW1 BUN D+ DUMP HAD A NULL LIST
019 62 0 2808 IFL STOX1,62,1 SET UP TO MARK ITEM WITH A SIGN OF 4
019 63 0 2809 BUN B+
019 64 0 2810 *D IFL STOX1,62,30 DO NOT MARK FOR DUMPING
019 65 0 2811 *B CAD - 0
019 66 0 2812 STP STOXX
019 67 0 2813 BUN STOX1
019 68 0 2814 CAD - 1
019 69 0 2815 STP STOXX ENTER ITEM INTO OUTPUT BUFFER
019 70 0 2816 BUN STOX1
019 71 0 2817 CAD - 2
019 72 0 2818 STP STOXX
019 73 0 2819 BUN STOX1
019 74 0 2820 LDB HOLD
019 75 0 2821 CAD - 0
019 76 0 2822 BUN C-
019 79 0 2823 END2 LSA 9 OUTPUT END FLAG
019 80 0 2824 STP STOXX
019 81 0 2825 BUN STOX
019 82 0 2826 IFL *-1,11,5
019 83 0 2827 BOF END3
019 84 0 2828 LDB IDEX
019 85 0 2829 CAD - TBL
019 86 0 2830 BUN C- PROCESS SIMPLE VARIABLES
019 91 0 2831 STOX1 BUN STOX

View File

@@ -14,18 +14,26 @@ BALGOL-Main.baca
PDF_index/k-1-pdf/k-1-u2196-balgol220compiler.pdf.
This transcription reflects the corrections hand-coded on the listing.
BALGOL-Main-card
BALGOL-Main.card
Card-image input deck of BALGOL-Main.baca prepared for input to the
tools/BAC-Assembler script.
BALGOL-Overlay.baca
Assembly listing of teh BALGOL compiler overlay module, transcribed
Assembly listing of the BALGOL compiler overlay module, transcribed
by Paul Kimpel from
http://archive.computerhistory.org/resources/text/Knuth_Don_X4100/
PDF_index/k-1-pdf/k-1-u2196-balgol220compiler.pdf.
This transcription reflects the corrections hand-coded on the listing.
BALGOL-Overlay.card
Card-image input deck of BALGOL-Overlay.baca prepared for input to
the tools/BAC-Assembler script.
BALGOL-FLOAT.baca, BALGOL-FLOAT.card
Assembly listing and input card deck for the BALGOL FLOAT intrinsic
function.
[work in progress]
Paul Kimpel
December 2016
January 2017

View File

@@ -209,7 +209,7 @@ window.addEventListener("load", function() {
var buffer = "";
var bufferLength = 0;
var bufferOffset = 0;
var cardHandler = startAssembly;
var cardHandler = initializePass1;
var cardsPerMinute = 10000;
var eofArmed = 0;
var eolRex = /([^\n\r\f]*)((:?\r[\n\f]?)|\n|\f)?/g;
@@ -301,6 +301,9 @@ window.addEventListener("load", function() {
* 10 = value inserted in (21)
* 11 = value inserted in (62)
* 12 = value inserted in (64)
* 13 = BU pair for CRF/CWF: (B-1)*2 in (41) U in (11)
* 14 = reload-lockout value added to (41)
* 15 = digit inserted in (11); if specified, insert 1 in (41)
* 19 = resolved address only
***************************************/
@@ -326,10 +329,10 @@ window.addEventListener("load", function() {
"MUL": [ 14, 1, -1, 3, 0],
"DIV": [ 15, 1, -1, 3, 0],
"RND": [ 16, 1, 0, 3, 0],
"FAD": [ 22, 1, -1, 2, 0, 4, -1],
"FAA": [122, 1, -1, 2, 0, 4, -1],
"FSU": [ 23, 1, -1, 2, 0, 4, -1],
"FSA": [123, 1, -1, 2, 0, 4, -1],
"FAD": [ 22, 1, -1, 2, 0, 4, 0],
"FAA": [122, 1, -1, 2, 0, 4, 0],
"FSU": [ 23, 1, -1, 2, 0, 4, 0],
"FSA": [123, 1, -1, 2, 0, 4, 0],
"FMU": [ 24, 1, -1, 3, 0],
"FDV": [ 25, 1, -1, 3, 0],
"SRA": [ 48, 1, -1, 2, 0],
@@ -341,7 +344,7 @@ window.addEventListener("load", function() {
"LDR": [ 41, 1, -1, 3, 0],
"LDB": [ 42, 1, -1, 2, 0],
"LBC": [142, 1, -1, 2, 0],
"LSA": [ 43, 1, 0, 5, -1, 2, 0],
"LSA": [ 43, 5, -1, 1, 0, 2, 0],
"STA": [ 40, 1, -1, 6, 0],
"STR": [140, 1, -1, 6, 0],
"STB": [240, 1, -1, 6, 0],
@@ -385,21 +388,21 @@ window.addEventListener("load", function() {
"DLB": [ 28, 1, -1, 7, -1, 9, -1],
"MTS": [ 50, 1, -1, 4, -1, 8, -1],
"MFS": [4000050,
1, -1, 4, -1, 8, -1],
1, -1, 4, -1, 8, -1],
"MTC": [ 51, 1, -1, 4, -1, 8, -1, 5, -1],
"MFC": [4000051,
1, -1, 4, -1, 8, -1, 5, -1],
1, -1, 4, -1, 8, -1, 5, -1],
"MRD": [ 52, 1, -1, 4, -1, 10, -1, 5, 0],
"MNC": [ 52, 1, -1, 4, -1, 8, -1, 5, 1],
"MNC": [ 52, 1, -1, 4, -1, 10, -1, 5, 1],
"MRR": [ 53, 1, -1, 4, -1, 10, -1, 5, 0],
"MIW": [ 54, 1, -1, 4, -1, 10, -1, 9, -1],
"MIW": [ 54, 1, -1, 4, -1, 10, -1, 9, 0],
"MIR": [ 55, 1, -1, 4, -1, 10, -1, 9, 0],
"MOW": [ 56, 1, -1, 4, -1, 10, -1, 9, -1],
"MOW": [ 56, 1, -1, 4, -1, 10, -1, 9, 0],
"MIR": [ 57, 1, -1, 4, -1, 10, -1, 9, 0],
"MPF": [ 58, 4, -1, 10, -1, 1, 0],
"MPB": [158, 4, -1, 10, -1, 1, 0],
"MPE": [258, 4, -1, 1, 0],
"MLS": [450, 4, -1, 8, -1, 1, 0],
"MLS": [450, 4, -1, 8, 0, 1, 0],
"MRW": [850, 4, -1, 8, 0, 1, 0],
"MDA": [950, 4, -1, 8, -1, 1, 0],
"MIB": [ 59, 1, -1, 4, -1, 8, 0],
@@ -409,14 +412,14 @@ window.addEventListener("load", function() {
"PRI": [ 5, 1, -1, 4, -1, 8, -1, 5, 0],
"PWR": [ 6, 1, -1, 4, -1, 8, -1],
"PWI": [ 7, 1, -1, 4, -1],
"CRD": [ 60, 1, -1, 4, -1, 5, 0],
"CWR": [ 61, 1, -1, 4, -1, 5, -1, 8, 0],
"CRF": [ 62, 1, -1, 4, -1, 5, -1, 8, 0],
"CWF": [ 63, 1, -1, 4, -1, 5, -1, 8, 0],
"CRD": [ 60, 1, -1, 4, -1, 5, 0, 8, 0],
"CWR": [ 61, 1, -1, 4, -1, 13, -1, 8, 0],
"CRF": [ 62, 1, -1, 13, -1, 14, 0],
"CWF": [ 63, 1, -1, 13, -1, 14, 0],
"CRI": [ 64, 1, -1, 4, -1],
"CWI": [ 65, 1, -1, 4, -1],
"KAD": [ 8, 1, 0, 3, 0],
"SPO": [ 9, 1, -1, 8, -1],
"SPO": [ 9, 1, -1, 8, -1, 15, 0],
// Pseudo-ops
"DEFN": [pseudoDEFN, // define symbol
@@ -741,10 +744,10 @@ window.addEventListener("load", function() {
var wordText;
if (opCode === null) {
text = padRight(" ", 8+5+5+4+15+3, " ");
text = padRight(" ", 8+6+6+4+16+3, " ");
} else {
if (word === null) {
wordText = padRight(" ", 15, " ");
wordText = padRight(" ", 16, " ");
} else {
w = word;
addr = w % 10000;
@@ -753,12 +756,12 @@ window.addEventListener("load", function() {
w = (w-op)/100;
variant = w % 10000;
w = (w-variant)/10000; // should be just the sign digit left
wordText = padLeft(w, 2, " ") + " " + padLeft(variant, 4, "0") + " " +
wordText = padLeft(w, 3, " ") + " " + padLeft(variant, 4, "0") + " " +
padLeft(op, 2, "0") + " " + padLeft(addr, 4, "0");
}
text = padLeft(seq, 8, " ") + padLeft(serial || " ", 5, " ") +
" " + padLeft(location, 4, "0") + wordText + " ";
text = padLeft(seq, 8, " ") + padLeft(serial || " ", 6, " ") +
" " + padLeft(location, 4, "0") + wordText + " ";
}
text += padRight(label, 6) + padRight(opCode || " ", 4) + padRight(sign, 2, " ") + operand;
@@ -1216,7 +1219,7 @@ window.addEventListener("load", function() {
if (token.newOffset < length) {
c = text.charAt(token.newOffset);
if (c == ",") {
token.offset = ++token.newOffset; // continue with next value
++token.newOffset; // continue with next value
} else if (c == " ") {
break; // out of while loop
} else {
@@ -1224,6 +1227,8 @@ window.addEventListener("load", function() {
break; // out of while loop
}
}
token.offset = token.newOffset;
} // while x
//for (x=0; x<values.length; ++x) {
@@ -1233,6 +1238,14 @@ window.addEventListener("load", function() {
return values;
}
/**************************************/
function emitWord(location, word) {
/* Outputs one word of assembled code to the object program */
//*** STUB FOR NOW ***//
return;
}
/**************************************/
function generateInstructionWord(opDesc, sign, values) {
/* Generates the word value for an executable instruction.
@@ -1291,53 +1304,76 @@ window.addEventListener("load", function() {
case 4: // unit or count digit inserted in (11)
w1 = word % p10[10];
w2 = w1 - w1 % p10[9];
word += (f%p10[1])*p10[9] - w2;
word += (f%10)*p10[9] - w2;
break;
case 5: // variant digit inserted in (41)
w1 = word % p10[7];
w2 = w1 - w1 % p10[6];
word += (f%p10[1])*p10[6] - w2;
word += (f%10)*p10[6] - w2;
break;
case 6: // sL field designator inserted in (22); if specified, insert 1 in (31)
w1 = word % p10[10];
w2 = w1 - w1 % p10[8];
word += (f%p10[2])*p10[8] - w2;
word += (f%100)*p10[8] - w2;
if (vx < vTop) {
w1 = word % p10[7];
w1 = word % p10[8];
w2 = w1 - w1 % p10[7];
word += p10[7] - w2;
word += p10[8] - w2;
}
break;
case 7: // sL field designator inserted in (22); (31) is undisturbed
w1 = word % p10[10];
w2 = w1 - w1 % p10[8];
word += (f%p10[2])*p10[8] - w2;
word += (f%100)*p10[8] - w2;
break;
case 8: // value inserted in (32)
w1 = word % p10[9];
w2 = w1 - w1 % p10[7];
word += (f%p10[2])*p10[7] - w2;
word += (f%100)*p10[7] - w2;
break;
case 9: // value inserted in (42)
w1 = word % p10[8];
w2 = w1 - w1 % p10[6];
word += (f%p10[2])*p10[6] - w2;
word += (f%100)*p10[6] - w2;
break;
case 10: // value inserted in (21)
w1 = word % p10[9];
w2 = w1 - w1 % p10[8];
word += (f%p10[2])*p10[8] - w2;
word += (f%10)*p10[8] - w2;
break;
case 11: // value inserted in (62)
w1 = word % p10[6];
w2 = w1 - w1 % p10[4];
word += (f%p10[2])*p10[4] - w2;
word += (f%100)*p10[4] - w2;
break;
case 12: // value inserted in (64)
w1 = word % p10[8];
w2 = w1 - w1 % p10[4];
word += (f%p10[4])*p10[4] - w2;
break;
case 13: // BU pair for CRF/CWF: (B-1)*2 in (41) U in (11)
w1 = word % p10[7]; // band in (41)
w2 = w1 - w1 % p10[6];
word += (((f%100-f%10)/10)-1)*2*p10[6] - w2;
w1 = word % p10[10]; // unit in (11)
w2 = w1 - w1 % p10[9];
word += (f%10)*p10[9] - w2;
break;
case 14: // reload-lockout value added to (41)
w1 = word % p10[7]; // band in (41)
w2 = w1 + ((f%10)*p10[6])%p10[7];
word += w2 - w1;
break;
case 15: // digit inserted in (11); if specified, insert 1 in (41)
w1 = word % p10[10];
w2 = w1 - w1 % p10[9];
word += (f%100)*p10[9] - w2;
if (vx < vTop) {
w1 = word % p10[7];
w2 = w1 - w1 % p10[6];
word += p10[7] - w2;
}
break;
case 19: // resolved address only
w2 = word % p10[4];
word += f%p10[4] - w2;
@@ -1768,7 +1804,24 @@ window.addEventListener("load", function() {
}
/**************************************/
function startAssembly(cardData) {
function initializePass1(cardData) {
/* Initializes or reinitializes the assembler for Pass 1 */
errorCount = 0;
errorTank = [];
location = 0;
cardData.serial = 0;
symTab = {};
pointTab = {};
poolTab = {};
symTab["RLO"] = 1; // kludge for CWR reload-lockout field
nextReaderStamp = performance.now();
cardHandler = startPass1;
}
/**************************************/
function startPass1(cardData) {
/* Callback function for the card reader. Reads the control cards and
then passes control to pass 1 of the assembler */
var card = cardData.text;
@@ -1776,22 +1829,12 @@ window.addEventListener("load", function() {
switch (opCode) {
case "ASMBL":
readACard(startAssembly, cardData);
readACard(startPass1, cardData);
break;
case "REORD":
readACard(startAssembly, cardData);
readACard(startPass1, cardData);
break;
default:
errorCount = 0;
errorTank = [];
location = 0;
cardData.serial = 0;
symTab = {};
pointTab = {};
poolTab = {};
symTab["RLO"] = 1; // kludge for CWR reload-lockout field
nextReaderStamp = performance.now();
cardHandler = assemblePass1;
assemblePass1(cardData);
break;
@@ -1822,55 +1865,59 @@ window.addEventListener("load", function() {
text: "",
newOffset: -1};
if (opCode.length <= 0) {
if (opCode == "REM") {
printPass1(seq, location, label, null, sign, operand);
} else {
if (!(opCode in opTab)) {
if (opCode.length <= 0) { // treat like a CNST pseudo-op
opDesc = opTab["CNST"];
} else if (!(opCode in opTab)) { // treat like a NOP
printError("INVALID OP CODE");
opDesc = opTab["NOP"];
} else {
opDesc = opTab[opCode];
if (opDesc[0] >= 0) { // normal instruction
values = evaluateOperand(operand, token, false); // discard result, take only side effects
++location; // normal instructions bump the location counter
} else {
// Parse the pseudo-op for size and location
switch (opDesc[0]) {
case pseudoDEFN:
values = evaluateOperand(operand, token, false);
if (values.length > 0) {
thisLoc = values[0];
} else {
printError("OPERAND ADDRESS REQUIRED");
}
break;
case pseudoLOCN:
values = evaluateOperand(operand, token, true);
if (values.length < 1) {
printError("OPERAND ADDRESS REQUIRED");
} else if (values[0] >= 0) {
location = values[0];
}
break;
case pseudoCNST:
values = parseConstantList(operand, token);
location += values.length;
break;
case pseudoF244:
case pseudoF424:
values = evaluateOperand(operand, token, false); // discard result, take only side effects
++location; // word-builders merely bump the location counter
break;
case pseudoFBGR:
location += 29; // all format bands are 29 words long
break;
case pseudoFINI:
finito = true;
values = evaluateOperand(operand, token, true);
break;
default:
printError("INVALID PSEUDO INSTRUCTION CODE: " + opDesc[0]);
} // switch
}
}
if (opDesc[0] >= 0) { // normal instruction
values = evaluateOperand(operand, token, false); // discard result, take only side effects
++location; // normal instructions bump the location counter
} else {
// Parse the pseudo-op for size and location
switch (opDesc[0]) {
case pseudoDEFN:
values = evaluateOperand(operand, token, false);
if (values.length > 0) {
thisLoc = values[0];
} else {
printError("OPERAND ADDRESS REQUIRED");
}
break;
case pseudoLOCN:
values = evaluateOperand(operand, token, true);
if (values.length < 1) {
printError("OPERAND ADDRESS REQUIRED");
} else if (values[0] >= 0) {
location = values[0];
}
break;
case pseudoCNST:
values = parseConstantList(operand, token);
location += values.length;
break;
case pseudoF244:
case pseudoF424:
values = evaluateOperand(operand, token, false); // discard result, take only side effects
++location; // word-builders merely bump the location counter
break;
case pseudoFBGR:
location += 29; // all format bands are 29 words long
break;
case pseudoFINI:
finito = true;
values = evaluateOperand(operand, token, true);
break;
default:
printError("INVALID PSEUDO INSTRUCTION CODE: " + opDesc[0]);
} // switch
}
if (label.length > 0) { // enter the label into the symbol table
@@ -1925,6 +1972,7 @@ window.addEventListener("load", function() {
}
printLine(text);
printLine("");
if (errorCount == 0) {
initializePass2(cardData);
@@ -1997,71 +2045,83 @@ window.addEventListener("load", function() {
text: "",
newOffset: -1};
if (opCode.length <= 0) {
printPass2(seq, serial, location, null, label, null, sign, operand);
if (opCode == "REM") {
printPass1(seq, location, label, null, sign, operand);
} else {
if (!(opCode in opTab)) {
if (opCode.length <= 0) { // treat line a CNST pseudo-op
opDesc = opTab["CNST"];
} else if (!(opCode in opTab)) {
printError("INVALID OP CODE");
printPass2(seq, serial, origLoc, null, label, opCode, sign, operand);
opDesc = opTab["NOP"];
} else {
opDesc = opTab[opCode];
if (opDesc[0] >= 0) { // normal instruction
}
if (opDesc[0] >= 0) { // normal instruction
values = evaluateOperand(operand, token, true);
word = generateInstructionWord(opDesc, sign, values);
printPass2(seq, serial, origLoc, word, label, opCode, sign, operand);
emitWord(location, word);
++location; // normal instructions bump the location counter
} else {
// Parse the pseudo-op
switch (opDesc[0]) {
case pseudoDEFN:
values = evaluateOperand(operand, token, true);
if (values.length > 0) {
thisLoc = values[0];
} else {
printError("OPERAND ADDRESS REQUIRED");
}
printPass2(seq, serial, origLoc, null, label, opCode, sign, operand);
break;
case pseudoLOCN:
values = evaluateOperand(operand, token, true);
if (values.length < 1) {
printError("OPERAND ADDRESS REQUIRED");
} else if (values[0] >= 0) {
location = values[0];
}
printPass2(seq, serial, origLoc, null, label, opCode, sign, operand); break;
break;
case pseudoCNST:
values = parseConstantList(operand, token);
printPass2(seq, serial, origLoc, values[0], label, opCode, sign, operand);
emitWord(location, values[0]);
++location;
for (x=1; x<values.length; ++x) {
printPass2("", null, origLoc+x, values[x], "", "", "", "", "");
emitWord(location, values[x]);
++location;
}
break;
case pseudoF244:
case pseudoF424:
values = evaluateOperand(operand, token, true);
word = generateInstructionWord(opDesc, sign, values);
printPass2(seq, serial, origLoc, word, label, opCode, sign, operand);
++location; // normal instructions bump the location counter
} else {
// Parse the pseudo-op
switch (opDesc[0]) {
case pseudoDEFN:
values = evaluateOperand(operand, token, true);
if (values.length > 0) {
thisLoc = values[0];
} else {
printError("OPERAND ADDRESS REQUIRED");
}
printPass2(seq, serial, origLoc, null, label, opCode, sign, operand);
break;
case pseudoLOCN:
values = evaluateOperand(operand, token, true);
if (values.length < 1) {
printError("OPERAND ADDRESS REQUIRED");
} else if (values[0] >= 0) {
location = values[0];
}
printPass2(seq, serial, origLoc, null, label, opCode, sign, operand); break;
break;
case pseudoCNST:
values = parseConstantList(operand, token);
location += values.length;
printPass2(seq, serial, origLoc, values[0], label, opCode, sign, operand);
for (x=1; x<values.length; ++x) {
printPass2("", null, origLoc+x, values[x], "", "", "", "", "");
}
break;
case pseudoF244:
case pseudoF424:
values = evaluateOperand(operand, token, true);
word = generateInstructionWord(opDesc, sign, values);
printPass2(seq, serial, origLoc, word, label, opCode, sign, operand);
emitWord(location, word);
++location;
break;
case pseudoFBGR:
values = generateFormatBand(operand);
printPass2(seq, serial, origLoc, values[0], label, opCode, sign, operand);
emitWord(location, values[0]);
++location;
for (x=1; x<values.length; ++x) {
printPass2("", null, origLoc+x, values[x], "", "", "", "", "");
emitWord(location, values[x]);
++location;
break;
case pseudoFBGR:
values = generateFormatBand(operand);
location += 29; // all format bands are 29 words long
printPass2(seq, serial, origLoc, values[0], label, opCode, sign, operand);
for (x=1; x<values.length; ++x) {
printPass2("", null, origLoc+x, values[x], "", "", "", "", "");
}
break;
case pseudoFINI:
finito = true;
values = evaluateOperand(operand, token, true);
break;
default:
printError("INVALID PSEUDO INSTRUCTION CODE: " + opDesc[0]);
} // switch
}
}
break;
case pseudoFINI:
finito = true;
values = evaluateOperand(operand, token, true);
printPass2(seq, serial, origLoc, null, label, opCode, sign, operand);
break;
default:
printError("INVALID PSEUDO INSTRUCTION CODE: " + opDesc[0]);
} // switch
}
if (label.length > 0) { // increment any point label counter
@@ -2080,9 +2140,11 @@ window.addEventListener("load", function() {
} else {
// Output the constant pool
for (text in poolTab) {
symTab[text] = location;
printLine(" " + padLeft(location, 4, "0") + " " + text);
++location;
location = symTab[text];
token.offset = 0;
values = parseConstantList(text, token);
printPass2(seq, serial, location, values[0], "", "", "", text);
emitWord(location, values[0]);
}
// Wrap up Pass 2
@@ -2096,7 +2158,7 @@ window.addEventListener("load", function() {
printLine("END OF PASS 2, ERRORS = " + errorCount);
setReaderReady(false);
cardHandler = startAssembly;
initializePass1(cardData);
}
}
@@ -2206,6 +2268,8 @@ window.addEventListener("load", function() {
"</style>";
outHopper = document.createElement("pre");
outHopperFrame.contentDocument.body.appendChild(outHopper);
initializePass1(cardData);
}, false);
</script>

View File

@@ -0,0 +1,206 @@
<?XML version="1.0"?>
<package>
<job id="BAC-Xscript-Reformatter">
<reference object="Scripting.FileSystemObject" /> 'Microsoft Scripting Runtime TypeLib (for fso)
<script language="VBScript">
<![CDATA[
Option Explicit
'-----------------------------------------------------------------------
' retro-205 BAC-Xscript-Reformatter.wsf
' Copyright (c) 2017, Paul Kimpel,
' Licensed under the MIT License, see
' http://www.opensource.org/licenses/mit-license.php
'-----------------------------------------------------------------------
' VBScript to extract source from the BALGOL assembly listing transcriptions.
' It reads an assembly transcription file and outputs a BAC-Assembler
' card deck.
' 2. An assembler card deck for the second movement's source.
' 3. A tape image containing the loadable object code for the assembler.
' Note that the assembler object code is placed on lane 1 of the tape
' starting at block 120.
'
' This script should be executed in the current path of the transcription
' files. Output files will be written to that path as well.
'
' Uses Scripting Runtime FileSystemObject.
' Parameters:
' None.
'-----------------------------------------------------------------------
' Modification Log.
' 2017-01-06 P.Kimpel
' Original version, cloned from retro-205/software/tools/
' Shell-Xscript-Reformatter.wsf.
'-----------------------------------------------------------------------
Const xScript1 = "BALGOL-Main.baca"
Const xScript2 = "BALGOL-Overlay.baca"
Const xFloat = "BALGOL-FLOAT.baca"
Dim args
Dim deckName
Dim fileName
Dim fso
Dim lastSeq
'---------------------------------------
Function PadLeft(ByVal s, ByVal chars)
'Formats the string "s" to be exactly "chars" characters long, padding
'with spaces or truncating on the left, as necessary.
Dim sLen
sLen = Len(s)
If sLen < chars Then
PadLeft = Space(chars - sLen) & s
ElseIf sLen > chars Then
PadLeft = Right(s, chars)
Else
PadLeft = s
End If
End Function
'---------------------------------------
Function Pic9n(ByVal v, ByVal chars)
'Formats a numeric value "v" as a string of "chars" length with leading zeroes.
Dim s
Dim sz
s = CStr(v)
sz = Len(s)
If sz > chars Then
Pic9n = Right(s, chars)
ElseIf sz < chars Then
Pic9n = String(chars-sz, "0") & s
Else
Pic9n = s
End If
End Function
'---------------------------------------
Function PicXn(ByVal v, ByVal chars)
'Formats a string value "v" as left justified over spaces in a field "chars" long.
Dim sz
sz = Len(CStr(v))
If sz < chars Then
PicXn = v & Space(chars-sz)
ElseIf sz > chars Then
PicXn = Left(v, chars)
Else
PicXn = v
End If
End Function
'---------------------------------------
Sub WriteCard(cardFile, seq, text)
'Applies the sequence number to the text and outputs the card image
Dim image
Dim seqNr
Dim seqText
seqText = PadLeft(seq, 8)
image = PicXn(text, 72)
If Len(Trim(seqText)) = 0 Then
seqText = Replace(lastSeq, " ", "")
If IsNumeric(seqText) Then
seqNr = CLng(seqText)
Else
seqNr = 999000
End If
seqNr = seqNr + 10
seqText = PadLeft("0" & seqNr, 6)
seqText = Mid(seqText, 1, 3) & " " & Mid(seqText, 4, 2) & " " & Mid(seqText, 6)
End If
lastSeq = seqText
cardFile.WriteLine image & seqText
End Sub
'---------------------------------------
Sub ExtractCode(byVal xScriptName, byVal deckName)
'Extracts source from an assembler transcription file.
'The assembler source is written as card images to a file with the same
'name as the transcription file, but modified with a ".card" extension.
Dim addr
Dim card
Dim cardFile
Dim lastAddr
Dim line
Dim lineNr
Dim seq
Dim text
Dim word
Dim xFile
Const addrCol = 14
Const labelCol = 21
Const opCodeCol = 27
Const operandCol = 33
Set xFile = fso.OpenTextfile(xScriptName, ForReading, False, False)
lineNr = 1
Set cardFile = fso.OpenTextFile(deckName, ForWriting, True, True)
Do While Not xFile.AtEndOfStream
line = xFile.ReadLine
lineNr = lineNr+1
seq = RTrim(Mid(line, 1, 8))
'-- If the sequence and opCode fields are blank, and address field is not present, generate a REM card
'-- If the sequence field is blank, and the address field IS present, do not generate a card
If Len(seq) = 0 And Len(RTrim(Mid(line, opCodeCol, 5))) = 0 And Len(RTrim(Mid(line, addrCol, 4))) = 0 Then
WriteCard cardFile, seq, "1" & Space(9) & "REM " & Mid(line, operandCol)
ElseIf Len(seq) > 0 Or Len(RTrim(Mid(line, addrCol, 4))) = 0 Then
'-- Reformat and write the assembler card image
WriteCard cardFile, seq, "1" & Space(3) & _
PicXn(Mid(line, labelCol, 5), 6) & _
PicXn(Mid(line, opCodeCol, 5), 6) & _
Mid(line, operandCol)
End If
Loop
cardFile.Close
Set cardFile = Nothing
xfile.Close
Set xFile = Nothing
End Sub
'---------------------------------------------------------------
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
Set args = WScript.Arguments
If args.Count < 1 Then
MsgBox "Must supply the name of the transcription file."
WScript.Quit 9
Else
fileName = Trim(args.Item(0))
If args.Count > 1 Then
lastSeq = Trim(args.Item(1))
Else
lastSeq = "01 0"
End If
End If
Set args = Nothing
'-- Main Line --
If Not fso.FileExists(fileName) Then
MsgBox "Transcription file does not exist: " & vbCrLf & fileName
Else
deckName = fso.BuildPath(fso.GetParentFolderName(fileName), fso.GetBaseName(fileName)) & ".card"
ExtractCode fileName, deckName
MsgBox "BAC Assembler card deck created: " & vbCrLf & deckName
End If
Set fso = Nothing
WScript.Quit 0
]]>
</script>
</job>
</package>

19
software/tools/README.txt Normal file
View File

@@ -0,0 +1,19 @@
Index of folder retro-220/software/tools:
Scripts and utilities supporting the Burroughs 220 BALGOL Compiler
recovery effort.
Unless otherwise specified, all files are in standard Windows text
format, with carriage-return/line-feed delimiters.
BAC-Assembler.html
HTML/Javascript assembler for the assembly language dialect used
with the BALGOL Main, Overlay, and intrinsic functions.
BAC-XScript-Reformatter.wsf
Windows VBScript utility to extract source code from the BALGOL
assembly listing transcriptions and reformat them into card decks
for use by BAC-Assembler.html
Paul Kimpel
January 2017

View File

@@ -481,7 +481,7 @@ BUTTON.panelLabel {
position: absolute;
width: 32px;
height: 18px;
color: white;
color: #D8C5BC;
background-color: black;
border-radius: 4px;
border: 2px solid white;

View File

@@ -138,6 +138,25 @@
left: 40px;
top: 12px}
#StorageLabel {
left: 78px;
top: 12px}
#MagneticTapeLabel {
left: 116px;
top: 12px}
#CardatronLabel {
left: 154px;
top: 12px}
#PaperTapeLabel {
left: 192px;
top: 12px}
#HighSpeedPrinterLabel {
left: 230px;
top: 12px}

View File

@@ -55,8 +55,12 @@
<div id=AlarmPanel class=panelDiv>
<button id=DigitCheckLabel class=panelLabel>DIGIT<br>CHECK</button>
<button id=ProgramCheckLabel class=panelLabel>PROGRAM<br>CHECK</button>
<button id=StorageLabel class=panelLabel>STORAGE</button>
<button id=MagneticTapeLabel class=panelLabel>MAGNETIC<br>TAPE</button>
<button id=CardatronLabel class=panelLabel>CARDATRON</button>
<button id=PaperTapeLabel class=panelLabel>PAPER<br>TAPE</button>
<button id=HighSpeedPrinterLabel class=panelLabel>HIGH SPEED<br>PRINTER</button>
</div>
<!--