flat assembler
Message board for the users of flat assembler.

Index > Windows > processed: BITS 32. Illegal instructions ,error on compile

Author
Thread Post new topic Reply to topic
fasmt



Joined: 09 Jul 2021
Posts: 2
fasmt
I tried to compile the below code using the "fasm" command, but it gives the error shown in the heading.


Code:

BITS 32

%include        'training.s' 

global main
extern  exit    

; ===============================================
section .text

    ; The program begins here:

    call    read_hex
    mov     ecx,eax
    call    read_hex
    sub     eax,ecx
    jnz     l1

    mov     eax,1
    call    print_eax
    jmp     l2

l1:
    mov     eax,0
    call    print_eax
l2:

    ; Exit the process:
        push    0
        call    exit
    
Post 09 Jul 2021, 05:03
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18469
Location: In your JS exploiting you and your system
revolution
What you appear to have there is NASM code (or MASM, or whatever) and not FASM code.

The fasm equivalent of "bits 32" is "code32".

But even after changing that you will discover that there are a bunch of other problems further on.

Good luck with your coursework.
Post 09 Jul 2021, 19:01
View user's profile Send private message Visit poster's website Reply with quote
fasmt



Joined: 09 Jul 2021
Posts: 2
fasmt
Hi yes , this example is for "yasm" I guess. Downloaded the correct one now. Thanks a lot
Post 12 Jul 2021, 04:50
View user's profile Send private message 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.