MASM

Trying to flip a triangle in assembly language

吃可爱长大的小学妹 提交于 2019-12-13 07:59:17
问题 INCLUDE Irvine32.inc .code main PROC mov ecx, 6 L1: call Proc1 call CRLF loop L1 exit main ENDP proc1 PROC USES ecx mov al, 'A' L2: call WriteChar inc al loop L2 ret proc1 ENDP END main The output of my code is ABCDEF ABCDE ABCD ABC AB A In a triangle form going down but I need to flip it to where it is A AB ABC ABCD ABCDE ABCDEF Edit: Trying to mirror the right triangle. A A AB BA ABC CBA ABCD DCBA ABCDE EDCBA ABCDEF FEDCBA 回答1: As suggested by @Jester, counting up is the solution, but only

Move register value into an array

社会主义新天地 提交于 2019-12-13 06:13:59
问题 I'm working on this assembly problem where I'm looping through each element in array1 and storing the index of that array where the entry is "F". I'm using MASM for x86 intel processors. Assembly Language INCLUDE Irvine32.inc .data array1 BYTE "FMMFMFMMFFMMFFFMFMFM",0 indexa1 BYTE SIZEOF array1 DUP(?) ArraySize = ($ - array1) .code main PROC mov esi,0 ; index mov ecx,ArraySize L1: cmp esi,ecx ; check to continue loop jl L2 ; continue jmp L5 ; exit L2: cmp array1[esi], "F" ; Check if "F" je L3

Random number array sorted with Selection Sort — garbage characters output for size > 130

别说谁变了你拦得住时间么 提交于 2019-12-13 04:45:43
问题 My program takes user input (integer between 10 and 200) and prints out the entered number of random numbers and stores them in an array. Then the array is sorted and printed out (SEE IMAGE BELOW). The median is of the numbers are also printed on the screen. I have not been able to find the error. The program works perfectly for numbers less than or equal to 130, but not over 130. TITLE Program5 (Program5.asm) INCLUDE Irvine32.inc ; (insert constant definitions here) MIN_INPUT = 10 MAX_INPUT

Calling a library made in MASM to C or C++

ぃ、小莉子 提交于 2019-12-13 04:23:34
问题 i have been trying to call a library in c which was made in masm. I have managed to make a .lib file from assembly MASM. But i have no idea how to call it to C language as a library. Here is the .lib file https://www.dropbox.com/s/d9d8cjbxmo51yqg/main.lib Help needed. Thanks 回答1: The basic idea is fairly simple: Write the (externally visible) assembly language functions using the C calling convention. Write a C-compatible prototype/declaration for each function. Call functions as needed. The

x86 assembly - how to show the integer 2, not the second ASCII character

我怕爱的太早我们不能终老 提交于 2019-12-13 03:33:41
问题 I have this code: .386 .model flat, stdcall option casemap :none include \masm32\include\windows.inc include \masm32\include\kernel32.inc include \masm32\include\masm32.inc includelib \masm32\lib\kernel32.lib includelib \masm32\lib\masm32.lib .data num dd ? .code start: mov eax, 1 mov ebx, 1 add eax, ebx push eax pop num sub num, 0 invoke StdOut, addr num invoke ExitProcess, 0 end start What it is supposed to do is do 1+1 and then display the result on the console. When I run it it displays

Moving a BYTE to a BYTE

匆匆过客 提交于 2019-12-13 02:16:40
问题 I am in a Machine Architecture and Assembly Language class, and I am supposed to create a MASM program that creates the Fibonacci sequence up to a user defined number, that is inclusively between 1 and 46. When I try to transfer the string stored in a BYTE labeled buffer , which is where the book authors ReadString procedure stores a string, to another BYTE labeled user , I receive this build output: 1>------ Build started: Project: MASM2, Configuration: Debug Win32 ------ 1> Assembling

How do I get another counter?

≯℡__Kan透↙ 提交于 2019-12-13 02:06:53
问题 I'm trying to compare bubble sort between C++ and MASM. I've got the C++ working without issue. With MASM, however, I need another counter in loopSwap, but I don't know how to go about it. I know that if I push a register, it would have to be before the comparison but if the comparison jump is met, I wouldn't be able to pop the same register. Any help is appreciated! C++ Code: #include <iostream> #include <cmath> #include <ctime> using namespace std; int deepBlueDecend(int* num, int size);

Pass by value and pass by reference in Assembly

为君一笑 提交于 2019-12-12 20:13:46
问题 I'm trying to solve this problem: Create a PROC procedure that takes one parameter as Pass by Value and prints the number of 'X' according to the number passed as a parameter. Before printing, make sure parameter is a positive number, at end of program you need to change the registers that have been used back to their first values . If the input to the procedure is 5 then the output on the console should be: XXXXX This is my code: var db 5 ;In the dataseg push [var] ;in the codeseg proc

masm error A2075: jump destination too far : by 30 bytes

♀尐吖头ヾ 提交于 2019-12-12 11:04:32
问题 My ma'am give me an assignment in which i have to make a program which will take input through keyboard and check the conventional order of the nested brackets. for example: input = {[()]}, output = correct format, input = ({[]}) output = incorrect My program: .model small .stack 100h .386 .data msg1 db "this is a correct format of nested brackets$" msg2 db "this is no a correct format of nested brakets$" .code main proc mov ax,@data mov ds,ax mov cx,15 push '#' l1: mov ah,1 int 21h cmp al,'[

Importance of Hexadecimal numbers in Computer Science [closed]

心不动则不痛 提交于 2019-12-12 07:23:45
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . When studying programming 8085, 8086 and microporcessors in general we always have hexadecimal representation. Its ok that binary numbers are important in computers. But how these hexadecimal numbers are important? Any historical importance? It would be nice if someone point to