flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Hello developers i' ve got some suggestions

Author
Thread Post new topic Reply to topic
Matrix



Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 05 Sep 2004, 02:10
Hy, i'd like to suggest u some features,
-in my opinion functions, macros not used by the program, shouldn't be
included from the .inc library.
-macros could have been defined at the bottom of the asm file, i have
discovered that macro definitions work only before the use in code., this
eliminates that little thing that developer could put the macro inlude files at
the bottom of the source with the other included files.

And, i think u have very little about how to define variables, arrays, strings, nested arrays - so i think u should open at least a new board for this question.

Except these little things, i like your assembler, it rulez Cool , keep up the good work !

MATRIX
Post 05 Sep 2004, 02:10
View user's profile Send private message Visit poster's website Reply with quote
Dragontamer



Joined: 24 Aug 2003
Posts: 84
Dragontamer 05 Sep 2004, 04:38
Matrix wrote:
Hy, i'd like to suggest u some features,
-in my opinion functions, macros not used by the program, shouldn't be
included from the .inc library.


I don't quite understand why not? Fasm is plenty fast, not to mention, macros can be redefined, right?

Quote:

-macros could have been defined at the bottom of the asm file, i have
discovered that macro definitions work only before the use in code., this
eliminates that little thing that developer could put the macro inlude files at
the bottom of the source with the other included files.


No no no no... How are macro to be redefined? If you have one macro, then the entire point of the "restore" macro is lost!! Ok, restore can be used with other stuff... But thats not the point.

Quote:

And, i think u have very little about how to define variables, arrays, strings, nested arrays - so i think u should open at least a new board for this question.

Except these little things, i like your assembler, it rulez Cool , keep up the good work !

MATRIX


why not just the main one? Possibly an FAQ, have you read the documentation?
Post 05 Sep 2004, 04:38
View user's profile Send private message Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 05 Sep 2004, 05:16
Hy, sorry if my thoughts are not clear but i post an example what i mean:

file : "small.asm"
org $100
include 'big.inc'
int $20

now, when i compile this code, the whole inc file is parsed in to my little com file, and i didn't use anything of it, i hope u get the point.

When useing a 100 byte set of routines from inc file, compiler should see if the code is used or not, and include if for example function used.

on that macro thing i was just thinking of that:
if someone like me wanted to use a macro in the whole asm file, not wanting to break usage of it, could put the macro definitions on the bottom of the code, really this doesn't mater much, just that: for example u have an inc file with macros and functions - in that case, you are forced to include anything on to the top of the code, and i don't know if someone has discovered that if you include a code with the include function, it will be compiled and inserted in that EXACT position, which means that many junk maj be compiled to the begining of the com file not just taking up space, but you even have to jump the code over if you don't want it to be executed immediately. if someone whould like to see an example after this i will make one and post it.
and yes, i have read everything, and much beyond.
MATRIX
Post 05 Sep 2004, 05:16
View user's profile Send private message Visit poster's website Reply with quote
Dragontamer



Joined: 24 Aug 2003
Posts: 84
Dragontamer 05 Sep 2004, 05:42
The solution is quite simple.

Use a linker, like everyone else Smile Only include macros in .inc files, and link other files together.

<edit> Only include macros, structures, defines, and actually, anything preprocessor material in include files </edit>

Watch:

You have 3 files.
main.asm
functions.asm
functions.inc

main looks like this:
Code:
format ELF

include "function.inc"
public main

section '.text'
main:
call sub
ret

    


function.asm :
Code:
format ELF
global sub

section '.text'
sub:
mov eax, 5
ret

    


Finally, function.inc

Code:
extrn sub
    


Now you execute:
fasm function.asm function.o
fasm main.asm main.o
ld main.o function.o

This is the way C programmers handle it. And it works fine.

If you want less typing, learn how to use a makefile or an IDE.


Last edited by Dragontamer on 05 Sep 2004, 06:10; edited 1 time in total
Post 05 Sep 2004, 05:42
View user's profile Send private message Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 05 Sep 2004, 06:00
Matrix wrote:
now, when i compile this code, the whole inc file is parsed in to my little com file, and i didn't use anything of it, i hope u get the point.

If you have definitions, macros, structures, your com file will not be increased neither in a single byte because the include's contents don't go beyond preprocessor stage. If you have code snippets in your include file and you don't want unused code to be generated, you could use standard proc macro or equivalent.
Quote:
...and i don't know if someone has discovered that if you include a code with the include function, it will be compiled and inserted in that EXACT position

FASM do exactly what you expect because you write it that way. 100% control the EXACT position.
Quote:
and yes, i have read everything, and much beyond.

Everything is such a big word...
Post 05 Sep 2004, 06:00
View user's profile Send private message Yahoo Messenger Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 08 Sep 2004, 02:10
org 256
int 20h
rb $ffffff
compiled ok

org 256
int 20h
rb $fffffff
its out of memory Sad

the accurate limit was rb 41942625 on my machine +1 bytes meant not enough memory

Smile

MATRIX
Post 08 Sep 2004, 02:10
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8363
Location: Kraków, Poland
Tomasz Grysztar 08 Sep 2004, 07:27
Use "-m" switch to adjust.
Post 08 Sep 2004, 07:27
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.