王爽《汇编语言》实验17

assume cs:code

code segment
start:
    ;----------install int7ch
        mov ax,code
        mov ds,ax
        mov si,offset int7ch

        mov ax,0
        mov es,ax
        mov di,200h

        mov cx,offset int7ch_end - offset int7ch
        cld
        rep movsb
        
	cli
        mov word ptr es:[4*7ch],200h
        mov word ptr es:[4*7ch+2],0
        sti
;---------------test
        mov ah,1
	mov dx,1439
	int 7ch
;--------------------
        mov ax,4c00h
        int 21h
    ;-----------------int7ch
int7ch:
        cmp ah,1
        ja over

        push ax
        push bx
        push cx
        push dx

	push ax

        mov ax,dx
        mov dx,0
        mov bx,1440
        div bx
        mov cl,al

        mov bl,18
        mov ax,dx
        div bl
	mov ch,al

        inc ah
        mov dh,ah

        mov dl,0

        pop ax
        mov al,1
        cmp ah, 0
        je read
        cmp ah, 1
        je write

read:
        mov ah,2
        jmp short ok
write:
        mov ah,3
        jmp short ok    
ok: 
        int 13h
        pop dx
        pop cx
        pop bx
        pop ax
over:
        iret    
int7ch_end: nop

code ends

end start

猜你喜欢

转载自blog.csdn.net/weixin_41944412/article/details/80788122