flat assembler
Message board for the users of flat assembler.

Index > Main > 64 bit OS

Author
Thread Post new topic Reply to topic
dasyar



Joined: 27 Feb 2005
Posts: 33
dasyar 28 Dec 2006, 16:41
I tried running FASM on my Win XP x64 system, for some reason it would not run. Am I missing something, or is FASM not 64 bit ready yet?

Thanks
Post 28 Dec 2006, 16:41
View user's profile Send private message Reply with quote
hckr83



Joined: 12 Nov 2006
Posts: 86
Location: usa
hckr83 28 Dec 2006, 18:26
hmm..it should run 32bit applications using that one little host program..wierd..
Post 28 Dec 2006, 18:26
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger Reply with quote
Xorpd!



Joined: 21 Dec 2006
Posts: 161
Xorpd! 28 Dec 2006, 19:02
Code:
C:\Asm\FASM\EXAMPLES\WIN64\my_example>type console_test.asm
format MS64 coff

extrn GetStdHandle
extrn 'WriteConsoleA' as WriteConsole
extrn ExitProcess
extrn WriteConsoleW
;extrn SetConsoleDisplayMode
;extrn SetCurrentConsoleFontEx

STD_INPUT_HANDLE = -10
STD_OUTPUT_HANDLE = -11
STD_ERROR_HANDLE = -12
CONSOLE_FULLSCREEN_MODE = 1
CONSOLE_WINDOWED_MODE = 2

section 'CODE' code readable executable align 16
align 16
public MAIN
MAIN:
   sub rsp, 40
   mov ecx, STD_OUTPUT_HANDLE
   call GetStdHandle
   mov [stdin], rax
;   mov r8, coord
;   mov edx, CONSOLE_FULLSCREEN_MODE
;   mov rcx, [stdin]
;   call SetConsoleDisplayMode
   xor eax, eax
   mov [rsp+32], rax
   mov r9, NumCharsWritten
   mov r8d, hello_len
   mov rdx, hello
   mov rcx, [stdin]
   call WriteConsole
   xor eax, eax
   mov [rsp+32], rax
   mov r9, NumCharsWritten
   mov r8d, ru_len
   mov rdx, ru
   mov rcx, [stdin]
   call WriteConsoleW
   xor ecx, ecx
   call ExitProcess
   add rsp, 40
   ret

section 'DATA' data readable writeable align 16
   stdin dq ?
   NumCharsWritten dw ?
   hello db 'Hello, world!', 13, 10
   hello_len = $-hello
   ru dw 417h, 434h, 440h, 430h, 432h, 441h
      dw 442h, 432h, 443h, 439h,  2ch,  20h
      dw 43ch, 438h, 440h, 21h, 13, 10
   ru_len = ($-ru)/2
   align 4
   coord dd 2 dup (?)

C:\Asm\FASM\EXAMPLES\WIN64\my_example>set path=C:\Asm\Fasm;C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin\win64\x86\AMD64

C:\Asm\FASM\EXAMPLES\WIN64\my_example>set lib=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib\AMD64

C:\Asm\FASM\EXAMPLES\WIN64\my_example>fasm console_test.asm
flat assembler  version 1.67.14  (1296617 kilobytes memory)
3 passes, 588 bytes.

C:\Asm\FASM\EXAMPLES\WIN64\my_example>link console_test.obj /subsystem:console /defaultlib:kernel32.lib /entry:MAIN
Microsoft (R) Incremental Linker Version 8.00.40310.39
Copyright (C) Microsoft Corporation.  All rights reserved.


C:\Asm\FASM\EXAMPLES\WIN64\my_example>console_test
Hello, world!
4@02AB2C9, <8@!
    
Post 28 Dec 2006, 19:02
View user's profile Send private message Visit poster's website Reply with quote
r22



Joined: 27 Dec 2004
Posts: 805
r22 29 Dec 2006, 00:33
XP 64 is 32bit compatible, so any 32bit program will run on it using the WOW64.

FASMW works fine on WIN XP 64, I've had no reason to use the commandline since I no longer live in the 1980s and GUIs<>devil Very Happy Very Happy

Fasm has issues on Vista64 when trying to run a program you compiled with FORMAT PE64 but there's no such problem on winXP 64.
Post 29 Dec 2006, 00:33
View user's profile Send private message AIM Address Yahoo Messenger Reply with quote
dasyar



