leecher1337 / ntvdmx64

Run Microsoft Windows NTVDM (DOS) on 64bit Editions
805 stars 81 forks source link

'yoda' is not recognized as an internal or external command #142

Closed peter8777555 closed 1 year ago

peter8777555 commented 3 years ago

I have build 06/21/2021 version by autobuild-ccpu-chk.cmd

I see the debug-wow.txt for YODA.

I do NOT copy Binaries\x86chk\dbg\files\bin\winxp\vdmexts.dll %SYSTEMROOT%\SysWOW64\ I just run inst-sym.cmd from NTVDM installation root I enter YODA got error message.

C:>yoda 'yoda' is not recognized as an internal or external command, operable program or batch file.

PS: I can NOT find yoda.exe in release directory. I find yoda.reg in \release\lang\reg directory.

leecher1337 commented 3 years ago

Citing readme.txt:

Debugging
=========
Name of debugger Master Yoda is.
Compiling frontend in mvdm\softpc.new\debugger you do.
Like Gandalf, debugger master Yoda smokes pipe in \\.\pipe\softpc
Therefore writing REG_SZ Key named PIPE containing
   \\.\pipe\softpc
to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WOW\CpuEnv
you need.
Setting empty REG_SZ named TRACE to CpuEnv you must.
After running vdmdebug.exe, you will be enlighted.
Do not call Yoda, Yoda will call you.

So steps you need to take: 1) By importing yoda.reg, you import the necessary keys and force ntvdm to break into yoda on startup (if you just want to break into yoda via ctrl+c, do not set YODA=1 like the .reg does. You then still can get a connection to yoda, but break on start isn't forced). NB: You should only debug with one ntvdm.exe open, so launching subprocesses which open an extra NTVDM may lock up, because pipe is already in use.

2) Before launching NTVDM, you need to start vdmdebug.exe, then ntvdm attaches to the pipe on startup and either breaks into yoda depending in your YODA setting or you can enter YODA by pressing CTRL+C on vdmdebug.exe window (you may need to do it a few times until it really breaks to Yoda> prompt)

NB: If you have no vdmdebug.exe running and set YODA=1 in registry, ntvdm.exe will be stuck in an endless loop printing out Yoda> to the Debug console (dbgview) and you can only stop it by killing ntvdm.exe

bugrepo commented 2 years ago

I've compiled the latest version of NTVDMx64 with autobuild-ccpu-fre.cmd, but I can't understand how to use Yoda.

I installed NTVDMx64, imported yoda.reg, then I start vdmdebug.exe and it types me this:

Softpc Debugging shell
Copyright Insignia Solutions 1991, 1992

Successfully created communications pipe (\\.\pipe\softpc)

Successfully created Yoda event object (YodaEvent)

Use Control-C to break into Yoda

Waiting for ntvdm to connect............

But when I run any DOS app - nothing happens. I press Control-C, but it doesn't help either.

What I do wrong? My OS is Win7x64SP1.

leecher1337 commented 2 years ago

Are you sure that you compiled the CHECKED build and NOT the FREE build?

bugrepo commented 2 years ago

As I wrote, I used autobuild-ccpu-fre.cmd. So, I need autobuild-ccpu-chk.cmd instead? OK. I thought, checked build is to debug NTVDM itself, not DOS programs...

bugrepo commented 2 years ago

It works! :) Though, with some small errors/warnings:

c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\base\system\rom.c:216 ROM at 0xc0000 has incorrect length 0x00004000 (actually 0x00008000)
c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\base\system\rom.c:233 ROM at 0x000c0000 has incorrect checksum 0x91
bugrepo commented 2 years ago

I have three questions.

  1. Is it possible to make debugger work in FREE build? You wrote that free builds are faster.
  2. What files of free build I need to replace with checked ones to make the debugger work?
  3. Can I use the debugger with native NT/2000/XP/2003 versions or to upgrade them?
leecher1337 commented 2 years ago

The errors are normal and can be ignored.

