English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 07 August 2022, 12:29   #1
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
vasm relocation error

I am getting a few
Code:
error 39: illegal relocation
errors wih vasm.


The errors are with the following lines (note, these lines are taken from the whole routine, and are not listed like this in the code, I can post the full code if needed, but also see the attached screenshot)


Code:
move.w     #PIPEBLIT,d0
move.w     #BLITDMOD,d0

move.w     #sprheight<<6,d2; #sprheight*64 = 32*64 = 2048
 move.w     #sprwidth>>4,d3; Spritewidth / 8 = 32/8 = 4BITPLANE_SIZE_B
add.l      #SCREEN_WIDTH/8,a0; Next source Bitplane



The errors are showing on the following constants:
PIPEBLIT, BLITMOD, sprheight, sprwidth, SCREEN_WIDTH


Here is the setup for the above constants
Code:
sprheight        equ 32
sprwidth         equ 32
sprsize          equ (sprheight*4)+8; Bytes to skip to next sprite (sprheight*bytesperline+controlwords)
sprskip          equ sprsize*4

SPRxSPD          equ 1
SPRySPD          equ 2


BLITDMOD          equ (BITPLANE_WORDS*SCREEN_DEPTH)-(sprwidth/8)
PIPEBLIT          equ (PIPE_TILE_WIDTH-sprwidth)/8














Attached Thumbnails
Click image for larger version

Name:	Clipboard Image.jpg
Views:	43
Size:	183.8 KB
ID:	76258  
BippyM is offline  
Old 07 August 2022, 13:24   #2
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,170
happens when the name is not defined as equ.
jotd is offline  
Old 07 August 2022, 13:28   #3
Galahad/FLT
Going nowhere
 
Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 8,987
Are you using any includes in place of using hardware registers directly?

BLITDMOD or BLTDMOD is usually to describe $dff066, is VASM being told elsewhere that BLTDMOD is actually $dff066 and so the move.w wont work because $dff066 is being declared as a longword?
Galahad/FLT is offline  
Old 07 August 2022, 13:32   #4
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
Most likely one or more of your Equates are unknown. Maybe as a result of a typo or simply wrong case?

These relocation errors appear when you use an unknown symbol, which the assembler then assumes as being externally defined, in complex arithmetic operations. Because Relocs only allow a simple addend with a referenced symbol.

EDIT:
The equates you have shown seem correct. But also check if BITPLANE_WORDS, SCREEN_DEPTH and PIPE_TILE_WIDTH are defined. Otherwise you have equates based on unknown symbols, and the arithmetic operations with them will lead to the relocation errors.

Last edited by phx; 07 August 2022 at 13:35. Reason: Addition
phx is offline  
Old 07 August 2022, 13:59   #5
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
Quote:
Originally Posted by phx View Post
Most likely one or more of your Equates are unknown. Maybe as a result of a typo or simply wrong case?

These relocation errors appear when you use an unknown symbol, which the assembler then assumes as being externally defined, in complex arithmetic operations. Because Relocs only allow a simple addend with a referenced symbol.

EDIT:
The equates you have shown seem correct. But also check if BITPLANE_WORDS, SCREEN_DEPTH and PIPE_TILE_WIDTH are defined. Otherwise you have equates based on unknown symbols, and the arithmetic operations with them will lead to the relocation errors.

From what I can see everything is defined. Most of it is done in an external file that is included early in my code.


sprheight is defined in my constants.asm file and then only used above. I have't used it anywhere else.

I have added my code for the whole project (it is messy as I am learning).


Quote:
Originally Posted by Galahad/FLT View Post
Are you using any includes in place of using hardware registers directly?

BLITDMOD or BLTDMOD is usually to describe $dff066, is VASM being told elsewhere that BLTDMOD is actually $dff066 and so the move.w wont work because $dff066 is being declared as a longword?

I don't think so, as mentioned above, i get the error just with the sprheight declaration and that is declared and used once.


Quote:
Originally Posted by jotd View Post
happens when the name is not defined as equ.

Everything is defined that I can see, but maybe I cannot see the wood for the trees!
Attached Files
File Type: zip Overflow-code.zip (16.7 KB, 28 views)
BippyM is offline  
Old 07 August 2022, 16:15   #6
JoeJoe
Registered User
 
