MASM

汇编语言-环境搭建

点点圈 提交于 2021-02-20 08:40:30
MS-DOS环境安装 安装Vmware,并下载MS-DOS镜像。(AMD要启用SVM) 安装MS-DOS镜像 一路Next,重装完毕后会报错 这是BIOS启动设置的问题,按CTRL+ALT+INSERT重启虚拟机,在vm出现logo时按F2(把握好时间,多试几次),进入BIOS设置,向右键(→)切换到Boot栏,向下键(↓)选择到CD-ROM Drive(变白即为选中),然后按SHIFT和加号(+),将其移动到最顶端。向右键(→)切换到Exit栏,选中“Exit Saving Changes”,按两次回车,保存设置并重启。 继续一路Next,然后这一步不选择“Install Add-Ons”(在选项上按空格即可取消选择),“Next” 这一步选择“Enable both UMB and EMS” 选择“Load both” 选择“Use default” 选择“Continue” 然后会提示你是否重启,在重启之前,将连接改为使用物理驱动器,然后重启,不然会一直重装。 重启成功 masm和link编译文件 DOS本身并没有自带这两个软件,需要我们将masm这个文件夹放到DOS里面。先关闭DOS,然后右键进入设置,选择“硬盘”,在右面的“硬盘实用工具中”,点击“映射”。去掉“以只读模式打开文件”的选择,点击确定。 这时会自动打开该磁盘(如果没打开在我的电脑中可以找到该磁盘)

Moving a character back and forth across the monitor

末鹿安然 提交于 2021-02-17 06:04:42
问题 Write a program that will move a character from left to right and then back again across the monitor of the PC a number of times as specified by the user's input. The user is to be prompted for the character to display and how many times to move it back and forth. An input of '?' and 1 would cause the '?' to move back and forth across the monitor 1 trip. Your program must only allow entry of numbers from 1 to 4 inclusive. Use a loop that allows an exit only if the value is greater than zero

Manipulating Strings in Assembly (MASM)

前提是你 提交于 2021-02-16 21:59:14
问题 .data source BYTE "Defense mechanism",0 target BYTE SIZEOF source DUP(0) .code main PROC mov esi, OFFSET target mov edi, OFFSET target mov ecx, SIZEOF source L1: mov al,[esi] ; get a character from source mov [edi],al ; store it in the target inc esi ; move to next character inc edi loop L1 In the .data section, I see that source is defined as the string. In the .code section, I see that the memory location of target is stored in the source index. Shouldn't I want the source index ( ESI ) to

Can't get output of assembly language code

别说谁变了你拦得住时间么 提交于 2021-02-16 20:30:17
问题 I am newbie in assembly language. I am trying to get a string of numbers from user terminated by Enter or the length of the string reaching 20. When I executed the program it didn't show any error, but neither did it show any output nor did it terminate when the string exceeded the 20 characters limit. My code is: .model small .stack 100h .data var1 db 100 dup('$') .code main proc mov ax, @data mov dx, ax mov si, offset var1 l1: mov ah, 1 int 21h cmp al,20 je programend mov [si], al inc si

Can't get output of assembly language code

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-16 20:29:06
问题 I am newbie in assembly language. I am trying to get a string of numbers from user terminated by Enter or the length of the string reaching 20. When I executed the program it didn't show any error, but neither did it show any output nor did it terminate when the string exceeded the 20 characters limit. My code is: .model small .stack 100h .data var1 db 100 dup('$') .code main proc mov ax, @data mov dx, ax mov si, offset var1 l1: mov ah, 1 int 21h cmp al,20 je programend mov [si], al inc si

What is the function of a “data label” in an x86 assembler?

帅比萌擦擦* 提交于 2021-02-16 16:41:21
问题 I'm currently learning assembly programming by following Kip Irvine's "assembly language x86 programming" book. In the book, the authors tries to explain the concept of data label A data label identifies the location of a variable, providing a convenient way to reference the variable in code. The following, for example, defines a variable named count: count DWORD 100 The assembler assigns a numeric address to each label. So my understanding of what data label does is: data label count is a

How to remove all punctuation and spaces in a string?

二次信任 提交于 2021-02-13 16:35:14
问题 I have input like this: This is, ,,, *&% a ::; demo + String. +Need to**@!/// format:::::!!! this.` Output Required: ThisisademoStringNeedtoformatthis I have to do this without using str_trim. Edit: I am writing an encryption program. I have to remove all punctuation from the string and turn all lower case letters to uppercase before I encrypt it. I added the code. I need to remove the spaces, or any punctuation before I turn it to upper case. So far I haven't found anything in my book that

Non-recursive Fibonacci Sequence in Assembly

梦想与她 提交于 2021-02-11 15:45:04
问题 In some homework, I have to create a Fibonacci Sequence program in Assembly. I created this code, but it doesn't seem to be working correctly and I am not sure as to why. I believe that I am doing this correctly, but EAX remains "2" every loop. INCLUDE Irvine32.inc .data prev DWORD ? next DWORD ? val DWORD ? count DWORD ? total DWORD ? myMsg BYTE "Fibonacci Sequence ",0dh,0ah,0 .code main PROC mov ecx,15 mov val,1 mov prev,-1 mov eax,1 mov edx,OFFSET myMsg call WriteString L1: mov count,ecx

Location and Highest value in array

做~自己de王妃 提交于 2021-02-10 12:18:41
问题 So i am trying learn assembly and my practice sheet has an example where i have to create a program to input 10 numbers one at a time into an array. I have to print the highest value and when it was entered. I have barely any exp in comparing but I want to somehow store the high value and compare it the locations? code: include irvine32.inc .data num dw 10 dup(0) count db 1 prompt db "Enter a number: ",0 yesMsg db "hi val is in location ",0 hiMsg db "The high value is ",0 .code main proc mov

Location and Highest value in array

╄→гoц情女王★ 提交于 2021-02-10 12:18:25
问题 So i am trying learn assembly and my practice sheet has an example where i have to create a program to input 10 numbers one at a time into an array. I have to print the highest value and when it was entered. I have barely any exp in comparing but I want to somehow store the high value and compare it the locations? code: include irvine32.inc .data num dw 10 dup(0) count db 1 prompt db "Enter a number: ",0 yesMsg db "hi val is in location ",0 hiMsg db "The high value is ",0 .code main proc mov