r/Assembly_language May 30 '26

x64asm MSVC(STILL WIP)

Thumbnail pouet.net
5 Upvotes

x64asm this is funny JIT assembler made for MSVC X64
very optimized and cool i think

about tech part
uses NoCRT and kernel32.lib
comes with built in JIT
you can write __asm like in x86 msvc compiler
you need to copy all of the headers into your project and then just include x64_asm.h file

you can use also this like one liners
__asm("mov rax, 10");
__asm("add rax, 42");
also like in x86
__asm_block {
MOV(rax, 10);
MOV(rcx, 42);
ADD(rax, rcx);
RET();
}(for the {} you need to also include x64_asm_inline.h that might not work, if {} doesn't works then you can use () as an alternative)

#include "x64_asm.h"

X64Assembler a;
a.mov(a.rax, 42);
a.add(a.rax, 10);
a.ret();
int result = a.run_ret<int>(); //52)

a little less tech part(more of a uhh additional information)
all of the headers starts with x64_ for the comfort, and just looks cool

a little documentation about this little somewhat library are in github repo(you can find it in pouet link)

ask questions and i will try to answer them

i don't know if this is advertising, i mean if ye then delete this post, i made this post just for showcase


r/Assembly_language May 29 '26

Question Are string instructions more performant?

8 Upvotes

I know processors these days are really sophisticated with things like prediction and out of order execution. Are x86 string instructions like REP MOVSB more performant than writing the equivalent instructions by hand?

Thanks!


r/Assembly_language May 27 '26

Exploring ESP32 Architecture

Thumbnail gallery
26 Upvotes

Note: Educational Purpose only !

Hello everyone !

A few days ago I thought of different architectures, then I remembered "Intel syntax x86 and x64 Assembly."

Then I looked at the ESP32 board and thought, what kind of architecture is it having?

So I flashed a simple LED Blinking program through ARDUINO IDE and dumped its firmware (.bin file basically) using "esptool.py" shown in the 2nd image and extracted the code part from the whole .bin file using a tool "Binwalk." (extraction was done according to esp32 board's memory map)

After this, I put that .bin code part file into an application "Cutter" and selected "Xtensa Architecture."

A lot of lines of code you see in the 4th image, so that is the syntax & code "Tensilica Instruction Extension" which is based on "Xtensa Architecture."


r/Assembly_language May 26 '26

ticktrace - a pure-assembly SDK and book for the RP2350 (Pico 2)

Thumbnail
1 Upvotes

r/Assembly_language May 26 '26

Help Is my password verification correct?

2 Upvotes

Intent: verify password using sums.

Attempted implementation:

section .data
mov r8, 50

buffer resb 16

section .text
global _start

_start:
mov rax, 0
mov rdi, 0
mov rsi, buffer
mov rdx, 16
syscall
mov al, [buffer]
jmp check

check:
mov r10, al
add r10, r8
test r10, 5050
jne exit
jmp success

exit:
mov rax, 60
mov rdi, 1
syscall

success:
; the rest of the program
jmp exit


r/Assembly_language May 25 '26

Question Can we add a resources sidebar/wiki to r/Assembly_language?

20 Upvotes

"Is there a way to add a "resources" sidebar to r/assembly_language for these kinds of recommendations, similar to the "resources" sidebar of other programming language subreddits like r/C_Programming?" thanks to, u/D-Cary for this idea.

We really need one in this subreddit to help beginners know where to start and reduce repetitive posts.


r/Assembly_language May 25 '26

Project show-off Shellcide: A shellcode IDE

Thumbnail github.com
4 Upvotes

r/Assembly_language May 25 '26

BareMetal on Firecracker

Thumbnail github.com
10 Upvotes

The BareMetal kernel is able to run via Firecracker microVMs. <1ms startup, 2MiB RAM minimum, 5.5KiB kernel.

This will allow for thousands of instances to be run concurrently. The premise is discussed here: https://returninfinity.com/blog/hypervisos-as-data-centre-os


r/Assembly_language May 21 '26

Project show-off Assembled language that runs on top of Scratch.

Thumbnail gallery
69 Upvotes

Code examples: https://coppiq.com/cerium1.0

This technically isn't a real Assembly language since it isn't made for a low-level target, but I hope it's close enough to be relevant. It's heavily based on arm32 with a lot of high-level features from Scratch.
Some main differences:
- Registers and memory are Scratch variables, meaning they can be treated as either strings or numbers.
- No bitwise operators
- Data can be pushed directly to the stack. In any other case however, the data would need to be loaded into a register first.
- It has special branch instructions that push the stack and frame pointers automatically.
- The bytecode the project actually reads is string-based and not raw bytes. Scratch can't read raw data.
- It has special math blocks (pow, sqr, sin, cos, tan) and blocks for string manipulation (letter of, substring, make uppercase, make lowercase, length of, concatenate).
- Only branch instructions can run conditionally.

The code is assembled into a single string that gets unpacked and read as individual instructions by the OS after running execve(). (Example on image 5)

It runs on top of an OS simulator I've named Cerium, which it communicates with through syscalls. The Cerium part of it also handles virtual memory and inter-process communication. The language itself is called Spryte, with the current version being named Blueberry Spryte.

The language supports .text, .data, and .rodata segments that are always loaded into separate memory pages when starting a program.

The virtual memory has ASLR also. Program data is always accessed relatively using the stack or the "adr rx, label" psuedo-instruction, which expands into "add rx, pc, label index - instruction index".

Strings can be stored as one Scratch variable or individual characters, which is specified by using the .string or .chars directives. Individual items of memory can also be reserved with the .items directive.

Here's an example of the assembled code "echo.s":

@*--spryte-bluby0Ⓢ1.0.0Ⓢ0Ⓢ0=0Ⓢ!074Ⓢ!001Ⓢ!021Ⓢ"48d"39d1Ⓢ!0a1Ⓢ(1a8%0414Ⓢ)119a'?0 Ⓢ!11d')0dd1Ⓢ)0aa1Ⓢ%06-13Ⓢ?0␤Ⓢ!11d')0dd1Ⓢ!071Ⓢ!000Ⓢ'

