Emulator: code formatting

This commit is contained in:
Daniele Verducci 2025-01-30 08:11:49 +01:00
parent 4bf29638ca
commit 882f258ad8

View File

@ -26,8 +26,7 @@ typedef struct {
} Machine;
Device *machine_find_device(Machine *self, zuint16 port)
{
Device *machine_find_device(Machine *self, zuint16 port) {
zusize index = 0;
for (; index < self->device_count; index++)
@ -38,37 +37,32 @@ Device *machine_find_device(Machine *self, zuint16 port)
}
static zuint8 machine_cpu_read(Machine *self, zuint16 address)
{
static zuint8 machine_cpu_read(Machine *self, zuint16 address) {
return address < MEMORY_SIZE ? self->memory[address] : 0xFF;
}
static void machine_cpu_write(Machine *self, zuint16 address, zuint8 value)
{
static void machine_cpu_write(Machine *self, zuint16 address, zuint8 value) {
if (address >= ROM_SIZE && address < MEMORY_SIZE)
self->memory[address] = value;
}
static zuint8 machine_cpu_in(Machine *self, zuint16 port)
{
static zuint8 machine_cpu_in(Machine *self, zuint16 port) {
Device *device = machine_find_device(self, port);
return device != Z_NULL ? device->read(device->context) : 0xFF;
}
static void machine_cpu_out(Machine *self, zuint16 port, zuint8 value)
{
static void machine_cpu_out(Machine *self, zuint16 port, zuint8 value) {
Device *device = machine_find_device(self, port);
if (device != Z_NULL) device->write(device->context, value);
}
void machine_initialize(Machine *self)
{
void machine_initialize(Machine *self) {
self->cpu.context = self;
self->cpu.fetch_opcode =
self->cpu.fetch =
@ -93,8 +87,7 @@ void machine_initialize(Machine *self)
}
void machine_power(Machine *self, zbool state)
{
void machine_power(Machine *self, zbool state) {
if (state)
{
self->cycles = 0;
@ -105,8 +98,7 @@ void machine_power(Machine *self, zbool state)
}
void machine_reset(Machine *self)
{
void machine_reset(Machine *self) {
z80_instant_reset(&self->cpu);
}