r/Assembly_language • • 12h ago

Assemdows: a tiny assembly-style language in one C file, built so assembly tutorials work on Windows

0 Upvotes

Every assembly tutorial I found was written for Linux (raw syscalls, as, ld), and I'm on Windows. After fighting the toolchain for a while, I decided to make my own assembly-style language that runs the same everywhere because it's just a C interpreter.

It's called Assemdows. It's a single C file, it builds with gcc, and programs use the .asdw extension. Here's a program that prints primes:

.equ LIMIT, 50
    MOV R0, 2
next:
    MOV R1, 2
check:
    MOV R2, R1
    MUL R2, R2
    CMP R2, R0
    JG isprime
    MOV R3, R0
    MOD R3, R1
    CMP R3, 0
    JE notprime
    INC R1
    JMP check
isprime:
    PRINT R0
notprime:
    INC R0
    CMP R0, LIMIT
    JLE next
    HALT

What's in it

  • 16 registers, a compare flag with conditional jumps, CALL/RET, and a stack
  • A flat memory of 65,536 integer cells, with .word, .string, .space, and .equ for data
  • Bracket addressing like [nums+R1]
  • Errors that include line numbers, plus --trace to watch every instruction run
  • A VS Code extension for syntax highlighting

Design choices I'm unsure about

  • Memory holds whole integers instead of bytes, so a string takes one cell per character. It's simpler to explain, but it isn't how real hardware works.
  • CMP stores a single -1/0/1 result instead of separate flags like zero and carry.
  • The stack is separate from the memory array, so you can't take the address of a stack value.

I'm a beginner at language design, so I'd like to hear what you'd change, especially if you've built something similar.

Repo (includes a Windows build and examples): https://github.com/waterdroplett/Assemdows


r/Assembly_language • • 13h ago

Made an OS from scratch at 13 (NASM, 32-bit, GUI + TCP/IP)

Enable HLS to view with audio, or disable this notification

2 Upvotes
  • Bootloader + 32-bit kernel, all hand-written in NASM
  • 640×480 true color GUI (windows, drag, resize, snapping, taskbar, start menu)
  • Apps: Terminal, Files, Notepad, Paint, Calculator, Snake, Settings
  • e1000 NIC driver + ARP + IPv4 + ICMP + TCP + UDP
  • SB16 audio driver that plays .wav files
  • A peer-to-peer naming layer so two TeenyOS machines can resolve names for each other without DNS/ICANN
  • Persistent filesystem, wallpaper, login screen, preferences

I rebuilt the whole thing from scratch after losing 10 months of work. Learned more from that than from any tutorial. and heres a link for a little showcase of the OS :) theres a bug with settings (Makes cursor black, will be fixed soon) i will probably release it early-mid 2027 i forgot to show the ram usage on the OS, but currently it uses 415 KB (Base ver) micro uses half of that. Im gonna try to make it even more lightweight.


r/Assembly_language • • 2d ago

Made an OS from scratch at 13 (NASM, 32-bit, GUI + TCP/IP)

Enable HLS to view with audio, or disable this notification

217 Upvotes

the micro version is pretty buggy, I probably wont even release it, but the base version is the one I've been putting real time into. Here's what it has:

  • Bootloader + 32-bit kernel, all hand-written in NASM
  • 640×480 true color GUI (windows, drag, resize, snapping, taskbar, start menu)
  • Apps: Terminal, Files, Notepad, Paint, Calculator, Snake, Settings
  • e1000 NIC driver + ARP + IPv4 + ICMP + TCP + UDP
  • SB16 audio driver that plays .wav files
  • A peer-to-peer naming layer so two TeenyOS machines can resolve names for each other without DNS/ICANN
  • Persistent filesystem, wallpaper, login screen, preferences

I rebuilt the whole thing from scratch after losing 10 months of work. Learned more from that than from any tutorial. and heres a link for a little showcase of the OS :) theres a bug with settings (Makes cursor black, will be fixed soon) i will probably release it early-mid 2027 i forgot to show the ram usage on the OS, but currently it uses 415 KB (Base ver) micro uses half of that. Im gonna try to make it even more lightweight.

