English Amiga Board


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

 
 
Thread Tools
Old 02 July 2023, 10:24   #1
RoC
Registered User
 
Join Date: May 2011
Location: Italy
Posts: 214
VASM - Question on conditional assembly

Good Sunday!

I have been trying to compile in VASM 1.9d the Blueberry's DemoStartup.s with the additional Lemon changes from the ExampleDemo of https://aminet.net/package/dev/cross...DemoToolchain5

I know this is supposed to work as such in VASM, but I am not sure whether this is true because the VASM returns errors on the IFs.

The DemoStartup.s relies on a number of conditional IFs. According to my noob reading of the VASM/MOT docs, "IF" should be able to conditionally assemble when the following lines are non-zero. So I tried to use the IFC, IFEQ, IFNE and IFGT to adjust them. The constats are defined in the main demo.s file and not in this included startup one - e.g. COMPATIBILITY and others.

I list a single instance of each of them to check whether these changes are needed or possible (coudn't find examples of ifc applied, so hope that syntax would be okay)
  • There are many "if COMPATIBILITY=1" or other values. Changed them to "ifc COMPATIBILITY,1" or the relevant value
  • There are "if MUSICPLAYER=0||MUSICPLAYER=2". I have changed it into "ifc MUSICPLAYER,0||MUSICPLAYER,2"
  • "if MUSICPLAYERUSEVBLANK>=1" has been changed into "ifgt MUSICPLAYERUSEVBLANK"
  • I could have changed "if MUSICPLAYERUSEVBLANK<>1" to "ifc MUSICPLAYERUSEVBLANK,0||MUSICPLAYERUSEVBLANK,2" but eventually I have cheated and changed the digit order (also for the IFGT cases..)
  • "if COMPATIBILITY<2" changed to "ifc COMPATIBILITY,0||COMPATIBILITY,1"
  • "if MUSICPLAYER=1 && MUSICPLAYERUSEVBLANK=2" changed to "ifc MUSICPLAYER,1 && MUSICPLAYERUSEVBLANK,2"
It might well possibile that this is not required altogether, so bear with me if the question is a little stupid. The modified compiles without errors, but it is not actually working because the object file does not include the selected music player and binary

For the ease of reference, please find the original demostartup.s and the changed one.

Thank you in advance for any info you could be able to share
Attached Files
File Type: s Original_DemoStartup.s (15.7 KB, 19 views)
File Type: s Modified_DemoStartup.s (17.6 KB, 15 views)

Last edited by RoC; 02 July 2023 at 10:59.
RoC is offline  
Old 02 July 2023, 12:30   #2
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,551
Quote:
Originally Posted by RoC View Post
I know this is supposed to work as such in VASM, but I am not sure whether this is true because the VASM returns errors on the IFs.
The errors tell you
expression must be constant
, because the symbols you are using are nowhere defined. So they cannot be evaluated.

Quote:
According to my noob reading of the VASM/MOT docs, "IF" should be able to conditionally assemble when the following lines are non-zero.
Not the following lines, but the expression in the
IF
directive's operand field.

Quote:
So I tried to use the IFC, IFEQ, IFNE and IFGT to adjust them.
Doesn't make sense.
IFC
compares strings and doesn't evaluate symbols.
IFNE
is the same as
IF
.

Quote:
The constats are defined in the main demo.s file and not in this included startup one - e.g. COMPATIBILITY and others.
You need to define them. Otherwise you cannot assemble the startup source alone.

Quote:
The modified compiles without errors
I get the same errors, except for
IFC
, which simply doesn't work the way you think.

IFC
is mostly used for checking whether a macro argument was empty. For example:
Code:
        ifc     "\1",""
        ...argument missing...
        endc
phx is offline  
Old 02 July 2023, 12:43   #3
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,068
I prefer IFB/IFNB for that (blank, not blank), and IFC for straight up string compares. Just make sure you don't have a trailing comment, if could be interpreted as it's not blank and the expression is always true.
a/b is offline  
Old 02 July 2023, 21:50   #4
RoC
Registered User
 
Join Date: May 2011
Location: Italy
Posts: 214
@phx and @a/b

I feared I was doing something wonky and indeed I did :-)

I must have completely misunderstood the if and thanks for bringing me on the right track.

I resume from the original ;-)
RoC 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
Question about XREF vs XDEF (vasm 1.8 vs vasm 1.9) roondar Coders. Asm / Hardware 8 01 May 2023 20:59
A couple of basic question regarding Amiga assembly programming Haplo Coders. Asm / Hardware 25 19 February 2023 10:38
Question about NEAR directive in vasm dansalvato Coders. Asm / Hardware 2 18 March 2022 12:40
Another Vasm question LeCaravage Coders. Asm / Hardware 7 27 January 2021 23:30
vasm question marduk_kurios Coders. Asm / Hardware 7 14 February 2014 20:06

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 12:06.

Top

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