-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSTUB.ASM
127 lines (93 loc) · 2.24 KB
/
STUB.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
; ÄÄÄ void three extender ÄÄÄ (c) 2k-1 by [email protected] ÄÄÄ
.586p
.SEQ
MEM_POOL = 16 SHL 20 ;16 MB memory pool
ASSUME CS:HYBRID, DS:HYBRID
HYBRID GROUP CODE_16, CODE_32, DATA, ZDATA
CODE_16 SEGMENT BYTE USE16
CODE_16 ENDS
CODE_32 SEGMENT BYTE USE32
CODE_32 ENDS
DATA SEGMENT BYTE USE16
DATA ENDS
ZDATA SEGMENT DWORD USE16
ZDATA ENDS
SCREEN SEGMENT AT 0a000h
SCREEN ENDS
; °°°±±±±±±²²²²²²²²²²²²ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
CODE_16 SEGMENT
ORG 100h ;þþþþþ program entry þþþþþ
rm_main:
lea di, ZERO_START ;ÄÄÄ clear zero data ÄÄÄ
mov ch, 55000 SHR 8
rep stosb
mov ax, 1687h ;ÄÄÄ DPMI installed? ÄÄÄ
int 2fh
inc ax
and bx, ax ;32-bit host ?
jnz @@dpmi
lea dx, no_dpmi ;error, exit
mov ah, 9h
int 21h
ret
no_dpmi db "no DPMI host found! please start in w95/w98 dosbox!$"
@@dpmi:
push es di
mov ax, cs ;ÄÄÄ get linear address ÄÄÄ
imul eax, -16
push eax
CODE_16 ENDS
include franky.rm ;franky: RM code
include shiva.rm ;shiva : RM code
CODE_16 SEGMENT
pop ebp ;ebp = linear address
mov bx, ds ;ÄÄÄ 16-bit PM switch ÄÄÄ
add bh, 10h
mov es, bx
xor ax, ax
inc ax
call dword ptr [ esp ]
pm_16:
mov al, 0ah ;ÄÄÄ get alias ÄÄÄ
mov bx, cs
int 31h
xchg bx, ax
mov al, 08h ;ÄÄÄ set limit ÄÄÄ
stc
sbb cx, cx
sbb dx, dx
int 31h
inc ax ;ÄÄÄ set rights ÄÄÄ
mov cx, 1101111111111011b
int 31h
push bx ;ÄÄÄ 32-bit PM switch ÄÄÄ
push OFFSET pm_32
retf
pm_32:
CODE_16 ENDS
CODE_32 SEGMENT
;ÄÄÄ 32-bit PM entry ÄÄÄ
inc eax
int 31h
push eax
pop ds ;set up DS, ES, SS
push eax
pop es
push eax
pop ss
mov ax, 0501h ;ÄÄÄ create memory pool ÄÄÄ
xor ecx, ecx
mov bx, MEM_POOL SHR 16
int 31h
shl ebx, 16
add ebp, ebx
add ebp, ecx ;[ebp] -> memory pool
xor eax, eax
mov ecx, MEM_POOL - 1 ;ÄÄÄ clear mem-pool ÄÄÄ
mov edi, ebp
rep stosb
CODE_32 ENDS
include shiva.mac
include franky.pm
include shiva.pm
END rm_main