Open keenmaster486 opened 10 months ago
I think what's going on is there are too many UPS (353,293) Your actual emulation time (2.89ms) is fine but there are so many updates to process the overhead of that eats up all the frame time. I added a single, 1ms sleep to the event loop which in theory would cap UPS to 1000. Can you see if that helps?
Pulled the latest and built. I now get a stable 60fps, but PC speaker is still stuttering.
I'm testing it by running Quick Basic and entering the command PLAY "cdefgabc"
, which plays perfectly smoothly on a real 5150.
The stuttering is also noticable in the startup beep and games such as Commander Keen.
Ok, glad we got performance up. I am not going to dig too deeply into speaker issues at this time as the sound system is going to be rewritten soon. For the moment, you can disable sound in the config if it is distracting.
I was verifying that Area 5150 still ran after making some CPU changes, and noticed the audio problem myself. Turns out adding that 1ms sleep has disturbed the timestep calculations and so the emulator has been running slightly above 60fps and starving the audio buffer:
my timestep code is a bit slapdash so I will take the time to refactor it while fixing this. I swear 0.2 is never coming out at this rate...
https://github.com/dbalsom/martypc/assets/21270805/989a0f95-68f8-4d08-a889-34a8c789adda
Having serious issues with the latest for a week or so now. PC speaker making all sorts of weird stuttering noises on startup, and now the keyboard is not working, so the emulator is unusable. See attached video with sound so you can hear my typing as the emulator seems to have a mind of its own, inserting random characters that I did not type, and constant backspaces to delete everything. Happens with EGA or CGA. Tried a fresh martypc.toml, same issue.
sorry you're having issues. can you change debug_keyboard to true in martypc.toml and show the terminal messages when you type a few keys (or see if key events are happening on their own)
either the phantom keystrokes are coming from the window system or from the emulator itself, and this would help determine that.
the current commit also adds a graph in the performance viewer it would be interesting to see.
https://github.com/dbalsom/martypc/assets/21270805/b5bef5d6-3ea4-4fc5-bc43-eb9a6d764255
Looking at the terminal output, the keyboard events it's reporting are the correct ones, reflecting what I'm actually typing. What appears on the screen definitely is not.
what machine configuration are you using?
can you pull the latest commit, then show me with the PIC and PPI viewers open from the Debug->Devices menu?
what we're looking for is if there are spontaneous IRQ1s (keyboard interrupts) and if the 'Last Keyboard Byte' seems to change on its own
https://github.com/dbalsom/martypc/assets/21270805/c7c83eff-cf0d-4e00-8064-01adc49a1394
I'm seeing that Last Keyboard Byte changing spontaneously from AA to 4D several times about once a second.
My machine configuration:
name = "ibm5160_hdd"
type = "Ibm5160"
rom_set = "auto"
speaker = true
[machine.memory]
conventional.size = 0xA0000
conventional.wait_states = 0
# Floppy disk controller
[machine.fdc]
type = "IbmNec"
# Drives connected to controller. Maximum of 4.
[[machine.fdc.drive]]
type = "360k"
image = "marty_util.img"
[[machine.fdc.drive]]
type = "360k"
# Hard disk controller
[machine.hdc]
type = "IbmXebec"
# Drives connected to controller. Maximum of 2.
# Drive #0 - (Typically C:)
[[machine.hdc.drive]]
type = "Mfm"
vhd = "main.vhd"
# Drive #1 - (Typically D:)
[[machine.hdc.drive]]
type = "Mfm"
vhd = "storage.vhd"
# Serial card
[[machine.serial]]
type = "IbmAsync"
[[machine.serial.port]]
io_base = 0x3F8
irq = 4
[[machine.serial.port]]
io_base = 0x2F8
irq = 3
# Video cards
[[machine.video]]
type = "CGA"
clock_mode = "Dynamic"
[machine.keyboard]
type = "ModelF"
layout = "US"
we can see IRQ1 ticking up very fast. so something is generating lots of keyboard interrupts.
4D is the scancode for Numpad 6...
can you disconnect your keyboard and see if the problem still occurs? if you reset the machine does it keep happening on next boot? if you remove the '[machine.keyboard]' section from the config does that stop the interrupts? (you won't be able to type, but if something else is causing it...)
Well I'll be darned, I unplugged my keyboard and plugged it back in again and now the problem's gone.
I wonder why this didn't affect any of my other programs.
Still having PC speaker problems though.
yeah, that is weird. let me know if it comes back.
MartyPC build: Branch:
version_0_2_0
Commit:Built using
cargo build -r --features=ega
Mymartypc.toml
:Output of MartyPC when run:
My machine:
Issue: I'm only getting about 53 fps. Seems like my machine should be able to handle 60. MartyPC does seem to be running only on one core. See attached screenshot of performance monitor: