Closed mvdhoning closed 5 years ago
I think this won't be a problem. I will check if it can be easily implemented in this version.
Initialize arrays is implemented now:
var
a: [3]byte = [%01010, $FF, 10];
But initialize ABSOLUTE arrays is not implemented. It's not an issue of the compiler but of the PRG file generator. Absolute variables can be far away of the code section, and the PRG would need to cover that spaces. Moreover the assembler viewer is not prepared to show differente segments of code now. I will review.
You can now initialize absolute arrays setting to a value. Not in declarartion but like a assigment instruction:
uses Commodore64;
var
a:[5]BYTE absolute $400;
begin
a := [1,2,3,4,5];
asm rts end
end.
with things possibe now i feel that
uses Commodore64;
var
adef1: [3]byte = [%01010, $FF, 10];
adef2: [3]byte = [$EE, $FF, $10];
aabs: [3]byte absolute $400;
begin
//first assing array1
aabs := adef1;
//do something
//next assing array2
aabs := adef2;
end
think i wont use aabs := [1,2,3];
but others might
also with this useable i feel less need to init a array at a specified position.
No problem. The problem with init absolute arrays, is in the output format the PRG work. It only can specify just one block of memory. If including several blocks, the intermediate RAM will be rewritten. Maybe it can be implemented using other output format.
Don't forget you can use types too:
type
Tarray3 = [3]byte;
And don't forget you can use constants too, to init arrays;
const A1 = [1,2,3];
var ar: [3]byte;
begin
ar := A1;
end.
It would be nice if we were able to init arrays with value. Also you mentioned an array could be assigned to a defined memory position.
So that would make it possible to define sprite or font data at $3000 for instance:
also a more pascal syntax way for declaring an array would be array [0..2] of byte for a size 3 array.
i know i can do
already, it just does not feel efficient.