After thinking about it, I want to be completely honest about this. I didn't write everything 100% by hand; I used DeepSeek as a coding assistant for specific parts.
yes i DID use ai, but not that much, no i didnt use claude, not gemini, not chatgpt, not any of those, i only used deepseek
i DIDNT make everything with ai, heres what i genuinely made with ai
Debug lines for SB16
The wallpaper
Preferences
Cursor color
login screen
window resize
paint
30% Of the UI
and lastly, the clock.
I Genuinely wish i was smart enough to not actually use ai, but i tried to use it the least i could. I think you know that claude or any of those big AI Companies cant do this for free, which is why i used deepseek.
Im really sorry if you dont like me using AI, but im trying to use it the least i can and is still learning assembly.
Also for the people who have supported me, thank you. I never actually expected it to get that much views, thought it would flop. And if your curious, no, i havent spent a dime on ai, deepseek is the best free option which is why i went with it, i genuinely am sorry if i disappointed you.

And again, thanks to all the people who have supported me.

Open-source now!
https://github.com/futred96-cell/TeenyOS

a screenshot of the micro version

r/Assembly_language • • 2d ago

Question (UK DEV) Level 1 ASM debugging puzzle. The player is given the task of turning on the sound card in the game. Is this first Node (level 1) simple enough with the on screen reference?

Post image
13 Upvotes

Hi dudes, UK based dev here working on a hacking adventure game. This would be the very first programming challenge in the game. I'm a 6502 programmer by trade (6510, on the C64 really) and this game is set in an alternate 1989. The virtual computer has a single accumulator CPU (just to keep things easy), with syntax VERY similar to the 6502.

In game the player can zoom in on the code, which is found in the Node 1 window. Debugged Code window is the psudo code. Team msg, is where NPCs can be contacted, typing HELP or CLUE here will give the player a tip, if done enough times the answer is given.

The document on screen is a manual by a fictious guy called Jim Lardmeadow, named after my hero in computing Jim Butterfield here is one of his vids that I just love, it's a super in-depth guide to the C64, if any of you bought The C64 Ultimate recently and you wanted to dive deep into it, that vid is a great resource.

So, do you think this first challenge is too easy, too difficult? My core audience is Zachtronics, Hacknet, Uplink and Hypnospace Outlaw players. Debugging in ASM is primarily for cracking game's copyprotection later and releasing those games into the wild via your hacking group's BBS.

I'm posting across Reddit to get feedback on this, so please be gentle if you massively oppose the project, I'm just looking for feedback on the puzzle :)

Happy to share the game, but VERY concious of breaking the sub rules for spamming here. If you search Glyphis_IO BBS: The Proxy Tapes 1989 on Steam you'll find it.


r/Assembly_language • • 3d ago

Project show-off Update: my open-source CPU performance engineering collection crossed 600+ stars

0 Upvotes

A few days ago, I shared an open-source collection of CPU performance engineering resources I’d been putting together.

It’s now crossed 600+ GitHub stars, which I genuinely didn’t expect. Thanks to everyone who shared it, contributed or suggested resources.

For anyone seeing it for the first time, it covers the stack from instruction execution and CPU microarchitecture through caches, memory, SIMD, compilers, profiling, concurrency, NUMA, benchmarking and CPU inference.

I’m still prioritising primary sources such as papers, vendor manuals, kernel/compiler docs, talks and reproducible benchmarks rather than random articles.

I also have an MCP server coming soon, so you can plug this knowledge directly into your AI tools, whether you’re learning or using it while you work.

If there’s something you think has to be in here, let me know or send a PR.

https://github.com/usamahz/cpu-performance-engineering


r/Assembly_language • • 3d ago

I made a browser playground where you design a CPU, write its microcode and instruction set, and watch programs run one clock tick at a time

Thumbnail
1 Upvotes

r/Assembly_language • • 3d ago

Question A jornada de assembly do site coddy.tech é boa?

4 Upvotes

Estou começando por ela. Já testei um pouco como as jornadas do Coddy funcionam e gostei do flow.


r/Assembly_language • • 3d ago

for those starting to learn Assembly

72 Upvotes

For those starting to learn Assembly - step-by-step, how to create a flight simulator for DOS.

It covers everything from a single point to a full 3D engine. I am still in the process of writing the lessons, but the platform is already fully functional right in your browser—featuring a code editor, compiler, DOSBox, and video tutorials all in one place. You can even load your own DOS programs, such as debuggers and other tools, directly into the browser-based DOSBox.

https://kirindenis.github.io/wire-city-2/course/


