ԶȡֵӶֿԽһݴ̡
2.IBM PC/XTУ8237Aͨ0ڶԶ̬RAMˢ£ΪԶԤùܡͷβһˢºֿԶɱˢ£ݲӶ̬RAMжʧͬһڴַݿظС
7.21 DMAڴ浽ڴĴʱʲôص㣿
𣺹̶ͨ0ĵַĴԴַͨ1ĵַĴֽڼĿĵַͼֵʱĿĵַͼֵͨһм11ԴֵַͨƼĴD1λãΪ1䡣ݴΪݴʱDMAݴá⣬DMAڴ浽ڴĴͨÿƼĴD0=1õġ
7.22 DMA8237Aȼģ
8237Aȼʽ̶ȼʽȼߵ̶Ϊͨ0123ѭȼʽͨȼѭijͨһδȼΪͣڵĸһͨȼΪߡ
7.23 8237Aijʼ8237AĶ˿ڵַΪ0000~000FH
ͨ0ڿ鴫ģʽַ1仯ԶԤùܣͨ1ڵֽڶ䣬ַ1仯ԶԤùܣͨ2ͨ3ͨ1ͬʽȻ8237AʹDACKΪߵƽЧDREQΪ͵ƽЧù̶ȼʽ8237
MOV AL04H MOV DXDMA+8 ;DMAΪ˿ַ0000HDMA+8ΪƼ ;˿ں OUT DXAL ;ر8237A MOV AL00
MOV DXDMA+0DH ;DMA+0DHΪ˿ں OUT DXAL ;(λ)
MOV DXDMA+0BH ;DMA+0BHΪģʽĴĶ˿ں MOV AL98H OUT DXAL ;ͨ0ѡģʽģʽΪ98Hģ
;ʽַ1仯ԶԤù MOV AL69H OUT DXAL ;ͨ1ѡģʽģʽΪ69Hֽڶ
;䣬ַ1仯ԶԤù MOV AL6AH OUT DXAL ;ͨ2ѡģʽģʽΪ6AH:ͬͨ1 MOV AL6BH OUT DXAL ;ͨ3ѡģʽģʽΪ6BH:ͬͨ1 MOV DXDMA+8 MOV AL0C0H ;ָʽΪC0H: DACKߵƽЧDREQ ;͵ƽЧ̶ȼ OUT DXAL
MOV DXDMA+0FH ;DMA+0FHΪۺ˿ں MOV AL0 OUT DXAL ;ȥĸͨ
7.24 Ӳжʱ
𣺢 ǸҪʱ䳣һӳӳӳӳֱִִIJҲָһźΪʱ
Ӳʹü/ʱҪĶʱʱ䣬ָԼ/ʱöʱָ/ʱǼ/ʱʼƵȷֵʱԶһʱ
7.25 8253/ʱУʱźCLKźGATE
ʲôã
ʱźCLK˼ʣǼ1ݡźGATEΪʱӵĿźţԿƼͣ
7.26 ˵82536ֹʽµص㣬˵ʹóϡ
𣺢 ģʽ0ģʽ1ģʽ4ģʽ5ΪӲIJԶظļʽģʽ2ģʽ3ΪҲӲԶظĶʱʽ
Ϊʱ8253GATE½м1ֵʱһźţ˼̱Ϊʱʱ8253ſGATE½м1ֵʱԶװֵ1˻ϵزΪʱĶʱ
ʱʽһʵʱƼԲУʱӶʱʷȳϡʽⲿ¼ļϵIJƷȳϡ
7.27 8253ģʽ4ģʽ5ʱʲôͬ
ģʽ4GATEΪ͵ƽʱֹͣģʽ5ſGATEشӲGATEΪ͵ƽʱӰ
7.28 ̽82530Ϊģʽ1ֵΪ3000H
1Ϊģʽ2ֵΪ2010H2Ϊģʽ4ֵΪ4030HַΪ0070H0072H0074H0076H
MOV AL32H ;ü0Ϊģʽ1 OUT 76HAL
MOV AX3000H ;дֵ OUT 70HAL MOV ALAH OUT 70HAL
MOV AL74H ;ü1Ϊģʽ2 OUT 76HAL
MOV AX2010H ;дֵ OUT 72HAL MOV ALAH
OUT MOV OUT MOV OUT MOV OUT
72HAL
AL0B8H ;ü2Ϊģʽ4 76HAL
AX4030H ;дֵ 74HAL ALAH 74HAL
7.29 CPUӦDMAӦҪжӦ죬
ԭ
𣺵CPUźźڵǰڵT4״̬TI״̬½ؾͿӦߣӦźHLDACPUINTRʱҪȵǰִָܷһINTA壬жӦINTAſһжӦźšӦҪжӦ졣
7.30 8259AȼѭʽǰȼΪIR4
Ҫʹȼ͵ΪIR1Ӧĸֵ֣Ƕ٣
1.OCW2֡
2.OCW2ľֵC1H(=11000001B)дżַ˿ڡ
7.31 һ8259AгʼijΣΪμ
עͣ˵ʼֵĺ塣
PORT0 EQU 40H ;8259Ażַ˿ں PORT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AڽеֽڷʽDMAͿ鷽ʽDMAʱ
ʲô
ڣֽڷʽʱDMAÿһֽڴͷϵͳߣCPUٿռһڡ鴫䷽ʽʱֻеֽڼΪ0ӶEOPһⲿI/OӿDMAEOPһ͵ƽźʱ8237Aͷ߶䡣
7.34 һפڴжϷܺװ
Դ˳עͽв䣬Աõһע嵥
STACK SEGMENT ;öջ DW 256 DUP (?) STACK ENDS DATA SEGMENT ;ݶ 8259P0 EQU 40H ;8259Ażַ˿ں