Skip to content

Commit e7e99b6

Browse files
committed
Get rid of STRICTVIP and drawQuirk
1 parent 499e52c commit e7e99b6

File tree

5 files changed

+13
-43
lines changed

5 files changed

+13
-43
lines changed

docs/index.html

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,14 @@ <h3>Interpreter type</h3>
5353
</label>
5454
<label>
5555
<input type="radio" class="nes-radio is-dark" name="interpreter" value="1">
56-
<span>Strict VIP</span>
57-
</label>
58-
<label>
59-
<input type="radio" class="nes-radio is-dark" name="interpreter" value="2">
6056
<span>VIP</span>
6157
</label>
6258
<label>
63-
<input type="radio" class="nes-radio is-dark" name="interpreter" value="4">
59+
<input type="radio" class="nes-radio is-dark" name="interpreter" value="3">
6460
<span>SCHIP</span>
6561
</label>
6662
<label>
67-
<input type="radio" class="nes-radio is-dark" name="interpreter" value="5">
63+
<input type="radio" class="nes-radio is-dark" name="interpreter" value="4">
6864
<span>XO-CHIP</span>
6965
</label>
7066
</div>

shared/types.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
module.exports = {
2-
AUTO: 0,
3-
STRICTVIP: 1, // Note that these two halt for display refresh, use BLINDVIP
4-
VIP: 2, // instead for headless testing
5-
BLINDVIP: 3,
6-
SCHIP: 4,
7-
XOCHIP: 5
2+
AUTO: 0, // Note that this one halts for display refresh, use BLINDVIP
3+
VIP: 1, // instead for headless testing
4+
BLINDVIP: 2,
5+
SCHIP: 3,
6+
XOCHIP: 4
87
};

src/silicon8/cpu.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ func (cpu *CPU) Reset(interpreter int) {
7171
}
7272

7373
switch interpreter {
74-
case STRICTVIP:
75-
cpu.RAMSize = STRICTVIP_RAM_SIZE
76-
cpu.stackSize = DEFAULT_STACK_SIZE
7774
case VIP, BLINDVIP:
7875
cpu.RAMSize = VIP_SCHIP_RAM_SIZE
7976
cpu.stackSize = DEFAULT_STACK_SIZE
@@ -134,10 +131,9 @@ func (cpu *CPU) setQuirks() {
134131
cpu.shiftQuirk = cpu.specType == SCHIP
135132
cpu.jumpQuirk = cpu.specType == SCHIP
136133
cpu.memQuirk = cpu.specType != SCHIP
137-
cpu.vfQuirk = cpu.specType == VIP || cpu.specType == STRICTVIP || cpu.specType == BLINDVIP
134+
cpu.vfQuirk = cpu.specType == VIP || cpu.specType == BLINDVIP
138135
cpu.clipQuirk = cpu.specType != XOCHIP
139-
cpu.dispQuirk = cpu.specType == VIP || cpu.specType == STRICTVIP
140-
cpu.drawQuirk = cpu.specType == STRICTVIP
136+
cpu.dispQuirk = cpu.specType == VIP
141137
}
142138

143139
func (cpu *CPU) DumpStatus() {
@@ -157,7 +153,6 @@ func (cpu *CPU) DumpStatus() {
157153
println(" vfQuirk: ", cpu.vfQuirk)
158154
println(" clipQuirk: ", cpu.clipQuirk)
159155
println(" dispQuirk: ", cpu.dispQuirk)
160-
println(" drawQuirk: ", cpu.drawQuirk)
161156
}
162157

163158
func (cpu *CPU) bumpSpecType(newType int) {

src/silicon8/display.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ func (cpu *CPU) draw(x, y, n uint8 ) {
120120

121121
cpu.SD = true
122122
cpu.setFlag(erases)
123-
cpu.messUpRegisters(x, y)
124123
if n == 0 {
125124
cpu.bumpSpecType(SCHIP)
126125
}
@@ -169,22 +168,6 @@ func (cpu *CPU) drawLine(ramPointer uint16, planeBufPointer uint16, plane uint8)
169168
return erases
170169
}
171170

172-
func (cpu *CPU) messUpRegisters(x, y uint8) {
173-
if !cpu.drawQuirk {
174-
return
175-
}
176-
177-
/**
178-
* "First is that I, VX and VY are all altered by this routine, so the
179-
* Chip-8 programmer should not expect them to be available for reuse with
180-
* their original values. These would have to be explicitly set again."
181-
* -- https://laurencescotford.com/chip-8-on-the-cosmac-vip-drawing-sprites/
182-
**/
183-
cpu.i = 0
184-
cpu.v[x] = 0
185-
cpu.v[y] = 0
186-
}
187-
188171
func (cpu *CPU) initDisplay(width uint16, height uint16, planes uint8) {
189172
cpu.DispWidth = width
190173
cpu.DispHeight = height

src/silicon8/types.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
package silicon8
22

33
const AUTO int = 0
4-
const STRICTVIP int = 1
5-
const VIP int = 2
6-
const BLINDVIP int = 3 // To run the emulator in headless VIP mode, which doesn't wait for display refresh
7-
const SCHIP int = 4
8-
const XOCHIP int = 5
4+
const VIP int = 1
5+
const BLINDVIP int = 2 // To run the emulator in headless VIP mode, which doesn't wait for display refresh
6+
const SCHIP int = 3
7+
const XOCHIP int = 4
98

10-
const STRICTVIP_RAM_SIZE uint16 = 3216 + 512
119
const VIP_SCHIP_RAM_SIZE uint16 = 3583 + 512
1210
const XOCHIP_RAM_SIZE uint16 = 65023 + 512
1311
const DEFAULT_STACK_SIZE uint8 = 12
@@ -62,7 +60,6 @@ type CPU struct {
6260
vfQuirk bool // vF is cleared after OR, AND and XOR opcodes
6361
clipQuirk bool // Sprites are clipped instead of wrapped at edges of display
6462
dispQuirk bool // Halt for display refresh before drawing sprite
65-
drawQuirk bool // Draw instruction messes up i, v[x] and v[y]
6663

6764
// External event handlers
6865
playSound playSoundEvent

0 commit comments

Comments
 (0)