如何在BIOS下的USB闪存驱动器(相比软盘)执行低级别的IO? [英] How to perform low-level IO with a USB flash drive under the BIOS (compared to a floppy)?

查看:165
本文介绍了如何在BIOS下的USB闪存驱动器(相比软盘)执行低级别的IO?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近一直在研究一些引导code这是用于与软盘驱动器的使用。我的目标是,使其使用我的USB闪存驱动器来修改程序。现在,我怎么看INT 13H功能已经用于与软盘驱动器,但我想我的问题是,如何将USB驱动器通讯有什么不同?

I have recently been studying some bootstrap code which was intended for use with a floppy drive. My goal is to modify the program so that it uses my USB flash drive. Now I see how the INT 13H function has been used with the floppy device, but I guess my question is, how will communicating with the USB drive differ?

例如,这里是软盘code(GNU汇编程序)的一个片段:

For example, here is a snippet of the floppy code (GNU assembler):

    movb    $0x00,%dl       /* select 1st floppy */

    /* later */

    movw    sec,%cx     /* get sector number */
    movw    head,%dx    /* get head number */

    movw    $0x0201,%ax /* read 1 sector */
    int $0x13

现在我已阅读,移动0x80的入%DL将在BIOS中选择第一个硬盘驱动器。在我的特殊的BIOS我可以改变驱动器顺序,其中包括USB驱动器。我敢肯定这是成为BIOS相关的,但是我在想,在BIOS中列出的顺序可以对应于我搬进%DL的值。我需要跟踪一些文档...

Now I have read that moving 0x80 into %dl will select the first HDD in the BIOS. In my particular bios I can change the drive order, which would include a USB drive. I am quite sure this is becoming BIOS dependant, but I was thinking that the order listed in the BIOS could correspond to the value I move into %dl. I need to track down some documentation...

我真的很陌生与块设备的工作,因为它是可以有人点我一个很好的地方开始学习更多?

I am really unfamiliar with working with block devices as it is, can someone point me to a good place to start learning more?

谢谢!

推荐答案

是,如果BIOS可以从USB闪存启动驱动器为软盘相同的BIOS功能/可用于简单的答案硬盘驱动器的访问。

The simple answer is that if the BIOS can boot from the USB flash drive the same BIOS functions for floppy disk / hard drive access can be used.

快乐的答案是,一个简单的技术允许同一引导扇区code到USB闪存驱动器上访问软盘映像是否与软盘模拟或硬盘驱动器模拟引导。如果DL = 80H(硬盘驱动器仿真)

The happy answer is that a simple technique allows the same boot sector code to access a floppy disk image on a USB flash drive whether it was booted with floppy disk emulation or hard drive emulation. If dl=80h (hard drive emulation)

GET驱动器参数结果
  INT 13H啊= 8结果
  返回:结果
  CH =最大扇区号(等同于每个轨道的扇区数)结果
  DH =最大头数(只加1得到的磁头数)

GET DRIVE PARAMETERS
int 13h, ah=8
Return:
ch=maximum sector number (same as number of sectors per track)
dh=maximum head number (just add 1 to get number of heads)

这返回的信息介绍仿真设备的几何形状(如DL = 0,那么它的标准的软盘几何 - 每磁道18个扇区和2头​​)。这可用于计算所需的所需的柱面磁头扇区信息:

This returned information describes the geometry of the emulated device (if dl=0 then it's standard floppy disk geometry - 18 sectors per track and 2 heads). This can be used to calculate the required Cylinder Head Sector information required for:

读取扇区(S)结果
  INT 13H啊= 2

READ SECTOR(S)
int 13h, ah=2

写入扇区(S)结果
  INT 13H啊= 3

WRITE SECTOR(S)
int 13h, ah=3

请参阅拉尔夫·布朗的中断列表 - INT 13H

在这里见我的文章: USB引导秘密

这篇关于如何在BIOS下的USB闪存驱动器(相比软盘)执行低级别的IO?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