English Amiga Board


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

 
 
Thread Tools
Old 14 May 2019, 13:05   #1
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Macros for debugging in VASM

Hi,

I'm trying to setup some macros for debugging information that I can use in VASM. Here's an example:

Code:
DEBUG_FUNC	MACRO
		IFNE	ENABLE_DEBUG
			move.l	#\1,DEBUG_SUBID	
		ENDC
		
		ENDM
Code:
ROUTINE1:
SUBID = $10000000
	DEBUG_FUNC	SUBID+$2000
        rts

Routine 2:
Code:
ROUTINE2:
SUBID = $20000000
	DEBUG_FUNC	SUBID+$5000
        rts
Obviously this won't assemble because I'm trying to redefine SUBID, but is there another way in the assembler that lets me do this.

Effectively I want to assign every subroutine a SUBID, and then within that sub routine have a checkpoints/positions to monitor how far the program counter got before something happened and caused a crash.

The ability to see the contents of DEBUG_SUBID is handle via interrupts so as long as the interrupt handler is running then I can see what went on quite quickly.

Any help appreciated.
Geezer
mcgeezer is offline  
Old 14 May 2019, 13:32   #2
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,409
From memory: doesn't the SET directive allow you to change the value of a symbol after setting it initially?

If the above is correct that may help you do this.
roondar is offline  
Old 14 May 2019, 13:45   #3
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Roondar's hint is spot on, SET is your friend.
StingRay is offline  
Old 14 May 2019, 14:01   #4
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
I initially looked at SET but I can't get the syntax right for some reason.

The VASM manual states...under the general section:

Code:
.set <symbol>,<expression>
Create a new program symbol with the name <symbol> and assign to it the
value of <expression>. If <symbol> is already assigned, it will contain a new
value from now on.
But I keep getting an unknown instruction error in VASM.

So I've tried...

set SUBID,$20000000

.set SUBID,$20000000

set SUBID = $20000000

and various combinations of indentation too..

Does anyone have an example I can look at please?
mcgeezer is offline  
Old 14 May 2019, 14:05   #5
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,409
It should be (again, from memory):
SUBID SET $20000000

Edit: I checked the manual (Motorola syntax section) and the above should work.
Quote:
Originally Posted by vasm manual
<symbol> set <expression>

Create a new symbol with the name <symbol> and assign the value of <expression>. If <symbol> is already assigned, it will contain a new value from now on.
roondar is offline  
Old 14 May 2019, 14:08   #6
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Quote:
Originally Posted by roondar View Post
It should be (again, from memory):
SUBID SET $20000000

Edit: I checked the manual (Motorola syntax section) and the above should work.
that's causing SUBID to be redefined and barfing the assembler.
mcgeezer is offline  
Old 14 May 2019, 14:18   #7
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
Make sure not to mix EQU and SET for the same symbol. When using a symbol with SET only, then there should never be a redefinition error.
phx is offline  
Old 14 May 2019, 14:23   #8
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Quote:
Originally Posted by phx View Post
Make sure not to mix EQU and SET for the same symbol. When using a symbol with SET only, then there should never be a redefinition error.
Noted...

It seems any combination of set I get an unknown instruction, I could really use a working example on this one..??? For example, this fails.

Code:
.set SUBID $10000000
	DEBUG_FUNC	SUBID+$2000
	nop
	nop
	
	DEBUG_FUNC	SUBID+$5000
mcgeezer is offline  
Old 14 May 2019, 14:40   #9
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Code:
SUBID SET $12345

....

SUBID SET SUBID+20

....

SUBID SET $abdc
StingRay is offline  
Old 14 May 2019, 14:43   #10
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Quote:
Originally Posted by StingRay View Post
Code:
SUBID SET $12345

....

SUBID SET SUBID+20

....

SUBID SET $abdc
Working now! Thanks a bunch buddy.

My problem was indentation.
mcgeezer is offline  
Old 14 May 2019, 15:09   #11
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
Quote:
Originally Posted by mcgeezer View Post
For example, this fails.

Code:
.set SUBID $10000000
.set is std-syntax (GNU, MIT-style), while you are certainly using mot-syntax (as in vasmm68kMOT). So you may want to read about syntax and directives in the appropriate "Mot Syntax Module" chapter 4.
phx is offline  
Old 14 May 2019, 15:27   #12
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Quote:
Originally Posted by phx View Post
.set is std-syntax (GNU, MIT-style), while you are certainly using mot-syntax (as in vasmm68kMOT). So you may want to read about syntax and directives in the appropriate "Mot Syntax Module" chapter 4.
Yep.... I was reading the wrong section... it makes sense now.

Code:
<symbol> set <expression>
Create a new symbol with the name <symbol> and assign the value of <expression>. If <symbol> is already assigned, it will contain a new value from now
on.
mcgeezer 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
Macros in imagefx source support.Apps 3 10 August 2018 03:30
Debugging help mop Coders. C/C++ 5 20 April 2018 08:37
Devpac Macros etc. Galahad/FLT Coders. Asm / Hardware 15 18 April 2016 23:59
Creating Macros Lonewolf10 Coders. Tutorials 3 18 June 2013 22:12
Keyboard Input Options > macros/key combinations ? Konrad support.WinUAE 3 23 May 2007 17:22

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

Top

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