📄 dma-fdc.s
字号:
dma_setup: # set the location of read buffer into es:bx and call dma_setup # this routine will communicate this addr to dma controller, # tell num of sect is 1, and open ch 2, and enable dma 1 # To use this routine, fdc shoud put the addr of read buf into es:bx # and be ready to accept data from dma controllerdma_disble: # disable DMA 1outb $0x14, $0x8 # output 0001 0100 to comand register to diable and init 8237amode: # setup DMA mode for channel 2outb $0x56, $0xb # output 0101 0110 to mode register # single transfer, addr increment, no autoinit, write, ch 2split_address: # split addr in es:bx into pppp hhhh hhhh llll llll # es was ssss ssss ssss ssss, bx was oooo oooo oooo oooo # the physical addr is # ssss ssss ssss ssss 0000 + oooo oooo oooo oooo # = pppp hhhh hhhh llll llll movw %es, %ax # load ssss ssss ssss ssss (the location of read buffer) to ax # es points to the base of read buf into which dma will write # data it reads from floppymovb $0x4, %cl # load count value into clshlw %cl, %ax # ax now becomes ssss ssss ssss oooo addw %bx, %ax # add offset. ax is now hhhh hhhh llll lllljc carryno_carry:movw %es, %bx # bx now has ssss ssss ssss ssssmovb $0x4, %cl # shrb %cl, %bh # bh now has ppppjmp buffer_addresscarry:movw %es, %bx # bx has ssss ssss ssss ssssmovb $0x4, %clshrb %cl, %bh # bh has high ssssadc $0x0, %bh # bh now has ppppbuffer_address: # output address to 8237a and page registeroutb %al, $0xc # reset flip-flopoutb %al, $0x4 # output low-order address byte nnnn nnnn to addr registermovb %ah, %al # load high-order address byte hhhh hhhh into aloutb %al, $0x4 # output high-order address byte hhhh hhhh to addr registermovb %bh, %al # load page value pppp into aloutb %bh, $0x81 # load page register with ppppcount_value: # load count register with value 511 to transfer 512 bytesoutb %al, $0xc # rest flip-flopoutb $0xff, $0x5 # load low-order byte 255 of count value into count registeroutb $0x1, $0x5 # load high-order byte 1 of count value into count registerchannel_unmask: # release eventual channel maskingoutb $0x2, $0xa # output 0000 0010 to release channel 2dma1_enable: # enable DMA 1outb $0x10, $0x8 # output 0001 0000 to command register to enable 8237a.ret
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -