NASM TO GAS:GAS中的resw的对应 [英] NASM TO GAS: counterpart of resw in GAS
问题描述
我的任务是将使用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屋!