MASM

Program to get user's details, calculate age and display all information

偶尔善良 提交于 2019-12-02 03:32:57
I have some code started but I am having problems saving the users string input into a variable. Using ReadString I can get prompt the user to input a string, but after saving the users input into a variable named AskName1, and then displaying the information saved in AskName1, I have found that it save the number of characters that the user input and not the actual string. So what I need to figure out is how to save the string that the user input into a variable instead of the number of characters the user input. INCLUDE Irvine32.inc .data AskName BYTE "Please enter your name " ,0dh,0ah,0

Jump table implementation in MASM x64?

痞子三分冷 提交于 2019-12-02 03:28:27
I'm trying to implement an algorithm in assembly (MASM64, Windows, x64) using jump tables. Basic idea is: there are 3 different types of operations I need to do with data. The operations depend on some variables, but I found it tedious to implement a lot of switching and many long implementations. PUBLIC superFunc@@40 ;__vectorcall decoration .DATA ALIGN 16 jumpTable1 qword func_11, func_12, func_13, func_14 jumpTable2 qword func_21, func_22, func_23, func_24 jumpTable3 qword func_31, func_32, func_33, func_34 .CODE superFunc@@40 PROC ;no stack actions, as we should do our stuff as a leaf

Issues using a local label in a macro in MASM

人走茶凉 提交于 2019-12-02 02:12:28
问题 I'm to write a macro that takes E,NE,A,B ... as a parameter and a single command i.e mov eax,ebx which would execute if the condition set by a preceding cmp operation is true. An example call would look like. cmp bx,20 mDoIf E,<call Dumpregs> The issue I'm running into is that when I attempt to compile with the below definition I get one of two errors. With the LOCAL definition I get an Undefined Symbol Error: ??0000 . When I remove the LOCAL definition I get an error: jump destination must

Test if value in EAX is the same as any value in a array x86

China☆狼群 提交于 2019-12-02 01:47:43
I am attempting to test if the random value generated in eax is the same as any value in an array I have allocated. The outer loop generates the array and writes it to the screen and in to the array, The inner loop is then supposed to test if the value exists in the array. I know i am not doing the inner loop correctly but I am not sure how to fix it. It assembles just fine but when I try to run I only get a blank cmd window screen. Also I am using Irvine32 libraries. My code is below: EDIT : I appreciate your guys help so far but now I Have two problems. The first is that when I try to

Test if value in EAX is the same as any value in a array x86

天涯浪子 提交于 2019-12-02 01:41:13
问题 I am attempting to test if the random value generated in eax is the same as any value in an array I have allocated. The outer loop generates the array and writes it to the screen and in to the array, The inner loop is then supposed to test if the value exists in the array. I know i am not doing the inner loop correctly but I am not sure how to fix it. It assembles just fine but when I try to run I only get a blank cmd window screen. Also I am using Irvine32 libraries. My code is below: EDIT :

LEA & MOV instruction comparision

流过昼夜 提交于 2019-12-02 01:38:20
Instruction 1: LEA DX, MESSAGE ; Move the address of MESSAGE in register DX Instruction 2: MOV DX, OFFSET MESSAGE ; Move the address of MESSAGE in register DX Questions: Are the above instructions equal? They seem to work similarly, but I have just started programming assembly so I can not say. If both of them are similar, then which one of above is the better way to do the above task? Note: I have already read this question On my 32-bit system, the instructions match opcodes like this: 8d 15 c8 90 04 08 lea 0x80490c8,%edx ba c8 90 04 08 mov $0x80490c8,%edx So you use a whole extra byte when

Assigning value to the variable present in previous line using $ sign

只愿长相守 提交于 2019-12-02 01:33:20
I'm trying to understand the MS-DOS v2.0 source code , and in particular some of the code in MSDATA.ASM . This code was originally assembled with a 35+ year old MASM assembler (a version that wasn't commercially available). The code I'm interested in is near the beginning: SUBTTL Initialized data and data used at DOS initialization PAGE ; DATA AREA for MS-DOS IFNDEF KANJI KANJI EQU 0 ;FALSE ENDIF CONSTANTS SEGMENT BYTE PUBLIC 'CONST' EXTRN international_table:BYTE EXTRN Current_Country:WORD ORG 0 CONSTRT EQU $ ; Start of constants segment PUBLIC DevStrLen DEVSTRLEN DB 3 ; Size of below PUBLIC

Cannot access label through segment registers, error in assembly

混江龙づ霸主 提交于 2019-12-02 01:28:46
问题 INCLUDE Irvine16.inc .data byteArray BYTE 6 DUP(?) listSize = ($ - byteArray) aSum WORD 0 soffset = 0 .code main PROC mov ax, @data mov ds, ax mov cx, listSize Loop1: mov ax, 0 movzx ax, [byteArray + soffset] add aSum, ax soffset = soffset + 1 loop Loop1 exit main ENDP END main The error I'm getting is error "A2074:cannot access label through segment registers" I'm trying to use the soffset to loop through the byteArray. 回答1: I'm not sure what's in Irvine16.inc, but I bet it is saying .model

Issues using a local label in a macro in MASM

那年仲夏 提交于 2019-12-02 01:02:53
I'm to write a macro that takes E,NE,A,B ... as a parameter and a single command i.e mov eax,ebx which would execute if the condition set by a preceding cmp operation is true. An example call would look like. cmp bx,20 mDoIf E,<call Dumpregs> The issue I'm running into is that when I attempt to compile with the below definition I get one of two errors. With the LOCAL definition I get an Undefined Symbol Error: ??0000 . When I remove the LOCAL definition I get an error: jump destination must specify a label . mDoIf MACRO op, command LOCAL true J&op true exitm true: command exitm endm Any help

How can I make a batch file that automatically builds, links and executes a .asm file?

给你一囗甜甜゛ 提交于 2019-12-01 23:53:29
问题 I am working with DosBox emulator in my university. We build .asm files with MASM. I am extremely tired of having to build my .asm file every time with masm, then pressing enter 4 times, then entering link .obj, then enter 4 times. Then running the actual .exe. I wanted to automate this, and after searching for a while, I understand I need to make a batch file. It currently looks like this @echo off set arg1=%1 masm %arg1%.asm %SendKeys% ("echo off{ENTER}") %SendKeys% "echo off{ENTER}"