Jump to content

- - - - -

Map file (md), size in bytes


  • Please log in to reply
2 replies to this topic

#1 betrand


    Frequent Member

  • Advanced user
  • 467 posts

Posted 14 October 2013 - 07:37 PM

I want to map a file (not necessarily an image file) to (md),

or to (fdxx) or (hdx,x), and get the size of the (md).

Size in bytes.


I don't want to know the size of a /file, by the way.


Thank you!

#2 steve6375


    Platinum Member

  • Developer
  • 7323 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars, www.easy2boot.com
    United Kingdom

Posted 14 October 2013 - 09:13 PM

Won't the size of the file be the same as the size of the volume?

Can you explain more what you are trying to do - give an example?

#3 tinybit


    Gold Member

  • Developer
  • 1175 posts

Posted 15 October 2013 - 02:28 AM

You cannot map a file to (md). The (md) device always start at physical address 0, where the Interrupt Vector Table resides.


You may instead map a file to (rd). Just like this:

map  /myfile  (rd)

or this

map  --sectors-per-track=0  --heads=0  /myfile  (rd)

If you map a file to (rd), then the internal variable rd_size will be set to the size of the file. rd_size is the size of the whole (rd) device.


By the way, rd_base is the starting address of the (rd) device.

# read rd_base
calc  *0x82D0
# read rd_size
calc  *0x82D8

In addition, (rd)+1 stands for the file which contains all bytes in the (rd) device.


# view the content of (rd)
cat  --hex  (rd)+1


Note that if you map a file to (rd), you cannot do "map --hook" for it. The mapping to (rd) does not act as a BIOS int13 disk emulation. If you want a disk emulation, you should map to (fd0), (fd1), (fd2), (fd3), (hd0), (hd1), (hd2), (hd3), (hd4), (hd5), (hd6), (hd7) or (hd), with or without the --mem switch.

Also tagged with one or more of these keywords: grub4dos

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users