首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何扩展TASM宏

如何扩展TASM宏
EN

Stack Overflow用户
提问于 2016-11-20 19:06:31
回答 1查看 867关注 0票数 3

有办法用Borland的TASM扩展宏吗?我想转换一个与TASM兼容的.ASM文件,以看到他的所有宏都被扩展了。找不到任何选择去做。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-11-21 18:58:21

使用TASM的命令行选项/la生成一个扩展的列表。从这个清单中,您可以看到高级别和低级别的扩展。此特性适用于所有版本的TASM,直到1988年首次发布。

例如,假设您有以下TASM宏:

代码语言:javascript
复制
OUTPUTMESSAGE MACRO hConsole,stringval
LOCAL msg
    .data
msg  db  '&stringval',0
    .code
    call outputString ,hConsole,OFFSET msg
ENDM ;OUTPUTMESSAGE

您希望看到如何扩展以下源:

代码语言:javascript
复制
OUTPUTMESSAGE hConsole,<This app was assembled with TASM version >
OUTPUTMESSAGE hConsole,%??version

使用/la生成的清单文件(我碰巧使用的是5.4版本)产生了以下内容:

代码语言:javascript
复制
    516                      OUTPUTMESSAGE hConsole,<This app was assembled with TASM version >
1   517 0000018F                 .data
1   518 00000000  54 68 69 73 20 61 70+  ??0000  db  'This app was assembled with TASM version ',0
    519       70 20 77 61 73 20 61+
    520       73 73 65 6D 62 6C 65+
    521       64 20 77 69 74 68 20+
    522       54 41 53 4D 20 76 65+
    523       72 73 69 6F 6E 20 00
1   524 0000002A                 .code
2   525 0000018F  C8 0000 00             ENTERD  00000h,0
2   526                      call outputString ,hConsole,OFFSET ??0000
3   527 00000193  68 00000000r           PUSH    OFFSET ??0000
3   528 00000198  FF 75 08           PUSH    hConsole
3   529 0000019B  E8 FFFFFE9B            CALL    outputString
    530                      OUTPUTMESSAGE hConsole,%??version
1   531 000001A0                 .data
1   532 0000002A  31 32 38 34 00     ??0001  db  '1284',0
1   533 0000002F                 .code
1   534                      call outputString ,hConsole,OFFSET ??0001
2   535 000001A0  68 0000002Ar           PUSH    OFFSET ??0001
2   536 000001A5  FF 75 08           PUSH    hConsole
2   537 000001A8  E8 FFFFFE8E            CALL    outputString

列对应于深度偏移源。不幸的是,正如您会发现的那样,line#列并不特别有用。下面是描述列的TASM5用户指南中的一个片段:

代码语言:javascript
复制
[depth] - indicates the level of nesting of Include files and macros within your
          listing file.

[line#] - is the number of the line in the listing file (not including header
          and title lines). Line numbers are particularly useful when the
          cross-reference feature of Turbo Assembler, which refers to lines by
          line number, is used. Be aware that the line numbers in [line#] are
          not the source module line numbers. For example, if a macro is
          expanded or a file is included, the line-number field will continue to
          advance, even though the current line in the source module stays the
          same. To translate a line number (for example, one that the
          cross-referencer produced) back to the source file, you must look up
          the line number in the listing file, and then find that same line (by
          eye, not by number) in the source file.

[offset] - is the offset in the current segment of the start of the machine code
           generated by the associated assembler source line.

[machine_code] - is the actual sequence of hexadecimal byte and word values that
                 is assembled from the associated assembler source line.

[source] - is simply the original assembler line, comments and all. Some
           assembler lines, such as those that contain only comments, don't
           generate any machine code; these lines have no [offset] or [machine_
           code] fields, but do have a line number.
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40708190

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档