NASM TO GAS:GAS中的resw的对应 [英] NASM TO GAS: counterpart of resw in GAS

查看:81
本文介绍了NASM TO GAS:GAS中的resw的对应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的任务是将使用NASM的汇编程序转换为GAS.不幸的是,有许多不匹配的语句.我已经转换了其中一些,但是在转换此语句时仍然遇到困难

I am tasked to convert my assembly program which uses NASM to GAS. Unfortunately there are lots of mismatched statements. I have converted some of them but I am still having trouble on how to convert this statement

min resw 1

推荐答案

保留一个单词(初始值设定为0)非常简单:

Reserving one word (with an initializer of 0) is pretty easy:

min:    .word    0

对于x86,.word是16位.对于其他尺寸:.byte.long.quad.

For x86, .word is 16-bit. For other sizes: .byte, .long, .quad.

如果您想保留一大块(例如50个单词),请使用.fill.space指令:

If you wanted to reserve a large chunk, say 50 words, use the .fill or .space directives:

buff1:  .fill    50, 1, 0     # count, size, value
buff2:  .space   50, 0        # count (bytes), value (defaults to 0)

对于重复模式大于1个字节的初始化程序, .dcb.size 带有值和长度:

For initializers with a repeating pattern wider than 1 byte, .dcb.size takes a value and length:

int_array:  .dcb.l  50, 12345       # 32-bit integer 12345 repeated 50 times

这篇关于NASM TO GAS:GAS中的resw的对应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