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 3890 bytes for KAB81.k4
Reached end of file


=============== Second pass
===========================


                                                                       !begin
                                                                             / KAB81 reads the paper tape and makes chennel 6 tape
                                                                             / equivalent to mkchan.c

                                                                       prog=0:      /form B-block
    0/0: 202 266 143|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

                                                                       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;
 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 201|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|164 371|222 146 120                                             DUP; SHL-4; J=Z.rdch0;
 3130/3: 200 360 000                                                         EXITH;
                                                                       !end

                                                                       !begin !label ch7open, ch7write, ch7close;  / output to channel 7
 3131/0: 006 242 006 301 242 107                                       *V0: =Q opbuff/opbuff+31/#121107;
 3132/0: 006 302 006 341 000 000                                        V1: =Q opbuff+32/opbuff+63/0;

                                                                       ch7write:
 3133/0: 304 340 007|200 320 106|200 326 115|052|200 360 000                 SET#160007; JS.70; JS.crash; ERASE; EXITH;
                                                                       ch7open:
 3135/1: 300 006 132|300 006 131                                             F.V1; F.V0;
 3136/1: 200 320 106|200 326 115|052|200 360 000                             JS.70; JS.crash; ERASE; EXITH;
                                                                       ch7close:
 3137/5: 304 006 301|170 365|304 140 007|170 362                             SET.opbuff+31; SRI15; SET#60007; SM15;
 3141/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)
 3143/2: 201 326 135                                                         JS.ch7open;                       / claim output tape
 3143/5: 304 000 002|304 000 005|200 220 000|170 151                         SET2; SET5; OUT; SRC6;            / paper tape reader
 3145/4: 304 006 202|170 144|140 140                                         SET.chbuff; SI6; M+I6;
 3146/5: 304 000 037|172 142                                                 SET31; S+M6;
 3147/4: 157 002                                                             QFRQ0/2;                          / word counter
 3150/0: 157 005                                                             QFRQ0/5;                          / char counter
 3150/2: 304 006 242|170 102|203 326 120                                     SET.opbuff; SM4; JS.readch;
 3151/4: 304 000 034|220 026 171                                       w0:   SET#34; J=.stop;
 3152/4: 304 000 100|170 071                                                 SET64; SRC3;
 3153/3: 304 000 007|170 110                                           w2:   SET7; SC4;
 3154/2: 304 000 007|054                                                     SET#7; AND;
 3155/0: 164 007|203 326 120|304 000 007|054|011|143 100|260 106 155   w1:   SHL+3; JS.readch; SET#7; AND; OR; DC4; JCNZ4.w1;
 3157/3: 164 061|107 064                                                     SHL+24; SMMQH3/4;
 3160/1: 203 326 120|263 066 153                                             JS.readch; JCNZ3.w2;

 3161/1: 304 000 036|170 031                                                 SET30; SRC1;        / block size - 2
 3162/0: 151 101                                                             MFRQ4/1;            / address of data
 3162/2: 041|041                                                             ZERO; ZERO;
 3162/4: 102 020|047|057|264 026 162                                   s1:   FMMQ1/0; STR; +D; JCNZ1.s1;
 3163/5: 300 006 201|033|027|042|301 006 201                                 F.blk; NOT; NEG; DUP; S.blk;       / block number
 3165/2: 042|170 024                                                         DUP; SI1;
 3165/5: 041|057                                                             ZERO; +D;           / add in the block no
 3166/1: 164 041|171 024                                                     SHL+16; FI1;        / and also put it in the top 16 bits
 3166/5: 166 341|052                                                         SHLD-16; ERASE;
 3167/2: 101 020|111 020                                                     SMM1/0; SMMN1/0;    / of the KDF9 checksum
 3170/0: 200 326 133                                                         JS.ch7write;

                                                                          /  SET#55; SHL+16;
                                                                          /  FM4; DUP; SHL+16; OR; SET31; +; SHL+16; SET70; OUT;

 3170/3: 204 266 151                                                         J.w0;

 3171/0: 052|205 326 137                                               stop: ERASE; JS.ch7close;
 3171/4: 171 150|304 000 006|200 220 000                                     FC6; SET6; OUT;                / deallocate paper tape reader

 3173/0: 304 006 024                                                         SET#3024;                      / to call brick 84 to simulate KAB60 exit to translate Usercode
 3173/3: 320 013 071|164 027|220 046 177                                     F.Z0-38; SHL+11; J<Z.usercode; / J if source is Usercode
 3174/5: 052                                                                 ERASE;                         / not Usercode, so discard brick number

 3175/0: 304 344 006|200 320 106|200 326 115                                 SET#162006; JS.70; JS.crash;   / interchange to produce channel 6
 3176/3: 304 004 021                                                         SET#2021;                      / to call brick 01
                                                                       usercode:                            / sumulate KAB60 exit to translate Usercode
 3177/0: 170 364|304 336 010|170 362                                         SI15; SET#157010; SM15;
 3200/1: 171 376|200 260 106                                                 FQ15; J.70;


 3201/0: 000 000 000 000 000 000                                       *blk: =0;
                                                                       !end // of main

                                                                       *chbuff:
                                                                       prog=prog+32:
                                                                       opbuff:

Reached end of file
                                                                       !end
No of ID table entries = 300 (10%)