Chinaunix首页 | 论坛 | 博客
  • 博客访问: 26462
  • 博文数量: 7
  • 博客积分: 244
  • 博客等级: 入伍新兵
  • 技术积分: 80
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-29 06:53
文章分类
文章存档

2010年(7)

最近访客

分类:

2010-05-08 18:27:16

  commmandbad dw 01f0h
res:
  mov dx,commandbad
  add dx,07h
  in al,dx
  test al,80h
  jnz res ;check if or not busy  

  mov dx,commandbad
  add dx,02h
  mov al,00h
  out dx,al
  mov al,1h
  out dx,al ;set sector count
   
  mov dx,commandbad
  add dx,03h
  mov al,00h
  out dx,al
  mov al,00h
  out dx,al ;set LBA low  
   
  mov dx,commandbad
  add dx,04h
  mov al,00h
  out dx,al
  out dx,al ;set LBA mid
   
  mov dx,commandbad
  add dx,05h
  mov al,00h
  out dx,al
  out dx,al ;set LBA high
   
  mov dx,commandbad
  add dx,06h
  mov al,40h
  out dx,al ;set LBA enable
   
  mov dx,commandbad
  add dx,07h
  mov al,24h
  out dx,al ;set 24h command
   
@@:
  in al,dx
  test al,80h
  jnz @b ;check if or not busy  
   
  test al,01h
  jnz res ;check if or not error
   
   
  test al,40h 
  jz res ;check DRAY is or not ready 
   
  mov di,0h
@@:
  mov dx,commandbad  
  insw ;read data to result  
  mov dx,commandbad
  add dx,07h
  IN AL,DX
  test AL, 08h
  jnz @b
阅读(1208) | 评论(0) | 转发(0) |
0

上一篇:对硬盘进行操作

下一篇:嵌入汇编

给主人留下些什么吧!~~