home *** CD-ROM | disk | FTP | other *** search
/ MACD 4 / MACD4.iso / Emulatory / QLsource / ROMsrc / ACE / ACE_ASM
Encoding:
Text File  |  1978-03-06  |  16.2 KB  |  686 lines

  1. *
  2. * last modified 30/08/95
  3. *
  4. * AMIGA QDOS SCREEN ACCELERATOR for 32 bit AGA machines
  5. * Version 3.21 by Simon N Goodwin, with thanks to Mark
  6. * J Swift for scanning a listing when I lost the source!
  7. * Listing assumes TABs set to 11 chars
  8. *
  9. qdos    equr    a0    Qdos screen pointer
  10. Plane1    equr    a1    Least significant bitplane
  11. Plane2    equr    a2
  12. Plane3    equr    a3    MODE 8 only
  13. table    equr    a4    Byte translator
  14. *
  15. * Interrupt servers must preserve A5, A6 and A7 (!)
  16. * but all other registers are up for grabs.
  17. *
  18. * Bitplane accumulator registers, added in v3.11
  19. *
  20. RED    equr    d4
  21. BLUE    equr    d5
  22. GREEN    equr    d6
  23. *
  24. * Amiga hardware equates
  25. *
  26. COLOR00    EQU    $DFF180
  27. COLOR01    EQU    $DFF182
  28. COLOR02    EQU    $DFF184
  29. COLOR03    EQU    $DFF186
  30. COLOR04    EQU    $DFF188
  31. COLOR05    EQU    $DFF18A
  32. COLOR06    EQU    $DFF18C
  33. COLOR07    EQU    $DFF18E
  34. *
  35. * QDOS equates
  36. *
  37. BP.INIT    equ    $110
  38. CA.GTINT    equ    $112
  39. BV.CHRIX    equ    $11A
  40. *
  41. * QDOS hardware equates
  42. *
  43. MC_STAT    equ    $18063
  44. *
  45. * Default addresses for Qdos and Amiga screen images
  46. *
  47. qlbase    equ    $20000    Base of first QL screen
  48. qlsize    equ    $8000    Size of each QL screen
  49. bp1base    equ    $10000    Base of first Amiga bitplane
  50. bp3base    equ    $12000    Base of BLUE bitplane in MODE 8
  51. bp2base    equ    $14000    Base of second bitplane
  52. *
  53. * Offsets of variables in interrupt linkage
  54. *
  55. link    equ    0    Interrupt link comes first
  56. vector    equ    4    Offset of code address
  57. marker    equ    8    Offset of "ACE3" signature
  58. prefix    equ    12    Number of bytes so far
  59. *
  60. * These variables follow MARKER and are relative to PREFIX
  61. *
  62. limit    equ    0    Count fields down from this
  63. count    equ    1    Current field in sequence
  64. busy    equ    2    Set during interrupt handler
  65. missed    equ    3    (Counted interrupts ignored)
  66. chunks    equ    4    Number of 2K chunks at each pass
  67. soFar    equ    5    Number of 2K chunks already done
  68. smode    equ    6    current screen mode
  69. varSize    equ    prefix+8    Total bytes of linkage
  70. *
  71. *  ROM header
  72. *
  73. BASE:
  74.     dc.l    $4AFB0001        ROM recognition code
  75.     dc.w    define-BASE    BASIC procs
  76.     dc.w    ROM_START-BASE
  77.     dc.b    0,30,'ACE screen accelerator v3.21 ',$A
  78. *
  79. *  start of ROM code
  80. *
  81. ROM_START:
  82.     movem.l    d0-d3/a0-a3,-(a7)
  83.  
  84.     lea    BASE(pc),a0
  85.     cmp.l    #$1000000,a0    FAST RAM?
  86.     bmi    ROM_EXIT        No, user decides
  87.  
  88.     moveq    #0,d0
  89.     trap    #1
  90.  
  91.     move.b    161(a0),d0     Check CPU version
  92.     cmp.b    #$30,d0        < 030, user decides
  93.     bcs.s    ROM_EXIT
  94.  
  95.     bsr    mblit_on
  96.  
  97. ROM_EXIT:
  98.     movem.l    (a7)+,d0-d3/a0-a3
  99.     rts
  100. *
  101. * This is the routine that redraws the whole screen
  102. * On entry A3 -> Linkage-8; A6 -> Qdos variables
  103. *
  104. AceVars    equ    prefix+8        A3 offset to LIMIT
  105. *
  106. redraw    btst    #7,$1813E
  107.     beq    mblit_off
  108.  
  109.     tst.b    busy+AceVars(a3)    Prevent re-entrancy
  110.     beq.s    update
  111. *
  112. * Code to work out the number of interrupts MISSED (while ACE is
  113. * busy) commented out for version 3.16 as Qdos can't cope with
  114. * missed interrupts anyway, and I needed the variable to set the
  115. * proportion of the screen to be updated (1..16, as SCR_PRIORITY)
  116. *
  117. * ignore    addq.b    #1,missed+AceVars(a3)
  118. skip    rts
  119. *
  120. update
  121. *    move.b    missed+AceVars(a3),d1
  122. *    beq.s    limit_ok        No interrupts missed
  123. *
  124. *    addq.b    #1,d1        Count one that worked
  125. *    clr.b    missed+AceVars(a3)    Keep checking
  126. *    cmp.b    limit+AceVars(a3),d1    Can the CPU keep up?
  127. *    bls.s    limit_ok        There is enough time
  128. *
  129. *    move.b    d1,limit+AceVars(a3)    Increase limit
  130. limit_ok    subq.b    #1,count+AceVars(a3)
  131.     bne.s    skip        The time is NOT nigh
  132. *
  133.     st    busy+AceVars(a3)    Flag critical region
  134.     move.b    limit+AceVars(a3),count+AceVars(a3)
  135.     lea.l    bp1base,Plane1
  136.     lea.l    bp2base,Plane2
  137.     lea.l    qlbase+qlsize,qdos    Point at screen 2
  138.     move.b    MC_STAT,d2     Check if it's in use
  139.     bmi.s    chkmod
  140. *
  141.     lea.l    -qlsize(qdos),qdos    Wind back to screen 1
  142. *
  143. * Check if mode has changed
  144. *
  145. chkmod
  146.     cmp.b    smode+AceVars(a3),d2
  147.     beq.s    chksho
  148. *
  149.     bsr    ace_cop
  150.     move.b    d2,smode+AceVars(a3)
  151. *
  152. chksho
  153.     btst    #1,d2        check blanking bit
  154.     bne    done        and exit if set
  155. *
  156. * Work out which chunk needs to be updated next, and adjust pointers
  157. *
  158. based    move.w    #2048/8,d3     Iterations per 2K chunk
  159.     moveq    #0,d4
  160.     move.b    chunks+AceVars(a3),d4
  161.     moveq    #0,d5
  162.     move.b    soFar+AceVars(a3),d5
  163. *
  164. * Advance input and output pointers past data previously processed
  165. *
  166.     move.l    d5,d6
  167.     lsl.l    #8,d6
  168.     add.l    d6,d6        * 512 for output offsets
  169.     add.l    d6,Plane1
  170.     add.l    d6,qdos
  171.     add.l    d6,Plane2
  172.     add.l    d6,qdos        Qdos gets scanned fastest
  173.     add.l    d6,qdos
  174.     add.l    d6,qdos        We'll need D6 again later
  175. *
  176. * Work out where we're going to end up
  177. *
  178.     add.b    d4,d5
  179.     cmp.b    #16,d5        Up to end of screen?
  180.     bcs.s    nextChunk
  181. *
  182.     sub.b    #16,d5        Compute potential overrun
  183.     sub.b    d5,d4        Do that much less, then
  184.     clr.b    d5        Restart at the beginning
  185. *
  186. nextChunk    move.b    d5,soFar+AceVars(a3)
  187.     mulu.w    d4,d3        D3 is loop count
  188.     subq.w    #1,d3        Adjust for DBRA
  189. *
  190. * If we're running on a CPU with a data cache, we should disable cache
  191. * allocation while redrawing the screen to avoid swamping it with data
  192. * that we do not intend to re-use, and wiping out MODE 8 table data.
  193. *
  194.     move.b    161(a6),d0     Check CPU version
  195.     cmp.b    #$30,d0
  196.     bcs.s    decached        No data cache before 68030
  197. *
  198. * If we're in MODE 8 we need to prime the data cache with our byteTable
  199. *
  200.      btst    #3,d2        MODE 8 ?
  201.      beq.s    noPrime
  202. *
  203.     lea.l     byteTable(pc),table
  204.     moveq     #256/4-1,d1
  205. primer    tst.l     (table)+        Get it all into the cache
  206.     dbra      d1,primer
  207. *
  208. noPrime    cmp.b     #$30,d0        Is this a 68030?
  209.     bne.s     after030
  210. *
  211. * 68030 data cache disabling code
  212. *
  213.     dc.w      $4E7A,$1002     MOVEC CACR,D1
  214.     move.l    d1,d7        Save old setting
  215.     beq.s     decached
  216. *
  217.     bset      #9,d1        Disable data allocation
  218.     dc.w      $4E7B,$1002     MOVEC D1,CACR
  219.     bra.s     decached
  220. *
  221. * 68040/060 data cache disabling code; leaves prior DTT0 in D7
  222. *
  223. after030    dc.w      $4E7A,$7006     MOVEC DTT0,D7
  224.     move.l    #$C060,d1        Don't cache 0..16 Mb
  225.     dc.w      $4E7B,$1006     MOVEC D1,DTT0
  226. *
  227. * Check the mode to determine the format of the Qdos screen
  228. *
  229. decached    btst      #3,d2        Mode 8 ?
  230.     bne.s     mode8
  231. *
  232. * Algorithmic version, reads 8 bytes and unscrambles them to 2 bitplanes
  233. * Input read to D0 and D5 goes to D2 and D3; D4 scratch, D6 counts loops
  234. *
  235. mode4    move.w    d3,d1
  236.     add.l     d6,Plane1        MODE 4 outputs 2 for 1
  237.     add.l     d6,Plane2
  238. next8    movem.l   (qdos)+,d0/d5    Scrambled long words: ABCD EFGH
  239.     move.l    d0,d2        Set A in high byte of result
  240.     lsl.l     #8,d0        Align BC in the high word
  241.     move.l    d2,d4        Save low byte in D for later
  242.     swap      d0        Low word is now BC
  243.     swap      d2        CDAB
  244.     move.l    d0,d3        Set up B, but in low word
  245.     move.b    d4,d3        Set up D, again low for now
  246.     move.b    d0,d2        AC set in low word
  247. *
  248. * So far we have set AC and BD in the low word of our output registers
  249. * Next step is to work out the other word, and get both words in order
  250. *
  251.     move.l    d5,d4        Save H for later
  252.     swap    d5        GHEF
  253.     swap    d2        AC??
  254.     move.w    d5,d2        Set E in place
  255.     move.l    d4,d5        EFGH
  256.     lsr.l    #8,d5        0EFG
  257.     move.b    d5,d2        Set G in place
  258.     move.l    d2,(Plane2)+    Store ACEG green bits
  259.     swap    d3        BD??
  260.     move.w    d5,d3        BDF?
  261.     move.b    d4,d3        BDFH
  262.     move.l    d3,(Plane1)+    Write out red bits
  263.     dbra    d1,next8
  264. *
  265.     bra    CacheIn
  266. *
  267. * MODE 8 support - added in version 3.11
  268. *
  269. mode8
  270.     lea.l     byteTable(pc),table    Point to start of table
  271. *
  272.     moveq    #0,d0        Ensure byte values are unsigned longs
  273.     move.l    a3,-(a7)        ** fix? **
  274.     lea.l    bp3base,Plane3    Extra plane pointer for eight colours
  275.     add.l    d6,Plane3
  276. *
  277. next2    move.l    (qdos)+,d1
  278. *
  279. * Convert two Qdos screen bytes into three packed nybbles for the bitplanes
  280. *
  281.     rol.l    #8,d1        Move MSB (green byte) to LSB
  282.     move.b    d1,d0        Make it an unsigned long value
  283.     moveq    #15,d2        Mask for low nybble
  284.     and.b    0(table,d0.l),d2    Get four packed green bits
  285.     lsl.l    #4,GREEN        Make room
  286.     or.b    d2,GREEN
  287.     rol.l    #8,d1        Get blue and red byte to LSB
  288.     move.b    d1,d0
  289.     moveq    #15,d2        Mask for packed red bits
  290.     move.b    0(table,d0.l),d0
  291.     lsl.l    #4,RED        Make room
  292.     and.b    d0,d2        Extract red bits
  293.     lsl.l    #4,BLUE        Make room
  294.     lsr.b    #4,d0        Move blue pack to low nybble
  295.     or.b    d2,RED
  296.     or.b    d0,BLUE
  297. *
  298. * Now do the next two Qdos bytes, from the other half of D1
  299. *
  300.     rol.l    #8,d1        Move MSB (green byte) to LSB
  301.     move.b    d1,d0        Make it an unsigned long value
  302.     moveq    #15,d2        Mask for low nybble
  303.     and.b    0(table,d0.l),d2    Get four packed green bits
  304.     lsl.l    #4,GREEN        Make room
  305.     or.b    d2,GREEN
  306.     rol.l    #8,d1        Get blue and red byte to LSB
  307.     move.b    d1,d0
  308.     moveq    #15,d2        Mask for packed red bits
  309.     move.b    0(table,d0.l),d0
  310.     lsl.l    #4,RED        Make room
  311.     and.b    d0,d2        Extract red bits
  312.     lsl.l    #4,BLUE        Make room
  313.     lsr.b    #4,d0        Move blue pack to low nybble
  314.     or.b    d2,RED
  315.     or.b    d0,BLUE
  316. *
  317. * Pick up another Qdos long word and repeat to get a whole word for each bitplane
  318. *
  319.     move.l    (qdos)+,d1
  320. *
  321. * Optimisation to speed up black areas of the screen. Overhead is just this test
  322. *
  323.     beq.s    blackOut        Skip prevarication
  324. *
  325.     rol.l    #8,d1        Move MSB (green byte) to LSB
  326.     move.b    d1,d0        Make it an unsigned long value
  327.     moveq    #15,d2        Mask for low nybble
  328.     and.b    0(table,d0.l),d2    Get four packed green bits
  329.     lsl.l    #4,GREEN        Make room
  330.     or.b    d2,GREEN
  331.     rol.l    #8,d1        Get blue and red byte to LSB
  332.     move.b    d1,d0
  333.     moveq    #15,d2        Mask for packed red bits
  334.     move.b    0(table,d0.l),d0
  335.     lsl.l    #4,RED        Make room
  336.     and.b    d0,d2        Extract red bits
  337.     lsl.l    #4,BLUE        Make room
  338.     lsr.b    #4,d0        Move blue pack to low nybble
  339.     or.b    d2,RED
  340.     or.b    d0,BLUE
  341. *
  342. * Time to sort out the remaining Qdos word
  343. *
  344.     rol.l    #8,d1        Move MSB (green byte) to LSB
  345.     move.b    d1,d0        Make it an unsigned long value
  346.     moveq    #15,d2        Mask for low nybble
  347.     and.b    0(table,d0.l),d2    Get four packed green bits
  348.     lsl.l    #4,GREEN        Make room
  349.     or.b    d2,GREEN
  350. *
  351. * If D3 is even we've got long words to write out
  352. *
  353.     btst    #0,d3
  354.     bne.s    noWrite
  355. *
  356. * These three nybbles complete long bitplane values which must be stored
  357. *
  358.     move.l    GREEN,(Plane3)+
  359.     rol.l    #8,d1        Get blue and red byte to LSB
  360.     move.b    d1,d0
  361.     moveq    #15,d2        Mask for packed red bits
  362.     move.b    0(table,d0.l),d0
  363.     lsl.l    #4,RED        Make room
  364.     and.b    d0,d2        Extract red bits
  365.     or.b    d2,RED
  366.     move.l    RED,(Plane2)+
  367.     lsl.l    #4,BLUE        Make room
  368.     lsr.b    #4,d0        Move blue pack to low nybble
  369.     or.b    d0,BLUE
  370.     move.l    BLUE,(Plane1)+
  371.     bra.s    CarryOn
  372. *
  373. * A quick hack to save time if even input long words are zero (8 black pixels)
  374. *
  375. blackOut    lsl.l    #8,GREEN
  376.     lsl.l    #8,RED
  377.     lsl.l    #8,BLUE
  378. *
  379. * If D3 is even we've got long words to write out
  380. *
  381.     btst    #0,d3
  382.     bne.s    CarryOn        Go round again for the next word
  383. *
  384.     move.l    BLUE,(Plane1)+
  385.     move.l    RED,(Plane2)+
  386.     move.l    GREEN,(Plane3)+
  387.     bra.s    CarryOn
  388. *
  389. * Continue to accumulate in registers as we have not yet got long values
  390. *
  391. noWrite    rol.l    #8,d1        Get blue and red byte to LSB
  392.     move.b    d1,d0
  393.     moveq    #15,d2        Mask for packed red bits
  394.     move.b    0(table,d0.l),d0
  395.     lsl.l    #4,RED        Make room
  396.     and.b    d0,d2        Extract red bits
  397.     lsl.l    #4,BLUE        Make room
  398.     lsr.b    #4,d0        Move blue pack to low nybble
  399.     or.b    d2,RED
  400.     or.b    d0,BLUE
  401. CarryOn    dbra    d3,next2
  402.     move.l    (a7)+,a3        ** fix? **
  403. *
  404. CacheIn    move.b    161(a6),d1     Check for data cache
  405.     cmp.b    #$30,d1        68030?
  406.     bcs.s    done
  407. *
  408.     beq.s    enable030
  409. *
  410. * Revert to prior setting of DTT0 on 68040 or 68060
  411. *
  412.     dc.w    $4E7B,$7006    MOVEC D7,DTT0
  413.     bra.s    done
  414. *
  415. * Revert to prior setting of CACR on 68030
  416. *
  417. enable030    dc.w    $4E7B,$7002    MOVEC D7,CACR
  418. done    clr.b    busy+AceVars(a3)
  419.     rts
  420. *
  421. * sub to change copper list to suit ace
  422. *
  423. ace_cop
  424.     bset    #7,$1813E        disable screen blitter
  425.     move.w    #$0000,COLOR00
  426.     move.b    MC_STAT,d2
  427.     btst    #3,d2
  428.     bne.s    ace_cop8
  429. *
  430. ace_cop4
  431.     move.w    #76,99974        DDFSTART
  432.     move.w    #204,99978     DDFSTOP
  433.     move.w    #-4,99982        Modulo
  434.     move.w    #-4,99986        Modulo
  435.     move.w    #$A200,100002
  436.     btst    #1,d2
  437.     bne    blnkit
  438.     move.w    #$0F00,COLOR01
  439.     move.w    #$00F0,COLOR02
  440.     move.w    #$0FFF,COLOR03
  441.     rts
  442. ace_cop8
  443.     move.w    #72,99974        DDFSTART
  444.     move.w    #200,99978     DDFSTOP
  445.     move.w    #-2,99982        Modulo
  446.     move.w    #-2,99986        Modulo
  447.     move.w    #$3200,100002
  448.     btst    #1,d2
  449.     bne.s    blnkit
  450.     move.w    #$000F,COLOR01
  451.     move.w    #$0F00,COLOR02
  452.     move.w    #$0F0F,COLOR03
  453.     move.w    #$00F0,COLOR04
  454.     move.w    #$00FF,COLOR05
  455.     move.w    #$0FF0,COLOR06
  456.     move.w    #$0FFF,COLOR07
  457.     rts
  458. *
  459. blnkit
  460.     move.w    #$0000,COLOR01
  461.     move.w    #$0000,COLOR02
  462.     move.w    #$0000,COLOR03
  463.     rts
  464. *
  465. * sub to change copper list to suit blitter
  466. *
  467. blt_cop
  468.     bclr    #7,$1813E        enable screen blitter
  469.     move.w    #76,99974        DDFSTART
  470.     move.w    #204,99978     DDFSTOP
  471.     move.w    #-4,99982        Modulo
  472.     move.w    #-4,99986        Modulo
  473.     move.w    #$A200,100002
  474.     move.w    #$0000,COLOR00
  475.     move.w    #$0FFF,COLOR03
  476. *
  477.     move.b    MC_STAT,d2
  478.     btst    #1,d2
  479.     bne.s    blnkit
  480.     btst    #3,d2
  481.     bne.s    blt_cop8
  482. *
  483. blt_cop4
  484.     move.w    #$0F00,COLOR01
  485.     move.w    #$00F0,COLOR02
  486.     rts
  487. *
  488. blt_cop8
  489.     move.w    #$0708,COLOR01
  490.     move.w    #$00FA,COLOR02
  491.     rts
  492. *
  493. * ACE_ON asks is it already on? if so, return no error
  494. *
  495. mblit_on    bsr.s    find_pos2
  496.     beq.s    it_worked        Already on
  497. *
  498. * Otherwise, allocate linkage area in common heap
  499. *
  500.     moveq    #varSize,d1
  501.     moveq    #0,d2        Owned by SuperBASIC
  502.     moveq    #24,d0        MT.ALCHP trap key
  503.     trap    #1
  504.     tst.l    d0        Did we get it?
  505.     bne.s    oops
  506. *
  507.     bsr    ace_cop
  508.     move.b    d2,prefix+smode(a0)
  509. *
  510.     lea.l    redraw,a2
  511.     move.l    a2,vector(a0)    Provide code address
  512.     move.l    d7,marker(a0)    Add signature
  513.     move.b    #2,prefix+limit(a0)    Update every other field
  514.     move.b    #1,prefix+count(a0)
  515.     move.b    #0,prefix+missed(a0)    Not currently used...
  516.     move.b    #0,prefix+busy(a0)
  517.     move.b    #8,prefix+chunks(a0)    Scan 8 x 2K per update
  518.     move.b    #0,prefix+soFar(a0)
  519.     moveq    #28,d0        Set up MT.LPOLL trap
  520. trap1_out    trap    #1
  521. it_worked    moveq    #0,d0
  522.     rts
  523. *
  524. find_pos2    bsr.s    find_pos        Extra call for trapping
  525. oops    rts
  526. *
  527. * ACE_OFF is pretty simple too
  528. *
  529. mblit_off    bsr.s    find_pos2        Is our interrupt link
  530.     bmi.s    it_worked        If not, return at once
  531. *
  532. * Remove interrupt server and deallocate linkage memory
  533. *
  534.     bsr    blt_cop
  535. *
  536. not_opened lea.l    -prefix(a4),a0
  537.     moveq    #29,d0        MT.RPOLL trap key
  538.     trap    #1
  539.     moveq    #25,d0        MT.RECHP trap key
  540.     bra.s    trap1_out
  541. *
  542. bad_param    moveq    #-15,d0        ERR.BP code
  543. no_luck    rts
  544. *
  545. setrate    move.w    CA.GTINT,a2    Integer fetch vector
  546.     jsr    (a2)
  547.     bne.s    no_luck
  548. *
  549.     subq.w    #2,d3
  550.     bne.s    bad_param
  551. *
  552. * Check first parameter, number of 2K chunks to update each time
  553. *
  554.     move.w    0(a1,a6.l),d4
  555.     ble.s    bad_param
  556. *
  557.     cmp.w    #16,d4
  558.     bhi.s    bad_param
  559. *
  560. * Check second parameter, delay between updates in fields
  561. *
  562.     tst.b    2(a1,a6.l)
  563.     bne.s    bad_param        Reject if <0 or >255
  564. *
  565.     move.b    3(a1,a6.l),d3
  566.     beq.s    bad_param        Trap zero (aka 256!)
  567. *
  568.     bsr.s    find_pos
  569. *
  570.     move.b    d3,limit(a4)
  571.     move.b    d4,chunks(a4)
  572.     move.b    #1,count(a4)    Respond next field
  573.     bra.s    it_worked
  574. *
  575. * ACE_STEP% returns the current setting of CHUNKS to SuperBASIC
  576. *
  577. step    bsr.s    find_pos
  578.     moveq    #0,d4
  579.     move.b    chunks(a4),d4
  580.     bra.s    chk_integer
  581. *
  582. * ACE_RATE% returns the current setting of LIMIT to SuperBASIC
  583. *
  584. rate    bsr.s    find_pos
  585.     moveq    #0,d4
  586.     move.b    limit(a4),d4
  587. *
  588. * Return the integer in D4.W to SuperBASIC via the RI stack
  589. *
  590. chk_integer moveq    #2,d1        Number of bytes needed
  591.     move.w    BV.CHRIX,a2    Find the BV.CHRIX vector
  592.     jsr    (a2)        Allocate RI space
  593.     subq.l    #2,$58(a6)     Update BV.RIP
  594. ret_integer move.l    $58(a6),a1     Get BV.RIP
  595.     move.w    d4,0(a1,a6.l)    Stack the result
  596.     moveq    #3,d4        Type = 16 bit Integer
  597. no_error    moveq    #0,d0        No run-time error
  598.     rts
  599. *
  600. * FIND_POS points A4 at ACE variables in the interrupt list
  601. *
  602. * LONG link address
  603. * LONG code address
  604. * LONG "ACE3" marker
  605. * BYTE count
  606. * BYTE limit
  607. *
  608. * Result in A4, "ACEn" marker in D7; job ID in D1, uses D0
  609. * Returns NOT FOUND to prior caller if the server is absent
  610. *
  611. find_pos    moveq    #0,d0        MT.INF
  612.     trap    #1
  613.     move.l    #'ACE3',d7
  614.     lea.l    60(a0),a4        Locate polled list
  615. find_loop    move.l    (a4),d0
  616.     beq.s    not_found        Report to prior caller
  617. *
  618.     movea.l    d0,a4
  619.     cmp.l    marker(a4),d7    Check signature
  620.     bne.s    find_loop
  621. *
  622. found_it    lea.l    prefix(a4),a4    Point at the data
  623.     rts
  624. *
  625. not_found    addq.l    #4,a7        Discard return address
  626.     moveq    #-7,d0        ERR.NF report code
  627.     rts
  628. *
  629. * Mode 8 byte conversion table, generated by ACE3_BAS
  630. *
  631. * Index:  0..255    A B C D E F G H
  632. * Result: 0..255    B D F H A C E G
  633. *
  634. byteTable    dc.b    0,16,1,17,32,48,33,49
  635.     dc.b    2,18,3,19,34,50,35,51
  636.     dc.b    64,80,65,81,96,112,97,113
  637.     dc.b    66,82,67,83,98,114,99,115
  638.     dc.b    4,20,5,21,36,52,37,53
  639.     dc.b    6,22,7,23,38,54,39,55
  640.     dc.b    68,84,69,85,100,116,101,117
  641.     dc.b    70,86,71,87,102,118,103,119
  642.     dc.b    128,144,129,145,160,176,161,177
  643.     dc.b    130,146,131,147,162,178,163,179
  644.     dc.b    192,208,193,209,224,240,225,241
  645.     dc.b    194,210,195,211,226,242,227,243
  646.     dc.b    132,148,133,149,164,180,165,181
  647.     dc.b    134,150,135,151,166,182,167,183
  648.     dc.b    196,212,197,213,228,244,229,245
  649.     dc.b    198,214,199,215,230,246,231,247
  650.     dc.b    8,24,9,25,40,56,41,57
  651.     dc.b    10,26,11,27,42,58,43,59
  652.     dc.b    72,88,73,89,104,120,105,121
  653.     dc.b    74,90,75,91,106,122,107,123
  654.     dc.b    12,28,13,29,44,60,45,61
  655.     dc.b    14,30,15,31,46,62,47,63
  656.     dc.b    76,92,77,93,108,124,109,125
  657.     dc.b    78,94,79,95,110,126,111,127
  658.     dc.b    136,152,137,153,168,184,169,185
  659.     dc.b    138,154,139,155,170,186,171,187
  660.     dc.b    200,216,201,217,232,248,233,249
  661.     dc.b    202,218,203,219,234,250,235,251
  662.     dc.b    140,156,141,157,172,188,173,189
  663.     dc.b    142,158,143,159,174,190,175,191
  664.     dc.b    204,220,205,221,236,252,237,253
  665.     dc.b    206,222,207,223,238,254,239,255
  666. *
  667. * SuperBASIC extension details for the BP.INIT vector
  668. *
  669. define    dc.w    3+1        Three procedures
  670.     dc.w    mblit_off-*
  671.     dc.b    7,'ACE_OFF'
  672.     dc.w    mblit_on-*
  673.     dc.b    6,'ACE_ON'
  674.     dc.w    setrate-*
  675.     dc.b    12,'ACE_PRIORITY'    Long name hence +1
  676.     dc.w    0
  677. *
  678.     dc.w    2        Two functions
  679.     dc.w    rate-*
  680.     dc.b    9,'ACE_RATE%'
  681.     dc.w    step-*
  682.     dc.b    9,'ACE_STEP%'
  683.     dc.w    0
  684. *
  685.     end
  686.