English Amiga Board


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

 
 
Thread Tools
Old 12 August 2024, 19:35   #1
dansalvato
Registered User
 
Join Date: Jun 2009
Location: United States
Posts: 59
vasm - Warn when addressing absolute 16-bit memory?

Hello, I'm wondering if it's possible for vasm (or something else in the build stack) to provide a warning if an instruction is addressing an absolute 16-bit memory address. This only ever happens in my code if I typo, so it would help a lot to preemptively find these bugs if the assembler could warn me about it.

For example, sometimes I accidentally type something like this:

Code:
move.w $10(a4),d0
As this:

Code:
move.w $10,d0
Any suggestions on how to catch this during build?
dansalvato is offline  
Old 12 August 2024, 20:37   #2
paraj
Registered User
 
paraj's Avatar
 
Join Date: Feb 2017
Location: Denmark
Posts: 1,291
Maybe I'm wrong, but I doubt any amiga assembler would warn about that. The major issue being the obviously correct
move.l 4.w,..
and less (depending on context) reading/setting of interrupt routines.

Is this really an issue you've encountered with literal offsets or only with "named" offsets? Asking because I've not really had an issue with the former, while the later might be worth looking at adding more "guard rails" for if possible in a compatible way (IMO).
paraj is offline  
Old 12 August 2024, 21:44   #3
dansalvato
Registered User
 
Join Date: Jun 2009
Location: United States
Posts: 59
Quote:
Originally Posted by paraj View Post
Maybe I'm wrong, but I doubt any amiga assembler would warn about that. The major issue being the obviously correct
move.l 4.w,..
and less (depending on context) reading/setting of interrupt routines.

Is this really an issue you've encountered with literal offsets or only with "named" offsets? Asking because I've not really had an issue with the former, while the later might be worth looking at adding more "guard rails" for if possible in a compatible way (IMO).
This is a good point. I only encounter it with named offsets, and only during part of the build process where I use the -pic (position-independent code) assembler option. I have module files that I build with -pic that are only supposed to address memory using a base register.

I could do this the quick and dirty way by writing a script that parses my code and looks for these errors, but I was just hoping a more formal mechanism existed.
dansalvato is offline  
Old Yesterday, 00:34   #4
NorthWay
Registered User
 
Join Date: May 2013
Location: Grimstad / Norway
Posts: 873
Quote:
Originally Posted by paraj View Post
Maybe I'm wrong, but I doubt any amiga assembler would warn about that.
Something in the back of my head says BAsm will get cranky about it unless opted out?
NorthWay is offline  
Old Yesterday, 11:08   #5
Asman
68k
 
Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 830
Quote:
Originally Posted by NorthWay View Post
Something in the back of my head says BAsm will get cranky about it unless opted out?
yes, as far as I remember, basm generate warning about that by default.

in source you can disable it in following way
Code:
 IFD BARFLY

 BOPT   w4-            ;disable 64k warnings

 ENDC	;END IFD BARFLY
Asman is offline  
Old Yesterday, 11:22   #6
DJ Mike
Registered User
 
Join Date: Nov 2005
Location: United Kingdom
Age: 41
Posts: 125
Yes, Barfly definitely warns about vector accesses by default. I get caught out by this when recompiling disassembled game code.

My similar typo mistake is usually forgetting to put # when using constants, e.g.

move.b $10,d0

instead of:

move.b #$10,d0
DJ Mike 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
16-Bit/32-Bit UK Computer Price Comparisons Amigajay Retrogaming General Discussion 10 02 July 2020 17:12
Absolute addressing Old_Bob Coders. Asm / Hardware 9 20 September 2018 10:36
Best Way to Convert 32-bit Signed Value to 16 Bit? AGS Coders. Asm / Hardware 31 29 December 2013 13:58
Memory addressing CmdrVimes Coders. General 7 25 October 2010 22:20
Memory Addressing Architecture Zetr0 support.Hardware 2 10 July 2007 16:55

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 20:29.

Top

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