Forum
Routine mapping? - Printable Version

+- Forum (https://www.boriel.com/forum)
+-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12)
+--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11)
+---- Forum: Wishlist (https://www.boriel.com/forum/forumdisplay.php?fid=14)
+---- Thread: Routine mapping? (/showthread.php?tid=617)



Routine mapping? - einar - 11-02-2014

Right now, ZX BASIC already supports variable mapping. If I already have a variable defined at a certain memory address, I can reference it as follows:

Code:
DIM x AS UBYTE AT 64000

It would be nice if ZX BASIC could also support routine mapping. If I already have an assembly routine implemented at a certain memory address, I would like to reference it as follows:

Code:
DECLARE sub FASTCALL doSomething(src as UINTEGER, dst as UINTEGER) AT 64000

In the meantime, I'm having to use this workaround:

Code:
sub FASTCALL doSomething(src as UINTEGER, dst as UINTEGER)
    asm
        jp 64000
    end asm
end sub


EDIT: Of course routine mapping should also work with both sub-routines and functions, either FASTCALL or not, exactly like any other ZX BASIC routine implemented in asm directly inside the routine body.


RE: Routine mapping? - einar - 02-27-2021

Bump!

Any chance this is going to be implemented?


RE: Routine mapping? - boriel - 02-28-2021

(02-27-2021, 02:55 AM)einar Wrote: Bump!

Any chance this is going to be implemented?

This is "on hold" (FUNC/SUB ... AT) because it's very platform dependent and I'm moving towards an arch-agnostic compiler.
Instead, in the future, a linker will do the final obj linking, and the developer could specify a memory-map of for functions and modules (that is, specifying where the code should be placed in memory).

Also remember you can call asm code directly with USR <address>.

For the moment your solution is the best I can think of... Confused
I'm currently working hard in namespaces and modules to allow obj files and code relocation.