Assembly Can';t get.define使用sdasz80(sdcc汇编程序)

Assembly Can';t get.define使用sdasz80(sdcc汇编程序),assembly,z80,sdcc,Assembly,Z80,Sdcc,SDCC的汇编程序源于ASxxxx,其中手册在此处描述了.define命令: 由于它是一个派生,所以可能不是所有的操作都是相同的,但是由于命令行参数help讨论了.define(“-b Display.define substations in listing”),我假设它们存在 然而,当我这样做时: .define ay /-1/ 我得到一个错误: g.s:1: Error: <o> .org in REL area or directive / mnemonic error

SDCC的汇编程序源于ASxxxx,其中手册在此处描述了.define命令:

由于它是一个派生,所以可能不是所有的操作都是相同的,但是由于命令行参数help讨论了.define(“-b Display.define substations in listing”),我假设它们存在

然而,当我这样做时:

.define ay /-1/
我得到一个错误:

g.s:1: Error: <o> .org in REL area or directive / mnemonic error
所有这些都导致了相同的错误。如果我尝试

.define
错误变为:

g.s:1: Error: <q> missing or improper operators, terminators, or delimiters
g.s:1:错误:缺少或不正确的运算符、终止符或分隔符
不过,我在
.blarg
中也遇到了同样的错误,因此有可能该关键字已被删除(为什么?)


我是做错了什么,还是sdasz80刚刚坏了?

废话,这似乎是他们出于某种原因删除的功能。 通过SDCC源的github镜像(sdas源在此处:)搜索SDCC的asxxxx.h(上一次编辑是6年前)有以下块:

/*
 *      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 */
};

但据我所知,这种结构没有在任何地方使用。

还要考虑到SDCC附带的SDASSZ80是ASxxxx的旧版本。事实上,他们随SDASSZ80提供的文档是针对较新版本的ASxxxx的,一些功能实际上并不存在于所提供的版本中


如果您需要这些功能和更新的功能,您可以从其网站下载ASxxxx的更新版本。有许多新的版本,包括新的有趣特性的文档。最新版本于2019年1月发布:

出于多种目的,您可以使用变量。这将适用于sdasz80(SDCC修订版)

/*
 *      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 */
};
SOME_IO_ADDRESS = 0x32
[...]
LD A, #0xAA
OUT (#SOME_IO_ADDRESS), A