Open
Conversation
Two-pass assembler that takes .asm source files and outputs Logisim v2.0 raw hex format. Supports labels, comments, hex/decimal/char literals (including escape sequences like '\n'). Also adds a clean, labelled assembly source for useless_OS that assembles identically to the existing useless_OS.hex. This was made quickly by Claude Sonnet 4.6 as a proof of concept. AI building stuff
assembler.py: - String literals: mov out1, "Hello\nWorld" expands to per-char movs - Numeric labels: disassembler output (0x0:, 0xa:) now assembles cleanly Makefile: - make / make all: force-rebuild all *.asm -> *.hex - make <stem>: assemble <stem>.asm into useless_OS.hex (active ROM) New sources: - useless_OS_strings.asm: useless_OS rewritten using string literals - fake_linux.asm: fake Linux boot + POSIX-like shell (ls, pwd, uname, whoami, help, exit); exit uses out2=0xFF as halt signal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
assembler.py, a two-pass assembler that takes.asmsource files and outputs Logisimv2.0 rawhex format ready to load into ROMuseless_OS_clean.asm, a clean labelled assembly source for the existinguseless_OS.hex(assembles identically byte-for-byte)Assembler features
shell_loop:,cmd_help:, etc.);)0xff), decimal, character ('A','\n',',')movencodings from operand typesUsage
python3 assembler.py source.asm # outputs source.hex python3 assembler.py source.asm -o out.hexThis was made quickly by Claude Sonnet 4.6 as a proof of concept. AI building stuff