Category "assembly"

Custom bootloader booted via USB drive produces incorrect output on some computers

I am fairly new to assembly, but I'm trying to dive into the world of low level computing. I'm trying to learn how to write assembly code that would run as boot

Execute system command in x64 bit assembly?

I recently been trying to execute system commands using pure assembly. I managed to achieve it in a x32 bit binary as posted here: execute system command (bash)

How do you enter command line arguments in SPIM

I am trying to make programs using argc and argv in MIPS simulator SPIM. This is my code: .data nl: .asciiz "\n" .globl main .text main: # print argv[0] lw

Why does GCC include an "empty" XOR

I have following piece of code: typedef struct { int x; int y; int z; int w; } s32x4; s32x4 f() { s32x4 v; v.x

error in partition function (mips assembly)

This is the code I wrote trying to implement the c partition function in mips. There seems to be an error because the program doesn't work, yet I can't find whe

C++ - How to debug SIGILL ILL_ILLOPN

Recently I ran into a crash while the following statement is getting executed static const float kDefaultTolerance = DoubleToFloat(0.25); where DoubleToFloat

How to divide two unsigned long 64 bit values in x86 assembly and then returning the quotient and remainder to a C program

In a separate C program, I have passed 4 parameters to an x86 ASM program. dividend divisor Quotient pointer Remainder pointer dividend = 0xA divisor = 0x3 Whic

why is my assembly program (changing background color with keyboard) not working [duplicate]

I am writing a program in assembly that changes the background color from clicks on the keyboard but I can't seem to make it work, anyone know

What does it take for pacman to function correctly?

I'm experiencing 2 problems: the "you win" screen does not show up the pacman has a trail. IDEAL p286 MODEL small STACK 100h DATASEG pacman db " _ __ _

How to open a saved .asm file in MARS on MacOS

I am new to using MIPS and I can't find how to open a file that I saved. I saved a .asm file under my downloads folder but when I try to open a file in MARS and

"There is no need to deallocate the stack at the end of the function when the inner-stack frame isn't modified", but it is being modified in this case

Here is a simple function #include <stdio.h> int foo() { int a = 3; int b = 4; int c = 5; return a * b * c; } int main() { int a = f

How can I get the range of numbers that would produce certain flag conditions when subtracted from 43h in Z80 assembly?

I started learning Z80 recently, but I'm struggling with flags. I want to get the range of register "B" in Z80 assembly. This is the problem that I faced. Regis

What does this i386 os code mean? The code is for resetting the system

/* jump to reset vector. esp := 0 */ int main(int argc, char **argv) { PRINT("reset\n"); _eflags = 0; // interrupt disabled __asm__ __volatile__ ("\

Нow to define a constant managed record with an overridden assignment method

I'm writing a program for mathematical research. Assembly language is used for speed. Data is represented as managed records with operator overloads. Some data

LDUR and STUR in ARM v8

I've had a couple of courses that touched on ARMv8 assembly, but both teachers described LDUR/STUR instructions a different way and now I've become pretty lost.

adressing in MIPS the proper way

what does the following line mean. is it taking the 4 bytes (16 bits) of whatever bit pattern is at $a3 and storing it to $t0? lw $t0, 4($a3) # extract ch

Are there any instructions (other than those that use RIP-relative addressing) that are position dependent?

(This question refers specifically to x86/x86_64) I'm working on an application that needs to insert a small block of instructions at specific points within ano

Is a mov to a segmentation register slower than a mov to a general purpose register?

Specifically is: mov %eax, %ds Slower than mov %eax, %ebx Or are they the same speed. I've researched online, but have been unable to find a definitive an

Writing a putchar in Assembly for x86_64 with 64 bit Linux?

I am trying to use the write syscall in order to reproduce the putchar function behavior which prints a single character. My code is as follows, asm_putchar:

Understand EQU and >> operators on them in RISC-V assembly, with LUI and ADDI

my prof posted this as one of the answers to a homework problem. Can anyone break this down for me? I don't understand what he is doing with CON1 - CON4 and wha