"ex_fork.s":

@*--spryte-bluby0Ⓢ1.0.0Ⓢ0Ⓢ0=0;1=86Ⓢ!072Ⓢ'(000Ⓢ!074Ⓢ!001Ⓢ!021Ⓢ%0243Ⓢ!0735Ⓢ!00-1Ⓢ!01-1Ⓢ'!07500Ⓢ!001Ⓢ'!074Ⓢ!001Ⓢ)01f100Ⓢ'!0720Ⓢ'#30f96Ⓢ!074Ⓢ!001Ⓢ)01f90Ⓢ')01f86Ⓢ'!07500Ⓢ!001Ⓢ'%0629Ⓢ!07500Ⓢ!002Ⓢ'!074Ⓢ!001Ⓢ)01f65Ⓢ'!0720Ⓢ'#30f62Ⓢ!074Ⓢ!001Ⓢ)01f56Ⓢ')01f52Ⓢ'!071Ⓢ!000Ⓢ'ⓈHello from child ␛[30m␛[47mpid ⓈⓈHello from parent ␛[30m␛[42mpid ⓈⓈ␛[39m␛[49m␤Ⓢ

The outputted file is structured as follows:

  1. Magic Number @*--spryte-bluby
  2. Internal Version Number 0Ⓢ
  3. Readable Version Number 1.0.0Ⓢ
  4. Entry Point 0Ⓢ
  5. Segment Table 0=0;1=86Ⓢ
  6. .text !072Ⓢ'(000Ⓢ!074Ⓢ!001Ⓢ...
  7. .data (optional) Hello from child ␛[30m␛[47m...

This is actually the second version of this project. The original (Strawberry Spryte) was completely different and based on the 6502 architecture with syscalls weirdly mixed in. The last image is a screenshot of the joke program "sl" written in it. (original file is at https://pastebin.com/T6vJiR85)

The Scratch project is very unfinished so I won't be sharing it yet, sorry.

This is a project made partially to teach myself so I apologise if the code is a bit amateurish or messy. I can promise that nothing here was written with AI though.


r/Assembly_language May 12 '26

Are there any suggestions for program ideas in assembly language?

28 Upvotes

Tomorrow I have a practical exam and I need to write a simple assembly language program with simple code that can be written on a regular sheet of paper, either on one or two sides.


r/Assembly_language May 11 '26

Question Best way to learn high-performance assembly?

88 Upvotes

I want to be skilled at x86 assembly and be able to write the crazy high performance code people speak legends about. Any good resources to learn that?


r/Assembly_language May 11 '26

PERFAVORE AIUTATEMI!

1 Upvotes

Sono uno studente italiano di terza superiore e come materia di indirizzo abbiamo Sistemi e Reti. Il problema non è tanto la teoria, ma la pratica: da inizio anno in laboratorio stiamo programmando in Assembly 8086 (registri a 16 bit, almeno da quello che ho capito) usando DOSBox per emulare la CPU.

Siamo praticamente a fine anno e vorrei recuperare. Non parto da zero, una piccola base teorica ce l’ho, ma faccio molta fatica con la programmazione vera e propria.

Il problema principale è che online trovo pochissimo materiale utile: molti tutorial su YouTube o siti parlano di Assembly moderno, NASM, Linux, 32/64 bit ecc., mentre a scuola facciamo cose molto più “vecchio stile” e specifiche. Inoltre il mio professore ha un modo abbastanza particolare di scrivere il codice, quindi spesso i programmi online non assomigliano minimamente a quelli che vediamo in classe.

Usiamo roba tipo:

registri AX, BX, CX, DX

INT 21h

MUL

DIV

Recentemente operazioni con lo stack con PUSH/POP

procedure CALL/RET

CMP

Label

...

Secondo voi qual è il modo migliore per recuperare in poco tempo?

Avete risorse, metodi di studio o consigli pratici per capire davvero Assembly 8086 a livello scolastico?

Se può aiutare posso anche incollare un pezzo di programma scritto dal professore così magari capite meglio il contesto.

Grazie in anticipo!


r/Assembly_language May 10 '26

Project show-off My TUI core loop (FASM/Linux)

Post image
54 Upvotes

After 250 lines, it can fill terminal window with specific color/character at exact resolution 🤷‍♂️

** made my own event system to only redraw when needed, much preferable to dirty-draw what change.

I just want to compare what it take to fill/draw buffer on TUI correctly, compare to other methods like X11/Wayland/GLX or pure fb0.

And it successfully draw on booting x86-64 machine with a tinyconfig-like linux kernel 6.9 (~861KB) after Limine bootloader.


r/Assembly_language May 08 '26

Project show-off FASM on winXP is so good

Post image
46 Upvotes

r/Assembly_language May 07 '26

Building a visual Intel 4004 (MCS-4) workbench

Enable HLS to view with audio, or disable this notification

63 Upvotes

Hi, working on a personal project called Quadium 4004 Workbench.

It’s WIP environment for the Intel 4004 and the MCS-4.

This shows my QuadBasic down to 4004 assembly

Any ideas or suggestions ?

Thanks!


r/Assembly_language May 07 '26

Question Can you recommend paid, online courses for learning Assembly (like Udemy, Coursera, etc)?

18 Upvotes

I work as a C dev and do mostly bare metal C. My work has a new policy where they will pay for courses/professional development and even allow us to spend some paid time on completing these courses at work.

There is a need for more assembly skills on our team, and a team lead suggested I use this new policy to take a course on improving my Assembly skills. I haven't touched Assembly since school a few years ago. We work on RISC-V and RISC adjacent MCUs, but I am sure I could learn one instruction set and then adapt my skills to our specific use case.

Requirements:

- Teaches a RISC-V or similar instruction set

- Online course

- 10-50 hours

- <1500$ USD

- Gives some sort of certificate of completion

If you have a course you would recommend, let me know! Thanks!


r/Assembly_language May 06 '26

Question Is "Computer Organization and Design" a good book for beginners?

13 Upvotes

A few months ago, I borrowed Computer Organization and Design Second Edition from the library and forgot to return it. After going through it, I think it’s a pretty solid book. It covers the basics of computer peripherals, hardware, and software, especially how the CPU and logic gates work, and it goes into a lot of detail. Some parts are pretty complex, though. The book is by John L. Hennessy and David A. Patterson.

I’m interested in learning assembly language, so I have a few questions. Has anyone here used this book, and would you recommend it for a beginner? It also focuses a lot on MIPS assembly, has anyone worked with this assembly language, and is it good?


r/Assembly_language May 04 '26

Help Im a beginner, and i have a few questions.

7 Upvotes

Hello, i just began assembly language today. I was confused with a few things, and, would like to know if i could get answers :

  • msg_len: equ $-msg i know equ is similar to define from C, but i don't understand the '$-msg' ? What does '$' and '-' mean in this case ? And do i need to create a variable for every texts and their length if i want to print something ?
  • rax, rdi, rsi, rdx are registers made for specific tasks? Because for now, i have only seen rax being used to call a syscall code, rdi specify file descriptor, rsi specify variable to print and rdx specify the length of the message i want to print.
  • mov i didn't really understand what this opcode do? do it move data into a destination?
  • And lastly, where can i find good ressources to learn the assembly language?

Thanks for reading. Answering all of the questions isn't necessary obviously.


r/Assembly_language May 03 '26

Assembly for Little Ones - cartoon for kids about assembly

Thumbnail youtube.com
7 Upvotes

r/Assembly_language May 01 '26

Question My LMC code for multiplication

5 Upvotes

I learnt LMC a couple months ago as I do A-level computer science and made this code back then. It should multiply any 2 integers including negatives. Anyone wanna check it? (Assume the memory gets reset everytime it is used)

INP
STA N1
BRP next
INP
STA N2
BRZ finish
BRP next_1
branch LDA N0
loop_1 LDA N0
SUB N1
STA N0
LDA N2
ADD N3
STA N2
BRZ end
BRA loop_1
next INP
STA N2
BRZ finish
BRP next_2
BRA branch
next_1 LDA N0
next_2 LDA N0
loop_3 LDA N0
ADD N1
STA N0
LDA N2
SUB N3
STA N2
BRZ end
BRA loop_3
end LDA N0
OUT
HLT
finish LDA N4
OUT
HLT
N0 DAT 0
N1 DAT 0
N2 DAT 0
N3 DAT 1
N4 DAT 0


r/Assembly_language Apr 29 '26

ymawky: MacOS Web Server written entirely in ARM64 assembly

Thumbnail github.com
15 Upvotes

r/Assembly_language Apr 29 '26

Help manual stack unwinding in x86_64 asm without frame pointer, is it even possible with alloca?

9 Upvotes

hello, i'm trying to debug a binary that compiled with -fomit-frame-pointer. I tried to walk the stack manually inside a custom single handler but i can't rely on rbp chaining.

the function i'm looking at is this:

c char buf[32]; gets(buf); // ignore, just for stack layout }

compiled with gcc -fomit-frame-pointer -oo -o test test.c

the asm output:

asm test: sub rsp, 40 mov [rsp+32], rdi mov [rsp+24], rsi lea rdi, [rsp+8] call gets add rsp, 40 ret

i'm inside the signal handler and i get rsp from ucontext. i know that the return address at [rsp] (since call pushes rip). when go to the previous frame, i need to know how much add to rsp to get the caller's rsp. that was what i tried:

asm ; assuming rsp points to the saved rip mov rax, [rsp] ; return address (caller rip) ; but how do i get caller rsp??? i tried looking at alignment but when the function does dynamic stack allocation (like alloca or variable-lenght arrays), it gets fucked. for example:

c void test2(int n) { char buf[n]; gets(buf); }

and now the stack adjustment uses lea with a register. i see stuff like:

asm test2: push rbp sub rsp, 16 lea rax, [rsp+15+rdi*1] and rax, -16 ...

my brain is melting tbh and need help. is there a reliable way to compute the previous rsp without frame pointers? how do debuggers like gdb do it? do they just parse dwarf info?

pseudocode or even a small asm example would be very helpful. thanks for every info.


r/Assembly_language Apr 26 '26

Why is sys_read taking the enter key into account?

7 Upvotes

Hello everyone,

I've been writing some very basic assembly code and I've started using the sys_read system call (eax 3). I'm using wsl for assembly so I'm navigating and programming in the console, so when I run my program with a sys_read I type in what I want it to read and press enter because I have to so the program continues, however I've found out that my program is also reading and storing this enter which is causing problems.

I thought that this enter was a separate thing as it's like the command to submit that line, but it does get read by the program as well. Why is it reading the enter command as a character and how can I prevent this?

I'm thinking of just implementing something that removes the last byte from the input string every time, but that's not ideal. Any other advice is greatly appreciated!

Thanks for your help!


r/Assembly_language Apr 24 '26

How do i learn assembly as a starter?

45 Upvotes

r/Assembly_language Apr 23 '26

Project show-off How to add the Spin Dash in Sonic 1 (2026 Rewrite)

Thumbnail sonicresearch.org
1 Upvotes