2000-05-06 21:34:20 +02:00
|
|
|
;
|
|
|
|
; File:
|
|
|
|
; kernel.asm
|
|
|
|
; Description:
|
|
|
|
; kernel start-up code
|
|
|
|
;
|
|
|
|
; Copyright (c) 1995, 1996
|
|
|
|
; Pasquale J. Villani
|
|
|
|
; All Rights Reserved
|
|
|
|
;
|
|
|
|
; This file is part of DOS-C.
|
|
|
|
;
|
|
|
|
; DOS-C is free software; you can redistribute it and/or
|
|
|
|
; modify it under the terms of the GNU General Public License
|
|
|
|
; as published by the Free Software Foundation; either version
|
|
|
|
; 2, or (at your option) any later version.
|
|
|
|
;
|
|
|
|
; DOS-C is distributed in the hope that it will be useful, but
|
|
|
|
; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
|
|
|
|
; the GNU General Public License for more details.
|
|
|
|
;
|
|
|
|
; You should have received a copy of the GNU General Public
|
|
|
|
; License along with DOS-C; see the file COPYING. If not,
|
|
|
|
; write to the Free Software Foundation, 675 Mass Ave,
|
|
|
|
; Cambridge, MA 02139, USA.
|
|
|
|
;
|
|
|
|
; $Id$
|
|
|
|
;
|
|
|
|
|
|
|
|
%include "segs.inc"
|
2002-01-23 23:29:41 +01:00
|
|
|
%include "ludivmul.inc"
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
|
2001-04-22 00:32:53 +02:00
|
|
|
segment PSP
|
2000-05-06 21:34:20 +02:00
|
|
|
|
2002-12-09 01:17:15 +01:00
|
|
|
extern _ReqPktPtr:wrt LGROUP
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
STACK_SIZE equ 384/2 ; stack allocated in words
|
|
|
|
|
2001-11-04 20:47:39 +01:00
|
|
|
;************************************************************
|
|
|
|
; KERNEL BEGINS HERE, i.e. this is byte 0 of KERNEL.SYS
|
|
|
|
;************************************************************
|
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
..start:
|
2001-11-04 20:47:39 +01:00
|
|
|
entry:
|
|
|
|
jmp short realentry
|
|
|
|
|
|
|
|
;************************************************************
|
|
|
|
; KERNEL CONFIGURATION AREA
|
|
|
|
; this is copied up on the very beginning
|
|
|
|
; it's a good idea to keep this in sync with KConfig.h
|
|
|
|
;************************************************************
|
|
|
|
global _LowKernelConfig
|
|
|
|
_LowKernelConfig:
|
|
|
|
db 'CONFIG' ; constant
|
|
|
|
dw configend-configstart; size of config area
|
|
|
|
; to be checked !!!
|
|
|
|
|
2003-09-04 21:07:55 +02:00
|
|
|
configstart:
|
2001-11-04 20:47:39 +01:00
|
|
|
|
|
|
|
DLASortByDriveNo db 0 ; sort disks by drive order
|
2003-09-04 21:07:55 +02:00
|
|
|
InitDiskShowDriveAssignment db 1 ;
|
|
|
|
SkipConfigSeconds db 2 ;
|
|
|
|
ForceLBA db 0 ;
|
|
|
|
GlobalEnableLBAsupport db 1 ;
|
|
|
|
BootHarddiskSeconds db 0 ;
|
2001-11-04 20:47:39 +01:00
|
|
|
|
2003-09-04 21:07:55 +02:00
|
|
|
configend:
|
2001-11-04 20:47:39 +01:00
|
|
|
|
|
|
|
;************************************************************
|
|
|
|
; KERNEL CONFIGURATION AREA END
|
|
|
|
;************************************************************
|
|
|
|
|
|
|
|
|
|
|
|
;************************************************************
|
|
|
|
; KERNEL real entry (at ~60:20)
|
|
|
|
;
|
|
|
|
; moves the INIT part of kernel.sys to high memory (~9000:0)
|
|
|
|
; then jumps there
|
|
|
|
; to aid debugging, some '123' messages are output
|
|
|
|
; this area is discardable and used as temporary PSP for the
|
|
|
|
; init sequence
|
|
|
|
;************************************************************
|
|
|
|
|
|
|
|
|
|
|
|
realentry: ; execution continues here
|
|
|
|
|
2001-07-10 00:19:33 +02:00
|
|
|
push ax
|
|
|
|
push bx
|
|
|
|
pushf
|
|
|
|
mov ax, 0e31h ; '1' Tracecode - kernel entered
|
|
|
|
mov bx, 00f0h
|
|
|
|
int 010h
|
|
|
|
popf
|
|
|
|
pop bx
|
|
|
|
pop ax
|
|
|
|
|
|
|
|
jmp far kernel_start
|
2001-04-15 05:21:50 +02:00
|
|
|
beyond_entry: resb 256-(beyond_entry-entry)
|
|
|
|
; scratch area for data (DOS_PSP)
|
2000-05-06 21:34:20 +02:00
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
segment INIT_TEXT
|
2000-05-06 21:34:20 +02:00
|
|
|
|
2003-06-15 17:53:58 +02:00
|
|
|
extern _FreeDOSmain
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
;
|
|
|
|
; kernel start-up
|
|
|
|
;
|
|
|
|
kernel_start:
|
2001-07-10 00:19:33 +02:00
|
|
|
|
|
|
|
push bx
|
|
|
|
pushf
|
|
|
|
mov ax, 0e32h ; '2' Tracecode - kernel entered
|
|
|
|
mov bx, 00f0h
|
|
|
|
int 010h
|
|
|
|
popf
|
|
|
|
pop bx
|
|
|
|
|
2004-04-10 12:59:57 +02:00
|
|
|
mov ax,seg init_tos
|
2000-05-06 21:34:20 +02:00
|
|
|
cli
|
|
|
|
mov ss,ax
|
2001-04-15 05:21:50 +02:00
|
|
|
mov sp,init_tos
|
2004-04-10 16:18:25 +02:00
|
|
|
int 12h ; move init text+data to higher memory
|
2000-05-06 21:34:20 +02:00
|
|
|
mov cl,6
|
|
|
|
shl ax,cl
|
2004-04-10 12:59:57 +02:00
|
|
|
mov dx,15 + init_end wrt INIT_TEXT
|
2000-05-06 21:34:20 +02:00
|
|
|
mov cl,4
|
|
|
|
shr dx,cl
|
|
|
|
sub ax,dx
|
|
|
|
mov es,ax
|
2004-04-13 13:54:09 +02:00
|
|
|
mov dx,__INIT_DATA_START wrt INIT_TEXT ; para aligned
|
2004-04-10 12:59:57 +02:00
|
|
|
shr dx,cl
|
|
|
|
add ax,dx
|
|
|
|
mov ss,ax ; set SS to init data segment
|
|
|
|
sti ; now enable them
|
2000-05-06 21:34:20 +02:00
|
|
|
mov ax,cs
|
2004-04-13 13:54:09 +02:00
|
|
|
mov dx,__InitTextStart wrt HMA_TEXT ; para aligned
|
2004-04-10 16:18:25 +02:00
|
|
|
%ifdef WATCOM
|
2004-04-13 12:58:06 +02:00
|
|
|
mov si,dx
|
|
|
|
mov cl,4
|
|
|
|
shr si,cl
|
|
|
|
add ax,si
|
2004-04-10 16:18:25 +02:00
|
|
|
%endif
|
2000-05-06 21:34:20 +02:00
|
|
|
mov ds,ax
|
2004-04-13 13:54:09 +02:00
|
|
|
mov cx,-2 + init_end wrt INIT_TEXT ; word aligned
|
2004-04-10 16:18:25 +02:00
|
|
|
mov si,cx
|
|
|
|
mov di,cx
|
|
|
|
shr cx,1
|
|
|
|
inc cx
|
|
|
|
std ; if there's overlap only std is safe
|
|
|
|
rep movsw
|
|
|
|
|
|
|
|
; move HMA_TEXT to higher memory
|
2004-04-13 19:16:39 +02:00
|
|
|
mov si,dx ; si = __InitTextStart wrt HMA_TEXT
|
|
|
|
mov cl,4
|
|
|
|
shr dx,cl
|
2004-04-10 16:18:25 +02:00
|
|
|
|
|
|
|
sub ax,dx
|
|
|
|
mov ds,ax ; ds = HMA_TEXT
|
|
|
|
mov ax,es
|
|
|
|
sub ax,dx
|
|
|
|
mov es,ax ; es = new HMA_TEXT
|
|
|
|
|
2004-04-13 19:16:39 +02:00
|
|
|
mov cx,si ; cx = __InitTextStart wrt HMA_TEXT
|
2004-04-10 16:18:25 +02:00
|
|
|
dec si
|
|
|
|
dec si
|
|
|
|
mov di,si
|
2000-05-06 21:34:20 +02:00
|
|
|
shr cx,1
|
|
|
|
rep movsw
|
2004-04-10 16:18:25 +02:00
|
|
|
|
|
|
|
cld
|
|
|
|
%ifndef WATCOM ; for WATCOM: CS equal for HMA and INIT
|
|
|
|
add ax,dx
|
|
|
|
mov es,ax ; otherwise CS -> init_text
|
|
|
|
%endif
|
2000-05-06 21:34:20 +02:00
|
|
|
push es
|
|
|
|
mov ax,cont
|
|
|
|
push ax
|
|
|
|
retf
|
2004-04-10 12:59:57 +02:00
|
|
|
cont: ; Now set up call frame
|
2003-06-15 17:53:58 +02:00
|
|
|
mov ds,[cs:_INIT_DGROUP]
|
2000-05-06 21:34:20 +02:00
|
|
|
mov bp,sp ; and set up stack frame for c
|
2001-07-10 00:19:33 +02:00
|
|
|
|
|
|
|
push bx
|
|
|
|
pushf
|
|
|
|
mov ax, 0e33h ; '3' Tracecode - kernel entered
|
|
|
|
mov bx, 00f0h
|
|
|
|
int 010h
|
|
|
|
popf
|
|
|
|
pop bx
|
2002-01-23 23:29:41 +01:00
|
|
|
|
2003-09-19 04:13:35 +02:00
|
|
|
mov byte [_BootDrive],bl ; tell where we came from
|
2001-11-04 20:47:39 +01:00
|
|
|
|
|
|
|
;!! int 11h
|
|
|
|
;!! mov cl,6
|
|
|
|
;!! shr al,cl
|
|
|
|
;!! inc al
|
|
|
|
;!! mov byte [_NumFloppies],al ; and how many
|
2001-03-21 03:56:26 +01:00
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
mov ax,ss
|
2001-04-22 00:32:53 +02:00
|
|
|
mov ds,ax
|
2000-05-06 21:34:20 +02:00
|
|
|
mov es,ax
|
2004-04-10 12:59:57 +02:00
|
|
|
jmp _FreeDOSmain
|
2000-05-06 21:34:20 +02:00
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
segment INIT_TEXT_END
|
|
|
|
|
2001-11-04 20:47:39 +01:00
|
|
|
|
|
|
|
;************************************************************
|
|
|
|
; KERNEL CODE AREA END
|
|
|
|
; the NUL device
|
|
|
|
;************************************************************
|
|
|
|
|
2002-11-09 20:21:09 +01:00
|
|
|
segment CONST
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
;
|
|
|
|
; NUL device strategy
|
|
|
|
;
|
|
|
|
global _nul_strtgy
|
|
|
|
_nul_strtgy:
|
|
|
|
mov word [cs:_ReqPktPtr],bx ;save rq headr
|
|
|
|
mov word [cs:_ReqPktPtr+2],es
|
|
|
|
retf
|
|
|
|
|
|
|
|
;
|
|
|
|
; NUL device interrupt
|
|
|
|
;
|
|
|
|
global _nul_intr
|
|
|
|
_nul_intr:
|
|
|
|
push es
|
|
|
|
push bx
|
|
|
|
les bx,[cs:_ReqPktPtr] ;es:bx--> rqheadr
|
|
|
|
or word [es:bx+3],100h ;set "done" flag
|
|
|
|
pop bx
|
|
|
|
pop es
|
|
|
|
retf
|
|
|
|
|
2003-06-15 17:53:58 +02:00
|
|
|
segment _LOWTEXT
|
2002-05-09 00:49:35 +02:00
|
|
|
; floppy parameter table
|
|
|
|
global _int1e_table
|
|
|
|
_int1e_table: times 0eh db 0
|
2000-05-06 21:34:20 +02:00
|
|
|
|
2001-11-04 20:47:39 +01:00
|
|
|
;************************************************************
|
|
|
|
; KERNEL FIXED DATA AREA
|
|
|
|
;************************************************************
|
|
|
|
|
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
segment _FIXED_DATA
|
|
|
|
|
|
|
|
; Because of the following bytes of data, THIS MODULE MUST BE THE FIRST
|
|
|
|
; IN THE LINK SEQUENCE. THE BYTE AT DS:0004 determines the SDA format in
|
|
|
|
; use. A 0 indicates MS-DOS 3.X style, a 1 indicates MS-DOS 4.0-6.X style.
|
|
|
|
global DATASTART
|
|
|
|
DATASTART:
|
2001-09-23 22:39:44 +02:00
|
|
|
global _DATASTART
|
|
|
|
_DATASTART:
|
2000-05-06 21:34:20 +02:00
|
|
|
dos_data db 0
|
|
|
|
dw kernel_start
|
|
|
|
db 0 ; padding
|
|
|
|
dw 1 ; Hardcoded MS-DOS 4.0+ style
|
|
|
|
|
|
|
|
times (0eh - ($ - DATASTART)) db 0
|
|
|
|
global _NetBios
|
2001-03-30 21:30:06 +02:00
|
|
|
_NetBios dw 0 ; NetBios Number
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
times (26h - 0ch - ($ - DATASTART)) db 0
|
|
|
|
|
|
|
|
; Globally referenced variables - WARNING: DO NOT CHANGE ORDER
|
|
|
|
; BECAUSE THEY ARE DOCUMENTED AS UNDOCUMENTED (?) AND HAVE
|
|
|
|
; MANY MULTIPLEX PROGRAMS AND TSR'S ACCESSING THEM
|
|
|
|
global _NetRetry
|
|
|
|
_NetRetry dw 3 ;-000c network retry count
|
|
|
|
global _NetDelay
|
|
|
|
_NetDelay dw 1 ;-000a network delay count
|
|
|
|
global _DskBuffer
|
|
|
|
_DskBuffer dd -1 ;-0008 current dos disk buffer
|
2002-08-05 21:56:38 +02:00
|
|
|
global _inputptr
|
|
|
|
_inputptr dw 0 ;-0004 Unread con input
|
2000-05-06 21:34:20 +02:00
|
|
|
global _first_mcb
|
|
|
|
_first_mcb dw 0 ;-0002 Start of user memory
|
|
|
|
global _DPBp
|
|
|
|
global MARK0026H
|
|
|
|
; A reference seems to indicate that this should start at offset 26h.
|
|
|
|
MARK0026H equ $
|
|
|
|
_DPBp dd 0 ; 0000 First drive Parameter Block
|
|
|
|
global _sfthead
|
2003-06-15 17:53:58 +02:00
|
|
|
_sfthead dd 0 ; 0004 System File Table head
|
2000-05-06 21:34:20 +02:00
|
|
|
global _clock
|
|
|
|
_clock dd 0 ; 0008 CLOCK$ device
|
|
|
|
global _syscon
|
2001-09-23 22:39:44 +02:00
|
|
|
_syscon dw _con_dev,seg _con_dev ; 000c console device
|
2000-05-06 21:34:20 +02:00
|
|
|
global _maxbksize
|
2001-04-22 00:32:53 +02:00
|
|
|
_maxbksize dw 512 ; 0010 maximum bytes/sector of any block device
|
2003-06-15 17:53:58 +02:00
|
|
|
dd 0 ; 0012 pointer to buffers info structure
|
2000-05-06 21:34:20 +02:00
|
|
|
global _CDSp
|
|
|
|
_CDSp dd 0 ; 0016 Current Directory Structure
|
|
|
|
global _FCBp
|
|
|
|
_FCBp dd 0 ; 001a FCB table pointer
|
|
|
|
global _nprotfcb
|
|
|
|
_nprotfcb dw 0 ; 001e number of protected fcbs
|
|
|
|
global _nblkdev
|
|
|
|
_nblkdev db 0 ; 0020 number of block devices
|
|
|
|
global _lastdrive
|
|
|
|
_lastdrive db 0 ; 0021 value of last drive
|
|
|
|
global _nul_dev
|
|
|
|
_nul_dev: ; 0022 device chain root
|
2002-12-09 01:17:15 +01:00
|
|
|
extern _con_dev:wrt LGROUP
|
2001-04-22 00:32:53 +02:00
|
|
|
dw _con_dev, seg _con_dev
|
|
|
|
; next is con_dev at init time.
|
2000-05-06 21:34:20 +02:00
|
|
|
dw 8004h ; attributes = char device, NUL bit set
|
|
|
|
dw _nul_strtgy
|
|
|
|
dw _nul_intr
|
|
|
|
db 'NUL '
|
|
|
|
global _njoined
|
|
|
|
_njoined db 0 ; 0034 number of joined devices
|
|
|
|
dw 0 ; 0035 DOS 4 pointer to special names (always zero in DOS 5)
|
|
|
|
setverPtr dw 0,0 ; 0037 setver list
|
|
|
|
dw 0 ; 003B cs offset for fix a20
|
|
|
|
dw 0 ; 003D psp of last umb exec
|
2001-08-19 14:58:36 +02:00
|
|
|
global _LoL_nbuffers
|
|
|
|
_LoL_nbuffers dw 1 ; 003F number of buffers
|
2000-05-06 21:34:20 +02:00
|
|
|
dw 1 ; 0041 size of pre-read buffer
|
|
|
|
global _BootDrive
|
2001-11-04 20:47:39 +01:00
|
|
|
_BootDrive db 1 ; 0043 drive we booted from
|
|
|
|
|
2004-04-13 22:41:15 +02:00
|
|
|
%IF XCPU < 386
|
2000-05-06 21:34:20 +02:00
|
|
|
db 0 ; 0044 cpu type (1 if >=386)
|
2001-11-04 20:47:39 +01:00
|
|
|
%ELSE
|
|
|
|
db 1 ; 0044 cpu type (1 if >=386)
|
|
|
|
%ENDIF
|
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
dw 0 ; 0045 Extended memory in KBytes
|
2001-08-19 14:58:36 +02:00
|
|
|
buf_info:
|
|
|
|
global _firstbuf
|
|
|
|
_firstbuf dd 0 ; 0047 disk buffer chain
|
2002-12-09 01:17:15 +01:00
|
|
|
dw 0 ; 004B Number of dirty buffers
|
2000-05-06 21:34:20 +02:00
|
|
|
dd 0 ; 004D pre-read buffer
|
2002-12-09 01:17:15 +01:00
|
|
|
dw 0 ; 0051 number of look-ahead buffers
|
2003-07-12 22:56:11 +02:00
|
|
|
global _bufloc
|
|
|
|
_bufloc db 0 ; 0053 00=conv 01=HMA
|
|
|
|
global _deblock_buf
|
|
|
|
_deblock_buf dd 0 ; 0054 deblock buffer
|
2000-06-21 20:16:46 +02:00
|
|
|
times 3 db 0 ; 0058 unknown
|
2000-05-06 21:34:20 +02:00
|
|
|
dw 0 ; 005B unknown
|
|
|
|
db 0, 0FFh, 0 ; 005D unknown
|
2000-08-06 07:50:17 +02:00
|
|
|
global _VgaSet
|
|
|
|
_VgaSet db 0 ; 0060 unknown
|
2000-05-06 21:34:20 +02:00
|
|
|
dw 0 ; 0061 unknown
|
2000-06-21 20:16:46 +02:00
|
|
|
global _uppermem_link
|
|
|
|
_uppermem_link db 0 ; 0063 upper memory link flag
|
2002-02-03 23:40:24 +01:00
|
|
|
_min_pars dw 0 ; 0064 minimum paragraphs of memory
|
|
|
|
; required by program being EXECed
|
2000-06-21 20:16:46 +02:00
|
|
|
global _uppermem_root
|
2002-02-09 01:40:33 +01:00
|
|
|
_uppermem_root dw 0ffffh ; 0066 dmd_upper_root (usually 9fff)
|
2002-02-03 23:40:24 +01:00
|
|
|
_last_para dw 0 ; 0068 para of last mem search
|
2000-05-06 21:34:20 +02:00
|
|
|
SysVarEnd:
|
2003-06-15 17:53:58 +02:00
|
|
|
;; FreeDOS specific entries
|
2003-06-15 21:26:49 +02:00
|
|
|
global _os_setver_minor
|
|
|
|
_os_setver_minor db 0
|
|
|
|
global _os_setver_major
|
|
|
|
_os_setver_major db 5
|
2003-06-15 17:53:58 +02:00
|
|
|
global _os_minor
|
|
|
|
_os_minor db 0
|
|
|
|
global _os_major
|
|
|
|
_os_major db 5
|
|
|
|
global _rev_number
|
|
|
|
_rev_number db 0
|
|
|
|
global _version_flags
|
|
|
|
_version_flags db 0
|
|
|
|
global _f_nodes
|
2004-03-23 23:45:38 +01:00
|
|
|
_f_nodes dd 0
|
2003-06-15 17:53:58 +02:00
|
|
|
global _f_nodes_cnt
|
|
|
|
_f_nodes_cnt dw 0
|
|
|
|
global os_release
|
|
|
|
extern _os_release
|
|
|
|
os_release dw _os_release
|
2000-05-06 21:34:20 +02:00
|
|
|
|
2001-04-29 19:34:41 +02:00
|
|
|
;; The first 5 sft entries appear to have to be at DS:00cc
|
|
|
|
times (0cch - ($ - DATASTART)) db 0
|
|
|
|
global _firstsftt
|
|
|
|
_firstsftt:
|
|
|
|
dd -1 ; link to next
|
|
|
|
dw 5 ; count
|
2001-04-15 05:21:50 +02:00
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
; Some references seem to indicate that this data should start at 01fbh in
|
|
|
|
; order to maintain 100% MS-DOS compatibility.
|
2001-04-15 05:21:50 +02:00
|
|
|
times (01fbh - ($ - DATASTART)) db 0
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
global MARK01FBH
|
|
|
|
MARK01FBH equ $
|
2002-08-05 21:56:38 +02:00
|
|
|
global _local_buffer ; local_buffer is 256 bytes long
|
|
|
|
; so it overflows into kb_buf!!
|
|
|
|
; only when kb_buf is used, local_buffer is limited to 128 bytes.
|
|
|
|
_local_buffer: times 128 db 0
|
2000-05-06 21:34:20 +02:00
|
|
|
global _kb_buf
|
2002-08-05 21:56:38 +02:00
|
|
|
_kb_buf db 128,0 ; initialise buffer to empty
|
2000-05-06 21:34:20 +02:00
|
|
|
times 128+1 db 0 ; room for 128 byte readline + LF
|
|
|
|
;
|
|
|
|
; Variables that follow are documented as part of the DOS 4.0-6.X swappable
|
|
|
|
; data area in Ralf Browns Interrupt List #56
|
|
|
|
;
|
|
|
|
; this byte is used for ^P support
|
|
|
|
global _PrinterEcho
|
|
|
|
_PrinterEcho db 0 ;-34 - 0 = no printer echo, ~0 echo
|
|
|
|
global _verify_ena
|
|
|
|
_verify_ena db 0 ; ~0, write with verify
|
|
|
|
|
|
|
|
; this byte is used for TAB's
|
|
|
|
global _scr_pos
|
|
|
|
_scr_pos db 0 ; Current Cursor Column
|
|
|
|
global _switchar
|
|
|
|
_switchar db '/' ;-31 - switch char
|
|
|
|
global _mem_access_mode
|
|
|
|
_mem_access_mode db 0 ;-30 - memory allocation strategy
|
|
|
|
global sharing_flag
|
|
|
|
sharing_flag db 0 ; 00 = sharing module not loaded
|
|
|
|
; 01 = sharing module loaded, but
|
|
|
|
; open/close for block devices
|
|
|
|
; disabled
|
|
|
|
; FF = sharing module loaded,
|
|
|
|
; open/close for block devices
|
|
|
|
; enabled (not implemented)
|
|
|
|
global _net_set_count
|
|
|
|
_net_set_count db 1 ;-28 - count the name below was set
|
|
|
|
global _net_name
|
|
|
|
_net_name db ' ' ;-27 - 15 Character Network Name
|
|
|
|
db 00 ; Terminating 0 byte
|
|
|
|
|
|
|
|
|
|
|
|
;
|
|
|
|
; Variables contained the the "STATE_DATA" segment contain
|
|
|
|
; information about the STATE of the current DOS Process. These
|
|
|
|
; variables must be preserved regardless of the state of the INDOS
|
|
|
|
; flag.
|
|
|
|
;
|
|
|
|
; All variables that appear in "STATE_DATA" **MUST** be declared
|
|
|
|
; in this file as the offsets from the INTERNAL_DATA variable are
|
|
|
|
; critical to the DOS applications that modify this data area.
|
|
|
|
;
|
|
|
|
;
|
|
|
|
global _ErrorMode, _InDOS
|
|
|
|
global _CritErrLocus, _CritErrCode
|
|
|
|
global _CritErrAction, _CritErrClass
|
|
|
|
global _CritErrDev, _CritErrDrive
|
|
|
|
global _dta
|
|
|
|
global _cu_psp, _default_drive
|
|
|
|
global _break_ena
|
2002-10-22 04:40:19 +02:00
|
|
|
global _return_code
|
2000-05-06 21:34:20 +02:00
|
|
|
global _internal_data
|
|
|
|
|
|
|
|
global _CritPatch
|
|
|
|
_CritPatch dw 0d0ch ;-11 zero list of patched critical
|
|
|
|
dw 0d0ch ; section variables
|
|
|
|
dw 0d0ch
|
|
|
|
dw 0d0ch
|
|
|
|
dw 0d0ch
|
|
|
|
db 0 ;-01 - unknown
|
|
|
|
_internal_data: ; <-- Address returned by INT21/5D06
|
|
|
|
_ErrorMode db 0 ; 00 - Critical Error Flag
|
|
|
|
_InDOS db 0 ; 01 - Indos Flag
|
|
|
|
_CritErrDrive db 0 ; 02 - Drive on write protect error
|
|
|
|
_CritErrLocus db 0 ; 03 - Error Locus
|
|
|
|
_CritErrCode dw 0 ; 04 - DOS format error Code
|
|
|
|
_CritErrAction db 0 ; 06 - Error Action Code
|
|
|
|
_CritErrClass db 0 ; 07 - Error Class
|
|
|
|
_CritErrDev dd 0 ; 08 - Failing Device Address
|
2003-06-15 17:53:58 +02:00
|
|
|
_dta dd 0 ; 0C - current DTA
|
2000-05-06 21:34:20 +02:00
|
|
|
_cu_psp dw 0 ; 10 - Current PSP
|
|
|
|
break_sp dw 0 ; 12 - used in int 23
|
2002-10-22 04:40:19 +02:00
|
|
|
_return_code dw 0 ; 14 - return code from process
|
2000-05-06 21:34:20 +02:00
|
|
|
_default_drive db 0 ; 16 - Current Drive
|
2001-04-22 00:32:53 +02:00
|
|
|
_break_ena db 1 ; 17 - Break Flag (default TRUE)
|
2000-05-06 21:34:20 +02:00
|
|
|
db 0 ; 18 - flag, code page switching
|
|
|
|
db 0 ; 19 - flag, copy of 18 on int 24h abort
|
|
|
|
|
|
|
|
global _swap_always, _swap_indos
|
|
|
|
_swap_always:
|
|
|
|
|
|
|
|
global _Int21AX
|
|
|
|
_Int21AX dw 0 ; 1A - AX from last Int 21
|
|
|
|
|
|
|
|
global owning_psp, _MachineId
|
|
|
|
owning_psp dw 0 ; 1C - owning psp
|
|
|
|
_MachineId dw 0 ; 1E - remote machine ID
|
|
|
|
dw 0 ; 20 - First usable mcb
|
|
|
|
dw 0 ; 22 - Best usable mcb
|
|
|
|
dw 0 ; 24 - Last usable mcb
|
|
|
|
dw 0 ; 26 - memory size in paragraphs
|
|
|
|
dw 0 ; 28 - unknown
|
|
|
|
db 0 ; 2A - unknown
|
|
|
|
db 0 ; 2B - unknown
|
|
|
|
db 0 ; 2C - unknown
|
|
|
|
global _break_flg
|
|
|
|
_break_flg db 0 ; 2D - Program aborted by ^C
|
|
|
|
db 0 ; 2E - unknown
|
|
|
|
db 0 ; 2F - not referenced
|
|
|
|
global _DayOfMonth
|
|
|
|
_DayOfMonth db 1 ; 30 - day of month
|
|
|
|
global _Month
|
|
|
|
_Month db 1 ; 31 - month
|
|
|
|
global _YearsSince1980
|
|
|
|
_YearsSince1980 dw 0 ; 32 - year since 1980
|
|
|
|
daysSince1980 dw 0FFFFh ; 34 - number of days since epoch
|
|
|
|
; force rebuild on first clock read
|
|
|
|
global _DayOfWeek
|
|
|
|
_DayOfWeek db 2 ; 36 - day of week
|
2002-10-22 04:40:19 +02:00
|
|
|
_console_swap db 0 ; 37 console swapped during read from dev
|
|
|
|
global _dosidle_flag
|
|
|
|
_dosidle_flag db 1 ; 38 - safe to call int28 if nonzero
|
|
|
|
_abort_progress db 0 ; 39 - abort in progress
|
2000-05-06 21:34:20 +02:00
|
|
|
global _CharReqHdr
|
|
|
|
_CharReqHdr:
|
|
|
|
global _ClkReqHdr
|
|
|
|
_ClkReqHdr times 30 db 0 ; 3A - Device driver request header
|
|
|
|
dd 0 ; 58 - pointer to driver entry
|
|
|
|
global _MediaReqHdr
|
|
|
|
_MediaReqHdr times 22 db 0 ; 5C - Device driver request header
|
|
|
|
global _IoReqHdr
|
|
|
|
_IoReqHdr times 30 db 0 ; 72 - Device driver request header
|
|
|
|
times 6 db 0 ; 90 - unknown
|
|
|
|
global _ClkRecord
|
|
|
|
_ClkRecord times 6 db 0 ; 96 - CLOCK$ transfer record
|
|
|
|
dw 0 ; 9C - unknown
|
|
|
|
global __PriPathBuffer
|
|
|
|
__PriPathBuffer times 80h db 0 ; 9E - buffer for file name
|
|
|
|
global __SecPathBuffer
|
|
|
|
__SecPathBuffer times 80h db 0 ;11E - buffer for file name
|
2002-10-22 04:40:19 +02:00
|
|
|
global _sda_tmp_dm
|
|
|
|
_sda_tmp_dm times 21 db 0 ;19E - 21 byte srch state
|
2000-05-06 21:34:20 +02:00
|
|
|
global _SearchDir
|
|
|
|
_SearchDir times 32 db 0 ;1B3 - 32 byte dir entry
|
|
|
|
global _TempCDS
|
|
|
|
_TempCDS times 88 db 0 ;1D3 - TemporaryCDS buffer
|
|
|
|
global _DirEntBuffer
|
|
|
|
_DirEntBuffer times 32 db 0 ;22B - space enough for 1 dir entry
|
|
|
|
global _wAttr
|
|
|
|
_wAttr dw 0 ;24B - extended FCB file attribute
|
|
|
|
|
|
|
|
|
|
|
|
global _SAttr
|
|
|
|
_SAttr db 0 ;24D - Attribute Mask for Dir Search
|
|
|
|
global _OpenMode
|
|
|
|
_OpenMode db 0 ;24E - File Open Attribute
|
|
|
|
|
2000-06-21 20:16:46 +02:00
|
|
|
times 3 db 0
|
|
|
|
global _Server_Call
|
|
|
|
_Server_Call db 0 ;252 - Server call Func 5D sub 0
|
|
|
|
db 0
|
2002-10-22 04:40:19 +02:00
|
|
|
; Pad to 05CCh
|
2000-05-06 21:34:20 +02:00
|
|
|
times (25ch - ($ - _internal_data)) db 0
|
|
|
|
|
|
|
|
global _tsr ; used by break and critical error
|
|
|
|
_tsr db 0 ;25C - handlers during termination
|
|
|
|
db 0 ;25D - padding
|
|
|
|
global term_psp
|
|
|
|
term_psp dw 0 ;25E - 0??
|
|
|
|
global int24_esbp
|
|
|
|
int24_esbp times 2 dw 0 ;260 - pointer to criticalerr DPB
|
|
|
|
global _user_r, int21regs_off, int21regs_seg
|
|
|
|
_user_r:
|
|
|
|
int21regs_off dw 0 ;264 - pointer to int21h stack frame
|
|
|
|
int21regs_seg dw 0
|
|
|
|
global critical_sp
|
|
|
|
critical_sp dw 0 ;268 - critical error internal stack
|
|
|
|
global current_ddsc
|
|
|
|
current_ddsc times 2 dw 0
|
|
|
|
|
|
|
|
; Pad to 059ah
|
|
|
|
times (27ah - ($ - _internal_data)) db 0
|
|
|
|
global current_device
|
|
|
|
current_device times 2 dw 0 ;27A - 0??
|
|
|
|
global _lpCurSft
|
|
|
|
_lpCurSft times 2 dw 0 ;27e - Current SFT
|
|
|
|
global _current_ldt
|
|
|
|
_current_ldt times 2 dw 0 ;282 - Current CDS
|
2003-10-16 15:01:55 +02:00
|
|
|
global _sda_lpFcb
|
|
|
|
_sda_lpFcb times 2 dw 0 ;286 - pointer to callers FCB
|
2001-11-04 20:47:39 +01:00
|
|
|
global _current_sft_idx
|
|
|
|
_current_sft_idx dw 0 ;28A - SFT index for next open
|
|
|
|
; used by MS NET
|
2000-05-06 21:34:20 +02:00
|
|
|
|
2001-07-22 03:58:58 +02:00
|
|
|
; Pad to 05b2h
|
2001-11-04 20:47:39 +01:00
|
|
|
times (292h - ($ - _internal_data)) db 0
|
2001-07-22 03:58:58 +02:00
|
|
|
dw __PriPathBuffer ; 292 - "sda_WFP_START" offset in DOS DS of first filename argument
|
|
|
|
dw __SecPathBuffer ; 294 - "sda_REN_WFP" offset in DOS DS of second filename argument
|
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
; Pad to 05ceh
|
|
|
|
times (2aeh - ($ - _internal_data)) db 0
|
2001-07-22 03:58:58 +02:00
|
|
|
global _current_filepos
|
|
|
|
_current_filepos times 2 dw 0 ;2AE - current offset in file
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
; Pad to 05f0h
|
|
|
|
times (2d0h - ($ - _internal_data)) db 0
|
|
|
|
global _prev_user_r
|
|
|
|
global prev_int21regs_off
|
|
|
|
global prev_int21regs_seg
|
|
|
|
_prev_user_r:
|
|
|
|
prev_int21regs_off dw 0 ;2D0 - pointer to prev int 21 frame
|
|
|
|
prev_int21regs_seg dw 0
|
|
|
|
|
2002-12-09 01:17:15 +01:00
|
|
|
; Pad to 05fdh
|
2002-08-03 04:02:15 +02:00
|
|
|
times (2ddh - ($ - _internal_data)) db 0
|
|
|
|
global _ext_open_action
|
|
|
|
global _ext_open_attrib
|
|
|
|
global _ext_open_mode
|
|
|
|
_ext_open_action dw 0 ;2DD - extended open action
|
|
|
|
_ext_open_attrib dw 0 ;2DF - extended open attrib
|
|
|
|
_ext_open_mode dw 0 ;2E1 - extended open mode
|
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
; Pad to 0620h
|
|
|
|
times (300h - ($ - _internal_data)) db 0
|
2001-07-22 03:58:58 +02:00
|
|
|
global _szNames
|
|
|
|
_szNames:
|
|
|
|
;; times 11 db 0
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
global _FcbSearchBuffer ; during FCB search 1st/next use bottom
|
|
|
|
_FcbSearchBuffer: ; of error stack as scratch buffer
|
|
|
|
; times 43 db 0 ; - only used during int 21 call
|
|
|
|
; stacks are made to initialize to no-ops so that high-water
|
2001-03-21 03:56:26 +01:00
|
|
|
; testing can be performed
|
|
|
|
|
|
|
|
global apistk_bottom
|
2000-05-06 21:34:20 +02:00
|
|
|
apistk_bottom:
|
2003-06-15 17:53:58 +02:00
|
|
|
times STACK_SIZE dw 0x9090 ;300 - Error Processing Stack
|
2000-05-06 21:34:20 +02:00
|
|
|
global _error_tos
|
|
|
|
_error_tos:
|
2003-06-15 17:53:58 +02:00
|
|
|
times STACK_SIZE dw 0x9090 ;480 - Disk Function Stack
|
2000-05-06 21:34:20 +02:00
|
|
|
global _disk_api_tos
|
|
|
|
_disk_api_tos:
|
2003-06-15 17:53:58 +02:00
|
|
|
times STACK_SIZE dw 0x9090 ;600 - Char Function Stack
|
2000-05-06 21:34:20 +02:00
|
|
|
global _char_api_tos
|
|
|
|
_char_api_tos:
|
|
|
|
apistk_top:
|
2001-11-04 20:47:39 +01:00
|
|
|
db 0 ; 780 ???
|
2000-05-06 21:34:20 +02:00
|
|
|
_VolChange db 0 ;781 - volume change
|
|
|
|
_VirtOpen db 0 ;782 - virtual open flag
|
|
|
|
|
|
|
|
; controlled variables end at offset 78Ch so pad to end
|
|
|
|
times (78ch - ($ - _internal_data)) db 0
|
2001-11-04 20:47:39 +01:00
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
;
|
|
|
|
; end of controlled variables
|
|
|
|
;
|
|
|
|
|
|
|
|
segment _BSS
|
2001-11-04 20:47:39 +01:00
|
|
|
;!! global _NumFloppies
|
|
|
|
;!!_NumFloppies resw 1
|
|
|
|
;!!intr_dos_stk resw 1
|
|
|
|
;!!intr_dos_seg resw 1
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
|
2001-03-21 03:56:26 +01:00
|
|
|
; mark front and end of bss area to clear
|
2001-04-22 00:32:53 +02:00
|
|
|
segment IB_B
|
|
|
|
global __ib_start
|
|
|
|
__ib_start:
|
|
|
|
segment IB_E
|
|
|
|
global __ib_end
|
|
|
|
__ib_end:
|
|
|
|
;; do not clear the other init BSS variables + STACK: too late.
|
|
|
|
|
|
|
|
; kernel startup stack
|
|
|
|
global init_tos
|
2001-07-22 03:58:58 +02:00
|
|
|
resw 512
|
2001-04-22 00:32:53 +02:00
|
|
|
init_tos:
|
|
|
|
; the last paragraph of conventional memory might become an MCB
|
|
|
|
resb 16
|
2001-07-28 20:13:06 +02:00
|
|
|
global __init_end
|
|
|
|
__init_end:
|
2001-04-22 00:32:53 +02:00
|
|
|
init_end:
|
2000-05-06 21:34:20 +02:00
|
|
|
|
2002-01-27 02:13:07 +01:00
|
|
|
segment _DATA
|
2000-05-06 21:34:20 +02:00
|
|
|
; blockdev private stack
|
|
|
|
global blk_stk_top
|
2001-04-15 05:21:50 +02:00
|
|
|
times 192 dw 0
|
2000-05-06 21:34:20 +02:00
|
|
|
blk_stk_top:
|
|
|
|
|
|
|
|
; clockdev private stack
|
|
|
|
global clk_stk_top
|
2001-04-15 05:21:50 +02:00
|
|
|
times 64 dw 0
|
2000-05-06 21:34:20 +02:00
|
|
|
clk_stk_top:
|
2002-12-09 01:17:15 +01:00
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
; Dynamic data:
|
|
|
|
; member of the DOS DATA GROUP
|
|
|
|
; and marks definitive end of all used data in kernel data segment
|
|
|
|
;
|
|
|
|
|
2002-01-27 02:13:07 +01:00
|
|
|
segment _DATAEND
|
|
|
|
|
|
|
|
_swap_indos:
|
|
|
|
; we don't know precisely what needs to be swapped before this, so set it here.
|
|
|
|
; this is just after FIXED_DATA+BSS+DATA and before (D)CONST+BSS
|
|
|
|
; probably, the clock and block stacks and disktransferbuffer should go past
|
|
|
|
; _swap_indos but only if int2a ah=80/81 (critical section start/end)
|
|
|
|
; are called upon entry and exit of the device drivers
|
|
|
|
|
2004-03-07 13:19:43 +01:00
|
|
|
times 96 dw 0x9090 ; Process 0 Stack
|
|
|
|
global _p_0_tos
|
|
|
|
_p_0_tos:
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
segment DYN_DATA
|
2002-01-27 02:13:07 +01:00
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
global _Dyn
|
|
|
|
_Dyn:
|
|
|
|
DynAllocated dw 0
|
2001-04-22 00:32:53 +02:00
|
|
|
|
2001-04-15 05:21:50 +02:00
|
|
|
segment ID_B
|
|
|
|
global __INIT_DATA_START
|
|
|
|
__INIT_DATA_START:
|
|
|
|
segment ID_E
|
|
|
|
global __INIT_DATA_END
|
|
|
|
__INIT_DATA_END:
|
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
|
2001-03-21 03:56:26 +01:00
|
|
|
segment INIT_TEXT_START
|
|
|
|
global __InitTextStart
|
|
|
|
__InitTextStart: ; and c version
|
|
|
|
|
|
|
|
|
|
|
|
;
|
|
|
|
; start end end of HMA area
|
|
|
|
|
|
|
|
segment HMA_TEXT_START
|
|
|
|
global __HMATextAvailable
|
|
|
|
__HMATextAvailable
|
|
|
|
global __HMATextStart
|
|
|
|
__HMATextStart:
|
|
|
|
|
|
|
|
;
|
2001-04-22 03:19:34 +02:00
|
|
|
; the HMA area is filled with 1eh+3(=sizeof VDISK) = 33 byte dummy data,
|
|
|
|
; so nothing will ever be below 0xffff:0031
|
|
|
|
;
|
2003-03-12 23:43:53 +01:00
|
|
|
segment HMA_TEXT
|
2001-04-22 03:19:34 +02:00
|
|
|
begin_hma:
|
2001-04-29 19:34:41 +02:00
|
|
|
times 10h db 0 ; filler [ffff:0..ffff:10]
|
|
|
|
times 20h db 0
|
2001-04-22 03:19:34 +02:00
|
|
|
db 0
|
2001-04-15 05:21:50 +02:00
|
|
|
|
2003-09-16 14:38:02 +02:00
|
|
|
; to minimize relocations
|
|
|
|
global _DGROUP_
|
|
|
|
_DGROUP_ dw DGROUP
|
|
|
|
|
2002-01-23 23:29:41 +01:00
|
|
|
%ifdef WATCOM
|
|
|
|
; 32 bit multiplication + division
|
|
|
|
global __U4M
|
|
|
|
__U4M:
|
|
|
|
LMULU
|
|
|
|
global __U4D
|
|
|
|
__U4D:
|
|
|
|
LDIVMODU
|
|
|
|
%endif
|
|
|
|
|
2003-09-16 14:38:02 +02:00
|
|
|
resb 0xd0 - ($-begin_hma)
|
|
|
|
; reserve space for far jump to cp/m routine
|
|
|
|
resb 5
|
|
|
|
|
2001-03-21 03:56:26 +01:00
|
|
|
;End of HMA segment
|
|
|
|
segment HMA_TEXT_END
|
|
|
|
global __HMATextEnd
|
|
|
|
__HMATextEnd: ; and c version
|
|
|
|
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
; The default stack (_TEXT:0) will overwrite the data area, so I create a dummy
|
|
|
|
; stack here to ease debugging. -- ror4
|
|
|
|
|
|
|
|
segment _STACK class=STACK stack
|
|
|
|
|
2001-03-21 03:56:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-09-16 14:38:02 +02:00
|
|
|
segment CONST
|
2001-03-21 03:56:26 +01:00
|
|
|
; dummy interrupt return handlers
|
2001-09-23 22:39:44 +02:00
|
|
|
|
|
|
|
global _int22_handler
|
2001-03-21 03:56:26 +01:00
|
|
|
global _int28_handler
|
|
|
|
global _int2a_handler
|
|
|
|
global _empty_handler
|
2001-09-23 22:39:44 +02:00
|
|
|
_int22_handler:
|
2001-03-21 03:56:26 +01:00
|
|
|
_int28_handler:
|
|
|
|
_int2a_handler:
|
|
|
|
_empty_handler:
|
|
|
|
iret
|
|
|
|
|
|
|
|
|
2001-04-15 05:21:50 +02:00
|
|
|
global _initforceEnableA20
|
|
|
|
initforceEnableA20:
|
|
|
|
call near forceEnableA20
|
|
|
|
retf
|
2001-03-21 03:56:26 +01:00
|
|
|
|
2001-04-15 05:21:50 +02:00
|
|
|
global __HMARelocationTableStart
|
|
|
|
__HMARelocationTableStart:
|
2001-03-21 03:56:26 +01:00
|
|
|
|
|
|
|
global _int2f_handler
|
|
|
|
extern reloc_call_int2f_handler
|
2003-06-15 17:53:58 +02:00
|
|
|
_int2f_handler: jmp 0:reloc_call_int2f_handler
|
2001-03-21 03:56:26 +01:00
|
|
|
call near forceEnableA20
|
|
|
|
|
|
|
|
global _int20_handler
|
|
|
|
extern reloc_call_int20_handler
|
2003-06-15 17:53:58 +02:00
|
|
|
_int20_handler: jmp 0:reloc_call_int20_handler
|
2001-03-21 03:56:26 +01:00
|
|
|
call near forceEnableA20
|
|
|
|
|
|
|
|
global _int21_handler
|
|
|
|
extern reloc_call_int21_handler
|
2003-06-15 17:53:58 +02:00
|
|
|
_int21_handler: jmp 0:reloc_call_int21_handler
|
2001-03-21 03:56:26 +01:00
|
|
|
call near forceEnableA20
|
|
|
|
|
|
|
|
|
|
|
|
global _low_int25_handler
|
|
|
|
extern reloc_call_low_int25_handler
|
2003-06-15 17:53:58 +02:00
|
|
|
_low_int25_handler: jmp 0:reloc_call_low_int25_handler
|
2001-03-21 03:56:26 +01:00
|
|
|
call near forceEnableA20
|
|
|
|
|
|
|
|
global _low_int26_handler
|
|
|
|
extern reloc_call_low_int26_handler
|
2003-06-15 17:53:58 +02:00
|
|
|
_low_int26_handler: jmp 0:reloc_call_low_int26_handler
|
2001-03-21 03:56:26 +01:00
|
|
|
call near forceEnableA20
|
|
|
|
|
|
|
|
global _int27_handler
|
|
|
|
extern reloc_call_int27_handler
|
2003-06-15 17:53:58 +02:00
|
|
|
_int27_handler: jmp 0:reloc_call_int27_handler
|
2001-03-21 03:56:26 +01:00
|
|
|
call near forceEnableA20
|
|
|
|
|
2001-03-30 21:30:06 +02:00
|
|
|
global _int0_handler
|
|
|
|
extern reloc_call_int0_handler
|
2003-06-15 17:53:58 +02:00
|
|
|
_int0_handler: jmp 0:reloc_call_int0_handler
|
2001-03-30 21:30:06 +02:00
|
|
|
call near forceEnableA20
|
2001-03-21 03:56:26 +01:00
|
|
|
|
2001-04-22 00:32:53 +02:00
|
|
|
global _int6_handler
|
|
|
|
extern reloc_call_int6_handler
|
2003-06-15 17:53:58 +02:00
|
|
|
_int6_handler: jmp 0:reloc_call_int6_handler
|
2001-04-22 00:32:53 +02:00
|
|
|
call near forceEnableA20
|
|
|
|
|
2001-03-21 03:56:26 +01:00
|
|
|
global _cpm_entry
|
|
|
|
extern reloc_call_cpm_entry
|
2003-06-15 17:53:58 +02:00
|
|
|
_cpm_entry: jmp 0:reloc_call_cpm_entry
|
2001-04-15 05:21:50 +02:00
|
|
|
call near forceEnableA20
|
|
|
|
|
|
|
|
global _reloc_call_blk_driver
|
|
|
|
extern _blk_driver
|
|
|
|
_reloc_call_blk_driver:
|
2003-06-15 17:53:58 +02:00
|
|
|
jmp 0:_blk_driver
|
2001-03-21 03:56:26 +01:00
|
|
|
call near forceEnableA20
|
|
|
|
|
2001-04-15 05:21:50 +02:00
|
|
|
global _reloc_call_clk_driver
|
|
|
|
extern _clk_driver
|
|
|
|
_reloc_call_clk_driver:
|
2003-06-15 17:53:58 +02:00
|
|
|
jmp 0:_clk_driver
|
2001-04-15 05:21:50 +02:00
|
|
|
call near forceEnableA20
|
2001-03-21 03:56:26 +01:00
|
|
|
|
2003-09-22 20:57:45 +02:00
|
|
|
global _CharMapSrvc ; in _DATA (see AARD)
|
2001-04-15 05:21:50 +02:00
|
|
|
extern _reloc_call_CharMapSrvc
|
2003-09-22 20:57:45 +02:00
|
|
|
_CharMapSrvc: jmp 0:_reloc_call_CharMapSrvc
|
2001-03-21 03:56:26 +01:00
|
|
|
call near forceEnableA20
|
|
|
|
|
2004-03-07 13:19:43 +01:00
|
|
|
global _init_call_p_0
|
|
|
|
extern reloc_call_p_0
|
|
|
|
_init_call_p_0: jmp 0:reloc_call_p_0
|
|
|
|
call near forceEnableA20
|
|
|
|
|
2002-12-09 01:17:15 +01:00
|
|
|
|
|
|
|
global __HMARelocationTableEnd
|
2001-03-21 03:56:26 +01:00
|
|
|
__HMARelocationTableEnd:
|
|
|
|
|
|
|
|
;
|
|
|
|
; if we were lucky, we found all entries from the outside to the kernel.
|
|
|
|
; if not, BUMS
|
|
|
|
;
|
|
|
|
;
|
|
|
|
; this routine makes the HMA area available. PERIOD.
|
|
|
|
; must conserve ALL registers
|
|
|
|
; will be only ever called, if HMA (DOS=HIGH) is enabled.
|
|
|
|
; for obvious reasons it should be located at the relocation table
|
|
|
|
;
|
|
|
|
global _XMSDriverAddress
|
|
|
|
_XMSDriverAddress:
|
|
|
|
dw 0 ; XMS driver, if detected
|
|
|
|
dw 0
|
|
|
|
|
2004-04-09 15:13:06 +02:00
|
|
|
global _ENABLEA20
|
|
|
|
_ENABLEA20:
|
2003-08-28 22:32:01 +02:00
|
|
|
mov ah,5
|
2001-07-10 00:19:33 +02:00
|
|
|
UsingXMSdriver:
|
2001-06-03 16:16:18 +02:00
|
|
|
push bx
|
2001-03-21 03:56:26 +01:00
|
|
|
call far [cs:_XMSDriverAddress]
|
2001-07-10 00:19:33 +02:00
|
|
|
pop bx
|
2001-03-21 03:56:26 +01:00
|
|
|
retf
|
|
|
|
|
2004-04-09 15:13:06 +02:00
|
|
|
global _DISABLEA20
|
|
|
|
_DISABLEA20:
|
2003-08-28 22:32:01 +02:00
|
|
|
mov ah,6
|
2001-07-28 20:13:06 +02:00
|
|
|
jmp short UsingXMSdriver
|
2001-03-21 03:56:26 +01:00
|
|
|
|
|
|
|
dslowmem dw 0
|
|
|
|
eshighmem dw 0ffffh
|
|
|
|
|
|
|
|
global forceEnableA20
|
|
|
|
forceEnableA20:
|
|
|
|
|
|
|
|
push ds
|
|
|
|
push es
|
|
|
|
push ax
|
|
|
|
|
|
|
|
forceEnableA20retry:
|
|
|
|
mov ds, [cs:dslowmem]
|
|
|
|
mov es, [cs:eshighmem]
|
|
|
|
|
|
|
|
mov ax, [ds:00000h]
|
|
|
|
cmp ax, [es:00010h]
|
|
|
|
jne forceEnableA20success
|
|
|
|
|
|
|
|
mov ax, [ds:00002h]
|
|
|
|
cmp ax, [es:00012h]
|
|
|
|
jne forceEnableA20success
|
|
|
|
|
|
|
|
mov ax, [ds:00004h]
|
|
|
|
cmp ax, [es:00014h]
|
|
|
|
jne forceEnableA20success
|
|
|
|
|
|
|
|
mov ax, [ds:00006h]
|
|
|
|
cmp ax, [es:00016h]
|
|
|
|
jne forceEnableA20success
|
|
|
|
|
|
|
|
;
|
|
|
|
; ok, we have to enable A20 )at least seems so
|
|
|
|
;
|
2002-08-03 04:02:15 +02:00
|
|
|
|
2004-04-09 15:13:06 +02:00
|
|
|
call far _ENABLEA20
|
2001-03-21 03:56:26 +01:00
|
|
|
|
|
|
|
jmp short forceEnableA20retry
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
forceEnableA20success:
|
|
|
|
pop ax
|
|
|
|
pop es
|
|
|
|
pop ds
|
|
|
|
ret
|
|
|
|
|
2002-08-03 04:02:15 +02:00
|
|
|
;
|
|
|
|
; global f*cking compatibility issues:
|
|
|
|
;
|
|
|
|
; very old brain dead software (PKLITE, copyright 1990)
|
|
|
|
; forces us to execute with A20 disabled
|
|
|
|
;
|
2001-03-21 03:56:26 +01:00
|
|
|
|
2002-08-03 04:02:15 +02:00
|
|
|
global _ExecUserDisableA20
|
2001-03-21 03:56:26 +01:00
|
|
|
|
2002-08-03 04:02:15 +02:00
|
|
|
_ExecUserDisableA20:
|
2001-03-21 03:56:26 +01:00
|
|
|
|
2002-08-03 04:02:15 +02:00
|
|
|
cmp word [cs:_XMSDriverAddress],0
|
|
|
|
jne NeedToDisable
|
|
|
|
cmp word [cs:_XMSDriverAddress+2],0
|
|
|
|
je noNeedToDisable
|
|
|
|
NeedToDisable:
|
|
|
|
push ax
|
2004-04-09 15:13:06 +02:00
|
|
|
call far _DISABLEA20
|
2002-08-03 04:02:15 +02:00
|
|
|
pop ax
|
|
|
|
noNeedToDisable:
|
|
|
|
iret
|
2001-03-21 03:56:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
;
|
|
|
|
; Default Int 24h handler -- always returns fail
|
|
|
|
; so we have not to relocate it (now)
|
|
|
|
;
|
|
|
|
FAIL equ 03h
|
|
|
|
|
|
|
|
global _int24_handler
|
|
|
|
_int24_handler: mov al,FAIL
|
|
|
|
iret
|
|
|
|
|
2001-04-29 19:34:41 +02:00
|
|
|
;
|
|
|
|
; this makes some things easier
|
|
|
|
;
|
2001-03-21 03:56:26 +01:00
|
|
|
|
2002-12-09 01:17:15 +01:00
|
|
|
segment _LOWTEXT
|
2001-04-29 19:34:41 +02:00
|
|
|
global _TEXT_DGROUP
|
|
|
|
_TEXT_DGROUP dw DGROUP
|
2001-03-21 03:56:26 +01:00
|
|
|
|
2001-04-29 19:34:41 +02:00
|
|
|
segment INIT_TEXT
|
|
|
|
global _INIT_DGROUP
|
|
|
|
_INIT_DGROUP dw DGROUP
|