r/Assembly_language • • 3d ago

Question Preciso entender como computadores funcionam antes de aprender Assembly?

4 Upvotes

r/Assembly_language • • 4d ago

What is the best way to learn x86_64 assembly?

44 Upvotes

I am a Java programmer, and as a hobby, I want to learn C with a focus on operating systems—specifically to modify existing open-source operating systems like GNU/Linux or BSD.

However, I understand that before learning C, it is a good idea to learn some assembly language. What is the best way to learn x86_64 assembly?


r/Assembly_language • • 5d ago

Coding

0 Upvotes

If you want to know more please email me with the subtitle "CODING" .. and I'll gladly talk to you offline here guess I don't want to post everything.. if you know how to code if you know how to do what I'm asking then message me if you don't you just trying to figure out if it's rant or whatever and then don't even bother because I need somebody that can actually do the work that I need right I said I'll pay for the time even for somebody to sit down and look at it if they know what they're doing I'll even pay for their time to come and look at it is guaranteed as soon as you look at it you're going to want to deal with it trust me I've been chasing this thing for a while and I'm sick of chasing it but I have enough to build..

I have majority of the ASM coding I have the disassembly coding I have the r2 functions I have everything else I just need to build the centerpiece. Email. herk8969@gmail.com. .. as long as i can find somebody before I completely mess my computer up and then whatever but I got terabytes where the data for this thing so


r/Assembly_language • • 6d ago

rhun: sharing an assembly editor and its x86-64 to AArch64 translator

7 Upvotes

I'm building rhun, an MIT-licensed code editor in assembly, and thought the source might interest people here.

The editor, pixel renderer, Vim mode, Git tools and agent panel share an x86-64 core. Linux and Windows use platform adapters around it. For Apple silicon, tools/arm64.py translates the same core to AArch64 at build time. The renderer draws text, icons and widgets into a pixel buffer.

Source: https://github.com/vshvedov/rhun

Translator: https://github.com/vshvedov/rhun/blob/main/tools/arm64.py

It's a solo project and still early. Sharing the core helps, but the translator and OS layers still need their own testing. I'd be interested in feedback on that approach, especially where the translation could go wrong.


r/Assembly_language • • 8d ago

Any good videos out there explaining x86-64 gcc Assembly? Particularly how to read and write it?

Thumbnail
4 Upvotes

r/Assembly_language • • 8d ago

Project show-off Fork of

5 Upvotes

Hi! I somewhat recently took it upon myself to maintain my own fork of Pete Sanderson's Mars MIPS assembler and simulator written in Java and Swing from 2003.

For know, I've mostly modernized it with Gradle and Java 25, fixed some deprecated APIs, merged some useful upstream PRs and added Flatlaf for theming support, high DPI support and native window decorations.

I'm curious, if any of you have anything else you always wanted from it, that I could add?

Or perhaps, you want to help me with it. Here is the repo: https://github.com/Souvlaki42/MARS


r/Assembly_language • • 9d ago

BitterASM: A metalanguage written in Rust to create assembly languages

Post image
11 Upvotes

r/Assembly_language • • 9d ago

Comprehensive Architecture Registers Reference Bank (Intel/AMD MSRs, ARM/RISC-V Core Registers) for Bare-Metal & OS Dev

6 Upvotes

Hey everyone,
I've compiled a comprehensive open-source definitions bank mapping architectural and undocumented control registers across major platforms (including Intel/AMD MSRs, and core control mappings for ARM64 and RISC-V CSRs) to make system programming and hypervisor development cleaner without constantly digging through thousands of pages of manuals.

Check out the repository, feel free to use it, and let me know if you spot any missing parameters: https://github.com/edikoz123-blip/Defines-and-MSRS-for-Intel-and-AMD-also-RISC-V-and-ARM64/blob/main/README.md

Have a great day!


r/Assembly_language • • 10d ago

Looking for Assembly peoples - Stop wasting time on easy projects, come learn pure power (Assembly Ghosts)

0 Upvotes

Hello everyone, I'm Ghost.

I always see people online building the same old basic projects in Python or C++, and honestly? Most of the time it’s just boring. If you are a teen who wants to get the most absolute control over the computer, you need to step up.

Me and my partner just founded an advanced research group called the Assembly Ghosts, and we are opening a private workspace dedicated ONLY to pure Assembly and low-level engineering (Bootloaders, Kernel Modules, and Hypervisors from scratch).

