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
1
vote
1 answer

How to tell tell the ./configure file where to take the dependencies from?

I want to install Libav locally in a folder and for that I have to install yasm (I can disable the dependency but I don't want to just for the sake of the argument). The installation of the package is done in the terminal via "./configure" and…
user10766540
1
vote
0 answers

amd64 MOV instruction not copying properly

There's something weird going on I don't understand. I have a data variable: variable_a dq 0 I check it's 0: (gdb) x variable_a 0x0: Cannot access memory at address 0x0 So far so good. I have rax: (gdb) i r rax 0x7fffffffe9e2 …
nemasu
  • 426
  • 2
  • 10
1
vote
1 answer

yasm multiple arbitrary inputs not working when redirecing inputs from a file

I am a student and I am struggling a bit with assembly. I have to make a basic calculator that can take in 2 64-bit arbitrary integers as input and a 8-bit char. From these inputs I need to use the char to determine what operation should take place.…
JustMeh
  • 13
  • 4
1
vote
2 answers

Confusion with comparing negative integers

I've begun to study assembly and I have some difficult with a sample program. I wrote a macro that would find the minimum in an array: %macro min 3 mov ecx, dword[%2] mov r12, 0 lea rbx, [%1] movsx eax, word[rbx+r12*4] ;…
DarkSkull
  • 1,041
  • 3
  • 13
  • 23
1
vote
1 answer

Skips one input every time after a jmp

So I have this code that is supposed to ask for 2 numbers and then make some operations with them, and after finishing one operation and outputting the answer, it should ask again for 2 numbers and an option until the user selects the option to…
1
vote
0 answers

Assembly, Reserving Space with resq in YASM

Using YASM I have tried to reserve space for 2000 quadwords, but when I do this I get a SIGSEGV when I try to write into the reserved block of quadwords. If I reserve space for only 300 quadwords, the program runs without error. What causes this? ;…
Patrick Clot
  • 111
  • 2
1
vote
1 answer

label or instruction expected at start of line YASM

I'm trying to build assembly YASM code that is supposed to calculate the distance between two points (A and B) on 2D plane. This the command that I'm using to build the code: yasm -f elf64 -g dwarf2 -l distance.lst distance.asm distance.asm:2:…
1
vote
0 answers

How to pass non-printable ASCII byte to STDIN file-descriptor in x86_64 assembler (yasm)

Problem Suppose I have a program in x86_64 assembler yasm (see below) that requests input from a user via SYS_read system service at some moment. This output is treated as byte-number further in the program. User easely could provide all numbers…
LRDPRDX
  • 631
  • 1
  • 11
  • 23
1
vote
1 answer

Signed multiplication followed by signed division in YASM (x86_64 architecture)

I am using yasm assembler for x86_64 processor architecture. Suppose I already have three numbers defined in the .data section: section .data ;CONSTANTS: SYSTEM_EXIT equ 60 SUCCESS_EXIT equ 0 ;VARIABLES: dVar1 dd 40400 wVar2 dw…
LRDPRDX
  • 631
  • 1
  • 11
  • 23
1
vote
0 answers

Using the brk system call on macOS, Yasm

I've been trying to find a way to use the brk system call in a Yasm program on macOS. I've looked in the syscall.inc file for that system call, but I couldn't find it there. Is there any alternative to brk on macOS?
nullbyte
  • 1,178
  • 8
  • 16
1
vote
0 answers

x86-64 assembly shell sort algorithm conversion

I have been working on this assembly program to sort a list of numbers, it seems like I am following the logic of the shell sort but when I run it continuously runs, therefore there is an issue in my sort any ideas where I am making a mistake? Im…
1
vote
0 answers

Declaring variables in Yasm

Here's is a simple program: %include 'utils/system.inc' section .data first: db 'First is bigger', 0xA,0 second: db 'Second is bigger', 0xA,0 a: db 18 b: db 20 section .text global start start: mov rax, [a wrt rip] mov rbx, [b…
nullbyte
  • 1,178
  • 8
  • 16
1
vote
0 answers

In yasm, define a string whose contents are equal to a macro argument value

Inside a macro, I'd like to declare a string whose value is equal to the textual value of a macro argument. For example, I want something like: %macro foo 1 ;; some other stuff that might use %1 unquoted db "%1",0 %endmacro foo bar Which after…
BeeOnRope
  • 60,350
  • 16
  • 207
  • 386
1
vote
0 answers

YASM: cannot apply 32 bit absolute relocations in 64 bit mode

The related code: 23 %define data rsi ... 33 34 extern g_4sha256_k 35 ... 239 240 movntdqa xmm6, [data+rax*4] 241 paddd xmm6, dword g_4sha256_k[rax*4] 242 add rax, 4 The yasm build…
gary
  • 1,569
  • 3
  • 20
  • 30
1
vote
1 answer

Why isn't gdb showing me the change in a BSS array when I calculate the address with the same expression as the addressing mode?

Wrote simple program with large buffer in .bss segment h_vals: resq 99999 then tried to increment value of some array cell. mov rcx, [h_vals+8*rax] inc rcx mov [h_vals+8*rax], rcx Still in gdb see the same value(0) both before and after third…
Bulat M.
  • 680
  • 9
  • 25