Questions tagged [assembly]

Assembly language (asm) programming questions. BE SURE TO ALSO TAG with the processor and/or instruction set you're using, as well as the assembler. WARNING: For .NET assemblies, use the tag [.net-assembly] instead. For Java ASM, use the tag [java-bytecode-asm] instead.

0
votes
0answers
18 views

power function in assembly language

I am trying to write a program to evaluate the value of the following real valued function. Make sure to print the output using a message box. f(x,y,z) = x^4 + y^3 + z + (x + y)^4z The program ...
0
votes
0answers
15 views

How to call user defined c functions in gnu asm-32 x86 subroutines compiled in gcc [duplicate]

I am compiling a program in GCC on Ubuntu x86-32bit with a At-t syntax gas file. I have functions defined in the main.c file that I want to call in the assembly file subroutine. The program segfaults ...
0
votes
1answer
16 views

Having trouble understanding cmpsb in the following example

I am following a tutorial on operating systems and I came across the following block code which is checking filenames on a disk against my variable "ImageName". My confusion arises from the push di ...
0
votes
0answers
22 views

Assembly language not compiling

i am trying to complete 80x86 assembly language program that prompts for and inputs the length, width, and height of a box and computes and displays its volume (length * width * height). I am a ...
0
votes
1answer
27 views

shift right and shift left assembly language

If I want to say for example bx is a number: shl bx,1 shr bx,1 What will be the new bx value? Does it stay the same?
0
votes
0answers
12 views

Phase 4 of Binary Bomb Exercise [duplicate]

I know that there are various versions of this question online, but I was unable to find one that helped me understand the assembly code of function 4 in the code that has been given to me. This is ...
-2
votes
0answers
29 views

finds out the 32 bit single precision IEEE 754 floating-point representation [on hold]

I am looking for Assembly8086 program code: Once your program reads the operand (i.e. user input), it finds out the 32 bit single precision IEEE 754 floating-point representation Examples: Input: ...
2
votes
1answer
21 views

Using a pointer arg to my function throws an exception

I am currently getting an "exception thrown" error on the line mov [ebx], eax I can't find a solution because all of them use this exact same code and it works for them. This is an exact copy ...
0
votes
0answers
21 views

How to use function GetDlgItemInt assembly?

In TASM for Win32, I have this code: ;------- Edit1 Create ---------------- push L 0 push [hInstEdit1] push idEdit1 push [newhwnd] push L 20 push L 200 push L 50 push L 130 ...
-2
votes
0answers
18 views

LARGEST FLOAT VALUE ASSEMBLY

is there any constant that represent tha largest floating point value in assembly? I'm trying to search on the internet and on the intel's optimization manual, but i'am not be able to find a solution.
-3
votes
0answers
13 views

how to make limits in asembly grafic 8086? [on hold]

I am codeing a game in assembly grafic. I am trying to have imits for my charcter's player. can someone tell what is the problem with my code? proc arrows PushAll keletArrow: call KeletTav ...
0
votes
0answers
20 views

What happens to the higher 32 bits in %rdi, when you want to do some operations in %edi? [duplicate]

Like the code below, movl $1, %edx I put the immediate value 1 into %edx, and I know 1 is now stored in the lower 32 bits of %rdx. The question is, what happens to the higher 32 bits of %rdx then ...
-6
votes
0answers
22 views

pointers from c to assembler mips. How? [on hold]

So Im dealing with the code (*v)[i++]+=a%2+b float b, int i,a,**V *V=(int*)malloc(sizeof(int)*10) I can only use beq,slt,j, and the normal opperators. How am I supposed to do it?
1
vote
2answers
21 views

Provide incbin path as a predefined macro in both NASM and GCC

I want to embed a binary file in an executable, in a way that is portable to both Windows and Linux. For achieving this, I want to use an assembly file with the directive incbin. For example: ....
0
votes
0answers
22 views

Should one prefer R_ARM_GOT32 or R_ARM_ABS32?

I'm finishing up an integration of Cryptogams SHA on an ARM platform. The code is used in both a static archive and shared library. The original code used the following technique to load a global ...
-3
votes
0answers
67 views

Returning a float from an assembly function [on hold]

