O2Hawk: system management work
This commit is contained in:
parent
8b2150dbd3
commit
2fbf3c3b19
|
@ -224,7 +224,7 @@ namespace BizHawk.Client.Common
|
|||
///
|
||||
public static SystemInfo ChannelF { get; } = new SystemInfo("Channel F", CoreSystem.ChannelF, 2);
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for ChannelF
|
||||
/// Gets the <see cref="SystemInfo"/> instance for Odyssey2
|
||||
/// </summary>
|
||||
///
|
||||
public static SystemInfo O2 { get; } = new SystemInfo("Odyssey2", CoreSystem.Odyssey2, 2);
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return new PadSchema
|
||||
{
|
||||
IsConsole = false,
|
||||
DefaultSize = new Size(200, 100),
|
||||
DefaultSize = new Size(100, 100),
|
||||
Buttons = new[]
|
||||
{
|
||||
new PadSchema.ButtonSchema
|
||||
|
@ -64,31 +64,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = $"P{controller} Button 1",
|
||||
DisplayName = "1",
|
||||
Name = $"P{controller} F",
|
||||
DisplayName = "F",
|
||||
Location = new Point(74, 34),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = $"P{controller} Button 2",
|
||||
DisplayName = "2",
|
||||
Location = new Point(98, 34),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = $"P{controller} Button 3",
|
||||
DisplayName = "3",
|
||||
Location = new Point(122, 34),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = $"P{controller} Button 4",
|
||||
DisplayName = "4",
|
||||
Location = new Point(146, 34),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -183,8 +183,8 @@ namespace BizHawk.Emulation.Common.Components.I8048
|
|||
case 0x9D: OP_EXP_A(AND8, P5); break; // AND P5,A
|
||||
case 0x9E: OP_EXP_A(AND8, P6); break; // AND P6,A
|
||||
case 0x9F: OP_EXP_A(AND8, P7); break; // AND P7,A
|
||||
case 0xA0: OP_A_R(MOVT_RAM, R0); break; // MOV @R0,A
|
||||
case 0xA1: OP_A_R(MOVT_RAM, R1); break; // MOV @R1,A
|
||||
case 0xA0: OP_IR(MOVT_RAM, R0); break; // MOV @R0,A
|
||||
case 0xA1: OP_IR(MOVT_RAM, R1); break; // MOV @R1,A
|
||||
case 0xA2: ILLEGAL(); break; // ILLEGAL
|
||||
case 0xA3: MOV_A_A(); break; // MOV A,@A
|
||||
case 0xA4: JP_2k(5); break; // JP 2K 5
|
||||
|
|
|
@ -83,6 +83,10 @@ namespace BizHawk.Emulation.Common.Components.I8048
|
|||
public const ushort PUSH = 73;
|
||||
public const ushort PULL = 74;
|
||||
public const ushort PULL_PC = 75;
|
||||
public const ushort EEA = 76;
|
||||
public const ushort DEA = 77;
|
||||
public const ushort RD_P = 78;
|
||||
public const ushort WR_P = 79;
|
||||
|
||||
public I8048()
|
||||
{
|
||||
|
@ -343,7 +347,7 @@ namespace BizHawk.Emulation.Common.Components.I8048
|
|||
Regs[cur_instr[instr_pntr++]] = Regs[A];
|
||||
break;
|
||||
case MOVT_RAM:
|
||||
|
||||
Regs[Regs[cur_instr[instr_pntr++]]] = Regs[A];
|
||||
break;
|
||||
case ST_CNT:
|
||||
counter_en = true;
|
||||
|
@ -407,6 +411,18 @@ namespace BizHawk.Emulation.Common.Components.I8048
|
|||
Regs[A] = (ushort)(Regs[A] >> 4);
|
||||
Regs[A] |= (ushort)((reg_d_ad << 4) & 0xF0);
|
||||
break;
|
||||
case EEA:
|
||||
EA = true;
|
||||
break;
|
||||
case DEA:
|
||||
EA = false;
|
||||
break;
|
||||
case RD_P:
|
||||
EA = false;
|
||||
break;
|
||||
case WR_P:
|
||||
WritePort(cur_instr[instr_pntr++], (byte)Regs[cur_instr[instr_pntr++]]);
|
||||
break;
|
||||
}
|
||||
|
||||
if (++irq_pntr == IRQS)
|
||||
|
@ -551,6 +567,7 @@ namespace BizHawk.Emulation.Common.Components.I8048
|
|||
ser.Sync(nameof(IRQS), ref IRQS);
|
||||
ser.Sync(nameof(irq_pntr), ref irq_pntr);
|
||||
|
||||
ser.Sync(nameof(EA), ref EA);
|
||||
ser.Sync(nameof(TF), ref TF);
|
||||
ser.Sync(nameof(timer_en), ref timer_en);
|
||||
ser.Sync(nameof(counter_en), ref counter_en);
|
||||
|
|
|
@ -227,13 +227,13 @@ namespace BizHawk.Emulation.Common.Components.I8048
|
|||
{
|
||||
PopulateCURINSTR(IDLE,
|
||||
IDLE,
|
||||
EEA,
|
||||
WR_P, 0, (ushort)(reg + RB),
|
||||
DEA,
|
||||
IDLE,
|
||||
IDLE,
|
||||
IDLE,
|
||||
IDLE,
|
||||
IDLE,
|
||||
IDLE,
|
||||
IDLE);
|
||||
WR_P, 0, A);
|
||||
|
||||
IRQS = 9;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,9 @@ namespace BizHawk.Emulation.Common.Components.I8048
|
|||
// registers
|
||||
public ushort[] Regs = new ushort[78];
|
||||
|
||||
// EA gets set to true on external memory address latch
|
||||
public bool EA;
|
||||
|
||||
// The 8048 has 2 flags that can be used for conditionals
|
||||
// F0 is on the PSW, F1 is seperate
|
||||
public bool F1;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
|
||||
using BizHawk.Common.BufferExtensions;
|
||||
using BizHawk.Common.NumberExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
/*
|
||||
|
@ -16,8 +17,7 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
{
|
||||
uint flags = (uint)(MemoryCallbackFlags.AccessRead);
|
||||
MemoryCallbacks.CallMemoryCallbacks(addr, 0, flags, "System Bus");
|
||||
addr_access = addr;
|
||||
|
||||
|
||||
if (addr < 0x400)
|
||||
{
|
||||
return _bios[addr];
|
||||
|
@ -32,7 +32,6 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
{
|
||||
uint flags = (uint)(MemoryCallbackFlags.AccessWrite);
|
||||
MemoryCallbacks.CallMemoryCallbacks(addr, value, flags, "System Bus");
|
||||
addr_access = addr;
|
||||
|
||||
if (addr < 0x400)
|
||||
{
|
||||
|
@ -56,14 +55,111 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
}
|
||||
}
|
||||
|
||||
public byte ReadPort(ushort addr)
|
||||
public byte ReadPort(ushort port)
|
||||
{
|
||||
return 0;
|
||||
if (port == 0)
|
||||
{
|
||||
// BUS, used with external memory and ppu
|
||||
if (cpu.EA)
|
||||
{
|
||||
return addr_latch;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (RAM_en)
|
||||
{
|
||||
if (addr_latch < 0x80)
|
||||
{
|
||||
return RAM[addr_latch & 0x7F];
|
||||
}
|
||||
else
|
||||
{
|
||||
// voice module would return here
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (ppu_en && !copy_en)
|
||||
{
|
||||
if ((addr_latch >= 0xA7) || (addr_latch <= 0xAA))
|
||||
{
|
||||
return audio.ReadReg(addr_latch);
|
||||
}
|
||||
return ppu.ReadReg(addr_latch);
|
||||
}
|
||||
|
||||
// not sure what happens if this case is reached, probably whatever the last value on the bus is
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (port == 1)
|
||||
{
|
||||
// various control pins
|
||||
return (byte)((lum_en ? 0x80 : 0) |
|
||||
(copy_en ? 0x40 : 0) |
|
||||
(0x20) |
|
||||
(!RAM_en ? 0x10 : 0) |
|
||||
(!ppu_en ? 0x08 : 0) |
|
||||
(!kybrd_en ? 0x04 : 0) |
|
||||
(cart_b1 ? 0x02 : 0) |
|
||||
(cart_b0 ? 0x01 : 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
// keyboard
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void WritePort(ushort addr, byte value)
|
||||
public void WritePort(ushort port, byte value)
|
||||
{
|
||||
|
||||
if (port == 0)
|
||||
{
|
||||
// BUS, used with external memory and ppu
|
||||
if (cpu.EA)
|
||||
{
|
||||
addr_latch = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (RAM_en && !copy_en)
|
||||
{
|
||||
if (addr_latch < 0x80)
|
||||
{
|
||||
RAM[addr_latch] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
// voice module goes here
|
||||
}
|
||||
}
|
||||
if (ppu_en)
|
||||
{
|
||||
if ((addr_latch >= 0xA7) || (addr_latch <= 0xAA))
|
||||
{
|
||||
audio.WriteReg(addr_latch, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
ppu.WriteReg(addr_latch, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (port == 1)
|
||||
{
|
||||
// various control pins
|
||||
lum_en = value.Bit(7);
|
||||
copy_en = value.Bit(6);
|
||||
RAM_en = !value.Bit(4);
|
||||
ppu_en = !value.Bit(3);
|
||||
kybrd_en = !value.Bit(2);
|
||||
cart_b1 = value.Bit(1);
|
||||
cart_b0 = value.Bit(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// keyboard
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,13 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
addr => RAM[addr],
|
||||
(addr, value) => RAM[addr] = value,
|
||||
1),
|
||||
new MemoryDomainDelegate(
|
||||
"CPU RAM",
|
||||
64,
|
||||
MemoryDomain.Endian.Little,
|
||||
addr => (byte)cpu.Regs[addr],
|
||||
(addr, value) => cpu.Regs[addr] = value,
|
||||
1),
|
||||
new MemoryDomainDelegate(
|
||||
"System Bus",
|
||||
0X1000,
|
||||
|
@ -36,11 +43,11 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
(addr, value) => _rom[addr] = value,
|
||||
1),
|
||||
new MemoryDomainDelegate(
|
||||
"VRAM",
|
||||
VRAM.Length,
|
||||
"PPU",
|
||||
256,
|
||||
MemoryDomain.Endian.Little,
|
||||
addr => VRAM[addr],
|
||||
(addr, value) => VRAM[addr] = value,
|
||||
addr => ppu.ReadReg((int)addr),
|
||||
(addr, value) => ppu.WriteReg((int)addr, value),
|
||||
1)
|
||||
};
|
||||
|
||||
|
|
|
@ -66,13 +66,20 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
ser.Sync(nameof(vblank_rise), ref vblank_rise);
|
||||
ser.Sync(nameof(input_register), ref input_register);
|
||||
|
||||
ser.Sync(nameof(RAM_en), ref RAM_en);
|
||||
ser.Sync(nameof(ppu_en), ref ppu_en);
|
||||
ser.Sync(nameof(cart_b0), ref cart_b0);
|
||||
ser.Sync(nameof(cart_b1), ref cart_b1);
|
||||
ser.Sync(nameof(lum_en), ref lum_en);
|
||||
ser.Sync(nameof(copy_en), ref copy_en);
|
||||
ser.Sync(nameof(kybrd_en), ref kybrd_en);
|
||||
|
||||
// memory domains
|
||||
ser.Sync(nameof(RAM), ref RAM, false);
|
||||
ser.Sync(nameof(VRAM), ref VRAM, false);
|
||||
ser.Sync(nameof(OAM), ref OAM, false);
|
||||
ser.Sync(nameof(_bios), ref _bios, false);
|
||||
ser.Sync(nameof(RAM_Bank), ref RAM_Bank);
|
||||
ser.Sync(nameof(addr_access), ref addr_access);
|
||||
ser.Sync(nameof(addr_latch), ref addr_latch);
|
||||
|
||||
ser.Sync(nameof(frame_buffer), ref frame_buffer, false);
|
||||
ser.Sync(nameof(_vidbuffer), ref _vidbuffer, false);
|
||||
|
|
|
@ -21,10 +21,12 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
// memory domains
|
||||
public byte[] RAM = new byte[0x80];
|
||||
|
||||
public byte[] VRAM = new byte[0x4000];
|
||||
public byte[] OAM = new byte[0xA0];
|
||||
|
||||
public int RAM_Bank;
|
||||
public byte addr_latch;
|
||||
public bool ppu_en, RAM_en, kybrd_en, copy_en, lum_en, cart_b0, cart_b1;
|
||||
public const bool P15 = true;
|
||||
|
||||
public byte[] _bios;
|
||||
public readonly byte[] _rom;
|
||||
|
@ -35,8 +37,6 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
|
||||
private int _frame = 0;
|
||||
|
||||
public ushort addr_access;
|
||||
|
||||
public MapperBase mapper;
|
||||
|
||||
private readonly ITraceable _tracer;
|
||||
|
@ -108,6 +108,16 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
|
||||
SetupMemoryDomains();
|
||||
HardReset();
|
||||
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
cpu.Regs[i] = (byte)i;
|
||||
}
|
||||
|
||||
for (int j = 0; j < 0x80; j++)
|
||||
{
|
||||
RAM[j] = (byte)j;
|
||||
}
|
||||
}
|
||||
|
||||
public DisplayType Region => DisplayType.NTSC;
|
||||
|
|
|
@ -30,6 +30,10 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
Name = Port1.Definition.Name,
|
||||
BoolButtons = Port1.Definition.BoolButtons
|
||||
.Concat(Port2.Definition.BoolButtons)
|
||||
.Concat(new[]
|
||||
{
|
||||
"Power"
|
||||
})
|
||||
.ToList()
|
||||
};
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
|
||||
private static readonly string[] BaseDefinition =
|
||||
{
|
||||
"Up", "Down", "Left", "Right", "Start", "Select", "B", "A", "Power"
|
||||
"Up", "Down", "Left", "Right", "F"
|
||||
};
|
||||
|
||||
public void SyncState(Serializer ser)
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
{
|
||||
ret = VDC_collision;
|
||||
}
|
||||
else
|
||||
else if(addr == 0xA3)
|
||||
{
|
||||
ret = VDC_color;
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
{
|
||||
VDC_collision = value;
|
||||
}
|
||||
else
|
||||
else if (addr == 0xA3)
|
||||
{
|
||||
VDC_color = value;
|
||||
}
|
||||
|
@ -154,13 +154,6 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
|
||||
}
|
||||
|
||||
// order sprites according to x coordinate
|
||||
// note that for sprites of equal x coordinate, priority goes to first on the list
|
||||
public void reorder_and_assemble_sprites()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static readonly byte[] Internal_Graphics = { 0x3C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, // 0 0x00
|
||||
0x18, 0x38, 0x18, 0x18, 0x18, 0x18, 0x3C, // 1 0x01
|
||||
0x3C, 0x66, 0x0C, 0x18, 0x30, 0x60, 0x7E, // 2 0x02
|
||||
|
|
Loading…
Reference in New Issue