MASM

Visual studio 搭建汇编环境

二次信任 提交于 2020-04-05 20:43:47
第一步:安装masm http://www.masm32.com/ 安装masm 1、点击install 2、选择安装路径,并等待安装 3、按任意键完成安装 4、选择YES 第二步:创建项目 1、创建项目 2、选择空项目,并创建 3、选择c++文件,并将文件名称的后缀改成:asm 第三步:配置汇编环境 一、添加masm的头文件 1、编辑包含目录 2、新建路径,选择masm下的include目录,然后确定 二、添加masm的库文件(可选) 1、可以不添加masm的库文件,因为在VS中已经包含了的库文件;但为了避免在编译中出现未知错误,建议添加库文件 2、编辑引用目录 3、添加lib目录 第四步:编码汇编代码 .386 .model flat,stdcall option casemap:none ;include include windows.inc include user32.inc include kernel32.inc ; data .data szCpation db 'A Messagebox!',0 szText db 'Hello world!',0 ; code .code start: invoke MessageBox,NULL,offset szText, offset szCpation, MB_OK invoke ExitProcess,NULL

Confusing brackets in MASM32

北慕城南 提交于 2020-03-23 08:18:12
问题 I am trying to get to grips with MASM32 and am confused by the following: I thought that brackets were used for indirection so if I have the a pre-defined variable .data item dd 42 then mov ebx, item would put the contents of 'item', i.e. the number 42, into ebx and mov ebx, [item] would put the address of 'item', i.e. where the 42 is stored, into ebx. But the following code in a console app: mov ebx, item invoke dwtoa, ebx, ADDR valuestr invoke StdOut, ADDR valuestr mov ebx, [item] invoke

汇编程序设计DOSBox模拟环境配置

时光总嘲笑我的痴心妄想 提交于 2020-02-29 07:02:11
# 汇编程序设计DOSBox模拟环境配置 #### 最近在学习汇编语言设计,然后上网找关于汇编程序的编译软件。不负有心人,终于找到了我需要的软件,值得庆幸。 #### 关于配置方法以及步骤,以下详情。 --- 首先,我们需要一个环境,该环境称为:DOSBox环境,该环境是一个仿真器环境,仿真真实的DOS环境,可重新创建 MS-DOS 兼容环境(包括声音、输入、图形甚至基本网络)。然后我们在这个环境下面进行汇编语言设计。有能力者可以直接网上下载真实的DOS环境,从而从实体机上运行并编写调试汇编程序。 DOSBox下载连接为: ---->这是下载链接<----- 当然要是不嫌弃,也可以到我的百度云盘中下载: ----->这是我的百度网盘链接<----- (提取码:tlow) --- 下载了之后,便是以下安装。习惯安装在 D 盘,所以我设置成了 D:\Program..... 如下图: 经过一系列的努力,你终于把环境配好了,好棒(๑•̀ㅂ•́)و✧ 然后,我们首先在D盘中新建一个文件夹,称作 "MASM" 为什么呢? 因为待会要使用,笨蛋( ╯□╰ ) > 哦~(●ˇ∀ˇ●) 接下来,我们进行masm配置,首先,你得把那几个程序找到 edit.exe, edit.com ( 编辑软件 ) debug.exe ( 是一种计算机程序,用于测试和调试MS-DOS可执行文件 ) masm.exe

汇编程序开发环境搭配

天大地大妈咪最大 提交于 2020-02-29 06:50:41
引子 由于这些日子一直都在研究底层的技术,从 Windows 驱动程序,到 Windows 内核等等技术的学习, 让我对底层的技术越发有兴趣了,而刚好,在研究 WRK 时, 对内存管理,寄存器,地址总线,数据总线,控制总线等的理解不够透彻, 所以越发的想学习汇编程序设计来提升功力, 而由于近来在公司里一直都有项目压着,所以在公司里也实在不好拿本汇编程序设计看, 所以只好晚上回来学习了, 汇编看了几个晚上,也算是蛮有感觉的。 今天就先来搭个开发环境再说吧。 开发环境搭配 我介绍四种开发汇编程序的方式: 第一种:直接在 Dos 环境下使用 Edit 命令调出源码编辑框, 生成源码后,可以使用由微软提供的 masm 汇编编译器来对源码进行编译, 编译完后再使用 Linker 连接器即可得到可执行文件, 这种方式现在几乎被灭绝了(当然使用 masm 汇编编译器还是很普遍的), 除非你真要在 DOS 环境下运行汇编程序; 第二种:通过简化第一种方式而来; 第三种:直接使用 Masm for Windows 集成实验环境,这个开发环境呢,非常适合汇编语言的初学者, 因为这个 IDE 本身就是由一些从事汇编程序教学的大学老师开发的出来用于汇编初学者进行学习和实验的, 所以使用简单,方便,这里可以对这个 IDE 稍加推荐; 第四种:则是通过 Visual Studio 这个强大的 IDE

