 PAGE   1 [3.3a] 6/28/89 17:43:26  ASSEMBLY OF TI9914.TEXT

PASS 1 COMPLETE. ERRORS: 0
    1                       *  sccs info:  @(#)  ti9914  8.1  84/05/04  00:18:44  *
    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                       

 PAGE   2 [3.3a] 6/28/89 17:43:26 TI9914 HP-IB DRIVERS (TI9914)

  211                       
  212                       ******************************************************************************
  213                       *                                                                            *
  214                       *                  *****   ***    ***    ***     *       *                   *
  215                       *                    *      *    *   *  *   *   **      **                   *
  216                       *                    *      *    *   *  *   *    *     * *                   *
  217                       *                    *      *     ****   ****    *    *  *                   *
  218                       *                    *      *        *      *    *    *****                  *
  219                       *                    *      *       *      *     *       *                   *
  220                       *                    *     ***     *      *     ***      *                   *
  221                       *                                                                            *
  222                       ******************************************************************************
  223                       
  224                       
  225                       
  226                       *
  227                       * def's
  228                       *
  229                                       def     TI9914_TI9914
  230                                       def     TI9914_clear
  231                                       def     TI9914_amigo_identify
  232                                       def     TI9914_amigo_clear
  233                                       def     TI9914_wait_for_ppol
  234                                       def     TI9914_short_msge_out
  235                                       def     TI9914_short_msge_in
  236                                       def     TI9914_long_msge_in

 PAGE   3 [3.3a] 6/28/89 17:43:26 TI9914 HP-IB DRIVERS (TI9914)

  238                       *******************************************************************************
  239                       *                     passed parameters - offsets from a6                     *
  240                       *******************************************************************************
  241                       
  242             0000 0000 olda6           equ      0  (long: address)     old stack frame ptr
  243             0000 0004 ret_addr        equ      4  (long: address)     return address
  244                       
  245                       *   procedure short_msge_out(sec: unsgn8; bufptr: anyptr; length: signed16);
  246                       *   procedure short_msge_in (sec: unsgn8; bufptr: anyptr; length: signed16);
  247                       
  248             0000 0008 s_length        equ      8  (word: signed16)    number of bytes
  249             0000 000A s_bufptr        equ     10  (long: address)     buffer address
  250             0000 000E s_sec           equ     14  (word: 0..255)      secondary command
  251                       
  252                       *   procedure long_msge_in  (sec: unsgn8; bufptr: anyptr; length: integer, bb_len: signed16);
  253                       
  254             0000 0008 l_bb_len        equ      8  (word: 0..32K)      number of bytes to bit-bucket
  255             0000 000A l_length        equ     10  (long: integer)     number of bytes
  256             0000 000E l_bufptr        equ     14  (long: address)     buffer address
  257             0000 0012 l_sec           equ     18  (word: 0..255)      secondary command
  258                       
  259                       
  260                       
  261                       *******************************************************************************
  262                       *                        module initialization procedure                      *
  263                       *******************************************************************************
  264                       
  265    00000000 4E75      TI9914_TI9914   rts
  266                       
  267                       
  268                       
  269                       *******************************************************************************
  270                       *                                escape sequence                              *
  271                       *******************************************************************************
  272                       
  273                       *
  274                       * assignment of escape values
  275                       *
  276             0000 0001 esc_notsysc     equ     ec_no_device            not system controller
  277             0000 0001 esc_bto         equ     ec_no_device            byte timeout
  278             0000 0006 esc_preeoi      equ     ec_bad_error_state      premature eoi on input
  279             0000 0007 esc_buserr      equ     ec_bus_error            bus error (DMA routine)
  280                       
  281                       
  282                       *
  283                       * procedure escape: enter with the escapecode in d0.w
  284                       *
  285    00000002 3B40 FFFE escape          move    d0,-2(a5)       store the escapecode
  286    00000006 4E4A                      trap    #10             escape a'la' Pascal

 PAGE   4 [3.3a] 6/28/89 17:43:26 TI9914 HP-IB DRIVERS (TI9914)

  288                       *******************************************************************************
  289                       *                      hp-ib card register offset equates                     *
  290                       *******************************************************************************
  291                       
  292             0000 0001 cardid          equ $01   read          card identification
  293                       
  294             0000 0003 cardstat        equ $03   read          card status
  295             0000 0003 carden          equ $03   write         card enable
  296                       
  297             0000 0005 extstat         equ $05   read          external status register
  298                       
  299             0000 0011 int0stat        equ $11   read          interrupt status register 0
  300             0000 0011 int0mask        equ $11   write         interrupt mask register 0
  301                       
  302             0000 0013 int1stat        equ $13   read          interrupt status register 1
  303             0000 0013 int1mask        equ $13   write         interrupt mask register 1
  304                       
  305             0000 0015 adrsstat        equ $15   read          address status register
  306                       
  307             0000 0017 busstat         equ $17   read          bus status register
  308             0000 0017 auxcmd          equ $17   write         auxillary command register
  309                       
  310             0000 0019 address         equ $19   write         address register
  311                       
  312             0000 001B spoll           equ $1B   write         serial poll response register
  313                       
  314             0000 001D cmdpass         equ $1D   read          command pass through register
  315             0000 001D ppoll           equ $1D   write         parallel poll response register
  316                       
  317             0000 001F datain          equ $1F   read          data in register
  318             0000 001F dataout         equ $1F   write         data out register
  319                       
  320                       
  321                       *******************************************************************************
  322                       *                       hp-ib auxillary command equates                       *
  323                       *******************************************************************************
  324                       
  325             0000 0000 swrst0          equ $00   false         software reset
  326             0000 0080 swrst1          equ $80   true
  327                       
  328             0000 0001 dacr0           equ $01   false         dac holdoff
  329             0000 0081 dacr1           equ $81   true
  330                       
  331             0000 0002 rhdf            equ $02   pulse         release rfd holdoff
  332                       
  333             0000 0003 hdfa0           equ $03   false         holdoff on all data
  334             0000 0083 hdfa1           equ $83   true
  335                       
  336             0000 0004 hdfe0           equ $04   false         holdoff on end
  337             0000 0084 hdfe1           equ $84   true
  338                       
  339             0000 0005 nbaf            equ $05   pulse         new byte available false
  340                       
  341             0000 0006 fget0           equ $06   false         force group execute trigger
  342             0000 0086 fget1           equ $86   true
  343                       
  344             0000 0007 rtl0            equ $07   false         return to local

 PAGE   5 [3.3a] 6/28/89 17:43:26 TI9914 HP-IB DRIVERS (TI9914)

  345             0000 0087 rtl1            equ $87   true
  346                       
  347             0000 0008 feoi            equ $08   pulse         force eoi
  348                       
  349             0000 0009 lon0            equ $09   false         listen only
  350             0000 0089 lon1            equ $89   true
  351                       
  352             0000 000A ton0            equ $0A   false         talk only
  353             0000 008A ton1            equ $8A   true
  354                       
  355             0000 000B gts             equ $0B   pulse         go to standby
  356                       
  357             0000 000C tca             equ $0C   pulse         take control asynchronously
  358                       
  359             0000 000D tcs             equ $0D   pulse         take control synchronously
  360                       
  361             0000 000E rpp0            equ $0E   false         request parallel poll
  362             0000 008E rpp1            equ $8E   true
  363                       
  364             0000 000F sic0            equ $0F   false         send ifc
  365             0000 008F sic1            equ $8F   true
  366                       
  367             0000 0010 sre0            equ $10   false         send ren
  368             0000 0090 sre1            equ $90   true
  369                       
  370             0000 0011 rqc             equ $11   pulse         request control
  371                       
  372             0000 0012 rlc             equ $12   pulse         release control
  373                       
  374             0000 0013 dai0            equ $13   false         disable all interrupts
  375             0000 0093 dai1            equ $93   true
  376                       
  377             0000 0014 pts             equ $14   pulse         pass through next secondary
  378                       
  379             0000 0015 stdl0           equ $15   false         set t1 delay (1200ns)
  380             0000 0095 stdl1           equ $95   true
  381                       
  382             0000 0017 vstdl0          equ $17   false         special set t1 delay for 9914A (600ns)
  383             0000 0097 vstdl1          equ $97   true
  384                       
  385             0000 0016 shdw0           equ $16   false         shadow handshake
  386             0000 0096 shdw1           equ $96   true

 PAGE   6 [3.3a] 6/28/89 17:43:26 TI9914 HP-IB DRIVERS (TI9914)

  388                       *******************************************************************************
  389                       *                            HP-IB related equates                            *
  390                       *******************************************************************************
  391                       
  392                       *
  393                       *  commands; odd parity
  394                       *
  395             0000 0004 sdc             equ     $04             selective device clear
  396             0000 00BF unl             equ     $BF             unlisten
  397             0000 00DF unt             equ     $DF             untalk
  398                       
  399                       *
  400                       *  address group bases
  401                       *
  402             0000 0020 listen          equ     $20             listen
  403             0000 0040 talk            equ     $40             talk
  404             0000 0060 secondary       equ     $60             secondary
  405                       
  406                       
  407                       
  408                       *******************************************************************************
  409                       *                         address register allocation                         *
  410                       *******************************************************************************
  411                       
  412                       
  413             0000 0000 a_free          equ     a0              general purpose temp
  414                       
  415             0000 0001 a_cardaddr      equ     a1              HP-IB card base address
  416                       
  417             0000 0002 a_int0stat      equ     a2              (R) interrupt 0 status
  418             0000 0002 a_int0mask      equ     a2              (W) interrupt 0 mask
  419                       
  420             0000 0003 a_busstat       equ     a3              (R) bus status
  421             0000 0003 a_auxcmd        equ     a3              (W) auxillary command
  422                       
  423             0000 0004 a_datain        equ     a4              (R) data in
  424             0000 0004 a_dataout       equ     a4              (W) data out
  425                       
  426             0000 0005 a_globals       equ     a5              Pascal globals
  427                       
  428             0000 0006 a_base          equ     a6              current stackframe base
  429                       
  430             0000 0007 a_stackptr      equ     a7              stack pointer
  431                       
  432                       
  433                       
  434                       *
  435                       * address register setup routine
  436                       *
  437                       *  NOTE: this routine assumes that the card address is already in a1!
  438                       *
  439                       
  440    00000008 45E9 0011 setup_a_regs    lea     int0stat(a_cardaddr),a_int0stat
  441    0000000C 47E9 0017                 lea     busstat(a_cardaddr),a_busstat
  442    00000010 49E9 001F                 lea     datain(a_cardaddr),a_datain
  443    00000014 4E75                      rts

 PAGE   7 [3.3a] 6/28/89 17:43:26 TI9914 HP-IB DRIVERS (TI9914)

  445                       *******************************************************************************
  446                       *                               procedure clear                               *
  447                       *******************************************************************************
  448                       
  449             0000 0016 TI9914_clear  equ *
  450                       
  451    00000016 61F0                      bsr     setup_a_regs            setup the address registers
  452                       *
  453                       * make sure that the card is the system controller
  454                       *
  455    00000018 7001                      moveq   #esc_notsysc,d0         escapecode if not the system controller
  456    0000001A 0829 0007                 btst    #7,extstat(a_cardaddr)  system controller?
                  0005 
  457    00000020 67E0                      beq     escape                  escape if not
  458                       *
  459                       * disable the card (remember that the internal HP-IB CAN'T be disabled from interrupting)
  460                       *
  461    00000022 7000                      moveq   #0,d0                   prepare to...
  462    00000024 1340 0003                 move.b  d0,carden(a_cardaddr)   disable card interrupts and DMA interaction
  463                       *
  464                       * software reset the 9914
  465                       *
  466    00000028 16BC 0080                 move.b  #swrst1,(a_auxcmd)      initiate the software reset
  467                       
  468    0000002C 14BC 0008                 move.b  #$08,(a_int0mask)       unmask the eoi condition
  469    00000030 1340 0013                 move.b  d0,int1mask(a_cardaddr) mask all other conditions
  470    00000034 1340 001B                 move.b  d0,spoll(a_cardaddr)    clear the serial poll response
  471    00000038 1340 001D                 move.b  d0,ppoll(a_cardaddr)    unconfigure the parallel poll response
  472    0000003C 1340 0019                 move.b  d0,address(a_cardaddr)  clear the address register
  473                       
  474    00000040 16BC 000E                 move.b  #rpp0,(a_auxcmd)        release parallel poll request
  475    00000044 16BC 0093                 move.b  #dai1,(a_auxcmd)        disable 9914 interrupts
  476    00000048 16BC 0016                 move.b  #shdw0,(a_auxcmd)       disable shadow handshake
  477                       
  478    0000004C 16BC 0000                 move.b  #swrst0,(a_auxcmd)      terminate the software reset
  479                       *
  480                       * regain active control, aborting any previous HP-IB operation
  481                       *
  482    00000050 16BC 0010                 move.b  #sre0,(a_auxcmd)        clear remote enable
  483    00000054 16BC 008F                 move.b  #sic1,(a_auxcmd)        assert interface clear
  484                       
  485    00000058 4878 0064                 pea     100                     push microsecond value
  486    0000005C 6100 FFA2                 bsr     miscasm_delay           delay to satisfy bus standard
  487                       
  488    00000060 16BC 000F                 move.b  #sic0,(a_auxcmd)        release interface clear
  489    00000064 16BC 0090                 move.b  #sre1,(a_auxcmd)        set remote enable
  490    00000068 16BC 000B                 move.b  #gts,(a_auxcmd)         go to standby
  491                       
  492    0000006C 4E75                      rts

 PAGE   8 [3.3a] 6/28/89 17:43:26 TI9914 HP-IB DRIVERS (TI9914)

  494                       *******************************************************************************
  495                       *                             procedure amigo clear                           *
  496                       *******************************************************************************
  497                       
  498             0000 006E TI9914_amigo_clear  equ *
  499                       
  500    0000006E 6198                      bsr     setup_a_regs            setup the address registers
  501                       *
  502                       * address the bus
  503                       *
  504    00000070 3F3C 0010                 move    #16,-(sp)               push the amigo clear secondary
  505    00000074 614E                      bsr.s   mo_ab                   address the bus for message out
  506                       *
  507                       * send out the single data byte
  508                       *
  509    00000076 6118                      bsr.s   wait_bo_                wait for byteout
  510    00000078 16BC 0008                 move.b  #feoi,(a_auxcmd)        tag this byte with an eoi
  511    0000007C 18BC 0000                 move.b  #0,(a_dataout)          send the data byte (disable parity check)
  512                       *
  513                       * send out the selective device clear
  514                       *
  515    00000080 610E                      bsr.s   wait_bo_                wait for byteout
  516    00000082 16BC 000C                 move.b  #tca,(a_auxcmd)         take control asynchronously
  517    00000086 6108                      bsr.s   wait_bo_                wait for byteout
  518    00000088 18BC 0004                 move.b  #sdc,(a_dataout)        selective device clear command
  519                       *
  520                       * unaddress the bus & exit
  521                       *
  522    0000008C 6000 0092                 bra     mo_ub_1                 unaddress the bus for message out
  523                        
  523                        
  523                        
  523                        
  523                        
  523                        
  524                       *
  525                       * link to the wait_bo routine
  526                       *
  527    00000090 6000 00EE wait_bo_        bra     wait_bo

 PAGE   9 [3.3a] 6/28/89 17:43:26 TI9914 HP-IB DRIVERS (TI9914)

  529                       *******************************************************************************
  530                       *                          procedure short message out                        *
  531                       *******************************************************************************
  532                       
  533             0000 0094 TI9914_short_msge_out  equ *
  534                       
  535    00000094 4E56 0000                 link    a_base,#0               no locals
  536                       
  537    00000098 6100 FF6E                 bsr     setup_a_regs            setup the address registers
  538                       *
  539                       * address the bus
  540                       *
  541    0000009C 3F2E 000E                 move    s_sec(a_base),-(sp)     push the secondary
  542    000000A0 6122                      bsr.s   mo_ab                   address the bus for message out
  543                       *
  544                       * send out the data bytes, tagging the last with eoi
  545                       *
  546    000000A2 206E 000A                 movea.l s_bufptr(a_base),a_free first byte address
  547    000000A6 302E 0008                 move    s_length(a_base),d0     byte count (signed16!!!)
  548                       
  549    000000AA 61E4      smo_l           bsr     wait_bo_                wait for byteout
  550    000000AC 5340                      subq    #1,d0                   this the last byte?
  551    000000AE 6F04                      ble.s   smo_lbo                 branch if so
  552    000000B0 1898                      move.b  (a_free)+,(a_dataout)   send a byte
  553    000000B2 60F6                      bra     smo_l                   loop
  554                       *
  555                       * last byte out
  556                       *
  557    000000B4 16BC 0008 smo_lbo         move.b  #feoi,(a_auxcmd)        tag this (last) byte with an eoi
  558    000000B8 1890                      move.b  (a_free),(a_dataout)    send the last byte
  559                       *
  560                       * unaddress the bus & exit
  561                       *
  562    000000BA 615E                      bsr.s   mo_ub                   unaddress the bus for message out
  563                       
  564    000000BC 4E5E                      unlk    a_base
  565    000000BE 205F                      movea.l (sp)+,a_free            pop the return address
  566    000000C0 508F                      addq.l  #8,sp                   pop off the parameters
  567    000000C2 4ED0                      jmp     (a_free)                return

 PAGE  10 [3.3a] 6/28/89 17:43:26 TI9914 HP-IB DRIVERS (TI9914)

  569                       *
  570                       * address the bus for message out -  secondary passed on the stack!!!
  571                       *
  572    000000C4 16BC 000C mo_ab           move.b  #tca,(a_auxcmd)         take control asynchronously
  573    000000C8 61C6                      bsr     wait_bo_                wait for byteout
  574    000000CA 18BC 00BF                 move.b  #unl,(a_dataout)        unlisten
  575                       
  576    000000CE 615C                      bsr.s   return_my_addr          fetch my address
  577    000000D0 803C 0040                 or.b    #talk,d0                compute MTA command
  578    000000D4 617C                      bsr.s   odd_parity              compute odd parity
  579    000000D6 61B8                      bsr     wait_bo_                wait for byteout
  580    000000D8 1880                      move.b  d0,(a_dataout)          issue the command
  581    000000DA 16BC 008A                 move.b  #ton1,(a_auxcmd)        I'm a talker
  582                       
  583    000000DE 6166                      bsr.s   return_ba               fetch the device's bus address
  584    000000E0 803C 0020                 or.b    #listen,d0              compute the LAG command
  585    000000E4 616C                      bsr.s   odd_parity              compute odd parity
  586    000000E6 61A8                      bsr     wait_bo_                wait for byteout
  587    000000E8 1880                      move.b  d0,(a_dataout)          issue the command
  588                       
  589    000000EA 205F                      movea.l (sp)+,a_free            pop the return address
  590    000000EC 7060                      moveq   #secondary,d0
  591    000000EE 805F                      or      (sp)+,d0                compute the SEC command
  592    000000F0 2F08                      move.l  a_free,-(sp)            push back the return address
  593    000000F2 615E                      bsr.s   odd_parity              compute odd parity
  594    000000F4 617C                      bsr.s   delay_wtb               delay, then send the command
  595                       *
  596                       * wait for the parallel poll response to go away
  597                       *
  598    000000F6 6198                      bsr     wait_bo_                wait for byte out
  599    000000F8 16BC 008E                 move.b  #rpp1,(a_auxcmd)        assert parallel poll
  600                       
  601    000000FC 6148                      bsr.s   return_ba               fetch the device's bus address
  602    000000FE 4440                      neg     d0                      negate it
  603    00000100 5E40                      addq    #7,d0                   compute the bit of interest (7-ba)
  604                       
  605    00000102 4878 0019                 pea     25                      push microsecond value
  606    00000106 6100 FEF8                 bsr     miscasm_delay           delay to satisfy bus standard
  607                       
  608    0000010A 0129 001D                 btst    d0,cmdpass(a_cardaddr)  test the poll response
  609    0000010E 66FA                      bne     *-4                     loop until it goes away
  610                       
  611    00000110 16BC 000E                 move.b  #rpp0,(a_auxcmd)        terminate the parallel poll
  612    00000114 16BC 000B                 move.b  #gts,(a_auxcmd)         go to standby
  613    00000118 4E75                      rts
  614                       
  615                       
  616                       *
  617                       * unaddress the bus for message out
  618                       *
  619    0000011A 6164      mo_ub           bsr.s   wait_bo                 wait for the last handshake to complete
  620    0000011C 16BC 000C                 move.b  #tca,(a_auxcmd)         take control asynchronously
  621    00000120 615E      mo_ub_1         bsr.s   wait_bo                 wait for byteout
  622    00000122 18BC 00BF                 move.b  #unl,(a_dataout)        unlisten
  623                       
  624    00000126 16BC 000B                 move.b  #gts,(a_auxcmd)         go to standby
  625    0000012A 6054                      bra.s   wait_bo                 wait for byteout, then return

 PAGE  11 [3.3a] 6/28/89 17:43:26 TI9914 HP-IB DRIVERS (TI9914)

  627                       *
  628                       * return my address
  629                       *
  630    0000012C 7015      return_my_addr  moveq   #21,d0                  internal card's default bus address
  631    0000012E B3FC 0047                 cmpa.l  #intHPIBaddr,a_cardaddr is this the internal card?
                  8000 
  632    00000134 670E                      beq.s   rma_ret                 branch if so
  633    00000136 701F                      moveq   #$1F,d0                 prepare to...
  634    00000138 C029 0005                 and.b   extstat(a_cardaddr),d0  read and isolate the card address bits
  635    0000013C B03C 001F                 cmp.b   #31,d0                  is its address 31?
  636    00000140 6602                      bne.s   rma_ret                 branch if not
  637    00000142 7000                      moveq   #0,d0                   else use address 0 instead
  638    00000144 4E75      rma_ret         rts                             return
  639                       
  640                       
  641                       *
  642                       * return the device's bus address
  643                       *
  644    00000146 2078 FED4 return_ba       movea.l f_area,a_free           BOOTROM stolen low RAM area ptr
  645    0000014A 7000                      moveq   #0,d0
  646    0000014C 1028 0059                 move.b  mm_ba(a_free),d0        load the bus address
  647    00000150 4E75                      rts                             return
  648                       
  649                       
  650                       *
  651                       *  procedure to compute odd parity; byte passed & returned in d0.b
  652                       *
  653    00000152 1200      odd_parity      move.b  d0,d1   7 6 5 4 3 2 1 0
  654                       
  655    00000154 1401                      move.b  d1,d2
  656    00000156 E30A                      lsl.b   #1,d2
  657    00000158 B501                      eor.b   d2,d1   76 65 54 43 32 21 10 0
  658                       
  659    0000015A 1401                      move.b  d1,d2
  660    0000015C E50A                      lsl.b   #2,d2
  661    0000015E B501                      eor.b   d2,d1   7654 6543 5432 4321 3210 210 10 0
  662                       
  663    00000160 1401                      move.b  d1,d2
  664    00000162 E90A                      lsl.b   #4,d2
  665    00000164 B501                      eor.b   d2,d1   76543210 6543210 543210 43210 3210 210 10 0
  666                       
  667    00000166 0201 0080                 andi.b  #$80,d1                 isolate logical 8-bit difference
  668    0000016A B300                      eor.b   d1,d0                   generate even parity
  669    0000016C 0A00 0080                 eori.b  #$80,d0                 switch it to odd parity
  670    00000170 4E75                      rts                             return
  671                       
  672                       
  673                       *
  674                       * delay, then write byte (delay between pri & sec cmds because of Chinook bug!)
  675                       *
  676    00000172 610C      delay_wtb       bsr.s   wait_bo                 wait for byte out
  677    00000174 4878 0055                 pea     85                      push microsecond value
  678    00000178 6100 FE86                 bsr     miscasm_delay           delay to avoid Chinook bug!!!
  679    0000017C 1880                      move.b  d0,(a_dataout)          write the byte
  680    0000017E 4E75                      rts                             return

 PAGE  12 [3.3a] 6/28/89 17:43:26 TI9914 HP-IB DRIVERS (TI9914)

  682                       *
  683                       * wait for byteout with timeout (25ms)
  684                       *
  685    00000180 7604      wait_bo         moveq   #4,d3                   byteout bit
  686    00000182 6002                      bra.s   wait_common             use common code
  687                       
  688                       *
  689                       * wait for bytein with timeout (25ms); accumulate int0 status for eoi detection
  690                       *
  691    00000184 7605      wait_bi         moveq   #5,d3                   bytein bit
  692                       *
  693                       * common code to wait for byteout/bytein with timeout (25ms)
  694                       *
  695    00000186 1212      wait_common     move.b  (a_int0stat),d1         accumulator for int0stat
  696    00000188 0701                      btst    d3,d1                   byteout/bytein already?
  697    0000018A 6702                      beq.s   wait_test_timer         if not, test for timer
  698    0000018C 4E75      wait_return     rts                             else return immediately
  699    0000018E 0838 0001 wait_test_timer btst    #timer_absent,sysflag2  timer absent?
                  FEDA 
  700    00000194 6622                      bne.s   wait_no_timer           if so, go to loop stuff
  701                       *
  702                       * timer hardware present
  703                       *
  704    00000196 4878 61A8                 pea     25000                   push microsecond value
  705    0000019A 4857                      pea     (sp)                    push its location
  706    0000019C 6100 FE62                 bsr     start_timer             microsec value to clock value
  707    000001A0 241F      wait_loop_1     move.l  (sp)+,d2                pop clock value
  708    000001A2 8212                      or.b    (a_int0stat),d1         accumulate int0stat
  709    000001A4 0701                      btst    d3,d1                   byteout/bytein?
  710    000001A6 66E4                      bne     wait_return             if so, return
  711    000001A8 2F02                      move.l  d2,-(sp)                push clock value
  712    000001AA 4857                      pea     (sp)                    push its location
  713    000001AC 6100 FE52                 bsr     check_timer             timed out yet?
  714    000001B0 6AEE                      bpl     wait_loop_1             if not, keep checking
  715    000001B2 588F                      addq.l  #4,sp                   else, pop the stack
  716    000001B4 7400                      moveq   #0,d2                   prepare to...
  717    000001B6 6004                      bra.s   wait_loop_2             test one more time!
  718                       *
  719                       * timer hardware not present
  720                       *
  721    000001B8 343C 192B wait_no_timer   move    #6443,d2                initialize timeout loop counter
  722    000001BC 8212      wait_loop_2     or.b    (a_int0stat),d1         accumulate int0stat
  723    000001BE 0701                      btst    d3,d1                   byteout/bytein?
  724    000001C0 56CA FFFA                 dbne    d2,wait_loop_2          loop until condition or timeout
  725    000001C4 66C6                      bne     wait_return             branch if condition occurred
  726                       *
  727                       * byte timeout
  728                       *
  729    000001C6 7001      w_bto           moveq   #esc_bto,d0             escapecode for byte timeout
  730                       *
  731                       * common routine to clear the HP-IB, then escape
  732                       *
  733    000001C8 3F00      clear_escape    move    d0,-(sp)                save the escapecode for a moment
  734    000001CA 6100 FE4A                 bsr     TI9914_clear            clear the bus
  735    000001CE 301F                      move    (sp)+,d0                restore the escapecode
  736    000001D0 6000 FE30                 bra     escape                  escape

 PAGE  13 [3.3a] 6/28/89 17:43:26 TI9914 HP-IB DRIVERS (TI9914)

  738                       *
  739                       * address the bus for message in -  device address & secondary passed on the stack!!!
  740                       *
  741    000001D4 16BC 000C mi_ab           move.b  #tca,(a_auxcmd)         take control asynchronously
  742    000001D8 61A6                      bsr     wait_bo                 wait for byteout
  743    000001DA 18BC 00BF                 move.b  #unl,(a_dataout)        unlisten
  744                       
  745    000001DE 6100 FF4C                 bsr     return_my_addr          fetch my address
  746    000001E2 803C 0020                 or.b    #listen,d0              compute MLA command
  747    000001E6 6100 FF6A                 bsr     odd_parity              compute odd parity
  748    000001EA 6194                      bsr     wait_bo                 wait for byteout
  749    000001EC 1880                      move.b  d0,(a_dataout)          issue the command
  750    000001EE 16BC 0089                 move.b  #lon1,(a_auxcmd)        I'm a listener
  751                       
  752    000001F2 205F                      movea.l (sp)+,a_free            pop the return address
  753                       
  754    000001F4 7040                      moveq   #talk,d0
  755    000001F6 805F                      or      (sp)+,d0                compute the TAG command
  756    000001F8 6100 FF58                 bsr     odd_parity              compute odd parity
  757    000001FC 6182                      bsr     wait_bo                 wait for byteout
  758    000001FE 1880                      move.b  d0,(a_dataout)          issue the command
  759                       
  760    00000200 7060                      moveq   #secondary,d0
  761    00000202 805F                      or      (sp)+,d0                compute the secondary command
  762    00000204 6100 FF4C                 bsr     odd_parity              compute odd parity
  763    00000208 6100 FF68                 bsr     delay_wtb               delay, then send the command
  764                       
  765    0000020C 6100 FF72                 bsr     wait_bo                 wait for byteout
  766                       
  767    00000210 4878 0055                 pea     85                      push microsecond value
  768    00000214 6100 FDEA                 bsr     miscasm_delay           delay to avoid Chinook bug!!!
  769                       
  770    00000218 16BC 0003                 move.b  #hdfa0,(a_auxcmd)       CLEAR holdoff on all
  771    0000021C 16BC 0084                 move.b  #hdfe1,(a_auxcmd)       SET holdoff on end
  772                       *
  773                       *   Release holdoff BEFORE releasing ATN, to prevent the possibility of losing
  774                       *   a data byte if the 9914 isn't ALREADY in holdoff, a condition that occurs
  775                       *   with the first byte in after a software or hardware reset.
  776                       *
  777    00000220 16BC 0002                 move.b  #rhdf,(a_auxcmd)        release RFD holdoff
  778    00000224 16BC 000B                 move.b  #gts,(a_auxcmd)         go to standby
  779    00000228 4ED0                      jmp     (a_free)                return
  780                       
  781                       
  782                       *
  783                       * unaddress the bus for message in
  784                       *
  785    0000022A 16BC 000D mi_ub           move.b  #tcs,(a_auxcmd)         take control SYNCHRONOUSLY
  786    0000022E 6100 FF50                 bsr     wait_bo                 wait for byteout
  787    00000232 18BC 00DF                 move.b  #unt,(a_dataout)        send the command
  788                       
  789    00000236 16BC 000B                 move.b  #gts,(a_auxcmd)         go to standby
  790    0000023A 6000 FF44                 bra     wait_bo                 wait for byteout, then return

 PAGE  14 [3.3a] 6/28/89 17:43:26 TI9914 HP-IB DRIVERS (TI9914)

  792                       *******************************************************************************
  793                       *                            function amigo identify                          *
  794                       *******************************************************************************
  795                       
  796             0000 023E TI9914_amigo_identify  equ *
  797                       
  798    0000023E 6100 FDC8                 bsr     setup_a_regs            setup the address registers
  799                       *
  800                       * address the bus & remove the initial RFD holdoff
  801                       *
  802    00000242 6100 FF02                 bsr     return_ba               fetch the device's bus address
  803    00000246 3F00                      move    d0,-(sp)                push it (to be issued as a secondary!)
  804    00000248 3F3C 001F                 move    #31,-(sp)               push bus address 31 (to be issued as an untalk)
  805    0000024C 6186                      bsr     mi_ab                   address the bus for message in
  806                       *
  807                       * read two bytes in, checking for premature eoi
  808                       *
  809    0000024E 6100 FF34                 bsr     wait_bi                 wait for bytein
  810    00000252 1014                      move.b  (a_datain),d0           read the first byte (and request the second)
  811    00000254 0801 0003                 btst    #3,d1                   premature eoi?
  812    00000258 6660                      bne.s   pre_eoi                 branch if so
  813                       
  814    0000025A E148                      lsl     #8,d0                   shift over the first byte
  815    0000025C 6100 FF26                 bsr     wait_bi                 wait for bytein
  816    00000260 16BC 0083                 move.b  #hdfa1,(a_auxcmd)       set holdoff on all
  817    00000264 1014                      move.b  (a_datain),d0           read the second byte (and holdoff)
  818                       *
  819                       * assign the return value, unaddress the bus, & exit
  820                       *
  821    00000266 3F40 0004                 move    d0,4(sp)                assign the return value
  822                       
  823    0000026A 16BC 000D                 move.b  #tcs,(a_auxcmd)         take control SYNCHRONOUSLY
  824    0000026E 6100 FEBC                 bsr     return_my_addr          fetch my address
  825    00000272 803C 0040                 or.b    #talk,d0                compute MTA command
  826    00000276 6100 FEDA                 bsr     odd_parity              compute odd parity
  827    0000027A 6100 FF04                 bsr     wait_bo                 wait for byteout
  828    0000027E 1880                      move.b  d0,(a_dataout)          send the command
  829    00000280 16BC 008A                 move.b  #ton1,(a_auxcmd)        I'm a talker
  830                       
  831    00000284 16BC 000B                 move.b  #gts,(a_auxcmd)         go to standby
  832    00000288 6000 FEF6                 bra     wait_bo                 wait for byteout, then return

 PAGE  15 [3.3a] 6/28/89 17:43:26 TI9914 HP-IB DRIVERS (TI9914)

  834                       *******************************************************************************
  835                       *                          procedure short message in                         *
  836                       *******************************************************************************
  837                       
  838             0000 028C TI9914_short_msge_in  equ *
  839                       
  840    0000028C 4E56 0000                 link    a_base,#0               no locals
  841                       
  842    00000290 6100 FD76                 bsr     setup_a_regs            setup the address registers
  843                       *
  844                       * address the bus & remove the initial RFD holdoff
  845                       *
  846    00000294 3F2E 000E                 move    s_sec(a_base),-(sp)     push the secondary
  847    00000298 6100 FEAC                 bsr     return_ba               fetch the device's bus address
  848    0000029C 3F00                      move    d0,-(sp)                push it
  849    0000029E 6100 FF34                 bsr     mi_ab                   address the bus for message in
  850                       *
  851                       * read the bytes in, checking for premature eoi
  852                       *
  853    000002A2 206E 000A                 movea.l s_bufptr(a_base),a_free first byte address
  854    000002A6 302E 0008                 move    s_length(a_base),d0     byte count (signed16!!!)
  855                       
  856    000002AA 6100 FED8 smi_l           bsr     wait_bi                 wait for bytein
  857    000002AE 5340                      subq    #1,d0                   this the last byte?
  858    000002B0 6F16                      ble.s   smi_lbi                 branch if so
  859    000002B2 10D4                      move.b  (a_datain),(a_free)+    read a byte (and request the next)
  860    000002B4 0801 0003                 btst    #3,d1                   premature eoi?
  861    000002B8 67F0                      beq     smi_l                   continue looping if not
  862                       *
  863                       * premature eoi
  864                       *
  865    000002BA 16BC 0083 pre_eoi         move.b  #hdfa1,(a_auxcmd)       set holdoff on all
  866    000002BE 6100 FF6A                 bsr     mi_ub                   unaddress the bus for message in
  867    000002C2 7006                      moveq   #esc_preeoi,d0          escapecode for premature eoi
  868    000002C4 6000 FD3C                 bra     escape                  escape
  869                       *
  870                       * last byte in
  871                       *
  872    000002C8 16BC 0083 smi_lbi         move.b  #hdfa1,(a_auxcmd)       set holdoff on all
  873    000002CC 1094                      move.b  (a_datain),(a_free)     read the last byte (and holdoff)
  874                       *
  875                       * unaddress the bus & exit
  876                       *
  877    000002CE 6100 FF5A                 bsr     mi_ub                   unaddress the bus for message in
  878                       
  879    000002D2 4E5E                      unlk    a_base
  880    000002D4 205F                      movea.l (sp)+,a_free            pop the return address
  881    000002D6 508F                      addq.l  #8,sp                   pop off the parameters
  882    000002D8 4ED0                      jmp     (a_free)                return

 PAGE  16 [3.3a] 6/28/89 17:43:26 TI9914 HP-IB DRIVERS (TI9914)

  884                       *******************************************************************************
  885                       *                           procedure long message in                         *
  886                       *******************************************************************************
  887                       
  888             0000 02DA TI9914_long_msge_in  equ *
  889                       
  890    000002DA 4E56 0000                 link    a_base,#0               no locals
  891                       
  892    000002DE 6100 FD28                 bsr     setup_a_regs            setup the address registers
  893                       *
  894                       * address the bus & remove the initial RFD holdoff
  895                       *
  896    000002E2 3F2E 0012                 move    l_sec(a_base),-(sp)     push the secondary
  897    000002E6 6100 FE5E                 bsr     return_ba               fetch the device's bus address
  898    000002EA 3F00                      move    d0,-(sp)                push it
  899    000002EC 6100 FEE6                 bsr     mi_ab                   address the bus for message in
  900                       
  901                       
  902                       *
  903                       * If required, bit-bucket up to 32K initial bytes
  904                       *
  905    000002F0 302E 0008                 move    l_bb_len(a_base),d0     bit-bucket byte count
  906    000002F4 5340                      subq    #1,d0                   count minus 1
  907    000002F6 6D20                      blt.s   lmi_check_len           branch if none to bit-bucket
  908                       
  909    000002F8 7420                      moveq   #32,d2                  bit 5, used for bytein test
  910                       
  911    000002FA 1212      lmi_BB_loop     move.b  (a_int0stat),d1         int0 status
  912    000002FC 67FC                      beq     lmi_BB_loop             loop until we see something
  913    000002FE B202                      cmp.b   d2,d1                   bytein only?
  914    00000300 6710                      beq.s   lmi_BB_bi               branch if so
  915    00000302 0201 0028                 andi.b  #$28,d1                 bytein or eoi?
  916    00000306 67F2                      beq     lmi_BB_loop             ignore status if neither one set
  917    00000308 0801 0003                 btst    #3,d1                   eoi?
  918    0000030C 6704                      beq.s   lmi_BB_bi               branch if not (must be bytein)
  919    0000030E 4A14                      tst.b   (a_datain)              premature eoi: read the byte...
  920    00000310 60A8                      bra     pre_eoi                 and terminate
  921    00000312 4A14      lmi_BB_bi       tst.b   (a_datain)              read a byte (and request the next)
  922    00000314 51C8 FFE4                 dbra    d0,lmi_BB_loop          loop till count exhausted
  923                       
  924                       
  925                       *
  926                       * check for the special case, count=1; leave count-2 in d0.l
  927                       *
  928    00000318 202E 000A lmi_check_len   move.l  l_length(a_base),d0     (transfer) byte count
  929    0000031C 5580                      subq.l  #2,d0                   this the last byte?
  930    0000031E 6D26                      blt.s   lmi_last_wait           branch if so
  931                       *
  932                       * decide whether to use DMA or FHS (for the real data transfer)
  933                       *
  934    00000320 2078 FED4                 movea.l f_area,a_free           BOOTROM stolen low RAM area ptr
  935    00000324 0828 0005                 btst    #dma_p,booleans(a_free) is DMA present?
                  000B 
  936    0000032A 6650                      bne.s   lmi_DMA                 branch if so

 PAGE  17 [3.3a] 6/28/89 17:43:26 TI9914 HP-IB DRIVERS (TI9914)

  938                       *
  939                       * Fast Handshake Routine (transfer n-1 bytes, then branch to last bytein routine)
  940                       *
  941    0000032C 206E 000E                 movea.l l_bufptr(a_base),a_free first byte address
  942    00000330 7420                      moveq   #32,d2                  bit 5, used for bytein test
  943                       
  944    00000332 1212      lmi_FHS_loop    move.b  (a_int0stat),d1         int0 status
  945    00000334 67FC                      beq     lmi_FHS_loop            loop until we see something
  946    00000336 B202                      cmp.b   d2,d1                   bytein only?
  947    00000338 6630                      bne.s   lmi_FHS_special         branch if not
  948    0000033A 10D4      lmi_FHS_bi      move.b  (a_datain),(a_free)+    read a byte (and request the next)
  949    0000033C 51C8 FFF4                 dbra    d0,lmi_FHS_loop         loop till lower count exhausted
  950                       
  951    00000340 4240                      clr     d0                      clear the lower count word only
  952    00000342 5380                      subq.l  #1,d0                   decrement the entire long count
  953    00000344 6AEC                      bpl     lmi_FHS_loop            loop until entire count exhausted
  954                       
  955                       
  956                       *
  957                       * last byte in - used for single byte, DMA, and FHS routines
  958                       *
  959    00000346 0812 0005 lmi_last_wait   btst    #5,(a_int0stat)         bytein?
  960    0000034A 67FA                      beq     *-4                     if not, keep looping
  961                       
  962    0000034C 206E 000E lmi_last_byte   movea.l l_bufptr(a_base),a_free first byte address
  963    00000350 202E 000A                 move.l  l_length(a_base),d0     total byte count
  964                       
  965    00000354 16BC 0083                 move.b  #hdfa1,(a_auxcmd)       set holdoff on all
  966    00000358 1194 08FF                 move.b  (a_datain),-1(a_free,d0.l)  transfer the last byte
  967                       
  968    0000035C 6100 FECC                 bsr     mi_ub                   unaddress the bus for message in
  969                       
  970    00000360 4E5E                      unlk    a_base
  971    00000362 205F                      movea.l (sp)+,a_free            pop the return address
  972    00000364 DEFC 000C                 adda    #12,sp                  pop off the parameters
  973    00000368 4ED0                      jmp     (a_free)                return
  974                       
  975                       
  976                       
  977    0000036A 0201 0028 lmi_FHS_special andi.b  #$28,d1                 bytein or eoi?
  978    0000036E 67C2                      beq     lmi_FHS_loop            ignore status if neither one set
  979    00000370 0801 0003                 btst    #3,d1                   eoi?
  980    00000374 67C4                      beq     lmi_FHS_bi              branch if not (must be bytein)
  981    00000376 1094                      move.b  (a_datain),(a_free)     premature eoi: transfer the byte...
  982    00000378 6000 FF40                 bra     pre_eoi                 and terminate

 PAGE  18 [3.3a] 6/28/89 17:43:26 TI9914 HP-IB DRIVERS (TI9914)

  984                       *
  985                       * DMA routine (transfer n-1 bytes, then branch to last bytein routine)
  986                       *
  987    0000037C 41F9 0050 lmi_DMA         lea     $500000,a_free          DMA channel 0 base address
                  0000 
  988    00000382 20AE 000E                 move.l  l_bufptr(a_base),(a_free) first byte address
  989    00000386 7200                      moveq   #0,d1                   for accumulating int0stat
  990    00000388 7400                      moveq   #0,d2                   constant '0' needed several places below
  991                       *
  992                       * outer loop: initiate each burst (65K max)
  993                       *
  994    0000038A 3140 0004 lmi_DMA_loop    move    d0,4(a_free)            set the DMA count
  995    0000038E 3142 0006                 move    d2,6(a_free)            arm the DMA channel
  996    00000392 137C 0001                 move.b  #$01,carden(a_cardaddr) enable DMA channel 0 transfer
                  0003 
  997                       *
  998                       * inner loop: wait for each burst to complete
  999                       *
 1000    00000398 40E7      lmi_DMA_wait    move    sr,-(sp)                internal HPIB always interrupt enabled...
 1001    0000039A 007C 0700                 ori     #$0700,sr               so lockout processor interrupts...
 1002    0000039E 16BC 0013                 move.b  #dai0,(a_auxcmd)        while testing for a 9914 interrupt request
 1003    000003A2 0829 0006                 btst    #6,cardstat(a_cardaddr) 9914 requesting an interrupt?
                  0003 
 1004    000003A8 6702                      beq.s   lmi_DMA_dai             branch if not
 1005    000003AA 8212                      or.b    (a_int0stat),d1         read status regtister (eoi & possibly bytein)
 1006    000003AC 16BC 0093 lmi_DMA_dai     move.b  #dai1,(a_auxcmd)        disable 9914 interrupts
 1007    000003B0 46DF                      move    (sp)+,sr                restore previous interrupt level
 1008                       
 1009    000003B2 0801 0003                 btst    #3,d1                   eoi?
 1010    000003B6 6606                      bne.s   lmi_DMA_bc              branch if so
 1011    000003B8 0528 0007                 btst    d2,7(a_free)            DMA channel armed?
 1012    000003BC 66DA                      bne     lmi_DMA_wait            if so, keep waiting
 1013                       *
 1014                       * this burst complete: channel disarmed, eoi encountered, or possibly both!
 1015                       *
 1016    000003BE 1342 0003 lmi_DMA_bc      move.b  d2,carden(a_cardaddr)   disable DMA channel 0 transfer
 1017    000003C2 0528 0007                 btst    d2,7(a_free)            DMA channel armed? (and eoi encountered)
 1018    000003C6 6706                      beq.s   lmi_DMA_cd              branch if not
 1019    000003C8 4A50                      tst     (a_free)                else disarm it,
 1020    000003CA 6000 FEEE                 bra     pre_eoi                 do remaining cleanup, and exit
 1021                       *
 1022                       * channel is disarmed: was the termination normal and do more bursts remain?
 1023                       *
 1024    000003CE 303C 0007 lmi_DMA_cd      move    #esc_buserr,d0          in case bus error; PRESERVE UPPER WORD!
 1025    000003D2 0C68 FFFF                 cmpi    #-1,4(a_free)           DMA transfer terminate normally?
                  0004 
 1026    000003D8 6600 FDEE                 bne     clear_escape            clear the HP-IB, then escape
 1027    000003DC 4240                      clr     d0                      clear the lower count word only
 1028    000003DE 5380                      subq.l  #1,d0                   decrement the entire long count
 1029    000003E0 6EA8                      bgt.s   lmi_DMA_loop            branch if more remains
 1030                       *
 1031                       * DMA completely done: did we happen to consume the last bytein while processing an eoi?
 1032                       *
 1033    000003E2 0801 0005                 btst    #5,d1                   already read the bytein status bit?
 1034    000003E6 6600 FF64                 bne     lmi_last_byte           if so, we'd never get another!
 1035    000003EA 6000 FF5A                 bra     lmi_last_wait           go read in the last byte

 PAGE  19 [3.3a] 6/28/89 17:43:26 TI9914 HP-IB DRIVERS (TI9914)

 1037                       *******************************************************************************
 1038                       *                       procedure wait for parallel poll                      *
 1039                       *******************************************************************************
 1040                       
 1041             0000 03EE TI9914_wait_for_ppol  equ *
 1042                       
 1043    000003EE 6100 FC18                 bsr     setup_a_regs            setup the address registers
 1044                       *
 1045                       * take control and start the parallel poll
 1046                       *
 1047    000003F2 16BC 000C                 move.b  #tca,(a_auxcmd)         take control asynchronously
 1048    000003F6 6100 FD88                 bsr     wait_bo                 wait for byteout
 1049    000003FA 16BC 008E                 move.b  #rpp1,(a_auxcmd)        assert parallel poll
 1050                       *
 1051                       * wait for the response
 1052                       *
 1053    000003FE 6100 FD46                 bsr     return_ba               fetch the device's bus address
 1054    00000402 4440                      neg     d0                      negate it
 1055    00000404 5E40                      addq    #7,d0                   compute the bit of interest (7-ba)
 1056                       
 1057    00000406 4878 0019                 pea     25                      push microsecond value
 1058    0000040A 6100 FBF4                 bsr     miscasm_delay           delay to satisfy bus standard
 1059                       
 1060    0000040E 0129 001D                 btst    d0,cmdpass(a_cardaddr)  test the poll response
 1061    00000412 67FA                      beq     *-4                     loop until we get a response
 1062                       
 1063    00000414 16BC 000E                 move.b  #rpp0,(a_auxcmd)        terminate the parallel poll
 1064    00000418 16BC 000B                 move.b  #gts,(a_auxcmd)         go to standby
 1065    0000041C 4E75                      rts
 1066                       
 1067                       
 1068                                       end
PASS 1 ERRORS: 0
PASS 2 ERRORS: 0
