【问题标题】:Print custom compile messages from a file using assembly directives使用汇编指令从文件中打印自定义编译消息
【发布时间】:2012-02-11 14:14:45
【问题描述】:

我正在使用 gcc 编译汇编代码,我想在编译过程中打印文件中包含的自定义消息。我希望能够做这样的事情:

custommessage:
    .incbin "custommessage.txt"
.print custommessage

这可能吗?

【问题讨论】:

    标签: gcc assembly compilation directive


    【解决方案1】:

    不,您不能直接执行此操作,因为 .print 指令只需要打印字符串。

    但是,如果您愿意先对您的消息文件执行一个小的转换,您可以得到您想要的:

    sed -e 's/^/.print \"/' -e 's/$/\"/' custommessage.txt > msg.txt
    

    这会将.print " 前置,并将" 附加到每一行。

    然后在你的汇编文件中

    .include "msg.txt"
    

    将打印您的所有消息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-11-06
      • 2014-11-10
      • 2013-06-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-31
      • 1970-01-01
      相关资源
      最近更新 更多