Return a float from a 64-bit assembly function that uses x87 FPU

隐身守侯 提交于 2020-02-20 11:43:50
问题 I am trying to make a program that calculates equations (what equation doesn't matter currently) that use 64-bit registers, floats, and coprocessor instructions. Unfortunately I don't know how to access the final outcome of the equation as a float. I can do: fist qword ptr [bla] mov rax,bla and change the function type to INT and get my value, but I cannot access it as a FLOAT. Even when I leave the result in ST(0) (the top of the coprocessor stack) it doesn't work as expected and my C++

Assembly copying from one array to another

独自空忆成欢 提交于 2020-02-06 07:24:26
问题 and sorry for the title, i couldn't imagine a way to express this in english. So i'm writing a little game in assembly for a course, and, inside of two for loops, i copy the pixel data from the "bomb" vector of pixels, to the "area" vector of pixels, which will later be drawn to the screen. In C, it should look like this: int x, y; for(int i=0;i<32;i++) for(int j=0;j<32;j++) area[x+i][y+j]=bomb[i][j]; Using masm assembler and notepad++ to write the code, i got mov ecx, 0 ; my i outerloop: cmp

what is the difference beetwen dw and db with dup in assembly

岁酱吖の 提交于 2020-01-30 12:29:28
问题 I want to know what is the difference between this code and this code in assembly language: a db 2 dup (1fh) b dw 1fh,1fh and I think that the second code is better and I don't know why they make number first. 回答1: The 2nd line is equivalent to db 1fh, 0, 1fh, 0 , because each arg to DW is a word-sized integer. (And x86 is little-endian) The 1st line is equivalent to db 1fh, 1fh . To do that with DW, use dw 1f1fh . For a very short constant, that's maybe clearer. For anything more than 2

what is the difference beetwen dw and db with dup in assembly

若如初见. 提交于 2020-01-30 12:29:06
问题 I want to know what is the difference between this code and this code in assembly language: a db 2 dup (1fh) b dw 1fh,1fh and I think that the second code is better and I don't know why they make number first. 回答1: The 2nd line is equivalent to db 1fh, 0, 1fh, 0 , because each arg to DW is a word-sized integer. (And x86 is little-endian) The 1st line is equivalent to db 1fh, 1fh . To do that with DW, use dw 1f1fh . For a very short constant, that's maybe clearer. For anything more than 2

Assembly instruction mov register,[register][register]

隐身守侯 提交于 2020-01-24 15:08:25
问题 I'm studying ASM 8086 theoretically on highschool (MASM, x86). .data var dd 421,422, 443, 442, 444, 217, 432 .code ; some code mov esi, (OFFSET var)+4 mov ebx, 4 mov edx, [ebx][esi] ; that's the line I don't uderstand I ran that program and after that EDX == 000001BBh == 443 What's the meaning of last line in that code? What does it do? 回答1: esi points 4 bytes after var, which is 422 . ebx is 4. [ebx][esi] is something which denotes [ebx+esi] and the [] is a pointer operator. All this

Assembly instruction mov register,[register][register]

心不动则不痛 提交于 2020-01-24 15:07:06
问题 I'm studying ASM 8086 theoretically on highschool (MASM, x86). .data var dd 421,422, 443, 442, 444, 217, 432 .code ; some code mov esi, (OFFSET var)+4 mov ebx, 4 mov edx, [ebx][esi] ; that's the line I don't uderstand I ran that program and after that EDX == 000001BBh == 443 What's the meaning of last line in that code? What does it do? 回答1: esi points 4 bytes after var, which is 422 . ebx is 4. [ebx][esi] is something which denotes [ebx+esi] and the [] is a pointer operator. All this