home *** CD-ROM | disk | FTP | other *** search
/ Dave Lowe: AssemPro For Development Amiga Driver / Lowe_AssemProForDevelopmentAmigaDriver.adf / Empty / Back-up of amdriver.asm < prev    next >
Encoding:
Assembly Source File  |  1987-06-04  |  9.0 KB  |  390 lines

  1.  
  2. ;    notetable
  3.  
  4. a02    equ   508
  5. Bb02   equ   480
  6. b02    equ   453
  7. c02    equ   428
  8. Db02   equ   404
  9. d02    equ   381
  10. eb02   equ   360
  11. e02    equ   339
  12. f02    equ   320
  13. gb02   equ   302
  14. g02    equ   285
  15.  
  16. a01    equ   254
  17. Bb01   equ   240
  18. b01    equ   226
  19. c01    equ   214
  20. Db01   equ   202
  21. d01    equ   190
  22. eb01   equ   180
  23. e01    equ   170
  24. f01    equ   160
  25. gb01   equ   151
  26. g01    equ   143
  27.  
  28.  
  29.  
  30. chann1reg      equ  $dff0a0       ;start of ch1 registers
  31. dmacon         equ  $dff096
  32. int_bf_int     equ     $dff01e
  33. int_bf_w       equ     $dff09c
  34. in_line        equ     0
  35. new_snd        equ     4
  36. sreset          equ     1
  37.  
  38. end_patt       equ     8
  39. cr             equ     16
  40.  
  41.  
  42.  
  43.                move.w #1,d0
  44.                andi.w #0,d0
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52. ;     a0 points to channel vars
  53. ;     a1 reads  patt data/song data/envelope data
  54. ;     a2 points to ch reg locations
  55. ;     d0 used as general purpose register
  56. ;     d1 holds bits set for dma control reg
  57.  
  58.  
  59.  
  60.  
  61.  
  62. testloop:      jsr driver
  63.                jsr delay
  64.                bra  testloop
  65.  
  66. tstop:          nop
  67.                nop
  68.                nop
  69.                nop
  70.  
  71.  
  72.  
  73.  
  74.  
  75. delay:
  76. ddd:               move.w $dff006,d0
  77. ;               andi.w #%0000000011111111,d0
  78. ;               cmpi #0,d0
  79. ;               bne ddd
  80. ;                rts
  81.  
  82.  
  83.  
  84.  
  85.  
  86.                move.l #$06ff,d7
  87. delloop:       subq.l #$1,d7
  88.                cmpi.l #50,d7
  89.                bls findel
  90.                bra delloop
  91. findel:        rts
  92.  
  93. driver:
  94.       lea ch1vars,a0
  95.       lea chann1reg,a2
  96.       move.w #%1000001000000001,d1  ; enable ch 1
  97.       move.w #%0000000000000000,d2
  98.  
  99. ;        *****************************
  100. ;  this section checks channel current status
  101.  
  102. sect1:
  103.                cmpi.w #0,(a0)        ; for test disable
  104.                beq sect1_j1
  105.                rts
  106. sect1_j1       cmpi.w #0,2(a0)        ;counter at zero
  107.                beq sect3             ; get new note
  108.                cmpi.w #1,2(a0)
  109.                beq sect4
  110.  
  111.                cmpi.w #3,4(a0)        ;is it looped data
  112.                bhs sect2              ;branch if one shot
  113.         ; data is looped data
  114. mode_switch:   subq #1,2(a0)          ;decrease counter
  115.                move.l 18(a0),a1        ;envelope data needed ?
  116.                cmpi.w #255,(a1)
  117.                beq env_finished
  118.                move.w (a1)+,8(a2)     ;send vol data
  119.                move.l a1,18(a0)       ;store pointer
  120. env_finished:  rts                    ; finish
  121.  
  122. ;         *****************************
  123. ; this section checks 4(a0) and if it is 2 then it sends the one shot
  124. ; data in the vars buffer and sets 4(a0) to 3
  125. ; when flag is 3 the program sends the loop data to the reg and sets
  126. ; the flag to 4
  127. ; when the flag is 4 it checks the block finished interrupt and when
  128. ; set it sets the flag to 1 and jumps to mode_switch where the loop
  129. ; data is processed normally
  130. ; new note must check the flag 4(a0) and if it is 1 then reset it 2
  131. ;
  132.  
  133. ;      flag must be 3 or 4
  134. sect2:
  135.                cmpi.w #4,4(a0)
  136.                beq part3        ;to check for block finished
  137.                bra part2        ;flag is 3,send loop data
  138. ;    part 1 send one shot data to chip
  139. one_shot_note: move.w  #3,4(a0)         ;set flag
  140.                move.l 38(a0),(a2)
  141.                move.w 42(a0),4(a2)
  142.                move.w #64,8(a2)
  143.                move.w d1,dmacon         ;start dma
  144.                rts
  145. ;    part 2 send loop data to chip
  146.  ;  move loop  data into register  from vars store
  147. part2:                                                  notyet:  
  148. ;               move.w 8(a0),d0       ;int mask bit
  149. ;               and int_bf_int,d0
  150. ;               cmpi.w #0,d0
  151. ;               beq notyet
  152. ;               move.w d0,int_bf_w
  153.  
  154.                move.w  #4,4(a0)      ;flag to 4
  155.                move.l 44(a0),(a2)
  156.                move.w 48(a0),4(a2)
  157.                subq #1,2(a0)           ;decrease count
  158.                rts
  159.  
  160. part3:   ;      clr.l d0
  161.          ;      move.w 8(a0),d0
  162.          ;      and int_bf_int,d0
  163.          ;      cmpi #0,d0
  164.  
  165. ;               bset  d0,int_bf_int    ;test int set
  166. ;               bne block_done
  167.                                   ;  block still playing
  168.                subq #1,2(a0)      ;dec count
  169.                rts
  170.  
  171.  
  172. block_done:    move.w #1,4(a0)   ;   flag to loop
  173.                bra mode_switch
  174.  
  175.  
  176.  
  177. ;          *****************************
  178.  
  179. ; this section gets new note data
  180.  
  181. sect3:
  182. ;               move.w 8(a0),d0
  183. ;               move.w d0,int_bf_w
  184.  
  185.                move.l 22(a0),a1     ;get patt pointer
  186. control_ret:   move.w (a1)+,d0       ;next data to d0/pointer inc
  187.                cmpi.w #100,d0         ;control marker
  188.                bls  sect5            ;effects flags
  189.        ;d1 holds next note pitch
  190.                move.w d0,12(a0)     ;store in curr pitch
  191.               move.w d0,6(a2)      ;pitch to reg
  192.                move.w (a1)+,2(a0)   ;store count
  193.                subq.w #1,2(a0)      ;and decrease
  194.                move.l a1,22(a0)     ;store patt pointer
  195.                move.l 34(a0),18(a0) ; reset env pointer
  196. ;               move.w #64,8(a2)
  197.  
  198.                cmpi.w #0,4(a0)
  199.                beq do_loop
  200.                bra one_shot_note              ;jump there
  201.  
  202.  ;     loop data trigger
  203. do_loop:       move.w d1,dmacon     ;start dma for current channel
  204.                rts
  205.  
  206.  
  207.       ;      ***********************************
  208. sect4:
  209.  
  210.  
  211.  
  212.                move.w #%0000000000000001,dmacon     ;dma off
  213.                subq.w #1,2(a0)
  214.                rts
  215.  
  216.       ;      ***********************************
  217.       ;  effects flags  d0 holds jump offset
  218. sect5:          move.l #jump_table,a3
  219.                 move.l (a3,d0),a4
  220.                 jmp (a4)
  221.  
  222.  
  223. jump_table:     defl   in_line_data
  224.                 defl   nsound
  225.                 defl   patt_end
  226.                 nop
  227.                 nop
  228. in_line_data:
  229. ;             data format = reg offset,data,etc....,end_data
  230.                nop
  231.                rts
  232.  
  233.  
  234.  
  235. nsound:        move.l (a1)+,a3          ;sound address to a3
  236.                cmpi.w #0,(a3)
  237.                bne one_shot_sound
  238.                move.w (a3)+,4(a0)       ;loop or one shot flag
  239.                move.l (a3)+,(a2)          ;data address
  240.                move.w (a3),4(a2)       ;length
  241.                jmp control_ret
  242.  
  243. one_shot_sound:
  244.                move.w (a3)+,4(a0)
  245.                move.l (a3)+,38(a0)     ;store
  246.                move.l (a3)+,42(a0)
  247.                move.l (a3),46(a0)
  248.                jmp control_ret
  249.  
  250. patt_end:
  251. ;      get next patt address from song part
  252.                move.l 26(a0),a1        ;song pos to a1
  253. song_cont_ret:  cmpi.l #0,(a1)          ;song marker ??
  254.                beq song_control
  255.                addq.l  #4,a1
  256.                move.l a1,26(a0)        ;store song pointer
  257.                move.l (a1),a1          ;patt address to a1
  258.                jmp control_ret
  259.  
  260.  
  261. song_control:
  262. ;    reset song to start
  263.                 addq.l #4,a1
  264.                 cmpi.l #255,(a1)
  265.                 beq tstop
  266.                 move.l 30(a0),a1
  267.                 bra song_cont_ret
  268.  
  269.  
  270.  
  271.  
  272. ch1vars         defw 0         ; test disable           +0
  273.                 defw 0         ; interrupt counter      +2
  274.                 defw 0         ; 1 = loop/one shot mode flag +4
  275.                 defw 0         ; current pitch          + 6
  276.  
  277.                 defw %0000000010000000        ;bit number for int read
  278.                 defw 0        ;
  279.                 defw 0        ;
  280.                 defw 0        ;
  281.                 defw 0        ;
  282.  
  283.                 defl env1     ; env pointer            +18
  284.                 defl p1       ; patt pointer          +22
  285.                 defl s1        ; curr song pointer     +26
  286.                 defl s1        ; reset song pointer    +30
  287.                 defl env1      ; reset env pointer     +34
  288. ;  section used to store current sound data
  289.  
  290.                defl 0         ; one shot data  address  +38
  291.                 defw 0        ; one shot data length    +42
  292.                 defl 0        ; loop data address       +46
  293.                 defw 0        ; loop data length        +50
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303. s1:            defl p1,p1,p1,0,sreset
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311. p1:            defw new_snd
  312.                defl snd2
  313.                defw  d02,cr,d02,cr,d02,cr,d02,cr/2,d02,cr/2
  314.                defw  d02,cr,d02,cr,d02,cr,d02,cr/2,d02,cr/2
  315.                defw  b02,cr,d02,cr,a02,cr,b02,cr/2,d02,cr/2
  316.                defw  c02,cr,d02,cr,a02,cr,g02,cr/2,d02,cr/2
  317.                defw end_patt
  318.  
  319.  
  320.  
  321.  
  322.  
  323. snd1       defw 0   ;loop data
  324.            defl sda    ;data address
  325.            defw 16  ;length
  326.  
  327. snd2       defw 1   ;one_shot_flag
  328.            defl koto1
  329.            defw 1280 ;length
  330.            defl rest_data    ;data address
  331.            defw 16     ;length
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339. sda:       defb 0,90,127,-90,-127,-90
  340.            defb 0,90,127,-90,-127,-90
  341.            defb 0,90,127,-90,-127,-90
  342.            defb 0,90,127,-90,-127,-90
  343.            defb 0,90,127,-90,-127,-90
  344.            defb 0,90,127,-90,-127,-90
  345.            defb 0,90,127,-90,-127,-90
  346.  
  347.  
  348.  
  349.  
  350. rest_data:
  351. ;          length=24 words
  352.            defw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  353.  
  354. env1:      defw 64,64,64,64,22,20,20,20,20,20,10,10,0
  355.            defw 12,20,24,26,30,40,50,60,255
  356.  
  357.                align.w
  358. koto1:
  359.                ibytes koto1
  360.  
  361.  
  362.  
  363.  
  364.                            end
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.