Ad 1) No, checked builds are slower BECAUSE they contain debugging functions and symbols. Fee builds are without debug stuff, thus they are faster. So if you want to debug, you always need checked build Ad 2) Mainly NTVDM.EXE, if you are just debugging DOS and no WOW32 stuff. It is recommended to also install the appropriate symbols to have symbolic information i.e. for the .r command (see debug-wow.txt for details) Ad 3) You mean with NTVDM.EXE on 32bit Windows? No, NTVDM with V86 Monitor states "Using Yoda on an x86 may be hazardous to your systems' health", see: https://devblogs.microsoft.com/oldnewthing/20060525-04/?p=31073 What you can do is using the vdmexts.dll extension shipped with WinDbg there and use WinDbg, it's much like described in debug-wow.txt but without replacing the dlls with the ones from NTVDMx64, but instead using what ships with WinDbg. It's not really very powerful, as NT normally ships with non-debug builds of NTVDM and stepping through the 16bit code is more painful, but it partly works. But as stated, on x86 there is no emulated CPU and therefore no YODA that could be used.

bugrepo commented 2 years ago

Many thanks for such a complete answers!

I tried checked version of NTVDM on Windows XP, but it said that "Yoda disabled on x86" :)

I've already read that article yesterday :)

bugrepo commented 2 years ago

I've fixed the EGA ROM BIOS, so there is no more warnings from Master Yoda about incorrect length and checksum :)

v7vga.zip

leecher1337 commented 2 years ago

ah, nice! I guess it wasn't all that relevant on V86 builds, as it normally maps the real ROM-BIOS on these builds in order to allow Fullscreen operation (and the wrong cheksum doesn't have any real effect)

bugrepo commented 2 years ago

Yes, I even tried renaming all *.rom files in Windows XP, but it had no effect on NTVDM. Seems that V86 NTVDM does not use v7vga.rom, bios1.rom and bios4.rom files at all.

leecher1337 commented 2 years ago

Yeah, X86GFX configuration doesn't need them. Checkout https://github.com/leecher1337/ntvdmx64/blob/master/ntvdmpatch/doc/defines.txt for a list of build coinfigurations. The mapping of X86GFX also leads to strange bugs in fullscreen mode partly, i.e. there once was an Intel VGA BIOS version that used 32bit I/O and some unusuar port addresses and tried to access the ports for 1 seconds for each character before giving up which lead to a completely slow NTVDM in fullscreen mode. Only possibility was to patch the VGA BIOS code in memory to make it work correctly.

bugrepo commented 2 years ago

How interesting... Here I have original IBM VGA ROM BIOS. It works with NTVDMx64 only in very basic text mode: with command.com, for example, but not with qbasic or even debug. Is it possible to update NTVDMx64 to use this VGA BIOS? Or to "update" VGA BIOS to use it with NTVDMx64?

Yoda's log when launching command.com:

Softpc Debugging shell
Copyright Insignia Solutions 1991, 1992

Successfully created communications pipe (\\.\pipe\softpc)

Successfully created Yoda event object (YodaEvent)

Use Control-C to break into Yoda

Waiting for ntvdm to connect............

Softpc connected successfully to debug shell....

host_runtime_set : Unknown option 13
NTVDM: 32768K Memory: 15360K XMS, 0K EMS, 16384K DPMI
c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\base\system\rom.c:216 ROM at 0xc0000 has incorrect length 0x00006000 (actually 0x00008000)
c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\base\system\rom.c:233 ROM at 0x000c0000 has incorrect checksum 0x10
*** Trace point *** : setting video mode
AX:0003 BX:0000 CX:0000 DX:e401 SP:0000 BP:0000 SI:0000 DI:0000
DS:0000 ES:0000 FS:0000 GS:0000 SS:0000 CS:f000 IP:fff0
c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\base\video\vga_prts.c:1218 Someone is trying to set extended memory to 0 (reg=0)
c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\base\video\vga_prts.c:1722 Row scan 0
c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\base\video\vga_prts.c:1725 hardware reset cleared
c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\base\video\vga_prts.c:1218 Someone is trying to set extended memory to 0 (reg=0)
c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\base\video\vga_prts.c:1722 Row scan 0
c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\base\video\vga_prts.c:1725 hardware reset cleared
*** Trace point *** : end of video set mode
c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\host\src\nt_com.c:1325 com reset Adapter 0, controller 0, line 4

