ISA DMA: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
m (Bot: Replace deprecated source tag with syntaxhighlight)
(→‎ISA DMA Background: Yes, this kind of an appendix.)
Line 23: Line 23:


== ISA DMA Background ==
== ISA DMA Background ==
'''ISA DMA''' (''Industry Standard Architecture Direct Memory Access''), like ISA itself, is an appendix for modern PCs. It is used by the
'''ISA DMA''' (''Industry Standard Architecture Direct Memory Access''), like ISA itself, is an [https://en.wikipedia.org/wiki/Appendix_(anatomy) appendix] for modern PCs. It is used by the
internal floppy disk controller, ISA sound cards, ISA network cards, and parallel ports (if they support ECP mode). Whilst interrupt, keyboard
internal floppy disk controller, ISA sound cards, ISA network cards, and parallel ports (if they support ECP mode). Whilst interrupt, keyboard
and timer interface circuits have obvious and relevant uses, the ISA DMA controller and its programming interface are still well and truly stuck in the
and timer interface circuits have obvious and relevant uses, the ISA DMA controller and its programming interface are still well and truly stuck in the
Line 496: Line 496:
bus. Real code should separate the two "out 0x4" and "out 0x5" calls with an "out" to some other port.
bus. Real code should separate the two "out 0x4" and "out 0x5" calls with an "out" to some other port.


<syntaxhighlight lang="asm">
<source lang="asm">
initialize_floppy_DMA:
initialize_floppy_DMA:
; set DMA channel 2 to transfer data from 0x1000 - 0x33ff in memory
; set DMA channel 2 to transfer data from 0x1000 - 0x33ff in memory
Line 512: Line 512:
out 0x0a, 0x02 ; unmask DMA channel 2
out 0x0a, 0x02 ; unmask DMA channel 2
ret
ret
</source>
</syntaxhighlight>


Once you have set up your start address and transfer length you do not need to touch it again, if you are using autoinit. Once reading or writing
Once you have set up your start address and transfer length you do not need to touch it again, if you are using autoinit. Once reading or writing
is selected, you don't need to change that, either. To ''change'' selecting reading or writing you use the mode register.
is selected, you don't need to change that, either. To ''change'' selecting reading or writing you use the mode register.


<syntaxhighlight lang="asm">
<source lang="asm">
prepare_for_floppy_DMA_write:
prepare_for_floppy_DMA_write:
out 0x0a, 0x06 ; mask DMA channel 2 and 0 (assuming 0 is already masked)
out 0x0a, 0x06 ; mask DMA channel 2 and 0 (assuming 0 is already masked)
Line 531: Line 531:
out 0x0a, 0x02 ; unmask DMA channel 2
out 0x0a, 0x02 ; unmask DMA channel 2
ret
ret
</source>
</syntaxhighlight>


Some hardware, as well as VirtualPC do not support autoinit. You may want to set the Mode registers to 0x4A and 0x46 in the above routines, instead.
Some hardware, as well as VirtualPC do not support autoinit. You may want to set the Mode registers to 0x4A and 0x46 in the above routines, instead.