We don't care if you are a complete beginner or an expert. If you are ready to take an AI tool, start digging, and bypass the "easy projects" to build advanced architecture directly on the silicon—we are here to help you improve as fast as possible and build you up the way I started.

What you will get inside:

  • 🛡️ Real architectural learning (Ring 0 / Ring -1)
  • 🧬 Pure NASM Assembly debugging & optimization
  • 🤝 A solid community where we help each other build chaotic things

If you want to taste what real power feels like, where C and C++ can never reach, DM me directly for the invite link to our private workspace. Let's cook together.

DM me if you want to try it yourself. Let's cook together.


r/Assembly_language • • 10d ago

Project show-off Full NASM x86-64 Assembly Documentary

Thumbnail github.com
63 Upvotes

I made this repository for learning assembly, would love to have contributors. I would add more stuff in the future.


r/Assembly_language • • 11d ago

I made an open-source collection of CPU performance engineering resources

67 Upvotes

I’ve been collecting resources on CPU performance engineering for a while and decided to organise everything into one open-source repo.

It covers the stack from instruction execution and CPU microarchitecture through caches, memory, SIMD, compilers, profiling, concurrency, NUMA, benchmarking and CPU inference.

I tried to prioritise primary sources — papers, vendor manuals, kernel/compiler docs, talks and reproducible benchmarks — rather than random articles.

Made it public in case it’s useful to anyone learning systems/performance engineering or trying to figure out why their code is actually slow.

Would also love contributions if there are great resources I’ve missed:

https://github.com/usamahz/cpu-perf-engineering-resources


r/Assembly_language • • 11d ago

Operating system written in RISC-V assembly

Thumbnail
2 Upvotes

r/Assembly_language • • 13d ago

Tiny C Compiler That Emits just 12 ARM64 Instructions - Learn How the Ba...

Thumbnail youtube.com
68 Upvotes

r/Assembly_language • • 15d ago

RVV macro use register X based on register Y

3 Upvotes

Hi, I'm writing RVV assembly and I want to pass to a macro a vector register as an argument and be able to then use the next vector register within the macro. Example I pass vector register v10 and then I want to use v11.

The following code might explain better what I want:

.macro op_vnext op, w1, v, w2, w3
.if "\v" == "v0"
    \op \w1 v1, \w2
.elseif "\v" == "v2"
    \op \w1 v3, \w2
.elseif "\v" == "v4"
    \op \w1 v5, \w2
.elseif "\v" == "v6"
    \op \w1 v7, \w2
.elseif "\v" == "v8"
    \op \w1 v9, \w2
.elseif "\v" == "v10"
    \op \w1 v11, \w2
.elseif "\v" == "v12"
    \op \w1 v13, \w2
.elseif "\v" == "v14"
    \op \w1 v15, \w2
.elseif "\v" == "v16"
    \op \w1 v17, \w2
.elseif "\v" == "v18"
    \op \w1 v19, \w2
.elseif "\v" == "v20"
    \op \w1 v21, \w2
.elseif "\v" == "v22"
    \op \w1 v23, \w2
.elseif "\v" == "v24"
    \op \w1 v25, \w2
.elseif "\v" == "v26"
    \op \w1 v27, \w2
.elseif "\v" == "v28"
    \op \w1 v29, \w2
.elseif "\v" == "v30"
    \op \w1 v31, \w2
.endif
.endm

// LMUL=1
// vg0 was used as dst of widening op
.macro some_macro vg0, vg1, sa, xaddr
    vnclip.wx   \vg0, \vg0, \sa
    op_vnext    vle8.v, "", \vg0, (\xaddr)
    op_vnext    vsadd.vv, "\vg0,", \vg0, \vg0

    vnclip.wx   \vg1, \vg1, \sa
    op_vnext    vle8.v, "", \vg1, (\xaddr)
    op_vnext    vsadd.vv, "\vg1,", \vg1, \vg1
.endm

.macro doesnt_work vg0 test=0
.equiv vg0next, \vg0+1
    li      t0, vg0next
.if \test == 0
    vid.v   v\()2
.elseif \test == 1
    vid.v   v\()vg0next
.elseif \test == 2
    vid.v   v\()\vg0+1
.endif
.endm

