Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get .define working with sdasz80 (sdcc assembler)

Tags:

assembly

z80

sdcc

SDCC's assembler is derived from ASxxxx where manual describes the .define command here: http://shop-pdp.net/ashtml/asxs02.htm#define

Since it's a derivation it's possible not everything works the same way, but since the command line argument help talks about .define ("-b Display .define substitions in listing") I'd assume they are there.

However, when I do:

.define ay /-1/

I get the error:

g.s:1: Error: <o> .org in REL area or directive / mnemonic error

Other forms I've tried include:

.define ay ^/-1/
.define ay "-1"
.define kword /foo/

All of those result int he same error. If I try

.define

the error becomes:

g.s:1: Error: <q> missing or improper operators, terminators, or delimiters

I get that same error with .blarg though, so it's possible the keyword has been removed (why though?)

Am I doing something wrong, or is sdasz80 just broken?

like image 708
Jari Komppa Avatar asked Dec 29 '25 19:12

Jari Komppa


2 Answers

Well crap, it seems it's a feature they removed for some reason. Searching through the github mirror of SDCC's sources (sdas sources here: https://github.com/svn2github/sdcc/tree/master/sdcc/sdas) SDCC's asxxxx.h (last edited 6 years ago) has this block:

/*
 *      The def structure is used by the .define assembler
 *      directive to define a substitution string for a
 *      single word.  The def structure contains the
 *      string being defined, the string to substitute
 *      for the defined string, and a link to the next
 *      def structure.  The defined string is a sequence
 *      of characters not containing any white space
 *      (i.e. NO SPACEs or TABs).  The substitution string
 *      may contain SPACES and/or TABs.
 */
struct def
{
        struct def      *d_dp;          /* link to next define */
        char            *d_id;          /* defined string */
        char            *d_define;      /* string to substitute for defined string     */
        int             d_dflag;        /* (1) .defined / (0) .undefined */
};

but as far as I can tell, that structure is not used anywhere.

like image 195
Jari Komppa Avatar answered Dec 31 '25 09:12

Jari Komppa


Take also into account that sdasz80 shipped along with SDCC is an old version of ASxxxx. In fact, the documentation they ship with their sdasz80 is for a newer version of ASxxxx and some features are actually not present in the version shipped.

If you want those features and newer ones, you may download an updated version of ASxxxx from its website. There have been many newer versions including docens of new interesting features. Latest version is from January 2019: http://shop-pdp.net/ashtml/asxxxx.php

like image 44
ronaldo Avatar answered Dec 31 '25 07:12

ronaldo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!