See history.txt for the list of fixes.

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@196 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2001-04-15 03:21:50 +00:00
parent 832ad2111b
commit be2ae12b54
56 changed files with 1423 additions and 1597 deletions

View File

@ -8,7 +8,9 @@
# These are generic definitions # These are generic definitions
RM=..\utils\rm -f RM=..\utils\rm -f
NASM=nasm
# Give path to nasm here (or if it's in your path just uncomment the line).
#NASM=nasm
# Use these for Turbo C 2.01 # Use these for Turbo C 2.01
@ -54,6 +56,9 @@ NASM=nasm
# $Id$ # $Id$
# #
# $Log$ # $Log$
# Revision 1.6 2001/04/15 03:21:49 bartoldeman
# See history.txt for the list of fixes.
#
# Revision 1.5 2001/03/22 10:51:04 bartoldeman # Revision 1.5 2001/03/22 10:51:04 bartoldeman
# Suggest to extract F_SCOPY into libm.lib for Borland C++. # Suggest to extract F_SCOPY into libm.lib for Borland C++.
# #

View File

@ -1,3 +1,46 @@
2001 Apr 15 - Build 2023
-------- Bart Oldeman (bart.oldeman@bristol.ac.uk)
+ Fixes Tom:
* apisupt.asm not necessary anymore.
* fix warnings.
* Don't allow directories to be created in DOS_CREAT.
* LoadDevice: drivers should not hang the computer if they fail.
Bart:
* fixed SYS.
* made most calls near again, with a jump/stack trick to
switch between INIT_TEXT and HMA_TEXT.
* INIT_TEXT now calls INT21 itself for some things (setting
PSP, opening/reading/closing devices and (fd)config.sys).
* fixed some carry handling in inthndlr.c and
* drives are checked before trying to access them.
* fixed console driver "busy state" confusion: the built-in
driver had it wrong, nansi.sys had it right:
"If no characters in buffer, return BUSY".
* space savings (RTL related and various other places)
* redirector fixes for find_next.
* CREAT on a device file failed (FD said it already existed).
But for some reason it should not fail in DOS.
* get ATTRIB/other things on a device file should return
FILENOTFOUND, not PATHNOTFOUND.
The sft_status field is not used for redirected drives.
* DosSelectDrv checks the media before setting the default
drive.
* Fixed INT21/AH=3,4,5 (character R/W AUX/PRN).
Hans Lermen:
* critical error handler destroyed AH (entry.asm).
Martin Stromberg
* find_first for volume labels fix.
* check drive at more places and avoid drive "@:" for drive "':".
* config.m: comment out NASM= by default.
* printf fix with DEBUG on.
+ Add Tom: Introduce init_data segment.
New temp file creation implementation.
Bart: added INT21/AH=53. XMSDSK works fine now.
dynamic allocation of Drive Parameter Blocks (they are
all FAR now).
+ Update Bart: moved DOS_PSP to segment 0x60 as segment 0x50 is already used by
GWBASIC/BASICA
2001 Apr 2 - Build 2023 2001 Apr 2 - Build 2023
-------- Bart Oldeman (bart.oldeman@bristol.ac.uk) -------- Bart Oldeman (bart.oldeman@bristol.ac.uk)
+ Fixes Bart: Volkov Commander revealed a few bugs: + Fixes Bart: Volkov Commander revealed a few bugs:

View File

@ -30,6 +30,9 @@
; $Header$ ; $Header$
; ;
; $Log$ ; $Log$
; Revision 1.5 2001/04/15 03:21:50 bartoldeman
; See history.txt for the list of fixes.
;
; Revision 1.4 2001/03/21 02:56:25 bartoldeman ; Revision 1.4 2001/03/21 02:56:25 bartoldeman
; See history.txt for changes. Bug fixes and HMA support are the main ones. ; See history.txt for changes. Bug fixes and HMA support are the main ones.
; ;
@ -72,7 +75,6 @@
%include "..\kernel\segs.inc" %include "..\kernel\segs.inc"
segment _DATA align=2 class=DATA
extern __bssend:wrt DGROUP extern __bssend:wrt DGROUP
segment HMA_TEXT segment HMA_TEXT
@ -80,9 +82,6 @@ segment HMA_TEXT
global _device_end global _device_end
_device_end: _device_end:
push bp
mov bp,sp
mov ax,__bssend mov ax,__bssend
mov dx,DGROUP mov dx,DGROUP
pop bp
ret ret

View File

@ -30,6 +30,9 @@
; $Id$ ; $Id$
; ;
; $Log$ ; $Log$
; Revision 1.5 2001/04/15 03:21:50 bartoldeman
; See history.txt for the list of fixes.
;
; Revision 1.4 2001/03/21 02:56:25 bartoldeman ; Revision 1.4 2001/03/21 02:56:25 bartoldeman
; See history.txt for changes. Bug fixes and HMA support are the main ones. ; See history.txt for changes. Bug fixes and HMA support are the main ones.
; ;
@ -80,8 +83,13 @@
;Initial revision. ;Initial revision.
; ;
%ifndef SYS
%include "..\kernel\segs.inc" %include "..\kernel\segs.inc"
%else
group TGROUP HMA_TEXT _TEXT
segment _TEXT class=CODE
segment HMA_TEXT class=CODE
%endif
segment HMA_TEXT segment HMA_TEXT
; ;

View File

@ -30,6 +30,9 @@
; $Header$ ; $Header$
; ;
; $Log$ ; $Log$
; Revision 1.5 2001/04/15 03:21:50 bartoldeman
; See history.txt for the list of fixes.
;
; Revision 1.4 2001/03/21 02:56:25 bartoldeman ; Revision 1.4 2001/03/21 02:56:25 bartoldeman
; See history.txt for changes. Bug fixes and HMA support are the main ones. ; See history.txt for changes. Bug fixes and HMA support are the main ones.
; ;
@ -75,12 +78,8 @@ segment HMA_TEXT
global _getvec global _getvec
_getvec: _getvec:
push bp mov bx,sp
mov bp,sp mov ax,[ss:bx+2]
mov ax,[bp+4]
call getvec
pop bp
ret
; ;
; assembler version - ax = vector number ; assembler version - ax = vector number

View File

@ -60,9 +60,9 @@
;Initial revision. ;Initial revision.
; ;
group IGROUP INIT_TEXT %include "..\kernel\segs.inc"
segment INIT_TEXT class=INIT segment INIT_TEXT
; ;
;COUNT ReadATClock(bcdDays, bcdHours, bcdMinutes, bcdSeconds) ;COUNT ReadATClock(bcdDays, bcdHours, bcdMinutes, bcdSeconds)
@ -73,49 +73,29 @@ segment INIT_TEXT class=INIT
; ;
global _ReadATClock global _ReadATClock
_ReadATClock: _ReadATClock:
mov ah,2
int 1ah
jnc @RdAT1140
sbb ax,ax
ret
@RdAT1140:
push bp push bp
mov bp,sp mov bp,sp
sub sp,byte 10
; Days = -6
; Hours = -2
; Minutes = -8
; Seconds = -10
; bcdSeconds = 10 ; bcdSeconds = 10
; bcdMinutes = 8 ; bcdMinutes = 8
; bcdHours = 6 ; bcdHours = 6
; bcdDays = 4 ; bcdDays = 4
mov ah,2
int 26
jnc @RdAT1140
sbb ax,ax
mov sp,bp
pop bp
ret
nop
@RdAT1140:
mov byte [bp-2],ch ;Hours
mov byte [bp-8],cl ;Minutes
mov byte [bp-10],dh ;Seconds
mov ah,4
int 26
mov word [bp-6],dx ;Days
mov word [bp-4],cx
mov ax,word [bp-6] ;Days
mov dx,word [bp-4]
mov bx,word [bp+4] ;bcdDays
mov word [bx],ax
mov word [bx+2],dx
mov al,byte [bp-2] ;Hours
mov bx,word [bp+6] ;bcdHours mov bx,word [bp+6] ;bcdHours
mov byte [bx],al mov byte [bx],ch ;Hours
mov al,byte [bp-8] ;Minutes
mov bx,word [bp+8] ;bcdMinutes mov bx,word [bp+8] ;bcdMinutes
mov byte [bx],al mov byte [bx],cl ;Minutes
mov al,byte [bp-10] ;Seconds
mov bx,word [bp+10] ;bcdSeconds mov bx,word [bp+10] ;bcdSeconds
mov byte [bx],al mov byte [bx],dh ;Seconds
mov ah,4
int 1ah
mov bx,word [bp+4] ;bcdDays
mov word [bx],dx ;Days
mov word [bx+2],cx
sub ax,ax sub ax,ax
mov sp,bp
pop bp pop bp
ret ret
nop

View File

@ -30,6 +30,9 @@
; $Header$ ; $Header$
; ;
; $Log$ ; $Log$
; Revision 1.5 2001/04/15 03:21:50 bartoldeman
; See history.txt for the list of fixes.
;
; Revision 1.4 2001/03/21 02:56:25 bartoldeman ; Revision 1.4 2001/03/21 02:56:25 bartoldeman
; See history.txt for changes. Bug fixes and HMA support are the main ones. ; See history.txt for changes. Bug fixes and HMA support are the main ones.
; ;
@ -84,7 +87,7 @@ segment HMA_TEXT
global _ReadPCClock global _ReadPCClock
_ReadPCClock: _ReadPCClock:
xor ah,ah xor ah,ah
int 26 int 1ah
mov bx,sp mov bx,sp
mov bx,[bx+2] mov bx,[bx+2]
mov [bx],dx mov [bx],dx

View File

@ -30,6 +30,9 @@
; $Header$ ; $Header$
; ;
; $Log$ ; $Log$
; Revision 1.5 2001/04/15 03:21:50 bartoldeman
; See history.txt for the list of fixes.
;
; Revision 1.4 2001/03/21 02:56:25 bartoldeman ; Revision 1.4 2001/03/21 02:56:25 bartoldeman
; See history.txt for changes. Bug fixes and HMA support are the main ones. ; See history.txt for changes. Bug fixes and HMA support are the main ones.
; ;
@ -78,14 +81,11 @@ segment HMA_TEXT
; ;
global _tmark global _tmark
_tmark: _tmark:
push bp
mov bp,sp
xor ah,ah xor ah,ah
int 01aH ; get current time in ticks int 01aH ; get current time in ticks
xor ah,ah xor ah,ah
mov word [LastTime],dx ; and store it mov word [LastTime],dx ; and store it
mov word [LastTime+2],cx mov word [LastTime+2],cx
pop bp
ret ret
@ -96,12 +96,11 @@ _tmark:
_tdelay: _tdelay:
push bp push bp
mov bp,sp mov bp,sp
sub sp,byte 4
xor ah,ah xor ah,ah
int 01aH ; get current time in ticks int 01aH ; get current time in ticks
xor ah,ah xor ah,ah
mov word [bp-4],dx ; and save it to a local variable mov word bx,dx ; and save it to a local variable
mov word [bp-2],cx ; "Ticks" ; "Ticks" (cx:bx)
; ;
; Do a c equivalent of: ; Do a c equivalent of:
; ;
@ -111,19 +110,16 @@ _tdelay:
mov dx,word [LastTime] mov dx,word [LastTime]
add dx,word [bp+4] add dx,word [bp+4]
adc ax,word [bp+6] adc ax,word [bp+6]
cmp ax,word [bp-2] cmp ax,cx
mov ax,0 ; mov does not affect flags
ja short tdel_1 ja short tdel_1
jne short tdel_2 jne short tdel_2
cmp dx,word [bp-4] cmp dx,bx
ja short tdel_1 ja short tdel_1
tdel_2: tdel_2:
mov ax,1 ; True return inc ax ; True return
jmp short tdel_3
tdel_1: tdel_1:
xor ax,ax ; False return pop bp ; False return
tdel_3:
mov sp,bp
pop bp
ret ret
@ -134,7 +130,6 @@ tdel_3:
_twait: _twait:
push bp push bp
mov bp,sp mov bp,sp
sub sp,byte 4
call _tmark ; mark a start call _tmark ; mark a start
; ;
; c equivalent ; c equivalent
@ -145,8 +140,7 @@ twait_1:
xor ah,ah xor ah,ah
int 01aH int 01aH
xor ah,ah ; do GetNowTime xor ah,ah ; do GetNowTime
mov word [bp-4],dx ; and save it to "Now" mov bx,dx ; and save it to "Now" (cx:bx)
mov word [bp-2],cx
; ;
; do comparison ; do comparison
; ;
@ -154,15 +148,14 @@ twait_1:
mov dx,word [LastTime] mov dx,word [LastTime]
add dx,word [bp+4] add dx,word [bp+4]
adc ax,word [bp+6] adc ax,word [bp+6]
cmp ax,word [bp-2] cmp ax,cx
jb short twait_1 jb short twait_1
jne short twait_2 jne short twait_2
cmp dx,word [bp-4] cmp dx,bx
jb short twait_1 jb short twait_1
twait_2: twait_2:
mov sp,bp
pop bp pop bp
ret ret
segment _BSS align=2 class=BSS segment _BSS
LastTime: resd 1 LastTime: resd 1

View File

@ -30,6 +30,9 @@
; $Header$ ; $Header$
; ;
; $Log$ ; $Log$
; Revision 1.5 2001/04/15 03:21:50 bartoldeman
; See history.txt for the list of fixes.
;
; Revision 1.4 2001/03/21 02:56:25 bartoldeman ; Revision 1.4 2001/03/21 02:56:25 bartoldeman
; See history.txt for changes. Bug fixes and HMA support are the main ones. ; See history.txt for changes. Bug fixes and HMA support are the main ones.
; ;
@ -84,28 +87,20 @@ segment HMA_TEXT
_WriteATClock: _WriteATClock:
push bp push bp
mov bp,sp mov bp,sp
sub sp,byte 4
; LocalCopy = -4
; bcdSeconds = 10 ; bcdSeconds = 10
; bcdMinutes = 8 ; bcdMinutes = 8
; bcdHours = 6 ; bcdHours = 6
; bcdDays = 4 ; bcdDays = 4
mov bx,word [bp+4] ;bcdDays
mov ax,word [bx]
mov dx,word [bx+2]
mov word [bp-4],ax ;LocalCopy
mov word [bp-2],dx
mov ch,byte [bp+6] ;bcdHours mov ch,byte [bp+6] ;bcdHours
mov cl,byte [bp+8] ;bcdMinutes mov cl,byte [bp+8] ;bcdMinutes
mov dh,byte [bp+10] ;bcdSeconds mov dh,byte [bp+10] ;bcdSeconds
mov dl,0 mov dl,0
mov ah,3 mov ah,3
int 26 int 1ah
mov cx,word [bp-2] mov bx,word [bp+4] ;bcdDays
mov dx,word [bp-4] ;LocalCopy mov dx,word [bx]
mov cx,word [bx+2]
mov ah,5 mov ah,5
int 26 int 1ah
mov sp,bp
pop bp pop bp
ret ret
nop

View File

@ -30,6 +30,9 @@
; $Header$ ; $Header$
; ;
; $Log$ ; $Log$
; Revision 1.5 2001/04/15 03:21:50 bartoldeman
; See history.txt for the list of fixes.
;
; Revision 1.4 2001/03/21 02:56:25 bartoldeman ; Revision 1.4 2001/03/21 02:56:25 bartoldeman
; See history.txt for changes. Bug fixes and HMA support are the main ones. ; See history.txt for changes. Bug fixes and HMA support are the main ones.
; ;
@ -79,14 +82,10 @@ segment HMA_TEXT
; ;
global _WritePCClock global _WritePCClock
_WritePCClock: _WritePCClock:
push bp mov bx,sp
mov bp,sp
; Ticks = 4 ; Ticks = 4
mov cx,word [bp+6] mov cx,word [ss:bx+4]
mov dx,word [bp+4] ;Ticks mov dx,word [ss:bx+2] ;Ticks
mov ah,1 mov ah,1
int 26 int 1ah
mov sp,bp
pop bp
ret ret
nop

View File

@ -34,6 +34,9 @@ static BYTE *Cds_hRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.4 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.3 2000/05/25 20:56:19 jimtabor * Revision 1.3 2000/05/25 20:56:19 jimtabor
* Fixed project history * Fixed project history
* *
@ -116,4 +119,5 @@ cdstbl;
#define CDSPHYSDRV 0x4000 #define CDSPHYSDRV 0x4000
#define CDSJOINED 0x2000 #define CDSJOINED 0x2000
#define CDSSUBST 0x1000 #define CDSSUBST 0x1000
#define CDSVALID (CDSNETWDRV | CDSPHYSDRV)

View File

@ -36,6 +36,9 @@ static BYTE *clock_hRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.4 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.3 2000/05/25 20:56:19 jimtabor * Revision 1.3 2000/05/25 20:56:19 jimtabor
* Fixed project history * Fixed project history
* *
@ -112,5 +115,6 @@ struct dpb
}; };
#define UNKNCLUSTER 0xffff /* 0xffff = unknown for DOS */ #define UNKNCLUSTER 0x0000 /* see RBIL INT 21/AH=52 entry */
#define UNKNCLSTFREE 0xffff /* 0xffff = unknown for DOS */

View File

@ -35,6 +35,9 @@ static BYTE *device_hRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.5 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.4 2000/05/25 20:56:19 jimtabor * Revision 1.4 2000/05/25 20:56:19 jimtabor
* Fixed project history * Fixed project history
* *
@ -448,12 +451,6 @@ typedef bpb FAR *bpbptr;
typedef BYTE FAR *byteptr; typedef BYTE FAR *byteptr;
typedef struct dhdr FAR *dhdrptr; typedef struct dhdr FAR *dhdrptr;
/*
* externals
*/
extern BYTE FAR *device_end();
/* /*
* end of device.h * end of device.h
*/ */

View File

@ -36,6 +36,9 @@ static BYTE *fat_hRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.6 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.5 2000/08/06 04:18:21 jimtabor * Revision 1.5 2000/08/06 04:18:21 jimtabor
* See history.txt * See history.txt
* *
@ -117,8 +120,8 @@ static BYTE *fat_hRcsId = "$Id$";
/* Test for 16 bit or 12 bit FAT */ /* Test for 16 bit or 12 bit FAT */
#define SIZEOF_CLST16 2 #define SIZEOF_CLST16 2
#define FAT_MAGIC 4086 #define FAT_MAGIC 4086
#define FAT_MAGIC16 65526 #define FAT_MAGIC16 ((unsigned)65526l)
#define FAT_MAGIC32 268435456 #define FAT_MAGIC32 268435456l
#define ISFAT32(dpbp) (((dpbp)->dpb_size)>FAT_MAGIC16 || ((dpbp)->dpb_size)<=FAT_MAGIC32 ) #define ISFAT32(dpbp) (((dpbp)->dpb_size)>FAT_MAGIC16 || ((dpbp)->dpb_size)<=FAT_MAGIC32 )
#define ISFAT16(dpbp) (((dpbp)->dpb_size)>FAT_MAGIC || ((dpbp)->dpb_size)<=FAT_MAGIC16 ) #define ISFAT16(dpbp) (((dpbp)->dpb_size)>FAT_MAGIC || ((dpbp)->dpb_size)<=FAT_MAGIC16 )

View File

@ -36,6 +36,9 @@ static BYTE *fnode_hRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.4 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.3 2000/05/25 20:56:19 jimtabor * Revision 1.3 2000/05/25 20:56:19 jimtabor
* Fixed project history * Fixed project history
* *
@ -108,7 +111,7 @@ struct f_node
ULONG f_diroff; /* offset of the dir entry */ ULONG f_diroff; /* offset of the dir entry */
UWORD f_dirstart; /* the starting cluster of dir */ UWORD f_dirstart; /* the starting cluster of dir */
/* when dir is not root */ /* when dir is not root */
struct dpb *f_dpb; /* the block device for file */ struct dpb FAR *f_dpb; /* the block device for file */
ULONG f_dsize; /* file size (for directories) */ ULONG f_dsize; /* file size (for directories) */
ULONG f_offset; /* byte offset for next op */ ULONG f_offset; /* byte offset for next op */

View File

@ -36,6 +36,9 @@ static BYTE *mcb_hRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.7 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.6 2000/08/06 04:27:07 jimtabor * Revision 1.6 2000/08/06 04:27:07 jimtabor
* See history.txt * See history.txt
* *
@ -104,7 +107,7 @@ static BYTE *mcb_hRcsId = "$Id$";
#define MCB_NORMAL 0x4d #define MCB_NORMAL 0x4d
#define MCB_LAST 0x5a #define MCB_LAST 0x5a
#define DOS_PSP 0x0050 /* 0x0008 What? seg 8 =0:0080 */ #define DOS_PSP 0x0060 /* 0x0008 What? seg 8 =0:0080 */
#define FREE_PSP 0 #define FREE_PSP 0
#define MCB_SIZE(x) ((((LONG)(x))<<4)+sizeof(mcb)) #define MCB_SIZE(x) ((((LONG)(x))<<4)+sizeof(mcb))

View File

