. : : Assembly Language : : .  |  首页  |  我提出的问题  |  我参与的问题  |  我的收藏  |  消息中心   |  游客  登录  | 
刷新 | 提问 | 未解决 | 已解决 | 精华区 | 搜索 |
  《汇编语言》论坛 ->使用BIOS进行键盘输入和磁盘读写
  管理员: assembly   [回复本贴] [收藏本贴] [管理本贴] [关闭窗口]
主题 : :  关于精简编程实验17  [待解决] 回复[ 2次 ]   点击[ 521次 ]  
2482425197
[帖 主]   [ 发表时间:2012-05-21 18:56 ]   [引用]   [回复]   [ top ] 
荣誉值:0
信誉值:0
注册日期:2012-03-04 22:25
assume cs:code
       code segment
                start:push cs
                      pop ds
                      mov si,offset int7ch
                      mov ax,0
                      mov es,ax
                      mov di,200H
                      mov cx,offset int7ch_e-offset int7ch
                      cld
                      rep movsb ;安装中断处理程序
                                  
                         cli
                      mov word ptr es:[7ch*4],200H
                      mov word ptr es:[7ch*4+2],0
                      sti      ;设置中断向量                                  
                        
                                  mov ax,4c00H
                                  int 21H
                        
                        
                   ;名称:int7ch
                   ;功能:根据给出的逻辑扇区号对软盘进行读或者写
                   ;参数:(ah)=0/1(0表示读,1表示写)
                   ;      (dx)=0-2879(0-2879表示要读写的逻辑扇区号)
                   ;      (es:bx)=指向读出数据或者写入数据的内存区
                   ;返回:(ah)=0,(al)=1 操作成功
                   ;      (ah)=出错代码
                   
                   int7ch:
                                  push cx
                                  push dx
                                  push bx
                                  push ax 
                                  mov ax,dx
                                  mov bx,1440
                                  div bx
                                  mov bx,dx
                                  mov dx,ax 
                                  mov cl,4
                                  shl dx,cl ;磁头号
                                  mov dl,0 ;驱动器号
                                  mov ax,bx
                                  mov dl,18 
                                  div dl
                                  mov ch,al ;磁道号
                                  inc ah
                                  mov cl,ah ;扇区号
                  pop ax
                                  add ah,2  ;功能号
                                  mov al,1  ;读或写的扇区数
                                  pop bx
                                  int 13H
                                  pop dx
                                  pop cx
                                  iret
                         int7ch_e:nop
                          
           code ends                  
end start
tomato
[第1楼]   [ 回复时间:2012-05-21 21:02 ]   [引用]   [回复]   [ top ] 
荣誉值:405
信誉值:0
注册日期:2008-01-19 14:51
是够精简的。
asmfriend008
[第2楼]   [ 回复时间:2013-06-21 16:21 ]   [引用]   [回复]   [ top ] 
荣誉值:0
信誉值:0
注册日期:2013-06-20 20:29
尽出洋相!错误百出!
shl dx,cl 磁头号?(如果左移8位还行.只移了4位成什么了?)
驱动器号在int 13h调用时,已经变成了18... 
只能写或读一个扇区?
需要登录后才能回帖 -->> 请单击此处登录
    Copyright © 2006-2024   ASMEDU.NET  All Rights Reserved