PAGE 1 [3.3a] 6/28/89 17:43:41 ASSEMBLY OF SIMON.TEXT PASS 1 COMPLETE. ERRORS: 0 1 * sccs info: @(#) simon 8.1 84/05/04 00:18:12 * 2 3 nosyms 4 5 * 6 * global or common symbol declarations 7 * 8 nolist 194 195 * 196 * Import timer routines & define timer constants 197 * 198 refa start_timer,check_timer 199 refa miscasm_delay 200 201 FFFF FEDA sysflag2 equ $FFFFFEDA location of sysflag2 202 0000 0001 timer_absent equ 1 1 for no timer, 0 for timer 203 204 * 205 * BOOTROM stolen low RAM area pointer 206 * 207 FFFF FED4 f_area equ $FFFFFED4 208 209 PAGE 2 [3.3a] 6/28/89 17:43:41 SIMON HPIB DRIVERS (SIMON) 212 213 ***************************************************************************** 214 * * 215 * *** *** * * *** * * * 216 * * * * ** ** * * * * * 217 * * * * * * * * ** * * 218 * * * * * * * * * * * * 219 * * * * * * * * ** * 220 * * * * * * * * * * * 221 * *** *** * * *** * * * 222 * * 223 ***************************************************************************** 224 225 226 227 * 228 * def's 229 * 230 def Simon_Simon 231 def Simon_clear 232 def Simon_amigo_identify 233 def Simon_amigo_clear 234 def Simon_wait_for_ppol 235 def Simon_short_msge_out 236 def Simon_short_msge_in 237 def Simon_long_msge_in PAGE 3 [3.3a] 6/28/89 17:43:41 SIMON HPIB DRIVERS (SIMON) 239 ******************************************************************************* 240 * passed parameters - offsets from a6 * 241 ******************************************************************************* 242 243 0000 0000 olda6 equ 0 (long: address) old stack frame ptr 244 0000 0004 ret_addr equ 4 (long: address) return address 245 246 * procedure short_msge_out(sec: unsgn8; bufptr: anyptr; length: signed16); 247 * procedure short_msge_in (sec: unsgn8; bufptr: anyptr; length: signed16); 248 249 0000 0008 s_length equ 8 (word: signed16) number of bytes 250 0000 000A s_bufptr equ 10 (long: address) buffer address 251 0000 000E s_sec equ 14 (word: 0..255) secondary command 252 253 * procedure long_msge_in (sec: unsgn8; bufptr: anyptr; length: integer; bb_len: signed16); 254 255 0000 0008 l_bb_len equ 8 (word: 0..32K) number of bytes to bit-bucket 256 0000 000A l_length equ 10 (long: integer) number of bytes 257 0000 000E l_bufptr equ 14 (long: address) buffer address 258 0000 0012 l_sec equ 18 (word: 0..255) secondary command 259 260 261 262 ******************************************************************************* 263 * module initialization procedure * 264 ******************************************************************************* 265 266 00000000 4E75 Simon_Simon rts 267 268 269 270 ******************************************************************************* 271 * escape sequence * 272 ******************************************************************************* 273 274 * 275 * assignment of escape values 276 * 277 0000 0001 esc_notsysc equ ec_no_device not system controller 278 0000 0001 esc_bto equ ec_no_device byte timeout 279 0000 0006 esc_preeoi equ ec_bad_error_state premature eoi on input 280 0000 0007 esc_buserr equ ec_bus_error bus error (DMA routine) 281 282 283 * 284 * procedure escape: enter with the escapecode in d0.w 285 * 286 00000002 3B40 FFFE escape move d0,-2(a5) store the escapecode 287 00000006 4E4A trap #10 escape a'la' Pascal PAGE 4 [3.3a] 6/28/89 17:43:41 SIMON HPIB DRIVERS (SIMON) 289 ******************************************************************************* 290 * card register offset equates * 291 ******************************************************************************* 292 293 0000 0001 cardid equ $01 read card identification 294 0000 0001 cardreset equ $01 write card software reset 295 0000 0003 cardstatus equ $03 read card status 296 0000 0003 cardcontrol equ $03 write card control 297 0000 0007 cardlatch equ $07 read/write latch for testing card buffers 298 299 0000 0011 intreg equ $11 read/write PHI/ABI interrupt register 300 0000 0013 intmask equ $13 read/write PHI/ABI interrupt mask 301 0000 0015 fifo equ $15 read/write PHI/ABI inbound/outbound fifo 302 0000 0017 status equ $17 read/write PHI/ABI status register 303 0000 0019 control equ $19 read/write PHI/ABI control register 304 0000 001B address equ $1B read/write PHI/ABI HP-IB address register 305 0000 001D ppolmask equ $1D read/write PHI/ABI parallel poll mask register 306 0000 001F ppolsense equ $1F read/write PHI/ABI parallel poll sense register 307 308 309 ******************************************************************************* 310 * HP-IB related equates * 311 ******************************************************************************* 312 313 0000 0004 sdc equ $04 selective device clear 314 0000 003F unl equ $3F unlisten 315 0000 005F unt equ $5F untalk 316 317 0000 0020 listen equ $20 listen (address 0) 318 0000 0040 talk equ $40 talk (address 0) 319 0000 0060 secondary equ $60 secondary (address 0) 320 321 322 ******************************************************************************* 323 * address register allocation * 324 ******************************************************************************* 325 326 0000 0000 a_free equ a0 general purpose temp 327 0000 0001 a_card equ a1 Simon card base address 328 0000 0002 a_status equ a2 PHI/ABI status register 329 0000 0003 a_intreg equ a3 PHI/ABI interrupt register 330 0000 0004 a_fifo equ a4 PHI/ABI inbound/outbound fifo 331 0000 0005 a_globals equ a5 Pascal globals 332 0000 0006 a_base equ a6 current stackframe base 333 0000 0007 a_stackptr equ a7 stack pointer 334 335 * 336 * address register setup routine 337 * 338 * NOTE: this routine assumes that the card address is already in a1! 339 * 340 00000008 45E9 0017 setup_a_regs lea status(a_card),a_status 341 0000000C 47E9 0011 lea intreg(a_card),a_intreg 342 00000010 49E9 0015 lea fifo(a_card),a_fifo 343 00000014 4E75 rts PAGE 5 [3.3a] 6/28/89 17:43:41 SIMON HPIB DRIVERS (SIMON) 345 ******************************************************************************* 346 * procedure clear * 347 ******************************************************************************* 348 349 0000 0016 Simon_clear equ * 350 351 00000016 61F0 bsr setup_a_regs setup the address registers 352 * 353 * software reset the card 354 * 355 00000018 7080 moveq #$80,d0 prepare to... 356 0000001A 1340 0001 move.b d0,cardreset(a_card) software reset the card (PHI/ABI pon) 357 0000001E 1340 0019 move.b d0,control(a_card) set 8-bit mode 358 00000022 1340 0019 move.b d0,control(a_card) once more, to guarantee high-order bit values 359 00000026 1340 001B move.b d0,address(a_card) bring the PHI/ABI online 360 * 361 * make sure that the card is the system controller 362 * 363 0000002A 7001 moveq #esc_notsysc,d0 escapecode if not the system controller 364 0000002C 0812 0003 btst #3,(a_status) system controller? 365 00000030 67D0 beq escape escape if not 366 * 367 * set up the interrupt and parallel poll response registers 368 * 369 00000032 14BC 0040 move.b #$40,(a_status) set high-order bits 370 00000036 137C 00FF move.b #$FF,intmask(a_card) allow exam of all interrupt bits 0013 371 0000003C 14BC 0000 move.b #$00,(a_status) set high-order bits 372 00000040 137C 00FF move.b #$FF,ppolmask(a_card) allow exam of all ppol response bits 001D 373 * 374 * regain active control, aborting any previous HP-IB operation 375 * 376 00000046 14BC 0000 move.b #$00,(a_status) set high-order bits 377 0000004A 137C 0090 move.b #$90,control(a_card) assert IFC, hold 8-bit 0019 378 379 00000050 4878 0064 pea 100 push microsec value 380 00000054 6100 FFAA bsr miscasm_delay delay for 100 us 381 382 00000058 137C 00A0 move.b #$A0,control(a_card) release IFC, assert REN, hold 8-bit 0019 383 384 0000005E 4E75 rts PAGE 6 [3.3a] 6/28/89 17:43:41 SIMON HPIB DRIVERS (SIMON) 386 ******************************************************************************* 387 * procedure amigo clear * 388 ******************************************************************************* 389 390 0000 0060 Simon_amigo_clear equ * 391 392 00000060 61A6 bsr setup_a_regs setup the address registers 393 * 394 * address the bus 395 * 396 00000062 3F3C 0010 move #16,-(sp) push the amigo clear secondary 397 00000066 6144 bsr.s mo_ab address the bus for message out 398 * 399 * send out the single data byte 400 * 401 00000068 6100 0086 bsr wait_fi wait for fifo idle 402 0000006C 14BC 0080 move.b #$80,(a_status) tag this byte with an eoi 403 00000070 18BC 0000 move.b #0,(a_fifo) send the data byte (disable parity check) 404 * 405 * send out the selective device clear 406 * 407 00000074 7004 moveq #sdc,d0 selective device clear command 408 00000076 616E bsr.s wtc send the command 409 * 410 * unaddress the bus & exit 411 * 412 00000078 605A bra.s mo_ub unaddress the bus for message out PAGE 7 [3.3a] 6/28/89 17:43:41 SIMON HPIB DRIVERS (SIMON) 414 ******************************************************************************* 415 * procedure short message out * 416 ******************************************************************************* 417 418 0000 007A Simon_short_msge_out equ * 419 420 0000007A 4E56 0000 link a_base,#0 no locals 421 422 0000007E 6188 bsr setup_a_regs setup the address registers 423 * 424 * address the bus 425 * 426 00000080 3F2E 000E move s_sec(a_base),-(sp) push the secondary 427 00000084 6126 bsr.s mo_ab address the bus for message out 428 * 429 * send out the data bytes, tagging the last with eoi 430 * 431 00000086 206E 000A movea.l s_bufptr(a_base),a_free first byte address 432 0000008A 302E 0008 move s_length(a_base),d0 byte count (signed16!!!) 433 434 0000008E 6160 smo_l bsr.s wait_fi wait for fifo idle 435 00000090 5340 subq #1,d0 this the last byte? 436 00000092 6F08 ble.s smo_lbo branch if so 437 00000094 14BC 0000 move.b #$00,(a_status) following byte will be data 438 00000098 1898 move.b (a_free)+,(a_fifo) send it 439 0000009A 60F2 bra smo_l loop 440 * 441 * last byte out 442 * 443 0000009C 14BC 0080 smo_lbo move.b #$80,(a_status) tag this (last) byte with an eoi 444 000000A0 1890 move.b (a_free),(a_fifo) send it 445 * 446 * unaddress the bus & exit 447 * 448 000000A2 6130 bsr.s mo_ub unaddress the bus for message out 449 450 000000A4 4E5E unlk a_base 451 000000A6 205F movea.l (sp)+,a_free pop the return address 452 000000A8 508F addq.l #8,sp pop off the parameters 453 000000AA 4ED0 jmp (a_free) return PAGE 8 [3.3a] 6/28/89 17:43:41 SIMON HPIB DRIVERS (SIMON) 455 * 456 * address the bus for message out - secondary passed on the stack!!! 457 * 458 000000AC 703F mo_ab moveq #unl,d0 unlisten command 459 000000AE 6136 bsr.s wtc send the command 460 461 000000B0 705E moveq #talk+30,d0 MTA command 462 000000B2 6132 bsr.s wtc send the command 463 464 000000B4 6124 bsr.s return_ba fetch the device's bus address 465 000000B6 803C 0020 or.b #listen,d0 compute the LAG command 466 000000BA 612A bsr.s wtc send the command 467 468 000000BC 205F movea.l (sp)+,a_free pop the return address 469 000000BE 7060 moveq #secondary,d0 470 000000C0 805F or (sp)+,d0 compute the SEC command 471 000000C2 2F08 move.l a_free,-(sp) push back the return address 472 000000C4 6120 bsr.s wtc send the command 473 * 474 * wait for the parallel poll response to go away 475 * 476 000000C6 6128 bsr.s wait_fi wait for fifo idle 477 478 000000C8 6110 bsr.s return_ba fetch the device's bus address 479 000000CA 4440 neg d0 negate it 480 000000CC 5E40 addq #7,d0 compute the bit of interest (7-ba) 481 482 000000CE 0114 btst d0,(a_fifo) test the poll response 483 000000D0 66FC bne *-2 loop until it goes away 484 485 000000D2 4E75 rts 486 487 488 * 489 * unaddress the bus for message out 490 * 491 000000D4 703F mo_ub moveq #unl,d0 unlisten command 492 000000D6 610E bsr.s wtc send the command 493 000000D8 6016 bra.s wait_fi wait for fifo idle, then return 494 495 496 * 497 * return the device's bus address 498 * 499 000000DA 2078 FED4 return_ba movea.l f_area,a_free BOOTROM stolen low RAM area ptr 500 000000DE 7000 moveq #0,d0 501 000000E0 1028 0059 move.b mm_ba(a_free),d0 load the bus address 502 000000E4 4E75 rts return 503 504 505 * 506 * write command 507 * 508 000000E6 6108 wtc bsr.s wait_fi wait for fifo idle 509 000000E8 14BC 0040 move.b #$40,(a_status) following byte is a command 510 000000EC 1880 move.b d0,(a_fifo) write it 511 000000EE 4E75 rts return PAGE 9 [3.3a] 6/28/89 17:43:41 SIMON HPIB DRIVERS (SIMON) 513 * 514 * wait for fifo idle with timeout (25ms) 515 * 516 000000F0 7601 wait_fi moveq #1,d3 fifo idle bit 517 000000F2 6002 bra.s wait_fifo use common code 518 519 * 520 * wait for fifo byte with timeout (25ms) 521 * 522 000000F4 7602 wait_fb moveq #2,d3 fifo byte bit 523 * 524 * common code to wait for fifo idle/byte with timeout (25ms) 525 * 526 000000F6 0713 wait_fifo btst d3,(a_intreg) fifo idle/byte already? 527 000000F8 6702 beq.s wait_test_timer if not, test for timer 528 000000FA 4E75 wait_return rts else return immediately 529 000000FC 0838 0001 wait_test_timer btst #timer_absent,sysflag2 timer absent? FEDA 530 00000102 6620 bne.s wait_no_timer if so, go to loop stuff 531 * 532 * timer hardware present 533 * 534 00000104 4878 61A8 pea 25000 push microsecond value 535 00000108 4857 pea (sp) push its location 536 0000010A 6100 FEF4 bsr start_timer microsec value to clock value 537 0000010E 241F wait_loop_1 move.l (sp)+,d2 pop clock value 538 00000110 0713 btst d3,(a_intreg) fifo idle/byte? 539 00000112 66E6 bne wait_return if so, return 540 00000114 2F02 move.l d2,-(sp) push clock value 541 00000116 4857 pea (sp) push its location 542 00000118 6100 FEE6 bsr check_timer timed out yet? 543 0000011C 6AF0 bpl wait_loop_1 if not, keep checking 544 0000011E 588F addq.l #4,sp else pop the stack 545 00000120 7400 moveq #0,d2 prepare to... 546 00000122 6004 bra.s wait_loop_2 test one more time! 547 * 548 * timer hardware not present 549 * 550 00000124 343C 1AF0 wait_no_timer move #6896,d2 initialize timeout loop counter 551 00000128 0713 wait_loop_2 btst d3,(a_intreg) fifo idle/byte? 552 0000012A 56CA FFFC dbne d2,wait_loop_2 loop until condition or timeout 553 0000012E 66CA bne wait_return branch if condition occurred 554 * 555 * byte timeout 556 * 557 00000130 7001 w_bto moveq #esc_bto,d0 escapecode for byte timeout 558 * 559 * common routine to clear the HP-IB, then escape 560 * 561 00000132 3F00 clear_escape move d0,-(sp) save the escapecode for a moment 562 00000134 6100 FEE0 bsr Simon_clear clear the bus 563 00000138 301F move (sp)+,d0 restore the escapecode 564 0000013A 6000 FEC6 bra escape escape PAGE 10 [3.3a] 6/28/89 17:43:41 SIMON HPIB DRIVERS (SIMON) 566 * 567 * address the bus for message in - device address & secondary passed on the stack!!! 568 * 569 0000013E 703F mi_ab moveq #unl,d0 unlisten command 570 00000140 61A4 bsr wtc send the command 571 572 00000142 703E moveq #listen+30,d0 MLA command 573 00000144 61A0 bsr wtc send the command 574 575 00000146 205F movea.l (sp)+,a_free pop the return address 576 577 00000148 7040 moveq #talk,d0 578 0000014A 805F or (sp)+,d0 compute the TAG command 579 0000014C 6198 bsr wtc send the command 580 581 0000014E 7060 moveq #secondary,d0 582 00000150 805F or (sp)+,d0 compute the secondary command 583 00000152 6192 bsr wtc send the command 584 585 00000154 619A bsr wait_fi wait for fifo idle 586 00000156 4ED0 jmp (a_free) return 587 588 589 * 590 * unaddress the bus for message in 591 * 592 00000158 705F mi_ub moveq #unt,d0 untalk command 593 0000015A 618A mi_ub_wtc bsr wtc send the command 594 0000015C 6092 bra wait_fi wait for fifo idle, then return PAGE 11 [3.3a] 6/28/89 17:43:41 SIMON HPIB DRIVERS (SIMON) 596 ******************************************************************************* 597 * function amigo identify * 598 ******************************************************************************* 599 600 0000 015E Simon_amigo_identify equ * 601 602 0000015E 6100 FEA8 bsr setup_a_regs setup the address registers 603 * 604 * address the bus 605 * 606 00000162 6100 FF76 bsr return_ba fetch the device's bus address 607 00000166 3F00 move d0,-(sp) push it (to be issued as a secondary!) 608 00000168 3F3C 001F move #31,-(sp) push bus address 31 (to be issued as an untalk) 609 0000016C 61D0 bsr mi_ab address the bus for message in 610 * 611 * read two bytes in, checking for premature eoi 612 * 613 0000016E 14BC 0080 move.b #$80,(a_status) inhibit LF detection 614 00000172 18BC 0002 move.b #2,(a_fifo) counted transfer enable: 2 bytes 615 616 00000176 6100 FF7C bsr wait_fb wait for fifo byte 617 0000017A 1014 move.b (a_fifo),d0 read the first byte 618 0000017C 0812 0006 btst #6,(a_status) premature eoi? 619 00000180 6642 bne.s pre_eoi branch if so 620 621 00000182 E148 lsl #8,d0 shift over the first byte 622 00000184 6100 FF6E bsr wait_fb wait for fifo byte 623 00000188 1014 move.b (a_fifo),d0 read the second byte 624 * 625 * assign the return value, unaddress the bus, & exit 626 * 627 0000018A 3F40 0004 move d0,4(sp) assign the return value 628 629 0000018E 705E moveq #talk+30,d0 MTA command 630 00000190 60C8 bra mi_ub_wtc unaddress the bus with MTA PAGE 12 [3.3a] 6/28/89 17:43:41 SIMON HPIB DRIVERS (SIMON) 632 ******************************************************************************* 633 * procedure short message in * 634 ******************************************************************************* 635 636 0000 0192 Simon_short_msge_in equ * 637 638 00000192 4E56 0000 link a_base,#0 no locals 639 640 00000196 6100 FE70 bsr setup_a_regs setup the address registers 641 * 642 * address the bus 643 * 644 0000019A 3F2E 000E move s_sec(a_base),-(sp) push the secondary 645 0000019E 6100 FF3A bsr return_ba fetch the device's bus address 646 000001A2 3F00 move d0,-(sp) push it 647 000001A4 6198 bsr mi_ab address the bus for message in 648 * 649 * read the bytes in, checking for premature eoi 650 * 651 000001A6 206E 000A movea.l s_bufptr(a_base),a_free first byte address 652 000001AA 302E 0008 move s_length(a_base),d0 byte count (signed16!!!) 653 654 000001AE 14BC 0080 move.b #$80,(a_status) inhibit LF detection 655 000001B2 1880 move.b d0,(a_fifo) counted transfer enable: 256 bytes max! 656 657 000001B4 6100 FF3E smi_l bsr wait_fb wait for fifo byte 658 000001B8 5340 subq #1,d0 this the last byte? 659 000001BA 6F10 ble.s smi_lbi branch if so 660 000001BC 10D4 move.b (a_fifo),(a_free)+ read a byte 661 000001BE 0812 0006 btst #6,(a_status) premature eoi? 662 000001C2 67F0 beq smi_l continue looping if not 663 * 664 * premature eoi 665 * 666 000001C4 6192 pre_eoi bsr mi_ub unaddress the bus for message in 667 000001C6 7006 moveq #esc_preeoi,d0 escapecode for premature eoi 668 000001C8 6000 FE38 bra escape escape 669 * 670 * last byte in 671 * 672 000001CC 1094 smi_lbi move.b (a_fifo),(a_free) read the last byte 673 * 674 * unaddress the bus & exit 675 * 676 000001CE 6188 bsr mi_ub unaddress the bus for message in 677 678 000001D0 4E5E unlk a_base 679 000001D2 205F movea.l (sp)+,a_free pop the return address 680 000001D4 508F addq.l #8,sp pop off the parameters 681 000001D6 4ED0 jmp (a_free) return PAGE 13 [3.3a] 6/28/89 17:43:41 SIMON HPIB DRIVERS (SIMON) 683 ******************************************************************************* 684 * procedure long message in * 685 ******************************************************************************* 686 687 0000 01D8 Simon_long_msge_in equ * 688 689 000001D8 4E56 0000 link a_base,#0 no locals 690 691 000001DC 6100 FE2A bsr setup_a_regs setup the address registers 692 * 693 * address the bus 694 * 695 000001E0 3F2E 0012 move l_sec(a_base),-(sp) push the secondary 696 000001E4 6100 FEF4 bsr return_ba fetch the device's bus address 697 000001E8 3F00 move d0,-(sp) push it 698 000001EA 6100 FF52 bsr mi_ab address the bus for message in 699 * 700 * determine the appropriate transfer type 701 * 702 000001EE 302E 0008 move l_bb_len(a_base),d0 bit-bucket byte count 703 000001F2 48C0 ext.l d0 make it long 704 000001F4 D0AE 000A add.l l_length(a_base),d0 total byte count 705 000001F8 B0BC 0000 cmp.l #256,d0 256 bytes or less? 0100 706 000001FE 6F0A ble.s lmi_ect branch if so 707 * 708 * tranfer of greater than 256 bytes: enable an UNCOUNTED transfer 709 * 710 00000200 14BC 00C0 move.b #$C0,(a_status) high order bits 711 00000204 18BC 0000 move.b #0,(a_fifo) low order bits 712 00000208 6006 bra.s lmi_BB 713 * 714 * tranfer of 256 or less bytes: enable a COUNTED transfer 715 * 716 0000020A 14BC 0080 lmi_ect move.b #$80,(a_status) inhibit LF detection 717 0000020E 1880 move.b d0,(a_fifo) counted transfer enable: 256 bytes max! 718 719 720 * 721 * If required, bit-bucket up to 32K initial bytes 722 * 723 00000210 302E 0008 lmi_BB move l_bb_len(a_base),d0 bit-bucket byte count 724 00000214 5340 subq #1,d0 count minus 1 725 00000216 6D16 blt.s lmi_decide branch if no bytes to bit-bucket 726 727 00000218 7402 moveq #2,d2 for fifo byte test 728 0000021A 7601 moveq #1,d3 for fifo idle test 729 730 0000021C 1213 lmi_BB_loop move.b (a_intreg),d1 731 0000021E 0501 btst d2,d1 fifo byte? 732 00000220 6606 bne.s lmi_BB_bi branch if so 733 00000222 0701 btst d3,d1 fifo idle? 734 00000224 67F6 beq.s lmi_BB_loop if not, keep looping 735 00000226 609C bra pre_eoi otherwise terminate 736 00000228 4A14 lmi_BB_bi tst.b (a_fifo) read a byte 737 0000022A 51C8 FFF0 dbra d0,lmi_BB_loop loop till lower count exhausted PAGE 14 [3.3a] 6/28/89 17:43:41 SIMON HPIB DRIVERS (SIMON) 739 * 740 * decide whether to use DMA or FHS 741 * 742 0000022E 202E 000A lmi_decide move.l l_length(a_base),d0 transfer byte count 743 00000232 5380 subq.l #1,d0 count minus 1 744 745 00000234 2078 FED4 movea.l f_area,a_free BOOTROM stolen low RAM area ptr 746 00000238 0828 0005 btst #dma_p,booleans(a_free) is DMA present? 000B 747 0000023E 6628 bne.s lmi_DMA branch if so 748 749 750 * 751 * Fast Handshake Routine 752 * 753 00000240 206E 000E movea.l l_bufptr(a_base),a_free first byte address 754 00000244 7402 moveq #2,d2 used for fifo byte test 755 00000246 7601 moveq #1,d3 used for fifo idle test 756 757 00000248 0513 lmi_FHS_loop btst d2,(a_intreg) fifo byte? 758 0000024A 670E beq.s lmi_FHS_special branch if not 759 0000024C 10D4 lmi_FHS_bi move.b (a_fifo),(a_free)+ read a byte 760 0000024E 51C8 FFF8 dbra d0,lmi_FHS_loop loop till lower count exhausted 761 762 00000252 4240 clr d0 clear the lower count word only 763 00000254 5380 subq.l #1,d0 decrement the entire long count 764 00000256 6AF0 bpl lmi_FHS_loop loop until entire count exhausted 765 766 00000258 605A bra.s lmi_term go terminate 767 768 769 0000025A 1213 lmi_FHS_special move.b (a_intreg),d1 770 0000025C 0501 btst d2,d1 fifo byte now? 771 0000025E 66EC bne lmi_FHS_bi branch if so 772 00000260 0701 btst d3,d1 fifo idle? 773 00000262 67E4 beq lmi_FHS_loop if not, keep looping 774 00000264 6000 FF5E bra pre_eoi otherwise terminate PAGE 15 [3.3a] 6/28/89 17:43:41 SIMON HPIB DRIVERS (SIMON) 776 * 777 * DMA routine 778 * 779 00000268 41F9 0050 lmi_DMA lea $500000,a_free DMA channel 0 base address 0000 780 0000026E 20AE 000E move.l l_bufptr(a_base),(a_free) first byte address 781 782 00000272 7400 moveq #0,d2 constant '0' needed several places below 783 00000274 137C 0001 move.b #$01,cardcontrol(a_card) enable DMA channel 0 transfer 0003 784 * 785 * outer loop: initiate each burst (65K max) 786 * 787 0000027A 3140 0004 lmi_DMA_loop move d0,4(a_free) set the DMA count 788 0000027E 3178 0008 move $0008,6(a_free) arm the DMA channel; set priority 0006 789 * 790 * inner loop: wait for each burst to complete 791 * 792 00000284 0813 0001 lmi_DMA_wait btst #1,(a_intreg) fifo idle? (transfer terminated) 793 00000288 6606 bne.s lmi_DMA_tbc branch if so 794 0000028A 0528 0007 btst d2,7(a_free) DMA channel still armed? 795 0000028E 66F4 bne lmi_DMA_wait if so, keep waiting 796 * 797 * this burst complete: channel disarmed, eoi encountered, or both! 798 * 799 00000290 0528 0007 lmi_DMA_tbc btst d2,7(a_free) DMA channel disarmed? 800 00000294 6706 beq.s lmi_DMA_cid branch if so; otherwise premature eoi 801 802 00000296 6152 bsr.s DMA_cleanup put everything as it was 803 00000298 6000 FF2A bra pre_eoi do remaining cleanup, and exit 804 * 805 * channel is disarmed: was the termination normal and do more bursts remain? 806 * 807 0000029C 0C68 FFFF lmi_DMA_cid cmpi #-1,4(a_free) DMA transfer terminate normally? 0004 808 000002A2 6708 beq.s lmi_DMA_count branch if so, otherwise... 809 810 000002A4 6144 bsr.s DMA_cleanup put everything as it was 811 000002A6 7007 moveq #esc_buserr,d0 escapecode for bus error 812 000002A8 6000 FE88 bra clear_escape clear the HP-IB, then escape 813 814 000002AC 4240 lmi_DMA_count clr d0 clear the lower count word only 815 000002AE 5380 subq.l #1,d0 decrement the entire long count 816 000002B0 6CC8 bge.s lmi_DMA_loop branch if more bursts remain 817 * 818 * DMA completely done 819 * 820 000002B2 6136 bsr.s DMA_cleanup put everything as it was PAGE 16 [3.3a] 6/28/89 17:43:41 SIMON HPIB DRIVERS (SIMON) 822 * 823 * termination: is the (PHI) byte transfer still enabled? 824 * 825 000002B4 0813 0001 lmi_term btst #1,(a_intreg) (outbound) fifo idle? 826 000002B8 6618 bne.s lmi_lw_eibf branch if so 827 * 828 * (PHI) transfer still enabled: stop it by asserting IFC & clearing the transfer enable byte 829 * 830 000002BA 14BC 0000 move.b #$00,(a_status) high order bits 831 000002BE 137C 0091 move.b #$91,control(a_card) assert IFC & init outbound fifo 0019 832 833 000002C4 4878 0064 pea 100 push microsec value 834 000002C8 6100 FD36 bsr miscasm_delay delay for 100 us 835 836 000002CC 137C 00A0 move.b #$A0,control(a_card) release IFC & assert REN 0019 837 * 838 * (PHI) transfer all done: empty the inbound fifo 839 * 840 000002D2 0813 0002 lmi_lw_eibf btst #2,(a_intreg) fifo byte? 841 000002D6 6704 beq.s lmi_uab if not, go unaddress the bus 842 000002D8 4A14 tst.b (a_fifo) read it 843 000002DA 60F6 bra lmi_lw_eibf go check for more bytes 844 * 845 * unaddress the bus 846 * 847 000002DC 6100 FE7A lmi_uab bsr mi_ub unaddress the bus for message in 848 849 000002E0 4E5E unlk a_base 850 000002E2 205F movea.l (sp)+,a_free pop the return address 851 000002E4 DEFC 000C adda #12,sp pop off the parameters 852 000002E8 4ED0 jmp (a_free) return 853 854 855 000002EA 4A50 DMA_cleanup tst (a_free) disarm the channel 856 000002EC 1342 0003 move.b d2,cardcontrol(a_card) disable the card 857 000002F0 4E75 rts PAGE 17 [3.3a] 6/28/89 17:43:41 SIMON HPIB DRIVERS (SIMON) 859 ******************************************************************************* 860 * procedure wait for parallel poll * 861 ******************************************************************************* 862 863 0000 02F2 Simon_wait_for_ppol equ * 864 865 000002F2 6100 FD14 bsr setup_a_regs setup the address registers 866 867 000002F6 6100 FDF8 bsr wait_fi wait for fifo idle 868 869 000002FA 6100 FDDE bsr return_ba fetch the device's bus address 870 000002FE 4440 neg d0 negate it 871 00000300 5E40 addq #7,d0 compute the bit of interest (7-ba) 872 873 00000302 0114 btst d0,(a_fifo) test the poll response 874 00000304 67FC beq *-2 loop until we get a response 875 876 00000306 4E75 rts 877 878 879 end PASS 1 ERRORS: 0 PASS 2 ERRORS: 0