@ -57,6 +57,9 @@ static BYTE *pcb_hRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.5 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.4 2000/08/06 04:18:21 jimtabor * Revision 1.4 2000/08/06 04:18:21 jimtabor
* See history.txt * See history.txt
* *
@ -128,7 +131,7 @@ xreg;
Furthermore, the PUSH$ALL macro must push ES first and AX last. Furthermore, the PUSH$ALL macro must push ES first and AX last.
-- 2000/03/22 ska*/ -- 2000/03/22 ska*/
/* maps MS-DOS unique stacking order */ /* maps MS-DOS unique stacking order */
typedef struct typedef struct _iregss
{ {
xreg a, xreg a,
b, b,

View File

@ -36,6 +36,9 @@ static char *portab_hRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.8 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.7 2001/03/21 02:56:25 bartoldeman * Revision 1.7 2001/03/21 02:56:25 bartoldeman
* See history.txt for changes. Bug fixes and HMA support are the main ones. * See history.txt for changes. Bug fixes and HMA support are the main ones.
* *
@ -239,3 +242,10 @@ typedef signed long LONG;
#define FDCALL #define FDCALL
#define CDECL #define CDECL
#endif #endif
#ifdef I86
/* commandline overflow - removing /DPROTO
TE*/
#define PROTO
#endif

View File

@ -34,6 +34,9 @@
; $Id$ ; $Id$
; ;
; $Log$ ; $Log$
; Revision 1.5 2001/04/15 03:21:50 bartoldeman
; See history.txt for the list of fixes.
;
; Revision 1.4 2001/03/21 02:56:25 bartoldeman ; Revision 1.4 2001/03/21 02:56:25 bartoldeman
; See history.txt for changes. Bug fixes and HMA support are the main ones. ; See history.txt for changes. Bug fixes and HMA support are the main ones.
; ;
@ -92,10 +95,9 @@ segment HMA_TEXT
;********************************************************************* ;*********************************************************************
; this implements some of the common string handling functions ; this implements some of the common string handling functions
; ;
; every function has 2 entries ; every function has 1 entry
; ;
; NEAR FUNC() ; NEAR FUNC()
; FAR init_call_FUNC()
; ;
; currently done: ; currently done:
; ;
@ -143,13 +145,13 @@ common_setup:
; are preloaded here ; are preloaded here
; the destination pointer, d = arg1 ; the destination pointer, d = arg1
mov di,[bp+6] mov di,[bp+4]
; Get the source pointer, s = arg2 ; Get the source pointer, s = arg2
mov si,[bp+8] mov si,[bp+6]
; Get the repitition count, n = arg3 ; Get the repitition count, n = arg3
mov cx,[bp+10] mov cx,[bp+8]
jmp bx jmp bx
@ -159,12 +161,7 @@ common_setup:
; VOID memcpy(REG BYTE *s, REG BYTE *d, REG COUNT n); ; VOID memcpy(REG BYTE *s, REG BYTE *d, REG COUNT n);
; ;
global _memcpy global _memcpy
global _init_call_memcpy
_memcpy: _memcpy:
pop ax
push cs
push ax
_init_call_memcpy:
call common_setup call common_setup
@ -186,7 +183,7 @@ common_return:
pop di pop di
pop si pop si
pop bp pop bp
retf ret
@ -196,23 +193,18 @@ common_return:
; ;
global __fmemcpy global __fmemcpy
global _fmemcpy global _fmemcpy
global _init_call_fmemcpy
_fmemcpy: _fmemcpy:
__fmemcpy: __fmemcpy:
pop ax
push cs
push ax
_init_call_fmemcpy:
call common_setup call common_setup
; Get the far source pointer, s ; Get the far source pointer, s
lds si,[bp+10] lds si,[bp+8]
; Get the far destination pointer d ; Get the far destination pointer d
les di,[bp+6] les di,[bp+4]
; Get the repetition count, n ; Get the repetition count, n
mov cx,[bp+14] mov cx,[bp+12]
jmp short domemcpy jmp short domemcpy
@ -222,23 +214,17 @@ _init_call_fmemcpy:
; VOID fmemset(REG VOID FAR *d, REG BYTE ch, REG COUNT n); ; VOID fmemset(REG VOID FAR *d, REG BYTE ch, REG COUNT n);
; ;
global _fmemset global _fmemset
global _init_call_fmemset
_fmemset: _fmemset:
pop ax
push cs
push ax
_init_call_fmemset:
call common_setup call common_setup
; Get the repetition count, n ; Get the repetition count, n
mov cx,[bp+12] mov cx,[bp+10]
; Get the far source pointer, s ; Get the far source pointer, s
les di,[bp+6] les di,[bp+4]
; Get the far destination pointer ch ; Get the far destination pointer ch
mov al,[bp+10] mov al,[bp+8]
domemset: domemset:
mov ah, al mov ah, al
@ -255,23 +241,17 @@ domemset:
; VOID memset(REG VOID *d, REG BYTE ch, REG COUNT n); ; VOID memset(REG VOID *d, REG BYTE ch, REG COUNT n);
; ;
global _memset global _memset
global _init_call_memset
_memset: _memset:
pop ax
push cs
push ax
_init_call_memset:
call common_setup call common_setup
; Get the far source pointer, s ; Get the far source pointer, s
; mov di,[bp+6] ; mov di,[bp+4]
; Get the char ch ; Get the char ch
mov ax,si ; mov al, [bp+8] mov ax,si ; mov al, [bp+6]
; Get the repititon count, n ; Get the repititon count, n
; mov cx,[bp+10] ; mov cx,[bp+8]
jmp short domemset jmp short domemset
@ -281,21 +261,16 @@ _init_call_memset:
;*************************************************************** ;***************************************************************
global _fstrncpy global _fstrncpy
global _init_call_fstrncpy
_fstrncpy: _fstrncpy:
pop ax
push cs
push ax
_init_call_fstrncpy:
call common_setup call common_setup
; Get the source pointer, ss ; Get the source pointer, ss
lds si,[bp+10] lds si,[bp+8]
; and the destination pointer, d ; and the destination pointer, d
les di,[bp+6] les di,[bp+4]
mov cx,[bp+14] mov cx,[bp+12]
jcxz common_return jcxz common_return
;; dec cx ;; dec cx
@ -318,38 +293,28 @@ store_one_byte: xor al,al
global _fstrcpy global _fstrcpy
global _init_call_fstrcpy
_fstrcpy: _fstrcpy:
pop ax
push cs
push ax
_init_call_fstrcpy:
call common_setup call common_setup
; Get the source pointer, ss ; Get the source pointer, ss
lds si,[bp+10] lds si,[bp+8]
; and the destination pointer, d ; and the destination pointer, d
les di,[bp+6] les di,[bp+4]
jmp short dostrcpy jmp short dostrcpy
;****** ;******
global _strcpy global _strcpy
global _init_call_strcpy
_strcpy: _strcpy:
pop ax
push cs
push ax
_init_call_strcpy:
call common_setup call common_setup
; Get the source pointer, ss ; Get the source pointer, ss
;mov si,[bp+8] ;mov si,[bp+6]
; and the destination pointer, d ; and the destination pointer, d
;mov di,[bp+6] ;mov di,[bp+4]
dostrcpy: dostrcpy:
@ -364,27 +329,17 @@ strcpy_loop:
;****************************************************************** ;******************************************************************
global _fstrlen global _fstrlen
global _init_call_fstrlen
_fstrlen: _fstrlen:
pop ax
push cs
push ax
_init_call_fstrlen:
call common_setup call common_setup
; Get the source pointer, ss ; Get the source pointer, ss
les di,[bp+6] les di,[bp+4]
jmp short dostrlen jmp short dostrlen
;********************************************** ;**********************************************
global _strlen global _strlen
global _init_call_strlen
_strlen: _strlen:
pop ax
push cs
push ax
_init_call_strlen:
call common_setup call common_setup
; The source pointer, ss, arg1 was loaded as di ; The source pointer, ss, arg1 was loaded as di
@ -398,21 +353,16 @@ dostrlen:
not ax not ax
dec ax dec ax
jmp common_return jmp short common_return
;************************************************************ ;************************************************************
global _strchr global _strchr
global _init_call_strchr
_strchr: _strchr:
pop ax
push cs
push ax
_init_call_strchr:
call common_setup call common_setup
; Get the source pointer, ss ; Get the source pointer, ss
; mov si,[bp+6] ; mov si,[bp+4]
; mov bx,[bp+8] ; mov bx,[bp+6]
mov bx,si mov bx,si
mov si,di mov si,di
@ -432,38 +382,28 @@ strchr_found:
;********************************************************************** ;**********************************************************************
global _fstrcmp global _fstrcmp
global _init_call_fstrcmp
_fstrcmp: _fstrcmp:
pop ax
push cs
push ax
_init_call_fstrcmp:
call common_setup call common_setup
; Get the source pointer, ss ; Get the source pointer, ss
lds si,[bp+6] lds si,[bp+4]
; and the destination pointer, d ; and the destination pointer, d
les di,[bp+10] les di,[bp+8]
jmp dostrcmp jmp dostrcmp
;****** ;******
global _strcmp global _strcmp
global _init_call_strcmp
_strcmp: _strcmp:
pop ax
push cs
push ax
_init_call_strcmp:
call common_setup call common_setup
; Get the source pointer, ss ; Get the source pointer, ss
; mov si,[bp+6] ; mov si,[bp+4]
; and the destination pointer, d ; and the destination pointer, d
; mov di,[bp+8] ; mov di,[bp+6]
xchg si,di xchg si,di
dostrcmp: dostrcmp:
@ -475,39 +415,29 @@ dostrcmp:
;********************************************************************** ;**********************************************************************
global _fstrncmp global _fstrncmp
global _init_call_fstrncmp
_fstrncmp: _fstrncmp:
pop ax
push cs
push ax
_init_call_fstrncmp:
call common_setup call common_setup
; Get the source pointer, ss ; Get the source pointer, ss
lds si,[bp+6] lds si,[bp+4]
; and the destination pointer, d ; and the destination pointer, d
les di,[bp+10] les di,[bp+8]
mov cx,[bp+12] mov cx,[bp+10]
jmp short dostrncmp jmp short dostrncmp
;****** ;******
global _strncmp global _strncmp
global _init_call_strncmp
_strncmp: _strncmp:
pop ax
push cs
push ax
_init_call_strncmp:
call common_setup call common_setup
; Get the source pointer, ss ; Get the source pointer, ss
;mov si,[bp+6] ;mov si,[bp+4]
; and the destination pointer, d ; and the destination pointer, d
;mov di,[bp+8] ;mov di,[bp+6]
;mov cx,[bp+10] ;mov cx,[bp+8]
xchg si,di xchg si,di
dostrncmp: dostrncmp:

View File

@ -37,6 +37,9 @@ static BYTE *blockioRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.8 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.7 2001/03/21 02:56:25 bartoldeman * Revision 1.7 2001/03/21 02:56:25 bartoldeman
* See history.txt for changes. Bug fixes and HMA support are the main ones. * See history.txt for changes. Bug fixes and HMA support are the main ones.
* *
@ -530,7 +533,7 @@ UWORD dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks, COUNT mod
{ {
/* REG struct dpb *dpbp = &blk_devices[dsk]; */ /* REG struct dpb *dpbp = &blk_devices[dsk]; */
REG struct dpb *dpbp = (struct dpb *)CDSp->cds_table[dsk].cdsDpb; REG struct dpb FAR *dpbp = CDSp->cds_table[dsk].cdsDpb;
for (;;) for (;;)
{ {

View File

@ -30,7 +30,7 @@
#include "portab.h" #include "portab.h"
#include "globals.h" #include "globals.h"
extern void FAR init_call_spawn_int23(void); extern void spawn_int23(void);
#ifdef VERSION_STRINGS #ifdef VERSION_STRINGS
static BYTE *RcsId = "$Id$"; static BYTE *RcsId = "$Id$";
@ -38,6 +38,9 @@ static BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.5 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.4 2001/03/21 02:56:25 bartoldeman * Revision 1.4 2001/03/21 02:56:25 bartoldeman
* See history.txt for changes. Bug fixes and HMA support are the main ones. * See history.txt for changes. Bug fixes and HMA support are the main ones.
* *
@ -90,25 +93,5 @@ void handle_break(void)
if (InDOS) if (InDOS)
--InDOS; /* fail-safe */ --InDOS; /* fail-safe */
{ spawn_int23(); /* invoke user INT-23 and never come back */
/*TE PATCH
CtrlC at DosInput (like C:>DATE does)
Nukes the Kernel.
it looks like ENTRY.ASM+PROCSUPT.ASM
got out of sync.
spawn_int() assumes a stack layout at
usr_ss:usr:sp. but usr:ss currently contains 0
this patch helps FreeDos to survive CtrlC,
but should clearly be done somehow else.
*/
extern ULONG lpUserStack;
usr_ss = FP_SEG(lpUserStack);
usr_sp = FP_OFF(lpUserStack);
}
init_call_spawn_int23(); /* invoke user INT-23 and never come back */
} }

View File

@ -36,6 +36,9 @@ static BYTE *charioRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.5 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.4 2000/05/26 19:25:19 jimtabor * Revision 1.4 2000/05/26 19:25:19 jimtabor
* Read History file for Change info * Read History file for Change info
* *
@ -117,8 +120,6 @@ static BYTE *charioRcsId = "$Id$";
#include "globals.h" #include "globals.h"
static BYTE *con_name = "CON";
#ifdef PROTO #ifdef PROTO
VOID kbfill(keyboard FAR *, UCOUNT, BOOL, UWORD *); VOID kbfill(keyboard FAR *, UCOUNT, BOOL, UWORD *);
struct dhdr FAR *finddev(UWORD attr_mask); struct dhdr FAR *finddev(UWORD attr_mask);
@ -192,7 +193,7 @@ VOID Do_DosIdle_loop(void)
{ {
FOREVER FOREVER
{ {
if (StdinBusy()) if (!StdinBusy())
return; return;
else else
{ {
@ -407,8 +408,3 @@ VOID sti(keyboard FAR * kp)
} }
} }
} }
VOID FAR init_call_sti(keyboard FAR * kp)
{
sti(kp);
}

View File

@ -27,7 +27,7 @@
/* Cambridge, MA 02139, USA. */ /* Cambridge, MA 02139, USA. */
/****************************************************************/ /****************************************************************/
#define CONFIG
#include "init-mod.h" #include "init-mod.h"
#include "portab.h" #include "portab.h"
@ -40,6 +40,9 @@ static BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.17 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.16 2001/04/02 23:18:30 bartoldeman * Revision 1.16 2001/04/02 23:18:30 bartoldeman
* Misc, zero terminated device names and redirector bugs fixed. * Misc, zero terminated device names and redirector bugs fixed.
* *
@ -178,15 +181,14 @@ static BYTE *RcsId = "$Id$";
#define KernelAlloc(x) adjust_far((void far *)malloc((unsigned long)(x))) #define KernelAlloc(x) adjust_far((void far *)malloc((unsigned long)(x)))
#endif #endif
BYTE FAR *lpBase; BYTE FAR *lpBase = 0;
BYTE FAR *upBase; BYTE FAR *upBase = 0;
static BYTE FAR *lpOldLast; static BYTE FAR *lpOldLast = 0;
static BYTE FAR *upOldLast; static COUNT nCfgLine = 0;
static COUNT nCfgLine; static COUNT nPass = 0;
static COUNT nPass; COUNT UmbState = 0;
COUNT UmbState; static BYTE szLine[256]={0};
static BYTE szLine[256]; static BYTE szBuf[256]={0};
static BYTE szBuf[256];
int singleStep = 0; int singleStep = 0;
@ -220,8 +222,6 @@ INIT int SkipLine(char *pLine);
INIT char *stristr(char *s1, char *s2); INIT char *stristr(char *s1, char *s2);
INIT COUNT strcasecmp(REG BYTE *d, REG BYTE *s); INIT COUNT strcasecmp(REG BYTE *d, REG BYTE *s);
INIT BYTE FAR *KernelAlloc(WORD nBytes);
extern void HMAconfig(int finalize); extern void HMAconfig(int finalize);
VOID config_init_buffers(COUNT anzBuffers); /* from BLOCKIO.C */ VOID config_init_buffers(COUNT anzBuffers); /* from BLOCKIO.C */
@ -337,9 +337,9 @@ INIT void PreConfig(void)
f_nodes_cnt = Config.cfgFiles; f_nodes_cnt = Config.cfgFiles;
/* sfthead = (sfttbl FAR *)&basesft; */ /* sfthead = (sfttbl FAR *)&basesft; */
/* FCBp = (sfttbl FAR *)&FcbSft; */ /* FCBp = (sfttbl FAR *)&FcbSft; */
FCBp = (sfttbl FAR *) /* FCBp = (sfttbl FAR *)
KernelAlloc(sizeof(sftheader) KernelAlloc(sizeof(sftheader)
+ Config.cfgFiles * sizeof(sft)); + Config.cfgFiles * sizeof(sft));*/
sfthead = (sfttbl FAR *) sfthead = (sfttbl FAR *)
KernelAlloc(sizeof(sftheader) KernelAlloc(sizeof(sftheader)
+ Config.cfgFiles * sizeof(sft)); + Config.cfgFiles * sizeof(sft));
@ -347,11 +347,15 @@ INIT void PreConfig(void)
CDSp = (cdstbl FAR *) CDSp = (cdstbl FAR *)
KernelAlloc(0x58 * lastdrive); KernelAlloc(0x58 * lastdrive);
DPBp = (struct dpb FAR *)
KernelAlloc(blk_dev.dh_name[0]*sizeof(struct dpb));
#ifdef DEBUG #ifdef DEBUG
printf("Preliminary f_node allocated at at 0x%p\n",f_nodes); printf("Preliminary f_node allocated at at 0x%p\n",f_nodes);
printf("Preliminary FCB table allocated at 0x%p\n",FCBp); printf("Preliminary FCB table allocated at 0x%p\n",FCBp);
printf("Preliminary sft table allocated at 0x%p\n",sfthead); printf("Preliminary sft table allocated at 0x%p\n",sfthead);
printf("Preliminary CDS table allocated at 0x%p\n",CDSp); printf("Preliminary CDS table allocated at 0x%p\n",CDSp);
printf("Preliminary DPB table allocated at 0x%p\n",DPBp);
#endif #endif
/* Done. Now initialize the MCB structure */ /* Done. Now initialize the MCB structure */
@ -369,7 +373,7 @@ INIT void PreConfig(void)
/* We expect ram_top as Kbytes, so convert to paragraphs */ /* We expect ram_top as Kbytes, so convert to paragraphs */
mcb_init((mcb FAR *) (MK_FP(first_mcb, 0)), mcb_init((mcb FAR *) (MK_FP(first_mcb, 0)),
(ram_top << 6) - first_mcb - 1); ((UCOUNT)ram_top << 6) - first_mcb - 1);
nPass = 1; nPass = 1;
} }
@ -416,9 +420,9 @@ INIT void PostConfig(void)
f_nodes_cnt = Config.cfgFiles; /* and the number of allocated files */ f_nodes_cnt = Config.cfgFiles; /* and the number of allocated files */
/* sfthead = (sfttbl FAR *)&basesft; */ /* sfthead = (sfttbl FAR *)&basesft; */
/* FCBp = (sfttbl FAR *)&FcbSft; */ /* FCBp = (sfttbl FAR *)&FcbSft; */
FCBp = (sfttbl FAR *) /* FCBp = (sfttbl FAR *)
KernelAlloc(sizeof(sftheader) KernelAlloc(sizeof(sftheader)
+ Config.cfgFiles * sizeof(sft)); + Config.cfgFiles * sizeof(sft));*/
sfthead = (sfttbl FAR *) sfthead = (sfttbl FAR *)
KernelAlloc(sizeof(sftheader) KernelAlloc(sizeof(sftheader)
+ Config.cfgFiles * sizeof(sft)); + Config.cfgFiles * sizeof(sft));
@ -426,12 +430,17 @@ INIT void PostConfig(void)
CDSp = (cdstbl FAR *) CDSp = (cdstbl FAR *)
KernelAlloc(0x58 * lastdrive); KernelAlloc(0x58 * lastdrive);
DPBp = (struct dpb FAR *)
KernelAlloc(blk_dev.dh_name[0]*sizeof(struct dpb));
#ifdef DEBUG #ifdef DEBUG
printf("f_node allocated at 0x%p\n",f_nodes); printf("f_node allocated at 0x%p\n",f_nodes);
printf("FCB table allocated at 0x%p\n",FCBp); printf("FCB table allocated at 0x%p\n",FCBp);
printf("sft table allocated at 0x%p\n",sfthead); printf("sft table allocated at 0x%p\n",sfthead);
printf("CDS table allocated at 0x%p\n",CDSp); printf("CDS table allocated at 0x%p\n",CDSp);
printf("DPB table allocated at 0x%p\n",DPBp);
#endif #endif
if (Config.cfgStacks) if (Config.cfgStacks)
{ {
@ -452,8 +461,6 @@ INIT void PostConfig(void)
/* This code must be executed after device drivers has been loaded */ /* This code must be executed after device drivers has been loaded */
INIT VOID configDone(VOID) INIT VOID configDone(VOID)
{ {
COUNT i;
HMAconfig(TRUE); /* final HMA processing */ HMAconfig(TRUE); /* final HMA processing */
@ -470,7 +477,7 @@ INIT VOID configDone(VOID)
/* We expect ram_top as Kbytes, so convert to paragraphs */ /* We expect ram_top as Kbytes, so convert to paragraphs */
mcb_init((mcb FAR *) (MK_FP(first_mcb, 0)), mcb_init((mcb FAR *) (MK_FP(first_mcb, 0)),
(ram_top << 6) - first_mcb - 1); ((UCOUNT)ram_top << 6) - first_mcb - 1);
if(UmbState == 1) if(UmbState == 1)
{ {
@ -480,10 +487,12 @@ INIT VOID configDone(VOID)
/* Check if any devices were loaded in umb */ /* Check if any devices were loaded in umb */
if(umb_start != FP_SEG(upBase) ){ if(umb_start != FP_SEG(upBase) ){
/* make last block normal with SC for the devices */ /* make last block normal with SC for the devices */
mumcb_init((mcb FAR *) (MK_FP(uppermem_root, 0)),
(FP_SEG(upBase) + ((FP_OFF(upBase) + 0x0f) >> 4)) - uppermem_root - 1);
uppermem_root = FP_SEG(upBase) + ((FP_OFF(upBase) + 0x0f) >> 4); UCOUNT umr_new = FP_SEG(upBase) + ((FP_OFF(upBase) + 0x0f) >> 4);
mumcb_init((mcb FAR *) (MK_FP(uppermem_root, 0)), umr_new - uppermem_root - 1);
uppermem_root = umr_new;
zumcb_init((mcb FAR *) (MK_FP(uppermem_root, 0)), zumcb_init((mcb FAR *) (MK_FP(uppermem_root, 0)),
(umb_start + UMB_top ) - uppermem_root - 1); (umb_start + UMB_top ) - uppermem_root - 1);
upBase += 16; upBase += 16;
@ -511,12 +520,12 @@ INIT VOID DoConfig(VOID)
/* Check to see if we have a config.sys file. If not, just */ /* Check to see if we have a config.sys file. If not, just */
/* exit since we don't force the user to have one. */ /* exit since we don't force the user to have one. */
if ((nFileDesc = dos_open((BYTE FAR *) "fdconfig.sys", 0)) < 0) if ((nFileDesc = init_DosOpen("fdconfig.sys", 0)) < 0)
{ {
#ifdef DEBUG #ifdef DEBUG
printf("FDCONFIG.SYS not found\n"); printf("FDCONFIG.SYS not found\n");
#endif #endif
if ((nFileDesc = dos_open((BYTE FAR *) "config.sys", 0)) < 0) if ((nFileDesc = init_DosOpen("config.sys", 0)) < 0)
{ {
#ifdef DEBUG #ifdef DEBUG
printf("CONFIG.SYS not found\n"); printf("CONFIG.SYS not found\n");
@ -557,7 +566,7 @@ INIT VOID DoConfig(VOID)
/* Read a line from config */ /* Read a line from config */
/* Interrupt processing if read error or no bytes read */ /* Interrupt processing if read error or no bytes read */
if ((nRetCode = dos_read(nFileDesc, pLine, LINESIZE - bytesLeft)) <= 0) if ((nRetCode = init_DosRead(nFileDesc, pLine, LINESIZE - bytesLeft)) <= 0)
break; break;
/* If the buffer was not filled completely, append a /* If the buffer was not filled completely, append a
@ -571,6 +580,7 @@ INIT VOID DoConfig(VOID)
while (!bEof && *pLine != EOF) while (!bEof && *pLine != EOF)
{ {
/* /*
Do it here in the loop. Do it here in the loop.
*/ */
@ -581,11 +591,10 @@ INIT VOID DoConfig(VOID)
if(!Umb_Test()){ if(!Umb_Test()){
UmbState = 1; UmbState = 1;
upBase = MK_FP(umb_start , 0); upBase = MK_FP(umb_start , 0);
uppermem_root = umb_start;
/* reset root */ /* reset root */
uppermem_root = FP_SEG(upBase) + ((FP_OFF(upBase) + 0x0f) >> 4); uppermem_root = umb_start;
/* setup the real mcb for the devicehigh block */ /* setup the real mcb for the devicehigh block */
zumcb_init((mcb FAR *) (MK_FP(uppermem_root, 0)), UMB_top - 1); zumcb_init((mcb FAR *) upBase, UMB_top - 1);
upBase += 16; upBase += 16;
} }
} }
@ -632,7 +641,7 @@ INIT VOID DoConfig(VOID)
pLine += strlen(pLine) + 1; pLine += strlen(pLine) + 1;
} }
} }
dos_close(nFileDesc); init_DosClose(nFileDesc);
} }
INIT struct table *LookUp(struct table *p, BYTE * token) INIT struct table *LookUp(struct table *p, BYTE * token)
@ -763,7 +772,6 @@ INIT static VOID Files(BYTE * pLine)
INIT static VOID Lastdrive(BYTE * pLine) INIT static VOID Lastdrive(BYTE * pLine)
{ {
/* Format: LASTDRIVE = letter */ /* Format: LASTDRIVE = letter */
COUNT nFiles;
BYTE drv; BYTE drv;
pLine = skipwh(pLine); pLine = skipwh(pLine);
@ -789,6 +797,7 @@ INIT static VOID Dosmem(BYTE * pLine)
BYTE *pTmp; BYTE *pTmp;
BYTE UMBwanted = FALSE, HMAwanted = FALSE; BYTE UMBwanted = FALSE, HMAwanted = FALSE;
extern BYTE INITDataSegmentClaimed;
pLine = GetStringArg(pLine, szBuf); pLine = GetStringArg(pLine, szBuf);
@ -801,7 +810,7 @@ INIT static VOID Dosmem(BYTE * pLine)
{ {
if (fmemcmp(pTmp, "UMB" ,3) == 0) { UMBwanted = TRUE; pTmp += 3; } if (fmemcmp(pTmp, "UMB" ,3) == 0) { UMBwanted = TRUE; pTmp += 3; }
if (fmemcmp(pTmp, "HIGH",4) == 0) { HMAwanted = TRUE; pTmp += 4; } if (fmemcmp(pTmp, "HIGH",4) == 0) { HMAwanted = TRUE; pTmp += 4; }
if (fmemcmp(pTmp, "CLAIMINIT",9) == 0) { INITDataSegmentClaimed = 0; pTmp += 9; }
pTmp = skipwh(pTmp); pTmp = skipwh(pTmp);
if (*pTmp != ',') if (*pTmp != ',')
@ -966,16 +975,16 @@ INIT static VOID Break(BYTE * pLine)
INIT static VOID Numlock(BYTE * pLine) INIT static VOID Numlock(BYTE * pLine)
{ {
extern VOID keycheck();
/* Format: NUMLOCK = (ON | OFF) */ /* Format: NUMLOCK = (ON | OFF) */
iregs regs;
BYTE FAR *keyflags = (BYTE FAR *)MK_FP(0x40,0x17); BYTE FAR *keyflags = (BYTE FAR *)MK_FP(0x40,0x17);
GetStringArg(pLine, szBuf); GetStringArg(pLine, szBuf);
*keyflags &= ~32; *keyflags &= ~32;
*keyflags |= strcasecmp(szBuf, "OFF") ? 32 : 0; *keyflags |= strcasecmp(szBuf, "OFF") ? 32 : 0;
regs.a.b.h = 1; keycheck();
init_call_intr(0x16, &regs);
} }
INIT static VOID DeviceHigh(BYTE * pLine) INIT static VOID DeviceHigh(BYTE * pLine)
@ -1002,40 +1011,31 @@ INIT void Device(BYTE * pLine)
INIT BOOL LoadDevice(BYTE * pLine, COUNT top, COUNT mode) INIT BOOL LoadDevice(BYTE * pLine, COUNT top, COUNT mode)
{ {
VOID FAR *driver_ptr;
BYTE *pTmp; BYTE *pTmp;
exec_blk eb; exec_blk eb;
struct dhdr FAR *dhp; struct dhdr FAR *dhp;
struct dhdr FAR *next_dhp; struct dhdr FAR *next_dhp;
UWORD dev_seg;
BOOL result; BOOL result;
if(mode) if(mode)
dev_seg = (((ULONG) FP_SEG(upBase) << 4) + FP_OFF(upBase) + 0xf) >> 4; dhp = AlignParagraph(upBase);
else else
dev_seg = (((ULONG) FP_SEG(lpBase) << 4) + FP_OFF(lpBase) + 0xf) >> 4; dhp = AlignParagraph(lpBase);
/* Get the device driver name */ /* Get the device driver name */
GetStringArg(pLine, szBuf); GetStringArg(pLine, szBuf);
/* The driver is loaded at the top of allocated memory. */ /* The driver is loaded at the top of allocated memory. */
/* The device driver is paragraph aligned. */ /* The device driver is paragraph aligned. */
eb.load.reloc = eb.load.load_seg = dev_seg; eb.load.reloc = eb.load.load_seg = FP_SEG(dhp);
dhp = MK_FP(dev_seg, 0);
#ifdef DEBUG #ifdef DEBUG
printf("Loading device driver %s at segment %04x\n", printf("Loading device driver %s at segment %04x\n",
szBuf, dev_seg); szBuf, FP_SEG(dhp));
#endif #endif
if (DosExec(3, &eb, szBuf) == SUCCESS) if (DosExec(3, &eb, szBuf) == SUCCESS)
{
/* TE this fixes the loading of devices drivers with
multiple devices in it. NUMEGA's SoftIce is such a beast
*/
for ( ; ; )
{ {
/* that's a nice hack >:-) /* that's a nice hack >:-)
@ -1060,28 +1060,27 @@ INIT BOOL LoadDevice(BYTE * pLine, COUNT top, COUNT mode)
} }
/* end of HIMEM.SYS HACK */ /* end of HIMEM.SYS HACK */
result=init_device(dhp, pTmp, mode, top); /* TE this fixes the loading of devices drivers with
multiple devices in it. NUMEGA's SoftIce is such a beast
if(!result){ */
for (next_dhp=NULL; FP_OFF(next_dhp) != 0xffff &&
(result=init_device(dhp, pTmp, mode, top))==SUCCESS
; dhp = next_dhp)
{
next_dhp = dhp->dh_next; next_dhp = dhp->dh_next;
if (FP_SEG(next_dhp) == 0xffff)
/* Does this ever occur with FP_OFF(next_dhp) != 0xffff ??? */
next_dhp = MK_FP(FP_SEG(dhp), FP_OFF(next_dhp));
#ifdef DEBUG
else if (FP_OFF(next_dhp) != 0xffff) /* end of internal chain */
printf("multisegmented device driver found, next %p\n",next_dhp);
/* give warning message */
#endif
/* Link in device driver and save nul_dev pointer to next */ /* Link in device driver and save nul_dev pointer to next */
dhp->dh_next = nul_dev.dh_next; dhp->dh_next = nul_dev.dh_next;
nul_dev.dh_next = dhp; nul_dev.dh_next = dhp;
} }
/* multiple devices end */
if (FP_OFF(next_dhp) == 0xffff) /* end of internal chain */
break;
FP_OFF(dhp) = FP_OFF(next_dhp);
if (FP_SEG(next_dhp) != 0xffff)
{
printf("multisegmented device driver found, next %p\n",next_dhp); /* give warning message */
dhp = next_dhp;
}
}
HMAconfig(FALSE); /* let the HMA claim HMA usage */ HMAconfig(FALSE); /* let the HMA claim HMA usage */
} }
@ -1109,7 +1108,7 @@ INIT BYTE FAR *KernelAlloc(WORD nBytes)
lpBase = AlignParagraph(lpBase); lpBase = AlignParagraph(lpBase);
lpAllocated = lpBase; lpAllocated = lpBase;
if (0x10000 - FP_OFF(lpBase) <= nBytes) if (0xffff - FP_OFF(lpBase) <= nBytes)
{ {
UWORD newOffs = (FP_OFF(lpBase) + nBytes) & 0xFFFF; UWORD newOffs = (FP_OFF(lpBase) + nBytes) & 0xFFFF;
UWORD newSeg = FP_SEG(lpBase) + 0x1000; UWORD newSeg = FP_SEG(lpBase) + 0x1000;
@ -1140,19 +1139,13 @@ INIT BYTE FAR *KernelAllocDma(WORD bytes)
INIT void FAR *AlignParagraph(VOID FAR * lpPtr) INIT void FAR *AlignParagraph(VOID FAR * lpPtr)
{ {
ULONG lTemp;
UWORD uSegVal; UWORD uSegVal;
/* First, convert the segmented pointer to linear address */ /* First, convert the segmented pointer to linear address */
lTemp = FP_SEG(lpPtr); uSegVal = FP_SEG(lpPtr);
lTemp = (lTemp << 4) + FP_OFF(lpPtr); uSegVal += (FP_OFF(lpPtr)+0xf) >> 4;
if (FP_OFF(lpPtr) > 0xfff0)
/* Next, round up the linear address to a paragraph boundary. */ uSegVal += 0x1000; /* handle overflow */
lTemp += 0x0f;
lTemp &= 0xfffffff0l;
/* Break it into segments. */
uSegVal = (UWORD) (lTemp >> 4);
/* and return an adddress adjusted to the nearest paragraph */ /* and return an adddress adjusted to the nearest paragraph */
/* boundary. */ /* boundary. */
@ -1238,7 +1231,7 @@ INIT COUNT toupper(COUNT c)
/* The following code is 8086 dependant */ /* The following code is 8086 dependant */
#ifdef KERNEL #if 1 /* ifdef KERNEL */
INIT VOID INIT VOID
mcb_init(mcb FAR * mcbp, UWORD size) mcb_init(mcb FAR * mcbp, UWORD size)
{ {
@ -1314,8 +1307,6 @@ char *stristr(char *s1, char *s2)
/* compare two ASCII strings ignoring case */ /* compare two ASCII strings ignoring case */
INIT COUNT strcasecmp(REG BYTE *d, REG BYTE *s) INIT COUNT strcasecmp(REG BYTE *d, REG BYTE *s)
{ {
int loop;
while (*s != '\0' && *d != '\0') while (*s != '\0' && *d != '\0')
{ {

View File

@ -28,6 +28,9 @@
; $Header$ ; $Header$
; ;
; $Log$ ; $Log$
; Revision 1.6 2001/04/15 03:21:50 bartoldeman
; See history.txt for the list of fixes.
;
; Revision 1.5 2001/03/21 02:56:25 bartoldeman ; Revision 1.5 2001/03/21 02:56:25 bartoldeman
; See history.txt for changes. Bug fixes and HMA support are the main ones. ; See history.txt for changes. Bug fixes and HMA support are the main ones.
; ;
@ -285,8 +288,8 @@ ConIS2:
lds bx,[_ReqPktPtr] ; Set the status lds bx,[_ReqPktPtr] ; Set the status
mov [bx+0Dh],al mov [bx+0Dh],al
ConCharReady: ConCharReady:
jmp _IODone ; key ready (busy=1) jmp _IOExit ; key ready (busy=0)
ConNoChar: ConNoChar:
jmp _IOExit ; no key ready (busy=0) jmp _IODone ; no key ready (busy=1)

View File

@ -37,6 +37,9 @@ static BYTE *dosfnsRcsId = "$Id$";
* /// Added SHARE support. 2000/09/04 Ron Cemer * /// Added SHARE support. 2000/09/04 Ron Cemer
* *
* $Log$ * $Log$
* Revision 1.15 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.14 2001/04/02 23:18:30 bartoldeman * Revision 1.14 2001/04/02 23:18:30 bartoldeman
* Misc, zero terminated device names and redirector bugs fixed. * Misc, zero terminated device names and redirector bugs fixed.
* *
@ -776,6 +779,12 @@ COUNT DosCreat(BYTE FAR * fname, COUNT attrib)
/* WORD i;*/ /* WORD i;*/
COUNT result, drive; COUNT result, drive;
/* NEVER EVER allow directories to be created */
if (attrib & ~(D_RDONLY|D_HIDDEN|D_SYSTEM|D_ARCHIVE))
{
return DE_ACCESS;
}
/* get a free handle */ /* get a free handle */
if ((hndl = get_free_hndl()) == 0xff) if ((hndl = get_free_hndl()) == 0xff)
return DE_TOOMANY; return DE_TOOMANY;
@ -815,8 +824,7 @@ COUNT DosCreat(BYTE FAR * fname, COUNT attrib)
if (CDSp->cds_table[drive].cdsFlags & CDSNETWDRV) { if (CDSp->cds_table[drive].cdsFlags & CDSNETWDRV) {
lpCurSft = (sfttbl FAR *)sftp; lpCurSft = (sfttbl FAR *)sftp;
sftp->sft_mode = attrib; sftp->sft_mode = attrib;
result = int2f_Remote_call(REM_CREATE, 0, 0, 0, (VOID FAR *) sftp, 0, MK_FP(0, attrib)); result = -int2f_Remote_call(REM_CREATE, 0, 0, 0, (VOID FAR *) sftp, 0, MK_FP(0, attrib));
result = -result;
if (result == SUCCESS) { if (result == SUCCESS) {
sftp->sft_count += 1; sftp->sft_count += 1;
p->ps_filetab[hndl] = sft_idx; p->ps_filetab[hndl] = sft_idx;
@ -892,7 +900,7 @@ COUNT DosDup(COUNT Handle)
return DE_TOOMANY; return DE_TOOMANY;
/* If everything looks ok, bump it up. */ /* If everything looks ok, bump it up. */
if ((Sftp->sft_flags & SFT_FDEVICE) || (Sftp->sft_status >= 0)) if ((Sftp->sft_flags & (SFT_FDEVICE | SFT_FSHARED)) || (Sftp->sft_status >= 0))
{ {
p->ps_filetab[NewHandle] = p->ps_filetab[Handle]; p->ps_filetab[NewHandle] = p->ps_filetab[Handle];
Sftp->sft_count += 1; Sftp->sft_count += 1;
@ -925,7 +933,7 @@ COUNT DosForceDup(COUNT OldHandle, COUNT NewHandle)
} }
/* If everything looks ok, bump it up. */ /* If everything looks ok, bump it up. */
if ((Sftp->sft_flags & SFT_FDEVICE) || (Sftp->sft_status >= 0)) if ((Sftp->sft_flags & (SFT_FDEVICE | SFT_FSHARED)) || (Sftp->sft_status >= 0))
{ {
p->ps_filetab[NewHandle] = p->ps_filetab[OldHandle]; p->ps_filetab[NewHandle] = p->ps_filetab[OldHandle];
@ -1004,8 +1012,7 @@ COUNT DosOpen(BYTE FAR * fname, COUNT mode)
if (CDSp->cds_table[drive].cdsFlags & CDSNETWDRV) { if (CDSp->cds_table[drive].cdsFlags & CDSNETWDRV) {
lpCurSft = (sfttbl FAR *)sftp; lpCurSft = (sfttbl FAR *)sftp;
result = int2f_Remote_call(REM_OPEN, 0, 0, 0, (VOID FAR *) sftp, 0, MK_FP(0, mode)); result = -int2f_Remote_call(REM_OPEN, 0, 0, 0, (VOID FAR *) sftp, 0, MK_FP(0, mode));
result = -result;
if (result == SUCCESS) { if (result == SUCCESS) {
sftp->sft_count += 1; sftp->sft_count += 1;
p->ps_filetab[hndl] = sft_idx; p->ps_filetab[hndl] = sft_idx;
@ -1080,25 +1087,20 @@ COUNT DosClose(COUNT hndl)
/* /*
remote sub sft_count. remote sub sft_count.
*/ */
p->ps_filetab[hndl] = 0xff;
if (s->sft_flags & SFT_FSHARED) if (s->sft_flags & SFT_FSHARED)
{ {
int2f_Remote_call(REM_CLOSE, 0, 0, 0, (VOID FAR *) s, 0, 0); int2f_Remote_call(REM_CLOSE, 0, 0, 0, (VOID FAR *) s, 0, 0);
p->ps_filetab[hndl] = 0xff;
return SUCCESS; return SUCCESS;
} }
/* now just drop the count if a device, else */ /* now just drop the count if a device, else */
/* call file system handler */ /* call file system handler */
if (s->sft_flags & SFT_FDEVICE)
{
p->ps_filetab[hndl] = 0xff;
s->sft_count -= 1; s->sft_count -= 1;
if (s->sft_flags & SFT_FDEVICE)
return SUCCESS; return SUCCESS;
}
else else
{ {
p->ps_filetab[hndl] = 0xff;
s->sft_count -= 1;
if (s->sft_count > 0) if (s->sft_count > 0)
return SUCCESS; return SUCCESS;
else { else {
@ -1113,9 +1115,9 @@ COUNT DosClose(COUNT hndl)
} }
} }
VOID DosGetFree(COUNT drive, COUNT FAR * spc, COUNT FAR * navc, COUNT FAR * bps, COUNT FAR * nc) VOID DosGetFree(UBYTE drive, COUNT FAR * spc, COUNT FAR * navc, COUNT FAR * bps, COUNT FAR * nc)
{ {
struct dpb *dpbp; struct dpb FAR *dpbp;
struct cds FAR *cdsp; struct cds FAR *cdsp;
static COUNT rg[4]; static COUNT rg[4];
@ -1123,13 +1125,15 @@ VOID DosGetFree(COUNT drive, COUNT FAR * spc, COUNT FAR * navc, COUNT FAR * bps,
drive = (drive == 0 ? default_drive : drive - 1); drive = (drive == 0 ? default_drive : drive - 1);
/* first check for valid drive */ /* first check for valid drive */
if (drive < 0 || drive >= lastdrive)
{
*spc = -1; *spc = -1;
if (drive >= lastdrive)
return; return;
}
cdsp = &CDSp->cds_table[drive]; cdsp = &CDSp->cds_table[drive];
if (!(cdsp->cdsFlags & CDSVALID))
return;
if (cdsp->cdsFlags & CDSNETWDRV) if (cdsp->cdsFlags & CDSNETWDRV)
{ {
int2f_Remote_call(REM_GETSPACE, 0, 0, 0, cdsp, 0, &rg); int2f_Remote_call(REM_GETSPACE, 0, 0, 0, cdsp, 0, &rg);
@ -1141,18 +1145,9 @@ VOID DosGetFree(COUNT drive, COUNT FAR * spc, COUNT FAR * navc, COUNT FAR * bps,
return; return;
} }
dpbp = (struct dpb *)CDSp->cds_table[drive].cdsDpb; dpbp = CDSp->cds_table[drive].cdsDpb;
if (dpbp == 0) if (dpbp == NULL || media_check(dpbp) < 0)
{
*spc = -1;
return; return;
}
if ((media_check(dpbp) < 0))
{
*spc = -1;
return;
}
/* get the data vailable from dpb */ /* get the data vailable from dpb */
*nc = dpbp->dpb_size; *nc = dpbp->dpb_size;
@ -1164,26 +1159,20 @@ VOID DosGetFree(COUNT drive, COUNT FAR * spc, COUNT FAR * navc, COUNT FAR * bps,
*navc = dos_free(dpbp); *navc = dos_free(dpbp);
} }
COUNT DosGetCuDir(COUNT drive, BYTE FAR * s) COUNT DosGetCuDir(UBYTE drive, BYTE FAR * s)
{ {
REG struct cds FAR *cdsp;
/* next - "log" in the drive */ /* next - "log" in the drive */
drive = (drive == 0 ? default_drive : drive - 1); drive = (drive == 0 ? default_drive : drive - 1);
/* first check for valid drive */ /* first check for valid drive */
if (drive < 0 || drive >= lastdrive) { if (drive >= lastdrive || !(CDSp->cds_table[drive].cdsFlags & CDSVALID)) {
return DE_INVLDDRV; return DE_INVLDDRV;
} }
cdsp = &CDSp->cds_table[drive]; current_ldt = &CDSp->cds_table[drive];
current_ldt = cdsp;
if (!(cdsp->cdsFlags & CDSNETWDRV) && (cdsp->cdsDpb == 0)) { fsncopy((BYTE FAR *) & current_ldt->cdsCurrentPath[1 + current_ldt->cdsJoinOffset],
return DE_INVLDDRV; s, 64);
}
fsncopy((BYTE FAR *) & cdsp->cdsCurrentPath[1 + cdsp->cdsJoinOffset], s, 64);
return SUCCESS; return SUCCESS;
} }
@ -1225,13 +1214,12 @@ COUNT DosChangeDir(BYTE FAR * s)
p = PriPathName; while(*p) printf("%c", *p++); p = PriPathName; while(*p) printf("%c", *p++);
printf("'\n"); printf("'\n");
#endif #endif
result = int2f_Remote_call(REM_CHDIR, 0, 0, 0, PriPathName, 0, 0); result = -int2f_Remote_call(REM_CHDIR, 0, 0, 0, PriPathName, 0, 0);
#if defined(CHDIR_DEBUG) #if defined(CHDIR_DEBUG)
printf("status = %04x, new_path='", result); printf("status = %04x, new_path='", result);
p = cdsd->cdsCurrentPath; while(p) printf("%c", *p++) p = cdsd->cdsCurrentPath; while(p) printf("%c", *p++)
printf("'\n"); printf("'\n");
#endif #endif
result = -result;
if (result != SUCCESS) { if (result != SUCCESS) {
return DE_PATHNOTFND; return DE_PATHNOTFND;
} }
@ -1330,10 +1318,9 @@ COUNT DosGetFattr(BYTE FAR * name, UWORD FAR * attrp)
static UWORD srfa[5]; static UWORD srfa[5];
COUNT result, drive; COUNT result, drive;
struct cds FAR *last_cds; struct cds FAR *last_cds;
BYTE FAR * p;
if (IsDevice(name)) { if (IsDevice(name)) {
return DE_PATHNOTFND; return DE_FILENOTFND;
} }
drive = get_verify_drive(name); drive = get_verify_drive(name);
@ -1360,10 +1347,10 @@ COUNT DosGetFattr(BYTE FAR * name, UWORD FAR * attrp)
{ {
last_cds = current_ldt; last_cds = current_ldt;
current_ldt = &CDSp->cds_table[drive]; current_ldt = &CDSp->cds_table[drive];
result = int2f_Remote_call(REM_GETATTRZ, 0, 0, 0, 0, 0, (VOID FAR *) srfa); result = -int2f_Remote_call(REM_GETATTRZ, 0, 0, 0, 0, 0, (VOID FAR *) srfa);
result = -result;
current_ldt = last_cds; current_ldt = last_cds;
*attrp = srfa[0]; *attrp = srfa[0];
return result;
} }
else { else {
/* /// Use truename()'s result, which we already have in PriPathName. /* /// Use truename()'s result, which we already have in PriPathName.
@ -1378,20 +1365,17 @@ COUNT DosGetFattr(BYTE FAR * name, UWORD FAR * attrp)
int i; int i;
for (i = 0; PriPathName[i] != '\0'; i++) tmp_name[i] = PriPathName[i]; for (i = 0; PriPathName[i] != '\0'; i++) tmp_name[i] = PriPathName[i];
tmp_name[i] = '\0'; tmp_name[i] = '\0';
result = dos_getfattr(tmp_name, attrp); return dos_getfattr(tmp_name, attrp);
} }
/* Sorry Ron someone else found this, see history.txt */
return result;
} }
COUNT DosSetFattr(BYTE FAR * name, UWORD FAR * attrp) COUNT DosSetFattr(BYTE FAR * name, UWORD FAR * attrp)
{ {
COUNT result, drive; COUNT result, drive;
struct cds FAR *last_cds; struct cds FAR *last_cds;
BYTE FAR *p;
if (IsDevice(name) ) { if (IsDevice(name) ) {
return DE_PATHNOTFND; return DE_FILENOTFND;
} }
drive = get_verify_drive(name); drive = get_verify_drive(name);
@ -1408,9 +1392,9 @@ COUNT DosSetFattr(BYTE FAR * name, UWORD FAR * attrp)
{ {
last_cds = current_ldt; last_cds = current_ldt;
current_ldt = &CDSp->cds_table[drive]; current_ldt = &CDSp->cds_table[drive];
result = int2f_Remote_call(REM_SETATTR, 0, 0, 0, 0, 0, MK_FP(0, attrp)); result = -int2f_Remote_call(REM_SETATTR, 0, 0, 0, 0, 0, MK_FP(0, attrp));
result = -result;
current_ldt = last_cds; current_ldt = last_cds;
return result;
} }
else { else {
/* /// Use truename()'s result, which we already have in PriPathName. /* /// Use truename()'s result, which we already have in PriPathName.
@ -1422,16 +1406,19 @@ COUNT DosSetFattr(BYTE FAR * name, UWORD FAR * attrp)
int i; int i;
for (i = 0; PriPathName[i] != '\0'; i++) tmp_name[i] = PriPathName[i]; for (i = 0; PriPathName[i] != '\0'; i++) tmp_name[i] = PriPathName[i];
tmp_name[i] = '\0'; tmp_name[i] = '\0';
result = dos_setfattr(name, attrp); return dos_setfattr(name, attrp);
} }
return result;
} }
BYTE DosSelectDrv(BYTE drv) UBYTE DosSelectDrv(UBYTE drv)
{ {
if ((0 <= drv) && (drv < lastdrive) &&(CDSp->cds_table[drv].cdsFlags & 0xf000)) struct cds FAR *cdsp = &CDSp->cds_table[drv];
if ((drv < lastdrive) && (cdsp->cdsFlags & CDSVALID) &&
((cdsp->cdsFlags & CDSNETWDRV) ||
(cdsp->cdsDpb!=NULL && media_check(cdsp->cdsDpb)==SUCCESS)))
{ {
current_ldt = &CDSp->cds_table[drv]; current_ldt = cdsp;
default_drive = drv; default_drive = drv;
} }
return lastdrive; return lastdrive;
@ -1442,7 +1429,7 @@ COUNT DosDelete(BYTE FAR *path)
COUNT result, drive; COUNT result, drive;
if (IsDevice(path)) { if (IsDevice(path)) {
return DE_PATHNOTFND; return DE_FILENOTFND;
} }
drive = get_verify_drive(path); drive = get_verify_drive(path);
@ -1455,12 +1442,10 @@ COUNT DosDelete(BYTE FAR *path)
} }
current_ldt = &CDSp->cds_table[drive]; current_ldt = &CDSp->cds_table[drive];
if (CDSp->cds_table[drive].cdsFlags & CDSNETWDRV) { if (CDSp->cds_table[drive].cdsFlags & CDSNETWDRV) {
result = int2f_Remote_call(REM_DELETE, 0, 0, 0, 0, 0, 0); return -int2f_Remote_call(REM_DELETE, 0, 0, 0, 0, 0, 0);
result = -result;
} else { } else {
result = dos_delete(path); return dos_delete(path);
} }
return result;
} }
COUNT DosRename(BYTE FAR * path1, BYTE FAR * path2) COUNT DosRename(BYTE FAR * path1, BYTE FAR * path2)
@ -1468,7 +1453,7 @@ COUNT DosRename(BYTE FAR * path1, BYTE FAR * path2)
COUNT result, drive1, drive2; COUNT result, drive1, drive2;
if (IsDevice(path1) || IsDevice(path2)) { if (IsDevice(path1) || IsDevice(path2)) {
return DE_PATHNOTFND; return DE_FILENOTFND;
} }
drive1 = get_verify_drive(path1); drive1 = get_verify_drive(path1);
@ -1486,12 +1471,10 @@ COUNT DosRename(BYTE FAR * path1, BYTE FAR * path2)
} }
current_ldt = &CDSp->cds_table[drive1]; current_ldt = &CDSp->cds_table[drive1];
if (CDSp->cds_table[drive1].cdsFlags & CDSNETWDRV) { if (CDSp->cds_table[drive1].cdsFlags & CDSNETWDRV) {
result = int2f_Remote_call(REM_RENAME, 0, 0, 0, 0, 0, 0); return -int2f_Remote_call(REM_RENAME, 0, 0, 0, 0, 0, 0);
result = -result;
} else { } else {
result = dos_rename(path1, path2); return dos_rename(path1, path2);
} }
return result;
} }
COUNT DosMkdir(BYTE FAR * dir) COUNT DosMkdir(BYTE FAR * dir)
@ -1512,12 +1495,10 @@ COUNT DosMkdir(BYTE FAR * dir)
} }
current_ldt = &CDSp->cds_table[drive]; current_ldt = &CDSp->cds_table[drive];
if (CDSp->cds_table[drive].cdsFlags & CDSNETWDRV) { if (CDSp->cds_table[drive].cdsFlags & CDSNETWDRV) {
result = int2f_Remote_call(REM_MKDIR, 0, 0, 0, 0, 0, 0); return -int2f_Remote_call(REM_MKDIR, 0, 0, 0, 0, 0, 0);
result = -result;
} else { } else {
result = dos_mkdir(dir); return dos_mkdir(dir);
} }
return result;
} }
COUNT DosRmdir(BYTE FAR * dir) COUNT DosRmdir(BYTE FAR * dir)
@ -1538,12 +1519,10 @@ COUNT DosRmdir(BYTE FAR * dir)
} }
current_ldt = &CDSp->cds_table[drive]; current_ldt = &CDSp->cds_table[drive];
if (CDSp->cds_table[drive].cdsFlags & CDSNETWDRV) { if (CDSp->cds_table[drive].cdsFlags & CDSNETWDRV) {
result = int2f_Remote_call(REM_RMDIR, 0, 0, 0, 0, 0, 0); return -int2f_Remote_call(REM_RMDIR, 0, 0, 0, 0, 0, 0);
result = -result;
} else { } else {
result = dos_rmdir(dir); return dos_rmdir(dir);
} }
return result;
} }
/* /// Added for SHARE. - Ron Cemer */ /* /// Added for SHARE. - Ron Cemer */

View File

@ -36,6 +36,9 @@ static BYTE *dosnamesRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.8 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.7 2001/03/21 02:56:25 bartoldeman * Revision 1.7 2001/03/21 02:56:25 bartoldeman
* See history.txt for changes. Bug fixes and HMA support are the main ones. * See history.txt for changes. Bug fixes and HMA support are the main ones.
* *
@ -206,7 +209,7 @@ COUNT ParseDosName(BYTE FAR * lpszFileName,
lpszLclFile = lpszFileName + 1; lpszLclFile = lpszFileName + 1;
++lpszFileName; ++lpszFileName;
} }
nDirCnt = lpszLclFile - lpszLclDir; nDirCnt = FP_OFF(lpszLclFile) - FP_OFF(lpszLclDir);
/* Parse out the file name portion. */ /* Parse out the file name portion. */
lpszFileName = lpszLclFile; lpszFileName = lpszLclFile;
while (bAllowWildcards ? WildChar(*lpszFileName) : NameChar(*lpszFileName)) while (bAllowWildcards ? WildChar(*lpszFileName) : NameChar(*lpszFileName))

View File

@ -26,13 +26,15 @@
#include "portab.h" #include "portab.h"
#include "globals.h" #include "globals.h"
#ifdef VERSION_STRINGS #ifdef VERSION_STRINGS
static BYTE *dskRcsId = "$Id$"; static BYTE *dskRcsId = "$Id$";
#endif #endif
/* /*
* $Log$ * $Log$
* Revision 1.14 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.13 2001/03/27 20:27:43 bartoldeman * Revision 1.13 2001/03/27 20:27:43 bartoldeman
* dsk.c (reported by Nagy Daniel), inthndlr and int25/26 fixes by Tom Ehlert. * dsk.c (reported by Nagy Daniel), inthndlr and int25/26 fixes by Tom Ehlert.
* *
@ -662,7 +664,7 @@ restart: /* yes, it's a GOTO >:-) */
return PartitionDone; return PartitionDone;
} }
COUNT FAR init_call_blk_driver(rqptr rp) COUNT FAR blk_driver(rqptr rp)
{ {
if (rp->r_unit >= nUnits && rp->r_command != C_INIT) if (rp->r_unit >= nUnits && rp->r_command != C_INIT)
return failure(E_UNIT); return failure(E_UNIT);
@ -705,7 +707,7 @@ WORD _dsk_init(rqptr rp)
pmiarray->mi_offset = 0l; pmiarray->mi_offset = 0l;
pmiarray->mi_drive = Unit; pmiarray->mi_drive = Unit;
fsarray[Unit].fs_serialno = 0x12345678; fsarray[Unit].fs_serialno = 0x12345678l;
pbpbarray = getPBpbarray(Unit); pbpbarray = getPBpbarray(Unit);
@ -1004,6 +1006,8 @@ static WORD Genblkdev(rqptr rp)
if (!hd(miarray[rp->r_unit].mi_drive)){ if (!hd(miarray[rp->r_unit].mi_drive)){
y = 2; y = 2;
x = 8; /* any odd ball drives return this */
if (miarray[rp->r_unit].mi_size <= 0xffff)
switch(miarray[rp->r_unit].mi_size) switch(miarray[rp->r_unit].mi_size)
{ {
case 640l: case 640l:
@ -1023,15 +1027,13 @@ static WORD Genblkdev(rqptr rp)
case 5760l: /* 2.88 almost forgot this one*/ case 5760l: /* 2.88 almost forgot this one*/
x = 9; x = 9;
break; break;
default:
x = 8; /* any odd ball drives return this */
} }
} }
gblp->gbio_devtype = (UBYTE) x; gblp->gbio_devtype = (UBYTE) x;
gblp->gbio_devattrib = (UWORD) y; gblp->gbio_devattrib = (UWORD) y;
gblp->gbio_media = (UBYTE) z; gblp->gbio_media = (UBYTE) z;
gblp->gbio_ncyl = miarray[rp->r_unit].mi_cyls; gblp->gbio_ncyl = miarray[rp->r_unit].mi_cyls;
gblp->gbio_bpb = bpbarray[rp->r_unit]; fmemcpy(&gblp->gbio_bpb, &bpbarray[rp->r_unit], sizeof(gblp->gbio_bpb));
gblp->gbio_nsecs = bpbarray[rp->r_unit].bpb_nsector; gblp->gbio_nsecs = bpbarray[rp->r_unit].bpb_nsector;
break; break;
} }
@ -1092,13 +1094,10 @@ WORD blockio(rqptr rp)
total = 0; total = 0;
trans = rp->r_trans; trans = rp->r_trans;
tmark(); tmark();
for ( remaining = rp->r_count;
remaining = rp->r_count,
start = (rp->r_start != HUGECOUNT ? rp->r_start : rp->r_huge) start = (rp->r_start != HUGECOUNT ? rp->r_start : rp->r_huge)
+ miarray[rp->r_unit].mi_offset; + miarray[rp->r_unit].mi_offset;
remaining > 0; while(remaining > 0)
remaining -= count, trans += count * SEC_SIZE, start += count
)
{ {
count = ltop(&track, &sector, &head, rp->r_unit, remaining, start, trans); count = ltop(&track, &sector, &head, rp->r_unit, remaining, start, trans);
@ -1151,6 +1150,9 @@ WORD blockio(rqptr rp)
return dskerr(ret); return dskerr(ret);
} }
total += count; total += count;
remaining -= count;
trans += count * SEC_SIZE;
start += count;
} }
rp->r_count = total; rp->r_count = total;
return S_DONE; return S_DONE;

View File

@ -34,6 +34,9 @@ static BYTE *errorRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.4 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.3 2000/05/25 20:56:21 jimtabor * Revision 1.3 2000/05/25 20:56:21 jimtabor
* Fixed project history * Fixed project history
* *
@ -125,10 +128,6 @@ VOID fatal(BYTE * err_msg)
for (;;) ; for (;;) ;
} }
VOID FAR init_call_fatal(BYTE * err_msg)
{
fatal(err_msg);
}
#endif #endif
/* Abort, retry or fail for character devices */ /* Abort, retry or fail for character devices */

View File

@ -30,6 +30,9 @@
; $Id$ ; $Id$
; ;
; $Log$ ; $Log$
; Revision 1.6 2001/04/15 03:21:50 bartoldeman
; See history.txt for the list of fixes.
;
; Revision 1.5 2001/04/02 23:18:30 bartoldeman ; Revision 1.5 2001/04/02 23:18:30 bartoldeman
; Misc, zero terminated device names and redirector bugs fixed. ; Misc, zero terminated device names and redirector bugs fixed.
; ;
@ -99,62 +102,33 @@ segment HMA_TEXT
_execrh: _execrh:
push bp ; perform c entry push bp ; perform c entry
mov bp,sp mov bp,sp
push bp ; it will get destroyed
push bx ; random char on display push bx ; random char on display
push si push si
push es ; sometimes it get lost push es ; sometimes it get lost
push ds push ds ; sp=bp-8
lds si,[bp+8] ; ds:si = device header lds si,[bp+8] ; ds:si = device header
les bx,[bp+4] ; es:bx = request header les bx,[bp+4] ; es:bx = request header
push ds ; needed later
push si
mov bp, execrh_ret1 ; construct return frame
push cs
push bp push bp
push ds
push ds ; call far the strategy push si ; needed later
push word [si+6] mov ax, [si+6]
mov [bp+8], ax
retf call far[bp+8] ; call far the strategy
execrh_ret1:
pop si ; these were saved pop si ; these were saved
pop ds pop ds
pop bp
mov bp, execrh_ret2 ; construct return frame mov ax, [si+8]
push cs mov [bp+8], ax
push bp call far[bp+8] ; call far the interrupt
push ds ; call far the interrupt sti ; damm driver turn off ints
push word [si+8]
retf
execrh_ret2:
exit_execrh: sti ; damm driver turn off ints
cld ; has gone backwards cld ; has gone backwards
pop ds pop ds
pop es pop es
pop si pop si
pop bx pop bx
pop bp pop bp
mov sp,bp
pop bp
ret ret
global _init_call_execrh
_init_call_execrh:
push bp
mov bp,sp
push word [bp+12]
push word [bp+10]
push word [bp+8]
push word [bp+6]
call _execrh
mov sp,bp
pop bp
retf

View File

@ -36,6 +36,9 @@ static BYTE *fatdirRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.14 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.13 2001/04/02 23:18:30 bartoldeman * Revision 1.13 2001/04/02 23:18:30 bartoldeman
* Misc, zero terminated device names and redirector bugs fixed. * Misc, zero terminated device names and redirector bugs fixed.
* *
@ -241,12 +244,12 @@ struct f_node FAR *dir_open(BYTE FAR * dirname)
return NULL; return NULL;
} }
fnp->f_dpb = (struct dpb *)TempCDS.cdsDpb; fnp->f_dpb = TempCDS.cdsDpb;
/* Perform all directory common handling after all special */ /* Perform all directory common handling after all special */
/* handling has been performed. */ /* handling has been performed. */
if (media_check((struct dpb *)TempCDS.cdsDpb) < 0) if (media_check(TempCDS.cdsDpb) < 0)
{ {
release_f_node(fnp); release_f_node(fnp);
return (struct f_node FAR *)0; return (struct f_node FAR *)0;
@ -450,7 +453,7 @@ COUNT dir_read(REG struct f_node FAR * fnp)
/* Now that we have the block for our entry, get the */ /* Now that we have the block for our entry, get the */
/* directory entry. */ /* directory entry. */
if (bp != NULL) if (bp != NULL)
getdirent((BYTE FAR *) & bp->b_buffer[fnp->f_diroff % fnp->f_dpb->dpb_secsize], getdirent((BYTE FAR *) & bp->b_buffer[((UWORD)fnp->f_diroff) % fnp->f_dpb->dpb_secsize],
(struct dirent FAR *)&fnp->f_dir); (struct dirent FAR *)&fnp->f_dir);
else else
{ {
@ -484,7 +487,7 @@ COUNT dir_write(REG struct f_node FAR * fnp)
if (fnp->f_flags.f_droot) if (fnp->f_flags.f_droot)
{ {
bp = getblock( bp = getblock(
(ULONG) (fnp->f_diroff / fnp->f_dpb->dpb_secsize (ULONG) ((UWORD)fnp->f_diroff / fnp->f_dpb->dpb_secsize
+ fnp->f_dpb->dpb_dirstrt), + fnp->f_dpb->dpb_dirstrt),
fnp->f_dpb->dpb_unit); fnp->f_dpb->dpb_unit);
bp->b_flag &= ~(BFR_DATA | BFR_FAT); bp->b_flag &= ~(BFR_DATA | BFR_FAT);
@ -554,7 +557,7 @@ COUNT dir_write(REG struct f_node FAR * fnp)
return 0; return 0;
} }
putdirent((struct dirent FAR *)&fnp->f_dir, putdirent((struct dirent FAR *)&fnp->f_dir,
(VOID FAR *) & bp->b_buffer[fnp->f_diroff % fnp->f_dpb->dpb_secsize]); (VOID FAR *) & bp->b_buffer[(UWORD)fnp->f_diroff % fnp->f_dpb->dpb_secsize]);
bp->b_flag |= BFR_DIRTY; bp->b_flag |= BFR_DIRTY;
} }
return DIRENT_SIZE; return DIRENT_SIZE;
@ -589,7 +592,6 @@ COUNT dos_findfirst(UCOUNT attr, BYTE FAR * name)
REG COUNT i; REG COUNT i;
COUNT nDrive; COUNT nDrive;
BYTE *p; BYTE *p;
/* BYTE FAR *ptr;*/
static BYTE local_name[FNAME_SIZE + 1], static BYTE local_name[FNAME_SIZE + 1],
local_ext[FEXT_SIZE + 1]; local_ext[FEXT_SIZE + 1];
@ -604,7 +606,7 @@ COUNT dos_findfirst(UCOUNT attr, BYTE FAR * name)
/* current directory, do a seek and read, then close the fnode. */ /* current directory, do a seek and read, then close the fnode. */
/* Start out by initializing the dirmatch structure. */ /* Start out by initializing the dirmatch structure. */
dmp->dm_drive = default_drive ; dmp->dm_drive = default_drive;
dmp->dm_entry = 0; dmp->dm_entry = 0;
dmp->dm_cluster = 0; dmp->dm_cluster = 0;
@ -621,7 +623,7 @@ COUNT dos_findfirst(UCOUNT attr, BYTE FAR * name)
*/ */
if (nDrive >= 0) if (nDrive >= 0)
{ {
dmp->dm_drive = nDrive ; dmp->dm_drive = nDrive;
} }
else else
nDrive = default_drive; nDrive = default_drive;
@ -661,9 +663,8 @@ COUNT dos_findfirst(UCOUNT attr, BYTE FAR * name)
if (current_ldt->cdsFlags & CDSNETWDRV) if (current_ldt->cdsFlags & CDSNETWDRV)
{ {
if (Remote_find(REM_FINDFIRST, name, dmp) != 0) dmp->dm_drive |= 0x80;
return DE_FILENOTFND; return -Remote_find(REM_FINDFIRST, name, dmp);
return SUCCESS;
} }
/* /// Added code here to do matching against device names. /* /// Added code here to do matching against device names.
@ -708,17 +709,31 @@ COUNT dos_findfirst(UCOUNT attr, BYTE FAR * name)
/* Now search through the directory to find the entry... */ /* Now search through the directory to find the entry... */
/* Complete building the directory from the passed in */
/* name */
if (nDrive >= 0)
LocalPath[0] = 'A' + nDrive;
else
LocalPath[0] = 'A' + default_drive;
LocalPath[1] = ':';
/* Special handling - the volume id is only in the root */ /* Special handling - the volume id is only in the root */
/* directory and only searched for once. So we need to open */ /* directory and only searched for once. So we need to open */
/* the root and return only the first entry that contains the */ /* the root and return only the first entry that contains the */
/* volume id bit set. */ /* volume id bit set. */
if ((attr & ~(D_RDONLY | D_ARCHIVE)) == D_VOLID) if ((attr & ~(D_RDONLY | D_ARCHIVE)) == D_VOLID)
{ {
LocalPath[2] = '\\';
LocalPath[3] = '\0';
}
/* Now open this directory so that we can read the */ /* Now open this directory so that we can read the */
/* fnode entry and do a match on it. */ /* fnode entry and do a match on it. */
if ((fnp = dir_open((BYTE FAR *) "\\")) == NULL) if ((fnp = dir_open((BYTE FAR *) LocalPath)) == NULL)
return DE_PATHNOTFND; return DE_PATHNOTFND;
if ((attr & ~(D_RDONLY | D_ARCHIVE)) == D_VOLID)
{
/* Now do the search */ /* Now do the search */
while (dir_read(fnp) == DIRENT_SIZE) while (dir_read(fnp) == DIRENT_SIZE)
{ {
@ -736,23 +751,9 @@ COUNT dos_findfirst(UCOUNT attr, BYTE FAR * name)
dir_close(fnp); dir_close(fnp);
return DE_FILENOTFND; return DE_FILENOTFND;
} }
/* Otherwise just do a normal find next */ /* Otherwise just do a normal find next */
else else
{ {
/* Complete building the directory from the passed in */
/* name */
if (nDrive >= 0)
LocalPath[0] = 'A' + nDrive;
else
LocalPath[0] = 'A' + default_drive;
LocalPath[1] = ':';
/* Now open this directory so that we can read the */
/* fnode entry and do a match on it. */
if ((fnp = dir_open((BYTE FAR *) LocalPath)) == NULL)
return DE_PATHNOTFND;
pop_dmp(dmp, fnp); pop_dmp(dmp, fnp);
dmp->dm_entry = 0; dmp->dm_entry = 0;
if (!fnp->f_flags.f_droot) if (!fnp->f_flags.f_droot)
@ -775,9 +776,6 @@ COUNT dos_findnext(void)
REG dmatch FAR *dmp = (dmatch FAR *) dta; REG dmatch FAR *dmp = (dmatch FAR *) dta;
REG struct f_node FAR *fnp; REG struct f_node FAR *fnp;
BOOL found = FALSE; BOOL found = FALSE;
/* BYTE FAR *p;*/
/* BYTE FAR *q;*/
COUNT nDrive;
/* assign our match parameters pointer. */ /* assign our match parameters pointer. */
dmp = (dmatch FAR *) dta; dmp = (dmatch FAR *) dta;
@ -790,50 +788,43 @@ COUNT dos_findnext(void)
* test 40h. I used RamView to see location MSD 116:04be and * test 40h. I used RamView to see location MSD 116:04be and
* FD f??:04be, the byte set with 0xc4 = Remote/Network drive 4. * FD f??:04be, the byte set with 0xc4 = Remote/Network drive 4.
* Ralf Brown docs for dos 4eh say bit 7 set == remote so what is * Ralf Brown docs for dos 4eh say bit 7 set == remote so what is
* bit 6 for? SHSUCDX Mod info say "test redir not network bit". * bit 6 for?
* SHSUCDX Mod info say "test redir not network bit".
* Just to confuse the rest, MSCDEX sets bit 5 too. * Just to confuse the rest, MSCDEX sets bit 5 too.
* *
* So, assume bit 6 is redirector and bit 7 is network. * So, assume bit 6 is redirector and bit 7 is network.
* jt * jt
* Bart: dm_drive can be the drive _letter_.
* but better just stay independent of it: we only use
* bit 7 to detect a network drive; the rest untouched.
* RBIL says that findnext can only return one error type anyway
* (12h, DE_NFILES)
*/ */
nDrive = dmp->dm_drive & 0x1f;
if (nDrive >= lastdrive) {
return DE_INVLDDRV;
}
current_ldt = &CDSp->cds_table[nDrive];
#if 0 #if 0
printf("findnext: %c %s\n", printf("findnext: %d\n",
nDrive + 'A', (current_ldt->cdsFlags & CDSNETWDRV)?"remote":"local"); dmp->dm_drive);
#endif #endif
if (current_ldt->cdsFlags & CDSNETWDRV) if (dmp->dm_drive & 0x80)
{ return -Remote_find(REM_FINDNEXT, 0, dmp);
if (Remote_find(REM_FINDNEXT, 0, dmp) != 0)
return DE_FILENOTFND;
return SUCCESS;
}
/* Allocate an fnode if possible - error return (0) if not. */ /* Allocate an fnode if possible - error return (0) if not. */
if ((fnp = get_f_node()) == (struct f_node FAR *)0) if ((fnp = get_f_node()) == (struct f_node FAR *)0)
{ {
return DE_FILENOTFND; return DE_NFILES;
} }
/* Force the fnode into read-write mode */ /* Force the fnode into read-write mode */
fnp->f_mode = RDWR; fnp->f_mode = RDWR;
if (dmp->dm_drive >= lastdrive) {
return DE_INVLDDRV;
}
/* Select the default to help non-drive specified path */ /* Select the default to help non-drive specified path */
/* searches... */ /* searches... */
fnp->f_dpb = (struct dpb *)CDSp->cds_table[dmp->dm_drive].cdsDpb; fnp->f_dpb = CDSp->cds_table[dmp->dm_drive].cdsDpb;
if (media_check(fnp->f_dpb) < 0) if (media_check(fnp->f_dpb) < 0)
{ {
release_f_node(fnp); release_f_node(fnp);
return DE_FILENOTFND; return DE_NFILES;
} }
fnp->f_dsize = DIRENT_SIZE * (fnp->f_dpb)->dpb_dirents; fnp->f_dsize = DIRENT_SIZE * (fnp->f_dpb)->dpb_dirents;

View File

@ -36,6 +36,9 @@ BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.14 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.13 2001/03/30 19:30:06 bartoldeman * Revision 1.13 2001/03/30 19:30:06 bartoldeman
* Misc fixes and implementation of SHELLHIGH. See history.txt for details. * Misc fixes and implementation of SHELLHIGH. See history.txt for details.
* *
@ -247,8 +250,6 @@ COUNT map_cluster(struct f_node FAR *, COUNT);
COUNT dos_open(BYTE FAR * path, COUNT flag) COUNT dos_open(BYTE FAR * path, COUNT flag)
{ {
REG struct f_node FAR *fnp; REG struct f_node FAR *fnp;
COUNT i;
BYTE FAR *fnamep;
/* First test the flag to see if the user has passed a valid */ /* First test the flag to see if the user has passed a valid */
/* file mode... */ /* file mode... */
@ -296,11 +297,6 @@ COUNT dos_open(BYTE FAR * path, COUNT flag)
return xlt_fnp(fnp); return xlt_fnp(fnp);
} }
COUNT FAR init_call_dos_open(BYTE FAR * path, COUNT flag)
{
return dos_open(path, flag);
}
BOOL fcmp(BYTE FAR * s1, BYTE FAR * s2, COUNT n) BOOL fcmp(BYTE FAR * s1, BYTE FAR * s2, COUNT n)
{ {
while (n--) while (n--)
@ -349,11 +345,6 @@ COUNT dos_close(COUNT fd)
return SUCCESS; return SUCCESS;
} }
COUNT FAR init_call_dos_close(COUNT fd)
{
return dos_close(fd);
}
/* */ /* */
/* split a path into it's component directory and file name */ /* split a path into it's component directory and file name */
/* */ /* */
@ -378,7 +369,7 @@ struct f_node FAR *
SpacePad(fname, FNAME_SIZE); SpacePad(fname, FNAME_SIZE);
SpacePad(fext, FEXT_SIZE); SpacePad(fext, FEXT_SIZE);
if (nDrive > (lastdrive -1)) { if (nDrive >= lastdrive) {
return (struct f_node FAR *)0; return (struct f_node FAR *)0;
} }
cdsp = &CDSp->cds_table[nDrive]; cdsp = &CDSp->cds_table[nDrive];
@ -525,6 +516,12 @@ COUNT dos_creat(BYTE FAR * path, COUNT attrib)
{ {
REG struct f_node FAR *fnp; REG struct f_node FAR *fnp;
/* NEVER EVER allow directories to be created */
if (attrib & ~(D_RDONLY|D_HIDDEN|D_SYSTEM|D_ARCHIVE))
{
return DE_ACCESS;
}
/* first split the passed dir into comopnents (i.e. - */ /* first split the passed dir into comopnents (i.e. - */
/* path to new directory and name of new directory */ /* path to new directory and name of new directory */
if ((fnp = split_path(path, szDirName, szFileName, szFileExt)) == NULL) if ((fnp = split_path(path, szDirName, szFileName, szFileExt)) == NULL)
@ -555,9 +552,6 @@ COUNT dos_creat(BYTE FAR * path, COUNT attrib)
else else
{ {
BOOL is_free; BOOL is_free;
REG COUNT idx;
struct buffer FAR *bp;
BYTE FAR *p;
/* Reset the directory by a close followed by */ /* Reset the directory by a close followed by */
/* an open */ /* an open */
@ -877,7 +871,7 @@ static VOID wipe_out(struct f_node FAR * fnp)
{ {
REG UWORD st, REG UWORD st,
next; next;
struct dpb *dpbp = fnp->f_dpb; struct dpb FAR *dpbp = fnp->f_dpb;
/* if already free or not valid file, just exit */ /* if already free or not valid file, just exit */
if ((fnp == NULL) || (fnp->f_dir.dir_start == FREE)) if ((fnp == NULL) || (fnp->f_dir.dir_start == FREE))
@ -954,11 +948,6 @@ date dos_getdate()
#endif #endif
} }
date FAR init_call_dos_getdate()
{
return dos_getdate();
}
/* */ /* */
/* dos_gettime for the file time */ /* dos_gettime for the file time */
/* */ /* */
@ -969,8 +958,6 @@ time dos_gettime()
Minute, Minute,
Second, Second,
Hundredth; Hundredth;
time Time;
BYTE h;
/* First - get the system time set by either the user */ /* First - get the system time set by either the user */
/* on start-up or the CMOS clock */ /* on start-up or the CMOS clock */
@ -984,11 +971,6 @@ time dos_gettime()
#endif #endif
} }
time FAR init_call_dos_gettime()
{
return dos_gettime();
}
/* */ /* */
/* dos_getftime for the file time */ /* dos_getftime for the file time */
/* */ /* */
@ -1509,7 +1491,6 @@ UCOUNT readblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
REG struct buffer FAR *bp; REG struct buffer FAR *bp;
UCOUNT xfr_cnt = 0; UCOUNT xfr_cnt = 0;
UCOUNT ret_cnt = 0; UCOUNT ret_cnt = 0;
ULONG idx;
UWORD secsize; UWORD secsize;
UCOUNT to_xfer = count; UCOUNT to_xfer = count;
@ -1666,7 +1647,7 @@ UCOUNT readblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
if (fnp->f_flags.f_ddir) if (fnp->f_flags.f_ddir)
xfr_cnt = min(to_xfer, secsize - fnp->f_boff); xfr_cnt = min(to_xfer, secsize - fnp->f_boff);
else else
xfr_cnt = min(min(to_xfer, secsize - fnp->f_boff), xfr_cnt = (UWORD)min(min(to_xfer, secsize - fnp->f_boff),
fnp->f_dir.dir_size - fnp->f_offset); fnp->f_dir.dir_size - fnp->f_offset);
fbcopy((BYTE FAR *) & bp->b_buffer[fnp->f_boff], buffer, xfr_cnt); fbcopy((BYTE FAR *) & bp->b_buffer[fnp->f_boff], buffer, xfr_cnt);
@ -1688,7 +1669,6 @@ UCOUNT writeblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
struct buffer FAR *bp; struct buffer FAR *bp;
UCOUNT xfr_cnt = 0; UCOUNT xfr_cnt = 0;
UCOUNT ret_cnt = 0; UCOUNT ret_cnt = 0;
ULONG idx;
UWORD secsize; UWORD secsize;
UCOUNT to_xfer = count; UCOUNT to_xfer = count;
@ -1927,11 +1907,6 @@ COUNT dos_read(COUNT fd, VOID FAR * buffer, UCOUNT count)
return err != SUCCESS ? err : xfr; return err != SUCCESS ? err : xfr;
} }
COUNT FAR init_call_dos_read(COUNT fd, VOID FAR * buffer, UCOUNT count)
{
return dos_read(fd, buffer, count);
}
#ifndef IPL #ifndef IPL
COUNT dos_write(COUNT fd, VOID FAR * buffer, UCOUNT count) COUNT dos_write(COUNT fd, VOID FAR * buffer, UCOUNT count)
{ {
@ -2016,7 +1991,7 @@ LONG dos_lseek(COUNT fd, LONG foffset, COUNT origin)
} }
/* returns the number of unused clusters */ /* returns the number of unused clusters */
UWORD dos_free(struct dpb * dpbp) UWORD dos_free(struct dpb FAR *dpbp)
{ {
/* There's an unwritten rule here. All fs */ /* There's an unwritten rule here. All fs */
/* cluster start at 2 and run to max_cluster+2 */ /* cluster start at 2 and run to max_cluster+2 */
@ -2029,7 +2004,7 @@ UWORD dos_free(struct dpb * dpbp)
UWORD max_cluster = ( ((ULONG) dpbp->dpb_size * (ULONG) (dpbp->dpb_clsmask + 1)) UWORD max_cluster = ( ((ULONG) dpbp->dpb_size * (ULONG) (dpbp->dpb_clsmask + 1))
/ (dpbp->dpb_clsmask + 1) ) + 1; / (dpbp->dpb_clsmask + 1) ) + 1;
if (dpbp->dpb_nfreeclst != UNKNCLUSTER) if (dpbp->dpb_nfreeclst != UNKNCLSTFREE)
return dpbp->dpb_nfreeclst; return dpbp->dpb_nfreeclst;
else else
{ {
@ -2048,18 +2023,13 @@ UWORD dos_free(struct dpb * dpbp)
#ifndef IPL #ifndef IPL
COUNT dos_cd(struct cds FAR * cdsp, BYTE FAR *PathName) COUNT dos_cd(struct cds FAR * cdsp, BYTE FAR *PathName)
{ {
BYTE FAR *p;
struct f_node FAR *fnp; struct f_node FAR *fnp;
REG struct dpb *dpbp;
COUNT x;
/* first check for valid drive */ /* first check for valid drive */
if (cdsp->cdsDpb == 0) if (cdsp->cdsDpb == 0)
return DE_INVLDDRV; return DE_INVLDDRV;
if ((media_check(cdsp->cdsDpb) < 0))
dpbp = (struct dpb *)cdsp->cdsDpb;
if ((media_check(dpbp) < 0))
return DE_INVLDDRV; return DE_INVLDDRV;
/* now test for its existance. If it doesn't, return an error. */ /* now test for its existance. If it doesn't, return an error. */
@ -2174,11 +2144,50 @@ COUNT dos_setfattr(BYTE FAR * name, UWORD FAR * attrp)
} }
#endif #endif
COUNT media_check(REG struct dpb * dpbp) VOID bpb_to_dpb(bpb FAR *bpbp, REG struct dpb FAR * dpbp)
{ {
bpb FAR *bpbp;
ULONG size; ULONG size;
REG COUNT i; REG COUNT i;
dpbp->dpb_mdb = bpbp->bpb_mdesc;
dpbp->dpb_secsize = bpbp->bpb_nbyte;
dpbp->dpb_clsmask = bpbp->bpb_nsector - 1;
dpbp->dpb_fatstrt = bpbp->bpb_nreserved;
dpbp->dpb_fats = bpbp->bpb_nfat;
dpbp->dpb_dirents = bpbp->bpb_ndirent;
size = bpbp->bpb_nsize == 0 ?
bpbp->bpb_huge :
(ULONG) bpbp->bpb_nsize;
/* patch point
dpbp->dpb_size = size / ((ULONG) bpbp->bpb_nsector);
*/
dpbp->dpb_fatsize = bpbp->bpb_nfsect;
dpbp->dpb_dirstrt = dpbp->dpb_fatstrt
+ dpbp->dpb_fats * dpbp->dpb_fatsize;
dpbp->dpb_data = dpbp->dpb_dirstrt
+ ((DIRENT_SIZE * dpbp->dpb_dirents
+ (dpbp->dpb_secsize - 1))
/ dpbp->dpb_secsize);
/*
Michal Meller <maceman@priv4,onet.pl> patch to jimtabor
*/
dpbp->dpb_size = ((size - dpbp->dpb_data) / ((ULONG) bpbp->bpb_nsector) + 1);
dpbp->dpb_flags = 0;
/* dpbp->dpb_next = (struct dpb FAR *)-1;*/
dpbp->dpb_cluster = UNKNCLUSTER;
dpbp->dpb_nfreeclst = UNKNCLSTFREE; /* number of free clusters */
for (i = 1, dpbp->dpb_shftcnt = 0;
i < (sizeof(dpbp->dpb_shftcnt) * 8); /* 8 bit bytes in C */
dpbp->dpb_shftcnt++, i <<= 1)
{
if (i >= bpbp->bpb_nsector)
break;
}
}
COUNT media_check(REG struct dpb FAR * dpbp)
{
/* First test if anyone has changed the removable media */ /* First test if anyone has changed the removable media */
FOREVER FOREVER
{ {
@ -2257,42 +2266,7 @@ COUNT media_check(REG struct dpb * dpbp)
} }
} }
} }
bpbp = MediaReqHdr.r_bpptr; bpb_to_dpb(MediaReqHdr.r_bpptr, dpbp);
dpbp->dpb_mdb = bpbp->bpb_mdesc;
dpbp->dpb_secsize = bpbp->bpb_nbyte;
dpbp->dpb_clsmask = bpbp->bpb_nsector - 1;
dpbp->dpb_fatstrt = bpbp->bpb_nreserved;
dpbp->dpb_fats = bpbp->bpb_nfat;
dpbp->dpb_dirents = bpbp->bpb_ndirent;
size = bpbp->bpb_nsize == 0 ?
bpbp->bpb_huge :
(ULONG) bpbp->bpb_nsize;
/* patch point
dpbp->dpb_size = size / ((ULONG) bpbp->bpb_nsector);
*/
dpbp->dpb_fatsize = bpbp->bpb_nfsect;
dpbp->dpb_dirstrt = dpbp->dpb_fatstrt
+ dpbp->dpb_fats * dpbp->dpb_fatsize;
dpbp->dpb_data = dpbp->dpb_dirstrt
+ ((DIRENT_SIZE * dpbp->dpb_dirents
+ (dpbp->dpb_secsize - 1))
/ dpbp->dpb_secsize);
/*
Michal Meller <maceman@priv4,onet.pl> patch to jimtabor
*/
dpbp->dpb_size = ((size - dpbp->dpb_data) / ((ULONG) bpbp->bpb_nsector) + 1);
dpbp->dpb_flags = 0;
/* dpbp->dpb_next = (struct dpb FAR *)-1;*/
dpbp->dpb_cluster = UNKNCLUSTER;
dpbp->dpb_nfreeclst = UNKNCLUSTER; /* number of free clusters */
for (i = 1, dpbp->dpb_shftcnt = 0;
i < (sizeof(dpbp->dpb_shftcnt) * 8); /* 8 bit bytes in C */
dpbp->dpb_shftcnt++, i <<= 1)
{
if (i >= bpbp->bpb_nsector)
break;
}
return SUCCESS; return SUCCESS;
} }
} }
@ -2306,7 +2280,7 @@ struct f_node FAR *xlt_fd(COUNT fd)
/* translate the f_node pointer into an fd */ /* translate the f_node pointer into an fd */
COUNT xlt_fnp(struct f_node FAR * fnp) COUNT xlt_fnp(struct f_node FAR * fnp)
{ {
return fnp - f_nodes; return (COUNT)(fnp - f_nodes);
} }
#if 0 #if 0

View File

@ -35,6 +35,9 @@ static BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.4 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.3 2000/05/25 20:56:21 jimtabor * Revision 1.3 2000/05/25 20:56:21 jimtabor
* Fixed project history * Fixed project history
* *
@ -99,10 +102,10 @@ static BYTE *RcsId = "$Id$";
*/ */
#ifdef PROTO #ifdef PROTO
UCOUNT link_fat12(struct dpb *, UCOUNT, UCOUNT); UCOUNT link_fat12(struct dpb FAR *, UCOUNT, UCOUNT);
UCOUNT link_fat16(struct dpb *, UCOUNT, UCOUNT); UCOUNT link_fat16(struct dpb FAR *, UCOUNT, UCOUNT);
UWORD next_cl12(struct dpb *, UCOUNT); UWORD next_cl12(struct dpb FAR *, UCOUNT);
UWORD next_cl16(struct dpb *, UCOUNT); UWORD next_cl16(struct dpb FAR *, UCOUNT);
#else #else
UCOUNT link_fat12(); UCOUNT link_fat12();
UCOUNT link_fat16(); UCOUNT link_fat16();
@ -132,7 +135,7 @@ UWORD next_cl16();
/* 12 bytes are compressed to 9 bytes */ /* 12 bytes are compressed to 9 bytes */
/* */ /* */
UCOUNT link_fat(struct dpb *dpbp, UCOUNT Cluster1, REG UCOUNT Cluster2) UCOUNT link_fat(struct dpb FAR *dpbp, UCOUNT Cluster1, REG UCOUNT Cluster2)
{ {
if (ISFAT12(dpbp)) if (ISFAT12(dpbp))
return link_fat12(dpbp, Cluster1, Cluster2); return link_fat12(dpbp, Cluster1, Cluster2);
@ -142,7 +145,7 @@ UCOUNT link_fat(struct dpb *dpbp, UCOUNT Cluster1, REG UCOUNT Cluster2)
return DE_BLKINVLD; return DE_BLKINVLD;
} }
UCOUNT link_fat16(struct dpb * dpbp, UCOUNT Cluster1, UCOUNT Cluster2) UCOUNT link_fat16(struct dpb FAR *dpbp, UCOUNT Cluster1, UCOUNT Cluster2)
{ {
UCOUNT idx; UCOUNT idx;
struct buffer FAR *bp; struct buffer FAR *bp;
@ -164,7 +167,7 @@ UCOUNT link_fat16(struct dpb * dpbp, UCOUNT Cluster1, UCOUNT Cluster2)
/* form an index so that we can read the block as a */ /* form an index so that we can read the block as a */
/* byte array */ /* byte array */
idx = (((LONG) Cluster1) * SIZEOF_CLST16) % dpbp->dpb_secsize; idx = (UWORD)((((LONG) Cluster1) * SIZEOF_CLST16) % dpbp->dpb_secsize);
/* Finally, put the word into the buffer and mark the */ /* Finally, put the word into the buffer and mark the */
/* buffer as dirty. */ /* buffer as dirty. */
@ -177,21 +180,21 @@ UCOUNT link_fat16(struct dpb * dpbp, UCOUNT Cluster1, UCOUNT Cluster2)
{ {
/* update the free space count for returned */ /* update the free space count for returned */
/* cluster */ /* cluster */
if (dpbp->dpb_nfreeclst != UNKNCLUSTER) if (dpbp->dpb_nfreeclst != UNKNCLSTFREE)
++dpbp->dpb_nfreeclst; ++dpbp->dpb_nfreeclst;
} }
else else
{ {
/* update the free space count for removed */ /* update the free space count for removed */
/* cluster */ /* cluster */
if (dpbp->dpb_nfreeclst != UNKNCLUSTER) if (dpbp->dpb_nfreeclst != UNKNCLSTFREE)
--dpbp->dpb_nfreeclst; --dpbp->dpb_nfreeclst;
} }
return SUCCESS; return SUCCESS;
} }
UCOUNT link_fat12(struct dpb * dpbp, UCOUNT Cluster1, UCOUNT Cluster2) UCOUNT link_fat12(struct dpb FAR *dpbp, UCOUNT Cluster1, UCOUNT Cluster2)
{ {
REG UBYTE FAR *fbp0, REG UBYTE FAR *fbp0,
FAR * fbp1; FAR * fbp1;
@ -253,7 +256,7 @@ UCOUNT link_fat12(struct dpb * dpbp, UCOUNT Cluster1, UCOUNT Cluster2)
else else
{ {
*fbp0 = Cluster2 & 0xff; *fbp0 = Cluster2 & 0xff;
*fbp1 = (*fbp1 & 0xf0) | (Cluster2 >> 8) & 0x0f; *fbp1 = (*fbp1 & 0xf0) | ((Cluster2 >> 8) & 0x0f);
} }
/* update the free space count */ /* update the free space count */
@ -261,14 +264,14 @@ UCOUNT link_fat12(struct dpb * dpbp, UCOUNT Cluster1, UCOUNT Cluster2)
{ {
/* update the free space count for returned */ /* update the free space count for returned */
/* cluster */ /* cluster */
if (dpbp->dpb_nfreeclst != UNKNCLUSTER) if (dpbp->dpb_nfreeclst != UNKNCLSTFREE)
++dpbp->dpb_nfreeclst; ++dpbp->dpb_nfreeclst;
} }
else else
{ {
/* update the free space count for removed */ /* update the free space count for removed */
/* cluster */ /* cluster */
if (dpbp->dpb_nfreeclst != UNKNCLUSTER) if (dpbp->dpb_nfreeclst != UNKNCLSTFREE)
--dpbp->dpb_nfreeclst; --dpbp->dpb_nfreeclst;
} }
@ -277,7 +280,7 @@ UCOUNT link_fat12(struct dpb * dpbp, UCOUNT Cluster1, UCOUNT Cluster2)
/* Given the disk parameters, and a cluster number, this function /* Given the disk parameters, and a cluster number, this function
looks at the FAT, and returns the next cluster in the clain. */ looks at the FAT, and returns the next cluster in the clain. */
UWORD next_cluster(struct dpb * dpbp, REG UCOUNT ClusterNum) UWORD next_cluster(struct dpb FAR *dpbp, REG UCOUNT ClusterNum)
{ {
if (ISFAT12(dpbp)) if (ISFAT12(dpbp))
return next_cl12(dpbp, ClusterNum); return next_cl12(dpbp, ClusterNum);
@ -287,7 +290,7 @@ UWORD next_cluster(struct dpb * dpbp, REG UCOUNT ClusterNum)
return LONG_LAST_CLUSTER; return LONG_LAST_CLUSTER;
} }
UWORD next_cl16(struct dpb * dpbp, REG UCOUNT ClusterNum) UWORD next_cl16(struct dpb FAR *dpbp, REG UCOUNT ClusterNum)
{ {
UCOUNT idx; UCOUNT idx;
struct buffer FAR *bp; struct buffer FAR *bp;
@ -309,7 +312,7 @@ UWORD next_cl16(struct dpb * dpbp, REG UCOUNT ClusterNum)
/* form an index so that we can read the block as a */ /* form an index so that we can read the block as a */
/* byte array */ /* byte array */
idx = (((LONG) ClusterNum) * SIZEOF_CLST16) % dpbp->dpb_secsize; idx = (ClusterNum * SIZEOF_CLST16) % dpbp->dpb_secsize;
/* Get the cluster number, */ /* Get the cluster number, */
fgetword((VOID FAR *) & (bp->b_buffer[idx]), (WORD FAR *) & RetCluster); fgetword((VOID FAR *) & (bp->b_buffer[idx]), (WORD FAR *) & RetCluster);
@ -318,7 +321,7 @@ UWORD next_cl16(struct dpb * dpbp, REG UCOUNT ClusterNum)
return RetCluster; return RetCluster;
} }
UWORD next_cl12(struct dpb * dpbp, REG UCOUNT ClusterNum) UWORD next_cl12(struct dpb FAR *dpbp, REG UCOUNT ClusterNum)
{ {
REG UBYTE FAR *fbp0, REG UBYTE FAR *fbp0,
FAR * fbp1; FAR * fbp1;
@ -373,7 +376,7 @@ UWORD next_cl12(struct dpb * dpbp, REG UCOUNT ClusterNum)
/* Now to unpack the contents of the FAT entry. Odd and */ /* Now to unpack the contents of the FAT entry. Odd and */
/* even bytes are packed differently. */ /* even bytes are packed differently. */
if (ClusterNum & 0x01) if (ClusterNum & 0x01)
ClusterNum = ((*fbp0 & 0xf0) >> 4) | *fbp1 << 4; ClusterNum = ((*fbp0 & 0xf0) >> 4) | (*fbp1 << 4);
else else
ClusterNum = *fbp0 | ((*fbp1 & 0x0f) << 8); ClusterNum = *fbp0 | ((*fbp1 & 0x0f) << 8);

View File

@ -35,6 +35,9 @@ static BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.9 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.8 2001/03/30 22:27:42 bartoldeman * Revision 1.8 2001/03/30 22:27:42 bartoldeman
* Saner lastdrive handling. * Saner lastdrive handling.
* *
@ -131,7 +134,7 @@ fcb FAR *CommonFcbInit(xfcb FAR * lpExtFcb, BYTE * pszBuffer, COUNT * pCurDrive)
void FcbNameInit(fcb FAR * lpFcb, BYTE * pszBuffer, COUNT * pCurDrive); void FcbNameInit(fcb FAR * lpFcb, BYTE * pszBuffer, COUNT * pCurDrive);
sft FAR *FcbGetSft(COUNT SftIndex); sft FAR *FcbGetSft(COUNT SftIndex);
VOID FcbNextRecord(fcb FAR * lpFcb); VOID FcbNextRecord(fcb FAR * lpFcb);
sft FAR *FcbGetFreeSft(WORD FAR * sft_idx); /* sft FAR *FcbGetFreeSft(WORD FAR * sft_idx); */
BOOL FcbCalcRec(xfcb FAR * lpXfcb); BOOL FcbCalcRec(xfcb FAR * lpXfcb);
VOID MoveDirInfo(dmatch FAR * lpDmatch, struct dirent FAR * lpDir); VOID MoveDirInfo(dmatch FAR * lpDmatch, struct dirent FAR * lpDir);
#else #else
@ -140,7 +143,7 @@ fcb FAR *CommonFcbInit();
void FcbNameInit(); void FcbNameInit();
sft FAR *FcbGetSft(); sft FAR *FcbGetSft();
VOID FcbNextRecord(); VOID FcbNextRecord();
sft FAR *FcbGetFreeSft(); /* sft FAR *FcbGetFreeSft(); */
BOOL FcbCalcRec(); BOOL FcbCalcRec();
VOID MoveDirInfo(); VOID MoveDirInfo();
#endif #endif
@ -150,12 +153,12 @@ static dmatch Dmatch;
VOID FatGetDrvData(COUNT drive, COUNT FAR * spc, COUNT FAR * bps, VOID FatGetDrvData(COUNT drive, COUNT FAR * spc, COUNT FAR * bps,
COUNT FAR * nc, BYTE FAR ** mdp) COUNT FAR * nc, BYTE FAR ** mdp)
{ {
struct dpb *dpbp; struct dpb FAR *dpbp;
printf("FGDD\n"); printf("FGDD\n");
/* first check for valid drive */ /* first check for valid drive */
if ((drive < 0) || (drive >= lastdrive) || (drive >= NDEVS)) if ((UCOUNT)drive >= lastdrive)
{ {
*spc = -1; *spc = -1;
return; return;
@ -168,7 +171,7 @@ VOID FatGetDrvData(COUNT drive, COUNT FAR * spc, COUNT FAR * bps,
*spc = -1; *spc = -1;
return; return;
} }
dpbp = (struct dpb *)CDSp->cds_table[drive].cdsDpb; dpbp = CDSp->cds_table[drive].cdsDpb;
dpbp->dpb_flags = -1; dpbp->dpb_flags = -1;
if ((media_check(dpbp) < 0)) if ((media_check(dpbp) < 0))
{ {
@ -181,8 +184,8 @@ VOID FatGetDrvData(COUNT drive, COUNT FAR * spc, COUNT FAR * bps,
*spc = dpbp->dpb_clsmask + 1; *spc = dpbp->dpb_clsmask + 1;
*bps = dpbp->dpb_secsize; *bps = dpbp->dpb_secsize;
/* Point to the media desctriptor fotr this drive */ /* Point to the media desctriptor for this drive */
*mdp = &(dpbp->dpb_mdb); *mdp = (BYTE FAR*)&(dpbp->dpb_mdb);
} }
#define PARSE_SEP_STOP 0x01 #define PARSE_SEP_STOP 0x01
@ -347,6 +350,13 @@ static VOID FcbNextRecord(fcb FAR * lpFcb)
} }
} }
static ULONG FcbRec(VOID)
{
UWORD tmp = 128;
return ((ULONG)lpFcb->fcb_cublock * tmp) + lpFcb->fcb_curec;
}
BOOL FcbRead(xfcb FAR * lpXfcb, COUNT * nErrorCode) BOOL FcbRead(xfcb FAR * lpXfcb, COUNT * nErrorCode)
{ {
sft FAR *s; sft FAR *s;
@ -367,8 +377,7 @@ BOOL FcbRead(xfcb FAR * lpXfcb, COUNT * nErrorCode)
/* Now update the fcb and compute where we need to position */ /* Now update the fcb and compute where we need to position */
/* to. */ /* to. */
lPosit = ((lpFcb->fcb_cublock * 128) + lpFcb->fcb_curec) lPosit = FcbRec() * lpFcb->fcb_recsiz;
* lpFcb->fcb_recsiz;
if (SftSeek(s, lPosit, 0) != SUCCESS) if (SftSeek(s, lPosit, 0) != SUCCESS)
{ {
*nErrorCode = FCB_ERR_EOF; *nErrorCode = FCB_ERR_EOF;
@ -439,8 +448,7 @@ BOOL FcbWrite(xfcb FAR * lpXfcb, COUNT * nErrorCode)
/* Now update the fcb and compute where we need to position */ /* Now update the fcb and compute where we need to position */
/* to. */ /* to. */
lPosit = ((lpFcb->fcb_cublock * 128) + lpFcb->fcb_curec) lPosit = FcbRec() * lpFcb->fcb_recsiz;
* lpFcb->fcb_recsiz;
if (SftSeek(s, lPosit, 0) != SUCCESS) if (SftSeek(s, lPosit, 0) != SUCCESS)
{ {
*nErrorCode = FCB_ERR_EOF; *nErrorCode = FCB_ERR_EOF;
@ -511,30 +519,27 @@ BOOL FcbGetFileSize(xfcb FAR * lpXfcb)
BOOL FcbSetRandom(xfcb FAR * lpXfcb) BOOL FcbSetRandom(xfcb FAR * lpXfcb)
{ {
LONG lPosit;
/* Convert to fcb if necessary */ /* Convert to fcb if necessary */
lpFcb = ExtFcbToFcb(lpXfcb); lpFcb = ExtFcbToFcb(lpXfcb);
/* Now update the fcb and compute where we need to position */ /* Now update the fcb and compute where we need to position */
/* to. */ /* to. */
lpFcb->fcb_rndm = (lpFcb->fcb_cublock * 128) lpFcb->fcb_rndm = FcbRec();
+ lpFcb->fcb_curec;
return TRUE; return TRUE;
} }
BOOL FcbCalcRec(xfcb FAR * lpXfcb) BOOL FcbCalcRec(xfcb FAR * lpXfcb)
{ {
LONG lPosit; UWORD div=128;
/* Convert to fcb if necessary */ /* Convert to fcb if necessary */
lpFcb = ExtFcbToFcb(lpXfcb); lpFcb = ExtFcbToFcb(lpXfcb);
/* Now update the fcb and compute where we need to position */ /* Now update the fcb and compute where we need to position */
/* to. */ /* to. */
lpFcb->fcb_cublock = lpFcb->fcb_rndm / 128; lpFcb->fcb_cublock = lpFcb->fcb_rndm / div;
lpFcb->fcb_curec = lpFcb->fcb_rndm % 128; lpFcb->fcb_curec = lpFcb->fcb_rndm & 127;
return TRUE; return TRUE;
} }
@ -551,7 +556,7 @@ BOOL FcbRandomBlockRead(xfcb FAR * lpXfcb, COUNT nRecords, COUNT * nErrorCode)
while ((--nRecords > 0) && (*nErrorCode == 0)); while ((--nRecords > 0) && (*nErrorCode == 0));
/* Now update the fcb */ /* Now update the fcb */
lpFcb->fcb_rndm = lpFcb->fcb_cublock * 128 + lpFcb->fcb_curec; lpFcb->fcb_rndm = FcbRec();
return TRUE; return TRUE;
} }
@ -568,12 +573,13 @@ BOOL FcbRandomBlockWrite(xfcb FAR * lpXfcb, COUNT nRecords, COUNT * nErrorCode)
while ((--nRecords > 0) && (*nErrorCode == 0)); while ((--nRecords > 0) && (*nErrorCode == 0));
/* Now update the fcb */ /* Now update the fcb */
lpFcb->fcb_rndm = lpFcb->fcb_cublock * 128 + lpFcb->fcb_curec; lpFcb->fcb_rndm = FcbRec();
return TRUE; return TRUE;
} }
BOOL FcbRandomRead(xfcb FAR * lpXfcb, COUNT * nErrorCode) BOOL FcbRandomIO(xfcb FAR * lpXfcb, COUNT * nErrorCode,
BOOL (*FcbFunc)(xfcb FAR *, COUNT *))
{ {
UWORD uwCurrentBlock; UWORD uwCurrentBlock;
UBYTE ucCurrentRecord; UBYTE ucCurrentRecord;
@ -586,57 +592,17 @@ BOOL FcbRandomRead(xfcb FAR * lpXfcb, COUNT * nErrorCode)
uwCurrentBlock = lpFcb->fcb_cublock; uwCurrentBlock = lpFcb->fcb_cublock;
ucCurrentRecord = lpFcb->fcb_curec; ucCurrentRecord = lpFcb->fcb_curec;
FcbRead(lpXfcb, nErrorCode); (*FcbFunc)(lpXfcb, nErrorCode);
lpFcb->fcb_cublock = uwCurrentBlock;
lpFcb->fcb_curec = ucCurrentRecord;
return TRUE;
}
BOOL FcbRandomWrite(xfcb FAR * lpXfcb, COUNT * nErrorCode)
{
UWORD uwCurrentBlock;
UBYTE ucCurrentRecord;
FcbCalcRec(lpXfcb);
/* Convert to fcb if necessary */
lpFcb = ExtFcbToFcb(lpXfcb);
uwCurrentBlock = lpFcb->fcb_cublock;
ucCurrentRecord = lpFcb->fcb_curec;
FcbWrite(lpXfcb, nErrorCode);
lpFcb->fcb_cublock = uwCurrentBlock; lpFcb->fcb_cublock = uwCurrentBlock;
lpFcb->fcb_curec = ucCurrentRecord; lpFcb->fcb_curec = ucCurrentRecord;
return TRUE; return TRUE;
} }
/*
static sft FAR *FcbGetFreeSft(WORD FAR * sft_idx) static sft FAR *FcbGetFreeSft(WORD FAR * sft_idx)
{ see get_free_sft in dosfns.c
WORD sys_idx = 0; */
sfttbl FAR *sp;
/* Get the SFT block that contains the SFT */
for (sp = sfthead; sp != (sfttbl FAR *) - 1; sp = sp->sftt_next)
{
REG WORD i;
for (i = 0; i < sp->sftt_count; i++)
{
if (sp->sftt_table[i].sft_count == 0)
{
*sft_idx = sys_idx + i;
return (sft FAR *) & sp->sftt_table[sys_idx + i];
}
}
sys_idx += i;
}
/* If not found, return an error */
return (sft FAR *) - 1;
}
BOOL FcbCreate(xfcb FAR * lpXfcb) BOOL FcbCreate(xfcb FAR * lpXfcb)
{ {
@ -646,7 +612,7 @@ BOOL FcbCreate(xfcb FAR * lpXfcb)
COUNT FcbDrive; COUNT FcbDrive;
/* get a free system file table entry */ /* get a free system file table entry */
if ((sftp = FcbGetFreeSft((WORD FAR *) & sft_idx)) == (sft FAR *) - 1) if ((sftp = get_free_sft((WORD FAR *) & sft_idx)) == (sft FAR *) - 1)
return DE_TOOMANY; return DE_TOOMANY;
/* Build a traditional DOS file name */ /* Build a traditional DOS file name */
@ -654,45 +620,26 @@ BOOL FcbCreate(xfcb FAR * lpXfcb)
/* check for a device */ /* check for a device */
dhp = IsDevice(PriPathName); dhp = IsDevice(PriPathName);
if (dhp) if (dhp || ((sftp->sft_status = dos_creat(PriPathName, 0)) >= 0))
{ {
sftp->sft_count += 1; sftp->sft_count += 1;
sftp->sft_mode = O_RDWR; sftp->sft_mode = O_RDWR;
sftp->sft_attrib = 0; sftp->sft_attrib = 0;
sftp->sft_flags = sftp->sft_flags = dhp ?
((dhp->dh_attr & ~SFT_MASK) & ~SFT_FSHARED) | SFT_FDEVICE | SFT_FEOF; ((dhp->dh_attr & ~SFT_MASK) & ~SFT_FSHARED) | SFT_FDEVICE | SFT_FEOF : 0;
sftp->sft_psp = cu_psp; sftp->sft_psp = cu_psp;
fbcopy(lpFcb->fcb_fname, sftp->sft_name, FNAME_SIZE + FEXT_SIZE); fbcopy(lpFcb->fcb_fname, sftp->sft_name, FNAME_SIZE + FEXT_SIZE);
sftp->sft_dev = dhp; sftp->sft_dev = dhp;
lpFcb->fcb_sftno = sft_idx; lpFcb->fcb_sftno = sft_idx;
lpFcb->fcb_curec = 0; lpFcb->fcb_curec = 0;
lpFcb->fcb_recsiz = 0; lpFcb->fcb_recsiz = (dhp ? 0 : 128);
if (!dhp) lpFcb->fcb_drive = FcbDrive;
lpFcb->fcb_fsize = 0; lpFcb->fcb_fsize = 0;
lpFcb->fcb_date = dos_getdate(); lpFcb->fcb_date = dos_getdate();
lpFcb->fcb_time = dos_gettime(); lpFcb->fcb_time = dos_gettime();
lpFcb->fcb_rndm = 0; lpFcb->fcb_rndm = 0;
return TRUE; return TRUE;
} }
sftp->sft_status = dos_creat(PriPathName, 0);
if (sftp->sft_status >= 0)
{
lpFcb->fcb_drive = FcbDrive;
lpFcb->fcb_sftno = sft_idx;
lpFcb->fcb_curec = 0;
lpFcb->fcb_recsiz = 128;
lpFcb->fcb_fsize = 0;
lpFcb->fcb_date = dos_getdate();
lpFcb->fcb_time = dos_gettime();
lpFcb->fcb_rndm = 0;
sftp->sft_count += 1;
sftp->sft_mode = O_RDWR;
sftp->sft_attrib = 0;
sftp->sft_flags = 0;
sftp->sft_psp = cu_psp;
fbcopy((BYTE FAR *) & lpFcb->fcb_fname, (BYTE FAR *) & sftp->sft_name, FNAME_SIZE + FEXT_SIZE);
return TRUE;
}
else
return FALSE; return FALSE;
} }
@ -707,11 +654,6 @@ static fcb FAR *ExtFcbToFcb(xfcb FAR * lpExtFcb)
static fcb FAR *CommonFcbInit(xfcb FAR * lpExtFcb, BYTE * pszBuffer, static fcb FAR *CommonFcbInit(xfcb FAR * lpExtFcb, BYTE * pszBuffer,
COUNT * pCurDrive) COUNT * pCurDrive)
{ {
BYTE FAR *lpszFcbFname,
*lpszFcbFext;
COUNT nDrvIdx,
nFnameIdx,
nFextIdx;
fcb FAR *lpFcb; fcb FAR *lpFcb;
/* convert to fcb if needed first */ /* convert to fcb if needed first */
@ -726,10 +668,6 @@ static fcb FAR *CommonFcbInit(xfcb FAR * lpExtFcb, BYTE * pszBuffer,
void FcbNameInit(fcb FAR * lpFcb, BYTE * pszBuffer, COUNT * pCurDrive) void FcbNameInit(fcb FAR * lpFcb, BYTE * pszBuffer, COUNT * pCurDrive)
{ {
BYTE FAR *lpszFcbFname,
FAR * lpszFcbFext;
COUNT loop;
/* Build a traditional DOS file name */ /* Build a traditional DOS file name */
if (lpFcb->fcb_drive != 0) if (lpFcb->fcb_drive != 0)
{ {
@ -779,7 +717,7 @@ BOOL FcbOpen(xfcb FAR * lpXfcb)
COUNT FcbDrive; COUNT FcbDrive;
/* get a free system file table entry */ /* get a free system file table entry */
if ((sftp = FcbGetFreeSft((WORD FAR *) & sft_idx)) == (sft FAR *) - 1) if ((sftp = get_free_sft((WORD FAR *) & sft_idx)) == (sft FAR *) - 1)
return DE_TOOMANY; return DE_TOOMANY;
/* Build a traditional DOS file name */ /* Build a traditional DOS file name */
@ -807,7 +745,7 @@ BOOL FcbOpen(xfcb FAR * lpXfcb)
return TRUE; return TRUE;
} }
fbcopy((BYTE FAR *) & lpFcb->fcb_fname, (BYTE FAR *) & sftp->sft_name, FNAME_SIZE + FEXT_SIZE); fbcopy((BYTE FAR *) & lpFcb->fcb_fname, (BYTE FAR *) & sftp->sft_name, FNAME_SIZE + FEXT_SIZE);
if ((FcbDrive < 0) || (FcbDrive >= lastdrive)) { if ((UCOUNT)FcbDrive >= lastdrive) {
return DE_INVLDDRV; return DE_INVLDDRV;
} }
if (CDSp->cds_table[FcbDrive].cdsFlags & CDSNETWDRV) { if (CDSp->cds_table[FcbDrive].cdsFlags & CDSNETWDRV) {
@ -853,7 +791,7 @@ BOOL FcbDelete(xfcb FAR * lpXfcb)
/* Build a traditional DOS file name */ /* Build a traditional DOS file name */
CommonFcbInit(lpXfcb, PriPathName, &FcbDrive); CommonFcbInit(lpXfcb, PriPathName, &FcbDrive);
if ((FcbDrive < 0) || (FcbDrive >= lastdrive)) { if ((UCOUNT)FcbDrive >= lastdrive) {
return DE_INVLDDRV; return DE_INVLDDRV;
} }
current_ldt = &CDSp->cds_table[FcbDrive]; current_ldt = &CDSp->cds_table[FcbDrive];
@ -927,16 +865,8 @@ BOOL FcbRename(xfcb FAR * lpXfcb)
/* First, expand the find match into fcb style */ /* First, expand the find match into fcb style */
/* file name entry */ /* file name entry */
/* Fill with blanks first */ /* Fill with blanks first */
for (pToName = LocalFcb.fcb_fname, nIndex = 0; memset(LocalFcb.fcb_fname, ' ', FNAME_SIZE);
nIndex < FNAME_SIZE; nIndex++) memset(LocalFcb.fcb_fext, ' ', FEXT_SIZE);
{
*pToName++ = ' ';
}
for (pToName = LocalFcb.fcb_fext, nIndex = 0;
nIndex < FEXT_SIZE; nIndex++)
{
*pToName++ = ' ';
}
/* next move in the file name while overwriting */ /* next move in the file name while overwriting */
/* the filler blanks */ /* the filler blanks */
@ -1006,21 +936,14 @@ void MoveDirInfo(dmatch FAR * lpDmatch, struct dirent FAR * lpDir)
/* First, expand the find match into dir style */ /* First, expand the find match into dir style */
/* file name entry */ /* file name entry */
/* Fill with blanks first */ /* Fill with blanks first */
for (lpToName = lpDir->dir_name, nIndex = 0;
nIndex < FNAME_SIZE; nIndex++) fmemset(lpDir->dir_name, ' ', FNAME_SIZE);
{ fmemset(lpDir->dir_ext , ' ', FEXT_SIZE );
*lpToName++ = ' ';
}
for (lpToName = lpDir->dir_ext, nIndex = 0;
nIndex < FEXT_SIZE; nIndex++)
{
*lpToName++ = ' ';
}
/* next move in the file name while overwriting */ /* next move in the file name while overwriting */
/* the filler blanks */ /* the filler blanks */
lpszFrom = lpDmatch->dm_name; lpszFrom = lpDmatch->dm_name;
lpToName = lpDir->dir_name; lpToName = (BYTE FAR *)lpDir->dir_name;
for (nIndex = 0; nIndex < FNAME_SIZE; nIndex++) for (nIndex = 0; nIndex < FNAME_SIZE; nIndex++)
{ {
if (*lpszFrom != 0 && *lpszFrom != '.') if (*lpszFrom != 0 && *lpszFrom != '.')
@ -1033,7 +956,7 @@ void MoveDirInfo(dmatch FAR * lpDmatch, struct dirent FAR * lpDir)
{ {
if (*lpszFrom == '.') if (*lpszFrom == '.')
++lpszFrom; ++lpszFrom;
lpToName = lpDir->dir_ext; lpToName = (BYTE FAR *)lpDir->dir_ext;
for (nIndex = 0; nIndex < FEXT_SIZE; nIndex++) for (nIndex = 0; nIndex < FEXT_SIZE; nIndex++)
{ {
if (*lpszFrom != '\0') if (*lpszFrom != '\0')
@ -1098,10 +1021,8 @@ BOOL FcbClose(xfcb FAR * lpXfcb)
BOOL FcbFindFirst(xfcb FAR * lpXfcb) BOOL FcbFindFirst(xfcb FAR * lpXfcb)
{ {
BYTE FAR *lpOldDta;
BYTE FAR *lpDir; BYTE FAR *lpDir;
COUNT nIdx, COUNT FcbDrive;
FcbDrive;
psp FAR *lpPsp = MK_FP(cu_psp, 0); psp FAR *lpPsp = MK_FP(cu_psp, 0);
/* First, move the dta to a local and change it around to match */ /* First, move the dta to a local and change it around to match */
@ -1152,10 +1073,8 @@ BOOL FcbFindFirst(xfcb FAR * lpXfcb)
BOOL FcbFindNext(xfcb FAR * lpXfcb) BOOL FcbFindNext(xfcb FAR * lpXfcb)
{ {
BYTE FAR *lpOldDta;
BYTE FAR *lpDir; BYTE FAR *lpDir;
COUNT nIdx, COUNT FcbDrive;
FcbDrive;
psp FAR *lpPsp = MK_FP(cu_psp, 0); psp FAR *lpPsp = MK_FP(cu_psp, 0);
/* First, move the dta to a local and change it around to match */ /* First, move the dta to a local and change it around to match */

View File

@ -36,6 +36,9 @@ static BYTE *Globals_hRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.11 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.10 2001/04/02 23:18:30 bartoldeman * Revision 1.10 2001/04/02 23:18:30 bartoldeman
* Misc, zero terminated device names and redirector bugs fixed. * Misc, zero terminated device names and redirector bugs fixed.
* *
@ -226,7 +229,6 @@ static BYTE *Globals_hRcsId = "$Id$";
#define PARSE_MAX 67 /* maximum # of bytes in path */ #define PARSE_MAX 67 /* maximum # of bytes in path */
#define NFILES 16 /* number of files in table */ #define NFILES 16 /* number of files in table */
#define NFCBS 16 /* number of fcbs */ #define NFCBS 16 /* number of fcbs */
#define NDEVS 26 /* number of supported devices */
#define NSTACKS 8 /* number of stacks */ #define NSTACKS 8 /* number of stacks */
#define NLAST 6 /* last drive */ #define NLAST 6 /* last drive */
#define NAMEMAX PARSE_MAX /* Maximum path for CDS */ #define NAMEMAX PARSE_MAX /* Maximum path for CDS */
@ -476,7 +478,7 @@ extern sfttbl
FAR * FCBp; /* FCB table pointer */ FAR * FCBp; /* FCB table pointer */
extern WORD extern WORD
nprotfcb; /* number of protected fcbs */ nprotfcb; /* number of protected fcbs */
extern BYTE extern UBYTE
nblkdev, /* number of block devices */ nblkdev, /* number of block devices */
lastdrive, /* value of last drive */ lastdrive, /* value of last drive */
uppermem_link; /* UMB Link flag */ uppermem_link; /* UMB Link flag */
@ -615,9 +617,6 @@ GLOBAL iregs error_regs; /* registers for dump */
GLOBAL WORD GLOBAL WORD
dump_regs; /* dump registers of bad call */ dump_regs; /* dump registers of bad call */
GLOBAL struct dpb
blk_devices[NDEVS];
GLOBAL struct f_node FAR GLOBAL struct f_node FAR
* f_nodes; /* pointer to the array */ * f_nodes; /* pointer to the array */
@ -635,7 +634,7 @@ GLOBAL iregs
FAR * kstackp; /* kernel stack */ FAR * kstackp; /* kernel stack */
/* Start of configuration variables */ /* Start of configuration variables */
GLOBAL struct config extern struct config
{ {
UBYTE cfgBuffers; /* number of buffers in the system */ UBYTE cfgBuffers; /* number of buffers in the system */
UBYTE cfgFiles; /* number of available files */ UBYTE cfgFiles; /* number of available files */
@ -643,7 +642,7 @@ GLOBAL struct config
UBYTE cfgProtFcbs; /* number of protected FCBs */ UBYTE cfgProtFcbs; /* number of protected FCBs */
BYTE cfgInit[NAMEMAX]; /* init of command.com */ BYTE cfgInit[NAMEMAX]; /* init of command.com */
BYTE cfgInitTail[NAMEMAX]; /* command.com's tail */ BYTE cfgInitTail[NAMEMAX]; /* command.com's tail */
BYTE cfgLastdrive; /* last drive */ UBYTE cfgLastdrive; /* last drive */
BYTE cfgStacks; /* number of stacks */ BYTE cfgStacks; /* number of stacks */
UWORD cfgStackSize; /* stacks size for each stack */ UWORD cfgStackSize; /* stacks size for each stack */
/* COUNTRY= /* COUNTRY=
@ -658,7 +657,7 @@ GLOBAL struct config
VOID FAR *cfgCSYS_data; /* where the loaded data is for PostConfig() */ VOID FAR *cfgCSYS_data; /* where the loaded data is for PostConfig() */
UBYTE cfgP_0_startmode; /* load command.com high or not */ UBYTE cfgP_0_startmode; /* load command.com high or not */
} Config } Config
#ifdef MAIN #ifdef CONFIG
= =
{ {
NUMBUFF, NUMBUFF,
@ -704,11 +703,7 @@ CriticalError(
VOID FAR CharMapSrvc(VOID); VOID FAR CharMapSrvc(VOID);
VOID FAR set_stack(VOID); VOID FAR set_stack(VOID);
VOID FAR restore_stack(VOID); VOID FAR restore_stack(VOID);
#ifndef IN_INIT_MOD
WORD execrh(request FAR *, struct dhdr FAR *); WORD execrh(request FAR *, struct dhdr FAR *);
#endif
VOID FAR init_call_execrh(request FAR *, struct dhdr FAR *);
VOID FAR reloc_call_execrh(request FAR *, struct dhdr FAR *);
VOID exit(COUNT); VOID exit(COUNT);
/*VOID INRPT FAR handle_break(VOID); */ /*VOID INRPT FAR handle_break(VOID); */
VOID tmark(VOID); VOID tmark(VOID);
@ -783,7 +778,7 @@ VOID fputbyte();
/*#define is_leap_year(y) ((y) & 3 ? 0 : (y) % 100 ? 1 : (y) % 400 ? 0 : 1) */ /*#define is_leap_year(y) ((y) & 3 ? 0 : (y) % 100 ? 1 : (y) % 400 ? 0 : 1) */
/* ^Break handling */ /* ^Break handling */
void FAR _init_call_spawn_int23(void); /* procsupt.asm */ void spawn_int23(void); /* procsupt.asm */
int control_break(void); /* break.c */ int control_break(void); /* break.c */
void handle_break(void); /* break.c */ void handle_break(void); /* break.c */

View File

@ -12,11 +12,6 @@
*/ */
#define DosExec reloc_call_DosExec #define DosExec reloc_call_DosExec
#define DosMemAlloc reloc_call_DosMemAlloc #define DosMemAlloc reloc_call_DosMemAlloc
#define dos_close reloc_call_dos_close
#define dos_getdate reloc_call_dos_getdate
#define dos_gettime reloc_call_dos_gettime
#define dos_open reloc_call_dos_open
#define dos_read reloc_call_dos_read
#define execrh reloc_call_execrh #define execrh reloc_call_execrh
#define fatal reloc_call_fatal #define fatal reloc_call_fatal
#define fmemcpy reloc_call_fmemcpy #define fmemcpy reloc_call_fmemcpy
@ -29,3 +24,5 @@
#define strlen reloc_call_strlen #define strlen reloc_call_strlen
#define WritePCClock reloc_call_WritePCClock #define WritePCClock reloc_call_WritePCClock
#define DaysFromYearMonthDay reloc_call_DaysFromYearMonthDay #define DaysFromYearMonthDay reloc_call_DaysFromYearMonthDay
#define p_0 reloc_call_p_0

View File

@ -75,6 +75,9 @@ static BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.3 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.2 2001/03/30 19:30:06 bartoldeman * Revision 1.2 2001/03/30 19:30:06 bartoldeman
* Misc fixes and implementation of SHELLHIGH. See history.txt for details. * Misc fixes and implementation of SHELLHIGH. See history.txt for details.
* *
@ -92,11 +95,11 @@ WORD HMAFree; /* first byte in HMA not yet used */
extern BYTE FAR * FAR XMSDriverAddress; extern BYTE FAR * FAR XMSDriverAddress;
extern FAR _EnableA20(); extern FAR _EnableA20(VOID);
extern FAR _DisableA20(); extern FAR _DisableA20(VOID);
void FAR *DetectXMSDriver(); extern void FAR *DetectXMSDriver(VOID);
#ifdef DEBUG #ifdef DEBUG
#define int3() __int__(3); #define int3() __int__(3);
@ -105,7 +108,7 @@ void FAR *DetectXMSDriver();
#endif #endif
#if defined( DEBUG ) || 1 /* experimental kernel !! */ #ifdef DEBUG
#define HMAInitPrintf(x) printf x #define HMAInitPrintf(x) printf x
#else #else
#define HMAInitPrintf(x) #define HMAInitPrintf(x)
@ -184,7 +187,7 @@ void _DisableHMA()
if so, it simply leaves it on if so, it simply leaves it on
*/ */
int EnableHMA() int EnableHMA(VOID)
{ {
_EnableA20(); _EnableA20();
@ -263,12 +266,13 @@ int MoveKernelToHMA()
/* A) for debugging purpose, suppress this, /* A) for debugging purpose, suppress this,
if any shift key is pressed if any shift key is pressed
*/ */
#ifdef DEBUG
if (KeyboardShiftState() & 0x0f) if (KeyboardShiftState() & 0x0f)
{ {
printf("Keyboard state is %0x, NOT moving to HMA\n",KeyboardShiftState()); printf("Keyboard state is %0x, NOT moving to HMA\n",KeyboardShiftState());
return FALSE; return FALSE;
} }
#endif
/* B) check out, if we can have HMA */ /* B) check out, if we can have HMA */
@ -288,7 +292,7 @@ int MoveKernelToHMA()
len = FP_OFF(_HMATextEnd) - FP_OFF(_HMATextStart); len = FP_OFF(_HMATextEnd) - FP_OFF(_HMATextStart);
HMASource = _HMATextStart; HMASource = (UBYTE FAR *)_HMATextStart;
len += FP_OFF(HMASource) & 0x000f; len += FP_OFF(HMASource) & 0x000f;
@ -340,7 +344,6 @@ int MoveKernelToHMA()
struct RelocationTable FAR *rp, rtemp ; struct RelocationTable FAR *rp, rtemp ;
UWORD HMATextSegment = FP_SEG( _HMATextStart ); UWORD HMATextSegment = FP_SEG( _HMATextStart );
/* verify, that all entries are valid */ /* verify, that all entries are valid */
@ -371,8 +374,46 @@ int MoveKernelToHMA()
rel->callNear = rtemp.callNear; rel->callNear = rtemp.callNear;
rel->callOffset = rtemp.callOffset+5; /* near calls are relative */ rel->callOffset = rtemp.callOffset+5; /* near calls are relative */
} }
}
{
struct initRelocationTable {
UBYTE callNear;
UWORD callOffset;
UBYTE jmpFar;
UWORD jmpOffset;
UWORD jmpSegment;
};
extern struct initRelocationTable
FAR _HMAinitRelocationTableStart[],
FAR _HMAinitRelocationTableEnd[];
struct initRelocationTable FAR *rp, FAR *endrp;
/* verify, that all entries are valid */
UWORD HMATextSegment = FP_SEG( _HMATextStart );
endrp = MK_FP(_CS, FP_OFF(_HMAinitRelocationTableEnd));
for (rp = MK_FP(_CS, FP_OFF(_HMAinitRelocationTableStart)); rp < endrp; rp++)
{
if (
rp->callNear != 0xe8 || /* call NEAR */
rp->jmpFar != 0xea || /* jmp FAR */
rp->jmpSegment != HMATextSegment || /* will only relocate HMA_TEXT */
0)
{
printf("illegal init relocation entry # %d\n",
FP_OFF(rp) - FP_OFF(_HMAinitRelocationTableStart));
goto errorReturn;
}
}
/* OK, all valid, go to relocate*/
for (rp = MK_FP(_CS, FP_OFF(_HMAinitRelocationTableStart)); rp < endrp; rp++)
{
rp->jmpSegment = HMASEGMENT;
rp->callOffset = rp->callOffset-5; /* near calls are relative */
}
} }
{ {
@ -414,7 +455,7 @@ errorReturn:
so: we install this after all drivers have been loaded so: we install this after all drivers have been loaded
*/ */
void InstallVDISK() void InstallVDISK(VOID)
{ {
static struct { /* Boot-Sektor of a RAM-Disk */ static struct { /* Boot-Sektor of a RAM-Disk */
UBYTE dummy1[3]; /* HIMEM.SYS uses 3, but FDXMS uses 2 */ UBYTE dummy1[3]; /* HIMEM.SYS uses 3, but FDXMS uses 2 */
@ -447,7 +488,6 @@ void InstallVDISK()
int init_call_XMScall( void FAR * driverAddress, UWORD ax, UWORD dx); int init_call_XMScall( void FAR * driverAddress, UWORD ax, UWORD dx);
void init_call_intr(int intrnr, iregs *rp);
/* /*
@ -455,7 +495,7 @@ void init_call_intr(int intrnr, iregs *rp);
it might be HIMEM.SYS we just loaded. it might be HIMEM.SYS we just loaded.
*/ */
void ClaimHMA() void ClaimHMA(VOID)
{ {
void FAR *pXMS; void FAR *pXMS;
@ -476,21 +516,6 @@ void ClaimHMA()
} }
} }
} }
void FAR *DetectXMSDriver()
{
iregs regs;
regs.a.x = 0x4300; /* XMS installation check */
init_call_intr(0x2f, &regs);
if ((regs.a.x & 0xff) != 0x80) return NULL;
regs.a.x = 0x4310; /* XMS get driver address */
init_call_intr(0x2f, &regs);
return MK_FP(regs.es, regs.b.x);
}
/* /*
this should be called, after each device driver this should be called, after each device driver

View File

@ -26,6 +26,7 @@
/* Cambridge, MA 02139, USA. */ /* Cambridge, MA 02139, USA. */
/* */ /* */
/****************************************************************/ /****************************************************************/
#define MAIN
#include "portab.h" #include "portab.h"
#include "globals.h" #include "globals.h"
@ -36,6 +37,9 @@ BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.20 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.19 2001/04/02 23:18:30 bartoldeman * Revision 1.19 2001/04/02 23:18:30 bartoldeman
* Misc, zero terminated device names and redirector bugs fixed. * Misc, zero terminated device names and redirector bugs fixed.
* *
@ -345,10 +349,6 @@ VOID int21_service(iregs FAR * r)
p->ps_stack = (BYTE FAR *) r; p->ps_stack = (BYTE FAR *) r;
#ifdef DEBUG #ifdef DEBUG
if (bDumpRegs) if (bDumpRegs)
{ {
@ -359,6 +359,10 @@ VOID int21_service(iregs FAR * r)
} }
#endif #endif
if(r->AH >=0x38 && r->AH <= 0x4F)
CLEAR_CARRY_FLAG();
/* Clear carry by default for these functions */
dispatch: dispatch:
/* Check for Ctrl-Break */ /* Check for Ctrl-Break */
@ -385,7 +389,6 @@ dispatch:
{ {
/* int 21h common error handler */ /* int 21h common error handler */
case 0x64: case 0x64:
case 0x6b:
error_invalid: error_invalid:
r->AX = -DE_INVLDFUNC; r->AX = -DE_INVLDFUNC;
goto error_out; goto error_out;
@ -393,7 +396,7 @@ dispatch:
r->AX = -rc; r->AX = -rc;
error_out: error_out:
CritErrCode = r->AX; /* Maybe set */ CritErrCode = r->AX; /* Maybe set */
r->FLAGS |= FLG_CARRY; SET_CARRY_FLAG();
break; break;
/* case 0x00: --> Simulate a DOS-4C-00 */ /* case 0x00: --> Simulate a DOS-4C-00 */
@ -412,32 +415,40 @@ dispatch:
/* Auxiliary Input */ /* Auxiliary Input */
case 0x03: case 0x03:
r->AL = _sti(); {
COUNT scratch;
GenericRead(STDAUX, 1, (BYTE FAR *) & r->AL, (COUNT FAR *) & scratch, TRUE);
break; break;
}
/* Auxiliary Output */ /* Auxiliary Output */
case 0x04: case 0x04:
sto(r->DL); {
COUNT scratch;
DosWrite(STDAUX, 1, (BYTE FAR *) & r->DL, (COUNT FAR *) &scratch);
break; break;
}
/* Print Character */ /* Print Character */
case 0x05: case 0x05:
sto(r->DL); {
COUNT scratch;
DosWrite(STDPRN, 1, (BYTE FAR *) & r->DL, (COUNT FAR *) &scratch);
break; break;
}
/* Direct Cosole I/O */ /* Direct Console I/O */
case 0x06: case 0x06:
if (r->DL != 0xff) if (r->DL != 0xff)
sto(r->DL); sto(r->DL);
else if (StdinBusy()) else if (StdinBusy())
{ {
r->FLAGS &= ~FLG_ZERO; r->AL = 0x00;
r->AL = _sti(); r->FLAGS |= FLG_ZERO;
} }
else else
{ {
r->AL = 0x00; r->FLAGS &= ~FLG_ZERO;
r->FLAGS |= FLG_ZERO; r->AL = _sti();
} }
break; break;
@ -457,7 +468,7 @@ dispatch:
q = FP_DS_DX; q = FP_DS_DX;
while (*q != '$') while (*q != '$')
++q; ++q;
DosWrite(STDOUT, q - (BYTE FAR*)FP_DS_DX, FP_DS_DX, (COUNT FAR *) & scratch); DosWrite(STDOUT, FP_OFF(q) - FP_OFF(FP_DS_DX), FP_DS_DX, (COUNT FAR *) & scratch);
} }
r->AL = '$'; r->AL = '$';
break; break;
@ -587,6 +598,7 @@ dispatch:
#ifndef TSC #ifndef TSC
case 0x61: case 0x61:
#endif #endif
case 0x6b:
r->AL = 0; r->AL = 0;
break; break;
@ -639,7 +651,7 @@ dispatch:
case 0x1f: case 0x1f:
if (default_drive < lastdrive) if (default_drive < lastdrive)
{ {
struct dpb FAR *dpb = (struct dpb FAR *)CDSp->cds_table[default_drive].cdsDpb; struct dpb FAR *dpb = CDSp->cds_table[default_drive].cdsDpb;
if (dpb == 0) if (dpb == 0)
{ {
r->AL = 0xff; r->AL = 0xff;
@ -660,7 +672,7 @@ dispatch:
/* Random read using FCB */ /* Random read using FCB */
case 0x21: case 0x21:
{ {
if (FcbRandomRead(FP_DS_DX, &CritErrCode)) if (FcbRandomIO(FP_DS_DX, &CritErrCode, FcbRead))
r->AL = 0; r->AL = 0;
else else
r->AL = CritErrCode; r->AL = CritErrCode;
@ -670,7 +682,7 @@ dispatch:
/* Random write using FCB */ /* Random write using FCB */
case 0x22: case 0x22:
{ {
if (FcbRandomWrite(FP_DS_DX, &CritErrCode)) if (FcbRandomIO(FP_DS_DX, &CritErrCode, FcbWrite))
r->AL = 0; r->AL = 0;
else else
r->AL = CritErrCode; r->AL = CritErrCode;
@ -851,8 +863,7 @@ dispatch:
struct dpb FAR *dpb = CDSp->cds_table[r->DL].cdsDpb; struct dpb FAR *dpb = CDSp->cds_table[r->DL].cdsDpb;
if (dpb == 0 || if (dpb == 0 ||
(CDSp->cds_table[r->DL].cdsFlags & CDSNETWDRV) || (CDSp->cds_table[r->DL].cdsFlags & CDSNETWDRV) ||
FP_SEG(dpb) != FP_SEG(&dpb) || /* check if it's a NEAR pointer */ media_check(dpb) < 0)
media_check((struct dpb *)dpb) < 0)
{ {
r->AL = 0xff; r->AL = 0xff;
CritErrCode = 0x0f; CritErrCode = 0x0f;
@ -869,6 +880,10 @@ dispatch:
} }
break; break;
/*
case 0x33:
see int21_syscall
*/
/* Get InDOS flag */ /* Get InDOS flag */
case 0x34: case 0x34:
{ {
@ -894,7 +909,7 @@ dispatch:
/* Dos Get Disk Free Space */ /* Dos Get Disk Free Space */
case 0x36: case 0x36:
DosGetFree( DosGetFree(
(COUNT) r->DL, r->DL,
(COUNT FAR *) & r->AX, (COUNT FAR *) & r->AX,
(COUNT FAR *) & r->BX, (COUNT FAR *) & r->BX,
(COUNT FAR *) & r->CX, (COUNT FAR *) & r->CX,
@ -942,7 +957,6 @@ dispatch:
goto error_invalid; goto error_invalid;
r->AX = r->BX = cntry; r->AX = r->BX = cntry;
} }
CLEAR_CARRY_FLAG();
} }
break; break;
@ -951,10 +965,6 @@ dispatch:
rc = DosMkdir((BYTE FAR *) FP_DS_DX); rc = DosMkdir((BYTE FAR *) FP_DS_DX);
if (rc != SUCCESS) if (rc != SUCCESS)
goto error_exit; goto error_exit;
else
{
CLEAR_CARRY_FLAG();
}
break; break;
/* Dos Remove Directory */ /* Dos Remove Directory */
@ -962,20 +972,12 @@ dispatch:
rc = DosRmdir((BYTE FAR *) FP_DS_DX); rc = DosRmdir((BYTE FAR *) FP_DS_DX);
if (rc != SUCCESS) if (rc != SUCCESS)
goto error_exit; goto error_exit;
else
{
CLEAR_CARRY_FLAG();
}
break; break;
/* Dos Change Directory */ /* Dos Change Directory */
case 0x3b: case 0x3b:
if ((rc = DosChangeDir((BYTE FAR *) FP_DS_DX)) < 0) if ((rc = DosChangeDir((BYTE FAR *) FP_DS_DX)) < 0)
goto error_exit; goto error_exit;
else
{
CLEAR_CARRY_FLAG();
}
break; break;
/* Dos Create File */ /* Dos Create File */
@ -983,10 +985,7 @@ dispatch:
if ((rc = DosCreat(FP_DS_DX, r->CX)) < 0) if ((rc = DosCreat(FP_DS_DX, r->CX)) < 0)
goto error_exit; goto error_exit;
else else
{
r->AX = rc; r->AX = rc;
CLEAR_CARRY_FLAG();
}
break; break;
/* Dos Open */ /* Dos Open */
@ -994,61 +993,38 @@ dispatch:
if ((rc = DosOpen(FP_DS_DX, r->AL)) < 0) if ((rc = DosOpen(FP_DS_DX, r->AL)) < 0)
goto error_exit; goto error_exit;
else else
{
r->AX = rc; r->AX = rc;
CLEAR_CARRY_FLAG();
}
break; break;
/* Dos Close */ /* Dos Close */
case 0x3e: case 0x3e:
if ((rc = DosClose(r->BX)) < 0) if ((rc = DosClose(r->BX)) < 0)
goto error_exit; goto error_exit;
else
CLEAR_CARRY_FLAG();
break; break;
/* Dos Read */ /* Dos Read */
case 0x3f: case 0x3f:
rc = DosRead(r->BX, r->CX, FP_DS_DX, (COUNT FAR *) & rc1); rc1 = DosRead(r->BX, r->CX, FP_DS_DX, (COUNT FAR *) & rc);
if (rc != SUCCESS)
if (rc1 != SUCCESS) goto error_exit;
{
r->AX = -rc1;
goto error_out;
}
else else
{ r->AX = rc1;
CLEAR_CARRY_FLAG();
r->AX = rc;
}
break; break;
/* Dos Write */ /* Dos Write */
case 0x40: case 0x40:
rc = DosWrite(r->BX, r->CX, FP_DS_DX, (COUNT FAR *) & rc1); rc1 = DosWrite(r->BX, r->CX, FP_DS_DX, (COUNT FAR *) & rc);
if (rc1 != SUCCESS) if (rc != SUCCESS)
{ goto error_exit;
r->AX = -rc1;
goto error_out;
}
else else
{ r->AX = rc1;
CLEAR_CARRY_FLAG();
r->AX = rc;
}
break; break;
/* Dos Delete File */ /* Dos Delete File */
case 0x41: case 0x41:
rc = DosDelete((BYTE FAR *) FP_DS_DX); rc = DosDelete((BYTE FAR *) FP_DS_DX);
if (rc < 0) if (rc < 0)
{ goto error_exit;
r->AX = -rc;
goto error_out;
}
else
CLEAR_CARRY_FLAG();
break; break;
/* Dos Seek */ /* Dos Seek */
@ -1059,7 +1035,6 @@ dispatch:
{ {
r->DX = (lrc >> 16); r->DX = (lrc >> 16);
r->AX = (UWORD)lrc; r->AX = (UWORD)lrc;
CLEAR_CARRY_FLAG();
} }
break; break;
@ -1069,41 +1044,25 @@ dispatch:
{ {
case 0x00: case 0x00:
rc = DosGetFattr((BYTE FAR *) FP_DS_DX, (UWORD FAR *) & r->CX); rc = DosGetFattr((BYTE FAR *) FP_DS_DX, (UWORD FAR *) & r->CX);
if (rc != SUCCESS)
goto error_exit;
else
{
CLEAR_CARRY_FLAG();
}
break; break;
case 0x01: case 0x01:
rc = DosSetFattr((BYTE FAR *) FP_DS_DX, (UWORD FAR *) & r->CX); rc = DosSetFattr((BYTE FAR *) FP_DS_DX, (UWORD FAR *) & r->CX);
if (rc != SUCCESS)
goto error_exit;
else
CLEAR_CARRY_FLAG();
break; break;
default: default:
goto error_invalid; goto error_invalid;
} }
if (rc != SUCCESS)
goto error_exit;
break; break;
/* Device I/O Control */ /* Device I/O Control */
case 0x44: case 0x44:
{ rc = DosDevIOctl(r);
rc = DosDevIOctl(r, (COUNT FAR *) & rc1);
if (rc1 != SUCCESS) if (rc != SUCCESS)
{ goto error_exit;
r->AX = -rc1;
goto error_out;
}
else{
CLEAR_CARRY_FLAG();
}
}
break; break;
/* Duplicate File Handle */ /* Duplicate File Handle */
@ -1112,10 +1071,7 @@ dispatch:
if (rc < SUCCESS) if (rc < SUCCESS)
goto error_exit; goto error_exit;
else else
{
CLEAR_CARRY_FLAG();
r->AX = rc; r->AX = rc;
}
break; break;
/* Force Duplicate File Handle */ /* Force Duplicate File Handle */
@ -1123,8 +1079,6 @@ dispatch:
rc = DosForceDup(r->BX, r->CX); rc = DosForceDup(r->BX, r->CX);
if (rc < SUCCESS) if (rc < SUCCESS)
goto error_exit; goto error_exit;
else
CLEAR_CARRY_FLAG();
break; break;
/* Get Current Directory */ /* Get Current Directory */
@ -1132,10 +1086,7 @@ dispatch:
if ((rc = DosGetCuDir(r->DL, MK_FP(r->DS, r->SI))) < 0) if ((rc = DosGetCuDir(r->DL, MK_FP(r->DS, r->SI))) < 0)
goto error_exit; goto error_exit;
else else
{
CLEAR_CARRY_FLAG();
r->AX = 0x0100; /*jpp: from interrupt list */ r->AX = 0x0100; /*jpp: from interrupt list */
}
break; break;
/* Allocate memory */ /* Allocate memory */
@ -1146,18 +1097,13 @@ dispatch:
goto error_exit; goto error_exit;
} }
else else
{
++(r->AX); /* DosMemAlloc() returns seg of MCB rather than data */ ++(r->AX); /* DosMemAlloc() returns seg of MCB rather than data */
CLEAR_CARRY_FLAG();
}
break; break;
/* Free memory */ /* Free memory */
case 0x49: case 0x49:
if ((rc = DosMemFree((r->ES) - 1)) < 0) if ((rc = DosMemFree((r->ES) - 1)) < 0)
goto error_exit; goto error_exit;
else
CLEAR_CARRY_FLAG();
break; break;
/* Set memory block size */ /* Set memory block size */
@ -1182,8 +1128,6 @@ dispatch:
#endif #endif
goto error_exit; goto error_exit;
} }
else
CLEAR_CARRY_FLAG();
break; break;
} }
@ -1195,8 +1139,6 @@ dispatch:
if ((rc = DosExec(r->AL, MK_FP(r->ES, r->BX), FP_DS_DX)) if ((rc = DosExec(r->AL, MK_FP(r->ES, r->BX), FP_DS_DX))
!= SUCCESS) != SUCCESS)
goto error_exit; goto error_exit;
else
CLEAR_CARRY_FLAG();
break; break;
/* Terminate Program */ /* Terminate Program */
@ -1242,40 +1184,31 @@ dispatch:
/* Dos Find First */ /* Dos Find First */
case 0x4e: case 0x4e:
{
/* dta for this call is set on entry. This */ /* dta for this call is set on entry. This */
/* needs to be changed for new versions. */ /* needs to be changed for new versions. */
if ((rc = DosFindFirst((UCOUNT) r->CX, (BYTE FAR *) FP_DS_DX)) < 0) if ((rc = DosFindFirst((UCOUNT) r->CX, (BYTE FAR *) FP_DS_DX)) < 0)
goto error_exit; goto error_exit;
else
{
r->AX = 0; r->AX = 0;
CLEAR_CARRY_FLAG();
}
}
break; break;
/* Dos Find Next */ /* Dos Find Next */
case 0x4f: case 0x4f:
{
/* dta for this call is set on entry. This */ /* dta for this call is set on entry. This */
/* needs to be changed for new versions. */ /* needs to be changed for new versions. */
if ((rc = DosFindNext()) < 0) if ((rc = DosFindNext()) < 0)
{ {
r->AX = -rc; if (rc == DE_FILENOTFND)
rc = DE_NFILES;
if (r->AX == 2) goto error_exit;
r->AX = 18;
goto error_out;
} }
else else
{
CLEAR_CARRY_FLAG();
r->AX = -SUCCESS; r->AX = -SUCCESS;
}
}
break; break;
/*
case 0x50:
case 0x51:
see int21_syscall
*/
/* ************UNDOCUMENTED************************************* */ /* ************UNDOCUMENTED************************************* */
/* Get List of Lists */ /* Get List of Lists */
case 0x52: case 0x52:
@ -1288,6 +1221,11 @@ dispatch:
} }
break; break;
case 0x53:
/* DOS 2+ internal - TRANSLATE BIOS PARAMETER BLOCK TO DRIVE PARAM BLOCK */
bpb_to_dpb((bpb FAR *)MK_FP(r->DS, r->SI), (struct dpb FAR *)MK_FP(r->ES, r->BP));
break;
/* Get verify state */ /* Get verify state */
case 0x54: case 0x54:
r->AL = (verify_ena ? TRUE : FALSE); r->AL = (verify_ena ? TRUE : FALSE);
@ -1306,13 +1244,12 @@ dispatch:
if (rc < SUCCESS) if (rc < SUCCESS)
goto error_exit; goto error_exit;
else else
{
CLEAR_CARRY_FLAG(); CLEAR_CARRY_FLAG();
}
break; break;
/* Get/Set File Date and Time */ /* Get/Set File Date and Time */
case 0x57: case 0x57:
CLEAR_CARRY_FLAG();
switch (r->AL) switch (r->AL)
{ {
case 0x00: case 0x00:
@ -1322,8 +1259,6 @@ dispatch:
(time FAR *) & r->CX); /* FileTime */ (time FAR *) & r->CX); /* FileTime */
if (rc < SUCCESS) if (rc < SUCCESS)
goto error_exit; goto error_exit;
else
CLEAR_CARRY_FLAG();
break; break;
case 0x01: case 0x01:
@ -1333,8 +1268,6 @@ dispatch:
(time FAR *) & r->CX); /* FileTime */ (time FAR *) & r->CX); /* FileTime */
if (rc < SUCCESS) if (rc < SUCCESS)
goto error_exit; goto error_exit;
else
CLEAR_CARRY_FLAG();
break; break;
default: default:
@ -1344,6 +1277,7 @@ dispatch:
/* Get/Set Allocation Strategy */ /* Get/Set Allocation Strategy */
case 0x58: case 0x58:
CLEAR_CARRY_FLAG();
switch (r->AL) switch (r->AL)
{ {
case 0x00: case 0x00:
@ -1358,7 +1292,6 @@ dispatch:
case LAST_FIT: case LAST_FIT:
case LAST_FIT_U: case LAST_FIT_U:
case LAST_FIT_UO: case LAST_FIT_UO:
case LARGEST:
case BEST_FIT: case BEST_FIT:
case BEST_FIT_U: case BEST_FIT_U:
case BEST_FIT_UO: case BEST_FIT_UO:
@ -1372,7 +1305,6 @@ dispatch:
goto error_invalid; goto error_invalid;
} }
} }
CLEAR_CARRY_FLAG();
break; break;
case 0x02: case 0x02:
@ -1419,7 +1351,7 @@ dispatch:
/* Create New File */ /* Create New File */
case 0x5b: case 0x5b:
if ((rc = DosOpen(FP_DS_DX, 0)) >= 0) if (!IsDevice(FP_DS_DX) && (rc = DosOpen(FP_DS_DX, 0)) >= 0)
{ {
DosClose(rc); DosClose(rc);
r->AX = 80; r->AX = 80;
@ -1445,10 +1377,8 @@ dispatch:
(((unsigned long)r->CX)<<16)|(((unsigned long)r->DX)&0xffffL), (((unsigned long)r->CX)<<16)|(((unsigned long)r->DX)&0xffffL),
(((unsigned long)r->SI)<<16)|(((unsigned long)r->DI)&0xffffL), (((unsigned long)r->SI)<<16)|(((unsigned long)r->DI)&0xffffL),
((r->AX & 0xff) != 0))) != 0) ((r->AX & 0xff) != 0))) != 0)
r->FLAGS |= FLG_CARRY; goto error_exit;
else
CLEAR_CARRY_FLAG(); CLEAR_CARRY_FLAG();
r->AX = -rc;
break; break;
/* /// End of additions for SHARE. - Ron Cemer */ /* /// End of additions for SHARE. - Ron Cemer */
@ -1482,17 +1412,11 @@ dispatch:
case 0x07: case 0x07:
case 0x08: case 0x08:
case 0x09: case 0x09:
{ rc = -int2f_Remote_call(REM_PRINTREDIR, 0, 0, r->DX, 0, 0, (MK_FP(0, Int21AX)));
COUNT result; if (rc != SUCCESS)
result = int2f_Remote_call(REM_PRINTREDIR, 0, 0, r->DX, 0, 0, (MK_FP(0, Int21AX))); goto error_exit;
r->AX = result;
if (result != SUCCESS) {
goto error_out;
} else {
CLEAR_CARRY_FLAG(); CLEAR_CARRY_FLAG();
}
break; break;
}
default: default:
goto error_invalid; goto error_invalid;
} }
@ -1511,17 +1435,15 @@ dispatch:
break; break;
default: default:
{ rc = -int2f_Remote_call(REM_PRINTSET, r->BX, r->CX, r->DX, (MK_FP(r->ES, r->DI)), r->SI, (MK_FP(r->DS, Int21AX)));
COUNT result; if (rc != SUCCESS) goto error_exit;
result = int2f_Remote_call(REM_PRINTSET, r->BX, r->CX, r->DX, (MK_FP(r->ES, r->DI)), r->SI, (MK_FP(r->DS, Int21AX))); r->AX=SUCCESS;
r->AX = result;
if (result != SUCCESS) goto error_out;
break; break;
} }
}
break; break;
case 0x5f: case 0x5f:
CLEAR_CARRY_FLAG();
switch (r->AL) switch (r->AL)
{ {
case 0x07: case 0x07:
@ -1537,28 +1459,20 @@ dispatch:
break; break;
default: default:
{ rc = -int2f_Remote_call(REM_DOREDIRECT, r->BX, r->CX, r->DX,
COUNT result; (MK_FP(r->ES, r->DI)), r->SI, (MK_FP(r->DS, Int21AX)));
result = int2f_Remote_call(REM_DOREDIRECT, r->BX, r->CX, r->DX, (MK_FP(r->ES, r->DI)), r->SI, (MK_FP(r->DS, Int21AX))); if (rc != SUCCESS)
r->AX = result; goto error_exit;
if (result != SUCCESS) { r->AX=SUCCESS;
goto error_out;
} else {
CLEAR_CARRY_FLAG();
}
break; break;
} }
}
break; break;
case 0x60: /* TRUENAME */ case 0x60: /* TRUENAME */
CLEAR_CARRY_FLAG();
if ((rc = truename(MK_FP(r->DS, r->SI), if ((rc = truename(MK_FP(r->DS, r->SI),
adjust_far(MK_FP(r->ES, r->DI)), TRUE)) != SUCCESS) adjust_far(MK_FP(r->ES, r->DI)), TRUE)) != SUCCESS)
goto error_exit; goto error_exit;
else
{
CLEAR_CARRY_FLAG();
}
break; break;
#ifdef TSC #ifdef TSC
@ -1582,10 +1496,11 @@ dispatch:
break; break;
#endif #endif
/* UNDOCUMENTED: return current psp */ /* UNDOCUMENTED: return current psp
case 0x62: case 0x62: is in int21_syscall
r->BX = cu_psp; r->BX = cu_psp;
break; break;
*/
/* UNDOCUMENTED: Double byte and korean tables */ /* UNDOCUMENTED: Double byte and korean tables */
case 0x63: case 0x63:
@ -1606,6 +1521,10 @@ dispatch:
#endif #endif
break; break;
} }
/*
case 0x64:
see above (invalid)
*/
/* Extended country info */ /* Extended country info */
case 0x65: case 0x65:
@ -1649,6 +1568,7 @@ dispatch:
CLEAR_CARRY_FLAG(); CLEAR_CARRY_FLAG();
break; break;
/* Code Page functions */ /* Code Page functions */
case 0x66: { case 0x66: {
int rc; int rc;
@ -1675,13 +1595,12 @@ dispatch:
if ((rc = SetJFTSize(r->BX)) != SUCCESS) if ((rc = SetJFTSize(r->BX)) != SUCCESS)
goto error_exit; goto error_exit;
else else
{
CLEAR_CARRY_FLAG(); CLEAR_CARRY_FLAG();
}
break; break;
/* Flush file buffer -- dummy function right now. */ /* Flush file buffer -- COMMIT FILE -- dummy function right now. */
case 0x68: case 0x68:
case 0x6a:
CLEAR_CARRY_FLAG(); CLEAR_CARRY_FLAG();
break; break;
@ -1698,31 +1617,28 @@ dispatch:
case 0x00: case 0x00:
r->AL = 0x0d; r->AL = 0x0d;
r->CX = 0x0866; r->CX = 0x0866;
rc = DosDevIOctl(r, (COUNT FAR *) & rc1); rc = DosDevIOctl(r);
break; break;
case 0x01: case 0x01:
r->AL = 0x0d; r->AL = 0x0d;
r->CX = 0x0846; r->CX = 0x0846;
rc = DosDevIOctl(r, (COUNT FAR *) & rc1); rc = DosDevIOctl(r);
break; break;
} }
r->CX = saveCX; r->CX = saveCX;
if (rc1 != SUCCESS) if (rc != SUCCESS)
{ goto error_exit;
r->AX = -rc1;
goto error_out;
}
else
{
CLEAR_CARRY_FLAG(); CLEAR_CARRY_FLAG();
}
break; break;
} }
else else
r->AL = 0xFF; r->AL = 0xFF;
break; break;
/*
case 0x6a: see case 0x68
case 0x6b: dummy func: return AL=0
*/
#if 0 #if 0
/* Extended Open-Creat, not fully functional.*/ /* Extended Open-Creat, not fully functional.*/
case 0x6c: case 0x6c:
@ -1812,6 +1728,9 @@ dispatch:
default: default:
goto error_invalid; goto error_invalid;
} }
/* case 0x6d and above not implemented : see default; return AL=0 */
#endif #endif
} }

View File

@ -96,8 +96,8 @@ _int3:
retf retf
segment INIT_TEXT segment INIT_TEXT
%if 0
; ;
; void init_call_intr(nr, rp) ; void init_call_intr(nr, rp)
; REG int nr ; REG int nr
@ -159,7 +159,7 @@ init_intr?1:
ret ret
%endif
; ;
; int init_call_XMScall( (WORD FAR * driverAddress)(), WORD AX, WORD DX) ; int init_call_XMScall( (WORD FAR * driverAddress)(), WORD AX, WORD DX)
; ;
@ -177,4 +177,83 @@ _init_call_XMScall:
pop bp pop bp
ret ret
; void FAR *DetectXMSDriver(VOID)
global _DetectXMSDriver
_DetectXMSDriver:
mov ax, 4300h
int 2fh ; XMS installation check
cmp al, 80h
je detected
xor ax, ax
xor dx, dx
ret
detected:
push es
push bx
mov ax, 4310h ; XMS get driver address
int 2fh
mov ax, bx
mov dx, es
pop bx
pop es
ret
global _keycheck
_keycheck:
mov ah, 1
int 16h
ret
;; COUNT init_DosOpen(BYTE *fname, COUNT mode)
global _init_DosOpen
_init_DosOpen:
;; first implementation of init calling DOS through ints:
mov bx, sp
mov ah, 3dh
;; we know that SS=DS during init stage.
mov al, [bx+4]
mov dx, [bx+2]
int 21h
common_exit:
jnc open_no_error
;; AX has file handle
neg ax
;; negative value for error code
open_no_error:
ret
;; COUNT init_DosClose(COUNT hndl)
global _init_DosClose
_init_DosClose:
mov bx, sp
mov bx, [bx+2]
mov ah, 3eh
int 21h
jmp common_exit
;; COUNT init_DosRead(COUNT hndl, BYTE *bp, UCOUNT n)
global _init_DosRead
_init_DosRead:
mov bx, sp
mov cx, [bx+6]
mov dx, [bx+4]
mov bx, [bx+2]
mov ah, 3fh
int 21h
jmp common_exit
;; VOID init_PSPInit(seg psp_seg)
global _init_PSPInit
_init_PSPInit:
push si
mov ah, 55h
mov bx, sp
mov dx, [bx+4]
xor si, si
int 21h
pop si
ret

View File

@ -35,6 +35,9 @@ static BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.8 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.7 2001/03/30 22:27:42 bartoldeman * Revision 1.7 2001/03/30 22:27:42 bartoldeman
* Saner lastdrive handling. * Saner lastdrive handling.
* *
@ -117,7 +120,7 @@ sft FAR *get_sft();
* WARNING: this code is non-portable (8086 specific). * WARNING: this code is non-portable (8086 specific).
*/ */
COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err) COUNT DosDevIOctl(iregs FAR * r)
{ {
sft FAR *s; sft FAR *s;
struct dpb FAR *dpbp; struct dpb FAR *dpbp;
@ -139,10 +142,7 @@ COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err)
/* Get the SFT block that contains the SFT */ /* Get the SFT block that contains the SFT */
if ((s = get_sft(r->BX)) == (sft FAR *) - 1) if ((s = get_sft(r->BX)) == (sft FAR *) - 1)
{ return DE_INVLDHNDL;
*err = DE_INVLDHNDL;
return 0;
}
break; break;
case 0x04: case 0x04:
@ -168,10 +168,7 @@ COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err)
dev = ( r->BL == 0 ? default_drive : r->BL - 1); dev = ( r->BL == 0 ? default_drive : r->BL - 1);
if (dev >= lastdrive) if (dev >= lastdrive)
{ return DE_INVLDDRV;
*err = DE_INVLDDRV;
return 0;
}
else else
{ {
cdsp = &CDSp->cds_table[dev]; cdsp = &CDSp->cds_table[dev];
@ -188,8 +185,7 @@ COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err)
break; break;
default: default:
*err = DE_INVLDFUNC; return DE_INVLDFUNC;
return 0;
} }
switch (r->AL) switch (r->AL)
@ -206,10 +202,7 @@ COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err)
/* sft_flags is a file, return an error because you */ /* sft_flags is a file, return an error because you */
/* can't set the status of a file. */ /* can't set the status of a file. */
if (!(s->sft_flags & SFT_FDEVICE)) if (!(s->sft_flags & SFT_FDEVICE))
{ return DE_INVLDFUNC;
*err = DE_INVLDFUNC;
return 0;
}
/* Set it to what we got in the DL register from the */ /* Set it to what we got in the DL register from the */
/* user. */ /* user. */
@ -243,10 +236,8 @@ COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err)
execrh((request FAR *) & CharReqHdr, s->sft_dev); execrh((request FAR *) & CharReqHdr, s->sft_dev);
if (CharReqHdr.r_status & S_ERROR) if (CharReqHdr.r_status & S_ERROR)
{ return DE_DEVICE;
*err = DE_DEVICE;
return 0;
}
if (r->AL == 0x07) if (r->AL == 0x07)
{ {
r->AL = CharReqHdr.r_status & S_BUSY ? 00 : 0xff; r->AL = CharReqHdr.r_status & S_BUSY ? 00 : 0xff;
@ -263,8 +254,7 @@ COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err)
} }
break; break;
} }
*err = DE_INVLDFUNC; return DE_INVLDFUNC;
return 0;
case 0x0d: case 0x0d:
nMode = C_GENIOCTL; nMode = C_GENIOCTL;
@ -280,16 +270,14 @@ COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err)
IoBlockCommon: IoBlockCommon:
if(!dpbp) if(!dpbp)
{ {
*err = DE_INVLDDRV; return DE_INVLDDRV;
return 0;
} }
if ( ((r->AL == 0x04 ) && !(dpbp->dpb_device->dh_attr & ATTR_IOCTL)) if ( ((r->AL == 0x04 ) && !(dpbp->dpb_device->dh_attr & ATTR_IOCTL))
|| ((r->AL == 0x05 ) && !(dpbp->dpb_device->dh_attr & ATTR_IOCTL)) || ((r->AL == 0x05 ) && !(dpbp->dpb_device->dh_attr & ATTR_IOCTL))
|| ((r->AL == 0x11) && !(dpbp->dpb_device->dh_attr & ATTR_QRYIOCTL)) || ((r->AL == 0x11) && !(dpbp->dpb_device->dh_attr & ATTR_QRYIOCTL))
|| ((r->AL == 0x0d) && !(dpbp->dpb_device->dh_attr & ATTR_GENIOCTL))) || ((r->AL == 0x0d) && !(dpbp->dpb_device->dh_attr & ATTR_GENIOCTL)))
{ {
*err = DE_INVLDFUNC; return DE_INVLDFUNC;
return 0;
} }
@ -304,8 +292,7 @@ COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err)
if (CharReqHdr.r_status & S_ERROR) if (CharReqHdr.r_status & S_ERROR)
{ {
*err = DE_DEVICE; return DE_DEVICE;
return 0;
} }
if (r->AL == 0x08) if (r->AL == 0x08)
{ {
@ -345,16 +332,14 @@ COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err)
case 0x08: case 0x08:
if(!dpbp) if(!dpbp)
{ {
*err = DE_INVLDDRV; return DE_INVLDDRV;
return 0;
} }
if (dpbp->dpb_device->dh_attr & ATTR_EXCALLS) if (dpbp->dpb_device->dh_attr & ATTR_EXCALLS)
{ {
nMode = C_REMMEDIA; nMode = C_REMMEDIA;
goto IoBlockCommon; goto IoBlockCommon;
} }
*err = DE_INVLDFUNC; return DE_INVLDFUNC;
return 0;
case 0x09: case 0x09:
if(cdsp->cdsFlags & CDSNETWDRV) if(cdsp->cdsFlags & CDSNETWDRV)
@ -366,8 +351,7 @@ COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err)
{ {
if(!dpbp) if(!dpbp)
{ {
*err = DE_INVLDDRV; return DE_INVLDDRV;
return 0;
} }
/* Need to add subst bit 15 */ /* Need to add subst bit 15 */
r->DX = dpbp->dpb_device->dh_attr; r->DX = dpbp->dpb_device->dh_attr;
@ -388,8 +372,7 @@ COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err)
IoLogCommon: IoLogCommon:
if(!dpbp) if(!dpbp)
{ {
*err = DE_INVLDDRV; return DE_INVLDDRV;
return 0;
} }
if ((dpbp->dpb_device->dh_attr & ATTR_GENIOCTL)) if ((dpbp->dpb_device->dh_attr & ATTR_GENIOCTL))
{ {
@ -405,22 +388,18 @@ COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err)
dpbp->dpb_device); dpbp->dpb_device);
if (CharReqHdr.r_status & S_ERROR) if (CharReqHdr.r_status & S_ERROR)
*err = DE_ACCESS; return DE_ACCESS;
else else
{ {
r->AL = CharReqHdr.r_unit; r->AL = CharReqHdr.r_unit;
*err = SUCCESS; return SUCCESS;
} }
return 0;
} }
*err = DE_INVLDFUNC; return DE_INVLDFUNC;
return 0;
default: default:
*err = DE_INVLDFUNC; return DE_INVLDFUNC;
return 0;
} }
*err = SUCCESS; return SUCCESS;
return 0;
} }

View File

@ -28,6 +28,9 @@
; $Id$ ; $Id$
; ;
; $Log$ ; $Log$
; Revision 1.9 2001/04/15 03:21:50 bartoldeman
; See history.txt for the list of fixes.
;
; Revision 1.8 2001/03/30 19:30:06 bartoldeman ; Revision 1.8 2001/03/30 19:30:06 bartoldeman
; Misc fixes and implementation of SHELLHIGH. See history.txt for details. ; Misc fixes and implementation of SHELLHIGH. See history.txt for details.
; ;
@ -131,6 +134,8 @@ STACK_SIZE equ 384/2 ; stack allocated in words
..start: ..start:
entry: jmp far kernel_start entry: jmp far kernel_start
beyond_entry: resb 256-(beyond_entry-entry)
; scratch area for data (DOS_PSP)
segment INIT_TEXT segment INIT_TEXT
@ -143,7 +148,7 @@ kernel_start:
mov ax,DGROUP mov ax,DGROUP
cli cli
mov ss,ax mov ss,ax
mov sp,tos mov sp,init_tos
int 12h ; move the init code to higher memory int 12h ; move the init code to higher memory
mov cl,6 mov cl,6
shl ax,cl shl ax,cl
@ -321,10 +326,13 @@ _uppermem_root dw 0 ; 0066 dmd_upper_root
_umb_start dw 0 ; 0068 para of last mem search _umb_start dw 0 ; 0068 para of last mem search
SysVarEnd: SysVarEnd:
; We've got (01fb-006a) some room here: don't use all zeros!
; Some references seem to indicate that this data should start at 01fbh in ; Some references seem to indicate that this data should start at 01fbh in
; order to maintain 100% MS-DOS compatibility. ; order to maintain 100% MS-DOS compatibility.
times (01fbh - (SysVarEnd - DATASTART)) db 0 times (01fbh - ($ - DATASTART)) db 0
global MARK01FBH global MARK01FBH
MARK01FBH equ $ MARK01FBH equ $
@ -600,23 +608,34 @@ __bssend:
segment _BSSEND segment _BSSEND
; blockdev private stack ; blockdev private stack
global blk_stk_top global blk_stk_top
times 256 dw 0 times 192 dw 0
blk_stk_top: blk_stk_top:
; clockdev private stack ; clockdev private stack
global clk_stk_top global clk_stk_top
times 256 dw 0 times 64 dw 0
clk_stk_top: clk_stk_top:
; this is nowhere needed
; interrupt stack ; interrupt stack
global intr_stk_top ; global intr_stk_top
times 256 dw 0 ; times 256 dw 0
intr_stk_top: ;intr_stk_top:
segment ID ; init data
retaddr dd 0 ; return address to jump to from HMA_TEXT
; kernel startup stack ; kernel startup stack
global tos global init_tos
times 128 dw 0 times 256 dw 0
tos: init_tos:
segment ID_B
global __INIT_DATA_START
__INIT_DATA_START:
segment ID_E
global __INIT_DATA_END
__INIT_DATA_END:
segment INIT_TEXT_START segment INIT_TEXT_START
global __InitTextStart global __InitTextStart
@ -640,6 +659,8 @@ segment HMA_TEXT
times 16 db 0 ; filler [ffff:0..ffff:10] times 16 db 0 ; filler [ffff:0..ffff:10]
times 22 db 0 ; filler [sizeof VDISK info] times 22 db 0 ; filler [sizeof VDISK info]
init_ret: jmp far [retaddr] ; return from init_calls.
;End of HMA segment ;End of HMA segment
segment HMA_TEXT_END segment HMA_TEXT_END
global __HMATextEnd global __HMATextEnd
@ -674,128 +695,125 @@ _DGROUP_:
dw DGROUP dw DGROUP
segment INIT_TEXT
call far initforceEnableA20 ; first enable A20 or not
manip_stack_A20:
pop word [retaddr+2] ; get last ret address
pop word [retaddr] ; get near ret address of init caller
mov ax, init_ret ; new init caller ret address
push ax
push word [retaddr+2] ; and back to the relocation entry
mov [retaddr+2], cs ; retaddr is now a far pointer to where we came from
ret
global __HMAinitRelocationTableStart
__HMAinitRelocationTableStart:
extern _DosExec
global _reloc_call_DosExec
_reloc_call_DosExec:
call manip_stack_A20
jmp far _DosExec
extern _DosMemAlloc
global _reloc_call_DosMemAlloc
_reloc_call_DosMemAlloc:
call manip_stack_A20
jmp far _DosMemAlloc
extern _execrh
global _reloc_call_execrh
_reloc_call_execrh:
call manip_stack_A20
jmp far _execrh
extern _fatal
global _reloc_call_fatal
_reloc_call_fatal:
call manip_stack_A20
jmp far _fatal
extern _fmemcpy
global _reloc_call_fmemcpy
_reloc_call_fmemcpy:
call manip_stack_A20
jmp far _fmemcpy
extern _memcpy
global _reloc_call_memcpy
_reloc_call_memcpy:
call manip_stack_A20
jmp far _memcpy
extern _printf
global _reloc_call_printf
_reloc_call_printf:
call manip_stack_A20
jmp far _printf
extern _strcpy
global _reloc_call_strcpy
_reloc_call_strcpy:
call manip_stack_A20
jmp far _strcpy
extern _sti
global _reloc_call_sti
_reloc_call_sti:
call manip_stack_A20
jmp far _sti
extern _strcmp
global _reloc_call_strcmp
_reloc_call_strcmp:
call manip_stack_A20
jmp far _strcmp
extern _strlen
global _reloc_call_strlen
_reloc_call_strlen:
call manip_stack_A20
jmp far _strlen
extern _WritePCClock
global _reloc_call_WritePCClock
_reloc_call_WritePCClock:
call manip_stack_A20
jmp far _WritePCClock
extern _DaysFromYearMonthDay
global _reloc_call_DaysFromYearMonthDay
_reloc_call_DaysFromYearMonthDay:
call manip_stack_A20
jmp far _DaysFromYearMonthDay
extern _fmemset
global _reloc_call_fmemset
_reloc_call_fmemset:
call manip_stack_A20
jmp far _fmemset
extern _p_0
global _reloc_call_p_0
_reloc_call_p_0:
call manip_stack_A20
jmp far _p_0
global __HMAinitRelocationTableEnd
__HMAinitRelocationTableEnd:
segment _TEXT segment _TEXT
global _initforceEnableA20
initforceEnableA20:
call near forceEnableA20
retf
global __HMARelocationTableStart global __HMARelocationTableStart
__HMARelocationTableStart: __HMARelocationTableStart:
extern _init_call_DosExec
global _reloc_call_DosExec
_reloc_call_DosExec: jmp far _init_call_DosExec
call near forceEnableA20
extern _init_call_DosMemAlloc
global _reloc_call_DosMemAlloc
_reloc_call_DosMemAlloc: jmp far _init_call_DosMemAlloc
call near forceEnableA20
extern _init_call_dos_close
global _reloc_call_dos_close
_reloc_call_dos_close: jmp far _init_call_dos_close
call near forceEnableA20
extern _init_call_dos_getdate
global _reloc_call_dos_getdate
_reloc_call_dos_getdate: jmp far _init_call_dos_getdate
call near forceEnableA20
extern _init_call_dos_gettime
global _reloc_call_dos_gettime
_reloc_call_dos_gettime: jmp far _init_call_dos_gettime
call near forceEnableA20
extern _init_call_dos_open
global _reloc_call_dos_open
_reloc_call_dos_open: jmp far _init_call_dos_open
call near forceEnableA20
extern _init_call_dos_read
global _reloc_call_dos_read
_reloc_call_dos_read: jmp far _init_call_dos_read
call near forceEnableA20
extern _init_call_execrh
global _reloc_call_execrh
_reloc_call_execrh: jmp far _init_call_execrh
call near forceEnableA20
extern _init_call_fatal
global _reloc_call_fatal
_reloc_call_fatal: jmp far _init_call_fatal
call near forceEnableA20
extern _init_call_fmemcpy
global _reloc_call_fmemcpy
_reloc_call_fmemcpy: jmp far _init_call_fmemcpy
call near forceEnableA20
extern _init_call_memcpy
global _reloc_call_memcpy
_reloc_call_memcpy: jmp far _init_call_memcpy
call near forceEnableA20
extern _init_call_printf
global _reloc_call_printf
_reloc_call_printf: jmp far _init_call_printf
call near forceEnableA20
extern _init_call_strcpy
global _reloc_call_strcpy
_reloc_call_strcpy: jmp far _init_call_strcpy
call near forceEnableA20
extern _init_call_sti
global _reloc_call_sti
_reloc_call_sti: jmp far _init_call_sti
call near forceEnableA20
extern _init_call_strcmp
global _reloc_call_strcmp
_reloc_call_strcmp: jmp far _init_call_strcmp
call near forceEnableA20
extern _init_call_strlen
global _reloc_call_strlen
_reloc_call_strlen: jmp far _init_call_strlen
call near forceEnableA20
extern _init_call_WritePCClock
global _reloc_call_WritePCClock
_reloc_call_WritePCClock: jmp far _init_call_WritePCClock
call near forceEnableA20
extern _init_call_DaysFromYearMonthDay
global _reloc_call_DaysFromYearMonthDay
_reloc_call_DaysFromYearMonthDay: jmp far _init_call_DaysFromYearMonthDay
call near forceEnableA20
global _CharMapSrvc
extern _reloc_call_CharMapSrvc
_CharMapSrvc: jmp far _reloc_call_CharMapSrvc
call near forceEnableA20
global _reloc_call_clk_driver
extern _init_call_clk_driver
_reloc_call_clk_driver: jmp far _init_call_clk_driver
call near forceEnableA20
global _reloc_call_fmemset
extern _init_call_fmemset
_reloc_call_fmemset: jmp far _init_call_fmemset
call near forceEnableA20
global _reloc_call_blk_driver
extern _init_call_blk_driver
_reloc_call_blk_driver: jmp far _init_call_blk_driver
call near forceEnableA20
global _int2f_handler global _int2f_handler
extern reloc_call_int2f_handler extern reloc_call_int2f_handler
_int2f_handler: jmp far reloc_call_int2f_handler _int2f_handler: jmp far reloc_call_int2f_handler
@ -806,9 +824,6 @@ _int2f_handler: jmp far reloc_call_int2f_handler
_int20_handler: jmp far reloc_call_int20_handler _int20_handler: jmp far reloc_call_int20_handler
call near forceEnableA20 call near forceEnableA20
global _int21_handler global _int21_handler
extern reloc_call_int21_handler extern reloc_call_int21_handler
_int21_handler: jmp far reloc_call_int21_handler _int21_handler: jmp far reloc_call_int21_handler
@ -840,14 +855,21 @@ _int0_handler: jmp far reloc_call_int0_handler
_cpm_entry: jmp far reloc_call_cpm_entry _cpm_entry: jmp far reloc_call_cpm_entry
call near forceEnableA20 call near forceEnableA20
; global _init_call_init_buffers global _reloc_call_blk_driver
; extern _reloc_call_init_buffers extern _blk_driver
;_init_call_init_buffers: jmp far _reloc_call_init_buffers _reloc_call_blk_driver:
; call near forceEnableA20 jmp far _blk_driver
call near forceEnableA20
global _init_call_p_0 global _reloc_call_clk_driver
extern _reloc_call_p_0 extern _clk_driver
_init_call_p_0: jmp far _reloc_call_p_0 _reloc_call_clk_driver:
jmp far _clk_driver
call near forceEnableA20
global _CharMapSrvc
extern _reloc_call_CharMapSrvc
_CharMapSrvc: jmp far _reloc_call_CharMapSrvc
call near forceEnableA20 call near forceEnableA20
@ -1006,16 +1028,6 @@ _int24_handler: mov al,FAIL
iret iret
segment HMA_TEXT
extern _init_call_printf:wrt TGROUP
global _printf
_printf:
pop ax
push cs
push ax
jmp _init_call_printf

View File

@ -5,6 +5,9 @@
# #
# $Log$ # $Log$
# Revision 1.8 2001/04/15 03:21:50 bartoldeman
# See history.txt for the list of fixes.
#
# Revision 1.7 2001/03/25 17:11:54 bartoldeman # Revision 1.7 2001/03/25 17:11:54 bartoldeman
# Fixed sys.com compilation. Updated to 2023. Also: see history.txt. # Fixed sys.com compilation. Updated to 2023. Also: see history.txt.
# #
@ -131,10 +134,9 @@ LIBS =..\LIB\DEVICE.LIB ..\LIB\LIBM.LIB
#ALLCFLAGS = -1- -O -Z -d -I..\hdr -I. \ #ALLCFLAGS = -1- -O -Z -d -I..\hdr -I. \
# -D__STDC__=0;DEBUG;KERNEL;I86;PROTO;ASMSUPT # -D__STDC__=0;DEBUG;KERNEL;I86;PROTO;ASMSUPT
ALLCFLAGS = -1- -O -Z -d -I..\hdr -I. \ ALLCFLAGS = -1- -O -Z -d -I..\hdr -I. \
-D__STDC__=0;KERNEL;I86;PROTO;ASMSUPT \ -D__STDC__=0;I86;ASMSUPT -w -g1
-g1 INITCFLAGS =$(ALLCFLAGS) -zAINIT -zCINIT_TEXT -zPIGROUP -zDIB -zRID -zTID
INITCFLAGS = $(ALLCFLAGS) -zAINIT -zCINIT_TEXT -zPIGROUP CFLAGS =$(ALLCFLAGS) -zAHMA -zCHMA_TEXT
CFLAGS = $(ALLCFLAGS) -zAHMA -zCHMA_TEXT
HDR=../hdr/ HDR=../hdr/
# *Implicit Rules* # *Implicit Rules*

View File

@ -29,7 +29,6 @@
#include "init-mod.h" #include "init-mod.h"
#define MAIN
#include "portab.h" #include "portab.h"
#include "globals.h" #include "globals.h"
@ -39,6 +38,9 @@ static BYTE *mainRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.13 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.12 2001/03/30 22:27:42 bartoldeman * Revision 1.12 2001/03/30 22:27:42 bartoldeman
* Saner lastdrive handling. * Saner lastdrive handling.
* *
@ -169,14 +171,14 @@ extern BYTE FAR * lpBase;
extern BYTE FAR * upBase; extern BYTE FAR * upBase;
INIT BOOL ReadATClock(BYTE *, BYTE *, BYTE *, BYTE *); INIT BOOL ReadATClock(BYTE *, BYTE *, BYTE *, BYTE *);
VOID FAR init_call_WritePCClock(ULONG); VOID WritePCClock(ULONG);
VOID FAR reloc_call_WritePCClock(ULONG);
INIT VOID configDone(VOID); INIT VOID configDone(VOID);
INIT static void InitIO(void); INIT static void InitIO(void);
INIT static COUNT BcdToByte(COUNT); INIT static COUNT BcdToByte(COUNT);
INIT static COUNT BcdToDay(BYTE *); /** INIT static COUNT BcdToDay(BYTE *);*/
INIT static VOID update_dcb(struct dhdr FAR *);
INIT static VOID init_kernel(VOID); INIT static VOID init_kernel(VOID);
INIT static VOID signon(VOID); INIT static VOID signon(VOID);
INIT VOID kernel(VOID); INIT VOID kernel(VOID);
@ -226,26 +228,28 @@ INIT VOID main(void)
at least one known utility (norton DE) seems to access them directly. at least one known utility (norton DE) seems to access them directly.
ok, so we access for all drives, that the stuff gets build ok, so we access for all drives, that the stuff gets build
*/ */
/*
void InitializeAllBPBs() should not be necessary anymore (see DosSelectDrv in dosfns.c)
void InitializeAllBPBs(VOID)
{ {
static char filename[] = "A:-@JUNK@-.TMP"; static char filename[] = "A:-@JUNK@-.TMP";
int drive,fileno; int drive,fileno;
for (drive = 'Z'; drive >= 'C'; drive--) for (drive = 'Z'; drive >= 'C'; drive--)
{ {
filename[0] = drive; filename[0] = drive;
if ((fileno = dos_open((BYTE FAR *) filename, O_RDONLY)) >= 0) if ((fileno = init_DosOpen(filename, O_RDONLY)) >= 0)
dos_close(fileno); init_DosClose(fileno);
} }
} }
*/
INIT void init_kernel(void) INIT void init_kernel(void)
{ {
COUNT i; COUNT i;
os_major = MAJOR_RELEASE; os_major = MAJOR_RELEASE;
os_minor = MINOR_RELEASE; os_minor = MINOR_RELEASE;
cu_psp = DOS_PSP;
nblkdev = 0; nblkdev = 0;
maxbksize = 0x200; maxbksize = 0x200;
switchar = '/'; switchar = '/';
@ -294,10 +298,13 @@ INIT void init_kernel(void)
scr_pos = 0; scr_pos = 0;
break_ena = TRUE; break_ena = TRUE;
init_PSPInit(DOS_PSP);
/* Do first initialization of system variable buffers so that */ /* Do first initialization of system variable buffers so that */
/* we can read config.sys later. */ /* we can read config.sys later. */
lastdrive = Config.cfgLastdrive; lastdrive = Config.cfgLastdrive;
PreConfig(); PreConfig();
init_device((struct dhdr FAR *)&blk_dev, NULL, NULL, ram_top);
/* Now config the temporary file system */ /* Now config the temporary file system */
FsConfig(); FsConfig();
@ -305,11 +312,12 @@ INIT void init_kernel(void)
#ifndef KDB #ifndef KDB
/* Now process CONFIG.SYS */ /* Now process CONFIG.SYS */
DoConfig(); DoConfig();
/* and do final buffer allocation. */ /* and do final buffer allocation. */
PostConfig(); PostConfig();
nblkdev = 0;
update_dcb(&blk_dev);
/* Init the file system on emore time */ /* Init the file system one more time */
FsConfig(); FsConfig();
/* and process CONFIG.SYS one last time to load device drivers. */ /* and process CONFIG.SYS one last time to load device drivers. */
@ -326,20 +334,12 @@ INIT void init_kernel(void)
InDOS = 0; InDOS = 0;
pDirFileNode = 0; pDirFileNode = 0;
dosidle_flag = 0; dosidle_flag = 0;
InitializeAllBPBs();
} }
INIT VOID FsConfig(VOID) INIT VOID FsConfig(VOID)
{ {
REG COUNT i; REG COUNT i;
date Date; struct dpb FAR *dpb;
time Time;
/* Get the start-up date and time */
Date = dos_getdate();
Time = dos_gettime();
/* Initialize the file tables */ /* Initialize the file tables */
for (i = 0; i < Config.cfgFiles; i++) for (i = 0; i < Config.cfgFiles; i++)
@ -351,84 +351,36 @@ INIT VOID FsConfig(VOID)
sfthead->sftt_count = Config.cfgFiles; sfthead->sftt_count = Config.cfgFiles;
for (i = 0; i < sfthead->sftt_count; i++) for (i = 0; i < sfthead->sftt_count; i++)
{ {
init_DosClose(i);
sfthead->sftt_table[i].sft_count = 0; sfthead->sftt_table[i].sft_count = 0;
sfthead->sftt_table[i].sft_status = -1; sfthead->sftt_table[i].sft_status = -1;
} }
/* 0 is /dev/con (stdin) */ /* 0 is /dev/con (stdin) */
sfthead->sftt_table[0].sft_count = 1; init_DosOpen("CON", SFT_MREAD);
sfthead->sftt_table[0].sft_mode = SFT_MREAD; sfthead->sftt_table[0].sft_flags |= SFT_FCONIN | SFT_FCONOUT;
sfthead->sftt_table[0].sft_attrib = 0;
sfthead->sftt_table[0].sft_flags =
((con_dev.dh_attr & ~SFT_MASK) & ~SFT_FSHARED) | SFT_FDEVICE | SFT_FEOF | SFT_FCONIN | SFT_FCONOUT;
sfthead->sftt_table[0].sft_psp = DOS_PSP;
sfthead->sftt_table[0].sft_date = Date;
sfthead->sftt_table[0].sft_time = Time;
fbcopy(
(VOID FAR *) "CON ",
(VOID FAR *) sfthead->sftt_table[0].sft_name, 11);
sfthead->sftt_table[0].sft_dev = (struct dhdr FAR *)&con_dev;
/* 1 is /dev/con (stdout) */ /* 1 is /dev/con (stdout) */
sfthead->sftt_table[1].sft_count = 1; init_DosOpen("CON", SFT_MWRITE);
sfthead->sftt_table[1].sft_mode = SFT_MWRITE; sfthead->sftt_table[1].sft_flags |= SFT_FCONIN | SFT_FCONOUT;
sfthead->sftt_table[1].sft_attrib = 0;
sfthead->sftt_table[1].sft_flags =
((con_dev.dh_attr & ~SFT_MASK) & ~SFT_FSHARED) | SFT_FDEVICE | SFT_FEOF | SFT_FCONIN | SFT_FCONOUT;
sfthead->sftt_table[1].sft_psp = DOS_PSP;
sfthead->sftt_table[1].sft_date = Date;
sfthead->sftt_table[1].sft_time = Time;
fbcopy(
(VOID FAR *) "CON ",
(VOID FAR *) sfthead->sftt_table[1].sft_name, 11);
sfthead->sftt_table[1].sft_dev = (struct dhdr FAR *)&con_dev;
/* 2 is /dev/con (stderr) */ /* 2 is /dev/con (stderr) */
sfthead->sftt_table[2].sft_count = 1; init_DosOpen("CON", SFT_MWRITE);
sfthead->sftt_table[2].sft_mode = SFT_MWRITE; sfthead->sftt_table[2].sft_flags |= SFT_FCONIN | SFT_FCONOUT;
sfthead->sftt_table[2].sft_attrib = 0;
sfthead->sftt_table[2].sft_flags =
((con_dev.dh_attr & ~SFT_MASK) & ~SFT_FSHARED) | SFT_FDEVICE | SFT_FEOF | SFT_FCONIN | SFT_FCONOUT;
sfthead->sftt_table[2].sft_psp = DOS_PSP;
sfthead->sftt_table[2].sft_date = Date;
sfthead->sftt_table[2].sft_time = Time;
fbcopy(
(VOID FAR *) "CON ",
(VOID FAR *) sfthead->sftt_table[2].sft_name, 11);
sfthead->sftt_table[2].sft_dev = (struct dhdr FAR *)&con_dev;
/* 3 is /dev/aux */ /* 3 is /dev/aux */
sfthead->sftt_table[3].sft_count = 1; init_DosOpen("AUX", SFT_MRDWR);
sfthead->sftt_table[3].sft_mode = SFT_MRDWR; sfthead->sftt_table[3].sft_flags &= ~SFT_FEOF;
sfthead->sftt_table[3].sft_attrib = 0;
sfthead->sftt_table[3].sft_flags =
((aux_dev.dh_attr & ~SFT_MASK) & ~SFT_FSHARED) | SFT_FDEVICE;
sfthead->sftt_table[3].sft_psp = DOS_PSP;
sfthead->sftt_table[3].sft_date = Date;
sfthead->sftt_table[3].sft_time = Time;
fbcopy(
(VOID FAR *) "AUX ",
(VOID FAR *) sfthead->sftt_table[3].sft_name, 11);
sfthead->sftt_table[3].sft_dev = (struct dhdr FAR *)&aux_dev;
/* 4 is /dev/prn */ /* 4 is /dev/prn */
sfthead->sftt_table[4].sft_count = 1; init_DosOpen("PRN", SFT_MWRITE);
sfthead->sftt_table[4].sft_mode = SFT_MWRITE; sfthead->sftt_table[4].sft_flags &= ~SFT_FEOF;
sfthead->sftt_table[4].sft_attrib = 0;
sfthead->sftt_table[4].sft_flags =
((prn_dev.dh_attr & ~SFT_MASK) & ~SFT_FSHARED) | SFT_FDEVICE;
sfthead->sftt_table[4].sft_psp = DOS_PSP;
sfthead->sftt_table[4].sft_date = Date;
sfthead->sftt_table[4].sft_time = Time;
fbcopy(
(VOID FAR *) "PRN ",
(VOID FAR *) sfthead->sftt_table[4].sft_name, 11);
sfthead->sftt_table[4].sft_dev = (struct dhdr FAR *)&prn_dev;
/* Log-in the default drive. */ /* Log-in the default drive. */
/* Get the boot drive from the ipl and use it for default. */ /* Get the boot drive from the ipl and use it for default. */
default_drive = BootDrive - 1; default_drive = BootDrive - 1;
dpb = DPBp;
/* Initialzie the current directory structures */ /* Initialize the current directory structures */
for (i = 0; i < lastdrive ; i++) for (i = 0; i < lastdrive ; i++)
{ {
struct cds FAR *pcds_table = &CDSp->cds_table[i]; struct cds FAR *pcds_table = &CDSp->cds_table[i];
@ -438,10 +390,11 @@ INIT VOID FsConfig(VOID)
pcds_table->cdsCurrentPath[0] += i; pcds_table->cdsCurrentPath[0] += i;
if (i < nblkdev) if (i < nblkdev && (ULONG)dpb != 0xffffffffl)
{ {
pcds_table->cdsDpb = &blk_devices[i]; pcds_table->cdsDpb = dpb;
pcds_table->cdsFlags = CDSPHYSDRV; pcds_table->cdsFlags = CDSPHYSDRV;
dpb = dpb->dpb_next;
} }
else else
{ {
@ -453,7 +406,7 @@ INIT VOID FsConfig(VOID)
pcds_table->cdsJoinOffset = 2; pcds_table->cdsJoinOffset = 2;
} }
/* Initialze the disk buffer management functions */ /* Initialize the disk buffer management functions */
/* init_call_init_buffers(); done from CONFIG.C */ /* init_call_init_buffers(); done from CONFIG.C */
} }
@ -495,21 +448,55 @@ INIT void kernel()
ep += sizeof(int); ep += sizeof(int);
#endif #endif
RootPsp = ~0; RootPsp = ~0;
p_0();
init_call_p_0();
} }
/* check for a block device and update device control block */
static VOID update_dcb(struct dhdr FAR * dhp)
{
REG COUNT Index;
COUNT nunits = dhp->dh_name[0];
struct dpb FAR *dpb;
if (nblkdev==0)
dpb = DPBp;
else {
for (dpb = DPBp; (ULONG)dpb->dpb_next != 0xffffffffl; dpb = dpb->dpb_next)
;
dpb = dpb->dpb_next = (struct dpb FAR *)KernelAlloc(nunits*sizeof(struct dpb));
}
for(Index = 0; Index < nunits; Index++)
{
dpb->dpb_next = dpb+1;
dpb->dpb_unit = nblkdev;
dpb->dpb_subunit = Index;
dpb->dpb_device = dhp;
dpb->dpb_flags = M_CHANGED;
if ((CDSp != 0) && (nblkdev < lastdrive))
{
CDSp->cds_table[nblkdev].cdsDpb = dpb;
CDSp->cds_table[nblkdev].cdsFlags = CDSPHYSDRV;
}
++dpb;
++nblkdev;
}
(dpb-1)->dpb_next = (void FAR *)0xFFFFFFFFl;
}
/* If cmdLine is NULL, this is an internal driver */ /* If cmdLine is NULL, this is an internal driver */
BOOL init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine, COUNT mode, COUNT r_top) BOOL init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine, COUNT mode, COUNT r_top)
{ {
request rq; request rq;
ULONG memtop = ((ULONG) r_top) << 10; UCOUNT maxmem = ((UCOUNT)r_top << 6) - FP_SEG(dhp);
ULONG maxmem = memtop - ((ULONG) FP_SEG(dhp) << 4);
if (maxmem >= 0x10000) if (maxmem >= 0x1000)
maxmem = 0xFFFF; maxmem = 0xFFFF;
else
maxmem <<= 4;
rq.r_unit = 0; rq.r_unit = 0;
rq.r_status = 0; rq.r_status = 0;
@ -519,7 +506,6 @@ BOOL init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine, COUNT mode, COUNT r_
rq.r_bpbptr = (void FAR *)(cmdLine ? cmdLine : "\n"); rq.r_bpbptr = (void FAR *)(cmdLine ? cmdLine : "\n");
rq.r_firstunit = nblkdev; rq.r_firstunit = nblkdev;
execrh((request FAR *) & rq, dhp); execrh((request FAR *) & rq, dhp);
/* /*
@ -535,32 +521,11 @@ BOOL init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine, COUNT mode, COUNT r_
lpBase = rq.r_endaddr; lpBase = rq.r_endaddr;
} }
/* check for a block device and update device control block */ if (!(dhp->dh_attr & ATTR_CHAR) && (rq.r_nunits != 0)) {
if (!(dhp->dh_attr & ATTR_CHAR) && (rq.r_nunits != 0)) dhp->dh_name[0] = rq.r_nunits;
{ update_dcb(dhp);
REG COUNT Index;
for (Index = 0; Index < rq.r_nunits; Index++)
{
struct dpb *pblk_devices = &blk_devices[nblkdev];
if (nblkdev)
(pblk_devices-1)->dpb_next = pblk_devices;
pblk_devices->dpb_next = (void FAR *)0xFFFFFFFF;
pblk_devices->dpb_unit = nblkdev;
pblk_devices->dpb_subunit = Index;
pblk_devices->dpb_device = dhp;
pblk_devices->dpb_flags = M_CHANGED;
if ((CDSp != 0) && (nblkdev < lastdrive))
{
CDSp->cds_table[nblkdev].cdsDpb = pblk_devices;
CDSp->cds_table[nblkdev].cdsFlags = CDSPHYSDRV;
} }
++nblkdev;
}
}
DPBp = &blk_devices[0];
return FALSE; return FALSE;
} }
@ -579,7 +544,6 @@ INIT static void InitIO(void)
setvec(0x29, int29_handler); /* Requires Fast Con Driver */ setvec(0x29, int29_handler); /* Requires Fast Con Driver */
init_device((struct dhdr FAR *)&con_dev, NULL, NULL, ram_top); init_device((struct dhdr FAR *)&con_dev, NULL, NULL, ram_top);
init_device((struct dhdr FAR *)&clk_dev, NULL, NULL, ram_top); init_device((struct dhdr FAR *)&clk_dev, NULL, NULL, ram_top);
init_device((struct dhdr FAR *)&blk_dev, NULL, NULL, ram_top);
/* If AT clock exists, copy AT clock time to system clock */ /* If AT clock exists, copy AT clock time to system clock */
if (!ReadATClock(bcd_days, &bcd_hours, &bcd_minutes, &bcd_seconds)) if (!ReadATClock(bcd_days, &bcd_hours, &bcd_minutes, &bcd_seconds))
{ {

View File

@ -35,6 +35,9 @@ static BYTE *memmgrRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.12 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.11 2001/04/02 23:18:30 bartoldeman * Revision 1.11 2001/04/02 23:18:30 bartoldeman
* Misc, zero terminated device names and redirector bugs fixed. * Misc, zero terminated device names and redirector bugs fixed.
* *
@ -166,9 +169,12 @@ seg far2para(VOID FAR * p)
return FP_SEG(p) + (FP_OFF(p) >> 4); return FP_SEG(p) + (FP_OFF(p) >> 4);
} }
seg long2para(LONG size) seg long2para(ULONG size)
{ {
return ((size + 0x0f) >> 4); UWORD high = size>>16;
if ((UWORD)size > 0xfff0)
high++;
return (((UWORD)size + 0x0f) >> 4) + (high << 12);
} }
/* /*
@ -176,11 +182,14 @@ seg long2para(LONG size)
*/ */
VOID FAR *add_far(VOID FAR * fp, ULONG off) VOID FAR *add_far(VOID FAR * fp, ULONG off)
{ {
if (FP_SEG(fp) == 0xffff) return ((BYTE FAR *)fp) + off; UWORD off2;
if (FP_SEG(fp) == 0xffff) return ((BYTE FAR *)fp) + FP_OFF(off);
off += FP_OFF(fp); off += FP_OFF(fp);
off2 = ((off >> 16) << 12) + ((UWORD)off >> 4);
return MK_FP(FP_SEG(fp) + (UWORD) (off >> 4), (UWORD) off & 0xf); return MK_FP(FP_SEG(fp) + off2, (UWORD) off & 0xf);
} }
/* /*
@ -199,7 +208,7 @@ VOID FAR *adjust_far(VOID FAR * fp)
#undef REG #undef REG
#define REG #define REG
#ifdef KERNEL #if 1 /* #ifdef KERNEL KERNEL */
/* Allocate a new memory area. *para is assigned to the segment of the /* Allocate a new memory area. *para is assigned to the segment of the
MCB rather then the segment of the data portion */ MCB rather then the segment of the data portion */
/* If mode == LARGEST, asize MUST be != NULL and will always recieve the /* If mode == LARGEST, asize MUST be != NULL and will always recieve the
@ -347,11 +356,6 @@ stopIt: /* reached from FIRST_FIT on match */
return SUCCESS; return SUCCESS;
} }
COUNT FAR init_call_DosMemAlloc(UWORD size, COUNT mode, seg FAR * para, UWORD FAR * asize)
{
return DosMemAlloc(size, mode, para, asize);
}
/* /*
* Unlike the name and the original prototype could suggest, this function * Unlike the name and the original prototype could suggest, this function
* is used to return the _size_ of the largest available block rather than * is used to return the _size_ of the largest available block rather than
@ -363,7 +367,6 @@ COUNT FAR init_call_DosMemAlloc(UWORD size, COUNT mode, seg FAR * para, UWORD FA
COUNT DosMemLargest(UWORD FAR * size) COUNT DosMemLargest(UWORD FAR * size)
{ {
REG mcb FAR *p; REG mcb FAR *p;
COUNT found;
/* Initialize */ /* Initialize */
p = ((mem_access_mode & (FIRST_FIT_UO | FIRST_FIT_U)) && uppermem_link && uppermem_root) p = ((mem_access_mode & (FIRST_FIT_UO | FIRST_FIT_U)) && uppermem_link && uppermem_root)
@ -550,7 +553,7 @@ COUNT DosMemCheck(void)
COUNT FreeProcessMem(UWORD ps) COUNT FreeProcessMem(UWORD ps)
{ {
mcb FAR *p, FAR *u; mcb FAR *p;
COUNT x = 0; COUNT x = 0;
/* Initialize */ /* Initialize */
@ -621,14 +624,12 @@ VOID show_chain(void)
p = nxtMCB(p); p = nxtMCB(p);
} }
} }
#endif
VOID mcb_print(mcb FAR * mcbp) VOID mcb_print(mcb FAR * mcbp)
{ {
static BYTE buff[9]; static BYTE buff[9];
VOID _fmemcpy();
_fmemcpy((BYTE FAR *) buff, (BYTE FAR *) (mcbp->m_name), 8); fmemcpy((BYTE FAR *) buff, (BYTE FAR *) (mcbp->m_name), 8);
buff[8] = '\0'; buff[8] = '\0';
printf("%04x:%04x -> |%s| m_type = 0x%02x '%c'; m_psp = 0x%04x; m_size = 0x%04x\n", printf("%04x:%04x -> |%s| m_type = 0x%02x '%c'; m_psp = 0x%04x; m_size = 0x%04x\n",
FP_SEG(mcbp), FP_SEG(mcbp),
@ -638,14 +639,8 @@ VOID mcb_print(mcb FAR * mcbp)
mcbp->m_psp, mcbp->m_psp,
mcbp->m_size); mcbp->m_size);
} }
/* #endif
VOID _fmemcpy(BYTE FAR * d, BYTE FAR * s, REG COUNT n)
{
while (n--)
*d++ = *s++;
}
*/
VOID DosUmbLink(BYTE n) VOID DosUmbLink(BYTE n)
{ {
REG mcb FAR *p; REG mcb FAR *p;
@ -688,4 +683,58 @@ VOID DosUmbLink(BYTE n)
DUL_exit: DUL_exit:
return; return;
} }
/*
if we arrive here the first time, it's just
before jumping to COMMAND.COM
so we are done initializing, and can claim the IMIT_DATA segment,
as these data/strings/buffers are no longer in use.
we carve a free memory block out of it and hope that
it will be useful (maybe for storing environments)
*/
BYTE INITDataSegmentClaimed = 1; /* must be enabled by CONFIG.SYS */
extern BYTE _INIT_DATA_START[], _INIT_DATA_END[];
VOID ClaimINITDataSegment()
{
unsigned ilow,ihigh;
VOID FAR * p;
if (INITDataSegmentClaimed)
return;
INITDataSegmentClaimed = 1;
ilow = (unsigned)_INIT_DATA_START;
ilow = (ilow+0x0f) & ~0x000f;
ihigh = (unsigned)_INIT_DATA_END;
ihigh = ((ihigh + 0x0f) & ~0x000f) - 0x20;
if (ilow +0x10 < ihigh)
{
printf("CLAIMING INIT_DATA memory - %u bytes\n",ihigh - ilow);
}
((mcb*)ilow)->m_type = MCB_NORMAL; /* 'M' */
((mcb*)ilow)->m_psp = FREE_PSP; /* '0' */
((mcb*)ilow)->m_size = (ihigh-ilow-0x10)>>4; /* '0' */
((mcb*)ihigh)->m_type = MCB_NORMAL; /* 'M' */
((mcb*)ihigh)->m_psp = 0x0008; /* system */
p = (void FAR*)(void*)ihigh;
((mcb*)ihigh)->m_size = first_mcb -1 - FP_SEG(p) - (FP_OFF(p) >> 4);
p = (void FAR*)(void*)ilow;
first_mcb = FP_SEG(p) + (FP_OFF(p) >> 4);
}
#endif #endif

View File

@ -34,6 +34,9 @@ static BYTE *miscRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.5 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.4 2001/03/21 02:56:26 bartoldeman * Revision 1.4 2001/03/21 02:56:26 bartoldeman
* See history.txt for changes. Bug fixes and HMA support are the main ones. * See history.txt for changes. Bug fixes and HMA support are the main ones.
* *
@ -98,11 +101,6 @@ VOID scopy(REG BYTE * s, REG BYTE * d)
*d = '\0'; *d = '\0';
} }
VOID FAR init_call_scopy(REG BYTE * s, REG BYTE * d)
{
scopy(s, d);
}
VOID fscopy(REG BYTE FAR * s, REG BYTE FAR * d) VOID fscopy(REG BYTE FAR * s, REG BYTE FAR * d)
{ {
while (*s) while (*s)
@ -117,7 +115,6 @@ VOID fsncopy(BYTE FAR * s, BYTE FAR * d, REG COUNT n)
*d = '\0'; *d = '\0';
} }
#ifndef ASMSUPT
VOID bcopy(REG BYTE * s, REG BYTE * d, REG COUNT n) VOID bcopy(REG BYTE * s, REG BYTE * d, REG COUNT n)
{ {
while (n--) while (n--)
@ -137,16 +134,3 @@ VOID fmemset(REG VOID FAR * s, REG int ch, REG COUNT n)
} }
#endif #endif
VOID FAR init_call_fbcopy(REG VOID FAR * s, REG VOID FAR * d, REG COUNT n)
{
fbcopy(s, d, n);
}
VOID fmemset(VOID FAR *, int, COUNT);
VOID FAR init_call_fmemset(REG VOID FAR * s, REG int ch, REG COUNT n)
{
fmemset(s, ch, n);
}
#endif

View File

@ -36,6 +36,9 @@ static BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.11 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.10 2001/04/02 23:18:30 bartoldeman * Revision 1.10 2001/04/02 23:18:30 bartoldeman
* Misc, zero terminated device names and redirector bugs fixed. * Misc, zero terminated device names and redirector bugs fixed.
* *
@ -86,7 +89,7 @@ static BYTE *RcsId = "$Id$";
*/ */
UWORD get_machine_name(BYTE FAR * netname) UWORD get_machine_name(BYTE FAR * netname)
{ {
fmemcpy(netname, &net_name, 15); fmemcpy(netname, &net_name, 16);
return (NetBios); return (NetBios);
} }
@ -124,8 +127,8 @@ UCOUNT Remote_RW(UWORD func, UCOUNT n, BYTE FAR * bp, sft FAR * s, COUNT FAR * e
*/ */
COUNT Remote_find(UWORD func, BYTE FAR * name, REG dmatch FAR * dmp ) COUNT Remote_find(UWORD func, BYTE FAR * name, REG dmatch FAR * dmp )
{ {
COUNT i, x; COUNT i;
char FAR *p, FAR *q; char FAR *p;
VOID FAR * test; VOID FAR * test;
struct dirent FAR *SDp = (struct dirent FAR *) &SearchDir; struct dirent FAR *SDp = (struct dirent FAR *) &SearchDir;

View File

@ -31,6 +31,9 @@ static BYTE *mainRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.11 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.10 2001/04/02 23:18:30 bartoldeman * Revision 1.10 2001/04/02 23:18:30 bartoldeman
* Misc, zero terminated device names and redirector bugs fixed. * Misc, zero terminated device names and redirector bugs fixed.
* *
@ -152,10 +155,10 @@ int SetJFTSize(UWORD nHandles)
return SUCCESS; return SUCCESS;
} }
/* this is the same, is shorter (~170)and slightly easier to understand TE*/
int DosMkTmp(BYTE FAR * pathname, UWORD attr) int DosMkTmp(BYTE FAR * pathname, UWORD attr)
{ {
/* create filename from current date and time */ /* create filename from current date and time */
static const char tokens[] = "0123456789ABCDEF";
char FAR *ptmp = pathname; char FAR *ptmp = pathname;
BYTE wd, BYTE wd,
month, month,
@ -167,6 +170,8 @@ int DosMkTmp(BYTE FAR * pathname, UWORD attr)
WORD sh; WORD sh;
WORD year; WORD year;
int rc; int rc;
char name83[13];
int loop;
while (*ptmp) while (*ptmp)
ptmp++; ptmp++;
@ -179,35 +184,24 @@ int DosMkTmp(BYTE FAR * pathname, UWORD attr)
sh = s * 100 + hund; sh = s * 100 + hund;
ptmp[0] = tokens[year & 0xf]; for ( loop = 0; loop < 0xfff; loop++)
ptmp[1] = tokens[month];
ptmp[2] = tokens[day & 0xf];
ptmp[3] = tokens[h & 0xf];
ptmp[4] = tokens[m & 0xf];
ptmp[5] = tokens[(sh >> 8) & 0xf];
ptmp[6] = tokens[(sh >> 4) & 0xf];
ptmp[7] = tokens[sh & 0xf];
ptmp[8] = '.';
ptmp[9] = 'A';
ptmp[10] = 'A';
ptmp[11] = 'A';
ptmp[12] = 0;
while ((rc = DosOpen(pathname, 0)) >= 0)
{ {
DosClose(rc); sprintf(name83,"%x%x%x%x%x%03x.%03x",
if (++ptmp[11] > 'Z') year & 0xf,month & 0xf, day & 0xf,h & 0xf,m & 0xf, sh&0xfff,
{ loop & 0xfff);
if (++ptmp[10] > 'Z')
{
if (++ptmp[9] > 'Z')
return DE_TOOMANY;
ptmp[10] = 'A'; fmemcpy(ptmp, name83, 13);
}
ptmp[11] = 'A'; if ((rc = DosOpen(pathname, 0)) < 0 &&
} rc != DE_ACCESS /* subdirectory ?? */
/* todo: sharing collision on
network drive
*/
)
break;
if (rc >= 0) DosClose(rc);
} }
if (rc == DE_FILENOTFND) if (rc == DE_FILENOTFND)
@ -219,21 +213,17 @@ int DosMkTmp(BYTE FAR * pathname, UWORD attr)
COUNT get_verify_drive(char FAR *src) COUNT get_verify_drive(char FAR *src)
{ {
COUNT drive; UBYTE drive;
/* First, adjust the source pointer */
src = adjust_far(src);
/* Do we have a drive? */ /* Do we have a drive? */
if (src[1] == ':') if (src[1] == ':')
{ drive = ((src[0]-1) | 0x20) - ('a'-1);
drive = (src[0] | 0x20) - 'a';
}
else else
drive = default_drive; return default_drive;
if ((drive < 0) || (drive >= lastdrive)) { if (drive < lastdrive && CDSp->cds_table[drive].cdsFlags & CDSVALID)
drive = DE_INVLDDRV;
}
return drive; return drive;
else
return DE_INVLDDRV;
} }
/* /*
@ -271,21 +261,19 @@ COUNT truename(char FAR * src, char FAR * dest, COUNT t)
dest[0] = '\0'; dest[0] = '\0';
i = get_verify_drive(src);
if (i < 0)
return DE_INVLDDRV;
buf[0] = i + 'A';
buf[1] = ':'; /* Just to be sure */
/* First, adjust the source pointer */ /* First, adjust the source pointer */
src = adjust_far(src); src = adjust_far(src);
/* Do we have a drive? */ /* Do we have a drive? */
if (src[1] == ':') if (src[1] == ':')
{
buf[0] = (src[0] | 0x20) + 'A' - 'a';
if (buf[0] >= lastdrive + 'A') /* BUG:should be: drive exists */
return DE_INVLDDRV;
src += 2; src += 2;
}
else
buf[0] = default_drive + 'A';
/* /// Added to adjust for filenames which begin with ".\" /* /// Added to adjust for filenames which begin with ".\"
The problem was manifesting itself in the inability The problem was manifesting itself in the inability
@ -297,7 +285,6 @@ COUNT truename(char FAR * src, char FAR * dest, COUNT t)
/* /// Changed to "while" from "if". - Ron Cemer */ /* /// Changed to "while" from "if". - Ron Cemer */
while ( (src[0] == '.') && (src[1] == '\\') ) src += 2; while ( (src[0] == '.') && (src[1] == '\\') ) src += 2;
i = buf[0] - 'A';
/* /*
Code repoff from dosfns.c Code repoff from dosfns.c
MSD returns X:/CON for truename con. Not X:\CON MSD returns X:/CON for truename con. Not X:\CON

View File

@ -44,6 +44,9 @@ static BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.6 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.5 2001/03/21 02:56:26 bartoldeman * Revision 1.5 2001/03/21 02:56:26 bartoldeman
* See history.txt for changes. Bug fixes and HMA support are the main ones. * See history.txt for changes. Bug fixes and HMA support are the main ones.
* *
@ -256,7 +259,7 @@ static COUNT cpyBuf(VOID FAR *dst, UWORD dstlen
, VOID FAR *src, UWORD srclen) , VOID FAR *src, UWORD srclen)
{ {
if(srclen <= dstlen) { if(srclen <= dstlen) {
_fmemcpy(dst, src, srclen); fmemcpy(dst, src, srclen);
return SUCCESS; return SUCCESS;
} }
return DE_INVLDFUNC; /* buffer too small */ return DE_INVLDFUNC; /* buffer too small */

View File

@ -28,12 +28,18 @@
#include "portab.h" #include "portab.h"
COUNT strlen (BYTE * s); /* don't want globals.h, sorry */
#ifdef VERSION_STRINGS #ifdef VERSION_STRINGS
static BYTE *prfRcsId = "$Id$"; static BYTE *prfRcsId = "$Id$";
#endif #endif
/* /*
* $Log$ * $Log$
* Revision 1.7 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.6 2001/03/30 19:30:06 bartoldeman * Revision 1.6 2001/03/30 19:30:06 bartoldeman
* Misc fixes and implementation of SHELLHIGH. See history.txt for details. * Misc fixes and implementation of SHELLHIGH. See history.txt for details.
* *
@ -44,6 +50,9 @@ static BYTE *prfRcsId = "$Id$";
* recoded for smaller object footprint, added main() for testing+QA * recoded for smaller object footprint, added main() for testing+QA
* *
* $Log$ * $Log$
* Revision 1.7 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.6 2001/03/30 19:30:06 bartoldeman * Revision 1.6 2001/03/30 19:30:06 bartoldeman
* Misc fixes and implementation of SHELLHIGH. See history.txt for details. * Misc fixes and implementation of SHELLHIGH. See history.txt for details.
* *
@ -166,7 +175,7 @@ BYTE *
p = q = s; p = q = s;
do do
{ /* generate digits in reverse order */ { /* generate digits in reverse order */
*p++ = "0123456789abcdef"[u % base]; *p++ = "0123456789abcdef"[(UWORD)(u % base)];
} }
while ((u /= base) > 0); while ((u /= base) > 0);
@ -185,11 +194,10 @@ BYTE *
#define RIGHT 1 #define RIGHT 1
/* printf -- short version of printf to conserve space */ /* printf -- short version of printf to conserve space */
WORD FAR WORD printf(CONST BYTE * fmt, ...)
init_call_printf(CONST BYTE * fmt, BYTE * args)
{ {
charp = 0; charp = 0;
return do_printf(fmt, &args); return do_printf(fmt, (BYTE **)&fmt + 1);
} }
WORD WORD
@ -216,8 +224,7 @@ COUNT
{ {
int base; int base;
BYTE s[11], BYTE s[11],
*p, *p;
*ltob();
int c, int c,
flag, flag,
size, size,

View File

@ -30,6 +30,9 @@
; $Id$ ; $Id$
; ;
; $Log$ ; $Log$
; Revision 1.6 2001/04/15 03:21:50 bartoldeman
; See history.txt for the list of fixes.
;
; Revision 1.5 2001/03/24 22:13:05 bartoldeman ; Revision 1.5 2001/03/24 22:13:05 bartoldeman
; See history.txt: dsk.c changes, warning removal and int21 entry handling. ; See history.txt: dsk.c changes, warning removal and int21 entry handling.
; ;
@ -94,9 +97,7 @@
extern _api_ss:wrt DGROUP ; switching extern _api_ss:wrt DGROUP ; switching
extern _usr_sp:wrt DGROUP ; user stacks extern _usr_sp:wrt DGROUP ; user stacks
extern _usr_ss:wrt DGROUP extern _usr_ss:wrt DGROUP
extern _lpUserStack:wrt DGROUP
extern _kstackp:wrt TGROUP ; kernel stack
extern _ustackp:wrt TGROUP ; new task stack
extern _break_flg:wrt DGROUP ; break detected flag extern _break_flg:wrt DGROUP ; break detected flag
extern _int21_handler:wrt TGROUP ; far call system services extern _int21_handler:wrt TGROUP ; far call system services
@ -149,6 +150,7 @@ _got_cbreak:
pop ds pop ds
iret iret
segment HMA_TEXT
; ;
; Special call for switching processes during break handling ; Special call for switching processes during break handling
@ -191,8 +193,23 @@ _spawn_int23:
; restore to user stack ; restore to user stack
cli ;; Pre-8086 don't disable INT autom. cli ;; Pre-8086 don't disable INT autom.
mov ss,[_usr_ss] ;*TE PATCH
mov sp,[_usr_sp] ; CtrlC at DosInput (like C:>DATE does)
; Nukes the Kernel.
;
; it looks like ENTRY.ASM+PROCSUPT.ASM
; got out of sync.
;
; spawn_int() assumes a stack layout at
; usr_ss:usr:sp. but usr:ss currently contains 0
;
; this patch helps FreeDos to survive CtrlC,
; but should clearly be done somehow else.
mov ss, [_lpUserStack+2]
mov sp, [_lpUserStack]
; mov ss,[_usr_ss]
; mov sp,[_usr_sp]
sti sti
; get all the user registers back ; get all the user registers back
@ -307,13 +324,8 @@ _spawn_int23:
??int23_respawn: ??int23_respawn:
pop bp ;; Restore the original register pop bp ;; Restore the original register
jmp _int21_handler jmp far _int21_handler
global _init_call_spawn_int23
_init_call_spawn_int23:
call _spawn_int23
retf
; ;
; interrupt enable and disable routines ; interrupt enable and disable routines
; ;

View File

@ -34,6 +34,9 @@ static BYTE *Proto_hRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.13 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.12 2001/03/30 19:30:06 bartoldeman * Revision 1.12 2001/03/30 19:30:06 bartoldeman
* Misc fixes and implementation of SHELLHIGH. See history.txt for details. * Misc fixes and implementation of SHELLHIGH. See history.txt for details.
* *
@ -162,18 +165,7 @@ static BYTE *Proto_hRcsId = "$Id$";
#define INIT #define INIT
#ifdef IN_INIT_MOD
#define __FAR_WRAPPER(ret, name, proto) \
ret FAR name proto; /* will be expanded to `init_call_<name>' */
#else
#define __FAR_WRAPPER(ret, name, proto) \
ret name proto; \
ret FAR init_call_##name proto; \
ret FAR reloc_call_##name proto;
#endif
/* blockio.c */ /* blockio.c */
VOID FAR init_call_init_buffers(COUNT anzBuffers);
ULONG getblkno(struct buffer FAR *); ULONG getblkno(struct buffer FAR *);
VOID setblkno(struct buffer FAR *, ULONG); VOID setblkno(struct buffer FAR *, ULONG);
struct buffer FAR *getblock(ULONG blkno, COUNT dsk); struct buffer FAR *getblock(ULONG blkno, COUNT dsk);
@ -198,7 +190,7 @@ BOOL con_break(void);
BOOL StdinBusy(void); BOOL StdinBusy(void);
VOID KbdFlush(void); VOID KbdFlush(void);
VOID Do_DosIdle_loop(void); VOID Do_DosIdle_loop(void);
__FAR_WRAPPER(VOID, sti, (keyboard FAR * kp)) VOID sti(keyboard FAR * kp);
sft FAR *get_sft(COUNT); sft FAR *get_sft(COUNT);
@ -214,6 +206,7 @@ INIT COUNT tolower(COUNT c);
INIT COUNT toupper(COUNT c); INIT COUNT toupper(COUNT c);
INIT VOID mcb_init(mcb FAR * mcbp, UWORD size); INIT VOID mcb_init(mcb FAR * mcbp, UWORD size);
INIT VOID strcat(REG BYTE * d, REG BYTE * s); INIT VOID strcat(REG BYTE * d, REG BYTE * s);
INIT BYTE FAR *KernelAlloc(WORD nBytes);
/* dosfns.c */ /* dosfns.c */
BYTE FAR *get_root(BYTE FAR *); BYTE FAR *get_root(BYTE FAR *);
@ -231,8 +224,8 @@ COUNT DosDup(COUNT Handle);
COUNT DosForceDup(COUNT OldHandle, COUNT NewHandle); COUNT DosForceDup(COUNT OldHandle, COUNT NewHandle);
COUNT DosOpen(BYTE FAR * fname, COUNT mode); COUNT DosOpen(BYTE FAR * fname, COUNT mode);
COUNT DosClose(COUNT hndl); COUNT DosClose(COUNT hndl);
VOID DosGetFree(COUNT drive, COUNT FAR * spc, COUNT FAR * navc, COUNT FAR * bps, COUNT FAR * nc); VOID DosGetFree(UBYTE drive, COUNT FAR * spc, COUNT FAR * navc, COUNT FAR * bps, COUNT FAR * nc);
COUNT DosGetCuDir(COUNT drive, BYTE FAR * s); COUNT DosGetCuDir(UBYTE drive, BYTE FAR * s);
COUNT DosChangeDir(BYTE FAR * s); COUNT DosChangeDir(BYTE FAR * s);
COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name); COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name);
COUNT DosFindNext(void); COUNT DosFindNext(void);
@ -240,14 +233,15 @@ COUNT DosGetFtime(COUNT hndl, date FAR * dp, time FAR * tp);
COUNT DosSetFtime(COUNT hndl, date FAR * dp, time FAR * tp); COUNT DosSetFtime(COUNT hndl, date FAR * dp, time FAR * tp);
COUNT DosGetFattr(BYTE FAR * name, UWORD FAR * attrp); COUNT DosGetFattr(BYTE FAR * name, UWORD FAR * attrp);
COUNT DosSetFattr(BYTE FAR * name, UWORD FAR * attrp); COUNT DosSetFattr(BYTE FAR * name, UWORD FAR * attrp);
BYTE DosSelectDrv(BYTE drv); UBYTE DosSelectDrv(UBYTE drv);
COUNT DosDelete(BYTE FAR *path); COUNT DosDelete(BYTE FAR *path);
COUNT DosRename(BYTE FAR * path1, BYTE FAR * path2); COUNT DosRename(BYTE FAR * path1, BYTE FAR * path2);
COUNT DosMkdir(BYTE FAR * dir); COUNT DosMkdir(BYTE FAR * dir);
COUNT DosRmdir(BYTE FAR * dir); COUNT DosRmdir(BYTE FAR * dir);
struct dhdr FAR * IsDevice(BYTE FAR * FileName); struct dhdr FAR * IsDevice(BYTE FAR * FileName);
/* extern sft FAR *get_free_sft(WORD FAR * sft_idx); BOOL IsShareInstalled(void);
#define FcbGetFreeSft(sft_idx) get_free_sft(sft_idx) */ COUNT DosLockUnlock(COUNT hndl, LONG pos, LONG len, COUNT unlock);
sft FAR *get_free_sft(WORD FAR * sft_idx);
/*dosidle.asm */ /*dosidle.asm */
VOID DosIdle_int(void); VOID DosIdle_int(void);
@ -258,12 +252,12 @@ COUNT ParseDosName(BYTE FAR *, COUNT *, BYTE *, BYTE *, BYTE *, BOOL);
COUNT ParseDosPath(BYTE FAR *, COUNT *, BYTE *, BYTE FAR *); COUNT ParseDosPath(BYTE FAR *, COUNT *, BYTE *, BYTE FAR *);
/* dsk.c */ /* dsk.c */
COUNT FAR init_call_blk_driver(rqptr rp); COUNT FAR blk_driver(rqptr rp);
/* error.c */ /* error.c */
VOID dump(void); VOID dump(void);
VOID panic(BYTE * s); VOID panic(BYTE * s);
__FAR_WRAPPER(VOID, fatal, (BYTE * err_msg)) VOID fatal(BYTE * err_msg);
COUNT char_error(request * rq, struct dhdr FAR * lpDevice); COUNT char_error(request * rq, struct dhdr FAR * lpDevice);
COUNT block_error(request * rq, COUNT nDrive, struct dhdr FAR * lpDevice); COUNT block_error(request * rq, COUNT nDrive, struct dhdr FAR * lpDevice);
@ -277,17 +271,17 @@ COUNT dos_findnext(void);
void ConvertName83ToNameSZ(BYTE FAR *destSZ, BYTE FAR *srcFCBName); void ConvertName83ToNameSZ(BYTE FAR *destSZ, BYTE FAR *srcFCBName);
/* fatfs.c */ /* fatfs.c */
__FAR_WRAPPER(COUNT, dos_open, (BYTE FAR * path, COUNT flag)) COUNT dos_open(BYTE FAR * path, COUNT flag);
BOOL fcmp(BYTE FAR * s1, BYTE FAR * s2, COUNT n); BOOL fcmp(BYTE FAR * s1, BYTE FAR * s2, COUNT n);
BOOL fcmp_wild(BYTE FAR * s1, BYTE FAR * s2, COUNT n); BOOL fcmp_wild(BYTE FAR * s1, BYTE FAR * s2, COUNT n);
VOID touc(BYTE FAR * s, COUNT n); VOID touc(BYTE FAR * s, COUNT n);
__FAR_WRAPPER(COUNT, dos_close, (COUNT fd)) COUNT dos_close(COUNT fd);
COUNT dos_creat(BYTE FAR * path, COUNT attrib); COUNT dos_creat(BYTE FAR * path, COUNT attrib);
COUNT dos_delete(BYTE FAR * path); COUNT dos_delete(BYTE FAR * path);
COUNT dos_rmdir(BYTE FAR * path); COUNT dos_rmdir(BYTE FAR * path);
COUNT dos_rename(BYTE FAR * path1, BYTE FAR * path2); COUNT dos_rename(BYTE FAR * path1, BYTE FAR * path2);
__FAR_WRAPPER(date, dos_getdate, (void)) date dos_getdate(void);
__FAR_WRAPPER(time, dos_gettime, (void)) time dos_gettime(void);
COUNT dos_getftime(COUNT fd, date FAR * dp, time FAR * tp); COUNT dos_getftime(COUNT fd, date FAR * dp, time FAR * tp);
COUNT dos_setftime(COUNT fd, date FAR * dp, time FAR * tp); COUNT dos_setftime(COUNT fd, date FAR * dp, time FAR * tp);
LONG dos_getcufsize(COUNT fd); LONG dos_getcufsize(COUNT fd);
@ -298,10 +292,10 @@ BOOL last_link(struct f_node FAR * fnp);
COUNT map_cluster(REG struct f_node FAR * fnp, COUNT mode); COUNT map_cluster(REG struct f_node FAR * fnp, COUNT mode);
UCOUNT readblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err); UCOUNT readblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err);
UCOUNT writeblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err); UCOUNT writeblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err);
__FAR_WRAPPER(COUNT, dos_read, (COUNT fd, VOID FAR * buffer, UCOUNT count)) COUNT dos_read(COUNT fd, VOID FAR * buffer, UCOUNT count);
COUNT dos_write(COUNT fd, VOID FAR * buffer, UCOUNT count); COUNT dos_write(COUNT fd, VOID FAR * buffer, UCOUNT count);
LONG dos_lseek(COUNT fd, LONG foffset, COUNT origin); LONG dos_lseek(COUNT fd, LONG foffset, COUNT origin);
UWORD dos_free(struct dpb *dpbp); UWORD dos_free(struct dpb FAR *dpbp);
VOID trim_path(BYTE FAR * s); VOID trim_path(BYTE FAR * s);
@ -312,18 +306,19 @@ VOID release_f_node(struct f_node FAR * fnp);
VOID dos_setdta(BYTE FAR * newdta); VOID dos_setdta(BYTE FAR * newdta);
COUNT dos_getfattr(BYTE FAR * name, UWORD FAR * attrp); COUNT dos_getfattr(BYTE FAR * name, UWORD FAR * attrp);
COUNT dos_setfattr(BYTE FAR * name, UWORD FAR * attrp); COUNT dos_setfattr(BYTE FAR * name, UWORD FAR * attrp);
COUNT media_check(REG struct dpb *dpbp); COUNT media_check(REG struct dpb FAR *dpbp);
struct f_node FAR *xlt_fd(COUNT fd); struct f_node FAR *xlt_fd(COUNT fd);
COUNT xlt_fnp(struct f_node FAR * fnp); COUNT xlt_fnp(struct f_node FAR * fnp);
struct dhdr FAR *select_unit(COUNT drive); struct dhdr FAR *select_unit(COUNT drive);
VOID bpb_to_dpb(bpb FAR *bpbp, REG struct dpb FAR * dpbp);
/* fattab.c */ /* fattab.c */
UCOUNT link_fat(struct dpb *dpbp, UCOUNT Cluster1, REG UCOUNT Cluster2); UCOUNT link_fat(struct dpb FAR *dpbp, UCOUNT Cluster1, REG UCOUNT Cluster2);
UCOUNT link_fat16(struct dpb *dpbp, UCOUNT Cluster1, UCOUNT Cluster2); UCOUNT link_fat16(struct dpb FAR *dpbp, UCOUNT Cluster1, UCOUNT Cluster2);
UCOUNT link_fat12(struct dpb *dpbp, UCOUNT Cluster1, UCOUNT Cluster2); UCOUNT link_fat12(struct dpb FAR *dpbp, UCOUNT Cluster1, UCOUNT Cluster2);
UWORD next_cluster(struct dpb *dpbp, REG UCOUNT ClusterNum); UWORD next_cluster(struct dpb FAR *dpbp, REG UCOUNT ClusterNum);
UWORD next_cl16(struct dpb *dpbp, REG UCOUNT ClusterNum); UWORD next_cl16(struct dpb FAR *dpbp, REG UCOUNT ClusterNum);
UWORD next_cl12(struct dpb *dpbp, REG UCOUNT ClusterNum); UWORD next_cl12(struct dpb FAR *dpbp, REG UCOUNT ClusterNum);
/* fcbfns.c */ /* fcbfns.c */
VOID DosOutputString(BYTE FAR * s); VOID DosOutputString(BYTE FAR * s);
@ -345,8 +340,8 @@ BOOL FcbSetRandom(xfcb FAR * lpXfcb);
BOOL FcbCalcRec(xfcb FAR * lpXfcb); BOOL FcbCalcRec(xfcb FAR * lpXfcb);
BOOL FcbRandomBlockRead(xfcb FAR * lpXfcb, COUNT nRecords, COUNT * nErrorCode); BOOL FcbRandomBlockRead(xfcb FAR * lpXfcb, COUNT nRecords, COUNT * nErrorCode);
BOOL FcbRandomBlockWrite(xfcb FAR * lpXfcb, COUNT nRecords, COUNT * nErrorCode); BOOL FcbRandomBlockWrite(xfcb FAR * lpXfcb, COUNT nRecords, COUNT * nErrorCode);
BOOL FcbRandomRead(xfcb FAR * lpXfcb, COUNT * nErrorCode); BOOL FcbRandomIO(xfcb FAR * lpXfcb, COUNT * nErrorCode,
BOOL FcbRandomWrite(xfcb FAR * lpXfcb, COUNT * nErrorCode); BOOL (*FcbFunc)(xfcb FAR *, COUNT *));
BOOL FcbCreate(xfcb FAR * lpXfcb); BOOL FcbCreate(xfcb FAR * lpXfcb);
void FcbNameInit(fcb FAR * lpFcb, BYTE * pszBuffer, COUNT * pCurDrive); void FcbNameInit(fcb FAR * lpFcb, BYTE * pszBuffer, COUNT * pCurDrive);
BOOL FcbOpen(xfcb FAR * lpXfcb); BOOL FcbOpen(xfcb FAR * lpXfcb);
@ -384,8 +379,17 @@ VOID INRPT FAR int2f_handler(void);
VOID INRPT FAR empty_handler(void); VOID INRPT FAR empty_handler(void);
VOID INRPT FAR int0_handler(void); VOID INRPT FAR int0_handler(void);
/* intr.asm */
/* void init_call_intr(int nr, iregs *rp); */
INIT COUNT init_DosRead(COUNT hndl, BYTE *bp, UCOUNT n);
INIT COUNT init_DosOpen(BYTE *fname, COUNT mode);
INIT COUNT init_DosClose(COUNT hndl);
INIT VOID init_PSPInit(seg psp_seg);
INIT VOID keycheck(VOID);
/* ioctl.c */ /* ioctl.c */
COUNT DosDevIOctl(iregs FAR * r, COUNT FAR * err); COUNT DosDevIOctl(iregs FAR * r);
/* main.c */ /* main.c */
INIT VOID main(void); INIT VOID main(void);
@ -393,11 +397,10 @@ INIT BOOL init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine, COUNT mode, COU
/* memmgr.c */ /* memmgr.c */
seg far2para(VOID FAR * p); seg far2para(VOID FAR * p);
seg long2para(LONG size); seg long2para(ULONG size);
VOID FAR *add_far(VOID FAR * fp, ULONG off); VOID FAR *add_far(VOID FAR * fp, ULONG off);
VOID FAR *adjust_far(VOID FAR * fp); VOID FAR *adjust_far(VOID FAR * fp);
__FAR_WRAPPER(COUNT, DosMemAlloc, COUNT DosMemAlloc(UWORD size, COUNT mode, seg FAR * para, UWORD FAR * asize);
(UWORD size, COUNT mode, seg FAR * para, UWORD FAR * asize))
COUNT DosMemLargest(UWORD FAR * size); COUNT DosMemLargest(UWORD FAR * size);
COUNT DosMemFree(UWORD para); COUNT DosMemFree(UWORD para);
COUNT DosMemChange(UWORD para, UWORD size, UWORD * maxSize); COUNT DosMemChange(UWORD para, UWORD size, UWORD * maxSize);
@ -410,16 +413,15 @@ VOID mcb_print(mcb FAR * mcbp);
/* misc.c */ /* misc.c */
/* /*
__FAR_WRAPPER(VOID, scopy, (REG BYTE * s, REG BYTE * d)) VOID scopy(REG BYTE * s, REG BYTE * d);
#define strcpy(d, s) scopy(s, d) #define strcpy(d, s) scopy(s, d)
__FAR_WRAPPER(VOID, fbcopy, (REG VOID FAR * s, REG VOID FAR * d, REG COUNT n)) VOID fbcopy(REG VOID FAR * s, REG VOID FAR * d, REG COUNT n);
*/ */
__FAR_WRAPPER(VOID, strcpy, (REG BYTE * d, REG BYTE * s)) VOID strcpy(REG BYTE * d, REG BYTE * s);
#define scopy(s, d) strcpy(d,s) #define scopy(s, d) strcpy(d,s)
__FAR_WRAPPER(VOID, fmemcpy, (REG VOID FAR * d, REG VOID FAR * s, REG COUNT n)) VOID fmemcpy(REG VOID FAR * d, REG VOID FAR * s, REG COUNT n);
#define fbcopy(s, d, n) fmemcpy(d,s,n) #define fbcopy(s, d, n) fmemcpy(d,s,n)
void FAR _reloc_call_fmemcpy(REG VOID FAR * d, REG VOID FAR * s, REG COUNT n);
/*VOID fscopy(REG BYTE FAR * s, REG BYTE FAR * d);*/ /*VOID fscopy(REG BYTE FAR * s, REG BYTE FAR * d);*/
@ -432,8 +434,8 @@ VOID fstrcpy(REG BYTE FAR * d, REG BYTE FAR * s);
void memcpy(REG BYTE * d, REG BYTE * s, REG COUNT n); void memcpy(REG BYTE * d, REG BYTE * s, REG COUNT n);
#define bcopy(s,d,n) memcpy(d,s,n) #define bcopy(s,d,n) memcpy(d,s,n)
__FAR_WRAPPER(void, fmemset,(REG VOID FAR * s, REG int ch, REG COUNT n)) void fmemset(REG VOID FAR * s, REG int ch, REG COUNT n);
__FAR_WRAPPER(void, memset ,(REG VOID * s, REG int ch, REG COUNT n)) void memset(REG VOID * s, REG int ch, REG COUNT n);
/* nls.c */ /* nls.c */
@ -460,16 +462,16 @@ UWORD syscall_MUX14(DIRECT_IREGS);
/* prf.c */ /* prf.c */
VOID put_console(COUNT c); VOID put_console(COUNT c);
__FAR_WRAPPER(WORD, printf, (CONST BYTE * fmt,...)) WORD printf(CONST BYTE * fmt,...);
WORD sprintf(BYTE * buff, CONST BYTE * fmt,...); WORD sprintf(BYTE * buff, CONST BYTE * fmt,...);
VOID hexd(char *title,VOID FAR *p,COUNT numBytes); VOID hexd(char *title,VOID FAR *p,COUNT numBytes);
/* strings.c */ /* strings.c */
__FAR_WRAPPER(COUNT, strlen, (REG BYTE * s)) COUNT strlen(REG BYTE * s);
COUNT fstrlen(REG BYTE FAR * s); COUNT fstrlen(REG BYTE FAR * s);
VOID _fstrcpy(REG BYTE FAR * d, REG BYTE FAR * s); VOID _fstrcpy(REG BYTE FAR * d, REG BYTE FAR * s);
VOID strncpy(REG BYTE * d, REG BYTE * s, COUNT l); VOID strncpy(REG BYTE * d, REG BYTE * s, COUNT l);
__FAR_WRAPPER(COUNT, strcmp, (REG BYTE * d, REG BYTE * s)) COUNT strcmp(REG BYTE * d, REG BYTE * s);
COUNT fstrcmp(REG BYTE FAR * d, REG BYTE FAR * s); COUNT fstrcmp(REG BYTE FAR * d, REG BYTE FAR * s);
COUNT fstrncmp(REG BYTE FAR * d, REG BYTE FAR * s, COUNT l); COUNT fstrncmp(REG BYTE FAR * d, REG BYTE FAR * s, COUNT l);
COUNT strncmp(REG BYTE * d, REG BYTE * s, COUNT l); COUNT strncmp(REG BYTE * d, REG BYTE * s, COUNT l);
@ -483,7 +485,7 @@ void fstrncpy(REG BYTE FAR * d, REG BYTE FAR * s, COUNT l);
BYTE *strchr(BYTE * s, BYTE c); BYTE *strchr(BYTE * s, BYTE c);
/* sysclk.c */ /* sysclk.c */
WORD FAR init_call_clk_driver(rqptr rp); WORD FAR clk_driver(rqptr rp);
COUNT BcdToByte(COUNT x); COUNT BcdToByte(COUNT x);
COUNT BcdToWord(BYTE * x, UWORD * mon, UWORD * day, UWORD * yr); COUNT BcdToWord(BYTE * x, UWORD * mon, UWORD * day, UWORD * yr);
COUNT ByteToBcd(COUNT x); COUNT ByteToBcd(COUNT x);
@ -505,7 +507,7 @@ VOID DosGetDate(BYTE FAR * wdp, BYTE FAR * mp, BYTE FAR * mdp, COUNT FAR * yp);
COUNT DosSetDate(BYTE FAR * mp, BYTE FAR * mdp, COUNT FAR * yp); COUNT DosSetDate(BYTE FAR * mp, BYTE FAR * mdp, COUNT FAR * yp);
WORD *is_leap_year_monthdays(int year); WORD *is_leap_year_monthdays(int year);
__FAR_WRAPPER(WORD,DaysFromYearMonthDay,(WORD Year, WORD Month, WORD DayOfMonth)) WORD DaysFromYearMonthDay(WORD Year, WORD Month, WORD DayOfMonth);
@ -513,10 +515,9 @@ __FAR_WRAPPER(WORD,DaysFromYearMonthDay,(WORD Year, WORD Month, WORD DayOfMonth)
COUNT ChildEnv(exec_blk FAR * exp, UWORD * pChildEnvSeg, char far * pathname); COUNT ChildEnv(exec_blk FAR * exp, UWORD * pChildEnvSeg, char far * pathname);
VOID new_psp(psp FAR * p, int psize); VOID new_psp(psp FAR * p, int psize);
VOID return_user(void); VOID return_user(void);
__FAR_WRAPPER(COUNT, DosExec, (COUNT mode, exec_blk FAR * ep, BYTE FAR * lp)) COUNT DosExec(COUNT mode, exec_blk FAR * ep, BYTE FAR * lp);
__FAR_WRAPPER(VOID, InitPSP, (VOID)) VOID InitPSP(VOID);
VOID p_0(VOID);
VOID FAR init_call_p_0(VOID);
/* irqstack.asm */ /* irqstack.asm */
VOID init_stacks(VOID FAR * stack_base, COUNT nStacks, WORD stackSize); VOID init_stacks(VOID FAR * stack_base, COUNT nStacks, WORD stackSize);

View File

@ -29,6 +29,9 @@
; $Header$ ; $Header$
; ;
; $Log$ ; $Log$
; Revision 1.5 2001/04/15 03:21:50 bartoldeman
; See history.txt for the list of fixes.
;
; Revision 1.4 2001/03/21 02:56:26 bartoldeman ; Revision 1.4 2001/03/21 02:56:26 bartoldeman
; See history.txt for changes. Bug fixes and HMA support are the main ones. ; See history.txt for changes. Bug fixes and HMA support are the main ones.
; ;
@ -58,7 +61,7 @@
; ;
group TGROUP _TEXT _IO_TEXT _IO_FIXED_DATA group TGROUP _TEXT _IO_TEXT _IO_FIXED_DATA
group DGROUP _FIXED_DATA _DATA _BSS _BSSEND group DGROUP _FIXED_DATA _DATA _BSS _BSSEND ID_B ID ID_E
group HGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END group HGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END
group IGROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END group IGROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END
@ -70,6 +73,9 @@ segment _DATA class=DATA align=2
segment _BSSSTART class=BSS align=2 segment _BSSSTART class=BSS align=2
segment _BSS class=BSS align=2 segment _BSS class=BSS align=2
segment _BSSEND class=BSS segment _BSSEND class=BSS
segment ID_B class=ID align=2
segment ID class=ID align=2
segment ID_E class=ID align=2
segment HMA_TEXT_START class=HMA segment HMA_TEXT_START class=HMA
segment HMA_TEXT class=HMA segment HMA_TEXT class=HMA
segment HMA_TEXT_END class=HMA segment HMA_TEXT_END class=HMA

View File

@ -34,6 +34,9 @@ static BYTE *stringsRcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.5 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.4 2001/03/21 02:56:26 bartoldeman * Revision 1.4 2001/03/21 02:56:26 bartoldeman
* See history.txt for changes. Bug fixes and HMA support are the main ones. * See history.txt for changes. Bug fixes and HMA support are the main ones.
* *
@ -104,11 +107,6 @@ COUNT strlen(REG BYTE * s)
return cnt; return cnt;
} }
COUNT FAR init_call_strlen(REG BYTE * s)
{
return strlen(s);
}
COUNT fstrlen(REG BYTE FAR * s) COUNT fstrlen(REG BYTE FAR * s)
{ {
REG WORD cnt = 0; REG WORD cnt = 0;
@ -145,11 +143,6 @@ COUNT strcmp(REG BYTE * d, REG BYTE * s)
return *d - *s; return *d - *s;
} }
COUNT FAR init_call_strcmp(REG BYTE * d, REG BYTE * s)
{
return strcmp(d, s);
}
COUNT fstrcmp(REG BYTE FAR * d, REG BYTE FAR * s) COUNT fstrcmp(REG BYTE FAR * d, REG BYTE FAR * s)
{ {
while (*s != '\0' && *d != '\0') while (*s != '\0' && *d != '\0')

View File

@ -35,6 +35,9 @@ static BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.5 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.4 2001/03/21 02:56:26 bartoldeman * Revision 1.4 2001/03/21 02:56:26 bartoldeman
* See history.txt for changes. Bug fixes and HMA support are the main ones. * See history.txt for changes. Bug fixes and HMA support are the main ones.
* *
@ -121,17 +124,16 @@ static UWORD Month,
Year; Year;
static BYTE bcdMinutes; static BYTE bcdMinutes;
static BYTE bcdHours; static BYTE bcdHours;
static BYTE bcdHundredths; /** static BYTE bcdHundredths;*/
static BYTE bcdSeconds; static BYTE bcdSeconds;
static ULONG Ticks; static ULONG Ticks;
UWORD DaysSinceEpoch = 0; UWORD DaysSinceEpoch = 0;
WORD FAR init_call_clk_driver(rqptr rp) WORD FAR clk_driver(rqptr rp)
{ {
COUNT COUNT
c; c;
int FAR *cp;
WORD *pdays; WORD *pdays;
switch (rp->r_command) switch (rp->r_command)
@ -337,9 +339,3 @@ VOID DayToBcd(BYTE * x, UWORD * mon, UWORD * day, UWORD * yr)
x[3] = ByteToBcd(*yr / 100); x[3] = ByteToBcd(*yr / 100);
x[2] = ByteToBcd(*yr % 100); x[2] = ByteToBcd(*yr % 100);
} }
/* Used by `main.c'. */
VOID FAR init_call_WritePCClock(ULONG ticks)
{
WritePCClock(ticks);
}

View File

@ -37,6 +37,9 @@ static BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.5 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.4 2001/03/21 02:56:26 bartoldeman * Revision 1.4 2001/03/21 02:56:26 bartoldeman
* See history.txt for changes. Bug fixes and HMA support are the main ones. * See history.txt for changes. Bug fixes and HMA support are the main ones.
* *
@ -133,11 +136,6 @@ WORD DaysFromYearMonthDay(WORD Year, WORD Month, WORD DayOfMonth)
+ ((Year - 1980 + 3) / 4); + ((Year - 1980 + 3) / 4);
} }
WORD FAR init_call_DaysFromYearMonthDay(WORD Year, WORD Month, WORD DayOfMonth)
{
return DaysFromYearMonthDay(Year,Month,DayOfMonth);
}
/* common - call the clock driver */ /* common - call the clock driver */
void ExecuteClockDriverRequest(BYTE command) void ExecuteClockDriverRequest(BYTE command)

View File

@ -35,6 +35,9 @@ static BYTE *RcsId = "$Id$";
/* /*
* $Log$ * $Log$
* Revision 1.10 2001/04/15 03:21:50 bartoldeman
* See history.txt for the list of fixes.
*
* Revision 1.9 2001/03/31 20:54:52 bartoldeman * Revision 1.9 2001/03/31 20:54:52 bartoldeman
* Made SHELLHIGH behave more like LOADHIGH. * Made SHELLHIGH behave more like LOADHIGH.
* *
@ -149,6 +152,8 @@ static BYTE *RcsId = "$Id$";
* Initial revision. * Initial revision.
*/ */
extern VOID ClaimINITDataSegment(VOID);
#define toupper(c) ((c) >= 'a' && (c) <= 'z' ? (c) + ('A' - 'a') : (c)) #define toupper(c) ((c) >= 'a' && (c) <= 'z' ? (c) + ('A' - 'a') : (c))
#define LOADNGO 0 #define LOADNGO 0
@ -160,7 +165,7 @@ static BYTE *RcsId = "$Id$";
static exe_header header; static exe_header header;
#define CHUNK 32256 #define CHUNK 32256
#define MAXENV 32768 #define MAXENV 32768u
#define ENV_KEEPFREE 83 /* keep unallocated by environment variables */ #define ENV_KEEPFREE 83 /* keep unallocated by environment variables */
/* The '65' added to nEnvSize does not cover the additional stuff: /* The '65' added to nEnvSize does not cover the additional stuff:
+ 2 bytes: number of strings + 2 bytes: number of strings
@ -311,12 +316,10 @@ COUNT ChildEnv(exec_blk FAR * exp, UWORD * pChildEnvSeg, char far * pathname)
VOID new_psp(psp FAR * p, int psize) VOID new_psp(psp FAR * p, int psize)
{ {
REG COUNT i; REG COUNT i;
BYTE FAR *lpPspBuffer;
psp FAR *q = MK_FP(cu_psp, 0); psp FAR *q = MK_FP(cu_psp, 0);
/* Clear out new psp first */ /* Clear out new psp first */
for (lpPspBuffer = (BYTE FAR *) p, i = 0; i < sizeof(psp); ++i) fmemset(p, 0, sizeof(psp));
*lpPspBuffer = 0;
/* initialize all entries and exits */ /* initialize all entries and exits */
/* CP/M-like exit point */ /* CP/M-like exit point */
@ -364,7 +367,7 @@ VOID new_psp(psp FAR * p, int psize)
p->ps_filetab = p->ps_files; p->ps_filetab = p->ps_files;
/* clone the file table */ /* clone the file table */
if (InDOS > 0) if (p!=q)
{ {
REG COUNT i; REG COUNT i;
@ -376,15 +379,6 @@ VOID new_psp(psp FAR * p, int psize)
p->ps_filetab[i] = 0xff; p->ps_filetab[i] = 0xff;
} }
} }
else
{
/* initialize stdin, stdout, etc */
p->ps_files[STDIN] = 0; /* stdin */
p->ps_files[STDOUT] = 1; /* stdout */
p->ps_files[STDERR] = 2; /* stderr */
p->ps_files[STDAUX] = 3; /* stdaux */
p->ps_files[STDPRN] = 4; /* stdprn */
}
/* first command line argument */ /* first command line argument */
p->ps_fcb1.fcb_drive = 0; p->ps_fcb1.fcb_drive = 0;
@ -540,14 +534,16 @@ COUNT DosComLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
sp = MK_FP(mem, 0); sp = MK_FP(mem, 0);
else else
{ /* test the filesize against the allocated memory */ { /* test the filesize against the allocated memory */
UWORD tmp = 16;
sp = MK_FP(mem, sizeof(psp)); sp = MK_FP(mem, sizeof(psp));
/* This is a potential problem, what to do with .COM files larger than /* This is a potential problem, what to do with .COM files larger than
the allocated memory? the allocated memory?
MS DOS always only loads the very first 64KB - sizeof(psp) bytes. MS DOS always only loads the very first 64KB - sizeof(psp) bytes.
-- 1999/04/21 ska */ -- 1999/04/21 ska */
if (com_size > (LONG) asize << 4) /* less memory than the .COM file has */ if ((ULONG)com_size > (ULONG)asize * tmp) /* less memory than the .COM file has */
com_size = (LONG) asize << 4; (ULONG)com_size = (ULONG)asize * tmp; /* << 4 */
} }
do do
{ {
@ -597,6 +593,14 @@ COUNT DosComLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
{ {
cu_psp = mem; cu_psp = mem;
dta = p->ps_dta; dta = p->ps_dta;
/* if that's the first time, we arrive here
now we 1 microsecond from COMMAND.COM
now we claim the ID = INIT_DATA segment,
which should no longer be used
*/
ClaimINITDataSegment();
if (InDOS) if (InDOS)
--InDOS; --InDOS;
exec_user(irp); exec_user(irp);
@ -693,13 +697,15 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
mem = exp->load.load_seg; mem = exp->load.load_seg;
/* compute image offset from the header */ /* compute image offset from the header */
image_offset = (ULONG) header.exHeaderSize * 16l; asize = 16;
image_offset = (ULONG)header.exHeaderSize * asize;
/* compute image size by removing the offset from the */ /* compute image size by removing the offset from the */
/* number pages scaled to bytes plus the remainder and */ /* number pages scaled to bytes plus the remainder and */
/* the psp */ /* the psp */
/* First scale the size */ /* First scale the size */
image_size = (ULONG) (header.exPages) * 512l; asize = 512;
image_size = (ULONG)header.exPages * asize;
/* remove the offset */ /* remove the offset */
image_size -= image_offset; image_size -= image_offset;
@ -777,7 +783,15 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
asize = exe_size; asize = exe_size;
#ifdef DEBUG #ifdef DEBUG
printf("loading %s at %04x\n", (char*)namep,mem); { COUNT i = 0;
printf("loading '");
while (namep[i]!=0)
{
cso(namep[i]);
i++;
}
printf("' at %04x\n", mem);
}
#endif #endif
/* /// Added open curly brace and "else" clause. We should not attempt /* /// Added open curly brace and "else" clause. We should not attempt
@ -844,6 +858,8 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
if (exe_size > 0) if (exe_size > 0)
{ {
UCOUNT tmp = 16;
sp = MK_FP(start_seg, 0x0); sp = MK_FP(start_seg, 0x0);
if (mode != OVERLAY) if (mode != OVERLAY)
@ -851,7 +867,7 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
if ((header.exMinAlloc == 0) && (header.exMaxAlloc == 0)) if ((header.exMinAlloc == 0) && (header.exMaxAlloc == 0))
{ {
sp = MK_FP(start_seg + mp->m_size sp = MK_FP(start_seg + mp->m_size
- (image_size + 15) / 16, 0); - (image_size + 15) / tmp, 0);
} }
} }
@ -928,6 +944,15 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
case LOADNGO: case LOADNGO:
cu_psp = mem; cu_psp = mem;
dta = p->ps_dta; dta = p->ps_dta;
/* if that's the first time, we arrive here
now we 1 microsecond from COMMAND.COM
now we claim the ID = INIT_DATA segment,
which should no longer be used
*/
ClaimINITDataSegment();
if (InDOS) if (InDOS)
--InDOS; --InDOS;
exec_user(irp); exec_user(irp);
@ -954,15 +979,14 @@ COUNT DosExec(COUNT mode, exec_blk FAR * ep, BYTE FAR * lp)
{ {
COUNT rc, COUNT rc,
err; err;
exec_blk leb = *ep; exec_blk leb;
/* BYTE FAR *cp;*/ /* BYTE FAR *cp;*/
BOOL bIsCom = FALSE; BOOL bIsCom = FALSE;
fmemcpy(&leb, ep, sizeof(exec_blk));
/* If file not found - free ram and return error */ /* If file not found - free ram and return error */
if (cu_psp == DOS_PSP)
InitPSP();
if ((rc = DosOpen(lp, 0)) < 0) if ((rc = DosOpen(lp, 0)) < 0)
{ {
return DE_FILENOTFND; return DE_FILENOTFND;
@ -985,43 +1009,22 @@ COUNT DosExec(COUNT mode, exec_blk FAR * ep, BYTE FAR * lp)
rc = DosExeLoader(lp, &leb, mode); rc = DosExeLoader(lp, &leb, mode);
} }
if (mode == LOAD && rc == SUCCESS) if (mode == LOAD && rc == SUCCESS)
*ep = leb; fmemcpy(ep, &leb, sizeof(exec_blk));
return rc; return rc;
} }
COUNT FAR init_call_DosExec(COUNT mode, exec_blk FAR * ep, BYTE FAR * lp)
{
return DosExec(mode, ep, lp);
}
VOID InitPSP(VOID)
{
psp FAR *p = MK_FP(DOS_PSP, 0);
/*
Fixed Device Driver Print output.
*/
if(p->ps_exit == 0x000020cd)
return;
new_psp(p, 0);
}
UBYTE P_0_startmode = 0;
/* process 0 */ /* process 0 */
VOID FAR reloc_call_p_0(VOID) VOID p_0(VOID)
{ {
exec_blk exb; exec_blk exb;
CommandTail Cmd; CommandTail Cmd;
BYTE FAR *szfInitialPrgm = (BYTE FAR *) Config.cfgInit; BYTE FAR *szfInitialPrgm = (BYTE FAR *) Config.cfgInit;
int rc; int rc;
/* init a fake psp file at seg 50:0000 */
psp FAR *p = MK_FP(cu_psp, 0);
new_psp(p, 0);
/* Execute command.com /P from the drive we just booted from */ /* Execute command.com /P from the drive we just booted from */
exb.exec.env_seg = master_env; exb.exec.env_seg = master_env;
strcpy(Cmd.ctBuffer, Config.cfgInitTail); fstrncpy(Cmd.ctBuffer, Config.cfgInitTail, sizeof(Config.cfgInitTail)-1);
for (Cmd.ctCount = 0; Cmd.ctCount < 127; Cmd.ctCount++) for (Cmd.ctCount = 0; Cmd.ctCount < 127; Cmd.ctCount++)
if (Cmd.ctBuffer[Cmd.ctCount] == '\r') if (Cmd.ctBuffer[Cmd.ctCount] == '\r')

View File

@ -4,6 +4,9 @@
# $Id$ # $Id$
# #
# $Log$ # $Log$
# Revision 1.7 2001/04/15 03:21:50 bartoldeman
# See history.txt for the list of fixes.
#
# Revision 1.6 2001/03/25 04:33:56 bartoldeman # Revision 1.6 2001/03/25 04:33:56 bartoldeman
# Fix compilation of sys.com. Now a proper .com file once again. # Fix compilation of sys.com. Now a proper .com file once again.
# #
@ -43,7 +46,7 @@
!include "..\config.mak" !include "..\config.mak"
CFLAGS = -mt -1- -v -vi- -k- -f- -ff- -O -Z -d -I$(INCLUDEPATH);..\hdr \ CFLAGS = -mt -1- -v -vi- -k- -f- -ff- -O -Z -d -I$(INCLUDEPATH);..\hdr \
-DI86;PROTO -zAHMA -zCHMA_TEXT -zPDGROUP -DI86;PROTO
# *Implicit Rules* # *Implicit Rules*
.c.obj: .c.obj:
@ -54,11 +57,11 @@ CFLAGS = -mt -1- -v -vi- -k- -f- -ff- -O -Z -d -I$(INCLUDEPATH);..\hdr \
# *List Macros* # *List Macros*
LIBS = ..\lib\device.lib LIBS = floppy.obj
EXE_dependencies = \ EXE_dependencies = \
sys.obj \ sys.obj \
$(LIBS) floppy.obj
# *Explicit Rules* # *Explicit Rules*
production: ..\bin\sys.com production: ..\bin\sys.com
@ -72,9 +75,12 @@ b_fat12.h: ..\boot\b_fat12.bin bin2c.com
b_fat16.h: ..\boot\b_fat16.bin bin2c.com b_fat16.h: ..\boot\b_fat16.bin bin2c.com
bin2c ..\boot\b_fat16.bin b_fat16.h b_fat16 bin2c ..\boot\b_fat16.bin b_fat16.h b_fat16
floppy.obj: ..\drivers\floppy.asm
$(NASM) -fobj -DSYS=1 ..\drivers\floppy.asm -o floppy.obj
sys.com: $(EXE_dependencies) sys.com: $(EXE_dependencies)
$(LINK) /m/t/c $(LIBPATH)\c0t.obj+sys.obj,sys,,\ $(LINK) /m/t/c $(LIBPATH)\c0t.obj+sys.obj+$(LIBS),sys,,\
$(LIBS)+$(CLIB); $(CLIB);
clobber: clean clobber: clean
$(RM) sys.com b_fat12.h b_fat16.h $(RM) sys.com b_fat12.h b_fat16.h
@ -84,3 +90,8 @@ clean:
# *Individual File Dependencies* # *Individual File Dependencies*
sys.obj: sys.c ..\hdr\portab.h ..\hdr\device.h b_fat12.h b_fat16.h sys.obj: sys.c ..\hdr\portab.h ..\hdr\device.h b_fat12.h b_fat16.h
# RULES (DEPENDENCIES)
# ----------------
.asm.obj :
$(NASM) -f obj -DSYS=1 $<