flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
Roman 02 May 2023, 17:55
Very interesting see, how in preprocessing apply usr_dll proc call after load.
Code: virtual at 0 tt:: txt db '12.0' end virtual load a dword from tt:txt usr_dll 'cos',a ;this must run user proc, and set a=cos(12) mov eax,a ;now eax =0.978147 ;or sand address tt:: txt to usr_dll proc virtual at 0 tt:: txt2 dd 10,20,30,2,4,5 txt3 dd 0,0,0,0 ;output result cross product end virtual usr_dll 'cross_product_Vec3',tt:txt2,tt:txt3 We could do fasm preprocessing more powerful. Last edited by Roman on 03 May 2023, 12:26; edited 1 time in total |
|||
![]() |
|
revolution 02 May 2023, 18:30
I think if you want to make a suggestion then breaking it down to the lowest possible complexity would be best.
For example, there is no need to complicate the above code with unnecessary virtual blocks. You could just show this: Code: usr_dll 'cos', result, 1.2345 You could also try writing the code yourself and posting the result for others to use if they wish. Maybe one day it could find its way into fasm if it is popular enough. |
|||
![]() |
|
Roman 02 May 2023, 19:07
Quote:
This is simple example. I want generated terrain vertex mesh data, or calculating on fly, 12 matrices4x4 in preprocessing. Or changed array positionXYZ objects for 3d level. Or usr_dll proc split text from file to parts and put to fasm data textCharTom,textCharNick,textCharChief This reason I needed out calculated data to fasm data. Than fasm work as usual with virtual or dd data. Or usr_dll proc work like as macro(more simple or complicated) and calculating some specific tasks. Usr_dll proc could changed equ\define\data. And change the macro name for some situation. Code: usr_dll 'cos', result, 1.2345 some fasm code macro a1 { mov eax,result } macroset equ 0 usr_dll 'if_equal', result, 1.2345 ,macroset,a1 ;to macroset return 0 or macro a1 if macroset >0 macroset ;in hear usr_dll 'if_equal' put fasm macro a1 end if |
|||
![]() |
|
ProMiNick 02 May 2023, 20:27
for any task thou should chose best instrument.
purpose of preprocessor is to make translation of one texts to another and making simple calculations. if thou expect floating point calculations as some kind of preprocessor wrapping over external to compiler OS interfaces (API or syscalls), so why not use completely external tool for such calculation and to leave for preprocessor tasks it was designed for? |
|||
![]() |
|
Roman 02 May 2023, 20:42
Because fasm preprocessor not universal, and exist many direction whear is need some special and not ordinary solution.
For simple example fasm not have vector cross,dot product, sqrt, matrices multiplication, and many etc. ProMiNick If fasm preprocessor so good, why Tomasz writing calm and fasmg ?! Some times Tomasz writes new supper-fasmg version, because fasmg not ready for new modern tasks. For example quantum or neural networks. This more flexible's and simple way add new feature in fasm. User_dll 'calm', param1,...,param12 Another moment, Tomasz not physically can write many solutions. Usr_dll gives parallel development for many people for many directions,on different programming languages. Last edited by Roman on 02 May 2023, 21:44; edited 4 times in total |
|||
![]() |
|
revolution 02 May 2023, 20:50
I looks to me like you want to transform the preprocessor into a fully fledged HLL compiler.
At what point does one realise that they stopped writing assembly and transitioned into writing HLL? |
|||
![]() |
|
Roman 02 May 2023, 20:55
Quote:
Some task yes, some not. If you want, you write as usual fasm code, or using many user_dlls and thousands procs and ready solution, for different tasks. For example parse complex math expression (as science math for molecules) to fasm data or code algorithm. Parse php to own format. Or video\audio decoding,encoding for neural algorithms. Good example. Writing hands thousands data values and enums(as usual do in fasm), or using usr_dll 'get_Tabdata_sin',0,360,0.2 ;and get to fasm auto generated sin tab for all 360 degrees , with step 0.2 ! Second profit we not see this big data ! Only fasm preprocessing see and work with this big data ! Something like as do in fasm rept: Code: rept 360*10 n:0 { sin(n) } ;small code, but generated big data ;but rept not powerful as could be usr_dll 'many_procs' ! ;and do more cool and complex datas generations tricks. rept 360*500 n:0 { sqrt(dot(sin(n)+cos(n/2),n))*0.85*vec3(n*0.1,n/6,n*0.05) } ;Or hands writing couples weeks very big data as usual. |
|||
![]() |
|
revolution 03 May 2023, 11:28
Your proposal is very Windows centric. fasm has many other targets that it can be used on. How would you suggest to make it more universal for other use cases? For example, how could a Linux user, or someone using the libc version, make use of user_dll?
|
|||
![]() |
|
Roman 03 May 2023, 12:05
For arm or Linux use different user_dll libs.
We not using windows dll on Linux or on ARM. Now we using fasm for arm and fasm for windows. And no problems. Fasm task only load usr_dll and call name proc. That's all. On arm library load one way and call procs. On window another way load library and call procs. This path is determined by the version fasm(arm or windows or linux) |
|||
![]() |
|
revolution 03 May 2023, 12:34
Roman wrote: For ... Linux use different user_dll libs. Code: ;*** only use this source for Windows host *** ;... user_dll 'super_matrix_converter', my_matrix, cols, rows, ... ;... Code: ;*** only use this source for Linux host *** ;... user_so 'super_matrix_converter', my_matrix, cols, rows, ... ;... Code: ;*** only use this source for libc host *** ;... user_??? 'super_matrix_converter', my_matrix, cols, rows, ... ;... ![]() Note that this doesn't involve ARM, it affects fasm and the OS host, not the CPU you are programming for. |
|||
![]() |
|
Roman 03 May 2023, 15:04
How fasm arm load dll for arm ?
Code: ;off user_dll and all user_dll fasm preprocessor ignored ! user_modeOff ;windows user_dll 'super_matrix_converter', my_matrix, cols, rows, ... ;Linux user_dll 'super_matrix_converter', my_matrix, cols, rows, ... ;arm user_dll 'super_matrix_converter', my_matrix, cols, rows, ... How work user_dll is determined by the version fasm ! User_dll must be as part fasm, like as macro,match,irp etc. If you don't like user_dll, named user_preprocessor_function. |
|||
![]() |
|
revolution 03 May 2023, 15:14
It isn't the name that matters. It is the implementation. You need to maintain many different versions of "user_dll" for each OS and each CPU mode. If someone is trying to compile your code on a 32-bit Linux system but only have a 64-bit Windows version of user_dll then how?
BTW, ARM is not an OS. ARM can run both Windows and Linux, same as x86. |
|||
![]() |
|
Roman 03 May 2023, 15:17
This work in fasm without problems, with user_dll i not see difference.
Code: ;code user_dll Matrix, my_matrix, cols, rows, ... SECTION '.idata' IMPORT DATA READABLE WRITEABLE ;executable library kernel32, 'KERNEL32.DLL' ;roughly something like this SECTION '.usrdll' IMPORT DATA library usrmath,'usermath.dll' import usrmath,\ Matrix,'super_matrix_converter' |
|||
![]() |
|
revolution 04 May 2023, 02:11
I may have misunderstood what you want. I thought you wanted Tomasz to write your stuff for you. But if all you want is to make your own custom version of fasm then you don't need to modify the preprocessor, you could introduce your own operators.
Code: mov eax, cos 1.618 load x dword from y store cos x + sqrt 3.141 at z dd 1.234 * tanh 0.5 |
|||
![]() |
|
Roman 04 May 2023, 05:16
Wath is mean?
Quote: mov eax, cos 1.618 Did this worked in Fasmw 1.73? Or thi is new feature, for New version fasm? I try in fasmw 1.73 compile error Code: mov eax, cos 1.618 |
|||
![]() |
|
Roman 04 May 2023, 06:06
Quote:
How do this ? I don't know how do this. |
|||
![]() |
|
revolution 04 May 2023, 15:12
You can add operators to tables.inc and update the expression parser/evaluator:
Code: single_operand_operators: db 1,'+',82h db 1,'-',83h db 3,'bsf',0E0h db 3,'bsr',0E1h ; add COS here db 3,'not',0D0h db 3,'plt',0F1h db 3,'rva',0F0h ; add SIN/SQRT here db 0 |
|||
![]() |
|
Roman 04 May 2023, 16:14
Code: single_operand_operators: db 1,'+',82h db 1,'-',83h db 3,'bsf',0E0h db 3,'bsr',0E1h ; add COS here db 3,'not',0D0h db 3,'plt',0F1h db 3,'rva',0F0h ; add SIN/SQRT here db 0 Its just names. But how fasm do calculation cos or sqrt ? In PREPROCE.INC i must writing my code ? And db 3,'bsr',0E1h Wath number i must writing for cos or sqrt ? Like as 0E1h number for bsr Last edited by Roman on 04 May 2023, 16:35; edited 1 time in total |
|||
![]() |
|
revolution 04 May 2023, 16:31
First number is the name length, second is the name, third is the priority. Example:
Code: db 3,'cos',0xd1 db 4,'sqrt',0xd2 |
|||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.