// File: /workspace/github_c_makefile_star2_O0/calmopyrin[P]tedplay/Sid.cpp
// Function: SIDsound::reset()
void SIDsound::reset(void)
{
	volume = masterVolume;

	lastByteWritten = 0;

	for (int v=0; v<3; v++) {
		voice[v].wave = WAVE_NONE;
		voice[v].egState = EG_FROZEN;
		voice[v].accu = 0;
		voice[v].freq = voice[v].pw = 0;
		voice[v].envCurrLevel = voice[v].envSustainLevel = 0;
		voice[v].gate = voice[v].ring = voice[v].test = 0;
		voice[v].filter = voice[v].sync = 0;
		voice[v].muted = 0;
		// Initial value of internal shift register
		voice[v].shiftReg = 0x7FFFFC;
		voice[v].envExpCounter = 0;
		voice[v].envAttackAdd = voice[v].envDecaySub = voice[v].envReleaseSub = 0;
		voice[v].envCounterCompare = 0;
		voice[v].envCounter = 0x7fff;
	}

	filterType = FILTER_NONE;
	filterCutoff = filterResonance = 0;

	Vhp = Vbp = Vlp = 0;
	setFilterCutoff();
	setResonance();

	dcDigiBlaster = 0;
	clockDeltaRemainder = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movl 0x21202(%rip), %ecx     # 0x358ac
movl %ecx, 0x170(%rax)
movb $0x0, 0x41b4(%rax)
movl $0x0, -0xc(%rbp)
cmpl $0x3, -0xc(%rbp)
jge 0x148cb
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movslq -0xc(%rbp), %rdx
imulq $0x78, %rdx, %rdx
addq %rdx, %rcx
movl $0x0, 0x4(%rcx)
movq %rax, %rcx
addq $0x8, %rcx
movslq -0xc(%rbp), %rdx
imulq $0x78, %rdx, %rdx
addq %rdx, %rcx
movl $0x0, 0x8(%rcx)
movq %rax, %rcx
addq $0x8, %rcx
movslq -0xc(%rbp), %rdx
imulq $0x78, %rdx, %rdx
addq %rdx, %rcx
movl $0x0, 0x20(%rcx)
movq %rax, %rcx
addq $0x8, %rcx
movslq -0xc(%rbp), %rdx
imulq $0x78, %rdx, %rdx
addq %rdx, %rcx
movl $0x0, 0x34(%rcx)
movq %rax, %rcx
addq $0x8, %rcx
movslq -0xc(%rbp), %rdx
imulq $0x78, %rdx, %rdx
addq %rdx, %rcx
movl $0x0, 0x30(%rcx)
movq %rax, %rcx
addq $0x8, %rcx
movslq -0xc(%rbp), %rdx
imulq $0x78, %rdx, %rdx
addq %rdx, %rcx
movl $0x0, 0x40(%rcx)
movq %rax, %rcx
addq $0x8, %rcx
movslq -0xc(%rbp), %rdx
imulq $0x78, %rdx, %rdx
addq %rdx, %rcx
movl $0x0, 0x48(%rcx)
movq %rax, %rcx
addq $0x8, %rcx
movslq -0xc(%rbp), %rdx
imulq $0x78, %rdx, %rdx
addq %rdx, %rcx
movl $0x0, 0x60(%rcx)
movq %rax, %rcx
addq $0x8, %rcx
movslq -0xc(%rbp), %rdx
imulq $0x78, %rdx, %rdx
addq %rdx, %rcx
movl $0x0, 0x5c(%rcx)
movq %rax, %rcx
addq $0x8, %rcx
movslq -0xc(%rbp), %rdx
imulq $0x78, %rdx, %rdx
addq %rdx, %rcx
movl $0x0, 0x58(%rcx)
movq %rax, %rcx
addq $0x8, %rcx
movslq -0xc(%rbp), %rdx
imulq $0x78, %rdx, %rdx
addq %rdx, %rcx
movl $0x0, 0x70(%rcx)
movq %rax, %rcx
addq $0x8, %rcx
movslq -0xc(%rbp), %rdx
imulq $0x78, %rdx, %rdx
addq %rdx, %rcx
movl $0x0, 0x64(%rcx)
movq %rax, %rcx
addq $0x8, %rcx
movslq -0xc(%rbp), %rdx
imulq $0x78, %rdx, %rdx
addq %rdx, %rcx
movl $0x0, 0x68(%rcx)
movq %rax, %rcx
addq $0x8, %rcx
movslq -0xc(%rbp), %rdx
imulq $0x78, %rdx, %rdx
addq %rdx, %rcx
movl $0x7ffffc, 0x28(%rcx)   # imm = 0x7FFFFC
movq %rax, %rcx
addq $0x8, %rcx
movslq -0xc(%rbp), %rdx
imulq $0x78, %rdx, %rdx
addq %rdx, %rcx
movl $0x0, 0x50(%rcx)
movq %rax, %rcx
addq $0x8, %rcx
movslq -0xc(%rbp), %rdx
imulq $0x78, %rdx, %rdx
addq %rdx, %rcx
movl $0x0, 0x44(%rcx)
movq %rax, %rcx
addq $0x8, %rcx
movslq -0xc(%rbp), %rdx
imulq $0x78, %rdx, %rdx
addq %rdx, %rcx
movl $0x0, 0x3c(%rcx)
movq %rax, %rcx
addq $0x8, %rcx
movslq -0xc(%rbp), %rdx
imulq $0x78, %rdx, %rdx
addq %rdx, %rcx
movl $0x0, 0x38(%rcx)
movq %rax, %rcx
addq $0x8, %rcx
movslq -0xc(%rbp), %rdx
imulq $0x78, %rdx, %rdx
addq %rdx, %rcx
movl $0x0, 0x54(%rcx)
addq $0x8, %rax
movslq -0xc(%rbp), %rcx
imulq $0x78, %rcx, %rcx
addq %rcx, %rax
movl $0x7fff, 0x4c(%rax)     # imm = 0x7FFF
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x146be
movq -0x18(%rbp), %rdi
movb $0x0, 0x194(%rdi)
movb $0x0, 0x19c(%rdi)
movl $0x0, 0x198(%rdi)
movl $0x0, 0x41b0(%rdi)
movl $0x0, 0x41ac(%rdi)
movl $0x0, 0x41a8(%rdi)
callq 0x15170
movq -0x18(%rbp), %rdi
callq 0x15240
movq -0x18(%rbp), %rax
movl $0x0, 0x18c(%rax)
movl $0x0, 0x178(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)