FAQ  •  Register  •  Login

Question about the ORG value

<<

LukeBord1

Posts: 13

Joined: Sat Jan 17, 2015 9:32 pm

Post Sat Nov 18, 2017 4:37 pm

Question about the ORG value

Maybe the question could result dumb to Assembly experts; however, is there a way to make an ORiGin memory address flexible? Saying it more clearly, even setting an ORG value in the ZXB commandline, is there a way to import the code into a new memory address?
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Wed Nov 22, 2017 11:18 pm

Re: Question about the ORG value

Currently not. What do you want to achieve exactly?
<<

LukeBord1

Posts: 13

Joined: Sat Jan 17, 2015 9:32 pm

Post Thu Nov 23, 2017 7:10 pm

Re: Question about the ORG value

boriel wrote:What do you want to achieve exactly?


...just to avoid to repeat the compile process regarding multiple bas files when the first org value is incorrectly calculated. I thought there was a way to freely import the compiled bin files as it happens with other tools like screen compressors or sound fx generators.
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Fri Nov 24, 2017 10:49 am

Re: Question about the ORG value

LukeBord1 wrote:
boriel wrote:What do you want to achieve exactly?


...just to avoid to repeat the compile process regarding multiple bas files when the first org value is incorrectly calculated. I thought there was a way to freely import the compiled bin files as it happens with other tools like screen compressors or sound fx generators.

You can, but not with ZX Basic cdeo, but with ASM code:

1) Compile your code with zxbasm for example
2) Your code must be relocatable (no org, no JP's, just JR, etc)
3) In your ZX Basic program do:

  Code:
PRINT "Hello world"
GOTO AfterBinary  : REM Avoid the CPU entering this region
MyBinary:   REM here starts your rutine
ASM
incbin "myfile.bin" ;  This include a binary file "as is"
END ASM
AfterBinary:
REM Now let's invoke the rutine

RANDOMIZE USR @MyBinary : REM @ means "address of", like "&" operator in C

Have not tested this, but it should work. Please, try this and tell me

In the mean time, just to let you know that, at this moment, ZX Basic does not have a linker (yet to be done).
But I think is what you're asking for. Basically, libraries (.BAS and asm) to be compiled once and stored in a binary format in a lib/ directory to be reused later, like C and other languages do. Still working on it.

Return to How-To & Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.

phpBB SEO