MASM

MASM x86 Adding two ints

和自甴很熟 提交于 2020-11-28 02:42:06
问题 I am writing a simple program that takes 3 ints from the user and does the following math: Sum of the first 2 numbers Difference of the second and third numbers Product of all three numbers Quotient (integer) and remainder of first and third numbers There should be output to the user showing the calculation. For example, if the user enters 10, 9, and 8, it should show for the first calculation: 10 + 9 = 19 I'm trying to do the sum at the moment. I was able to calculate it, but I seem to be

Ubuntu安装flex和bison

不羁的心 提交于 2020-11-26 18:49:51
在学习虎书,第二章练习要用lex和yacc,然而作者提供的 网址 上放的是flex和bison,当然这样更好啦(flex和bison完全兼容lex和yacc)。考虑到在windows下用这两个玩意还要安装masm,所以最后决定上虚拟机(之前操作系统课就装过了,幸亏没卸载哈哈哈)。 Ubuntu下使用 sudo apt-get install flex bison 命令,不一会就装好了,如图: 然后写了一个测试程序,就用Ubuntu自带的gedit写, 保存为.l文件 : %% [\t] + is | am | are | was | were { printf ( "%s: is a verb\n" ,yytext);} [a-zA-Z] + { printf ( "%s: is not a verb" ,yytext);} .|\ n %% int main (){ yylex (); } 使用命令 lex verb.l 再使用命令 gcc lex.yy.l -lfl 最后运行 ./a.out 这个程序会判断输入的单词是不是动词: 程序成功运行也说明我们安装配置成功了。 来源: oschina 链接: https://my.oschina.net/u/4518215/blog/4751194

VS2013的x86汇编语言开发环境配置

℡╲_俬逩灬. 提交于 2020-10-29 00:47:25
转载: https://blog.csdn.net/infoworld/article/details/45085415 转载: https://blog.csdn.net/u014792304/article/details/53373430 转载: https://www.cnblogs.com/sunylat/p/6242141.html 转载: https://www.cnblogs.com/del/archive/2010/04/03/1703689.html 转载: https://www.cnblogs.com/iBinary/p/7508144.html (基本概念介绍) 转载: https://arthurchiao.github.io/blog/x86-asm-guide-trans-cn-zh/ (翻译国外一篇文章) 转载: http://www.ruanyifeng.com/blog/2018/01/assembly-language-primer.html (入门教程) 使用vs编译x86汇编语言无需安装MASM,因为所有的vs版本都集成了MASM12.0(All versions of Visual Studio include the Microsoft Assembler (MASM) version 12.0.)。 其安装目录(C:\Program

汇编语言环境dos,win32及win64

霸气de小男生 提交于 2020-10-28 18:31:53
win一、计算2^12保存在AX中(王爽汇编语言第二版p100): mov cx,12 ;循环12次 mov ax,1 ;初始化AX s: add ax,ax loop s ;执行完loop后,要显示的数字2^12 已经在寄存器AX 二、AX寄存器以显示说明: 本例中,2^12= 4096,故 AX= 1000H 则输出字符为 4096 。 原理: ax为十六位寄存器,所以输出十进制数范围为0 - 65535,最大五位数,故设置CX=5,LOOP语句实现算法: 4096/10000= 商0 余数 4096 ; 根据十进制书写习惯,不输出前面的0字符 ,需要在输出循环里判断 4096/1000= 商4 余数96 ;输出4 96/100= 商0 余数96 ;输出0 96 /10= 商9 余数6 ;输出9 6 /1= 商6 余数0 ;输出6 把每次所得商加上48即可得到相应数字的ASCII码, 三、完整代码: code segment assume cs:code,ds:data,ss:stack start: mov ax,data mov ds,ax mov cx,12 ;循环12次 mov ax,1 ;初始化AX s: add ax,ax loop s ;执行完loop后,要显示的数字2^12 已经在寄存器AX mov si, offset divisors mov di,