Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Assembly (http://www.programmingforums.org/forum20.html)
-   -   32 bit assembler on x64 windows (http://www.programmingforums.org/showthread.php?t=11147)

Indigno Aug 22nd, 2006 2:47 PM

32 bit assembler on x64 windows
 
I guess I'm looking for an environment that allows me to code in 32 bit assembly on my x64 bit version of windows. I know that I should probably dual boot into x86 windows but I'd rather keep that space for more important things. And besides, it's a lot easier to use a program than a new OS. Any help would be most appreciated.

Random Spirit Aug 22nd, 2006 3:02 PM

Well your xp x64 windows can still run 32 bit code so you wont need a special assembler for x64 just any x86 one will do.

The one i used is MASM32

http://www.masm32.com/

the website is bad on the eyes, but its meant be compatible with MASM. You can use any editor to write the source and then just assemble it with MASM32. Its still only 32-bit, but unless you really need to program in 64 bits it is all you will need.

edit:- there is also NASM which is good too.

http://sourceforge.net/projects/nasm

Eoin Aug 22nd, 2006 3:27 PM

I'd recommend FASM. With that you'd be able to write 32bit or 64bit programs as you please.

Random Spirit Aug 22nd, 2006 3:29 PM

Eoin that looks great. I never heard of FASM before. Thanks.

Mad_guy Aug 22nd, 2006 4:48 PM

FASM is pretty good, you can even write 64-bit device drivers in it.

Another 64-bit assembler is GoAsm, and it's pretty slick but from what I hear, it has a week macro system (especially compared to systems like MASM.)

Eoin Aug 22nd, 2006 5:17 PM

Quote:

Originally Posted by Mad_guy
...it has a week macro system (especially compared to systems like MASM.)

FASM's macro system is also weak, but you can do some fancy things with it once you get to grips with it. I point to my own inlineable procedures as a shameless plug :rolleyes: .

Indigno Aug 22nd, 2006 10:34 PM

Which one is best for beginners?

Klarre Aug 23rd, 2006 1:33 AM

I can't say something about FASM or NASM. I have only been using TASM and MASM. I should recommend MASM to a beginner. You can almost write code as you were writing C code using MASM. It is very simple thanks to its macro system. You will also get a lot of tutorials and sample applications with the assembler.

Cache Aug 23rd, 2006 8:55 AM

FASM mixed with the Win32 API is pretty easy to pick up. I'd had a go with MASM and not really gotten anywhere, tried FASM and had a working GUI'd Win32 app running within a few hours.

This is what I came up with. It's laughable in just about every respect, but it's a start. I call it 'FDelete' because it's made with FASM and it deletes things:

:

  1. format PE GUI 4.0
  2. entry start
  3.  
  4. include '%fasminc%\win32a.inc'
  5.  
  6. ID_EDIT      = 101
  7. ID_DIALOG    = 50
  8. MB_INFO      = MB_OK+MB_ICONINFORMATION+MB_SETFOREGROUND
  9. MAX_PATH    = 100h
  10.  
  11. section '.data' data readable writeable
  12.  
  13.   _edittext  rb MAX_PATH
  14.   _strbuff    rb 1024
  15.  
  16.   _progname  db 'FDelete',0
  17.   _cnd          db 'Could not delete: %s',0
  18.   _fsd          db '"%s" successfuly deleted',0
  19.  
  20. section '.code' code readable executable
  21.  
  22.   start:
  23.     invoke    GetModuleHandle,0
  24.     invoke    DialogBoxParam,eax,ID_DIALOG,HWND_DESKTOP,DialogProc,0
  25.     invoke    ExitProcess,0
  26.  
  27. proc DialogProc uses ebx esi edi,hwnddlg,msg,wparam,lparam
  28.     cmp    [msg],WM_COMMAND
  29.     je    wmcommand
  30.     cmp    [msg],WM_CLOSE
  31.     je    wmclose
  32.     xor    eax,eax
  33.     jmp    finish
  34.   wmcommand:
  35.     cmp    [wparam],BN_CLICKED shl 16 + IDOK
  36.     jne    processed
  37.     invoke    GetDlgItemText,[hwnddlg],ID_EDIT,_edittext,MAX_PATH
  38.     cmp    eax,0
  39.     jbe    processed
  40.     invoke    DeleteFile,_edittext
  41.     cmp    eax,0
  42.     jne    success
  43.     jmp    failure
  44.   success:
  45.     cinvoke wsprintf,_strbuff,_fsd,_edittext
  46.     jmp    show
  47.   failure:
  48.     cinvoke wsprintf,_strbuff,_cnd,_edittext
  49.   show:
  50.     invoke    MessageBox,[hwnddlg],_strbuff,_progname,MB_INFO
  51.     jmp    processed
  52.   wmclose:
  53.     invoke    EndDialog,[hwnddlg],0
  54.   processed:
  55.     mov    eax,1
  56.   finish:
  57.     ret
  58. endp
  59.  
  60. section '.idata' import data readable writeable
  61.  
  62.   library KERNEL32,'KERNEL32.DLL',\
  63.       USER32,'USER32.DLL'
  64.  
  65.   import KERNEL32,\
  66.     GetModuleHandle,'GetModuleHandleA',\
  67.     ExitProcess,'ExitProcess',\
  68.     DeleteFile,'DeleteFileA'
  69.  
  70.   import USER32,\
  71.     DialogBoxParam,'DialogBoxParamA',\
  72.     GetDlgItemText,'GetDlgItemTextA',\
  73.     MessageBox,'MessageBoxA',\
  74.     EndDialog,'EndDialog',\
  75.     wsprintf,'wsprintfA'
  76.  
  77. section '.rsrc' resource data readable
  78.  
  79.   directory RT_DIALOG,dialogs
  80.  
  81.   resource dialogs,ID_DIALOG,LANG_ENGLISH+SUBLANG_DEFAULT,fdeldialog
  82.  
  83.   dialog fdeldialog,'FDelete',0,0,190,65,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME+DS_CENTER
  84.     dialogitem 'STATIC','File Path:',-1,10,10,70,8,WS_VISIBLE
  85.     dialogitem 'EDIT','',ID_EDIT,10,20,170,13,WS_VISIBLE+WS_BORDER+WS_TABSTOP
  86.     dialogitem 'BUTTON','OK',IDOK,130,40,45,15,WS_VISIBLE+WS_TABSTOP+BS_DEFPUSHBUTTON
  87.   enddialog

BTW, the odd indentation is caused by the forum.


All times are GMT -5. The time now is 10:17 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC