// Copyright (c) 2009 - 2026 kio@little-bat.de
// BSD-2-Clause license
// https://opensource.org/licenses/BSD-2-Clause

#include "MachineTc2048.h"
#include "Joy/Tc2048Joy.h"
#include "Keyboard.h"
#include "TapeRecorder.h"
#include "Ula/MmuTc2048.h"
#include "Ula/UlaTc2048.h"


/*
the main difference is that instead of ULA there is another chip, SCLD.
Besides all the ULA functions SCLD is able to work in some other video
modes. Unlike Spectrum in TIMEX port #FE is fully decoded, what in rare
cases is causing incompatibility. The other hardware difference is joy-
stick port (Kempston) built in TIMEX. ROM code is the same as in Spectrum
except one OUT instruction setting proper video mode after reset.
*/


namespace zxsp
{

MachineTc2048::MachineTc2048(IMachineController* m, IScreen* screen, Model model, isa_id id) : //
	MachineZxsp(m, screen, model, id)
{}

MachineTc2048::MachineTc2048(IMachineController* m, IScreen* screen) : //
	MachineZxsp(m, screen, tc2048, isa_MachineTc2048)
{
	addItem(new Z80(this));						 // must be 1st item
	addItem(new UlaTc2048(this, isa_UlaTc2048)); // should be 2nd item
	addItem(new MmuTc2048(this));
	addItem(new KeyboardTimex(this, isa_KbdTimex));
	addItem(new Tc2048Joy(this));
	addItem(new Walkman(this));
}

void MachineTc2048::loadScr(FD& fd)
{
	ula->setPortFF(ula->getPortFF() & 0x3F); // reset video-related bits
	MachineZxsp::loadScr(fd);
}

} // namespace zxsp
