.section .data
myvalue:
.byte 67,68,69,70,0
mygs:
.asciz "%s\n"
.section .text
.globl main
main:
movl $myvalue,%ecx
inc %ecx#本来应输出CDEF,68代表D
push %ecx
push $mygs
call printf
push $0
call exit
deepfuture@deepfuture-laptop:~/private/mytest$ gcc -o test12 test12.s
deepfuture@deepfuture-laptop:~/private/mytest$ ./test12
DEF
deepfuture@deepfuture-laptop:~/private/mytest$
本文介绍了一个使用汇编语言实现字符串输出的例子。通过定义字节和字符串,并调用printf函数来展示如何改变输出结果中的字符。这个简单的示例帮助理解汇编语言中对内存直接操作的特点。
3754

被折叠的 条评论
为什么被折叠?



