The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: ekisner on August 26, 2009, 02:27:55 PM

Title: Access Denied to int 16h (AH=00)...?
Post by: ekisner on August 26, 2009, 02:27:55 PM
So, I took some assembler courses in college about 5 years ago and have decided to get back into it - I love that the language is so low-level.

To that effect, I started with the basic hello world and had no trouble writing to the screen.

Next up, I wanted to make a program that would simply accept input from the keyboard and write it to the screen... see the following code seg

.386
.model flat, stdcall
option casemap :none

.data
.code

start:

    xor eax,eax
    mov ah,00h
    int 16h
    MOV AH,0Eh
    INT 10h

;;;;EXIT THE PROGRAM;;;;
;    mov ax,4c00h
;    int 21h
;   Not working yet, but I can probably google the "exit process" interrupt
end start


The program compiles and links properly, however when I run it in CMD I get "access denied" returned to me.  No idea what I'm doing wrong?

Am coding on an XP Pro x64 computer... is that possibly why?

Edit:
The reason I'm using bios interrupts is because I have a thing for making my own code.. rather than importing libraries and using call/invoke.  It's a personal preference.  Don't want to use the Win32 API if possible.
Title: Re: Access Denied to int 16h (AH=00)...?
Post by: dedndave on August 26, 2009, 02:39:18 PM
if you want to write 32-bit programs, there is no avoiding the API
INT xx are DOS/BIOS function calls that simply will not work in win32
they will only work in 16-bit programs
i suppose if you wanted to, you could write a 16-bit program that switches to protected mode
but, that is a lot of work with little gain
16-bit programs are becoming obsolete
newer OS's won't run them at all
another approach might be to write a 32-bit program with ring0 access and get at the BIOS calls
again - a lot of work with little or no gain
Title: Re: Access Denied to int 16h (AH=00)...?
Post by: redskull on August 26, 2009, 02:49:32 PM
While you get back into the swing of things, there's no shame in just writing a 16-bit program and running it under the Windows emulator (virtual-86 mode).  It does a pretty good job of emulating the basic I/O calls, but some of the more low level ones are hit and miss.  You'll need to get the 16-bit linker to do so, though.  But, as was said, the Win32 API is the only way to do things under 32-bit

-r
Title: Re: Access Denied to int 16h (AH=00)...?
Post by: ekisner on August 26, 2009, 03:33:30 PM
That is most unfortunate - and it seems that I'm actually trying to do 16 bit programming (which if I remember the usage terms of these forums means that this topic is in the wrong thread.  Sorry.)

Ah well, I guess I'll just have to get used to using the Win32 API... thank you for the answers, both of you.
Title: Re: Access Denied to int 16h (AH=00)...?
Post by: dedndave on August 26, 2009, 03:44:32 PM
well - if you are trying to write 32-bit code......
right forum - just the wrong code - lol
welcome to masm32
Title: Re: Access Denied to int 16h (AH=00)...?
Post by: Slugsnack on August 26, 2009, 07:25:52 PM
just a little nitpick :

xor eax,eax
    mov ah,00h


if you are xor'ing eax with itself then eax is zeroed from that and therefore also ax/ah/al. so the second instruction is redundant