I'm writing 16-bit boot sector code. It reads "sector 0" under VMware with all the fields, including the 0xaa55 sig, as expected but the same code copied to DOSBox under Win 8.1 (x64) reads nothing. This makes testing a bit tedious.

The A: drive is a MOUNT in DOSBox.

Is anyone aware of a work-around, please?

Here is example assembly code to show the problem (assemble into a .COM file with NASM, -f bin, org 0x100):

        mov     bp,4

        mov     ax,0x0000   ; RESET
        mov     dl,0x00     ; (bit 7 for HDD)

        int     0x13

        mov     al,01       ; # sectors
        mov     ah,02       ; read sector(s)
        mov     cl,1        ; 6 bits first sector (1-based, aka "sector 0")
        mov     ch,0        ; low 8 bits of CYL (2 more bits can be given in CL)
        mov     dh,0        ; HEAD
        mov     dl,0x00     ; 0-based drive. 0 is typically A:, 1 for B:, 80 for C:
        mov     bx,di
        push    cs
        pop     es         ; es:bx -> buffer area. Careful about segment boundaries


        int     0x13       ; READ SECTOR(S)

        jnc     getsect_done
        dec     bp
        cmp     bp,0x0000
        ja      getsect_loop

Thanks if anyone can explain the difference, or suggest what would also work in DOSBox.

  • Not the cause of your problem but you're not showing where you initialise di.
    – ecm
    Jul 9, 2021 at 10:24
  • 2
    Sorry. I left out the calling code. Caller sets di pointing to a buffer within the caller. The called code pushes a few registers before the chunk I copied. Also, by asking the question (oops) I have a clue to follow--the DOSBox "A" drive is a MOUNT, so I may have caused my own problem, if DOSBox doesn't emulate a sector 0 with MOUNT. Jul 9, 2021 at 10:30
  • 5
    If it's really a MOUNTed drive, there will be no sector 0 - you should IMGMOUNT a disk image that actually holds the boot sector.
    – tofro
    Jul 9, 2021 at 11:32
  • Keep in mind as well, DOSbox is not a virtual machine--it is more somewhere in between being a plain application and a full virtual machine, more like a partial emulator. Most code will work the same, but there are going to be a few edge cases where it does not. (This is even true if you execute the code on a real physical DOS machine, and the reason why hardware usually needs drivers or extensive libraries to access them in diverse configurations.)
    – C. M.
    Jul 11, 2021 at 19:38

2 Answers 2


DOSBox only allows absolute sector reads from disk images, as mounted by IMGMOUNT.

You can’t use interrupt 0x13, service 0x02 on drives mounted with MOUNT. (To understand that link, note that imageDiskList in DOSBox is only populated by the BOOT and IMGMOUNT commands, not by MOUNT.)

The workaround is to use IMGMOUNT:

imgmount -t floppy a /path/to/floppy.img
  • 2
    Indeed sentences differ from paragraphs but there's good presentation, too. Splitting up a slab of text helps readers get your points. Anyway, a good answer and upvoted :-)
    – TonyM
    Jul 9, 2021 at 18:40
  • Right @TonyM, and thanks for taking the time to edit my post. I’ve seen lots of edits recently where people just added newlines after every single full stop :-(. In this case I still think the second paragraph makes more sense kept together. SE doesn’t help, there’s too much space between paragraphs and too few tools for supporting information (e.g. Wikimedia-style footnotes). Jul 10, 2021 at 12:02
  • Honestly not sure if you're being sarcastic or not, do hope not. It's about keeping the relevant points together so they can be seen easily. There's some shocking presentation out there in pro engineering and some defensiveness out there with it, too. Splitting every sentence into a paragraph may be suitable, may not, depending on the context. Personally, I just go on: is it difficult to make out though the text is right. Sorry if I've hit some long-standing nerve, not my intention.
    – TonyM
    Jul 10, 2021 at 12:52
  • @TonyM no sarcasm intended, sorry, I do appreciate genuine attempts to improve the content here. When I trained as a journalist, a long time ago, it was drummed into me that one idea = one paragraph ;-). Jul 10, 2021 at 14:27

Thanks for the above comments/suggestions.

This in the .cfg file works to allow reading 'sector 0' :-

mount c c:\users\roopy\source
mount -t floppy b: c:\Users\roopy\Downloads\BackupDownloads\iso\DOS5and6
imgmount a -t floppy Dos5.img

It means the code I'm testing can be run as a DOS command (temporarily) and it reads the boot sector from the first floppy just fine.

  • 2
    The sort order of answers may change as votes are cast, so it’s unwise to refer to other answers as ‘above’ (or generally assume them to be read in any particular order). And this doesn’t seem to add much over Stephen’s answer anyway. Jul 11, 2021 at 11:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .