Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Why does int 16h in my assembly language program cause a crash?

I'm trying to learn Assembly language, and I'm trying to do one of the examples in the book.

It compiles fine, but when ever I try to run my program it crashes. When I debug the program it says

'Unhandled exception in temp.exe;0xC0000005;Access Violation' and tells me that the line

int 16h

is what is causing the crash. The book tells me specifially to use this command, so I can't change it to something else. So does anyone know what I can do?

I'm using Windows XP with SP3. I've got an Intel Celeron processor.

Here's my code:

mov bx, 0

cmp bx, 80

jz done1

mov ah, 0

int 16h

mov myvar[2], al

inc bx

cmp al, 0dh

jz done2

done1: mov myvar, 0dh

done2: mov bx, 0

myloop: cmp myvar[bx], 0dh

jz done3

mov ah, 03

mov al, myvar[bx]

int 10h

inc bx

;jmp myloop

done3: exit

1 Answer

Relevance
  • Anonymous
    1 decade ago

    The only thing I can think of is that, for some reason, Windows isn't allowing you to access the keyboard directly. (I haven't tried anything like this since Windows 3.11, so I don't know whether XP or Vista would cause the problem.)

    (Running in a "DOS box" - a command prompt - is still running in Windows.)

Still have questions? Get your answers by asking now.