Page 1 of 1

Help in understanding 7-dmc_basics.nes - test 19

Posted: Thu Oct 08, 2020 7:55 pm
by selassje

Looking at the code of that test :

Code: Select all

set_test 19,"There should be a one-byte buffer that's filled immediately if empty"
	setb $4013,1
	setb SNDCHN,$10
	lda #$10
:       and $4015
	bne :-
	delay_dmc 4
	delay 30
	setb $4013,0
	setb SNDCHN,$10
	lda $4015
	and #$90
	cmp #$80
	jne test_failed 
        setb SNDCHN,$10
	jsr should_be_playing
	delay_dmc 4
	jsr should_be_silent
	jmp tests_passed

The test expects DMC to be running but from my understanding. the sample buffer will immediately consume the single byte, after running the last setb "SNDCHN,$10" instruction, making bytes_remaining == 0. And according to Wiki, bytes_remaining need to be > 0 to read DMC flag in $4015 as set.