home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 December
/
simtel1292_SIMTEL_1292_Walnut_Creek.iso
/
msdos
/
ddjmag
/
ddj8906.arc
/
DOSCAL.ASC
< prev
next >
Wrap
Text File
|
1989-05-27
|
4KB
|
147 lines
_UNDOCUMENTED DOS_
by Rahner James
[LISTING ONE]
; *********************************************************************
; DATA STRUCTURES
; *********************************************************************
CALL52_2XX struc
dpb_ptr dd ? ; Far ptr to first disk parameter block
open_file_ptr dd ? ; Far ptr to Open File table
clock_ptr dd ? ; Far ptr to CLOCK$ device driver
con_ptr dd ? ; Far ptr to CON: device driver
num_drives_2xx db ? ; Number of logical drives
sector_sz_2xx dw ? ; Maximum sector size
buffer_ptr_2xx dd ? ; Far pointer to next sector buffer
NUL_driver_2xx db ? ; Beginning of the NUL device driver
CALL52_2XX ends
CALL52_3XX struc
dd 4 dup(?) ; This are defined in previous structure
sector_sz_3xx dw ? ; Maximum sector size
buffer_ptr_3xx dd ? ; Far pointer to next sector buffer
path_ptr_3xx dd ? ; Far pointer to drive path table
FCB_ptr_3xx dd ? ; Far pointer to FCB table
FCB_sz_3xx dw ? ; Size of the FCB table
num_drives_3xx db ? ; Number of logical drives
lastdrive db ? ; LASTDRIVE number
NUL_driver_3xx db ? ; Beginning of the NUL device driver
CALL52_3XX ends
; *********************************************************************
; MODIFY_DOS
;
; Changes MS-DOS's internal maximum sector size and buffer linked list
; to allow MS-DOS to access partitions above 32-megabytes
;
; Given:
; BIGGEST_SECTOR set to largest logical sector of all partitions
; DOS_VERSION = major version of MS-DOS
; OLD_FILE_END -> initial end of driver
;
; Returns:
; TRASH_PTR set to new end of program
; MS-DOS's internal maximum sector setting changed
; MS-DOS's internal linked buffer list relocated
; *********************************************************************
modify_dos proc uses ax ds di si
local sect_para_size:word
local buffer_paragraph:word
mov ax, offset old_file_end ; Get pointer to old end of file
add ax, 15 ; Change it to a segment number so we
mov cl, 4 ; only have to deal with a 16-bit number
shr ax, cl
mov bx, cs
add ax, bx ; AX -> paragraph start
mov buffer_paragraph, ax ; Save it for later
mov ax, biggest_sector ; AX = size of buffer we may need to
; allocate
add ax, 10h ; The buffer header too
shr ax, cl ; Change bytes/sector to paras/sector
mov sect_para_size, ax ; Save for later
mov ah, 52h ; Our undocumented system call
int 21h ; Set ES:BX -> DOS list of lists
mov di, buffer_paragraph ; DI -> beg. of initialization trash
mov si, sector_sz_2xx ; SI = offset to version 2.xx sector size
cmp dos_version, 2 ; See if version 2.xx
je @F ; Skip if it is
mov si, sector_sz_3xx ; SI = offset to version 3.xx sector size
@@: mov cx, es:[bx+si] ; CX = the largest block size supported
cmp cx, biggest_sector ; See if we need to change anything
jnc done ; Jump if we don't need to
mov cx, biggest_sector ; Update DOS with the new largest
add bx, si ; BX -> sector size variable
mov es:[bx], cx ; Update maximum sector size w/our sector
add bx, 2 ; Buffer pointer is right after for
; both versions
mov dx, cs
@@: mov si, bx ; DS:SI = ES:BX
mov ax, es
mov ds, ax
les bx, dword ptr es:[bx] ; ES:BX -> next buffer in list
cmp bx, -1 ; Are we at the end
je done ; Quit if we are
mov byte ptr es:[bx+4], -1 ; Set the nasty buffer flag
mov ax, bx ; Calculate absolute memory placement
mov cl, 4
shr ax, cl
mov cx, es
add ax, cx
cmp ax, dx ; See if we are above or below the line
ja @B ; Loop again if already done this buffer
les bx, dword ptr es:[bx]
xchg si, bx ; xchg es:bx, ds:si
push es
mov ax, ds
mov es, ax
pop ds
mov word ptr es:[bx], 0 ; Previous buffer -> this one
mov es:[bx+2], di
push es
mov es, di
mov es:[0], si ; This one -> what previous did
mov es:[2], ds
mov byte ptr es:[4], -1 ; Tell DOS this hasn't been used yet
pop es
add di, sect_para_size ; DI -> next buffer start
cmp si, -1 ; See if we are at end of list
je done ; Quit if we are
mov bx, si ; ES:BX -> next buffer in line
mov ax, ds
mov es, ax
jmp @B
done: mov cs:trash_pointer, di ; New end of program
ret
modify_dos endp