code:
.486
.model flat, stdcall
option casemap: none
..code
start:
mov ah, 4ch
int 21h
end start
Alright, simple enough. I type that into QEditor then hit the console
assemble and link button from the project menu which basically does
this:
ml /c /coff <file>.asm
link /SUBSYSTEM:CONSOLE /OPT:NOREF <file>.obj
Assembles and links without errors or warnings...I go to run it and
when it tries to execute the int 21h line I get an "access violation".
I got this thing to work last night by linking it with tlink instead,
after looking at the hex for both versions of the executable I noticed
that the big difference is in the header of the exe. The masm32
linker version even has an ascii string saying that this program does
not run in dos mode, so it makes sense that calling a DOS interrupt
won't work. So I guess my question is how can I get the linker that
is included in the masm32 package to create exe's that can call DOS
interrupts? Is there a 16-bit combatibility mode or something I can
use? Does this have to do with coff? Can I make it link in another
format? etc?
Thanx a bunch.
|
|
0
|
|
|
|
Reply
|
spamtrap
|
9/3/2004 12:10:53 AM |
|
Nelson wrote:
>
> code:
>
> .486
> .model flat, stdcall
> option casemap: none
>
> .code
> start:
> mov ah, 4ch
> int 21h
> end start
>
> Alright, simple enough. I type that into QEditor then hit the console
> assemble and link button from the project menu which basically does
> this:
>
> ml /c /coff <file>.asm
> link /SUBSYSTEM:CONSOLE /OPT:NOREF <file>.obj
> So I guess my question is how can I get the linker that
> is included in the masm32 package to create exe's that can call DOS
> interrupts? Is there a 16-bit combatibility mode or something I can
> use? Does this have to do with coff? Can I make it link in another
> format? etc?
1. This code above is for 32-bit mode. You must write a 16-bit DOS
code to do an interrupt. Change the code to:
.486
.model small
option segment:use16 ;don't forget this
.code
start:
mov ah, 4ch
int 21h
end start
2. You need the 16-bit Microsoft linker.
See http://www.ht.sakura.ne.jp/~delmonta/programmierung/masm-e.html
3. At last, you'll be successful with ml /c <file>.asm (don't add /COFF),
then use 16-bit linker.
========================================================================
(Mr.) IIJIMA Hiromitsu, mailto:delmonta@ht.sakura.ne.jp
aka Delmonta http://www.ht.sakura.ne.jp/~delmonta/
|
|
0
|
|
|
|
Reply
|
IIJIMA
|
9/3/2004 1:27:09 AM
|
|
IIJIMA Hiromitsu <spamtrap@crayne.org> wrote:
>
>1. This code above is for 32-bit mode. You must write a 16-bit DOS
> code to do an interrupt. Change the code to:
>
> .486
> .model small
> option segment:use16 ;don't forget this
You can skip the "option" if you just swap the order of the first two
lines:
.model small
.486
> .code
> start:
> mov ah, 4ch
> int 21h
> end start
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
|
|
0
|
|
|
|
Reply
|
Tim
|
9/3/2004 5:53:15 AM
|
|
IIJIMA Hiromitsu <spamtrap@crayne.org> wrote in message news:<4137C717.F3981A06@ht.sakura.ne.jp>...
Nelson,
wrote:
> >
> > code:
> >
> > .486
> > .model flat, stdcall
> > option casemap: none
> >
> > .code
> > start:
> > mov ah, 4ch
> > int 21h
> > end start
> >
> > Alright, simple enough. I type that into QEditor then hit the console
> > assemble and link button from the project menu which basically does
> > this:
> >
> > ml /c /coff <file>.asm
> > link /SUBSYSTEM:CONSOLE /OPT:NOREF <file>.obj
>
>
> > So I guess my question is how can I get the linker that
> > is included in the masm32 package to create exe's that can call DOS
> > interrupts? Is there a 16-bit combatibility mode or something I can
> > use? Does this have to do with coff? Can I make it link in another
> > format? etc?
>
> 1. This code above is for 32-bit mode. You must write a 16-bit DOS
> code to do an interrupt. Change the code to:
>
> .486
> .model small
> option segment:use16 ;don't forget this
>
> .code
> start:
> mov ah, 4ch
> int 21h
> end start
>
> 2. You need the 16-bit Microsoft linker.
> See http://www.ht.sakura.ne.jp/~delmonta/programmierung/masm-e.html
>
> 3. At last, you'll be successful with ml /c <file>.asm (don't add /COFF),
> then use 16-bit linker.
>
> ========================================================================
> (Mr.) IIJIMA Hiromitsu, mailto:delmonta@ht.sakura.ne.jp
> aka Delmonta http://www.ht.sakura.ne.jp/~delmonta/
|
|
0
|
|
|
|
Reply
|
spamtrap
|
9/3/2004 10:47:24 AM
|
|
Apologies for the duplicate posting, must have hit the wrong key while
typing the answer.
Nelson,
Delmonta has pointed you in the right direction with the 16 bit OMF
linker. MASM32 will not build 16 bit files and to make the point, int
21h cannot be used in 32 bit windows.
If you really want to work with 16 bit DOS code, try and get hold of
the last commercial release of MASM 611d as it was well suited for
that purpose.
Regards,
hutch at movsd dot com
|
|
0
|
|
|
|
Reply
|
spamtrap
|
9/13/2004 11:10:11 AM
|
|
|
4 Replies
344 Views
(page loaded in 0.047 seconds)
Similiar Articles: Problem with int 21h and Masm32. - comp.lang.asm.x86code: .486 .model flat, stdcall option casemap: none ..code start: mov ah, 4ch int 21h end start Alright, simple enough. I type that int... writing windows vxd drivers with MASM/TASM - comp.lang.asm.x86 ...Problem with int 21h and Masm32. - comp.lang.asm.x86 You must write a 16-bit DOS code to do an interrupt. ... make the point, int 21h cannot be used in 32 bit windows. ... Where to get/buy MASM? - comp.lang.asm.x86Get the grill good and hot while placing meat ... cheaper and better to cut up a whole roast than to buy ... Problem with int 21h and Masm32. - comp.lang.asm.x86 MASM ... Allocating Memory in DOS - comp.lang.asm.x86... section, there are no problems. But I would like to allocate > memory on-the-fly, based on filesize, so I have tried to > use INT 21h AH ... cs.ucr.edu/AsmTools/MASM ... input & output in assembly - comp.lang.asm.x86All MS-DOS functions are handled through INT 21h. ... knowing, but having a desire to learn is not a problem.... ... Here's a following sample program I created with MASM ... FAQ -- assembly-language/x86/general/part1 - comp.lang.asm.x86 ...MASM, TASM, and other commercial assemblers NASM, and ... alt.lang.asm is: alt.lang.asm will address the problems ... To Truncate A File There is not any single DOS Int 21h ... Flushing instruction cache - comp.lang.asm.x86Simple code encryption (xor) problem - comp.lang.asm.x86 ..... otherwise MASM ... grab A86 and read up on how the INT instruction ... CHARACTER INPUT WITHOUT ECHO INT 21h ... Programming Misc: Problem with int 21h and Masm32. - programming ...programming.itags.org: Programming Misc question: Problem with int 21h and Masm32., created at:Tue, 29 Apr 2008 20:23:00 GMT with 1,217 bytes, last updated: Saturday ... Problem with int 21h and Masm32. - comp.lang.asm.x86 | Computer Groupcode: .486 .model flat, stdcall option casemap: none ..code start: mov ah, 4ch int 21h end start Alright, simple enough. I type that int... 7/21/2012 1:59:53 AM
|