flat assembler
Message board for the users of flat assembler.

Index > Windows > COM files in Windows 7 64-bit?

Author
Thread Post new topic Reply to topic
Falk



Joined: 16 Aug 2011
Posts: 2
Falk 20 Aug 2011, 21:23
I've just started with Assembly, and I found this code in a tutorial:
Code:
org 100h
mov ah,09
msg db "hello world!$"
mov dx,msg
int 21h
mov ah,08
int 21h
int 20h    

In Windows XP 32-bit it displayed a nice MSDOS prompt with the text in it.
In Windows 7 64-bit I get this message:
Quote:
This version of the file is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need an x86 (32-bit) or an x64 (64-bit) version of the program

Is there a way to make this code (or something similar) work in 64-bit?
I quite like the simpleness of this code, and I would like to wait a while before I start with all the Windows includes and the PE format.
Post 20 Aug 2011, 21:23
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20425
Location: In your JS exploiting you and your system
revolution 20 Aug 2011, 21:27
You will need something like DOSBOX to run the old DOS programs in Win7. MS removed support for 16-bit programs so there is no other way other than using a DOS emulator.
Post 20 Aug 2011, 21:27
View user's profile Send private message Visit poster's website Reply with quote
me239



Joined: 06 Jan 2011
Posts: 200
me239 20 Aug 2011, 21:32
revolution wrote:
You will need something like DOSBOX to run the old DOS programs in Win7. MS removed support for 16-bit programs so there is no other way other than using a DOS emulator.
Beware though, DOSBox is meant for DOS gaming so don't be surprised if a lot of your DOS utilities and programs don't work.
Post 20 Aug 2011, 21:32
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1903
DOS386 21 Aug 2011, 02:07
Falk wrote:
Code:
org 100h
mov ah,09
msg db "hello world!$" ; !!! BUG !!!
mov dx,msg
int 21h
mov ah,08
int 21h
int 20h    


The code is faulty as it
executes data Sad

Quote:
Is there a way to make this code (or something similar) work in
64-bit?


NO.

Quote:
I quite like the simpleness of this code, and I would like to wait a while before I start with all the Windows includes and the PE format.


PE works without includes too
Wink ... Otherweise, I recommend only
PE examples if you don't have DOS.

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 21 Aug 2011, 02:07
View user's profile Send private message Reply with quote
Falk



Joined: 16 Aug 2011
Posts: 2
Falk 21 Aug 2011, 09:23
I think that I'll just run in Windows XP/Virtual mode on Windows 7.

DOS386 wrote:

The code is faulty as it
executes data Sad

As I understand it too, yes it does.
But it always works, so I let that one slide, as I believe I know what the problem is, and won't really build a major project based on this hello world Smile

Thanks guys.
Post 21 Aug 2011, 09:23
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 21 Aug 2011, 14:26
You are *VERY* lucky that your code works, because this is what the CPU sees:
Code:
org 100h
mov ah,09
msg:push 6C65h
    insb
    outsw
    jc $+2+6Ch
    and [fs:si],sp
mov dx,msg
int 21h
mov ah,08
int 21h
int 20h
    
Post 21 Aug 2011, 14:26
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.