c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\host\src\nt_com.c:1325 com reset Adapter 1, controller 0, line 3

c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\host\src\nt_com.c:1325 com reset Adapter 2, controller 0, line 4

c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\host\src\nt_com.c:1325 com reset Adapter 3, controller 0, line 3

YODA debug event handler installed
Loading [C:\windows\system32\ntio.sys]
VDM ModLoad: C:\windows\system32\ntio.sys => segment 8e05, len=8430
VDM SegMove: C:\windows\system32\ntio.sys (1) 8e05 => 70, len = 8430
VDM SegMove: C:\windows\system32\ntdos.sys (2) 9386 => a7, len = 8f29
Loading [C:\WINDOWS\SYSTEM32\HIMEM.SYS]
VDM ModLoad: C:\WINDOWS\SYSTEM32\HIMEM.SYS => segment 0, len=12a0
VDM SegMove: C:\windows\system32\ntdos.sys (1) 9386 => fe2e, len = 793f
Loading [C:\WINDOWS\SYSTEM32\COMMAND.COM]
VDM ModLoad: C:\WINDOWS\SYSTEM32\COMMAND.COM => segment 40a, len=cb0d
Loading [C:\windows\system32\MSCDEXNT.EXE]
VDM ModLoad: C:\windows\system32\MSCDEXNT.EXE => segment c8a4, len=200
Loading [C:\windows\system32\REDIR.EXE]
VDM ModLoad: C:\windows\system32\REDIR.EXE => segment c8bb, len=1400
Loading [C:\windows\system32\DOSX.EXE]
VDM ModLoad: C:\windows\system32\DOSX.EXE => segment c9e0, len=de00
VDM SegLoad: C:\windows\system32\DOSX.EXE(0) Data => b7
VDM SegLoad: C:\windows\system32\DOSX.EXE(2) Code => cf
VDM SegLoad: C:\windows\system32\DOSX.EXE(3) Code => c7

Yoda's log when launching debug.exe:

c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\base\video\vga_mode.c:406 Funny memory organisation selected TEXT_80_FUN
c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\host\src\nt_graph.c:1579 Funny text mode selected TEXT_80_FUN
c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\base\video\vga_mode.c:406 Funny memory organisation selected TEXT_80_FUN
c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\host\src\nt_graph.c:1579 Funny text mode selected TEXT_80_FUN
c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\host\src\nt_cga.c:329 VDM: nt_text() repaint region out of ranged x:0 y:25 w:1 h:1

c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\host\src\nt_cga.c:329 VDM: nt_text() repaint region out of ranged x:0 y:26 w:1 h:1

c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\host\src\nt_cga.c:329 VDM: nt_text() repaint region out of ranged x:0 y:27 w:1 h:1

...

c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\host\src\nt_cga.c:329 VDM: nt_text() repaint region out of ranged x:0 y:997 w:1 h:1

c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\host\src\nt_cga.c:329 VDM: nt_text() repaint region out of ranged x:0 y:998 w:1 h:1

c:\ntvdmbld\w\minnt\base\mvdm\softpc.new\host\src\nt_cga.c:329 VDM: nt_text() repaint region out of ranged x:0 y:999 w:1 h:1
leecher1337 commented 2 years ago

The supplied BIOS is enough to be compatible with the internal VGA emulation. I don't really understand why you want to replace it, it doesn't make sense to me.

bugrepo commented 2 years ago

The supplied BIOS is enough to be compatible with the internal VGA emulation.

OK! Thanks for your answer! I thought it's EGA-only.