JJBladester
JJBladester

Reputation: 51

30H interrupt gives wrong DOS version

I am running a 32-bit copy of Windows 8 on a 64-bit AMD processor. I am taking an 8086 assembly course and the book gives an example of how to obtain DOS's version number. When I start cmd.exe, it tells me at the top that it is version 6.2.9200. Also, when I run the "VER" DOS command it tells me the same thing. However, when I execute a 30H interrupt routine to obtain the DOS version number, it tells me I am running DOS Version 5.0. What could explain this difference?

By the way, I assembled the code below in MASM6 using the command ML /Fl DOSVER.ASM.

   .MODEL SMALL
   .DATA
   VNS    DB  'DOS Version $'

   .CODE
   .STARTUP
   LEA   DX,VNS     ;set up pointer to output string
   MOV   AH,9       ;display string
   INT   21H        ;DOS call
   MOV   AH,30H     ;get DOS version number
   INT   21H        ;DOS call
   PUSH  AX         ;save copy of version number
   ADD   AL,30H     ;add ASCII bias to major version number
   MOV   DL,AL      ;prepare for output
   MOV   AH,2       ;output character to screen
   INT   21H        ;DOS call
   MOV   DL,'.'     ;load a period
   MOV   AH,2       ;output character to screen
   INT   21H        ;DOS call
   POP   AX         ;get version number back
   MOV   AL,AH      ;load minor version number
   MOV   BL,10      ;divide minor version number by 10
   SUB   AH,AH
   DIV   BL
   ADD   AL,30H     ;add ASCII bias
   MOV   DL,AL      ;prepare for output
   MOV   AH,2       ;output character to screen
   INT   21H        ;DOS call
   .EXIT

   END

Upvotes: 0

Views: 1916

Answers (1)

Michael
Michael

Reputation: 1146

The version number you see at the top of the command-line interface, and which is returned by the VER command, is the Windows version, not the DOS version. As I understand it the Windows command-line interface is a DOS Emulator, rather than an actual instance of MS-DOS. It would appear that Windows NT based systems, which would include Windows 8, emulate a 5.0 version of MS-DOS (this seems to be suggested here and here) - which would seem to be consistent with what you describe.

Upvotes: 1

Related Questions