Skip to content

Instantly share code, notes, and snippets.

@migerh
Created April 26, 2012 07:22
Show Gist options
  • Save migerh/2497117 to your computer and use it in GitHub Desktop.
Save migerh/2497117 to your computer and use it in GitHub Desktop.
1.3 to 1.4 diff
diff --git a/dcpu b/dcpu
index 56bcc78..dd8cbf7 100644
--- a/dcpu
+++ b/dcpu
@@ -1,6 +1,6 @@
DCPU-16 Specification
Copyright 1985 Mojang
-Version 1.3
+Version 1.4
@@ -68,7 +68,7 @@ DESCRIPTION is a short text that describes the opcode or value.
--- Basic opcodes (5 bits) ----------------------------------------------------
C | VAL | NAME | DESCRIPTION
----+------+----------+--------------------------------------------------------
+---+------+----------+---------------------------------------------------------
- | 0x00 | n/a | special instruction - see below
1 | 0x01 | SET b, a | sets b to a
2 | 0x02 | ADD b, a | sets b to b+a, sets EX to 0x0001 if there's an overflow,
@@ -90,7 +90,7 @@ DESCRIPTION is a short text that describes the opcode or value.
2 | 0x0d | ASR b, a | sets b to b>>a, sets EX to ((b<<16)>>>a)&0xffff
| | | (arithmetic shift) (treats b as signed)
2 | 0x0e | SHL b, a | sets b to b<<a, sets EX to ((b<<a)>>16)&0xffff
- 2 | 0x0f | MVI b, a | sets b to a, then increases I and J by 1
+ 2 | 0x0f | STI b, a | sets b to a, then increases I and J by 1
2+| 0x10 | IFB b, a | performs next instruction only if (b&a)!=0
2+| 0x11 | IFC b, a | performs next instruction only if (b&a)==0
2+| 0x12 | IFE b, a | performs next instruction only if b==a
@@ -103,24 +103,25 @@ DESCRIPTION is a short text that describes the opcode or value.
- | 0x19 | - |
3 | 0x1a | ADX b, a | sets b to b+a+EX, sets EX to 0x0001 if there is an over-
| | | flow, 0x0 otherwise
- 3 | 0x1b | SUX b, a | sets b to b-a+EX, sets EX to 0xFFFF if there is an under-
+ 3 | 0x1b | SBX b, a | sets b to b-a+EX, sets EX to 0xFFFF if there is an under-
| | | flow, 0x0 otherwise
- - | 0x1c | - |
+ - | 0x1c | - |
- | 0x1d | - |
- | 0x1e | - |
- | 0x1f | - |
---+------+----------+----------------------------------------------------------
* The branching opcodes take one cycle longer to perform if the test fails
+ When they skip an if instruction, they will skip an additional instruction
+ at the cost of one extra cycle. This lets you easily chain conditionals.
* Signed numbers are represented using two's complement.
-
Special opcodes always have their lower five bits unset, have one value and a
five bit opcode. In binary, they have the format: aaaaaaooooo00000
The value (a) is in the same six bit format as defined earlier.
---- Special opcodes: (6 bits) --------------------------------------------------
+--- Special opcodes: (5 bits) --------------------------------------------------
C | VAL | NAME | DESCRIPTION
---+------+-------+-------------------------------------------------------------
- | 0x00 | n/a | reserved for future expansion
@@ -131,7 +132,7 @@ The value (a) is in the same six bit format as defined earlier.
- | 0x04 | - |
- | 0x05 | - |
- | 0x06 | - |
- - | 0x07 | - |
+ 9 | 0x07 | HCF a | use sparingly
4 | 0x08 | INT a | triggers a software interrupt with message a
1 | 0x09 | IAG a | sets a to IA
1 | 0x0a | IAS a | sets IA to a
@@ -142,9 +143,9 @@ The value (a) is in the same six bit format as defined earlier.
- | 0x0f | - |
2 | 0x10 | HWN a | sets a to number of connected hardware devices
4 | 0x11 | HWQ a | sets A, B, C, X, Y registers to information about hardware a
- | | | a+b is a 32 bit word identifying the hardware type
- | | | c is the hardware revision
- | | | x+y is a 32 bit word identifying the manufacturer
+ | | | A+(B<<16) is a 32 bit word identifying the hardware id
+ | | | C is the hardware version
+ | | | X+(Y<<16) is a 32 bit word identifying the manufacturer
4+| 0x12 | HWI a | sends an interrupt to hardware a
- | 0x13 | - |
- | 0x14 | - |
@@ -186,7 +187,7 @@ reliably prevent multiple concurrent interrupts.
=== HARDWARE ===================================================================
-The DCPU-16 supports up to 65536 connected hardware devices. These devices can
+The DCPU-16 supports up to 65535 connected hardware devices. These devices can
be anything from additional storage, sensors, monitors or speakers.
How to control the hardware is specified per hardware device, but the DCPU-16
supports a standard enumeration method for detecting connected hardware via
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment