【问题标题】:Can't get .define working with sdasz80 (sdcc assembler)无法让 .define 与 sdasz80(sdcc 汇编器)一起使用
【发布时间】:2019-05-05 15:11:29
【问题描述】:

SDCC 的汇编器源自 ASxxxx,其中手册在此处描述了 .define 命令:http://shop-pdp.net/ashtml/asxs02.htm#define

由于它是派生的,因此可能并非所有内容都以相同的方式工作,但是由于命令行参数 help 谈到 .define ("-b Display .define substitions in Listing") 我假设它们在那里。

但是,当我这样做时:

.define ay /-1/

我得到错误:

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

我尝试过的其他形式包括:

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

所有这些都会导致相同的错误。如果我尝试

.define

错误变成:

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

我在.blarg 上遇到了同样的错误,所以可能关键字已被删除(为什么?)

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

【问题讨论】:

    标签: assembly z80 sdcc


    【解决方案1】:

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

    SOME_IO_ADDRESS = 0x32
    [...]
    LD A, #0xAA
    OUT (#SOME_IO_ADDRESS), A
    

    【讨论】:

      【解决方案2】:

      还要考虑到与 SDCC 一起提供的 sdasz80 是旧版本的 ASxxxx。事实上,他们的 sdasz80 附带的文档是针对更新版本的 ASxxxx 的,并且某些功能实际上在附带的版本中不存在。

      如果您想要这些功能和更新的功能,您可以从其网站下载更新版本的 ASxxxx。有许多更新的版本,包括新的有趣功能的文档。 2019年1月最新版本:http://shop-pdp.net/ashtml/asxxxx.php

      【讨论】:

        【解决方案3】:

        好吧,废话,似乎这是他们出于某种原因删除的功能。 通过github镜像搜索SDCC的源码(这里sdas的源码:https://github.com/svn2github/sdcc/tree/master/sdcc/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 */
        };
        

        但据我所知,该结构并未在任何地方使用。

        【讨论】:

          猜你喜欢
          • 2013-07-23
          • 1970-01-01
          • 1970-01-01
          • 2022-01-06
          • 1970-01-01
          • 1970-01-01
          • 2014-10-31
          • 2018-01-02
          • 2016-11-14
          相关资源
          最近更新 更多