-
Notifications
You must be signed in to change notification settings - Fork 15
math library #36
Comments
Sounds good and I think that we should start looking at compiling libraries into binaries using a variation of the ABI format. Make it like loading a dll. |
Ignore what I said earlier. We will just compile this into the library.dasm16 file for now. |
Plusmid and I are working on the format for the equivalent of .dll or .so using the ABI format for libraries. I think we should make a math lib as our first external library. The library will be setup like a normal program but will have a jumptable that is setup like this: :libmath_api Thoughts? |
sounds good. they way atlas has gone, even though its partly my working, it is getting beyond my skills. |
What will happen is that the program will call a function named, say, lib_run_func, and set A to a buffer with the library name and B to a buffer with the function name like this: SET A, myLibName Then the OS function lib_run_func searches through the loaded libraries list, finds the library with the matching name, then searches through the jump table of the library to find the function. If it finds it, it then runs it using params pushed onto the stack or maybe registers. |
ok that makes sense. what about having the lib_run_func use some other registers like x and y so registers a and b which are commonly used don't need to be pushed to the stack as often. if someone makes a library using registers a and b as parameters they wouldn't need to do as much work porting it to atlas by making the functions pop a and b back from the stack. |
Then X and Y need to be pushed. The problem is you never know if registers are unused or not. ; Get Library handler ; Get function address ; Save address for future use ; Call the function ; Free the handle (so the library can automatically be unloaded if the instance counter reaches 0) This may be a bit more compicated but this will (hopefully) be done by the compilers /assemblers later. |
a good goal would be for a library supporting
i good starting point might be entropers library https://github.com/Entroper/DCPU-16-fixedmath and a fork from vertarmis https://github.com/vietarmis/DCPU-16-fixedmath/blob/1e2e4ed49bd0e12923ee39e0b1a312fe5ef2314a/fixedmath.dasm
The text was updated successfully, but these errors were encountered: