flat assembler
Message board for the users of flat assembler.
Index
> Main > converting Fasm to gas |
Author |
|
LocoDelAssembly 07 Oct 2009, 21:58
Quote:
|
|||
07 Oct 2009, 21:58 |
|
fpga 08 Oct 2009, 09:13
Thank you for your response.
I did think that last night but not any more. I couldn't work out how the end of the string "some_string" was detected. I now think the two statements above just load only the address (label_1) of the asciz string into ebx. The string is a device file name and last night I was wondering how the program "knew" where the end of that filename, ie the 0, was. I now think the system call, denoted by 5 in eax, which opens the file, named "some_string", only needs the string's start address in ebx i.e. I think it then moves along from that address until it finds the '0' and then opens the file with that string name. Here's the Fasm code. Code: section ".text" ;================= mov eax, 5 ;open the file mov ebx, label_1 ;file name mov ecx, 02o ;read and write mov edx, 600o ;read and write for the user int 80h ;open section ".data" ;================= label_1 db "some_string", 0 I asked on the masm32 forum and Greg very kindly posted this conversion Code: .intel_syntax noprefix .arch pentium .global _start .data label_1: .asciz "some_string" .text mov ebx, OFFSET label_1 .end |
|||
08 Oct 2009, 09:13 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.