home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / PROGTOOL / PASSDK30.ZIP;1 / DISK1.ZIP / PAS / SUBS / PCM / PCMIOA.ASM < prev    next >
Encoding:
Assembly Source File  |  1993-03-24  |  16.6 KB  |  738 lines

  1. ;$Author:   DCODY  $
  2. ;$Date:   24 Mar 1993 10:19:32  $
  3. ;$Header:   X:/sccs/pcm/pcmioa.asv   1.11   24 Mar 1993 10:19:32   DCODY  $
  4. ;$Log:   X:/sccs/pcm/pcmioa.asv  $
  5. ;  
  6. ;     Rev 1.11   24 Mar 1993 10:19:32   DCODY
  7. ;  removed common.inc as an include
  8. ;  
  9. ;     Rev 1.10   10 Feb 1993 10:21:48   DCODY
  10. ;  added "FFAR ptr" to a couple calls to internal routines.
  11. ;  
  12. ;     Rev 1.9   09 Feb 1993 08:29:52   DCODY
  13. ;  removed the compile switches that creates separate .OBJs from this source.
  14. ;  This file is now compiled just once.
  15. ;  
  16. ;     Rev 1.8   03 Feb 1993 12:10:30   DCODY
  17. ;  No change.
  18. ;  
  19. ;     Rev 1.7   08 Dec 1992 17:15:00   DCODY
  20. ;  moved externADDR macro for Borland link.
  21. ;  
  22. ;     Rev 1.6   20 Oct 1992 10:09:08   DCODY
  23. ;  adjusted tiny model .data declaration and segment use. removed binary.inc
  24. ;  as an include file.
  25. ;  
  26. ;     Rev 1.5   06 Oct 1992 16:00:44   DCODY
  27. ;  added direct dos read/write file routines.
  28. ;  
  29. ;     Rev 1.4   23 Sep 1992 10:57:04   DCODY
  30. ;  more work on playthisblock, continuethisblock...
  31. ;  
  32. ;     Rev 1.3   26 Aug 1992 10:58:26   DCODY
  33. ;  added Playthisblock and RecordthisBlock support routines
  34. ;  
  35. ;     Rev 1.2   12 Aug 1992 17:10:56   DCODY
  36. ;  major change to eliminate the foreground buffers and background
  37. ;  processing responsibilities.
  38. ;  
  39. ;     Rev 1.1   23 Jun 1992 17:11:34   DCODY
  40. ;  PAS2 update
  41. ;  
  42. ;     Rev 1.0   15 Jun 1992 09:44:36   BCRANE
  43. ;  Initial revision.
  44. ;$Logfile:   X:/sccs/pcm/pcmioa.asv  $
  45. ;$Modtimes$
  46. ;$Revision:   1.11  $
  47. ;$Workfile:   pcmioa.asm  $ 
  48.  
  49.  
  50.     page    64,131
  51.     Title    PCMIOA    --  Background Task for PCM I/O
  52.  
  53. ;   /*\
  54. ;---|*|------------====< PCMIOA.ASM >====------------
  55. ;---|*|
  56. ;---|*| Copyright (c) 1991, Media Vision, Inc. All rights reserved
  57. ;---|*|
  58. ;   \*/
  59.  
  60.         .xlist
  61.     include model.inc
  62.     include masm.inc
  63.     .list
  64.  
  65. ;
  66. ;-----------------------================================-----------------------
  67. ;-----------------------====< Code/Data Generation >====-----------------------
  68. ;-----------------------================================-----------------------
  69. ;
  70.  
  71.     externADDR    InitPCM         ; initialize the PCM low level code
  72.     externADDR    StopPCM         ; Kill the PCM hardware
  73.     externADDR    PCMPlay         ; start the PCM output
  74.     externADDR    PCMRecord        ; start the PCM input
  75.     externADDR    UserFunc        ; sets up the call-back routine
  76.  
  77. ;
  78. ;---------------------------========================---------------------------
  79. ;---------------------------====< DATA SECTION >====---------------------------
  80. ;---------------------------========================---------------------------
  81. ;
  82. if MODELSIZE eq 0
  83.     .code
  84. else
  85.     .data
  86. endif
  87.  
  88. ;
  89. ; Code Model Dependencies
  90. ;
  91. if @datasize
  92.   cptr    equ    <dword>         ; C pointer is FAR
  93. else
  94.   cptr    equ    <word>            ; C pointer is NEAR
  95. endif
  96.  
  97. NODIRECTION    equ    0
  98. DMAINPUT    equ    1
  99. DMAOUTPUT    equ    2
  100.  
  101. PCMFILEINPUT    equ    DMAINPUT
  102. PCMFILEOUTPUT    equ    DMAOUTPUT
  103. PCMBLOCKINPUT    equ    DMAINPUT+80h
  104. PCMBLOCKOUTPUT    equ    DMAOUTPUT+80h
  105.  
  106. ;
  107. ; Structure Definitions
  108. ;
  109. buffptr struc
  110.  
  111.  BPstatus       dw      0               ; 0=empty, 1=full
  112.  BPcount    dw    0        ; # of bytes in the buffer
  113.  BPsize     dw    0        ; total size of allocated buff
  114.  BPbuffer    dd    0        ; pointer to buffer data
  115.  
  116.   if @datasize
  117.    BPnextptr    dd    0        ; pointer to buffer data
  118.   else
  119.    BPnextptr    dw    0        ; pointer to buffer data
  120.   endif
  121.  
  122. buffptr ends
  123.  
  124. ;
  125. ;--------------====< code generation dependent declarations >====------------
  126. ;
  127.  
  128. ;
  129. ; Local data declarations
  130. ;
  131.     public    CountdownBuffers
  132. CountdownBuffers    db    00    ; countdown value
  133.     public    NextDMAPtr
  134. NextDMAPtr        dd    00    ; our pointer to the DMA's buffer
  135.     public    DMAUnitSize
  136. DMAUnitSize        dw    00    ; size of DMA buffer divisions
  137.  
  138.     public    __callersroutine
  139.   if @codesize
  140. __callersroutine        dd      00
  141.   else
  142. __callersroutine    dw    00
  143.   endif
  144.  
  145.     externPTR    HeadOfBuffers        ; pointer to buffer linked list
  146.     extrn    BufferDataCount  :word    ; # of full buffers (0=done)
  147.     extrn    DMARunning     :word    ; DMA status (0=off,1=running)
  148.     extrn    StartOfDMABuffer :dword ; always a far * to start of DMA buffer
  149.     extrn __pcmdatasize     :byte    ; default to 8 bit pcm
  150.     extrn    MaxBuffCount     :word    ; count of DMA blocks
  151.     extrn    ProcessedBlockCount:word; # of full buffers (0=done)
  152.     extrn    __synccallback     :dword ; callback to application at int
  153.     extrn    __fptrpos     :dword ; file position byte count pointer
  154.  
  155. ;
  156. ;---------------------------========================---------------------------
  157. ;---------------------------====< CODE SECTION >====---------------------------
  158. ;---------------------------========================---------------------------
  159. ;
  160.         .code
  161.  
  162.  
  163. ;   /*\
  164. ;---|*|------------====< BackgroundInit( int, int ) >====------------
  165. ;---|*|
  166. ;---|*| Initialize our internal variables, etc...
  167. ;---|*|
  168. ;---|*| Entry Conditions:
  169. ;---|*|     wParm1 - Size of DMA buffer
  170. ;---|*|     wParm2 - # of DMA buffer divisions
  171. ;---|*|
  172. ;---|*| Exit Conditions:
  173. ;---|*|     No return value
  174. ;---|*|
  175. ;---|*| Functionality:
  176. ;---|*|
  177. ;---|*|     Clear interrupt mechanisms.
  178. ;---|*|     Disable DMA channel.
  179. ;---|*|     Set DMARunning to 0;
  180. ;---|*|
  181. ;   \*/
  182.  
  183.         public  BackgroundInit
  184. BackgroundInit    proc
  185.     push    bp
  186.     mov    bp,sp
  187.     push    es
  188. ;
  189. ; get the # of buffers in the linked list
  190. ;
  191.     mov    ax,wParm1
  192.     mov    [DMAUnitSize],ax    ; max size of each DMA division
  193. ;
  194. ; flush any prior low-level setup
  195. ;
  196.     call    InitPCM
  197.     mov    DMARunning,0        ; signal it dead
  198. ;
  199. ; all done, return home
  200. ;
  201.     pop    es
  202.     pop    bp
  203.     ret
  204.  
  205. BackgroundInit    endp
  206.  
  207.  
  208. ;   /*\
  209. ;---|*|------------====< _dofread ( char far *, int, int ) >====------------
  210. ;---|*|
  211. ;---|*| Replacement code for the fread C library function. This will also
  212. ;---|*| keep track of the file position.
  213. ;---|*|
  214. ;---|*| Entry Conditions:
  215. ;---|*|     char far * is a pointer to the buffer
  216. ;---|*|     int - Length of the buffer
  217. ;---|*|     int - file handle
  218. ;---|*|
  219. ;---|*| Exit Conditions:
  220. ;---|*|     AX holds the length read from disk
  221. ;---|*|
  222. ;   \*/
  223.  
  224.     public    _dofread
  225. _dofread    proc
  226.     push    bp
  227.     mov    bp,sp
  228.     push    ds
  229.  
  230.         lds     dx,wParm1               ; get the buffer
  231.     mov    cx,wParm3        ; get the length
  232.     mov    bx,wParm4        ; get the handle
  233.     mov    ah,3fh            ; read command
  234.  
  235.     int    21h
  236.  
  237.     pop    ds
  238.  
  239.         cmc                             ; set carry if good read
  240.     sbb    bx,bx
  241.     and    ax,bx
  242.     add    wptr [__fptrpos+0],ax
  243.     adc    wptr [__fptrpos+2],0
  244.  
  245.     pop    bp
  246.     ret
  247.  
  248. _dofread    endp
  249.  
  250.  
  251. ;   /*\
  252. ;---|*|--------------====< FlushBuffer >====-----------------
  253. ;---|*|
  254. ;---|*| Flush the buffer by filling it with silence (value of 0x80)
  255. ;---|*|
  256. ;---|*| Entry Conditions:
  257. ;---|*|       dParm1 is the far pointer to the block
  258. ;---|*|       wParm2 is an unsigned integer which is the block length
  259. ;---|*|
  260. ;---|*| Exit Conditions:
  261. ;---|*|       DX:AX hold the ending pointer
  262. ;---|*|
  263. ;---|*| Prototype:
  264. ;---|*|
  265. ;---|*| char far * FlushBuffer (char far *, int)
  266. ;---|*|
  267. ;---|*|
  268. ;   \*/
  269.  
  270.         public  FlushBuffer
  271. FlushBuffer    proc
  272.     push    bp
  273.     mov    bp,sp
  274.  
  275.     push    es
  276.     push    di
  277.  
  278.     pushf
  279.     cld
  280.  
  281.     les    di,dParm1        ; grab 2 words off the stack
  282.     mov    cx,wParm3        ; wParm3 is used to skip the 2nd word
  283.  
  284.     cmp    [__pcmdatasize],9    ; 8 bit sets the carry
  285.     sbb    al,al            ; al = ff if 8 bit PCM
  286.     and    al,80h            ; al = 80 if 8 bit, 00 if 16 bit
  287.  
  288.     jcxz    @F
  289.     rep    stosb
  290.     @@:
  291.  
  292.     mov    dx,es            ; return the ending ptr
  293.     mov    ax,di
  294.  
  295.         popf
  296.  
  297.     pop    di
  298.     pop    es
  299.     pop    bp
  300.     ret
  301.  
  302. FlushBuffer    endp
  303.  
  304.  
  305. ;   /*\
  306. ;---|*|------------====< _dofwrite ( char far *, int, int ) >====------------
  307. ;---|*|
  308. ;---|*| Replacement code for the fwrite C library function. This will also
  309. ;---|*| keep track of the file position.
  310. ;---|*|
  311. ;---|*| Entry Conditions:
  312. ;---|*|     char far * is a pointer to the buffer
  313. ;---|*|     int - Length of the buffer
  314. ;---|*|     int - file handle
  315. ;---|*|
  316. ;---|*| Exit Conditions:
  317. ;---|*|     AX holds the length writtent to disk
  318. ;---|*|
  319. ;   \*/
  320.     public    _dofwrite
  321. _dofwrite    proc
  322.     push    bp
  323.     mov    bp,sp
  324.     push    ds
  325.  
  326.         lds     dx,wParm1               ; get the buffer
  327.     mov    cx,wParm3        ; get the length
  328.     mov    bx,wParm4        ; get the handle
  329.     mov    ah,40h            ; write command
  330.  
  331.     int    21h
  332.  
  333.         pop     ds
  334.  
  335.     cmc                ; set carry if good read
  336.     sbb    bx,bx
  337.     and    ax,bx
  338.     add    wptr [__fptrpos+0],ax
  339.     adc    wptr [__fptrpos+2],0
  340.  
  341.     pop    bp
  342.     ret
  343.  
  344. _dofwrite    endp
  345.  
  346.  
  347. ;   /*\
  348. ;---|*|------------====< StartTheDMAInput() >====------------
  349. ;---|*|
  350. ;---|*| Calculate the H/W timer value (internal routine)
  351. ;---|*|
  352. ;---|*| Entry Conditions:
  353. ;---|*|       pointer to a routine
  354. ;---|*|
  355. ;---|*| Exit Conditions:
  356. ;---|*|       AX =  0 indicates DMA running
  357. ;---|*|       AX = -1 indicates a failure
  358. ;---|*|
  359. ;---|*| Functionality:
  360. ;---|*|
  361. ;---|*|     Reset input pointer to the DMA buffer.
  362. ;---|*|     Load next buffer of data into the DMA buffer.
  363. ;---|*|     Enable DMA & interrupts.
  364. ;---|*|     Set DMARunning to 1;
  365. ;---|*|
  366. ;   \*/
  367.  
  368.     public StartTheDMAInput
  369. StartTheDMAInput        proc
  370.     push    bp
  371.     mov    bp,sp
  372.  
  373.         push    es
  374. ;
  375. ; Reset the DMA's internal buffer pointer & counter
  376. ;
  377.     call    FFAR ptr _resetdmaptrs    ; reset the criticals
  378. ;
  379. ; Validate some critical data
  380. ;
  381.     mov    ax,-1            ; setup for bad return
  382.  
  383.     cmp    DMAUnitSize,0        ; we must have a valid size of units
  384.     jz    stdmaout_bad
  385.  
  386.     les    bx,[NextDMAPtr]     ; we must have a valid DMA buffer
  387.     mov    cx,es
  388.     or    bx,cx
  389.         jz      stdmaout_bad
  390. ;
  391. ; setup the callers callback
  392. ;
  393.       if @codesize
  394.     mov    ax,wParm1+0
  395.     mov    dx,wParm1+2
  396.     mov    wptr [__callersroutine+0],ax
  397.     mov    wptr [__callersroutine+2],dx
  398.       else
  399.         mov     ax,wParm1+0
  400.     mov    [__callersroutine],ax
  401.       endif
  402. ;
  403. ; setup our call-back routine
  404. ;
  405.     lea    ax,InputBackgroundTask
  406.     push    cs
  407.     push    ax
  408.     call    UserFunc
  409.     add    sp,4
  410. ;
  411. ; The DMA is loaded, let'er rip!!!
  412. ;
  413.     call    PCMRecord
  414.     mov    DMARunning,1
  415.  
  416.     sub    ax,ax
  417. ;
  418. stdmaout_bad:
  419.     pop    es
  420.     pop    bp
  421.     ret
  422.  
  423. StartTheDMAInput    endp
  424.  
  425.  
  426. ;   /*\
  427. ;---|*|------------====< StartTheDMAOutput() >====------------
  428. ;---|*|
  429. ;---|*| Calculate the H/W timer value (internal routine)
  430. ;---|*|
  431. ;---|*| Entry Conditions:
  432. ;---|*|       None
  433. ;---|*|
  434. ;---|*| Exit Conditions:
  435. ;---|*|       AX =  0 indicates DMA running
  436. ;---|*|       AX = -1 indicates a failure
  437. ;---|*|
  438. ;---|*| Functionality:
  439. ;---|*|
  440. ;---|*|     Reset input pointer to the DMA buffer.
  441. ;---|*|     Load next buffer of data into the DMA buffer.
  442. ;---|*|     Enable DMA & interrupts.
  443. ;---|*|     Set DMARunning to 1;
  444. ;---|*|
  445. ;   \*/
  446.  
  447.     public    StartTheDMAOutput
  448. StartTheDMAOutput       proc
  449.         push    bp
  450.         mov     bp,sp
  451.     push    es
  452. ;
  453. ; Reset the DMA's internal buffer pointer & counter
  454. ;
  455.     call    FFAR ptr _resetdmaptrs    ; reset the criticals
  456. ;
  457. ; Validate some critical data
  458. ;
  459.     mov    ax,-1            ; setup for bad return
  460.  
  461.     cmp    DMAUnitSize,0        ; we must have a valid size of units
  462.     jz    stdmaout_bad
  463.  
  464.     les    bx,[NextDMAPtr]     ; we must have a valid DMA buffer
  465.     mov    cx,es
  466.     or    bx,cx
  467.         jz      stdmaout_bad
  468. ;
  469. ; setup the callers callback
  470. ;
  471.       if @codesize
  472.     mov    ax,wParm1+0
  473.     mov    dx,wParm1+2
  474.     mov    wptr [__callersroutine+0],ax
  475.     mov    wptr [__callersroutine+2],dx
  476.       else
  477.         mov     ax,wParm1+0
  478.     mov    [__callersroutine],ax
  479.       endif
  480. ;
  481. ; setup our call-back routine
  482. ;
  483.     lea    ax,OutputBackgroundTask
  484.     push    cs
  485.     push    ax
  486.     call    UserFunc
  487.     add    sp,4
  488. ;
  489. ; The DMA is loaded, let'er rip!!!
  490. ;
  491.     call    PCMPlay
  492.     mov    DMARunning,1
  493.  
  494.     sub    ax,ax
  495. ;
  496. stdmaout_bad:
  497.     pop    es
  498.         pop     bp
  499.     ret
  500.  
  501. StartTheDMAOutput    endp
  502.  
  503.  
  504. ;
  505. ;--------------------------=============================-----------------------
  506. ;--------------------------====< Internal Routines >====-----------------------
  507. ;--------------------------=============================-----------------------
  508. ;
  509.  
  510. ;   /*\
  511. ;---|*|------------====< InputBackgroundTask() >====------------
  512. ;---|*|
  513. ;---|*| This is the interrupt code for processing DMA-buffer-has-data interrupts
  514. ;---|*|
  515. ;---|*| Entry Conditions:
  516. ;---|*|     None
  517. ;---|*|
  518. ;---|*| Exit Conditions:
  519. ;---|*|     None
  520. ;---|*|
  521. ;---|*| Interrupt handling:
  522. ;---|*|
  523. ;---|*|     if Next Buffer has data,
  524. ;---|*|     Kill-the-DMA;
  525. ;---|*|     set DMARunning to 0;
  526. ;---|*|     exit interrupt.
  527. ;---|*|     else
  528. ;---|*|        Load DMA into Next buffer.
  529. ;---|*|
  530. ;---|*|     Increment BufferDataCount.
  531. ;---|*|
  532. ;   \*/
  533.  
  534. InputBackgroundTask    proc
  535.     push    ax            ; save the entire state
  536.     push    bx
  537.     push    cx
  538.     push    dx
  539.     push    si
  540.     push    di
  541.     push    ds
  542.     push    es
  543. ;
  544. ; initialize the segment registers to point to our local static segment
  545. ;
  546. if MODELSIZE eq 0
  547.     mov    ax,cs            ; load our data segment
  548.         mov     ds,ax                   ; DS too in case of failure
  549. else
  550.         mov     ax,@data                ; load our data segment
  551.     mov    ds,ax            ; DS too in case of failure
  552. endif
  553.  
  554. ;
  555. ; Save the next DMA pointer, increment our internal buffer-loaded count
  556. ;
  557.         inc     ProcessedBlockCount     ; total block count the DMA has seen
  558.         inc     BufferDataCount         ; tell the world, we have new data
  559.     mov    ax,BufferDataCount
  560.     cmp    ax,MaxBuffCount
  561.     jb    inbkgrtsk_exit
  562. ;
  563. ; Yuck! We just ran out of buffer space, we must kill the DMA
  564. ;
  565.         call    StopPCM                 ; kill the interrupts...
  566.     mov    DMARunning,0
  567. ;
  568. inbkgrtsk_exit:
  569.   if @codesize
  570.     cmp    wptr [__callersroutine+2],0  ; if there is no vector, just exit
  571.     jz    @F
  572.     call    dptr [__callersroutine]      ; call the user routine
  573.       @@:
  574.   else
  575.     cmp    wptr [__callersroutine],0    ; if there is no vector, just exit
  576.     jz    @F
  577.     call    wptr [__callersroutine]      ; call the user routine
  578.       @@:
  579.   endif
  580. ;
  581. ; Call the application level it it wants a slice of time...
  582. ;
  583.         cmp     wptr [__synccallback+2],0    ; if no App. vector, just exit
  584.     jz    @F
  585.     call    dptr [__synccallback]         ; if no App. vector, just exit
  586.     @@:
  587. ;
  588. ; finally, all done.
  589. ;
  590.         pop     es
  591.     pop    ds
  592.     pop    di
  593.     pop    si
  594.     pop    dx
  595.     pop    cx
  596.     pop    bx
  597.     pop    ax
  598.     retf
  599.  
  600. InputBackgroundTask    endp
  601.  
  602.  
  603. ;   /*\
  604. ;---|*|------------====< OutputBackgroundTask() >====------------
  605. ;---|*|
  606. ;---|*| This is the interrupt code for processing DMA buffer
  607. ;---|*| empty interrupts for the file output routines.
  608. ;---|*|
  609. ;---|*| Entry Conditions:
  610. ;---|*|     None
  611. ;---|*|
  612. ;---|*| Exit Conditions:
  613. ;---|*|     None
  614. ;---|*|
  615. ;---|*| Interrupt handling:
  616. ;---|*|
  617. ;---|*|     If BufferDataCount       is zero,
  618. ;---|*|     Kill-the-DMA;
  619. ;---|*|     set DMARunning to 0;
  620. ;---|*|
  621. ;---|*|     Attempt to load as many blocks as possible into the DMA buffer.
  622. ;---|*|
  623. ;---|*|     If data is loaded and DMARunning = 0,
  624. ;---|*|     restart the DMA;
  625. ;---|*|     set DMARunning to -1;
  626. ;---|*|
  627. ;---|*|     Exit interrupt.
  628. ;---|*|
  629. ;   \*/
  630.  
  631. OutputBackgroundTask    proc
  632.     push    ax            ; save the entire state
  633.     push    bx
  634.     push    cx
  635.     push    dx
  636.     push    si
  637.     push    di
  638.     push    ds
  639.     push    es
  640. ;
  641. ; initialize the data segment to point to our local static segment
  642. ;
  643. if MODELSIZE eq 0
  644.     mov    ax,cs            ; load our data segment
  645.         mov     ds,ax                   ; DS too in case of failure
  646. else
  647.         mov     ax,@data                ; load our data segment
  648.     mov    ds,ax
  649. endif
  650. ;
  651. ; We just finished a block. If done (0), stop the DMA, else go load another
  652. ;
  653.     inc    ProcessedBlockCount    ; total block count the DMA has seen
  654.         sub     BufferDataCount,1       ; decrement the internal buffered data
  655.     adc    BufferDataCount,0    ; count down to zero
  656.     jnz    bkgrtsk_05        ; more data, go load it...
  657. ;
  658. ; Yuck! We just ran out of data, we must silence the DMA
  659. ;
  660.     call    StopPCM         ; kill the interrupts...
  661.     mov    DMARunning,0
  662. ;
  663. bkgrtsk_05:
  664.   if @codesize
  665.     cmp    wptr [__callersroutine+2],0  ; if there is no vector, just exit
  666.     jz    @F
  667.     call    dptr [__callersroutine]      ; call the user routine
  668.       @@:
  669.   else
  670.     cmp    wptr [__callersroutine],0    ; if there is no vector, just exit
  671.     jz    @F
  672.         call    wptr [__callersroutine]      ; call the user routine
  673.       @@:
  674.   endif
  675. ;
  676. ; Call the application level it it wants a slice of time...
  677. ;
  678.         cmp     wptr [__synccallback+2],0    ; if no App. vector, just exit
  679.     jz    @F
  680.     call    dptr [__synccallback]         ; if no App. vector, just exit
  681.     @@:
  682. ;
  683. ; finally, all done.
  684. ;
  685.         pop     es
  686.     pop    ds
  687.     pop    di
  688.     pop    si
  689.     pop    dx
  690.     pop    cx
  691.     pop    bx
  692.     pop    ax
  693.     retf
  694.  
  695. OutputBackgroundTask    endp
  696.  
  697.  
  698. ;
  699. ;   /*\
  700. ;---|*|------------====< _resetdmaptrs >====----------------
  701. ;---|*|
  702. ;---|*| Reset the DMA starting point
  703. ;---|*|
  704. ;---|*| Entry Conditions:
  705. ;---|*|     DS points to the default data segment
  706. ;---|*|
  707. ;---|*| Exit Conditions:
  708. ;---|*|     None
  709. ;---|*|
  710. ;   \*/
  711.  
  712. _resetdmaptrs    proc
  713.     push    es
  714. ;
  715. ; load the number of buffer divisions. this tells us when to wrap the DMA buff
  716. ;
  717.     mov    al,byte ptr [MaxBuffCount]
  718.     mov    [CountdownBuffers],al
  719. ;
  720. ; reset the DMA buffer offset
  721. ;
  722.     les    ax,[StartOfDMABuffer]
  723.     mov    wptr [NextDMAPtr+0],ax
  724.     mov    wptr [NextDMAPtr+2],es
  725.  
  726.         pop     es
  727.     ret
  728.  
  729. _resetdmaptrs   endp
  730.  
  731.  
  732. ;   /*\
  733. ;---|*| end of PCMIOA.ASM
  734. ;   \*/
  735.  
  736.         end
  737.  
  738.