1 / Dec 6 2023 Vincent Slyngstad 2 / Disassembly of the DECtape driver at location 26000 in dec-d8-sbaf-pb. 3 4 / DECtape IOTs: 5 DTRA=6761 / Read Register A 6 DTCA=6762 / Clear Register A 7 DTXA=6764 / XOR into Register A 8 DTSF=6771 / Skip if done 9 DTRB=6772 / Load Register B 10 DTLB=6774 / Load memory field to controller 11 12 / DECtape Register A: 13 / 0-2 Unit number 14 / 3 Reverse 15 / 4 GO 16 / 5 Continuous mode 17 / 6-8 Command 18 / 000 Move 19 / 001 Search 20 / 010 Read 21 / 100 Write 22 / 9 Interrupt enable 23 / 10 Error/Leave error 24 / 11 Flag/Leave flag 25 26 / DECtape Register B: 27 / 0 Any Error 28 / 1 Mark Track Error 29 / 2 EOT Error 30 / 3 Select Error 31 / 4 Parity Error 32 / 5 Error 33 / 6-8 Memory Field 34 / 11 Done 35 36 *2600 37 RELOC 7600 38 007600* 0070 C70, 0070 / Bootstrap entry point, and harmless constant 39 40 007601* 4242 JMS SYSIO / Call SYSIO entry point. 41 007602* 0005 0005 / Function code. 5 is WRITE. 42 007603* 0005 0005 / Block = first disk scratch block. 43 007604* 7200 7200 / Buffer address. 44 007605* 0000 .-. / Link field. 45 007606* 7402 HLT / Error HALT. 46 47 007607* 4242 JMS SYSIO / Call SYSIO entry point. 48 007610* 0005 0005 / Function code. 5 is WRITE. 49 007611* 0006 0006 / Block = second disk scratch block. 50 007612* 7400 7400 / Buffer address. 51 007613* 0000 .-. / Link field. 52 007614* 7402 HLT 53 54 007615* 4242 JMS SYSIO / Call SYSIO entry point. 55 007616* 0003 0003 / Function code. 3 is READ. 56 007617* 0001 0001 / Block = MONITOR (1ST PAGE OF SAVE). 57 007620* 7200 7200 / Buffer address. 58 007621* 0000 BUFP, .-. / Link field. Re-used as BUFP below. 59 007622* 7402 HLT / Error HALT. 60 61 007623* 4242 JMS SYSIO / Call SYSIO entry point. 62 007624* 0003 C3, 0003 / Function code. 3 is READ. 63 007625* 0002 0002 / Block = MONITOR (START). 64 007626* 7400 MONTOR, 7400 / Buffer address. Also Monitor starting address. 65 007627* 0000 LNKPTR, .-. / Link field. Re-used for indirect returns. 66 007630* 7402 HLT / Error HALT. 67 68 007631* 5626 JMP I MONTOR / Jump to MONITOR START. 69 70 007632* 0400 C400, 0400 / Constant: reverse search 71 007633* 7010 C7010, 7010 / Mask constant 72 007634* 7577 N201, -201 / Block size (negative) 73 007635* 7754 PCA, CA-1 / Pointer to CA 74 75 007636* 2377 FAIL, ISZ RETRY / Check for first time. 76 007637* 5345 JMP BAIL / Not first, go bail. 77 007640* 5272 JMP SETUP / First time, go do retry 78 79 / SYSIO Function Word: 80 / 2 Indirect return 81 / 3-5 Unit number 82 / 6-8 Memory field for buffer 83 / 9-11 3 = read, 5 = write 84 *7642 85 007642* 0000 SYSIO, .-. / System Device Driver 86 007643* 7240 CLA CMA / Get -1 87 007644* 3377 DCA RETRY / Set flag to attempt a retry. 88 007645* 1642 TAD I SYSIO / Get the function word 89 007646* 3351 DCA OFUNC / Remember unshifted function word 90 007647* 1351 TAD OFUNC / Get it again 91 007650* 7106 CLL RTL / Shift indirect return to L 92 007651* 7004 RAL / AC is now UUUFFFCCC000 93 007652* 3352 DCA SFUNC / Remember shifted function word 94 007653* 2242 ISZ SYSIO / Point to the block number 95 007654* 1642 TAD I SYSIO / Get block number 96 007655* 3350 DCA CSLNK / Store block number for now 97 007656* 2242 ISZ SYSIO / Point to buffer address 98 007657* 1642 TAD I SYSIO / Get buffer address 99 007660* 3221 DCA BUFP / Save as BUFP 100 007661* 1242 TAD SYSIO / Get link pointer 101 007662* 7430 SZL / Indirect return? 102 007663* 7344 CLA CLL CMA RAL / Yes, Get -2, keep L set 103 007664* 3227 DCA LNKPTR / Save argument pointer or -2 104 007665* 2242 ISZ SYSIO / Point to link argument 105 007666* 2242 ISZ SYSIO / Point to error return 106 007667* 1642 TAD I SYSIO / Get error return? 107 007670* 7430 SZL / Was L set by CMA RAL? 108 007671* 3242 DCA SYSIO / Yes, do return indirection if needed 109 007672* 7200 SETUP, CLA / Clear cruft if retry 110 007673* 1352 TAD SFUNC / Get shifted function word 111 007674* 0233 AND C7010 / Mask for UNIT and command bit 112 / Also a constant 0200 113 007675* 1232 TAD C400 / Add 600 to form unit, reverse, search 114 007676* 6766 DTCA DTXA / Send it to controller. 115 007677* 6774 DTLB / Stop the controller (AC==0). 116 007700* 1235 TAD PCA / Get a pointer to CA 117 007701* 3355 DCA CA / Make CA point to itself 118 / Here the first time with reverse bit clear 119 007702* 7006 RAGAIN, RTL / Get reverse bit to LINK 120 007703* 7004 RAL 121 007704* 7220 CLA CML / Clear cruft, complement link 122 007705* 1342 TAD C200 / Get a go bit 123 007706* 7420 FAGAIN, SNL / Need reverse? 124 007707* 1232 TAD C400 / Yes, set reverse bit 125 007710* 6764 DTXA / Toggle the selected bits. 126 007711* 6773 DTRB DTSF / Wait for done. 127 007712* 5311 JMP .-1 128 007713* 7510 SPA / Any error? 129 007714* 5302 JMP RAGAIN / Yes, try again 130 007715* 6761 DTRA / Read the A register. 131 007716* 7006 RTL / Shift go bit to LINK 132 007717* 7006 RTL 133 007720* 7630 SZL CLA / Was it set? 134 007721* 1224 TAD C3 / Yes, get a an offset of 3. 135 007722* 1354 TAD WC / Get or add WC. 136 007723* 7040 CMA / Subtrace block number from desired. 137 007724* 1350 TAD CSLNK 138 007725* 7040 CMA / Desired block number? 139 007726* 7640 SZA CLA 140 007727* 5306 JMP FAGAIN / No, go search again 141 007730* 7430 SZL / Overflow? 142 007731* 5307 JMP FAGAIN+1 / Yes, go search again in reverse 143 007732* 1234 TAD N201 / Get block size in words 144 007733* 3354 DCA WC / Set up WC for data transfer 145 007734* 7040 CMA / Get -1 146 007735* 1221 TAD BUFP / Set up CA for data transfer 147 007736* 3355 DCA CA 148 007737* 1351 TAD OFUNC / Get original function word 149 007740* 6774 DTLB / Set field in the controller 150 007741* 1352 TAD SFUNC / Get UUUFFFCCC000 151 007742* 0200 C200, AND C70 / Get the command bits 152 007743* 5357 JMP DMAGO / Go start the data transfer 153 007744* 2242 OKRET, ISZ SYSIO / Set up for normal return 154 007745* 1342 BAIL, TAD C200 / Get 0200 (GO bit) 155 007746* 6764 DTXA / XOR to stop the DECtape 156 007747* 5642 JMP I SYSIO / Return 157 007750* 0000 CSLNK, .-. / ?? 158 007751* 0000 OFUNC, .-. / Pointer to where to write link 159 007752* 0000 SFUNC, .-. / Saved/shifted function word 160 161 *7754 162 007754* 0000 WC, .-. / Hardware WC register 163 007755* 0000 CA, .-. / Hardware CA register 164 165 *7757 166 007757* 6764 DMAGO, DTXA / Give command to the controller 167 007760* 6772 DMAWT, DTRB / Read status register 168 007761* 7710 SPA CLA / Any error? 169 007762* 5236 JMP FAIL / Yes, go check retry 170 007763* 1354 TAD WC / Are we (almost) done? 171 007764* 7140 CLL CMA 172 007765* 7640 SZA CLA 173 007766* 5360 JMP DMAWT / No, just keep going 174 007767* 6774 DTLB / Yes, clear memory field 175 007770* 1227 TAD LNKPTR / Get saved link pointer 176 007771* 3355 DCA CA / Fudge CA to link pointer 177 007772* 6773 DTRB DTSF / Read B, skip if done 178 007773* 5372 JMP .-1 / Wait for done 179 007774* 7710 SPA CLA / Any error? 180 007775* 5236 JMP FAIL / Yes, go check retry 181 007776* 5344 JMP OKRET / No, take the normal return 182 183 007777* 0000 RETRY, .-. / Flag for first attempt (allow retry). 184 $ BAIL 7745 BUFP 7621 C200 7742 C3 7624 C400 7632 C70 7600 C7010 7633 CA 7755 CSLNK 7750 DMAGO 7757 DMAWT 7760 DTCA 6762 DTLB 6774 DTRA 6761 DTRB 6772 DTSF 6771 DTXA 6764 FAGAIN 7706 FAIL 7636 LNKPTR 7627 MONTOR 7626 N201 7634 OFUNC 7751 OKRET 7744 PCA 7635 RAGAIN 7702 RETRY 7777 SETUP 7672 SFUNC 7752 SYSIO 7642 WC 7754