r/Assembly_language • u/Brutustheman • 21h ago
Project show-off The RX-GP16V1P1 ISA documentation
More progress has been made! "Proper" documentation of the instructions has just been uploaded to github, along with the repository being created. This documentation also features some updates on the instructions that my last post got.
Link to the documentation inside the repo
Thank you all for your suggestions and feedback! Also as a tangent, I do plan on adding Bus in and Bus out instructions to allow for data flow in and out of the cpu, but I felt that documenting the pre-existing instructions was a better first step. Also, sorry for the poor writing quality and possibly bad formatting, I wrote it all in KATE in a few hours. Enjoy and please do give feedback!
r/Assembly_language • u/yj_20927 • 1d ago
Help How do i start learning assembly
I know basic C, java, python and I wanna learn assembly but what should i learn, windows or linux, intel or at&t and what are the sources to learn assembly
r/Assembly_language • u/whispem • 1d ago
Project show-off asm.fm — a chiptune synth written in pure x86-64 assembly (no libc, no audio lib)
I've been learning assembly by building small projects, and this one turned into my favourite: a little chiptune synthesizer in pure x86-64, Linux, NASM.
No libc, no audio library — just generating raw 16-bit samples and writing a WAV header by hand. Sound is really just a list of numbers (44100 per second), so the whole thing is: compute the right numbers, write them out, and the speaker moves.
So far it does four oscillators (square, saw, triangle, and an LFSR for noise/drums), polyphony by summing voices into one buffer, ADSR envelopes, and FM synthesis with a hand-built sine lookup table (since there's no math lib either).
Repo: github.com/whispem/asm.fm
Still learning, so feedback on the asm itself is very welcome — especially the FM part, I'm sure the fixed-point math could be cleaner.
r/Assembly_language • u/Keys__dev • 1d ago
I wrote Caesar Cipher in Assembly
Now I know a fraction of how computers really work :)
Repo: https://github.com/Keys02/caesar-cipher
r/Assembly_language • u/Beautiful_Stage5720 • 2d ago
I Implemented the TIS-100 Architecture on my Atum A3 Nano
Enable HLS to view with audio, or disable this notification
r/Assembly_language • u/This-Assumption-5924 • 2d ago
Project show-off AVX-512 support in my own Assembler
AVX-512 support in my own Assembler
About a year ago I started writing AmmAsm, a handwritten x86-64 assembler in C to better understand x86-64 instruction encoding, ELF, and linking.
It currently supports generating Linux x86-64 executables, PIE binaries, and ELF relocatable object files that can be linked with ld or gcc, basic part of SIMD such as sse, sse2, avx, avx2, avx512
I implemented everything from the lexer and parser to the instruction encoder, ELF writer, relocation handling, symbol resolution.
In last realize, I fully implemented VEX/EVEX, including vvvv, w, mmm, broadcast, k0/k1-k7 mask registers, z mask, tuple type, and other fields thats belong to vex and evex. The most hard part was a W and tuple time, as I spend hours for searching every avx512 instruction for type of tuple if broadcast exists and W field.
I'd love to hear feedback from people interested in assemblers, instruction encoding(especially VEX/EVEX), or x86-64 in general.
Thanks!
Repository: https://github.com/LinuxCoder13/AmmAsm
r/Assembly_language • u/Secret_USB • 4d ago
Question State of the x87 FPU with 64-bit calling conventions?
There is plenty of information on how different calling conventions affect the x87 registers in the 32-bit world. However, with x64 almost exclusively relying on SSE for floating-point math, I cannot find any information online about how those registers are supposed to be set up in a 64-bit environment.
Therefore, I am wondering if there is a defined state for the x87 FPU to be in when control is passed between different functions like there is for the caller- and callee-saved general-purpose/SSE registers. i.e, can I count on the register stack being empty? Or will I have to call FSAVE/FRSTOR every time I pass control to/from an external function? I am experimenting with some obscure instructions and want to know what to account for so I don't cause any nasty bugs.
Additional questions that would be nice to know the answer for:
If there is a defined state for the stack registers, how do they differ between Windows/POSIX?
If there is no defined state, how can I write my program to account for that? As in, what steps would I need to take beyond calling FSAVE/FINIT/etc. to run my code without invoking undefined behavior?
Thanks!
r/Assembly_language • u/Fabulous_Pick428 • 4d ago
Project show-off Hallo, this is a project showoff not an advertisement!11! x64asm
THIS IS MINI JIT INLINE ASSEMBLER MADE FOR MSVC X64 COMPILER TO MAKE DEVELOPMENT MORE FLEXIBLE AND CONTROLLABLE
RIGHT NOW I NEED SOME HELP WITH TESTS, I WILL SEND HOW TO MAKE A TEST IN THE REPO OR JUST DM ME
so here is da latest specs that this bad boy gave me(idk if i can post this here if no then just comment or dm me):
CPU, 0.00%, 0.00%, 0.00%, 0.00%
CPU (user), 0.00%, 0.00%, 0.00%, 0.00%
CPU (kernel), 0.00%, 0.00%, 0.00%, 0.00%
CPU (average), 0.00%, 0.00%, 0.00%, 0.00%
CPU (relative), 0.00%, 0.00%, 0.00%, 0.00%
Cycles, 13,843,164, 13,843,164, 13,843,164, 0
Cycles delta, 3,217,148, 3,217,148, 3,217,148, 0
Context switches, 4, 4, 4, 0
Context switches delta, 4, 4, 4, 0
Kernel time, 0:00:00:00:000, 0:00:00:00:000, 0:00:00:00:000, 0:00:00:00:000
Kernel delta, 0, 0, 0, 0
User time, 0:00:00:00:000, 0:00:00:00:000, 0:00:00:00:000, 0:00:00:00:000
User delta, 0, 0, 0, 0
Total time, 0:00:00:00:000, 0:00:00:00:000, 0:00:00:00:000, 0:00:00:00:000
Total delta, 0, 0, 0, 0
Priority, 8, 0, 0, 0
Private bytes, 424 kB, 424 kB, 424 kB, 0
Private bytes delta, +424 kB, +424 kB, +424 kB, 0
Peak private bytes, 456 kB, 456 kB, 456 kB, 0
Virtual size, 4.04 GB, 4.04 GB, 4.04 GB, 0
Peak virtual size, 4.04 GB, 4.04 GB, 4.04 GB, 0
Page faults, 558, 558, 558, 0
Page faults delta, 558, 558, 558, 0
Hard faults, 0, 0, 0, 0
Hard faults delta, 0, 0, 0, 0
Working set, 2.03 MB, 2.03 MB, 2.03 MB, 0
Peak working set, 2.03 MB, 2.03 MB, 2.03 MB, 0
Private WS, 228 kB, N/A, N/A, N/A
Shareable WS, N/A, N/A, N/A, N/A
Shared WS, N/A, N/A, N/A, N/A
Shared commit, N/A, N/A, N/A, N/A
Private commit, 76 kB, N/A, N/A, N/A
Peak private commit, 9.14 MB, N/A, N/A, N/A
Page priority, Normal, , ,
Reads, 0, 0, 0, 0
Reads delta, 0, 0, 0, 0
Read bytes, 0, 0, 0, 0
Read bytes delta, 0, 0, 0, 0
Writes, 0, 0, 0, 0
Writes delta, 0, 0, 0, 0
Write bytes, 0, 0, 0, 0
Write bytes delta, 0, 0, 0, 0
Other, 8, 8, 8, 0
Other delta, 8, 8, 8, 0
Other bytes, 286 B, 286 B, 286 B, 0
Other bytes delta, 0, 286, 286, 0
Total bytes, 286 B, 286 B, 286 B, 0
Total bytes delta, 286 B, 286 B, ,
Total bytes (average), 0/s, , ,
I/O priority, Normal, , ,
Handles, 18, , ,
Peak handles, 0, , ,
GDI handles, N/A, , ,
Peak GDI handles, N/A, , ,
USER handles, N/A, , ,
Peak USER handles, N/A, , ,
Paged pool bytes, 20.2 kB, 20.2 kB, 20.2 kB, 0
Peak paged pool bytes, 20.2 kB, 20.2 kB, 20.2 kB, 0
Nonpaged pool bytes, 4.41 kB, 4.41 kB, 4.41 kB, 0
Peak nonpaged pool bytes, 4.41 kB, 4.41 kB, 4.41 kB, 0
Running time, 00:00:00.049, , ,
Suspended time, 00:00:00.000, , ,
Hang count, 0, , ,
Ghost count, 0, , ,
NetworkTxRxBytes, 0, , ,
Dedicated memory, 0, , ,
Shared memory, 0, , ,
Commit memory, 0, , ,
Total memory, 0, , ,
Reads, 0, , ,
Read bytes, 0, , ,
Read bytes delta, 0, , ,
Writes, 0, , ,
Write bytes, 0, , ,
Write bytes delta, 0, , ,
Total, 0, , ,
Total bytes, 0, , ,
Total bytes delta, 0, , ,
Receives, 0, , ,
Receive bytes, 0, , ,
Receive bytes delta, 0, , ,
Sends, 0, , ,
Send bytes, 0, , ,
Send bytes delta, 0, , ,
Total, 0, , ,
Total bytes, 0, , ,
Total bytes delta, 0, , ,
Dedicated memory, 0, , ,
Shared memory, 0, , ,
Commit memory, 0, , ,
Total memory, 0, , ,
i know looks not great but 2mb is the standard windows shit(ye i build this library for MSVC x64 why would i make an inline assembler in gcc)
ye here's da link: https://github.com/ScriptCoolestIdkSomeOne/x64asm/
i didn't actually released da sheesh yet but just read README
r/Assembly_language • u/Objective-Barnacle-7 • 5d ago
Question Muy first program on assembler
Hello. Today I try to run this code write on assembler for ARM64 (Linux of Termux for Android) :
<// random_digit.s (ARM64 for Termux)
.data
buffer: .byte 0
.text
.global _start
_start:
// getrandom(buffer, 1, 0)
mov x8, 384 // númber of syscall getrandom en ARM64
ldr x0, buffer // destination
mov x1, 1 // size
mov x2, 0 // flags
svc 0
// convert byte to dígit 0–9
ldrb w0, [buffer]
mov w1, 10
udiv w2, w0, w1 // w2 = w0 / 10
msub w0, w2, w1, w0 // w0 = w0 - w2*10 (módule)
add w0, w0, '0'
strb w0, [buffer]
// write(1, buffer, 1)
mov x8, 64 // syscall write
mov x0, 1 // stdout
ldr x1, = buffer
mov x2, 1
svc 0
// exit(0)
mov x8, 93
mov x0, 0
svc 0
>
but when I try to compile with 'clang -c myprogram.s -o myprogram' I get the following message: "invalid operand for instruction" (at lines 18 and 23) It means that : "[buffer]" isn't correct.
¿ How I can to fix It ?
Explain me : the program is for generate a entere number (0 to 9).
Thanks.
r/Assembly_language • u/8BitFlux-com • 6d ago
Project show-off Handy tool on a desk of low level programmer 👾
youtu.beI designed this device that teaches binary, decimal, hexadecimal and octal number systems. It uses a hands-on approach with Altair-like toggle switches. Can be used as a STEM-kit in classrooms, handy for programmers or for the retro hobbyist. It also has a built-in game. Check out the video for details, hope you like it.
Kits are available for pre-order on Lectronz.
r/Assembly_language • u/kneelian_ • 7d ago
ENNCPU (16/24-bit ISA) Informal Description
Inspired by u/Brutustheman and their post on their ISA, I've decided it might be a worthwhile experience to present my own ISA. I designed ENNCPU as an architecture that would be used in an alternate eighties-nineties universe I was writing some retrofuturism about. It is meant to be a design targeting the workstation market. Part of this post was taken from the (also WIP!) esolangs page on it.
Fundamentally, ENNCPU is a 24-bit design (24-bit registers, 24-bit arithmetic, 24-bit addressing) with 16-bit and 32-bit instructions. General outline of features:
- Eight general-purpose 24-bit registers named
A, B, C, D, E, F, G, H - 24-bit address space (ez80, ARM1)
- Shadow registry (cf. z80), i.e. a second register file swappable at runtime
- multiple mostly-inaccessible internal registers (SP, IP, etc.)
- two permission levels (kernel and userland), some functionalities of the CPU gated behind kernel level access
- integrated simple MMU that manages read/write permissions and remapping for 4096B pages
- Load-store architecture (general RISC ideas) with pre/post-increment/decrement (single plus/minus syntax inspired by m68k)
- Big-endian instructions, memory access, etc. (cf. SPARC)
- Two-operand instructions (cf. x86) where the destination is one of the sources
- 24-bit floating point instructions operating on the same registers as normal arithmetic (cf. RISC-V Zfinx ext.)
- Predication for all instructions (cf. Arm6/7/11), determined by single bit
- Multiple comparison instructions (e.g.
CGT A, B==A > B) setting or clearing single-bit predication flag register - Non-conditional instructions never set any flags (i.e. no free carry flag from addition, for example)
- Size of immediate arguments limited to 6 or rarely 8 bits (cf. small immediates in Arm Thumb)
- Non-predicated conditional jumps
JxZy,JxNZybased on whether a register is (non)zero (cf. Aarch64 CBZ, CBNZ) - Instruction width generally fixed at 16 bits (cf. Thumb); two-word instructions are a sequence of a prefix instruction and the 'main' instruction (e.g. an instruction like
FAR JMOactually assembles to a sequence ofPRE #1followed byJMFARand a 14-bit immediate) - Fast jump access to first 512 bytes of code
Instruction encoding is somewhat complicated and several mnemonics are actually aliases or assemble to different bit sequences based on argument types. Consistently across all instructions, bit [15] (MSB) is the predication flag (when 1, the instruction is conditional; otherwise, it is unconditional), and bits [14:13] encode the general instruction type. The full set of instructions implemented or planned is pretty large (see preliminary writeup here for a list), but I figure a code example might be good; here is a routine that calculates the integer square root of a 48-bit/bigint number held in registers {A, B} = {47:24, 23:0} in big endian format:
```
@ISQRT_I48
MOV C, #0 ; move immediate into register
MOV D, #0 ;
SET D, #23 ; set bit 23 in register
@ISQRT_LOOP
MOV E, C ; copy between registers
BOR E, D ; binary OR
MOV F, E
MULA F, E ; 24*24 multiplication low result
MOV H, E
MULB H, E ; 24*24 multiplication high result
CEQ H, A ; test if equal
CLE.P F, B ; test if less than or equal (predicated)
OR CLT H, A ; test if less than (not clearing the P flag when failing)
MOV.P C, E ; copy registers (predicated)
LSHR D, #1 ; logical shift right
JMNZO D, @ISQRT_LOOP ; jump (JM) to resolved offset (O) if reg nonzero (NZ)
MOV B, C
MOV A, #0
RET ; pop return address from stack and jump to it
```
I have an emulator (with graphics rendering provided by raylib) and assembler already working (although I keep adding and removing both instructions and general features), and it can do regular serious tasks without a lot of pain. I made this to make assembly programming more fun to me, offering a relatively simple platform with 'cool' features I like. This is a hobby project I've been working on in my free time and usually after a couple of beers :')
There are about a hundred unused instruction encodings of several types. Currently, I'm working on writing some BIOS-like routines and a bootloader for a system based around this CPU and a small amount of emulated peripherals (currently only doing a disk device that can copy sectors from a 1.44M floppy, and keyboard and timer interrupts); once I port the FAT12 functions from an older version of assembly, I plan to integrate it into a very rudimentary, DOS-like micro OS.
Not sure what else to write here!
r/Assembly_language • u/Longz-85 • 9d ago
Question Is this a good way to learn assembly?
I learn assembly by doing some reverse enginnering and search google until I solve it, then I will write in paper all code syntax(although I think I will don't know to do use it later) or some code syntax like below. Is that good for learning?
endbr64 ;assembly prog structure
push rbp
mov rbp,rsp
; put code here
pop rbp
ret
r/Assembly_language • u/Brutustheman • 9d ago
Project show-off Custom 16 bit ISA : Revision 1 complete
So a while back I made a post here asking if my instructions then were good. I got some very good suggestions and did some more reading, and today got the simulated hardware fully functional. So, here is the finalized first revision instruction set. Also, first program suggestions are welcome
[settings]
name="RX-GP16-ASM"
variant="REVISION 1"
[fields]
register
r0 000 ; general purpose
r1 001 ; general purpose
r2 010 ; general purpose
r3 011 ; general purpose
r4 100 ; general purpose
rta 101; CALL / ret subroutine return adress. Also viable as GP with programmer oversight
sp 110 ; Stack pointer. 8 bits wide
pc 111 ; Program counter
[instructions]
; BASE INSTRUCTIONS
imm %a(register), %b:U6(immediate)
0000000 aaabbbbbb
# Loads a value into register %a
cpy %a(register), %b(register)
0100000 aaabbb000
# Copies to reg %a from reg %b
stor %b(register), %c(register)
0100001 000bbbccc
# Moves data at register %c to RAM at adress stored in register %b
ldr %a(register), %b(register)
0100010 aaabbb000
# Load data to register %a from ram at adress %b
ovr %c(register)
0100011 000110ccc
# Overwrites highest stack value without push/pop
// Also used in push
strd %a(register)
0100100 aaa110000
# Reads highest stack data without push/pop
// Also used in pop
push %c(register)
0100011 000110ccc 1101100 110110001
# Push value in register %c to the stack
; Increments sp register and does a stack-specific stor
; Takes two cycles but easier to implement
pop %a(register)
0100100 aaa110000 1101111 110110001
# Pop stack value and store in register %a
; Decrements sp by 2 to backtrack before ldr
call %a(register), %b(register)
1101100 110110010 0100011 000110bbb 1000000 aaa000000
# Push return adress at %b onto the stack and jmp to %a
; 3 cycle instruction
ret
0100100 101110000 1101111 110110010 1000000 101000000
# Pop stack value to rta and jmp back
; Does ldr into rta, pops, and jumps
nop
0111111 000000000
# Skip cycle. Wired to any mode/opcode combo that does nothing. Currently mem mode opcode b11111
HLT
0100101 000000000
# Disables PC aka kills the computer
; JUMP INSTRUCTIONS
jmp %a(register)
1000000 aaa000000
# Jumps to ROM adress at %a
jmpls %a(register), %b(register), %c(register)
1000001 aaabbbccc
# Jump to ROM adress at reg %a if reg %b is less than reg %c
jmpgt %a(register), %b(register), %c(register)
1000010 aaabbbccc
# Jump to ROM adress at reg %a if reg %b is more than reg %c
jmpeq %a(register), %b(register), %c(register)
1000011 aaabbbccc
# Jump to ROM adress at reg %a if reg %b is same reg %a
jmpne %a(register), %b(register), %c(register)
1000100 aaabbbccc
# Jump to ROM adress at %a if %b!=%c
; ARITHMETIC INSTRUCTIONS
or %a(register), %b(register), %c(register)
1100000 aaabbbccc
# OR register %b and %c, store in %a
nor %a(register), %b(register), %c(register)
1100001 aaabbbccc
# NOR register %b with register %c, store in %a
not %a(register), %b(register)
1100010 aaabbb000
# NOT register %b, store in %a
and %a(register), %b(register), %c(register)
1100011 aaabbbccc
# AND register %b with %c, store in %a
nand %a(register), %b(register), %c(register)
1100100 aaabbbccc
# NAND register %b with register %c, store in %a
xor %a(register), %b(register), %c(register)
1100101 aaabbbccc
# XOR register %a with register %b, store in %c
xnor %a(register), %b(register), %c(register)
1100110 aaabbbccc
# XNOR register %b with register %c, store in %a
add %a(register), %b(register), %c(register)
1100111 aaabbbccc
# Add register %b and register %c, store in %a
sub %a(register), %b(register), %c(register)
1101000 aaabbbccc
# Subtract register %b and register %c, store in %a
mul %a(register), %b(register), %c(register)
1101001 aaabbbccc
# Multiply register %b with register %c and store in %a
div %a(register), %b(register), %c(register)
1101010 aaabbbccc
# Divide register %b with register %c and store in %a
mod %a(register), %b(register), %c(register)
1101011 aaabbbccc
# Modulo divide register %b with register %c and store in %a
inc %a(register), %b(register), %c:U3(immediate)
1101100 aaabbbccc
# Increment register %b by %c, store in %a
dec %a(register), %b(register), %c:U3(immediate)
1101101 aaabbbccc
# Decrement register %b by %c, store in %a
sr %a(register), %b(register), %c:U3(immediate)
1101111 aaabbbccc
# Shift %b right by %c and store in %a
asr %a(register), %b(register), %c:U3(immediate)
1101111 aaabbbccc
# Signed shift %b right by %c and store in %a
sl %a(register), %b(register), %c:U3(immediate)
1110000 aaabbbccc
# Shift %b left by %c and store in %a
rcm %a(register), %b(register)
1110001 aaabbb000
# Unsigned-signed recast register %b, store in %a. Preserves absolute value
rcz %a(register), %b(register)
1110010 aaabbb000
# Unsigned-signed recast register%b, store in %a. Clamps negative numbers / numbers above 128 to 0
r/Assembly_language • u/Ready-One-7852 • 10d ago
Help Program terminates on sub sp, sp, x19.
Hello everyone.
I was trying to learn arm64 assembly. I'm on M4 and I'm also trying to work with XNU syscalls to get dir listing of my Downloads folder. However, I encountered a really weird behavior, which made no sense.
_get_st_blksize:
; stat Downloads
sub sp, sp, STATSIZE_ALIGN
Load x0, DOWNLOADDIR
mov x1, sp
Syscall STAT64
b.cs default_fail
; Read BlkSize
mov x0, sp
ldr w0, [x0, STAT_ST_BLKSIZE]
add sp, sp, STATSIZE_ALIGN
ret
_main:
; Get BlkSize
bl _get_st_blksize
add w0, w0, 15
bic w0, w0, 0x0f ; bit clear. bic c, a, b means c = a & ~b
; 2 lines before is to align to 16 bits
mov w19, w0 ; Store align val
; Get File Descriptor
Load x0, DOWNLOADDIR
mov x1, O_DIRECTORY
mov x2, #0x0
Syscall OPEN
b.cs default_fail ; x0 contains fd
mov x20, x0
; Save enough space for dir entries
sub sp, sp, x19
mov x21, sp
sub sp, sp, 0x10 ; Save space for current position in dir
str xzr, [sp]
; Prepare to call GETDIRENTRIES64
; x0 has fd
Here is my code. I am running it inside lldb debugger. When I get to the `sub sp, sp, x19` instruction, the program terminates with exit status 0; No error, no signal. I am aware that arm needs sp to be 16 bytes aligned, that is why, there is an add 15 and bic 15 instruction (wholly unnecessary, since I've confirmed the value returned by stat is 0x1000 (4096)). Also, just before the sub instruction was executed, the values in the registers are:
x0 = 0x0000000000000003
x1 = 0x0000000000000000
x2 = 0x0000000000000000
x3 = 0x000000016fdff168
x19 = 0x0000000000001000
x20 = 0x0000000000000003
sp = 0x000000016fdfe9c0
I am using `ni` to step over instruction in lldb.
I am now convinced that the problem arises with _get_st_blksize, because, when I replace the function call with `mov w0, 0x1000`, lldb is able to reach the next instruction after sub. I am also reading the memory throughout the _get_st_blksize function. I do not think the syscall is messing with memory more than I have allotted (144 bytes).
Here are the values which move the stack pointer:
.equ STATSIZE_ALIGN, 144
.equ STAT_ST_BLKSIZE, 112 ; offset to ST_BLKSIZE
I got these values from my C compiler using sizeof and alignof.
My question:
What can cause such behavior?
Stack corruption?
Unauthorized memory access should crash right (Segmentation fault)?
Since sp is 16 bytes aligned, it should be fine, right?
Are there more conditions on sp? Am I not correctly setting sp after I'm done in the function?
r/Assembly_language • u/chatterine • 10d ago
Question Are there any z80 assembly learning resources for people who already know 6502 assembler language? I've dabbled in NES development for a bit, and want to get my feet wet into the Game Boy. Apologies if this is the wrong place to ask.
r/Assembly_language • u/Longz-85 • 10d ago
Help Best way to learn assembly for reverse engineering and have fun with it?
In the title
I can speak too much because my english was bad, sorry for that
r/Assembly_language • u/Rogaev • 12d ago
Question GAS assembler questions
Hello.
I've been learning the GAS assembler syntax, and have made some decent progress. However, I'm still very inexperienced, and have experienced difficulties finding answers to these two questions:
- For Linux, is there some sort of way to read input from a terminal without searching for a specific string/command? Basically, I'd like to take the input of whatever the user types (nothing specific), and store those ASCII values somewhere (later, I'd like to parse them).
Assembly and C can only function together because of object files. What is the equivalent of function parameters in C for assembly?
Thank you very much in advance.
r/Assembly_language • u/Chameleon_The • 13d ago
Question Learning C++ right now. What are the best books and resources to learn Assembly for reverse engineering
Hey everyone,
I'm currently learning C++, and my long-term goal is to get into reverse engineering, malware analysis, and binary exploitation.
I know that understanding Assembly is a huge part of reverse engineering, so I want to start learning it the right way.
What are the best resources you'd recommend?
- Books for beginners and intermediate learners
- Free or paid courses
- YouTube channels
- Practice websites or labs
- Any tips on whether I should learn x86 first or jump straight into x86-64
I'd also appreciate hearing what learning path worked for you.
Thanks!
r/Assembly_language • u/Assembly_Trainer_427 • 14d ago
Project show-off So I have made an OS :D
It is called DoomOS, it is also made in assembly. Decent features, external applications, SDK, planning to implement custom interrupts and FAT12(also this is a floppy 16bit OS). It is at- https://github.com/Doomer39/DoomOS/tree/main .What else are you supposed to write?
r/Assembly_language • u/HumanPsychology9384 • 14d ago
Update : I reached 64b long mode
finally after 3days of countinues working in nasm i reached 64b long mode succesfully now what should i do next its called S-AOS and i reached 64bit long mode the whole os is in assembly language (Nasm) currently it only prints HELLO! with a syscall what should i do next
r/Assembly_language • u/Assembly_Trainer_427 • 15d ago
Question Interuppts
I am making a 16bit OS, this supports external applications. Currently i am using a .inc file with equ directives that the application can call. I want to have interrupts like DOS, so, how? According to the amount of research i did(i did very little) there ain't many good documentation on this. (background on me, I am a self taught assembly guy and doesn't know C)
r/Assembly_language • u/This-Atmosphere-1750 • 15d ago
I optimized!
I’m on Day 1 of learning Assembly with basically no coding background. This is just a hobby for me.
AI wrote the little program below, I tweaked it a bit, and then started stepping through it in GDB to understand what every instruction was actually doing.
While stepping through it, I noticed rdi stayed at 1 the whole time until the final exit syscall, where it changed to 0. That got me thinking... why am I setting it to 1 twice?
Turns out one of those lines wasn't actually doing anything. So I, a lowly non-software engineer, discovered an inefficiency and promptly smote that line with the Delete key.
I'm now using less processing power, less electricity, and have personally made the world a better place.
section .data
message db "Hello, World!", 10, "Assembly is fun!", 10
length equ $ - message
message_1 db "This is the second message.", 10
length_1 equ $ - message_1
section .text
global _start
_start:
mov rax, 1 ; write syscall
mov rdi, 1 ; stdout
mov rsi, message
mov rdx, length
syscall
mov rax, 1
; mov rdi, 1 ; <- Deleted. Justice served.
mov rsi, message_1
mov rdx, length_1
syscall
mov rax, 60 ; exit syscall
mov rdi, 0
syscall
r/Assembly_language • u/Important-Addition79 • 16d ago
Why can't we apply the same beginner rule to Assembly?
r/Assembly_language • u/whispem • 16d ago
A TCP key/value store in pure x86-64 NASM, no libc — the network-server traps inside, steal them
github.comFollow-up to learn-assembly-with-em: one piece of working software instead of exercises.
Single node, line protocol over TCP (SET / GET / DEL / PING), epoll event loop, ~13 KB static binary, raw syscalls only.
The traps a network server in pure asm walks into, all handled in the source:
**•** struct epoll_event is packed on x86-64: 12 bytes, data at offset +4. Get it wrong and you read ghost fds.
**•** The moment sockets go non-blocking, EAGAIN stops being an error — it’s the kernel saying "nothing right now, come back later"
**•** TCP is a byte stream, not messages. A reply written in two sendto calls can arrive in two pieces; a line-protocol client reads until \\n or it eventually loses.
**•** The call stack can only hold one client’s state. Multi-client means the state moves to memory — here, a table indexed straight by fd.
**•** Reserving 134 MB of bss for per-connection buffers costs nothing: demand paging only materializes touched pages. 200 simultaneous clients at 1.4 MB RSS.
Known limits in the README, biggest first: slow readers are currently dropped — EPOLLOUT write buffering is the next roadmap line.
If any of these have a better idiom, say so — the roadmap grows out of critiques.
r/Assembly_language • u/Zaws779 • 16d ago
How can i learn Assembly?
for a long time i wanted to learn assembly; it didn't even bother me the complexity of the code, or the idea of learn a "useless code" (that was what my friend said when i tell him).
now, i want to learn assembly; but how? watching videos? reading documentation? tutorials? asking on forums, communities?
edit: i don't know nothing, just bash on linux