Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APPENDTO not respecting slot #628

Open
lajohnston opened this issue Apr 8, 2024 · 6 comments
Open

APPENDTO not respecting slot #628

lajohnston opened this issue Apr 8, 2024 · 6 comments

Comments

@lajohnston
Copy link

lajohnston commented Apr 8, 2024

Hi there,

It looks like appending data to another RAMSECTION doesn't append it to the same slot.

.ramsection "someRamData" slot 3
    someByte: db
.ends

.ramsection "someMoreData" appendto someRamData
    anotherByte:     db
.ends

The above results in wla-z80 mapping the following:

RAM slot 0 bank 0 (1 bytes (0.01%) used)
  - .RAMSECTION "someMoreData" (1 bytes).
RAM slot 3 bank 0 (1 bytes (0.01%) used)
  - .RAMSECTION "someRamData" (1 bytes).

I would expect it to append to the same slot and bank, but is the current behaviour intentional? It seems even if I change defaultslot to another value it still goes to slot 0. Assigning the slot in the appendto section results in it mapping as I'd expect. I haven't seen this issue with sections so I'm not sure if those are affected as well.

EDIT: It looks like it does affect sections too

@lajohnston lajohnston changed the title Using RAMSECTION with APPENDTO not respecting slot APPENDTO not respecting slot Apr 8, 2024
@vhelin
Copy link
Owner

vhelin commented Apr 8, 2024

Thanks for the report! I'll try to fix this latest on Wednesday this week...

@vhelin
Copy link
Owner

vhelin commented Apr 8, 2024

I think the issue here is that the assembler doesn't to any appending of .SECTIONs or .RAMSECTIONs and reports what is just written in the code. If you link the object containing this code you should see WLALINK doing the appending (here I inserted this code to the code in #630 and got this in the end:

kuva

What is interesting here that here in the output we have a report about the SLOT where the APPENDTO .RAMSECTION was put initially (0). Found out that it's a bug in WLALINK...

linked.sym:

kuva

Seems like WLALINK appends just fine, it just reports a bit wrong...

vhelin added a commit that referenced this issue Apr 8, 2024
@vhelin
Copy link
Owner

vhelin commented Apr 8, 2024

I could also try to make the assembler sniff around the code and report in your case correctly what is going to happen... unless linkfile for WLALINK specifies a new slot/bank for these .RAMSECTIONs, then the assembler would be wrong. :)

@lajohnston
Copy link
Author

great thanks :) Yes it looks like with the latest version, wlalink is reporting it fine, and wla-z80 is misreporting it in the verbose output. I'm just using a basic linkfile so no slot/bank mapping there

@lajohnston
Copy link
Author

A somewhat related feature request, would it be desirable/possible at some point to implement an optional DEFAULTRAMSLOT directive within the MEMORYMAP, which works alongside DEFAULTSLOT but acts as the default for RAMSECTIONs? I'm not sure about other systems, but for the SMS at least I believe the RAM always occupies the same slot so it perhaps makes sense to define it in one place and have all RAMSECTIONs use it

@vhelin
Copy link
Owner

vhelin commented Apr 10, 2024

DEFAULTRAMSLOT sounds like a useful feature so I'll try to implement it later this week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants