File:  [Isaki's NoNo m68k/m88k emulator] / nono / debugger / saddr.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed Apr 29 17:05:16 2026 UTC (2 months, 3 weeks ago) by root
Branches: MAIN, Isaki
CVS tags: v018, v017, HEAD
nono 0.5.0

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

//
// 諸情報付きのアドレス
//

#pragma once

class saddr_t
{
 public:
	// コンストラクタ
	saddr_t() { }

	saddr_t(uint32 addr_, bool super_)
		: saddr_t(addr_, super_, false) { }

	saddr_t(uint32 addr_, bool super_, bool data_) {
		Set(addr_, super_, data_);
	}
	// コピーコンストラクタ
	saddr_t(const saddr_t& rhs) {
		Set(rhs);
	}
	// 代入演算子
	saddr_t& operator=(const saddr_t& rhs) {
		Set(rhs);
		return *this;
	}

	// 代入演算子 (uint32 を代入するとアドレスだけ差し替える)
	saddr_t& operator=(uint32 rhs) {
		SetAddr(rhs);
		return *this;
	}

	// 代入
	void Set(uint32 addr_, bool super_, bool data_) {
		addr  = addr_;
		super = super_;
		data  = data_;
	}

	uint32 GetAddr() const		{ return addr; }
	bool IsSuper() const		{ return super; }
	bool IsData()  const		{ return data; }
	void SetAddr(uint32 addr_)	{ addr  = addr_; }
	void SetSuper(bool super_)	{ super = super_; }
	void SetData(bool data_)	{ data  = data_; }

	// (uint32)saddr でアドレスだけ取り出せると楽
	explicit operator uint32() const { return GetAddr(); }

	// saddr += n でアドレス進められると楽
	uint32 operator+=(uint32 val) {
		addr += val;
		return addr;
	}
	// saddr++ でアドレス進められると楽
	void operator++(int n) {
		addr++;
	}

 private:
	void Set(const saddr_t& rhs) {
		addr  = rhs.addr;
		super = rhs.super;
		data  = rhs.data;
	}

	uint32 addr {};		// アドレス (32bit)
	bool super {};		// スーパーバイザアクセスなら true
	bool data  {};		// データ空間アクセスなら true
};

unix.superglobalmegacorp.com

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