Pascal [Rev 3.0M 6/ 4/84] AMIGO.TEXT 28-Jun-89 17:44:17 Page 1 1:D 0 (* sccs info: @(#) amigo 8.1 84/05/04 00:11:39 *) 2:S 3:D 0 $modcal, debug off, range off, ovflcheck off, stackcheck off, callabs off$ 4:S 5:D 0 $search 'BRDECS', 'MISCASM', 'SR'$ 6:S 7:S 8:D 0 (***************************************************************************) 9:D 0 (* *) 10:D 0 (* *** * * *** *** *** *) 11:D 0 (* * * ** ** * * * * * *) 12:D 0 (* * * * * * * * * * *) 13:D 0 (* ***** * * * * * * * *) 14:D 0 (* * * * * * * ** * * *) 15:D 0 (* * * * * * * * * * *) 16:D 0 (* * * * * *** **** *** *) 17:D 0 (* *) 18:D 0 (***************************************************************************) 19:S 20:S 21:D 0 module csAMIGO; {amigo command set} 22:S 23:D 1 import 24:D 1 brdecs, sr; 25:S 26:D 1 export 27:S 28:D 1 type 29:S 30:D 1 amigo_dev_type = {enumerated supported amigo devices} 31:D 1 (H9895, M8290X, H913X_A, H913X_B, H913X_C, Y7905, C7906, P7920, X7925); 32:S 33:D 1 s1_type = {enumerated status 1 values} 34:D 1 ( 35:D 1 normal_completion , illegal_opcode , 36:D 1 unit_available , illegal_drive_type , 37:D 1 s1_4 , s1_5 , 38:D 1 s1_6 , cylinder_compare_error , 39:D 1 uncorrectable_data_error , head_sector_compare_error , 40:D 1 io_program_error , s1_11 , 41:D 1 end_of_cylinder , sync_bit_not_received_in_time , 42:D 1 overrun , possibly_correctable_data_error , 43:D 1 illegal_access_to_spare_track , defective_track , 44:D 1 access_not_ready_during_data_operation , status_2_error , 45:D 1 s1_20 , s1_21 , 46:D 1 attempt_to_write_on_protected_track , unit_unavailable , 47:D 1 s1_24 , s1_25 , 48:D 1 s1_26 , s1_27 , 49:D 1 s1_28 , s1_29 , 50:D 1 s1_30 , drive_attention 51:D 1 ); Pascal [Rev 3.0M 6/ 4/84] AMIGO.TEXT 28-Jun-89 17:44:17 Page 2 52:D 1 $page$ 53:S 54:D 1 status_type = {4 bytes of returned status} 55:D 1 packed record 56:D 1 { stat 1 - from previous operation } 57:D 1 s: boolean; { 15 spare track bit } 58:D 1 p: boolean; { 14 protected track bit } 59:D 1 d: boolean; { 13 defective track bit } 60:D 1 s1: s1_type; { 12-8 last operation status } 61:D 1 unit: unsgn8; { 7-0 unit number } 62:D 1 { stat 2 - from specified drive } 63:D 1 star: boolean; { 15 conditions *'ed below } 64:D 1 xx: 0..3; { 14-13 undefined } 65:D 1 tttt: 0..15; { 12-9 disc type bits } 66:D 1 r: boolean; { 8 reserved } 67:D 1 a: boolean; { 7 drive attention } 68:D 1 w: boolean; { 6 write protected } 69:D 1 fmt: boolean; { 5 format switch } 70:D 1 e: boolean; { 4 *drive fault } 71:D 1 f: boolean; { 3 first status bit } 72:D 1 c: boolean; { 2 *seek check } 73:D 1 ss: 0..3; { 1,0 *drive ready status } 74:D 1 end; 75:S 76:D 1 command_type = {commands supported by the issue_cmd procedure} 77:D 1 ( req_status, { request status } 78:D 1 req_log_addr, { request logical address } 79:D 1 seek_cmd, { seek } 80:D 1 recalibrate_cmd, { recalibrate } 81:D 1 unbuf_read_cmd, { unbuffered read } 82:D 1 buf_read_cmd ); { buffered read } 83:S 84:D 1 ftcb_type = {first two command bytes} 85:D 1 packed record 86:D 1 opcode: unsgn8; 87:D 1 unit: unsgn8; 88:D 1 end; 89:S 90:D 1 function device: amigo_dev_type; 91:D 1 function MI_controller: boolean; 92:D 1 function surface_mode: boolean; 93:S 94:D 1 function dsj: unsgn8; 95:D 1 function logical_addr: integer; 96:D 1 procedure status(var status_bytes: status_type); 97:D 1 procedure seek(record_addr: integer); 98:D 1 procedure recalibrate; 99:D 1 procedure set_file_mask; 100:D 1 procedure issue_cmd(command: command_type; var command_buffer: ftcb_type); 101:D 1 procedure conditional_wait_for_ppol; 102:S 103:D 1 implement {csAMIGO} Pascal [Rev 3.0M 6/ 4/84] AMIGO.TEXT 28-Jun-89 17:44:17 Page 3 104:D 1 $page$ 105:S 106:D 1 type 107:S 108:D 1 map_type = {media addressing parameters} 109:D 1 record 110:D 1 cyl_per_med: signed16; { number of cylinders per medium } 111:D 1 trk_per_cyl: signed16; { number of tracks per cylinder } 112:D 1 sec_per_trk: signed16; { number of sectors per track } 113:D 1 end; 114:S 115:D 1 tvat = {three vector address type} 116:D 1 packed record 117:D 1 cyl: signed16; { cylinder address } 118:D 1 head: unsgn8; { head address } 119:D 1 sect: unsgn8; { sector address } 120:D 1 end; 121:S 122:S 123:D 1 function device: amigo_dev_type; 124:D 2 type 125:D 2 amigo_device_table_type = array[HP9895..HP7925] of amigo_dev_type; 126:D 2 const 127:D 2 amigo_device = {conversion table from dev_type to amigo_dev_type} 128:D 2 amigo_device_table_type 129:D 2 [ {d4} H9895, {d5} M8290X, {NA} H9895, {d7} H913X_A, 130:D 2 {d8} H913X_B, {d9} H913X_C, {d10} Y7905, {d11} C7906, 131:D 2 {d12} P7920, {d13} X7925 ]; 132:C 2 begin {device} 133:C 2 with f_area^.m_msus do 134:C 3 begin 135:C 3 if not (dev in [HP9895, HP8290X, HP913X_A, HP913X_B, HP913X_C, 136:C 4 HP7905, HP7906, HP7920, HP7925]) 137:C 4 then escape(ec_no_device); 138:C 3 device := amigo_device[dev]; 139:C 3 end; {with} 140:C 2 end; {device} 141:S 142:S 143:D 1 function MI_controller: boolean; 144:C 2 begin {MI_controller} 145:C 2 MI_controller := device in [Y7905, C7906, P7920, X7925]; 146:C 2 end; {MI_controller} 147:S 148:S 149:D 1 function surface_mode: boolean; 150:C 2 begin {surface_mode} 151:C 2 surface_mode := device in [Y7905, C7906]; 152:C 2 end; {surface_mode} Pascal [Rev 3.0M 6/ 4/84] AMIGO.TEXT 28-Jun-89 17:44:17 Page 4 153:D 1 $page$ 154:S 155:D 1 procedure get_map(var map: map_type); 156:D 2 type 157:D 2 device_maps_type = array[amigo_dev_type] of map_type; 158:D 2 const 159:D 2 device_maps = device_maps_type 160:D 2 [{H9895} map_type[ cyl_per_med: 77, trk_per_cyl: 2, sec_per_trk: 30], 161:D 2 {M8290X} map_type[ cyl_per_med: 33, trk_per_cyl: 2, sec_per_trk: 16], 162:D 2 {H913X_A} map_type[ cyl_per_med: 152, trk_per_cyl: 4, sec_per_trk: 31], 163:D 2 {H913X_B} map_type[ cyl_per_med: 305, trk_per_cyl: 4, sec_per_trk: 31], 164:D 2 {H913X_C} map_type[ cyl_per_med: 305, trk_per_cyl: 6, sec_per_trk: 31], 165:D 2 {Y7905} map_type[ cyl_per_med: 400, trk_per_cyl: 2, sec_per_trk: 48], 166:D 2 {C7906} map_type[ cyl_per_med: 400, trk_per_cyl: 2, sec_per_trk: 48], 167:D 2 {P7920} map_type[ cyl_per_med: 800, trk_per_cyl: 5, sec_per_trk: 48], 168:D 2 {X7925} map_type[ cyl_per_med: 800, trk_per_cyl: 9, sec_per_trk: 64] ]; 169:D 2 var 170:D -4 2 status_bytes: status_type; 171:C 2 begin {get_map} 172:C 2 map := device_maps[device]; 173:C 2 if device=H9895 then {the medium may be either single or double-sided} 174:C 3 begin 175:C 3 status(status_bytes); 176:C 3 if status_bytes.tttt in [5,6] 177:C 4 then map.trk_per_cyl := 2 178:C 4 else map.trk_per_cyl := 1; 179:C 3 end; {then} 180:C 2 end; {get_map} 181:S 182:S 183:D 1 function dsj: unsgn8; 184:D 2 var 185:D -2 2 dsj_byte: packed record b: unsgn8; end; 186:D -2 2 const 187:D -2 2 dsj_sec = 16; 188:C 2 begin {dsj} 189:C 2 HPIB_short_msge_in(dsj_sec, addr(dsj_byte), sizeof(dsj_byte)); 190:C 2 dsj := dsj_byte.b 191:C 2 end; {dsj} 192:S 193:S 194:D 1 procedure set_file_mask; 195:D 2 type 196:D 2 sfm_cmd_type = {set file mask command} 197:D 2 packed record 198:D 2 oc: unsgn8; mask: unsgn8; 199:D 2 end; 200:D 2 sfm_cmd_array_type = array[boolean] of sfm_cmd_type; 201:D 2 const 202:D 2 sfm_sec = 8; {secondary} 203:D 2 sfm_oc = 15; {op code} 204:D 2 sfm_cmd_array = sfm_cmd_array_type 205:D 2 [ {false: cylinder mode} sfm_cmd_type[ oc: sfm_oc, mask: 7 ], 206:D 2 {true: surface mode } sfm_cmd_type[ oc: sfm_oc, mask: 5 ] ]; 207:C 2 begin {set_file_mask} ***WARNING: (line 208): 'ADDR' of a constant may not be supported on other implementations 208:C 2 HPIB_short_msge_out(sfm_sec, addr(sfm_cmd_array[surface_mode]), sizeof(sfm_cmd_type)); 209:C 2 end; {set_file_mask} Pascal [Rev 3.0M 6/ 4/84] AMIGO.TEXT 28-Jun-89 17:44:17 Page 5 210:D 1 $page$ 211:S 212:D 1 procedure issue_cmd(command: command_type; var command_buffer: ftcb_type); 213:D 2 type 214:D 2 ctet = {command table entry type} 215:D 2 packed record 216:D 2 sec: signed16; { secondary command } 217:D 2 oc: unsgn8; { opcode } 218:D 2 nb: unsgn8; { number of data bytes } 219:D 2 end; 220:D 2 command_table_type = packed array[command_type] of ctet; 221:D 2 const 222:D 2 command_table = command_table_type 223:D 2 [ {req_status } ctet[sec: 8, oc: 03, nb: 2], 224:D 2 {req_log_addr } ctet[sec: 8, oc: 20, nb: 2], 225:D 2 {seek_cmd } ctet[sec: 8, oc: 02, nb: 6], 226:D 2 {recalibrate_cmd} ctet[sec: 8, oc: 01, nb: 2], 227:D 2 {unbuf_read_cmd } ctet[sec: 8, oc: 05, nb: 2], 228:D 2 {buf_read_cmd } ctet[sec: 10, oc: 05, nb: 2] ]; 229:C 2 begin {issue_cmd} 230:C 2 with command_table[command] do 231:C 3 begin 232:C 3 command_buffer.opcode := oc; 233:C 3 command_buffer.unit := f_area^.m_msus.un4; 234:C 3 HPIB_short_msge_out(sec, addr(command_buffer), nb); 235:C 3 end; {with} 236:C 2 end; {issue_cmd} 237:S 238:S 239:D 1 procedure recalibrate; 240:D 2 var 241:D -2 2 recalibrate_cmd_buf: ftcb_type; 242:C 2 begin {recalibrate} 243:C 2 issue_cmd(recalibrate_cmd, recalibrate_cmd_buf); 244:C 2 end; {recalibrate} 245:S 246:S 247:D 1 procedure conditional_wait_for_ppol; 248:C 2 begin {conditional_wait_for_ppol} 249:C 2 if not MI_controller then 250:C 3 HPIB_wait_for_ppol; 251:C 2 end; {conditional_wait_for_ppol} 252:S 253:S 254:D 1 procedure status(var status_bytes: status_type); 255:D 2 var 256:D -2 2 status_cmd_buf: ftcb_type; 257:D -2 2 const 258:D -2 2 send_sts_sec = 8; 259:C 2 begin {status} 260:C 2 issue_cmd(req_status, status_cmd_buf); 261:C 2 conditional_wait_for_ppol; 262:C 2 HPIB_short_msge_in(send_sts_sec, addr(status_bytes), sizeof(status_bytes)); 263:C 2 end; {status} Pascal [Rev 3.0M 6/ 4/84] AMIGO.TEXT 28-Jun-89 17:44:17 Page 6 264:D 1 $page$ 265:S 266:D 1 procedure seek(record_addr: integer); 267:D 2 var 268:D -6 2 map: map_type; 269:D -10 2 track: integer; 270:D -10 2 seek_cmd_buf: 271:D -10 2 packed record 272:D -10 2 ftcb: ftcb_type; 273:D -10 2 tva: tvat 274:D -16 2 end; 275:C 2 begin {seek} 276:C 2 get_map(map); 277:C 2 with map, seek_cmd_buf.tva do 278:C 3 begin 279:C 3 sect := record_addr mod sec_per_trk; 280:C 3 track := record_addr div sec_per_trk; 281:C 3 if surface_mode then 282:C 4 begin {select proper 7905/06 logical "volume"} 283:C 4 head := track div cyl_per_med + 2*f_area^.m_msus.vn4; 284:C 4 cyl := track mod cyl_per_med; 285:C 4 end {then} 286:C 4 else 287:C 4 begin 288:C 4 head := track mod trk_per_cyl; 289:C 4 cyl := track div trk_per_cyl; 290:C 4 end; {else} 291:C 3 end; {with} 292:C 2 issue_cmd(seek_cmd, seek_cmd_buf.ftcb); 293:C 2 end; {seek} 294:S 295:S 296:D 1 function logical_addr: integer; 297:D 2 var 298:D -2 2 ladd_cmd_buf: ftcb_type; 299:D -6 2 tv_addr: tvat; 300:D -12 2 map: map_type; 301:D -16 2 track: integer; 302:D -16 2 const 303:D -16 2 send_addr_sec = 8; 304:C 2 begin {logical_addr} 305:C 2 issue_cmd(req_log_addr, ladd_cmd_buf); 306:C 2 conditional_wait_for_ppol; 307:C 2 HPIB_short_msge_in(send_addr_sec, addr(tv_addr), sizeof(tv_addr)); 308:C 2 get_map(map); {does status sequence if 9895!!!!} 309:C 2 with tv_addr, map do 310:C 3 begin 311:C 3 if surface_mode 312:C 4 then track := (head-2*f_area^.m_msus.vn4)*cyl_per_med+cyl 313:C 4 else track := cyl*trk_per_cyl+head; 314:C 3 logical_addr := track*sec_per_trk+sect; 315:C 3 end; {with} 316:C 2 end; {logical_addr} 317:S 318:S 319:C 1 end; {csAMIGO} Pascal [Rev 3.0M 6/ 4/84] AMIGO.TEXT 28-Jun-89 17:44:17 Page 7 320:D 1 $page$ 321:S 322:D 1 module ddAMIGO; 323:S 324:D 1 import 325:D 1 brdecs, miscasm, sr, csAMIGO; 326:S 327:D 1 export 328:D 1 function controllersID(cardID: unsgn8; HPIBident: signed16): boolean; 329:D 1 procedure setdevicename(var device_name: string255); 330:D 1 procedure controller_init; 331:D 1 procedure unit_init; 332:D 1 procedure deviceread(bufptr: anyptr; length, start_addr: integer); 333:S 334:D 1 implement {ddAMIGO} 335:S 336:D 1 const 337:D 1 MAC_ident = 0*256+2; {$0002} 338:D 1 IDC_ident = 0*256+3; {$0003} 339:S 340:S 341:D 1 function controllersID(cardID: unsgn8; HPIBident: signed16): boolean; 342:D 2 type 343:D 2 device_ident_type = array[H9895..H913X_C] of signed16; 344:D 2 const 345:D 2 device_ident = device_ident_type 346:D 2 [ {H9895 } 0*256+129, {$0081} 347:D 2 {M8290X } 1*256+ 4, {$0104} 348:D 2 {H913X_A} 1*256+ 6, {$0106} 349:D 2 {H913X_B} 1*256+ 10, {$010A} 350:D 2 {H913X_C} 1*256+ 15 ]; {$010F} 351:D 2 var 352:D -4 2 status_bytes: status_type; 353:C 2 begin {controllersID} 354:C 2 if device in [H9895..H913X_C] then {require EXACT device/ident match} 355:C 3 controllersID := HPIBident=device_ident[device] 356:C 3 else {only check for MAC or IDC controller; let unit_init set msus.dev correctly} 357:C 3 controllersID := HPIBident in [MAC_ident,IDC_ident]; 358:C 2 end; {controllersID} 359:S 360:S 361:D 1 procedure setdevicename(var device_name: string255); 362:D 2 type 363:D 2 string5 = string[5]; 364:D 2 devicenames_type = array[amigo_dev_type] of string5; 365:D 2 const 366:D 2 devicenames = {names to be displayed on the menu} 367:D 2 devicenames_type 368:D 2 [ {H9895} '9895', 369:D 2 {M8290X} '8290X', 370:D 2 {H913X_A} '913XA', 371:D 2 {H913X_B} '913XB', 372:D 2 {H913X_C} '913XC', 373:D 2 {Y7905} '7905', 374:D 2 {C7906} '7906', 375:D 2 {P7920} '7920', 376:D 2 {X7925} '7925' ]; 377:C 2 begin {setdevicename} 378:C 2 device_name := 'HP'+devicenames[device]; 379:C 2 end; {setdevicename} Pascal [Rev 3.0M 6/ 4/84] AMIGO.TEXT 28-Jun-89 17:44:17 Page 8 380:D 1 $page$ 381:S 382:D 1 procedure controller_init; 383:C 2 begin {controller_init} 384:C 2 HPIB_amigo_clear; 385:C 2 HPIB_wait_for_ppol; 386:C 2 end; {controller_init} 387:S 388:S 389:D 1 function not_PHI_DMA: boolean; 390:C 2 begin {not_PHI_DMA} 391:C 2 not_PHI_DMA := not ((cardID=hp98625) and f_area^.booleans.dma_p); 392:C 2 end; {not_PHI_DMA} 393:S 394:S 395:D 1 procedure unit_init; 396:D 2 type 397:D 2 device_table_type = array[0..3] of dev_type; 398:D 2 const 399:D 2 device_table = device_table_type 400:D 2 [ {0} HP7906, {1} HP7920, {2} HP7905, {3} HP7925 ]; 401:D 2 var 402:D -2 2 ident: signed16; 403:D -6 2 status_bytes: status_type; 404:C 2 begin {unit_init} 405:C 2 with f_area^.m_msus do 406:C 3 begin 407:C 3 if (un4>7) or (vn4>1) then 408:C 4 escape(ec_no_device); 409:C 3 HPIB_clear; 410:C 3 ident := HPIB_amigo_identify; 411:C 3 if not controllersID(cardID, ident) 412:C 4 or (not MI_controller and (un>3)) {trick: tests vn4/un4 simultaneously!!!} 413:C 4 or ((ident=IDC_ident) and {special IDC considerations...} 414:C 4 ((un4<>0) or {being single-unit only, it ignores the unit field} 415:C 4 not_PHI_DMA)) {it requires the hard disc interface card & DMA} 416:C 4 then escape(ec_no_device); 417:C 3 if dsj<>0 then 418:C 4 {reading it removed any power-on holdoff}; 419:C 3 status(status_bytes); 420:C 3 if dsj<>0 then 421:C 4 escape(ec_bad_error_state); 422:C 3 if status_bytes.ss=2 then 423:C 4 escape(ec_no_device); {"unit not present or power off"} 424:C 3 if MI_controller then {we need to determine the exact type of THIS particular unit} 425:C 4 begin 426:C 4 if not (status_bytes.tttt in [0..3]) then 427:C 5 escape(ec_no_device); {unrecognized unit type} 428:C 4 dev := device_table[status_bytes.tttt]; {set dev BEFORE using surface_mode function!!!} 429:C 4 if not surface_mode and (vn4<>0) then 430:C 5 escape(ec_no_device); 431:C 4 end; {then} 432:C 3 end; {with} 433:C 2 end; {unit_init} Pascal [Rev 3.0M 6/ 4/84] AMIGO.TEXT 28-Jun-89 17:44:17 Page 9 434:D 1 $page$ 435:S 436:D 1 procedure deviceread(bufptr: anyptr; length, start_addr: integer); 437:S 438:D 2 var 439:D -2 2 tries: signed16; 440:D -3 2 buffered_transfer: boolean; 441:D -4 2 transfer_successful: boolean; 442:D -8 2 transfer_length: integer; 443:D -12 2 max_transfer_length: integer; 444:D -14 2 read_cmd: command_type; 445:D -16 2 read_cmd_buf: ftcb_type; 446:D -20 2 remaining_surf_bytes: integer; 447:D -24 2 status_bytes: status_type; 448:S 449:D -24 2 const 450:D -24 2 send_data_sec = 0; 451:D -24 2 maxtries = 10; 452:D -24 2 bytes_per_surf = 400*48*256; {only valid for 7905/06!!!} 453:S 454:D 2 procedure process_errors; 455:D 3 var 456:D -4 3 status_bytes: status_type; 457:D -8 3 err_rcrd: integer; 458:C 3 begin {process_errors} 459:C 3 status(status_bytes); 460:C 3 if dsj<>0 then escape(ec_bad_error_state); 461:C 3 with status_bytes do 462:C 4 case s1 of 463:C 5 {retryable errors} 464:C 5 cylinder_compare_error, 465:C 5 uncorrectable_data_error, 466:C 5 head_sector_compare_error, 467:C 5 sync_bit_not_received_in_time, 468:C 5 end_of_cylinder, 469:C 5 overrun, 470:C 5 possibly_correctable_data_error, 471:C 5 access_not_ready_during_data_operation: 472:C 5 begin 473:C 5 err_rcrd := logical_addr; 474:C 5 if s1=cylinder_compare_error then 475:C 6 if MI_controller then 476:C 7 begin 477:C 7 recalibrate; 478:C 7 HPIB_wait_for_ppol; 479:C 7 end {then} 480:C 7 else 481:C 7 escape(ec_read_error); 482:C 5 if err_rcrd=start_addr then 483:C 6 begin 484:C 6 tries := tries+1; 485:C 6 if tries>=maxtries then escape(ec_read_error); 486:C 6 transfer_successful := false; {try, try, again} 487:C 6 end {then} 488:C 6 else 489:C 6 begin 490:C 6 tries := 1; 491:C 6 transfer_length := (err_rcrd-start_addr)*256; {bytes SUCCESSFULLY transferred} 492:C 6 transfer_successful := true; {would you believe partially successful?} 493:C 6 end; {else} Pascal [Rev 3.0M 6/ 4/84] AMIGO.TEXT 28-Jun-89 17:44:17 Page 10 494:C 5 end; 495:S 496:C 5 {immediate escape errors} 497:C 5 illegal_access_to_spare_track, 498:C 5 defective_track: 499:C 5 escape(ec_read_error); 500:C 5 illegal_drive_type, 501:C 5 unit_unavailable: 502:C 5 escape(ec_no_device); 503:S 504:C 5 {errors requiring status 2 processing} 505:C 5 status_2_error, 506:C 5 drive_attention: 507:C 5 begin 508:C 5 if e then escape(ec_bad_hardware); 509:C 5 if ss<>0 then {recall that unit_init checked for the ec_no_device condition} 510:C 6 if MI_controller 511:C 7 then escape(ec_not_ready) {hard disc not up to speed: retry later} 512:C 7 else escape(ec_no_medium); {no medium: do not retry later} 513:C 5 if logical_addr>(start_addr+(length-1)div 256) then 514:C 6 transfer_successful := true {already transferred enough bytes} 515:C 6 else 516:C 6 escape(ec_read_error); 517:C 5 end; 518:S 519:C 5 {other errors} 520:C 5 otherwise 521:C 5 escape(ec_bad_error_state); 522:S 523:C 5 end; {case} 524:C 3 end; {process_errors} 525:S 526:S 527:C 2 begin {deviceread} 528:S 529:C 2 if MI_controller then 530:C 3 begin 531:C 3 set_file_mask; 532:C 3 HPIB_wait_for_ppol; 533:C 3 buffered_transfer := not_PHI_DMA; 534:C 3 end {then} 535:C 3 else 536:C 3 if device=M8290X then 537:C 4 begin 538:C 4 status(status_bytes); 539:C 4 buffered_transfer := not status_bytes.r; 540:C 4 end {then} 541:C 4 else 542:C 4 buffered_transfer := false; 543:S 544:C 2 if buffered_transfer then 545:C 3 begin 546:C 3 seek(start_addr); 547:C 3 HPIB_wait_for_ppol; 548:C 3 read_cmd := buf_read_cmd; 549:C 3 end {then} 550:C 3 else 551:C 3 read_cmd := unbuf_read_cmd; 552:S 553:C 2 tries := 0; Pascal [Rev 3.0M 6/ 4/84] AMIGO.TEXT 28-Jun-89 17:44:17 Page 11 554:C 2 $page$ 555:S 556:C 2 while length>0 do 557:C 3 begin 558:S 559:C 3 if buffered_transfer then 560:C 4 max_transfer_length := 256 561:C 4 else 562:C 4 begin 563:C 4 seek(start_addr); 564:C 4 if MI_controller then 565:C 5 begin 566:C 5 max_transfer_length := 65536; {max DMA burst length} 567:C 5 if surface_mode then {don't try to cross a surface's logical boundary} 568:C 6 begin 569:C 6 remaining_surf_bytes := bytes_per_surf-(start_addr*256 mod bytes_per_surf); 570:C 6 if remaining_surf_bytesec_bad_error_state {premature eoi} then 589:C 5 escape(escapecode); 590:S 591:C 3 HPIB_wait_for_ppol; 592:C 3 if dsj=0 then 593:C 4 transfer_successful := true 594:C 4 else 595:C 4 process_errors; {will set/clear transfer_successful, or escape} 596:S 597:C 3 if transfer_successful then 598:C 4 begin 599:C 4 start_addr := start_addr+transfer_length div 256; 600:C 4 bufptr := addr(charptr(bufptr)^, transfer_length); 601:C 4 length := length-transfer_length; 602:C 4 end; {if} 603:S 604:C 3 end; {while} 605:S 606:C 2 end; {deviceread} 607:S 608:C 1 end. {ddAMIGO} 609:S No errors. 1 warnings. ***** Nonstandard language features enabled *****