Kidsgrove Algol Compiler - Brick 81
This assembler listing has hot links for all references to subroutines.
You can click on the routine name in code such as JS.pproc;
and jump to the routine.
When you have seen enough of it, you can use the back button to carry on where you left off.
Started
Loaded 5941 bytes for KAB81.k4
Reached end of file
=============== Second pass
===========================
!begin
/ KAB81 reads the paper tape and makes chennel 6 tape
/ the input paper tape must have been propared by mkchan.c
/ as a PT images of a POST mag tape
/ enhancement as of Jluy 2020
/ Initial lines beginning with Z have the form
/ Z38: 16 octal digits
/ and set the specified Z-store to the value indicated
prog=0: /form B-block
0/0: 202 266 144|000 000 000 J.main; =H 0;
1/0: 000 052 374|000 000 000 =H 11004; =H 0;
2/0: 034 053 102 256 030 230 =P *n *c M *c KAB8;
3/0: 106 112 031 147 134 065 =P 1DH99UPU;
4/0: 200 326 115|200 326 115 prog=4: JS.crash; JS.crash; /restart
5/0: 000 000 000 000 000 000|000 000 000 000 000 000 =0; =0;
7/0: 000 000 006 100 006 252 = Q 0/1600/chbuff;
prog=1600:
/ -------------------------------------------------------------------
Z0 = 11103: / Z11 should be accessed as F.Z0-11
Z50 = Z0-50:
/ N.B. variable nextz is held in M8, and I8 = -1
/ -------------------------------------------------------------------
sprint:
/ prints a string embedded in code, call sequence must be
/ *JS.sprint; *= #30; =P 8 chars ending in 02
!begin
3100/0: 173 000|033|027|042|170 363|140 360|042|170 364|174 000 FLINK; NOT; NEG; DUP; SRM15; M+I15; DUP; SI15; SLINK;
3102/2: 171 376|304 000 010|200 220 000|202 360 002 FQ15; SET8; OUT; EXIT.2;
!end
/ -------------------------------------------------------------------
n1print:
/ prints a string embedded in code followed by bottom bits of n1
/ call sequence must be *JS.cwprint; *= #30; =P 8 chars; =0;
!begin
3104/1: 173 000|033|027|042|170 363|140 360|140 360|042|170 364|174 000
FLINK; NOT; NEG; DUP; SRM15; M+I15; M+I15; DUP; SI15; SLINK;
3106/5: 300 006 113|065|067|300 006 114|011|101 360 F.radix; REV; FRB; F.digits; OR; SMM15/0;
3110/4: 171 376|304 000 010|200 220 000|202 360 003 FQ15; SET8; OUT; EXIT.3;
3112/3: 017|017|017|040 202 001 020 202 001 *radix: =#1010100104101001;
3114/0: 101 004 000 101 004 002 digits: =#2020200020202002;
!end
/ -------------------------------------------------------------------
crash:
/ // disaster
3115/0: 200 326 100|017|017|017|000 000 000 000 000 030 *JS.sprint; *=#30;
3117/0: 171 350 362 207 072 002 =P --crash*c;
3120/0: 136 010 MRWDQ0;
/ -------------------------------------------------------------------
!begin !label readch; / exorts label readch outside the block
3120/2: 052 rdch0: ERASE;
readch:
3120/3: 262 126 125 JCNZ5.samewd;
3121/0: 265 046 123 JCNZ2.noread;
3121/3: 125 140|121 140 PREQ6; PARQ6;
3122/1: 304 000 040|170 051|304 006 251|170 123 SET32; SRC2; SET.chbuff-1; SRM5;
noread:
3123/5: 304 377 320|170 130|140 120|143 040 SET-48; SC5; M+I5; DC2;
3125/2: 100 120|304 000 006|172 130|164 120|304 000 077|054 samewd: FMM5/0; SET6; S+C5; SHLC5; SET#77; AND;
3127/3: 042|033|027|164 371|222 146 120 DUP; NOT; NEG; SHL-4; J=Z.rdch0; / ignore all characters before / :
3130/5: 200 360 000 EXITH;
!end
!begin !label ch7open, ch7write, ch7close; / output to channel 7
3131/2: 017|017|017|017|006 312 006 351 242 107 *V0: =Q opbuff/opbuff+31/#121107;
3133/0: 006 352 007 011 000 000 V1: =Q opbuff+32/opbuff+63/0;
ch7write:
3134/0: 304 340 007|200 320 106|200 326 115|052|200 360 000 SET#160007; JS.70; JS.crash; ERASE; EXITH;
ch7open:
3136/1: 300 006 133|300 006 132 F.V1; F.V0;
3137/1: 200 320 106|200 326 115|052|200 360 000 JS.70; JS.crash; ERASE; EXITH;
ch7close:
3140/5: 304 006 351|170 365|304 140 007|170 362 SET.opbuff+31; SRI15; SET#60007; SM15;
3142/3: 171 376|200 320 106|200 326 115|200 360 000 FQ15; JS.70; JS.crash; EXITH;
!end
!begin !label main;
main: /main(int argc, char **argv)
3144/2: 201 326 136 JS.ch7open; / claim output tape
3144/5: 304 000 002|304 000 005|200 220 000|170 151 SET2; SET5; OUT; SRC6; / paper tape reader
3146/4: 304 006 252|170 144|140 140 SET.chbuff; SI6; M+I6;
3147/5: 304 000 037|172 142 SET31; S+M6;
3150/4: 157 002 QFRQ0/2; / word counter
3151/0: 157 005 QFRQ0/5; / char counter
3151/2: 304 006 312|170 102 SET.opbuff; SM4;
3152/1: 203 326 120 wz: JS.readch;
3152/4: 304 000 072|200 026 166|052 SET#72; JNE.opop; ERASE; / J if not Z-store prefix
3153/5: 203 326 120|304 000 017|054 JS.readch; SET#17; AND; / first digit
3155/0: 203 326 120|304 000 017|225 026 160 JS.readch; SET#17; J=.d1; / J if colon or slash, i.e. just 1 digit
3156/3: 304 000 017|054 SET#17; AND; / second digit
3157/1: 065|304 000 012|034|050|056 REV; SET10; MULTD; CONT; +;
3160/2: 203 326 120 JS.readch; / should be another colon or slash - ignore
3160/5: 052|027|170 362 d1: ERASE; NEG; SM15; / Z-store number
3161/3: 304 000 020|170 110|041 SET16; SC4; ZERO; / for i := 1 step 1 until 16 do (approx)
3162/3: 164 007|203 326 120|304 000 017|054|011 f1: SHL+3; JS.readch; SET#17; AND; OR;
3164/1: 143 100|263 106 162 DC4; JCNZ4.f1;
3165/0: 321 373 137|201 266 152 SM15.Z0; J.wz; / multiple Z-store specs allowed
3166/0: 320 013 071 opop: F.Z0-38; / output options to LP and to TTY
3166/3: 304 000 020|170 371 SET16; SRC15;
3167/2: 164 003|047|033|300 366 230|011|303 366 313|262 366 167|052 w3: SHL+1; STR; NOT; FM15.z38tab; OR; SMQ15.opbuff+1; JCNZ15.w3; ERASE;
3171/5: 304 000 030|301 006 312|304 377 302|301 366 313 SET#30; S.opbuff; SET#177702; SM15.opbuff+1;
3173/5: 300 006 250|171 362|056|042|304 000 010|200 220 000 F.v11; FM15; +; DUP; SET8; OUT;
3176/0: 041|301 006 312|027|033|304 000 010|200 220 000 ZERO; S.opbuff; NEG; NOT; SET8; OUT; / remove last word with newline
3200/0: 304 000 034|222 026 217 w0: SET#34; J=.stop; / while ch != semi-colon
3201/0: 304 000 100|170 071 SET64; SRC3; / assemble 64 half words -- last 2 words are overwritten
3201/5: 304 000 007|170 110 w2: SET7; SC4;
3202/4: 304 000 007|054 SET#7; AND;
3203/2: 164 007|203 326 120|304 000 007|054|011|143 100|262 106 203 w1: SHL+3; JS.readch; SET#7; AND; OR; DC4; JCNZ4.w1;
3205/5: 164 061|107 064 SHL+24; SMMQH3/4;
3206/3: 203 326 120|265 066 201 JS.readch; JCNZ3.w2;
3207/3: 304 000 036|170 031 SET30; SRC1; / block size - 2
3210/2: 151 101 MFRQ4/1; / address of data
3210/4: 041|041 ZERO; ZERO;
3211/0: 102 020|047|057|260 026 211 s1: FMMQ1/0; STR; +D; JCNZ1.s1;
3212/1: 300 006 251|033|027|042|301 006 251 F.blk; NOT; NEG; DUP; S.blk; / block number
3213/4: 042|170 024 DUP; SI1;
3214/1: 041|057 ZERO; +D; / add in the block no
3214/3: 164 041|171 024 SHL+16; FI1; / and also put it in the top 16 bits
3215/1: 166 341|052 SHLD-16; ERASE;
3215/4: 101 020|111 020 SMM1/0; SMMN1/0; / of the KDF9 checksum
3216/2: 200 326 134 JS.ch7write;
/ SET#55; SHL+16;
/ FM4; DUP; SHL+16; OR; SET31; +; SHL+16; SET70; OUT;
3216/5: 200 266 200 J.w0;
3217/2: 052|205 326 140 stop: ERASE; JS.ch7close;
3220/0: 171 150|304 000 006|200 220 000 FC6; SET6; OUT; / deallocate paper tape reader
3221/2: 304 006 024 SET#3024; / to call brick 84 to simulate KAB60 exit to translate Usercode
3221/5: 320 013 071|164 027|222 046 225 F.Z0-38; SHL+11; J<Z.usercode; / J if source is Usercode
3223/1: 052 ERASE; / not Usercode, so discard brick number
3223/2: 304 344 006|200 320 106|200 326 115 SET#162006; JS.70; JS.crash; / interchange to produce channel 6
3224/5: 304 004 021 SET#2021; / to call brick 01
usercode: / sumulate KAB60 exit to translate Usercode
3225/2: 170 364|304 336 010|170 362 SI15; SET#157010; SM15;
3226/3: 171 376|200 260 106 FQ15; J.70;
3227/2: 017|017|017|017 *z38tab: / table of bits in Z38 (all these words are -ve)
3230/0: 216 327 154 300 017 377 = P CM+LP*s; / D1 TINT;B100
3231/0: 322 030 254 227 060 077 = P TABLES*s; / D2 TINT;B040
3232/0: 277 052 147 173 075 300 = P ORIG-SW*s; / D3 TINT;B020 indicates use of original software for assembly
3233/0: 322 136 064 003 377 377 = P TEXT*s; / D4 TINT;B010
3234/0: 272 367 257 303 100 077 = P NO-OPT*s; / D5 TINT;B004
3235/0: 272 367 264 227 075 000 = P NO-TEST*s; / D6 TINT;B002
3236/0: 272 367 267 207 053 200 = P NO-WARN*s; / D7 TINT;B001
3237/0: 261 331 377 377 377 300 = P L+G*4d*s; / D8 TINT;B200000
3240/0: 256 033 047 276 300 077 = P KALGOL*s; / D9 TINT;B100000
3241/0: 336 033 047 276 300 077 = P WALGOL*s; / D10 TINT;B40000
3242/0: 327 071 162 216 371 045 = P USERCODE; / D11 TINT;B20000
3243/0: 232 374 264 312 033 200 = P FORTRAN*s; / D12 TINT;B10000
3244/0: 326 063 362 262 040 077 = P UC/RLB*s; / D13 TINT;B4000
3245/0: 256 033 024 003 377 377 = P KAL4*s; / D14 TINT;B2000
3246/0: 221 025 100 377 377 377 = P D15*s; / D15 TINT;B1000
3247/0: 221 025 200 377 377 377 = P D16*s; / D16 TINT;B400
3250/0: 000 000 006 312 006 313 v11: = Q 0/opbuff/opbuff+1;
3251/0: 000 000 000 000 000 000 *blk: =0;
!end // of main
*chbuff:
prog=prog+32:
opbuff:
Reached end of file
!end
C-block from 1600 to 1706
No of ID table entries = 312 (10%)