New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Execute loop target cycles computation ignores full-speed? #61
Comments
I am not sure. Before we look at your solution, are you saying that my version of the full speed does not do anything (other than skipping the video update)? I can't figure it out any longer... |
This is sa2 with no changes, with enhanced disk speed off, just added logging in
The first number is a microsecond timestamp, so this appears to be called every ~3.9ms (but a bit wild if you do the math), but given:
I would expect the gap between calls to With the patch, the access pattern becomes:
so it gets called every ~7.7ms. With enhanced disk speed on, I see stretches in the unmodified code that are the same ~3.5ms, but also bursts where it's executing more cycles (8163 versus 2000-6000) in very short (~932μs!) frames:
With the patch and enhanced disk speed on, the bursts look like this:
so sleeping a lot less and in some cases not at all (where the target number of instructions might be too high), but the 10 logs cover 72.2ms while the prior (enhanced disk speed off) logs covered 77.1ms. In the unmodified case, the pasted logs show ~8.75 cycles per μs. The logs of the patched case cover a lot more time, but the logs show ~28.3 cycles per μs. This might be because it didn't have to run through the audio/event/video bits as many times as the unmodified code had to. My expectation when reading the code was that turning off enhanced disk speed would have no effect on the unpatched version because it's executing instructions as fast as it possibly could whenever it's not doing audio/events/video, but it does slow down when I turn it off so I think the So I think the only way the enhanced disk speed can be taken advantage of is if the CPU isn't starved by |
I was looking at your patch and you try to estimate the actual speed and re-apply it next time. How AppleWin deals with this is different and I should probably just do the same
First of all I run in blocks of 16ms, not 1ms (Windows timers seem to be a lot better, and I rely on OpenGL to go at the correct speed), I don't do 3, and you see here AppleWin/source/frontends/sdl/main.cpp Lines 158 to 163 in 2abca0c
So, re-reading my code, I can't figure out where I gain speed, but if I simply skipped VideoPresentScreen in full speed (except every wall-clock Frame), it would be simpler.In this case I should ignore the real speed and run at fixed speed always (which I do). |
Found it: AppleWin/source/frontends/sdl/sdlframe.cpp Line 689 in 2abca0c
So, yes. |
Ok. I'm going to wait to see how you go about this and pattern my real fix after that. Thanks! |
This is what AW does: https://github.com/AppleWin/AppleWin/blob/a243efc74bf499e487ce0008adceb831da8fd890/source/Windows/AppleWin.cpp#L181 to reset the wallclock counter. |
… speed. But only call it after 16ms wall clock. Fixes #61 Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
Could you please have a look at that commit and see if it works for you. |
I think the delay/sleep in the main loop is necessary, which then shifts the problem to correctly determine the right number of cycles to execute in "turbo" mode. Avoiding the screen refresh is probably also part of the right fix (because refreshing faster than 60/120 Hz is certainly pointless), but if you call right back into So basically I'm thinking there are two modes:
and the tight main loop does not allow the normal mode. |
When running in full speed we do indeed want 100% CPU utilisation either because it is running the emulation or repainting the screen. With my change (modulo a bug), the amount of cycles executed each time in full speed should make little or no difference. The only difference between your |
Sorry, I must be explaining it poorly. The problem isn't that it pegs the CPU when in turbo mode, but that it pegs the CPU during normal mode. My expectation is that in normal mode we call The key to the fix that I was proposing is the But inserting the |
I have to admit that measuring CPU utilisation has always been complicated. When I run What I found more interesting is to see the maximum FPS when you do not wait for VSYNC which the same situation I get 400 FPS. If I skip Are you saying that you see high CPU utilisation during normal execution or full speed? I intentionally do not want any Can you try to run with |
|
This is odd.
And I run at 60 FPS, you seem to be running at 300 FPS. What does the Help dialog say? In a normal one, the call to Can you run
|
The help screen says 23x-24x fps.
Try any other driver and I get:
|
This does not add up. Either my timer or ImGui Framerate are wrong. AppleWin/source/frontends/sdl/main.cpp Line 147 in c70377f
https://github.com/ocornut/imgui/blob/6d5388448794f76cc92576a74ad3cb17da2fca84/imgui.cpp#L3915-L3919 When I run here, the 2 agree. |
Sorry, by “23x-24x” I mean 230-something to 240-something. I will try out the ideas. To summarize, you think the right way to run this loop is with the main outer loop calling in to Execute as often as it can, but limiting the video update to the actual display frame rate, and the idle period is basically waiting for vsync? I may have less time these next few days, but I’ll let you know how it goes. Thanks! |
Ok, then it all makes sense.
This seems to imply that SDL knows that it should sync every 1 video frame, but then it does not do it. Maybe you could reach out to the SDL forum and see if they know anything about it. |
commit 364cfcb Author: Andrea Odetti <mariofutire@gmail.com> Date: Sun Jan 16 20:26:02 2022 +0000 Debugger: add some more flags & switches. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 586f094 Author: Andrea Odetti <mariofutire@gmail.com> Date: Sun Jan 16 19:17:57 2022 +0000 Update ImGui. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 6c6409b Merge: 26a7293 af81434 Author: Andrea Odetti <mariofutire@gmail.com> Date: Sun Jan 16 11:16:39 2022 +0000 Merge remote-tracking branch 'upstream/master' commit af81434 Author: tomcw <tomcw@users.noreply.github.com> Date: Sat Jan 15 18:01:41 2022 +0000 Support AN3 for IIe (AppleWin#1018) (Fix IOUDIS for IIc - $C07E/F was backwards) commit 26a7293 Merge: c70377f d88ab11 Author: Andrea <mariofutire@gmail.com> Date: Fri Jan 14 17:36:28 2022 +0000 Merge pull request audetto#62 from audetto/fullspeed sa2: do not call VideoPresentScreen every Apple ][ frame when in full… commit d88ab11 Author: Andrea Odetti <mariofutire@gmail.com> Date: Tue Jan 11 18:07:57 2022 +0000 sa2: do not call VideoPresentScreen every Apple ][ frame when in full speed. But only call it after 16ms wall clock. Fixes audetto#61 Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit c70377f Author: Andrea Odetti <mariofutire@gmail.com> Date: Tue Jan 11 17:50:08 2022 +0000 ImGui: avoid non-reentrant call to VideoPresentScreen(). The debugger (which calls VideoPresentScreen) is execute in immediate mode from VideoPresentScreen. Is this a design problem? Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 2abca0c Author: Andrea Odetti <mariofutire@gmail.com> Date: Mon Jan 10 15:38:25 2022 +0000 Update ImGui. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 3348d44 Author: Andrea Odetti <mariofutire@gmail.com> Date: Mon Jan 10 15:38:13 2022 +0000 SaveState: fix some issues in the order of things. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 726b05c Author: Andrea Odetti <mariofutire@gmail.com> Date: Mon Jan 10 12:00:18 2022 +0000 cpack: extract version number from resources. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 0264538 Merge: f557566 5fbd833 Author: Andrea Odetti <mariofutire@gmail.com> Date: Sat Jan 8 08:57:04 2022 +0000 Merge remote-tracking branch 'upstream/master' commit 5fbd833 Author: Andrea <mariofutire@gmail.com> Date: Fri Jan 7 21:06:24 2022 +0000 Screenshot: reset file pointer to the end. (PR AppleWin#1016) commit f557566 Merge: e8fe81c aa4af5e Author: Andrea Odetti <mariofutire@gmail.com> Date: Thu Jan 6 18:55:38 2022 +0000 Merge remote-tracking branch 'upstream/master' commit aa4af5e Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Thu Jan 6 10:26:30 2022 -0800 Debugger: Fix DF E937 not checking for 0.0 correctly commit 65e4859 Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Thu Jan 6 10:13:27 2022 -0800 Debugger: Cleanup DB DB2 DB4 DB8 DW DW2 DW4 DF DS commit ae214a1 Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Thu Jan 6 10:11:33 2022 -0800 Debugger: Cleanup: Add note about magic number 200 commit 8667c0e Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Thu Jan 6 10:10:59 2022 -0800 Debugger: Cleanup: Add note about DISASM ID commit 182e48e Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Thu Jan 6 10:10:09 2022 -0800 Debugger: Add: First pass of DF commit 32ee96f Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Thu Jan 6 08:24:55 2022 -0800 Debugger: Cleanup FormatNopcodeBytes() commit e8fe81c Merge: d0601d1 7c4855e Author: Andrea Odetti <mariofutire@gmail.com> Date: Thu Jan 6 14:25:28 2022 +0000 Merge remote-tracking branch 'upstream/master' commit 7c4855e Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Wed Jan 5 15:42:34 2022 -0800 Debugger: Cleanup DISASM_DISPLAY_ enums commit ca1bea3 Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Wed Jan 5 15:41:47 2022 -0800 Debugger: Add comment about DISK command commit 225b290 Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Wed Jan 5 15:41:18 2022 -0800 Debugger: Update wish list commit d0601d1 Merge: c2a2553 545c79f Author: Andrea Odetti <mariofutire@gmail.com> Date: Wed Jan 5 18:45:35 2022 +0000 Merge remote-tracking branch 'upstream/master' commit 545c79f Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Wed Jan 5 08:55:17 2022 -0800 Debugger: Cleanup: Nopcode_e commit 7853c1c Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Wed Jan 5 08:54:54 2022 -0800 Debugger: Cleanup commit 8d864c2 Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Tue Jan 4 23:37:38 2022 -0800 Cleanup: getVideoScannerAddressTXT() and getVideoScannerAddressHGR() to make it easier to debug commit 98a4481 Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Tue Jan 4 23:37:06 2022 -0800 Debugger: 2.9.1.13 Added: CD now detects .. to change to the previous directory and chops the trailing sub-directory from the current path. commit e91c5c0 Merge: 2a5e156 e14339e Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Tue Jan 4 21:41:08 2022 -0800 Merged commit 2a5e156 Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Tue Jan 4 21:40:23 2022 -0800 Debugger: 2.9.1.12 Added: New commands HGR0, HGR3, HGR4, HGR5 to see pages /usr/bin/bash0, 0, 0, respectively. commit e14339e Author: tomcw <tomcw@users.noreply.github.com> Date: Tue Jan 4 20:19:21 2022 +0000 Registry: fix support for legacy 'Harddisk Enable' key (AppleWin#1015) commit 1613671 Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Tue Jan 4 11:29:18 2022 -0800 Debugger: Add note for 2.9.1.11 commit 5e70f79 Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Tue Jan 4 11:21:42 2022 -0800 Debugger: 2.9.1.11 Fixed: Right justify signed decimal values. commit f3c0e15 Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Tue Jan 4 11:20:54 2022 -0800 Debugger: 2.9.1.10 Fixed: Immedate audetto#80 was not showing -128 for the signed decimal value. commit 6b11e24 Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Tue Jan 4 11:20:08 2022 -0800 Debugger: 2.9.1.9 Fixed: Immediate #0 was showing '#' prefix but not showing zero for the signed decimal value. Changed to show the signed decimal value only if non zero. commit 61d6ef5 Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Tue Jan 4 11:17:14 2022 -0800 Debugger: Cleanup old cruft commit c2a2553 Author: Andrea Odetti <mariofutire@gmail.com> Date: Tue Jan 4 17:34:16 2022 +0000 Update ImGui. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 4a51835 Merge: 1f1a0f0 f03c09d Author: Andrea <mariofutire@gmail.com> Date: Tue Jan 4 17:33:27 2022 +0000 Merge pull request audetto#56 from audetto/paths Separate Frame from Resource folder to support native MacOS port. commit 18b4581 Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Tue Jan 4 09:28:33 2022 -0800 Debugger: 2.9.1.8 Changed: Disassembly window now lists symbol labels and symbol target address from User2 in orange. commit 17686df Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Tue Jan 4 09:25:51 2022 -0800 Debugger: 2.9.1.7 Added: Extended SYM command to auto-generate symbol names when reverse engineering. NOTE: These symbols will be placed in User2. commit 1f5ca5d Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Tue Jan 4 09:24:52 2022 -0800 Bugfix: Is user requested which symbol table but symbol not found, mark as not in any commit ba9388d Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Mon Jan 3 22:48:12 2022 -0800 Debugger: 2.9.1.6 Added: Branch instructions now show target address commit b3dc408 Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Mon Jan 3 22:47:25 2022 -0800 Debugger: Cleanup commit 65ab105 Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Mon Jan 3 22:18:12 2022 -0800 Debugger: 2.9.1.5 Added: Disassembly window now shows signed decimal values for immediate values. commit aaae1dd Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Mon Jan 3 22:15:41 2022 -0800 Debugger: 2.9.1.4 Changed: Show symbol warnings in Orange, and length of symbols in light blue commit 48e0fe3 Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Mon Jan 3 21:11:25 2022 -0800 Debugger: 2.9.1.3 Added: DB command now optionally supports = commit 3985ee9 Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Mon Jan 3 21:09:11 2022 -0800 Debugger: 2.9.1.2: Fixed: Off by one end address when deleting DisasmData_t commit 19b7d43 Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Mon Jan 3 21:07:49 2022 -0800 Debugger: 2.9.1.1: Added: X command now supports a range and will chop off the appropiate data sections. commit 561a145 Author: michaelangel007 <michaelangel007@sharedcraft.com> Date: Mon Jan 3 21:05:37 2022 -0800 Debugger: Add _GetAutoSymbolName() helper commit f03c09d Author: Andrea Odetti <mariofutire@gmail.com> Date: Mon Jan 3 17:01:22 2022 +0000 Separate Frame from Resource folder to support native MacOS port. Fixes audetto#55 Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 1f1a0f0 Author: Andrea Odetti <mariofutire@gmail.com> Date: Mon Jan 3 16:32:29 2022 +0000 /proc/self/exe does not exist on MacOS. Fixes audetto#54 Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit fa60480 Author: Andrea Odetti <mariofutire@gmail.com> Date: Mon Jan 3 16:02:36 2022 +0000 Add support for screenshot in sa2 via Alt-Ins. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 8de697f Author: Andrea Odetti <mariofutire@gmail.com> Date: Mon Jan 3 16:01:36 2022 +0000 Clean NFrame::FrameRefreshStatus. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit dadba55 Merge: 89d9031 d63e406 Author: Andrea Odetti <mariofutire@gmail.com> Date: Mon Jan 3 15:50:27 2022 +0000 Merge remote-tracking branch 'upstream/master' commit d63e406 Author: Andrea <mariofutire@gmail.com> Date: Mon Jan 3 14:41:03 2022 +0000 Correct BMP creation on Linux (PR AppleWin#1014) Enable BMP Header packing on all compilers. Add virtual function to FrameBase to select where to save screenshots. commit 89d9031 Merge: d6e9a58 9006bcf Author: Andrea <mariofutire@gmail.com> Date: Fri Dec 31 16:30:21 2021 +0000 Merge pull request audetto#52 from audetto/cmake Use cmake native find_package for OpenGL. commit d6e9a58 Author: Andrea Odetti <mariofutire@gmail.com> Date: Fri Dec 31 15:27:34 2021 +0000 applen: add some help with the most important F keys. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit b48893f Merge: 8984232 a243efc Author: Andrea Odetti <mariofutire@gmail.com> Date: Fri Dec 31 14:18:17 2021 +0000 Merge remote-tracking branch 'upstream/master' commit 8984232 Author: Andrea Odetti <mariofutire@gmail.com> Date: Fri Dec 31 14:18:02 2021 +0000 Update ImGui. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 9006bcf Author: Andrea Odetti <mariofutire@gmail.com> Date: Fri Dec 31 14:06:34 2021 +0000 Use cmake native find_package for OpenGL. Could solve audetto#39. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit a243efc Author: tomcw <tomcw@users.noreply.github.com> Date: Fri Dec 24 20:58:04 2021 +0000 Fix for cmd line -dcd not being honoured (regression) commit a727db7 Author: tomcw <tomcw@users.noreply.github.com> Date: Thu Dec 23 15:56:14 2021 +0000 Load save-state: . fix for II/II+ when VidHD's SHR is being updated (init memVidHD ptr). . refactor to consolidate all Mem* related initialisation. commit d865d5c Author: Andrea Odetti <mariofutire@gmail.com> Date: Sun Dec 19 20:26:41 2021 +0000 Update package version. Should really be dynamic. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 9ec45b1 Merge: e545691 0f2d4b1 Author: Andrea Odetti <mariofutire@gmail.com> Date: Sun Dec 19 20:18:37 2021 +0000 Merge remote-tracking branch 'upstream/master' commit 0f2d4b1 Author: tomcw <tomcw@users.noreply.github.com> Date: Sun Dec 19 19:28:50 2021 +0000 1.30.7.0: Update History.txt commit d342f3a Author: tomcw <tomcw@users.noreply.github.com> Date: Sun Dec 19 19:26:07 2021 +0000 Fix for VS2008 commit e545691 Merge: d6aa407 577ffcc Author: Andrea Odetti <mariofutire@gmail.com> Date: Sun Dec 19 15:06:02 2021 +0000 Merge remote-tracking branch 'upstream/master' commit 577ffcc Author: TomCh <tomcw@users.noreply.github.com> Date: Sun Dec 19 14:17:51 2021 +0000 VidHD: Support SHR for Apple II/II+ models (AppleWin#997, PR AppleWin#1013) . Support aux writes for II/II+ (6502 emulation, not 65C02) . Extend VidHD save-state for II/II+ aux memory commit ff65a9f Author: tomcw <tomcw@users.noreply.github.com> Date: Sat Dec 18 21:31:17 2021 +0000 Save-state: remove ASSERT when saving LC for //e or Enhanced //e commit d6aa407 Author: Andrea Odetti <mariofutire@gmail.com> Date: Sat Dec 18 17:58:19 2021 +0000 Fix a couple of warnings / Pi issues. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 86122aa Author: Andrea Odetti <mariofutire@gmail.com> Date: Sat Dec 18 16:45:44 2021 +0000 Update ImGui. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 9130816 Author: Andrea Odetti <mariofutire@gmail.com> Date: Sat Dec 18 16:43:23 2021 +0000 Unify exceptions. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 9590d7c Merge: 151ef94 47f7218 Author: Andrea Odetti <mariofutire@gmail.com> Date: Sat Dec 18 16:38:39 2021 +0000 Merge remote-tracking branch 'upstream/master' commit 47f7218 Author: Andrea <mariofutire@gmail.com> Date: Sat Dec 18 16:37:28 2021 +0000 throw std::runtime_error instead of std::string (PR AppleWin#1011) + add more information about location of yaml parser error. commit 151ef94 Merge: c758e68 651b57f Author: Andrea Odetti <mariofutire@gmail.com> Date: Sun Dec 12 19:55:51 2021 +0000 Merge remote-tracking branch 'upstream/master' commit c758e68 Author: Andrea Odetti <mariofutire@gmail.com> Date: Sun Dec 12 19:40:41 2021 +0000 qapple: patch qapple.pro. Qt Creator is better at debugging qapple. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit b80f7c5 Author: Andrea Odetti <mariofutire@gmail.com> Date: Sun Dec 12 19:15:40 2021 +0000 QApple: fix VidHD. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 28e5703 Author: Andrea Odetti <mariofutire@gmail.com> Date: Sun Dec 12 18:31:53 2021 +0000 Update ImGui. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 651b57f Author: tomcw <tomcw@users.noreply.github.com> Date: Sun Dec 12 11:53:37 2021 +0000 HDD: fix for slowdown during r/w block operations . firmware does busy-wait RMW (rol abs,x) . the IORead then IOWrite was flipping the LED status each access, with a huge performance penalty! commit 19aadbf Author: tomcw <tomcw@users.noreply.github.com> Date: Sat Dec 11 20:27:39 2021 +0000 Add a top-level catch-handler for std::string commit 6dd4390 Author: Andrea Odetti <mariofutire@gmail.com> Date: Sat Dec 11 20:26:38 2021 +0000 libretro: update cards. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit abe7d66 Author: Andrea Odetti <mariofutire@gmail.com> Date: Sat Dec 11 20:08:47 2021 +0000 Update from AW. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit b5b2958 Merge: 9d8d111 408f5fe Author: Andrea Odetti <mariofutire@gmail.com> Date: Sat Dec 11 20:08:34 2021 +0000 Merge remote-tracking branch 'upstream/master' # Conflicts: # source/CardManager.cpp commit 9d8d111 Merge: 0ae58c5 49d0b75 Author: Andrea <mariofutire@gmail.com> Date: Sat Dec 11 20:00:12 2021 +0000 Merge pull request audetto#51 from audetto/vidhd Vidhd commit 408f5fe Author: tomcw <tomcw@users.noreply.github.com> Date: Sat Dec 11 19:30:54 2021 +0000 Fix for loading save-state - eg. where 'AS-S2_End Credits' & 'OMT-PAL' lost their precise frame cycle commit a07ba4a Author: Andrea <mariofutire@gmail.com> Date: Sat Dec 11 18:05:06 2021 +0000 Set SHR alpha channel to 255 for consistency with other video modes. (PR AppleWin#1010) commit 1670e0d Author: tomcw <tomcw@users.noreply.github.com> Date: Sat Dec 11 17:57:35 2021 +0000 Fix for AppleWin-Test: . don't load floppy/harddisk images (in Registry's Config) if also loading a save-state via cmd-line. . done to prevent MessageBox alerts when deleted disk images can't be found. Info: Registry contains refs to disk images, but on test clean-up, the images get deleted. commit 49d0b75 Author: Andrea Odetti <mariofutire@gmail.com> Date: Sat Dec 11 14:25:37 2021 +0000 Set SHR Alpha to 255 for maximum compatibility. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit aa7f327 Author: Andrea Odetti <mariofutire@gmail.com> Date: Sat Dec 11 17:14:09 2021 +0000 SDL: reset hardware in Begin, not Initialize. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 177c9fe Author: Andrea <mariofutire@gmail.com> Date: Sat Dec 11 15:26:09 2021 +0000 Make Slot 0 more consistent with other slots. (PR AppleWin#1006) commit 010d352 Author: tomcw <tomcw@users.noreply.github.com> Date: Sat Dec 11 15:11:04 2021 +0000 HDD read: error if reading block to ROM (AppleWin#1007) commit 2de04b3 Author: tomcw <tomcw@users.noreply.github.com> Date: Sat Dec 11 14:32:00 2021 +0000 Help: Update debugger info for 'brk' cmd commit 0ac210b Author: tomcw <tomcw@users.noreply.github.com> Date: Sat Dec 11 13:41:34 2021 +0000 Debugger: Extend 'brk' cmd: . brk all <on|off> Fix 'brk' cmd for invalid opcodes of length 2 & 3 commit 1ab0d56 Author: tomcw <tomcw@users.noreply.github.com> Date: Fri Dec 10 19:37:58 2021 +0000 HDD: remove magic numbers & add GH ref (AppleWin#1007) commit bb6fa80 Author: tomcw <tomcw@users.noreply.github.com> Date: Thu Dec 9 21:22:13 2021 +0000 HDD r/w: error if r/w overlaps with I/O memory . break to debugger if single-stepping HDD write: support memory accesses across 64KiB boundary commit c594d6e Author: tomcw <tomcw@users.noreply.github.com> Date: Tue Dec 7 21:59:05 2021 +0000 VidHD: Fix SHIFT+PRINTSCRN for 320x200 commit 36e1c5a Author: Andrea Odetti <mariofutire@gmail.com> Date: Sat Dec 4 13:36:33 2021 +0000 Move ExpansionCard utility to separate file. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit b740255 Author: Andrea Odetti <mariofutire@gmail.com> Date: Sat Dec 4 12:47:09 2021 +0000 Fix VidHD card insertion. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit ad6ca9c Author: Andrea Odetti <mariofutire@gmail.com> Date: Sat Dec 4 12:29:57 2021 +0000 Move Initialise/Destroy Emulator to LinuxFrame. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 6e42274 Merge: 9439b1b 3128fdb Author: Andrea Odetti <mariofutire@gmail.com> Date: Fri Dec 3 19:42:53 2021 +0000 Uthernet2 as a Card. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 9439b1b Author: Andrea Odetti <mariofutire@gmail.com> Date: Fri Dec 3 18:46:23 2021 +0000 Incorporate VidHD fro AW. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 79668e4 Merge: 0ae58c5 443545b Author: Andrea Odetti <mariofutire@gmail.com> Date: Fri Dec 3 10:15:27 2021 +0000 Merge remote-tracking branch 'upstream/master' into hd # Conflicts: # source/Card.h commit 443545b Author: TomCh <tomcw@users.noreply.github.com> Date: Tue Nov 30 21:41:02 2021 +0000 Support SHR video modes with a VidHD card (AppleWin#997, PR AppleWin#1004) Support VidHD in slot 3 (via Config GUI or '-s3 vidhd') for SHR video modes only. - AppleWin window is slightly enlarged when VidHD card is inserted. Support IIgs 320x200 (and fill mode) and 640x200 video modes. Debugger: add 'shr' command to view video CUI: Allow user to specify width & height (for full-screen); and allow separate x,y scaling in full-screen mode. commit 0ae58c5 Author: Andrea Odetti <mariofutire@gmail.com> Date: Tue Nov 30 09:23:33 2021 +0000 libretro: include DiscControl in save state. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit a6eea04 Author: Andrea Odetti <mariofutire@gmail.com> Date: Mon Nov 29 20:46:16 2021 +0000 Update 3rd party repos. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 36ab6a8 Author: Andrea Odetti <mariofutire@gmail.com> Date: Mon Nov 29 09:59:34 2021 +0000 cmake changes: 1) always build libappleii as static 2) expose OpenGL as a cmake variable commit 1f1ef6c Author: Andrea Odetti <mariofutire@gmail.com> Date: Sun Nov 28 19:27:56 2021 +0000 libretro: remove poor function. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 97c3472 Author: Andrea Odetti <mariofutire@gmail.com> Date: Sun Nov 28 19:18:38 2021 +0000 libretro: support relative paths in m3u playlists. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit e08363f Author: Andrea Odetti <mariofutire@gmail.com> Date: Sun Nov 28 18:52:40 2021 +0000 libretro: ignore RetroArch request to re-insert the previous image. The idea is that on a multigame floppy, only the first is bootable. This seems the most common use case. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 24a135e Author: Andrea Odetti <mariofutire@gmail.com> Date: Sun Nov 28 18:51:42 2021 +0000 libretro: add m3u as supported extension. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 76317c2 Author: Andrea Odetti <mariofutire@gmail.com> Date: Sun Nov 28 18:49:17 2021 +0000 libwindows: a very tiny step towards compilation of libretro with VS. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit d46c90a Author: Andrea Odetti <mariofutire@gmail.com> Date: Sun Nov 28 14:52:58 2021 +0000 libretro: cosmetic changes. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit a16b2b2 Author: Andrea Odetti <mariofutire@gmail.com> Date: Sun Nov 28 14:29:16 2021 +0000 More elegant serialisation data structure. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 02740ce Author: Andrea Odetti <mariofutire@gmail.com> Date: Sun Nov 28 14:12:55 2021 +0000 libretro: handle m3u format as gamepath. Implement retro_set_initial_image. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 30dbfad Author: Andrea Odetti <mariofutire@gmail.com> Date: Sun Nov 28 13:24:25 2021 +0000 libretro: implement retro_reset(). Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 7037e20 Author: Andrea Odetti <mariofutire@gmail.com> Date: Sat Nov 27 21:27:46 2021 +0000 libretro: implement save/load state. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 741849a Author: Andrea Odetti <mariofutire@gmail.com> Date: Sat Nov 27 13:45:34 2021 +0000 Implement 2nd version of the Disc Control interface. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 117502b Author: Andrea Odetti <mariofutire@gmail.com> Date: Sat Nov 27 11:39:55 2021 +0000 Implement base Disc Control interface. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit cca65ba Author: Andrea Odetti <mariofutire@gmail.com> Date: Sat Nov 27 11:38:40 2021 +0000 Reduce verbosity of key logger. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit eb74e28 Author: Andrea Odetti <mariofutire@gmail.com> Date: Sat Nov 27 10:12:38 2021 +0000 libretro: fix meaning of memory ids. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 34a0baa Author: Andrea Odetti <mariofutire@gmail.com> Date: Fri Nov 26 21:09:16 2021 +0000 Update 3rd party repos. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit fad9da0 Author: Andrea Odetti <mariofutire@gmail.com> Date: Fri Nov 26 20:54:28 2021 +0000 Fix for recent AW. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit f61d207 Merge: f080599 0b2104c Author: Andrea Odetti <mariofutire@gmail.com> Date: Fri Nov 26 20:51:34 2021 +0000 Merge remote-tracking branch 'upstream/master' commit 0b2104c Author: Andrea <mariofutire@gmail.com> Date: Thu Nov 25 20:23:21 2021 +0000 Card::Save/LoadSnapshot (PR AppleWin#1003) Add 2 virtual methods to Card to load and save snapshots. commit f080599 Author: Andrea Odetti <mariofutire@gmail.com> Date: Wed Nov 24 18:02:27 2021 +0000 libretro: support mouse retropad. commit 6175dc8 Author: Andrea Odetti <mariofutire@gmail.com> Date: Wed Nov 24 14:08:14 2021 +0000 Add support for memory / achievements. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 8fd124e Author: Andrea Odetti <mariofutire@gmail.com> Date: Wed Nov 24 14:01:37 2021 +0000 Enable printf warnings. on retro_log_cb. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 759cb5a Author: Andrea Odetti <mariofutire@gmail.com> Date: Mon Nov 22 19:04:48 2021 +0000 libretro: ensure game is released *before* shutdown. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit ea82879 Merge: 7c81aaf abc6314 Author: Andrea Odetti <mariofutire@gmail.com> Date: Mon Nov 22 18:58:44 2021 +0000 Merge remote-tracking branch 'upstream/master' commit 7c81aaf Author: Andrea Odetti <mariofutire@gmail.com> Date: Mon Nov 22 18:53:39 2021 +0000 libretro: controllers are inserted after the Game has loaded. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 0493cad Merge: 8da9f84 6829164 Author: Andrea <mariofutire@gmail.com> Date: Mon Nov 22 18:50:08 2021 +0000 Merge pull request audetto#48 from audetto/cmake Cmake: add ability to select frontends commit 6829164 Author: Andrea Odetti <mariofutire@gmail.com> Date: Sun Nov 21 20:20:37 2021 +0000 Add libretro.h to the git repo. To ease libretro compilation. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 7839aa0 Author: Andrea Odetti <mariofutire@gmail.com> Date: Sun Nov 21 20:09:57 2021 +0000 Add ability to select which frontend to build. cmake .. -DBUILD_SA2=ON or use cmake-gui. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 3128fdb Author: Andrea Odetti <mariofutire@gmail.com> Date: Sun Nov 14 16:06:08 2021 +0000 Ensure the Plug-And-Play works as much as possible. Reset all the IO handlers every time a card is inserted / removed. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit 3c09d75 Author: Andrea Odetti <mariofutire@gmail.com> Date: Sun Nov 14 16:05:28 2021 +0000 Rewrite the Uthernet2 as Card. Signed-off-by: Andrea Odetti <mariofutire@gmail.com> commit abc6314 Author: tomcw <tomcw@users.noreply.github.com> Date: Mon Nov 15 20:26:53 2021 +0000 HDD: fix edge-case for old save-state m_buf_ptr commit 01f89f8 Author: TomCh <tomcw@users.noreply.github.com> Date: Sun Nov 14 17:40:15 2021 +0000 Joystick: Remove buttonlatch & BUTTONTIME (AppleWin#1002)
Hiya, me again. So I was trying to chase down why my app (which does not use the main loop in
source/frontends/sdl/main.cpp
) seems to be much slower than sa2. I've found that sa2 actually calls thewriteAudio
-ProcessEvents
-ExecuteOneFrame
-VideoPresentScreen
sequence in a tight loop. This is surprising to me, and it pegs my CPU at ~42%.I might be missing something big here, but my implementation is actually driven off of a 60 Hz timer, so if it finishes executing a 1/60 slice of 1 MHz 6502 code in less time, it'll just take a nap. This approach keeps the CPU at ~25%, but is of course quite slow. As an experiment, I hacked in the same nap (which computes to about 6 ms each time) to sa2:
and it did slow down just like mine did, but CPU utilization also dropped to ~31%.
I dug into it, and I think the problem is that
Speed::getCyclesTillNext()
doesn't actually know how many cycles to run when at full-speed. It callsSpeed::getCyclesAtFixedSpeed()
and computes 16-ms (because 60 Hz) worth of 1 MHz cycles and returns it, when I think it should be instead computing how many 6502 instructions can actually be executed in a 16-ms slice of the host CPU's time.I tried to basically live-benchmark the emulation to get a rough "6502 cycles per microsecond" and use that to determine how many 6502 instructions to try to run in our 16-ms timeslice if we were at full-speed:
Before I go too far down this rabbit hole, am I actually on the right track, or is the tight loop actually the preferred implementation? The patch above allows both sa2 and my app to run at approximately the same speed but with lower CPU utilization in both cases.
Thanks!
The text was updated successfully, but these errors were encountered: