inline hp48_device/check_devices()

This commit is contained in:
Gwenhael Le Moine 2023-09-12 14:48:24 +02:00
parent 2f45a02a10
commit 2136cdc775
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
3 changed files with 55 additions and 55 deletions

View file

@ -306,8 +306,6 @@ extern void load_addr( word_20* dat, long addr, int n ); /* hp48_emulate.c */
/* #ifndef _DEVICE_H */
/* #define _DEVICE_H 1 */
extern void check_devices( void ); /* hp48_device.c */
extern void init_display( void ); /* hp48_device.c */
extern void update_display( void ); /* hp48_device.c */
extern void redraw_display( void ); /* hp48_device.c */

View file

@ -19,54 +19,6 @@ extern int device_check;
device_t device;
void check_devices( void ) {
if ( device.display_touched > 0 && device.display_touched-- == 1 ) {
device.display_touched = 0;
update_display();
}
if ( device.display_touched > 0 ) {
device_check = 1;
}
if ( device.contrast_touched ) {
device.contrast_touched = 0;
adjust_contrast( display.contrast );
}
if ( device.ann_touched ) {
device.ann_touched = 0;
draw_annunc();
}
if ( device.baud_touched ) {
device.baud_touched = 0;
serial_baud( saturn.baud );
}
if ( device.ioc_touched ) {
device.ioc_touched = 0;
if ( ( saturn.io_ctrl & 0x02 ) && ( saturn.rcs & 0x01 ) ) {
do_interupt();
}
}
if ( device.rbr_touched ) {
device.rbr_touched = 0;
receive_char();
}
if ( device.tbr_touched ) {
device.tbr_touched = 0;
transmit_char();
}
if ( device.t1_touched ) {
saturn.t1_instr = 0;
sched_timer1 = saturn.t1_tick;
restart_timer( T1_TIMER );
set_t1 = saturn.timer1;
device.t1_touched = 0;
}
if ( device.t2_touched ) {
saturn.t2_instr = 0;
sched_timer2 = saturn.t2_tick;
device.t2_touched = 0;
}
}
/*******/
/* LCD */
/*******/

View file

@ -2254,7 +2254,60 @@ inline void schedule( void ) {
if ( device.display_touched < 0 )
device.display_touched = 1;
}
check_devices();
if ( device.display_touched > 0 && device.display_touched-- == 1 ) {
device.display_touched = 0;
update_display();
}
if ( device.display_touched > 0 )
device_check = 1;
if ( device.contrast_touched ) {
device.contrast_touched = 0;
adjust_contrast( display.contrast );
}
if ( device.ann_touched ) {
device.ann_touched = 0;
draw_annunc();
}
if ( device.baud_touched ) {
device.baud_touched = 0;
serial_baud( saturn.baud );
}
if ( device.ioc_touched ) {
device.ioc_touched = 0;
if ( ( saturn.io_ctrl & 0x02 ) && ( saturn.rcs & 0x01 ) )
do_interupt();
}
if ( device.rbr_touched ) {
device.rbr_touched = 0;
receive_char();
}
if ( device.tbr_touched ) {
device.tbr_touched = 0;
transmit_char();
}
if ( device.t1_touched ) {
saturn.t1_instr = 0;
sched_timer1 = saturn.t1_tick;
restart_timer( T1_TIMER );
set_t1 = saturn.timer1;
device.t1_touched = 0;
}
if ( device.t2_touched ) {
saturn.t2_instr = 0;
sched_timer2 = saturn.t2_tick;
device.t2_touched = 0;
}
sched_display = SCHED_NEVER;
if ( device.display_touched ) {
if ( device.display_touched < sched_display )
@ -2273,7 +2326,6 @@ inline void schedule( void ) {
schedule_event = sched_receive;
if ( ( sched_adjtime -= steps ) <= 0 ) {
sched_adjtime = SCHED_ADJTIME;
if ( saturn.PC < SrvcIoStart || saturn.PC > SrvcIoEnd ) {
@ -2301,10 +2353,8 @@ inline void schedule( void ) {
}
saturn.timer1 &= 0x0f;
} else {
} else
adj_time_pending = 1;
}
}
if ( sched_adjtime < schedule_event )
schedule_event = sched_adjtime;