mirror of
https://github.com/FDOS/kernel.git
synced 2025-07-27 07:44:09 +02:00
See history.txt for changes. Bug fixes and HMA support are the main ones.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@167 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
513094d9fe
commit
f2184025da
@ -1,3 +1,28 @@
|
|||||||
|
2001 Mar 21 - Build 2022
|
||||||
|
-------- Bart Oldeman (bart.oldeman@bristol.ac.uk)
|
||||||
|
+ Clean A lot of space savings by Tom Ehlert, merely because Turbo C 2.01 does not
|
||||||
|
do it. And several more complicated situations as well, like coding some
|
||||||
|
string functions in assembly (asmsupt.asm).
|
||||||
|
+ Add Tom Ehlert: support for DOS=HIGH. Now most of the kernel can be loaded into
|
||||||
|
the HMA. This required a lot of segmentation changes. Let's hope the best
|
||||||
|
of it. Support for device drivers with multiple devices.
|
||||||
|
+ Fixes From Tom Ehlert:
|
||||||
|
task.c bug fix (image_size is in bytes)
|
||||||
|
dosfns.c change dir to E:\FREEDOS\*.PRJ fix
|
||||||
|
fcbfns.c fixes.
|
||||||
|
break.c Ctrl-C Ctrl-C -> crash temporary fix.
|
||||||
|
+ Fixes From Bart:
|
||||||
|
Let UMBs work again after HMA changes.
|
||||||
|
Be able to compile sys.com again. Is now really a .exe file but still masks
|
||||||
|
as .com in the hope that we can make it a real .com again.
|
||||||
|
DeviceHigh loads low if there are not enough UMB's available.
|
||||||
|
Fixed another redirector problem.
|
||||||
|
+ Update Optimized asmsupt.asm a bit with help of the glibc 2.2 source.
|
||||||
|
+ Fixes Tom Ehlert and Brian Reifsnyder: fix partition detection in dsk.c +
|
||||||
|
other bug fixes (also: floppy.asm).
|
||||||
|
+ Update Tom Ehlert optimized blockio.c.
|
||||||
|
+ Fixes a few small ones from Tom I forgot.
|
||||||
|
|
||||||
2001 Mar 08 - Build 2022
|
2001 Mar 08 - Build 2022
|
||||||
-------- Bart Oldeman (bart.oldeman@bristol.ac.uk)
|
-------- Bart Oldeman (bart.oldeman@bristol.ac.uk)
|
||||||
+ Fixes MCB chain corruption fix (thanks Tom Ehlert and Martin Stromberg)
|
+ Fixes MCB chain corruption fix (thanks Tom Ehlert and Martin Stromberg)
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
; $Header$
|
; $Header$
|
||||||
;
|
;
|
||||||
; $Log$
|
; $Log$
|
||||||
|
; Revision 1.4 2001/03/21 02:56:25 bartoldeman
|
||||||
|
; See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
;
|
||||||
; 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
|
||||||
;
|
;
|
||||||
@ -66,20 +69,20 @@
|
|||||||
;Initial revision.
|
;Initial revision.
|
||||||
;
|
;
|
||||||
|
|
||||||
group TGROUP _TEXT
|
%include "..\kernel\segs.inc"
|
||||||
group DGROUP _DATA
|
|
||||||
|
|
||||||
segment _DATA align=2 class=DATA
|
segment _DATA align=2 class=DATA
|
||||||
extern last:wrt DGROUP
|
extern __bssend:wrt DGROUP
|
||||||
|
|
||||||
segment _TEXT class=CODE
|
segment HMA_TEXT
|
||||||
|
|
||||||
global _device_end
|
global _device_end
|
||||||
|
|
||||||
_device_end:
|
_device_end:
|
||||||
push bp
|
push bp
|
||||||
mov bp,sp
|
mov bp,sp
|
||||||
mov ax,last
|
mov ax,__bssend
|
||||||
mov dx,DGROUP
|
mov dx,DGROUP
|
||||||
pop bp
|
pop bp
|
||||||
ret
|
ret
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
; $Id$
|
; $Id$
|
||||||
;
|
;
|
||||||
; $Log$
|
; $Log$
|
||||||
|
; Revision 1.4 2001/03/21 02:56:25 bartoldeman
|
||||||
|
; See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
;
|
||||||
; 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
|
||||||
;
|
;
|
||||||
@ -77,9 +80,9 @@
|
|||||||
;Initial revision.
|
;Initial revision.
|
||||||
;
|
;
|
||||||
|
|
||||||
group TGROUP _TEXT
|
%include "..\kernel\segs.inc"
|
||||||
|
|
||||||
segment _TEXT class=CODE
|
segment HMA_TEXT
|
||||||
|
|
||||||
;
|
;
|
||||||
;
|
;
|
||||||
@ -211,37 +214,6 @@ _fl_rd_status:
|
|||||||
;
|
;
|
||||||
; Returns 0 if successful, error code otherwise.
|
; Returns 0 if successful, error code otherwise.
|
||||||
;
|
;
|
||||||
global _fl_read
|
|
||||||
_fl_read:
|
|
||||||
push bp ; C entry
|
|
||||||
mov bp,sp
|
|
||||||
|
|
||||||
mov dl,[bp+4] ; get the drive (if or'ed 80h its
|
|
||||||
; hard drive.
|
|
||||||
mov dh,[bp+6] ; get the head number
|
|
||||||
mov ch,[bp+8] ; cylinder number (lo only if hard)
|
|
||||||
mov al,[bp+9h] ; get the top of cylinder
|
|
||||||
xor ah,ah
|
|
||||||
mov cl,6 ; form top of cylinder for sector
|
|
||||||
shl ax,cl
|
|
||||||
mov cl,[bp+0Ah] ; sector number
|
|
||||||
and cl,03fh ; mask to sector field bits 5-0
|
|
||||||
or cl,al ; or in bits 7-6
|
|
||||||
mov al,[bp+0Ch]
|
|
||||||
les bx,[bp+0Eh] ; Load 32 bit buffer ptr
|
|
||||||
|
|
||||||
mov ah,2
|
|
||||||
int 13h ; read sectors to memory es:bx
|
|
||||||
|
|
||||||
mov al,ah
|
|
||||||
jc fl_rd1 ; error, return error code
|
|
||||||
xor al,al ; Zero transfer count
|
|
||||||
fl_rd1:
|
|
||||||
xor ah,ah ; force into < 255 count
|
|
||||||
pop bp
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
; Write Sectors
|
; Write Sectors
|
||||||
;
|
;
|
||||||
@ -251,60 +223,59 @@ fl_rd1:
|
|||||||
;
|
;
|
||||||
; Returns 0 if successful, error code otherwise.
|
; Returns 0 if successful, error code otherwise.
|
||||||
;
|
;
|
||||||
|
global _fl_read
|
||||||
|
_fl_read:
|
||||||
|
mov ah,2 ; cmd READ
|
||||||
|
jmp short fl_common
|
||||||
|
|
||||||
|
global _fl_verify
|
||||||
|
_fl_verify:
|
||||||
|
mov ah,4 ; cmd verify
|
||||||
|
jmp short fl_common
|
||||||
|
|
||||||
global _fl_write
|
global _fl_write
|
||||||
_fl_write:
|
_fl_write:
|
||||||
|
mov ah,3 ; cmd WRITE
|
||||||
|
|
||||||
|
fl_common:
|
||||||
push bp ; C entry
|
push bp ; C entry
|
||||||
mov bp,sp
|
mov bp,sp
|
||||||
|
|
||||||
mov dl,[bp+4] ; get the drive (if or'ed 80h its
|
mov dl,[bp+4] ; get the drive (if or'ed 80h its
|
||||||
; hard drive.
|
; hard drive.
|
||||||
mov dh,[bp+6] ; get the head number
|
mov dh,[bp+6] ; get the head number
|
||||||
mov ch,[bp+8] ; cylinder number (lo only if hard)
|
mov bx,[bp+8] ; cylinder number (lo only if hard)
|
||||||
mov al,[bp+9h] ; get the top of cylinder
|
|
||||||
xor ah,ah
|
mov al,1 ; this should be an error code
|
||||||
mov cl,6 ; form top of cylinder for sector
|
cmp bx,3ffh ; this code can't write above 3ff=1023
|
||||||
shl ax,cl
|
ja fl_error
|
||||||
|
|
||||||
|
mov ch,bl ; low 8 bits of cyl number
|
||||||
|
|
||||||
|
xor bl,bl ; extract bits 8+9 to cl
|
||||||
|
shr bx,1
|
||||||
|
shr bx,1
|
||||||
|
|
||||||
|
|
||||||
mov cl,[bp+0Ah] ; sector number
|
mov cl,[bp+0Ah] ; sector number
|
||||||
and cl,03fh ; mask to sector field bits 5-0
|
and cl,03fh ; mask to sector field bits 5-0
|
||||||
or cl,al ; or in bits 7-6
|
or cl,bl ; or in bits 7-6
|
||||||
mov al,[bp+0Ch]
|
|
||||||
|
mov al,[bp+0Ch] ; count to read/write
|
||||||
les bx,[bp+0Eh] ; Load 32 bit buffer ptr
|
les bx,[bp+0Eh] ; Load 32 bit buffer ptr
|
||||||
|
|
||||||
mov ah,3
|
|
||||||
int 13h ; write sectors from mem es:bx
|
int 13h ; write sectors from mem es:bx
|
||||||
|
|
||||||
mov al,ah
|
mov al,ah
|
||||||
jc fl_wr1 ; error, return error code
|
jc fl_wr1 ; error, return error code
|
||||||
xor al,al ; Zero transfer count
|
xor al,al ; Zero transfer count
|
||||||
fl_wr1:
|
fl_wr1:
|
||||||
|
fl_error:
|
||||||
xor ah,ah ; force into < 255 count
|
xor ah,ah ; force into < 255 count
|
||||||
pop bp
|
pop bp
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
;
|
|
||||||
; SUBROUTINE
|
|
||||||
;
|
|
||||||
|
|
||||||
global _fl_verify
|
|
||||||
_fl_verify:
|
|
||||||
push bp
|
|
||||||
mov bp,sp
|
|
||||||
mov dl,[bp+4]
|
|
||||||
mov dh,[bp+6]
|
|
||||||
mov ch,[bp+8]
|
|
||||||
mov cl,[bp+0Ah]
|
|
||||||
mov al,[bp+0Ch]
|
|
||||||
mov ah,4
|
|
||||||
int 13h ; Disk dl=drive a: ah=func 04h
|
|
||||||
; verify sectors with mem es:bx
|
|
||||||
mov al,ah
|
|
||||||
jc fl_ver1 ; Jump if carry Set
|
|
||||||
xor al,al ; Zero register
|
|
||||||
fl_ver1:
|
|
||||||
xor ah,ah ; Zero register
|
|
||||||
pop bp
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
global _fl_format
|
global _fl_format
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
; $Header$
|
; $Header$
|
||||||
;
|
;
|
||||||
; $Log$
|
; $Log$
|
||||||
|
; Revision 1.4 2001/03/21 02:56:25 bartoldeman
|
||||||
|
; See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
;
|
||||||
; 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
|
||||||
;
|
;
|
||||||
@ -66,9 +69,9 @@
|
|||||||
;Initial revision.
|
;Initial revision.
|
||||||
;
|
;
|
||||||
|
|
||||||
group TGROUP _TEXT
|
%include "..\kernel\segs.inc"
|
||||||
|
|
||||||
segment _TEXT class=CODE
|
segment HMA_TEXT
|
||||||
|
|
||||||
global _getvec
|
global _getvec
|
||||||
_getvec:
|
_getvec:
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
; $Header$
|
; $Header$
|
||||||
;
|
;
|
||||||
; $Log$
|
; $Log$
|
||||||
|
; Revision 1.4 2001/03/21 02:56:25 bartoldeman
|
||||||
|
; See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
;
|
||||||
; 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
|
||||||
;
|
;
|
||||||
@ -69,9 +72,10 @@
|
|||||||
;Initial revision.
|
;Initial revision.
|
||||||
;
|
;
|
||||||
|
|
||||||
group TGROUP _TEXT
|
%include "..\kernel\segs.inc"
|
||||||
|
|
||||||
segment _TEXT class=CODE
|
|
||||||
|
segment HMA_TEXT
|
||||||
|
|
||||||
;
|
;
|
||||||
; BOOL ReadPCClock(Ticks)
|
; BOOL ReadPCClock(Ticks)
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
; $Header$
|
; $Header$
|
||||||
;
|
;
|
||||||
; $Log$
|
; $Log$
|
||||||
|
; Revision 1.4 2001/03/21 02:56:25 bartoldeman
|
||||||
|
; See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
;
|
||||||
; 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
|
||||||
;
|
;
|
||||||
@ -66,10 +69,9 @@
|
|||||||
;Initial revision.
|
;Initial revision.
|
||||||
;
|
;
|
||||||
|
|
||||||
group TGROUP _TEXT
|
%include "..\kernel\segs.inc"
|
||||||
group DGROUP _BSS
|
|
||||||
|
|
||||||
segment _TEXT class=CODE
|
segment HMA_TEXT
|
||||||
|
|
||||||
;
|
;
|
||||||
; void tmark()
|
; void tmark()
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
; $Header$
|
; $Header$
|
||||||
;
|
;
|
||||||
; $Log$
|
; $Log$
|
||||||
|
; Revision 1.4 2001/03/21 02:56:25 bartoldeman
|
||||||
|
; See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
;
|
||||||
; 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
|
||||||
;
|
;
|
||||||
@ -66,9 +69,9 @@
|
|||||||
;Initial revision.
|
;Initial revision.
|
||||||
;
|
;
|
||||||
|
|
||||||
group TGROUP _TEXT
|
%include "..\kernel\segs.inc"
|
||||||
|
|
||||||
segment _TEXT class=CODE
|
segment HMA_TEXT
|
||||||
|
|
||||||
;
|
;
|
||||||
; VOID WriteATClock(bcdDays, bcdHours, bcdMinutes, bcdSeconds)
|
; VOID WriteATClock(bcdDays, bcdHours, bcdMinutes, bcdSeconds)
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
; $Header$
|
; $Header$
|
||||||
;
|
;
|
||||||
; $Log$
|
; $Log$
|
||||||
|
; Revision 1.4 2001/03/21 02:56:25 bartoldeman
|
||||||
|
; See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
;
|
||||||
; 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
|
||||||
;
|
;
|
||||||
@ -65,10 +68,10 @@
|
|||||||
; Rev 1.0 02 Jul 1995 8:01:30 patv
|
; Rev 1.0 02 Jul 1995 8:01:30 patv
|
||||||
;Initial revision.
|
;Initial revision.
|
||||||
;
|
;
|
||||||
|
%include "..\kernel\segs.inc"
|
||||||
|
|
||||||
group TGROUP _TEXT
|
segment HMA_TEXT
|
||||||
|
|
||||||
segment _TEXT class=CODE
|
|
||||||
|
|
||||||
;
|
;
|
||||||
; VOID WritePCClock(Ticks)
|
; VOID WritePCClock(Ticks)
|
||||||
|
@ -36,8 +36,8 @@ static char *portab_hRcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
* Revision 1.6 2001/03/19 05:08:53 bartoldeman
|
* Revision 1.7 2001/03/21 02:56:25 bartoldeman
|
||||||
* New macros from Tom Ehlert to save even more bytes.
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
*
|
*
|
||||||
* Revision 1.5 2001/03/08 21:15:00 bartoldeman
|
* Revision 1.5 2001/03/08 21:15:00 bartoldeman
|
||||||
* Fixes for MK_FP and friends from Tom Ehlert; reduces kernel by 1.5k.
|
* Fixes for MK_FP and friends from Tom Ehlert; reduces kernel by 1.5k.
|
||||||
|
@ -32,9 +32,9 @@ static BYTE *date_hRcsId = "$Id$";
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This Kernel is at a min Dos Ver. 4.00 */
|
/* This Kernel is at a min Dos Ver. 5.00 */
|
||||||
|
|
||||||
#define MAJOR_RELEASE 4
|
#define MAJOR_RELEASE 5
|
||||||
#define MINOR_RELEASE 00
|
#define MINOR_RELEASE 00
|
||||||
|
|
||||||
#define REV_NUMBER 0
|
#define REV_NUMBER 0
|
||||||
|
@ -27,6 +27,9 @@
|
|||||||
; $Id$
|
; $Id$
|
||||||
;
|
;
|
||||||
; $Log$
|
; $Log$
|
||||||
|
; Revision 1.4 2001/03/21 02:56:25 bartoldeman
|
||||||
|
; See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
;
|
||||||
; 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
|
||||||
;
|
;
|
||||||
@ -79,7 +82,7 @@
|
|||||||
extern _usr_sp:wrt DGROUP ; user stacks
|
extern _usr_sp:wrt DGROUP ; user stacks
|
||||||
extern _usr_ss:wrt DGROUP
|
extern _usr_ss:wrt DGROUP
|
||||||
|
|
||||||
segment _TEXT
|
segment HMA_TEXT
|
||||||
global _set_stack
|
global _set_stack
|
||||||
;
|
;
|
||||||
; void far set_stack(void) -
|
; void far set_stack(void) -
|
||||||
|
@ -24,9 +24,19 @@
|
|||||||
; write to the Free Software Foundation, 675 Mass Ave,
|
; write to the Free Software Foundation, 675 Mass Ave,
|
||||||
; Cambridge, MA 02139, USA.
|
; Cambridge, MA 02139, USA.
|
||||||
;
|
;
|
||||||
|
; version 1.4 by tom.ehlert@ginko.de
|
||||||
|
; added some more functions
|
||||||
|
; changed bcopy, scopy, sncopy,...
|
||||||
|
; to memcpy, strcpy, strncpy
|
||||||
|
; Bart Oldeman: optimized a bit: see /usr/include/bits/string.h from
|
||||||
|
; glibc 2.2
|
||||||
|
;
|
||||||
; $Id$
|
; $Id$
|
||||||
;
|
;
|
||||||
; $Log$
|
; $Log$
|
||||||
|
; Revision 1.4 2001/03/21 02:56:25 bartoldeman
|
||||||
|
; See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
;
|
||||||
; 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
|
||||||
;
|
;
|
||||||
@ -77,126 +87,443 @@
|
|||||||
|
|
||||||
%include "segs.inc"
|
%include "segs.inc"
|
||||||
|
|
||||||
segment _TEXT
|
segment HMA_TEXT
|
||||||
|
|
||||||
|
;*********************************************************************
|
||||||
|
; this implements some of the common string handling functions
|
||||||
;
|
;
|
||||||
; VOID bcopy(s, d, n)
|
; every function has 2 entries
|
||||||
; REG BYTE *s, *d;
|
|
||||||
; REG COUNT n;
|
|
||||||
;
|
;
|
||||||
|
; NEAR FUNC()
|
||||||
|
; FAR init_call_FUNC()
|
||||||
;
|
;
|
||||||
global _bcopy
|
; currently done:
|
||||||
_bcopy:
|
;
|
||||||
|
; memcpy(void *dest, void *src, int count)
|
||||||
|
; fmemcpy(void FAR *dest, void FAR *src, int count)
|
||||||
|
; _fmemcpy(void FAR *dest, void FAR *src, int count)
|
||||||
|
; fmemset(void FAR *dest, int ch, int count);
|
||||||
|
; fstrncpy(void FAR*dest, void FAR *src, int count);
|
||||||
|
; strcpy (void *dest, void *src);
|
||||||
|
; fstrcpy (void FAR*dest, void FAR *src, int count);
|
||||||
|
; strlen (void *dest);
|
||||||
|
; fstrlen (void FAR*dest);
|
||||||
|
; strchr (BYTE *src , BYTE ch);
|
||||||
|
; fstrcmp (BYTE FAR *s1 , BYTE FAR *s2);
|
||||||
|
; strcmp (BYTE *s1 , BYTE *s2);
|
||||||
|
; fstrncmp(BYTE FAR *s1 , BYTE FAR *s2, int count);
|
||||||
|
; strncmp(BYTE *s1 , BYTE *s2, int count);
|
||||||
|
|
||||||
|
;***********************************************
|
||||||
|
; common_setup - set up the standard calling frame for C-functions
|
||||||
|
; and save registers needed later
|
||||||
|
; also preload the args for the near functions
|
||||||
|
; di=arg1
|
||||||
|
; si=arg2
|
||||||
|
; cx=arg3
|
||||||
|
;
|
||||||
|
common_setup:
|
||||||
|
pop bx ; get return address
|
||||||
|
|
||||||
push bp ; Standard C entry
|
push bp ; Standard C entry
|
||||||
mov bp,sp
|
mov bp,sp
|
||||||
push si
|
push si
|
||||||
push di
|
push di
|
||||||
push ds
|
|
||||||
push es
|
push es
|
||||||
|
push ds
|
||||||
; Get the repitition count, n
|
|
||||||
mov cx,[bp+8]
|
|
||||||
jcxz bcopy_exit
|
|
||||||
|
|
||||||
; Set both ds and es to same segment (for near copy)
|
; Set both ds and es to same segment (for near copy)
|
||||||
mov ax,ds
|
pop es
|
||||||
mov es,ax
|
push ds
|
||||||
|
|
||||||
; Get the source pointer, ss
|
|
||||||
mov si,[bp+4]
|
|
||||||
|
|
||||||
; and the destination pointer, d
|
|
||||||
mov di,[bp+6]
|
|
||||||
|
|
||||||
?doIt:
|
|
||||||
; Set direction to autoincrement
|
; Set direction to autoincrement
|
||||||
cld
|
cld
|
||||||
|
|
||||||
|
; to conserve even some more bytes,
|
||||||
|
; the registers for the near routines
|
||||||
|
; are preloaded here
|
||||||
|
|
||||||
|
; the destination pointer, d = arg1
|
||||||
|
mov di,[bp+6]
|
||||||
|
|
||||||
|
; Get the source pointer, s = arg2
|
||||||
|
mov si,[bp+8]
|
||||||
|
|
||||||
|
; Get the repitition count, n = arg3
|
||||||
|
mov cx,[bp+10]
|
||||||
|
|
||||||
|
jmp bx
|
||||||
|
|
||||||
|
|
||||||
|
;***********************************************
|
||||||
|
;
|
||||||
|
; VOID memcpy(REG BYTE *s, REG BYTE *d, REG COUNT n);
|
||||||
|
;
|
||||||
|
global _memcpy
|
||||||
|
global _init_call_memcpy
|
||||||
|
_memcpy:
|
||||||
|
pop ax
|
||||||
|
push cs
|
||||||
|
push ax
|
||||||
|
_init_call_memcpy:
|
||||||
|
call common_setup
|
||||||
|
|
||||||
|
|
||||||
|
domemcpy:
|
||||||
; And do the built-in byte copy, but do a 16-bit transfer
|
; And do the built-in byte copy, but do a 16-bit transfer
|
||||||
; whenever possible.
|
; whenever possible.
|
||||||
mov al, cl
|
shr cx,1
|
||||||
and al,1 ; test for odd count
|
|
||||||
jz b_even
|
|
||||||
movsb
|
|
||||||
b_even: shr cx,1
|
|
||||||
rep movsw
|
rep movsw
|
||||||
|
jnc common_return
|
||||||
|
movsb
|
||||||
|
|
||||||
; Finally do a C exit to return
|
;
|
||||||
fbcopy_exit:
|
; common_return - pop saved registers and do return
|
||||||
bcopy_exit: pop es
|
;
|
||||||
|
|
||||||
|
common_return:
|
||||||
pop ds
|
pop ds
|
||||||
|
pop es
|
||||||
pop di
|
pop di
|
||||||
pop si
|
pop si
|
||||||
pop bp
|
pop bp
|
||||||
ret
|
retf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;************************************************************
|
||||||
;
|
;
|
||||||
; VOID fbcopy(s, d, n)
|
; VOID fmemcpy(REG BYTE FAR *d, REG BYTE FAR *s,REG COUNT n);
|
||||||
;
|
;
|
||||||
; REG VOID FAR *s, FAR *d;
|
global __fmemcpy
|
||||||
; REG COUNT n;
|
global _fmemcpy
|
||||||
global _fbcopy
|
global _init_call_fmemcpy
|
||||||
_fbcopy:
|
_fmemcpy:
|
||||||
push bp ; Standard C entry
|
__fmemcpy:
|
||||||
mov bp,sp
|
pop ax
|
||||||
push si
|
push cs
|
||||||
push di
|
push ax
|
||||||
|
_init_call_fmemcpy:
|
||||||
; Save ds, since we won't necessarily be within our
|
call common_setup
|
||||||
; small/tiny environment
|
|
||||||
push ds
|
|
||||||
push es
|
|
||||||
|
|
||||||
; Get the repititon count, n
|
|
||||||
mov cx,[bp+12]
|
|
||||||
jcxz fbcopy_exit
|
|
||||||
|
|
||||||
; Get the far source pointer, s
|
; Get the far source pointer, s
|
||||||
lds si,[bp+4]
|
lds si,[bp+10]
|
||||||
|
|
||||||
; Get the far destination pointer d
|
; Get the far destination pointer d
|
||||||
les di,[bp+8]
|
les di,[bp+6]
|
||||||
|
|
||||||
jmp short ?doIt
|
; Get the repetition count, n
|
||||||
|
mov cx,[bp+14]
|
||||||
|
|
||||||
|
|
||||||
|
jmp short domemcpy
|
||||||
|
|
||||||
|
;***************************************************************
|
||||||
;
|
;
|
||||||
; VOID fmemset(s, ch, n)
|
; VOID fmemset(REG VOID FAR *d, REG BYTE ch, REG COUNT n);
|
||||||
;
|
;
|
||||||
; REG VOID FAR *s
|
|
||||||
; REG int ch
|
|
||||||
; REG COUNT n;
|
|
||||||
global _fmemset
|
global _fmemset
|
||||||
|
global _init_call_fmemset
|
||||||
_fmemset:
|
_fmemset:
|
||||||
push bp ; Standard C entry
|
pop ax
|
||||||
mov bp,sp
|
push cs
|
||||||
push di
|
push ax
|
||||||
|
_init_call_fmemset:
|
||||||
|
|
||||||
; Save ds, since we won't necessarily be within our
|
call common_setup
|
||||||
; small/tiny environment
|
|
||||||
push es
|
|
||||||
|
|
||||||
; Get the repititon count, n
|
; Get the repetition count, n
|
||||||
mov cx,[bp+10]
|
mov cx,[bp+12]
|
||||||
jcxz fmemset_exit
|
|
||||||
|
|
||||||
; Get the far source pointer, s
|
; Get the far source pointer, s
|
||||||
les di,[bp+4]
|
les di,[bp+6]
|
||||||
|
|
||||||
; Test if odd or even
|
|
||||||
mov al, cl
|
|
||||||
and al, 1
|
|
||||||
|
|
||||||
; Get the far destination pointer ch
|
; Get the far destination pointer ch
|
||||||
mov al,[bp+8]
|
mov al,[bp+10]
|
||||||
|
|
||||||
|
domemset:
|
||||||
mov ah, al
|
mov ah, al
|
||||||
|
|
||||||
jz m_even
|
shr cx,1
|
||||||
stosb
|
|
||||||
m_even: shr cx,1
|
|
||||||
rep stosw
|
rep stosw
|
||||||
|
jnc common_return
|
||||||
|
stosb
|
||||||
|
|
||||||
|
jmp short common_return
|
||||||
|
|
||||||
|
;***************************************************************
|
||||||
|
;
|
||||||
|
; VOID memset(REG VOID *d, REG BYTE ch, REG COUNT n);
|
||||||
|
;
|
||||||
|
global _memset
|
||||||
|
global _init_call_memset
|
||||||
|
_memset:
|
||||||
|
pop ax
|
||||||
|
push cs
|
||||||
|
push ax
|
||||||
|
_init_call_memset:
|
||||||
|
|
||||||
|
call common_setup
|
||||||
|
|
||||||
|
; Get the far source pointer, s
|
||||||
|
; mov di,[bp+6]
|
||||||
|
|
||||||
|
; Get the char ch
|
||||||
|
mov ax,si ; mov al, [bp+8]
|
||||||
|
|
||||||
|
; Get the repititon count, n
|
||||||
|
; mov cx,[bp+10]
|
||||||
|
|
||||||
|
jmp short domemset
|
||||||
|
|
||||||
|
|
||||||
fmemset_exit: pop es
|
|
||||||
pop di
|
|
||||||
pop bp
|
;***************************************************************
|
||||||
ret
|
|
||||||
|
global _fstrncpy
|
||||||
|
global _init_call_fstrncpy
|
||||||
|
_fstrncpy:
|
||||||
|
pop ax
|
||||||
|
push cs
|
||||||
|
push ax
|
||||||
|
_init_call_fstrncpy:
|
||||||
|
call common_setup
|
||||||
|
|
||||||
|
; Get the source pointer, ss
|
||||||
|
lds si,[bp+10]
|
||||||
|
|
||||||
|
; and the destination pointer, d
|
||||||
|
les di,[bp+6]
|
||||||
|
|
||||||
|
mov cx,[bp+14]
|
||||||
|
|
||||||
|
jcxz common_return
|
||||||
|
;; dec cx
|
||||||
|
; jcxz store_one_byte
|
||||||
|
strncpy_loop: lodsb
|
||||||
|
stosb
|
||||||
|
test al,al
|
||||||
|
loopnz strncpy_loop
|
||||||
|
|
||||||
|
store_one_byte: xor al,al
|
||||||
|
; the spec for strncpy() would require
|
||||||
|
; rep stosb
|
||||||
|
; to fill remaining part of buffer
|
||||||
|
stosb
|
||||||
|
|
||||||
|
jmp short common_return
|
||||||
|
|
||||||
|
;*****************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
global _fstrcpy
|
||||||
|
global _init_call_fstrcpy
|
||||||
|
_fstrcpy:
|
||||||
|
pop ax
|
||||||
|
push cs
|
||||||
|
push ax
|
||||||
|
_init_call_fstrcpy:
|
||||||
|
call common_setup
|
||||||
|
|
||||||
|
; Get the source pointer, ss
|
||||||
|
lds si,[bp+10]
|
||||||
|
|
||||||
|
; and the destination pointer, d
|
||||||
|
les di,[bp+6]
|
||||||
|
|
||||||
|
jmp short dostrcpy
|
||||||
|
|
||||||
|
;******
|
||||||
|
global _strcpy
|
||||||
|
global _init_call_strcpy
|
||||||
|
_strcpy:
|
||||||
|
pop ax
|
||||||
|
push cs
|
||||||
|
push ax
|
||||||
|
_init_call_strcpy:
|
||||||
|
call common_setup
|
||||||
|
|
||||||
|
|
||||||
|
; Get the source pointer, ss
|
||||||
|
;mov si,[bp+8]
|
||||||
|
|
||||||
|
; and the destination pointer, d
|
||||||
|
;mov di,[bp+6]
|
||||||
|
|
||||||
|
dostrcpy:
|
||||||
|
|
||||||
|
strcpy_loop:
|
||||||
|
lodsb
|
||||||
|
stosb
|
||||||
|
test al,al
|
||||||
|
jne strcpy_loop
|
||||||
|
|
||||||
|
jmp short common_return
|
||||||
|
|
||||||
|
;******************************************************************
|
||||||
|
|
||||||
|
global _fstrlen
|
||||||
|
global _init_call_fstrlen
|
||||||
|
_fstrlen:
|
||||||
|
pop ax
|
||||||
|
push cs
|
||||||
|
push ax
|
||||||
|
_init_call_fstrlen:
|
||||||
|
call common_setup
|
||||||
|
|
||||||
|
; Get the source pointer, ss
|
||||||
|
les di,[bp+6]
|
||||||
|
|
||||||
|
jmp short dostrlen
|
||||||
|
|
||||||
|
;**********************************************
|
||||||
|
global _strlen
|
||||||
|
global _init_call_strlen
|
||||||
|
_strlen:
|
||||||
|
pop ax
|
||||||
|
push cs
|
||||||
|
push ax
|
||||||
|
_init_call_strlen:
|
||||||
|
call common_setup
|
||||||
|
|
||||||
|
; The source pointer, ss, arg1 was loaded as di
|
||||||
|
|
||||||
|
dostrlen:
|
||||||
|
mov al,0
|
||||||
|
mov cx,0xffff
|
||||||
|
repne scasb
|
||||||
|
|
||||||
|
mov ax,cx
|
||||||
|
not ax
|
||||||
|
dec ax
|
||||||
|
|
||||||
|
jmp common_return
|
||||||
|
|
||||||
|
;************************************************************
|
||||||
|
global _strchr
|
||||||
|
global _init_call_strchr
|
||||||
|
_strchr:
|
||||||
|
pop ax
|
||||||
|
push cs
|
||||||
|
push ax
|
||||||
|
_init_call_strchr:
|
||||||
|
call common_setup
|
||||||
|
|
||||||
|
; Get the source pointer, ss
|
||||||
|
; mov si,[bp+6]
|
||||||
|
; mov bx,[bp+8]
|
||||||
|
mov bx,si
|
||||||
|
mov si,di
|
||||||
|
|
||||||
|
strchr_loop:
|
||||||
|
lodsb
|
||||||
|
cmp al,bl
|
||||||
|
je strchr_found
|
||||||
|
test al,al
|
||||||
|
jne strchr_loop
|
||||||
|
|
||||||
|
mov si,1 ; return NULL if not found
|
||||||
|
strchr_found:
|
||||||
|
mov ax,si
|
||||||
|
dec ax
|
||||||
|
|
||||||
|
jmp common_return
|
||||||
|
|
||||||
|
;**********************************************************************
|
||||||
|
global _fstrcmp
|
||||||
|
global _init_call_fstrcmp
|
||||||
|
_fstrcmp:
|
||||||
|
pop ax
|
||||||
|
push cs
|
||||||
|
push ax
|
||||||
|
_init_call_fstrcmp:
|
||||||
|
call common_setup
|
||||||
|
|
||||||
|
; Get the source pointer, ss
|
||||||
|
lds si,[bp+6]
|
||||||
|
|
||||||
|
; and the destination pointer, d
|
||||||
|
les di,[bp+10]
|
||||||
|
|
||||||
|
jmp dostrcmp
|
||||||
|
|
||||||
|
;******
|
||||||
|
global _strcmp
|
||||||
|
global _init_call_strcmp
|
||||||
|
_strcmp:
|
||||||
|
pop ax
|
||||||
|
push cs
|
||||||
|
push ax
|
||||||
|
_init_call_strcmp:
|
||||||
|
call common_setup
|
||||||
|
|
||||||
|
|
||||||
|
; Get the source pointer, ss
|
||||||
|
; mov si,[bp+6]
|
||||||
|
|
||||||
|
; and the destination pointer, d
|
||||||
|
; mov di,[bp+8]
|
||||||
|
xchg si,di
|
||||||
|
|
||||||
|
dostrcmp:
|
||||||
|
; replace strncmp(s1,s2)-->
|
||||||
|
; strncmp(s1,s2,0xffff)
|
||||||
|
mov cx,0xffff
|
||||||
|
jmp short dostrncmp
|
||||||
|
|
||||||
|
|
||||||
|
;**********************************************************************
|
||||||
|
global _fstrncmp
|
||||||
|
global _init_call_fstrncmp
|
||||||
|
_fstrncmp:
|
||||||
|
pop ax
|
||||||
|
push cs
|
||||||
|
push ax
|
||||||
|
_init_call_fstrncmp:
|
||||||
|
call common_setup
|
||||||
|
|
||||||
|
; Get the source pointer, ss
|
||||||
|
lds si,[bp+6]
|
||||||
|
|
||||||
|
; and the destination pointer, d
|
||||||
|
les di,[bp+10]
|
||||||
|
mov cx,[bp+12]
|
||||||
|
|
||||||
|
jmp short dostrncmp
|
||||||
|
|
||||||
|
;******
|
||||||
|
global _strncmp
|
||||||
|
global _init_call_strncmp
|
||||||
|
_strncmp:
|
||||||
|
pop ax
|
||||||
|
push cs
|
||||||
|
push ax
|
||||||
|
_init_call_strncmp:
|
||||||
|
call common_setup
|
||||||
|
|
||||||
|
; Get the source pointer, ss
|
||||||
|
;mov si,[bp+6]
|
||||||
|
|
||||||
|
; and the destination pointer, d
|
||||||
|
;mov di,[bp+8]
|
||||||
|
;mov cx,[bp+10]
|
||||||
|
xchg si,di
|
||||||
|
|
||||||
|
dostrncmp:
|
||||||
|
jcxz strncmp_retzero
|
||||||
|
|
||||||
|
strncmp_loop:
|
||||||
|
lodsb
|
||||||
|
scasb
|
||||||
|
jne strncmp_done
|
||||||
|
test al,al
|
||||||
|
loopne strncmp_loop
|
||||||
|
strncmp_retzero:
|
||||||
|
xor ax, ax
|
||||||
|
jmp short strncmp_done2
|
||||||
|
strncmp_done:
|
||||||
|
sbb ax,ax
|
||||||
|
or al,1
|
||||||
|
strncmp_done2: jmp common_return
|
||||||
|
|
||||||
|
316
kernel/blockio.c
316
kernel/blockio.c
@ -37,6 +37,9 @@ static BYTE *blockioRcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.7 2001/03/21 02:56:25 bartoldeman
|
||||||
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
*
|
||||||
* Revision 1.6 2000/10/30 00:32:08 jimtabor
|
* Revision 1.6 2000/10/30 00:32:08 jimtabor
|
||||||
* Minor Fixes
|
* Minor Fixes
|
||||||
*
|
*
|
||||||
@ -152,34 +155,43 @@ static BYTE *blockioRcsId = "$Id$";
|
|||||||
/* block cache routines */
|
/* block cache routines */
|
||||||
/* */
|
/* */
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
/* #define DISPLAY_GETBLOCK */
|
||||||
|
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
/* Initialize the buffer structure */
|
/* Initialize the buffer structure */
|
||||||
/* */
|
/* */
|
||||||
/* XXX: This should go into `INIT_TEXT'. -- ror4 */
|
/* XXX: This should go into `INIT_TEXT'. -- ror4 */
|
||||||
VOID FAR init_buffers(void)
|
|
||||||
|
/* this code moved to CONFIG.C
|
||||||
|
VOID FAR reloc_call_init_buffers(void)
|
||||||
{
|
{
|
||||||
REG WORD i;
|
REG WORD i;
|
||||||
REG WORD count;
|
REG WORD count;
|
||||||
|
|
||||||
|
printf("init_buffers %d buffers at %p\n",Config.cfgBuffers, (void FAR*)&buffers[0]);
|
||||||
|
|
||||||
for (i = 0; i < Config.cfgBuffers; ++i)
|
for (i = 0; i < Config.cfgBuffers; ++i)
|
||||||
{
|
{
|
||||||
buffers[i].b_unit = 0;
|
struct buffer FAR *pbuffer = &buffers[i];
|
||||||
buffers[i].b_flag = 0;
|
|
||||||
buffers[i].b_blkno = 0;
|
pbuffer->b_unit = 0;
|
||||||
buffers[i].b_copies = 0;
|
pbuffer->b_flag = 0;
|
||||||
buffers[i].b_offset_lo = 0;
|
pbuffer->b_blkno = 0;
|
||||||
buffers[i].b_offset_hi = 0;
|
pbuffer->b_copies = 0;
|
||||||
|
pbuffer->b_offset_lo = 0;
|
||||||
|
pbuffer->b_offset_hi = 0;
|
||||||
if (i < (Config.cfgBuffers - 1))
|
if (i < (Config.cfgBuffers - 1))
|
||||||
buffers[i].b_next = &buffers[i + 1];
|
pbuffer->b_next = pbuffer + 1;
|
||||||
else
|
else
|
||||||
buffers[i].b_next = NULL;
|
pbuffer->b_next = NULL;
|
||||||
}
|
}
|
||||||
firstbuf = &buffers[0];
|
firstbuf = &buffers[0];
|
||||||
lastbuf = &buffers[Config.cfgBuffers - 1];
|
lastbuf = &buffers[Config.cfgBuffers - 1];
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/* Extract the block number from a buffer structure. */
|
/* Extract the block number from a buffer structure. */
|
||||||
|
#if 0 /*TE*/
|
||||||
ULONG getblkno(struct buffer FAR * bp)
|
ULONG getblkno(struct buffer FAR * bp)
|
||||||
{
|
{
|
||||||
if (bp->b_blkno == 0xffffu)
|
if (bp->b_blkno == 0xffffu)
|
||||||
@ -187,9 +199,13 @@ ULONG getblkno(struct buffer FAR * bp)
|
|||||||
else
|
else
|
||||||
return bp->b_blkno;
|
return bp->b_blkno;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
#define getblkno(bp) (bp)->b_blkno
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Set the block number of a buffer structure. (The caller should */
|
/* Set the block number of a buffer structure. (The caller should */
|
||||||
/* set the unit number before calling this function.) */
|
/* set the unit number before calling this function.) */
|
||||||
|
#if 0 /*TE*/
|
||||||
VOID setblkno(struct buffer FAR * bp, ULONG blkno)
|
VOID setblkno(struct buffer FAR * bp, ULONG blkno)
|
||||||
{
|
{
|
||||||
if (blkno >= 0xffffu)
|
if (blkno >= 0xffffu)
|
||||||
@ -206,6 +222,90 @@ VOID setblkno(struct buffer FAR * bp, ULONG blkno)
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
#define setblkno(bp, blkno) (bp)->b_blkno = (blkno)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
this searches the buffer list for the given disk/block.
|
||||||
|
|
||||||
|
if found, the buffer is returned.
|
||||||
|
|
||||||
|
if not found, NULL is returned, and *pReplacebp
|
||||||
|
contains a buffer to throw out.
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct buffer FAR *searchblock(ULONG blkno, COUNT dsk,
|
||||||
|
struct buffer FAR ** pReplacebp)
|
||||||
|
{
|
||||||
|
int fat_count = 0;
|
||||||
|
struct buffer FAR *bp;
|
||||||
|
struct buffer FAR *lbp = NULL;
|
||||||
|
struct buffer FAR *lastNonFat = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DISPLAY_GETBLOCK
|
||||||
|
printf("[searchblock %d, blk %ld, buf ", dsk, blkno);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Search through buffers to see if the required block */
|
||||||
|
/* is already in a buffer */
|
||||||
|
|
||||||
|
for (bp = firstbuf; bp != NULL;lbp = bp, bp = bp->b_next)
|
||||||
|
{
|
||||||
|
if ((getblkno(bp) == blkno) &&
|
||||||
|
(bp->b_flag & BFR_VALID) && (bp->b_unit == dsk))
|
||||||
|
{
|
||||||
|
/* found it -- rearrange LRU links */
|
||||||
|
if (lbp != NULL)
|
||||||
|
{
|
||||||
|
lbp->b_next = bp->b_next;
|
||||||
|
bp->b_next = firstbuf;
|
||||||
|
firstbuf = bp;
|
||||||
|
}
|
||||||
|
#ifdef DISPLAY_GETBLOCK
|
||||||
|
printf("HIT %04x:%04x]\n", FP_SEG(bp), FP_OFF(bp));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return (bp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bp->b_flag & BFR_FAT)
|
||||||
|
fat_count++;
|
||||||
|
else
|
||||||
|
lastNonFat = bp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
now take either the last buffer in chain (not used recently)
|
||||||
|
or, if we are low on FAT buffers, the last non FAT buffer
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (lbp ->b_flag & BFR_FAT && fat_count < 3 && lastNonFat)
|
||||||
|
{
|
||||||
|
lbp = lastNonFat;
|
||||||
|
}
|
||||||
|
*pReplacebp = lbp;
|
||||||
|
|
||||||
|
#ifdef DISPLAY_GETBLOCK
|
||||||
|
printf("MISS, replace %04x:%04x]\n", FP_SEG(lbp), FP_OFF(lbp));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
if (lbp != firstbuf) /* move to front */
|
||||||
|
{
|
||||||
|
for (bp = firstbuf; bp->b_next != lbp; bp = bp->b_next)
|
||||||
|
;
|
||||||
|
bp->b_next = bp->b_next->b_next;
|
||||||
|
lbp->b_next = firstbuf;
|
||||||
|
firstbuf = lbp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
/* Return the address of a buffer structure containing the */
|
/* Return the address of a buffer structure containing the */
|
||||||
@ -218,106 +318,34 @@ VOID setblkno(struct buffer FAR * bp, ULONG blkno)
|
|||||||
/* */
|
/* */
|
||||||
struct buffer FAR *getblock(ULONG blkno, COUNT dsk)
|
struct buffer FAR *getblock(ULONG blkno, COUNT dsk)
|
||||||
{
|
{
|
||||||
REG struct buffer FAR *bp;
|
struct buffer FAR *bp;
|
||||||
REG struct buffer FAR *lbp;
|
struct buffer FAR *Replacebp;
|
||||||
REG struct buffer FAR *mbp;
|
|
||||||
REG BYTE fat_count = 0;
|
|
||||||
|
|
||||||
/* Search through buffers to see if the required block */
|
/* Search through buffers to see if the required block */
|
||||||
/* is already in a buffer */
|
/* is already in a buffer */
|
||||||
|
|
||||||
#ifdef DISPLAY_GETBLOCK
|
bp = searchblock(blkno, dsk, &Replacebp);
|
||||||
printf("[getblock %d, blk %ld, buf ", dsk, blkno);
|
|
||||||
#endif
|
if (bp)
|
||||||
bp = firstbuf;
|
|
||||||
lbp = NULL;
|
|
||||||
mbp = NULL;
|
|
||||||
while (bp != NULL)
|
|
||||||
{
|
{
|
||||||
if ((bp->b_flag & BFR_VALID) && (bp->b_unit == dsk)
|
|
||||||
&& (getblkno(bp) == blkno))
|
|
||||||
{
|
|
||||||
/* found it -- rearrange LRU links */
|
|
||||||
if (lbp != NULL)
|
|
||||||
{
|
|
||||||
lbp->b_next = bp->b_next;
|
|
||||||
bp->b_next = firstbuf;
|
|
||||||
firstbuf = bp;
|
|
||||||
}
|
|
||||||
#ifdef DISPLAY_GETBLOCK
|
|
||||||
printf("HIT]\n");
|
|
||||||
#endif
|
|
||||||
return (bp);
|
return (bp);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (bp->b_flag & BFR_FAT)
|
|
||||||
fat_count++;
|
|
||||||
mbp = lbp; /* move along to next buffer */
|
|
||||||
lbp = bp;
|
|
||||||
bp = bp->b_next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* The block we need is not in a buffer, we must make a buffer */
|
/* The block we need is not in a buffer, we must make a buffer */
|
||||||
/* available, and fill it with the desired block */
|
/* available, and fill it with the desired block */
|
||||||
|
|
||||||
/* detach lru buffer */
|
|
||||||
#ifdef DISPLAY_GETBLOCK
|
|
||||||
printf("MISS]\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* make sure we keep at least 3 buffers for the FAT. If this is not a */
|
/* take the buffer that lbp points to and flush it, then read new block. */
|
||||||
/* FAT buffer, or there are at least 3 already, then we can use this */
|
if (flush1(Replacebp) && fill(Replacebp, blkno, dsk)) /* success */
|
||||||
/* buffer. */
|
|
||||||
/* otherwise, search again, and find the last non-FAT buffer. */
|
|
||||||
if ((lbp->b_flag & BFR_FAT) && (fat_count < 3))
|
|
||||||
{
|
{
|
||||||
bp = firstbuf;
|
return Replacebp;
|
||||||
lbp = NULL;
|
|
||||||
mbp = NULL;
|
|
||||||
while ((bp != NULL) && (bp->b_flag & BFR_FAT))
|
|
||||||
{
|
|
||||||
/* if this is a FAT buffer, then move to the next one, else we found */
|
|
||||||
/* the one we want. */
|
|
||||||
mbp = lbp; /* move along to next buffer */
|
|
||||||
lbp = bp;
|
|
||||||
bp = bp->b_next;
|
|
||||||
}
|
|
||||||
/* if we get to the end of the list here, then we must only have 3 */
|
|
||||||
/* buffers, which is not suppose to happen, but if it does, then we */
|
|
||||||
/* end up using the last buffer (even though it is FAT). */
|
|
||||||
|
|
||||||
if (bp == NULL)
|
|
||||||
{
|
|
||||||
/* put lbp at the top of the chain. */
|
|
||||||
if (mbp != NULL)
|
|
||||||
mbp->b_next = NULL;
|
|
||||||
lbp->b_next = firstbuf;
|
|
||||||
firstbuf = bp = lbp;
|
|
||||||
}
|
|
||||||
else if (lbp != NULL)
|
|
||||||
{
|
|
||||||
lbp->b_next = bp->b_next;
|
|
||||||
bp->b_next = firstbuf;
|
|
||||||
firstbuf = bp;
|
|
||||||
}
|
|
||||||
lbp = bp;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* put lbp at the top of the chain. */
|
return NULL;
|
||||||
if (mbp != NULL)
|
|
||||||
mbp->b_next = NULL;
|
|
||||||
lbp->b_next = firstbuf;
|
|
||||||
firstbuf = lbp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* take the buffer than lbp points to and flush it, then read new block. */
|
|
||||||
if (flush1(lbp) && fill(lbp, blkno, dsk)) /* success */
|
|
||||||
mbp = lbp;
|
|
||||||
else
|
|
||||||
mbp = NULL; /* failure */
|
|
||||||
return (mbp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -333,107 +361,30 @@ struct buffer FAR *getblock(ULONG blkno, COUNT dsk)
|
|||||||
*/
|
*/
|
||||||
BOOL getbuf(struct buffer FAR ** pbp, ULONG blkno, COUNT dsk)
|
BOOL getbuf(struct buffer FAR ** pbp, ULONG blkno, COUNT dsk)
|
||||||
{
|
{
|
||||||
REG struct buffer FAR *bp;
|
struct buffer FAR *bp;
|
||||||
REG struct buffer FAR *lbp;
|
struct buffer FAR *Replacebp;
|
||||||
REG struct buffer FAR *mbp;
|
|
||||||
REG BYTE fat_count = 0;
|
|
||||||
|
|
||||||
/* Search through buffers to see if the required block */
|
/* Search through buffers to see if the required block */
|
||||||
/* is already in a buffer */
|
/* is already in a buffer */
|
||||||
|
|
||||||
#ifdef DISPLAY_GETBLOCK
|
bp = searchblock(blkno, dsk, &Replacebp);
|
||||||
printf("[getbuf %d, blk %ld, buf ", dsk, blkno);
|
|
||||||
#endif
|
if (bp)
|
||||||
bp = firstbuf;
|
|
||||||
lbp = NULL;
|
|
||||||
mbp = NULL;
|
|
||||||
while (bp != NULL)
|
|
||||||
{
|
{
|
||||||
if ((bp->b_flag & BFR_VALID) && (bp->b_unit == dsk)
|
|
||||||
&& (getblkno(bp) == blkno))
|
|
||||||
{
|
|
||||||
/* found it -- rearrange LRU links */
|
|
||||||
if (lbp != NULL)
|
|
||||||
{
|
|
||||||
lbp->b_next = bp->b_next;
|
|
||||||
bp->b_next = firstbuf;
|
|
||||||
firstbuf = bp;
|
|
||||||
}
|
|
||||||
*pbp = bp;
|
*pbp = bp;
|
||||||
#ifdef DISPLAY_GETBLOCK
|
|
||||||
printf("HIT]\n");
|
|
||||||
#endif
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (bp->b_flag & BFR_FAT)
|
|
||||||
fat_count++;
|
|
||||||
mbp = lbp; /* move along to next buffer */
|
|
||||||
lbp = bp;
|
|
||||||
bp = bp->b_next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* The block we need is not in a buffer, we must make a buffer */
|
/* The block we need is not in a buffer, we must make a buffer */
|
||||||
/* available. */
|
/* available. */
|
||||||
|
|
||||||
#ifdef DISPLAY_GETBLOCK
|
|
||||||
printf("MISS]\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* make sure we keep at least 3 buffers for the FAT. If this is not a */
|
|
||||||
/* FAT buffer, or there are at least 3 already, then we can use this */
|
|
||||||
/* buffer. */
|
|
||||||
/* otherwise, search again, and find the last non-FAT buffer. */
|
|
||||||
if ((lbp->b_flag & BFR_FAT) && (fat_count < 3))
|
|
||||||
{
|
|
||||||
bp = firstbuf;
|
|
||||||
lbp = NULL;
|
|
||||||
mbp = NULL;
|
|
||||||
while ((bp != NULL) && (bp->b_flag & BFR_FAT))
|
|
||||||
{
|
|
||||||
/* if this is a FAT buffer, then move to the next one, else we found */
|
|
||||||
/* the one we want. */
|
|
||||||
mbp = lbp; /* move along to next buffer */
|
|
||||||
lbp = bp;
|
|
||||||
bp = bp->b_next;
|
|
||||||
}
|
|
||||||
/* if we get to the end of the list here, then we must only have 3 */
|
|
||||||
/* buffers, which is not suppose to happen, but if it does, then we */
|
|
||||||
/* end up using the last buffer (even though it is FAT). */
|
|
||||||
|
|
||||||
if (bp == NULL)
|
|
||||||
{
|
|
||||||
/* put lbp at the top of the chain. */
|
|
||||||
if (mbp != NULL)
|
|
||||||
mbp->b_next = NULL;
|
|
||||||
lbp->b_next = firstbuf;
|
|
||||||
firstbuf = bp = lbp;
|
|
||||||
}
|
|
||||||
else if (lbp != NULL)
|
|
||||||
{
|
|
||||||
lbp->b_next = bp->b_next;
|
|
||||||
bp->b_next = firstbuf;
|
|
||||||
firstbuf = bp;
|
|
||||||
}
|
|
||||||
lbp = bp;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* put lbp at the top of the chain. */
|
|
||||||
if (mbp != NULL)
|
|
||||||
mbp->b_next = NULL;
|
|
||||||
lbp->b_next = firstbuf;
|
|
||||||
firstbuf = lbp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* take the buffer than lbp points to and flush it, then make it available. */
|
/* take the buffer than lbp points to and flush it, then make it available. */
|
||||||
if (flush1(lbp)) /* success */
|
if (flush1(Replacebp)) /* success */
|
||||||
{
|
{
|
||||||
lbp->b_flag = 0;
|
Replacebp->b_flag = 0;
|
||||||
lbp->b_unit = dsk;
|
Replacebp->b_unit = dsk;
|
||||||
setblkno(lbp, blkno);
|
setblkno(Replacebp, blkno);
|
||||||
*pbp = lbp;
|
*pbp = Replacebp;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -443,7 +394,6 @@ BOOL getbuf(struct buffer FAR ** pbp, ULONG blkno, COUNT dsk)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
/* Mark all buffers for a disk as not valid */
|
/* Mark all buffers for a disk as not valid */
|
||||||
/* */
|
/* */
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
|
||||||
extern void spawn_int23(void);
|
extern void FAR init_call_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.4 2001/03/21 02:56:25 bartoldeman
|
||||||
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
*
|
||||||
* 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
|
||||||
*
|
*
|
||||||
@ -87,5 +90,25 @@ 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 */
|
||||||
}
|
}
|
||||||
|
353
kernel/config.c
353
kernel/config.c
@ -27,6 +27,7 @@
|
|||||||
/* Cambridge, MA 02139, USA. */
|
/* Cambridge, MA 02139, USA. */
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "init-mod.h"
|
#include "init-mod.h"
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
@ -39,8 +40,8 @@ static BYTE *RcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
* Revision 1.9 2001/03/19 04:50:56 bartoldeman
|
* Revision 1.10 2001/03/21 02:56:25 bartoldeman
|
||||||
* See history.txt for overview: put kernel 2022beo1 into CVS
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
*
|
*
|
||||||
* Revision 1.9 2001/03/08 21:15:00 bartoldeman
|
* Revision 1.9 2001/03/08 21:15:00 bartoldeman
|
||||||
* Fixed handling of "DOS=UMB", use toupper instead of tolower consistently.
|
* Fixed handling of "DOS=UMB", use toupper instead of tolower consistently.
|
||||||
@ -148,9 +149,11 @@ static BYTE *RcsId = "$Id$";
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __TURBOC__
|
#ifdef __TURBOC__
|
||||||
void __int__(int); /* TC 2.01 requires this. :( -- ror4 */
|
void __int__(int); /* TC 2.01 requires this. :( -- ror4 */
|
||||||
|
#define int3() __int__(3);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef KDB
|
#ifdef KDB
|
||||||
#include <alloc.h>
|
#include <alloc.h>
|
||||||
|
|
||||||
@ -163,7 +166,7 @@ static BYTE FAR *lpOldLast;
|
|||||||
static BYTE FAR *upOldLast;
|
static BYTE FAR *upOldLast;
|
||||||
static COUNT nCfgLine;
|
static COUNT nCfgLine;
|
||||||
static COUNT nPass;
|
static COUNT nPass;
|
||||||
static COUNT UmbState;
|
COUNT UmbState;
|
||||||
static BYTE szLine[256];
|
static BYTE szLine[256];
|
||||||
static BYTE szBuf[256];
|
static BYTE szBuf[256];
|
||||||
|
|
||||||
@ -172,7 +175,7 @@ int singleStep = 0;
|
|||||||
INIT VOID zumcb_init(mcb FAR * mcbp, UWORD size);
|
INIT VOID zumcb_init(mcb FAR * mcbp, UWORD size);
|
||||||
INIT VOID mumcb_init(mcb FAR * mcbp, UWORD size);
|
INIT VOID mumcb_init(mcb FAR * mcbp, UWORD size);
|
||||||
|
|
||||||
INIT VOID Buffers(BYTE * pLine);
|
INIT VOID Config_Buffers(BYTE * pLine);
|
||||||
INIT VOID sysScreenMode(BYTE * pLine);
|
INIT VOID sysScreenMode(BYTE * pLine);
|
||||||
INIT VOID sysVersion(BYTE * pLine);
|
INIT VOID sysVersion(BYTE * pLine);
|
||||||
INIT VOID Break(BYTE * pLine);
|
INIT VOID Break(BYTE * pLine);
|
||||||
@ -181,18 +184,29 @@ INIT VOID DeviceHigh(BYTE * pLine);
|
|||||||
INIT VOID Files(BYTE * pLine);
|
INIT VOID Files(BYTE * pLine);
|
||||||
INIT VOID Fcbs(BYTE * pLine);
|
INIT VOID Fcbs(BYTE * pLine);
|
||||||
INIT VOID Lastdrive(BYTE * pLine);
|
INIT VOID Lastdrive(BYTE * pLine);
|
||||||
INIT VOID LoadDevice(BYTE * pLine, COUNT top, COUNT mode);
|
INIT BOOL LoadDevice(BYTE * pLine, COUNT top, COUNT mode);
|
||||||
INIT VOID Dosmem(BYTE * pLine);
|
INIT VOID Dosmem(BYTE * pLine);
|
||||||
INIT VOID Country(BYTE * pLine);
|
INIT VOID Country(BYTE * pLine);
|
||||||
INIT VOID InitPgm(BYTE * pLine);
|
INIT VOID InitPgm(BYTE * pLine);
|
||||||
INIT VOID Switchar(BYTE * pLine);
|
INIT VOID Switchar(BYTE * pLine);
|
||||||
INIT VOID CfgFailure(BYTE * pLine);
|
INIT VOID CfgFailure(BYTE * pLine);
|
||||||
INIT VOID Stacks(BYTE * pLine);
|
INIT VOID Stacks(BYTE * pLine);
|
||||||
|
INIT VOID SetAnyDos(BYTE * pLine);
|
||||||
INIT BYTE *GetNumArg(BYTE * pLine, COUNT * pnArg);
|
INIT BYTE *GetNumArg(BYTE * pLine, COUNT * pnArg);
|
||||||
INIT BYTE *GetStringArg(BYTE * pLine, BYTE * pszString);
|
INIT BYTE *GetStringArg(BYTE * pLine, BYTE * pszString);
|
||||||
INIT struct dhdr FAR *linkdev(struct dhdr FAR * dhp);
|
INIT struct dhdr FAR *linkdev(struct dhdr FAR * dhp);
|
||||||
INIT UWORD initdev(struct dhdr FAR * dhp, BYTE FAR * cmdTail);
|
INIT UWORD initdev(struct dhdr FAR * dhp, BYTE FAR * cmdTail);
|
||||||
INIT int SkipLine(char *pLine);
|
INIT int SkipLine(char *pLine);
|
||||||
|
INIT char *stristr(char *s1, char *s2);
|
||||||
|
|
||||||
|
INIT BYTE FAR *KernelAlloc(WORD nBytes);
|
||||||
|
|
||||||
|
extern void HMAconfig(int finalize);
|
||||||
|
VOID config_init_buffers(COUNT anzBuffers); /* from BLOCKIO.C */
|
||||||
|
|
||||||
|
extern fmemcmp(BYTE far *s1, BYTE FAR *s2, unsigned len);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
INIT static VOID FAR *AlignParagraph(VOID FAR * lpPtr);
|
INIT static VOID FAR *AlignParagraph(VOID FAR * lpPtr);
|
||||||
#ifndef I86
|
#ifndef I86
|
||||||
@ -213,12 +227,12 @@ struct table
|
|||||||
static struct table commands[] =
|
static struct table commands[] =
|
||||||
{
|
{
|
||||||
{"BREAK", 1, Break},
|
{"BREAK", 1, Break},
|
||||||
{"BUFFERS", 1, Buffers},
|
{"BUFFERS", 1, Config_Buffers},
|
||||||
{"COMMAND", 1, InitPgm},
|
{"COMMAND", 1, InitPgm},
|
||||||
{"COUNTRY", 1, Country},
|
{"COUNTRY", 1, Country},
|
||||||
{"DEVICE", 2, Device},
|
{"DEVICE", 2, Device},
|
||||||
{"DEVICEHIGH", 2, DeviceHigh},
|
{"DEVICEHIGH", 2, DeviceHigh},
|
||||||
{"DOS", 2, Dosmem},
|
{"DOS", 1, Dosmem},
|
||||||
{"FCBS", 1, Fcbs},
|
{"FCBS", 1, Fcbs},
|
||||||
{"FILES", 1, Files},
|
{"FILES", 1, Files},
|
||||||
{"LASTDRIVE", 1, Lastdrive},
|
{"LASTDRIVE", 1, Lastdrive},
|
||||||
@ -229,6 +243,7 @@ static struct table commands[] =
|
|||||||
{"SWITCHAR", 1, Switchar},
|
{"SWITCHAR", 1, Switchar},
|
||||||
{"SCREEN", 1, sysScreenMode}, /* JPP */
|
{"SCREEN", 1, sysScreenMode}, /* JPP */
|
||||||
{"VERSION", 1, sysVersion}, /* JPP */
|
{"VERSION", 1, sysVersion}, /* JPP */
|
||||||
|
{"ANYDOS", 1, SetAnyDos}, /* JPP */
|
||||||
/* default action */
|
/* default action */
|
||||||
{"", -1, CfgFailure}
|
{"", -1, CfgFailure}
|
||||||
};
|
};
|
||||||
@ -240,6 +255,21 @@ INIT BYTE FAR *KernelAllocDma(WORD);
|
|||||||
|
|
||||||
BYTE *pLineStart;
|
BYTE *pLineStart;
|
||||||
|
|
||||||
|
BYTE HMATextIsAvailable = 0;
|
||||||
|
|
||||||
|
void FAR * ConfigAlloc(COUNT bytes)
|
||||||
|
{
|
||||||
|
VOID FAR *p;
|
||||||
|
|
||||||
|
p = HMAalloc(bytes);
|
||||||
|
|
||||||
|
if (p == NULL) p = KernelAlloc(bytes);
|
||||||
|
|
||||||
|
/* printf("ConfigAllog %d at %p\n", bytes, p);*/
|
||||||
|
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
/* Do first time initialization. Store last so that we can reset it */
|
/* Do first time initialization. Store last so that we can reset it */
|
||||||
/* later. */
|
/* later. */
|
||||||
INIT void PreConfig(void)
|
INIT void PreConfig(void)
|
||||||
@ -250,23 +280,31 @@ INIT void PreConfig(void)
|
|||||||
UmbState = 0;
|
UmbState = 0;
|
||||||
|
|
||||||
/* Initialize the base memory pointers */
|
/* Initialize the base memory pointers */
|
||||||
lpOldLast = lpBase = AlignParagraph((BYTE FAR *) & last);
|
|
||||||
|
|
||||||
|
if ( HMATextIsAvailable )
|
||||||
|
lpOldLast = lpBase = AlignParagraph((BYTE FAR *) & _HMATextAvailable);
|
||||||
|
else
|
||||||
|
lpOldLast = lpBase = AlignParagraph((BYTE FAR *) & _InitTextStart);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("SDA located at 0x%04x:0x%04x\n",
|
printf("SDA located at 0x%p\n", internal_data);
|
||||||
FP_SEG(internal_data), FP_OFF(internal_data));
|
|
||||||
#endif
|
#endif
|
||||||
/* Begin by initializing our system buffers */
|
/* Begin by initializing our system buffers */
|
||||||
dma_scratch = (BYTE FAR *) KernelAllocDma(BUFFERSIZE);
|
/* the dms_scratch buffer is statically allocated
|
||||||
|
in the DSK module */
|
||||||
|
/* dma_scratch = (BYTE FAR *) KernelAllocDma(BUFFERSIZE); */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Preliminary DMA scratchpad allocated at 0x%04x:0x%04x\n",
|
/* printf("Preliminary DMA scratchpad allocated at 0x%p\n",dma_scratch);*/
|
||||||
FP_SEG(dma_scratch), FP_OFF(dma_scratch));
|
|
||||||
#endif
|
#endif
|
||||||
buffers = (struct buffer FAR *)
|
|
||||||
KernelAlloc(Config.cfgBuffers * sizeof(struct buffer));
|
|
||||||
|
|
||||||
|
config_init_buffers( Config.cfgBuffers );
|
||||||
|
/* buffers = (struct buffer FAR *)
|
||||||
|
KernelAlloc(Config.cfgBuffers * sizeof(struct buffer)); */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Preliminary %d buffers allocated at 0x%04x:0x%04x\n", Config.cfgBuffers,
|
/* printf("Preliminary %d buffers allocated at 0x%p\n", Config.cfgBuffers, buffers);*/
|
||||||
FP_SEG(buffers), FP_OFF(buffers));
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Initialize the file table */
|
/* Initialize the file table */
|
||||||
@ -285,22 +323,16 @@ INIT void PreConfig(void)
|
|||||||
KernelAlloc(0x58 * (lastdrive));
|
KernelAlloc(0x58 * (lastdrive));
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
printf("Preliminary f_node allocated at at 0x%p\n",f_nodes);
|
||||||
printf("Preliminary f_node allocated at 0x%04x:0x%04x\n",
|
printf("Preliminary FCB table allocated at 0x%p\n",FCBp);
|
||||||
FP_SEG(f_nodes), FP_OFF(f_nodes));
|
printf("Preliminary sft table allocated at 0x%p\n",sfthead);
|
||||||
printf("Preliminary FCB table allocated at 0x%04x:0x%04x\n",
|
printf("Preliminary CDS table allocated at 0x%p\n",CDSp);
|
||||||
FP_SEG(FCBp), FP_OFF(FCBp));
|
|
||||||
printf("Preliminary sft table allocated at 0x%04x:0x%04x\n",
|
|
||||||
FP_SEG(sfthead), FP_OFF(sfthead));
|
|
||||||
printf("Preliminary CDS table allocated at 0x%04x:0x%04x\n",
|
|
||||||
FP_SEG(CDSp), FP_OFF(CDSp));
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Done. Now initialize the MCB structure */
|
/* Done. Now initialize the MCB structure */
|
||||||
/* This next line is 8086 and 80x86 real mode specific */
|
/* This next line is 8086 and 80x86 real mode specific */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Preliminary allocation completed: top at 0x%04x:0x%04x\n",
|
printf("Preliminary allocation completed: top at 0x%p\n",lpBase);
|
||||||
FP_SEG(lpBase), FP_OFF(lpBase));
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef KDB
|
#ifdef KDB
|
||||||
@ -327,20 +359,29 @@ INIT void PostConfig(void)
|
|||||||
if (lastdrive < nblkdev )
|
if (lastdrive < nblkdev )
|
||||||
lastdrive = nblkdev ;
|
lastdrive = nblkdev ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Initialize the base memory pointers from last time. */
|
/* Initialize the base memory pointers from last time. */
|
||||||
lpBase = AlignParagraph(lpOldLast);
|
|
||||||
|
if ( HMATextIsAvailable )
|
||||||
|
lpOldLast = lpBase = AlignParagraph((BYTE FAR *) & _HMATextStart);
|
||||||
|
else
|
||||||
|
lpOldLast = lpBase = AlignParagraph((BYTE FAR *) & _InitTextStart);
|
||||||
|
|
||||||
/* Begin by initializing our system buffers */
|
/* Begin by initializing our system buffers */
|
||||||
dma_scratch = (BYTE FAR *) KernelAllocDma(BUFFERSIZE);
|
/* dma_scratch = (BYTE FAR *) KernelAllocDma(BUFFERSIZE); */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("DMA scratchpad allocated at 0x%04x:0x%04x\n", FP_SEG(dma_scratch),
|
/* printf("DMA scratchpad allocated at 0x%p\n", dma_scratch); */
|
||||||
FP_OFF(dma_scratch));
|
|
||||||
#endif
|
#endif
|
||||||
buffers = (struct buffer FAR *)
|
|
||||||
KernelAlloc(Config.cfgBuffers * sizeof(struct buffer));
|
|
||||||
|
config_init_buffers( Config.cfgBuffers );
|
||||||
|
|
||||||
|
/* buffers = (struct buffer FAR *)
|
||||||
|
KernelAlloc(Config.cfgBuffers * sizeof(struct buffer)); */
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("%d buffers allocated at 0x%04x:0x%04x\n", Config.cfgBuffers,
|
/* printf("%d buffers allocated at 0x%p\n", Config.cfgBuffers,buffers); */
|
||||||
FP_SEG(buffers), FP_OFF(buffers));
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Initialize the file table */
|
/* Initialize the file table */
|
||||||
@ -360,14 +401,10 @@ INIT void PostConfig(void)
|
|||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
||||||
printf("f_node allocated at 0x%04x:0x%04x\n",
|
printf("f_node allocated at 0x%p\n",f_nodes);
|
||||||
FP_SEG(f_nodes), FP_OFF(f_nodes));
|
printf("FCB table allocated at 0x%p\n",FCBp);
|
||||||
printf("FCB table allocated at 0x%04x:0x%04x\n",
|
printf("sft table allocated at 0x%p\n",sfthead);
|
||||||
FP_SEG(FCBp), FP_OFF(FCBp));
|
printf("CDS table allocated at 0x%p\n",CDSp);
|
||||||
printf("sft table allocated at 0x%04x:0x%04x\n",
|
|
||||||
FP_SEG(sfthead), FP_OFF(sfthead));
|
|
||||||
printf("CDS table allocated at 0x%04x:0x%04x\n",
|
|
||||||
FP_SEG(CDSp), FP_OFF(CDSp));
|
|
||||||
#endif
|
#endif
|
||||||
if (Config.cfgStacks)
|
if (Config.cfgStacks)
|
||||||
{
|
{
|
||||||
@ -375,13 +412,11 @@ INIT void PostConfig(void)
|
|||||||
init_stacks(stackBase, Config.cfgStacks, Config.cfgStackSize);
|
init_stacks(stackBase, Config.cfgStacks, Config.cfgStackSize);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Stacks allocated at %04x:%04x\n",
|
printf("Stacks allocated at %p\n",stackBase);
|
||||||
FP_SEG(stackBase), FP_OFF(stackBase));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Allocation completed: top at 0x%04x:0x%04x\n",
|
printf("Allocation completed: top at 0x%p\n",lpBase);
|
||||||
FP_SEG(lpBase), FP_OFF(lpBase));
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -392,6 +427,10 @@ INIT VOID configDone(VOID)
|
|||||||
{
|
{
|
||||||
COUNT i;
|
COUNT i;
|
||||||
|
|
||||||
|
HMAconfig(TRUE); /* final HMA processing */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (lastdrive < nblkdev) {
|
if (lastdrive < nblkdev) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("lastdrive %c too small upping it to: %c\n", lastdrive + 'A', nblkdev + 'A' -1);
|
printf("lastdrive %c too small upping it to: %c\n", lastdrive + 'A', nblkdev + 'A' -1);
|
||||||
@ -426,8 +465,7 @@ INIT VOID configDone(VOID)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("UMB Allocation completed: top at 0x%04x:0x%04x\n",
|
printf("UMB Allocation completed: top at 0x%p\n",upBase);
|
||||||
FP_SEG(upBase), FP_OFF(upBase));
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The standard handles should be reopened here, because
|
/* The standard handles should be reopened here, because
|
||||||
@ -509,6 +547,9 @@ INIT VOID DoConfig(VOID)
|
|||||||
/*
|
/*
|
||||||
Do it here in the loop.
|
Do it here in the loop.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* shouldn't this go also AFTER the last line has been read?
|
||||||
|
might be the UMB driver */
|
||||||
if(UmbState == 2){
|
if(UmbState == 2){
|
||||||
if(!Umb_Test()){
|
if(!Umb_Test()){
|
||||||
UmbState = 1;
|
UmbState = 1;
|
||||||
@ -624,7 +665,7 @@ INIT BYTE *GetStringArg(BYTE * pLine, BYTE * pszString)
|
|||||||
return scan(pLine, pszString);
|
return scan(pLine, pszString);
|
||||||
}
|
}
|
||||||
|
|
||||||
INIT static VOID Buffers(BYTE * pLine)
|
INIT void Config_Buffers(BYTE * pLine)
|
||||||
{
|
{
|
||||||
COUNT nBuffers;
|
COUNT nBuffers;
|
||||||
|
|
||||||
@ -719,17 +760,49 @@ INIT static VOID Lastdrive(BYTE * pLine)
|
|||||||
UmbState of confidence, 1 is sure, 2 maybe, 4 unknown and 0 no way.
|
UmbState of confidence, 1 is sure, 2 maybe, 4 unknown and 0 no way.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __TURBOC__
|
||||||
|
void __int__(int); /* TC 2.01 requires this. :( -- ror4 */
|
||||||
|
#endif
|
||||||
|
#define int3() __int__(3);
|
||||||
|
|
||||||
INIT static VOID Dosmem(BYTE * pLine)
|
INIT static VOID Dosmem(BYTE * pLine)
|
||||||
{
|
{
|
||||||
BYTE *pTmp;
|
BYTE *pTmp;
|
||||||
|
BYTE UMBwanted = FALSE, HMAwanted = FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
pLine = GetStringArg(pLine, szBuf);
|
||||||
|
|
||||||
|
for (pTmp = szBuf; *pTmp != '\0'; pTmp++)
|
||||||
|
*pTmp = toupper(*pTmp);
|
||||||
|
|
||||||
|
printf("DOS called with %s\n", szBuf);
|
||||||
|
int3();
|
||||||
|
|
||||||
|
for (pTmp = szBuf ; ; )
|
||||||
|
{
|
||||||
|
if (fmemcmp(pTmp, "UMB" ,3) == 0) { UMBwanted = TRUE; pTmp += 3; }
|
||||||
|
if (fmemcmp(pTmp, "HIGH",4) == 0) { HMAwanted = TRUE; pTmp += 4; }
|
||||||
|
|
||||||
|
pTmp = skipwh(pTmp);
|
||||||
|
|
||||||
|
if (*pTmp != ',')
|
||||||
|
break;
|
||||||
|
pTmp++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(UmbState == 0){
|
if(UmbState == 0){
|
||||||
uppermem_link = 0;
|
uppermem_link = 0;
|
||||||
uppermem_root = 0;
|
uppermem_root = 0;
|
||||||
GetStringArg(pLine, szBuf);
|
UmbState = UMBwanted ? 2 : 0;
|
||||||
for (pTmp = szBuf; *pTmp != '\0'; pTmp++)
|
}
|
||||||
*pTmp = toupper(*pTmp);
|
|
||||||
UmbState = strcmp(szBuf, "UMB") ? 0 : 2;
|
if (HMAwanted)
|
||||||
|
{
|
||||||
|
int MoveKernelToHMA();
|
||||||
|
|
||||||
|
HMATextIsAvailable = MoveKernelToHMA();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -771,10 +844,15 @@ INIT static VOID Fcbs(BYTE * pLine)
|
|||||||
* Returns TRUE if successful, FALSE if not.
|
* Returns TRUE if successful, FALSE if not.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static INIT BOOL LoadCountryInfo(char *filename, UWORD ctryCode, UWORD codePage)
|
INIT BOOL LoadCountryInfo(char *filename, UWORD ctryCode, UWORD codePage)
|
||||||
{
|
{
|
||||||
/* printf("cntry: %u, CP%u, file=\"%s\"\n", ctryCode, codePage, filename); */
|
/* printf("cntry: %u, CP%u, file=\"%s\"\n", ctryCode, codePage, filename); */
|
||||||
printf("Sorry, the COUNTRY= statement has been temporarily disabled\n");
|
printf("Sorry, the COUNTRY= statement has been temporarily disabled\n");
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER(codePage);
|
||||||
|
UNREFERENCED_PARAMETER(ctryCode);
|
||||||
|
UNREFERENCED_PARAMETER(filename);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -867,7 +945,11 @@ INIT static VOID DeviceHigh(BYTE * pLine)
|
|||||||
{
|
{
|
||||||
if(UmbState == 1)
|
if(UmbState == 1)
|
||||||
{
|
{
|
||||||
LoadDevice(pLine, UMB_top, TRUE);
|
if (LoadDevice(pLine, UMB_top, TRUE) == DE_NOMEM)
|
||||||
|
{
|
||||||
|
printf("Not enough free memory in UMB's: loading low\n");
|
||||||
|
LoadDevice(pLine, ram_top, FALSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -876,12 +958,12 @@ INIT static VOID DeviceHigh(BYTE * pLine)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INIT static VOID Device(BYTE * pLine)
|
INIT void Device(BYTE * pLine)
|
||||||
{
|
{
|
||||||
LoadDevice(pLine, ram_top, FALSE);
|
LoadDevice(pLine, ram_top, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
INIT static VOID LoadDevice(BYTE * pLine, COUNT top, COUNT mode)
|
INIT BOOL LoadDevice(BYTE * pLine, COUNT top, COUNT mode)
|
||||||
{
|
{
|
||||||
VOID FAR *driver_ptr;
|
VOID FAR *driver_ptr;
|
||||||
BYTE *pTmp;
|
BYTE *pTmp;
|
||||||
@ -889,6 +971,7 @@ INIT static VOID LoadDevice(BYTE * pLine, COUNT top, COUNT mode)
|
|||||||
struct dhdr FAR *dhp;
|
struct dhdr FAR *dhp;
|
||||||
struct dhdr FAR *next_dhp;
|
struct dhdr FAR *next_dhp;
|
||||||
UWORD dev_seg;
|
UWORD dev_seg;
|
||||||
|
BOOL result;
|
||||||
|
|
||||||
if(mode)
|
if(mode)
|
||||||
dev_seg = (((ULONG) FP_SEG(upBase) << 4) + FP_OFF(upBase) + 0xf) >> 4;
|
dev_seg = (((ULONG) FP_SEG(upBase) << 4) + FP_OFF(upBase) + 0xf) >> 4;
|
||||||
@ -908,18 +991,74 @@ INIT static VOID LoadDevice(BYTE * pLine, COUNT top, COUNT mode)
|
|||||||
szBuf, dev_seg);
|
szBuf, dev_seg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int3();
|
||||||
|
|
||||||
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 ( ; ; )
|
||||||
|
{
|
||||||
|
struct dhdr FAR *previous_nul_dhp;
|
||||||
|
|
||||||
|
previous_nul_dhp = nul_dev.dh_next;
|
||||||
|
|
||||||
|
next_dhp = dhp->dh_next;
|
||||||
|
|
||||||
/* Link in device driver and save nul_dev pointer to next */
|
/* Link in device driver and save nul_dev pointer to next */
|
||||||
next_dhp = dhp->dh_next = nul_dev.dh_next;
|
dhp->dh_next = nul_dev.dh_next;
|
||||||
nul_dev.dh_next = dhp;
|
nul_dev.dh_next = dhp;
|
||||||
|
|
||||||
if(init_device(dhp, pLine, mode, top)){
|
/* that's a nice hack >:-)
|
||||||
nul_dev.dh_next = next_dhp; /* return orig pointer if error */
|
|
||||||
|
although we don't want HIMEM.SYS,(it's not free), other people
|
||||||
|
might load HIMEM.SYS to see if they are compatible to it.
|
||||||
|
|
||||||
|
if it's HIMEM.SYS, we won't survive TESTMEM:ON
|
||||||
|
|
||||||
|
so simply add TESTMEM:OFF to the commandline
|
||||||
|
*/
|
||||||
|
pTmp = pLine;
|
||||||
|
|
||||||
|
int3();
|
||||||
|
if (DosLoadedInHMA)
|
||||||
|
if (stristr(szBuf, "HIMEM.SYS") != NULL)
|
||||||
|
{
|
||||||
|
if (stristr(pLine, "/TESTMEM:OFF") == NULL)
|
||||||
|
{
|
||||||
|
pTmp = szBuf;
|
||||||
|
strcpy(pTmp, pLine);
|
||||||
|
strcat(pTmp, " /TESTMEM:OFF\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* end of HIMEM.SYS HACK */
|
||||||
|
|
||||||
|
result=init_device(dhp, pTmp, mode, top);
|
||||||
|
if(result){
|
||||||
|
nul_dev.dh_next = previous_nul_dhp; /* return orig pointer if error */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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 */
|
||||||
|
|
||||||
|
}
|
||||||
else
|
else
|
||||||
CfgFailure(pLine);
|
CfgFailure(pLine);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
INIT static VOID CfgFailure(BYTE * pLine)
|
INIT static VOID CfgFailure(BYTE * pLine)
|
||||||
@ -934,7 +1073,7 @@ INIT static VOID CfgFailure(BYTE * pLine)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef KDB
|
#ifndef KDB
|
||||||
INIT static BYTE FAR *KernelAlloc(WORD nBytes)
|
INIT BYTE FAR *KernelAlloc(WORD nBytes)
|
||||||
{
|
{
|
||||||
BYTE FAR *lpAllocated;
|
BYTE FAR *lpAllocated;
|
||||||
|
|
||||||
@ -956,7 +1095,7 @@ INIT static BYTE FAR *KernelAlloc(WORD nBytes)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef I86
|
#ifdef I86
|
||||||
INIT static BYTE FAR *KernelAllocDma(WORD bytes)
|
INIT BYTE FAR *KernelAllocDma(WORD bytes)
|
||||||
{
|
{
|
||||||
BYTE FAR *allocated;
|
BYTE FAR *allocated;
|
||||||
|
|
||||||
@ -968,7 +1107,7 @@ INIT static BYTE FAR *KernelAllocDma(WORD bytes)
|
|||||||
return allocated;
|
return allocated;
|
||||||
}
|
}
|
||||||
|
|
||||||
INIT static VOID FAR *AlignParagraph(VOID FAR * lpPtr)
|
INIT void FAR *AlignParagraph(VOID FAR * lpPtr)
|
||||||
{
|
{
|
||||||
ULONG lTemp;
|
ULONG lTemp;
|
||||||
UWORD uSegVal;
|
UWORD uSegVal;
|
||||||
@ -1122,4 +1261,86 @@ INIT VOID
|
|||||||
strcpy(d, s);
|
strcpy(d, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* see if the second string is contained in the first one, ignoring case */
|
||||||
|
char *stristr(char *s1, char *s2)
|
||||||
|
{
|
||||||
|
int loop;
|
||||||
|
|
||||||
|
for ( ; *s1 ; s1++)
|
||||||
|
for ( loop = 0; ; loop++)
|
||||||
|
{
|
||||||
|
if (s2[loop] == 0) /* found end of string 2 -> success */
|
||||||
|
{
|
||||||
|
return s1; /* position where s2 was found */
|
||||||
|
}
|
||||||
|
if (toupper(s1[loop]) != toupper(s2[loop]) )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
moved from BLOCKIO.C here.
|
||||||
|
that saves some relocation problems
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
VOID config_init_buffers(COUNT anzBuffers)
|
||||||
|
{
|
||||||
|
REG WORD i;
|
||||||
|
struct buffer FAR *pbuffer;
|
||||||
|
int HMAcount = 0;
|
||||||
|
|
||||||
|
anzBuffers = max(anzBuffers,6);
|
||||||
|
anzBuffers = min(anzBuffers,64);
|
||||||
|
|
||||||
|
firstbuf = ConfigAlloc(sizeof (struct buffer));
|
||||||
|
|
||||||
|
pbuffer = firstbuf;
|
||||||
|
|
||||||
|
for (i = 0; ; ++i)
|
||||||
|
{
|
||||||
|
if (FP_SEG(pbuffer) == 0xffff) HMAcount++;
|
||||||
|
|
||||||
|
lastbuf = pbuffer;
|
||||||
|
|
||||||
|
pbuffer->b_unit = 0;
|
||||||
|
pbuffer->b_flag = 0;
|
||||||
|
pbuffer->b_blkno = 0;
|
||||||
|
pbuffer->b_copies = 0;
|
||||||
|
pbuffer->b_offset_lo = 0;
|
||||||
|
pbuffer->b_offset_hi = 0;
|
||||||
|
pbuffer->b_next = NULL;
|
||||||
|
|
||||||
|
/* printf("init_buffers buffer %d at %p\n",i, pbuffer);*/
|
||||||
|
|
||||||
|
if (i < (anzBuffers - 1))
|
||||||
|
pbuffer->b_next = ConfigAlloc(sizeof (struct buffer));
|
||||||
|
|
||||||
|
if (pbuffer->b_next == NULL)
|
||||||
|
break;
|
||||||
|
|
||||||
|
pbuffer = pbuffer->b_next;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (HMAcount > 0)
|
||||||
|
printf("Kernel: allocated %d Diskbuffers = %u Bytes in HMA\n",
|
||||||
|
HMAcount, HMAcount*sizeof (struct buffer));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Undocumented feature:
|
||||||
|
|
||||||
|
ANYDOS
|
||||||
|
will report to MSDOS programs just the version number
|
||||||
|
they expect. be careful with it!
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
INIT VOID SetAnyDos(BYTE * pLine)
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(pLine);
|
||||||
|
ReturnAnyDosVersionExpected = TRUE;
|
||||||
|
}
|
||||||
|
@ -28,6 +28,9 @@
|
|||||||
; $Header$
|
; $Header$
|
||||||
;
|
;
|
||||||
; $Log$
|
; $Log$
|
||||||
|
; Revision 1.5 2001/03/21 02:56:25 bartoldeman
|
||||||
|
; See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
;
|
||||||
; 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
|
||||||
;
|
;
|
||||||
@ -90,7 +93,7 @@ ConTable db 0Ah
|
|||||||
PRT_SCREEN equ 7200h
|
PRT_SCREEN equ 7200h
|
||||||
CTL_P equ 10h
|
CTL_P equ 10h
|
||||||
|
|
||||||
segment _IO_TEXT
|
segment _TEXT
|
||||||
|
|
||||||
uScanCode db 0 ; Scan code for con: device
|
uScanCode db 0 ; Scan code for con: device
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ static BYTE *dosfnsRcsId = "$Id$";
|
|||||||
* /// Added SHARE support. 2000/09/04 Ron Cemer
|
* /// Added SHARE support. 2000/09/04 Ron Cemer
|
||||||
*
|
*
|
||||||
* $Log$
|
* $Log$
|
||||||
* Revision 1.10 2001/03/19 04:34:18 bartoldeman
|
* Revision 1.11 2001/03/21 02:56:25 bartoldeman
|
||||||
* Update the redirector and Martin Stromberg changes to CVS.
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
*
|
*
|
||||||
* Revision 1.10 2001/03/08 21:15:00 bartoldeman
|
* Revision 1.10 2001/03/08 21:15:00 bartoldeman
|
||||||
* Redirector and DosSelectDrv() (Martin Stromberg) fixes
|
* Redirector and DosSelectDrv() (Martin Stromberg) fixes
|
||||||
@ -805,6 +805,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;
|
||||||
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;
|
result = -result;
|
||||||
if (result == SUCCESS) {
|
if (result == SUCCESS) {
|
||||||
@ -963,12 +964,13 @@ COUNT DosOpen(BYTE FAR * fname, COUNT mode)
|
|||||||
|
|
||||||
sftp->sft_shroff = -1; /* /// Added for SHARE - Ron Cemer */
|
sftp->sft_shroff = -1; /* /// Added for SHARE - Ron Cemer */
|
||||||
|
|
||||||
|
sftp->sft_mode = mode;
|
||||||
|
|
||||||
/* check for a device */
|
/* check for a device */
|
||||||
dhp = IsDevice(fname);
|
dhp = IsDevice(fname);
|
||||||
if ( dhp )
|
if ( dhp )
|
||||||
{
|
{
|
||||||
sftp->sft_count += 1;
|
sftp->sft_count += 1;
|
||||||
sftp->sft_mode = mode;
|
|
||||||
sftp->sft_attrib = 0;
|
sftp->sft_attrib = 0;
|
||||||
sftp->sft_flags =
|
sftp->sft_flags =
|
||||||
((dhp->dh_attr & ~SFT_MASK) & ~SFT_FSHARED) | SFT_FDEVICE | SFT_FEOF;
|
((dhp->dh_attr & ~SFT_MASK) & ~SFT_FSHARED) | SFT_FDEVICE | SFT_FEOF;
|
||||||
@ -1185,6 +1187,12 @@ COUNT DosChangeDir(BYTE FAR * s)
|
|||||||
COUNT result;
|
COUNT result;
|
||||||
BYTE FAR *p;
|
BYTE FAR *p;
|
||||||
|
|
||||||
|
/* don't do wildcard CHDIR --TE*/
|
||||||
|
/* although this should be handled somewhere else */
|
||||||
|
for (p = s; *p; p++)
|
||||||
|
if (*p == '*' || *p == '?')
|
||||||
|
return DE_PATHNOTFND;
|
||||||
|
|
||||||
drive = get_verify_drive(s);
|
drive = get_verify_drive(s);
|
||||||
if (drive < 0 ) {
|
if (drive < 0 ) {
|
||||||
return drive;
|
return drive;
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
PSP_USERSP equ 2eh
|
PSP_USERSP equ 2eh
|
||||||
PSP_USERSS equ 30h
|
PSP_USERSS equ 30h
|
||||||
|
|
||||||
segment _TEXT
|
segment HMA_TEXT
|
||||||
|
|
||||||
global _DosIdle_int
|
global _DosIdle_int
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ segment _TEXT
|
|||||||
_DosIdle_int:
|
_DosIdle_int:
|
||||||
push ds
|
push ds
|
||||||
push ax
|
push ax
|
||||||
mov ax,DGROUP
|
mov ax, DGROUP
|
||||||
mov ds,ax
|
mov ds,ax
|
||||||
pop ax
|
pop ax
|
||||||
cmp byte [_dosidle_flag],0
|
cmp byte [_dosidle_flag],0
|
||||||
|
@ -36,6 +36,9 @@ static BYTE *dosnamesRcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.7 2001/03/21 02:56:25 bartoldeman
|
||||||
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
*
|
||||||
* Revision 1.6 2000/06/21 18:16:46 jimtabor
|
* Revision 1.6 2000/06/21 18:16:46 jimtabor
|
||||||
* Add UMB code, patch, and code fixes
|
* Add UMB code, patch, and code fixes
|
||||||
*
|
*
|
||||||
@ -226,8 +229,8 @@ COUNT ParseDosName(BYTE FAR * lpszFileName,
|
|||||||
{
|
{
|
||||||
if ((lpszFileName - lpszLclFile) == 2) /* for tail DotDot */
|
if ((lpszFileName - lpszLclFile) == 2) /* for tail DotDot */
|
||||||
nDirCnt += 2;
|
nDirCnt += 2;
|
||||||
if (nDirCnt > PARSE_MAX)
|
if (nDirCnt > PARSE_MAX-1)
|
||||||
nDirCnt = PARSE_MAX;
|
nDirCnt = PARSE_MAX-1;
|
||||||
fbcopy(lpszLclDir, (BYTE FAR *) pszDir, nDirCnt);
|
fbcopy(lpszLclDir, (BYTE FAR *) pszDir, nDirCnt);
|
||||||
if (((lpszFileName - lpszLclFile) == 2) && (nDirCnt < PARSE_MAX))
|
if (((lpszFileName - lpszLclFile) == 2) && (nDirCnt < PARSE_MAX))
|
||||||
pszDir[nDirCnt++] = '\\'; /* make DosTrimPath() enjoy, for tail DotDot */
|
pszDir[nDirCnt++] = '\\'; /* make DosTrimPath() enjoy, for tail DotDot */
|
||||||
@ -272,8 +275,8 @@ COUNT ParseDosName(BYTE FAR * lpszFileName,
|
|||||||
return DE_FILENOTFND;
|
return DE_FILENOTFND;
|
||||||
|
|
||||||
/* Fix lengths to maximums allowed by MS-DOS. */
|
/* Fix lengths to maximums allowed by MS-DOS. */
|
||||||
if (nDirCnt > PARSE_MAX)
|
if (nDirCnt > PARSE_MAX-1)
|
||||||
nDirCnt = PARSE_MAX;
|
nDirCnt = PARSE_MAX-1;
|
||||||
if (nFileCnt > FNAME_SIZE)
|
if (nFileCnt > FNAME_SIZE)
|
||||||
nFileCnt = FNAME_SIZE;
|
nFileCnt = FNAME_SIZE;
|
||||||
if (nExtCnt > FEXT_SIZE)
|
if (nExtCnt > FEXT_SIZE)
|
||||||
@ -344,9 +347,9 @@ COUNT ParseDosPath(BYTE FAR * lpszFileName,
|
|||||||
lpszLclDir = lpszFileName;
|
lpszLclDir = lpszFileName;
|
||||||
if (!PathSep(*lpszLclDir))
|
if (!PathSep(*lpszLclDir))
|
||||||
{
|
{
|
||||||
fstrncpy(pszDir, pszCurPath, PARSE_MAX);
|
fstrncpy(pszDir, pszCurPath, PARSE_MAX - 1); /*TE*/
|
||||||
nPathCnt = fstrlen(pszCurPath);
|
nPathCnt = fstrlen(pszCurPath);
|
||||||
if (!PathSep(pszDir[nPathCnt - 1]) && nPathCnt < PARSE_MAX)
|
if (!PathSep(pszDir[nPathCnt - 1]) && nPathCnt < PARSE_MAX - 1) /*TE*/
|
||||||
pszDir[nPathCnt++] = '\\';
|
pszDir[nPathCnt++] = '\\';
|
||||||
if (nPathCnt > PARSE_MAX)
|
if (nPathCnt > PARSE_MAX)
|
||||||
nPathCnt = PARSE_MAX;
|
nPathCnt = PARSE_MAX;
|
||||||
@ -363,8 +366,8 @@ COUNT ParseDosPath(BYTE FAR * lpszFileName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Fix lengths to maximums allowed by MS-DOS. */
|
/* Fix lengths to maximums allowed by MS-DOS. */
|
||||||
if ((nDirCnt + nPathCnt) > PARSE_MAX)
|
if ((nDirCnt + nPathCnt) > PARSE_MAX - 1) /*TE*/
|
||||||
nDirCnt = PARSE_MAX - nPathCnt;
|
nDirCnt = PARSE_MAX - 1 - nPathCnt;
|
||||||
|
|
||||||
/* Finally copy whatever the user wants extracted to the user's */
|
/* Finally copy whatever the user wants extracted to the user's */
|
||||||
/* buffers. */
|
/* buffers. */
|
||||||
|
115
kernel/dsk.c
115
kernel/dsk.c
@ -33,9 +33,8 @@ static BYTE *dskRcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
* Revision 1.10 2001/03/19 05:01:38 bartoldeman
|
* Revision 1.11 2001/03/21 02:56:25 bartoldeman
|
||||||
* Space saving and partition detection fixes from Tom Ehlert and
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
* Brian Reifsnyder.
|
|
||||||
*
|
*
|
||||||
* Revision 1.9 2001/03/08 21:15:00 bartoldeman
|
* Revision 1.9 2001/03/08 21:15:00 bartoldeman
|
||||||
* Space saving fixes from Tom Ehlert
|
* Space saving fixes from Tom Ehlert
|
||||||
@ -124,7 +123,7 @@ static BYTE *dskRcsId = "$Id$";
|
|||||||
* Initial revision.
|
* Initial revision.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if 0
|
#if defined(DEBUG)
|
||||||
#define PartCodePrintf(x) printf x
|
#define PartCodePrintf(x) printf x
|
||||||
#else
|
#else
|
||||||
#define PartCodePrintf(x)
|
#define PartCodePrintf(x)
|
||||||
@ -155,7 +154,7 @@ COUNT fl_verify();
|
|||||||
BOOL fl_format();
|
BOOL fl_format();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NDEV 16 /* only one for demo */
|
#define NDEV 8 /* only one for demo */
|
||||||
#define SEC_SIZE 512 /* size of sector in bytes */
|
#define SEC_SIZE 512 /* size of sector in bytes */
|
||||||
#define N_RETRY 5 /* number of retries permitted */
|
#define N_RETRY 5 /* number of retries permitted */
|
||||||
#define NENTRY 26 /* total size of dispatch table */
|
#define NENTRY 26 /* total size of dispatch table */
|
||||||
@ -164,10 +163,17 @@ extern BYTE FAR nblk_rel;
|
|||||||
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
BYTE bytes[2 * SEC_SIZE];
|
BYTE bytes[1 * SEC_SIZE];
|
||||||
boot boot_sector;
|
boot boot_sector;
|
||||||
}
|
} buffer;
|
||||||
buffer;
|
|
||||||
|
/* if the buffer above is good enough for booting
|
||||||
|
it's also good enough for DMA input */
|
||||||
|
BYTE /* scratchpad used for working around */
|
||||||
|
FAR * dma_scratch_buffer = (BYTE FAR *)&buffer; /* DMA transfers during disk I/O */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
STATIC struct media_info
|
STATIC struct media_info
|
||||||
{
|
{
|
||||||
@ -229,7 +235,7 @@ STATIC struct dos_partitionS
|
|||||||
dos_partition[NDEV - 2];
|
dos_partition[NDEV - 2];
|
||||||
|
|
||||||
#ifdef PROTO
|
#ifdef PROTO
|
||||||
WORD init(rqptr),
|
WORD _dsk_init(rqptr),
|
||||||
mediachk(rqptr),
|
mediachk(rqptr),
|
||||||
bldbpb(rqptr),
|
bldbpb(rqptr),
|
||||||
blockio(rqptr),
|
blockio(rqptr),
|
||||||
@ -247,7 +253,7 @@ COUNT ltop(WORD *, WORD *, WORD *, COUNT, COUNT, ULONG, byteptr);
|
|||||||
WORD dskerr(COUNT);
|
WORD dskerr(COUNT);
|
||||||
COUNT processtable(int table_type,COUNT ptDrive, BYTE ptHead, UWORD ptCylinder, BYTE ptSector, LONG ptAccuOff);
|
COUNT processtable(int table_type,COUNT ptDrive, BYTE ptHead, UWORD ptCylinder, BYTE ptSector, LONG ptAccuOff);
|
||||||
#else
|
#else
|
||||||
WORD init(),
|
WORD _dsk_init(),
|
||||||
mediachk(),
|
mediachk(),
|
||||||
bldbpb(),
|
bldbpb(),
|
||||||
blockio(),
|
blockio(),
|
||||||
@ -275,7 +281,7 @@ static WORD(*dispatch[NENTRY]) (rqptr) =
|
|||||||
static WORD(*dispatch[NENTRY]) () =
|
static WORD(*dispatch[NENTRY]) () =
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
init, /* Initialize */
|
_dsk_init, /* Initialize */
|
||||||
mediachk, /* Media Check */
|
mediachk, /* Media Check */
|
||||||
bldbpb, /* Build BPB */
|
bldbpb, /* Build BPB */
|
||||||
blk_error, /* Ioctl In */
|
blk_error, /* Ioctl In */
|
||||||
@ -317,9 +323,9 @@ static WORD(*dispatch[NENTRY]) () =
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ULONG StartSector(WORD ptDrive, unsigned BeginHead,
|
ULONG StartSector(WORD ptDrive, unsigned BeginCylinder,
|
||||||
unsigned BeginSector,
|
unsigned BeginSector,
|
||||||
unsigned BeginCylinder,
|
unsigned BeginHead,
|
||||||
ULONG peStartSector,
|
ULONG peStartSector,
|
||||||
ULONG ptAccuOff)
|
ULONG ptAccuOff)
|
||||||
{
|
{
|
||||||
@ -345,12 +351,8 @@ ULONG StartSector(WORD ptDrive, unsigned BeginHead,
|
|||||||
startPos = ((ULONG)BeginCylinder * heads + BeginHead) * sectors + BeginSector - 1;
|
startPos = ((ULONG)BeginCylinder * heads + BeginHead) * sectors + BeginSector - 1;
|
||||||
|
|
||||||
PartCodePrintf((" CHS %x %x %x (%d %d %d) --> %lx ( %ld)\n",
|
PartCodePrintf((" CHS %x %x %x (%d %d %d) --> %lx ( %ld)\n",
|
||||||
BeginHead,
|
BeginCylinder, BeginHead, BeginSector,
|
||||||
BeginSector,
|
BeginCylinder, BeginHead, BeginSector,
|
||||||
BeginCylinder,
|
|
||||||
BeginHead,
|
|
||||||
BeginSector,
|
|
||||||
BeginCylinder,
|
|
||||||
startPos, startPos));
|
startPos, startPos));
|
||||||
|
|
||||||
return startPos;
|
return startPos;
|
||||||
@ -385,6 +387,7 @@ COUNT processtable(int table_type,COUNT ptDrive, BYTE ptHead, UWORD ptCylinder,
|
|||||||
BYTE *p;
|
BYTE *p;
|
||||||
int partition_chain = 0;
|
int partition_chain = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
ULONG newStartPos;
|
||||||
|
|
||||||
restart: /* yes, it's a GOTO >:-) */
|
restart: /* yes, it's a GOTO >:-) */
|
||||||
|
|
||||||
@ -395,8 +398,7 @@ restart: /* yes, it's a GOTO >:-) */
|
|||||||
|
|
||||||
|
|
||||||
PartCodePrintf(("searching partition table at %x %x %x %x %lx\n",
|
PartCodePrintf(("searching partition table at %x %x %x %x %lx\n",
|
||||||
ptDrive, ptHead, ptCylinder,
|
ptDrive, ptCylinder, ptHead, ptSector, ptAccuOff));
|
||||||
ptSector, ptAccuOff));
|
|
||||||
|
|
||||||
/* Read partition table */
|
/* Read partition table */
|
||||||
for ( retry = N_RETRY; --retry >= 0; )
|
for ( retry = N_RETRY; --retry >= 0; )
|
||||||
@ -437,17 +439,20 @@ restart: /* yes, it's a GOTO >:-) */
|
|||||||
|
|
||||||
/* Walk through the table, add DOS partitions to global
|
/* Walk through the table, add DOS partitions to global
|
||||||
array and process extended partitions */
|
array and process extended partitions */
|
||||||
|
|
||||||
|
/* when searching the EXT chain,
|
||||||
|
must skip primary partitions */
|
||||||
|
if ( (table_type==PRIMARY) ||
|
||||||
|
( (table_type==EXTENDED) && (partition_chain!=0) ) )
|
||||||
|
{
|
||||||
|
|
||||||
for (ptemp_part = &temp_part[0];
|
for (ptemp_part = &temp_part[0];
|
||||||
ptemp_part < &temp_part[N_PART] && nUnits < NDEV; ptemp_part++)
|
ptemp_part < &temp_part[N_PART] && nUnits < NDEV; ptemp_part++)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* when searching the EXT chain,
|
if ( ptemp_part->peFileSystem == FAT12 ||
|
||||||
must skip primary partitions */
|
|
||||||
if ( ( (table_type==PRIMARY)
|
|
||||||
|| ( (table_type==EXTENDED) && (partition_chain!=0) ) ) &&
|
|
||||||
( ptemp_part->peFileSystem == FAT12 ||
|
|
||||||
ptemp_part->peFileSystem == FAT16SMALL ||
|
ptemp_part->peFileSystem == FAT16SMALL ||
|
||||||
ptemp_part->peFileSystem == FAT16LARGE) )
|
ptemp_part->peFileSystem == FAT16LARGE )
|
||||||
{
|
{
|
||||||
struct dos_partitionS *pdos_partition;
|
struct dos_partitionS *pdos_partition;
|
||||||
|
|
||||||
@ -459,28 +464,25 @@ restart: /* yes, it's a GOTO >:-) */
|
|||||||
pmiarray->mi_drive = ptDrive;
|
pmiarray->mi_drive = ptDrive;
|
||||||
pmiarray->mi_partidx = nPartitions;
|
pmiarray->mi_partidx = nPartitions;
|
||||||
|
|
||||||
{
|
newStartPos = StartSector(ptDrive,
|
||||||
ULONG newStartPos = StartSector(ptDrive,
|
ptemp_part->peBeginCylinder,
|
||||||
ptemp_part->peBeginHead,
|
ptemp_part->peBeginHead,
|
||||||
ptemp_part->peBeginSector,
|
ptemp_part->peBeginSector,
|
||||||
ptemp_part->peBeginCylinder,
|
|
||||||
ptemp_part->peStartSector,
|
ptemp_part->peStartSector,
|
||||||
ptAccuOff);
|
ptAccuOff);
|
||||||
|
|
||||||
if (newStartPos != pmiarray->mi_offset)
|
if (newStartPos != pmiarray->mi_offset)
|
||||||
{
|
{
|
||||||
printf("PART TABLE mismatch for drive %x, CHS=%d %d %d, startsec %d, offset %ld\n",
|
printf("PART TABLE mismatch for drive %x, CHS=%d %d %d, startsec %d, offset %ld\n",
|
||||||
ptemp_part->peBeginCylinder,
|
ptDrive,
|
||||||
ptemp_part->peBeginHead,
|
ptemp_part->peBeginCylinder, ptemp_part->peBeginHead,ptemp_part->peBeginSector,
|
||||||
ptemp_part->peBeginSector,
|
ptemp_part->peStartSector, ptAccuOff);
|
||||||
ptemp_part->peStartSector,
|
|
||||||
ptAccuOff);
|
printf(" old startpos = %ld, new startpos = %ld, using new\n",
|
||||||
printf(" old startpos = %ld, new startpos = %ld, taking new\n",
|
|
||||||
pmiarray->mi_offset, newStartPos);
|
pmiarray->mi_offset, newStartPos);
|
||||||
|
|
||||||
pmiarray->mi_offset = newStartPos;
|
pmiarray->mi_offset = newStartPos;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
nUnits++;
|
nUnits++;
|
||||||
|
|
||||||
@ -501,27 +503,26 @@ restart: /* yes, it's a GOTO >:-) */
|
|||||||
|
|
||||||
PartCodePrintf(("DOS PARTITION drive %x CHS %x-%x-%x %x-%x-%x %lx %lx %lx FS %x\n",
|
PartCodePrintf(("DOS PARTITION drive %x CHS %x-%x-%x %x-%x-%x %lx %lx %lx FS %x\n",
|
||||||
pdos_partition->peDrive,
|
pdos_partition->peDrive,
|
||||||
pdos_partition->peBeginCylinder,
|
pdos_partition->peBeginCylinder,pdos_partition->peBeginHead ,pdos_partition->peBeginSector ,
|
||||||
pdos_partition->peBeginHead ,
|
pdos_partition->peEndCylinder ,pdos_partition->peEndHead ,pdos_partition->peEndSector ,
|
||||||
pdos_partition->peBeginSector ,
|
|
||||||
pdos_partition->peEndCylinder ,
|
|
||||||
pdos_partition->peEndHead ,
|
|
||||||
pdos_partition->peEndSector ,
|
|
||||||
pdos_partition->peStartSector ,
|
pdos_partition->peStartSector ,
|
||||||
pdos_partition->peSectors ,
|
pdos_partition->peSectors ,
|
||||||
pdos_partition->peAbsStart ,
|
pdos_partition->peAbsStart ,
|
||||||
pdos_partition->peFileSystem
|
pdos_partition->peFileSystem
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
nPartitions++;
|
nPartitions++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* search for EXT partitions only on 2. run */
|
||||||
|
if (table_type==EXTENDED)
|
||||||
|
{
|
||||||
for (ptemp_part = &temp_part[0];
|
for (ptemp_part = &temp_part[0];
|
||||||
ptemp_part < &temp_part[N_PART] && nUnits < NDEV; ptemp_part++)
|
ptemp_part < &temp_part[N_PART] && nUnits < NDEV; ptemp_part++)
|
||||||
{
|
{
|
||||||
if ( (table_type==EXTENDED) &&
|
if ( (ptemp_part->peFileSystem == EXTENDED ||
|
||||||
(ptemp_part->peFileSystem == EXTENDED ||
|
|
||||||
ptemp_part->peFileSystem == EXTENDED_INT32 ) )
|
ptemp_part->peFileSystem == EXTENDED_INT32 ) )
|
||||||
{
|
{
|
||||||
/* restart with new extended part table, don't recurs */
|
/* restart with new extended part table, don't recurs */
|
||||||
@ -534,13 +535,13 @@ restart: /* yes, it's a GOTO >:-) */
|
|||||||
|
|
||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
COUNT blk_driver(rqptr rp)
|
COUNT FAR init_call_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);
|
||||||
@ -552,7 +553,7 @@ COUNT blk_driver(rqptr rp)
|
|||||||
return ((*dispatch[rp->r_command]) (rp));
|
return ((*dispatch[rp->r_command]) (rp));
|
||||||
}
|
}
|
||||||
|
|
||||||
static WORD init(rqptr rp)
|
WORD _dsk_init(rqptr rp)
|
||||||
{
|
{
|
||||||
extern COUNT fl_nrdrives(VOID);
|
extern COUNT fl_nrdrives(VOID);
|
||||||
COUNT HardDrive,
|
COUNT HardDrive,
|
||||||
@ -608,6 +609,9 @@ static WORD init(rqptr rp)
|
|||||||
thats the way it is (hope I got it right)
|
thats the way it is (hope I got it right)
|
||||||
TE (with a little help from my friends) */
|
TE (with a little help from my friends) */
|
||||||
|
|
||||||
|
PartCodePrintf(("DSK init: found %d disk drives\n",nHardDisk));
|
||||||
|
|
||||||
|
|
||||||
for (HardDrive = 0; HardDrive < nHardDisk; HardDrive++)
|
for (HardDrive = 0; HardDrive < nHardDisk; HardDrive++)
|
||||||
{
|
{
|
||||||
/* Process primary partition table */
|
/* Process primary partition table */
|
||||||
@ -905,7 +909,6 @@ static WORD Genblkdev(rqptr rp)
|
|||||||
}
|
}
|
||||||
case 0x0866: /* get volume serial number */
|
case 0x0866: /* get volume serial number */
|
||||||
{
|
{
|
||||||
REG COUNT i;
|
|
||||||
struct Gioc_media FAR * gioc = (struct Gioc_media FAR *) rp->r_trans;
|
struct Gioc_media FAR * gioc = (struct Gioc_media FAR *) rp->r_trans;
|
||||||
struct FS_info FAR * fs = &fsarray[rp->r_unit];
|
struct FS_info FAR * fs = &fsarray[rp->r_unit];
|
||||||
|
|
||||||
@ -992,19 +995,23 @@ WORD blockio(rqptr rp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (count)
|
if (count && FP_SEG(trans) != 0xffff)
|
||||||
|
{
|
||||||
ret = action((WORD) miarray[rp->r_unit].mi_drive, head, track, sector,
|
ret = action((WORD) miarray[rp->r_unit].mi_drive, head, track, sector,
|
||||||
count, trans);
|
count, trans);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
count = 1;
|
count = 1;
|
||||||
/* buffer crosses DMA boundary, use scratchpad */
|
/* buffer crosses DMA boundary, use scratchpad */
|
||||||
|
/* use scratchpad also, if going to HIGH memory */
|
||||||
|
|
||||||
if (cmd != C_INPUT)
|
if (cmd != C_INPUT)
|
||||||
fbcopy(trans, dma_scratch, SEC_SIZE);
|
fbcopy(trans, dma_scratch_buffer, SEC_SIZE);
|
||||||
ret = action((WORD) miarray[rp->r_unit].mi_drive, head, track, sector,
|
ret = action((WORD) miarray[rp->r_unit].mi_drive, head, track, sector,
|
||||||
1, dma_scratch);
|
1, dma_scratch_buffer);
|
||||||
if (cmd == C_INPUT)
|
if (cmd == C_INPUT)
|
||||||
fbcopy(dma_scratch, trans, SEC_SIZE);
|
fbcopy(dma_scratch_buffer, trans, SEC_SIZE);
|
||||||
}
|
}
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
fl_reset((WORD) miarray[rp->r_unit].mi_drive);
|
fl_reset((WORD) miarray[rp->r_unit].mi_drive);
|
||||||
|
@ -28,6 +28,9 @@
|
|||||||
; $Id$
|
; $Id$
|
||||||
;
|
;
|
||||||
; $Log$
|
; $Log$
|
||||||
|
; Revision 1.4 2001/03/21 02:56:25 bartoldeman
|
||||||
|
; See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
;
|
||||||
; 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
|
||||||
;
|
;
|
||||||
@ -72,12 +75,12 @@
|
|||||||
%include "segs.inc"
|
%include "segs.inc"
|
||||||
%include "stacks.inc"
|
%include "stacks.inc"
|
||||||
|
|
||||||
segment _TEXT
|
segment HMA_TEXT
|
||||||
extern _int21_syscall:wrt TGROUP
|
extern _int21_syscall:wrt HGROUP
|
||||||
extern _int25_handler:wrt TGROUP
|
extern _int25_handler:wrt HGROUP
|
||||||
extern _int26_handler:wrt TGROUP
|
extern _int26_handler:wrt HGROUP
|
||||||
extern _set_stack:wrt TGROUP
|
extern _set_stack:wrt HMA_TEXT
|
||||||
extern _restore_stack:wrt TGROUP
|
extern _restore_stack:wrt HGROUP
|
||||||
extern _error_tos:wrt DGROUP
|
extern _error_tos:wrt DGROUP
|
||||||
extern _char_api_tos:wrt DGROUP
|
extern _char_api_tos:wrt DGROUP
|
||||||
extern _disk_api_tos:wrt DGROUP
|
extern _disk_api_tos:wrt DGROUP
|
||||||
@ -100,12 +103,12 @@ segment _TEXT
|
|||||||
extern _Int21AX:wrt DGROUP
|
extern _Int21AX:wrt DGROUP
|
||||||
|
|
||||||
|
|
||||||
global _cpm_entry
|
global reloc_call_cpm_entry
|
||||||
global _int20_handler
|
global reloc_call_int20_handler
|
||||||
global _int21_handler
|
global reloc_call_int21_handler
|
||||||
global _low_int25_handler
|
global reloc_call_low_int25_handler
|
||||||
global _low_int26_handler
|
global reloc_call_low_int26_handler
|
||||||
global _int27_handler
|
global reloc_call_int27_handler
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
@ -118,7 +121,7 @@ segment _TEXT
|
|||||||
; function after the call. What we do is convert it to a normal call and
|
; function after the call. What we do is convert it to a normal call and
|
||||||
; fudge the stack to look like an int 21h call.
|
; fudge the stack to look like an int 21h call.
|
||||||
;
|
;
|
||||||
_cpm_entry:
|
reloc_call_cpm_entry:
|
||||||
; Stack is:
|
; Stack is:
|
||||||
; return offset
|
; return offset
|
||||||
; psp seg
|
; psp seg
|
||||||
@ -159,7 +162,7 @@ _cpm_entry:
|
|||||||
cmp cl,024h
|
cmp cl,024h
|
||||||
jbe cpm_error
|
jbe cpm_error
|
||||||
mov ah,cl ; get the call # from cl to ah
|
mov ah,cl ; get the call # from cl to ah
|
||||||
jmp short _int21_handler ; do the system call
|
jmp short reloc_call_int21_handler ; do the system call
|
||||||
cpm_error: mov al,0
|
cpm_error: mov al,0
|
||||||
iret
|
iret
|
||||||
|
|
||||||
@ -189,7 +192,7 @@ _RestartSysCall:
|
|||||||
; VOID INRPT far
|
; VOID INRPT far
|
||||||
; int20_handler(iregs UserRegs)
|
; int20_handler(iregs UserRegs)
|
||||||
;
|
;
|
||||||
_int20_handler:
|
reloc_call_int20_handler:
|
||||||
mov ah,0 ; terminate through int 21h
|
mov ah,0 ; terminate through int 21h
|
||||||
|
|
||||||
|
|
||||||
@ -199,7 +202,7 @@ _int20_handler:
|
|||||||
; VOID INRPT far
|
; VOID INRPT far
|
||||||
; int21_handler(iregs UserRegs)
|
; int21_handler(iregs UserRegs)
|
||||||
;
|
;
|
||||||
_int21_handler:
|
reloc_call_int21_handler:
|
||||||
;
|
;
|
||||||
; Create the stack frame for C call. This is done to
|
; Create the stack frame for C call. This is done to
|
||||||
; preserve machine state and provide a C structure for
|
; preserve machine state and provide a C structure for
|
||||||
@ -347,7 +350,7 @@ dos_crit_sect:
|
|||||||
; VOID INRPT far
|
; VOID INRPT far
|
||||||
; int27_handler(iregs UserRegs)
|
; int27_handler(iregs UserRegs)
|
||||||
;
|
;
|
||||||
_int27_handler:
|
reloc_call_int27_handler:
|
||||||
;
|
;
|
||||||
; First convert the memory to paragraphs
|
; First convert the memory to paragraphs
|
||||||
;
|
;
|
||||||
@ -360,7 +363,7 @@ _int27_handler:
|
|||||||
; ... then use the standard system call
|
; ... then use the standard system call
|
||||||
;
|
;
|
||||||
mov ax,3100h
|
mov ax,3100h
|
||||||
jmp _int21_handler ; terminate through int 21h
|
jmp reloc_call_int21_handler ; terminate through int 21h
|
||||||
|
|
||||||
;
|
;
|
||||||
; I really do need to get rid of this because it's the only thing stopping
|
; I really do need to get rid of this because it's the only thing stopping
|
||||||
@ -368,7 +371,7 @@ _int27_handler:
|
|||||||
;
|
;
|
||||||
stkframe dd 0
|
stkframe dd 0
|
||||||
|
|
||||||
_low_int25_handler:
|
reloc_call_low_int25_handler:
|
||||||
sti
|
sti
|
||||||
pushf
|
pushf
|
||||||
push ax
|
push ax
|
||||||
@ -417,7 +420,7 @@ _low_int25_handler:
|
|||||||
; flag image on the stack.
|
; flag image on the stack.
|
||||||
|
|
||||||
|
|
||||||
_low_int26_handler:
|
reloc_call_low_int26_handler:
|
||||||
sti
|
sti
|
||||||
pushf
|
pushf
|
||||||
push ax
|
push ax
|
||||||
@ -478,12 +481,6 @@ PSP_USERSP equ 2eh
|
|||||||
PSP_USERSS equ 30h
|
PSP_USERSS equ 30h
|
||||||
|
|
||||||
|
|
||||||
;
|
|
||||||
; Default Int 24h handler -- always returns fail
|
|
||||||
;
|
|
||||||
global _int24_handler
|
|
||||||
_int24_handler: mov al,FAIL
|
|
||||||
iret
|
|
||||||
|
|
||||||
;
|
;
|
||||||
; COUNT
|
; COUNT
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
; $Id$
|
; $Id$
|
||||||
;
|
;
|
||||||
; $Log$
|
; $Log$
|
||||||
|
; Revision 1.4 2001/03/21 02:56:25 bartoldeman
|
||||||
|
; See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
;
|
||||||
; 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
|
||||||
;
|
;
|
||||||
@ -78,7 +81,7 @@
|
|||||||
|
|
||||||
%include "segs.inc"
|
%include "segs.inc"
|
||||||
|
|
||||||
segment _TEXT
|
segment HMA_TEXT
|
||||||
; _execrh
|
; _execrh
|
||||||
; Execute Device Request
|
; Execute Device Request
|
||||||
;
|
;
|
||||||
|
113
kernel/fatdir.c
113
kernel/fatdir.c
@ -36,8 +36,8 @@ static BYTE *fatdirRcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
* Revision 1.10 2001/03/19 04:50:56 bartoldeman
|
* Revision 1.11 2001/03/21 02:56:25 bartoldeman
|
||||||
* See history.txt for overview: put kernel 2022beo1 into CVS
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
*
|
*
|
||||||
* Revision 1.10 2001/03/08 21:00:00 bartoldeman
|
* Revision 1.10 2001/03/08 21:00:00 bartoldeman
|
||||||
* Fix handling of very long path names (Tom Ehlert)
|
* Fix handling of very long path names (Tom Ehlert)
|
||||||
@ -271,6 +271,9 @@ struct f_node FAR *dir_open(BYTE FAR * dirname)
|
|||||||
/* Convert the name into an absolute name for */
|
/* Convert the name into an absolute name for */
|
||||||
/* comparison... */
|
/* comparison... */
|
||||||
/* first the file name with trailing spaces... */
|
/* first the file name with trailing spaces... */
|
||||||
|
|
||||||
|
memset(TempBuffer, ' ', FNAME_SIZE+FEXT_SIZE);
|
||||||
|
|
||||||
for (i = 0; i < FNAME_SIZE; i++)
|
for (i = 0; i < FNAME_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (*p != '\0' && *p != '.' && *p != '/' && *p != '\\')
|
if (*p != '\0' && *p != '.' && *p != '/' && *p != '\\')
|
||||||
@ -279,9 +282,6 @@ struct f_node FAR *dir_open(BYTE FAR * dirname)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; i < FNAME_SIZE; i++)
|
|
||||||
TempBuffer[i] = ' ';
|
|
||||||
|
|
||||||
/* and the extension (don't forget to */
|
/* and the extension (don't forget to */
|
||||||
/* add trailing spaces)... */
|
/* add trailing spaces)... */
|
||||||
if (*p == '.')
|
if (*p == '.')
|
||||||
@ -293,8 +293,6 @@ struct f_node FAR *dir_open(BYTE FAR * dirname)
|
|||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for (; i < FEXT_SIZE; i++)
|
|
||||||
TempBuffer[i + FNAME_SIZE] = ' ';
|
|
||||||
|
|
||||||
/* Now search through the directory to */
|
/* Now search through the directory to */
|
||||||
/* find the entry... */
|
/* find the entry... */
|
||||||
@ -586,12 +584,7 @@ COUNT dos_findfirst(UCOUNT attr, BYTE FAR * name)
|
|||||||
BYTE FAR *ptr;
|
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];
|
||||||
Tname[65];
|
|
||||||
|
|
||||||
fsncopy(name, (BYTE FAR *)&Tname, sizeof(Tname));
|
|
||||||
Tname[sizeof(Tname)-1]=0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
printf("ff %s", Tname);
|
printf("ff %s", Tname);
|
||||||
*/
|
*/
|
||||||
@ -610,7 +603,7 @@ COUNT dos_findfirst(UCOUNT attr, BYTE FAR * name)
|
|||||||
dmp->dm_attr_srch = attr | D_RDONLY | D_ARCHIVE;
|
dmp->dm_attr_srch = attr | D_RDONLY | D_ARCHIVE;
|
||||||
|
|
||||||
/* Parse out the drive, file name and file extension. */
|
/* Parse out the drive, file name and file extension. */
|
||||||
i = ParseDosName((BYTE FAR *)&Tname, &nDrive, &LocalPath[2], local_name, local_ext, TRUE);
|
i = ParseDosName((BYTE FAR *)name, &nDrive, &LocalPath[2], local_name, local_ext, TRUE);
|
||||||
if (i != SUCCESS)
|
if (i != SUCCESS)
|
||||||
return i;
|
return i;
|
||||||
/*
|
/*
|
||||||
@ -639,28 +632,16 @@ COUNT dos_findfirst(UCOUNT attr, BYTE FAR * name)
|
|||||||
/* copy the part of the pattern which belongs to the filename and is fixed */
|
/* copy the part of the pattern which belongs to the filename and is fixed */
|
||||||
for (p = local_name, i = 0; i < FNAME_SIZE && *p && *p != '*'; ++p, ++i)
|
for (p = local_name, i = 0; i < FNAME_SIZE && *p && *p != '*'; ++p, ++i)
|
||||||
SearchDir.dir_name[i] = *p;
|
SearchDir.dir_name[i] = *p;
|
||||||
if (*p == '*')
|
|
||||||
{
|
|
||||||
for (; i < FNAME_SIZE; ++i)
|
for (; i < FNAME_SIZE; ++i)
|
||||||
SearchDir.dir_name[i] = '?';
|
SearchDir.dir_name[i] = *p == '*' ? '?' : ' ';
|
||||||
while (*++p) ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
for (; i < FNAME_SIZE; i++)
|
|
||||||
SearchDir.dir_name[i] = ' ';
|
|
||||||
|
|
||||||
/* and the extension (don't forget to add trailing spaces)... */
|
/* and the extension (don't forget to add trailing spaces)... */
|
||||||
for (p = local_ext, i = 0; i < FEXT_SIZE && *p && *p != '*'; ++p, ++i)
|
for (p = local_ext, i = 0; i < FEXT_SIZE && *p && *p != '*'; ++p, ++i)
|
||||||
SearchDir.dir_ext[i] = *p;
|
SearchDir.dir_ext[i] = *p;
|
||||||
if (*p == '*')
|
|
||||||
{
|
|
||||||
for (; i < FEXT_SIZE; ++i)
|
for (; i < FEXT_SIZE; ++i)
|
||||||
SearchDir.dir_ext[i] = '?';
|
SearchDir.dir_ext[i] = *p == '*' ? '?' : ' ';
|
||||||
while (*++p) ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
for (; i < FEXT_SIZE; i++)
|
|
||||||
SearchDir.dir_ext[i] = ' ';
|
|
||||||
|
|
||||||
/* Convert everything to uppercase. */
|
/* Convert everything to uppercase. */
|
||||||
DosUpFMem(SearchDir.dir_name, FNAME_SIZE + FEXT_SIZE);
|
DosUpFMem(SearchDir.dir_name, FNAME_SIZE + FEXT_SIZE);
|
||||||
@ -912,9 +893,6 @@ COUNT dos_findnext(void)
|
|||||||
|
|
||||||
static VOID pop_dmp(dmatch FAR * dmp, struct f_node FAR * fnp)
|
static VOID pop_dmp(dmatch FAR * dmp, struct f_node FAR * fnp)
|
||||||
{
|
{
|
||||||
COUNT idx;
|
|
||||||
BYTE FAR *p;
|
|
||||||
BYTE FAR *q;
|
|
||||||
|
|
||||||
dmp->dm_attr_fnd = fnp->f_dir.dir_attrib;
|
dmp->dm_attr_fnd = fnp->f_dir.dir_attrib;
|
||||||
dmp->dm_time = fnp->f_dir.dir_time;
|
dmp->dm_time = fnp->f_dir.dir_time;
|
||||||
@ -925,38 +903,43 @@ static VOID pop_dmp(dmatch FAR * dmp, struct f_node FAR * fnp)
|
|||||||
dmp->dm_flags.f_ddir = fnp->f_flags.f_ddir;
|
dmp->dm_flags.f_ddir = fnp->f_flags.f_ddir;
|
||||||
dmp->dm_flags.f_dmod = fnp->f_flags.f_dmod;
|
dmp->dm_flags.f_dmod = fnp->f_flags.f_dmod;
|
||||||
dmp->dm_flags.f_dnew = fnp->f_flags.f_dnew;
|
dmp->dm_flags.f_dnew = fnp->f_flags.f_dnew;
|
||||||
p = dmp->dm_name;
|
|
||||||
if (fnp->f_dir.dir_name[0] == '.')
|
ConvertName83ToNameSZ((BYTE FAR *)dmp->dm_name, (BYTE FAR *) fnp->f_dir.dir_name);
|
||||||
{
|
|
||||||
for (idx = 0, q = (BYTE FAR *) fnp->f_dir.dir_name;
|
|
||||||
idx < FNAME_SIZE; idx++)
|
|
||||||
{
|
|
||||||
if (*q == ' ')
|
|
||||||
break;
|
|
||||||
*p++ = *q++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (idx = 0, q = (BYTE FAR *) fnp->f_dir.dir_name;
|
|
||||||
idx < FNAME_SIZE; idx++)
|
|
||||||
{
|
|
||||||
if (*q == ' ')
|
|
||||||
break;
|
|
||||||
*p++ = *q++;
|
|
||||||
}
|
|
||||||
if (fnp->f_dir.dir_ext[0] != ' ')
|
|
||||||
{
|
|
||||||
*p++ = '.';
|
|
||||||
for (idx = 0, q = (BYTE FAR *) fnp->f_dir.dir_ext; idx < FEXT_SIZE; idx++)
|
|
||||||
{
|
|
||||||
if (*q == ' ')
|
|
||||||
break;
|
|
||||||
*p++ = *q++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*p++ = NULL;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
/*
|
||||||
|
this receives a name in 11 char field NAME+EXT and builds
|
||||||
|
a zeroterminated string
|
||||||
|
*/
|
||||||
|
void ConvertName83ToNameSZ(BYTE FAR *destSZ, BYTE FAR *srcFCBName)
|
||||||
|
{
|
||||||
|
int loop;
|
||||||
|
int noExtension = FALSE;
|
||||||
|
|
||||||
|
if (*srcFCBName == '.')
|
||||||
|
{
|
||||||
|
noExtension = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (loop = FNAME_SIZE; --loop >= 0; srcFCBName++)
|
||||||
|
{
|
||||||
|
if (*srcFCBName != ' ')
|
||||||
|
*destSZ++ = *srcFCBName;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!noExtension) /* not for ".", ".." */
|
||||||
|
{
|
||||||
|
if (*srcFCBName != ' ')
|
||||||
|
{
|
||||||
|
*destSZ++ = '.';
|
||||||
|
for (loop = FEXT_SIZE; --loop >= 0; srcFCBName++)
|
||||||
|
{
|
||||||
|
if (*srcFCBName != ' ')
|
||||||
|
*destSZ++ = *srcFCBName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*destSZ = '\0';
|
||||||
|
}
|
||||||
|
@ -36,8 +36,8 @@ BYTE *RcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
* Revision 1.9 2001/03/19 04:50:56 bartoldeman
|
* Revision 1.10 2001/03/21 02:56:25 bartoldeman
|
||||||
* See history.txt for overview: put kernel 2022beo1 into CVS
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
*
|
*
|
||||||
* Revision 1.9 2001/03/08 21:00:00 bartoldeman
|
* Revision 1.9 2001/03/08 21:00:00 bartoldeman
|
||||||
* Disabled select_unit() since it's not used
|
* Disabled select_unit() since it's not used
|
||||||
@ -348,7 +348,7 @@ COUNT FAR init_call_dos_close(COUNT fd)
|
|||||||
/* */
|
/* */
|
||||||
/* split a path into it's component directory and file name */
|
/* split a path into it's component directory and file name */
|
||||||
/* */
|
/* */
|
||||||
static struct f_node FAR *
|
struct f_node FAR *
|
||||||
split_path(BYTE FAR * path, BYTE * dname, BYTE * fname, BYTE * fext)
|
split_path(BYTE FAR * path, BYTE * dname, BYTE * fname, BYTE * fext)
|
||||||
{
|
{
|
||||||
REG struct f_node FAR *fnp;
|
REG struct f_node FAR *fnp;
|
||||||
@ -1506,13 +1506,11 @@ UCOUNT readblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
|
|||||||
UWORD secsize;
|
UWORD secsize;
|
||||||
UCOUNT to_xfer = count;
|
UCOUNT to_xfer = count;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if defined( DEBUG ) && 0
|
||||||
if (bDumpRdWrParms)
|
if (bDumpRdWrParms)
|
||||||
{
|
{
|
||||||
printf("readblock:\n");
|
printf("readblock:fd %02x buffer %04x:%04x count %x\n",
|
||||||
printf(" fd buffer count\n -- ------ -----\n");
|
fd, FP_SEG(buffer), FP_OFF(buffer), count);
|
||||||
printf(" %02d %04x:%04x %d\n",
|
|
||||||
fd, (COUNT) FP_SEG(buffer), (COUNT) FP_OFF(buffer), count);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Translate the fd into an fnode pointer, since all internal */
|
/* Translate the fd into an fnode pointer, since all internal */
|
||||||
@ -1690,9 +1688,7 @@ UCOUNT writeblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (bDumpRdWrParms)
|
if (bDumpRdWrParms)
|
||||||
{
|
{
|
||||||
printf("writeblock:\n");
|
printf("writeblock: fd %02d buffer %04x:%04x count %d\n",
|
||||||
printf(" fd buffer count\n -- ------ -----\n");
|
|
||||||
printf(" %02d %04x:%04x %d\n",
|
|
||||||
fd, (COUNT) FP_SEG(buffer), (COUNT) FP_OFF(buffer), count);
|
fd, (COUNT) FP_SEG(buffer), (COUNT) FP_OFF(buffer), count);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -35,6 +35,9 @@ static BYTE *RcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.7 2001/03/21 02:56:26 bartoldeman
|
||||||
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
*
|
||||||
* Revision 1.6 2000/08/06 05:50:17 jimtabor
|
* Revision 1.6 2000/08/06 05:50:17 jimtabor
|
||||||
* Add new files and update cvs with patches and changes
|
* Add new files and update cvs with patches and changes
|
||||||
*
|
*
|
||||||
@ -722,29 +725,29 @@ void FcbNameInit(fcb FAR * lpFcb, BYTE * pszBuffer, COUNT * pCurDrive)
|
|||||||
{
|
{
|
||||||
BYTE FAR *lpszFcbFname,
|
BYTE FAR *lpszFcbFname,
|
||||||
FAR * lpszFcbFext;
|
FAR * lpszFcbFext;
|
||||||
COUNT nDrvIdx,
|
COUNT loop;
|
||||||
nFnameIdx,
|
|
||||||
nFextIdx;
|
|
||||||
|
|
||||||
/* Build a traditional DOS file name */
|
/* Build a traditional DOS file name */
|
||||||
lpszFcbFname = (BYTE FAR *) lpFcb->fcb_fname;
|
|
||||||
if (lpFcb->fcb_drive != 0)
|
if (lpFcb->fcb_drive != 0)
|
||||||
{
|
{
|
||||||
*pCurDrive = lpFcb->fcb_drive;
|
*pCurDrive = lpFcb->fcb_drive;
|
||||||
pszBuffer[0] = 'A' + lpFcb->fcb_drive - 1;
|
pszBuffer[0] = 'A' + lpFcb->fcb_drive - 1;
|
||||||
pszBuffer[1] = ':';
|
pszBuffer[1] = ':';
|
||||||
nDrvIdx = 2;
|
pszBuffer += 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*pCurDrive = default_drive + 1;
|
*pCurDrive = default_drive + 1;
|
||||||
nDrvIdx = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (nFnameIdx = 0; nFnameIdx < FNAME_SIZE; nFnameIdx++)
|
ConvertName83ToNameSZ((BYTE FAR *)pszBuffer, (BYTE FAR *) lpFcb->fcb_fname);
|
||||||
|
|
||||||
|
/*
|
||||||
|
lpszFcbFname = (BYTE FAR *) lpFcb->fcb_fname;
|
||||||
|
for (loop = FNAME_SIZE; --loop >= 0; )
|
||||||
{
|
{
|
||||||
if (*lpszFcbFname != ' ')
|
if (*lpszFcbFname != ' ')
|
||||||
pszBuffer[nDrvIdx + nFnameIdx] = *lpszFcbFname++;
|
*pszBuffer++ = *lpszFcbFname++;
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -752,19 +755,17 @@ void FcbNameInit(fcb FAR * lpFcb, BYTE * pszBuffer, COUNT * pCurDrive)
|
|||||||
lpszFcbFext = (BYTE FAR *) lpFcb->fcb_fext;
|
lpszFcbFext = (BYTE FAR *) lpFcb->fcb_fext;
|
||||||
if (*lpszFcbFext != ' ')
|
if (*lpszFcbFext != ' ')
|
||||||
{
|
{
|
||||||
pszBuffer[nDrvIdx + nFnameIdx++] = '.';
|
*pszBuffer++ = '.';
|
||||||
for (nFextIdx = 0; nFextIdx < FEXT_SIZE; nFextIdx++)
|
for (loop = FEXT_SIZE; --loop >= 0; )
|
||||||
{
|
{
|
||||||
if (*lpszFcbFext != ' ')
|
if (*lpszFcbFext != ' ')
|
||||||
pszBuffer[nDrvIdx + nFnameIdx + nFextIdx] =
|
*pszBuffer++ = *lpszFcbFext++;
|
||||||
*lpszFcbFext++;
|
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
*pszBuffer = '\0';
|
||||||
nFextIdx = 0;
|
*/
|
||||||
pszBuffer[nDrvIdx + nFnameIdx + nFextIdx] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL FcbOpen(xfcb FAR * lpXfcb)
|
BOOL FcbOpen(xfcb FAR * lpXfcb)
|
||||||
|
@ -36,6 +36,9 @@ static BYTE *Globals_hRcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.7 2001/03/21 02:56:26 bartoldeman
|
||||||
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
*
|
||||||
* Revision 1.6 2000/12/16 01:38:35 jimtabor
|
* Revision 1.6 2000/12/16 01:38:35 jimtabor
|
||||||
* Added patches from Bart Oldeman
|
* Added patches from Bart Oldeman
|
||||||
*
|
*
|
||||||
@ -214,7 +217,7 @@ 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 8 /* number of supported devices */
|
#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 */
|
||||||
@ -295,16 +298,18 @@ struct buffer
|
|||||||
FAR *b_next; /* form linked list for LRU */
|
FAR *b_next; /* form linked list for LRU */
|
||||||
BYTE b_unit; /* disk for this buffer */
|
BYTE b_unit; /* disk for this buffer */
|
||||||
BYTE b_flag; /* buffer flags */
|
BYTE b_flag; /* buffer flags */
|
||||||
UWORD b_blkno; /* block for this buffer */
|
ULONG b_blkno; /* block for this buffer */
|
||||||
/* DOS-C: 0xffff for huge block numbers */
|
/* DOS-C: 0xffff for huge block numbers */
|
||||||
BYTE b_copies; /* number of copies to write */
|
BYTE b_copies; /* number of copies to write */
|
||||||
UBYTE b_offset_lo; /* span between copies (low) */
|
UBYTE b_offset_lo; /* span between copies (low) */
|
||||||
|
#if 0 /*TE*/
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct dpb FAR *_b_dpbp; /* pointer to DPB */
|
struct dpb FAR *_b_dpbp; /* pointer to DPB */
|
||||||
LONG _b_huge_blkno; /* DOS-C: actual block number if >= 0xffff */
|
LONG _b_huge_blkno; /* DOS-C: actual block number if >= 0xffff */
|
||||||
}
|
}
|
||||||
_b;
|
_b;
|
||||||
|
#endif
|
||||||
UBYTE b_offset_hi; /* DOS-C: span between copies (high) */
|
UBYTE b_offset_hi; /* DOS-C: span between copies (high) */
|
||||||
UBYTE b_unused;
|
UBYTE b_unused;
|
||||||
BYTE b_buffer[BUFFERSIZE]; /* 512 byte sectors for now */
|
BYTE b_buffer[BUFFERSIZE]; /* 512 byte sectors for now */
|
||||||
@ -351,7 +356,14 @@ extern COUNT *
|
|||||||
disk_api_tos, /* API handler stack - disk fns */
|
disk_api_tos, /* API handler stack - disk fns */
|
||||||
char_api_tos; /* API handler stack - char fns */
|
char_api_tos; /* API handler stack - char fns */
|
||||||
extern BYTE
|
extern BYTE
|
||||||
FAR last; /* first available byte of ram */
|
FAR _InitTextStart; /* first available byte of ram */
|
||||||
|
extern BYTE
|
||||||
|
FAR _HMATextAvailable, /* first byte of available CODE area */
|
||||||
|
FAR _HMATextStart[], /* first byte of HMAable CODE area */
|
||||||
|
FAR _HMATextEnd[]; /* and the last byte of it */
|
||||||
|
extern
|
||||||
|
BYTE DosLoadedInHMA; /* if InitHMA has moved DOS up */
|
||||||
|
|
||||||
extern struct ClockRecord
|
extern struct ClockRecord
|
||||||
ClkRecord;
|
ClkRecord;
|
||||||
|
|
||||||
@ -593,8 +605,8 @@ GLOBAL struct f_node FAR
|
|||||||
* f_nodes; /* pointer to the array */
|
* f_nodes; /* pointer to the array */
|
||||||
|
|
||||||
GLOBAL struct buffer
|
GLOBAL struct buffer
|
||||||
FAR *lastbuf, /* tail of ditto */
|
FAR *lastbuf; /* tail of ditto */
|
||||||
FAR * buffers; /* pointer to array of track buffers */
|
/* FAR * buffers; /* pointer to array of track buffers */
|
||||||
|
|
||||||
GLOBAL BYTE /* scratchpad used for working around */
|
GLOBAL BYTE /* scratchpad used for working around */
|
||||||
FAR * dma_scratch; /* DMA transfers during disk I/O */
|
FAR * dma_scratch; /* DMA transfers during disk I/O */
|
||||||
@ -675,6 +687,7 @@ VOID FAR restore_stack(VOID);
|
|||||||
WORD execrh(request FAR *, struct dhdr FAR *);
|
WORD execrh(request FAR *, struct dhdr FAR *);
|
||||||
#endif
|
#endif
|
||||||
VOID FAR init_call_execrh(request FAR *, struct dhdr FAR *);
|
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);
|
||||||
@ -746,11 +759,12 @@ VOID fputbyte();
|
|||||||
#ifdef I86
|
#ifdef I86
|
||||||
#define setvec(n, isr) (void)(*(VOID (INRPT FAR * FAR *)())(4 * (n)) = (isr))
|
#define setvec(n, isr) (void)(*(VOID (INRPT FAR * FAR *)())(4 * (n)) = (isr))
|
||||||
#endif
|
#endif
|
||||||
#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 spawn_int23(void); /* procsupt.asm */
|
void FAR _init_call_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 */
|
||||||
|
|
||||||
|
|
||||||
|
GLOBAL BYTE ReturnAnyDosVersionExpected;
|
||||||
|
@ -10,19 +10,22 @@
|
|||||||
* calls for the latter functions therefore need to be wrapped up with far
|
* calls for the latter functions therefore need to be wrapped up with far
|
||||||
* entry points.
|
* entry points.
|
||||||
*/
|
*/
|
||||||
#define DosExec init_call_DosExec
|
#define DosExec reloc_call_DosExec
|
||||||
#define DosMemAlloc init_call_DosMemAlloc
|
#define DosMemAlloc reloc_call_DosMemAlloc
|
||||||
#define dos_close init_call_dos_close
|
#define dos_close reloc_call_dos_close
|
||||||
#define dos_getdate init_call_dos_getdate
|
#define dos_getdate reloc_call_dos_getdate
|
||||||
#define dos_gettime init_call_dos_gettime
|
#define dos_gettime reloc_call_dos_gettime
|
||||||
#define dos_open init_call_dos_open
|
#define dos_open reloc_call_dos_open
|
||||||
#define dos_read init_call_dos_read
|
#define dos_read reloc_call_dos_read
|
||||||
#define execrh init_call_execrh
|
#define execrh reloc_call_execrh
|
||||||
#define fatal init_call_fatal
|
#define fatal reloc_call_fatal
|
||||||
#define fbcopy init_call_fbcopy
|
#define fmemcpy reloc_call_fmemcpy
|
||||||
#define printf init_call_printf
|
#define memcpy reloc_call_memcpy
|
||||||
#define scopy init_call_scopy
|
#define fmemset reloc_call_fmemset
|
||||||
#define sti init_call_sti
|
#define printf reloc_call_printf
|
||||||
#define strcmp init_call_strcmp
|
#define strcpy reloc_call_strcpy
|
||||||
#define strlen init_call_strlen
|
#define sti reloc_call_sti
|
||||||
#define WritePCClock init_call_WritePCClock
|
#define strcmp reloc_call_strcmp
|
||||||
|
#define strlen reloc_call_strlen
|
||||||
|
#define WritePCClock reloc_call_WritePCClock
|
||||||
|
#define DaysFromYearMonthDay reloc_call_DaysFromYearMonthDay
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
; $Id$
|
; $Id$
|
||||||
;
|
;
|
||||||
; $Log$
|
; $Log$
|
||||||
|
; Revision 1.7 2001/03/21 02:56:26 bartoldeman
|
||||||
|
; See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
;
|
||||||
; Revision 1.6 2000/08/06 05:50:17 jimtabor
|
; Revision 1.6 2000/08/06 05:50:17 jimtabor
|
||||||
; Add new files and update cvs with patches and changes
|
; Add new files and update cvs with patches and changes
|
||||||
;
|
;
|
||||||
@ -88,14 +91,14 @@
|
|||||||
%include "segs.inc"
|
%include "segs.inc"
|
||||||
%include "stacks.inc"
|
%include "stacks.inc"
|
||||||
|
|
||||||
segment _TEXT
|
segment HMA_TEXT
|
||||||
extern _nul_dev:wrt DGROUP
|
extern _nul_dev:wrt DGROUP
|
||||||
extern _umb_start:wrt DGROUP
|
extern _umb_start:wrt DGROUP
|
||||||
extern _UMB_top:wrt DGROUP
|
extern _UMB_top:wrt DGROUP
|
||||||
extern _syscall_MUX14:wrt _TEXT
|
extern _syscall_MUX14:wrt HMA_TEXT
|
||||||
|
|
||||||
global _int2f_handler
|
global reloc_call_int2f_handler
|
||||||
_int2f_handler:
|
reloc_call_int2f_handler:
|
||||||
sti ; Enable interrupts
|
sti ; Enable interrupts
|
||||||
cmp ah,11h ; Network interrupt?
|
cmp ah,11h ; Network interrupt?
|
||||||
jne Int2f3 ; No, continue
|
jne Int2f3 ; No, continue
|
||||||
@ -336,6 +339,8 @@ int2f_call:
|
|||||||
; B2h UMB segment number is invalid
|
; B2h UMB segment number is invalid
|
||||||
;
|
;
|
||||||
;
|
;
|
||||||
|
|
||||||
|
segment INIT_TEXT
|
||||||
global _Umb_Test
|
global _Umb_Test
|
||||||
_Umb_Test
|
_Umb_Test
|
||||||
push bp
|
push bp
|
||||||
@ -345,8 +350,8 @@ _Umb_Test
|
|||||||
push dx
|
push dx
|
||||||
push bx
|
push bx
|
||||||
|
|
||||||
mov ax,DGROUP
|
mov ax, DGROUP
|
||||||
mov ds,ax
|
mov ds, ax
|
||||||
|
|
||||||
mov ax,4300h ; is there a xms driver installed?
|
mov ax,4300h ; is there a xms driver installed?
|
||||||
int 2fh
|
int 2fh
|
||||||
@ -404,4 +409,4 @@ umbt_error: dec ax
|
|||||||
pop ds
|
pop ds
|
||||||
pop es
|
pop es
|
||||||
pop bp
|
pop bp
|
||||||
retf ; this was called FAR.
|
ret ; this was called NEAR!!
|
||||||
|
@ -36,8 +36,8 @@ BYTE *RcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
* Revision 1.13 2001/03/19 04:50:56 bartoldeman
|
* Revision 1.14 2001/03/21 02:56:26 bartoldeman
|
||||||
* See history.txt for overview: put kernel 2022beo1 into CVS
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
*
|
*
|
||||||
* Revision 1.13 2001/03/08 21:00:00 bartoldeman
|
* Revision 1.13 2001/03/08 21:00:00 bartoldeman
|
||||||
* MCB chain corruption and DosFindNext fix (thanks Martin Stromberg and Tom Ehlert)
|
* MCB chain corruption and DosFindNext fix (thanks Martin Stromberg and Tom Ehlert)
|
||||||
@ -309,15 +309,37 @@ VOID int21_syscall(iregs FAR * irp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int debug_cnt;
|
||||||
|
|
||||||
VOID int21_service(iregs FAR * r)
|
VOID int21_service(iregs FAR * r)
|
||||||
{
|
{
|
||||||
COUNT rc = 0,
|
COUNT rc = 0,
|
||||||
rc1;
|
rc1;
|
||||||
ULONG lrc;
|
ULONG lrc;
|
||||||
psp FAR *p = MK_FP(cu_psp, 0);
|
psp FAR *p = MK_FP(cu_psp, 0);
|
||||||
|
void FAR *FP_DS_DX = MK_FP(r->DS, r->DX); /* this is saved so often,
|
||||||
|
that this saves ~100 bytes */
|
||||||
|
|
||||||
|
|
||||||
|
#define CLEAR_CARRY_FLAG() r->FLAGS &= ~FLG_CARRY
|
||||||
|
#define SET_CARRY_FLAG() r->FLAGS |= FLG_CARRY
|
||||||
|
|
||||||
p->ps_stack = (BYTE FAR *) r;
|
p->ps_stack = (BYTE FAR *) r;
|
||||||
|
|
||||||
|
|
||||||
|
switch(r->AH)
|
||||||
|
{
|
||||||
|
case 0x2a: /*DosGetDate */
|
||||||
|
case 0x2b: /*DosSetDate */
|
||||||
|
case 0x2c: /*DosGetTime */
|
||||||
|
case 0x2d: /*DosSetDate */
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
debug_cnt++; /* debuggable statement */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (bDumpRegs)
|
if (bDumpRegs)
|
||||||
{
|
{
|
||||||
@ -422,21 +444,20 @@ dispatch:
|
|||||||
case 0x09:
|
case 0x09:
|
||||||
{
|
{
|
||||||
static COUNT scratch;
|
static COUNT scratch;
|
||||||
BYTE FAR *p = MK_FP(r->DS, r->DX),
|
BYTE FAR * q;
|
||||||
FAR * q;
|
q = FP_DS_DX;
|
||||||
q = p;
|
|
||||||
while (*q != '$')
|
while (*q != '$')
|
||||||
++q;
|
++q;
|
||||||
DosWrite(STDOUT, q - p, p, (COUNT FAR *) & scratch);
|
DosWrite(STDOUT, q - (BYTE FAR*)FP_DS_DX, FP_DS_DX, (COUNT FAR *) & scratch);
|
||||||
}
|
}
|
||||||
r->AL = '$';
|
r->AL = '$';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Buffered Keyboard Input */
|
/* Buffered Keyboard Input */
|
||||||
case 0x0a:
|
case 0x0a:
|
||||||
((keyboard FAR *) MK_FP(r->DS, r->DX))->kb_count = 0;
|
((keyboard FAR *) FP_DS_DX)->kb_count = 0;
|
||||||
sti((keyboard FAR *) MK_FP(r->DS, r->DX));
|
sti((keyboard FAR *) FP_DS_DX);
|
||||||
((keyboard FAR *) MK_FP(r->DS, r->DX))->kb_count -= 2;
|
((keyboard FAR *) FP_DS_DX)->kb_count -= 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Check Stdin Status */
|
/* Check Stdin Status */
|
||||||
@ -477,35 +498,35 @@ dispatch:
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0f:
|
case 0x0f:
|
||||||
if (FcbOpen(MK_FP(r->DS, r->DX)))
|
if (FcbOpen(FP_DS_DX))
|
||||||
r->AL = 0;
|
r->AL = 0;
|
||||||
else
|
else
|
||||||
r->AL = 0xff;
|
r->AL = 0xff;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x10:
|
case 0x10:
|
||||||
if (FcbClose(MK_FP(r->DS, r->DX)))
|
if (FcbClose(FP_DS_DX))
|
||||||
r->AL = 0;
|
r->AL = 0;
|
||||||
else
|
else
|
||||||
r->AL = 0xff;
|
r->AL = 0xff;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x11:
|
case 0x11:
|
||||||
if (FcbFindFirst(MK_FP(r->DS, r->DX)))
|
if (FcbFindFirst(FP_DS_DX))
|
||||||
r->AL = 0;
|
r->AL = 0;
|
||||||
else
|
else
|
||||||
r->AL = 0xff;
|
r->AL = 0xff;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x12:
|
case 0x12:
|
||||||
if (FcbFindNext(MK_FP(r->DS, r->DX)))
|
if (FcbFindNext(FP_DS_DX))
|
||||||
r->AL = 0;
|
r->AL = 0;
|
||||||
else
|
else
|
||||||
r->AL = 0xff;
|
r->AL = 0xff;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x13:
|
case 0x13:
|
||||||
if (FcbDelete(MK_FP(r->DS, r->DX)))
|
if (FcbDelete(FP_DS_DX))
|
||||||
r->AL = 0;
|
r->AL = 0;
|
||||||
else
|
else
|
||||||
r->AL = 0xff;
|
r->AL = 0xff;
|
||||||
@ -513,7 +534,7 @@ dispatch:
|
|||||||
|
|
||||||
case 0x14:
|
case 0x14:
|
||||||
{
|
{
|
||||||
if (FcbRead(MK_FP(r->DS, r->DX), &CritErrCode))
|
if (FcbRead(FP_DS_DX, &CritErrCode))
|
||||||
r->AL = 0;
|
r->AL = 0;
|
||||||
else
|
else
|
||||||
r->AL = CritErrCode;
|
r->AL = CritErrCode;
|
||||||
@ -522,7 +543,7 @@ dispatch:
|
|||||||
|
|
||||||
case 0x15:
|
case 0x15:
|
||||||
{
|
{
|
||||||
if (FcbWrite(MK_FP(r->DS, r->DX), &CritErrCode))
|
if (FcbWrite(FP_DS_DX, &CritErrCode))
|
||||||
r->AL = 0;
|
r->AL = 0;
|
||||||
else
|
else
|
||||||
r->AL = CritErrCode;
|
r->AL = CritErrCode;
|
||||||
@ -530,14 +551,14 @@ dispatch:
|
|||||||
}
|
}
|
||||||
|
|
||||||
case 0x16:
|
case 0x16:
|
||||||
if (FcbCreate(MK_FP(r->DS, r->DX)))
|
if (FcbCreate(FP_DS_DX))
|
||||||
r->AL = 0;
|
r->AL = 0;
|
||||||
else
|
else
|
||||||
r->AL = 0xff;
|
r->AL = 0xff;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x17:
|
case 0x17:
|
||||||
if (FcbRename(MK_FP(r->DS, r->DX)))
|
if (FcbRename(FP_DS_DX))
|
||||||
r->AL = 0;
|
r->AL = 0;
|
||||||
else
|
else
|
||||||
r->AL = 0xff;
|
r->AL = 0xff;
|
||||||
@ -565,7 +586,7 @@ dispatch:
|
|||||||
{
|
{
|
||||||
psp FAR *p = MK_FP(cu_psp, 0);
|
psp FAR *p = MK_FP(cu_psp, 0);
|
||||||
|
|
||||||
p->ps_dta = MK_FP(r->DS, r->DX);
|
p->ps_dta = FP_DS_DX;
|
||||||
dos_setdta(p->ps_dta);
|
dos_setdta(p->ps_dta);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -625,7 +646,7 @@ dispatch:
|
|||||||
/* Random read using FCB */
|
/* Random read using FCB */
|
||||||
case 0x21:
|
case 0x21:
|
||||||
{
|
{
|
||||||
if (FcbRandomRead(MK_FP(r->DS, r->DX), &CritErrCode))
|
if (FcbRandomRead(FP_DS_DX, &CritErrCode))
|
||||||
r->AL = 0;
|
r->AL = 0;
|
||||||
else
|
else
|
||||||
r->AL = CritErrCode;
|
r->AL = CritErrCode;
|
||||||
@ -635,7 +656,7 @@ dispatch:
|
|||||||
/* Random write using FCB */
|
/* Random write using FCB */
|
||||||
case 0x22:
|
case 0x22:
|
||||||
{
|
{
|
||||||
if (FcbRandomWrite(MK_FP(r->DS, r->DX), &CritErrCode))
|
if (FcbRandomWrite(FP_DS_DX, &CritErrCode))
|
||||||
r->AL = 0;
|
r->AL = 0;
|
||||||
else
|
else
|
||||||
r->AL = CritErrCode;
|
r->AL = CritErrCode;
|
||||||
@ -644,7 +665,7 @@ dispatch:
|
|||||||
|
|
||||||
/* Get file size in records using FCB */
|
/* Get file size in records using FCB */
|
||||||
case 0x23:
|
case 0x23:
|
||||||
if (FcbGetFileSize(MK_FP(r->DS, r->DX)))
|
if (FcbGetFileSize(FP_DS_DX))
|
||||||
r->AL = 0;
|
r->AL = 0;
|
||||||
else
|
else
|
||||||
r->AL = 0xff;
|
r->AL = 0xff;
|
||||||
@ -652,13 +673,13 @@ dispatch:
|
|||||||
|
|
||||||
/* Set random record field in FCB */
|
/* Set random record field in FCB */
|
||||||
case 0x24:
|
case 0x24:
|
||||||
FcbSetRandom(MK_FP(r->DS, r->DX));
|
FcbSetRandom(FP_DS_DX);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Set Interrupt Vector */
|
/* Set Interrupt Vector */
|
||||||
case 0x25:
|
case 0x25:
|
||||||
{
|
{
|
||||||
VOID(INRPT FAR * p) () = MK_FP(r->DS, r->DX);
|
VOID(INRPT FAR * p) () = FP_DS_DX;
|
||||||
|
|
||||||
setvec(r->AL, p);
|
setvec(r->AL, p);
|
||||||
}
|
}
|
||||||
@ -676,7 +697,7 @@ dispatch:
|
|||||||
/* Read random record(s) using FCB */
|
/* Read random record(s) using FCB */
|
||||||
case 0x27:
|
case 0x27:
|
||||||
{
|
{
|
||||||
if (FcbRandomBlockRead(MK_FP(r->DS, r->DX), r->CX, &CritErrCode))
|
if (FcbRandomBlockRead(FP_DS_DX, r->CX, &CritErrCode))
|
||||||
r->AL = 0;
|
r->AL = 0;
|
||||||
else
|
else
|
||||||
r->AL = CritErrCode;
|
r->AL = CritErrCode;
|
||||||
@ -686,7 +707,7 @@ dispatch:
|
|||||||
/* Write random record(s) using FCB */
|
/* Write random record(s) using FCB */
|
||||||
case 0x28:
|
case 0x28:
|
||||||
{
|
{
|
||||||
if (FcbRandomBlockWrite(MK_FP(r->DS, r->DX), r->CX, &CritErrCode))
|
if (FcbRandomBlockWrite(FP_DS_DX, r->CX, &CritErrCode))
|
||||||
r->AL = 0;
|
r->AL = 0;
|
||||||
else
|
else
|
||||||
r->AL = CritErrCode;
|
r->AL = CritErrCode;
|
||||||
@ -769,6 +790,34 @@ dispatch:
|
|||||||
r->CH = REVISION_MAJOR; /* JPP */
|
r->CH = REVISION_MAJOR; /* JPP */
|
||||||
r->CL = REVISION_MINOR;
|
r->CL = REVISION_MINOR;
|
||||||
r->BL = REVISION_SEQ;
|
r->BL = REVISION_SEQ;
|
||||||
|
|
||||||
|
if (ReturnAnyDosVersionExpected)
|
||||||
|
{
|
||||||
|
/* TE for testing purpose only and NOT
|
||||||
|
to be documented:
|
||||||
|
return programs, who ask for version == XX.YY
|
||||||
|
exactly this XX.YY.
|
||||||
|
this makes most MS programs more happy.
|
||||||
|
*/
|
||||||
|
UBYTE FAR *retp = MK_FP(r->cs, r->ip);
|
||||||
|
|
||||||
|
if ( retp[0] == 0x3d && /* cmp ax, xxyy */
|
||||||
|
(retp[3] == 0x75 || retp[3] == 0x74)) /* je/jne error */
|
||||||
|
{
|
||||||
|
r->AL = retp[1];
|
||||||
|
r->AH = retp[2];
|
||||||
|
}
|
||||||
|
else if(retp[0] == 0x86 && /* xchg al,ah */
|
||||||
|
retp[1] == 0xc4 &&
|
||||||
|
retp[2] == 0x3d && /* cmp ax, xxyy */
|
||||||
|
(retp[5] == 0x75 || retp[5] == 0x74)) /* je/jne error */
|
||||||
|
{
|
||||||
|
r->AL = retp[4];
|
||||||
|
r->AH = retp[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Keep Program (Terminate and stay resident) */
|
/* Keep Program (Terminate and stay resident) */
|
||||||
@ -872,65 +921,65 @@ dispatch:
|
|||||||
goto error_invalid;
|
goto error_invalid;
|
||||||
} else {
|
} else {
|
||||||
/* Get Country Information */
|
/* Get Country Information */
|
||||||
if((rc = DosGetCountryInformation(cntry, MK_FP(r->DS, r->DX))) < 0)
|
if((rc = DosGetCountryInformation(cntry, FP_DS_DX)) < 0)
|
||||||
goto error_invalid;
|
goto error_invalid;
|
||||||
r->AX = r->BX = cntry;
|
r->AX = r->BX = cntry;
|
||||||
}
|
}
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Dos Create Directory */
|
/* Dos Create Directory */
|
||||||
case 0x39:
|
case 0x39:
|
||||||
rc = DosMkdir((BYTE FAR *) MK_FP(r->DS, r->DX));
|
rc = DosMkdir((BYTE FAR *) FP_DS_DX);
|
||||||
if (rc != SUCCESS)
|
if (rc != SUCCESS)
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Dos Remove Directory */
|
/* Dos Remove Directory */
|
||||||
case 0x3a:
|
case 0x3a:
|
||||||
rc = DosRmdir((BYTE FAR *) MK_FP(r->DS, r->DX));
|
rc = DosRmdir((BYTE FAR *) FP_DS_DX);
|
||||||
if (rc != SUCCESS)
|
if (rc != SUCCESS)
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Dos Change Directory */
|
/* Dos Change Directory */
|
||||||
case 0x3b:
|
case 0x3b:
|
||||||
if ((rc = DosChangeDir((BYTE FAR *) MK_FP(r->DS, r->DX))) < 0)
|
if ((rc = DosChangeDir((BYTE FAR *) FP_DS_DX)) < 0)
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Dos Create File */
|
/* Dos Create File */
|
||||||
case 0x3c:
|
case 0x3c:
|
||||||
if ((rc = DosCreat(MK_FP(r->DS, r->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;
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Dos Open */
|
/* Dos Open */
|
||||||
case 0x3d:
|
case 0x3d:
|
||||||
if ((rc = DosOpen(MK_FP(r->DS, r->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;
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -939,12 +988,12 @@ dispatch:
|
|||||||
if ((rc = DosClose(r->BX)) < 0)
|
if ((rc = DosClose(r->BX)) < 0)
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
else
|
else
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Dos Read */
|
/* Dos Read */
|
||||||
case 0x3f:
|
case 0x3f:
|
||||||
rc = DosRead(r->BX, r->CX, MK_FP(r->DS, r->DX), (COUNT FAR *) & rc1);
|
rc = DosRead(r->BX, r->CX, FP_DS_DX, (COUNT FAR *) & rc1);
|
||||||
|
|
||||||
if (rc1 != SUCCESS)
|
if (rc1 != SUCCESS)
|
||||||
{
|
{
|
||||||
@ -953,14 +1002,14 @@ dispatch:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
r->AX = rc;
|
r->AX = rc;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Dos Write */
|
/* Dos Write */
|
||||||
case 0x40:
|
case 0x40:
|
||||||
rc = DosWrite(r->BX, r->CX, MK_FP(r->DS, r->DX), (COUNT FAR *) & rc1);
|
rc = DosWrite(r->BX, r->CX, FP_DS_DX, (COUNT FAR *) & rc1);
|
||||||
if (rc1 != SUCCESS)
|
if (rc1 != SUCCESS)
|
||||||
{
|
{
|
||||||
r->AX = -rc1;
|
r->AX = -rc1;
|
||||||
@ -968,21 +1017,21 @@ dispatch:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
r->AX = rc;
|
r->AX = rc;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Dos Delete File */
|
/* Dos Delete File */
|
||||||
case 0x41:
|
case 0x41:
|
||||||
rc = DosDelete((BYTE FAR *) MK_FP(r->DS, r->DX));
|
rc = DosDelete((BYTE FAR *) FP_DS_DX);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
{
|
{
|
||||||
r->AX = -rc;
|
r->AX = -rc;
|
||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Dos Seek */
|
/* Dos Seek */
|
||||||
@ -992,8 +1041,8 @@ dispatch:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
r->DX = (lrc >> 16);
|
r->DX = (lrc >> 16);
|
||||||
r->AX = lrc & 0xffff;
|
r->AX = (UWORD)lrc;
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1002,21 +1051,21 @@ dispatch:
|
|||||||
switch (r->AL)
|
switch (r->AL)
|
||||||
{
|
{
|
||||||
case 0x00:
|
case 0x00:
|
||||||
rc = DosGetFattr((BYTE FAR *) MK_FP(r->DS, r->DX), (UWORD FAR *) & r->CX);
|
rc = DosGetFattr((BYTE FAR *) FP_DS_DX, (UWORD FAR *) & r->CX);
|
||||||
if (rc != SUCCESS)
|
if (rc != SUCCESS)
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x01:
|
case 0x01:
|
||||||
rc = DosSetFattr((BYTE FAR *) MK_FP(r->DS, r->DX), (UWORD FAR *) & r->CX);
|
rc = DosSetFattr((BYTE FAR *) FP_DS_DX, (UWORD FAR *) & r->CX);
|
||||||
if (rc != SUCCESS)
|
if (rc != SUCCESS)
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
else
|
else
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1035,7 +1084,7 @@ dispatch:
|
|||||||
goto error_out;
|
goto error_out;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1047,7 +1096,7 @@ dispatch:
|
|||||||
goto error_exit;
|
goto error_exit;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
r->AX = rc;
|
r->AX = rc;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1058,7 +1107,7 @@ dispatch:
|
|||||||
if (rc < SUCCESS)
|
if (rc < SUCCESS)
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
else
|
else
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Get Current Directory */
|
/* Get Current Directory */
|
||||||
@ -1067,7 +1116,7 @@ dispatch:
|
|||||||
goto error_exit;
|
goto error_exit;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
r->AX = 0x0100; /*jpp: from interrupt list */
|
r->AX = 0x0100; /*jpp: from interrupt list */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1082,7 +1131,7 @@ dispatch:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
++(r->AX); /* DosMemAlloc() returns seg of MCB rather than data */
|
++(r->AX); /* DosMemAlloc() returns seg of MCB rather than data */
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1091,7 +1140,7 @@ dispatch:
|
|||||||
if ((rc = DosMemFree((r->ES) - 1)) < 0)
|
if ((rc = DosMemFree((r->ES) - 1)) < 0)
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
else
|
else
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Set memory block size */
|
/* Set memory block size */
|
||||||
@ -1117,7 +1166,7 @@ dispatch:
|
|||||||
goto error_exit;
|
goto error_exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1126,11 +1175,11 @@ dispatch:
|
|||||||
case 0x4b:
|
case 0x4b:
|
||||||
break_flg = FALSE;
|
break_flg = FALSE;
|
||||||
|
|
||||||
if ((rc = DosExec(r->AL, MK_FP(r->ES, r->BX), MK_FP(r->DS, r->DX)))
|
if ((rc = DosExec(r->AL, MK_FP(r->ES, r->BX), FP_DS_DX))
|
||||||
!= SUCCESS)
|
!= SUCCESS)
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
else
|
else
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Terminate Program */
|
/* Terminate Program */
|
||||||
@ -1179,12 +1228,12 @@ dispatch:
|
|||||||
{
|
{
|
||||||
/* 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 *) MK_FP(r->DS, r->DX))) < 0)
|
if ((rc = DosFindFirst((UCOUNT) r->CX, (BYTE FAR *) FP_DS_DX)) < 0)
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r->AX = 0;
|
r->AX = 0;
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1204,7 +1253,7 @@ dispatch:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
r->AX = -SUCCESS;
|
r->AX = -SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1235,12 +1284,12 @@ dispatch:
|
|||||||
|
|
||||||
/* Dos Rename */
|
/* Dos Rename */
|
||||||
case 0x56:
|
case 0x56:
|
||||||
rc = DosRename((BYTE FAR *) MK_FP(r->DS, r->DX), (BYTE FAR *) MK_FP(r->ES, r->DI));
|
rc = DosRename((BYTE FAR *) FP_DS_DX, (BYTE FAR *) MK_FP(r->ES, r->DI));
|
||||||
if (rc < SUCCESS)
|
if (rc < SUCCESS)
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1256,7 +1305,7 @@ dispatch:
|
|||||||
if (rc < SUCCESS)
|
if (rc < SUCCESS)
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
else
|
else
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x01:
|
case 0x01:
|
||||||
@ -1267,7 +1316,7 @@ dispatch:
|
|||||||
if (rc < SUCCESS)
|
if (rc < SUCCESS)
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
else
|
else
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1304,7 +1353,7 @@ dispatch:
|
|||||||
goto error_invalid;
|
goto error_invalid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x02:
|
case 0x02:
|
||||||
@ -1335,23 +1384,23 @@ dispatch:
|
|||||||
r->CH = CritErrLocus;
|
r->CH = CritErrLocus;
|
||||||
r->BH = CritErrClass;
|
r->BH = CritErrClass;
|
||||||
r->BL = CritErrAction;
|
r->BL = CritErrAction;
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Create Temporary File */
|
/* Create Temporary File */
|
||||||
case 0x5a:
|
case 0x5a:
|
||||||
if ((rc = DosMkTmp(MK_FP(r->DS, r->DX), r->CX)) < 0)
|
if ((rc = DosMkTmp(FP_DS_DX, r->CX)) < 0)
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r->AX = rc;
|
r->AX = rc;
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Create New File */
|
/* Create New File */
|
||||||
case 0x5b:
|
case 0x5b:
|
||||||
if ((rc = DosOpen(MK_FP(r->DS, r->DX), 0)) >= 0)
|
if ((rc = DosOpen(FP_DS_DX, 0)) >= 0)
|
||||||
{
|
{
|
||||||
DosClose(rc);
|
DosClose(rc);
|
||||||
r->AX = 80;
|
r->AX = 80;
|
||||||
@ -1359,12 +1408,12 @@ dispatch:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((rc = DosCreat(MK_FP(r->DS, r->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;
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1379,7 +1428,7 @@ dispatch:
|
|||||||
((r->AX & 0xff) != 0))) != 0)
|
((r->AX & 0xff) != 0))) != 0)
|
||||||
r->FLAGS |= FLG_CARRY;
|
r->FLAGS |= FLG_CARRY;
|
||||||
else
|
else
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
r->AX = -rc;
|
r->AX = -rc;
|
||||||
break;
|
break;
|
||||||
/* /// End of additions for SHARE. - Ron Cemer */
|
/* /// End of additions for SHARE. - Ron Cemer */
|
||||||
@ -1391,7 +1440,7 @@ dispatch:
|
|||||||
/* Remote Server Call */
|
/* Remote Server Call */
|
||||||
case 0x00:
|
case 0x00:
|
||||||
{
|
{
|
||||||
UWORD FAR *x = MK_FP(r->DS, r->DX);
|
UWORD FAR *x = FP_DS_DX;
|
||||||
r->AX = x[0];
|
r->AX = x[0];
|
||||||
r->BX = x[1];
|
r->BX = x[1];
|
||||||
r->CX = x[2];
|
r->CX = x[2];
|
||||||
@ -1408,7 +1457,7 @@ dispatch:
|
|||||||
r->SI = FP_OFF(internal_data);
|
r->SI = FP_OFF(internal_data);
|
||||||
r->CX = swap_always - internal_data;
|
r->CX = swap_always - internal_data;
|
||||||
r->DX = swap_indos - internal_data;
|
r->DX = swap_indos - internal_data;
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x07:
|
case 0x07:
|
||||||
@ -1421,7 +1470,7 @@ dispatch:
|
|||||||
if (result != SUCCESS) {
|
if (result != SUCCESS) {
|
||||||
goto error_out;
|
goto error_out;
|
||||||
} else {
|
} else {
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1434,11 +1483,11 @@ dispatch:
|
|||||||
switch (r->AL)
|
switch (r->AL)
|
||||||
{
|
{
|
||||||
case 0x00:
|
case 0x00:
|
||||||
r->CX = get_machine_name(MK_FP(r->DS, r->DX));
|
r->CX = get_machine_name(FP_DS_DX);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x01:
|
case 0x01:
|
||||||
set_machine_name(MK_FP(r->DS, r->DX), r->CX);
|
set_machine_name(FP_DS_DX, r->CX);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1449,7 +1498,7 @@ dispatch:
|
|||||||
if (result != SUCCESS) {
|
if (result != SUCCESS) {
|
||||||
goto error_out;
|
goto error_out;
|
||||||
} else {
|
} else {
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1479,7 +1528,7 @@ dispatch:
|
|||||||
if (result != SUCCESS) {
|
if (result != SUCCESS) {
|
||||||
goto error_out;
|
goto error_out;
|
||||||
} else {
|
} else {
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1492,7 +1541,7 @@ dispatch:
|
|||||||
goto error_exit;
|
goto error_exit;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1549,19 +1598,19 @@ dispatch:
|
|||||||
r->DL = DosUpChar(r->DL);
|
r->DL = DosUpChar(r->DL);
|
||||||
break;
|
break;
|
||||||
case 0x21: /* upcase memory area */
|
case 0x21: /* upcase memory area */
|
||||||
DosUpMem(MK_FP(r->DS, r->DX), r->CX);
|
DosUpMem(FP_DS_DX, r->CX);
|
||||||
break;
|
break;
|
||||||
case 0x22: /* upcase ASCIZ */
|
case 0x22: /* upcase ASCIZ */
|
||||||
DosUpString(MK_FP(r->DS, r->DX));
|
DosUpString(FP_DS_DX);
|
||||||
break;
|
break;
|
||||||
case 0xA0: /* upcase single character of filenames */
|
case 0xA0: /* upcase single character of filenames */
|
||||||
r->DL = DosUpFChar(r->DL);
|
r->DL = DosUpFChar(r->DL);
|
||||||
break;
|
break;
|
||||||
case 0xA1: /* upcase memory area of filenames */
|
case 0xA1: /* upcase memory area of filenames */
|
||||||
DosUpFMem(MK_FP(r->DS, r->DX), r->CX);
|
DosUpFMem(FP_DS_DX, r->CX);
|
||||||
break;
|
break;
|
||||||
case 0xA2: /* upcase ASCIZ of filenames */
|
case 0xA2: /* upcase ASCIZ of filenames */
|
||||||
DosUpFString(MK_FP(r->DS, r->DX));
|
DosUpFString(FP_DS_DX);
|
||||||
break;
|
break;
|
||||||
case 0x23: /* check Yes/No response */
|
case 0x23: /* check Yes/No response */
|
||||||
r->AX = DosYesNo(r->DL);
|
r->AX = DosYesNo(r->DL);
|
||||||
@ -1581,7 +1630,7 @@ dispatch:
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Code Page functions */
|
/* Code Page functions */
|
||||||
@ -1601,7 +1650,7 @@ dispatch:
|
|||||||
}
|
}
|
||||||
if(rc != SUCCESS)
|
if(rc != SUCCESS)
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1611,13 +1660,13 @@ dispatch:
|
|||||||
goto error_exit;
|
goto error_exit;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Flush file buffer -- dummy function right now. */
|
/* Flush file buffer -- dummy function right now. */
|
||||||
case 0x68:
|
case 0x68:
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Get/Set Serial Number */
|
/* Get/Set Serial Number */
|
||||||
@ -1648,7 +1697,7 @@ dispatch:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1675,7 +1724,7 @@ dispatch:
|
|||||||
x += 2;
|
x += 2;
|
||||||
r->CX = x;
|
r->CX = x;
|
||||||
r->AX = rc;
|
r->AX = rc;
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1694,7 +1743,7 @@ dispatch:
|
|||||||
{
|
{
|
||||||
r->CX = 0x02;
|
r->CX = 0x02;
|
||||||
r->AX = rc;
|
r->AX = rc;
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1708,7 +1757,7 @@ dispatch:
|
|||||||
{
|
{
|
||||||
r->CX = 0x03;
|
r->CX = 0x03;
|
||||||
r->AX = rc;
|
r->AX = rc;
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1717,7 +1766,7 @@ dispatch:
|
|||||||
{
|
{
|
||||||
r->CX = 0x01;
|
r->CX = 0x01;
|
||||||
r->AX = rc;
|
r->AX = rc;
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if ((rc = DosCreat(MK_FP(r->DS, r->SI), r->CX )) < 0 )
|
if ((rc = DosCreat(MK_FP(r->DS, r->SI), r->CX )) < 0 )
|
||||||
@ -1726,7 +1775,7 @@ dispatch:
|
|||||||
{
|
{
|
||||||
r->CX = 0x02;
|
r->CX = 0x02;
|
||||||
r->AX = rc;
|
r->AX = rc;
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1738,7 +1787,7 @@ dispatch:
|
|||||||
{
|
{
|
||||||
r->CX = 0x01;
|
r->CX = 0x01;
|
||||||
r->AX = rc;
|
r->AX = rc;
|
||||||
r->FLAGS &= ~FLG_CARRY;
|
CLEAR_CARRY_FLAG();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1808,28 +1857,19 @@ struct int25regs
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* this function is called from an assembler wrapper function */
|
/* this function is called from an assembler wrapper function */
|
||||||
VOID int25_handler(struct int25regs FAR * r)
|
/*
|
||||||
|
I'm probably either
|
||||||
|
A) totally braindamaged
|
||||||
|
B) chasing a compiler bug, which I can't find.
|
||||||
|
|
||||||
|
LEAVE THIS CODE EXACTLY AS IS OR FDOS WON'T BOOT
|
||||||
|
*/
|
||||||
|
VOID int2526_handler(WORD mode, struct int25regs FAR * r)
|
||||||
{
|
{
|
||||||
ULONG blkno;
|
ULONG blkno;
|
||||||
UWORD nblks;
|
UWORD nblks;
|
||||||
BYTE FAR *buf;
|
BYTE FAR *buf;
|
||||||
UBYTE drv = r->ax & 0xFF;
|
UBYTE drv = r->ax;
|
||||||
|
|
||||||
InDOS++;
|
|
||||||
|
|
||||||
if (r->cx == 0xFFFF)
|
|
||||||
{
|
|
||||||
struct HugeSectorBlock FAR *lb = MK_FP(r->ds, r->bx);
|
|
||||||
blkno = lb->blkno;
|
|
||||||
nblks = lb->nblks;
|
|
||||||
buf = lb->buf;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nblks = r->cx;
|
|
||||||
blkno = r->dx;
|
|
||||||
buf = MK_FP(r->ds, r->bx);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (drv >= (lastdrive - 1))
|
if (drv >= (lastdrive - 1))
|
||||||
{
|
{
|
||||||
@ -1838,31 +1878,27 @@ VOID int25_handler(struct int25regs FAR * r)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* *** Changed 9/4/00 BER */
|
|
||||||
r->ax=dskxfer(drv, blkno, buf, nblks, DSKREAD);
|
nblks = r->cx;
|
||||||
if (r->ax > 0)
|
blkno = r->dx;
|
||||||
|
|
||||||
|
buf = MK_FP(r->ds, r->bx);
|
||||||
|
|
||||||
|
if (mode == DSKREAD)
|
||||||
{
|
{
|
||||||
r->flags |= FLG_CARRY;
|
if (nblks == 0xFFFF)
|
||||||
--InDOS;
|
{
|
||||||
return;
|
/*struct HugeSectorBlock FAR *lb = MK_FP(r->ds, r->bx);*/
|
||||||
|
blkno = ((struct HugeSectorBlock FAR *)buf)->blkno;
|
||||||
|
nblks = ((struct HugeSectorBlock FAR *)buf)->nblks;
|
||||||
|
buf = ((struct HugeSectorBlock FAR *)buf)->buf;
|
||||||
}
|
}
|
||||||
/* End of change */
|
else
|
||||||
|
{
|
||||||
r->ax = 0;
|
buf = MK_FP(r->ds, r->bx);
|
||||||
r->flags &= ~FLG_CARRY;
|
}
|
||||||
--InDOS;
|
} else {
|
||||||
}
|
if (nblks == 0xFFFF)
|
||||||
|
|
||||||
VOID int26_handler(struct int25regs FAR * r)
|
|
||||||
{
|
|
||||||
ULONG blkno;
|
|
||||||
UWORD nblks;
|
|
||||||
BYTE FAR *buf;
|
|
||||||
UBYTE drv = r->ax & 0xFF;
|
|
||||||
|
|
||||||
InDOS++;
|
|
||||||
|
|
||||||
if (r->cx == 0xFFFF)
|
|
||||||
{
|
{
|
||||||
struct HugeSectorBlock FAR *lb = MK_FP(r->ds, r->bx);
|
struct HugeSectorBlock FAR *lb = MK_FP(r->ds, r->bx);
|
||||||
blkno = lb->blkno;
|
blkno = lb->blkno;
|
||||||
@ -1871,46 +1907,42 @@ VOID int26_handler(struct int25regs FAR * r)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nblks = r->cx;
|
|
||||||
blkno = r->dx;
|
|
||||||
buf = MK_FP(r->ds, r->bx);
|
buf = MK_FP(r->ds, r->bx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drv >= (lastdrive -1))
|
|
||||||
{
|
|
||||||
r->ax = 0x202;
|
|
||||||
r->flags |= FLG_CARRY;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* *** Changed 9/4/00 BER */
|
|
||||||
|
|
||||||
|
InDOS++;
|
||||||
|
|
||||||
|
if (mode == DSKREAD)
|
||||||
|
{
|
||||||
|
r->ax=dskxfer(drv, blkno, buf, nblks, mode);
|
||||||
|
} else {
|
||||||
r->ax=dskxfer(drv, blkno, buf, nblks, DSKWRITE);
|
r->ax=dskxfer(drv, blkno, buf, nblks, DSKWRITE);
|
||||||
|
if (r->ax <= 0)
|
||||||
|
setinvld(drv);
|
||||||
|
}
|
||||||
|
|
||||||
if (r->ax > 0)
|
if (r->ax > 0)
|
||||||
{
|
{
|
||||||
r->flags |= FLG_CARRY;
|
r->flags |= FLG_CARRY;
|
||||||
--InDOS;
|
--InDOS;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* End of change */
|
|
||||||
|
|
||||||
setinvld(drv);
|
|
||||||
|
|
||||||
r->ax = 0;
|
r->ax = 0;
|
||||||
r->flags &= ~FLG_CARRY;
|
r->flags &= ~FLG_CARRY;
|
||||||
--InDOS;
|
--InDOS;
|
||||||
}
|
|
||||||
|
|
||||||
VOID INRPT FAR int28_handler(void)
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
VOID int25_handler(struct int25regs FAR * r) { int2526_handler(DSKREAD,r); }
|
||||||
|
VOID int26_handler(struct int25regs FAR * r) { int2526_handler(DSKWRITE,r); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
VOID INRPT FAR int2a_handler(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID INRPT FAR empty_handler(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef TSC
|
#ifdef TSC
|
||||||
static VOID StartTrace(VOID)
|
static VOID StartTrace(VOID)
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
%include "segs.inc"
|
%include "segs.inc"
|
||||||
|
|
||||||
segment _TEXT
|
segment HMA_TEXT
|
||||||
;
|
;
|
||||||
; void intr(nr, rp)
|
; void intr(nr, rp)
|
||||||
; REG int nr
|
; REG int nr
|
||||||
@ -90,3 +90,91 @@ intr?1:
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
global _int3
|
||||||
|
_int3:
|
||||||
|
int 3
|
||||||
|
retf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
segment INIT_TEXT
|
||||||
|
;
|
||||||
|
; void init_call_intr(nr, rp)
|
||||||
|
; REG int nr
|
||||||
|
; REG struct REGPACK *rp
|
||||||
|
;
|
||||||
|
; same stuff as above, but in INIT_SEGMENT
|
||||||
|
global _init_call_intr
|
||||||
|
_init_call_intr:
|
||||||
|
push bp ; Standard C entry
|
||||||
|
mov bp,sp
|
||||||
|
push si
|
||||||
|
push di
|
||||||
|
push ds
|
||||||
|
push es
|
||||||
|
|
||||||
|
mov ax, [bp+4] ; interrupt number
|
||||||
|
mov [CS:init_intr?1-1], al
|
||||||
|
jmp short init_intr?2 ; flush the instruction cache
|
||||||
|
init_intr?2 mov bx, [bp+6] ; regpack structure
|
||||||
|
mov ax, [bx]
|
||||||
|
mov cx, [bx+4]
|
||||||
|
mov dx, [bx+6]
|
||||||
|
mov bp, [bx+8]
|
||||||
|
mov di, [bx+10]
|
||||||
|
mov si, [bx+12]
|
||||||
|
push Word [bx+14] ; ds
|
||||||
|
mov es, [bx+16]
|
||||||
|
mov bx, [bx+2]
|
||||||
|
pop ds
|
||||||
|
|
||||||
|
int 0
|
||||||
|
init_intr?1:
|
||||||
|
|
||||||
|
pushf
|
||||||
|
push ds
|
||||||
|
push bx
|
||||||
|
mov bx, sp
|
||||||
|
mov ds, [SS:bx+8]
|
||||||
|
mov bx, [ss:bx+20] ; address of REGPACK
|
||||||
|
mov [bx], ax
|
||||||
|
pop ax
|
||||||
|
mov [bx+2], ax
|
||||||
|
mov [bx+4], cx
|
||||||
|
mov [bx+6], dx
|
||||||
|
mov [bx+8], bp
|
||||||
|
mov [bx+10], di
|
||||||
|
mov [bx+12], si
|
||||||
|
pop ax
|
||||||
|
mov [bx+14], ax
|
||||||
|
mov [bx+16], es
|
||||||
|
pop ax
|
||||||
|
mov [bx+18], ax
|
||||||
|
|
||||||
|
pop es
|
||||||
|
pop ds
|
||||||
|
pop di
|
||||||
|
pop si
|
||||||
|
pop bp
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;
|
||||||
|
; int init_call_XMScall( (WORD FAR * driverAddress)(), WORD AX, WORD DX)
|
||||||
|
;
|
||||||
|
; this calls HIMEM.SYS
|
||||||
|
;
|
||||||
|
global _init_call_XMScall
|
||||||
|
_init_call_XMScall:
|
||||||
|
push bp
|
||||||
|
mov bp,sp
|
||||||
|
|
||||||
|
mov ax,[bp+8]
|
||||||
|
mov dx,[bp+10]
|
||||||
|
call far [bp+4]
|
||||||
|
|
||||||
|
pop bp
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
@ -7,3 +7,4 @@ struct REGPACK {
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern void intr(int intrnr, struct REGPACK *rp);
|
extern void intr(int intrnr, struct REGPACK *rp);
|
||||||
|
extern void FAR int3();
|
||||||
|
@ -28,6 +28,9 @@
|
|||||||
; $Header$
|
; $Header$
|
||||||
;
|
;
|
||||||
; $Log$
|
; $Log$
|
||||||
|
; Revision 1.7 2001/03/21 02:56:26 bartoldeman
|
||||||
|
; See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
;
|
||||||
; Revision 1.6 2000/06/21 18:16:46 jimtabor
|
; Revision 1.6 2000/06/21 18:16:46 jimtabor
|
||||||
; Add UMB code, patch, and code fixes
|
; Add UMB code, patch, and code fixes
|
||||||
;
|
;
|
||||||
@ -72,8 +75,8 @@
|
|||||||
extern _NumFloppies:wrt DGROUP
|
extern _NumFloppies:wrt DGROUP
|
||||||
extern blk_stk_top:wrt DGROUP
|
extern blk_stk_top:wrt DGROUP
|
||||||
extern clk_stk_top:wrt DGROUP
|
extern clk_stk_top:wrt DGROUP
|
||||||
extern _blk_driver:wrt TGROUP
|
extern _reloc_call_blk_driver
|
||||||
extern _clk_driver:wrt TGROUP
|
extern _reloc_call_clk_driver
|
||||||
|
|
||||||
;---------------------------------------------------
|
;---------------------------------------------------
|
||||||
;
|
;
|
||||||
@ -225,11 +228,11 @@ clk_dos_stk resw 1
|
|||||||
clk_dos_seg resw 1
|
clk_dos_seg resw 1
|
||||||
|
|
||||||
segment _IO_TEXT
|
segment _IO_TEXT
|
||||||
|
|
||||||
global _ReqPktPtr
|
global _ReqPktPtr
|
||||||
_ReqPktPtr dd 0
|
_ReqPktPtr dd 0
|
||||||
uUnitNumber dw 0
|
uUnitNumber dw 0
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
; Name:
|
; Name:
|
||||||
; GenStrategy
|
; GenStrategy
|
||||||
@ -413,8 +416,10 @@ DiskIntrEntry:
|
|||||||
push ds
|
push ds
|
||||||
push bx
|
push bx
|
||||||
mov bp,sp
|
mov bp,sp
|
||||||
|
push ax
|
||||||
mov ax,DGROUP
|
mov ax,DGROUP
|
||||||
mov ds,ax
|
mov ds,ax
|
||||||
|
pop ax
|
||||||
cld
|
cld
|
||||||
call word [cs:si+1]
|
call word [cs:si+1]
|
||||||
pop cx
|
pop cx
|
||||||
@ -436,7 +441,7 @@ AsmType: mov al,[bx+unit]
|
|||||||
|
|
||||||
les di,[bx+trans]
|
les di,[bx+trans]
|
||||||
push ax
|
push ax
|
||||||
mov ax,DGROUP
|
mov ax, DGROUP
|
||||||
mov ds,ax
|
mov ds,ax
|
||||||
pop ax
|
pop ax
|
||||||
cld
|
cld
|
||||||
@ -558,7 +563,7 @@ blk_entry:
|
|||||||
mov bp,sp ; make a c frame
|
mov bp,sp ; make a c frame
|
||||||
push word [cs:_ReqPktPtr+2]
|
push word [cs:_ReqPktPtr+2]
|
||||||
push word [cs:_ReqPktPtr]
|
push word [cs:_ReqPktPtr]
|
||||||
call _blk_driver
|
call far _reloc_call_blk_driver
|
||||||
pop cx
|
pop cx
|
||||||
pop cx
|
pop cx
|
||||||
les bx,[cs:_ReqPktPtr] ; now return completion code
|
les bx,[cs:_ReqPktPtr] ; now return completion code
|
||||||
@ -580,6 +585,8 @@ blk_entry:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
; clock device interrupt
|
; clock device interrupt
|
||||||
;
|
;
|
||||||
@ -613,7 +620,7 @@ clk_entry:
|
|||||||
mov bp,sp ; make a c frame
|
mov bp,sp ; make a c frame
|
||||||
push word [cs:_ReqPktPtr+2]
|
push word [cs:_ReqPktPtr+2]
|
||||||
push word [cs:_ReqPktPtr]
|
push word [cs:_ReqPktPtr]
|
||||||
call _clk_driver
|
call far _reloc_call_clk_driver
|
||||||
pop cx
|
pop cx
|
||||||
pop cx
|
pop cx
|
||||||
les bx,[cs:_ReqPktPtr] ; now return completion code
|
les bx,[cs:_ReqPktPtr] ; now return completion code
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
; $Header$
|
; $Header$
|
||||||
;
|
;
|
||||||
; $Log$
|
; $Log$
|
||||||
|
; Revision 1.4 2001/03/21 02:56:26 bartoldeman
|
||||||
|
; See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
;
|
||||||
; 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
|
||||||
;
|
;
|
||||||
@ -58,16 +61,7 @@
|
|||||||
; $EndLog$
|
; $EndLog$
|
||||||
;
|
;
|
||||||
|
|
||||||
group TGROUP _TEXT _IO_TEXT _IO_FIXED_DATA
|
%include "segs.inc"
|
||||||
group DGROUP _FIXED_DATA _DATA _BSS _BSSEND
|
|
||||||
|
|
||||||
segment _TEXT class=CODE
|
|
||||||
segment _IO_TEXT class=CODE
|
|
||||||
segment _IO_FIXED_DATA class=CODE align=2
|
|
||||||
segment _FIXED_DATA class=DATA align=16
|
|
||||||
segment _DATA class=DATA align=2
|
|
||||||
segment _BSS class=BSS align=2
|
|
||||||
segment _BSSEND class=BSS
|
|
||||||
|
|
||||||
extern _IOExit:wrt TGROUP
|
extern _IOExit:wrt TGROUP
|
||||||
extern _IOSuccess:wrt TGROUP
|
extern _IOSuccess:wrt TGROUP
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
; $Id$
|
; $Id$
|
||||||
;
|
;
|
||||||
; $Log$
|
; $Log$
|
||||||
; Revision 1.6 2001/03/19 04:50:56 bartoldeman
|
; Revision 1.7 2001/03/21 02:56:26 bartoldeman
|
||||||
; See history.txt for overview: put kernel 2022beo1 into CVS
|
; See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
;
|
;
|
||||||
; Revision 1.6 2001/03/08 21:15:00 bartoldeman
|
; Revision 1.6 2001/03/08 21:15:00 bartoldeman
|
||||||
; uppermem_root initialised to 0 (no UMBs).
|
; uppermem_root initialised to 0 (no UMBs).
|
||||||
@ -219,15 +219,6 @@ _nul_intr:
|
|||||||
pop es
|
pop es
|
||||||
retf
|
retf
|
||||||
|
|
||||||
extern _init_call_printf:wrt TGROUP
|
|
||||||
|
|
||||||
global _printf
|
|
||||||
|
|
||||||
_printf:
|
|
||||||
pop ax
|
|
||||||
push cs
|
|
||||||
push ax
|
|
||||||
jmp _init_call_printf
|
|
||||||
|
|
||||||
|
|
||||||
segment _FIXED_DATA
|
segment _FIXED_DATA
|
||||||
@ -551,7 +542,9 @@ _FcbSearchBuffer: ; of error stack as scratch buffer
|
|||||||
_LocalPath:
|
_LocalPath:
|
||||||
; times 67 db 0
|
; times 67 db 0
|
||||||
; stacks are made to initialize to no-ops so that high-water
|
; stacks are made to initialize to no-ops so that high-water
|
||||||
; tesing can be performed
|
; testing can be performed
|
||||||
|
|
||||||
|
global apistk_bottom
|
||||||
apistk_bottom:
|
apistk_bottom:
|
||||||
times STACK_SIZE dw 0 ;300 - Error Processing Stack
|
times STACK_SIZE dw 0 ;300 - Error Processing Stack
|
||||||
global _error_tos
|
global _error_tos
|
||||||
@ -594,6 +587,14 @@ _ram_top dw 0
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;
|
||||||
|
; mark front and end of bss area to clear
|
||||||
|
segment _BSSSTART
|
||||||
|
global __bssstart
|
||||||
|
__bssstart:
|
||||||
|
segment _BSSEND
|
||||||
|
global __bssend
|
||||||
|
__bssend:
|
||||||
|
|
||||||
segment _BSSEND
|
segment _BSSEND
|
||||||
; blockdev private stack
|
; blockdev private stack
|
||||||
@ -607,17 +608,42 @@ blk_stk_top:
|
|||||||
clk_stk_top:
|
clk_stk_top:
|
||||||
|
|
||||||
; interrupt stack
|
; interrupt stack
|
||||||
|
global intr_stk_top
|
||||||
times 256 dw 0
|
times 256 dw 0
|
||||||
intr_stk_top:
|
intr_stk_top:
|
||||||
|
|
||||||
; kernel startup stack
|
; kernel startup stack
|
||||||
|
global tos
|
||||||
times 128 dw 0
|
times 128 dw 0
|
||||||
tos:
|
tos:
|
||||||
|
|
||||||
global last
|
segment INIT_TEXT_START
|
||||||
last: ; must always be end of stack area
|
global __InitTextStart
|
||||||
global _last
|
__InitTextStart: ; and c version
|
||||||
_last: ; and c version
|
|
||||||
|
|
||||||
|
;
|
||||||
|
; start end end of HMA area
|
||||||
|
|
||||||
|
segment HMA_TEXT_START
|
||||||
|
global __HMATextAvailable
|
||||||
|
__HMATextAvailable
|
||||||
|
global __HMATextStart
|
||||||
|
__HMATextStart:
|
||||||
|
|
||||||
|
;
|
||||||
|
; the HMA area is filled with 16+22(=sizeof VDISK) = 32 byte dummy data,
|
||||||
|
; so nothing will ever be below 0xffff:25
|
||||||
|
;
|
||||||
|
segment HMA_TEXT
|
||||||
|
times 16 db 0 ; filler [ffff:0..ffff:10]
|
||||||
|
times 22 db 0 ; filler [sizeof VDISK info]
|
||||||
|
|
||||||
|
;End of HMA segment
|
||||||
|
segment HMA_TEXT_END
|
||||||
|
global __HMATextEnd
|
||||||
|
__HMATextEnd: ; and c version
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; The default stack (_TEXT:0) will overwrite the data area, so I create a dummy
|
; The default stack (_TEXT:0) will overwrite the data area, so I create a dummy
|
||||||
@ -625,3 +651,367 @@ _last: ; and c version
|
|||||||
|
|
||||||
segment _STACK class=STACK stack
|
segment _STACK class=STACK stack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
segment _TEXT
|
||||||
|
; dummy interrupt return handlers
|
||||||
|
|
||||||
|
global _int28_handler
|
||||||
|
global _int2a_handler
|
||||||
|
global _empty_handler
|
||||||
|
_int28_handler:
|
||||||
|
_int2a_handler:
|
||||||
|
_empty_handler:
|
||||||
|
iret
|
||||||
|
|
||||||
|
|
||||||
|
; to minimize relocations
|
||||||
|
global _DGROUP_
|
||||||
|
_DGROUP_:
|
||||||
|
dw DGROUP
|
||||||
|
|
||||||
|
|
||||||
|
segment _TEXT
|
||||||
|
|
||||||
|
global __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
|
||||||
|
extern reloc_call_int2f_handler
|
||||||
|
_int2f_handler: jmp far reloc_call_int2f_handler
|
||||||
|
call near forceEnableA20
|
||||||
|
|
||||||
|
global _int20_handler
|
||||||
|
extern reloc_call_int20_handler
|
||||||
|
_int20_handler: jmp far reloc_call_int20_handler
|
||||||
|
call near forceEnableA20
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
global _int21_handler
|
||||||
|
extern reloc_call_int21_handler
|
||||||
|
_int21_handler: jmp far reloc_call_int21_handler
|
||||||
|
call near forceEnableA20
|
||||||
|
|
||||||
|
|
||||||
|
global _low_int25_handler
|
||||||
|
extern reloc_call_low_int25_handler
|
||||||
|
_low_int25_handler: jmp far reloc_call_low_int25_handler
|
||||||
|
call near forceEnableA20
|
||||||
|
|
||||||
|
global _low_int26_handler
|
||||||
|
extern reloc_call_low_int26_handler
|
||||||
|
_low_int26_handler: jmp far reloc_call_low_int26_handler
|
||||||
|
call near forceEnableA20
|
||||||
|
|
||||||
|
global _int27_handler
|
||||||
|
extern reloc_call_int27_handler
|
||||||
|
_int27_handler: jmp far reloc_call_int27_handler
|
||||||
|
call near forceEnableA20
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
global _cpm_entry
|
||||||
|
extern reloc_call_cpm_entry
|
||||||
|
_cpm_entry: jmp far reloc_call_cpm_entry
|
||||||
|
call near forceEnableA20
|
||||||
|
|
||||||
|
; global _init_call_init_buffers
|
||||||
|
; extern _reloc_call_init_buffers
|
||||||
|
;_init_call_init_buffers: jmp far _reloc_call_init_buffers
|
||||||
|
; call near forceEnableA20
|
||||||
|
|
||||||
|
global _init_call_p_0
|
||||||
|
extern _reloc_call_p_0
|
||||||
|
_init_call_p_0: jmp far _reloc_call_p_0
|
||||||
|
call near forceEnableA20
|
||||||
|
|
||||||
|
|
||||||
|
global __HMARelocationTableEnd
|
||||||
|
__HMARelocationTableEnd:
|
||||||
|
|
||||||
|
;
|
||||||
|
; if we were lucky, we found all entries from the outside to the kernel.
|
||||||
|
; if not, BUMS
|
||||||
|
;
|
||||||
|
;
|
||||||
|
; this routine makes the HMA area available. PERIOD.
|
||||||
|
; must conserve ALL registers
|
||||||
|
; will be only ever called, if HMA (DOS=HIGH) is enabled.
|
||||||
|
; for obvious reasons it should be located at the relocation table
|
||||||
|
;
|
||||||
|
global enableA20 ; to see it in the map
|
||||||
|
|
||||||
|
delay:
|
||||||
|
in al, 64h
|
||||||
|
delay_check:
|
||||||
|
and al, 2
|
||||||
|
jnz delay
|
||||||
|
ret
|
||||||
|
|
||||||
|
;void _EnableHMA()
|
||||||
|
;{
|
||||||
|
; OutportWithDelay(0x64, 0xd1);
|
||||||
|
; OutportWithDelay(0x60, 0xdf);
|
||||||
|
; OutportWithDelay(0x64, 0xff);
|
||||||
|
;}
|
||||||
|
|
||||||
|
global _XMSDriverAddress
|
||||||
|
_XMSDriverAddress:
|
||||||
|
dw 0 ; XMS driver, if detected
|
||||||
|
dw 0
|
||||||
|
|
||||||
|
global __EnableA20
|
||||||
|
__EnableA20:
|
||||||
|
cmp word [cs:_XMSDriverAddress],0
|
||||||
|
jne enableUsingXMSdriver
|
||||||
|
cmp word [cs:_XMSDriverAddress+2],0
|
||||||
|
jne enableUsingXMSdriver
|
||||||
|
|
||||||
|
|
||||||
|
; we do it ourself, without an XMS driver
|
||||||
|
mov al,0d1h
|
||||||
|
out 64h,al
|
||||||
|
call delay
|
||||||
|
mov al,0dfh
|
||||||
|
out 60h,al
|
||||||
|
call delay
|
||||||
|
mov al,0ffh
|
||||||
|
out 64h,al
|
||||||
|
call delay
|
||||||
|
retf
|
||||||
|
|
||||||
|
enableUsingXMSdriver:
|
||||||
|
mov ah,3
|
||||||
|
UsingXMSdriver:
|
||||||
|
call far [cs:_XMSDriverAddress]
|
||||||
|
retf
|
||||||
|
|
||||||
|
global __DisableA20
|
||||||
|
__DisableA20:
|
||||||
|
mov ah,4
|
||||||
|
cmp word [cs:_XMSDriverAddress],0
|
||||||
|
jne UsingXMSdriver
|
||||||
|
cmp word [cs:_XMSDriverAddress+2],0
|
||||||
|
jne UsingXMSdriver
|
||||||
|
|
||||||
|
; we do it ourself, without an XMS driver
|
||||||
|
;OutportWithDelay(0x64, 0xd1);
|
||||||
|
;OutportWithDelay(0x60, 0xdd);
|
||||||
|
;OutportWithDelay(0x64, 0xff);
|
||||||
|
mov al,0d1h
|
||||||
|
out 64h,al
|
||||||
|
call delay
|
||||||
|
mov al,0ddh
|
||||||
|
out 60h,al
|
||||||
|
call delay
|
||||||
|
mov al,0ffh
|
||||||
|
out 64h,al
|
||||||
|
call delay
|
||||||
|
|
||||||
|
retf
|
||||||
|
|
||||||
|
|
||||||
|
dslowmem dw 0
|
||||||
|
eshighmem dw 0ffffh
|
||||||
|
|
||||||
|
global forceEnableA20
|
||||||
|
forceEnableA20:
|
||||||
|
|
||||||
|
push ds
|
||||||
|
push es
|
||||||
|
push ax
|
||||||
|
|
||||||
|
forceEnableA20retry:
|
||||||
|
mov ds, [cs:dslowmem]
|
||||||
|
mov es, [cs:eshighmem]
|
||||||
|
|
||||||
|
mov ax, [ds:00000h]
|
||||||
|
cmp ax, [es:00010h]
|
||||||
|
jne forceEnableA20success
|
||||||
|
|
||||||
|
mov ax, [ds:00002h]
|
||||||
|
cmp ax, [es:00012h]
|
||||||
|
jne forceEnableA20success
|
||||||
|
|
||||||
|
mov ax, [ds:00004h]
|
||||||
|
cmp ax, [es:00014h]
|
||||||
|
jne forceEnableA20success
|
||||||
|
|
||||||
|
mov ax, [ds:00006h]
|
||||||
|
cmp ax, [es:00016h]
|
||||||
|
jne forceEnableA20success
|
||||||
|
|
||||||
|
;
|
||||||
|
; ok, we have to enable A20 )at least seems so
|
||||||
|
;
|
||||||
|
; some debug first
|
||||||
|
; push bx
|
||||||
|
; mov ah, 0eh
|
||||||
|
; mov al, 'H'
|
||||||
|
; mov bx, 0007h
|
||||||
|
; int 10h
|
||||||
|
; pop bx
|
||||||
|
|
||||||
|
call far __EnableA20
|
||||||
|
|
||||||
|
jmp short forceEnableA20retry
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
forceEnableA20success:
|
||||||
|
pop ax
|
||||||
|
pop es
|
||||||
|
pop ds
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
segment _TEXT
|
||||||
|
;
|
||||||
|
; Default Int 24h handler -- always returns fail
|
||||||
|
; so we have not to relocate it (now)
|
||||||
|
;
|
||||||
|
FAIL equ 03h
|
||||||
|
|
||||||
|
global _int24_handler
|
||||||
|
_int24_handler: mov al,FAIL
|
||||||
|
iret
|
||||||
|
|
||||||
|
|
||||||
|
segment HMA_TEXT
|
||||||
|
extern _init_call_printf:wrt TGROUP
|
||||||
|
global _printf
|
||||||
|
|
||||||
|
_printf:
|
||||||
|
pop ax
|
||||||
|
push cs
|
||||||
|
push ax
|
||||||
|
jmp _init_call_printf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
# $Log$
|
# $Log$
|
||||||
# Revision 1.5 2001/03/19 04:50:56 bartoldeman
|
# Revision 1.6 2001/03/21 02:56:26 bartoldeman
|
||||||
# See history.txt for overview: put kernel 2022beo1 into CVS
|
# See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
#
|
#
|
||||||
# Revision 1.4 2000/08/06 05:50:17 jimtabor
|
# Revision 1.4 2000/08/06 05:50:17 jimtabor
|
||||||
# Add new files and update cvs with patches and changes
|
# Add new files and update cvs with patches and changes
|
||||||
@ -127,9 +127,11 @@ NASMFLAGS = -i../hdr/
|
|||||||
LIBS =..\LIB\DEVICE.LIB ..\LIB\LIBM.LIB
|
LIBS =..\LIB\DEVICE.LIB ..\LIB\LIBM.LIB
|
||||||
#CFLAGS = -1- -O -Z -d -I..\hdr -I. \
|
#CFLAGS = -1- -O -Z -d -I..\hdr -I. \
|
||||||
# -D__STDC__=0;DEBUG;KERNEL;I86;PROTO;ASMSUPT
|
# -D__STDC__=0;DEBUG;KERNEL;I86;PROTO;ASMSUPT
|
||||||
CFLAGS = -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;KERNEL;I86;PROTO;ASMSUPT \
|
||||||
INITCFLAGS = $(CFLAGS) -zAINIT -zCINIT_TEXT -zPIGROUP
|
-g1
|
||||||
|
INITCFLAGS = $(ALLCFLAGS) -zAINIT -zCINIT_TEXT -zPIGROUP
|
||||||
|
CFLAGS = $(ALLCFLAGS) -zAHMA -zCHMA_TEXT
|
||||||
HDR=../hdr/
|
HDR=../hdr/
|
||||||
|
|
||||||
# *Implicit Rules*
|
# *Implicit Rules*
|
||||||
@ -191,7 +193,8 @@ EXE_dependencies = \
|
|||||||
sysclk.obj \
|
sysclk.obj \
|
||||||
syspack.obj \
|
syspack.obj \
|
||||||
systime.obj \
|
systime.obj \
|
||||||
task.obj
|
task.obj \
|
||||||
|
inithma.obj
|
||||||
|
|
||||||
# *Explicit Rules*
|
# *Explicit Rules*
|
||||||
|
|
||||||
@ -215,7 +218,7 @@ kernel.exe: $(EXE_dependencies) $(LIBS)
|
|||||||
$(RM) kernel.lib
|
$(RM) kernel.lib
|
||||||
$(LIBUTIL) kernel +entry +io +blockio +chario +dosfns +console
|
$(LIBUTIL) kernel +entry +io +blockio +chario +dosfns +console
|
||||||
$(LIBUTIL) kernel +printer +serial +dsk +error +fatdir +fatfs
|
$(LIBUTIL) kernel +printer +serial +dsk +error +fatdir +fatfs
|
||||||
$(LIBUTIL) kernel +fattab +fcbfns +initoem +inthndlr +ioctl +nls_hc
|
$(LIBUTIL) kernel +fattab +fcbfns +initoem +initHMA+inthndlr +ioctl +nls_hc
|
||||||
$(LIBUTIL) kernel +main +config +memmgr +misc +newstuff +nls +intr
|
$(LIBUTIL) kernel +main +config +memmgr +misc +newstuff +nls +intr
|
||||||
$(LIBUTIL) kernel +dosnames +prf +strings +network +sysclk +syspack
|
$(LIBUTIL) kernel +dosnames +prf +strings +network +sysclk +syspack
|
||||||
$(LIBUTIL) kernel +systime +task +int2f +irqstack +apisupt
|
$(LIBUTIL) kernel +systime +task +int2f +irqstack +apisupt
|
||||||
@ -284,6 +287,14 @@ main.obj: main.c init-mod.h $(HDR)portab.h globals.h $(HDR)device.h \
|
|||||||
$(HDR)version.h proto.h
|
$(HDR)version.h proto.h
|
||||||
$(CC) $(INITCFLAGS) -c main.c
|
$(CC) $(INITCFLAGS) -c main.c
|
||||||
|
|
||||||
|
initHMA.obj: initHMA.c init-mod.h $(HDR)portab.h globals.h $(HDR)device.h \
|
||||||
|
$(HDR)mcb.h $(HDR)pcb.h $(HDR)date.h $(HDR)time.h $(HDR)fat.h \
|
||||||
|
$(HDR)fcb.h $(HDR)tail.h $(HDR)process.h $(HDR)dcb.h $(HDR)sft.h \
|
||||||
|
$(HDR)cds.h $(HDR)exe.h $(HDR)fnode.h $(HDR)dirmatch.h \
|
||||||
|
$(HDR)file.h $(HDR)clock.h $(HDR)kbd.h $(HDR)error.h \
|
||||||
|
$(HDR)version.h proto.h
|
||||||
|
$(CC) $(INITCFLAGS) -c initHMA.c
|
||||||
|
|
||||||
# XXX: I generated these using `gcc -MM' and `sed', so they may not be
|
# XXX: I generated these using `gcc -MM' and `sed', so they may not be
|
||||||
# completely correct... -- ror4
|
# completely correct... -- ror4
|
||||||
blockio.obj: blockio.c $(HDR)portab.h globals.h $(HDR)device.h \
|
blockio.obj: blockio.c $(HDR)portab.h globals.h $(HDR)device.h \
|
||||||
|
105
kernel/main.c
105
kernel/main.c
@ -36,9 +36,14 @@
|
|||||||
#ifdef VERSION_STRINGS
|
#ifdef VERSION_STRINGS
|
||||||
static BYTE *mainRcsId = "$Id$";
|
static BYTE *mainRcsId = "$Id$";
|
||||||
#endif
|
#endif
|
||||||
|
GLOBAL WORD bDumpRegs = FALSE;
|
||||||
|
GLOBAL WORD bDumpRdWrParms= FALSE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.8 2001/03/21 02:56:26 bartoldeman
|
||||||
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
*
|
||||||
* Revision 1.7 2000/08/06 05:50:17 jimtabor
|
* Revision 1.7 2000/08/06 05:50:17 jimtabor
|
||||||
* Add new files and update cvs with patches and changes
|
* Add new files and update cvs with patches and changes
|
||||||
*
|
*
|
||||||
@ -158,6 +163,7 @@ 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 FAR init_call_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);
|
||||||
@ -169,12 +175,31 @@ INIT static VOID signon(VOID);
|
|||||||
INIT VOID kernel(VOID);
|
INIT VOID kernel(VOID);
|
||||||
INIT VOID FsConfig(VOID);
|
INIT VOID FsConfig(VOID);
|
||||||
|
|
||||||
|
#ifdef __TURBOC__
|
||||||
|
void __int__(int); /* TC 2.01 requires this. :( -- ror4 */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
INIT VOID main(void)
|
INIT VOID main(void)
|
||||||
{
|
{
|
||||||
|
setvec(1, empty_handler); /* single step */
|
||||||
|
setvec(3, empty_handler); /* debug breakpoint */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef KDB
|
#ifdef KDB
|
||||||
BootDrive = 1;
|
BootDrive = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
{ /* clear the BSS area (what normally the RTL does */
|
||||||
|
extern BYTE _bssstart[],_bssend[];
|
||||||
|
fmemset(_bssstart,0,_bssend-_bssstart);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
init_kernel();
|
init_kernel();
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
/* Non-portable message kludge alert! */
|
/* Non-portable message kludge alert! */
|
||||||
printf("KERNEL: Boot drive = %c\n", 'A' + BootDrive - 1);
|
printf("KERNEL: Boot drive = %c\n", 'A' + BootDrive - 1);
|
||||||
@ -183,7 +208,7 @@ INIT VOID main(void)
|
|||||||
kernel();
|
kernel();
|
||||||
}
|
}
|
||||||
|
|
||||||
INIT static VOID init_kernel(void)
|
INIT void init_kernel(void)
|
||||||
{
|
{
|
||||||
COUNT i;
|
COUNT i;
|
||||||
os_major = MAJOR_RELEASE;
|
os_major = MAJOR_RELEASE;
|
||||||
@ -194,6 +219,8 @@ INIT static VOID init_kernel(void)
|
|||||||
switchar = '/';
|
switchar = '/';
|
||||||
dosidle_flag = 1;
|
dosidle_flag = 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Init oem hook - returns memory size in KB */
|
/* Init oem hook - returns memory size in KB */
|
||||||
ram_top = init_oem();
|
ram_top = init_oem();
|
||||||
UMB_top = 0;
|
UMB_top = 0;
|
||||||
@ -371,31 +398,33 @@ INIT VOID FsConfig(VOID)
|
|||||||
/* Initialzie the current directory structures */
|
/* Initialzie 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];
|
||||||
|
|
||||||
fbcopy((VOID FAR *) "A:\\\0",
|
fbcopy((VOID FAR *) "A:\\\0",
|
||||||
(VOID FAR *) CDSp->cds_table[i].cdsCurrentPath, 4);
|
(VOID FAR *) pcds_table->cdsCurrentPath, 4);
|
||||||
CDSp->cds_table[i].cdsCurrentPath[0] += i;
|
|
||||||
|
pcds_table->cdsCurrentPath[0] += i;
|
||||||
|
|
||||||
if (i < nblkdev)
|
if (i < nblkdev)
|
||||||
{
|
{
|
||||||
CDSp->cds_table[i].cdsDpb = &blk_devices[i];
|
pcds_table->cdsDpb = &blk_devices[i];
|
||||||
CDSp->cds_table[i].cdsFlags = CDSPHYSDRV;
|
pcds_table->cdsFlags = CDSPHYSDRV;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CDSp->cds_table[i].cdsFlags = 0;
|
pcds_table->cdsFlags = 0;
|
||||||
}
|
}
|
||||||
CDSp->cds_table[i].cdsStrtClst = 0xffff;
|
pcds_table->cdsStrtClst = 0xffff;
|
||||||
CDSp->cds_table[i].cdsParam = 0xffff;
|
pcds_table->cdsParam = 0xffff;
|
||||||
CDSp->cds_table[i].cdsStoreUData = 0xffff;
|
pcds_table->cdsStoreUData = 0xffff;
|
||||||
CDSp->cds_table[i].cdsJoinOffset = 2;
|
pcds_table->cdsJoinOffset = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialze the disk buffer management functions */
|
/* Initialze the disk buffer management functions */
|
||||||
init_buffers();
|
/* init_call_init_buffers(); done from CONFIG.C */
|
||||||
}
|
}
|
||||||
|
|
||||||
INIT static VOID signon()
|
INIT VOID signon()
|
||||||
{
|
{
|
||||||
printf("\nFreeDOS Kernel compatibility %d.%d\n%s\n",
|
printf("\nFreeDOS Kernel compatibility %d.%d\n%s\n",
|
||||||
os_major, os_minor, copyright);
|
os_major, os_minor, copyright);
|
||||||
@ -404,7 +433,7 @@ INIT static VOID signon()
|
|||||||
BUILD);
|
BUILD);
|
||||||
}
|
}
|
||||||
|
|
||||||
INIT static VOID kernel()
|
INIT void kernel()
|
||||||
{
|
{
|
||||||
seg asize;
|
seg asize;
|
||||||
BYTE FAR *ep,
|
BYTE FAR *ep,
|
||||||
@ -434,7 +463,8 @@ INIT static VOID kernel()
|
|||||||
ep += sizeof(int);
|
ep += sizeof(int);
|
||||||
#endif
|
#endif
|
||||||
RootPsp = ~0;
|
RootPsp = ~0;
|
||||||
p_0();
|
|
||||||
|
init_call_p_0();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If cmdLine is NULL, this is an internal driver */
|
/* If cmdLine is NULL, this is an internal driver */
|
||||||
@ -457,7 +487,9 @@ 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);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Added needed Error handle
|
* Added needed Error handle
|
||||||
*/
|
*/
|
||||||
@ -478,17 +510,19 @@ BOOL init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine, COUNT mode, COUNT r_
|
|||||||
|
|
||||||
for (Index = 0; Index < rq.r_nunits; Index++)
|
for (Index = 0; Index < rq.r_nunits; Index++)
|
||||||
{
|
{
|
||||||
if (nblkdev)
|
struct dpb *pblk_devices = &blk_devices[nblkdev];
|
||||||
blk_devices[nblkdev - 1].dpb_next = &blk_devices[nblkdev];
|
|
||||||
|
|
||||||
blk_devices[nblkdev].dpb_next = (void FAR *)0xFFFFFFFF;
|
if (nblkdev)
|
||||||
blk_devices[nblkdev].dpb_unit = nblkdev;
|
(pblk_devices-1)->dpb_next = pblk_devices;
|
||||||
blk_devices[nblkdev].dpb_subunit = Index;
|
|
||||||
blk_devices[nblkdev].dpb_device = dhp;
|
pblk_devices->dpb_next = (void FAR *)0xFFFFFFFF;
|
||||||
blk_devices[nblkdev].dpb_flags = M_CHANGED;
|
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))
|
if ((CDSp != 0) && (nblkdev <= lastdrive))
|
||||||
{
|
{
|
||||||
CDSp->cds_table[nblkdev].cdsDpb = &blk_devices[nblkdev];
|
CDSp->cds_table[nblkdev].cdsDpb = pblk_devices;
|
||||||
CDSp->cds_table[nblkdev].cdsFlags = CDSPHYSDRV;
|
CDSp->cds_table[nblkdev].cdsFlags = CDSPHYSDRV;
|
||||||
}
|
}
|
||||||
++nblkdev;
|
++nblkdev;
|
||||||
@ -508,6 +542,7 @@ INIT static void InitIO(void)
|
|||||||
ULONG ticks;
|
ULONG ticks;
|
||||||
|
|
||||||
/* Initialize driver chain */
|
/* Initialize driver chain */
|
||||||
|
|
||||||
nul_dev.dh_next = (struct dhdr FAR *)&con_dev;
|
nul_dev.dh_next = (struct dhdr FAR *)&con_dev;
|
||||||
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);
|
||||||
@ -516,7 +551,11 @@ INIT static void InitIO(void)
|
|||||||
/* 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))
|
||||||
{
|
{
|
||||||
DaysSinceEpoch = BcdToDay(bcd_days);
|
DaysSinceEpoch = DaysFromYearMonthDay(
|
||||||
|
100 * BcdToByte(bcd_days[3]) + BcdToByte(bcd_days[2]),
|
||||||
|
BcdToByte(bcd_days[1]),
|
||||||
|
BcdToByte(bcd_days[0]) );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is a rather tricky calculation. The number of timer ticks per
|
* This is a rather tricky calculation. The number of timer ticks per
|
||||||
* second is not exactly 18.2, but rather 0x1800b0 / 86400 = 19663 / 1080
|
* second is not exactly 18.2, but rather 0x1800b0 / 86400 = 19663 / 1080
|
||||||
@ -537,23 +576,3 @@ INIT static COUNT BcdToByte(COUNT x)
|
|||||||
return ((((x) >> 4) & 0xf) * 10 + ((x) & 0xf));
|
return ((((x) >> 4) & 0xf) * 10 + ((x) & 0xf));
|
||||||
}
|
}
|
||||||
|
|
||||||
INIT static COUNT BcdToDay(BYTE * x)
|
|
||||||
{
|
|
||||||
UWORD mon,
|
|
||||||
day,
|
|
||||||
yr;
|
|
||||||
|
|
||||||
mon = BcdToByte(x[1]) - 1;
|
|
||||||
day = BcdToByte(x[0]) - 1;
|
|
||||||
yr = 100 * BcdToByte(x[3]) + BcdToByte(x[2]);
|
|
||||||
if (yr < 1980)
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
day += days[is_leap_year(yr)][mon];
|
|
||||||
while (--yr >= 1980)
|
|
||||||
day += is_leap_year(yr) ? 366 : 365;
|
|
||||||
return day;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -35,8 +35,8 @@ static BYTE *memmgrRcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
* Revision 1.8 2001/03/19 04:50:56 bartoldeman
|
* Revision 1.9 2001/03/21 02:56:26 bartoldeman
|
||||||
* See history.txt for overview: put kernel 2022beo1 into CVS
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
*
|
*
|
||||||
* Revision 1.8 2001/03/08 21:00:00 bartoldeman
|
* Revision 1.8 2001/03/08 21:00:00 bartoldeman
|
||||||
* UMB and MCB chain corruption (thanks Martin Stromberg) fixes
|
* UMB and MCB chain corruption (thanks Martin Stromberg) fixes
|
||||||
@ -114,8 +114,14 @@ VOID mcb_init();
|
|||||||
VOID mcb_print();
|
VOID mcb_print();
|
||||||
VOID show_chain();
|
VOID show_chain();
|
||||||
|
|
||||||
#define nxtMCBsize(mcb,size) \
|
/*#define nxtMCBsize(mcb,size) \
|
||||||
MK_FP(far2para((VOID FAR *) (mcb)) + (size) + 1, 0)
|
MK_FP(far2para((VOID FAR *) (mcb)) + (size) + 1, 0) */
|
||||||
|
|
||||||
|
void FAR *nxtMCBsize(mcb FAR *Mcb, int size)
|
||||||
|
{
|
||||||
|
return MK_FP(far2para((VOID FAR *) (Mcb)) + (size) + 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
#define nxtMCB(mcb) nxtMCBsize((mcb), (mcb)->m_size)
|
#define nxtMCB(mcb) nxtMCBsize((mcb), (mcb)->m_size)
|
||||||
|
|
||||||
#define mcbFree(mcb) ((mcb)->m_psp == FREE_PSP)
|
#define mcbFree(mcb) ((mcb)->m_psp == FREE_PSP)
|
||||||
@ -164,6 +170,8 @@ 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;
|
||||||
|
|
||||||
off += FP_OFF(fp);
|
off += FP_OFF(fp);
|
||||||
|
|
||||||
return MK_FP(FP_SEG(fp) + (UWORD) (off >> 4), (UWORD) off & 0xf);
|
return MK_FP(FP_SEG(fp) + (UWORD) (off >> 4), (UWORD) off & 0xf);
|
||||||
@ -176,6 +184,9 @@ VOID FAR *adjust_far(VOID FAR * fp)
|
|||||||
{
|
{
|
||||||
/* and return an adddress adjusted to the nearest paragraph */
|
/* and return an adddress adjusted to the nearest paragraph */
|
||||||
/* boundary. */
|
/* boundary. */
|
||||||
|
|
||||||
|
if (FP_SEG(fp) == 0xffff) return fp;
|
||||||
|
|
||||||
return MK_FP(FP_SEG(fp) + (FP_OFF(fp) >> 4), FP_OFF(fp) & 0xf);
|
return MK_FP(FP_SEG(fp) + (FP_OFF(fp) >> 4), FP_OFF(fp) & 0xf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -613,14 +624,14 @@ VOID mcb_print(mcb FAR * mcbp)
|
|||||||
mcbp->m_psp,
|
mcbp->m_psp,
|
||||||
mcbp->m_size);
|
mcbp->m_size);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
VOID _fmemcpy(BYTE FAR * d, BYTE FAR * s, REG COUNT n)
|
VOID _fmemcpy(BYTE FAR * d, BYTE FAR * s, REG COUNT n)
|
||||||
{
|
{
|
||||||
while (n--)
|
while (n--)
|
||||||
*d++ = *s++;
|
*d++ = *s++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
VOID DosUmbLink(BYTE n)
|
VOID DosUmbLink(BYTE n)
|
||||||
{
|
{
|
||||||
REG mcb FAR *p;
|
REG mcb FAR *p;
|
||||||
|
@ -34,6 +34,9 @@ static BYTE *miscRcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.4 2001/03/21 02:56:26 bartoldeman
|
||||||
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
*
|
||||||
* 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
|
||||||
*
|
*
|
||||||
@ -86,6 +89,7 @@ static BYTE *miscRcsId = "$Id$";
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
#ifndef ASMSUPT
|
||||||
|
|
||||||
VOID scopy(REG BYTE * s, REG BYTE * d)
|
VOID scopy(REG BYTE * s, REG BYTE * d)
|
||||||
{
|
{
|
||||||
@ -145,3 +149,4 @@ VOID FAR init_call_fmemset(REG VOID FAR * s, REG int ch, REG COUNT n)
|
|||||||
{
|
{
|
||||||
fmemset(s, ch, n);
|
fmemset(s, ch, n);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@ -36,6 +36,9 @@ static BYTE *RcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.8 2001/03/21 02:56:26 bartoldeman
|
||||||
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
*
|
||||||
* Revision 1.7 2000/08/06 05:50:17 jimtabor
|
* Revision 1.7 2000/08/06 05:50:17 jimtabor
|
||||||
* Add new files and update cvs with patches and changes
|
* Add new files and update cvs with patches and changes
|
||||||
*
|
*
|
||||||
@ -161,6 +164,7 @@ COUNT Remote_find(UWORD func, BYTE FAR * name, REG dmatch FAR * dmp )
|
|||||||
/*
|
/*
|
||||||
Needed Code Rep-off.;)
|
Needed Code Rep-off.;)
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
p = dmp->dm_name;
|
p = dmp->dm_name;
|
||||||
if (SDp->dir_name[0] == '.')
|
if (SDp->dir_name[0] == '.')
|
||||||
{
|
{
|
||||||
@ -191,6 +195,9 @@ COUNT Remote_find(UWORD func, BYTE FAR * name, REG dmatch FAR * dmp )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*p++ = NULL;
|
*p++ = NULL;
|
||||||
|
*/
|
||||||
|
ConvertName83ToNameSZ((BYTE FAR *) dmp->dm_name, (BYTE FAR *) SDp->dir_name);
|
||||||
|
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,9 @@ static BYTE *RcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.5 2001/03/21 02:56:26 bartoldeman
|
||||||
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
*
|
||||||
* Revision 1.4 2000/08/06 05:50:17 jimtabor
|
* Revision 1.4 2000/08/06 05:50:17 jimtabor
|
||||||
* Add new files and update cvs with patches and changes
|
* Add new files and update cvs with patches and changes
|
||||||
*
|
*
|
||||||
@ -348,7 +351,9 @@ log( ("NLS: nlsGetData(): Subfunction not found\n") );
|
|||||||
}
|
}
|
||||||
|
|
||||||
VOID nlsCPchange(UWORD cp)
|
VOID nlsCPchange(UWORD cp)
|
||||||
{ printf("\7\nSorry, to change the codepage is not implemented, yet.\n\
|
{
|
||||||
|
UNREFERENCED_PARAMETER(cp);
|
||||||
|
printf("\7\nSorry, to change the codepage is not implemented, yet.\n\
|
||||||
Hope it's OK to proceed ignoring this call.\n-- 2000/02/26 ska\n");
|
Hope it's OK to proceed ignoring this call.\n-- 2000/02/26 ska\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -610,6 +615,8 @@ COUNT DosSetCodepage(UWORD actCP, UWORD sysCP)
|
|||||||
UWORD syscall_MUX14(DIRECT_IREGS)
|
UWORD syscall_MUX14(DIRECT_IREGS)
|
||||||
{ struct nlsPackage FAR*nls; /* addressed NLS package */
|
{ struct nlsPackage FAR*nls; /* addressed NLS package */
|
||||||
|
|
||||||
|
if (flags || cs || ip || ds || es || si);
|
||||||
|
|
||||||
log( ("NLS: MUX14(): subfct=%x, cp=%u, cntry=%u\n",
|
log( ("NLS: MUX14(): subfct=%x, cp=%u, cntry=%u\n",
|
||||||
AL, BX, DX) );
|
AL, BX, DX) );
|
||||||
|
|
||||||
|
@ -29,8 +29,8 @@
|
|||||||
; $Id$
|
; $Id$
|
||||||
;
|
;
|
||||||
; $Log$
|
; $Log$
|
||||||
; Revision 1.5 2001/03/19 04:50:56 bartoldeman
|
; Revision 1.6 2001/03/21 02:56:26 bartoldeman
|
||||||
; See history.txt for overview: put kernel 2022beo1 into CVS
|
; See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
;
|
;
|
||||||
;
|
;
|
||||||
; Revision 1.5 2001/03/08 21:15:00 bartoldeman
|
; Revision 1.5 2001/03/08 21:15:00 bartoldeman
|
||||||
@ -87,15 +87,15 @@
|
|||||||
|
|
||||||
%include "segs.inc"
|
%include "segs.inc"
|
||||||
|
|
||||||
segment _TEXT
|
segment HMA_TEXT
|
||||||
global _CharMapSrvc
|
global _reloc_call_CharMapSrvc
|
||||||
extern _DosUpChar:wrt TGROUP
|
extern _DosUpChar:wrt HGROUP
|
||||||
;
|
;
|
||||||
; CharMapSrvc:
|
; CharMapSrvc:
|
||||||
; User callable character mapping service.
|
; User callable character mapping service.
|
||||||
; Part of Function 38h
|
; Part of Function 38h
|
||||||
;
|
;
|
||||||
_CharMapSrvc:
|
_reloc_call_CharMapSrvc:
|
||||||
push ds
|
push ds
|
||||||
push es
|
push es
|
||||||
push bp
|
push bp
|
||||||
@ -106,8 +106,10 @@ _CharMapSrvc:
|
|||||||
push bx
|
push bx
|
||||||
|
|
||||||
push ax ; arg of _upChar
|
push ax ; arg of _upChar
|
||||||
mov ax, DGROUP
|
push ax
|
||||||
|
mov ax,DGROUP
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
|
pop ax
|
||||||
|
|
||||||
call _DosUpChar
|
call _DosUpChar
|
||||||
;add sp, byte 2 // next POP retrieves orig AX
|
;add sp, byte 2 // next POP retrieves orig AX
|
||||||
|
57
kernel/prf.c
57
kernel/prf.c
@ -34,15 +34,15 @@ static BYTE *prfRcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
* Revision 1.4 2001/03/19 04:50:56 bartoldeman
|
* Revision 1.5 2001/03/21 02:56:26 bartoldeman
|
||||||
* See history.txt for overview: put kernel 2022beo1 into CVS
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
*
|
*
|
||||||
* Revision 1.4 2001/03/07 10:00:00 tomehlert
|
* Revision 1.4 2001/03/07 10:00:00 tomehlert
|
||||||
* recoded for smaller object footprint, added main() for testing+QA
|
* recoded for smaller object footprint, added main() for testing+QA
|
||||||
*
|
*
|
||||||
* $Log$
|
* $Log$
|
||||||
* Revision 1.4 2001/03/19 04:50:56 bartoldeman
|
* Revision 1.5 2001/03/21 02:56:26 bartoldeman
|
||||||
* See history.txt for overview: put kernel 2022beo1 into CVS
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -110,13 +110,21 @@ VOID cso(COUNT);
|
|||||||
VOID cso();
|
VOID cso();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __TURBOC__
|
||||||
|
void __int__(int); /* TC 2.01 requires this. :( -- ror4 */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* special console output routine */
|
/* special console output routine */
|
||||||
VOID
|
VOID
|
||||||
put_console(COUNT c)
|
put_console(COUNT c)
|
||||||
{
|
{
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
cso('\r');
|
put_console('\r');
|
||||||
cso(c);
|
|
||||||
|
_AX = 0x0e00 | c;
|
||||||
|
_BX = 0x0070;
|
||||||
|
__int__(0x10);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* special handler to switch between sprintf and printf */
|
/* special handler to switch between sprintf and printf */
|
||||||
@ -188,7 +196,15 @@ sprintf(BYTE * buff, CONST BYTE * fmt, BYTE * args,...)
|
|||||||
handle_char(NULL);
|
handle_char(NULL);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
ULONG FAR retcs(int i)
|
||||||
|
{
|
||||||
|
char *p = (char*)&i;
|
||||||
|
|
||||||
|
p -= 4;
|
||||||
|
return *(ULONG *)p;
|
||||||
|
}
|
||||||
|
*/
|
||||||
COUNT
|
COUNT
|
||||||
do_printf(CONST BYTE * fmt, BYTE ** arg)
|
do_printf(CONST BYTE * fmt, BYTE ** arg)
|
||||||
{
|
{
|
||||||
@ -203,6 +219,18 @@ COUNT
|
|||||||
int longarg;
|
int longarg;
|
||||||
long currentArg;
|
long currentArg;
|
||||||
|
|
||||||
|
/*
|
||||||
|
long cs = retcs(1);
|
||||||
|
put_console("0123456789ABCDEF"[(cs >> 28) & 0x0f]);
|
||||||
|
put_console("0123456789ABCDEF"[(cs >> 24) & 0x0f]);
|
||||||
|
put_console("0123456789ABCDEF"[(cs >> 20) & 0x0f]);
|
||||||
|
put_console("0123456789ABCDEF"[(cs >> 16) & 0x0f]);
|
||||||
|
put_console(':');
|
||||||
|
put_console("0123456789ABCDEF"[(cs >> 12) & 0x0f]);
|
||||||
|
put_console("0123456789ABCDEF"[(cs >> 8) & 0x0f]);
|
||||||
|
put_console("0123456789ABCDEF"[(cs >> 4) & 0x0f]);
|
||||||
|
put_console("0123456789ABCDEF"[(cs >> 0) & 0x0f]);
|
||||||
|
*/
|
||||||
while ((c = *fmt++) != '\0')
|
while ((c = *fmt++) != '\0')
|
||||||
{
|
{
|
||||||
if (c != '%')
|
if (c != '%')
|
||||||
@ -242,7 +270,8 @@ COUNT
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch (c = *fmt++)
|
c = *fmt++;
|
||||||
|
switch (c)
|
||||||
{
|
{
|
||||||
case '\0':
|
case '\0':
|
||||||
return 0;
|
return 0;
|
||||||
@ -251,6 +280,15 @@ COUNT
|
|||||||
handle_char(*(COUNT *) arg++);
|
handle_char(*(COUNT *) arg++);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
case 'p':
|
||||||
|
{
|
||||||
|
WORD w[2];
|
||||||
|
w[1] = *((unsigned int*) arg)++;
|
||||||
|
w[0] = *((unsigned int*) arg)++;
|
||||||
|
do_printf("%04x:%04x",(BYTE**)&w);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
p = *((BYTE **) arg)++;
|
p = *((BYTE **) arg)++;
|
||||||
goto do_outputstring;
|
goto do_outputstring;
|
||||||
@ -299,6 +337,8 @@ do_outputstring:
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
handle_char('?');
|
||||||
|
|
||||||
handle_char(c);
|
handle_char(c);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -370,7 +410,8 @@ struct {
|
|||||||
{ "2147483649", "%lu", 1,0x8000},
|
{ "2147483649", "%lu", 1,0x8000},
|
||||||
{ "-2147483647", "%ld", 1,0x8000},
|
{ "-2147483647", "%ld", 1,0x8000},
|
||||||
{ "32767", "%ld", 0x7fff,0},
|
{ "32767", "%ld", 0x7fff,0},
|
||||||
{ "32769", "%ld", 0x8001,0},
|
|
||||||
|
{ "ptr 1234:5678", "ptr %p", 0x5678,0x1234},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
; $Id$
|
; $Id$
|
||||||
;
|
;
|
||||||
; $Log$
|
; $Log$
|
||||||
|
; Revision 1.4 2001/03/21 02:56:26 bartoldeman
|
||||||
|
; See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
;
|
||||||
; 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,6 +102,8 @@
|
|||||||
|
|
||||||
segment _TEXT
|
segment _TEXT
|
||||||
|
|
||||||
|
extern _DGROUP_:wrt TGROUP
|
||||||
|
|
||||||
;
|
;
|
||||||
; Special call for switching processes
|
; Special call for switching processes
|
||||||
;
|
;
|
||||||
@ -109,8 +114,7 @@ segment _TEXT
|
|||||||
_exec_user:
|
_exec_user:
|
||||||
|
|
||||||
PUSH$ALL
|
PUSH$ALL
|
||||||
mov ax,DGROUP
|
mov ds,[_DGROUP_]
|
||||||
mov ds,ax
|
|
||||||
mov bp,sp
|
mov bp,sp
|
||||||
cld
|
cld
|
||||||
cli
|
cli
|
||||||
@ -302,6 +306,11 @@ _spawn_int23:
|
|||||||
jmp _int21_handler
|
jmp _int21_handler
|
||||||
|
|
||||||
|
|
||||||
|
global _init_call_spawn_int23
|
||||||
|
_init_call_spawn_int23:
|
||||||
|
int 3
|
||||||
|
call _spawn_int23
|
||||||
|
retf
|
||||||
;
|
;
|
||||||
; interrupt enable and disable routines
|
; interrupt enable and disable routines
|
||||||
;
|
;
|
||||||
|
@ -34,6 +34,9 @@ static BYTE *Proto_hRcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.9 2001/03/21 02:56:26 bartoldeman
|
||||||
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
*
|
||||||
* Revision 1.8 2000/10/30 00:21:15 jimtabor
|
* Revision 1.8 2000/10/30 00:21:15 jimtabor
|
||||||
* Adding Brian Reifsnyder Fix for Int 25/26
|
* Adding Brian Reifsnyder Fix for Int 25/26
|
||||||
*
|
*
|
||||||
@ -156,11 +159,12 @@ static BYTE *Proto_hRcsId = "$Id$";
|
|||||||
#else
|
#else
|
||||||
#define __FAR_WRAPPER(ret, name, proto) \
|
#define __FAR_WRAPPER(ret, name, proto) \
|
||||||
ret name proto; \
|
ret name proto; \
|
||||||
ret FAR init_call_##name proto;
|
ret FAR init_call_##name proto; \
|
||||||
|
ret FAR reloc_call_##name proto;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* blockio.c */
|
/* blockio.c */
|
||||||
VOID FAR init_buffers(void);
|
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);
|
||||||
@ -243,7 +247,7 @@ 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 blk_driver(rqptr rp);
|
COUNT FAR init_call_blk_driver(rqptr rp);
|
||||||
|
|
||||||
/* error.c */
|
/* error.c */
|
||||||
VOID dump(void);
|
VOID dump(void);
|
||||||
@ -386,15 +390,35 @@ COUNT DosGetLargestBlock(UWORD FAR * block);
|
|||||||
VOID show_chain(void);
|
VOID show_chain(void);
|
||||||
VOID DosUmbLink(BYTE n);
|
VOID DosUmbLink(BYTE n);
|
||||||
VOID mcb_print(mcb FAR * mcbp);
|
VOID mcb_print(mcb FAR * mcbp);
|
||||||
VOID _fmemcpy(BYTE FAR * d, BYTE FAR * s, REG COUNT n);
|
|
||||||
|
|
||||||
/* misc.c */
|
/* misc.c */
|
||||||
|
/*
|
||||||
__FAR_WRAPPER(VOID, scopy, (REG BYTE * s, REG BYTE * d))
|
__FAR_WRAPPER(VOID, scopy, (REG BYTE * s, REG BYTE * d))
|
||||||
VOID fscopy(REG BYTE FAR * s, REG BYTE FAR * d);
|
#define strcpy(d, s) scopy(s, d)
|
||||||
VOID fsncopy(BYTE FAR * s, BYTE FAR * d, REG COUNT n);
|
|
||||||
VOID bcopy(REG BYTE * s, REG BYTE * d, REG COUNT n);
|
|
||||||
__FAR_WRAPPER(VOID, fbcopy, (REG VOID FAR * s, REG VOID FAR * d, REG COUNT n))
|
__FAR_WRAPPER(VOID, fbcopy, (REG VOID FAR * s, REG VOID FAR * d, REG COUNT n))
|
||||||
|
|
||||||
|
*/
|
||||||
|
__FAR_WRAPPER(VOID, strcpy, (REG BYTE * d, REG BYTE * s))
|
||||||
|
#define scopy(s, d) strcpy(d,s)
|
||||||
|
__FAR_WRAPPER(VOID, fmemcpy, (REG VOID FAR * d, REG VOID FAR * s, REG COUNT 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 fstrcpy(REG BYTE FAR * d, REG BYTE FAR * s);
|
||||||
|
#define fscopy(s,d) fstrcpy(d,s)
|
||||||
|
|
||||||
|
VOID fstrcpy(REG BYTE FAR * d, REG BYTE FAR * s);
|
||||||
|
|
||||||
|
/*VOID bcopy(REG BYTE * s, REG BYTE * d, REG COUNT n);*/
|
||||||
|
void memcpy(REG BYTE * d, REG BYTE * s, REG COUNT n);
|
||||||
|
#define bcopy(s,d,n) memcpy(d,s,n)
|
||||||
|
|
||||||
|
__FAR_WRAPPER(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))
|
||||||
|
|
||||||
|
|
||||||
/* nls.c */
|
/* nls.c */
|
||||||
BYTE DosYesNo(unsigned char ch);
|
BYTE DosYesNo(unsigned char ch);
|
||||||
#ifndef DosUpMem
|
#ifndef DosUpMem
|
||||||
@ -431,11 +455,17 @@ __FAR_WRAPPER(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);
|
||||||
VOID fstrncpy(REG BYTE FAR * d, REG BYTE FAR * s, COUNT l);
|
/*
|
||||||
|
void fsncopy(REG BYTE FAR * s, REG BYTE FAR * d, COUNT l);
|
||||||
|
#define fstrncpy(d,s,l) fsncopy(s,d,l)
|
||||||
|
*/
|
||||||
|
void fstrncpy(REG BYTE FAR * d, REG BYTE FAR * s, COUNT l);
|
||||||
|
#define fsncopy(s,d,l) fstrncpy(d,s,l)
|
||||||
|
|
||||||
BYTE *strchr(BYTE * s, BYTE c);
|
BYTE *strchr(BYTE * s, BYTE c);
|
||||||
|
|
||||||
/* sysclk.c */
|
/* sysclk.c */
|
||||||
WORD clk_driver(rqptr rp);
|
WORD FAR init_call_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);
|
||||||
@ -456,6 +486,11 @@ COUNT DosSetTime(BYTE FAR * hp, BYTE FAR * mp, BYTE FAR * sp, BYTE FAR * hdp);
|
|||||||
VOID DosGetDate(BYTE FAR * wdp, BYTE FAR * mp, BYTE FAR * mdp, COUNT FAR * yp);
|
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);
|
||||||
|
__FAR_WRAPPER(WORD,DaysFromYearMonthDay,(WORD Year, WORD Month, WORD DayOfMonth))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* task.c */
|
/* task.c */
|
||||||
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);
|
||||||
@ -463,7 +498,7 @@ VOID return_user(void);
|
|||||||
__FAR_WRAPPER(COUNT, DosExec, (COUNT mode, exec_blk FAR * ep, BYTE FAR * lp))
|
__FAR_WRAPPER(COUNT, DosExec, (COUNT mode, exec_blk FAR * ep, BYTE FAR * lp))
|
||||||
__FAR_WRAPPER(VOID, InitPSP, (VOID))
|
__FAR_WRAPPER(VOID, InitPSP, (VOID))
|
||||||
|
|
||||||
VOID FAR 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);
|
||||||
@ -478,7 +513,7 @@ COUNT truename(char FAR * src, char FAR * dest, COUNT t);
|
|||||||
COUNT int2f_Remote_call(UWORD func, UWORD b, UCOUNT n, UWORD d, VOID FAR * s, UWORD i, VOID FAR * data);
|
COUNT int2f_Remote_call(UWORD func, UWORD b, UCOUNT n, UWORD d, VOID FAR * s, UWORD i, VOID FAR * data);
|
||||||
COUNT QRemote_Fn(char FAR * s, char FAR * d);
|
COUNT QRemote_Fn(char FAR * s, char FAR * d);
|
||||||
|
|
||||||
COUNT FAR Umb_Test(void);
|
COUNT Umb_Test(void);
|
||||||
|
|
||||||
UWORD get_machine_name(BYTE FAR * netname);
|
UWORD get_machine_name(BYTE FAR * netname);
|
||||||
VOID set_machine_name(BYTE FAR * netname, UWORD name_num);
|
VOID set_machine_name(BYTE FAR * netname, UWORD name_num);
|
||||||
@ -487,9 +522,24 @@ COUNT Remote_find(UWORD func, BYTE FAR * name, REG dmatch FAR * dmp);
|
|||||||
|
|
||||||
/* procsupt.asm */
|
/* procsupt.asm */
|
||||||
VOID INRPT FAR exec_user(iregs FAR * irp);
|
VOID INRPT FAR exec_user(iregs FAR * irp);
|
||||||
#define strcpy(d, s) scopy(s, d)
|
|
||||||
|
|
||||||
/* detect.c */
|
/* detect.c */
|
||||||
unsigned long FAR is_dosemu(void);
|
unsigned long FAR is_dosemu(void);
|
||||||
|
|
||||||
|
|
||||||
|
/* new by TE */
|
||||||
|
|
||||||
|
/*
|
||||||
|
assert at compile time, that something is true.
|
||||||
|
|
||||||
|
use like
|
||||||
|
ASSERT_CONST( SECSIZE == 512)
|
||||||
|
ASSERT_CONST( (BYTE FAR *)x->fcb_ext - (BYTE FAR *)x->fcbname == 8)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define ASSERT_CONST(x) { typedef struct { char x[2 * (x) - 1]; } xx ; }
|
||||||
|
|
||||||
|
void ConvertName83ToNameSZ(BYTE FAR *destSZ, BYTE FAR *srcFCBName);
|
||||||
|
|
||||||
|
|
||||||
|
VOID FAR *HMAalloc(COUNT bytesToAllocate);
|
@ -29,6 +29,9 @@
|
|||||||
; $Header$
|
; $Header$
|
||||||
;
|
;
|
||||||
; $Log$
|
; $Log$
|
||||||
|
; Revision 1.4 2001/03/21 02:56:26 bartoldeman
|
||||||
|
; See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
;
|
||||||
; 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
|
||||||
;
|
;
|
||||||
@ -56,6 +59,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
|
||||||
|
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
|
||||||
|
|
||||||
segment _TEXT class=CODE
|
segment _TEXT class=CODE
|
||||||
@ -63,8 +67,13 @@ segment _IO_TEXT class=CODE
|
|||||||
segment _IO_FIXED_DATA class=CODE align=2
|
segment _IO_FIXED_DATA class=CODE align=2
|
||||||
segment _FIXED_DATA class=DATA align=16
|
segment _FIXED_DATA class=DATA align=16
|
||||||
segment _DATA class=DATA align=2
|
segment _DATA class=DATA 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 HMA_TEXT_START class=HMA
|
||||||
|
segment HMA_TEXT class=HMA
|
||||||
|
segment HMA_TEXT_END class=HMA
|
||||||
segment INIT_TEXT_START class=INIT align=16
|
segment INIT_TEXT_START class=INIT align=16
|
||||||
segment INIT_TEXT class=INIT
|
segment INIT_TEXT class=INIT
|
||||||
segment INIT_TEXT_END class=INIT
|
segment INIT_TEXT_END class=INIT
|
||||||
|
|
||||||
|
@ -34,6 +34,9 @@ static BYTE *stringsRcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.4 2001/03/21 02:56:26 bartoldeman
|
||||||
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
*
|
||||||
* 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
|
||||||
*
|
*
|
||||||
@ -91,6 +94,7 @@ static BYTE *stringsRcsId = "$Id$";
|
|||||||
* Initial revision.
|
* Initial revision.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef ASMSUPT
|
||||||
COUNT strlen(REG BYTE * s)
|
COUNT strlen(REG BYTE * s)
|
||||||
{
|
{
|
||||||
REG WORD cnt = 0;
|
REG WORD cnt = 0;
|
||||||
@ -204,3 +208,4 @@ BYTE *strchr(BYTE * s, BYTE c)
|
|||||||
while (*p);
|
while (*p);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@ -35,6 +35,9 @@ static BYTE *RcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.4 2001/03/21 02:56:26 bartoldeman
|
||||||
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
*
|
||||||
* 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
|
||||||
*
|
*
|
||||||
@ -107,12 +110,8 @@ VOID DayToBcd();
|
|||||||
/* */
|
/* */
|
||||||
/* WARNING - THIS DRIVER IS NON-PORTABLE!!!! */
|
/* WARNING - THIS DRIVER IS NON-PORTABLE!!!! */
|
||||||
/* */
|
/* */
|
||||||
|
extern WORD days[2][13]; /* this is defined by SYSTIME.C */
|
||||||
|
|
||||||
WORD days[2][13] =
|
|
||||||
{
|
|
||||||
{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365},
|
|
||||||
{0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366}
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct ClockRecord clk;
|
static struct ClockRecord clk;
|
||||||
|
|
||||||
@ -128,11 +127,12 @@ static BYTE bcdSeconds;
|
|||||||
static ULONG Ticks;
|
static ULONG Ticks;
|
||||||
UWORD DaysSinceEpoch = 0;
|
UWORD DaysSinceEpoch = 0;
|
||||||
|
|
||||||
WORD clk_driver(rqptr rp)
|
WORD FAR init_call_clk_driver(rqptr rp)
|
||||||
{
|
{
|
||||||
REG COUNT count,
|
COUNT
|
||||||
c;
|
c;
|
||||||
BYTE FAR *cp;
|
int FAR *cp;
|
||||||
|
WORD *pdays;
|
||||||
|
|
||||||
switch (rp->r_command)
|
switch (rp->r_command)
|
||||||
{
|
{
|
||||||
@ -142,9 +142,6 @@ WORD clk_driver(rqptr rp)
|
|||||||
return S_DONE;
|
return S_DONE;
|
||||||
|
|
||||||
case C_INPUT:
|
case C_INPUT:
|
||||||
count = rp->r_count;
|
|
||||||
if (count > sizeof(struct ClockRecord))
|
|
||||||
count = sizeof(struct ClockRecord);
|
|
||||||
{
|
{
|
||||||
ULONG remainder,
|
ULONG remainder,
|
||||||
hs;
|
hs;
|
||||||
@ -158,6 +155,7 @@ WORD clk_driver(rqptr rp)
|
|||||||
* (100 x 86400) / 0x1800b0 = 108000 / 19663. -- ror4
|
* (100 x 86400) / 0x1800b0 = 108000 / 19663. -- ror4
|
||||||
*/
|
*/
|
||||||
hs = 0;
|
hs = 0;
|
||||||
|
#if 0
|
||||||
if (Ticks >= 64 * 19663ul)
|
if (Ticks >= 64 * 19663ul)
|
||||||
{
|
{
|
||||||
hs += 64 * 108000ul;
|
hs += 64 * 108000ul;
|
||||||
@ -193,6 +191,15 @@ WORD clk_driver(rqptr rp)
|
|||||||
hs += 108000ul;
|
hs += 108000ul;
|
||||||
Ticks -= 19663ul;
|
Ticks -= 19663ul;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
UWORD q1 = Ticks/19663ul;
|
||||||
|
|
||||||
|
Ticks -= q1*19663ul;
|
||||||
|
hs = q1*108000ul;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
* Now Ticks < 19663, so Ticks * 108000 < 2123604000 < ULONG_MAX.
|
* Now Ticks < 19663, so Ticks * 108000 < 2123604000 < ULONG_MAX.
|
||||||
* *phew* -- ror4
|
* *phew* -- ror4
|
||||||
@ -205,15 +212,13 @@ WORD clk_driver(rqptr rp)
|
|||||||
clk.clkSeconds = remainder / 100ul;
|
clk.clkSeconds = remainder / 100ul;
|
||||||
clk.clkHundredths = remainder % 100ul;
|
clk.clkHundredths = remainder % 100ul;
|
||||||
}
|
}
|
||||||
fbcopy((BYTE FAR *) & clk, rp->r_trans, count);
|
|
||||||
|
fbcopy((BYTE FAR *) & clk, rp->r_trans, min(sizeof(struct ClockRecord),rp->r_count ));
|
||||||
return S_DONE;
|
return S_DONE;
|
||||||
|
|
||||||
case C_OUTPUT:
|
case C_OUTPUT:
|
||||||
count = rp->r_count;
|
rp->r_count = min(rp->r_count,sizeof(struct ClockRecord));
|
||||||
if (count > sizeof(struct ClockRecord))
|
fbcopy(rp->r_trans, (BYTE FAR *) & clk, rp->r_count);
|
||||||
count = sizeof(struct ClockRecord);
|
|
||||||
rp->r_count = count;
|
|
||||||
fbcopy(rp->r_trans, (BYTE FAR *) & clk, count);
|
|
||||||
|
|
||||||
/* Set PC Clock first */
|
/* Set PC Clock first */
|
||||||
DaysSinceEpoch = clk.clkDays;
|
DaysSinceEpoch = clk.clkDays;
|
||||||
@ -224,6 +229,7 @@ WORD clk_driver(rqptr rp)
|
|||||||
100ul * clk.clkSeconds +
|
100ul * clk.clkSeconds +
|
||||||
clk.clkHundredths;
|
clk.clkHundredths;
|
||||||
Ticks = 0;
|
Ticks = 0;
|
||||||
|
#if 0
|
||||||
if (hs >= 64 * 108000ul)
|
if (hs >= 64 * 108000ul)
|
||||||
{
|
{
|
||||||
Ticks += 64 * 19663ul;
|
Ticks += 64 * 19663ul;
|
||||||
@ -259,6 +265,15 @@ WORD clk_driver(rqptr rp)
|
|||||||
Ticks += 19663ul;
|
Ticks += 19663ul;
|
||||||
hs -= 108000ul;
|
hs -= 108000ul;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
UWORD q1 = hs/108000ul;
|
||||||
|
|
||||||
|
hs -= q1*108000ul;
|
||||||
|
Ticks = q1*19663ul;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
Ticks += hs * 19663ul / 108000ul;
|
Ticks += hs * 19663ul / 108000ul;
|
||||||
}
|
}
|
||||||
WritePCClock(Ticks);
|
WritePCClock(Ticks);
|
||||||
@ -266,13 +281,13 @@ WORD clk_driver(rqptr rp)
|
|||||||
/* Now set AT clock */
|
/* Now set AT clock */
|
||||||
/* Fix year by looping through each year, subtracting */
|
/* Fix year by looping through each year, subtracting */
|
||||||
/* the appropriate number of days for that year. */
|
/* the appropriate number of days for that year. */
|
||||||
for (Year = 1980, c = clk.clkDays; c > 0;)
|
for (Year = 1980, c = clk.clkDays; ;)
|
||||||
{
|
{
|
||||||
count = is_leap_year(Year) ? 366 : 365;
|
pdays = is_leap_year_monthdays(Year);
|
||||||
if (c >= count)
|
if (c >= pdays[12])
|
||||||
{
|
{
|
||||||
++Year;
|
++Year;
|
||||||
c -= count;
|
c -= pdays[12];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
@ -282,12 +297,14 @@ WORD clk_driver(rqptr rp)
|
|||||||
/* days for that year. Use this to index the table. */
|
/* days for that year. Use this to index the table. */
|
||||||
for (Month = 1; Month < 13; ++Month)
|
for (Month = 1; Month < 13; ++Month)
|
||||||
{
|
{
|
||||||
if (days[count == 366][Month] > c)
|
if (pdays[Month] > c)
|
||||||
{
|
{
|
||||||
Day = c - days[count == 366][Month - 1] + 1;
|
Day = c - pdays[Month - 1] + 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DayToBcd((BYTE *) bcdDays, &Month, &Day, &Year);
|
DayToBcd((BYTE *) bcdDays, &Month, &Day, &Year);
|
||||||
bcdMinutes = ByteToBcd(clk.clkMinutes);
|
bcdMinutes = ByteToBcd(clk.clkMinutes);
|
||||||
bcdHours = ByteToBcd(clk.clkHours);
|
bcdHours = ByteToBcd(clk.clkHours);
|
||||||
|
133
kernel/systime.c
133
kernel/systime.c
@ -37,6 +37,9 @@ static BYTE *RcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.4 2001/03/21 02:56:26 bartoldeman
|
||||||
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
*
|
||||||
* 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
|
||||||
*
|
*
|
||||||
@ -94,39 +97,65 @@ static BYTE *RcsId = "$Id$";
|
|||||||
* Initial revision.
|
* Initial revision.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static WORD days[2][13] =
|
|
||||||
|
WORD days[2][13] =
|
||||||
{
|
{
|
||||||
{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365},
|
{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365},
|
||||||
{0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366}
|
{0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366}
|
||||||
};
|
};
|
||||||
|
|
||||||
static WORD ndays[2][13] =
|
|
||||||
{
|
|
||||||
/* 1 2 3 4 5 6 7 8 9 10 11 12 */
|
|
||||||
{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
|
|
||||||
{0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
|
|
||||||
};
|
|
||||||
|
|
||||||
extern BYTE
|
|
||||||
Month,
|
|
||||||
DayOfMonth,
|
|
||||||
DayOfWeek;
|
|
||||||
|
|
||||||
extern COUNT
|
|
||||||
Year,
|
|
||||||
YearsSince1980;
|
|
||||||
|
|
||||||
extern request
|
extern request
|
||||||
ClkReqHdr;
|
ClkReqHdr;
|
||||||
|
|
||||||
VOID DosGetTime(BYTE FAR * hp, BYTE FAR * mp, BYTE FAR * sp, BYTE FAR * hdp)
|
/*
|
||||||
|
return a pointer to an array with the days for that year
|
||||||
|
*/
|
||||||
|
|
||||||
|
WORD *is_leap_year_monthdays(int y)
|
||||||
|
{
|
||||||
|
/* this is correct in a strict mathematical sense
|
||||||
|
return ((y) & 3 ? days[0] : (y) % 100 ? days[1] : (y) % 400 ? days[0] : days[1]); */
|
||||||
|
|
||||||
|
/* this will work until 2200 - long enough for me - and saves 0x1f bytes */
|
||||||
|
|
||||||
|
if ((y & 3) || y == 2100) return days[0];
|
||||||
|
|
||||||
|
return days[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
WORD DaysFromYearMonthDay(WORD Year, WORD Month, WORD DayOfMonth)
|
||||||
|
{
|
||||||
|
if (Year < 1980) return 0;
|
||||||
|
|
||||||
|
return DayOfMonth - 1
|
||||||
|
+ is_leap_year_monthdays(Year)[Month - 1]
|
||||||
|
+ ((Year - 1980) * 365)
|
||||||
|
+ ((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 */
|
||||||
|
void ExecuteClockDriverRequest(BYTE command)
|
||||||
{
|
{
|
||||||
ClkReqHdr.r_length = sizeof(request);
|
ClkReqHdr.r_length = sizeof(request);
|
||||||
ClkReqHdr.r_command = C_INPUT;
|
ClkReqHdr.r_command = command;
|
||||||
ClkReqHdr.r_count = sizeof(struct ClockRecord);
|
ClkReqHdr.r_count = sizeof(struct ClockRecord);
|
||||||
ClkReqHdr.r_trans = (BYTE FAR *) (&ClkRecord);
|
ClkReqHdr.r_trans = (BYTE FAR *) (&ClkRecord);
|
||||||
ClkReqHdr.r_status = 0;
|
ClkReqHdr.r_status = 0;
|
||||||
execrh((request FAR *) & ClkReqHdr, (struct dhdr FAR *)clock);
|
execrh((request FAR *) & ClkReqHdr, (struct dhdr FAR *)clock);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
VOID DosGetTime(BYTE FAR * hp, BYTE FAR * mp, BYTE FAR * sp, BYTE FAR * hdp)
|
||||||
|
{
|
||||||
|
ExecuteClockDriverRequest(C_INPUT);
|
||||||
|
|
||||||
if (ClkReqHdr.r_status & S_ERROR)
|
if (ClkReqHdr.r_status & S_ERROR)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -138,6 +167,8 @@ VOID DosGetTime(BYTE FAR * hp, BYTE FAR * mp, BYTE FAR * sp, BYTE FAR * hdp)
|
|||||||
|
|
||||||
COUNT DosSetTime(BYTE FAR * hp, BYTE FAR * mp, BYTE FAR * sp, BYTE FAR * hdp)
|
COUNT DosSetTime(BYTE FAR * hp, BYTE FAR * mp, BYTE FAR * sp, BYTE FAR * hdp)
|
||||||
{
|
{
|
||||||
|
BYTE Month, DayOfMonth, DayOfWeek; COUNT Year;
|
||||||
|
|
||||||
DosGetDate((BYTE FAR *) & DayOfWeek, (BYTE FAR *) & Month,
|
DosGetDate((BYTE FAR *) & DayOfWeek, (BYTE FAR *) & Month,
|
||||||
(BYTE FAR *) & DayOfMonth, (COUNT FAR *) & Year);
|
(BYTE FAR *) & DayOfMonth, (COUNT FAR *) & Year);
|
||||||
|
|
||||||
@ -146,18 +177,10 @@ COUNT DosSetTime(BYTE FAR * hp, BYTE FAR * mp, BYTE FAR * sp, BYTE FAR * hdp)
|
|||||||
ClkRecord.clkSeconds = *sp;
|
ClkRecord.clkSeconds = *sp;
|
||||||
ClkRecord.clkHundredths = *hdp;
|
ClkRecord.clkHundredths = *hdp;
|
||||||
|
|
||||||
YearsSince1980 = Year - 1980;
|
ClkRecord.clkDays = DaysFromYearMonthDay(Year, Month, DayOfMonth);
|
||||||
ClkRecord.clkDays = DayOfMonth - 1
|
|
||||||
+ days[is_leap_year(Year)][Month - 1]
|
ExecuteClockDriverRequest(C_OUTPUT);
|
||||||
+ ((YearsSince1980) * 365)
|
|
||||||
+ ((YearsSince1980 + 3) / 4);
|
|
||||||
|
|
||||||
ClkReqHdr.r_length = sizeof(request);
|
|
||||||
ClkReqHdr.r_command = C_OUTPUT;
|
|
||||||
ClkReqHdr.r_count = sizeof(struct ClockRecord);
|
|
||||||
ClkReqHdr.r_trans = (BYTE FAR *) (&ClkRecord);
|
|
||||||
ClkReqHdr.r_status = 0;
|
|
||||||
execrh((request FAR *) & ClkReqHdr, (struct dhdr FAR *)clock);
|
|
||||||
if (ClkReqHdr.r_status & S_ERROR)
|
if (ClkReqHdr.r_status & S_ERROR)
|
||||||
return char_error(&ClkReqHdr, (struct dhdr FAR *)clock);
|
return char_error(&ClkReqHdr, (struct dhdr FAR *)clock);
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
@ -169,25 +192,22 @@ BYTE FAR *wdp,
|
|||||||
FAR * mdp;
|
FAR * mdp;
|
||||||
COUNT FAR *yp;
|
COUNT FAR *yp;
|
||||||
{
|
{
|
||||||
COUNT count,
|
WORD c;
|
||||||
c;
|
WORD *pdays;
|
||||||
|
WORD Year,Month;
|
||||||
|
|
||||||
|
ExecuteClockDriverRequest(C_INPUT);
|
||||||
|
|
||||||
ClkReqHdr.r_length = sizeof(request);
|
|
||||||
ClkReqHdr.r_command = C_INPUT;
|
|
||||||
ClkReqHdr.r_count = sizeof(struct ClockRecord);
|
|
||||||
ClkReqHdr.r_trans = (BYTE FAR *) (&ClkRecord);
|
|
||||||
ClkReqHdr.r_status = 0;
|
|
||||||
execrh((request FAR *) & ClkReqHdr, (struct dhdr FAR *)clock);
|
|
||||||
if (ClkReqHdr.r_status & S_ERROR)
|
if (ClkReqHdr.r_status & S_ERROR)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Year = 1980, c = ClkRecord.clkDays; c > 0;)
|
for (Year = 1980, c = ClkRecord.clkDays; ;)
|
||||||
{
|
{
|
||||||
count = is_leap_year(Year) ? 366 : 365;
|
pdays = is_leap_year_monthdays(Year);
|
||||||
if (c >= count)
|
if (c >= pdays[12])
|
||||||
{
|
{
|
||||||
++Year;
|
++Year;
|
||||||
c -= count;
|
c -= pdays[12];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
@ -196,21 +216,19 @@ COUNT FAR *yp;
|
|||||||
/* c contains the days left and count the number of days for */
|
/* c contains the days left and count the number of days for */
|
||||||
/* that year. Use this to index the table. */
|
/* that year. Use this to index the table. */
|
||||||
Month = 1;
|
Month = 1;
|
||||||
while (c >= ndays[count == 366][Month])
|
while (c >= pdays[Month])
|
||||||
{
|
{
|
||||||
c -= ndays[count == 366][Month];
|
|
||||||
++Month;
|
++Month;
|
||||||
}
|
}
|
||||||
|
|
||||||
*mp = Month;
|
*mp = Month;
|
||||||
*mdp = c + 1;
|
*mdp = c - pdays[Month-1] + 1;
|
||||||
*yp = Year;
|
*yp = Year;
|
||||||
|
|
||||||
/* Day of week is simple. Take mod 7, add 2 (for Tuesday */
|
/* Day of week is simple. Take mod 7, add 2 (for Tuesday */
|
||||||
/* 1-1-80) and take mod again */
|
/* 1-1-80) and take mod again */
|
||||||
|
|
||||||
DayOfWeek = (ClkRecord.clkDays % 7 + 2) % 7;
|
*wdp = (ClkRecord.clkDays + 2) % 7;
|
||||||
*wdp = DayOfWeek;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
COUNT DosSetDate(mp, mdp, yp)
|
COUNT DosSetDate(mp, mdp, yp)
|
||||||
@ -218,31 +236,28 @@ BYTE FAR *mp,
|
|||||||
FAR * mdp;
|
FAR * mdp;
|
||||||
COUNT FAR *yp;
|
COUNT FAR *yp;
|
||||||
{
|
{
|
||||||
|
WORD *pdays, Month, DayOfMonth,Year;
|
||||||
Month = *mp;
|
Month = *mp;
|
||||||
DayOfMonth = *mdp;
|
DayOfMonth = *mdp;
|
||||||
Year = *yp;
|
Year = *yp;
|
||||||
|
pdays = is_leap_year_monthdays(Year);
|
||||||
|
|
||||||
if (Year < 1980 || Year > 2099
|
if (Year < 1980 || Year > 2099
|
||||||
|| Month < 1 || Month > 12
|
|| Month < 1 || Month > 12
|
||||||
|| DayOfMonth < 1 || DayOfMonth > ndays[is_leap_year(Year)][Month])
|
|| DayOfMonth < 1
|
||||||
|
|| DayOfMonth > pdays[Month] - pdays[Month-1])
|
||||||
return DE_INVLDDATA;
|
return DE_INVLDDATA;
|
||||||
|
|
||||||
|
|
||||||
DosGetTime((BYTE FAR *) & ClkRecord.clkHours,
|
DosGetTime((BYTE FAR *) & ClkRecord.clkHours,
|
||||||
(BYTE FAR *) & ClkRecord.clkMinutes,
|
(BYTE FAR *) & ClkRecord.clkMinutes,
|
||||||
(BYTE FAR *) & ClkRecord.clkSeconds,
|
(BYTE FAR *) & ClkRecord.clkSeconds,
|
||||||
(BYTE FAR *) & ClkRecord.clkHundredths);
|
(BYTE FAR *) & ClkRecord.clkHundredths);
|
||||||
|
|
||||||
YearsSince1980 = Year - 1980;
|
ClkRecord.clkDays = DaysFromYearMonthDay(Year, Month, DayOfMonth);
|
||||||
ClkRecord.clkDays = DayOfMonth - 1
|
|
||||||
+ days[is_leap_year(Year)][Month - 1]
|
ExecuteClockDriverRequest(C_OUTPUT);
|
||||||
+ ((YearsSince1980) * 365)
|
|
||||||
+ ((YearsSince1980 + 3) / 4);
|
|
||||||
|
|
||||||
ClkReqHdr.r_length = sizeof(request);
|
|
||||||
ClkReqHdr.r_command = C_OUTPUT;
|
|
||||||
ClkReqHdr.r_count = sizeof(struct ClockRecord);
|
|
||||||
ClkReqHdr.r_trans = (BYTE FAR *) (&ClkRecord);
|
|
||||||
ClkReqHdr.r_status = 0;
|
|
||||||
execrh((request FAR *) & ClkReqHdr, (struct dhdr FAR *)clock);
|
|
||||||
if (ClkReqHdr.r_status & S_ERROR)
|
if (ClkReqHdr.r_status & S_ERROR)
|
||||||
return char_error(&ClkReqHdr, (struct dhdr FAR *)clock);
|
return char_error(&ClkReqHdr, (struct dhdr FAR *)clock);
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
@ -35,8 +35,8 @@ static BYTE *RcsId = "$Id$";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log$
|
* $Log$
|
||||||
* Revision 1.6 2001/03/19 04:50:56 bartoldeman
|
* Revision 1.7 2001/03/21 02:56:26 bartoldeman
|
||||||
* See history.txt for overview: put kernel 2022beo1 into CVS
|
* See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
*
|
*
|
||||||
* Revision 1.6 2001/03/08 21:00:00 bartoldeman
|
* Revision 1.6 2001/03/08 21:00:00 bartoldeman
|
||||||
* UMB fixes to DosComLoader
|
* UMB fixes to DosComLoader
|
||||||
@ -441,7 +441,7 @@ set_name:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static COUNT DosComLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
COUNT DosComLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
||||||
{
|
{
|
||||||
COUNT rc,
|
COUNT rc,
|
||||||
err,
|
err,
|
||||||
@ -674,7 +674,7 @@ static COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
|||||||
|
|
||||||
/* and finally add in the psp size */
|
/* and finally add in the psp size */
|
||||||
if (mode != OVERLAY)
|
if (mode != OVERLAY)
|
||||||
image_size += (ULONG) long2para((LONG) sizeof(psp));
|
image_size += sizeof(psp); /*TE 03/20/01*/
|
||||||
|
|
||||||
if (mode != OVERLAY)
|
if (mode != OVERLAY)
|
||||||
{
|
{
|
||||||
@ -956,7 +956,7 @@ VOID InitPSP(VOID)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* process 0 */
|
/* process 0 */
|
||||||
VOID FAR p_0(VOID)
|
VOID FAR reloc_call_p_0(VOID)
|
||||||
{
|
{
|
||||||
exec_blk exb;
|
exec_blk exb;
|
||||||
CommandTail Cmd;
|
CommandTail Cmd;
|
||||||
|
@ -4,6 +4,9 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
#
|
#
|
||||||
# $Log$
|
# $Log$
|
||||||
|
# Revision 1.4 2001/03/21 02:56:26 bartoldeman
|
||||||
|
# See history.txt for changes. Bug fixes and HMA support are the main ones.
|
||||||
|
#
|
||||||
# Revision 1.3 2000/05/25 20:56:23 jimtabor
|
# Revision 1.3 2000/05/25 20:56:23 jimtabor
|
||||||
# Fixed project history
|
# Fixed project history
|
||||||
#
|
#
|
||||||
@ -36,7 +39,7 @@
|
|||||||
#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 \
|
||||||
# -L$(LIBPATH) -DI86;PROTO;DEBUG
|
# -L$(LIBPATH) -DI86;PROTO;DEBUG
|
||||||
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 \
|
||||||
-L$(LIBPATH) -DI86;PROTO
|
-L$(LIBPATH) -DI86;PROTO -zAHMA -zCHMA_TEXT -zDHMA_TEXT
|
||||||
|
|
||||||
# *Implicit Rules*
|
# *Implicit Rules*
|
||||||
.c.obj:
|
.c.obj:
|
||||||
@ -66,7 +69,8 @@ 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
|
||||||
|
|
||||||
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,sys,,\
|
||||||
|
$(LINK) /m/c $(LIBPATH)\c0s.obj+sys.obj,sys.com,,\
|
||||||
$(LIBS)+$(CLIB);
|
$(LIBS)+$(CLIB);
|
||||||
|
|
||||||
clobber: clean
|
clobber: clean
|
||||||
|
Loading…
x
Reference in New Issue
Block a user