Questions tagged [yasm]

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.

172 questions
42
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…
pythonic
  • 20,589
  • 43
  • 136
  • 219
40
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…
Daniel A.A. Pelsmaeker
  • 47,471
  • 20
  • 111
  • 157
36
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] ;…
InvalidBrainException
  • 2,312
  • 8
  • 32
  • 41
26
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…
lllllllllllll
  • 8,519
  • 9
  • 45
  • 80
15
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',…
szx
  • 6,433
  • 6
  • 46
  • 67
11
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. …
Anik Samiur Rahman
  • 111
  • 1
  • 1
  • 6
11
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…
Amaury Brisou
  • 344
  • 1
  • 4
  • 10
11
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…
zhen lee
  • 333
  • 2
  • 6
  • 18
7
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…
Kamil.S
  • 5,205
  • 2
  • 22
  • 51
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…
Tom Seddon
  • 2,648
  • 1
  • 19
  • 28
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…
InvalidBrainException
  • 2,312
  • 8
  • 32
  • 41
6
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 …
BeeOnRope
  • 60,350
  • 16
  • 207
  • 386
6
votes
1 answer

Gnu assembler gives unexpected memory operand

The GNU assembler gives an unexpected memory operand when assembling Intel syntax code. I have reduced my bug to one single lonely line of code, and for the last three days I've tried anything to understand why the GNU assembler yields something…
HJLebbink
  • 719
  • 1
  • 11
  • 32
5
votes
2 answers

Why in NASM do we have to use square brackets ([ ]) to MOV to memory location?

For example if I have a variable named test declared like: test db 0x01 ;suppose the address is 0x00000052 If I do something like: mov rax, test ;rax = 0x00000052 mov rax, [test] ;rax = 0x01 But, when I try to save in it, if we're…
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…
Bulat M.
  • 680
  • 9
  • 25
1
2 3
11 12