Hi Bernd, we just had this in the BTTR Software forum, "DOS Ain't Dead". The thread started [1] with the question of how to avoid using 100% CPU time of a CPU core for a DOS VM.
In one of my replies [2] I answered exactly where code should idle. That is, whenever it does a polling loop. For example, as the editor is polling for both keyboard and mouse input, its polling loop should idle the CPU when no input has been received. And I linked to lDebug's idle function [3]. Basically, it tries to run 2F.1680 in the mode this code runs in (can be Protected Mode), then if in Protected Mode and the first call failed it tries to run 2F.1680 by calling down to the Real/Virtual 86 Mode handler, and then if that failed too it tries HLT. (Albeit not in Protected Mode for now, which should probably be made an option rather than internal flag.) Unlike Jerome's V8 power tools sources linked in another reply, I do not store whether the 2F.1680 calls failed. This does make it more inefficient but ultimately that doesn't matter, there is still major power savings even if the 2F.1680 calls are useless no-ops in every iteration. Regards, ecm [1]: https://www.bttr-software.de/forum/forum_entry.php?id=22550 [2]: https://www.bttr-software.de/forum/forum_entry.php?id=22557 [3]: https://hg.pushbx.org/ecm/ldebug/file/97b4a91322eb/source/lineio.asm#l2102 On at 2025-05-14 14:29:25 +0200, "Bernd Böckmann via Freedos-devel" <freedos-devel@lists.sourceforge.net> wrote: >Hi! > >Is anyone into power management, specifically how to properly idle DOS >applications NOT using any of the DOS calls typically triggering DOS idle >handling? > >FreeDOS EDIT does not use any DOS functions in its event handling loop, but >instead does its input polling through INT16 (keyboard) and INT33 (mouse). > >First guess on saving some energy would be to issue HLT instructions as part >of the event loop, but I am not sure about the side effects on doing so from >within an application. May it safely be used? > >Further, there seem to be some idle related interrupts, like INT28 [1]. But >the FDAPM documentation mentions that this interrupt is not hooked, unless its >ADV:MAX mode is used [2]. As this is not the default, relying on INT28 seems >neither to be a good idea. > > >Bernd > > >[1]: https://fd.lod.bz/rbil/interrup/dos_kernel/28.html#4166 >[2]: >https://gitlab.com/FreeDOS/base/fdapm/-/blob/8438642453457b25b13db4d589958fec400bb9bc/DOC/FDAPM/FDAPM.TXT#L44 > > > >_______________________________________________ >Freedos-devel mailing list >Freedos-devel@lists.sourceforge.net >https://lists.sourceforge.net/lists/listinfo/freedos-devel
_______________________________________________ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel