File:  [Isaki's NoNo m68k/m88k emulator] / nono / vm / device.cpp
Revision 1.1.1.14 (vendor branch): download - view: text, annotated - select for diffs
Wed Apr 29 17:06:01 2026 UTC (2 months, 3 weeks ago) by root
Branches: MAIN, Isaki
CVS tags: v027, HEAD
nono 1.7.0

//
// nono
// Copyright (C) 2020 nono project
// Licensed under nono-license.txt
//

//
// デバイスの基本クラスなど
//

#include "device.h"
#include "mpu.h"
#include "scheduler.h"

//
// Device
//

// コンストラクタ
Device::Device(uint objid_)
	: inherited(objid_)
{
}

// デストラクタ
Device::~Device()
{
}

bool
Device::Create()
{
	return true;
}

bool
Device::Create2()
{
	return true;
}

void
Device::EarlyInit()
{
	mpu = GetMPUDevice();
	scheduler = GetScheduler();
}

bool
Device::Init()
{
	return true;
}

void
Device::ResetHard(bool poweron)
{
}

void
Device::PowerOff()
{
}

// ログ表示。
// VM デバイスでは、仮想時間、PC、オブジェクト名を表示する。
void
Device::putlogn(const char *fmt, ...) const
{
	char buf[1024];
	va_list ap;
	uint64 vt;
	int len;

	vt = scheduler->GetVirtTime();
	len = snprintf(buf, sizeof(buf), "%16s %08x %s ",
		SecToStr(vt).c_str(),
		mpu->GetPPC(),
		GetName().c_str());

	va_start(ap, fmt);
	vsnprintf(buf + len, sizeof(buf) - len, fmt, ap);
	va_end(ap);

	WriteLog(buf);
}


//
// IODevice
//

// コンストラクタ
IODevice::IODevice(uint objid_)
	: inherited(objid_)
{
}

// デストラクタ
IODevice::~IODevice()
{
}

busdata
IODevice::Read(busaddr addr)
{
	return 0;
}

busdata
IODevice::Write(busaddr addr, uint32 data)
{
	return 0;
}

busdata
IODevice::ReadBurst16(busaddr addr, uint32 *dst)
{
	return BusData::BusErr;
}

busdata
IODevice::WriteBurst16(busaddr addr, const uint32 *src)
{
	return BusData::BusErr;
}

busdata
IODevice::Read1(uint32 addr)
{
	return 0xff;
}

busdata
IODevice::Write1(uint32 addr, uint32 data)
{
	return 0;
}

busdata
IODevice::Peek1(uint32 addr)
{
	return 0xff;
}

bool
IODevice::Poke1(uint32 addr, uint32 data)
{
	return false;
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.