I’m very new to assembly and having difficulties in getting basic calculations to work with different length numbers. So this is my adding code, that works with numbers that are 3 or less characters long. for as long as both are the same length. for example 123 + 123 works just fine and outputs 246. But 12 + 123 does
Tag: nasm
How to make a custom section executable (other than .text)
Basic Hello World as seen many times before on x86_64 Linux: My current ld linker script: Invoked with: I’m currently getting a segfault. Inspecting the output of readelf -a I can see that my_section does not have executable permissions. I believe this is causing the segfault. If I replace it with .text : { *(.my_section*) } > rom it still
get a char passed as parameter
I would like to write a function in NASM System V ABI x86-64 (Intel Syntax) that I could use in a C program. Here is the prototype of the function: I therefore retrieve the parameters in order (const char *s = rdi, int c = rsi) First, I get the character stored in the register rsi and put it in
Clear input buffer Assembly x86 (NASM)
Edit: This is similar to this: Reset a string variable to print multitple user inputs in a loop (NASM Assembly). But it is not the same issue. From the other post, I was able to prevent additional characters from being printed. However, I still cannot prevent those additional characters from being read when the program goes back to the point
x86 NASM | Input in Loop working only the first and third time
I have a loop that runs succesfully 3 times, but the input I have in this loop works only the first time. I am new to assembly so pls have patience. Code: Output: Well, later I thought that the loop might not running a third time, so I changed the code a bit. New Code: New Output: Explaination: 0 is
C sockets
The following C program calls select() to get a list of client sockets that have data in the socket buffer (using UNIX domain datagram sockets). It takes four parameters on call from a NASM program. The parameter fds_array[] is a 3-element integer array created in NASM and passed into the program. The data are passed in from NASM in rdi,
Loop Never Ends in Assembly?
Basically, I have below assembly code: I am trying to loop through 0-50 and print the variable pas or probably buf from input box. But this loop keeps printing pas endlessly. I Presume the issue is the re-assignment of ecx, but otherwise without putting my string into ecx how would I print it? or even execute any thing within my
SYS_READ call only works once, seemingly skips over code when ran again
I’m trying to rewrite a little text game in assembly for fun, and I noticed that I’m only able to run the following code successfully once. If I run it again elsewhere, it will seemingly skip over the code. I am compiling using the following command: nasm -f elf64 -o test.o textgame.s && ld -o test test.o && ./test Full
Calling printf() in assembly causes a ‘floating point exception’
I have the following code: I compile it with nasm -f elf64 1.asm and link it using ld -dynamic-linker /lib/ld-linux-x86-64.so.2 1.o -o 1 -lc. When I execute the binary, I get printf() doesn’t always fail when I call it in assembly code. Removing printf() calls from printax and printbx gives me Update: The exception also disappears if I remove the
How to link C language libraries?
I am interested in executing a function which is written in C language:- I want to call this fun() through assembly language which i have written:- (NASM 64bit) I have created object file by using these commands nasm -f elf64 MyAsm.asm and gcc -c CLang.c. When I merge these two file with gcc gcc MyASM.o CLang.o i get an error