Questions tagged [assembly]

Assembly language questions. Please tag the processor and/or the instruction set you are using, as well as the assembler, a valid set should be like this: ([assembly] [x86] [gnu-assembler] or [att]). Use the [.net-assembly] tag instead for .NET assemblies, [cil] for .NET assembly language, and for Java bytecode, use the tag java-bytecode-asm instead.

Filter by
Sorted by
Tagged with
0 votes
1 answer
12 views

Arm cortex m0 LDR instruction

What is the difference between these instructions in the ARM Cortex M0? LDR r1, r2 LDR r1, [r2] MOV r1, r2 Is any of them wrong? If none of them is wrong, why would I use the second one to load from ...
Ahmed Abdalhaleem's user avatar
-2 votes
0 answers
15 views

Adding 2 numbers in assembly x86

When you try to add 2 numbers it says a letter or a symbol .plus: mov eax, [num1] sub eax, 0 mov ebx, [num2] sub ebx, 0 ...
Me88_88's user avatar
0 votes
0 answers
24 views

Assembly, accessing bytes in eax [duplicate]

How can I adress a specific byte in eax. I know that I can access byte 0 and 1 via ah and al but how can I access byte 2 and 3?
Marlon Müller's user avatar
1 vote
0 answers
15 views

fnstenv to get EIP returns NULL value (PIC shellcode alternative to call/pop)

Objective I am learning exploit development and one of the topics is on writing shellcode. Typically, msfvenom would do the job well with shikata ga nai encoding. The shellcode generated will also ...
balapoopi's user avatar
0 votes
0 answers
12 views

Difference about byte-addressable memory address and memory in direct mapping

Consider a computer uses 48-bit byte-addressable memory address, and it has a memory of 4 GB and a one-level cache of 2 KB (not counting the space for tags nor dirty flags). Suppose a cache block is ...
Benjj's user avatar
  • 1
-1 votes
0 answers
35 views

Why does a compiler access args relative to ESP in one function but EBP in another? [duplicate]

Here is a C code-1: int max(int x, int y) { int diff = x - y; int mask = (diff >> 31) & 1; return y + mask * diff; } and its assembly O1 optmised: movl 4(%esp), %eax ...
Dawood Ahmed's user avatar
0 votes
0 answers
22 views

Using an ADC with PIC24 and storing the data in an SD card

I'm just an engineer student and I have such a project. But I didn't find enough resources to read except the datasheets it seems like the PIC24 is not being used a lost in the industry and there is a ...
skander's user avatar
  • 29
0 votes
0 answers
25 views

Overfast library for C language [closed]

I would like to write optimized program on C language, and I would like to use as fast c-gui-lib as I can. So, can you advise me something? If you can't advise anything with gui, write, how to use ...
Rarest Loki's user avatar
0 votes
0 answers
30 views

link PIC24 with SDcard

I'm trying to save some data on the SD card that I will write on the PIC24fg64GA002 and I'm having some problems in the coding due to me being new to programming using mplab and programming pic. ...
skander's user avatar
  • 29
0 votes
0 answers
28 views

Which instruction encoding is supported by a ARM processor, particularly a Cortex M0, STM32F0 one for example

Confused about instruction encoding supported by my core (ie. T1, T2, etc) Having the STM32F0 series Cortex-M0 programming manual, I found that https://www.st.com/resource/en/programming_manual/pm0215-...
yo3hcv's user avatar
  • 1,549
0 votes
0 answers
24 views

how RISCV architecture suggest to fill mtval register in instruction address fault?

If mtval is written with a nonzero value when a breakpoint, address-misaligned, access-fault, or page-fault exception occurs on an instruction fetch, load, or store, then mtval will contain the ...
Ömer GÜZEL's user avatar
0 votes
0 answers
26 views

Finding sum of n positive number

How do I write a program in assembly language? I want to input 15 two-digit decimal numbers (including positive numbers, negative numbers, and 0) , and then the program will calculate the sum of all ...
A confused guy's user avatar
1 vote
0 answers
70 views

