flat assembler
Message board for the users of flat assembler.

Index > Windows > Starting programming assembly in windows

Author
Thread Post new topic Reply to topic
Lengua_Maquinista



Joined: 05 Apr 2017
Posts: 4
Lengua_Maquinista 06 Apr 2017, 17:49
Hello everyone, I have some experience learning assembly language in Ubuntu, I can easily use a compiler and linker and subsequently run a program compiled in assembly. However, I have had various problems installing and using compilers and linkers in Windows 7. Ideally, you should just be able to install a program and have it work, but I MASM also didn't afford me this luxury, in order to do what I want the fallowing things are necessary:

-text editor (not a problem)

-properly installed compiler and linker

-command line programs (or GUI programs...) that are properly installed and configured to assemble and link programs

-all properly installed to run the text off the terminal when you execute the program....

Would any of you be able to give me a correct series of instructions/downloads so that I can accomplish this? I realize I could just go back to ubuntu but I don't want to do that because the tethering program wasn't working before and it might not work again....

Thanks
Post 06 Apr 2017, 17:49
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20358
Location: In your JS exploiting you and your system
revolution 06 Apr 2017, 18:15
fasm doesn't need to be installed, just copy the executable file to your path and run it.

fasm can be used without a linker. fasm can also be used with a linker if you wish to.

The download page is linked at the bottom of this page that you are reading now.
Post 06 Apr 2017, 18:15
View user's profile Send private message Visit poster's website Reply with quote
Lengua_Maquinista



Joined: 05 Apr 2017
Posts: 4
Lengua_Maquinista 06 Apr 2017, 21:47
I guess there are bugs or something in the code im trying to run.......because when I copy this into the assembler and tell it to run i get an error:

Code:
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

;                 Build this with the "Project" menu using
;                       "Console Assemble and Link"

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    .486                                    ; create 32 bit code
    .model flat, stdcall                    ; 32 bit memory model
    option casemap :none                    ; case sensitive
 
    include \masm32\include\windows.inc     ; always first
    include \masm32\macros\macros.asm       ; MASM support macros

  ; -----------------------------------------------------------------
  ; include files that have MASM format prototypes for function calls
  ; -----------------------------------------------------------------
    include \masm32\include\masm32.inc
    include \masm32\include\gdi32.inc
    include \masm32\include\user32.inc
    include \masm32\include\kernel32.inc

  ; ------------------------------------------------
  ; Library files that have definitions for function
  ; exports and tested reliable prebuilt code.
  ; ------------------------------------------------
    includelib \masm32\lib\masm32.lib
    includelib \masm32\lib\gdi32.lib
    includelib \masm32\lib\user32.lib
    includelib \masm32\lib\kernel32.lib

    .code                       ; Tell MASM where the code starts

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

start:                          ; The CODE entry point to the program

    print chr$("Hey, this actually works.",13,10)
    exit

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

end start                       ; Tell MASM where the program ends    


actually, it seems like the libraries just aren't installed properly for this code to be able to run it because it highlights the "include" line....looks like i need to run a simpler program

Edit by revolution: Added code tags
Post 06 Apr 2017, 21:47
View user's profile Send private message Reply with quote
Trinitek



Joined: 06 Nov 2011
Posts: 257
Trinitek 06 Apr 2017, 22:15
If you want to build MASM code, use MASM. FASM has its own set of macros and syntax.
Post 06 Apr 2017, 22:15
View user's profile Send private message Reply with quote
Lengua_Maquinista



Joined: 05 Apr 2017
Posts: 4
Lengua_Maquinista 06 Apr 2017, 22:46
Okay, I'll just read the documentation for FASM what I should have done in the first place, thanks

edit: Now that i did that, i ran the "Beer" program and omfg that was hilarious!
Post 06 Apr 2017, 22:46
View user's profile Send private message Reply with quote
catafest



Joined: 05 Aug 2010
Posts: 129
catafest 07 May 2017, 18:25
Read the https://flatassembler.net/docs.php and use internet to find tutorials and docs.
If don't want to use FASM editor you can use the SAMS editor - https://dman95.github.io/SASM/english.html :
Come with example projects:
Code:
format ELF64

section '.data' writeable
    msg db 'Hello, world!', 0
    formatStr db "%s", 0

section '.text' executable
public main
extrn printf
main:
    mov ebp, esp; for correct debugging
    mov rbp, rsp; for correct debugging
    sub rsp, 32
    and rsp, -16
    mov rcx, formatStr
    mov rdx, msg
    call printf
    mov rsp, rbp
    xor eax, eax
    ret    
Post 07 May 2017, 18:25
View user's profile Send private message Visit poster's website Yahoo Messenger Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 08 May 2017, 13:57
Trinitek wrote:
If you want to build MASM code, use MASM. FASM has its own set of macros and syntax.


True, MASM and FASM are not really compatible, so old code will need rewriting.

Although, for "MASM"-style, I would say use JWasm (or HJWasm??) instead and read Art of Assembly if you want some kind of (MASM syntax) tutorial.

Or (untested) buy Ray Seyfarth's (cheap) 64-bit assembly book(s), which are apparently quite good (and use YASM and his GDB frontend/IDE called EBE).
Post 08 May 2017, 13:57
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.