home *** CD-ROM | disk | FTP | other *** search
- {
- Example of use of "DMA" unit.
- }
-
-
- [ ... ]
-
-
- procedure Games_Sb16(dsize : word;p : pointer);
- {
- When using the DMA unit ....
- }
- var li : word;
- begin;
- DMA_Init_Transfer(dma_ch,Blockmode,p,dsize-1);
-
- if sb16_outputlength <> dsize then begin;
- wr_dsp_sb16($C6); { DSP command 8-bit via DMA }
- if stereo then { for SB16 Only for starting ! }
- wr_dsp_sb16($20)
- else
- wr_dsp_sb16($00);
- wr_dsp_sb16(Lo(dsize-1)); { size of block to }
- wr_dsp_sb16(Hi(dsize-1)); { DSP }
- sb16_outputlength := dsize;
- end else begin;
- wr_dsp_sb16($45); { DMA Continue SB16 8-Bit }
- end;
- end;
-
- [ ... ]
-
- procedure Games_Sb16(Segm,Offs,dsize : word);
- {
- Ohne die Unit DMA ....
- }
- var li : word;
- begin;
- port[$0A] := dma_ch+4; { lock DMA channel }
- Port[$0c] := 0; { buffer address (blk) }
- Port[$0B] := $49; { for sound output }
- {
- Error in source of the book !!!!!!!!!!!!!!
- should read
- Port[$0B] := $48 + dma_ch;
- !!!!!!!!!!!!!!!!!!!!
- }
- Port[dma_addr[dma_ch]] := Lo(offs); { to DMA-Controller }
- Port[dma_addr[dma_ch]] := Hi(offs);
- Port[dma_wc[dma_ch]] := Lo(dsize-1); { size of block (block size) }
- Port[dma_wc[dma_ch]] := Hi(dsize-1); { to DMA controller }
- Port[dma_page[dma_ch]] := Segm;
- if sb16_outputlength <> dsize then begin;
- wr_dsp_sb16($C6); { DSP command 8-Bit via DMA }
- if stereo then { for SB16 Only for starting ! }
- wr_dsp_sb16($20)
- else
- wr_dsp_sb16($00);
- wr_dsp_sb16(Lo(dsize-1)); { Size of block }
- wr_dsp_sb16(Hi(dsize-1)); { to DSP }
- sb16_outputlength := dsize;
- end else begin;
- wr_dsp_sb16($45); { DMA continue SB16 8-Bit }
- end;
- Port[$0A] := dma_ch; { free DMA channel }
- end;
-
-