Yasm is a modular assembler intended as a full rewrite of the Netwide Assembler (NASM). It is licensed under a revision of the BSD licenses.
Questions tagged [yasm]
149 questions
37
votes
6 answers
Find which assembly instruction caused an Illegal Instruction error without debugging
While running a program I've written in assembly, I get Illegal instruction error. Is there a way to know which instruction is causing the error, without debugging that is, because the machine I'm running on does not have a debugger or any…
![](../../users/profiles/1018562.webp)
pythonic
- 18,049
- 33
- 112
- 196
33
votes
4 answers
Basic use of immediates vs. square brackets in YASM/NASM x86 assembly
Suppose I have the following declared:
section .bss
buffer resb 1
And these instructions follow in section .text:
mov al, 5 ; mov-immediate
mov [buffer], al ; store
mov bl, [buffer] ;…
![](../../users/profiles/816695.webp)
InvalidBrainException
- 2,052
- 6
- 27
- 38
27
votes
2 answers
What are the sizes of tword, oword and yword operands?
What are the sizes of tword, oword and yword operands, as used in the NASM/YASM manual? And on a related note, is there a trick or underlying idea to these names? Is there a way by which bigger word sizes are given logical names?
I know that while…
![](../../users/profiles/146622.webp)
Daniel A.A. Pelsmaeker
- 40,431
- 19
- 96
- 149
23
votes
3 answers
How to generate a nasm compilable assembly code from c source code on Linux?
Test platform is 32 bit Linux.
Basically, I know gcc can be used to generate both Intel and At&T style
assembly code, but it seems that you can not directly use nasm/tasm to compile
the Intel style assembly code gcc generated.
I am conducting a…
![](../../users/profiles/1488533.webp)
lllllllllllll
- 6,731
- 6
- 28
- 67
10
votes
2 answers
Can't call C standard library function on 64-bit Linux from assembly (yasm) code
I have a function foo written in assembly and compiled with yasm and GCC on Linux (Ubuntu) 64-bit. It simply prints a message to stdout using puts(), here is how it looks:
bits 64
extern puts
global foo
section .data
message:
db 'foo() called',…
![](../../users/profiles/249230.webp)
szx
- 5,012
- 5
- 36
- 59
10
votes
5 answers
Cannot find yasm even though I have installed it
I got a strange problem. I tried to install x264. When run sudo ./configure --enable-shared,
it gave:
Found no assembler
Minimum version is yasm-0.7.0
If you really want to compile without asm, configure with --disable-asm.
But I already installed…
![](../../users/profiles/1201399.webp)
zhen lee
- 313
- 2
- 6
- 18
7
votes
2 answers
GDB shows error message when trying to print a variable in an Assembly program
While learning assembly language from a book there is a listing showing some basic operations:
segment .data
a dq 176
b dq 4097
segment .text
global _start
_start:
mov rax, [a] ; Move a into rax.
add rax, [b] ; add b o rax.
…
![](../../users/profiles/7830658.webp)
Anik Samiur Rahman
- 71
- 1
- 5
7
votes
1 answer
How can I use gdb to debug code assembled using yasm?
I've got code assembling using yasm, and linking into my C++ program, but I can't set breakpoints in gdb on symbols from the assembly language file.
The command lines probably aren't terribly illuminating, but here we go:
"g++" -ftemplate-depth-128…
![](../../users/profiles/1618406.webp)
Tom Seddon
- 2,336
- 15
- 24
7
votes
2 answers
make: Circular dependency dropped
I've already searched a long time on stackoverflow and other make manuals, websites but cannot find any trailing whitespace or miss usage in make functions. Can you help me solve this warning message ?
make: Circular main.asm.o <- main.asm…
![](../../users/profiles/2490210.webp)
Amaury Brisou
- 145
- 1
- 3
- 7
6
votes
2 answers
Assembly: Why does jumping to a label that returns via ret cause a segmentation fault?
Linux Assembly Tutorial states:
there is one very important thing to remember: If you are planning to return from a procedure (with the RET instruction), don't jump to it! As in "never!" Doing that will cause a segmentation fault on Linux (which is…
![](../../users/profiles/816695.webp)
InvalidBrainException
- 2,052
- 6
- 27
- 38
6
votes
2 answers
Minimal opcode size x86-64 strlen implementation
I'm investigating a minimal opcode size x86-64 strlen implementation for my code golfing / binary executable that is not supposed to exceed some size (think of demoscene for simplicity).
General idea comes from here, size optimization ideas from…
![](../../users/profiles/5329717.webp)
Kamil.S
- 4,364
- 2
- 14
- 40
5
votes
1 answer
Polygot include file for nasm/yasm and C
I have a bunch of magic numbers that I would like to include in both a C program and an assembly file to be compiled by nasm or yasm.
In plain C the file would look something a series of defines, like:
#define BLESS 55378008
#define ANSWER …
![](../../users/profiles/149138.webp)
BeeOnRope
- 51,419
- 13
- 149
- 309
5
votes
1 answer
how to call code written in C from assembly?
SOLVED QUESTION
Should made main symbol global, so that linker could find it in object file when linking. Corrected code.
When doing task, tried to call simple C function from the assembly(YASM assembler):
Wrote C function:
#include…
![](../../users/profiles/6772989.webp)
Bulat M.
- 638
- 6
- 21
5
votes
2 answers
The effect of code alignment in timing main loops in assembly
Let's say I have the following main loop
.L2:
vmulps ymm1, ymm2, [rdi+rax]
vaddps ymm1, ymm1, [rsi+rax]
vmovaps [rdx+rax], ymm1
add rax, 32
jne .L2
The way I would time this is…
![](../../users/profiles/2542702.webp)
Z boson
- 29,230
- 10
- 105
- 195
5
votes
2 answers
Simple asm program with yasm in MacOS Mountain Lion
I want to compile and execute a very simple program in 64 bit.
section .text
global _start
_start:
mov rdx,len
mov rcx,msg
mov rbx,1
mov rax,4
int 0x80
mov rbx,0
mov rax,1
int 0x80…
![](../../users/profiles/189992.webp)
ssedano
- 7,943
- 8
- 56
- 95