> On Feb 27, 2025, at 4:22 PM, Folkert van Heusden via Freedos-devel 
> <freedos-devel@lists.sourceforge.net> wrote:
> 
> Hi,
> 
> I'm writing a PC-emulator (8088 and 8086).
> At this point MS-DOS 6.22 works fine. I can type commands and start and
> play e.g. DOOM8088.
> Of course I also would like FreeDOS to run. Booting the installer floppy
> works fine to a certain point. I get the menu where I can select a
> language. After I press enter, I see the text asking if I'm sure to
> continue and that's the point where things fail: the keypress is
> registered by the bios (stored in the keyboard buffer, is what I read in
> the disassembly) but the FreeDOS kernel does not seem to pick it up.
> What should retrieve it? A timer or so? Any ideas?
> 
> Thanks
> 
> 
> regards

Most of the text output and prompting in the installer are handled by V8Power 
Tools.

Text input is not handled through DOS. The tools talk directly to the BIOS.

Same goes for their text output.

At the startup of the installer, when prompted to continue, the input is 
handled by VASK.COM.

The input loop in VASK starts around line 110 [1].

But for simplicity, here is a copy      (with some comments added)…

.WaitLoop:
        GotoXY          dx                              ; position cursor to 
correct location
        IdleCPU                                         ; see below
        mov             ax, 0x0100
        int                     0x16                    ; call BIOS keyboard 
interrupt [3]
        jz                      .WaitLoop               ; is there no key 
waiting repeat loop
        mov             ax, 0x0000
        int                     0x16                    ; call BIOS keyboard 
interrupt [4]
        cmp                     al, 0x03                        ; test for 
CTRL+C
        jne                     .NotCtrlC
        mov                     al, [ControlC]
        test                    al, al                  ; test if CTRL+C is 
allowed
        jz                      .NotExact               ; no, then ignore
        Terminate       0xc8                            ; terminate with 
special exit code
.NotCtrlC:

The IdleCPU function [2] is a little more complex. It will first try to use DOS 
to perform the Idle for power reduction. 
However if that is not supported, it will simply fall back on the CPU HLT 
instruction. The CPU will remain idle until the
Next interrupt occurs (like keypress, timer tick, etc.).

The macro can also be set programmatically to not use either method which will 
use more power.


%imacro IdleCPUHandler 0
IdleCPUHandlerProc:
        pushf
        push            ax
        mov             al, [%%IdleCPUData]
        cmp      al, 1
        ja              %%NoIdle
        je              %%Alternate
        ; DOS 5.00+, Windows 3+ -- Release current VM time slice [5].
        mov     ax, 0x1680
        int             0x2f
        cmp      al, 0x00
        je              %%Done
        mov             al, 1
        mov             [%%IdleCPUData], al
%%Alternate:
        hlt
%%NoIdle:

%%Done:
        pop             ax
        popf
        ret
%%IdleCPUData:
        db 0
%endmacro

%imacro IdleCPU 0
        call            IdleCPUHandlerProc
%endmacro

So, there really isn’t anything fancy or special going on. 

:-)

Jerome

[1]  
https://github.com/LoopZ/V8Power/blob/0fad04f5c46e02824c052569ba74d20d0289d6df/SOURCE/VASK.ASM#L110
[2]  
https://github.com/LoopZ/V8Power/blob/0fad04f5c46e02824c052569ba74d20d0289d6df/SOURCE/COMMON.INC#L56
[3]  https://fd.lod.bz/rbil/interrup/bios/1601.html#1792
[4]  https://fd.lod.bz/rbil/interrup/bios/1600.html#1791
[5]  https://fd.lod.bz/rbil/interrup/windows/2f1680.html#4575



_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to