From 7f13d772f7047645ec19d0784ad7f00c415ca90c Mon Sep 17 00:00:00 2001 From: "LGB (Gabor Lenart)" Date: Sat, 16 Jul 2022 11:31:17 +0200 Subject: [PATCH] M65: SID osc3 read val, FPGA temperature Add emulation of some source of possible entropy used by some programs to generate "random" numbers. For SID regs, the behaviour is VERY MUCH NOT correct, but still better than before when reading those registers produced a constant value only ... --- targets/mega65/io_mapper.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/targets/mega65/io_mapper.c b/targets/mega65/io_mapper.c index 8c241b62..85c781dc 100644 --- a/targets/mega65/io_mapper.c +++ b/targets/mega65/io_mapper.c @@ -144,6 +144,8 @@ Uint8 io_read ( unsigned int addr ) switch (addr & 0x5F) { case 0x19: return get_mouse_x_via_sid(); case 0x1A: return get_mouse_y_via_sid(); + case 0x1B: return rand(); // oscillator-3 status read/only, generate some random byte here, even if it's not correct + case 0x1C: return rand(); // -- "" -- } return 0xFF; case 0x16: // $D600-$D6FF ~ C65 I/O mode @@ -206,6 +208,10 @@ Uint8 io_read ( unsigned int addr ) case 0x2E: case 0x2F: return cpld_firmware_version[addr - 0x2C]; + case 0xDE: // D6DE: FPGA die temperatore, low byte: assuming to be 0, but the low nybble contains a kind of "noise" only + return rand() & 0xF; + case 0xDF: // D6DF: FPGA die temperature, high byte: assuming to be 164 (just because I see that on a real MEGA65 currently at my room's temperature ...) + return 164; default: DEBUG("MEGA65: reading MEGA65 specific I/O @ $D6%02X result is $%02X" NL, addr, D6XX_registers[addr]); return D6XX_registers[addr];