Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - WLA-DX structs question

Reply to topic
Author Message
  • Joined: 06 Aug 2021
  • Posts: 49
Reply with quote
WLA-DX structs question
Post Posted: Tue Aug 30, 2022 2:47 pm
I've been using WLA-DX for a while for programming in assembly, but whenever I use the following code (from the documentation)


.STRUCT position_t
pos_x  DW
pos_y  DW
.ENDST

.STRUCT enemy_t
id     DW
       INSTANCEOF position_t ; here we import fields from position_t
health DW
.ENDST

.ENUM $A000
nemesis INSTANCEOF enemy_t
.ENDE


I get the following error message:


Quote

..\\Object_Files\\structs.asm:58: DIRECTIVE_ERROR: Unexpected symbol "position_t" in .STRUCT.
..\\Object_Files\\structs.asm:58: ERROR: Couldn't parse "position_t".
LOAD_FILE_DATA: Could not open file "main.o".


I'm wondering what I'm doing wrong, any thoughts?
  View user's profile Send private message
  • Joined: 06 Mar 2022
  • Posts: 593
  • Location: London, UK
Reply with quote
Post Posted: Tue Aug 30, 2022 3:09 pm
Nothing wrong with that code so not sure why you should be seeing an error.

Is there anything above that snippet (e.g. another .struct) which could be causing the problem (see it's on line 58)?

Otherwise, check what version you're running (just running wla-z80 with no arguments should print it near the top)
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3757
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Tue Aug 30, 2022 3:09 pm
I suspect you either give a name to that member or use the dot ( . ) for an unnamed member - try

.STRUCT enemy_t
id     DW
.      INSTANCEOF position_t ; here we import fields from position_t
health DW
.ENDST
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14683
  • Location: London
Reply with quote
Post Posted: Tue Aug 30, 2022 3:19 pm
The docs say this is allowed syntax - it makes a "nameless" instance. I just tried it (copied and pasted into an existing project) and it compiled fine, producing these symbols (if I also export them):

0000a000 nemesis
0000a000 nemesis.id
0000a002 nemesis.pos_x
0000a004 nemesis.pos_y
0000a006 nemesis.health

Maybe you need a newer version of WLA DX? Mine says this:

----------------------------------------------------------------------
---                 WLA Z80 Macro Assembler v10.3a                 ---
----------------------------------------------------------------------
                Programmed by Ville Helin in 1998-2008
        In GitHub since 2014: https://github.com/vhelin/wla-dx
                   $VER: wla-z80 10.3a (24.6.2022)
  View user's profile Send private message Visit poster's website
  • Joined: 06 Aug 2021
  • Posts: 49
Reply with quote
Post Posted: Tue Aug 30, 2022 5:24 pm
Maxim wrote

Maybe you need a newer version of WLA DX?


Just updated to 10.3 but now nothing will compile at all...

Gives me the following error:

Quote

FIND_FILE: Could not open "main.o", searched in the following directories:
./ (current directory)
----------------------------------------------------------------------
--- WLALINK - WLA DX Macro Assembler Linker v5.18a ---
----------------------------------------------------------------------
Programmed by Ville Helin in 1998-2008
In GitHub since 2014: https://github.com/vhelin/wla-dx
$VER: wlalink 5.18a (20.8.2022)

USAGE: ..\..\WLA-DX_Binaries\wlalink [OPTIONS] <LINK FILE> <OUTPUT FILE>

OPTIONS:
-b Program file output
-bS Starting address of the program (optional)
-bE Ending address of the program (optional)
-d Discard unreferenced sections
-D Don't create _sizeof_* definitions
-nS Don't sort the sections
-i Write list files
-r ROM file output (default)
-R Make file paths in link file relative to its location
-s Write also a NO$GMB/NO$SNES symbol file
-S Write also a WLA symbol file
-A Add address-to-line mapping data to WLA symbol file
-v Verbose messages (all)
-v1 Verbose messages (only discard sections)
-v2 Verbose messages (-v1 plus short summary)
-L <DIR> Library directory
-t <TYPE> Output type (supported types: 'CBMPRG')
-a <ADDR> Load address (can also be label) for CBM PRG

EXAMPLE: ..\..\WLA-DX_Binaries\wlalink -d -v -S linkfile linked.rom

The system cannot find the file specified.
The system cannot find the file specified.
Could Not Find C:\Users\Cam\Desktop\SMS-Development\ASM Z80\SMS Template\Main\main.o


This build.bat worked for me before this, though to be honest I'm not 100% comfortable with making bat files, so I've probably done something wrong.

Here it is:


 @echo off
 cls

 ..\..\WLA-DX_Binaries\wla-z80 -o ..\Main\main.asm main.o

 echo [objects] > linkfile
 echo main.o >> linkfile

 ..\..\WLA-DX_Binaries\wlalink -drvs linkfile output.sms
 
 REM specific to my computer/github repository
 rem java -jar ..\..\..\Emulicious-with-Java\Emulicious.jar output.sms

 REM Make sure SYM file is in same directory with same name as output.sms
 move output.sym ..
 move output.sms ..
 
 REM Clean up
 del linkfile
 del main.o
 ::output.sms
  View user's profile Send private message
  • Joined: 06 Mar 2022
  • Posts: 593
  • Location: London, UK
Reply with quote
Post Posted: Tue Aug 30, 2022 5:35 pm
You've got your input and output files the wrong way around.

Should be

 ..\..\WLA-DX_Binaries\wla-z80 -o main.o ..\Main\main.asm
  View user's profile Send private message Visit poster's website
  • Joined: 06 Aug 2021
  • Posts: 49
Reply with quote
Post Posted: Tue Aug 30, 2022 5:46 pm
willbritton wrote


Should be

 ..\..\WLA-DX_Binaries\wla-z80 -o main.o ..\Main\main.asm


Tried that, but when I do that it still doesn't work, and it no longer shows the version information when I try to build
  View user's profile Send private message
  • Joined: 06 Mar 2022
  • Posts: 593
  • Location: London, UK
Reply with quote
Post Posted: Tue Aug 30, 2022 6:08 pm
I don't think it should print out the version every time, but okay what's the error it's printing out now?
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3757
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Tue Aug 30, 2022 6:57 pm
   $(WLAZ80) -o build/main.o main.asm
   $(WLALINK) -d -S build/wla-linkfile build/output.sms


edit: it won't print anything unless there's an error or you specify -v (or -v1 or -v2)
  View user's profile Send private message Visit poster's website
  • Joined: 06 Aug 2021
  • Posts: 49
Reply with quote
Post Posted: Tue Aug 30, 2022 10:29 pm
willbritton wrote
I don't think it should print out the version every time, but okay what's the error it's printing out now?


Ah okay! In that case the wla-z80.exe is working, it's the wlalink that I'm running into issues with now. Unfortunately there's no error code, it just prints:

Quote

----------------------------------------------------------------------
--- WLALINK - WLA DX Macro Assembler Linker v5.18a ---
----------------------------------------------------------------------
Programmed by Ville Helin in 1998-2008
In GitHub since 2014: https://github.com/vhelin/wla-dx
$VER: wlalink 5.18a (20.8.2022)

USAGE: ..\..\WLA-DX_Binaries\wlalink [OPTIONS] <LINK FILE> <OUTPUT FILE>

OPTIONS:
-b Program file output
-bS Starting address of the program (optional)
-bE Ending address of the program (optional)
-d Discard unreferenced sections
-D Don't create _sizeof_* definitions
-nS Don't sort the sections
-i Write list files
-r ROM file output (default)
-R Make file paths in link file relative to its location
-s Write also a NO$GMB/NO$SNES symbol file
-S Write also a WLA symbol file
-A Add address-to-line mapping data to WLA symbol file
-v Verbose messages (all)
-v1 Verbose messages (only discard sections)
-v2 Verbose messages (-v1 plus short summary)
-L <DIR> Library directory
-t <TYPE> Output type (supported types: 'CBMPRG')
-a <ADDR> Load address (can also be label) for CBM PRG

EXAMPLE: ..\..\WLA-DX_Binaries\wlalink -d -v -S linkfile linked.rom


This is what the bat file looks like now:


 @echo off
 rem cls

 ..\..\WLA-DX_Binaries\wla-z80 -o main.o ..\Main\main.asm

 echo [objects]>linkfile
 echo main.o>>linkfile

 ..\..\WLA-DX_Binaries\wlalink -drvs linkfile output.sms
 
 REM specific to my computer/github repository
 rem java -jar ..\..\..\Emulicious-with-Java\Emulicious.jar output.sms

 REM Make sure SYM file is in same directory with same name as output.sms
 rem move output.sym ..
 rem move output.sms ..
 
 REM Clean up
 rem del linkfile
 rem del main.o
 ::output.sms


The linkfile and main.o are getting created, but output.sms is not
  View user's profile Send private message
  • Joined: 06 Aug 2021
  • Posts: 49
Reply with quote
Post Posted: Tue Aug 30, 2022 10:33 pm
bofner wrote


Quote


EXAMPLE: ..\..\WLA-DX_Binaries\wlalink -d -v -S linkfile linked.rom



This was the issue! I needed to separate my -dvrs into -d -v -r -s

Thank you all for your help, I got it back up and running!
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!