Skip to content

Commit 66543bd

Browse files
committed
MDF4K autostart: don't read controller at all
MDFourier 4K autostart is meant to behave as much like the NSF as possible. - Someone might make a dedicated cartridge of MDF4K for use on a disassembled console under repair with empty controller ports. - I received an anecdotal report that at least one emulator developer implemented audio before input and NROM before NSF. - Because some console models pass audio and controller signals through the same inverter amplifier, checking for the B Button during the test can be heard as buzzing. The new sequence for autostart is as follows: 1. Show title screen for 1 second, to distinguish a bootup failure from muted audio. There are concerns that this may not be long enough to get picky modern displays to synchronize to the signal. 2. Run the test and disregard input. 3. Show title screen until power off or reset.
1 parent a1c5c44 commit 66543bd

4 files changed

Lines changed: 69 additions & 43 deletions

File tree

nes/makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ objlist:=vwf7 zappertest overclock paldetect vwf_draw init \
2525
objlistnsf := mdfouriernsf mdfourier ntscPeriods
2626
objlistmdf4k := mdfourier4kfe mdfourier padsnodas ntscPeriods
2727
objlistmdf4kchr := mdfourier4kfe-chrrom mdfourier padsnodas ntscPeriods
28-
objlistmdf4kauto := mdfourier4kfe-autostart mdfourier padsnodas ntscPeriods
29-
objlistmdf4kchrauto := mdfourier4kfe-chrrom-autostart mdfourier padsnodas ntscPeriods
28+
objlistmdf4kauto := mdfourier4kfe-autostart mdfourier ntscPeriods
29+
objlistmdf4kchrauto := mdfourier4kfe-chrrom-autostart mdfourier ntscPeriods
3030

3131
AS65:=ca65
3232
LD65:=ld65

nes/mdfourier4k-chrrom.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ SEGMENTS {
2323

2424
INESHDR: load = HEADER, type = ro, align = $10;
2525
DMC: load = ROMF0, type = ro, align = 64, optional = yes;
26-
LIBCODE: load = ROMF0, type = ro;
26+
LIBCODE: load = ROMF0, type = ro, optional = yes;
2727
CODE: load = ROMF0, type = ro, align = $20;
2828
RODATA: load = ROMF0, type = ro;
2929

nes/mdfourier4k.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ SEGMENTS {
2222

2323
INESHDR: load = HEADER, type = ro, align = $10;
2424
DMC: load = ROMF0, type = ro, align = 64, optional = yes;
25-
LIBCODE: load = ROMF0, type = ro;
25+
LIBCODE: load = ROMF0, type = ro, optional = yes;
2626
CODE: load = ROMF0, type = ro, align = $20;
2727
RODATA: load = ROMF0, type = ro;
2828

nes/src/mdfourier4kfe.s

Lines changed: 65 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
; and can affect noise
2424
MDF_PA13_HIGH = 1
2525

26+
MDF4K_AUTOSTART_DELAY = 60
27+
2628
test_good_phase := test_state+6
2729

2830
OAM := $0200 ; for synced reads
@@ -111,15 +113,58 @@ irq_handler:
111113
sta mdfourier_good_phase
112114
lda #VBLANK_NMI
113115
sta PPUCTRL
114-
.ifdef ::MDF4K_AUTOSTART
115-
jmp autostart_entry_point
116-
.else
116+
.ifndef ::MDF4K_AUTOSTART
117117
jsr mdfourier_ready_tone
118118
.endif
119119

120120
restart:
121121
jsr mdfourier_init_apu
122122
jsr mdfourier_push_apu
123+
jsr mdf4k_draw_title
124+
125+
.ifdef ::MDF4K_AUTOSTART
126+
ldy #MDF4K_AUTOSTART_DELAY
127+
titlewait:
128+
jsr vsync
129+
dey
130+
bne titlewait
131+
.else
132+
; Wait for A press
133+
keywait:
134+
jsr read_pads
135+
jsr vsync
136+
lda new_keys
137+
bpl keywait
138+
.endif
139+
140+
autostart_entry_point:
141+
; reduce interference from the PPU as far as we possibly can
142+
ldy #$3F
143+
lda #$00
144+
ldx #$0D
145+
sta PPUMASK
146+
sty PPUADDR
147+
sta PPUADDR
148+
stx PPUDATA
149+
sta PPUADDR
150+
sta PPUADDR
151+
152+
.if ::MDF_PA13_HIGH
153+
ldx #$20
154+
stx PPUADDR
155+
sta PPUADDR
156+
.endif
157+
jsr mdfourier_run
158+
159+
.ifdef ::MDF4K_AUTOSTART
160+
jsr mdf4k_draw_title
161+
forever: jmp forever
162+
.else
163+
jmp restart
164+
.endif
165+
.endproc
166+
167+
.proc mdf4k_draw_title
123168
lda #VBLANK_NMI
124169
sta PPUCTRL
125170
asl a
@@ -212,33 +257,7 @@ have_phase_xy:
212257
sta PPUSCROLL
213258
lda #BG_ON
214259
sta PPUMASK
215-
216-
; Wait for A press
217-
keywait:
218-
jsr read_pads
219-
jsr vsync
220-
lda new_keys
221-
bpl keywait
222-
223-
autostart_entry_point:
224-
; reduce interference from the PPU as far as we possibly can
225-
ldy #$3F
226-
lda #$00
227-
ldx #$0D
228-
sta PPUMASK
229-
sty PPUADDR
230-
sta PPUADDR
231-
stx PPUDATA
232-
sta PPUADDR
233-
sta PPUADDR
234-
235-
.if ::MDF_PA13_HIGH
236-
ldx #$20
237-
stx PPUADDR
238-
sta PPUADDR
239-
.endif
240-
jsr mdfourier_run
241-
jmp restart
260+
rts
242261
.endproc
243262

244263
.proc write_4y_of_a
@@ -261,14 +280,21 @@ autostart_entry_point:
261280
.endproc
262281

263282
.proc mdfourier_present
264-
bit new_keys
265-
bvc no_B_press
266-
lda mdfourier_good_phase
267-
sta test_good_phase
268-
rts
269-
no_B_press:
270-
jsr vsync
271-
jsr sync_read_b_button
283+
.ifdef ::MDF4K_AUTOSTART
284+
jsr vsync
285+
lda #0
286+
sta new_keys
287+
sta cur_keys
288+
.else
289+
bit new_keys
290+
bvc no_B_press
291+
lda mdfourier_good_phase
292+
sta test_good_phase
293+
rts
294+
no_B_press:
295+
jsr vsync
296+
jsr sync_read_b_button
297+
.endif
272298
jmp mdfourier_push_apu
273299
.endproc
274300

@@ -290,4 +316,4 @@ chrdata_end:
290316

291317
.rodata
292318
uipalette: .byte $0F, $20, $0F, $20, $0F, $0F, $10, $10
293-
uipalette_end:
319+
uipalette_end:

0 commit comments

Comments
 (0)