mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-05-07 18:36:09 +08:00
Add integration device commands to read CPU cycle count and info
This commit is contained in:
parent
e58f5ded15
commit
1c07709727
@ -112,6 +112,14 @@ extern uint16_t DOSBOXID_VAR dosbox_id_baseio;
|
||||
|
||||
#define DOSBOX_ID_REG_INJECT_NMI (0x00808602UL)
|
||||
|
||||
#define DOSBOX_ID_REG_CPU_CYCLES (0x55504300UL) /* fixed cycle count, which may vary if max or auto */
|
||||
#define DOSBOX_ID_REG_CPU_MAX_PERCENT (0x55504301UL) /* for max cycles, percentage from 0 to 100 */
|
||||
#define DOSBOX_ID_REG_CPU_CYCLES_INFO (0x55504302UL) /* info about cycles, including fixed, auto, max */
|
||||
# define DOSBOX_ID_REG_CPU_CYCLES_INFO_MODE_MASK (0xFUL << 0UL)
|
||||
# define DOSBOX_ID_REG_CPU_CYCLES_INFO_FIXED (1UL << 0UL)
|
||||
# define DOSBOX_ID_REG_CPU_CYCLES_INFO_MAX (2UL << 0UL)
|
||||
# define DOSBOX_ID_REG_CPU_CYCLES_INFO_AUTO (3UL << 0UL)
|
||||
|
||||
#define DOSBOX_ID_REG_8237_INJECT_WRITE (0x00823700UL)
|
||||
#define DOSBOX_ID_REG_8237_INJECT_READ (0x00823780UL)
|
||||
|
||||
|
@ -873,6 +873,27 @@ void dosbox_integration_trigger_read() {
|
||||
case DOSBOX_ID_RESET_INDEX_CODE: /* interface reset result */
|
||||
break;
|
||||
|
||||
case DOSBOX_ID_REG_CPU_CYCLES:
|
||||
if (CPU_CycleMax < 0x80000000)
|
||||
dosbox_int_register = (uint32_t)CPU_CycleMax;
|
||||
else
|
||||
dosbox_int_register = (uint32_t)0x7FFFFFFFUL;
|
||||
break;
|
||||
|
||||
case DOSBOX_ID_REG_CPU_MAX_PERCENT:
|
||||
dosbox_int_register = CPU_CyclePercUsed;
|
||||
break;
|
||||
|
||||
case DOSBOX_ID_REG_CPU_CYCLES_INFO:
|
||||
dosbox_int_register = 0;
|
||||
if (CPU_CycleAutoAdjust)
|
||||
dosbox_int_register |= DOSBOX_ID_REG_CPU_CYCLES_INFO_MAX;
|
||||
else if (CPU_AutoDetermineMode &CPU_AUTODETERMINE_CYCLES)
|
||||
dosbox_int_register |= DOSBOX_ID_REG_CPU_CYCLES_INFO_AUTO;
|
||||
else
|
||||
dosbox_int_register |= DOSBOX_ID_REG_CPU_CYCLES_INFO_FIXED;
|
||||
break;
|
||||
|
||||
default:
|
||||
dosbox_int_register = 0xAA55AA55;
|
||||
dosbox_int_error = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user