https://github.com/helyousfi/nasm
https://github.com/helyousfi/nasm
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/helyousfi/nasm
- Owner: helyousfi
- Created: 2024-09-29T15:32:49.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-03T15:25:29.000Z (about 1 year ago)
- Last Synced: 2025-02-26T20:37:17.419Z (7 months ago)
- Language: Assembly
- Size: 48.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# 86 Architecture
## BIOS
- BIOS is firmware embedded on a motherboard that initializes hardware components and prepares the system for booting an operating system.
- A bootloader is a small program that loads the operating system into memory when the computer starts up.

# Registers

## EIP
EIP (Extended Instruction Pointer) is a 32-bit register in the x86 architecture.
It holds the memory address of the next instruction that the CPU will execute.
## FSM
The FSM (Flag Status Register) in x86 architecture is a special register that contains flags indicating the status of the CPU after an arithmetic or logical operation.
## The main internal bus
The main internal bus in a computer system refers to the set of pathways (wires) used to transfer data, addresses, and control signals between the CPU, memory, and other peripherals.
# Special Purpose Registers
# Assemble the program
nasm -f elf32 hello.asm -o hello.o
# Link the object files
ld -m elf_i386 -s -o hello hello.o## 1. nasm -f elf32 hello.asm -o hello.o
- nasm: Assembler for x86 assembly language.
- -f elf32: Specifies the output format. elf32 indicates a 32-bit ELF (Executable and Linkable Format) object file. Since hello.asm is likely a 32-bit assembly program, the elf32 format is appropriate.
In short, this command assembles the hello.asm file into an object file hello.o using the 32-bit ELF format.
## 2. ld -m elf_i386 -o hello hello.old: The linker command. It links the object files produced by the assembler into an executable file.
-m elf_i386: Specifies the target format for the linker. elf_i386 tells ld to create a 32-bit ELF executable for the i386 architecture.
-o hello: Specifies the name of the final output executable file. In this case, the executable will be named hello.
hello.o: The input object file that was produced in the previous step (hello.o). This file contains the machine code generated from hello.asm.
# Syscalls

# Standard File Descriptors:
# Resources
https://www.linuxjournal.com/article/4048
https://www.youtube.com/watch?v=busHtSyx2-w&list=PLetF-YjXm-sCH6FrTz4AQhfH6INDQvQSn&index=3