From a8724da1b7e68693102afce2395414a340ac9748 Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Sat, 16 Sep 2023 17:50:08 +0200 Subject: [PATCH] cleaning more dead or commented code --- src/emu_memory.c | 52 ++++++++++++------------------------------------ src/emulator.h | 1 - src/ui.h | 18 ++++++++++++++--- 3 files changed, 28 insertions(+), 43 deletions(-) diff --git a/src/emu_memory.c b/src/emu_memory.c index 67ddc1f..c74e0d6 100644 --- a/src/emu_memory.c +++ b/src/emu_memory.c @@ -489,16 +489,18 @@ void write_nibble_sx( long addr, int val ) { } return; } + if ( device.display_touched ) return; - if ( addr >= display.disp_start && addr < display.disp_end ) { + + if ( addr >= display.disp_start && addr < display.disp_end ) ui__disp_draw_nibble( addr, val ); - } + if ( display.lines == 63 ) return; - if ( addr >= display.menu_start && addr < display.menu_end ) { + + if ( addr >= display.menu_start && addr < display.menu_end ) ui__menu_draw_nibble( addr, val ); - } } void write_nibble_gx( long addr, int val ) { @@ -600,14 +602,6 @@ void write_nibble_gx( long addr, int val ) { saturn.port2[ ( ( saturn.bank_switch << 18 ) + ( addr - 0xb0000 ) ) & port2_mask ] = val; - /* - if (port2_size > (saturn.bank_switch << 18)) - { - if (port2_is_ram) - saturn.port2[(saturn.bank_switch << 18) - + (addr - 0xb0000)] = val; - } - */ return; } return; @@ -636,14 +630,6 @@ void write_nibble_gx( long addr, int val ) { saturn.port2[ ( ( saturn.bank_switch << 18 ) + ( addr - 0xc0000 ) ) & port2_mask ] = val; - /* - if (port2_size > (saturn.bank_switch << 18)) - { - if (port2_is_ram) - saturn.port2[(saturn.bank_switch << 18) - + (addr - 0xc0000)] = val; - } - */ return; } return; @@ -668,28 +654,22 @@ void write_nibble_gx( long addr, int val ) { saturn.port2[ ( ( saturn.bank_switch << 18 ) + ( addr - 0xc0000 ) ) & port2_mask ] = val; - /* - if (port2_size > (saturn.bank_switch << 18)) - { - if (port2_is_ram) - saturn.port2[(saturn.bank_switch << 18) - + (addr - 0xc0000)] = val; - } - */ return; } return; } + if ( device.display_touched ) return; - if ( addr >= display.disp_start && addr < display.disp_end ) { + + if ( addr >= display.disp_start && addr < display.disp_end ) ui__disp_draw_nibble( addr, val ); - } + if ( display.lines == 63 ) return; - if ( addr >= display.menu_start && addr < display.menu_end ) { + + if ( addr >= display.menu_start && addr < display.menu_end ) ui__menu_draw_nibble( addr, val ); - } } int read_nibble_sx( long addr ) { @@ -1155,13 +1135,6 @@ long read_nibbles( long addr, int len ) { return val; } -void write_nibbles( long addr, long val, int len ) { - while ( len-- > 0 ) { - write_nibble( addr++, val ); - val >>= 4; - } -} - void dev_memory_init( void ) { if ( opt_gx ) { read_nibble = read_nibble_gx; @@ -1172,5 +1145,6 @@ void dev_memory_init( void ) { read_nibble_crc = read_nibble_crc_sx; write_nibble = write_nibble_sx; } + memset( &device, 0, sizeof( device ) ); } diff --git a/src/emulator.h b/src/emulator.h index a47c32e..55736f7 100644 --- a/src/emulator.h +++ b/src/emulator.h @@ -283,7 +283,6 @@ extern int ( *read_nibble_crc )( long addr ); /* emu_memory.c */ /****************/ extern long read_nibbles( long addr, int len ); -void write_nibbles( long addr, long val, int len ); extern void dev_memory_init( void ); /* */ /*****************/ diff --git a/src/ui.h b/src/ui.h index 32a7c3a..11f9cb0 100644 --- a/src/ui.h +++ b/src/ui.h @@ -3,29 +3,41 @@ #include "emulator.h" /* word_4; word_20; */ -/**************/ -/* public API */ -/**************/ +/*************************************************/ +/* public API: if it's there it's used elsewhere */ +/*************************************************/ +/*************************/ /* used in: emu_memory.c */ +/*************************/ extern void ui__disp_draw_nibble( word_20 addr, word_4 val ); extern void ui__menu_draw_nibble( word_20 addr, word_4 val ); /* extern void ui__draw_nibble( int c, int r, int val ); */ +/*****************************************/ /* used in: emu_actions.c, emu_emulate.c */ +/*****************************************/ extern int ui__get_event( void ); +/*****************************************************/ /* used in: emu_actions.c, emu_emulate.c, debugger.c */ +/*****************************************************/ extern void ui__update_LCD( void ); +/**************************/ /* used in: emu_emulate.c */ +/**************************/ extern void ui__adjust_contrast( void ); extern void ui__draw_annunc( void ); +/*********************************/ /* used in: debugger.c, ui_sdl.c */ +/*********************************/ extern void ui__init_LCD( void ); +/*******************/ /* used in: main.c */ +/*******************/ extern void init_ui( void ); #endif /* !_X48_GUI_H */