WoW. 16-bit application on 32-bit Windows.

By | January 21, 2020

There was time when PC used 16-bit microprocessors such as 8086 and 80286. The first 32-bit Windows NT operating system had NTVDM (NT Vistual DOS Machine) component that allowed execution of 16-bit Windows and 16-bit / 32-bit DOS applications. The latest 32-bit Windows operating systems does not support NTVDM by default, it should be enabled. In the same time 64-bit Windows do not have NTVDM feature at all. Here is my old 16-bit application written on assembler language which distinguishes 8086 and 80286 microprocessors by number of trap interrupts. In the case of 8086 one trap interrupt is lost. The code:


;This program analyzes type of microprocessor: 8086/8088 or >=80286.
;When TF is set one trap interrupt does not occur in case of 8086/8088
;microprocessor after POP Segm.Reg. or MOV Segm.Reg.,R/M instructions
;Source module: 88_286.asm, executed module: 88_286.com
   name micropr_type
   code segment
   assume cs:code,ds:code
   org 100h
p88_286: push  cs
   pop  ds
   mov  ah,9
   mov  dx,offset soob1
   int  21h ;Title message
   mov  ax,2501h
   mov  dx,offset int1
   int  21h ;Set INT 1 vector
   pushf    ;Save flags in stack
   pushf
   pop  ax ;Copy flags in AX
   or  ax,100h ;Set bit of TF position
   push  ax
   popf ;Set TF
;Trap interrupt begins
   mov  es,ax ;MOV in Seg.Reg. in trap regime
;After this command 1 trap interrupt does not occur in case of 8086/8088
   nop ;90h code of NOP
   popf ;Reload flags (The end of trap interrupt),9dh code of POPF
   mov  dx,offset s88
   cmp  byte ptr pr,80h ;7-th bit is set for 80286
   jc  lp1
   mov dx,offset s286
lp1: mov  ah,9
   int  21h ;The result message
   mov  ah,9
   mov  dx,offset pr
   and  byte ptr pr,7fh ;clear 7-th bit in 1-st byte of PR string
   int  21h ;Out number of trap interrupt
   mov  ax,4c00h
   int  21h
soob1    db 0dh,0ah,’This program analyzes processor type’,0dh,0ah,’$’
s88    db ‘8086/8088′,0dh,0ah,’$’
s286   db ‘>=80286′,0dh,0ah,’$’
pr     db ‘0 trap interrupts’,0dh,0ah,’$’
;The trap interrupt (INT 1) procedure
int1: push  ds
   push  bp
   push  bx
   inc  cs:byte ptr pr ;counter of trap interrupts
   mov  bp,sp
   lds  bx,[bp+6]   ;Read return address of INT 1 from stack
                    ;IP to BX, CS to DS
   mov  ax,word ptr [bx] ;In AX code of next instruction(s)
   cmp  ax,9d90h
   jnz  int1_ex
   or  cs:byte ptr pr,80h ;sign of 80286
int1_ex: pop  bx
   pop  bp
   pop  ds
   iret
code  ends
end  p88_286

When I started it on my 32-bit Windows 10 machine the following message was popped up:
NTVDM is disabled.


I started Control Panel, went to Program & Feature and enabled NTVDM legacy:
Enabling NTVDM legacy.
After that 88_8286.com was executed normally:
88_286
When the result shows 80286 it means and current processor does not lose trap interrupt. My current processor is 64-bit which running in 32-bit mode:
Processor
The code and executable of 88_286 may be downloaded from here.

However for some old MSDOS application enabling NTVDM legacy it is not enough:

Start Editor.
    For example when I started MSDOS editor I got the error like this.
Start Debugger.
    The same for MSDOS debugger.

To make these program working it is necessary to enable legacy in command prompt properties and restart command prompt:
Command Prompt Legacy.

Now MSDOS editor and MSDOS debugger work!
Command Prompt Edit.

Command Prompt Debug.

Leave a Reply

Your email address will not be published. Required fields are marked *