How to compile x86 Assembly generated via rustc into an executable?

I am having difficulties assembling the x86 Assembly that is compiled by the rustc compiler. I have tried various methods of assembling it, but am getting no output. The code in itself is very simple, ...
kush's user avatar
  • 11
1 vote
1 answer
69 views

How to correctly reset the NEG flag in a LMC without storing said variable then loading it again?

My given task is to find the mean of the sum of 3 inputs rounded down using LMC. To which I had the following code: LDA zro STO r STO cnt LDA t STO abc lp IN STO a div LDA ...
Harry Barry's user avatar
-1 votes
0 answers
44 views

input, output and working with files on flat assembler:

I want to enter 10 characters in a loop and write these characters to a file My code format MZ org 100h buffer db 10 dup(?) buffer_end: start: mov si, buffer mov cx, 10 read_loop: mov ...
martyr's user avatar
  • 97
-4 votes
0 answers
33 views

Which of the following are valid label names and which are not?

Which of the following are valid label names and which are not? For those which are not, give a reason. MUL TESTING&CHECKING ZERO CHECK 12_STEPS PRICES_IN_$ PPPPPPPP kindly explain also i tried ...
Ubaid Ahmed's user avatar
1 vote
1 answer
47 views

Is there a way to make GDB disassemble all memory in a specific range, without regard for instruction boundaries?

x/16i 0xdeadbeef yields: 0x80481be <_init+22>: shlb $0x3a,-0x18(%ebp,%eax,1) 0x80481c3 <_init+27>: jle 0x80481c0 <_init+24> 0x80481c5 <_init+29>: .byte ...
brunge's user avatar
  • 13
0 votes
0 answers
42 views

How to Remove Leading Zeros from String? - Assembly Language (DosBox, TASM)

I'm very VERY new to Assembly language, and I would like to know how to remove the zeros in front of an integer string? This is the last thing I needed before completing it, and here is what our ...
dsadada's user avatar
2 votes
1 answer
83 views

Why does using the %ebx register cause a segmentation fault in my assembly code

I'm working on a small piece of i386 assembly code and encountered a segmentation fault when using the %ebx register. I would appreciate some insights into why this is happening. I have two versions ...
Seizh7's user avatar
  • 21
0 votes
0 answers
38 views

RISC-V jumps with zero offset

I want to verify my understanding of the RISC-V standard concerning jump commands. For this, I have considered the three following three assembly commands: j 0 j 4 j 8 where j is the jump pseudo-...
Schottky's user avatar
  • 1,591
0 votes
0 answers
27 views

MASM Frame not in module the current stack frame was not found in a loaded module [duplicate]

I'm currently learning MASM x64 and using Visual Studio 2022. To facilitate my learning process, I've attempted to create a simple WriteLine procedure that I can call from the main function to write a ...
Joey Soroka's user avatar
-2 votes
0 answers
46 views

Unresolved external symbol x64 asm and C++

I am trying to use variables declared and populated in C++ in .asm code, but I get a linker error. The asm code looks like this: .data EXTERN NtOpenProcessSSN: DWORD EXTERN NtCloseSysCall: QWORD ....
Desertcod98's user avatar
0 votes
0 answers
34 views

why doesn't my loop work in 64 bit nasm for efi [duplicate]

I'm writing a basic bootloader for my laptop, which uses uefi, I have got booting from the usb working, printing working, exits working, everything but a simple loop. This the the loop: mov r10, 0x05 ....
Chromegism's user avatar
0 votes
0 answers
26 views

Checking for collision of snake with border in 8088 assembly language

org 0x100 jmp start checkBorder: push bp mov bp,sp push ax push bx push cx push dx mov ax,[bp+6] mov bx,[bp+4] cmp ax,17 jz over cmp ax,54 jz over ...
Adeel Umar's user avatar
-1 votes
0 answers
23 views

Assebly , C8051F310, Button interrupt