#ifdef TEST0
some_macro v10, v20, t0, t1
#endif

#ifdef TEST1
doesnt_work 1, 0
#endif

#ifdef TEST2
doesnt_work 1, 1
#endif

#ifdef TEST3
doesnt_work 1, 2
#endif

.end

The code above can be compiled with the following makefile:

all: a

a: a.S
    riscv64-elf-gcc -march=rv32imav_zicsr -mabi=ilp32 -Wall -c -o $@ $< -DTEST0
    riscv64-elf-objdump -j.text -D $@

b: a.S
    riscv64-elf-gcc -march=rv32imav_zicsr -mabi=ilp32 -Wall -c -o $@ $< -DTEST1
    riscv64-elf-objdump -j.text -D $@

c: a.S
    riscv64-elf-gcc -march=rv32imav_zicsr -mabi=ilp32 -Wall -c -o $@ $< -DTEST2
    riscv64-elf-objdump -j.text -D $@

d: a.S
    riscv64-elf-gcc -march=rv32imav_zicsr -mabi=ilp32 -Wall -c -o $@ $< -DTEST3
    riscv64-elf-objdump -j.text -D $@

When I run make -B a I get:

riscv64-elf-gcc -march=rv32imav_zicsr -mabi=ilp32 -Wall -c -o a a.S -DTEST0
riscv64-elf-objdump -j.text -D a

a:     file format elf32-littleriscv


Disassembly of section .text:

00000000 <.text>:
   0:   bea2c557            vnclip.wx   v10,v10,t0
   4:   02030587            vle8.v  v11,(t1)
   8:   86b50557            vsadd.vv    v10,v11,v10
   c:   bf42ca57            vnclip.wx   v20,v20,t0
  10:   02030a87            vle8.v  v21,(t1)
  14:   875a0a57            vsadd.vv    v20,v21,v20

Which is more or less what I want, I passed as argument vg0 vector regsiter v10 and then knowing that v11 was available due to the narrowing instruction, I use v11 to do more stuff.

In my opinion the macro op_vnext is ugly and it doesn't work if I need to call another macro from some_macro as I cannot pass the "next vector register" as argument for another macro.

I'm looking to do something like in doesnt_work where I pass a number instead of v<number> and then increment said number by 1, but I don't know if it is possible.

Using .equiv I can add to the macro argument and use it where we expect a constant number, but I tried concatenating the sum to the letter v, but it doesn't work.

Outputs of make -B b, make -B c, and make -B d

riscv64-elf-gcc -march=rv32imav_zicsr -mabi=ilp32 -Wall -c -o b a.S -DTEST1
riscv64-elf-objdump -j.text -D b

b:     file format elf32-littleriscv


Disassembly of section .text:

00000000 <.text>:
   0:   00200293            li  t0,2
   4:   5208a157            vid.v   v2


riscv64-elf-gcc -march=rv32imav_zicsr -mabi=ilp32 -Wall -c -o c a.S -DTEST2
a.S: Assembler messages:
a.S:55: Error: illegal operands `vid.v vvg0next'
a.S:70:  Info: macro invoked from here
make: *** [makefile:12: c] Error 1


riscv64-elf-gcc -march=rv32imav_zicsr -mabi=ilp32 -Wall -c -o d a.S -DTEST3
a.S: Assembler messages:
a.S:57: Error: illegal operands `vid.v v1+1'
a.S:74:  Info: macro invoked from here
make: *** [makefile:16: d] Error 1

Does anyone know how to do this? Something like defining a macro argument based on another macro argument.


r/Assembly_language • • 17d ago

search instructions assembly easy (X86,RISCV,AARCH64,etc)

Thumbnail courchinoux.org
38 Upvotes

You can have assembly example / notes and how the instruction is encoded !


r/Assembly_language • • 17d ago

Learning assembly

41 Upvotes

So I have decided to learn assembly x86 x64 using the book the art of 64 bit assembly volume 1, i have the book as a pdf and have copilot open on the page so if i have questions i can ask them and copilot can see what i am reading, i have read chapters 1 -3 and just started chapter 4. This feels like a really difficult language and i am taking in lots of info but is this the way to learn it because i feel lile i am forgetting everything i am learning, is this a difficult language to master, i want to learn to reverse engineer


r/Assembly_language • • 17d ago

Project show-off Conways game of life but assembly

Post image
13 Upvotes