flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > Customizing FASM |
Author |
|
scientica 01 Jul 2003, 12:56
Why do you want an instruction/directive to make a label?
in fasm.txt privalov wrote: The last and the most flexible way to define labels is to use "label" _________________ ... a professor saying: "use this proprietary software to learn computer science" is the same as English professor handing you a copy of Shakespeare and saying: "use this book to learn Shakespeare without opening the book itself. - Bradley Kuhn |
|||
01 Jul 2003, 12:56 |
|
Tommy 01 Jul 2003, 13:40
That was only an example... I want an instruction in which declares a label and output some bytes to the output file... (Please don't suggest macros) I only want to know how to do it, you'll probably see what it will be used for later.... So, do you know how?
Thanks for your reply anyway.... So long! Tommy |
|||
01 Jul 2003, 13:40 |
|
scientica 02 Jul 2003, 11:19
Tommy wrote: That was only an example... I want an instruction in which declares a label and output some bytes to the output file... Ok, sorry I miss understood you. _________________ ... a professor saying: "use this proprietary software to learn computer science" is the same as English professor handing you a copy of Shakespeare and saying: "use this book to learn Shakespeare without opening the book itself. - Bradley Kuhn |
|||
02 Jul 2003, 11:19 |
|
Tomasz Grysztar 02 Jul 2003, 12:00
You'll probably have a good reference when I finish the internals documentation, but currently I can only provide you with a small example. You'll have to make three modifications, I give line numbers for the 1.47 version of core. First you have to put two new lines into the X86.INC file, between the lines 7730 and 7731 (after the definition of cvttss2si instruction handler):
Code: db 'makelabel',0 dw makelabel_directive-assembler The you have to put two new lines into the PARSER.INC file, in line, after the line 178 add: Code: cmp bx,makelabel_directive-assembler je parse_label_directive And finally you have to put the handler for newly defined directive into ASSEMBLE.INC file, you can put it anywhere: Code: makelabel_directive: lods byte [esi] cmp al,2 jne invalid_argument lods dword [esi] cmp eax,0Fh jb invalid_use_of_symbol je reserved_word_used_as_symbol inc esi mov ebx,eax xor cl,cl mov eax,edi sub eax,[org_origin] cdq mov ebp,[org_sib] call operand_32bit_prefix mov byte [edi],50h inc edi jmp define_free_label Directive defined this way should work exactly as in your example above. |
|||
02 Jul 2003, 12:00 |
|
Tommy 03 Jul 2003, 09:08
I understand scientica....
Thank you Privalov! Exactly what I needed.... Thanks again! So long! Tommy |
|||
03 Jul 2003, 09:08 |
|
Tommy 04 Jul 2003, 08:49
When we're talking about custom instructions etc., what about adding your old tutorial on how to customize FASM instructions etc. to the documentation??
Regards, Tommy |
|||
04 Jul 2003, 08:49 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.