⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shiyan1.asm

📁 PCI9054和8259构成的定时中断
💻 ASM
字号:
data segment
int_vect equ 073h
irq_mask_0_7 equ 011111011b
irq_mask_8_15 equ 011110111b
ioport_9054 equ 0c000h
csreg dw ?
ipreg dw ?
irq_count dw 8
msg1 db 0dh,0ah,'tpc',0dh,0ah,'$'
msg2 db 0dh,0ah,'press',0dh,0ah,'$'
msg3 db 0dh,0ah,'dma',0dh,0ah,'$'
data ends
stacks segment
sta db 100 dup(?)
stacks ends
code segment
assume cs:code,ds:data,ss:stacks,es:data

start:
cli
mov ax,data
mov ds,ax
mov es,ax
mov ax,stacks
mov ss,ax

mov dx,ioport_9054+68h
in ax,dx
or ax,0900h
out dx,ax

mov al,int_vect
mov ah,35h
int 21h
mov ax,es
mov csreg,ax
mov ipreg,bx

mov ax,cs
mov ds,ax
mov dx,offset int_proc
mov al,int_vect
mov ah,25h
int 21h

in al,21h
and al,irq_mask_0_7
out 21h,al
in al,0a1h
and al,irq_mask_8_15
out 0a1h,al

mov ax,data
mov ds,ax
mov dx,offset msg2
mov ah,09h
int 21h
mov dx,offset msg3
mov ah,09h
int 21h
;mov irq_times,0ah

loop1:
cmp irq_count,0
jz exit
mov ah,1
int 16h
jnz exit
jmp loop1

exit:
cli
mov bl,irq_mask_0_7
not bl
in al,21h
or al,bl
out 21h,al
mov bl,irq_mask_8_15
not bl
in al,0a1h
or al,bl
out 0a1h,al

mov dx,ipreg
mov ax,csreg
mov ds,ax
mov ah,25h
mov al,int_vect
int 21h

mov dx,ioport_9054+68h
in ax,dx
and ax,0f7ffh
out dx,ax

mov ax,4c00h
int 21h

int_proc proc far
cli
push ax
push dx
push ds
dec irq_count
mov ax,data
mov ds,ax
mov dx,offset msg1
mov ah,09h
int 21h

mov al,20h
out 0a0h,al
out 20h,al
pop ds
pop dx
pop ax
sti
iret

int_proc endp


code ends
end start


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -