move rom/ram/ports management from bus to emulator
This commit is contained in:
parent
a1c6fed619
commit
8dd69b710e
2 changed files with 15 additions and 16 deletions
18
src/bus.c
18
src/bus.c
|
@ -1,11 +1,9 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "rom.h"
|
|
||||||
#include "ram.h"
|
|
||||||
#include "ports.h"
|
|
||||||
#include "hdw.h"
|
#include "hdw.h"
|
||||||
#include "bus.h"
|
#include "bus.h"
|
||||||
|
#include "ports.h"
|
||||||
|
|
||||||
#define SEG_OF( adr ) ( ( adr ) >> 12 )
|
#define SEG_OF( adr ) ( ( adr ) >> 12 )
|
||||||
#define OFFSET_OF( adr ) ( ( adr ) & 0xFFF )
|
#define OFFSET_OF( adr ) ( ( adr ) & 0xFFF )
|
||||||
|
@ -32,19 +30,9 @@ static address hdw_seg;
|
||||||
|
|
||||||
word crc;
|
word crc;
|
||||||
|
|
||||||
void bus_init( void )
|
void bus_init( void ) { bus_reset(); }
|
||||||
{
|
|
||||||
rom_init();
|
|
||||||
ram_init();
|
|
||||||
ports_init();
|
|
||||||
bus_reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
void bus_exit( void )
|
void bus_exit( void ) {}
|
||||||
{
|
|
||||||
rom_exit();
|
|
||||||
ram_exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void update_crc( byte nibble ) { crc = ( crc >> 4 ) ^ ( ( ( crc ^ nibble ) & 0xF ) * 0x1081 ); }
|
static inline void update_crc( byte nibble ) { crc = ( crc >> 4 ) ^ ( ( ( crc ^ nibble ) & 0xF ) * 0x1081 ); }
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "emulator.h"
|
#include "emulator.h"
|
||||||
|
#include "rom.h"
|
||||||
|
#include "ram.h"
|
||||||
|
#include "ports.h"
|
||||||
|
|
||||||
#define MAX_DELTA 4000
|
#define MAX_DELTA 4000
|
||||||
|
|
||||||
|
@ -46,13 +49,21 @@ void emulator_init( void )
|
||||||
{
|
{
|
||||||
static bool locked = false;
|
static bool locked = false;
|
||||||
|
|
||||||
|
rom_init();
|
||||||
|
ram_init();
|
||||||
|
ports_init();
|
||||||
bus_init();
|
bus_init();
|
||||||
|
|
||||||
if ( !locked )
|
if ( !locked )
|
||||||
locked = true;
|
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 )
|
static inline void throttle( bool is_needed )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue