aboutsummaryrefslogtreecommitdiff
path: root/asm/dosver.asm
blob: 8406663284d2b2cb267623dd85848d243bf3ef68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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