{"id":20912507,"url":"https://github.com/fogleman/dcpu-16","last_synced_at":"2025-07-09T23:10:02.507Z","repository":{"id":3060263,"uuid":"4082433","full_name":"fogleman/DCPU-16","owner":"fogleman","description":"Python scripts for DCPU-16 emulation.","archived":false,"fork":false,"pushed_at":"2013-04-20T18:35:02.000Z","size":1599,"stargazers_count":70,"open_issues_count":4,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-12T22:29:58.324Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"DCPU-16 ASM","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fogleman.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-04-20T02:36:08.000Z","updated_at":"2024-03-15T22:53:43.000Z","dependencies_parsed_at":"2022-09-12T13:30:59.988Z","dependency_job_id":null,"html_url":"https://github.com/fogleman/DCPU-16","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/fogleman/DCPU-16","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fogleman%2FDCPU-16","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fogleman%2FDCPU-16/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fogleman%2FDCPU-16/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fogleman%2FDCPU-16/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fogleman","download_url":"https://codeload.github.com/fogleman/DCPU-16/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fogleman%2FDCPU-16/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264505016,"owners_count":23618877,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T14:27:53.504Z","updated_at":"2025-07-09T23:10:02.198Z","avatar_url":"https://github.com/fogleman.png","language":"DCPU-16 ASM","funding_links":[],"categories":[],"sub_categories":[],"readme":"## DCPU-16 Emulator v1.7\n\n### Download (Windows Installer)\n\nSee the downloads page:\n\nhttps://github.com/fogleman/DCPU-16/downloads\n\n### Implemented Specifications\n\n- DCPU-16 1.7: http://pastebin.com/raw.php?i=Q4JvQvnM\n- LEM1802: http://dcpu.com/highnerd/rc_1/lem1802.txt\n- Generic Keyboard: http://dcpu.com/highnerd/rc_1/keyboard.txt\n- Generic Clock: http://dcpu.com/highnerd/rc_1/clock.txt\n\n### Screenshots\n\n![](https://raw.github.com/fogleman/DCPU-16/master/screenshots/debug.png)\n\n![](https://raw.github.com/fogleman/DCPU-16/master/screenshots/syntax.png)\n\n![](https://raw.github.com/fogleman/DCPU-16/master/screenshots/nyan.gif)\n\n### Assembler Features\n\n```dasm\n; Macros (can be nested)\n#macro BRK { NOP } ; ignore breakpoints\n\n#macro push(x) {\n  SET PUSH x\n}\n\n; String Literals\nDAT \"Here is some text.\", 0 ; null-terminated string\n\n; Reserve block of memory\nRESERVE 0xff\n\n; Character Literals\nSET A 'a' ; A = 0x61\nSET B 'A' ; B = 0x41\n\n; Negative Numbers\nSET A -1    ; A = 0xffff\nSET B -0xff ; B = 0xff01\n\n; Breakpoints\nBRK\n\n; Opcode Aliases\nSET A POP\nSET A [SP++] ; equivalent to POP\n\nSET PUSH A\nSET [--SP] A ; equivalent to PUSH\n\nSET A PICK 1\nSET A [SP + 1] ; equivalent to PICK 1\n\nSET A PEEK\nSET A [SP] ; equivalent to PEEK\n\n; Local Labels\n:prefix\n  SET A 10\n:.loop ; becomes prefix.loop\n  SUB A 1\n  IFE A 0\n    SET PC .done\n  SET PC .loop\n:.done ; becomes prefix.done\n\n; Fixed Labels\n:screen @ 0x8000\n```\n\n### Hardware Enumeration\n\nThe following code enumerates available hardware devices and populates the variables lem, keyboard and clock with their respective hardware identifiers.\n\n```dasm\n#macro match_hardware(a, b, location) {\n    IFE A a\n    IFE B b\n    SET [location] I\n}\n\nJSR enumerate_hardware\n\n; now you can use the devices, e.g.\nSET A 0\nSET B 0x8000\nHWI [lem]\n\nBRK\n\n:enumerate_hardware\nHWN I\n:.loop\nIFE I 0\nSET PC .done\nSUB I 1\nHWQ I\nmatch_hardware(0xf615, 0x7349, lem)\nmatch_hardware(0x7406, 0x30cf, keyboard)\nmatch_hardware(0xb402, 0x12d0, clock)\nSET PC .loop\n:.done\nSET PC POP\n\n:lem\nDAT -1\n:keyboard\nDAT -1\n:clock\nDAT -1\n```\n\n### Benchmarks\n\n    Usage: python benchmark.py\n\nRun benchmarks on the emulator to test performance.\n\nMacBook Air (1.7 GHz Intel Core i5)\n\n    Benchmarking \"C\" emulator using \"programs/life.dasm\"...\n    Result: 88728989 cycles per second\n\nThe C implementation could emulate over 800 DCPU-16 processors at their 100 kHz clock rate.\n\n### Pretty Print\n\n    Usage: python assembler.py programs/example.dasm \u003e pretty_output.dasm\n\nAssemble and output in pretty format. Shows machine code in comments. Comments from the input file are not retained.\n\n```dasm\n    SET A, 48                   ; 7c01 0030\n    SET [0x1000], 32            ; 7de1 1000 0020\n    SUB A, [0x1000]             ; 7803 1000\n    IFN A, 16                   ; c00d\n        SET PC, crash           ; 7dc1 001a\n    SET I, 10                   ; a861\n    SET A, 0x2000               ; 7c01 2000\n:loop\n    SET [I + 0x2000], [A]       ; 2161 2000\n    SUB I, 1                    ; 8463\n    IFN I, 0                    ; 806d\n        SET PC, loop            ; 7dc1 000d\n    SET X, 4                    ; 9031\n    JSR testsub                 ; 7c10 0018\n    SET PC, crash               ; 7dc1 001a\n:testsub\n    SHL X, 4                    ; 9037\n    SET PC, POP                 ; 61c1\n:crash\n    SET PC, crash               ; 7dc1 001a\n```\n\n### Dependencies\n- **Python 2.5+**: http://www.python.org/\n- **PLY**: http://www.dabeaz.com/ply/\n- **wxPython**: http://www.wxpython.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffogleman%2Fdcpu-16","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffogleman%2Fdcpu-16","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffogleman%2Fdcpu-16/lists"}