Join Date: Feb 2020
Location: Germany
Posts: 178
So with vasm 1.9 the whole thing can be compiled and started. But the includes are needed, otherwise the code will not run.
JoeJoe is offline  
Old 07 August 2022, 16:23   #7
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
Quote:
Originally Posted by JoeJoe View Post
So with vasm 1.9 the whole thing can be compiled and started. But the includes are needed, otherwise the code will not run.



You'll need all the data files too to run it. I'll upload it all later as I'm out with the kids now
BippyM is offline  
Old 07 August 2022, 16:33   #8
JoeJoe
Registered User
 
Join Date: Feb 2020
Location: Germany
Posts: 178
Yes I know it. You have post it on other side
JoeJoe is offline  
Old 07 August 2022, 16:34   #9
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
Quote:
Originally Posted by JoeJoe View Post
Yes I know it. You have post it on other side

Yeah differe t issue that I thiught was related to the plug in. I deleted that one but if you still have it feel free to include it here if it is needed
BippyM is offline  
Old 07 August 2022, 16:53   #10
JoeJoe
Registered User
 
Join Date: Feb 2020
Location: Germany
Posts: 178
Sorry, then I expressed myself stupidly. Your sources can be compiled without problems. I have simply copied the missing includes from the "other" project.
So I can't reproduce the error.
JoeJoe is offline  
Old 07 August 2022, 17:38   #11
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
Quote:
Originally Posted by BippyM View Post
Everything is defined that I can see, but maybe I cannot see the wood for the trees!
Phew... your example source needed a lot of changes to make it assemble on a Unix system (differing case in file names). All INCBINs were missing, so I commented them out. funcdef.i. The includes from "I" are missing, so I took my own "custom.i", and I'm not sure which SDK you were using. NDK3.9? Devpac-includes?

In the end I could assemble it, and the only error I saw was this:
Code:
vasm 1.9a (c) in 2002-2022 Volker Barthelmann
vasm M68k/CPU32/ColdFire cpu backend 2.5c (c) 2002-2022 Frank Wille
vasm motorola syntax module 3.16 (c) 2002-2022 Frank Wille
vasm test output module 1.0 (c) 2002 Volker Barthelmann

error 39 in line 43 of "src/Copper.asm": illegal relocation
        included from line 32 of "Overflow.s"
>        move.l     #(BPL0PTH<<16),d0                           ; Bitplane high pointer to $00E00000
That's because BPL0PTH does not exist, and it cannot shift an unknown symbol (hence, illegal relocation). Officially, they are called BPL1PT .. BPL6PT. No BPL0PT.

Do you have something which reproduces the other errors?

EDIT: When trying to link an executable I also notice that Sprite1a and Sprite2a are undefined.

Last edited by phx; 07 August 2022 at 17:43. Reason: More unknowns
phx is offline  
Old 07 August 2022, 18:01   #12
JoeJoe
Registered User
 
Join Date: Feb 2020
Location: Germany
Posts: 178
The symbole "BPL0PTH" is added at line 20 (include "i/custom.i") in the Overflow.s file.
JoeJoe is offline  
Old 07 August 2022, 18:08   #13
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
But there was no "i/custom.i" in the archive.

@bippy: Can you exclude a problem with VisualCode? Did you also try to assemble your project manually from the shell?
phx is offline  
Old 07 August 2022, 21:45   #14
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
Okay, so maybe I dived in abit too deep


well this is the header of my custom.i


Code:
*
* Custom chips hardware registers
*
* Written by Frank Wille in 2013, 2016.
*



Anyway I seem to be using a mixture of includes, I think I should probably replace them with a consistent set. I have some files from release 40.13 and some from an unknown release with intuition.i from release 1.3.. So I will sort this tonight I think. Any advice on which version of includes would be best? NDK3.9 maybe??




I will also go back to my source and try and clean it up. I might even restart it so that it is better structured. The issue with the sprites is the code started off just creating a screen, and then I took the agony sprite (which is an attached sprite 32px wide (so 4 sprites as it is 16 colour)) and I moved it around the screen. I then literally replaced the sprite and changed my code to get a gamescreen running.


