Smart multi-system assembly compiler for retro gaming projects
Poppy v2.0.0 is now available with Pansy.Core integration, reverse converters, and bank switching! Download the release โ
Poppy is a production-ready multi-system assembly compiler targeting classic gaming platforms:
| Platform | CPU | Status |
|---|---|---|
| NES | MOS 6502 | โ Compile-validated |
| SNES | WDC 65816 | โ Compile-validated |
| Game Boy | Sharp SM83 | โ Compile-validated |
| Atari 2600 | MOS 6507 | โ Compile-validated |
| Atari Lynx | WDC 65C02 | โ Compile-validated |
| Genesis | Motorola 68000 | โ Compile-validated |
| GBA | ARM7TDMI | โ Compile-validated |
| WonderSwan | NEC V30MZ | โ Compile-validated |
| Master System | Zilog Z80 | โ Compile-validated |
| TurboGrafx-16 | HuC6280 | โ Compile-validated |
The compiler supports real-world game development with comprehensive tooling, including a VS Code extension with IntelliSense, formatting, and build integration.
Core Compiler Features:
- ๐ Clean, lowercase assembly syntax
- ๐ข
$prefix for hexadecimal values (e.g.,$40df) - ๐ท๏ธ Labels, local labels, and anonymous labels
- ๐
.orgdirective for address setting - ๐ Data directives (
.byte,.word,.long,.fill,.ds) - ๐ All 6502 addressing modes
- ๐ Automatic zero-page optimization
- ๐ฅ๏ธ Command-line interface
File System & Organization:
- ๐ฆ
.includedirective for file inclusion - ๐
.incbindirective for binary data inclusion - ๐งฉ
.asset/.asset_manifestdirectives for binary/JSON/CHR reinsertion - ๐ Preprocessor with include path resolution
- ๐๏ธ Multi-file project support
Target Systems:
- ๐ฎ Full NES/Famicom support (6502)
- ๐จ Full SNES/Super Famicom support (65816)
- ๐น๏ธ Full Game Boy/Color support (SM83)
- ๐๏ธ Multiple memory mapping modes (LoROM, HiROM, ExHiROM)
- ๐ All iNES mapper configurations
Label System:
- ๐ท๏ธ Global labels
- ๐ Local labels with
@prefix and scoping - โ Anonymous forward labels (
+,++, etc.) - โ Anonymous backward labels (
-,--, etc.)
Directives & Features:
- ๐ฏ Target directives (
.nes,.snes,.gb) - ๐บ๏ธ Memory mapping (
.lorom,.hirom,.exhirom) - ๐ง Mapper selection (
.mapper) - ๐ Alignment directives (
.align,.pad) - โ
Compile-time assertions (
.assert) โ ๏ธ Error and warning directives (.error,.warning)- ๐ฌ Multi-line comments (
/* */)
SNES ROM Generation:
- ๐จ SNES header at correct ROM offset ($7fc0 LoROM, $ffc0 HiROM)
- ๐ 11 SNES header directives (
.snes_name,.snes_map_mode, etc.) - ๐บ๏ธ LoROM, HiROM, and ExHiROM support
- โ Automatic checksum calculation
- ๐ข ROM speed, type, and region configuration
Game Boy ROM Generation:
- ๐น๏ธ Game Boy header at $0100-$014f
- ๐ 7 GB header directives (
.gb_title,.gb_mbc,.gb_cgb, etc.) - ๐ฎ MBC support (MBC1, MBC3, MBC5, etc.)
- ๐ CGB (Color Game Boy) mode flags
- โ Automatic Nintendo logo and checksums
- ๐ RAM size and battery configuration
NES ROM Generation:
- ๐ฎ iNES 1.0 and iNES 2.0 header generation
- ๐ 12 iNES header directives (
.ines_prg,.ines_chr,.ines_mapper, etc.) - ๐บ๏ธ Support for mappers 0-4095, submappers 0-15
- ๐ Battery backup, trainer, mirroring configuration
- ๐ NTSC/PAL timing selection
Macro System:
- ๐ง Macro definitions with parameters (
.macro/.endmacro) - ๐ฏ Macro parameter substitution and default values
- ๐ท๏ธ Local labels within macros
- ๐ Nested macro invocations
Conditional Assembly:
- โ Conditional compilation (
.if/.else/.endif) - ๐ Symbol existence checks (
.ifdef/.ifndef) - ๐ข Expression-based conditionals (
.ifeq,.ifne,.ifgt, etc.)
Code Generation:
- ๐ Repeat blocks (
.rept/.endr) for code generation - ๐ข Enumeration blocks (
.enum/.ende) for sequential constants - ๐ Listing file generation with symbol tables
Metadata & Verification:
- ๐ผ Automatic Pansy metadata generation (symbols, CDL, cross-refs)
- ๐ Roundtrip verification against original ROM (byte-for-byte)
- ๐ฆ Peony project support (
peony.jsonfrom Nexen game packs) - ๐ฏ
--pansy,--no-pansy,--no-verifyCLI flags
Developer Tools:
- ๐จ VS Code Extension
- Syntax highlighting for all platforms
- IntelliSense with opcode documentation
- Code formatting with column alignment
- 40+ code snippets
- Build task integration
- Go-to-definition and hover info
- ๐ Comprehensive error messages with context
- ๐งฎ Advanced expression evaluation
- ๐ Multiple output formats (ROM, symbols, listings, memory maps)
Format Export:
- ๐ PASM-to-ASAR exporter (
.asmoutput) - ๐ PASM-to-CA65 exporter (
.soutput with.โ@local label conversion) - ๐ PASM-to-XKAS exporter (
;โ//comment conversion) - ๐ญ ExporterFactory for extensible format registration
- ๐ Automatic directive translation via reverse mapping tables
Download the latest release from GitHub Releases.
# Clone the repository
git clone https://github.com/TheAnsarya/poppy.git
cd poppy
# Build the compiler
cd src
dotnet build -c Release
# The compiler will be at: src/Poppy.CLI/bin/Release/net10.0/poppy.exeInstall the "Poppy Assembly" extension from the Visual Studio Code Marketplace for the best development experience.
# Basic assembly
poppy game.pasm # Output: game.bin
# Specify output file
poppy -o rom.nes game.pasm # Output: rom.nes
# Generate debug symbols
poppy -s game.nl game.pasm # Creates FCEUX .nl symbol file
poppy -s game.mlb game.pasm # Creates Mesen .mlb symbol file
poppy -s game.sym game.pasm # Creates generic .sym symbol file
# Generate listing file
poppy -l game.lst game.pasm # Creates symbol table listing
# Verbose output
poppy -V game.pasm # Shows compilation progress
# Target different architectures
poppy -t 6502 game.pasm # NES (default)
poppy -t 65816 game.pasm # SNES
poppy -t sm83 game.pasm # Game Boy
# Pansy metadata & roundtrip verification
poppy game.pasm -o game.nes # Auto-generates game.pansy
poppy game.pasm --no-pansy # Disable Pansy generation
poppy game.pasm --no-verify # Disable roundtrip verification
poppy game.pasm --pansy out.pansy # Custom Pansy output path
# Export to other assembler formats
poppy export game.pasm --to asar # Export to ASAR format (.asm)
poppy export game.pasm --to ca65 # Export to CA65 format (.s)
poppy export game.pasm --to xkas # Export to XKAS format (.asm)
poppy export src/ --to asar # Export entire project directory
# Genesis asset-manifest workflow (conversion + inclusion)
poppy --platform genesis src/main.pasm -o build/game.bin; Example NES ROM with iNES 2.0 header
.nes
.ines_prg 2 ; 32KB PRG ROM
.ines_chr 1 ; 8KB CHR ROM
.ines_mapper 0 ; NROM mapper
.ines_mirroring 1 ; vertical mirroring
; Constants
PPU_CTRL = $2000
PPU_MASK = $2001
PPU_STATUS = $2002
; Reset vector
.org $8000
reset:
sei
cld
ldx #$ff
txs
lda #$00
sta PPU_CTRL
sta PPU_MASK
@wait_vblank1:
bit PPU_STATUS
bpl @wait_vblank1
@wait_vblank2:
bit PPU_STATUS
bpl @wait_vblank2
main_loop:
jmp main_loop
; NMI handler
nmi:
rti
; IRQ handler
irq:
rti
; Interrupt vectors
.org $fffa
.word nmi ; NMI vector
.word reset ; Reset vector
.word irq ; IRQ/BRK vectorsubroutine1:
@local_loop: ; local to subroutine1
dex
bne @local_loop
rts
subroutine2:
@local_loop: ; different local scope
dey
bne @local_loop
rts; Forward references (+)
lda #$00
beq + ; jump to next +
lda #$01
+:
sta $2000
; Backward references (-)
-:
lda ($00),y
sta $2007
iny
bne - ; jump to previous -.include "constants.inc"
.include "macros.inc"
; Binary data inclusion
.org $a000
.incbin "graphics.chr".assert * < $8000, "Code exceeds PRG ROM bank"
.error "Not implemented yet"
.warning "TODO: Optimize this section"Check out the example projects in the examples/ directory:
- nes-hello-world - Minimal NES ROM with screen initialization
- snes-hello-world - SNES ROM with native mode setup
- gb-hello-world - Game Boy ROM displaying "HELLO" text
| Document | Description |
|---|---|
| User Manual | Complete usage guide with examples |
| Channel F Development Guide | Channel F/F8 project layout, syntax, and coding patterns |
| SNES Development Guide | Comprehensive SNES/65816 guide |
| Game Boy Development Guide | Complete GB/GBC guide with SM83 |
| Atari Lynx Guide | Atari Lynx/65C02 assembly guide |
| System Syntax Reference | Per-system .target, CLI platform commands, and baseline syntax |
| Build from Project | Nexen โ Peony โ Poppy pipeline |
| Project File Format | .poppy project configuration |
| Syntax Specification | Assembly language syntax guide |
| Document | Description |
|---|---|
| Migrating from ASAR | ASAR โ Poppy for SNES |
| Migrating from ca65 | ca65/cc65 โ Poppy for NES/SNES |
| Migrating from xkas | xkas โ Poppy for SNES |
| Migrating from RGBDS | RGBDS โ Poppy for Game Boy |
| Migrating from WLA-DX | WLA-DX โ Poppy for Z80/6502/65816 |
| Migrating from DASM | DASM โ Poppy for Atari 2600 |
| Migrating from ASM68K | ASM68K โ Poppy for Genesis |
| Migrating from devkitARM | devkitARM/GAS โ Poppy for GBA |
| Document | Description |
|---|---|
| Architecture | Compiler design and structure |
| Benchmarks | BenchmarkDotNet suite and ARM special-emission benchmark workflows |
| PASM File Format | Poppy Assembly .pasm file format specification |
| CDL/DIZ Workflow | Poppy โ Peony roundtrip workflow with CDL/DIZ files |
| File Formats | ROM and patch format reference |
| Resources | External links and research |
| Release Notes v1.0.0 | Complete v1.0.0 release summary |
| Document | Description |
|---|---|
| Roadmap | Development roadmap and milestones (v1.0 complete!) |
| v1.x Roadmap | Plans for v1.1-v1.3 (project system, assets, advanced features) |
| v2.0 Roadmap | Platform expansion (GBA, Genesis, SPC700, LSP, WASM) |
| v1.0.0 Release Report | Complete v1.0.0 release summary |
| All Plans | Architecture plans, encoding specs, issue analysis |
| Document | Description |
|---|---|
| Chat Logs | AI conversation archives |
| Session Logs | Work session summaries |
Priority compilation targets:
- Dragon Warrior 1 (NES) - Simple NES game
- Final Fantasy Mystic Quest (SNES) - Simple SNES game
- Dragon Warrior 4 (NES) - Complex NES game
- Dragon Quest 3 Remake (SNES) - Complex SNES project
lda #$40 ; immediate value
sta $2000 ; absolute address
lda $10,x ; zero page indexedstart:
lda #$01
jsr subroutine
jmp start
subroutine:
inc $10
rts.include "constants.inc"
.include "macros.inc"
; Asset with convertor (planned)
.asset "graphics.png" png2chrCurrent Version: v2.0.0 (Released 2026)
Completed:
- โ Full NES support (6502, iNES 2.0)
- โ Full SNES support (65816, LoROM/HiROM/ExHiROM)
- โ Full Game Boy support (SM83, MBC1/3/5, CGB modes)
- โ Full Atari 2600 support (6507)
- โ Full Atari Lynx support (65C02)
- โ Complete macro system with parameters
- โ Conditional assembly (.if, .ifdef, .ifndef)
- โ Include system (.include, .incbin)
- โ Debug symbol export (.sym, .nl, .mlb)
- โ Reverse converters (PASM โ ASAR/CA65/XKAS)
- โ VS Code extension (published to marketplace)
- โ Comprehensive documentation (21 guides, 5,800+ lines)
- โ Example projects for all platforms
- โ Pansy.Core integration for metadata export
- โ Bank switching support
- โ 3,185 tests passing
Planned:
- Language Server Protocol (LSP)
- Web-based compiler (WASM)
- Plugin system
See v1.x Roadmap and v2.0 Roadmap for details.
This project follows strict formatting guidelines:
- Indentation: TABS only (never spaces)
- Brace Style: K&R (opening brace on same line)
- Hexadecimal: Always lowercase with
$prefix - Assembly: Lowercase opcodes (
lda,sta,jsr) - Encoding: UTF-8 with BOM
- Line Endings: CRLF
See .github/copilot-instructions.md for complete guidelines.
Poppy is the build stage of the Flower Toolchain โ an integrated pipeline for playing, debugging, disassembling, editing, and rebuilding retro games:
| Stage | Tool | Poppy Role |
|---|---|---|
| 1. Play & Debug | Nexen | โ |
| 2. Disassemble | Peony | โ |
| 3. Edit & Document | Editor + Pansy UI | โ |
| 4. Build | Poppy | Compile .pasm โ ROM, generate Pansy metadata |
| 5. Verify | Game Garden | Roundtrip byte-identical rebuild |
See the Integrated Pipeline Master Plan for architecture details.
- Nexen - Multi-system emulator & debugger
- ๐ผ Pansy - Universal disassembly metadata format
- ๐บ Peony - Multi-system disassembler
- ๐ฑ Game Garden - Games disassembly & recompilation
- GameInfo - ROM hacking toolkit
- BPS-Patch - Binary patching system
See the LICENSE file for details (Unlicense)
Inspired by and learning from:
- ASAR - SNES patching assembler
- XKAS - SNES assembler
- Ophis - 6502 assembler
- ca65 - Part of cc65 suite
๐ธ Poppy - Making retro game development bloom