From 9493cf35a2986c6d9f043aa7eac3afe4d36e95a7 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Sat, 16 Nov 2024 13:46:46 -0500 Subject: Added code to detect OS version mostly through MS-DOS interrupt calls. --- asm/dosver.asm | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 asm/dosver.asm (limited to 'asm') diff --git a/asm/dosver.asm b/asm/dosver.asm new file mode 100644 index 0000000..8406663 --- /dev/null +++ b/asm/dosver.asm @@ -0,0 +1,76 @@ + push bp + mov bp, sp + + mov al, 0 + mov ah, 0x30 + + int 0x21 + + ; Push actual version info onto stack + push ax + + cmp bh, 0x00 + jne notdrdos + + ; Check if it is DR_DOS lying about being PC_DOS + mov ax, 0x4452 + int 0x21 + jc notdrdos + + ; Mark drdos as 0xee + mov bh, 0xee + + ; clear the stack in a meaningless way + pop cx + + ; DrDos version, or something like it, is already in the ax reggy + jmp alldone + + +notdrdos: + ; pop the actual version into ax now that we're done + ; with drdos checks + pop ax + + cmp al, 5 + je five + + ; if al is still zero, it's dos 1 + cmp al, 0 + jne alldone + + ; Mark it as MS-DOS 1.0 + mov al, 1 + mov ah, 0 + mov bh, 0xFF + jmp alldone + +five: + ; Store the OEM version + push bx + + mov ax, 0x3306 + int 0x21 + + ; True version should have been in bx + push bx + pop ax + pop bx + +alldone: + + mov cl, 8 + shr bx, cl + xor bh, bh + + ; second argument - OEM code in high byte + mov di, [bp]+6 + mov [di], bx + + ; first argument - major (al) minor(ah) versions + mov di, [bp]+8 + mov [di], ax + + pop bp + retf 4 + \ No newline at end of file -- cgit v1.2.3