include "hdr1.html"; ?>
Line | Address | Object Code | Label | F1 | N1 | B | F2 | N2 | Comments | Check |
---|---|---|---|---|---|---|---|---|---|---|
1 | 0 | ; tape2/indexing.t2 | ||||||||
2 | 0 | ;-------------------------------------------------------------------- | ||||||||
3 | 0 | ; index1 - first stage of indexing | ||||||||
4 | 0 | ; acc points at array info | ||||||||
5 | 0 | Indexing:: | ; | |||||||
6 | 0 | Index1: | ; | |||||||
7 | 0 | 2070636577777 | sto | ARptr | / | lod | -1 | ;store address, get bound list | @6937 | |
8 | 1 | 0416150 | sto | BLptr | ;save bound list | @6938 | ||||
9 | 1+ | 0555121 | cls | W6737 | ;clear partial index | |||||
10 | 2 | .ret: | ; | |||||||
11 | 2 | 2200007000000 | inc | T2Link | / | jmp | 0 | ;return after bumping return | @6939 | |
12 | 3 | ;-------------------------------------------------------------------- | ||||||||
13 | 3 | ; index2 - intermediate stage, | ||||||||
14 | 3 | ; acc contains subscript value, assume Index1 done | ||||||||
15 | 3 | Index2: | ; | |||||||
16 | 3 | 2270642120000 | inc | BLptr | / | sub | 0 | ;remove lower bound | @6940 | |
17 | 4 | 1120011 | jn | SubOflo | ;out-of range | @6941 | ||||
18 | 4+ | 0515121 | ads | W6737 | ;add to index | |||||
19 | 5 | 2270642120000 | inc | BLptr | / | sub | 0 | ;check upper bound | @6942 | |
20 | 6 | 1120014 | jn | .2A | ;OK, | @6943 | ||||
21 | 6+ | 1100011 | jmp | SubOflo | ;over the top, abort | |||||
22 | 7 | ;-------------------------------------------------------------------- | ||||||||
23 | 7 | ; index3 - final subscript to indexing operation | ||||||||
24 | 7 | ; acc contains final subscript, return with address of element | ||||||||
25 | 7 | ; | ||||||||
26 | 7 | Index3: | ; | |||||||
27 | 7 | 0070642120001 | o00 | BLptr | / | sub | 1 | ;remove lower bnd | @6944 | |
28 | 8 | 1120011 | jn | SubOflo | ;out of range | @6945 | ||||
29 | 8+ | 0515121 | ads | W6737 | ;add to index | |||||
30 | 9 | 0070642120002 | o00 | BLptr | / | sub | 2 | ;check upper limit | @6946 | |
31 | 10 | 1020013 | jn | .3A | ;OK, skip | @6947 | ||||
32 | 10+ | 1100011 | jmp | SubOflo | ;report out of range | |||||
33 | 11 | ; | ||||||||
34 | 11 | .3A: | ; | |||||||
35 | 11 | 0615121 | lod | W6737 | ;get index value | @6948 | ||||
36 | 11+ | 0116147 | add | ARptr | ;add base address | |||||
37 | 12 | 1000002 | jmp | .ret | ;return address of element | @6949 | ||||
38 | 12+ | ;-------- | ||||||||
39 | 12+ | ; from Index2, subscript OK | ||||||||
40 | 12+ | .2A: | ; | |||||||
41 | 12+ | 0615121 | lod | W6737 | ;present index | |||||
42 | 13 | 0070643240002 | o00 | BLptr | / | mul | 2 | ;multiply by stride | @6950 | |
43 | 14 | 1360000 | ara | 0 | ; | @6951 | ||||
44 | 14+ | 0415121 | sto | W6737 | ;updated index | |||||
45 | 15 | 1000002 | jmp | .ret | ; | @6952 | ||||
46 | 15+ | ; | ||||||||
47 | 15+ | 0000000 | o00 | 0 | ; | |||||
48 | 16 | =7109 | ||||||||
49 | 7109 | ;-------------------------------------------------------------------- | ||||||||
50 | 7109 | ; Size: get size of array (address in arg1) | ||||||||
51 | 7109 | Size: | ; | |||||||
52 | 7109 | 0000072577777 | o00 | arg1 | / | lod | -1 | ;get address of store used | @7109 | |
53 | 7110 | 2000072600000 | sto | arg1 | / | lod | 0 | ;size is top half of word | @7110 | |
54 | 7111 | 1220024 | srl | 20 | ;shift down to normal | @7111 | ||||
55 | 7111+ | 0116210 | add | N1 | ;=-1 less overhead | |||||
56 | 7112 | 1000052 | jmp | retlnk1 | ;and return it | @7112 | ||||
57 | 7112+ | ;-------------------------------------------------------------------- | ||||||||
58 | 7112+ | ; | ||||||||
59 | 7112+ | Range: | ; | |||||||
60 | 7112+ | 0455120 | inc | W6736 | ;set flag for lowbound | |||||
61 | 7113 | Lowbound: | ; | |||||||
62 | 7113 | 0000072577777 | o00 | arg1 | / | lod | -1 | ;address of array descriptor | @7113 | |
63 | 7114 | 2000022600000 | sto | 4 | / | lod | 0 | ; | @7114 | |
64 | 7115 | 0076222 | and | K127 | ;=127 | @7115 | ||||
65 | 7115+ | 0120017 | sub | arg2 | ; | |||||
66 | 7116 | 1120011 | jn | SubOflo | ;arg2 > no dims | @7116 | ||||
67 | 7116+ | 0600017 | lod | arg2 | ;reload arg2 | |||||
68 | 7117 | 1120011 | jn | SubOflo | ;arg2 <= 0 | @7117 | ||||
69 | 7117+ | 1140011 | jz | SubOflo | ; | |||||
70 | 7118 | 0100004 | add | 4 | ;add base address | @7118 | ||||
71 | 7118+ | 0115120 | add | W6736 | ;add flag (0/1) | |||||
72 | 7119 | 2400076577777 | ads | arg2 | / | lod | -1 | ;get range/lowbound | @7119 | |
73 | 7120 | 1000052 | jmp | retlnk1 | ;return it | @7120 | ||||
74 | 7120+ | ; | ||||||||
75 | 7120+ | 0000000 | o00 | 0 | ; | |||||
76 | 7121 | ; no refs | ||||||||
77 | 7121 | ;L7121: | ||||||||
78 | 7121 | 1000052 | jmp | retlnk1 | ; | @7121 | ||||
79 | 7121+ | ; | ||||||||
80 | 7121+ | 0000000 | o00 | 0 | ; | |||||
81 | 7122 | ;-------------------------------------------------------------------- |