All Questions
4,466
questions
0
votes
0
answers
40
views
Why is my array value not equal to a literal?
I am new to assembly and was trying to work with an array. However, I was geting caught when try to compare the array value to a constant stored in a register.
From the following code I was expecting ...
2
votes
0
answers
55
views
NASM ORG doesn't like SECTION [closed]
Looks like NASM ORG directive doesn't behave correctly in the presence of SECTION directive, in spite that it's compiled to the binary format. I wonder if there's an alternative for ORG in NASM which ...
1
vote
0
answers
32
views
Unable to compile NASM without -no_pie on macOS
I'm trying to follow the tutorial for NASM and I made a few adjustments (like changing the entrypoint function from "start" to "_main") to get the following hello.asm to compile ...
0
votes
1
answer
30
views
Order in which instructions are printed/executed
Why the output is in diffrent order than it is declared?
Shouldnt the output be in this order?
aaaa
bbbb
cccc
Instead it is:
I assume the issue is in assigning "bbb" value to the text ...
-1
votes
0
answers
25
views
Writing x64 nasm assembly for windows [duplicate]
I would like to learn how to write x64 nasm assembly for windows but I can't find any resources for that.
And also how to compile the assembly into executable program.
So if anyone knows of a ...
1
vote
0
answers
64
views
How to Fix IMUL and DIV Errors in Assembly Calculator Code?
I'm currently learning assembly language and trying to write a simple calculator program. The program is supposed to read two numbers and an operator (+, -, *, /) from stdin, perform the specified ...
-2
votes
0
answers
33
views
objcopy says one of input files was not recognized as a valid object file
Im trying to objcopy two files together but its just not working...
I tried the following:
objcopy -I bootloader.bin extendedprogram.bin -O bootloader.flp
The result was:
llvm-objcopy: error: '...
3
votes
1
answer
63
views
How to get NASM to encode `push` with a sign-extended 16-bit immediate?
When assembling the following with NASM:
BITS 64
push 32767
I get 68 ff 7f 00 00. This is interesting to me, since this is the 32b encoding (push dword). Any ideas why it doesn't resort to the 16b ...
0
votes
1
answer
36
views
x86 NASM Crash - Iterate over string
How to iterate over individual characters of a string in x86 assembly and print them?
global _main ; declare _main entry point
extern _printf ; extern method
section ....
2
votes
0
answers
45
views
(x86_64 NASM) Why is my program returning 0 instead of 256? [duplicate]
This is my first assembly code:
;program name - first.asm
section .data ;stores initialised var
section .bss ;stores uninit var
section .text ;actual code
global _start
_start:
mov eax,1
mov ...
0
votes
0
answers
100
views
Linux Assembler bss data is overlapping?
I have the following 2 modules that have overlapping address's
You can see that n_Companies extends into savedRegisters causing untold problems.
Can anyone shed some light on this for me ?
MODULE=...
0
votes
0
answers
49
views
printf in assembly NASM x86 print only once of the array in the loop
Calling printf function inside my x86 code, outputs only the first number in the array and stops working even if I remove the call exit. It prints out the first element in the array infinity
extern ...
2
votes
0
answers
71
views
Can NASM be forced to generate mov with offset of 0?
My question
I have tried using NASM's strict keyword and -O0 to inhibit it from turning mov dword [rdi+0], 0xab into mov dword [rdi], 0xab, but haven't been successful. My hunch is that the +0 gets ...
1
vote
1
answer
80
views
In x86_64 Linux NASM, is it possible to have multiple opcodes on one line?
In C, you are able to have multiple things on one line, like this:
int a; int b = 1; a = b;
Could you do this in assembly?
I tried searching for this on many websites and asked for help on some ...
0
votes
0
answers
38
views
ld return some error when link some object file with other
I use nasm to compile this assembly code and link it with some other output file 'i686-elf':
global x86_Video_GetVbeInfo
x86_Video_GetVbeInfo:
; make new call frame
push ebp ; ...