move rom/ram/ports management from bus to emulator

This commit is contained in:
Gwenhael Le Moine 2024-04-13 13:42:37 +02:00
parent a1c6fed619
commit 8dd69b710e
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
2 changed files with 15 additions and 16 deletions

View file

@ -1,11 +1,9 @@
#include <string.h>
#include "types.h"
#include "rom.h"
#include "ram.h"
#include "ports.h"
#include "hdw.h"
#include "bus.h"
#include "ports.h"
#define SEG_OF( adr ) ( ( adr ) >> 12 )
#define OFFSET_OF( adr ) ( ( adr ) & 0xFFF )
@ -32,19 +30,9 @@ static address hdw_seg;
word crc;
void bus_init( void )
{
rom_init();
ram_init();
ports_init();
bus_reset();
}
void bus_init( void ) { bus_reset(); }
void bus_exit( void )
{
rom_exit();
ram_exit();
}
void bus_exit( void ) {}
static inline void update_crc( byte nibble ) { crc = ( crc >> 4 ) ^ ( ( ( crc ^ nibble ) & 0xF ) * 0x1081 ); }

View file

@ -11,6 +11,9 @@
#include "display.h"
#include "gui.h"
#include "emulator.h"
#include "rom.h"
#include "ram.h"
#include "ports.h"
#define MAX_DELTA 4000
@ -46,13 +49,21 @@ void emulator_init( void )
{
static bool locked = false;
rom_init();
ram_init();
ports_init();
bus_init();
if ( !locked )
locked = true;
}
void emulator_exit( void ) { bus_exit(); }
void emulator_exit( void )
{
rom_exit();
ram_exit();
bus_exit();
}
static inline void throttle( bool is_needed )
{