我正在努力寻找一种方法来检索 GAS 中第一个命令行参数的第一个字符。为了澄清我的意思,我在 NASM 中是如何做到的:
main:
pop ebx
pop ebx
pop ebx ; get first argument string address into EBX register
cmp byte [ebx], 45 ; compare the first char of the argument string to ASCII dash ('-', dec value 45)
...
编辑:文字转换为 AT&T 语法并在 GAS 中编译它不会产生预期的结果。EBX 值不会被识别为字符。