The sprite data is actually in another directory (bin/). I probably should have included everything in my archive.


Thanks for the help. I will go and look at what you and others have pointed out and see what I can figure out further

edit: attached the custom.i I am using and bpl0pth is defined

Quote:
Originally Posted by phx View Post
Phew... your example source needed a lot of changes to make it assemble on a Unix system (differing case in file names). All INCBINs were missing, so I commented them out. funcdef.i. The includes from "I" are missing, so I took my own "custom.i", and I'm not sure which SDK you were using. NDK3.9? Devpac-includes?

In the end I could assemble it, and the only error I saw was this:
Code:
vasm 1.9a (c) in 2002-2022 Volker Barthelmann
vasm M68k/CPU32/ColdFire cpu backend 2.5c (c) 2002-2022 Frank Wille
vasm motorola syntax module 3.16 (c) 2002-2022 Frank Wille
vasm test output module 1.0 (c) 2002 Volker Barthelmann

error 39 in line 43 of "src/Copper.asm": illegal relocation
        included from line 32 of "Overflow.s"
>        move.l     #(BPL0PTH<<16),d0                           ; Bitplane high pointer to $00E00000
That's because BPL0PTH does not exist, and it cannot shift an unknown symbol (hence, illegal relocation). Officially, they are called BPL1PT .. BPL6PT. No BPL0PT.

Do you have something which reproduces the other errors?

EDIT: When trying to link an executable I also notice that Sprite1a and Sprite2a are undefined.
Attached Files
File Type: zip custom.zip (1.4 KB, 23 views)
BippyM is offline  
Old 07 August 2022, 22:26   #15
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
So... I decided to move all the constants out of the constants.asm file and included them at the bottom of the overflow.s file after all includes. The errors have now cleared
BippyM is offline  
Old 08 August 2022, 00:33   #16
Galahad/FLT
Going nowhere
 
Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 8,987
Quote:
Originally Posted by BippyM View Post
So... I decided to move all the constants out of the constants.asm file and included them at the bottom of the overflow.s file after all includes. The errors have now cleared
It might be that the file you've now moved your constants into, is now loaded/referenced earlier than the other file, which means the assembler now knows all your equates before the source uses them.
Galahad/FLT is offline  
Old 08 August 2022, 08:45   #17
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
Quote:
Originally Posted by Galahad/FLT View Post
It might be that the file you've now moved your constants into, is now loaded/referenced earlier than the other file, which means the assembler now knows all your equates before the source uses them.



Well i have a file that loads in all the includes and source files and jumps to my progstart: lable. The first include after they system includes was my constants include which had well.. You know Anyway all I have done is removed that include and instead copied the contents of it into the file. That does the including, only it's at the end... So no idea!
BippyM is offline  
Old 08 August 2022, 17:26   #18
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
Quote:
Originally Posted by BippyM View Post
edit: attached the custom.i I am using and bpl0pth is defined
Your custom.i has my header, but I am quite sure that somebody modified it and changed BPL1..6PT to BPL0..5PT. It wasn't me. The custom.i in all my games uses the official 1..6 numbering.

Such things happen, when you release your source into the public domain...

Glad that you found the issue, BTW.
phx is offline  
Old 08 August 2022, 18:37   #19
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
Quote:
Originally Posted by phx View Post
Your custom.i has my header, but I am quite sure that somebody modified it and changed BPL1..6PT to BPL0..5PT. It wasn't me. The custom.i in all my games uses the official 1..6 numbering.

Such things happen, when you release your source into the public domain...

Glad that you found the issue, BTW.

Thanks, I have no idea where I got your modified includes from. I'll source some proper updated ones
BippyM is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Infuriating vasm error DanielAllsopp Coders. Asm / Hardware 9 09 November 2021 13:41
VASM/VLINK relocation issues pipper Coders. Asm / Hardware 31 22 May 2021 12:03
compil error VASM LeCaravage Coders. Asm / Hardware 8 26 January 2021 15:05
error compiling vasm on windows Ami030 Coders. Asm / Hardware 3 28 December 2019 16:07
VASM fatal error.. jimmy2x2x Coders. Asm / Hardware 2 21 November 2014 10:27

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 17:55.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.49688 seconds with 16 queries