Comments (10)
fp_Gang: array[0..2] of pointer absolute $e482;
gang0, gang1, gang2 : string[15];
begin
fp_Gang[0] := @gang0;
fp_Gang[1] := @gang1;
fp_Gang[2] := @gang2;
fp_Gang[2]:='string2';
fp_Gang[1]:='string1';
fp_Gang[0]:='string0';
writeln(Pstring(fp_Gang[2]));
end.
from mad-pascal.
{$define basicoff}
{$define romoff}
type TGang = record
name: string[15];
logo: string[15];
end;
var
fp_Gang: array[0..2] of ^TGang absolute $e482;
gang0, gang1, gang2 : TGang;
begin
gang0.name := 'string1';
gang1.name := 'string1';
gang2.name := 'string2';
gang0.logo := 'red';
gang1.logo := 'white';
gang2.logo := 'black';
fp_Gang[2] := @gang2;
fp_Gang[1] := @gang1;
fp_Gang[0] := @gang0;
writeln(Pstring(fp_Gang[2].name));
writeln(Pstring(fp_Gang[1]));
writeln(Pstring(fp_Gang[2].logo));
writeln(Pstring(fp_Gang[1].logo));
repeat until false;
end.
from mad-pascal.
thanks to both of you!
i will try to see if the problem is there with the latest version and if i use correct code.
it may take a couple of days (or weeks), need to finish other work first.
from mad-pascal.
I'll check it
I remember that I had a similar problem in previous versions (2-3 years ago) and I wrote a workaround then.
I also had a problem when I was trying to calculate an index inside array brackets (the problematic array was nested within another array), and the solution was to make this calculation one step earlier
from mad-pascal.
thanks, as said, might be due to my older version. the code is embedded in a long procedure, i have to take my time to get a minimal example. for now i will then close this issue, and will reopen it if i am able to reproduce with the minimal example.
from mad-pascal.
in the latest version of MP, there is an error message when trying to use the modifier ABSOLUTE for a string array
fp_Gang: array[0..2] of String[15] absolute $e482;
compiler has no way of instantiating such an array with valid pointers to strings
such an array will contain pointers with a value of 0
from mad-pascal.
ok, but how to do it else? what i want would be at $e482 a space of 15 chars (+1 for the string length) that the user can fill (gang name is typed in at start of the game).
from mad-pascal.
var
fp_Gang: array[0..2] of String[15] absolute $e482;
begin
repeat until false;
end.
Mad Pascal Compiler version 1.7.1 [2024/02/03] for 6502
Compiling test.pas
test.pas (5,52) Error: ABSOLUTE modifier is not available for this type of array
from mad-pascal.
but that was not the initial problem. in the code above weaponnames are a usual array of strings, not fixed to an absolute address. the fp_weapon was absolute, but its an array of byte. yet, it seemed to me that mad pascal confused the indexing. as said i will check this later and reopen if need be.
from mad-pascal.
@aydindemircioglu I wrote some simple examples considering your case and got the correct result, please provide full example of your code.
from mad-pascal.
Related Issues (20)
- Compiler directives $info $warning $error not working as expected
- Determining the location (in memory) for STATICDATA
- The compiller requires write access to library files for compilation (?) HOT 2
- Incorrect algorithm in the prime numbers calculation benchmarks HOT 2
- [Feature] ORGIN directive HOT 1
- [Optimizing] Extra jump to the correct part of the procedure when there are sub-functions in the function/procedure. HOT 3
- Adding brackets to object function yields unhandled exception? HOT 1
- Phase error detection code safe to alter? HOT 1
- Very slow compile time with StrToInt? HOT 3
- No error on pointers to undeclared types HOT 1
- two peeks with an and clause might compile wrongly?
- Commander X16 target support HOT 3
- 1.6.8 still marked as "Latest" stable release instead of 1.6.9 ... is this intentional? HOT 2
- Random of a 'formula' HOT 5
- Neo6502: Illegal addressing mode (CPU 65816) HOT 1
- The sysutils unit cannot be compiled for target raw. HOT 2
- Neo6502 - concat don't work properly HOT 13
- Problem locating units on OSes with case sensitive file names
- procedure aling not workiong properly HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mad-pascal.