mostly formatting

This commit is contained in:
Gwenhael Le Moine 2023-09-13 09:28:04 +02:00
parent 43ccdf7699
commit b63db93237
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
7 changed files with 115 additions and 142 deletions

View file

@ -29,7 +29,6 @@ ifeq ($(FULL_WARNINGS), yes)
endif
DOTOS = src/main.o \
src/x48_lcd.o \
src/hp48_emulate.o \
src/hp48_init.o \
src/hp48_serial.o \
@ -41,6 +40,7 @@ DOTOS = src/main.o \
src/timer.o \
src/error_handling.o \
src/x48_resources.o \
src/x48_lcd.o \
src/x48.o
.PHONY: all clean clean-all pretty-code install

View file

@ -277,30 +277,38 @@ extern display_t display;
/* #endif /\* !_DEVICE_H *\/ */
extern saturn_t saturn;
extern void init_saturn( void ); /* hp48_init.c */
extern int init_emulator( void ); /* hp48_init.c */
extern int exit_emulator( void ); /* hp48_init.c */
/***************/
/* hp48_init.c */
/***************/
extern void init_saturn( void );
extern int init_emulator( void );
extern int exit_emulator( void );
extern int read_rom( const char* fname );
extern int read_files( void );
extern int write_files( void );
extern int serial_init( void ); /* hp48_serial.c */
extern void serial_baud( int baud ); /* hp48_serial.c */
extern void transmit_char( void ); /* hp48_serial.c */
extern void receive_char( void ); /* hp48_serial.c */
/*****************/
/* hp48_serial.c */
/*****************/
extern int serial_init( void );
extern void serial_baud( int baud );
extern void transmit_char( void );
extern void receive_char( void );
extern void do_kbd_int( void ); /* hp48emu_actions.c */
extern void do_interupt( void ); /* hp48emu_actions.c */
/********************/
/* hp48emu_memory.c */
/********************/
extern void ( *write_nibble )( long addr, int val );
extern int ( *read_nibble )( long addr );
extern int ( *read_nibble_crc )( long addr );
extern void ( *write_nibble )( long addr, int val ); /* hp48emu_memory.c */
extern int ( *read_nibble )( long addr ); /* hp48emu_memory.c */
extern int ( *read_nibble_crc )( long addr ); /* hp48emu_memory.c */
/******************/
/* hp48_emulate.c */
/******************/
extern void emulate( void );
extern int step_instruction( void );
extern void schedule( void );
extern void load_addr( word_20* dat, long addr, int n );
extern void emulate( void ); /* hp48_emulate.c */
extern int step_instruction( void ); /* hp48_emulate.c */
extern void schedule( void ); /* hp48_emulate.c */
extern int read_rom( const char* fname ); /* hp48_init.c */
extern int read_files( void ); /* hp48_init.c */
extern int write_files( void ); /* hp48_init.c */
extern void load_addr( word_20* dat, long addr, int n ); /* hp48_emulate.c */
#endif /* !_HP48_H */

View file

@ -1,13 +1,12 @@
#include <stdio.h>
#include <unistd.h>
#include "options.h"
#include "hp48.h"
#include "hp48emu.h"
#include "timer.h"
#include "x48.h" /* disp; refresh_display(); get_ui_event() */
extern int throttle;
static long jumpaddr;
unsigned long instructions = 0;

View file