I need to get a float value calculated by an assembly function called from a c code. This is my c code: extern float test_distance(VECTOR x1, VECTOR x2, int d); void testIndex(){ float x[5] = {...
0
votes
1answer
55 views

Passing an array as argument to a x86 function from C

I have a bmp file and I read it in a c function and store the values of pixels as unsigned integer. I want to pass this unsigned integer array to x86 but I fail. Here is my c code: I have this ...
-2
votes
0answers
23 views

Can cpu interrupt break multi-cycle instructions?

Some instruction may take multi cpu cycles, what if interrupt comes when these multi-cycle instruction are running? How this activate in arm mips c51 x86 sparc power-pc and risc-V ?
1
vote
0answers
8 views

How can I implement a two-digit counter that counts seconds into the downward direction in Emu8086?

I need implement a two-digit counter that counts seconds into the downward direction in Emu8086. For the design of traffic lights.
0
votes
1answer
52 views

C++ inline assembly trying to copy a char from a string into a register

I have an assignment in C++ to read a file into a string variable which contains digits (no spaces), and using inline assembly, the program needs to sum up the digits of the string. For this I want to ...
2
votes
2answers
34 views

Why IDIV with -1 causes floating point exception?

As far as I understood, idiv %ebx will divide edx:eax (concatenated into 64-bit value, in that order) with 32-bit ebx. However, when I try to divide 0x00000000:0xfffffffb (0 and -5) with 0xffffffff (-...
-3
votes
0answers
22 views

Simulating Pipelining Hazards [on hold]

I am working on my semester project on Computer Architecture and want to simulate pipelining hazards using any high-level programming language preferably Java. The steps involved in hazards is that ...
1
vote
3answers
57 views

ASSUME directive using masm

I have been attempting to write assembly code with using ASSUME but keep on getting errors that I have not been able to find out their causes. Here are a couple of examples: Example 1 .286 .model ...
0
votes
1answer
37 views

Porting yasm code (Intel style) to gas (AT&T style)

I'm trying to learn about strings in assembly x86 32bit but recently switched from yasm to gas and tried translating the sources file btw I used xorpd code you can see here I saw some AT&T syntax ...
1
vote
2answers
80 views

How to comprehend the flow of this assembly code

I can' t understand how this works. Here's a part of main() program disassembled by objdump and written in intel notation 0000000000000530 <main>: 530: lea rdx,[rip+0x37d] # 8b4 &...
0
votes
0answers
25 views

Understanding cache miss rate

I got so confused when learning how data cache and instruction cache miss rate works with a direct mapped caches... Suppose I am looking a mips processor which has 8 bytes of block size, the assembly ...
0
votes
0answers
41 views

How to convert VS assembly to gcc assembly

I am porting some code from Visual Studio to Linux. In Linux the GCC compiler is not able to add immediate values to labels. Visual Studio: int main() { one: goto done; two: goto done; ...
0
votes
1answer
37 views

Sorting an array from biggest to least in Assembly language x86

I'm trying to sort an array using the registers from biggest to least and nothing seems to be working. The ecx is my amount of numbers that I have, the esi is the address of my list which consists of ...
0
votes
0answers
14 views

Assembly 8086x How do I change the default mouse into a box [duplicate]

Code below prints a photo and creates a mouse. I want to change the mouse that it creates into a square but how do I do it so that the square will follow the mouse to wherever it goes first i tried to ...
0
votes
0answers
11 views

problem with an execve (/bin/sh) shellcode [duplicate]

I'm trying to write the shellcode for an execve(/bin/sh) but i'm having some trouble understanding why it doesn't work. here is my .asm code : global _start section .text _start: ; PUSH ...
2
votes
1answer
73 views

Random number generator crashing in assembly

Found this code here on stackoverflow, I understood how it works and tried implementing it. It crashes at the INT 1AH instruction and I don't know why. When I run it in ollydbg, it stops at the same ...
1
vote
1answer
29 views

how to store 4 character in a define doubleWord in assembly language

I'm currently doing assembly programming (16-bit) on DOSBox using MASM. var1 dd 'abcd' for the above code MASM is generating error: A2010: syntax error What is wrong with the syntax? I am simply ...
-4
votes
1answer
63 views

How to Fix the Instruction in Code which cause application crash

The main application file is crashing becausing The server is affected by a format string bug when handles the players nicknames due the access to an invalid memory zone. The instruction executed is "...
-3
votes
1answer
43 views

RISC-V or ARM for learning low-level programming and hardware? [on hold]

I decided to study low-level things and my choice fell on RISC-V and ARM. ARM seemed to me a rather heterogeneous architecture, specific in different versions and for different vendors, unlike x86. ...
0
votes
1answer
38 views

Why isn't there an output when I enter image lookup <address > in lldb? [on hold]

So when I enter the commands image lookup in lldb, I get no output. I am using debugserver by the way. I searched in google about this problem and didn't find anything.
-1
votes
1answer
38 views

How to execute x64 Assembly within a Python script? [on hold]

I am making a compiler in Python and I know that compilers translate code to Assembly and then execute it, because computers can understand Assembly. I want to translate my programs into x64 Assembly, ...
0
votes
0answers
27 views

Assembly RISCV rotation instruction [duplicate]

I have worked with assembly language of riscv. But I can't find a specific keyword for rotation operation in Risc-V assembly language.
1
vote
1answer
38 views

How do i generate 2 random numbers, once within the range of 50 and 259, and once within 50 and 159? [duplicate]

I'm working on an assembly 8086 project for class and needed a way to generate 2 random numbers, once within 50 and 259 and once within 50 and 159.
0
votes
2answers
30 views

mov instruction doesn't work other way around

I'm trying to move the characters that are not digit from the char array "buffer" to new array "clean". "buffer" is created by using scanf function. .section bss buffer: .skip 20 clean: ....
1
vote
1answer
43 views

Cross compile MASM-syntax assembly with mingw on Linux

I want to cross compile a Metasploit template (in assembly language) for 64 bit Windows on Kali Linux. I am trying to compile from assembly to exe. Here is the code - ; Author: Stephen Fewer (...
-3
votes
0answers
45 views

How do i translate my code into asm to make my program run faster? [on hold]

Hey i'm trying to translate a loop with some instructions to intel asm in order to make my program run faster. I've tried translating it but didn't get the solution i was hoping for. double x = 0.0; ...
-1
votes
0answers
23 views

Assembly 8086x How do I change the default mouse to a picture

Code below prints a photo and creates a mouse. I want to change the mouse that it creates into a square, so I created a file named Dotmaze.bmp- a picture of a square. But if I print it, of course, it ...
2
votes
2answers
104 views

Why are global variables in x86-64 accessed relative to the instruction pointer?

I have tried to compile c code to assembly code using gcc -S -fasm foo.c. The c code declare global variable and variable in the main function as shown below: int y=6; int main() { int x=4; ...
-2
votes
1answer
45 views

How to change the window color to red in assembly?

In TASM for Win32, I have this code: mov [wc.clsHbrBackground], COLOR_WINDOW + 1 I need to change the color of the window to red. How can I do that?
-4
votes
1answer
44 views

How Can I Convert Assembly Code to Machine Code In Java

I have some instructions for a cpu so i have assembly code and how can i translate them to machine code in java. I have code like this: LI 5 ST 1 AD 1 ST 0 LI 0 BZ 0 And i want to them like this: ...
0
votes
0answers
20 views

How to get links right in a singly linked list in assembly?

I'm supposed to implement a singly linked list using assembly(masm x86). I've done the 'append' function, and the 'print' function so far, but I can't figure out where the problem is(the code ...
0
votes
1answer
74 views

How can I trace the value of an address in memory?

As the title suggests, I want to see from where came the value of a specific address. I am debugging an ios game with lldb. This game has a muliplier value of 0.4 (how fast combos decrease). I can ...
-1
votes
1answer
30 views

How to implement logic gates using assembly code?

I'm preparing for a digital systems exam and I have a past paper question as below: implement AND and NAND gate using assembly code. There's no mark scheme for the paper so I can't look up how to do ...
0
votes
0answers
38 views

pushl to stack with respect to %ebp leads to segfault

I want to print values stored in stack using the variable iIndex, which means number of elements stored in the stack. All values stored in stack are integers, and iIndex has value -4, -8, -12... so on ...
0
votes
0answers
37 views

Trying to pass a parameter to procedure but getting an exception thrown?

I would like to pass an 'inputCounter' parameter by pushing it onto the stack. Within the procedure, I dereferenced the stack pointer pointing to this parameter, and would like to add it to the ...

http://mssss.yulina-kosm.ru