VOGONS


First post, by videogamer555

User metadata
Rank Member
Rank
Member

It seems to have a problem with interrupt 13, which is direct disk access. I'm trying to create my own program that runs at boot-up. I'm testing it in DosBox by using DosBox's boot command to boot the disk image that contains this program (which I've written in assembly language, using NASM). One of the first things it does is attempt to load additional data from the disk, with a call to interrupt 13 with register AH set to 2 (and the other registers set to read the first 125 sectors from the disk). But it doesn't work. When I try it in the debug version of DosBox, I see why. It is giving me an "Illegal unhandled interrupt D" error. D is the hexidecimal representation of the number 13. Interrupt 13, is not even a DOS function. It is a BIOS function, the lowest of all "low level" computer code, which means that ALL x86 computers are supposed to be able to handle it. In fact it's with interrupt 13 that all disk operations are ultimately performed. Even in modern versions of Windows, if you dug down into the Windows kernel, you'd find that functions that read data from the disk are actually calling interrupt, and the Windows API functions like ReadFile and WriteFile, are in fact invoking interrupt 13 deep down in their code. So if interrupt 13 is truly not being handled by DosBox, it's a major bug, because interrupt 13 is necessary for all forms of disk access.

Reply 1 of 8, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

You might have made a typo in your ASM.
it is int 0x13
you are probably calling
int 13 which is 0xd in hex.

Water flows down the stream
How to ask questions the smart way!

Reply 3 of 8, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Yeah, I wrote that initially, but thought it might be not clear enough.

Anyway. It is not a bug in DOSBox, but a typo by yourself.

Water flows down the stream
How to ask questions the smart way!

Reply 5 of 8, by Jorpho

User metadata
Rank l33t++
Rank
l33t++
videogamer555 wrote:

So if interrupt 13 is truly not being handled by DosBox, it's a major bug, because interrupt 13 is necessary for all forms of disk access.

If I'm not mistaken, the overwhelmingly vast majority of games do not require direct disk access. (Captain Blood used it because of its copy protection scheme; hence, an uncracked version of Captain Blood will only run in DOSBox if a floppy is booted.)

Reply 6 of 8, by videogamer555

User metadata
Rank Member
Rank
Member
Qbix wrote:
You might have made a typo in your ASM. it is int 0x13 you are probably calling int 13 which is 0xd in hex. […]
Show full quote

You might have made a typo in your ASM.
it is int 0x13
you are probably calling
int 13 which is 0xd in hex.

Wow. That was a real noob mistake for me to make. I could have sworn that the web page I was using for a reference to x86 interupts said that it was interupt 13 decimal, but upon rechecking that webpage, it did indeed say that it was interupt 13 hexidecimal (which would be interup 19 decimal).

Reply 7 of 8, by videogamer555

User metadata
Rank Member
Rank
Member

Still having a problem. It's still not reading the disk. DOSBox debugger reports this error "BIOS:Disk 0 is not active". To create the boot disk that has the program (first sector boot program) I'm running, I've compiled assembly code using NASM in raw mode. I boot the boot disk in DOS Box by dragdropping the file "testbootdisk.img" directly onto the dosbox.exe icon in Windows Explorer. Below here is the assembly code (fully commented) that I've been using. Please examine the code, and tell me where I'm going wrong.

BITS 16 ; set assembler to use the 16bit instructions

mov ax,0x0013 ; Graphics mode to use is 0x13
int 0x10 ; Call interupt 0x10

mov ax,0xA000 ; Set ES register to start of VRAM (part 1)
mov es,ax ; Set ES register to start of VRAM (part 2)
mov ah,2 ; Operation type is Read Disk Sectors
mov al,125 ; Number of sectors to read is 125 (64000 bytes)
mov ch,0 ; First track/cylinder number to read is 0
mov cl,2 ; First sector to read on this track/cylinder is number 2 (the first sector after the boot sector)
mov dh,0 ; First read-write head to use is number 0
mov dl,0 ; Drive to read from is 0 (the "A drive")
mov bx,0 ; First offset in VRAM to write to is 0
int 0x13 ; Call interupt 0x13

Loop: ; loop to keep the program running
jmp Loop

section .picture start=512 ; start of section that contains picture data is at byte 512 (first byte of sector 2)
incbin "~RESOURCES\VGA.raw" ; copy all bytes of raw pixels to the disk image