many small stuff before releasing 5.0.0

This commit is contained in:
Gwenhael Le Moine 2024-09-26 15:40:46 +02:00
parent 493af19b9c
commit 2890dd3831
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
8 changed files with 79 additions and 73 deletions

View file

@ -8,22 +8,23 @@
NAME = saturn
PREFIX = /usr
DOCDIR = $(PREFIX)/doc/$(NAME)
PREFIX ?= /usr
DOCDIR ?= $(PREFIX)/doc/$(NAME)
VERSION_MAJOR = 0
VERSION_MINOR = 1
VERSION_MAJOR = 5
VERSION_MINOR = 0
PATCHLEVEL = 0
OPTIM ?= 2
CFLAGS ?= -O$(OPTIM) \
override CFLAGS := -O$(OPTIM) \
-D_GNU_SOURCE=1 \
-DVERSION_MAJOR=$(VERSION_MAJOR) \
-DVERSION_MINOR=$(VERSION_MINOR) \
-DPATCHLEVEL=$(PATCHLEVEL) \
-I./src/ \
-I./libChf/src/
-I./libChf/src/ \
$(CFLAGS)
LIBS = -L./libChf -lChf

View file

@ -110,11 +110,6 @@ ChfTable message_table[] = {
{MOD_CHF_MODULE_ID, MOD_M_MAP_SZ_CONFIGURED, "Size_configured" },
{MOD_CHF_MODULE_ID, MOD_M_MAP_UNCONFIGURED, "*Unconfigured*" },
{MAIN_CHF_MODULE_ID, MAIN_M_COPYRIGHT,
"saturn %s - A poor-man's emulator of HP48GX, HP49, HP39/40\nCopyright (C) 1998-2000 Ivan Cibrario Bertolotti\n" },
{MAIN_CHF_MODULE_ID, MAIN_M_LICENSE,
"This program is free software, and comes with ABSOLUTELY NO WARRANTY;\nfor details see the accompanying documentation.\n\n" },
{SERIAL_CHF_MODULE_ID, SERIAL_I_CALLED, "Function [%s] called" },
{SERIAL_CHF_MODULE_ID, SERIAL_I_REVISION, "Serial port emulator: [%s]" },
{SERIAL_CHF_MODULE_ID, SERIAL_I_READ, "Read [%s]; value [%01X]" },

View file

@ -161,6 +161,7 @@
between 1 and 32, inclusive. When undefined, Port_2 is not emulated at all.
The default value is 8, that is, Port_2 is emulated and its size is 1Mbyte.
*/
// #define N_PORT_2_BANK ( config.model == MODEL_48GX ? 32 : 1 )
#define N_PORT_2_BANK 32
/* 2.5: SERIAL_FORCE_OPENPTY, SERIAL_FORCE_STREAMSPTY
@ -179,13 +180,6 @@
*/
#define HP49_SUPPORT
/* 3.13: REAL_CPU_SPEED
Define this symbol (recommended) to force the emulated CPU to run
no faster than a software-controlled limit; by default, the limit
is close to the real CPU speed.
*/
#define REAL_CPU_SPEED
/* 3.14: CPU_SLOW_IN
Define this symbol (recommended) to slow down the A=IN and C=IN
instructions depending on the current emulated CPU speed.

View file

@ -245,7 +245,6 @@ static void EmulatorLoop( void )
if ( inner_loop < INNER_LOOP_MIN )
inner_loop = INNER_LOOP_MIN;
#ifdef REAL_CPU_SPEED
/* 3.13: Force an upper limit to the CPU speed if the compile-time option
REAL_CPU_SPEED is defined: inner_loop is limited to
cpu_status.inner_loop_max
@ -254,12 +253,12 @@ static void EmulatorLoop( void )
well, I hope.
The special value cpu_status.inner_loop_max==0 gives maximum speed.
*/
if ( cpu_status.inner_loop_max != 0 && inner_loop >= cpu_status.inner_loop_max ) {
inner_loop = cpu_status.inner_loop_max;
if ( T1_INTERVAL > ela )
usleep( T1_INTERVAL - ela );
}
#endif
if ( config.throttle )
if ( cpu_status.inner_loop_max != 0 && inner_loop >= cpu_status.inner_loop_max ) {
inner_loop = cpu_status.inner_loop_max;
if ( T1_INTERVAL > ela )
usleep( T1_INTERVAL - ela );
}
cpu_status.inner_loop = inner_loop;
old_t = cur_t;

View file

@ -2,8 +2,6 @@
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include "ui4x_config.h"
@ -61,8 +59,12 @@ int main( int argc, char** argv )
}
/* 3.9: Print out MAIN_M_COPYRIGHT and MAIN_M_LICENSE on stdout now */
fprintf( stdout, ChfGetMessage( MAIN_CHF_MODULE_ID, MAIN_M_COPYRIGHT, "" ), "$Revision: 4.1 $" );
/* fprintf( stdout, ChfGetMessage( CHF_MODULE_ID, MAIN_M_LICENSE, "" ) ); */
fprintf( stdout,
"saturn %i.%i.%i - A poor-man's emulator of HP48GX, HP49, HP39/40\nCopyright (C) 1998-2000 Ivan Cibrario "
"Bertolotti\nCopyright (C) Gwenhael Le Moine\n",
VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL );
fprintf( stdout,
"This program is free software, and comes with ABSOLUTELY NO WARRANTY;\nfor details see the accompanying documentation.\n\n" );
init_emulator( &config );

