-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdzemm.asm
153 lines (143 loc) · 2.33 KB
/
dzemm.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
; DZEMM.ASM--
; Copyright (c) 2012 Doszip Developers
;
; Change history:
; 2012-12-12 - created
;
USECLIPBOARD equ 1
.186
.model tiny
.code
assume ds:_TEXT
dd -1 ; pointer to next driver
dw 8000h ; device attributes
dw strategy ; device strategy entry point
dw interrupt ; device interrupt entry point
db 'EMMXXXX0' ; device name
strategy:
mov cs:drvseg,es
mov cs:drvoff,bx
retf
interrupt:
pusha
push ds
push es
lds bx,cs:drvptr
sub ax,ax
cmp cs:drvset,al
jne interrupt_end
inc cs:drvset
cmp [bx+3],al
je initdevice
interrupt_end:
mov word ptr [bx+3],100h
pop es
pop ds
popa
retf
ifdef USECLIPBOARD
int_2F: cmp ah,17h
je new_2F
db 0EAh ; opcode for jmp SSSS:0000
old_2F dw 0
dw 0
new_2F: mov ah,90h ; Clipboard is 90xx
endif
int_67: push bp
mov bp,ax
db 0B8h
vdd_67 dw 0
dw 0C4C4h
db 58h,02h
pop bp
iret
drvptr label dword
drvoff dw ?
drvseg dw ?
drvset db ?
vddname db 'dzemm.dll',0
vddinit db 'DZEmmInitVDD',0
vdddisp db 'DZEmmCallVDD',0
initdevice:
push ds
push bx
mov ax,cs
mov ds,ax
mov es,ax
mov si,offset vddname
mov di,offset vddinit
mov bx,offset vdddisp
dw 0C4C4h
db 58h,00h
jc initdevice_end
mov vdd_67,ax
mov vdd_in,ax
mov ah,41h ; steal memory from EMM ;-)
int 67h
test ah,ah
jnz @F
mov dx,bx
jmp initdevice_seg
@@:
mov ax,5800h ; alloc one segment from dos
int 21h ; get alloc and UMB state
mov si,ax
mov ax,5802h
int 21h
mov ah,0
mov di,ax
mov ax,5801h ; set alloc and UMB strategy
mov bx,0082h ; last fit, try high then low memory
int 21h
mov ax,5803h ; add UMBs to DOS memory chain
mov bx,0001h
int 21h
xor bp,bp
mov ah,48h ; alloc segment
mov bx,1000h ; para
int 21h
jc @F
mov bp,ax
@@:
mov ax,5801h ; reset alloc and UMB strategy
mov bx,si
int 21h
mov ax,5803h
mov bx,di
int 21h
mov dx,bp ; call dzemm.dll(dx)
test dx,dx
ifdef ARG_NOXMS
jnz initdevice_seg
mov dx,0D000h
else
jz initdevice_end
endif
initdevice_seg:
mov bp,5E00h
db 0B8h
vdd_in dw 0
dw 0C4C4h
db 58h,02h
test ax,ax
jz initdevice_end
mov dx,offset int_67
mov ax,2567h
int 21h
ifdef USECLIPBOARD
mov ax,352Fh ; get/set vector
int 21h
mov old_2F,bx
mov old_2F[2],es
mov dx,offset int_2F
mov ax,252Fh
int 21h
endif
initdevice_end:
pop bx
pop ds
mov word ptr [bx+0Eh],offset device_end
mov word ptr [bx+10h],cs
jmp interrupt_end
device_end:
end initdevice