Switch branches/tags
Nothing to show
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
README.md
doc.go
main.go
sourcecache.go
version.go

README.md

DCPU AR

The ar command performs various operations on compiled archives.

One of which dumps its contents to stdout in human-readable form. Thus allowing us to examine it more closely. This is mostly useful for debugging purposes on my part.

Another options lets us extract all DCPU binary code into a separate file, allowing us to load a program into other emulators.

A third option dumps each instruction to stdout, along with source context. For example:

$ dcpu-ar -src dcpu
  PC INST     OP    A    B   FILE & SOURCE
===============================================================================
0000 ffff | 001f 001f 003f | m35fd.dasm:6 :M35fd dat -1
0001 ffff | 001f 001f 003f | sped3.dasm:6 :Sped3 dat -1
0002 ffff | 001f 001f 003f | keyboard.dasm:6 :Keyboard dat -1
0003 ffff | 001f 001f 003f | clock.dasm:6 :Clock dat -1
0004 ffff | 001f 001f 003f | spc2000.dasm:6 :Spc2000 dat -1
0005 ffff | 001f 001f 003f | lem1802.dasm:6 :Lem1802 dat -1
0006 1701 | 0001 0018 0005 | bootstrap.dasm:10 func Bootstrap {
0007 0f01 | 0001 0018 0003 | bootstrap.dasm:10 func Bootstrap {
0008 1301 | 0001 0018 0004 | bootstrap.dasm:10 func Bootstrap {
0009 1600 | 0000 0010 0005 | bootstrap.dasm:11 	hwn z
000a 88a3 | 0003 0005 0022 | bootstrap.dasm:12 	sub z, 1
000b 1620 | 0000 0011 0005 | bootstrap.dasm:15 	hwq z
000c 7c12 | 0012 0000 001f | bootstrap.dasm:18 	ife a, 0xb402
000d b402 | 0002 0000 002d | bootstrap.dasm:18 	ife a, 0xb402
000e 7c32 | 0012 0001 001f | bootstrap.dasm:19 		ife b, 0x12d0
000f 12d0 | 0010 0016 0004 | bootstrap.dasm:19 		ife b, 0x12d0
0010 17c1 | 0001 001e 0005 | bootstrap.dasm:20 			set [Clock], z
0011 0003 | 0003 0000 0000 | bootstrap.dasm:20 			set [Clock], z
...

As can be seen, some source lines appear multiple times. This is because some instructions generate multiple words.

The INST column shows the value at the memory address denoted by PC. The OP, A and B columns show the opcode and the instruction operands. The last column shows the source file, line and actual code for the given instruction.

License

DCPU, 0x10c and related materials are Copyright 2012 Mojang.

Unless otherwise stated, all of the work in this project is subject to a 1-clause BSD license. Its contents can be found in the enclosed LICENSE file.