Search code examples
assemblyx86x86-emulation

x86 Assembly "Unable to Load Program" in DOSbox


I am creating my first x86 assembly program. I am using VS Code as my editor and using Insight as my debugger coupled with DOSBox as my emulator.

As a start I have created a .asm program to change to colour of the screen:

   global _start

    section .text

_start:
    call set_colour
    ret 16

set_colour:
    mov ah, 06h         ; scroll up function
    xor al, al          ; clear entire screen
    xor cx, cx          ; upper left corner
    mov dx, 184fh       ; lower right corner
    mov bh, 1eh         ; yellow on blue
    int 10h
    ret 

When I try convert this .asm file to a .o file DOSBox returns an error saying it cannot load the file. What am I doing wrong?


Solution

  • While DOSBox emulates a 32-bit CPU, DOS itself runs in 16-bit real mode, without tools like DOS4gw, used in some DOS Games, such as Doom.

    I think the -f win32 command line option is to blame for this error.