王爽《汇编语言》实验17

本文档展示了如何使用汇编语言安装一个中断处理程序,并对其进行测试。通过将中断处理程序的地址存入中断向量,然后调用中断7ch进行读写操作。在测试过程中,进行了数值的除法运算来确定磁盘扇区位置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值