View file

@ -16,6 +16,7 @@ static config_t config = {
.progname = ( char* )"ui4x",
.model = MODEL_48GX,
.throttle = false,
.verbose = false,
.shiftless = false,
@ -51,41 +52,42 @@ static config_t config = {
static void print_config( void )
{
fprintf( stderr, "*** config\n" );
fprintf( stderr, " .progname = %s\n", config.progname );
fprintf( stderr, "--- config\n" );
fprintf( stderr, "-- progname = %s\n", config.progname );
fprintf( stderr, "state_dir_path = %s\n", config.state_dir_path );
fprintf( stderr, "-- mod_file_name = %s\n", config.mod_file_name );
fprintf( stderr, "-- cpu_file_name = %s\n", config.cpu_file_name );
fprintf( stderr, "-- hdw_file_name = %s\n", config.hdw_file_name );
fprintf( stderr, "-- rom_file_name = %s\n", config.rom_file_name );
fprintf( stderr, "-- ram_file_name = %s\n", config.ram_file_name );
fprintf( stderr, "-- port_1_file_name = %s\n", config.port_1_file_name );
fprintf( stderr, "-- port_2_file_name = %s\n", config.port_2_file_name );
fprintf( stderr, "-- hw = %s\n", config.hw );
fprintf( stderr, " .model = %i\n", config.model );
fprintf( stderr, " .verbose = %s\n", config.verbose ? "true" : "false" );
fprintf( stderr, " .shiftless = %s\n", config.shiftless ? "true" : "false" );
fprintf( stderr, "model = %i\n", config.model );
fprintf( stderr, "throttle = %s\n", config.throttle ? "true" : "false" );
fprintf( stderr, "verbose = %s\n", config.verbose ? "true" : "false" );
fprintf( stderr, "shiftless = %s\n", config.shiftless ? "true" : "false" );
fprintf( stderr, " .frontend = %i\n", config.frontend );
fprintf( stderr, "frontend = %i\n", config.frontend );
fprintf( stderr, " .mono = %s\n", config.mono ? "true" : "false" );
fprintf( stderr, " .gray = %s\n", config.gray ? "true" : "false" );
fprintf( stderr, "mono = %s\n", config.mono ? "true" : "false" );
fprintf( stderr, "gray = %s\n", config.gray ? "true" : "false" );
fprintf( stderr, " .chromeless = %s\n", config.chromeless ? "true" : "false" );
fprintf( stderr, " .fullscreen = %s\n", config.fullscreen ? "true" : "false" );
fprintf( stderr, " .scale = %f\n", config.scale );
fprintf( stderr, "chromeless = %s\n", config.chromeless ? "true" : "false" );
fprintf( stderr, "fullscreen = %s\n", config.fullscreen ? "true" : "false" );
fprintf( stderr, "scale = %f\n", config.scale );
fprintf( stderr, " .tiny = %s\n", config.tiny ? "true" : "false" );
fprintf( stderr, " .small = %s\n", config.small ? "true" : "false" );
fprintf( stderr, "tiny = %s\n", config.tiny ? "true" : "false" );
fprintf( stderr, "small = %s\n", config.small ? "true" : "false" );
fprintf( stderr, " .wire_name = %s\n", config.wire_name );
fprintf( stderr, " .ir_name = %s\n", config.ir_name );
fprintf( stderr, "wire_name = %s\n", config.wire_name );
fprintf( stderr, "ir_name = %s\n", config.ir_name );
fprintf( stderr, " .reset = %s\n", config.reset ? "true" : "false" );
fprintf( stderr, " .monitor = %s\n", config.monitor ? "true" : "false" );
fprintf( stderr, " .batchXfer = %s\n", config.batchXfer ? "true" : "false" );
fprintf( stderr, " .state_dir_path = %s\n", config.state_dir_path );
fprintf( stderr, " .mod_file_name = %s\n", config.mod_file_name );
fprintf( stderr, " .cpu_file_name = %s\n", config.cpu_file_name );
fprintf( stderr, " .hdw_file_name = %s\n", config.hdw_file_name );
fprintf( stderr, " .rom_file_name = %s\n", config.rom_file_name );
fprintf( stderr, " .ram_file_name = %s\n", config.ram_file_name );
fprintf( stderr, " .port_1_file_name = %s\n", config.port_1_file_name );
fprintf( stderr, " .port_2_file_name = %s\n", config.port_2_file_name );
fprintf( stderr, " .hw = %s\n", config.hw );
fprintf( stderr, "*** /config\n" );
fprintf( stderr, "reset = %s\n", config.reset ? "true" : "false" );
fprintf( stderr, "monitor = %s\n", config.monitor ? "true" : "false" );
fprintf( stderr, "-- batchXfer = %s\n", config.batchXfer ? "true" : "false" );
fprintf( stderr, "--- /config\n" );
}
/* Path/name dynamic allocator */
@ -107,6 +109,7 @@ config_t* config_init( int argc, char* argv[] )
int clopt_model = -1;
int clopt_verbose = -1;
int clopt_throttle = -1;
int clopt_shiftless = -1;
int clopt_frontend = -1;
int clopt_mono = -1;
@ -134,6 +137,7 @@ config_t* config_init( int argc, char* argv[] )
struct option long_options[] = {
{"help", no_argument, NULL, 'h' },
{"verbose", no_argument, &clopt_verbose, true },
{"throttle", no_argument, &clopt_throttle, true },
{"48sx", no_argument, &clopt_model, MODEL_48SX },
{"48gx", no_argument, &clopt_model, MODEL_48GX },
@ -172,6 +176,14 @@ config_t* config_init( int argc, char* argv[] )
const char* help_text = "usage: %s [options]\n"
"options:\n"
" -h --help what you are reading\n"
" --verbose display more informations\n"
" --throttle throttle CPU speed\n"
" --48gx emulate a HP 48GX\n"
" --48sx emulate a HP 48SX\n"
" --40g emulate a HP 40G\n"
" --49g emulate a HP 49G\n"
" --state-dir=<path> use a different data directory "
"(default: ~/.config/saturnMODEL/)\n"
" --gui graphical (SDL2) front-end (default: true)\n"
" --tui text front-end (default: false)\n"
" --tui-small text small front-end (2×2 pixels per character) (default: "
@ -188,12 +200,10 @@ config_t* config_init( int argc, char* argv[] )
"false)\n"
" --gray make the UI grayscale (default: "
"false)\n"
" --48gx make the GUI looks like a HP 48GX (default: "
"auto)\n"
" --48sx make the GUI looks like a HP 48SX (default: "
"auto)\n"
" --shiftless don't map the shift keys to let them free for numbers (default: "
"false)\n";
"false)\n"
" --reset force a reset\n"
" --monitor start with monitor\n";
while ( c != EOF ) {
c = getopt_long( argc, argv, optstring, long_options, &option_index );
@ -244,13 +254,6 @@ config_t* config_init( int argc, char* argv[] )
}
}
if ( optind < argc ) {
fprintf( stderr, "Invalid arguments : " );
while ( optind < argc )
fprintf( stderr, "%s\n", argv[ optind++ ] );
fprintf( stderr, "\n" );
}
/****************************************************/
/* 2. treat command-line params which have priority */
/****************************************************/
@ -258,6 +261,8 @@ config_t* config_init( int argc, char* argv[] )
config.verbose = clopt_verbose == true;
if ( clopt_model != -1 )
config.model = clopt_model;
if ( clopt_throttle != -1 )
config.throttle = clopt_throttle == true;
if ( clopt_frontend != -1 )
config.frontend = clopt_frontend;
if ( clopt_chromeless != -1 )
@ -324,7 +329,16 @@ config_t* config_init( int argc, char* argv[] )
config.progname = strdup( argv[ 0 ] );
print_config();
if ( config.verbose ) {
print_config();
if ( optind < argc ) {
fprintf( stderr, "%i invalid arguments : ", argc - optind );
while ( optind < argc )
fprintf( stderr, "%s\n", argv[ optind++ ] );
fprintf( stderr, "\n" );
}
}
return &config;
}

View file

@ -15,6 +15,7 @@ typedef struct {
char* progname;
int model;
bool throttle;
bool verbose;
bool shiftless;

View file

@ -2,6 +2,8 @@
#include <SDL2/SDL.h>
#include "config.h"
#include "ui4x_config.h"
#include "ui4x_emulator.h"
#include "ui4x_common.h"
@ -57,8 +59,6 @@ static annunciators_ui_t annunciators_ui[ NB_ANNUNCIATORS ] = {
{.x = 241, .y = 4, .width = ann_io_width, .height = ann_io_height, .bits = ann_io_bitmap },
};
static config_t config;
static int lcd_pixels_buffer[ LCD_WIDTH * LCD_HEIGHT ];
static int last_annunciators = -1;
static int last_contrast = -1;
@ -985,7 +985,7 @@ void ui_get_event_sdl( void )
break;
case SDL_MOUSEBUTTONUP:
hpkey = mouse_click_to_hpkey( event.button.x, event.button.y );
if ( lasthpkey != hpkey || lastticks == -1 || ( SDL_GetTicks() - lastticks < 750 ) )
if ( lasthpkey != hpkey || lastticks == -1 || ( SDL_GetTicks() - lastticks < LONG_PRESS_THR ) )
sdl_release_key( hpkey );
lasthpkey = lastticks = -1;