Skip to content

Commit

Permalink
performance fix for forth83 - don't sleep if -n is set. also, minor c…
Browse files Browse the repository at this point in the history
…leanup
  • Loading branch information
davidly committed Feb 15, 2025
1 parent 4439064 commit 6c4d5f2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions ntvcm.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,10 @@
#include <djl_con.hxx>
#include <djl_cycle.hxx>

#define AUTHOR "David Lee"
#define FILENAME "ntvcm"
#define VERSION "0.1"
#define FILENAME "ntvcm"
#define VERSION "0.1"
#if !defined(BUILD)
#define BUILD ""
#define BUILD ""
#endif
#if !defined(COMMIT_ID)
#define COMMIT_ID ""
Expand Down Expand Up @@ -1604,7 +1603,13 @@ char get_next_kbd_char()

bool is_kbd_char_available()
{
return ( ( g_fileInputOffset < g_fileInputText.size() ) || g_consoleConfig.throttled_kbhit() );
if ( g_fileInputOffset < g_fileInputText.size() )
return true;

if ( g_sleepOnKbdLoop )
return g_consoleConfig.throttled_kbhit();

return g_consoleConfig.portable_kbhit();
} //is_kbd_char_available

bool cpm_read_console( char * buf, size_t bufsize, uint8_t & out_len )
Expand Down
2 changes: 1 addition & 1 deletion x80.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ extern void x80_invoke_out( uint8_t x ); // called for the out instruction
extern void x80_invoke_in( uint8_t x ); // called for the in instruction
extern void x80_invoke_halt( void ); // called when the 8080 hlt (on Z80 halt) instruction is executed
extern uint8_t x80_invoke_hook( void ); // called with the OPCODE_HOOK instruction is executed
extern void x80_hard_exit( const char * pcerror, uint8_t arg1, uint8_t arg2 ); // called on failures to exit the app

// emulator API

Expand All @@ -268,4 +269,3 @@ extern void x80_trace_instructions( bool trace ); // enable/disable
extern void x80_end_emulation(); // stop the emulation
extern void x80_trace_state( void ); // trace the registers
extern const char * x80_render_operation( uint16_t address ); // return a string with the disassembled instruction at address
extern void x80_hard_exit( const char * pcerror, uint8_t arg1, uint8_t arg2 ); // called on failures to exit the app

0 comments on commit 6c4d5f2

Please sign in to comment.