问题描述
我试图创造AT&放一个简单的密码程序,变速箱总成,但我有掩蔽输入的麻烦。我希望发生的是,当用户输入字符,它们出现在屏幕上的星号。英特尔的语法是比较简单的:
I'm trying to create a simple password program in AT&T Assembly but i'm having trouble with masking an input. What i want to happen is when the user enters characters, they appear on the screen as asterisk'. In intel syntax it's relatively simple:
mov ah, 08h
int 21h
mov dl,2ah
mov ah,02h
int 21h
本使用英特尔命令来读取输入而不呼应它,而是打印一个星号。
我试图解决AT&放这个问题; T语法,我遇到了一些麻烦。
This uses the intel command to read an input without echoing it and instead print an asterisk.I'm trying to solve this problem in AT&T syntax and I'm having some trouble.
任何投入将大大AP preciated。
先谢谢了。
Any input would be greatly appreciated. Thanks in advance.
推荐答案
请纠正我,如果我错了:
在AT& T公司装配十六进制写C语言风格:的0x30
而不是 30小时的
。八进制也类似于C $ P $与pfixed一个 0
。
In AT&T assembly hexadecimal is written C-style: 0x30
instead of 30h
. Octals are also like in C, prefixed with a 0
.
和具体取决于大小的内存你操纵你必须使用这种规模的后缀操作数。这意味着 MOVL
而不是 MOV
在32位长记忆:
And depending on what size memory you are manipulating you have to use that size's postfix on the operand. That means movl
instead of mov
on 32bit long memory:
8 bits = b - derived from "byte"
16 bits = w - derived from "word"
32 bits = l - I have no idea why 16 bits is usually a "dword"
64 bits = q - derived from "qword", q for "quad-", so four words in size
另外的值是美元符号pfixed $ P $ $×41
(因为是变量?)和寄存器是$ P $与百分号pfixed:%EAX
。
Also values are prefixed with a dollar sign: $0x41
(as are variables?) and registers are prefixed with percent signs: %eax
.
所以,如果我读这正确的code应该是:
So if I'm reading this correctly your code should be:
movl $ah, $0x08
int 0x21
movl $dl, $2ah
movl $ah, $0x02
int $0x21
我无法相信我错过了这个时候,我写了答案,AT&安培; T语法颠倒了源 - 目的为了说明它有两个输入
I can't believe I missed this when I wrote the answer, AT&T syntax has reversed source-destination order for instructions with two inputs.
即。 AT& T公司是:
I.e. AT&T is:
movl <source>, <dest>
而在英特尔的语法,这将是:
while in Intel syntax this will be:
mov <dest>, <source>
任何更正,欢迎,因为我还在学习为好。
Any corrections are welcome as I'm still learning as well.
这篇关于AT&amp; T公司大会蒙面输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!