6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 22, 2024 5:22 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue Dec 28, 2021 4:24 am 
Offline

Joined: Sun Nov 28, 2021 7:38 am
Posts: 8
Hello,

I have a small problem with the use of the VLINK. I hope someone can help me:

In the VIC-20 program source code, I am using the *=<expression> to define the base address for the code section (starts at $1001) and the character section (starts at $1C00):
Code:
*=$1001
; Code and data
...
*=$1C00
; Character RAM
...


When I am using VASM (oldstyle syntax module) to create a binary from assembler source code it all works fine and it produces the .prg file with:
    - Two bytes header
    - Followed by code section with the machine code and data
    - Followed by the area filled with zeros
    - Starting with the position $C02 (because of the 2 bytes header) in the file are appended custom characters.

However, when I use VASM to create the object file followed by calling the VLINK linker to create a binary the *=1$C00 is ignored and the character section starts immediately after the code section without the area filled with zeros, so the app does not work properly…

Please see attached image:

Code:
Broken external image link
https://gcdn.pbrd.co/images/rMtBoCi129Vg.png?o=1

Many thanks for your help
STeN


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 30, 2021 4:33 pm 
Offline

Joined: Thu Apr 23, 2020 5:04 pm
Posts: 53
stenlik wrote:
However, when I use VASM to create the object file followed by calling the VLINK linker to create a binary the *=1$C00 is ignored and the character section starts immediately after the code section without the area filled with zeros, so the app does not work properly…

Because many object file formats do not store target addresses, when using a linker and relocatable object files, you usually specify the memory layout in a linker script. This is very flexible but a bit more effort. The oldstyle syntax module creates a new section for every org directive. A linker file for your case could look like this:

Code:
MEMORY
{
 ram : org = 0x1001, len=0x4000
}

SECTIONS
{
 code: { *(seg1001) } >ram
 fill: { .=.+0x1c00-0x1001-SIZEOF(code);}
 chars: { *(seg1c00) } >ram
}

The section names seg* are generated from the addresses. You could also use a named section, but then the code will not work without a linker.

I am not sure at the moment if it is also possible to have the oldstyle syntax module generate a single section with the gaps filled, eliminating the need for a linker script. I will check this with the author of that module.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 20 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: