|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2011-3-17 09:00:26
|
显示全部楼层
源码
.MODEL SMALL
io8259_main_addr equ 0600H
io8259_sub_addr equ 0800H
.8086
.code
io8259_std1_init macro base,icw1_val,icw2_val,icw4_val
mov dx,base
mov al,icw1_val
out dx,al
mov dx,base+2
mov al,icw2_val
out dx,al
mov al,icw4_val
out dx,al
endm
io8259_std_init macro base,icw1_val,icw2_val,icw3_val,icw4_val
mov dx,base
mov al,icw1_val
out dx,al
mov dx,base+2
mov al,icw2_val
out dx,al
mov al,icw3_val
out dx,al
mov al,icw4_val
out dx,al
endm
setup_int macro int_irq,int_cs,int_ip
push di
push ds
mov di,0
mov ds,di
mov di,(int_irq)*4
mov word ptr ds:[di],int_ip
mov word ptr ds:[di+2],int_cs
pop ds
pop di
endm
setup_ints macro int_irq,int_cs,int_ip
setup_int int_irq,int_cs,int_ip
setup_int (int_irq+1),int_cs,int_ip
setup_int (int_irq+2),int_cs,int_ip
setup_int (int_irq+3),int_cs,int_ip
setup_int (int_irq+4),int_cs,int_ip
setup_int (int_irq+5),int_cs,int_ip
setup_int (int_irq+6),int_cs,int_ip
setup_int (int_irq+7),int_cs,int_ip
endm
intxx proc far
iret
intxx endp
intl1 proc far
iret
intl1 endp
intl2 proc far
iret
intl2 endp
intl1_s proc far
iret
intl1_s endp
intl2_s proc far
iret
intl2_s endp
.startup
cli
setup_ints 00h,seg intxx,offset intxx
setup_ints 08h,seg intxx,offset intxx
setup_ints 10h,seg intxx,offset intxx
setup_ints 18h,seg intxx,offset intxx
setup_int 30h,seg intl1,offset intl1
setup_int 31h,seg intl2,offset intl2
setup_int 40h,seg intl1_s,offset intl1_s
setup_int 41h,seg intl2_s,offset intl2_s
main:
io8259_std_init io8259_main_addr,\
11h,30h,04h,13h
;io8259_std1_init io8259_main_addr,\
;13h,30h,03h
slave:
io8259_std_init io8259_sub_addr,\
11h,40h,02h,03h
sti
jmp $
.data
.stack
END |
|