Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Including / compiling code to different addresses
Hi there,

I'm in need of some advice with loading code to specific addresses.

1. A way to include a ZXBC basic file - during compilation - at a specific address. Something like this...
#INCLUDE "font.bas" ' load font relevant code to 24576
#INCLUDE "setup.bas" ' load program setup code to 24576 + compiled size of font.bas
#INCLUDE "graphicscode.bas", 38000 ' load graphics code and variables direct to address 38000.

This would see non-speed critical #INCLUDE code (and variables) first compiled to the program's ORG address (24576) and code (and variables) that must run in uncontended memory space - placed at the specified address.

2. How to directly include a binary blob to a specific address, without the use of labels and memmove, memcopy, zx7 unpack, etc. Something like this...
INCBIN "graphics.bin", 45000

It should be something like:

org <new-address>
incbin "file.bin"
But this is not suported, precisely because the "+ compiled size of font.bas" is something VERY HARD to compute.
Basically what you're asking is a LINKER to compile several .bas files into .obj code and link them at a later stage.
This project will take time. I've been investigating (that the problematic part) current linkers and will try to make obj code compatible with the one used in SDCC. So people might perhaps link SDCC code with ZXBasic one.

The main obstacle is to take 128K models (and others!) memory maps and take them into account.

Forum Jump:

Users browsing this thread: 1 Guest(s)