flat assembler
Message board for the users of flat assembler.
Index
> Main > Compiler using FASM |
Author |
|
denial 20 Feb 2005, 22:32
I'm a newbie too, but I hope I can help you:
If you wanna write a compiler, it should also be fast. I think using external C functions will make your language pretty slow. So maybe you should write your functions in assembler. However, I think it's possible to use extern C functions. You can either write an own DLL in C and import it at runtime with the library/import-macros, or you can use the C-libary provided by windows. I read about somewhere. |
|||
20 Feb 2005, 22:32 |
|
Azh321 21 Feb 2005, 00:01
Actually it doesnt matter if its fast. With todays cpu speeds and such, plus this is a simple language. And im a not a "newbie" or else I wouldnt be programming a compiler. I have decided what I will be doing for the generated asm though.
I will program each of the built-in functions in asm and it will include that at the bottom of the asm source and call that when needed. |
|||
21 Feb 2005, 00:01 |
|
vid 21 Feb 2005, 00:31
well, azh. I see it that way: if you see that compiler is problem that you cannot solve by your own,m than it is too hard taks for you FOR NOW (it will change in soon future if you keep it up with asm). Try to make some text-file parser or simple ineterpreter, i believe you will son see what i was talking about. Just keep your compiler project for yourself until you can make it, and try some similar but simpler tasks before. The general rule is: trust yourself. I've done it this way and i think i 've made it far enough without embarassing myself.
|
|||
21 Feb 2005, 00:31 |
|
Azh321 21 Feb 2005, 00:46
Where do you guys get the part of me being a noob? I have made interpreters, I have made VM's. I have even worked on a few cpu emulators. Why would I ever want to make a simple one when I have made complex ones already? I CAN make this, all I was asking was if there was something similar to NASM's extern keyword.
|
|||
21 Feb 2005, 00:46 |
|
vid 21 Feb 2005, 00:56
sorry then, there's too many newbies asking now so i was fooled by the fact. But nayway, there is keyword "extrn", just look at http://flatassembler.net/docs.php?article=manual#2.4.3. you know, RTFM.
I hope that's what you was asking for. |
|||
21 Feb 2005, 00:56 |
|
Azh321 21 Feb 2005, 01:06
Yes, I saw that. But thanks for helping.
|
|||
21 Feb 2005, 01:06 |
|
calm_observer 21 Feb 2005, 21:30
Azh321 wrote: Im writing a compiler, its in C, and it generates an asm file...he just uses C functions.... "extern printf" and such so he can use any functions...is there a similar way to do that? I am for certain not a fasm expert, but I think what you are looking for comes under the assembler directives 'import', 'export' and 'extrn', look under section '2.4 Formatter Directives' and varies depending upon the output format. You can find an example for both Portable Executable in PEDEMO.ASM and mscoff in MSCOFF.ASM in the examples that come with the assembler. Also you need to look at the various forms of the 'invoke' macros. As someone new to fasm you will find (I am finding) that you'll need to put in some work when it comes to understanding macros, this was also true when I used nasm. Check the macro section on this forum for more help than I can possibly give you. Now to your compiler. You may want to check out this site http://www-personal.umich.edu/~williams/archive/forth/hatforth/hatforth.html "^Forth (pronounced "hat Forth", or "to the power Forth") is a dialect of Forth intended for automatic text translation into source for the implementation language of a normal Forth. It grew out of a set of assembly language macros dating back to mid-1991, written for the Ann Arbor macro assembler (AAma by Martinus Veltman) to run on Motorola 680x0 cpu's under a variety of operating systems." Finally, keep us posted as to your progress _________________ EDUCATION, n. That which discloses to the wise and disguises from the foolish their lack of understanding. |
|||
21 Feb 2005, 21:30 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.