File:  [Isaki's NoNo m68k/m88k emulator] / nono / vm / extram.h
Revision 1.1.1.4 (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) 2023 nono project
// Licensed under nono-license.txt
//

//
// X68030 勝手に拡張メモリ
//

#pragma once

#include "device.h"

class ExtRAMDevice : public IODevice
{
	using inherited = IODevice;
 public:
	ExtRAMDevice();
	~ExtRAMDevice() override;

	bool Init() override;
	void ResetHard(bool poweron) override;

	busdata Read(busaddr addr) override;
	busdata Write(busaddr, uint32 data) override;
	busdata Peek1(uint32 addr) override;
	bool Poke1(uint32 addr, uint32 data) override;

	// 拡張メモリ容量(バイト単位)を取得
	int GetSize() const	{ return ram_size; }
	// 拡張メモリ容量(MB単位)を取得
	int GetSizeMB() const { return ram_size / 1024 / 1024; }

 private:
	inline uint32 Decoder(uint32) const;

	std::unique_ptr<uint8[]> ram {};

	// 拡張メモリの開始アドレス
	uint32 ram_addr {};

	// 拡張メモリ容量(バイト単位)。ram[] の確保したバイト数
	uint ram_size {};
};

inline ExtRAMDevice *GetExtRAMDevice() {
	return Object::GetObject<ExtRAMDevice>(OBJ_EXTRAM);
}

unix.superglobalmegacorp.com

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