Joined: 27 Feb 2005
Posts: 33
dasyar 29 Dec 2006, 12:56
Thanks for the info.
I have always worked with FASM DOS version, I found it to be easy and straight foreward. Since the FASM DOS version no longer works in a DOS box on x64, then I guess I have to make some choices; sometimes progress is very painfull.
Post 29 Dec 2006, 12:56
View user's profile Send private message Reply with quote
Azu



Joined: 16 Dec 2008
Posts: 1159
Azu 22 Jul 2009, 05:32
r22 wrote:
XP 64 is 32bit compatible, so any 32bit program will run on it using the WOW64.

FASMW works fine on WIN XP 64, I've had no reason to use the commandline since I no longer live in the 1980s and GUIs<>devil Very Happy Very Happy

Fasm has issues on Vista64 when trying to run a program you compiled with FORMAT PE64 but there's no such problem on winXP 64.
Wow, Vista can't even run 64bit PEs? That's just sad..
Post 22 Jul 2009, 05:32
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 22 Jul 2009, 08:19
dasyar: 16bit code is not supported in 64bit LONG mode - thus if a x86-64 OS wants to run 16bit applications, it would have to include an emulator. Just use the win32 console version instead Smile

Azu: of course it can - if it fails to run a PE64, either fasm is outputting it incorrectly or (more likely) there's something wrong with the source code.
Post 22 Jul 2009, 08:19
View user's profile Send private message Visit poster's website Reply with quote
Azu



Joined: 16 Dec 2008
Posts: 1159
Azu 22 Jul 2009, 08:24
f0dder wrote:
dasyar: 16bit code is not supported in 64bit LONG mode - thus if a x86-64 OS wants to run 16bit applications, it would have to include an emulator. Just use the win32 console version instead Smile

Azu: of course it can - if it fails to run a PE64, either fasm is outputting it incorrectly or (more likely) there's something wrong with the source code.
He said it's working fine on XP so there's nothing wrong with FASM or the source..
Post 22 Jul 2009, 08:24
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 22 Jul 2009, 14:58
Azu wrote:
f0dder wrote:
dasyar: 16bit code is not supported in 64bit LONG mode - thus if a x86-64 OS wants to run 16bit applications, it would have to include an emulator. Just use the win32 console version instead Smile

Azu: of course it can - if it fails to run a PE64, either fasm is outputting it incorrectly or (more likely) there's something wrong with the source code.
He said it's working fine on XP so there's nothing wrong with FASM or the source..
Different versions of Windows have slightly different constraints - like, win2k requiring at least one import (ending up) importing from kernel32, Win9x variants (and iirc also Vista or Win7?) not supporting filealign<512, et cetera. So it could very easily be either fasm or the source file that isn't clean.

64bit Vista and Win7 definitely do support PE64 files - which is pretty duh Smile

_________________
Image - carpe noctem
Post 22 Jul 2009, 14:58
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 22 Jul 2009, 16:45
Quote:

dasyar: 16bit code is not supported in 64bit LONG mode

Just a clarification here, what it is not supported is the Virtual-8086 mode, 16-bit protected mode apps can still be ran in long-mode.
Post 22 Jul 2009, 16:45
View user's profile Send private message Reply with quote
Azu



Joined: 16 Dec 2008
Posts: 1159
Azu 22 Jul 2009, 19:37
f0dder wrote:
Azu wrote:
f0dder wrote:
dasyar: 16bit code is not supported in 64bit LONG mode - thus if a x86-64 OS wants to run 16bit applications, it would have to include an emulator. Just use the win32 console version instead Smile

Azu: of course it can - if it fails to run a PE64, either fasm is outputting it incorrectly or (more likely) there's something wrong with the source code.
He said it's working fine on XP so there's nothing wrong with FASM or the source..
Different versions of Windows have slightly different constraints - like, win2k requiring at least one import (ending up) importing from kernel32, Win9x variants (and iirc also Vista or Win7?) not supporting filealign<512, et cetera. So it could very easily be either fasm or the source file that isn't clean.

64bit Vista and Win7 definitely do support PE64 files - which is pretty duh Smile
Well then those constraints should be public, so compilers can be made to work within them..
Post 22 Jul 2009, 19:37
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 22 Jul 2009, 22:36
Azu wrote:
Well then those constraints should be public, so compilers can be made to work within them..
Agreed. I haven't checked the PECOFF.DOC after PE64 was introduced, so I don't know if any of them are mentioned there... but iirc things like file alignment constraints weren't mentioned in the 32bit version.

_________________
Image - carpe noctem
Post 22 Jul 2009, 22:36
View user's profile Send private message Visit poster's website 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-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.