English Amiga Board


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

 
 
Thread Tools
Old 26 January 2021, 10:43   #1
LeCaravage
Registered User
 
LeCaravage's Avatar
 
Join Date: May 2017
Location: AmigaLand
Posts: 459
compil error VASM

Hi,

May be someone could help.
I've got a strange error when trying to assemble using Vasm :

error 31 in line 41 of "part6.s": expression must be constant
>bufpokt: blk.w HF,0 ; buffer scrolltext


HF is defined below the "blk.w". H=12.
Before the bufpokt label I have an "even" directive.
After this block I have also valid instructions.


I tried to use other constants and same error.
Very strange. Really no idea what's going on.

Edit :

If I replace blk.w HF,0 by dc.b HF it works.

If I set HF=512 and let the dc.b, then no errors also. 512 is not a byte it should display an error or at least a warning. May be vasm set the complementary to 255 ?

Last edited by LeCaravage; 26 January 2021 at 10:50.
LeCaravage is offline  
Old 26 January 2021, 10:52   #2
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,409
As far as I understand it, this is because VASM doesn't know symbols unless they're defined prior to the actual use of them. There are two solutions for this that I've used (there may be more, there may be better ones):

1) define HF before the line that uses it.
Code:
HF	EQU	<something>

... etc ...

bufpokt: blk.w HF,0 ; buffer scrolltext
2) define HF as an external symbol in an include file and include that in the file that uses HF
Code:
Include file:

	XREF	HF

Source file:
	include file_that_has_hf_xref.i

... etc ...

bufpokt: blk.w HF,0 ; buffer scrolltext

Last edited by roondar; 26 January 2021 at 10:54. Reason: Spelling / examples
roondar is offline  
Old 26 January 2021, 10:54   #3
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,162
I think blk.w / ds.w needs constant values. XREF isn't going to cut it. You need something like HF = 300 (equate/define)
jotd is offline  
Old 26 January 2021, 10:56   #4
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,409
Quote:
Originally Posted by jotd View Post
I think blk.w / ds.w needs constant values. XREF isn't going to cut it. You need something like HF = 300 (equate/define)
I was indeed assuming HF was defined like as a constant, yes.
roondar is offline  
Old 26 January 2021, 10:58   #5
LeCaravage
Registered User
 
LeCaravage's Avatar
 
Join Date: May 2017
Location: AmigaLand
Posts: 459
Roondar, you're the man !

If moved the Hf = 12 within the include file (the definition was at first in top of main.s) and it fixed the pb. I guess the Xref does also the trick.
AFAIK Seka doesn't need this.

Thanks pal,
LeCaravage is offline  
Old 26 January 2021, 11:05   #6
LeCaravage
Registered User
 
LeCaravage's Avatar
 
Join Date: May 2017
Location: AmigaLand
Posts: 459
@jotd and Roondar : I'm dumb in english, I used below instead of above in first post ^^
LeCaravage is offline  
Old 26 January 2021, 12:08   #7
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
Quote:
Originally Posted by LeCaravage View Post
error 31 in line 41 of "part6.s": expression must be constant
>bufpokt: blk.w HF,0 ; buffer scrolltext


HF is defined below the "blk.w". H=12.
When you only defined H, then HF is undefined and the error is expected. The BLK directive allocates memory, so the size-expression must be constant as jotd correctly pointed out.

Otherwise there should be no problem, even when defining HF below the BLK-directive:
Code:
frank@nerthus cat blkexpr.s 
        blk.w   HF,0
HF=12
frank@nerthus vasmm68k_mot blkexpr.s 
vasm 1.8i (c) in 2002-2020 Volker Barthelmann
vasm M68k/CPU32/ColdFire cpu backend 2.3m (c) 2002-2020 Frank Wille
vasm motorola syntax module 3.14a (c) 2002-2020 Frank Wille
vasm test output module 1.0 (c) 2002 Volker Barthelmann

CODE(acrx1):              24 bytes
Quote:
If I replace blk.w HF,0 by dc.b HF it works.
Then HF does no longer define the size of a memory block, but just a value in memory. That's an important difference. So the assembler generates an 8-bit relocation entry, which must be resolved by the linker.

Quote:
If I set HF=512 and let the dc.b, then no errors also. 512 is not a byte it should display an error or at least a warning.
It does.
Code:
frank@nerthus cat byterange.s 
        dc.b    HF
HF=512
frank@nerthus vasmm68k_mot -quiet byterange.s 

error 2040 in line 1 of "byterange.s": data out of range
>       dc.b    HF
Maybe another typo?
phx is offline  
Old 26 January 2021, 14:10   #8
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,409
I don't know what I was thinking there... You're of course fully correct.
Next time I'll be sure to check first and then write

Anyway, I do believe I know why I thought this: I seem to recall that you do need to define macro's before use and I guess that made me make a mistake. Well that and trying to quickly answer a post while I really ought to be doing other things
roondar is offline  
Old 26 January 2021, 15:05   #9
LeCaravage
Registered User
 
LeCaravage's Avatar
 
Join Date: May 2017
Location: AmigaLand
Posts: 459
And to summarize, I entered this thread convinced of vasm's fault and I go out I was totally wrong ^^
LeCaravage 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
VASM: strange behaviour, quits with error 8 buzzybee Coders. Asm / Hardware 2 07 August 2020 23:06
error compiling vasm on windows Ami030 Coders. Asm / Hardware 3 28 December 2019 16:07
vasm/mot: include failed error message guy lateur Coders. Asm / Hardware 6 23 December 2018 20:29
VASM fatal error.. jimmy2x2x Coders. Asm / Hardware 2 21 November 2014 10:27
Dragons Compil #30 netraider request.Demos 1 09 November 2012 10:07

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 05:11.

Top

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