. : : Assembly Language : : .  |  首页  |  我提出的问题  |  我参与的问题  |  我的收藏  |  消息中心   |  游客  登录  | 
刷新 | 提问 | 未解决 | 已解决 | 精华区 | 搜索 |
  《汇编语言》论坛 ->使用BIOS进行键盘输入和磁盘读写
  管理员: assembly   [回复本贴] [收藏本贴] [管理本贴] [关闭窗口]
主题 : :  exam17  [已解决] 回复[ 2次 ]   点击[ 443次 ]  
jjch224
[帖 主]   [ 发表时间:2010-08-23 22:27 ]   [引用]   [回复]   [ top ] 
荣誉值:16
信誉值:0
注册日期:2010-07-09 09:48
;exam17 p310
;安装一个新的int7ch中断例程,实现通过逻辑扇区区号对软盘进行读写。
;参数说明:1.用ah寄存器传递功能号:0表示读,1表示写;
;          2.用dx寄存器传递要读写的扇区的逻辑扇区号;
;          3.用es:bx指向存储读出数据或写入数据的内存区;
assume cs:code
code segment
start:
        mov ax,cs
        mov ds,ax
        mov si,offset int7ch
        
        mov ax,0
        mov es,ax
        mov di,200h
        mov cx,offset int7chend-offset int7ch
        cld
        rep movsb
        
        mov word ptr es:[7ch*4],200h
        mov word ptr es:[7ch*4+2],0
        
        mov dx,100
        mov al,2        
        mov ah,0;read
        int 7ch
        
        mov ax,4c00h
        int 21h
int7ch:        
        push bx
        push si
        push ax        
        mov ax,0
        mov es,ax
        mov bx,2c8h
        
        call s
        
        pop ax
        add ah,2        
        mov dl,0
        int 13h
        pop si
        pop bx
        iret
        
;-----------------call:dx ret:dh=mh,ch=cd,cl=sq-------------
s:        push si
        push ax
        mov si,1440
        call divs  ;ljsq/1440 yushu=dx,shang=ax
        
        push ax
        
        mov si,18
        call divs ;(ljsq/1440)/18 yushu=dx,shang=ax
        
        mov ch,al;ch=cd
        mov cl,dl
        inc cl   ;cl=sq
        
        pop dx
        mov dh,dl   ;dh=mh
        
        pop ax
        pop si
        ret        
;-------------------------sub-pro,dx/si,dx=yushu,ax=shang        
divs:        
        push dx
        pop ax
        mov dx,0
        div si;dx/1440 yushu=dx,shang=ax
        ret        
int7chend:nop
code ends
end start
jjch224
[第1楼]   [ 回复时间:2010-08-23 22:28 ]   [引用]   [回复]   [ top ] 
荣誉值:16
信誉值:0
注册日期:2010-07-09 09:48
调试无问题。
jjch224
[第2楼]   [ 回复时间:2010-09-01 10:06 ]   [引用]   [回复]   [ top ] 
荣誉值:16
信誉值:0
注册日期:2010-07-09 09:48
此贴由 贴主 于 [ 2010-09-01 10:06 ] 结贴。 结贴原因:问题已解决
得分情况:
此问题已结贴!
    Copyright © 2006-2024   ASMEDU.NET  All Rights Reserved