Jump to content
IGNORED

Mad Pascal


Recommended Posts

Hi, Tebe!

 

I experimented with $R directive for including resource data to main binary file. It works well, including RCDATA for general types of data. But I have a small problem. Resource data set is mirrored to constant value in main program in a way like this:

 

const

data = $8F00;

 

That's ok, every data in resource is linked to constant value in main program with specified memory address. Now, for my problem, which probably isn't. What I want to do is calling resource data, then declaring variable in main program without assigning it to specific memory address, but dynamically relocating resource variable to main data segment. For example, I want to do something like this (putting resource data directly to array of bytes):

 

newData : array[0..150] of byte; // Linked directly to resource data with the same name

 

Currently I have to do:

 

const

data = $8F00;

 

var

newData : array[0..150] of byte;

.

.

.

newData := Pointer(data);

.

.

.

Is this possible?

 

Greetings,

Gury

Edited by Gury
Link to comment
Share on other sites

Thank you! I thought about previous solution with const value, which works great (I actually read array of data from resource and point it to screen memory without declaring array), but you never know, the way from this patch can be useful, too.

Link to comment
Share on other sites

I had a custom routine to do inverse text, but it is unnecessary now. I can use text and * sign in resource file with RCASM directive, but this new solution is more than practical. Feature straight from MAD assembler :)

 

 

Mad Pascal 1.3.7, http://mads.atari8.info

{$R 'text.rc'}
 
var  txt: array [0..0] of byte absolute $bc40;

text.rc

txt rcasm 'text.asm'

text.asm

  dta d'Atari !'

 

I can confirm I use this text resource file feature successfully, I just have to be careful with setting offsets to specific strings. One thing I like about this stuff is, I can make more resource files with strings for specific purposes. This also makes code more readable.

Link to comment
Share on other sites

  • 3 weeks later...

Great to see new version. But I run my program and something is wrong:

c:\Atari\Appl\mp>mads.exe projects\titler\titler.a65 -x -i:base
SYSTEM: $24B4..$2559
JOYSTICK: $255A..$2559
CRT: $255A..$25FB
FASTGRAPH: $25FC..$2857
SYSUTILS: $2858..$28EF
CODE: $2000..$45FE
DATA: $45FF..$5116
        RCDATA 'MEM0101.SCR' adr.MENU0101 0 0 0 0 0 0 0 0
 ift main.ADR.MENU0101+len >= $c000
res6502.asm (221) ERROR: Undeclared label MAIN.ADR.MENU0101 (BANK=0)
        org main.ADR.MENU0101
res6502.asm (242) ERROR: Undeclared label MAIN.ADR.MENU0101 (BANK=0)
        RCDATA 'MEM0102.SCR' adr.MENU0102 0 0 0 0 0 0 0 0
 ift main.ADR.MENU0102+len >= $c000
res6502.asm (221) ERROR: Undeclared label MAIN.ADR.MENU0102 (BANK=0)
        org main.ADR.MENU0102
res6502.asm (242) ERROR: Undeclared label MAIN.ADR.MENU0102 (BANK=0)
Writing listing file...

I didn't reach $c000 memory address. Are there any modifications in code for reading resource files?

 

Greetings

Link to comment
Share on other sites

const

menu0101 = 36900;

menu0102 = menu0101 + 360;



var

functions: array [0..0] of byte absolute menu0101 + 360 + 840;


{$r 'projects\titler\titler.rc'}


titler.rc

********


menu0101 RCDATA 'MEM0101.SCR'

menu0102 RCDATA 'MEM0102.SCR'

functions RCASM 'functions.asm'





I will check anyway if a problem is in my code.


Link to comment
Share on other sites

  • 4 months later...

http://mads.atari8.info

 

MadPascal 1.4.3

 

- SYSTEM: ReadConfig, ReadSector, WriteSector
- SYSTEM: Point, Rect, Bounds, PointsEqual
- DOS: CurrentMinuteOfDay, CurrentSec100OfDay, CurrentSecondOfDay, MinuteOfDay, MinutesToTime, SecondOfDay, SecondsToTime
- MATH: Power, ArcTan2, InRange, EnsureRange, CycleToRad, DegNormalize, DegToGrad, DegToRad, DivMod, GradToDeg, GradToRad, RadToCycle, RadToDeg, RadToGrad
- LABEL, GOTO label
- {$f page} fast multiplication for types WORD, SMALLINT, SINGLE
  • Like 5
Link to comment
Share on other sites

  • 1 month later...

Hi tebe!

 

http://mads.atari8.info

 

MadPascal 1.4.3

While porting a little (very old) game from TP7 to Mad-Pascal, I found a little bug in the generated code, probably at the optimizer.

 

This code:

 

program bug;

var
    A : byte;
    B : boolean;
begin
    A := 4;

    if A = 2 then
        B := False
    else
    begin
        if A = 3 then
            A := 1;
        B := True;
    end;

    writeln(B);
end.
Should write "TRUE", but the optimizer generates a "sta B" instruction, writing a "0" to "B", so the result is "FALSE".

 

Thanks!!

  • Like 1
Link to comment
Share on other sites

Hi tebe!,

 

thx DMSC, yes it was a bug

 

new, fixed MP 1.4.5, http://mads.atari8.info/mp_145.7z

 

- UNIT support clause USES

- UNIT, section INTERFACE need procedure/function declaration

 

http://wiki.freepascal.org/Unit

 

p.s.

section INITIALIZATION, FINALIZATION is not supported

Thank you!

 

Indeed, my ported program works now :-)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...