 PAGE   1 [3.3a] 6/28/89 17:46:12  ASSEMBLY OF BUBL_BOOT.TEXT

PASS 1 COMPLETE. ERRORS: 0
    1                       *  sccs info:  @(#)  bubl_boot  8.1  84/05/04  00:16:27  *
    2                       
    3                       * bubl_boot
    4                       
    5                       * llen  80
    6                         nosyms
    7                       
    8                         nolist
  194                         def ddBUBL_setdevicename,ddBUBL_unit_init
  195                         def ddBUBL_deviceread
  196                       
  197                         refr miscasm_cardID
  198                         refr miscasm_delay
  199                       
  200                       *** Import timer routines ***
  201                         refa start_timer,check_timer,delay,milli_to_micro
  202                       
  203                       *
  204                       * define constants for timer routines
  205                       *
  206             FFFF FEDA sysflag2        equ     $FFFFFEDA       location of sysflag2
  207             0000 0001 timer_absent    equ     1               1 for no timer, 0 for timer
  208             0000 0000 M68000          equ     0               1 for 68000, 0 for 68010/12
  209                       
  210                       
  211                       ******** Bubble Card's MSUS Device Name
  212                       *
  213                       *   This is the name returned when 'setdevicename' is called.
  214                       *   NOTE: The string MUST be terminated by a period {.} !
  215                       *         The period is not transfered, but is used to stop
  216                       *         the transfer (the scan) of the string.
  217                       
  218    00000000 48        bubl_name  dc.b 'HP98259.'
  218    00000001 50        
  218    00000002 39        
  218    00000003 38        
  218    00000004 32        
  218    00000005 35        
  218    00000006 39        
  218    00000007 2E        
  219                       
  220                       
  221                       ******** Bubble Card's ID Reg Value
  222                       
  223             0000 001E bubble_id      equ  $1E   cards id value
  224                       
  225                       
  226                       ******** Reg Addresses Equates
  227                       
  228             0000 0001 id_reg         equ  $01   cards id/reset reg
  229             0000 0003 io_stat_reg    equ  $03   cards io status reg
  230             0000 0005 config_reg     equ  $05   cards configure reg
  231             0000 0009 data_reg       equ  $09   read/wrt parameters
  232             0000 000B cmdst_reg      equ  $0B   command and status
  233                       
  234                       
  235                       ******** cards Status Reg Bit Definitions
  236                       

 PAGE   2 [3.3a] 6/28/89 17:46:12  ASSEMBLY OF BUBL_BOOT.TEXT

  237             0000 0007 reset          equ  7     reset in progress
  238                       
  239                       
  240                       ******** controller Status Reg Bit Definitions
  241                       
  242             0000 0007 busy           equ  7     BMC is executing a cmd
  243             0000 0006 op_done        equ  6     cmd completed successfully
  244             0000 0000 fifo_avail     equ  0     fifo buffer available
  245                       
  246                       
  247                       ******** Command Reg Commands
  248                       
  249             0000 0011 initialize     equ  $11   initialize MBM and FSA
  250             0000 0012 read_data      equ  $12   read bubble data
  251             0000 0014 read_seek      equ  $14   pre-seek to read address
  252             0000 0019 abort_cmd      equ  $19   abort, no data loss
  253             0000 001D reset_fifo     equ  $1D   reset FIFO
  254                       
  255                       
  256                       ******** Reg Address Counter Assignments
  257                       
  258             0000 000B blr_lsb        equ  $0B   block length LSB  W
  259                       
  260                       
  261                       
  262                       ******** Configuration Reg Bit Definitions
  263                       
  264             0000 0005 k_size         equ  5     0 = 128K, 1 = 512K byte bubbles
  265                       
  266                       
  267                       ******** Flag Bit Definitions
  268                       
  269             0000 0010 odd_sector     equ  16    512K odd sector flag
  270                       
  271                       
  272                       ********
  273                       *
  274                       *    ddBUBL_setdevicename
  275                       *
  276                       *
  277                       *  PURPOSE: Returns in the location pointed to by the parameter passed on
  278                       *           the stack the msus name for the bubbles card as defined in the
  279                       *           declaration at the beginning of this driver.  The first byte
  280                       *           of the returned string is the string length.  For example, if
  281                       *           the declared name is 'BUBBLES.' the the returned string looks
  282                       *           like this when returned to memory:
  283                       *                                               7 B U B B L E S
  284                       *
  285                       *
  286                       *  NOTE: Character string to be returned is declared above, and the
  287                       *        string must be terminated with a period.
  288                       *
  289                       *  CALLER: (from within the bootrom)
  290                       *
  291                       *  CALL: (none)
  292                       *
  293                       *  REG: A0.l - saved return address   R/W

 PAGE   3 [3.3a] 6/28/89 17:46:12  ASSEMBLY OF BUBL_BOOT.TEXT

  294                       *       A1.l - parameter passed in, memory location to store name   R/W
  295                       *       A2.l - pointer to character string to be returned   R/W
  296                       *       A4.l - working copy of A1.l   R/W
  297                       *       D0.l - character counter   R/W
  298                       *
  299                       *  PDL: retrieve parameters from stack
  300                       *       WHILE character <> "."
  301                       *         move character to memory location, starting with second location
  302                       *         character count = character count + 1
  303                       *       END WHILE
  304                       *       move character count to first memory location
  305                       *       RETURN
  306                       *
  307                       *  REVISION:  4-12-82
  308                       *
  309                       ********
  310                       
  311    00000008 205F      ddBUBL_setdevicename movea.l (SP)+,A0        save return address
  312    0000000A 225F                           movea.l (SP)+,A1        get location to store device name
  313    0000000C 49E9 0001                      lea 1(A1),A4            working copy of location plus one
  314    00000010 7000                           moveq #0,D0             clear character counter
  315    00000012 45FA FFEC                      lea bubl_name,A2        get ptr to bubbles msus name
  316                       
  317    00000016 0C12 002E bubl_nextletter      cmpi.b #'.',(A2)        is next character a period ?
  318    0000001A 6706                            beq.s bubl_namesize    branch when period is found
  319    0000001C 18DA                           move.b (A2)+,(A4)+      move character to store location
  320    0000001E 5200                           addq.b #1,D0            increment character counter
  321    00000020 60F4                            bra.s bubl_nextletter  get next device name character
  322                       
  323    00000022 1280      bubl_namesize        move.b D0,(A1)          store string size
  324                       
  325    00000024 4ED0                           jmp (A0)                return
  326                       
  327                       
  328                       ********
  329                       *
  330                       *    ddBUBL_unit_init
  331                       *
  332                       *
  333                       *  PURPOSE: Initialize the bubbles card to a known starting state.
  334                       *
  335                       *  NOTE: After performing a card reset, a minimum of 150 micro-
  336                       *        seconds is required before accessing the controller again.
  337                       *
  338                       *  CALLER: (from within the bootrom)
  339                       *
  340                       *  CALL: bubl_intz, bubl_opdone, bubl_sc_size
  341                       *
  342                       *  REG: A1.l - base card address   R/W
  343                       *       A2.l - BMC command/status register address   R
  344                       *       D1.l - block size value (64 to 512 bytes)  W
  345                       *       D2.l - delay counter  R/W
  346                       *       D6.w - size, zero rel (number of MBM's), then AR reg value  W
  347                       *
  348                       *  PDL:   CALL bubl_sc_size
  349                       *       reset card (also disables interrupts)
  350                       *       wait 150 us minimum for reset to complete

 PAGE   4 [3.3a] 6/28/89 17:46:12  ASSEMBLY OF BUBL_BOOT.TEXT

  351                       *       send  abort  command to BMC
  352                       *         CALL bubl_opdone
  353                       *       build value for BLR MSB = 0001 (bits)
  354                       *       build value for MBM group select in AR reg set to max size
  355                       *         CALL bubl_intz
  356                       *       send  initialize  command to BMC
  357                       *         CALL bubl_opdone
  358                       *       RETURN
  359                       *
  360                       *  REVISION:  6-25-82
  361                       *
  362                       *  NEXT REVISION:
  363                       *
  364                       *     Modified by:      Anny Randel
  365                       *     Date:             Dec. 14, 1983
  366                       *     Purpose:          Use timer when present
  367                       *
  368                       ********
  369                       
  370    00000026 612E      ddBUBL_unit_init   bsr.s bubl_sc_size         get card address and size
  371    00000028 4229 0001                  clr.b id_reg(A1)             reset card
  372    0000002C 4878 00C8                  pea    200                   push microsecond value
  373    00000030 6100 FFCE                  bsr    miscasm_delay         delay
  374    00000034 14BC 0019                  move.b #abort_cmd,(A2)       abort any running commands
  375    00000038 6100 01C0                  bsr bubl_opdone              return when op is complete
  376    0000003C 720B                       moveq #11,D1                 (shift count)
  377    0000003E E36E                       lsl.w D1,D6                  align 'size' to AR reg
  378    00000040 7240                       moveq #64,D1                 force BLR MSB of 0001
  379    00000042 0829 0005                  btst #k_size,config_reg(A1)  128K or 512K byte bubbles ?
                  0005 
  380    00000048 6702                        beq.s bubl_init_intz        branch if 128K
  381    0000004A E54E                       lsl.w #2,D6                  adjust for 512K
  382                       
  383    0000004C 6152      bubl_init_intz     bsr.s bubl_intz            initialize BMC
  384    0000004E 14BC 0011                  move.b #initialize,(A2)      initialize MBM and FSA
  385                       
  386    00000052 6000 01A6                   bra bubl_opdone             wait for op complete, return
  387                       
  388                       
  389                       ********
  390                       *
  391                       *    bubl_sc_size
  392                       *
  393                       *
  394                       *  PURPOSE: Returns the card address and the size of the card measured in
  395                       *           'bytes' .  The bubble card's configuration register gives the
  396                       *           size (number of 128K or 512K byte MBM's available {bits 0 - 2).
  397                       *           Bits 3 and 4 form the FSA value for the number of channels.
  398                       *           Bit 5 is false for 1 Mbit and true for 4 Mbit bubbles.  If the
  399                       *           'extended configure reg exists' bit is set this present driver
  400                       *           ignors it and continues normal; bit 6 can be used by later
  401                       *           drivers for what ever purpose desired as long it is realized that
  402                       *           this driver will continue running.  Bit 7 is also an
  403                       *           'extended configure reg exists' bit, but this driver will
  404                       *           exit without further action if it finds this bit set.
  405                       *
  406                       *  NOTE: Card address is calculated by calling the routine 'miscasm_cardID'

 PAGE   5 [3.3a] 6/28/89 17:46:12  ASSEMBLY OF BUBL_BOOT.TEXT

  407                       *        in the bootrom and returned in register A1.
  408                       *
  409                       *  CALLER: ddBUBL_unit_init,bubl_deviceread
  410                       *
  411                       *  CALL: miscasm_cardID (in bootrom)
  412                       *
  413                       *  REG: A1.l - base card address   R/W
  414                       *       A2.l - command/status register address   R/W
  415                       *       A3.l - data register address   R/W
  416                       *       D0.l - shift count  R/W
  417                       *       D1.l - block size value (64 to 512 bytes)  W
  418                       *       D6.w - size, zero rel (number of MBM's)  W
  419                       *       D7.l - maximum bubble storage size in 'bytes'   W
  420                       *
  421                       *  PDL:   CALL miscasm_cardID     {get card address & ident number}
  422                       *       IF card ID <> 'bubbles' THEN error escape    {ec_no_device}
  423                       *       IF exit extended config reg bit THEN RETURN
  424                       *       convert size to 'bytes'     {size depends on bits 0 - 2, and 5}
  425                       *       convert 'fsa's to block size    {64 to 512 bytes}
  426                       *       RETURN
  427                       *
  428                       *  REVISION:  5-10-82
  429                       *
  430                       ********
  431                       
  432    00000056 558F      bubl_sc_size subq.l #2,SP              make room on stack for card-ID
  433    00000058 6100 FFA6                bsr miscasm_cardID      get cards base address and card-ID
  434    0000005C 7000                   moveq #0,D0               clear work register
  435    0000005E 301F                   move.w (SP)+,D0           get card-ID from stack
  436    00000060 0C40 001E              cmpi.w #bubble_id,D0      bubbles card ID is 30
  437    00000064 6600 01E8               bne bubl_nodevice        escape if wrong ID !!!!!!!!
  438                       
  439    00000068 45E9 000B              lea cmdst_reg(A1),A2      address of BMC's command/status reg
  440    0000006C 47E9 0009              lea data_reg(A1),A3       address of BMC's data reg
  441    00000070 7200                   moveq #0,D1               clear config copy register
  442    00000072 1229 0005              move.b config_reg(A1),D1  get copy of configuration reg
  443    00000076 6B24                    bmi.s bub_quit           branch if bit 7 is set
  444    00000078 2E01                   move.l D1,D7              save for calc'ing BLR MSB
  445    0000007A 0207 0007              andi.b #$07,D7            isolate 'size' bits
  446    0000007E 3C07                   move.w D7,D6              save 'size'
  447    00000080 5207                   addq.b #1,D7              value + 1 = size
  448    00000082 7011                   moveq #17,D0              shift count to convert size to bytes
  449    00000084 0801 0005              btst #k_size,D1           128K Mbyte or 512K Mbyte ?
  450    00000088 6702                    beq.s bub_convert        branch if 128K
  451    0000008A 5400                   addq.b #2,D0              adjust for 512K
  452                       
  453    0000008C E1AF      bub_convert  lsl.l D0,D7               convert size to bytes
  454    0000008E 2001                   move.l D1,D0              get config_reg copy
  455    00000090 E608                   lsr.b #3,D0               right justify 'fsa' bits
  456    00000092 0200 0003              andi.b #$03,D0            isolate 'fsa' bits
  457    00000096 7240                   moveq #64,D1              assume block size of 64
  458    00000098 E169                   lsl.w D0,D1               adjust for actual block size
  459                       
  460    0000009A 4E75                   rts                       return
  461                       
  462                       
  463    0000009C 588F      bub_quit     addq.l #4,SP              cut back stack one level

 PAGE   6 [3.3a] 6/28/89 17:46:12  ASSEMBLY OF BUBL_BOOT.TEXT

  464                       
  465    0000009E 4E75                   rts                       exit driver
  466                       
  467                       
  468                       ********
  469                       *
  470                       *    bubl_intz
  471                       *
  472                       *
  473                       *  PURPOSE: Set up bubble memory controller (BMC) for
  474                       *           read operation.
  475                       *
  476                       *  NOTE: Block size and starting address are passed
  477                       *        in registers as parameters.
  478                       *
  479                       *  CALLER: bubl_read
  480                       *
  481                       *  CALL: (none)
  482                       *
  483                       *  REG: A2.l - command/status register address   R
  484                       *       A3.l - data register address   R
  485                       *       D1.l - block size value (64 to 512 bytes)  W
  486                       *       D6.w - block address  R/W
  487                       *
  488                       *  PDL: address the block reg lsb
  489                       *       set BLR LSB reg for 1 block
  490                       *       set BLR MSB reg for # of channels
  491                       *       set ENABLE reg RCD, max rate (1)
  492                       *       set AR regs for starting block address
  493                       *       RETURN
  494                       *
  495                       *       (1) For max rate, MAX RATE bit is false.
  496                       *
  497                       *  REVISION:  5-10-82
  498                       *
  499                       *  REVISION: 12-27-83
  500                       *       changed 6th line to move.b $24 instead of $20 for speed reasons
  501                       *       Anny Randel (see Robert Quist if any questions)
  502                       *
  503                       ********
  504                       
  505    000000A0 14BC 000B bubl_intz move.b #blr_lsb,(A2)  point at BLR LSB
  506    000000A4 16BC 0001           move.b #$01,(A3)      BLR LSB  1 block per read op
  507    000000A8 E449                lsr.w #2,D1           align BLR MSB bits
  508    000000AA 1681                move.b D1,(A3)        BLR MSB  # channels
  509    000000AC E549                lsl.w #2,D1           restore block size value
  510    000000AE 16BC 0024           move.b #$24,(A3)      ER       rcd
  511    000000B2 1686                move.b D6,(A3)        AR  LSB  page address
  512    000000B4 E04E                lsr.w #8,D6
  513    000000B6 1686                move.b D6,(A3)        AR  MSB  MBM select
  514                       
  515    000000B8 4E75                rts                   return
  516                       
  517                       
  518                       ********
  519                       *
  520                       *    ddBUBL_deviceread

 PAGE   7 [3.3a] 6/28/89 17:46:12  ASSEMBLY OF BUBL_BOOT.TEXT

  521                       *
  522                       *
  523                       *  PURPOSE: Read requested number of bytes starting at requested sector
  524                       *           into requested memory buffer location.  Requested parameters
  525                       *           are passed in on the stack.
  526                       *
  527                       *  NOTE: The block size must be adjusted for the number of fsa's available,
  528                       *        and the requested number of bytes is tested against max available.
  529                       *        Interrupts are locked out for no longer than 150 milliseconds
  530                       *        (512 byte block while reading through an MBM boundry),
  531                       *        (12.5 ms max for 64 byte block) reguardless of the length
  532                       *        of the transfer.
  533                       *
  534                       *  CALLER: (from within the bootrom)
  535                       *
  536                       *  CALL: bubl_intz, bubl_opdone, bubl_sc_size
  537                       *        (error-exits: bubl_read_err, bubl_hard_err)
  538                       *
  539                       *  REG: A0.l - return address  R/W
  540                       *       A1.l - base card address  R
  541                       *       A2.l - BMC command/status register address  R
  542                       *       A3.l - BMC data register address  R
  543                       *       A4.l - data buffer pointer  R/W
  544                       *       D0.l - 'fsa' shift count; then timeout counter  R/W
  545                       *       D1.l - block size value (64 to 512 bytes)  W
  546                       *       D2.w - SR (68000 status register) copy  R/W
  547                       *       D3.l - requested data length in bytes  R/W
  548                       *       D4.w - (lower) 512K odd-sector byte counter  R/W
  549                       *       D4.w - (upper) bit 16 = odd-sector flag  R/W
  550                       *       D5.l - data starting address (block) in bubbles  R/W
  551                       *       D6.l - AR address value, then block byte  counter  W
  552                       *       D7.l - max bubble size in 'bytes'; then 'fifo_avail' bit #  R/W
  553                       *
  554                       *  PDL:   CALL bubl_sc_size
  555                       *         retrieve parameters from stack
  556                       *       convert sector address to bubble block address
  557                       *         CALL bubl_intz
  558                       *       send read-seek command to BMC
  559                       *       IF requested byte address + length > max available in bub-card THEN
  560                       *          escape with bubl_addr_err    {ec_bad_error_state}
  561                       *       END IF
  562                       *         CALL bubl_opdone
  563                       *       REPEAT
  564                       *         IF transfer length count < initial transfer length THEN
  565                       *           increment start address by one block size
  566                       *         END IF
  567                       *           CALL bubl_intz
  568                       *         send reset_fifo command to BMC
  569                       *         initialize block byte count = block size
  570                       *         disable interrupts
  571                       *         initialize timeout count  {150 ms}  {transfer should complete in 48 ms
  572                       *         send read command to BMC            for worst case combination
  573                       *         IF odd_sector THEN read and discard 256 bytes
  574                       *         read one block size of data from desired bubble location
  575                       *         IF read error or timeout THEN
  576                       *           enable interrupts
  577                       *           error escape

 PAGE   8 [3.3a] 6/28/89 17:46:12  ASSEMBLY OF BUBL_BOOT.TEXT

  578                       *         END IF
  579                       *         enable interrupts
  580                       *       UNITL byte transfer length expires
  581                       *       finish read (discard data) until block byte count = 0
  582                       *       RETURN
  583                       *
  584                       *  REVISION:  6-25-82
  585                       *
  586                       *  REVISION:
  587                       *     Modified by:      Anny Randel
  588                       *     Date:             Dec. 14, 1983
  589                       *     Purpose:          Use timer when present
  590                       *
  591                       ********
  592                       
  593    000000BA 619A      ddBUBL_deviceread   bsr bubl_sc_size       get card address and size
  594    000000BC 205F                        movea.l (SP)+,A0         pop return address
  595    000000BE 2A1F                        move.l (SP)+,D5          pop data starting addr (sector)
  596    000000C0 261F                        move.l (SP)+,D3          pop data length (bytes)
  597    000000C2 7807                        moveq #busy,D4           'busy' is bit 7
  598    000000C4 0801 0009                   btst #9,D1               512 byte block size ?
  599    000000C8 6606                         bne.s bubl_read_512     branch if 512 byte block size
  600    000000CA E58D                        lsl.l #2,D5              assume 64 byte blocks to start
  601    000000CC E0AD                        lsr.l D0,D5              now convert sector to block address
  602    000000CE 600C                         bra.s bubl_read_addr    check for address zero
  603                       
  604    000000D0 0805 0000 bubl_read_512     btst #0,D5               odd or even sector ask for ?
  605    000000D4 6704                         beq.s bubl_read_adjust  branch if even sector
  606    000000D6 08C4 0010                   bset #odd_sector,D4      set odd sector flag
  607                       
  608    000000DA E28D      bubl_read_adjust  lsr.l #1,D5              adjust addresss for 512 block size
  609                       
  610    000000DC 303C 1FFF bubl_read_addr    move.w #$1FFF,D0         13 lsb bits of address reg
  611    000000E0 0829 0005                   btst #k_size,config_reg(A1)  128K or 512K ?
                  0005 
  612    000000E6 6602                         bne.s bubl_read_4mbit   branch if 512K
  613    000000E8 E448                        lsr.w #2,D0              alter for 128K
  614                       
  615    000000EA 3C05      bubl_read_4mbit   move.w D5,D6             get copy of block address
  616    000000EC CC40                        and.w D0,D6              isolate starting page address
  617    000000EE 6606                         bne.s bubl_read_non0    branch over zero address code
  618    000000F0 3C05                        move.w D5,D6             get copy of block address
  619    000000F2 8C40                        or.w D0,D6               non mbm bits only, addr - 1
  620    000000F4 6004                         bra.s bubl_read_seek    branch over non-zero address code
  621                       
  622    000000F6 3C05      bubl_read_non0    move.w D5,D6             pass block address as parameter
  623    000000F8 5346                        subq.w #1,D6             back up one (read-seek leaves AR+1)
  624                       
  625    000000FA 285F      bubl_read_seek    movea.l (SP)+,A4         pop data buffer addr
  626    000000FC 2F08                        move.l A0,-(SP)          push return address
  627    000000FE 61A0                          bsr.s bubl_intz        initialize controller
  628    00000100 14BC 0014                   move.b #read_seek,(A2)   seek to desired starting address
  629    00000104 2C05                        move.l D5,D6             get copy of starting address (block)
  630    00000106 CCC1                        mulu D1,D6               convert block addr to byte address
  631    00000108 DC83                        add.l D3,D6              calc max desired byte address
  632    0000010A BC87                        cmp.l D7,D6              compare for max address
  633    0000010C 6E00 014C                    bgt bubl_addr_err       escape if address is to high !!!!!!!!

 PAGE   9 [3.3a] 6/28/89 17:46:12  ASSEMBLY OF BUBL_BOOT.TEXT

  634                       
  635    00000110 6100 00E8                     bsr   bubl_opdone      wait for op complete
  636    00000114 7E00                        moveq #fifo_avail,D7     'fifo_avail' is bit #0
  637    00000116 6002                         bra.s bubl_read_init
  638                       
  639    00000118 5245      bubl_read_blk     addq.w #1,D5             increment starting block address
  640                       
  641    0000011A 3C05      bubl_read_init    move.w D5,D6             pass block address parameter
  642    0000011C 6182                          bsr.s bubl_intz        initialize controller
  643    0000011E 14BC 001D                   move.b #reset_fifo,(A2)  clear out fifo, prepare for read
  644    00000122 6100 00D6                     bsr   bubl_opdone      wait for op complete
  645    00000126 2C01                        move.l D1,D6             initialize block size counter
  646    00000128 5346                        subq.w #1,D6             (adjust for 'dbj' )
  647    0000012A 40C2                        move SR,D2               save current interrupt value
  648    0000012C 007C 2700                   ori #$2700,SR            disable interrupts >>>>>>>>
  649                       
  650                       ****** START OF ANNY'S CHANGES *******
  651    00000130 0838 0001                 btst    #timer_absent,sysflag2  timer absent?
                  FEDA 
  652    00000136 6612                      bne.s   bubl_settimeout         branch if so
  653    00000138 2F3C 0002                 move.l  #149000,-(sp)      Set timeout to 149 ms (to insure<150)
                  4608 
  654    0000013E 4857                      pea     (sp)
  655    00000140 4EB8 0000                 jsr     start_timer             Get timeout value
  656    00000144 201F                      move.l  (sp)+,d0                 into d0 (& pop stack)
  657    00000146 6000 0006                 bra     bubl_timeset
  658                       ***************************************
  659                       
  660    0000014A 303C 4C00 bubl_settimeout   move.w #$4C00,D0         initialize 150ms timeout counter
  661    0000014E 14BC 0012 bubl_timeset      move.b #read_data,(A2)   kick off read op
  662    00000152 0884 0010                   bclr #odd_sector,D4      odd sector of 512 block size ?
  663    00000156 670E                         beq.s bubl_read_loop    branch if not odd_sector
  664                       
  665    00000158 0F12      bubl_dummy_read   btst D7,(A2)             is read data available ?
  666    0000015A 671E                         beq.s bubl_dummy_busy   branch if data not available in fifo
  667    0000015C 4A13                        tst.b (A3)               throw away byte
  668    0000015E 5346                        subq.w #1,D6             decrement dummy byte countyer
  669    00000160 0C46 00FF                   cmpi.w #255,D6           256 bytes in bit bucket ?
  670    00000164 6EF2                         bgt.s bubl_dummy_read   get next byte if not yet 1/2 block
  671                       
  672    00000166 0F12      bubl_read_loop    btst D7,(A2)             is read data available ?
  673    00000168 6730                         beq.s bubl_read_busy    branch if data not available in fifo
  674    0000016A 18D3                        move.b (A3),(A4)+        move data to ram buffer
  675    0000016C 5383                        subq.l #1,D3             decrement total length by one
  676    0000016E 6F00 0082                    ble   bubl_read_dump    exit if length count is zero
  677                       
  678    00000172 51CE FFF2 bubl_read_chk      dbf D6,bubl_read_loop   get next byte if not yet one block
  679    00000176 46C2                        move D2,SR               re-enable interrupts <<<<<<<<
  680    00000178 609E                         bra.s bubl_read_blk     branch if length count not expired
  681                       
  682    0000017A 0912      bubl_dummy_busy   btst D4,(A2)             controller still busy ?
  683    0000017C 676A                         beq.s bubl_read_error   branch if not busy
  684                       
  685                       ******* ANNY'S CHANGES ********
  686    0000017E 0838 0001                 btst    #timer_absent,sysflag2  timer absent?
                  FEDA 
  687    00000184 660E                      bne.s   bubl_dummy_busy1        branch if so

 PAGE  10 [3.3a] 6/28/89 17:46:12  ASSEMBLY OF BUBL_BOOT.TEXT

  688                       
  689    00000186 2F00                      move.l  d0,-(sp)            Check to see if timer has expired
  690    00000188 4857                      pea     (sp)
  691    0000018A 4EB8 0000                 jsr     check_timer
  692    0000018E 584F                      addq    #4,sp                           pop stack
  693    00000190 6AC6                      bpl.s   bubl_dummy_read      branch if not timed out
  694    00000192 602A                      bra.s   bubl_read_tout     escape with timeout error
  695                       ********************************
  696                       
  697    00000194 5340      bubl_dummy_busy1   subq.w #1,D0            decrement timeout counter
  698    00000196 6EC0                         bgt.s bubl_dummy_read   branch if not timed out
  699                       
  700    00000198 6024                         bra.s bubl_read_tout    escape with time out error
  701                       
  702                       *************************************************************************
  703                       *  The next five lines were modified to fix bug found by Robert Quist.  *
  704                       *  The fix also came from Quist.                                        *
  705                       *************************************************************************
  706                       
  707    0000019A 0912      bubl_read_busy    btst D4,(A2)             controller still busy ?
  708    0000019C 6606                         bne.s bubl_read_busy1
  709    0000019E 0F12                         btst D7,(A2)
  710    000001A0 66C4                         bne.s bubl_read_loop
  711    000001A2 6044                         bra.s bubl_read_error   branch if not busy
  712                       
  713                       ********** ANNY'S CHANGES ***********
  714    000001A4 0838 0001 bubl_read_busy1 btst    #timer_absent,sysflag2  timer absent?
                  FEDA 
  715    000001AA 660E                      bne.s   bubl_read_busy2         branch if so
  716                       
  717    000001AC 2F00                      move.l  d0,-(sp)
  718    000001AE 4857                      pea     (sp)
  719    000001B0 4EB8 0000                 jsr     check_timer
  720    000001B4 584F                      addq    #4,sp                           pop stack
  721    000001B6 6AAE                      bpl.s   bubl_read_loop    branch if not timed out
  722    000001B8 6004                      bra.s   bubl_read_tout  escape with timeout error
  723                       **************************************
  724                       
  725    000001BA 5340      bubl_read_busy2   subq.w #1,D0             decrement timeout counter
  726    000001BC 6EA8                         bgt.s bubl_read_loop    branch if not timed out
  727                       
  728    000001BE 46C2      bubl_read_tout    move D2,SR               re-enable interrupts <<<<<<<<
  729                       
  730    000001C0 6000 0094                    bra bubl_hard_err     escape with time out error !!!!!!!!
  731                       
  732    000001C4 0912      bubl_exss_busy    btst D4,(A2)             controller still busy ?
  733    000001C6 6606                         bne.s bubl_exss_busy0   branch if so
  734    000001C8 0F12                         btst D7,(A2)            data available now?
  735    000001CA 6620                         bne.s bubl_read_exss    branch if so
  736    000001CC 601A                         bra.s bubl_read_error
  737                       
  738                       ******* ANNY'S CHANGES ********
  739    000001CE 0838 0001 bubl_exss_busy0 btst    #timer_absent,sysflag2  timer absent?
                  FEDA 
  740    000001D4 660C                      bne.s   bubl_exss_busy1         branch if so
  741                       
  742    000001D6 2F00                      move.l  d0,-(sp)

 PAGE  11 [3.3a] 6/28/89 17:46:12  ASSEMBLY OF BUBL_BOOT.TEXT

  743    000001D8 4857                      pea     (sp)
  744    000001DA 4EB8 0000                 jsr     check_timer             see if we've timed out
  745    000001DE 584F                      addq    #4,sp                           pop stack
  746    000001E0 6A0A                      bpl.s   bubl_read_exss
  747                       **************  END OF ANNY'S CHANGES **************
  748                       
  749    000001E2 5340      bubl_exss_busy1    subq.w #1,D0             decrement timeout counter
  750    000001E4 6E06                         bgt.s bubl_read_exss    branch if not timed out
  751                       
  752    000001E6 60D6                         bra.s bubl_read_tout    escape with time out error
  753                       
  754                       
  755    000001E8 46C2      bubl_read_error   move D2,SR               re-enable interrupts <<<<<<<<
  756                       
  757    000001EA 6066                         bra.s bubl_read_err     escape with read error !!!!!!!!
  758                       
  759                       
  760    000001EC 0F12      bubl_read_exss    btst D7,(A2)             is read data available ?
  761    000001EE 67D4                         beq.s bubl_exss_busy    branch if data not available in fifo
  762    000001F0 4A13                        tst.b (A3)               discard the byte
  763                       
  764    000001F2 51CE FFF8 bubl_read_dump     dbf D6,bubl_read_exss   get next byte if block not finished
  765    000001F6 46C2                        move D2,SR               re-enable interrupts <<<<<<<<
  766                       
  767    000001F8 4E75                         rts                     normal returnreturn
  768                       
  769                       
  770                       ********
  771                       *
  772                       *    bubl_opdone
  773                       *
  774                       *
  775                       *  PURPOSE: Check for op_done status; timeout if never occures.
  776                       *
  777                       *  NOTE: Interrupts are not lock out during this routine.
  778                       *
  779                       *  CALLER: bubl_read, bubl_unit_init
  780                       *
  781                       *  CALL: bubl_hard_err
  782                       *
  783                       *  REG: A2.l - ptr to BMC's command/status register   R
  784                       *       d0.l - timeout counter  R/W
  785                       *
  786                       *  PDL: initialize timeout count      {1.5 sec}
  787                       *       WHILE op_done false in BMC status reg
  788                       *         decrement timeout count
  789                       *         IF timeout count <= 0 THEN bubl_hard_err    {ec_bad_hardware}
  790                       *       END WHILE
  791                       *       RETURN
  792                       *
  793                       *  REVISION:  6-25-82
  794                       *
  795                       *
  796                       *     Modified by:      Anny Randel
  797                       *     Date:             Dec. 14, 1983
  798                       *     Purpose:          Use timer when present
  799                       ********

 PAGE  12 [3.3a] 6/28/89 17:46:12  ASSEMBLY OF BUBL_BOOT.TEXT

  800                       
  801                       *********  START OF ANNY'S CHANGES  *********
  802    000001FA 0838 0001 bubl_opdone     btst    #timer_absent,sysflag2  timer absent?
                  FEDA 
  803    00000200 6610                      bne.s   bubl_opdone1            branch if so
  804                       
  805    00000202 2F3C 0016                 move.l  #1500000,-(sp)  push us value on stack (1.5 sec)
                  E360 
  806    00000208 4857                      pea     (sp)
  807    0000020A 4EB8 0000                 jsr     start_timer     get timeout value
  808    0000020E 201F                      move.l  (sp)+,d0            into d0
  809    00000210 6006                      bra.s   bubl_test
  810                       **********************************************
  811                       
  812    00000212 203C 0003 bubl_opdone1    move.l #$3A000,D0     initialize timeout counter
                  A000 
  813                       
  814    00000218 0812 0007 bubl_test   btst #busy,(A2)       is  busy  intr bit set ?
  815    0000021C 6608                   bne.s bubl_tout      branch if set
  816    0000021E 0812 0006             btst #op_done,(A2)    is  op_done  intr bit set ?
  817    00000222 6702                   beq.s bubl_tout      branch if not set
  818                       
  819    00000224 4E75                  rts                   normal retrun
  820                       
  821                       *************** ANNY'S CHANGES ***************
  822                       
  823    00000226 0838 0001 bubl_tout       btst    #timer_absent,sysflag2  timer absent?
                  FEDA 
  824    0000022C 661A                      bne.s   bubl_tout1              branch if so
  825                       
  826    0000022E 2F00                      move.l  d0,-(sp)
  827    00000230 4857                      pea     (sp)
  828    00000232 4EB8 0000                 jsr     check_timer     check for time out
  829    00000236 588F                      addq.l  #4,sp
  830    00000238 6ADE                      bpl.s   bubl_test       branch if not timed out
  831                       
  832    0000023A 0812 0007                 btst #busy,(A2)       is  busy  intr bit set ?
  833    0000023E 6616                       bne.s bubl_hard_err  branch if set
  834    00000240 0812 0006                 btst #op_done,(A2)    is  op_done  intr bit set ?
  835    00000244 6710                       beq.s bubl_hard_err  branch if not set
  836                       
  837    00000246 4E75                      rts                   normal retrun
  838                       
  839                       ************** END OF ANNY'S CHANGES ***********
  840                       
  841    00000248 5380      bubl_tout1   subq.l #1,D0          decrement timeout counter
  842    0000024A 6ECC                   bgt.s bubl_test      branch if not timed out
  843                       
  844    0000024C 6008                   bra.s bubl_hard_err  escape with timeout error !!!!!!!!
  845                       
  846                       
  847                       ********
  848                       *
  849                       *    error exits
  850                       *
  851                       *
  852                       *  PURPOSE: Central error escape routine.

 PAGE  13 [3.3a] 6/28/89 17:46:12  ASSEMBLY OF BUBL_BOOT.TEXT

  853                       *
  854                       *  NOTE: All errors jump to one of these labels.
  855                       *
  856                       *  CALLER: bubl_deviceread, bubl_opdone
  857                       *
  858                       *  CALL: (escape back to boot rom calling routine)
  859                       *
  860                       *  REG: A5.l - ptr back to boot-rom error handler  R
  861                       *       D0.w - error number to be returned   R/W
  862                       *
  863                       *  PDL: store error number (1)
  864                       *       escape back to error exit location
  865                       *
  866                       *       (1) Error numbers declared in bootrom.
  867                       *
  868                       *  REVISION:  5-10-82
  869                       *
  870                       ********
  871                       
  872    0000024E 7001      bubl_nodevice moveq #ec_no_device,D0        no device or wrong device
  873    00000250 600A                     bra.s bubl_escape
  874                       
  875    00000252 7004      bubl_read_err moveq #ec_read_error,D0       could not get data from bubble
  876    00000254 6006                     bra.s bubl_escape
  877                       
  878    00000256 7005      bubl_hard_err moveq #ec_bad_hardware,D0     time-out or opdone error
  879    00000258 6002                     bra.s bubl_escape
  880                       
  881    0000025A 7006      bubl_addr_err moveq #ec_bad_error_state,D0  address out of range
  882                       
  883    0000025C 3B40 FFFE bubl_escape   move.w D0,-2(A5)
  884    00000260 2E6D FFF6               movea.l -10(A5),SP
  885                       
  886    00000264 4E75                    rts
  887                       
  888                         end
PASS 1 ERRORS: 0
PASS 2 ERRORS: 0
