1、四、程序清单assume cs:code code segment start: ;清屏 mov ah,6 ; mov al,0 ; mov ch,0 mov cl,0 ; mov dh,24 mov dl,79 mov bh,7 int 10h l:年 mov al,9 mov si,0 call s mov byte ptr es:160*12+2*40+4,/月 mov al,8 mov si,6 160*12+2*40+10,日 mov al,7 mov si,12 160*12+2*40+16, 取时数并送入显存 mov al,4 mov si,18 160*12+2*40+22,:
2、取分数并送入显存 mov al,2 mov si,24 160*12+2*40+28,取秒数并送入显存 mov al,0 mov si,30 jmp l mov ax,4c00h int 21h ;*子程序* 名称:s 作用:取出BCD码并送入显存 入参:al为单元数,si为显存偏移地址变址 * s: push ax push bx push si out 70h,al in al,71h mov cl,4 mov ah,al shr ah,cl and al,00001111b add al,30h add ah,30h mov bx,0b800h mov es,bx mov bx,160*
3、12+2*40 mov es:bx+si,ah bx+si+2,al pop si pop bx pop ax ret code ends end start 四、程序运行结果实验2 8255并行接口键盘程序设计利用09H型中断设计一个自己的键盘中断服务程序,程序设计应考虑在退出时不破坏原有的设置。dseg segment addr_point dw ? count dw ? buffer db 20h dup() prompt db Please enter the characters: db 0dh,0ah,$ message db buffer overflow,0dh,0ah sav
4、e_ip9 dw ? save_cs9 dw ?dseg endscseg segment assume cs:cseg,ds:dsegmain proc far push dx sub ax,ax push ax mov ax,dseg mov ds,ax mov ax,offset buffer mov addr_point,ax mov count,0 mov al,09h mov ah,35h int 21h ;save interrupt vector of type 09h mov save_ip9,bx mov save_cs9,es mov dx,offset kbint pu
5、sh ds mov ax,seg kbint mov ah,25h int 21h pop ds ;set interrupt vector of 9 in al,21h and al,0fdh out 21h,al sti jmp $ retmain endpkeyboard interrupt serverkbint proc near push bx cld in al,60h ;read in the char in al,61h mov ah,al or al,80h out 61h,al xchg ah,al pop ax test al,80h ;is press or rele
6、ase code? jnz cont mov bx,addr_point mov bx,al call disp inc bx inc count mov addr_point,bxcheck: cmp count,32 jb cont or al,02hcont: cli mov al,20h out 20h,al pop bx iretkbint endpdiplay char codedisp proc near push cx mov ch,2 mov cl,4nextb: rol al,cl mov dl,al and dl,0fh or dl,30h cmp dl,3ah jl dispit add dl,7hdispit: mov ah,2 dec ch jnz nextb mov dl, pop dx pop cxdisp endpcseg ends end start三、程序运行结果程序运行后,将会修改09H中断
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1