用户:
lsk666666查看:2 回复:3 评论:2 创建时间:2021-09-12T20:07:31
昨天看到有人发贴提到了汇编,就去简单学了一下,来个阶段性汇报 环境:archlinuxx86-喵linux5.13.13-arch1-1na喵 functions.a喵(一些常用功能,网上抄的)(懒得排版,结尾放图片) slen:pushebxmovebx,eaxnextchar:cmpbyte[eax],0jzfinishedinceaxjmpnextcharfinished:subeax,ebxpopebxretquit:movebx,0moveax,1int80hretsprint:pushedxpushecxpushebxpusheaxcallslenmovedx,eaxpopeaxmovecx,eaxmovebx,1moveax,4int80hpopebxpopecxpopedxretsprintln:callsprintpusheaxmoveax,0x0apusheaxmoveax,espcallsprintpopeaxpopeaxret test.a喵(我写的程序,读取一个输入,然后输出): %include"functions.a喵"section.datapropmt:db"Input:",6section.bssinput:resb255section.textglobal_start_start:moveax,propmtcallsprintmoveax,3movebx,0movecx,inputmovedx,255int80hmoveax,inputcallsprintcallquit 运行方法(Forlinux,其他OS不知道): 首先安装na喵。 吧两个文件放到一个目录下,到这个目录输入na喵-felf32test.a喵来汇编 然后输入命令ld-melf_i386-s-otesttest.o进行链接 然后./test执行 ------------------------------------------- 关于为什么不是Helloworld这事:helloworld的程序是作为练手网上抄的,发出来没有意义,而这个程序是我自己写的 两个代码的图片(文件名不一样,但是不要在意那些细节~):
我劝在座的各位别学这玩意,上面那堆东西换到python就一句话:print(input("Input:"))
人生苦短,我用Python(鬼啊,Java世界第一)(滑稽)
点赞0
评论