// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0xb2bd(%rip), %rax      # 0x14d38
movq %rax, (%rdi)
xorl %r15d, %r15d
movq %r15, 0x65fd8(%rdi)
movq %r15, 0xb71d0(%rdi)
movq %rdi, 0x1c9ea(%rip)     # 0x26480
addq $0x55fc0, %rdi          # imm = 0x55FC0
leaq 0x65fe0(%rbx), %r14
movl $0x10000, %edx          # imm = 0x10000
xorl %esi, %esi
callq 0x3130
movl $0x10000, %edx          # imm = 0x10000
movq %r14, %rdi
xorl %esi, %esi
callq 0x3130
leaq 0x21(%rbx), %r14
movl $0x7fa, %edx            # imm = 0x7FA
movq %r14, %rdi
xorl %esi, %esi
callq 0x3130
movl $0x7fa, %edx            # imm = 0x7FA
movq %r14, %rdi
xorl %esi, %esi
callq 0x3130
movl $0x7fa, %edx            # imm = 0x7FA
movq %r14, %rdi
xorl %esi, %esi
callq 0x3130
movl $0x7fa, %edx            # imm = 0x7FA
movq %r14, %rdi
xorl %esi, %esi
callq 0x3130
movl $0x49534142, 0x1b(%rbx) # imm = 0x49534142
movw $0x43, 0x1f(%rbx)
movl $0x4e52454b, 0x41b(%rbx) # imm = 0x4E52454B
movl $0x4c414e, 0x41e(%rbx)  # imm = 0x4C414E
movl $0xffff, 0x76008(%rbx)  # imm = 0xFFFF
leaq 0x45fc0(%rbx), %rax
movq %rax, 0xb6010(%rbx)
leaq 0x824(%rbx), %rcx
movq %rcx, 0xb6160(%rbx)
leaq 0x233dc(%rbx), %rcx
movq %rcx, 0xb6168(%rbx)
movl $0x1, 0xb6180(%rbx)
movl %r15d, 0x1c923(%rip)    # 0x26488
movl %r15d, 0xb6184(%rbx)
movq %r15, 0x81c(%rbx)
movl %r15d, 0xb601c(%rbx)
movb %r15b, 0xb601b(%rbx)
movq %rax, 0x1c908(%rip)     # 0x26490
movq %rax, 0xb6198(%rbx)
movq %rax, 0xb6150(%rbx)
movq %rax, 0xb6148(%rbx)
movl %r15d, 0xb6130(%rbx)
movl %r15d, 0x65fcc(%rbx)
movq %r15, 0x65fc4(%rbx)
leaq 0xb602c(%rbx), %rdi
movq %rdi, 0xb60f0(%rbx)
leaq 0xb606c(%rbx), %rax
movq %rax, 0xb60f8(%rbx)
leaq 0xb60ac(%rbx), %rax
movq %rax, 0xb6100(%rbx)
movl $0xc0, %edx
xorl %esi, %esi
callq 0x3130
movb %r15b, 0x45fb0(%rbx)
movb %r15b, 0x1c8a2(%rip)    # 0x26498
movl %r15d, 0x1c89f(%rip)    # 0x2649c
movl %r15d, 0x1c89c(%rip)    # 0x264a0
movb %r15b, 0x1c899(%rip)    # 0x264a4
movb %r15b, 0x45fa4(%rbx)
movl %r15d, 0x1c88f(%rip)    # 0x264a8
movq %r15, 0x1c858(%rip)     # 0x26478
movq %rbx, %rdi
callq 0xbdae
leaq 0xb61b8(%rbx), %rdi
movl $0x1000, %edx           # imm = 0x1000
movl $0xfe, %esi
callq 0x3130
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
popq %rbx
popq %r14
popq %r15
jmp 0x9c52