-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path8TSR_A.ASM
100 lines (87 loc) · 1.78 KB
/
8TSR_A.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
.8086
.model small
.code
public _DiskInterrupt
public _TSRInterrupt
extrn _NTRACKS:byte:far
extrn _NHEADS:byte:far
extrn _NNEWSECTORSIZE:byte:far
extrn _NNEWEOT:byte:far
extrn _NNEWGAPLENGTH:byte:far
extrn _NNEWDTL:byte:far
extrn _NNEWGAP3LENGTH:byte:far
; Overriden AH=8 (Get drive parameters),
; 17h (Set disk type for format),
; 18h (Set media type for format)
; Only for floppies (DL=0 to 1 / 0 to 3)
_DiskInterrupt proc far
cli
pushf
cmp dl,3
ja back
cmp ah,8
je get_drive_parameters
cmp ah,17h
je set_disk_format
cmp ah,18h
je set_media_format
; Call the old INT 13h handler if not any of these/not our drive
back:
popf
sti
int 0EAh
; Update FLAGS in the stack unwind and return back to caller
back2:
push bp
mov bp,sp
push ax
lahf
mov [bp+6],ah
pop ax
pop bp
sti
iret
; Fills CX and DX with tracks, sectors and sector size information
; New DPT in ES:DI
get_drive_parameters:
mov ch,[_NTRACKS]
mov cl,[_NNEWEOT]
mov dh,[_NHEADS]
mov dl,1
xor ax,ax
xor bx,bx
mov es,ax
les di,[es:78h]
popf
clc
jmp back2
; Does not do anything, just returns success
set_disk_format:
mov ah,0
popf
clc
jmp back2
; Only return success and the new DPT in ES:DI
set_media_format:
xor ax,ax
mov es,ax
les di,[es:78h]
popf
clc
jmp back2
_DiskInterrupt endp
; INT E8h Update TSR resident data
; AX: tracks and heads, BX: sector size and spt, CX: gap length and DTL, DL: gap3 length
_TSRInterrupt proc far
cli
mov [_NTRACKS],al
mov [_NHEADS],ah
mov [_NNEWSECTORSIZE],bl
mov [_NNEWEOT],bh
mov [_NNEWGAPLENGTH],cl
mov [_NNEWDTL],ch
mov [_NNEWGAP3LENGTH],dl
sti
iret
_TSRInterrupt endp
END