diff options
| author | Melodi <62381002+Melodi17@users.noreply.github.com> | 2025-08-06 22:36:34 +1000 |
|---|---|---|
| committer | Melodi <62381002+Melodi17@users.noreply.github.com> | 2025-08-06 22:36:34 +1000 |
| commit | 7a8d2bcd75d88a5429937bf551878c55e1dcf0fd (patch) | |
| tree | 81bc1f259fb8678513aa8b214df4ef72720bb585 /Chip/BusDevice.cs | |
| parent | 16f3cb74564cf7c19da6e13666c98aca36094716 (diff) | |
moved everything to seperate projects, and started compiler work + push and pop instructions added
Diffstat (limited to 'Chip/BusDevice.cs')
| -rw-r--r-- | Chip/BusDevice.cs | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/Chip/BusDevice.cs b/Chip/BusDevice.cs deleted file mode 100644 index 8b677c5..0000000 --- a/Chip/BusDevice.cs +++ /dev/null @@ -1,56 +0,0 @@ -namespace Q1Emu.Chip; - -using System.Runtime.CompilerServices; - -public abstract class BusDevice -{ - public BusDevice(u16 addressableStart, u16 addressableEnd) - { - this.AddressableStart = addressableStart; - this.AddressableEnd = addressableEnd; - } - - public Bus Bus { get; set; } - public abstract u8 Read(u16 address); - public abstract void Write(u16 address, u8 value); - - public u16 ReadWord(u16 address) - { - u8 high = this.Read(address); - u8 low = this.Read((u16) (address + 1)); - u16 value = Make.u16(high, low); - return value; - } - - public void WriteWord(u16 address, u16 value) - { - ref8 data = Make.ref8(value); - this.Write(address, data[0]); - this.Write((u16) (address + 1), data[1]); - } - - public i16 ReadSignedWord(u16 address) - { - u8 high = this.Read(address); - u8 low = this.Read((u16) (address + 1)); - return Make.i16(high, low); - } - - public virtual void Clock() { } - public virtual void Reset() { } - - public void AttachToBus(Bus bus) - { - this.Bus = bus; - bus.Devices.Add(this); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - protected u16 GetRelativeAddress(u16 address) - { - return (u16) (address - this.AddressableStart); - } - - public u16 AddressableStart { get; } - public u16 AddressableEnd { get; } -}
\ No newline at end of file |
