-
Notifications
You must be signed in to change notification settings - Fork 0
/
HyperWaveCHIP-64 Extension docs.txt
91 lines (50 loc) · 4.25 KB
/
HyperWaveCHIP-64 Extension docs.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
HyperWaveCHIP-64 specification Version 1.1
By oxiti8
This extension builds off of HYPERCHIP-64, which builds off of XO-CHIP 1.1. At minimum, an XO-CHIP 1.1 implementation is required to implement HyperWaveCHIP-64.
In HyperWaveCHIP-64 1.1, 4 draw planes can be used for a total of 16 colors on screen at once. This is inherited from HYPERCHIP-64. NEW instructions are as follows:
00En RANGE:
00E1: INVERT :: Flip all pixel bits of the currently selected display plane. Effectively inverts the entire plane(s).
00Fn RANGE:
00F1: OR MODE :: Change the pixel paint mode to OR. Draws will only result in pixels being turned on, not off. Collision occurs as usual.
00F2: SUBTRACT MODE :: Change the pixel paint mode to SUBTRACT. Draws will only result in pixels being turned off instead. Collision occurs as usual.
00F3: XOR MODE :: Change the pixel paint mode to XOR. Draws will invert on and off pixels accordingly. Collision occurs as usual. This is the default drawing mode.
5XYn RANGE:
5XY1: SKP VX > VY :: Skip next instruction if VX > VY. Will also skip over the F000/F100/F200/F300 instructions. Inherited from CHIP-8E.
8XYn RANGE:
8XYC: MULT VX, VY :: Set VX = VX * VY, VF = carry. You multiply VX with VY, then set the 8 low bits of the product to VX, and any high bits to VF.
8XYD: DIV VX, VY :: VX = VX / VY. VF = VX % VY. If VY is 0, set both VX and VF to 0. Prevents division by zero.
8XYF: DIV VY, VX :: VX = VY / VX. VF = VY % VX. If VY is 0, set both VX and VF to 0. Prevents division by zero.
FXnn RANGE:
FN03: PALETTE N :: Set color of palette X to 3-byte (24-bit) color from memory at I, I+1, I+2.
FX1F: SUB I, VX :: I = I - VX. Subtracts VX from I. The inverse of FX1E. (HWC-64 1.1)
Fn00 RANGE:
F100 NNNN: LONG JUMP :: Set PC to NNNN.
F200 NNNN: LONG CALL SUBROUTINE :: Store PC in stack, then set PC to NNNN.
F300 NNNN: LONG JUMP0 :: Set PC to NNNN + V0.
IMPORTANT:
- Skip instructions should double skip over F100, F200, and F300 in the same way as they double skip over F000 in XO-CHIP.
- FN01 (plane N) must allow for values of N ranging from 0-15 instead of just 0-3 to allow for 4 planes and 16 colors - a chart showing what colors correspond to what planes is provided below:
╭────────────────────── COLOR ──────────────────────╮
│ 1 2 3 4 5 6 7 8 9 A B C D E F │
│ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ │
B 1. o o o o o o o o │
I 2. o o o o o o o o │
T 3. o o o o o o o o │
S 4. o o o o o o o o │
╰───────────────────────────────────────────────────╯
For FN03, the value of N (0..15) represents which palette is being modified. Here's a guide:
N = 0: The palette used for the Background color (Background in Octo)
N = 1: The palette for Plane 1 only (Foreground 1 in Octo)
N = 2: The palette for Plane 2 only (Foreground 2 in Octo)
N = 3: The palette for Plane 1 + Plane 2 (Blended in Octo)
N = 4: The palette for Plane 3 only
N = 5: The palette for Plane 1 + Plane 3
...
N = 15: The palette for Plane 1 + Plane 2 + Plane 3 + Plane 4
The structure of the opcode allows for 4 bitplanes and 16 colors maximum. The actual color data itself is stored sequentially as 3 bytes, one for each color channel, allowing for full 8-bit color depth.
Accessing the bytes in memory that contain the color data is handled much like how you would handle accessing sprite or audio sample data. Here is an example in Octo:
: main
i := green # i points to the location of the color data in memory.
0xF0 0x03 # FN03. N is 0, so the background palette is selected to be modified, and the palette for the background is set to the RRGGBB value stored at i in memory (In this case, 0x00 0xFF 0x00, the color green. The palette used for the background is changed to #00FF00.)
: green
0x00 0xFF 0x00 # RRGGBB format color data.