-
Notifications
You must be signed in to change notification settings - Fork 47
/
himem16.asm
85 lines (60 loc) · 777 Bytes
/
himem16.asm
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
77
78
79
80
81
82
83
84
85
himaddrx:
himaddr dd 0
himemthere:
mov ax,0x4300
int 0x2F
cmp al,0x80
jz .hi
ret
.hi:
mov ax,0x4310
int 0x2F
mov word [cs:himaddrx + 2],es
mov word [cs:himaddrx],bx
mov al,0x80
ret
allochigh: ; EDX = bytes, return ECX = handle, EDI = linear
xor ecx,ecx
cmp [cs:himaddr],0
jnz .useh
.noh:
mov ecx,0
mov edi,0
ret
.useh:
mov ax,0x0900
shr edx,10
call far [cs:himaddr]
cmp dx,0
jz .noh
mov ax,0x0C00
mov cx,dx
xor edx,edx
xor ebx,ebx
mov dx,cx
call far [cs:himaddr]
cmp ax,1
jz .okh
mov ax,0x0A00
mov dx,cx
call far [cs:himaddr]
jmp .noh
.okh:
xor edi,edi
mov di,dx
shl edi,16
add edi,ebx
ret
freehigh: ; DX = handle
cmp dx,0
jz .noh
cmp [cs:himaddr],0
jnz .useh
.noh:
ret
.useh:
mov ax,0x0D00
call far [cs:himaddr]
mov ax,0x0A00
call far [cs:himaddr]
ret