// File: /workspace/github_c_makefile_star2_O0/calmopyrin[P]tedplay/Tedmem.cpp
// Function: TED::TED()
TED::TED() : filter(0), sidCard(0)
{
	unsigned int i;

	instance_ = this;
	// clearing cartdridge ROMs
	for (i=0;i<4;++i) {
		memset(&(RomHi[i]),0,ROMSIZE);
		memset(&(RomLo[i]),0,ROMSIZE);
		memset(romlopath,0,sizeof(romlopath));
		memset(romhighpath,0,sizeof(romhighpath));
	};
	// default ROM sets
	strcpy(romlopath[0],"BASIC");
	strcpy(romhighpath[0],"KERNAL");

	// 64 kbytes of memory allocated
	RAMMask=0xFFFF;

	// actual ram bank pointer default setting
	actram=Ram;

	// setting screen memory pointer
	scrptr=screen;
	// pointer of the end of the screen memory
	endptr=scrptr+456*312-8;
	// setting the CPU to fast mode
	fastmode=1;
	// initial position of the electron beam (upper left corner)
	irqline=VertSubCount=0;
	beamy=0;
	beamx=0;
	hshift = 0;
	scrblank= false;

	charrombank=charrambank=cset=VideoBase=Ram;
	scrattr=0;
	timer1=timer2=timer3=0;
	chrbuf = DMAbuf;
	clrbuf = DMAbuf + 64;
	tmpClrbuf = DMAbuf + 128;
	memset(DMAbuf, 0, sizeof(DMAbuf));

	// create an instance of the keyboard class
//	keys = new KEYS;
//	tap = new TAP;
	// setting the TAP::mem pointer to this MEM class
//	tap->mem=this;
//	tcbmbus = NULL;
	crsrblinkon = false;
	VertSubActive = false;
	CharacterPositionReload = CharacterPosition = 0;
	SideBorderFlipFlop = false;
	render_ok = false;

	BadLine = 0;
	CycleCounter = 0;
	oscillatorInit();
	memset(protectedPlayerMemory, 0xfe, sizeof(protectedPlayerMemory));
	enableSidCard(1, 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
callq 0x19830
movq -0x18(%rbp), %rax
leaq 0xdda4(%rip), %rcx      # 0x23cf8
addq $0x10, %rcx
movq %rcx, (%rax)
movq $0x0, 0x65fd8(%rax)
movq $0x0, 0xb71d0(%rax)
movq %rax, 0x1f9a0(%rip)     # 0x35918
movl $0x0, -0xc(%rbp)
cmpl $0x4, -0xc(%rbp)
jae 0x15ffd
movq -0x18(%rbp), %rdi
addq $0x55fc0, %rdi          # imm = 0x55FC0
movl -0xc(%rbp), %eax
shlq $0xe, %rax
addq %rax, %rdi
xorl %esi, %esi
movl $0x4000, %edx           # imm = 0x4000
callq 0x3130
movq -0x18(%rbp), %rdi
addq $0x65fe0, %rdi          # imm = 0x65FE0
movl -0xc(%rbp), %eax
shlq $0xe, %rax
addq %rax, %rdi
xorl %esi, %esi
movl $0x4000, %edx           # imm = 0x4000
callq 0x3130
movq -0x18(%rbp), %rdi
addq $0x1b, %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x3130
movq -0x18(%rbp), %rdi
addq $0x41b, %rdi            # imm = 0x41B
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x3130
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x15f7f
movq -0x18(%rbp), %rdi
addq $0x1b, %rdi
leaq 0x9841(%rip), %rsi      # 0x1f84d
callq 0x3230
movq -0x18(%rbp), %rdi
addq $0x41b, %rdi            # imm = 0x41B
leaq 0x9830(%rip), %rsi      # 0x1f853
callq 0x3230
movq -0x18(%rbp), %rdi
movl $0xffff, 0x76008(%rdi)  # imm = 0xFFFF
movq %rdi, %rax
addq $0x45fc0, %rax          # imm = 0x45FC0
movq %rax, 0xb6010(%rdi)
movq %rdi, %rax
addq $0x824, %rax            # imm = 0x824
movq %rax, 0xb6160(%rdi)
movq 0xb6160(%rdi), %rax
addq $0x22bc0, %rax          # imm = 0x22BC0
addq $-0x8, %rax
movq %rax, 0xb6168(%rdi)
movl $0x1, 0xb6180(%rdi)
movl $0x0, 0x1f89e(%rip)     # 0x35920
movl $0x0, 0xb6184(%rdi)
movl $0x0, 0x820(%rdi)
movl $0x0, 0x81c(%rdi)
movl $0x0, 0xb601c(%rdi)
movb $0x0, 0xb601b(%rdi)
movq %rdi, %rax
addq $0x45fc0, %rax          # imm = 0x45FC0
movq %rax, 0x1f867(%rip)     # 0x35928
movq %rax, 0xb6198(%rdi)
movq %rax, 0xb6150(%rdi)
movq %rax, 0xb6148(%rdi)
movl $0x0, 0xb6130(%rdi)
movl $0x0, 0x65fcc(%rdi)
movl $0x0, 0x65fc8(%rdi)
movl $0x0, 0x65fc4(%rdi)
movq %rdi, %rax
addq $0xb602c, %rax          # imm = 0xB602C
movq %rax, 0xb60f0(%rdi)
movq %rdi, %rax
addq $0xb602c, %rax          # imm = 0xB602C
addq $0x40, %rax
movq %rax, 0xb60f8(%rdi)
movq %rdi, %rax
addq $0xb602c, %rax          # imm = 0xB602C
addq $0x80, %rax
movq %rax, 0xb6100(%rdi)
addq $0xb602c, %rdi          # imm = 0xB602C
xorl %esi, %esi
movl $0xc0, %edx
callq 0x3130
movq -0x18(%rbp), %rdi
movb $0x0, 0x45fb0(%rdi)
movb $0x0, 0x1f7d3(%rip)     # 0x35930
movl $0x0, 0x1f7cd(%rip)     # 0x35934
movl $0x0, 0x1f7c7(%rip)     # 0x35938
movb $0x0, 0x1f7c4(%rip)     # 0x3593c
movb $0x0, 0x45fa4(%rdi)
movl $0x0, 0x1f7b7(%rip)     # 0x35940
movq $0x0, 0x1f77c(%rip) # 0x35910
callq 0x19a00
movq -0x18(%rbp), %rdi
addq $0xb61b8, %rdi          # imm = 0xB61B8
movl $0xfe, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x3130
movq -0x18(%rbp), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x161d0
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)