split "private" parts of emulator.h into emulator_inner.h
This commit is contained in:
parent
fd11a9fa08
commit
3d70c997a4
9 changed files with 152 additions and 124 deletions
|
@ -2,7 +2,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "emulator.h"
|
||||
#include "emulator_inner.h"
|
||||
#include "romio.h"
|
||||
#include "ui.h" /* ui__get_event(); ui__update_LCD(); */
|
||||
|
||||
|
|
|
@ -4,9 +4,21 @@
|
|||
#include <sys/time.h>
|
||||
|
||||
#include "runtime_options.h" /* throttle */
|
||||
#include "emulator.h" /* word_20; register_to_address(); exchange_reg(); add_address(); store(); recall(); store_n(); recall_n(); */
|
||||
#include "ui.h" /* ui__get_event(); ui__adjust_contrast(); ui__update_LCD(); ui__draw_annunc(); */
|
||||
#include "debugger.h" /* enter_debugger, TRAP_INSTRUCTION, ILLEGAL_INSTRUCTION */
|
||||
#include "emulator_inner.h"
|
||||
|
||||
#define P_FIELD 0 /* unused? */
|
||||
#define WP_FIELD 1 /* unused? */
|
||||
#define XS_FIELD 2 /* unused? */
|
||||
#define X_FIELD 3 /* unused? */
|
||||
#define S_FIELD 4 /* unused? */
|
||||
#define M_FIELD 5 /* unused? */
|
||||
#define B_FIELD 6 /* unused? */
|
||||
#define W_FIELD 7
|
||||
#define A_FIELD 15
|
||||
#define IN_FIELD 16
|
||||
#define OUTS_FIELD 18
|
||||
|
||||
static long jumpaddr;
|
||||
|
||||
|
@ -22,6 +34,9 @@ int set_t1;
|
|||
|
||||
long schedule_event = 0;
|
||||
|
||||
long sched_timer1;
|
||||
long sched_timer2;
|
||||
|
||||
#define SrvcIoStart 0x3c0
|
||||
#define SrvcIoEnd 0x5ec
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <sys/types.h>
|
||||
|
||||
#include "runtime_options.h"
|
||||
#include "emulator.h"
|
||||
#include "emulator_inner.h"
|
||||
#include "romio.h"
|
||||
|
||||
#define X48_MAGIC 0x48503438
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "emulator.h"
|
||||
#include "emulator_inner.h"
|
||||
#include "romio.h"
|
||||
#include "ui.h" /* ui__disp_draw_nibble(); ui__menu_draw_nibble(); */
|
||||
#include "runtime_options.h"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "emulator.h"
|
||||
#include "emulator_inner.h"
|
||||
|
||||
extern long nibble_masks[ 16 ];
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#include "runtime_options.h"
|
||||
#include "emulator.h"
|
||||
#include "emulator_inner.h"
|
||||
|
||||
static int wire_fd;
|
||||
static int ir_fd;
|
||||
|
|
|
@ -7,9 +7,11 @@
|
|||
#include <sys/time.h>
|
||||
|
||||
#include "romio.h"
|
||||
#include "emulator.h"
|
||||
#include "emulator_inner.h"
|
||||
#include "debugger.h" /* used for in_debugger */
|
||||
|
||||
#define NR_TIMERS 4
|
||||
|
||||
typedef struct x48_timer_t {
|
||||
word_1 run;
|
||||
word_64 start;
|
||||
|
|
130
src/emulator.h
130
src/emulator.h
|
@ -3,34 +3,25 @@
|
|||
|
||||
#include <stdint.h> /* int64_t */
|
||||
|
||||
#define NR_MCTL 6
|
||||
|
||||
#define P_FIELD 0 /* unused? */
|
||||
#define WP_FIELD 1 /* unused? */
|
||||
#define XS_FIELD 2 /* unused? */
|
||||
#define X_FIELD 3 /* unused? */
|
||||
#define S_FIELD 4 /* unused? */
|
||||
#define M_FIELD 5 /* unused? */
|
||||
#define B_FIELD 6 /* unused? */
|
||||
#define W_FIELD 7
|
||||
#define A_FIELD 15
|
||||
#define IN_FIELD 16
|
||||
#define OUT_FIELD 17
|
||||
#define OUTS_FIELD 18
|
||||
|
||||
#define DEC 10
|
||||
#define HEX 16
|
||||
|
||||
#define NR_MCTL 6
|
||||
#define NR_RSTK 8
|
||||
#define NR_PSTAT 16
|
||||
|
||||
#define NR_TIMERS 4
|
||||
|
||||
#define T1_TIMER 0
|
||||
#define T2_TIMER 1 /* unused? */
|
||||
#define RUN_TIMER 2
|
||||
#define IDLE_TIMER 3
|
||||
|
||||
typedef unsigned char word_1;
|
||||
typedef unsigned char word_4;
|
||||
typedef unsigned char word_8;
|
||||
typedef unsigned short word_12;
|
||||
typedef unsigned short word_16;
|
||||
typedef long word_20;
|
||||
typedef long word_32;
|
||||
typedef int64_t word_64;
|
||||
|
||||
typedef struct t1_t2_ticks {
|
||||
unsigned long t1_ticks;
|
||||
unsigned long t2_ticks;
|
||||
|
@ -88,16 +79,6 @@ typedef struct device_t {
|
|||
char t2_touched;
|
||||
} device_t;
|
||||
|
||||
typedef unsigned char word_1;
|
||||
typedef unsigned char word_4;
|
||||
typedef unsigned char word_8;
|
||||
typedef unsigned short word_12;
|
||||
typedef unsigned short word_16;
|
||||
typedef long word_20;
|
||||
typedef long word_32;
|
||||
|
||||
typedef int64_t word_64;
|
||||
|
||||
typedef struct keystate_t {
|
||||
short rows[ 9 ];
|
||||
} keystate_t;
|
||||
|
@ -235,10 +216,7 @@ typedef struct saturn_t {
|
|||
extern int got_alarm;
|
||||
|
||||
extern int set_t1;
|
||||
extern long sched_timer1;
|
||||
extern long sched_timer2;
|
||||
|
||||
extern int adj_time_pending;
|
||||
extern long sched_adjtime;
|
||||
extern long schedule_event;
|
||||
|
||||
|
@ -261,11 +239,8 @@ extern int write_files( void ); /* used in debugger.c */
|
|||
/***************/
|
||||
/* emu_timer.c */
|
||||
/***************/
|
||||
extern void reset_timer( int timer );
|
||||
extern void start_timer( int timer );
|
||||
extern void restart_timer( int timer );
|
||||
extern void stop_timer( int timer );
|
||||
extern word_64 get_timer( int timer );
|
||||
|
||||
extern t1_t2_ticks get_t1_t2( void );
|
||||
extern void set_accesstime( void );
|
||||
|
@ -273,108 +248,29 @@ extern void set_accesstime( void );
|
|||
/********************/
|
||||
/* hp48emu_memory.c */
|
||||
/********************/
|
||||
extern void ( *write_nibble )( long addr, int val );
|
||||
extern int ( *read_nibble )( long addr );
|
||||
extern int ( *read_nibble_crc )( long addr );
|
||||
|
||||
/****************/
|
||||
/* emu_memory.c */
|
||||
/****************/
|
||||
extern long read_nibbles( long addr, int len );
|
||||
extern void dev_memory_init( void ); /* */
|
||||
|
||||
/*****************/
|
||||
/* emu_actions.c */
|
||||
/*****************/
|
||||
void push_return_addr( long addr );
|
||||
long pop_return_addr( void );
|
||||
void register_to_status( unsigned char* r );
|
||||
void status_to_register( unsigned char* r );
|
||||
void swap_register_status( unsigned char* r );
|
||||
void clear_status( void );
|
||||
void set_program_stat( int n );
|
||||
void clear_program_stat( int n );
|
||||
int get_program_stat( int n );
|
||||
void clear_hardware_stat( int op );
|
||||
int is_zero_hardware_stat( int op );
|
||||
void set_register_bit( unsigned char* reg, int n );
|
||||
void clear_register_bit( unsigned char* reg, int n );
|
||||
int get_register_bit( unsigned char* reg, int n );
|
||||
void set_register_nibble( unsigned char* reg, int n, unsigned char val );
|
||||
unsigned char get_register_nibble( unsigned char* reg, int n );
|
||||
void register_to_address( unsigned char* reg, word_20* dat, int s );
|
||||
void add_address( word_20* dat, int add );
|
||||
void load_constant( unsigned char* reg, int n, long addr );
|
||||
void store( word_20 dat, unsigned char* reg, int code );
|
||||
void store_n( word_20 dat, unsigned char* reg, int n );
|
||||
void recall( unsigned char* reg, word_20 dat, int code );
|
||||
void recall_n( unsigned char* reg, word_20 dat, int n );
|
||||
long dat_to_addr( unsigned char* dat );
|
||||
void addr_to_dat( long addr, unsigned char* dat );
|
||||
extern void do_kbd_int( void );
|
||||
void do_interupt( void );
|
||||
void do_in( void );
|
||||
void do_reset( void );
|
||||
void do_configure( void );
|
||||
void do_unconfigure( void );
|
||||
void do_inton( void );
|
||||
void do_intoff( void );
|
||||
void do_return_interupt( void );
|
||||
void do_reset_interrupt_system( void );
|
||||
void do_shutdown( void );
|
||||
int get_identification( void );
|
||||
|
||||
/******************/
|
||||
/* emu_register.c */
|
||||
/******************/
|
||||
void add_p_plus_one( unsigned char* r );
|
||||
void add_register_constant( unsigned char* res, int code, int val );
|
||||
void sub_register_constant( unsigned char* res, int code, int val );
|
||||
void add_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
|
||||
int code );
|
||||
void sub_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
|
||||
int code );
|
||||
void complement_2_register( unsigned char* r, int code );
|
||||
void complement_1_register( unsigned char* r, int code );
|
||||
void inc_register( unsigned char* r, int code );
|
||||
void dec_register( unsigned char* r, int code );
|
||||
void zero_register( unsigned char* r, int code );
|
||||
void or_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
|
||||
int code );
|
||||
void and_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
|
||||
int code );
|
||||
void copy_register( unsigned char* to, unsigned char* from, int code );
|
||||
void exchange_register( unsigned char* r1, unsigned char* r2, int code );
|
||||
void exchange_reg( unsigned char* r, word_20* d, int code );
|
||||
void shift_left_register( unsigned char* r, int code );
|
||||
void shift_left_circ_register( unsigned char* r, int code );
|
||||
void shift_right_register( unsigned char* r, int code );
|
||||
void shift_right_circ_register( unsigned char* r, int code );
|
||||
void shift_right_bit_register( unsigned char* r, int code );
|
||||
int is_zero_register( unsigned char* r, int code );
|
||||
int is_not_zero_register( unsigned char* r, int code );
|
||||
int is_equal_register( unsigned char* r1, unsigned char* r2, int code );
|
||||
int is_not_equal_register( unsigned char* r1, unsigned char* r2, int code );
|
||||
int is_less_register( unsigned char* r1, unsigned char* r2, int code );
|
||||
int is_less_or_equal_register( unsigned char* r1, unsigned char* r2, int code );
|
||||
int is_greater_register( unsigned char* r1, unsigned char* r2, int code );
|
||||
int is_greater_or_equal_register( unsigned char* r1, unsigned char* r2,
|
||||
int code );
|
||||
|
||||
/****************/
|
||||
/* emu_serial.c */
|
||||
/****************/
|
||||
extern int init_serial( void );
|
||||
extern void serial_baud( int baud );
|
||||
extern void transmit_char( void );
|
||||
extern void receive_char( void );
|
||||
|
||||
/*****************/
|
||||
/* emu_emulate.c */
|
||||
/*****************/
|
||||
extern void emulate( void );
|
||||
int step_instruction( void );
|
||||
void schedule( void );
|
||||
void load_addr( word_20* dat, long addr, int n );
|
||||
extern int step_instruction( void );
|
||||
extern void schedule( void );
|
||||
extern void load_addr( word_20* dat, long addr, int n );
|
||||
|
||||
#endif /* !_HP48_H */
|
||||
|
|
115
src/emulator_inner.h
Normal file
115
src/emulator_inner.h
Normal file
|
@ -0,0 +1,115 @@
|
|||
#ifndef _EMULATOR_INNER_H
|
||||
#define _EMULATOR_INNER_H 1
|
||||
|
||||
#include "emulator.h"
|
||||
|
||||
#define OUT_FIELD 17
|
||||
|
||||
#define T1_TIMER 0
|
||||
#define T2_TIMER 1 /* unused? */
|
||||
|
||||
extern int adj_time_pending;
|
||||
|
||||
/***************/
|
||||
/* emu_timer.c */
|
||||
/***************/
|
||||
extern void reset_timer( int timer );
|
||||
extern void restart_timer( int timer );
|
||||
extern word_64 get_timer( int timer );
|
||||
|
||||
/********************/
|
||||
/* hp48emu_memory.c */
|
||||
/********************/
|
||||
extern void ( *write_nibble )( long addr, int val );
|
||||
extern int ( *read_nibble_crc )( long addr );
|
||||
|
||||
/****************/
|
||||
/* emu_memory.c */
|
||||
/****************/
|
||||
extern void dev_memory_init( void ); /* */
|
||||
|
||||
/*****************/
|
||||
/* emu_actions.c */
|
||||
/*****************/
|
||||
void push_return_addr( long addr );
|
||||
long pop_return_addr( void );
|
||||
void register_to_status( unsigned char* r );
|
||||
void status_to_register( unsigned char* r );
|
||||
void swap_register_status( unsigned char* r );
|
||||
void clear_status( void );
|
||||
void set_program_stat( int n );
|
||||
void clear_program_stat( int n );
|
||||
int get_program_stat( int n );
|
||||
void clear_hardware_stat( int op );
|
||||
int is_zero_hardware_stat( int op );
|
||||
void set_register_bit( unsigned char* reg, int n );
|
||||
void clear_register_bit( unsigned char* reg, int n );
|
||||
int get_register_bit( unsigned char* reg, int n );
|
||||
void set_register_nibble( unsigned char* reg, int n, unsigned char val );
|
||||
unsigned char get_register_nibble( unsigned char* reg, int n );
|
||||
void register_to_address( unsigned char* reg, word_20* dat, int s );
|
||||
void add_address( word_20* dat, int add );
|
||||
void load_constant( unsigned char* reg, int n, long addr );
|
||||
void store( word_20 dat, unsigned char* reg, int code );
|
||||
void store_n( word_20 dat, unsigned char* reg, int n );
|
||||
void recall( unsigned char* reg, word_20 dat, int code );
|
||||
void recall_n( unsigned char* reg, word_20 dat, int n );
|
||||
long dat_to_addr( unsigned char* dat );
|
||||
void addr_to_dat( long addr, unsigned char* dat );
|
||||
void do_interupt( void );
|
||||
void do_in( void );
|
||||
void do_reset( void );
|
||||
void do_configure( void );
|
||||
void do_unconfigure( void );
|
||||
void do_inton( void );
|
||||
void do_intoff( void );
|
||||
void do_return_interupt( void );
|
||||
void do_reset_interrupt_system( void );
|
||||
void do_shutdown( void );
|
||||
int get_identification( void );
|
||||
|
||||
/******************/
|
||||
/* emu_register.c */
|
||||
/******************/
|
||||
void add_p_plus_one( unsigned char* r );
|
||||
void add_register_constant( unsigned char* res, int code, int val );
|
||||
void sub_register_constant( unsigned char* res, int code, int val );
|
||||
void add_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
|
||||
int code );
|
||||
void sub_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
|
||||
int code );
|
||||
void complement_2_register( unsigned char* r, int code );
|
||||
void complement_1_register( unsigned char* r, int code );
|
||||
void inc_register( unsigned char* r, int code );
|
||||
void dec_register( unsigned char* r, int code );
|
||||
void zero_register( unsigned char* r, int code );
|
||||
void or_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
|
||||
int code );
|
||||
void and_register( unsigned char* res, unsigned char* r1, unsigned char* r2,
|
||||
int code );
|
||||
void copy_register( unsigned char* to, unsigned char* from, int code );
|
||||
void exchange_register( unsigned char* r1, unsigned char* r2, int code );
|
||||
void exchange_reg( unsigned char* r, word_20* d, int code );
|
||||
void shift_left_register( unsigned char* r, int code );
|
||||
void shift_left_circ_register( unsigned char* r, int code );
|
||||
void shift_right_register( unsigned char* r, int code );
|
||||
void shift_right_circ_register( unsigned char* r, int code );
|
||||
void shift_right_bit_register( unsigned char* r, int code );
|
||||
int is_zero_register( unsigned char* r, int code );
|
||||
int is_not_zero_register( unsigned char* r, int code );
|
||||
int is_equal_register( unsigned char* r1, unsigned char* r2, int code );
|
||||
int is_not_equal_register( unsigned char* r1, unsigned char* r2, int code );
|
||||
int is_less_register( unsigned char* r1, unsigned char* r2, int code );
|
||||
int is_less_or_equal_register( unsigned char* r1, unsigned char* r2, int code );
|
||||
int is_greater_register( unsigned char* r1, unsigned char* r2, int code );
|
||||
int is_greater_or_equal_register( unsigned char* r1, unsigned char* r2,
|
||||
int code );
|
||||
|
||||
/****************/
|
||||
/* emu_serial.c */
|
||||
/****************/
|
||||
extern void serial_baud( int baud );
|
||||
extern void transmit_char( void );
|
||||
extern void receive_char( void );
|
||||
|
||||
#endif /* _EMULATOR_INNER_H */
|
Loading…
Add table
Reference in a new issue