I don't know how to develop a program in assembler for C8051F310 to poll the key on interrupt and the fact of pressing. I checked a lot of documentation and still can't find how to do it. In the code ...
JAJAJa Jajajaaa's user avatar
-1 votes
1 answer
42 views

clarifications on assembler code when declaring an array with a size decided at runtime

I'm trying to understand how sizeof() works, so I made 2 arrays, and see what is assembled, I've not used -O3 option because I thought the code to be clearer and the code is not deleted by ...
sefiroths's user avatar
  • 1,553
1 vote
0 answers
15 views

assembly compile target in termux + prooted ubuntu in galaxy android

Hi assembly programmers, I am a newbie using Galaxy Handphone S23 and want to compile hello-world assembly code in termux-prooted-ubuntu environment. I checked to find CPU architecture is armv8-a. ---[...
user1389406's user avatar
-4 votes
0 answers
28 views

how to write a assembly program calculate float number by Intel x86(MISP) , I have no book or document to read and study about my problem [closed]

how to write a assembly program calculate float number by Intel x86(MISP) , I have no book or document to read and study about my problem I only permitted to use basic commmand in J format, I format , ...
Hiep's user avatar
  • 1
0 votes
0 answers
17 views

How does sbrk in MIPS properly get called

I'm trying to learn MIPS and implement a dynamic memory allocation depending on the size of the number of values I need to store, so I'm using sbrk in my allocation of space. The problem arises that ...
Niv O's user avatar
  • 1
0 votes
0 answers
26 views

How do I partition in MIPS with recursive calling?

I am tasked with sorting a line of numbers. The method I have to use is partioning a line of numbers with recursion using MIPS. I have some code that I wrote so far, and put it into basic english what ...
Tanner Raine's user avatar
1 vote
0 answers
24 views

GAS (gnu assembler) and conditional execution

Stupid question. I am writing code in pure assembly for STM32 variants. I want to make two different versions from the same source file by assembling twice with a simple change that is selectable ...
Jeff Casey's user avatar
-1 votes
0 answers
38 views

What does macro do in NASM X86?

section .text global _start global _exit _start: %macro output , assign 2 mov eax, 4 mov ebx, 1 mov ecx, output mov edx, assignLength int 0x80 %endmacro% output 13, "Hello ...
Eric Wright's user avatar
0 votes
0 answers
21 views

Exit branch and continue rest of code in ARM assembly (for home security system)

I am working on a home security system in ARM assembly, where the system is enabled by a switch. Upon activation, it's ready to detect motion and requires the user to input a specific sequence of keys....
Boo Man's user avatar
0 votes
0 answers
21 views

Debugging "invalid program counter value: 0x00000000" in MARS, function that calls other functions

The homework assignment: Implement a subprogram which takes 4 numbers in the argument registers $a0...$a3 and returns the largest value and the average in $v0 and $v1 to the calling program. Note the ...
Sweeney31's user avatar
0 votes
0 answers
29 views

Why does this code not work with Bubble sort

These variable has ALREADY been defined: int i, k, Done; int A[]; // Array to be sorted int N; // contains the length of the array Write the following Bubble Sort ...
hou Kevin's user avatar
1 vote
0 answers
47 views

output is not what was expected FASM BootLoader org 0x7c00

output is not what was expected FASM BootLoader org 0x7c00 use16 org 0x7c00 message db "Hello!" len equ $ - message BootLoader: cli xor ax, ax mov ds, ax mov ...
hitokiri's user avatar
0 votes
1 answer
28 views

What is the MSB of each seven segment in ARMv7 DE1-SoC in cpulator?

In the cpulator website, when i want to show a number on the seven segment displays, it tells me to change an specific memory location which i assume is connected to the displays. i can understand the ...
Emad Kheyroddin's user avatar
0 votes
0 answers
61 views

how to get contents of textbox in masm

I am trying to create a simple desktop application in masm, which swaps the text of two textboxes when a button is pressed. So far I have been able to create the application window, text entry boxes ...
ChinchBug's user avatar
0 votes
0 answers
50 views

How to create a socket on Apple Silicon (aarch64 macos) assembly

I'm trying to create a socket using aarch64 assembly on a Apple Silicon device, here's what I have so far. .equ SYS_write, 4 .equ SYS_exit, 0x80 .equ SYS_socket, 196 SOCK_ID: .byte 0 .text .global ...
Saurav Maheshkar's user avatar
1 vote
1 answer
53 views

Why am I getting this error in proteus: "Invalid opcode 0xFFFF at PC=0x0008"

I need to write assembly code for my ATmega8 microcontroller that will generate 12-bit triangular voltage with a frequency ranging from 10 Hz to 1 kHz. Additionally, the code should allow controlling ...
Макс Фокин's user avatar
1 vote
0 answers
37 views

Adding NOP instructions after branches and jumps for control hazards in a 5-stage RISC pipeline without hazard detection?

There is a RISCV (5 stages pipeline 32-bits) If we supose there is no hazard unit nor forwarding support, so I have to add nop instructions. If the branch policy is Branch never taken, so we have to ...
Claudio Rodriguez's user avatar
1 vote
0 answers
83 views

C to assembly issue , I do not know why my function is not working and I always get 0xFFFFFFFE 0x0000000C

I need to "translate " the function ChangeVector to assembly without using variables (I have to use for example push ebp..mov ebp, esp ... but my problem is that the original code works ...
Leah M's user avatar
  • 11
1 vote
1 answer
60 views

How to get a emu8086 program to output a result?

Here is my assignment: Write a program to divide two 8-bit numbers using successive subtraction method using 8086. Multiply this result with 7365. Display this result in Blue color on the output ...
Somisetti Sridhar's user avatar
0 votes
0 answers
63 views

is it possible to specify a register for a variable when programming in C targeting a MIPS processor?

I am programming in C, targeting MIPS and compiling with mips-linux-gnu-gcc (using Ubuntu). For debugging purposes, I wanted to place a local variable always inside a specific register, let's say $3. ...
Renan Pícoli's user avatar
0 votes
0 answers
63 views

double the number in the mips

The task is: "Modify the program shown in Figure 3-4. Ask the user to enter an integer value, then print the result of doubling that number. Use the add statement.", and this is the program ...
P.Bak's user avatar
  • 1
1 vote
1 answer
41 views

An assembly program that reads 4 integers, finds the smallest and calculates the sum

It reads the integers just fine and finds the smallest one just fine as well. However, it gives wrong results for sums > 9. I am trying to calculate the sum in BH as a decimal. However if I for ...
Zahra 's user avatar
  • 11
-2 votes
1 answer
35 views

My code is not leaving the cicle that starts at line 228 (called ciclo), it seems like hes not reading the mouse

; multi-segment executable file template. data segment ; add your data here! ; Escolhas inícias stringjogar db "JOGAR$",0 stringtop5 db "TOP 5$",0 ...
Just do it's user avatar
0 votes
0 answers
42 views

Understanding fcmovb instruction in x86

I'm not understanding why fcmovb st(0) st(4) is not acting the way I expect. afaiu it will set st0 = st4 if the CF flag is set. Before: gdb> i r eflags st0 st4 eflags 0x282 [ SF IF ] st0 0 (raw ...
bogardon's user avatar
  • 905
3 votes
1 answer
92 views

Kernel not executed, after being loaded

Issue Kernel seems to be loaded, by the bootloader, but no further execution. It seems like there is a problem either with the way I run the image with qemu or with the way the kernel is loaded. ...
Calin's user avatar
  • 33
1 vote
0 answers
32 views

How do i link only desired functions from static library?

I want to link only Print_String and Exit functions from this assembly GNU/as x64 library (that actually contains 20+ functions): .intel_syntax noprefix .section .text .global Exit Exit: #Exit ...
Bartek_0x00's user avatar

1
2 3 4 5
874