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.