Pascal [Rev 3.0M 6/ 4/84] SPSOD.TEXT 28-Jun-89 17:45:08 Page 1 1:D 0 (* sccs info: @(#) spsod 8.1 84/05/04 00:18:32 *) 2:S 3:D 0 $modcal, debug off, range off, ovflcheck off, stackcheck off, callabs off$ 4:S 5:D 0 $search 'BRDECS', 'SR', 'MISCASM'$ 6:S 7:D 0 (****************************************************************************) 8:D 0 (* Scanner Procedures for Sector-oriented Devices *) 9:D 0 (****************************************************************************) 10:S 11:D 0 module spsod; 12:S 13:D 1 import 14:D 1 brdecs, 15:D 1 sr, 16:D 1 miscasm; 17:S 18:D 1 export 19:S 20:D 1 function extd_active1(bootpass: signed16; initscan: boolean; var msus: msus_type; 21:D 2 var msus_valid: boolean; use_booleans: boolean): boolean; 22:D 1 function extd_active2(bootpass: signed16; initscan: boolean; var msus: msus_type; 23:D 2 var msus_valid: boolean; use_booleans: boolean): boolean; 24:D 1 function mini_active1(bootpass: signed16; initscan: boolean; var msus: msus_type; 25:D 2 var msus_valid: boolean; use_booleans: boolean): boolean; 26:D 1 function mini_active2(bootpass: signed16; initscan: boolean; var msus: msus_type; 27:D 2 var msus_valid: boolean; use_booleans: boolean): boolean; 28:D 1 function eprom_active1(bootpass: signed16; initscan: boolean; var msus: msus_type; 29:D 2 var msus_valid: boolean; use_booleans: boolean): boolean; 30:D 1 function eprom_active2(bootpass: signed16; initscan: boolean; var msus: msus_type; 31:D 2 var msus_valid: boolean; use_booleans: boolean): boolean; 32:D 1 function bubl_active1(bootpass: signed16; initscan: boolean; var msus: msus_type; 33:D 2 var msus_valid: boolean; use_booleans: boolean): boolean; 34:D 1 function bubl_active2(bootpass: signed16; initscan: boolean; var msus: msus_type; 35:D 2 var msus_valid: boolean; use_booleans: boolean): boolean; 36:D 1 function next_system(var filename: string255): boolean; 37:S 38:D 1 implement {spsod} 39:S 40:S 41:D 1 procedure dsp_ri_error; external; 42:S 43:S 44:D 1 function escape_result: boolean; 45:S { 46:S function to print out a message for an abnormal escape 47:D 2 } 48:C 2 begin {escape_result} 49:C 2 if not (escapecode in [ec_no_device, ec_no_medium, ec_not_ready]) then 50:C 3 dsp_ri_error; 51:C 2 escape_result := false; 52:C 2 end; {escape_result} 53:S 54:S 55:D 1 function HPIB_card: boolean; 56:C 2 begin {HPIB_card} 57:C 2 HPIB_card := cardID in [intHPIB, HP98624, HP98625]; 58:C 2 end; {HPIB_card} Pascal [Rev 3.0M 6/ 4/84] SPSOD.TEXT 28-Jun-89 17:45:08 Page 2 59:D 1 $page$ 60:S 61:D 1 function extd_controller_inited(initscan, extd_active1: boolean; var sc, ba: signed16): boolean; 62:D 2 label 1; 63:D 2 var 64:D -2 2 HPIBident: signed16; 65:D -4 2 device: dev_type; 66:C 2 begin {extd_controller_inited} 67:C 2 extd_controller_inited := true; {initial assumption} 68:C 2 with f_area^ do 69:C 3 if not initscan then {restore the previous sc & ba} 70:C 4 begin 71:C 4 sc := m_msus.sc; 72:C 4 ba := m_msus.ba; 73:C 4 end {then} 74:C 4 else {try to initialize the controller} 75:C 4 try 76:C 5 m_msus.fmt := LIF; {anything except f7} 77:C 5 m_msus.dev := Unknown; 78:C 5 m_msus.un := 0; 79:C 5 m_msus.sc := sc; 80:C 5 m_msus.ba := ba; 81:S 82:C 5 if cardID=no_card then 83:C 6 escape(ec_no_device); {no card present} 84:S 85:C 5 if HPIB_card then 86:C 6 begin 87:C 6 HPIB_clear; 88:C 6 HPIBident := HPIB_amigo_identify; 89:C 6 end {then} 90:C 6 else 91:C 6 begin 92:C 6 if ba<>0 then 93:C 7 escape(ec_no_device); {don't test different "ba's" on non-HPIB's} 94:C 6 HPIBident := -1; {indicate null HPIB ident} 95:C 6 end; {else} 96:S 97:C 5 for device := d0 to d31 do {try to identify the device type} 98:C 6 begin 99:C 6 m_msus.dev := device; 100:C 6 if dd_controllersID(cardID, HPIBident) then goto 1; 101:C 6 end; {then} 102:C 5 m_msus.dev := Unknown; 103:C 5 escape(ec_no_device); {unrecognized device} 104:S 105:C 5 1: if not bit_tst(initialized_cntrlrs, sc, ba) then 106:C 6 begin 107:C 6 if not extd_active1 and (ba=0) then 108:C 7 escape(ec_no_device); {extd_active1 gets first shot at ba 0!} 109:C 6 dd_controller_init; 110:C 6 bit_set(initialized_cntrlrs, sc, ba); 111:C 6 end; {then} 112:C 5 recover 113:C 5 extd_controller_inited := escape_result; 114:C 2 end; {extd_controller_inited} Pascal [Rev 3.0M 6/ 4/84] SPSOD.TEXT 28-Jun-89 17:45:08 Page 3 115:D 1 $page$ 116:S 117:D 1 function active_unit(var initscan: boolean; var un4, vn4: signed16; var msus: msus_type; 118:D 2 var msus_valid: boolean; use_booleans, extd: boolean): boolean; 119:D 2 label 1; 120:D 2 var 121:D -2 2 au_offset: signed16; 122:D -4 2 format: fmt_type; 123:D 2 procedure set_msus; 124:C 3 begin {set_msus} 125:C 3 msus := f_area^.m_msus; 126:C 3 if not HPIB_card then msus.ba := 255; {indicate null bus address} 127:C 3 msus_valid := true; 128:C 3 end; {set_msus} 129:C 2 begin {active_unit} 130:C 2 active_unit := false; {assume until proven otherwise} 131:C 2 with f_area^ do 132:C 3 if not initscan then 133:C 4 begin 134:C 4 initscan := true; 135:C 4 un4 := m_msus.un4; 136:C 4 vn4 := m_msus.vn4; 137:C 4 end {then} 138:C 4 else 139:C 4 begin 140:C 4 m_msus.un4 := un4; 141:C 4 m_msus.vn4 := vn4; 142:C 4 au_offset := m_msus.sc*16+un4; 143:C 4 if not (use_booleans and bit_tst(accessed_units, au_offset, m_msus.ba)) then 144:C 5 try 145:C 6 m_msus.fmt := LIF; {default directory format if no active media} 146:C 6 dd_unit_init; {confirm unit/volume present} 147:C 6 if not msus_valid then set_msus; {if FIRST unit found, then remember it} 148:S 149:C 6 dd_deviceread(fubuffer, 256, 0); {load sysrec, confirming unit ready & medium present} 150:C 6 if use_booleans and (vn4=7) then 151:C 7 bit_set(accessed_units, au_offset, m_msus.ba); {prevent further access} 152:S 153:C 6 for format := f0 to f6 do {try to identify the directory format} 154:C 7 begin 155:C 7 m_msus.fmt := format; 156:C 7 if dm_sysrec_valid then 157:C 8 begin 158:C 8 set_msus; 159:C 8 active_unit := true; 160:C 8 goto 1; 161:C 8 end; {if} 162:C 7 end; {for} 163:C 6 1: 164:S 165:C 6 recover 166:C 6 begin 167:C 6 if extd then {special rules; only for external discs} 168:C 7 if escapecode=ec_not_ready then 169:C 8 vn4 := 7 {skip to next unit} 170:C 8 else if (escapecode=ec_no_device) and use_booleans then 171:C 9 bit_set(accessed_units, au_offset, m_msus.ba); {prevent further access} 172:C 6 active_unit := escape_result; 173:C 6 end; {recover} 174:C 4 end; {else} Pascal [Rev 3.0M 6/ 4/84] SPSOD.TEXT 28-Jun-89 17:45:08 Page 4 175:C 2 end; {active_unit} Pascal [Rev 3.0M 6/ 4/84] SPSOD.TEXT 28-Jun-89 17:45:08 Page 5 176:D 1 $page$ 177:S 178:D 1 function device_active(bootpass: signed16; var initscan: boolean; device: dev_type; 179:D 2 var select_code,unit: signed16; var msus: msus_type; 180:D 2 var msus_valid: boolean): boolean; 181:D 2 var 182:D -2 2 un4: signed16; 183:D -4 2 vn4: signed16; 184:C 2 begin {device_active} 185:C 2 if bootpass<>1 then {unit has already been accessed} 186:C 3 device_active := false 187:C 3 else 188:C 3 begin 189:C 3 with f_area^.m_msus do 190:C 4 if initscan then 191:C 5 begin 192:C 5 dev := device; 193:C 5 sc := select_code; 194:C 5 ba := 0; 195:C 5 end {then} 196:C 5 else 197:C 5 select_code := sc; 198:C 3 un4 := unit mod 16; 199:C 3 vn4 := unit div 16; 200:C 3 device_active := active_unit(initscan, un4, vn4, msus, msus_valid, false, false); 201:C 3 unit := vn4*16+un4; 202:C 3 end; {else} 203:C 2 end; {device_active} Pascal [Rev 3.0M 6/ 4/84] SPSOD.TEXT 28-Jun-89 17:45:08 Page 6 204:D 1 $page$ 205:S 206:D 1 (*****************************************************************************) 207:D 1 (* External Disc Active Routines *) 208:D 1 (*****************************************************************************) 209:S 210:S 211:D 1 function extd_active1(bootpass: signed16; initscan: boolean; var msus: msus_type; 212:D 2 var msus_valid: boolean; use_booleans: boolean): boolean; 213:D 2 label 1; 214:D 2 var 215:D -4 2 sc, ba: signed16; 216:D -8 2 un4, vn4: signed16; 217:C 2 begin {extd_active1} 218:S 219:C 2 if initscan and (bootpass=1) then 220:C 3 for sc := 0 to 31 do 221:C 4 with f_area^ do 222:C 5 begin 223:C 5 initialized_cntrlrs[sc] := chr(0); {permanent booleans} 224:C 5 if use_booleans then 225:C 6 for un4 := 0 to 15 do 226:C 7 accessed_units[sc*16+un4] := chr(0); {non-permanent booleans} 227:C 5 end; {with} 228:S 229:C 2 extd_active1 := true; 230:C 2 for sc := 0 to 31 do 231:C 3 for ba := 0 to 0 do 232:C 4 if extd_controller_inited(initscan, true, sc, ba) then 233:C 5 for un4 := 0 to 0 do 234:C 6 for vn4 := 0 to 0 do 235:C 7 if active_unit(initscan, un4, vn4, msus, msus_valid, use_booleans, true) then 236:C 8 goto 1; 237:C 2 extd_active1 := false; 238:C 2 1: 239:C 2 end; {extd_active1} 240:S 241:S 242:D 1 function extd_active2(bootpass: signed16; initscan: boolean; var msus: msus_type; 243:D 2 var msus_valid: boolean; use_booleans: boolean): boolean; 244:D 2 label 1; 245:D 2 var 246:D -4 2 sc, ba: signed16; 247:D -8 2 un4, vn4: signed16; 248:C 2 begin {extd_active2} 249:C 2 extd_active2 := true; 250:C 2 for sc := 0 to 31 do 251:C 3 for ba := 0 to 7 do 252:C 4 if extd_controller_inited(initscan, false, sc, ba) then 253:C 5 for un4 := 0 to 15 do 254:C 6 for vn4 := 0 to 7 do 255:C 7 if not((ba=0) and (un4=0) and (vn4=0)) {case handled by extd_active1} then 256:C 8 if active_unit(initscan, un4, vn4, msus, msus_valid, use_booleans, true) then 257:C 9 goto 1; 258:C 2 extd_active2 := false; 259:C 2 1: 260:C 2 end; {extd_active2} Pascal [Rev 3.0M 6/ 4/84] SPSOD.TEXT 28-Jun-89 17:45:08 Page 7 261:D 1 $page$ 262:S 263:D 1 (*****************************************************************************) 264:D 1 (* Internal Minifloppy Active Routines *) 265:D 1 (*****************************************************************************) 266:S 267:S 268:D 1 function mini_active1(bootpass: signed16; initscan: boolean; var msus: msus_type; 269:D 2 var msus_valid: boolean; use_booleans: boolean): boolean; 270:D 2 var 271:D -4 2 select_code,unit: signed16; 272:C 2 begin {mini_active1} 273:C 2 unit := 0; select_code := 255; 274:C 2 mini_active1 := device_active(bootpass, initscan, mini, select_code, unit, msus, msus_valid); 275:C 2 end; {mini_active1} 276:S 277:S 278:D 1 function mini_active2(bootpass: signed16; initscan: boolean; var msus: msus_type; 279:D 2 var msus_valid: boolean; use_booleans: boolean): boolean; 280:D 2 label 1; 281:D 2 var 282:D -4 2 select_code,unit: signed16; 283:C 2 begin {mini_active2} 284:C 2 mini_active2 := true; select_code := 255; 285:C 2 for unit := 1 to ndrives.b do 286:C 3 if device_active(bootpass, initscan, mini, select_code, unit, msus, msus_valid) then 287:C 4 goto 1; 288:C 2 mini_active2 := false; 289:C 2 1: 290:C 2 end; {mini_active2} Pascal [Rev 3.0M 6/ 4/84] SPSOD.TEXT 28-Jun-89 17:45:08 Page 8 291:D 1 $page$ 292:S 293:D 1 (*****************************************************************************) 294:D 1 (* EPROM Memory Disc Active Routines *) 295:D 1 (*****************************************************************************) 296:S 297:S 298:D 1 function eprom_active1(bootpass: signed16; initscan: boolean; var msus: msus_type; 299:D 2 var msus_valid: boolean; use_booleans: boolean): boolean; 300:D 2 var 301:D -4 2 select_code,unit: signed16; 302:C 2 begin {eprom_active1} 303:C 2 unit := 0; select_code := 255; 304:C 2 eprom_active1 := device_active(bootpass, initscan, eprom, select_code, unit, msus, msus_valid); 305:C 2 end; {eprom_active1} 306:S 307:S 308:D 1 function eprom_active2(bootpass: signed16; initscan: boolean; var msus: msus_type; 309:D 2 var msus_valid: boolean; use_booleans: boolean): boolean; 310:D 2 label 1,2; 311:D 2 var 312:D -6 2 select_code,unit,last_unit: signed16; 313:C 2 begin {eprom_active2} 314:C 2 eprom_active2 := true; select_code := 255; 315:C 2 last_unit := f_area^.m_msus.un; 316:C 2 for unit := 1 to 255 do 317:C 3 begin 318:C 3 if device_active(bootpass, initscan, eprom, select_code, unit, msus, msus_valid) then goto 2; 319:C 3 if unit <> last_unit then goto 1; 320:C 3 end; 321:C 2 1: 322:C 2 eprom_active2 := false; 323:C 2 2: 324:C 2 end; {eprom_active2} Pascal [Rev 3.0M 6/ 4/84] SPSOD.TEXT 28-Jun-89 17:45:08 Page 9 325:D 1 $page$ 326:S 327:D 1 (*****************************************************************************) 328:D 1 (* Bubble Memory Card Active Routines *) 329:D 1 (*****************************************************************************) 330:S 331:S 332:D 1 function bubl_active1(bootpass: signed16; initscan: boolean; var msus: msus_type; 333:D 2 var msus_valid: boolean; use_booleans: boolean): boolean; 334:D 2 var 335:D -4 2 select_code,unit: signed16; 336:C 2 begin {bubl_active1} 337:C 2 select_code := 30; {default select_code; highest priority} 338:C 2 unit := 255; 339:C 2 bubl_active1 := device_active(bootpass, initscan, bubbles, select_code, unit, msus, msus_valid); 340:C 2 end; {bubl_active1} 341:S 342:S 343:D 1 function bubl_active2(bootpass: signed16; initscan: boolean; var msus: msus_type; 344:D 2 var msus_valid: boolean; use_booleans: boolean): boolean; 345:D 2 label 1; 346:D 2 var 347:D -4 2 select_code,unit: signed16; 348:C 2 begin {bubl_active2} 349:C 2 bubl_active2 := true; unit := 255; 350:C 2 for select_code := 0 to 31 do 351:C 3 if select_code<>30 {case covered by bubl_active1} then 352:C 4 if device_active(bootpass, initscan, bubbles, select_code, unit, msus, msus_valid) then goto 1 ; 353:C 2 bubl_active2 := false; 354:C 2 1: 355:C 2 end; {bubl_active2} Pascal [Rev 3.0M 6/ 4/84] SPSOD.TEXT 28-Jun-89 17:45:08 Page 10 356:D 1 $page$ 357:S 358:D 1 function next_system(var filename: string255): boolean; 359:D 2 var 360:D -2 2 filetype: signed16; 361:D -2 2 sector_addr, 362:D -10 2 length: integer; 363:D -14 2 execution_addr: anyptr; 364:C 2 begin {next_system} 365:C 2 try 366:C 3 filetype := -5822; {DCD 68000-based systems file type} 367:C 3 next_system := dm_fileopen(filename, filetype, sector_addr, length, execution_addr); 368:C 3 recover 369:C 3 begin 370:C 3 dsp_ri_error; 371:C 3 next_system := false; 372:C 3 end; {recover} 373:C 2 end; {next_system} 374:S 375:S 376:C 1 end. {spsod} 377:S 378:S No errors. No warnings. ***** Nonstandard language features enabled *****