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
3
votes
2 answers

How to print a triangle of stars in assembly?

I need to get the following output: * ** *** **** ***** ****** ******* ******** ********* ********** So its 10 rows,and my stars will start at 1 and go to 10. Currently I am…
Papbad
  • 163
  • 2
  • 13
3
votes
1 answer

What does `000000q` mean?

I am studying x86_64 assembler (yasm) with this textbook. There I have met the following lines that define file access flags: O_RDONLY equ 000000q O_WRONLY equ 000001q O_RDWR equ 000002q The question is what do their…
LRDPRDX
  • 631
  • 1
  • 11
  • 23
3
votes
1 answer

yasm movsx, movsxd invalid size for operand 2

I am trying to assemble the code below using yasm. I have put 'here' comments where yasm reports the error "error: invalid size for operand 2". Why is this error happening ? segment .data a db 25 b dw 0xffff c dd 3456 d dq…
user4180854
3
votes
0 answers

Unexplained Segmentation Fault running to breakpoint in gdb in x86-64 yasm assembly

I'm learning x86-64 assembly on an Oracle Enterprise Linux 7.3 VM. I have a simple program that runs fine outside of gdb but gives a segmentation fault if I set a breakpoint and run the program to it. I've pared it down to a pretty small program but…
Bobby Durrett
  • 1,223
  • 12
  • 19
3
votes
1 answer

gdb behaves differently for symbols in the .bss, vs. symbols in .data

I recently started learning assembly language for the Intel x86-64 architecture using YASM. While solving one of the tasks suggested in a book (by Ray Seyfarth) I came to following problem: When I place some characters into a buffer in the .bss…
Bulat M.
  • 680
  • 9
  • 25
2
votes
1 answer

How can I change the terminal color in 64-bit Linux when using YASM assembly?

Im trying to change the colour of the terminal based on a number of 1 to 5 inputed by the user but it just doesnt work. Sorry i dont really understand assembly but need to do this for a project and cant understand what is wrong with it. Its only…
2
votes
1 answer

x86 Assembly: Segmentation Fault (Core dumped) while trying to reverse print array

In my code i'm trying to print an array in reverse. My two main ideas were to either use the stack and the LIFO property to do it or use a loop as index from 10 to 0 zero to access the elements in reverse. I went with the second one due to…
Ivan
  • 37
  • 8
2
votes
2 answers

YASM [symbol+$$] Effective Address is Too Complex in a flat binary

org 0x7c00 is the normal way to get correct absolute addresses in a flat binary, but I was curious about a different way which I expected to work. I tried using section boot vstart=0x7c00 align=1 to tell YASM the right memory address, with symbol in…
2
votes
1 answer

x86-64 assembly program linking fails with gcc

From seyfarth's book: segment .data a dw 175 b dw 4097 segment .text global main main: mov rax, [a] ; mov a (175)into rax add rax, [b] ; add b to rax xor …
SRK
  • 53
  • 4
2
votes
1 answer

Average of marks with bytes

I'm computing the average of 3 marks: g0 dw 70 g1 dw 100 g2 dw 65 with xor rax, rax xor rcx, rcx mov ax, [g0] inc rcx add ax, [g1] inc rcx add ax, [g2] inc rcx xor rdx, rdx idiv rcx The grades don't need to be words, because bytes…
J. Poe
  • 21
  • 1
2
votes
1 answer

Specify physical address for an ELF32 section in yasm?

I'm trying to use yasm to build a simple ELF program. However, I can't figure out how to get it to target the .TEXT section so that it's VMA address begins at 0x1000, rather than 0. I've tried using START and ORG directives, but these only appear to…
Earlz
  • 62,085
  • 98
  • 303
  • 499
2
votes
2 answers

Unable to make libtool incorporate yasm-created object files

I'm trying to get libtool and yasm to work together. yasm creates the correct .o files from my .asm sources, but I can't figure out how to get libtool to build the associated .lo and .dep files. It wants to build the shared library, incorporating…
2
votes
1 answer

Unresolved Reference when linking compiled code with NASM and MSVC

I'm trying to combine assembly (compiled with yasm) with objects compiled by msvc/cl.exe, which I'm trying to link (with link.exe) into a .dll, which is then linked to the final executable. Both creating the object files from source, and creating…
Leandros
  • 16,805
  • 9
  • 69
  • 108
2
votes
1 answer

yasm: Expected `,' with immediate value

Given the following assembly program: BITS 64 mov rax, 0b111 Yasm outputs: error: expected `,' Why does it expect a comma here? NASM happily assembles this.
Matthew Sainsbury
  • 1,470
  • 3
  • 18
  • 42
2
votes
1 answer

Understanding small asm code with a strange constant

I am working through the riddles of "xchg rax,rax" (xchg.xorpd.net). Those are riddles about x86_64 assembly, where you have to understand what code pieces do. This is riddle number 0x15: mov rdx,0xffffffff80000000 add rax,rdx xor …
dedthecool
  • 33
  • 2
1 2
3
11 12