@ -3,132 +3,96 @@
#include "hp48.h"
extern void push_return_addr( long addr ); /* hp48emu_actions.c */
extern long pop_return_addr( void ); /* hp48emu_actions.c */
/********************/
/* hp48emu_memory.c */
/********************/
extern long read_nibbles( long addr, int len );
extern void write_nibbles( long addr, long val, int len );
extern void dev_memory_init( void );
extern void register_to_status( unsigned char* r ); /* hp48emu_actions.c */
extern void status_to_register( unsigned char* r ); /* hp48emu_actions.c */
extern void swap_register_status( unsigned char* r ); /* hp48emu_actions.c */
extern void clear_status( void ); /* hp48emu_actions.c */
/*********************/
/* hp48emu_actions.c */
/*********************/
extern void push_return_addr( long addr );
extern long pop_return_addr( void );
extern void register_to_status( unsigned char* r );
extern void status_to_register( unsigned char* r );
extern void swap_register_status( unsigned char* r );
extern void clear_status( void );
extern void set_program_stat( int n );
extern void clear_program_stat( int n );
extern int get_program_stat( int n );
extern void set_hardware_stat( int op );
extern void clear_hardware_stat( int op );
extern int is_zero_hardware_stat( int op );
extern void set_register_bit( unsigned char* reg, int n );
extern void clear_register_bit( unsigned char* reg, int n );
extern int get_register_bit( unsigned char* reg, int n );
extern void set_register_nibble( unsigned char* reg, int n, unsigned char val );
extern unsigned char get_register_nibble( unsigned char* reg, int n );
extern void register_to_address( unsigned char* reg, word_20* dat, int s );
extern void address_to_register( word_20 dat, unsigned char* reg, int s );
extern void add_address( word_20* dat, int add );
extern char* make_hexstr( long addr, int n );
extern void load_constant( unsigned char* reg, int n, long addr );
extern void load_address( unsigned char* reg, long addr, int n );
extern void store( word_20 dat, unsigned char* reg, int code );
extern void store_n( word_20 dat, unsigned char* reg, int n );
extern void recall( unsigned char* reg, word_20 dat, int code );
extern void recall_n( unsigned char* reg, word_20 dat, int n );
extern long dat_to_addr( unsigned char* dat );
extern void addr_to_dat( long addr, unsigned char* dat );
extern void do_kbd_int( void );
extern void do_interupt( void );
extern void do_in( void );
extern void do_reset( void );
extern void do_configure( void );
extern void do_unconfigure( void );
extern void do_inton( void );
extern void do_intoff( void );
extern void do_return_interupt( void );
extern void do_reset_interrupt_system( void );
extern void do_shutdown( void );
extern int get_identification( void );
extern long read_nibbles( long addr, int len ); /* hp48emu_memory.c */
extern void write_nibbles( long addr, long val,
int len ); /* hp48emu_memory.c */
extern void dev_memory_init( void ); /* hp48emu_memory.c */
extern void set_program_stat( int n ); /* hp48emu_actions.c */
extern void clear_program_stat( int n ); /* hp48emu_actions.c */
extern int get_program_stat( int n ); /* hp48emu_actions.c */
extern void set_hardware_stat( int op ); /* hp48emu_actions.c */
extern void clear_hardware_stat( int op ); /* hp48emu_actions.c */
extern int is_zero_hardware_stat( int op ); /* hp48emu_actions.c */
extern void set_register_bit( unsigned char* reg,
int n ); /* hp48emu_actions.c */
extern void clear_register_bit( unsigned char* reg,
int n ); /* hp48emu_actions.c */
extern int get_register_bit( unsigned char* reg,
int n ); /* hp48emu_actions.c */
extern void set_register_nibble( unsigned char* reg, int n,
unsigned char val ); /* hp48emu_actions.c */
extern unsigned char get_register_nibble( unsigned char* reg,
int n ); /* hp48emu_actions.c */
extern void register_to_address( unsigned char* reg, word_20* dat,
int s ); /* hp48emu_actions.c */
extern void address_to_register( word_20 dat, unsigned char* reg,
int s ); /* hp48emu_actions.c */
extern void add_address( word_20* dat, int add ); /* hp48emu_actions.c */
extern char* make_hexstr( long addr, int n ); /* hp48emu_actions.c */
extern void load_constant( unsigned char* reg, int n,
long addr ); /* hp48emu_actions.c */
extern void load_address( unsigned char* reg, long addr,
int n ); /* hp48emu_actions.c */
extern void store( word_20 dat, unsigned char* reg,
int code ); /* hp48emu_actions.c */
extern void store_n( word_20 dat, unsigned char* reg,
int n ); /* hp48emu_actions.c */
extern void recall( unsigned char* reg, word_20 dat,
int code ); /* hp48emu_actions.c */
extern void recall_n( unsigned char* reg, word_20 dat,
int n ); /* hp48emu_actions.c */
extern long dat_to_addr( unsigned char* dat ); /* hp48emu_actions.c */
extern void addr_to_dat( long addr,
unsigned char* dat ); /* hp48emu_actions.c */
extern void do_in( void ); /* hp48emu_actions.c */
extern void do_reset( void ); /* hp48emu_actions.c */
extern void do_configure( void ); /* hp48emu_actions.c */
extern void do_unconfigure( void ); /* hp48emu_actions.c */
extern void do_inton( void ); /* hp48emu_actions.c */
extern void do_intoff( void ); /* hp48emu_actions.c */
extern void do_return_interupt( void ); /* hp48emu_actions.c */
extern void do_reset_interrupt_system( void ); /* hp48emu_actions.c */
extern void do_shutdown( void ); /* hp48emu_actions.c */
extern int get_identification( void ); /* hp48emu_actions.c */
extern void add_p_plus_one( unsigned char* r ); /* hp48emu_register.c */
extern void add_register_constant( unsigned char* res, int code,
int val ); /* hp48emu_register.c */
extern void sub_register_constant( unsigned char* res, int code,
int val ); /* hp48emu_register.c */
/**********************/
/* hp48emu_register.c */
/**********************/
extern void add_p_plus_one( unsigned char* r );
extern void add_register_constant( unsigned char* res, int code, int val );
extern void sub_register_constant( unsigned char* res, int code, int val );
extern void add_register( unsigned char* res, unsigned char* r1,
unsigned char* r2,
int code ); /* hp48emu_register.c */
unsigned char* r2, int code );
extern void sub_register( unsigned char* res, unsigned char* r1,
unsigned char* r2,
int code ); /* hp48emu_register.c */
extern void complement_2_register( unsigned char* r,
int code ); /* hp48emu_register.c */
extern void complement_1_register( unsigned char* r,
int code ); /* hp48emu_register.c */
extern void inc_register( unsigned char* r, int code ); /* hp48emu_register.c */
extern void dec_register( unsigned char* r, int code ); /* hp48emu_register.c */
extern void zero_register( unsigned char* r,
int code ); /* hp48emu_register.c */
unsigned char* r2, int code );
extern void complement_2_register( unsigned char* r, int code );
extern void complement_1_register( unsigned char* r, int code );
extern void inc_register( unsigned char* r, int code );
extern void dec_register( unsigned char* r, int code );
extern void zero_register( unsigned char* r, int code );
extern void or_register( unsigned char* res, unsigned char* r1,
unsigned char* r2, int code ); /* hp48emu_register.c */
unsigned char* r2, int code );
extern void and_register( unsigned char* res, unsigned char* r1,
unsigned char* r2,
int code ); /* hp48emu_register.c */
extern void copy_register( unsigned char* to, unsigned char* from,
int code ); /* hp48emu_register.c */
extern void exchange_register( unsigned char* r1, unsigned char* r2,
int code ); /* hp48emu_register.c */
extern void exchange_reg( unsigned char* r, word_20* d,
int code ); /* hp48emu_register.c */
extern void shift_left_register( unsigned char* r,
int code ); /* hp48emu_register.c */
extern void shift_left_circ_register( unsigned char* r,
int code ); /* hp48emu_register.c */
extern void shift_right_register( unsigned char* r,
int code ); /* hp48emu_register.c */
extern void shift_right_circ_register( unsigned char* r,
int code ); /* hp48emu_register.c */
extern void shift_right_bit_register( unsigned char* r,
int code ); /* hp48emu_register.c */
extern int is_zero_register( unsigned char* r,
int code ); /* hp48emu_register.c */
extern int is_not_zero_register( unsigned char* r,
int code ); /* hp48emu_register.c */
extern int is_equal_register( unsigned char* r1, unsigned char* r2,
int code ); /* hp48emu_register.c */
unsigned char* r2, int code );
extern void copy_register( unsigned char* to, unsigned char* from, int code );
extern void exchange_register( unsigned char* r1, unsigned char* r2, int code );
extern void exchange_reg( unsigned char* r, word_20* d, int code );
extern void shift_left_register( unsigned char* r, int code );
extern void shift_left_circ_register( unsigned char* r, int code );
extern void shift_right_register( unsigned char* r, int code );
extern void shift_right_circ_register( unsigned char* r, int code );
extern void shift_right_bit_register( unsigned char* r, int code );
extern int is_zero_register( unsigned char* r, int code );
extern int is_not_zero_register( unsigned char* r, int code );
extern int is_equal_register( unsigned char* r1, unsigned char* r2, int code );
extern int is_not_equal_register( unsigned char* r1, unsigned char* r2,
int code ); /* hp48emu_register.c */
extern int is_less_register( unsigned char* r1, unsigned char* r2,
int code ); /* hp48emu_register.c */
int code );
extern int is_less_register( unsigned char* r1, unsigned char* r2, int code );
extern int is_less_or_equal_register( unsigned char* r1, unsigned char* r2,
int code ); /* hp48emu_register.c */
int code );
extern int is_greater_register( unsigned char* r1, unsigned char* r2,
int code ); /* hp48emu_register.c */
int code );
extern int is_greater_or_equal_register( unsigned char* r1, unsigned char* r2,
int code ); /* hp48emu_register.c */
int code );
#endif /* !_HP48_EMU_H */

View file

@ -14,6 +14,7 @@
#include "options.h"
#include "hp48.h"
#include "hp48emu.h"
#include "romio.h"
#include "x48.h"
#include "error_handling.h"

View file

@ -1,7 +1,7 @@
#ifndef _X48_GUI_H
#define _X48_GUI_H 1
#include "hp48.h" /* word_20, word_4 */
#include "hp48.h" /* word_20, word_4 */
#if defined( GUI_IS_X11 )
#include <X11/Xlib.h>

View file

@ -18,6 +18,7 @@ extern void usage( void );
extern void show_version( void );
extern void show_copyright( void );
extern void show_warranty( void );
extern char* get_string_resource_from_db( XrmDatabase db, char* name,
char* class );
extern char* get_string_resource( char* name, char* class );