mirror of https://github.com/FDOS/kernel.git
kernel 2026 test changes (see history.txt)
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@343 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
2e46486b3f
commit
0e8b739c4c
|
@ -307,7 +307,7 @@ fat_12: add si, si ; multiply cluster number by 3...
|
|||
shr ax, cl ; shift the cluster number
|
||||
|
||||
fat_even: and ah, 0x0f ; mask off the highest 4 bits
|
||||
cmp ax, 0x0fff ; check for EOF
|
||||
cmp ax, 0x0ff8 ; check for EOF
|
||||
jb next_clust ; continue if not EOF
|
||||
|
||||
%endif
|
||||
|
@ -412,35 +412,34 @@ read_next: push dx
|
|||
; + head * sectPerTrack offset in cylinder
|
||||
; + track * sectPerTrack * nHeads offset in platter
|
||||
;
|
||||
; t1 = abs / sectPerTrack (ax has t1)
|
||||
; sector = abs mod sectPerTrack (cx has sector)
|
||||
;
|
||||
div word [sectPerTrack]
|
||||
xchg ax, cx
|
||||
mov al, [sectPerTrack]
|
||||
mul byte [nHeads]
|
||||
xchg ax, cx
|
||||
; cx = nHeads * sectPerTrack <= 255*63
|
||||
; dx:ax = abs
|
||||
div cx
|
||||
; ax = track, dx = sector + head * sectPertrack
|
||||
xchg ax, dx
|
||||
; dx = track, ax = sector + head * sectPertrack
|
||||
div byte [sectPerTrack]
|
||||
; dx = track, al = head, ah = sector
|
||||
mov cx, dx
|
||||
|
||||
;
|
||||
; t1 = head + track * nHeads
|
||||
;
|
||||
; track = t1 / nHeads (ax has track)
|
||||
; head = t1 mod nHeads (dl has head)
|
||||
;
|
||||
xor dx, dx
|
||||
div word [nHeads]
|
||||
; cx = track, al = head, ah = sector
|
||||
|
||||
; the following manipulations are necessary in order to
|
||||
; properly place parameters into registers.
|
||||
; ch = cylinder number low 8 bits
|
||||
; cl = 7-6: cylinder high two bits
|
||||
; 5-0: sector
|
||||
mov dh, dl ; save head into dh for bios
|
||||
ror ah, 1 ; move track high bits into
|
||||
ror ah, 1 ; bits 7-6 (assumes top = 0)
|
||||
xchg al, ah ; swap for later
|
||||
mov dl, byte [sectPerTrack]
|
||||
sub dl, cl
|
||||
inc cl ; sector offset from 1
|
||||
or cx, ax ; merge cylinder into sector
|
||||
mov al, dl ; al has # of sectors left
|
||||
mov dh, al ; save head into dh for bios
|
||||
xchg ch, cl ; set cyl no low 8 bits
|
||||
ror cl, 1 ; move track high bits into
|
||||
ror cl, 1 ; bits 7-6 (assumes top = 0)
|
||||
mov al, byte [sectPerTrack]
|
||||
sub al, ah ; al has # of sectors left
|
||||
inc ah ; sector offset from 1
|
||||
or cl, ah ; merge sector into cylinder
|
||||
|
||||
%ifdef MULTI_SEC_READ
|
||||
; Calculate how many sectors can be transfered in this read
|
||||
|
|
|
@ -299,34 +299,32 @@ read_next: push dx
|
|||
; + head * sectPerTrack offset in cylinder
|
||||
; + track * sectPerTrack * nHeads offset in platter
|
||||
;
|
||||
; t1 = abs / sectPerTrack (ax has t1)
|
||||
; sector = abs mod sectPerTrack (cx has sector)
|
||||
;
|
||||
div word [sectPerTrack]
|
||||
xchg ax, cx
|
||||
mov al, [sectPerTrack]
|
||||
mul byte [nHeads]
|
||||
xchg ax, cx
|
||||
; cx = nHeads * sectPerTrack <= 255*63
|
||||
; dx:ax = abs
|
||||
div cx
|
||||
; ax = track, dx = sector + head * sectPertrack
|
||||
xchg ax, dx
|
||||
; dx = track, ax = sector + head * sectPertrack
|
||||
div byte [sectPerTrack]
|
||||
; dx = track, al = head, ah = sector
|
||||
mov cx, dx
|
||||
|
||||
;
|
||||
; t1 = head + track * nHeads
|
||||
;
|
||||
; track = t1 / nHeads (ax has track)
|
||||
; head = t1 mod nHeads (dl has head)
|
||||
;
|
||||
xor dx, dx
|
||||
div word [nHeads]
|
||||
; cx = track, al = head, ah = sector
|
||||
|
||||
; the following manipulations are necessary in order to
|
||||
; properly place parameters into registers.
|
||||
; ch = cylinder number low 8 bits
|
||||
; cl = 7-6: cylinder high two bits
|
||||
; 5-0: sector
|
||||
mov dh, dl ; save head into dh for bios
|
||||
ror ah, 1 ; move track high bits into
|
||||
ror ah, 1 ; bits 7-6 (assumes top = 0)
|
||||
xchg al, ah ; swap for later
|
||||
mov dl, byte [sectPerTrack]
|
||||
sub dl, cl
|
||||
inc cl ; sector offset from 1
|
||||
or cx, ax ; merge cylinder into sector
|
||||
mov dh, al ; save head into dh for bios
|
||||
xchg ch, cl ; set cyl no low 8 bits
|
||||
ror cl, 1 ; move track high bits into
|
||||
ror cl, 1 ; bits 7-6 (assumes top = 0)
|
||||
inc ah ; sector offset from 1
|
||||
or cl, ah ; merge sector into cylinder
|
||||
|
||||
mov ax, 0x0201
|
||||
mov dl, [drive]
|
||||
|
|
44
build.bat
44
build.bat
|
@ -18,21 +18,6 @@ set XERROR=
|
|||
call config.bat
|
||||
call getmake.bat
|
||||
|
||||
@if not "%XLINK%" == "" goto link_set
|
||||
|
||||
@if \%COMPILER% == \TC2 set XLINK=%TC2_BASE%\tlink /m/c
|
||||
@if \%COMPILER% == \TURBOCPP set XLINK=%TP1_BASE%\bin\tlink /m/c
|
||||
@if \%COMPILER% == \TC3 set XLINK=%TC3_BASE%\bin\tlink /m/c
|
||||
@if \%COMPILER% == \BC5 set XLINK=%BC5_BASE%\bin\tlink /m/c
|
||||
@if \%COMPILER% == \WATCOM goto watcom_problem
|
||||
@if \%COMPILER% == \MSCL8 set XLINK=%MS_BASE%\link /ONERROR:NOEXE /ma /nologo
|
||||
goto link_set
|
||||
|
||||
:watcom_problem
|
||||
@echo you MUST set XLINK for Watcom in config.bat as WLINK is not suitable
|
||||
goto end
|
||||
|
||||
:link_set
|
||||
|
||||
@set XERROR=
|
||||
|
||||
|
@ -72,6 +57,35 @@ goto loop_commandline
|
|||
if \%COMPILER% == \ echo you MUST define a COMPILER variable in CONFIG.BAT
|
||||
if \%COMPILER% == \ goto end
|
||||
|
||||
|
||||
@if not "%XLINK%" == "" goto link_set
|
||||
|
||||
@if \%COMPILER% == \TC2 set XLINK=%TC2_BASE%\tlink /m/c
|
||||
@if \%COMPILER% == \TURBOCPP set XLINK=%TP1_BASE%\bin\tlink /m/c
|
||||
@if \%COMPILER% == \TC3 set XLINK=%TC3_BASE%\bin\tlink /m/c
|
||||
@if \%COMPILER% == \BC5 set XLINK=%BC5_BASE%\bin\tlink /m/c
|
||||
@if \%COMPILER% == \WATCOM goto watcom_problem
|
||||
@if \%COMPILER% == \MSCL8 set XLINK=%MS_BASE%\bin\link /ONERROR:NOEXE /ma /nologo
|
||||
goto link_set
|
||||
|
||||
:watcom_problem
|
||||
@echo you MUST set XLINK for Watcom in config.bat as WLINK is not suitable
|
||||
goto end
|
||||
|
||||
:link_set
|
||||
|
||||
echo linker ist %XLINK%
|
||||
|
||||
@if not "%XUPX%" == "" goto upx_set
|
||||
@set XUPX=@rem
|
||||
@set UPXOPT=
|
||||
goto compile
|
||||
|
||||
:upx_set
|
||||
@set UPXOPT=-U
|
||||
|
||||
:compile
|
||||
|
||||
:************************************************************************
|
||||
:* finally - we are going to compile
|
||||
:************************************************************************
|
||||
|
|
10
config.b
10
config.b
|
@ -54,11 +54,18 @@ set TC2_BASE=c:\tc201
|
|||
|
||||
:- if WATCOM maybe you need to set your WATCOM environment variables
|
||||
:- and path
|
||||
:- if not %WATCOM% == \ goto watcom_defined
|
||||
:- if not \%WATCOM% == \ goto watcom_defined
|
||||
:- set WATCOM=c:\watcom
|
||||
:- set PATH=%PATH%;%WATCOM%\binw
|
||||
:watcom_defined
|
||||
|
||||
:-**********************************************************************
|
||||
:- where is UPX and which options to use?
|
||||
:-**********************************************************************
|
||||
set XUPX=upx --8086
|
||||
:- or use set XUPX=
|
||||
:- if you don't want to use it
|
||||
|
||||
:-**********************************************************************
|
||||
:- (optionally) which linker to use:
|
||||
:- (otherwise will be determined automatically)
|
||||
|
@ -108,6 +115,7 @@ set XFAT=16
|
|||
:- Give extra compiler DEFINE flags here
|
||||
:- such as -DDEBUG : extra DEBUG output
|
||||
:- -DDOSEMU : printf output goes to dosemu log
|
||||
:- -p : use PASCAL calling convention with Turbo C
|
||||
:- set ALLCFLAGS=-DDEBUG
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,119 @@
|
|||
advanced CONFIG.SYS processing
|
||||
|
||||
a new command ECHO
|
||||
ECHO does ECHO it's argument (surprised ?-) and is executed at
|
||||
the time the DEVICE= lines are executed.
|
||||
use it similar to
|
||||
|
||||
ECHO loading driver 1
|
||||
device=Driver1.sys
|
||||
ECHO driver1 successfully loaded
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
the following advanced config.sys processing options are available:
|
||||
|
||||
normal
|
||||
FILES=20
|
||||
DEVICE=MyNetWorkDriver.sys
|
||||
|
||||
'?' - ALWAYS ask if a single line shall be executed
|
||||
|
||||
FILES=20
|
||||
?DEVICE=MyNetWorkDriver.sys
|
||||
|
||||
|
||||
'!' - NEVER ask if a single line shall be executed, even if single stepping
|
||||
|
||||
!FILES=20
|
||||
!DOS=HIGH,UMB
|
||||
!BUFFERS=30
|
||||
DEVICE=MyNetWorkDriver.sys
|
||||
|
||||
|
||||
|
||||
configuration management - you may compose several configurations,
|
||||
using following special commands:
|
||||
|
||||
MENU
|
||||
MENU select your configuration
|
||||
MENU
|
||||
MENU use (0) for basic configuration
|
||||
MENU use (1) for CDROM operation
|
||||
MENU use (2) for NETWORK configuration
|
||||
MENU
|
||||
MENUDEFAULT=0,1 ( configuration 0, wait 1 second)
|
||||
|
||||
|
||||
1? rem CDROM
|
||||
1? device=CDROM.SYS
|
||||
|
||||
2? rem NETWORK
|
||||
2? device=MyNetworkDriver.SYS
|
||||
|
||||
|
||||
Although this is definitively worse then MSDOS menuing possibilities,
|
||||
IMHO it's better then nothing
|
||||
|
||||
|
||||
|
||||
thus my config.sys now looks like
|
||||
|
||||
|
||||
!files=20
|
||||
!dos=high,umb
|
||||
!break=off
|
||||
!buffers=30
|
||||
!screen=0x12
|
||||
!lastdrive=z
|
||||
|
||||
MENU
|
||||
MENU
|
||||
MENU 0 - SoftIce+HIMEM+Network (default)
|
||||
MENU 1 - SoftIce+HIMEM
|
||||
MENU 2 - HIMEM+EMM386
|
||||
MENU
|
||||
MENUDEFAULT=0,0
|
||||
|
||||
|
||||
0? DEVICE=C:\NUMEGA\S-ICE.EXE /TRA 3000 /SYM 400
|
||||
0? DEVICE=himem.exe
|
||||
0? DEVICE=UMBPCI.SYS
|
||||
|
||||
0?device=c:\ntclient\ifshlp.sys
|
||||
0?device=c:\ntclient\protman.dos /i:c:\ntclient
|
||||
0?device=c:\ntclient\dm9pci.dos
|
||||
0?device=c:\ntclient\ndishlp.sys
|
||||
0?device=c:\ntclient\nemm.dos
|
||||
0?device=c:\ntclient\tcpdrv.dos
|
||||
|
||||
|
||||
|
||||
1? DEVICE=C:\NUMEGA\S-ICE.EXE /TRA 3000 /SYM 400
|
||||
1? DEVICE=himem.exe
|
||||
1? DEVICE=UMBPCI.SYS
|
||||
|
||||
|
||||
|
||||
2? DEVICE=himem.exe
|
||||
2? DEVICE=emm386.exe NOEMS
|
||||
|
||||
|
||||
rem DEVICE=CDROM.SYS /D:MSCD000
|
||||
|
||||
shellhigh=a:\command.com /p /e:512 /MSG
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
12/14/01 - tom ehlert
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,3 +1,37 @@
|
|||
2002 Feb xx - Build 2026test
|
||||
-------- Bart Oldeman (bart@dosemu.org)
|
||||
+ Changes Tom
|
||||
* FCB clean-ups and fixes
|
||||
* initial config.sys menus (see config.txt)
|
||||
* execrh
|
||||
* make kernel UPX-able
|
||||
* cleaned up midnight flag, dates
|
||||
* tmark() and friends are floppy specific and implemented in C
|
||||
instead of ASM (parts by Bart)
|
||||
+ Changes Victor
|
||||
* lfn fixes
|
||||
* FAT32 fixes
|
||||
* dosemu log nicer
|
||||
+ Changes Martin
|
||||
* log output
|
||||
* warning fixes for sys, patchobj and prf.c
|
||||
+ Changes Bart
|
||||
* FCB clean-ups and fixes
|
||||
* make Watcom compiled kernel runnable
|
||||
* make compilation with Pascal style calling conventions
|
||||
for Borland compilers (-p) possible
|
||||
* initialize CDS before opening devices
|
||||
* implement lock/unlock for remote drives
|
||||
* implement commit file (int21/ah=68,6a)
|
||||
* implement ioctl get/set logical drive map (int21/ax=440E--F)
|
||||
* implement get drive data table (int2f/ax=0803)
|
||||
* fix "get SDA" (int21/ax=5d06)
|
||||
* do not use CHS if the root extended partition of the relevant
|
||||
logical partition is labelled LBA
|
||||
* boot sector fixes:
|
||||
enable booting beyond cylinder x where x * number of heads >= 65536.
|
||||
still uses CHS to boot (not able to boot beyond cylinder 1023)
|
||||
recognize FF8-FFF as FAT12 ending (was only FFF)
|
||||
2001 Nov 18 - Build 2025c
|
||||
-------- Bart Oldeman (bart@dosemu.org)
|
||||
+ Changes Bart
|
||||
|
|
|
@ -104,7 +104,7 @@ int 21 Description State Ver Status
|
|||
50h Set PSP Address active 2.00 supported
|
||||
51h Get PSP Address active 2.00 supported
|
||||
52h Get List of Lists undocumented 2.00 supported
|
||||
53h undocumented not supported
|
||||
53h Translate BPB to DPB undocumented supported
|
||||
54h Get Verify State active 2.00 supported
|
||||
55h Create New Psp undocumented 2.00 supported
|
||||
56h Rename File active 2.00 supported
|
||||
|
@ -139,11 +139,11 @@ int 21 Description State Ver Status
|
|||
65h NLS Functions active 3.30 supported
|
||||
66h Code Page Functions active 3.30 supported
|
||||
67h Set Maximum Handle Count active 3.30 supported
|
||||
68h Commit File active 3.30 dummy func
|
||||
68h Commit File active 3.30 supported
|
||||
69h GET/SET DISK SERIAL NUMBER active 4.00 supported
|
||||
6ah COMMIT FILE (same as 68h) active 4.00 not supported
|
||||
6ah COMMIT FILE (same as 68h) active 4.00 supported
|
||||
6bh NULL FUNCTION active 5.00 supported
|
||||
6ch Extended Open/Create active 4.00 planned
|
||||
6ch Extended Open/Create active 4.00 supported
|
||||
71h LONG FILENAME FUNCTIONS active 7.00 not supported
|
||||
|
||||
int 22: Program Termination Address.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
struct lfn_inode
|
||||
{
|
||||
UNICODE name[256];
|
||||
UNICODE name[261];
|
||||
|
||||
struct dirent l_dir; /* this file's dir entry image */
|
||||
|
||||
|
@ -13,10 +13,9 @@ typedef struct lfn_inode FAR * lfn_inode_ptr;
|
|||
COUNT lfn_allocate_inode(VOID);
|
||||
COUNT lfn_free_inode(COUNT handle);
|
||||
|
||||
COUNT lfn_setup_inode(COUNT handle, CLUSTER dirstart, ULONG diroff);
|
||||
COUNT lfn_setup_inode(COUNT handle, ULONG dirstart, ULONG diroff);
|
||||
|
||||
COUNT lfn_create_entries(COUNT handle, lfn_inode_ptr lip);
|
||||
COUNT lfn_remove_entries(COUNT handle);
|
||||
|
||||
COUNT lfn_dir_read(COUNT handle, lfn_inode_ptr lip);
|
||||
COUNT lfn_dir_write(COUNT handle);
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
#AFLAGS = /Mx /Dmem$(MODEL)=1
|
||||
#LIBFLAGS = /c
|
||||
|
||||
OBJS = devend.obj floppy.obj getvec.obj timer.obj rdpcclk.obj rdatclk.obj \
|
||||
OBJS = devend.obj floppy.obj getvec.obj rdpcclk.obj rdatclk.obj \
|
||||
wrpcclk.obj wratclk.obj
|
||||
|
||||
LIBOBJS= +devend +floppy +getvec +timer +rdpcclk +rdatclk +wrpcclk +wratclk
|
||||
LIBOBJS= +devend +floppy +getvec +rdpcclk +rdatclk +wrpcclk +wratclk
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -44,7 +44,13 @@ _ReadPCClock:
|
|||
mov bx,[bx+2]
|
||||
mov [bx],dx
|
||||
mov [bx+2],cx
|
||||
cbw
|
||||
extern _DaysSinceEpoch ; ; update days if necessary
|
||||
|
||||
mov ah,0
|
||||
|
||||
add word [_DaysSinceEpoch ],ax ; *some* BIOS's accumulate several days
|
||||
adc word [_DaysSinceEpoch+2],0 ;
|
||||
|
||||
ret
|
||||
|
||||
; Log: rdpcclk.asm,v
|
||||
|
|
|
@ -1,144 +0,0 @@
|
|||
;
|
||||
; File:
|
||||
; timer.asm
|
||||
; Description:
|
||||
; Set a single timer and check when expired
|
||||
;
|
||||
; Copyright (c) 1995
|
||||
; Pasquale J. Villani
|
||||
; All Rights Reserved
|
||||
;
|
||||
; This file is part of DOS-C.
|
||||
;
|
||||
; DOS-C is free software; you can redistribute it and/or
|
||||
; modify it under the terms of the GNU General Public License
|
||||
; as published by the Free Software Foundation; either version
|
||||
; 2, or (at your option) any later version.
|
||||
;
|
||||
; DOS-C is distributed in the hope that it will be useful, but
|
||||
; WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
|
||||
; the GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public
|
||||
; License along with DOS-C; see the file COPYING. If not,
|
||||
; write to the Free Software Foundation, 675 Mass Ave,
|
||||
; Cambridge, MA 02139, USA.
|
||||
;
|
||||
; $Header$
|
||||
;
|
||||
|
||||
%include "..\kernel\segs.inc"
|
||||
|
||||
segment HMA_TEXT
|
||||
|
||||
;
|
||||
; void tmark()
|
||||
;
|
||||
global _tmark
|
||||
_tmark:
|
||||
xor ah,ah
|
||||
int 01aH ; get current time in ticks
|
||||
xor ah,ah
|
||||
mov word [LastTime],dx ; and store it
|
||||
mov word [LastTime+2],cx
|
||||
ret
|
||||
|
||||
|
||||
;
|
||||
; int tdelay(Ticks)
|
||||
;
|
||||
global _tdelay
|
||||
_tdelay:
|
||||
push bp
|
||||
mov bp,sp
|
||||
xor ah,ah
|
||||
int 01aH ; get current time in ticks
|
||||
xor ah,ah
|
||||
mov word bx,dx ; and save it to a local variable
|
||||
; "Ticks" (cx:bx)
|
||||
;
|
||||
; Do a c equivalent of:
|
||||
;
|
||||
; return Now >= (LastTime + Ticks);
|
||||
;
|
||||
mov ax,word [LastTime+2]
|
||||
mov dx,word [LastTime]
|
||||
add dx,word [bp+4]
|
||||
adc ax,word [bp+6]
|
||||
cmp ax,cx
|
||||
mov ax,0 ; mov does not affect flags
|
||||
ja short tdel_1
|
||||
jne short tdel_2
|
||||
cmp dx,bx
|
||||
ja short tdel_1
|
||||
tdel_2:
|
||||
inc ax ; True return
|
||||
tdel_1:
|
||||
pop bp ; False return
|
||||
ret
|
||||
|
||||
|
||||
;
|
||||
; void twait(Ticks)
|
||||
;
|
||||
global _twait
|
||||
_twait:
|
||||
push bp
|
||||
mov bp,sp
|
||||
call _tmark ; mark a start
|
||||
;
|
||||
; c equivalent
|
||||
; do
|
||||
; GetNowTime(&Now);
|
||||
; while((LastTime + Ticks) < Now);
|
||||
twait_1:
|
||||
xor ah,ah
|
||||
int 01aH
|
||||
xor ah,ah ; do GetNowTime
|
||||
mov bx,dx ; and save it to "Now" (cx:bx)
|
||||
;
|
||||
; do comparison
|
||||
;
|
||||
mov ax,word [LastTime+2]
|
||||
mov dx,word [LastTime]
|
||||
add dx,word [bp+4]
|
||||
adc ax,word [bp+6]
|
||||
cmp ax,cx
|
||||
jb short twait_1
|
||||
jne short twait_2
|
||||
cmp dx,bx
|
||||
jb short twait_1
|
||||
twait_2:
|
||||
pop bp
|
||||
ret
|
||||
|
||||
segment _BSS
|
||||
LastTime: resd 1
|
||||
|
||||
; Log: timer.asm,v
|
||||
; Revision 1.3 1999/08/10 17:21:08 jprice
|
||||
; ror4 2011-01 patch
|
||||
;
|
||||
; Revision 1.2 1999/03/29 17:08:31 jprice
|
||||
; ror4 changes
|
||||
;
|
||||
; Revision 1.1.1.1 1999/03/29 15:40:34 jprice
|
||||
; New version without IPL.SYS
|
||||
;
|
||||
; Revision 1.2 1999/01/22 04:16:39 jprice
|
||||
; Formating
|
||||
;
|
||||
; Revision 1.1.1.1 1999/01/20 05:51:00 jprice
|
||||
; Imported sources
|
||||
;
|
||||
;
|
||||
; Rev 1.2 29 Aug 1996 13:07:12 patv
|
||||
;Bug fixes for v0.91b
|
||||
;
|
||||
; Rev 1.1 01 Sep 1995 18:50:42 patv
|
||||
;Initial GPL release.
|
||||
;
|
||||
; Rev 1.0 02 Jul 1995 8:01:04 patv
|
||||
;Initial revision.
|
||||
;
|
16
hdr/device.h
16
hdr/device.h
|
@ -455,6 +455,22 @@ typedef bpb FAR *bpbptr;
|
|||
typedef BYTE FAR *byteptr;
|
||||
typedef struct dhdr FAR *dhdrptr;
|
||||
|
||||
extern request /* I/O Request packets */
|
||||
ASM CharReqHdr, ASM IoReqHdr, ASM MediaReqHdr;
|
||||
|
||||
/* dsk.c */
|
||||
COUNT ASMCFUNC FAR blk_driver(rqptr rp);
|
||||
ddt * getddt(int dev);
|
||||
|
||||
/* error.c */
|
||||
COUNT char_error(request * rq, struct dhdr FAR * lpDevice);
|
||||
COUNT block_error(request * rq, COUNT nDrive, struct dhdr FAR * lpDevice);
|
||||
/* sysclk.c */
|
||||
WORD ASMCFUNC FAR clk_driver(rqptr rp);
|
||||
|
||||
/* execrh.asm */
|
||||
WORD ASMCFUNC execrh(request FAR *, struct dhdr FAR *);
|
||||
|
||||
/*
|
||||
* end of device.h
|
||||
*/
|
||||
|
|
22
hdr/fat.h
22
hdr/fat.h
|
@ -97,14 +97,14 @@ struct dirent {
|
|||
};
|
||||
|
||||
struct lfn_entry {
|
||||
UBYTE lfn_id;
|
||||
UNICODE lfn_name0_4[5];
|
||||
UBYTE lfn_attrib;
|
||||
UBYTE lfn_id; /* Sequence number for this LFN entry */
|
||||
UNICODE lfn_name0_4[5]; /* First 5 characters of LFN */
|
||||
UBYTE lfn_attrib; /* LFN attribute, should be D_LFN == 0x0f */
|
||||
UBYTE lfn_reserved1;
|
||||
UBYTE lfn_checksum;
|
||||
UNICODE lfn_name5_10[6];
|
||||
UBYTE lfn_checksum; /* Checksum for the corresponding 8.3 name */
|
||||
UNICODE lfn_name5_10[6]; /* Next 6 characters of LFN */
|
||||
UWORD lfn_reserved2;
|
||||
UNICODE lfn_name11_12[2];
|
||||
UNICODE lfn_name11_12[2]; /* Last 2 characters of LFN */
|
||||
};
|
||||
|
||||
/* */
|
||||
|
@ -140,16 +140,6 @@ struct lfn_entry {
|
|||
|
||||
#define DIRENT_SIZE 32
|
||||
|
||||
struct lfn_inode {
|
||||
UNICODE name[256];
|
||||
|
||||
struct dirent l_dir;
|
||||
|
||||
ULONG l_diroff; /* offset of the dir entry */
|
||||
};
|
||||
|
||||
typedef struct lfn_inode FAR *lfn_inode_ptr;
|
||||
|
||||
/*
|
||||
* Log: fat.h,v
|
||||
*
|
||||
|
|
23
hdr/fnode.h
23
hdr/fnode.h
|
@ -63,22 +63,17 @@ struct f_node {
|
|||
UWORD f_boff; /* the byte in the cluster */
|
||||
};
|
||||
|
||||
#if 0
|
||||
struct lfn_inode {
|
||||
UNICODE name[255];
|
||||
|
||||
struct dirent l_dir; /* this file's dir entry image */
|
||||
|
||||
ULONG l_diroff; /* offset of the dir entry */
|
||||
CLUSTER l_dirstart; /* the starting cluster of dir */
|
||||
/* when dir is not root */
|
||||
};
|
||||
|
||||
typedef struct lfn_inode FAR *lfn_inode_ptr;
|
||||
#endif
|
||||
|
||||
typedef struct f_node *f_node_ptr;
|
||||
|
||||
struct lfn_inode {
|
||||
UNICODE l_name[261]; /* Long file name string */
|
||||
/* If the string is empty, */
|
||||
/* then file has the 8.3 name */
|
||||
struct dirent l_dir; /* Directory entry image */
|
||||
ULONG l_diroff; /* Current directory entry offset */
|
||||
};
|
||||
|
||||
typedef struct lfn_inode FAR * lfn_inode_ptr;
|
||||
/*
|
||||
* Log: fnode.h,v
|
||||
*
|
||||
|
|
|
@ -24,4 +24,3 @@ typedef struct _KernelConfig {
|
|||
unsigned char ForceLBA;
|
||||
unsigned char GlobalEnableLBAsupport; /* = 0 --> disable LBA support */
|
||||
} KernelConfig;
|
||||
extern struct _KernelConfig FAR LowKernelConfig;
|
||||
|
|
|
@ -450,7 +450,7 @@ struct nlsInfoBlock { /* This block contains all information
|
|||
};
|
||||
|
||||
extern struct nlsInfoBlock nlsInfo;
|
||||
extern struct nlsPackage nlsPackageHardcoded;
|
||||
extern struct nlsPackage ASM nlsPackageHardcoded;
|
||||
/* These are the "must have" tables within the hard coded NLS pkg */
|
||||
extern struct nlsFnamTerm nlsFnameTermHardcoded;
|
||||
extern struct nlsDBCS nlsDBCSHardcoded;
|
||||
|
|
13
hdr/portab.h
13
hdr/portab.h
|
@ -99,6 +99,7 @@ anyone knows a _portable_ way to create nice errors ? ?
|
|||
have a certain calling standard. These are declared
|
||||
as 'ASMCFUNC', and is (and will be ?-) cdecl */
|
||||
#define ASMCFUNC cdecl
|
||||
#define ASM ASMCFUNC
|
||||
#ifdef MC68K
|
||||
#define far /* No far type */
|
||||
#define interrupt /* No interrupt type */
|
||||
|
@ -174,7 +175,11 @@ typedef unsigned short CLUSTER;
|
|||
#endif
|
||||
typedef unsigned short UNICODE;
|
||||
|
||||
#define STATIC /* local calls inside module */
|
||||
#ifdef STATICS
|
||||
#define STATIC static /* local calls inside module */
|
||||
#else
|
||||
#define STATIC
|
||||
#endif
|
||||
|
||||
#ifdef UNIX
|
||||
typedef char FAR *ADDRESS;
|
||||
|
@ -191,7 +196,11 @@ typedef signed long LONG;
|
|||
/* General far pointer macros */
|
||||
#ifdef I86
|
||||
#ifndef MK_FP
|
||||
#ifdef __WATCOMC__
|
||||
#define MK_FP(__s,__o) (((unsigned short)(__s)):>((void __near *)(__o)))
|
||||
#else
|
||||
#define MK_FP(seg,ofs) ((VOID far *)(((ULONG)(seg)<<16)|(UWORD)(ofs)))
|
||||
#endif
|
||||
#define FP_SEG(fp) ((UWORD)((ULONG)(VOID FAR *)(fp)>>16))
|
||||
#define FP_OFF(fp) ((UWORD)(fp))
|
||||
#endif
|
||||
|
@ -203,6 +212,8 @@ typedef signed long LONG;
|
|||
#define FP_OFF(fp) (fp)
|
||||
#endif
|
||||
|
||||
typedef VOID (FAR ASMCFUNC * intvec) ();
|
||||
|
||||
/*
|
||||
this suppresses the warning
|
||||
unreferenced parameter 'x'
|
||||
|
|
|
@ -68,10 +68,10 @@ typedef struct {
|
|||
|
||||
/* CP/M-like entry point */
|
||||
UBYTE ps_farcall; /* 05 far call opcode */
|
||||
VOID(FAR * ps_reentry) (); /* 06 re-entry point */
|
||||
VOID(interrupt FAR * ps_isv22) (), /* 0a terminate address */
|
||||
(interrupt FAR * ps_isv23) (), /* 0e break address */
|
||||
(interrupt FAR * ps_isv24) (); /* 12 critical error address */
|
||||
VOID(FAR ASMCFUNC * ps_reentry) (); /* 06 re-entry point */
|
||||
intvec ps_isv22, /* 0a terminate address */
|
||||
ps_isv23, /* 0e break address */
|
||||
ps_isv24; /* 12 critical error address */
|
||||
UWORD ps_parent; /* 16 parent psp segment */
|
||||
UBYTE ps_files[20]; /* 18 file table - 0xff is unused */
|
||||
UWORD ps_environ; /* 2c environment paragraph */
|
||||
|
|
|
@ -43,8 +43,8 @@ static BYTE *date_hRcsId =
|
|||
|
||||
#define REVISION_MAJOR 1
|
||||
#define REVISION_MINOR 1
|
||||
#define REVISION_SEQ 25
|
||||
#define BUILD "2025"
|
||||
#define SUB_BUILD "c"
|
||||
#define KERNEL_VERSION_STRING "1.1.25c" /*#REVISION_MAJOR "." #REVISION_MINOR "." #REVISION_SEQ */
|
||||
#define KERNEL_BUILD_STRING "2025c" /*#BUILD SUB_BUILD */
|
||||
#define REVISION_SEQ 26
|
||||
#define BUILD "2026"
|
||||
#define SUB_BUILD "test"
|
||||
#define KERNEL_VERSION_STRING "1.1.26test" /*#REVISION_MAJOR "." #REVISION_MINOR "." #REVISION_SEQ */
|
||||
#define KERNEL_BUILD_STRING "2026test" /*#BUILD SUB_BUILD */
|
||||
|
|
|
@ -80,3 +80,5 @@ struct xdpbforformat {
|
|||
} setroot;
|
||||
} xdff_f;
|
||||
};
|
||||
|
||||
COUNT DosGetExtFree(BYTE FAR * DriveString, struct xfreespace FAR * xfsp);
|
||||
|
|
|
@ -46,36 +46,11 @@ static BYTE *blockioRcsId =
|
|||
/* */
|
||||
/* Initialize the buffer structure */
|
||||
/* */
|
||||
/* XXX: This should go into `INIT_TEXT'. -- ror4 */
|
||||
|
||||
/* this code moved to CONFIG.C
|
||||
VOID FAR reloc_call_init_buffers(void)
|
||||
{
|
||||
REG WORD i;
|
||||
REG WORD count;
|
||||
|
||||
printf("init_buffers %d buffers at %p\n",Config.cfgBuffers, (void FAR*)&buffers[0]);
|
||||
|
||||
for (i = 0; i < Config.cfgBuffers; ++i)
|
||||
{
|
||||
struct buffer FAR *pbuffer = &buffers[i];
|
||||
|
||||
pbuffer->b_unit = 0;
|
||||
pbuffer->b_flag = 0;
|
||||
pbuffer->b_blkno = 0;
|
||||
pbuffer->b_copies = 0;
|
||||
pbuffer->b_offset = 0;
|
||||
if (i < (Config.cfgBuffers - 1))
|
||||
pbuffer->b_next = pbuffer + 1;
|
||||
else
|
||||
pbuffer->b_next = NULL;
|
||||
}
|
||||
firstbuf = &buffers[0];
|
||||
}
|
||||
*/
|
||||
/* Extract the block number from a buffer structure. */
|
||||
|
||||
#if 0 /*TE*/
|
||||
ULONG getblkno(struct buffer FAR * bp)
|
||||
STATIC ULONG getblkno(struct buffer FAR * bp)
|
||||
{
|
||||
if (bp->b_blkno == 0xffffu)
|
||||
return bp->b_huge_blkno;
|
||||
|
@ -89,7 +64,7 @@ VOID FAR reloc_call_init_buffers(void)
|
|||
/* Set the block number of a buffer structure. (The caller should */
|
||||
/* set the unit number before calling this function.) */
|
||||
#if 0 /*TE*/
|
||||
VOID setblkno(struct buffer FAR * bp, ULONG blkno)
|
||||
STATIC VOID setblkno(struct buffer FAR * bp, ULONG blkno)
|
||||
{
|
||||
if (blkno >= 0xffffu)
|
||||
{
|
||||
|
|
|
@ -38,11 +38,10 @@ static BYTE *charioRcsId =
|
|||
#include "globals.h"
|
||||
|
||||
#ifdef PROTO
|
||||
static VOID kbfill(keyboard FAR *, UCOUNT, BOOL, UWORD *);
|
||||
STATIC VOID kbfill(keyboard FAR *, UCOUNT, BOOL, UWORD *);
|
||||
struct dhdr FAR *finddev(UWORD attr_mask);
|
||||
|
||||
#else
|
||||
static VOID kbfill();
|
||||
STATIC VOID kbfill();
|
||||
struct dhdr FAR *finddev();
|
||||
#endif
|
||||
|
||||
|
@ -267,7 +266,7 @@ VOID KbdFlush(void)
|
|||
execrh((request FAR *) & CharReqHdr, syscon);
|
||||
}
|
||||
|
||||
static VOID kbfill(keyboard FAR * kp, UCOUNT c, BOOL ctlf, UWORD * vp)
|
||||
STATIC VOID kbfill(keyboard FAR * kp, UCOUNT c, BOOL ctlf, UWORD * vp)
|
||||
{
|
||||
if (kp->kb_count >= kp->kb_size)
|
||||
{
|
||||
|
|
414
kernel/config.c
414
kernel/config.c
|
@ -59,35 +59,35 @@ static BYTE *RcsId =
|
|||
*/
|
||||
extern f_node_ptr DOSFAR f_nodes; /* pointer to the array */
|
||||
extern UWORD DOSFAR f_nodes_cnt, /* number of allocated f_nodes */
|
||||
DOSFAR first_mcb; /* Start of user memory */
|
||||
DOSFAR ASM first_mcb; /* Start of user memory */
|
||||
|
||||
extern UBYTE DOSFAR lastdrive, DOSFAR nblkdev, DOSFAR mem_access_mode,
|
||||
DOSFAR uppermem_link;
|
||||
extern UBYTE DOSFAR ASM lastdrive, DOSFAR ASM nblkdev, DOSFAR ASM mem_access_mode,
|
||||
DOSFAR ASM uppermem_link;
|
||||
extern struct dhdr
|
||||
DOSTEXTFAR blk_dev, /* Block device (Disk) driver */
|
||||
DOSFAR nul_dev;
|
||||
extern struct buffer FAR *DOSFAR firstbuf; /* head of buffers linked list */
|
||||
DOSTEXTFAR ASM blk_dev, /* Block device (Disk) driver */
|
||||
DOSFAR ASM nul_dev;
|
||||
extern struct buffer FAR *DOSFAR ASM firstbuf; /* head of buffers linked list */
|
||||
|
||||
extern struct dpb FAR *DOSFAR DPBp;
|
||||
extern struct dpb FAR *DOSFAR ASM DPBp;
|
||||
/* First drive Parameter Block */
|
||||
extern cdstbl FAR *DOSFAR CDSp;
|
||||
extern cdstbl FAR *DOSFAR ASM CDSp;
|
||||
/* Current Directory Structure */
|
||||
extern sfttbl FAR *DOSFAR sfthead;
|
||||
extern sfttbl FAR *DOSFAR ASM sfthead;
|
||||
/* System File Table head */
|
||||
extern sfttbl FAR *DOSFAR FCBp;
|
||||
extern sfttbl FAR *DOSFAR ASM FCBp;
|
||||
|
||||
extern BYTE DOSFAR VgaSet, DOSFAR _HMATextAvailable, /* first byte of available CODE area */
|
||||
extern BYTE DOSFAR ASM VgaSet, DOSFAR _HMATextAvailable, /* first byte of available CODE area */
|
||||
FAR _HMATextStart[], /* first byte of HMAable CODE area */
|
||||
FAR _HMATextEnd[], DOSFAR break_ena, /* break enabled flag */
|
||||
FAR _HMATextEnd[], DOSFAR ASM break_ena, /* break enabled flag */
|
||||
DOSFAR os_major, /* major version number */
|
||||
DOSFAR os_minor, /* minor version number */
|
||||
DOSFAR switchar, DOSFAR _InitTextStart, /* first available byte of ram */
|
||||
DOSFAR ASM switchar, DOSFAR _InitTextStart, /* first available byte of ram */
|
||||
DOSFAR ReturnAnyDosVersionExpected;
|
||||
|
||||
extern UWORD DOSFAR ram_top, /* How much ram in Kbytes */
|
||||
extern UWORD DOSFAR ASM ram_top, /* How much ram in Kbytes */
|
||||
|
||||
DOSFAR UMB_top,
|
||||
DOSFAR umb_start, DOSFAR uppermem_root, DOSFAR LoL_nbuffers;
|
||||
DOSFAR ASM UMB_top,
|
||||
DOSFAR ASM umb_start, DOSFAR ASM uppermem_root, DOSFAR ASM LoL_nbuffers;
|
||||
|
||||
struct config Config = {
|
||||
NUMBUFF,
|
||||
|
@ -124,71 +124,87 @@ STATIC BYTE szBuf[256] = { 0 };
|
|||
|
||||
BYTE singleStep = FALSE; /* F8 processing */
|
||||
BYTE SkipAllConfig = FALSE; /* F5 processing */
|
||||
BYTE askThisSingleCommand = FALSE; /* ?device= device?= */
|
||||
BYTE askThisSingleCommand = FALSE; /* ?device= device?= */
|
||||
BYTE DontAskThisSingleCommand = FALSE; /* !files= */
|
||||
|
||||
INIT VOID zumcb_init(UCOUNT seg, UWORD size);
|
||||
INIT VOID mumcb_init(UCOUNT seg, UWORD size);
|
||||
COUNT MenuTimeout = -1;
|
||||
BYTE MenuSelected = '2';
|
||||
BYTE MenuLine = 0;
|
||||
UCOUNT Menus = 0;
|
||||
|
||||
INIT VOID Config_Buffers(BYTE * pLine);
|
||||
INIT VOID sysScreenMode(BYTE * pLine);
|
||||
INIT VOID sysVersion(BYTE * pLine);
|
||||
INIT VOID CfgBreak(BYTE * pLine);
|
||||
INIT VOID Device(BYTE * pLine);
|
||||
INIT VOID DeviceHigh(BYTE * pLine);
|
||||
INIT VOID Files(BYTE * pLine);
|
||||
INIT VOID Fcbs(BYTE * pLine);
|
||||
INIT VOID CfgLastdrive(BYTE * pLine);
|
||||
INIT BOOL LoadDevice(BYTE * pLine, COUNT top, COUNT mode);
|
||||
INIT VOID Dosmem(BYTE * pLine);
|
||||
INIT VOID Country(BYTE * pLine);
|
||||
INIT VOID InitPgm(BYTE * pLine);
|
||||
INIT VOID InitPgmHigh(BYTE * pLine);
|
||||
INIT VOID CfgSwitchar(BYTE * pLine);
|
||||
INIT VOID CfgFailure(BYTE * pLine);
|
||||
INIT VOID Stacks(BYTE * pLine);
|
||||
INIT VOID SetAnyDos(BYTE * pLine);
|
||||
INIT VOID Numlock(BYTE * pLine);
|
||||
INIT BYTE *GetNumArg(BYTE * pLine, COUNT * pnArg);
|
||||
INIT BYTE *GetStringArg(BYTE * pLine, BYTE * pszString);
|
||||
INIT struct dhdr FAR *linkdev(struct dhdr FAR * dhp);
|
||||
INIT UWORD initdev(struct dhdr FAR * dhp, BYTE FAR * cmdTail);
|
||||
INIT int SkipLine(char *pLine);
|
||||
INIT char *stristr(char *s1, char *s2);
|
||||
INIT COUNT strcasecmp(REG BYTE * d, REG BYTE * s);
|
||||
STATIC VOID zumcb_init(UCOUNT seg, UWORD size);
|
||||
STATIC VOID mumcb_init(UCOUNT seg, UWORD size);
|
||||
|
||||
extern void HMAconfig(int finalize);
|
||||
STATIC VOID Config_Buffers(BYTE * pLine);
|
||||
STATIC VOID sysScreenMode(BYTE * pLine);
|
||||
STATIC VOID sysVersion(BYTE * pLine);
|
||||
STATIC VOID CfgBreak(BYTE * pLine);
|
||||
STATIC VOID Device(BYTE * pLine);
|
||||
STATIC VOID DeviceHigh(BYTE * pLine);
|
||||
STATIC VOID Files(BYTE * pLine);
|
||||
STATIC VOID Fcbs(BYTE * pLine);
|
||||
STATIC VOID CfgLastdrive(BYTE * pLine);
|
||||
STATIC BOOL LoadDevice(BYTE * pLine, COUNT top, COUNT mode);
|
||||
STATIC VOID Dosmem(BYTE * pLine);
|
||||
STATIC VOID Country(BYTE * pLine);
|
||||
STATIC VOID InitPgm(BYTE * pLine);
|
||||
STATIC VOID InitPgmHigh(BYTE * pLine);
|
||||
STATIC VOID CfgSwitchar(BYTE * pLine);
|
||||
STATIC VOID CfgFailure(BYTE * pLine);
|
||||
STATIC VOID CfgIgnore(BYTE * pLine);
|
||||
STATIC VOID CfgMenu(BYTE * pLine);
|
||||
STATIC VOID DoMenu(void);
|
||||
STATIC VOID CfgMenuDefault(BYTE * pLine);
|
||||
|
||||
STATIC VOID Stacks(BYTE * pLine);
|
||||
STATIC VOID SetAnyDos(BYTE * pLine);
|
||||
STATIC VOID Numlock(BYTE * pLine);
|
||||
STATIC BYTE * GetNumArg(BYTE * pLine, COUNT * pnArg);
|
||||
BYTE *GetStringArg(BYTE * pLine, BYTE * pszString);
|
||||
STATIC int SkipLine(char *pLine);
|
||||
#if 0
|
||||
STATIC char * stristr(char *s1, char *s2);
|
||||
#endif
|
||||
STATIC COUNT strcasecmp(REG BYTE * d, REG BYTE * s);
|
||||
|
||||
void HMAconfig(int finalize);
|
||||
VOID config_init_buffers(COUNT anzBuffers); /* from BLOCKIO.C */
|
||||
|
||||
INIT STATIC VOID FAR *AlignParagraph(VOID FAR * lpPtr);
|
||||
STATIC VOID FAR * AlignParagraph(VOID FAR * lpPtr);
|
||||
#ifndef I86
|
||||
#define AlignParagraph(x) (x)
|
||||
#endif
|
||||
|
||||
#define EOF 0x1a
|
||||
|
||||
INIT struct table *LookUp(struct table *p, BYTE * token);
|
||||
STATIC struct table * LookUp(struct table *p, BYTE * token);
|
||||
|
||||
typedef void config_sys_func_t(BYTE * pLine);
|
||||
|
||||
struct table {
|
||||
BYTE *entry;
|
||||
BYTE pass;
|
||||
VOID(*func) (BYTE * pLine);
|
||||
config_sys_func_t *func;
|
||||
};
|
||||
|
||||
STATIC struct table commands[] = {
|
||||
/* rem is never executed by locking out pass */
|
||||
{"REM", 0, CfgIgnore},
|
||||
{";", 0, CfgIgnore},
|
||||
|
||||
{"MENUDEFAULT", 0, CfgMenuDefault},
|
||||
{"MENU", 0, CfgMenu}, /* lines to print in pass 0 */
|
||||
{"ECHO", 2, CfgMenu}, /* lines to print in pass 2 - when devices are loaded */
|
||||
|
||||
{"BREAK", 1, CfgBreak},
|
||||
{"BUFFERS", 1, Config_Buffers},
|
||||
{"COMMAND", 1, InitPgm},
|
||||
{"COUNTRY", 1, Country},
|
||||
{"DEVICE", 2, Device},
|
||||
{"DEVICEHIGH", 2, DeviceHigh},
|
||||
{"DOS", 1, Dosmem},
|
||||
{"FCBS", 1, Fcbs},
|
||||
{"FILES", 1, Files},
|
||||
{"LASTDRIVE", 1, CfgLastdrive},
|
||||
{"NUMLOCK", 1, Numlock},
|
||||
/* rem is never executed by locking out pass */
|
||||
{"REM", 0, CfgFailure},
|
||||
{";", 0, CfgFailure},
|
||||
{"SHELL", 1, InitPgm},
|
||||
{"SHELLHIGH", 1, InitPgmHigh},
|
||||
{"STACKS", 1, Stacks},
|
||||
|
@ -196,13 +212,17 @@ STATIC struct table commands[] = {
|
|||
{"SCREEN", 1, sysScreenMode}, /* JPP */
|
||||
{"VERSION", 1, sysVersion}, /* JPP */
|
||||
{"ANYDOS", 1, SetAnyDos}, /* JPP */
|
||||
|
||||
{"DEVICE", 2, Device},
|
||||
{"DEVICEHIGH", 2, DeviceHigh},
|
||||
/* {"INSTALL", 3, install}, would go here */
|
||||
|
||||
/* default action */
|
||||
{"", -1, CfgFailure}
|
||||
};
|
||||
|
||||
#ifndef KDB
|
||||
INIT BYTE FAR *KernelAlloc(WORD nBytes);
|
||||
INIT BYTE FAR *KernelAllocDma(WORD);
|
||||
BYTE FAR * KernelAlloc(WORD nBytes);
|
||||
#endif
|
||||
|
||||
BYTE *pLineStart = 0;
|
||||
|
@ -213,7 +233,7 @@ BYTE HMAState = 0;
|
|||
#define HMA_DONE 2 /* Moved kernel to HMA */
|
||||
#define HMA_LOW 3 /* Definitely LOW */
|
||||
|
||||
void FAR *ConfigAlloc(COUNT bytes)
|
||||
STATIC void FAR* ConfigAlloc(COUNT bytes)
|
||||
{
|
||||
VOID FAR *p;
|
||||
|
||||
|
@ -229,10 +249,8 @@ void FAR *ConfigAlloc(COUNT bytes)
|
|||
|
||||
/* Do first time initialization. Store last so that we can reset it */
|
||||
/* later. */
|
||||
INIT void PreConfig(void)
|
||||
void PreConfig(void)
|
||||
{
|
||||
/* Set pass number */
|
||||
nPass = 0;
|
||||
VgaSet = 0;
|
||||
UmbState = 0;
|
||||
|
||||
|
@ -240,7 +258,7 @@ INIT void PreConfig(void)
|
|||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
extern BYTE FAR internal_data[];
|
||||
extern BYTE FAR ASM internal_data[];
|
||||
printf("SDA located at 0x%p\n", internal_data);
|
||||
}
|
||||
#endif
|
||||
|
@ -307,17 +325,14 @@ INIT void PreConfig(void)
|
|||
|
||||
/* We expect ram_top as Kbytes, so convert to paragraphs */
|
||||
mcb_init(first_mcb, ram_top * 64 - first_mcb - 1);
|
||||
nPass = 1;
|
||||
}
|
||||
|
||||
/* Do second pass initialization. */
|
||||
/* Also, run config.sys to load drivers. */
|
||||
INIT void PostConfig(void)
|
||||
void PostConfig(void)
|
||||
{
|
||||
/* close all (device) files */
|
||||
|
||||
/* Set pass number */
|
||||
nPass = 2;
|
||||
/* compute lastdrive ... */
|
||||
lastdrive = Config.cfgLastdrive;
|
||||
if (lastdrive < nblkdev)
|
||||
|
@ -387,7 +402,7 @@ INIT void PostConfig(void)
|
|||
}
|
||||
|
||||
/* This code must be executed after device drivers has been loaded */
|
||||
INIT VOID configDone(VOID)
|
||||
VOID configDone(VOID)
|
||||
{
|
||||
if (HMAState != HMA_DONE)
|
||||
{
|
||||
|
@ -423,20 +438,21 @@ INIT VOID configDone(VOID)
|
|||
if (UmbState == 1)
|
||||
{
|
||||
|
||||
UCOUNT umr_new = FP_SEG(upBase) + ((FP_OFF(upBase) + 0x0f) >> 4);
|
||||
|
||||
mumcb_init(ram_top * 64 - 1, umb_start - 64 * ram_top);
|
||||
/* Check if any devices were loaded in umb */
|
||||
if (umb_start != FP_SEG(upBase))
|
||||
{
|
||||
/* make last block normal with SC for the devices */
|
||||
|
||||
UCOUNT umr_new = FP_SEG(upBase) + ((FP_OFF(upBase) + 0x0f) >> 4);
|
||||
|
||||
mumcb_init(uppermem_root, umr_new - uppermem_root - 1);
|
||||
|
||||
uppermem_root = umr_new;
|
||||
zumcb_init(uppermem_root, (umb_start + UMB_top) - uppermem_root - 1);
|
||||
zumcb_init(umr_new, (umb_start + UMB_top) - umr_new - 1);
|
||||
upBase += 16;
|
||||
}
|
||||
else
|
||||
umr_new = FP_SEG(upBase);
|
||||
|
||||
{
|
||||
/* are there any more UMB's ??
|
||||
|
@ -454,12 +470,12 @@ INIT VOID configDone(VOID)
|
|||
|
||||
UCOUNT umb_seg, umb_size, umbz_root;
|
||||
|
||||
umbz_root = uppermem_root;
|
||||
umbz_root = umr_new;
|
||||
|
||||
if (UMB_get_largest(&umb_seg, &umb_size))
|
||||
{
|
||||
|
||||
mcb_init(umbz_root, (umb_start + UMB_top) - uppermem_root - 1);
|
||||
mcb_init(umbz_root, (umb_start + UMB_top) - umr_new - 1);
|
||||
|
||||
/* change UMB 'Z' to 'M' */
|
||||
((mcb FAR *) MK_FP(umbz_root, 0))->m_type = 'M';
|
||||
|
@ -488,12 +504,16 @@ INIT VOID configDone(VOID)
|
|||
|
||||
}
|
||||
|
||||
INIT VOID DoConfig(VOID)
|
||||
VOID DoConfig(int pass)
|
||||
{
|
||||
COUNT nFileDesc;
|
||||
BYTE *pLine;
|
||||
BOOL bEof;
|
||||
|
||||
|
||||
/* Set pass number */
|
||||
nPass = pass;
|
||||
|
||||
/* Check to see if we have a config.sys file. If not, just */
|
||||
/* exit since we don't force the user to have one. */
|
||||
if ((nFileDesc = open("fdconfig.sys", 0)) >= 0)
|
||||
|
@ -570,9 +590,17 @@ INIT VOID DoConfig(VOID)
|
|||
|
||||
if (pEntry->pass >= 0 && pEntry->pass != nPass)
|
||||
continue;
|
||||
|
||||
if (SkipLine(pLineStart)) /* F5/F8 processing */
|
||||
|
||||
if (nPass == 0) /* pass 0 always executed (rem Menu prompt) */
|
||||
{
|
||||
(*(pEntry->func)) (pLine);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SkipLine(pLineStart)) /* F5/F8 processing */
|
||||
continue;
|
||||
}
|
||||
|
||||
pLine = skipwh(pLine);
|
||||
|
||||
|
@ -603,10 +631,15 @@ INIT VOID DoConfig(VOID)
|
|||
}
|
||||
|
||||
}
|
||||
close(nFileDesc);
|
||||
close(nFileDesc);
|
||||
|
||||
if (nPass == 0)
|
||||
{
|
||||
DoMenu();
|
||||
}
|
||||
}
|
||||
|
||||
INIT struct table *LookUp(struct table *p, BYTE * token)
|
||||
STATIC struct table * LookUp(struct table *p, BYTE * token)
|
||||
{
|
||||
while (*(p->entry) != '\0')
|
||||
{
|
||||
|
@ -665,7 +698,7 @@ UWORD GetBiosKey(int timeout)
|
|||
return 0xffff;
|
||||
}
|
||||
|
||||
INIT BOOL SkipLine(char *pLine)
|
||||
STATIC BOOL SkipLine(char *pLine)
|
||||
{
|
||||
short key;
|
||||
|
||||
|
@ -702,6 +735,16 @@ INIT BOOL SkipLine(char *pLine)
|
|||
if (SkipAllConfig)
|
||||
return TRUE;
|
||||
|
||||
/* 1?device=CDROM.SYS */
|
||||
/* 2?device=OAKROM.SYS */
|
||||
/* 3?device=EMM386.EXE NOEMS */
|
||||
if (MenuLine != 0 &&
|
||||
MenuSelected != MenuLine)
|
||||
return TRUE;
|
||||
|
||||
if (DontAskThisSingleCommand) /* !files=30 */
|
||||
return FALSE;
|
||||
|
||||
if (!askThisSingleCommand && !singleStep)
|
||||
return FALSE;
|
||||
|
||||
|
@ -743,7 +786,7 @@ INIT BOOL SkipLine(char *pLine)
|
|||
|
||||
}
|
||||
|
||||
INIT BYTE *GetNumArg(BYTE * pLine, COUNT * pnArg)
|
||||
STATIC BYTE * GetNumArg(BYTE * pLine, COUNT * pnArg)
|
||||
{
|
||||
/* look for NUMBER */
|
||||
pLine = skipwh(pLine);
|
||||
|
@ -755,7 +798,7 @@ INIT BYTE *GetNumArg(BYTE * pLine, COUNT * pnArg)
|
|||
return GetNumber(pLine, pnArg);
|
||||
}
|
||||
|
||||
INIT BYTE *GetStringArg(BYTE * pLine, BYTE * pszString)
|
||||
BYTE *GetStringArg(BYTE * pLine, BYTE * pszString)
|
||||
{
|
||||
/* look for STRING */
|
||||
pLine = skipwh(pLine);
|
||||
|
@ -764,7 +807,7 @@ INIT BYTE *GetStringArg(BYTE * pLine, BYTE * pszString)
|
|||
return scan(pLine, pszString);
|
||||
}
|
||||
|
||||
INIT void Config_Buffers(BYTE * pLine)
|
||||
STATIC void Config_Buffers(BYTE * pLine)
|
||||
{
|
||||
COUNT nBuffers;
|
||||
|
||||
|
@ -777,7 +820,7 @@ INIT void Config_Buffers(BYTE * pLine)
|
|||
(nBuffers < 0 ? nBuffers : max(Config.cfgBuffers, nBuffers));
|
||||
}
|
||||
|
||||
INIT STATIC VOID sysScreenMode(BYTE * pLine)
|
||||
STATIC VOID sysScreenMode(BYTE * pLine)
|
||||
{
|
||||
COUNT nMode;
|
||||
|
||||
|
@ -808,7 +851,7 @@ INIT STATIC VOID sysScreenMode(BYTE * pLine)
|
|||
#endif
|
||||
}
|
||||
|
||||
INIT STATIC VOID sysVersion(BYTE * pLine)
|
||||
STATIC VOID sysVersion(BYTE * pLine)
|
||||
{
|
||||
COUNT major, minor;
|
||||
char *p;
|
||||
|
@ -834,7 +877,7 @@ INIT STATIC VOID sysVersion(BYTE * pLine)
|
|||
os_minor = minor;
|
||||
}
|
||||
|
||||
INIT STATIC VOID Files(BYTE * pLine)
|
||||
STATIC VOID Files(BYTE * pLine)
|
||||
{
|
||||
COUNT nFiles;
|
||||
|
||||
|
@ -846,7 +889,7 @@ INIT STATIC VOID Files(BYTE * pLine)
|
|||
Config.cfgFiles = max(Config.cfgFiles, nFiles);
|
||||
}
|
||||
|
||||
INIT STATIC VOID CfgLastdrive(BYTE * pLine)
|
||||
STATIC VOID CfgLastdrive(BYTE * pLine)
|
||||
{
|
||||
/* Format: LASTDRIVE = letter */
|
||||
BYTE drv;
|
||||
|
@ -868,7 +911,7 @@ INIT STATIC VOID CfgLastdrive(BYTE * pLine)
|
|||
UmbState of confidence, 1 is sure, 2 maybe, 4 unknown and 0 no way.
|
||||
*/
|
||||
|
||||
INIT STATIC VOID Dosmem(BYTE * pLine)
|
||||
STATIC VOID Dosmem(BYTE * pLine)
|
||||
{
|
||||
BYTE *pTmp;
|
||||
BYTE UMBwanted = FALSE;
|
||||
|
@ -915,7 +958,7 @@ INIT STATIC VOID Dosmem(BYTE * pLine)
|
|||
}
|
||||
}
|
||||
|
||||
INIT STATIC VOID CfgSwitchar(BYTE * pLine)
|
||||
STATIC VOID CfgSwitchar(BYTE * pLine)
|
||||
{
|
||||
/* Format: SWITCHAR = character */
|
||||
|
||||
|
@ -923,7 +966,7 @@ INIT STATIC VOID CfgSwitchar(BYTE * pLine)
|
|||
switchar = *szBuf;
|
||||
}
|
||||
|
||||
INIT STATIC VOID Fcbs(BYTE * pLine)
|
||||
STATIC VOID Fcbs(BYTE * pLine)
|
||||
{
|
||||
/* Format: FCBS = totalFcbs [,protectedFcbs] */
|
||||
COUNT fcbs;
|
||||
|
@ -953,7 +996,7 @@ INIT STATIC VOID Fcbs(BYTE * pLine)
|
|||
* Returns TRUE if successful, FALSE if not.
|
||||
*/
|
||||
|
||||
INIT BOOL LoadCountryInfo(char *filename, UWORD ctryCode, UWORD codePage)
|
||||
STATIC BOOL LoadCountryInfo(char *filename, UWORD ctryCode, UWORD codePage)
|
||||
{
|
||||
/* printf("cntry: %u, CP%u, file=\"%s\"\n", ctryCode, codePage, filename); */
|
||||
printf("Sorry, the COUNTRY= statement has been temporarily disabled\n");
|
||||
|
@ -965,7 +1008,7 @@ INIT BOOL LoadCountryInfo(char *filename, UWORD ctryCode, UWORD codePage)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
INIT STATIC VOID Country(BYTE * pLine)
|
||||
STATIC VOID Country(BYTE * pLine)
|
||||
{
|
||||
/* Format: COUNTRY = countryCode, [codePage], filename */
|
||||
COUNT ctryCode;
|
||||
|
@ -1001,7 +1044,7 @@ INIT STATIC VOID Country(BYTE * pLine)
|
|||
CfgFailure(pLine);
|
||||
}
|
||||
|
||||
INIT STATIC VOID Stacks(BYTE * pLine)
|
||||
STATIC VOID Stacks(BYTE * pLine)
|
||||
{
|
||||
COUNT stacks;
|
||||
|
||||
|
@ -1028,13 +1071,13 @@ INIT STATIC VOID Stacks(BYTE * pLine)
|
|||
}
|
||||
}
|
||||
|
||||
INIT STATIC VOID InitPgmHigh(BYTE * pLine)
|
||||
STATIC VOID InitPgmHigh(BYTE * pLine)
|
||||
{
|
||||
InitPgm(pLine);
|
||||
Config.cfgP_0_startmode = 0x80;
|
||||
}
|
||||
|
||||
INIT STATIC VOID InitPgm(BYTE * pLine)
|
||||
STATIC VOID InitPgm(BYTE * pLine)
|
||||
{
|
||||
/* Get the string argument that represents the new init pgm */
|
||||
pLine = GetStringArg(pLine, Config.cfgInit);
|
||||
|
@ -1049,14 +1092,14 @@ INIT STATIC VOID InitPgm(BYTE * pLine)
|
|||
Config.cfgP_0_startmode = 0;
|
||||
}
|
||||
|
||||
INIT STATIC VOID CfgBreak(BYTE * pLine)
|
||||
STATIC VOID CfgBreak(BYTE * pLine)
|
||||
{
|
||||
/* Format: BREAK = (ON | OFF) */
|
||||
GetStringArg(pLine, szBuf);
|
||||
break_ena = strcasecmp(szBuf, "OFF") ? 1 : 0;
|
||||
}
|
||||
|
||||
INIT STATIC VOID Numlock(BYTE * pLine)
|
||||
STATIC VOID Numlock(BYTE * pLine)
|
||||
{
|
||||
extern VOID ASMCFUNC keycheck();
|
||||
|
||||
|
@ -1070,7 +1113,7 @@ INIT STATIC VOID Numlock(BYTE * pLine)
|
|||
keycheck();
|
||||
}
|
||||
|
||||
INIT STATIC VOID DeviceHigh(BYTE * pLine)
|
||||
STATIC VOID DeviceHigh(BYTE * pLine)
|
||||
{
|
||||
if (UmbState == 1)
|
||||
{
|
||||
|
@ -1087,12 +1130,12 @@ INIT STATIC VOID DeviceHigh(BYTE * pLine)
|
|||
}
|
||||
}
|
||||
|
||||
INIT void Device(BYTE * pLine)
|
||||
STATIC void Device(BYTE * pLine)
|
||||
{
|
||||
LoadDevice(pLine, ram_top, FALSE);
|
||||
}
|
||||
|
||||
INIT BOOL LoadDevice(BYTE * pLine, COUNT top, COUNT mode)
|
||||
STATIC BOOL LoadDevice(BYTE * pLine, COUNT top, COUNT mode)
|
||||
{
|
||||
exec_blk eb;
|
||||
struct dhdr FAR *dhp;
|
||||
|
@ -1159,10 +1202,20 @@ INIT BOOL LoadDevice(BYTE * pLine, COUNT top, COUNT mode)
|
|||
return result;
|
||||
}
|
||||
|
||||
INIT STATIC VOID CfgFailure(BYTE * pLine)
|
||||
STATIC VOID CfgFailure(BYTE * pLine)
|
||||
{
|
||||
BYTE *pTmp = pLineStart;
|
||||
static UBYTE ErrorAlreadyPrinted[128];
|
||||
|
||||
/* suppress multiple printing of same unrecognized lines */
|
||||
|
||||
if (nCfgLine < sizeof(ErrorAlreadyPrinted)*8)
|
||||
{
|
||||
if (ErrorAlreadyPrinted[nCfgLine/8] & (1 << (nCfgLine%8)))
|
||||
return;
|
||||
|
||||
ErrorAlreadyPrinted[nCfgLine/8] |= (1 << (nCfgLine%8));
|
||||
}
|
||||
printf("CONFIG.SYS error in line %d\n", nCfgLine);
|
||||
printf(">>>%s\n ", pTmp);
|
||||
while (++pTmp != pLine)
|
||||
|
@ -1171,7 +1224,7 @@ INIT STATIC VOID CfgFailure(BYTE * pLine)
|
|||
}
|
||||
|
||||
#ifndef KDB
|
||||
INIT BYTE FAR *KernelAlloc(WORD nBytes)
|
||||
BYTE FAR * KernelAlloc(WORD nBytes)
|
||||
{
|
||||
BYTE FAR *lpAllocated;
|
||||
|
||||
|
@ -1195,7 +1248,8 @@ INIT BYTE FAR *KernelAlloc(WORD nBytes)
|
|||
#endif
|
||||
|
||||
#ifdef I86
|
||||
INIT BYTE FAR *KernelAllocDma(WORD bytes)
|
||||
/*
|
||||
STATIC BYTE FAR * KernelAllocDma(WORD bytes)
|
||||
{
|
||||
BYTE FAR *allocated;
|
||||
|
||||
|
@ -1206,8 +1260,9 @@ INIT BYTE FAR *KernelAllocDma(WORD bytes)
|
|||
lpBase += bytes;
|
||||
return allocated;
|
||||
}
|
||||
*/
|
||||
|
||||
INIT void FAR *AlignParagraph(VOID FAR * lpPtr)
|
||||
STATIC void FAR * AlignParagraph(VOID FAR * lpPtr)
|
||||
{
|
||||
UWORD uSegVal;
|
||||
|
||||
|
@ -1223,18 +1278,38 @@ INIT void FAR *AlignParagraph(VOID FAR * lpPtr)
|
|||
}
|
||||
#endif
|
||||
|
||||
INIT BYTE *skipwh(BYTE * s)
|
||||
STATIC BYTE * skipwh(BYTE * s)
|
||||
{
|
||||
while (*s && (*s == 0x0d || *s == 0x0a || *s == ' ' || *s == '\t'))
|
||||
++s;
|
||||
return s;
|
||||
}
|
||||
|
||||
INIT BYTE *scan(BYTE * s, BYTE * d)
|
||||
STATIC BYTE * scan(BYTE * s, BYTE * d)
|
||||
{
|
||||
askThisSingleCommand = FALSE;
|
||||
DontAskThisSingleCommand = FALSE;
|
||||
|
||||
s = skipwh(s);
|
||||
|
||||
MenuLine = 0;
|
||||
|
||||
/* does the line start with "1?" */
|
||||
|
||||
if (s[1] == '?' && s[0] >= '0' && s[0] <= '9')
|
||||
{
|
||||
MenuLine = s[0];
|
||||
Menus |= 1 << (MenuLine - '0');
|
||||
s = skipwh(s+2);
|
||||
}
|
||||
|
||||
/* !dos=high,umb ?? */
|
||||
if (*s == '!')
|
||||
{
|
||||
DontAskThisSingleCommand = TRUE;
|
||||
s = skipwh(s+1);
|
||||
}
|
||||
|
||||
if (*s == ';')
|
||||
{
|
||||
/* semicolon is a synonym for rem */
|
||||
|
@ -1258,7 +1333,7 @@ INIT BYTE *scan(BYTE * s, BYTE * d)
|
|||
}
|
||||
|
||||
/*
|
||||
INIT BYTE *scan_seperator(BYTE * s, BYTE * d)
|
||||
BYTE *scan_seperator(BYTE * s, BYTE * d)
|
||||
{
|
||||
s = skipwh(s);
|
||||
if (*s)
|
||||
|
@ -1268,13 +1343,13 @@ INIT BYTE *scan_seperator(BYTE * s, BYTE * d)
|
|||
}
|
||||
*/
|
||||
|
||||
INIT BOOL isnum(BYTE * pLine)
|
||||
STATIC BOOL isnum(BYTE * pLine)
|
||||
{
|
||||
return (*pLine >= '0' && *pLine <= '9');
|
||||
}
|
||||
|
||||
/* JPP - changed so will accept hex number. */
|
||||
INIT BYTE *GetNumber(REG BYTE * pszString, REG COUNT * pnNum)
|
||||
STATIC BYTE * GetNumber(REG BYTE * pszString, REG COUNT * pnNum)
|
||||
{
|
||||
BYTE Base = 10;
|
||||
BOOL Sign = FALSE;
|
||||
|
@ -1303,7 +1378,7 @@ INIT BYTE *GetNumber(REG BYTE * pszString, REG COUNT * pnNum)
|
|||
|
||||
/* Yet another change for true portability (WDL) */
|
||||
#if 0
|
||||
INIT COUNT tolower(COUNT c)
|
||||
STATIC COUNT tolower(COUNT c)
|
||||
{
|
||||
if (c >= 'A' && c <= 'Z')
|
||||
return (c + ('a' - 'A'));
|
||||
|
@ -1313,7 +1388,7 @@ INIT COUNT tolower(COUNT c)
|
|||
#endif
|
||||
|
||||
/* Yet another change for true portability (PJV) */
|
||||
INIT COUNT toupper(COUNT c)
|
||||
STATIC COUNT toupper(COUNT c)
|
||||
{
|
||||
if (c >= 'a' && c <= 'z')
|
||||
return (c - ('a' - 'A'));
|
||||
|
@ -1324,7 +1399,7 @@ INIT COUNT toupper(COUNT c)
|
|||
/* The following code is 8086 dependant */
|
||||
|
||||
#if 1 /* ifdef KERNEL */
|
||||
INIT VOID mcb_init(UCOUNT seg, UWORD size)
|
||||
STATIC VOID mcb_init(UCOUNT seg, UWORD size)
|
||||
{
|
||||
COUNT i;
|
||||
|
||||
|
@ -1344,7 +1419,7 @@ INIT VOID mcb_init(UCOUNT seg, UWORD size)
|
|||
mem_access_mode = FIRST_FIT;
|
||||
}
|
||||
|
||||
INIT VOID zumcb_init(UCOUNT seg, UWORD size)
|
||||
STATIC VOID zumcb_init(UCOUNT seg, UWORD size)
|
||||
{
|
||||
COUNT i;
|
||||
mcb FAR *mcbp = MK_FP(seg, 0);
|
||||
|
@ -1357,7 +1432,7 @@ INIT VOID zumcb_init(UCOUNT seg, UWORD size)
|
|||
|
||||
}
|
||||
|
||||
INIT VOID mumcb_init(UCOUNT seg, UWORD size)
|
||||
STATIC VOID mumcb_init(UCOUNT seg, UWORD size)
|
||||
{
|
||||
COUNT i;
|
||||
mcb FAR *mcbp = MK_FP(seg, 0);
|
||||
|
@ -1372,15 +1447,16 @@ INIT VOID mumcb_init(UCOUNT seg, UWORD size)
|
|||
}
|
||||
#endif
|
||||
|
||||
INIT VOID strcat(REG BYTE * d, REG BYTE * s)
|
||||
VOID strcat(REG BYTE * d, REG BYTE * s)
|
||||
{
|
||||
while (*d != 0)
|
||||
++d;
|
||||
strcpy(d, s);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* see if the second string is contained in the first one, ignoring case */
|
||||
char *stristr(char *s1, char *s2)
|
||||
STATIC char * stristr(char *s1, char *s2)
|
||||
{
|
||||
int loop;
|
||||
|
||||
|
@ -1397,9 +1473,10 @@ char *stristr(char *s1, char *s2)
|
|||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* compare two ASCII strings ignoring case */
|
||||
INIT COUNT strcasecmp(REG BYTE * d, REG BYTE * s)
|
||||
STATIC COUNT strcasecmp(REG BYTE * d, REG BYTE * s)
|
||||
{
|
||||
while (*s != '\0' && *d != '\0')
|
||||
{
|
||||
|
@ -1513,12 +1590,117 @@ VOID config_init_buffers(COUNT anzBuffers)
|
|||
they expect. be careful with it!
|
||||
*/
|
||||
|
||||
INIT VOID SetAnyDos(BYTE * pLine)
|
||||
STATIC VOID SetAnyDos(BYTE * pLine)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(pLine);
|
||||
ReturnAnyDosVersionExpected = TRUE;
|
||||
}
|
||||
|
||||
STATIC VOID CfgIgnore(BYTE * pLine)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(pLine);
|
||||
}
|
||||
|
||||
/*
|
||||
'MENU'ing stuff
|
||||
|
||||
although it's worse then MSDOS's , its better then nothing
|
||||
|
||||
*/
|
||||
|
||||
STATIC VOID CfgMenu(BYTE * pLine)
|
||||
{
|
||||
printf("%s\n",pLine);
|
||||
}
|
||||
|
||||
STATIC VOID DoMenu(void)
|
||||
{
|
||||
if (Menus == 0)
|
||||
return;
|
||||
|
||||
Menus |= 1 << 0; /* '0' Menu always allowed */
|
||||
|
||||
printf("\n\n");
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int key,i;
|
||||
|
||||
printf("\rSinglestepping (F8) is :%s - ", singleStep ? "ON " : "OFF");
|
||||
|
||||
printf("please select a Menu[");
|
||||
|
||||
for (i = 0; i <= 9; i++)
|
||||
if (Menus & (1 << i))
|
||||
printf("%c", '0' + i);
|
||||
printf("]");
|
||||
|
||||
key = GetBiosKey(MenuTimeout);
|
||||
|
||||
MenuTimeout = -1;
|
||||
|
||||
if (key == -1) /* timeout, take default */
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (key == 0x3f00) /* F5 */
|
||||
{
|
||||
SkipAllConfig = TRUE;
|
||||
break;
|
||||
}
|
||||
if (key == 0x4200) /* F8 */
|
||||
{
|
||||
singleStep = !singleStep;
|
||||
}
|
||||
|
||||
key &= 0xff;
|
||||
|
||||
if (key == '\r') /* CR - use default */
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (key == 0x1b) /* ESC - use default */
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
printf("%c", key);
|
||||
|
||||
if (key >= '0' && key <= '9')
|
||||
if (Menus & (1 << (key - '0')))
|
||||
{
|
||||
MenuSelected = key; break;
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
STATIC VOID CfgMenuDefault(BYTE * pLine)
|
||||
{
|
||||
COUNT num = 0;
|
||||
|
||||
pLine = skipwh(pLine);
|
||||
|
||||
if ('=' != *pLine)
|
||||
{
|
||||
CfgFailure(pLine);
|
||||
return;
|
||||
}
|
||||
pLine = skipwh(pLine + 1);
|
||||
|
||||
/* Format: STACKS = stacks [, stackSize] */
|
||||
pLine = GetNumArg(pLine, &num);
|
||||
MenuSelected = '0' + num;
|
||||
pLine = skipwh(pLine);
|
||||
|
||||
if (*pLine == ',')
|
||||
{
|
||||
GetNumArg(++pLine, &MenuTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Log: config.c,v - for newer log entries see "cvs log config.c"
|
||||
*
|
||||
|
|
133
kernel/dosfns.c
133
kernel/dosfns.c
|
@ -36,7 +36,7 @@ static BYTE *dosfnsRcsId =
|
|||
#include "globals.h"
|
||||
|
||||
COUNT get_free_hndl(VOID);
|
||||
sft FAR *get_free_sft(COUNT *);
|
||||
sft FAR * get_free_sft(COUNT *);
|
||||
BOOL cmatch(COUNT, COUNT, COUNT);
|
||||
|
||||
f_node_ptr xlt_fd(COUNT);
|
||||
|
@ -51,14 +51,14 @@ BYTE share_installed = 0;
|
|||
error. If < 0 is returned, it is the negated error return
|
||||
code, so DOS simply negates this value and returns it in
|
||||
AX. */
|
||||
static int share_open_check(char far * filename, /* far pointer to fully qualified filename */
|
||||
STATIC int share_open_check(char far * filename, /* far pointer to fully qualified filename */
|
||||
unsigned short pspseg, /* psp segment address of owner process */
|
||||
int openmode, /* 0=read-only, 1=write-only, 2=read-write */
|
||||
int sharemode); /* SHARE_COMPAT, etc... */
|
||||
|
||||
/* DOS calls this to record the fact that it has successfully
|
||||
closed a file, or the fact that the open for this file failed. */
|
||||
static void share_close_file(int fileno); /* file_table entry number */
|
||||
STATIC void share_close_file(int fileno); /* file_table entry number */
|
||||
|
||||
/* DOS calls this to determine whether it can access (read or
|
||||
write) a specific section of a file. We call it internally
|
||||
|
@ -71,7 +71,7 @@ static void share_close_file(int fileno); /* file_table entry number */
|
|||
generates a critical error (if allowcriter is non-zero).
|
||||
If non-zero is returned, it is the negated return value for
|
||||
the DOS call. */
|
||||
static int share_access_check(unsigned short pspseg, /* psp segment address of owner process */
|
||||
STATIC int share_access_check(unsigned short pspseg, /* psp segment address of owner process */
|
||||
int fileno, /* file_table entry number */
|
||||
unsigned long ofs, /* offset into file */
|
||||
unsigned long len, /* length (in bytes) of region to access */
|
||||
|
@ -82,7 +82,7 @@ static int share_access_check(unsigned short pspseg, /* psp segment address o
|
|||
returns non-zero.
|
||||
If the return value is non-zero, it is the negated error
|
||||
return code for the DOS 0x5c call. */
|
||||
static int share_lock_unlock(unsigned short pspseg, /* psp segment address of owner process */
|
||||
STATIC int share_lock_unlock(unsigned short pspseg, /* psp segment address of owner process */
|
||||
int fileno, /* file_table entry number */
|
||||
unsigned long ofs, /* offset into file */
|
||||
unsigned long len, /* length (in bytes) of region to lock or unlock */
|
||||
|
@ -90,8 +90,14 @@ static int share_lock_unlock(unsigned short pspseg, /* psp segment address o
|
|||
|
||||
/* /// End of additions for SHARE. - Ron Cemer */
|
||||
|
||||
STATIC int remote_lock_unlock(sft FAR *sftp, /* SFT for file */
|
||||
unsigned long ofs, /* offset into file */
|
||||
unsigned long len, /* length (in bytes) of region to lock or unlock */
|
||||
int unlock); /* non-zero to unlock; zero to lock */
|
||||
|
||||
|
||||
#ifdef WITHFAT32
|
||||
struct dpb FAR *GetDriveDPB(UBYTE drive, COUNT * rc)
|
||||
struct dpb FAR * GetDriveDPB(UBYTE drive, COUNT * rc)
|
||||
{
|
||||
struct dpb FAR *dpb;
|
||||
drive = drive == 0 ? default_drive : drive - 1;
|
||||
|
@ -114,7 +120,7 @@ struct dpb FAR *GetDriveDPB(UBYTE drive, COUNT * rc)
|
|||
}
|
||||
#endif
|
||||
|
||||
static VOID DosGetFile(BYTE * lpszPath, BYTE FAR * lpszDosFileName)
|
||||
STATIC VOID DosGetFile(BYTE * lpszPath, BYTE FAR * lpszDosFileName)
|
||||
{
|
||||
BYTE szLclName[FNAME_SIZE + 1];
|
||||
BYTE szLclExt[FEXT_SIZE + 1];
|
||||
|
@ -127,7 +133,7 @@ static VOID DosGetFile(BYTE * lpszPath, BYTE FAR * lpszDosFileName)
|
|||
fmemcpy(&lpszDosFileName[FNAME_SIZE], (BYTE FAR *) szLclExt, FEXT_SIZE);
|
||||
}
|
||||
|
||||
sft FAR *idx_to_sft(COUNT SftIndex)
|
||||
sft FAR * idx_to_sft(COUNT SftIndex)
|
||||
{
|
||||
sfttbl FAR *sp;
|
||||
|
||||
|
@ -151,7 +157,7 @@ sft FAR *idx_to_sft(COUNT SftIndex)
|
|||
return (sft FAR *) - 1;
|
||||
}
|
||||
|
||||
STATIC COUNT get_sft_idx(UCOUNT hndl)
|
||||
COUNT get_sft_idx(UCOUNT hndl)
|
||||
{
|
||||
psp FAR *p = MK_FP(cu_psp, 0);
|
||||
|
||||
|
@ -595,7 +601,7 @@ sft FAR *get_free_sft(COUNT * sft_idx)
|
|||
|
||||
/* MS NET uses this on open/creat TE */
|
||||
{
|
||||
extern WORD current_sft_idx;
|
||||
extern WORD ASM current_sft_idx;
|
||||
current_sft_idx = sys_idx;
|
||||
}
|
||||
|
||||
|
@ -622,7 +628,7 @@ BYTE FAR *get_root(BYTE FAR * fname)
|
|||
}
|
||||
|
||||
/* Ascii only file name match routines */
|
||||
static BOOL cmatch(COUNT s, COUNT d, COUNT mode)
|
||||
STATIC BOOL cmatch(COUNT s, COUNT d, COUNT mode)
|
||||
{
|
||||
if (s >= 'a' && s <= 'z')
|
||||
s -= 'a' - 'A';
|
||||
|
@ -669,7 +675,7 @@ COUNT DosCreatSft(BYTE * fname, COUNT attrib)
|
|||
sftp->sft_mode = SFT_MRDWR;
|
||||
sftp->sft_attrib = attrib;
|
||||
sftp->sft_psp = cu_psp;
|
||||
|
||||
|
||||
/* check for a device */
|
||||
dhp = IsDevice(fname);
|
||||
if (dhp)
|
||||
|
@ -681,6 +687,8 @@ COUNT DosCreatSft(BYTE * fname, COUNT attrib)
|
|||
fmemcpy(sftp->sft_name, (BYTE FAR *) SecPathName,
|
||||
FNAME_SIZE + FEXT_SIZE);
|
||||
sftp->sft_dev = dhp;
|
||||
sftp->sft_date = dos_getdate();
|
||||
sftp->sft_time = dos_gettime();
|
||||
return sft_idx;
|
||||
}
|
||||
|
||||
|
@ -717,6 +725,9 @@ COUNT DosCreatSft(BYTE * fname, COUNT attrib)
|
|||
sftp->sft_count += 1;
|
||||
sftp->sft_flags = drive;
|
||||
DosGetFile(fname, sftp->sft_name);
|
||||
dos_getftime(sftp->sft_status,
|
||||
(date FAR *) & sftp->sft_date,
|
||||
(time FAR *) & sftp->sft_time);
|
||||
return sft_idx;
|
||||
}
|
||||
else
|
||||
|
@ -843,16 +854,6 @@ COUNT DosOpenSft(BYTE * fname, COUNT mode)
|
|||
struct dhdr FAR *dhp;
|
||||
COUNT drive, result;
|
||||
|
||||
OpenMode = (BYTE) mode;
|
||||
|
||||
/* test if mode is in range */
|
||||
if ((mode & ~SFT_OMASK) != 0)
|
||||
return DE_INVLDACC;
|
||||
|
||||
mode &= 3;
|
||||
|
||||
OpenMode = (BYTE) mode;
|
||||
|
||||
/* now get a free system file table entry */
|
||||
if ((sftp = get_free_sft(&sft_idx)) == (sft FAR *) - 1)
|
||||
return DE_TOOMANY;
|
||||
|
@ -860,7 +861,8 @@ COUNT DosOpenSft(BYTE * fname, COUNT mode)
|
|||
fmemset(sftp, 0, sizeof(sft));
|
||||
sftp->sft_psp = cu_psp;
|
||||
sftp->sft_mode = mode;
|
||||
|
||||
OpenMode = (BYTE) mode;
|
||||
|
||||
/* check for a device */
|
||||
dhp = IsDevice(fname);
|
||||
if (dhp)
|
||||
|
@ -954,6 +956,10 @@ COUNT DosOpen(BYTE FAR * fname, COUNT mode)
|
|||
psp FAR *p = MK_FP(cu_psp, 0);
|
||||
COUNT sft_idx, result, hndl;
|
||||
|
||||
/* test if mode is in range */
|
||||
if ((mode & ~SFT_OMASK) != 0)
|
||||
return DE_INVLDACC;
|
||||
|
||||
/* get a free handle */
|
||||
if ((hndl = get_free_hndl()) < 0)
|
||||
return hndl;
|
||||
|
@ -964,7 +970,7 @@ COUNT DosOpen(BYTE FAR * fname, COUNT mode)
|
|||
return result;
|
||||
}
|
||||
|
||||
sft_idx = DosOpenSft(PriPathName, mode);
|
||||
sft_idx = DosOpenSft(PriPathName, mode & 3);
|
||||
|
||||
if (sft_idx < SUCCESS)
|
||||
return sft_idx;
|
||||
|
@ -973,7 +979,7 @@ COUNT DosOpen(BYTE FAR * fname, COUNT mode)
|
|||
return hndl;
|
||||
}
|
||||
|
||||
COUNT DosCloseSft(WORD sft_idx)
|
||||
COUNT DosCloseSft(WORD sft_idx, BOOL commitonly)
|
||||
{
|
||||
sft FAR *sftp = idx_to_sft(sft_idx);
|
||||
|
||||
|
@ -991,31 +997,32 @@ COUNT DosCloseSft(WORD sft_idx)
|
|||
if (sftp->sft_flags & SFT_FSHARED)
|
||||
{
|
||||
/* printf("closing SFT %d = %p\n",sft_idx,sftp); */
|
||||
return remote_close(sftp);
|
||||
return (commitonly ? remote_commit(sftp) : remote_close(sftp));
|
||||
}
|
||||
|
||||
/* now just drop the count if a device, else */
|
||||
/* call file system handler */
|
||||
sftp->sft_count -= 1;
|
||||
if (!commitonly)
|
||||
sftp->sft_count -= 1;
|
||||
|
||||
if (sftp->sft_flags & SFT_FDEVICE)
|
||||
return SUCCESS;
|
||||
else
|
||||
{
|
||||
if (sftp->sft_count > 0)
|
||||
return SUCCESS;
|
||||
else
|
||||
{
|
||||
|
||||
if (commitonly)
|
||||
return dos_commit(sftp->sft_status);
|
||||
|
||||
if (sftp->sft_count > 0)
|
||||
return SUCCESS;
|
||||
|
||||
/* /// Added for SHARE *** CURLY BRACES ADDED ALSO!!! ***. - Ron Cemer */
|
||||
if (IsShareInstalled())
|
||||
{
|
||||
if (sftp->sft_shroff >= 0)
|
||||
share_close_file(sftp->sft_shroff);
|
||||
sftp->sft_shroff = -1;
|
||||
}
|
||||
/* /// End of additions for SHARE. - Ron Cemer */
|
||||
return dos_close(sftp->sft_status);
|
||||
}
|
||||
if (IsShareInstalled())
|
||||
{
|
||||
if (sftp->sft_shroff >= 0)
|
||||
share_close_file(sftp->sft_shroff);
|
||||
sftp->sft_shroff = -1;
|
||||
}
|
||||
/* /// End of additions for SHARE. - Ron Cemer */
|
||||
return dos_close(sftp->sft_status);
|
||||
}
|
||||
|
||||
COUNT DosClose(COUNT hndl)
|
||||
|
@ -1024,7 +1031,7 @@ COUNT DosClose(COUNT hndl)
|
|||
COUNT ret;
|
||||
|
||||
/* Get the SFT block that contains the SFT */
|
||||
ret = DosCloseSft(get_sft_idx(hndl));
|
||||
ret = DosCloseSft(get_sft_idx(hndl), FALSE);
|
||||
if (ret != DE_INVLDHNDL && ret != DE_ACCESS)
|
||||
p->ps_filetab[hndl] = 0xff;
|
||||
return ret;
|
||||
|
@ -1705,14 +1712,17 @@ COUNT DosLockUnlock(COUNT hndl, LONG pos, LONG len, COUNT unlock)
|
|||
{
|
||||
sft FAR *s;
|
||||
|
||||
/* Invalid function unless SHARE is installed. */
|
||||
if (!IsShareInstalled())
|
||||
return DE_INVLDFUNC;
|
||||
|
||||
/* Get the SFT block that contains the SFT */
|
||||
if ((s = get_sft(hndl)) == (sft FAR *) - 1)
|
||||
return DE_INVLDHNDL;
|
||||
|
||||
if (s->sft_flags & SFT_FSHARED)
|
||||
return remote_lock_unlock(s, pos, len, unlock);
|
||||
|
||||
/* Invalid function unless SHARE is installed or remote. */
|
||||
if (!IsShareInstalled())
|
||||
return DE_INVLDFUNC;
|
||||
|
||||
/* Lock violation if this SFT entry does not support locking. */
|
||||
if (s->sft_shroff < 0)
|
||||
return DE_LOCK;
|
||||
|
@ -1806,7 +1816,7 @@ BOOL IsShareInstalled(void)
|
|||
error. If < 0 is returned, it is the negated error return
|
||||
code, so DOS simply negates this value and returns it in
|
||||
AX. */
|
||||
static int share_open_check(char far * filename, /* far pointer to fully qualified filename */
|
||||
STATIC int share_open_check(char far * filename, /* far pointer to fully qualified filename */
|
||||
unsigned short pspseg, /* psp segment address of owner process */
|
||||
int openmode, /* 0=read-only, 1=write-only, 2=read-write */
|
||||
int sharemode)
|
||||
|
@ -1825,7 +1835,7 @@ static int share_open_check(char far * filename, /* far pointer to fully
|
|||
|
||||
/* DOS calls this to record the fact that it has successfully
|
||||
closed a file, or the fact that the open for this file failed. */
|
||||
static void share_close_file(int fileno)
|
||||
STATIC void share_close_file(int fileno)
|
||||
{ /* file_table entry number */
|
||||
iregs regs;
|
||||
|
||||
|
@ -1845,7 +1855,7 @@ static void share_close_file(int fileno)
|
|||
generates a critical error (if allowcriter is non-zero).
|
||||
If non-zero is returned, it is the negated return value for
|
||||
the DOS call. */
|
||||
static int share_access_check(unsigned short pspseg, /* psp segment address of owner process */
|
||||
STATIC int share_access_check(unsigned short pspseg, /* psp segment address of owner process */
|
||||
int fileno, /* file_table entry number */
|
||||
unsigned long ofs, /* offset into file */
|
||||
unsigned long len, /* length (in bytes) of region to access */
|
||||
|
@ -1869,7 +1879,7 @@ static int share_access_check(unsigned short pspseg, /* psp segment address o
|
|||
returns non-zero.
|
||||
If the return value is non-zero, it is the negated error
|
||||
return code for the DOS 0x5c call. */
|
||||
static int share_lock_unlock(unsigned short pspseg, /* psp segment address of owner process */
|
||||
STATIC int share_lock_unlock(unsigned short pspseg, /* psp segment address of owner process */
|
||||
int fileno, /* file_table entry number */
|
||||
unsigned long ofs, /* offset into file */
|
||||
unsigned long len, /* length (in bytes) of region to lock or unlock */
|
||||
|
@ -1889,6 +1899,27 @@ static int share_lock_unlock(unsigned short pspseg, /* psp segment address o
|
|||
}
|
||||
|
||||
/* /// End of additions for SHARE. - Ron Cemer */
|
||||
STATIC int remote_lock_unlock(sft FAR *sftp, /* SFT for file */
|
||||
unsigned long ofs, /* offset into file */
|
||||
unsigned long len, /* length (in bytes) of region to lock or unlock */
|
||||
int unlock)
|
||||
{ /* non-zero to unlock; zero to lock */
|
||||
iregs regs;
|
||||
unsigned long param_block[2];
|
||||
param_block[0] = ofs;
|
||||
param_block[1] = len;
|
||||
|
||||
regs.a.x = 0x110a;
|
||||
regs.b.b.l = (unlock ? 0x01 : 0x00);
|
||||
regs.c.x = 1;
|
||||
regs.ds = FP_SEG(param_block);
|
||||
regs.d.x = FP_OFF(param_block);
|
||||
regs.es = FP_SEG(sftp);
|
||||
regs.di = FP_OFF(sftp);
|
||||
intr(0x2f, ®s);
|
||||
return ((regs.flags & 1) ? -(int)regs.a.b.l : 0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
|
|
173
kernel/dsk.c
173
kernel/dsk.c
|
@ -59,28 +59,24 @@ extern COUNT ASMCFUNC fl_lba_ReadWrite(BYTE drive, WORD mode,
|
|||
struct _bios_LBA_address_packet FAR
|
||||
* dap_p);
|
||||
|
||||
int LBA_Transfer(ddt * pddt, UWORD mode, VOID FAR * buffer,
|
||||
STATIC int LBA_Transfer(ddt * pddt, UWORD mode, VOID FAR * buffer,
|
||||
ULONG LBA_address, unsigned total, UWORD * transferred);
|
||||
#else
|
||||
BOOL fl_reset();
|
||||
COUNT fl_readdasd();
|
||||
COUNT fl_diskchanged();
|
||||
COUNT fl_rd_status();
|
||||
COUNT fl_format();
|
||||
COUNT fl_read();
|
||||
COUNT fl_write();
|
||||
COUNT fl_verify();
|
||||
VOID fl_readkey();
|
||||
COUNT fl_setmediatype();
|
||||
COUNT fl_setdisktype();
|
||||
BOOL ASMCFUNC fl_reset();
|
||||
COUNT ASMCFUNC fl_readdasd();
|
||||
COUNT ASMCFUNC fl_diskchanged();
|
||||
COUNT ASMCFUNC fl_rd_status();
|
||||
COUNT ASMCFUNC fl_format();
|
||||
COUNT ASMCFUNC fl_read();
|
||||
COUNT ASMCFUNC fl_write();
|
||||
COUNT ASMCFUNC fl_verify();
|
||||
VOID ASMCFUNC fl_readkey();
|
||||
COUNT ASMCFUNC fl_setmediatype();
|
||||
COUNT ASMCFUNC fl_setdisktype();
|
||||
#endif
|
||||
|
||||
#define NENTRY 26 /* total size of dispatch table */
|
||||
|
||||
extern BYTE FAR nblk_rel;
|
||||
|
||||
extern int FAR ASMCFUNC Get_nblk_rel(void);
|
||||
|
||||
#define LBA_READ 0x4200
|
||||
#define LBA_WRITE 0x4300
|
||||
UWORD LBA_WRITE_VERIFY = 0x4302;
|
||||
|
@ -106,7 +102,7 @@ struct FS_info {
|
|||
BYTE fstype[8];
|
||||
};
|
||||
|
||||
extern struct DynS Dyn;
|
||||
extern struct DynS ASM Dyn;
|
||||
|
||||
/*TE - array access functions */
|
||||
ddt *getddt(int dev)
|
||||
|
@ -114,6 +110,20 @@ ddt *getddt(int dev)
|
|||
return &(((ddt *) Dyn.Buffer)[dev]);
|
||||
}
|
||||
|
||||
ULONG dsk_lasttime = 0;
|
||||
|
||||
STATIC VOID tmark(ddt *pddt)
|
||||
{
|
||||
ReadPCClock(&pddt->ddt_fh.ddt_lasttime);
|
||||
}
|
||||
|
||||
STATIC BOOL tdelay(ddt *pddt, ULONG ticks)
|
||||
{
|
||||
ULONG now;
|
||||
ReadPCClock(&now);
|
||||
return now - pddt->ddt_fh.ddt_lasttime >= ticks;
|
||||
}
|
||||
|
||||
#define N_PART 4 /* number of partitions per
|
||||
table partition */
|
||||
|
||||
|
@ -122,44 +132,26 @@ COUNT nUnits; /* number of returned units */
|
|||
#define PARTOFF 0x1be
|
||||
|
||||
#ifdef PROTO
|
||||
WORD
|
||||
_dsk_init(rqptr rq, ddt * pddt),
|
||||
mediachk(rqptr rq, ddt * pddt),
|
||||
bldbpb(rqptr rq, ddt * pddt),
|
||||
blockio(rqptr rq, ddt * pddt),
|
||||
IoctlQueblk(rqptr rq, ddt * pddt),
|
||||
Genblkdev(rqptr rq, ddt * pddt),
|
||||
Getlogdev(rqptr rq, ddt * pddt),
|
||||
Setlogdev(rqptr rq, ddt * pddt),
|
||||
blk_Open(rqptr rq, ddt * pddt),
|
||||
blk_Close(rqptr rq, ddt * pddt),
|
||||
blk_Media(rqptr rq, ddt * pddt),
|
||||
blk_noerr(rqptr rq, ddt * pddt),
|
||||
blk_nondr(rqptr rq, ddt * pddt), blk_error(rqptr rq, ddt * pddt);
|
||||
WORD dskerr(COUNT);
|
||||
typedef WORD dsk_proc(rqptr rq, ddt * pddt);
|
||||
#else
|
||||
WORD _dsk_init(),
|
||||
mediachk(),
|
||||
bldbpb(),
|
||||
blockio(),
|
||||
IoctlQueblk(),
|
||||
Genblkdev(),
|
||||
Getlogdev(),
|
||||
Setlogdev(),
|
||||
blk_Open(),
|
||||
blk_Close(), blk_Media(), blk_noerr(), blk_nondr(), blk_error();
|
||||
WORD dskerr();
|
||||
typedef WORD dsk_proc();
|
||||
#endif
|
||||
|
||||
STATIC dsk_proc _dsk_init, mediachk, bldbpb, blockio, IoctlQueblk,
|
||||
Genblkdev, Getlogdev, Setlogdev, blk_Open, blk_Close,
|
||||
blk_Media, blk_noerr, blk_nondr, blk_error;
|
||||
|
||||
#ifdef PROTO
|
||||
STATIC WORD dskerr(COUNT);
|
||||
#else
|
||||
STATIC WORD dskerr();
|
||||
#endif
|
||||
|
||||
/* */
|
||||
/* the function dispatch table */
|
||||
/* */
|
||||
|
||||
#ifdef PROTO
|
||||
static WORD(*dispatch[NENTRY]) (rqptr rq, ddt * pddt) =
|
||||
#else
|
||||
static WORD(*dispatch[NENTRY]) () =
|
||||
#endif
|
||||
static dsk_proc (*dispatch[NENTRY]) =
|
||||
{
|
||||
_dsk_init, /* Initialize */
|
||||
mediachk, /* Media Check */
|
||||
|
@ -195,7 +187,7 @@ static WORD(*dispatch[NENTRY]) () =
|
|||
/* F U N C T I O N S --------------------------------------------------- */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
COUNT FAR ASMCFUNC blk_driver(rqptr rp)
|
||||
COUNT ASMCFUNC FAR blk_driver(rqptr rp)
|
||||
{
|
||||
if (rp->r_unit >= nUnits && rp->r_command != C_INIT)
|
||||
return failure(E_UNIT);
|
||||
|
@ -208,7 +200,7 @@ COUNT FAR ASMCFUNC blk_driver(rqptr rp)
|
|||
}
|
||||
|
||||
/* disk init is done in diskinit.c, so this should never be called */
|
||||
WORD _dsk_init(rqptr rp, ddt * pddt)
|
||||
STATIC WORD _dsk_init(rqptr rp, ddt * pddt)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(rp);
|
||||
UNREFERENCED_PARAMETER(pddt);
|
||||
|
@ -267,10 +259,10 @@ STATIC WORD diskchange(ddt * pddt)
|
|||
}
|
||||
|
||||
/* can not detect or error... */
|
||||
return tdelay((LONG) 37) ? M_DONT_KNOW : M_NOT_CHANGED;
|
||||
return tdelay(pddt, 37ul) ? M_DONT_KNOW : M_NOT_CHANGED;
|
||||
}
|
||||
|
||||
WORD mediachk(rqptr rp, ddt * pddt)
|
||||
STATIC WORD mediachk(rqptr rp, ddt * pddt)
|
||||
{
|
||||
/* check floppy status */
|
||||
if (pddt->ddt_descflags & DF_REFORMAT)
|
||||
|
@ -306,29 +298,53 @@ STATIC WORD RWzero(ddt * pddt, UWORD mode)
|
|||
0 if not set, 1 = a, 2 = b, etc, assume set.
|
||||
page 424 MS Programmer's Ref.
|
||||
*/
|
||||
static WORD Getlogdev(rqptr rp, ddt * pddt)
|
||||
STATIC WORD Getlogdev(rqptr rp, ddt * pddt)
|
||||
{
|
||||
BYTE x = rp->r_unit;
|
||||
int i;
|
||||
ddt *pddt2 = getddt(0);
|
||||
|
||||
UNREFERENCED_PARAMETER(pddt);
|
||||
if (!(pddt->ddt_descflags & DF_MULTLOG)) {
|
||||
rp->r_unit = 0;
|
||||
return S_DONE;
|
||||
}
|
||||
|
||||
x++;
|
||||
if (x > Get_nblk_rel())
|
||||
return failure(E_UNIT);
|
||||
for (i = 0; i < nUnits; i++, pddt2++)
|
||||
{
|
||||
if (pddt->ddt_driveno == pddt2->ddt_driveno &&
|
||||
(pddt2->ddt_descflags & (DF_MULTLOG | DF_CURLOG)) ==
|
||||
(DF_MULTLOG | DF_CURLOG))
|
||||
break;
|
||||
}
|
||||
|
||||
rp->r_unit = x;
|
||||
rp->r_unit = i+1;
|
||||
return S_DONE;
|
||||
}
|
||||
|
||||
static WORD Setlogdev(rqptr rp, ddt * pddt)
|
||||
STATIC WORD Setlogdev(rqptr rp, ddt * pddt)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(rp);
|
||||
UNREFERENCED_PARAMETER(pddt);
|
||||
int i;
|
||||
ddt *pddt2 = getddt(0);
|
||||
|
||||
if (!(pddt->ddt_descflags & DF_MULTLOG)) {
|
||||
rp->r_unit = 0;
|
||||
return S_DONE;
|
||||
}
|
||||
|
||||
for (i = 0; i < nUnits; i++, pddt2++)
|
||||
{
|
||||
if (pddt->ddt_driveno == pddt2->ddt_driveno &&
|
||||
(pddt2->ddt_descflags & (DF_MULTLOG | DF_CURLOG)) ==
|
||||
(DF_MULTLOG | DF_CURLOG))
|
||||
break;
|
||||
}
|
||||
|
||||
pddt2->ddt_descflags &= ~DF_CURLOG;
|
||||
pddt->ddt_descflags |= DF_CURLOG;
|
||||
rp->r_unit++;
|
||||
return S_DONE;
|
||||
}
|
||||
|
||||
static WORD blk_Open(rqptr rp, ddt * pddt)
|
||||
STATIC WORD blk_Open(rqptr rp, ddt * pddt)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(rp);
|
||||
|
||||
|
@ -336,7 +352,7 @@ static WORD blk_Open(rqptr rp, ddt * pddt)
|
|||
return S_DONE;
|
||||
}
|
||||
|
||||
static WORD blk_Close(rqptr rp, ddt * pddt)
|
||||
STATIC WORD blk_Close(rqptr rp, ddt * pddt)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(rp);
|
||||
|
||||
|
@ -344,7 +360,7 @@ static WORD blk_Close(rqptr rp, ddt * pddt)
|
|||
return S_DONE;
|
||||
}
|
||||
|
||||
static WORD blk_nondr(rqptr rp, ddt * pddt)
|
||||
STATIC WORD blk_nondr(rqptr rp, ddt * pddt)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(rp);
|
||||
UNREFERENCED_PARAMETER(pddt);
|
||||
|
@ -352,7 +368,7 @@ static WORD blk_nondr(rqptr rp, ddt * pddt)
|
|||
return S_BUSY | S_DONE;
|
||||
}
|
||||
|
||||
static WORD blk_Media(rqptr rp, ddt * pddt)
|
||||
STATIC WORD blk_Media(rqptr rp, ddt * pddt)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(rp);
|
||||
|
||||
|
@ -362,13 +378,16 @@ static WORD blk_Media(rqptr rp, ddt * pddt)
|
|||
return S_DONE; /* Floppy */
|
||||
}
|
||||
|
||||
static WORD getbpb(ddt * pddt)
|
||||
STATIC WORD getbpb(ddt * pddt)
|
||||
{
|
||||
ULONG count;
|
||||
bpb *pbpbarray = &pddt->ddt_bpb;
|
||||
WORD head, /*track, */ sector, ret;
|
||||
|
||||
pddt->ddt_descflags |= DF_NOACCESS; /* set drive to not accessible and changed */
|
||||
/* pddt->ddt_descflags |= DF_NOACCESS;
|
||||
* disabled for now - problems with FORMAT ?? */
|
||||
|
||||
/* set drive to not accessible and changed */
|
||||
if (diskchange(pddt) != M_NOT_CHANGED)
|
||||
pddt->ddt_descflags |= DF_DISKCHANGE;
|
||||
|
||||
|
@ -447,12 +466,12 @@ static WORD getbpb(ddt * pddt)
|
|||
|
||||
if (head == 0 || sector == 0)
|
||||
{
|
||||
tmark();
|
||||
tmark(pddt);
|
||||
return failure(E_FAILURE);
|
||||
}
|
||||
pddt->ddt_ncyl = (count + head * sector - 1) / (head * sector);
|
||||
|
||||
tmark();
|
||||
tmark(pddt);
|
||||
|
||||
#ifdef DSK_DEBUG
|
||||
printf("BPB_NSECS = %04x\n", sector);
|
||||
|
@ -475,7 +494,7 @@ STATIC WORD bldbpb(rqptr rp, ddt * pddt)
|
|||
return S_DONE;
|
||||
}
|
||||
|
||||
static WORD IoctlQueblk(rqptr rp, ddt * pddt)
|
||||
STATIC WORD IoctlQueblk(rqptr rp, ddt * pddt)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(pddt);
|
||||
|
||||
|
@ -494,7 +513,7 @@ static WORD IoctlQueblk(rqptr rp, ddt * pddt)
|
|||
|
||||
}
|
||||
|
||||
COUNT Genblockio(ddt * pddt, UWORD mode, WORD head, WORD track,
|
||||
STATIC COUNT Genblockio(ddt * pddt, UWORD mode, WORD head, WORD track,
|
||||
WORD sector, WORD count, VOID FAR * buffer)
|
||||
{
|
||||
UWORD transferred;
|
||||
|
@ -753,7 +772,7 @@ STATIC WORD Genblkdev(rqptr rp, ddt * pddt)
|
|||
return S_DONE;
|
||||
}
|
||||
|
||||
WORD blockio(rqptr rp, ddt * pddt)
|
||||
STATIC WORD blockio(rqptr rp, ddt * pddt)
|
||||
{
|
||||
ULONG start, size;
|
||||
WORD ret;
|
||||
|
@ -776,10 +795,10 @@ WORD blockio(rqptr rp, ddt * pddt)
|
|||
return failure(E_FAILURE);
|
||||
}
|
||||
|
||||
if (pddt->ddt_descflags & 0x200) /* drive inaccessible */
|
||||
if (pddt->ddt_descflags & DF_NOACCESS) /* drive inaccessible */
|
||||
return failure(E_FAILURE);
|
||||
|
||||
tmark();
|
||||
tmark(pddt);
|
||||
start = (rp->r_start != HUGECOUNT ? rp->r_start : rp->r_huge);
|
||||
pbpb = hd(pddt->ddt_descflags) ? &pddt->ddt_defbpb : &pddt->ddt_bpb;
|
||||
size = (pbpb->bpb_nsize ? pbpb->bpb_nsize : pbpb->bpb_huge);
|
||||
|
@ -854,7 +873,7 @@ STATIC WORD dskerr(COUNT code)
|
|||
translate LBA sectors into CHS addressing
|
||||
*/
|
||||
|
||||
void LBA_to_CHS(struct CHS *chs, ULONG LBA_address, ddt * pddt)
|
||||
STATIC void LBA_to_CHS(struct CHS *chs, ULONG LBA_address, ddt * pddt)
|
||||
{
|
||||
/* we need the defbpb values since those are taken from the
|
||||
BIOS, not from some random boot sector, except when
|
||||
|
@ -916,7 +935,7 @@ STATIC unsigned DMA_max_transfer(void FAR * buffer, unsigned count)
|
|||
|
||||
*/
|
||||
|
||||
int LBA_Transfer(ddt * pddt, UWORD mode, VOID FAR * buffer,
|
||||
STATIC int LBA_Transfer(ddt * pddt, UWORD mode, VOID FAR * buffer,
|
||||
ULONG LBA_address, unsigned totaltodo,
|
||||
UWORD * transferred)
|
||||
{
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
/*
|
||||
DYNDATA.C
|
||||
|
||||
this serves as a placeholder in the near data segment
|
||||
|
||||
alll data herein goes to special segment
|
||||
DYN_DATA AFTER BSS, but immediately before HMA_TEXT
|
||||
*/
|
||||
#include "portab.h"
|
||||
#include "init-mod.h"
|
||||
#include "dyndata.h"
|
||||
|
||||
struct DynS Dyn = { 0 };
|
|
@ -49,9 +49,9 @@ additionally:
|
|||
|
||||
#ifndef __TURBOC__
|
||||
#include "init-dat.h"
|
||||
extern struct DynS DOSFAR Dyn;
|
||||
extern struct DynS DOSFAR ASM Dyn;
|
||||
#else
|
||||
extern struct DynS FAR Dyn;
|
||||
extern struct DynS FAR ASM Dyn;
|
||||
#endif
|
||||
|
||||
void far *DynAlloc(char *what, unsigned num, unsigned size)
|
||||
|
@ -85,7 +85,7 @@ void DynFree(void *ptr)
|
|||
Dyn.Allocated = (char *)ptr - (char *)Dyn.Buffer;
|
||||
}
|
||||
|
||||
void FAR *DynLast()
|
||||
void FAR * DynLast()
|
||||
{
|
||||
DebugPrintf(("dynamic data end at %p\n",
|
||||
(void FAR *)(Dyn.Buffer + Dyn.Allocated)));
|
||||
|
|
|
@ -39,8 +39,8 @@ static BYTE *errorRcsId =
|
|||
/* error registers */
|
||||
VOID dump(void)
|
||||
{
|
||||
printf("Register Dump [AH = %02x CS:IP = %04x:%04x]\n",
|
||||
error_regs.AH, error_regs.CS, error_regs.IP);
|
||||
printf("Register Dump [AH = %02x CS:IP = %04x:%04x FLAGS = %04x]\n",
|
||||
error_regs.AH, error_regs.CS, error_regs.IP, error_regs.FLAGS);
|
||||
printf("AX:%04x BX:%04x CX:%04x DX:%04x\n",
|
||||
error_regs.AX, error_regs.BX, error_regs.CX, error_regs.DX);
|
||||
printf("SI:%04x DI:%04x DS:%04x ES:%04x\n",
|
||||
|
|
|
@ -55,11 +55,10 @@ _execrh:
|
|||
mov ax, [si+6] ; construct strategy address
|
||||
mov [bp+8], ax
|
||||
|
||||
mov si, [si+8] ; save 'interrupt' address
|
||||
|
||||
call far[bp+8] ; call far the strategy
|
||||
|
||||
mov [bp+8],si ; construct interrupt address
|
||||
mov ax,[si+8] ; construct 'interrupt' address
|
||||
mov [bp+8],ax ; construct interrupt address
|
||||
call far[bp+8] ; call far the interrupt
|
||||
|
||||
sti ; damm driver turn off ints
|
||||
|
|
|
@ -196,7 +196,8 @@ f_node_ptr dir_open(BYTE * dirname)
|
|||
while (dir_read(fnp) == 1)
|
||||
{
|
||||
if (fnp->f_dir.dir_name[0] != '\0'
|
||||
&& fnp->f_dir.dir_name[0] != DELETED)
|
||||
&& fnp->f_dir.dir_name[0] != DELETED
|
||||
&& !(fnp->f_dir.dir_attrib & D_VOLID))
|
||||
{
|
||||
if (fcmp
|
||||
(TempBuffer, (BYTE *) fnp->f_dir.dir_name,
|
||||
|
@ -319,6 +320,11 @@ COUNT dir_read(REG f_node_ptr fnp)
|
|||
/* Description.
|
||||
* Writes directory entry pointed by fnp to disk. In case of erroneous
|
||||
* situation fnode is released.
|
||||
* The caller should set
|
||||
* 1. f_dmod flag if original directory entry was modified.
|
||||
* 2. f_dmod & f_dnew flags if new directory entry is created. In this
|
||||
* case the reserved fields is cleared, but only if new dentry isn't
|
||||
* a LFN entry (has D_LFN attribute).
|
||||
* Return value.
|
||||
* TRUE - all OK.
|
||||
* FALSE - error occured (fnode is released).
|
||||
|
@ -406,8 +412,6 @@ BOOL dir_write(REG f_node_ptr fnp)
|
|||
|
||||
VOID dir_close(REG f_node_ptr fnp)
|
||||
{
|
||||
REG COUNT disk = fnp->f_dpb->dpb_unit;
|
||||
|
||||
/* Test for invalid f_nodes */
|
||||
if (fnp == NULL)
|
||||
return;
|
||||
|
@ -418,7 +422,7 @@ VOID dir_close(REG f_node_ptr fnp)
|
|||
|
||||
#endif
|
||||
/* Clear buffers after release */
|
||||
flush_buffers(disk);
|
||||
flush_buffers(fnp->f_dpb->dpb_unit);
|
||||
|
||||
/* and release this instance of the fnode */
|
||||
release_f_node(fnp);
|
||||
|
@ -517,6 +521,9 @@ COUNT dos_findfirst(UCOUNT attr, BYTE * name)
|
|||
{
|
||||
dmp->dm_dircluster = fnp->f_dirstart; /* TE */
|
||||
memcpy(&SearchDir, &fnp->f_dir, sizeof(struct dirent));
|
||||
#ifdef DEBUG
|
||||
printf("dos_findfirst: %11s\n", fnp->f_dir.dir_name);
|
||||
#endif
|
||||
dir_close(fnp);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -629,6 +636,9 @@ COUNT dos_findnext(void)
|
|||
memcpy(&SearchDir, &fnp->f_dir, sizeof(struct dirent));
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("dos_findnext: %11s\n", fnp->f_dir.dir_name);
|
||||
#endif
|
||||
/* return the result */
|
||||
release_f_node(fnp);
|
||||
|
||||
|
|
|
@ -179,6 +179,28 @@ COUNT dos_close(COUNT fd)
|
|||
return SUCCESS;
|
||||
}
|
||||
|
||||
COUNT dos_commit(COUNT fd)
|
||||
{
|
||||
f_node_ptr fnp, fnp2;
|
||||
|
||||
/* Translate the fd into a useful pointer */
|
||||
fnp = xlt_fd(fd);
|
||||
|
||||
/* If the fd was invalid because it was out of range or the */
|
||||
/* requested file was not open, tell the caller and exit */
|
||||
/* note: an invalid fd is indicated by a 0 return */
|
||||
if (fnp == (f_node_ptr) 0 || fnp->f_count <= 0)
|
||||
return DE_INVLDHNDL;
|
||||
fnp2 = get_f_node();
|
||||
if (fnp2 == (f_node_ptr) 0)
|
||||
return DE_INVLDHNDL;
|
||||
|
||||
/* a copy of the fnode is closed meaning that the directory info
|
||||
is updated etc, but we keep our old info */
|
||||
memcpy(fnp2, fnp, sizeof(*fnp));
|
||||
return dos_close(xlt_fnp(fnp2));
|
||||
}
|
||||
|
||||
/* */
|
||||
/* split a path into it's component directory and file name */
|
||||
/* */
|
||||
|
@ -282,15 +304,14 @@ STATIC BOOL find_fname(f_node_ptr fnp, BYTE * fname, BYTE * fext)
|
|||
* Remove entries with D_LFN attribute preceeding the directory entry
|
||||
* pointed by fnp, fnode isn't modified (I hope).
|
||||
* Return value.
|
||||
* SUCCESS - completed successfully.
|
||||
* ERROR - error occured.
|
||||
* SUCCESS - completed successfully.
|
||||
* DE_BLKINVLD - error occured, fnode is released.
|
||||
* input: fnp with valid non-LFN directory entry, not equal to '..' or
|
||||
* '.'
|
||||
*/
|
||||
COUNT remove_lfn_entries(f_node_ptr fnp)
|
||||
{
|
||||
ULONG original_diroff = fnp->f_diroff;
|
||||
COUNT rc;
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
|
@ -298,17 +319,22 @@ COUNT remove_lfn_entries(f_node_ptr fnp)
|
|||
break;
|
||||
fnp->f_diroff -= 2 * DIRENT_SIZE;
|
||||
/* it cannot / should not get below 0 because of '.' and '..' */
|
||||
if ((rc = dir_read(fnp)) < 0)
|
||||
return rc;
|
||||
if (dir_read(fnp) <= 0) {
|
||||
dir_close(fnp);
|
||||
return DE_BLKINVLD;
|
||||
}
|
||||
if (fnp->f_dir.dir_attrib != D_LFN)
|
||||
break;
|
||||
fnp->f_dir.dir_name[0] = DELETED;
|
||||
fnp->f_flags.f_dmod = TRUE;
|
||||
dir_write(fnp);
|
||||
if (!dir_write(fnp)) return DE_BLKINVLD;
|
||||
}
|
||||
fnp->f_diroff = original_diroff - DIRENT_SIZE;
|
||||
if ((rc = dir_read(fnp)) < 0)
|
||||
return rc;
|
||||
if (dir_read(fnp) <= 0) {
|
||||
dir_close(fnp);
|
||||
return DE_BLKINVLD;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ UCOUNT link_fat32(struct dpb FAR * dpbp, CLUSTER Cluster1,
|
|||
|
||||
#endif
|
||||
|
||||
UCOUNT link_fat16(struct dpb FAR * dpbp, CLUSTER Cluster1,
|
||||
STATIC UCOUNT link_fat16(struct dpb FAR * dpbp, CLUSTER Cluster1,
|
||||
CLUSTER Cluster2)
|
||||
{
|
||||
UCOUNT idx;
|
||||
|
@ -266,7 +266,7 @@ UCOUNT link_fat16(struct dpb FAR * dpbp, CLUSTER Cluster1,
|
|||
return SUCCESS;
|
||||
}
|
||||
|
||||
UCOUNT link_fat12(struct dpb FAR * dpbp, CLUSTER Cluster1,
|
||||
STATIC UCOUNT link_fat12(struct dpb FAR * dpbp, CLUSTER Cluster1,
|
||||
CLUSTER Cluster2)
|
||||
{
|
||||
REG UBYTE FAR *fbp0, FAR * fbp1;
|
||||
|
|
133
kernel/fcbfns.c
133
kernel/fcbfns.c
|
@ -85,7 +85,7 @@ VOID FatGetDrvData(UCOUNT drive, UCOUNT FAR * spc, UCOUNT FAR * bps,
|
|||
WORD FcbParseFname(int wTestMode, BYTE FAR ** lpFileName, fcb FAR * lpFcb)
|
||||
{
|
||||
COUNT nIndex;
|
||||
WORD wRetCodeName, wRetCodeExt;
|
||||
WORD wRetCodeName = FALSE, wRetCodeExt = FALSE;
|
||||
|
||||
/* pjv -- ExtFcbToFcb? */
|
||||
/* Start out with some simple stuff first. Check if we are */
|
||||
|
@ -156,7 +156,7 @@ WORD FcbParseFname(int wTestMode, BYTE FAR ** lpFileName, fcb FAR * lpFcb)
|
|||
return (wRetCodeName | wRetCodeExt) ? PARSE_RET_WILD : PARSE_RET_NOWILD;
|
||||
}
|
||||
|
||||
BYTE FAR *ParseSkipWh(BYTE FAR * lpFileName)
|
||||
BYTE FAR * ParseSkipWh(BYTE FAR * lpFileName)
|
||||
{
|
||||
while (*lpFileName == ' ' || *lpFileName == '\t')
|
||||
++lpFileName;
|
||||
|
@ -191,13 +191,12 @@ BOOL TestFieldSeps(BYTE FAR * lpFileName)
|
|||
}
|
||||
#endif
|
||||
|
||||
BYTE FAR *GetNameField(BYTE FAR * lpFileName, BYTE FAR * lpDestField,
|
||||
BYTE FAR * GetNameField(BYTE FAR * lpFileName, BYTE FAR * lpDestField,
|
||||
COUNT nFieldSize, BOOL * pbWildCard)
|
||||
{
|
||||
COUNT nIndex = 0;
|
||||
BYTE cFill = ' ';
|
||||
|
||||
*pbWildCard = FALSE;
|
||||
while (*lpFileName != '\0' && !TestFieldSeps(lpFileName)
|
||||
&& nIndex < nFieldSize)
|
||||
{
|
||||
|
@ -222,7 +221,7 @@ BYTE FAR *GetNameField(BYTE FAR * lpFileName, BYTE FAR * lpDestField,
|
|||
return lpFileName;
|
||||
}
|
||||
|
||||
static VOID FcbNextRecord(fcb FAR * lpFcb)
|
||||
STATIC VOID FcbNextRecord(fcb FAR * lpFcb)
|
||||
{
|
||||
if (++lpFcb->fcb_curec > 128)
|
||||
{
|
||||
|
@ -231,19 +230,17 @@ static VOID FcbNextRecord(fcb FAR * lpFcb)
|
|||
}
|
||||
}
|
||||
|
||||
static ULONG FcbRec(VOID)
|
||||
STATIC ULONG FcbRec(VOID)
|
||||
{
|
||||
UWORD tmp = 128;
|
||||
|
||||
return ((ULONG) lpFcb->fcb_cublock * tmp) + lpFcb->fcb_curec;
|
||||
return ((ULONG) lpFcb->fcb_cublock * 128) + lpFcb->fcb_curec;
|
||||
}
|
||||
|
||||
BOOL FcbRead(xfcb FAR * lpXfcb, COUNT * nErrorCode)
|
||||
BOOL FcbRead(xfcb FAR * lpXfcb, COUNT * nErrorCode, UCOUNT recno)
|
||||
{
|
||||
sft FAR *s;
|
||||
LONG lPosit;
|
||||
ULONG lPosit;
|
||||
COUNT nRead;
|
||||
psp FAR *p = MK_FP(cu_psp, 0);
|
||||
BYTE far * FcbIoPtr = dta + recno * lpFcb->fcb_recsiz;
|
||||
|
||||
/* Convert to fcb if necessary */
|
||||
lpFcb = ExtFcbToFcb(lpXfcb);
|
||||
|
@ -266,7 +263,7 @@ BOOL FcbRead(xfcb FAR * lpXfcb, COUNT * nErrorCode)
|
|||
}
|
||||
|
||||
/* Do the read */
|
||||
nRead = DosReadSft(s, lpFcb->fcb_recsiz, p->ps_dta, nErrorCode);
|
||||
nRead = DosReadSft(s, lpFcb->fcb_recsiz, FcbIoPtr, nErrorCode);
|
||||
|
||||
/* Now find out how we will return and do it. */
|
||||
if (nRead == lpFcb->fcb_recsiz)
|
||||
|
@ -287,19 +284,19 @@ BOOL FcbRead(xfcb FAR * lpXfcb, COUNT * nErrorCode)
|
|||
}
|
||||
else
|
||||
{
|
||||
fmemset(&p->ps_dta[nRead], 0, lpFcb->fcb_recsiz - nRead);
|
||||
fmemset(FcbIoPtr + nRead, 0, lpFcb->fcb_recsiz - nRead);
|
||||
*nErrorCode = FCB_ERR_EOF;
|
||||
FcbNextRecord(lpFcb);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL FcbWrite(xfcb FAR * lpXfcb, COUNT * nErrorCode)
|
||||
BOOL FcbWrite(xfcb FAR * lpXfcb, COUNT * nErrorCode, UCOUNT recno)
|
||||
{
|
||||
sft FAR *s;
|
||||
LONG lPosit;
|
||||
ULONG lPosit;
|
||||
COUNT nWritten;
|
||||
psp FAR *p = MK_FP(cu_psp, 0);
|
||||
BYTE far * FcbIoPtr = dta + recno * lpFcb->fcb_recsiz;
|
||||
|
||||
/* Convert to fcb if necessary */
|
||||
lpFcb = ExtFcbToFcb(lpXfcb);
|
||||
|
@ -321,7 +318,7 @@ BOOL FcbWrite(xfcb FAR * lpXfcb, COUNT * nErrorCode)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
nWritten = DosWriteSft(s, lpFcb->fcb_recsiz, p->ps_dta, nErrorCode);
|
||||
nWritten = DosWriteSft(s, lpFcb->fcb_recsiz, FcbIoPtr, nErrorCode);
|
||||
|
||||
/* Now find out how we will return and do it. */
|
||||
if (nWritten == lpFcb->fcb_recsiz)
|
||||
|
@ -355,7 +352,7 @@ BOOL FcbGetFileSize(xfcb FAR * lpXfcb)
|
|||
hndl = DosOpen(SecPathName, O_RDONLY);
|
||||
if (hndl >= 0)
|
||||
{
|
||||
LONG fsize;
|
||||
ULONG fsize;
|
||||
|
||||
/* Get the size */
|
||||
fsize = DosGetFsize(hndl);
|
||||
|
@ -401,13 +398,15 @@ BOOL FcbCalcRec(xfcb FAR * lpXfcb)
|
|||
BOOL FcbRandomBlockRead(xfcb FAR * lpXfcb, COUNT nRecords,
|
||||
COUNT * nErrorCode)
|
||||
{
|
||||
UCOUNT recno = 0;
|
||||
|
||||
FcbCalcRec(lpXfcb);
|
||||
|
||||
/* Convert to fcb if necessary */
|
||||
lpFcb = ExtFcbToFcb(lpXfcb);
|
||||
|
||||
do
|
||||
FcbRead(lpXfcb, nErrorCode);
|
||||
FcbRead(lpXfcb, nErrorCode, recno++);
|
||||
while ((--nRecords > 0) && (*nErrorCode == 0));
|
||||
|
||||
/* Now update the fcb */
|
||||
|
@ -419,13 +418,15 @@ BOOL FcbRandomBlockRead(xfcb FAR * lpXfcb, COUNT nRecords,
|
|||
BOOL FcbRandomBlockWrite(xfcb FAR * lpXfcb, COUNT nRecords,
|
||||
COUNT * nErrorCode)
|
||||
{
|
||||
UCOUNT recno = 0;
|
||||
|
||||
FcbCalcRec(lpXfcb);
|
||||
|
||||
/* Convert to fcb if necessary */
|
||||
lpFcb = ExtFcbToFcb(lpXfcb);
|
||||
|
||||
do
|
||||
FcbWrite(lpXfcb, nErrorCode);
|
||||
FcbWrite(lpXfcb, nErrorCode, recno++);
|
||||
while ((--nRecords > 0) && (*nErrorCode == 0));
|
||||
|
||||
/* Now update the fcb */
|
||||
|
@ -434,8 +435,7 @@ BOOL FcbRandomBlockWrite(xfcb FAR * lpXfcb, COUNT nRecords,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL FcbRandomIO(xfcb FAR * lpXfcb, COUNT * nErrorCode,
|
||||
BOOL(*FcbFunc) (xfcb FAR *, COUNT *))
|
||||
BOOL FcbRandomIO(xfcb FAR * lpXfcb, COUNT * nErrorCode, FcbFunc_t *FcbFunc)
|
||||
{
|
||||
UWORD uwCurrentBlock;
|
||||
UBYTE ucCurrentRecord;
|
||||
|
@ -448,48 +448,58 @@ BOOL FcbRandomIO(xfcb FAR * lpXfcb, COUNT * nErrorCode,
|
|||
uwCurrentBlock = lpFcb->fcb_cublock;
|
||||
ucCurrentRecord = lpFcb->fcb_curec;
|
||||
|
||||
(*FcbFunc) (lpXfcb, nErrorCode);
|
||||
(*FcbFunc) (lpXfcb, nErrorCode, 0);
|
||||
|
||||
lpFcb->fcb_cublock = uwCurrentBlock;
|
||||
lpFcb->fcb_curec = ucCurrentRecord;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
static sft FAR *FcbGetFreeSft(COUNT * sft_idx)
|
||||
see get_free_sft in dosfns.c
|
||||
*/
|
||||
|
||||
BOOL FcbCreate(xfcb FAR * lpXfcb)
|
||||
/* merged fcbOpen and FcbCreate - saves ~200 byte */
|
||||
BOOL FcbOpenCreate(xfcb FAR * lpXfcb, BOOL Create)
|
||||
{
|
||||
sft FAR *sftp;
|
||||
COUNT sft_idx, FcbDrive;
|
||||
struct dhdr FAR *dhp;
|
||||
|
||||
/* Build a traditional DOS file name */
|
||||
lpFcb = CommonFcbInit(lpXfcb, PriPathName, &FcbDrive);
|
||||
|
||||
sft_idx = DosCreatSft(PriPathName, 0);
|
||||
if (Create)
|
||||
{
|
||||
sft_idx = DosCreatSft(PriPathName, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
sft_idx = DosOpenSft(PriPathName, O_RDWR | SFT_MFCB);
|
||||
|
||||
/* if file is RDONLY, try to open rdonly */
|
||||
if (sft_idx == DE_ACCESS)
|
||||
sft_idx = DosOpenSft(PriPathName, O_RDONLY | SFT_MFCB);
|
||||
}
|
||||
|
||||
if (sft_idx < 0)
|
||||
return FALSE;
|
||||
|
||||
sftp = idx_to_sft(sft_idx);
|
||||
sftp->sft_mode |= SFT_MFCB;
|
||||
|
||||
/* check for a device */
|
||||
dhp = IsDevice(PriPathName);
|
||||
lpFcb->fcb_sftno = sft_idx;
|
||||
lpFcb->fcb_curec = 0;
|
||||
lpFcb->fcb_recsiz = (dhp ? 0 : 128);
|
||||
if (!dhp)
|
||||
lpFcb->fcb_drive = FcbDrive;
|
||||
lpFcb->fcb_fsize = 0;
|
||||
lpFcb->fcb_date = dos_getdate();
|
||||
lpFcb->fcb_time = dos_gettime();
|
||||
lpFcb->fcb_rndm = 0;
|
||||
|
||||
lpFcb->fcb_recsiz = 0; /* true for devices */
|
||||
if (sftp->sft_flags & SFT_FDEVICE) /* check for a device */
|
||||
{
|
||||
lpFcb->fcb_drive = FcbDrive;
|
||||
lpFcb->fcb_recsiz = 128;
|
||||
}
|
||||
lpFcb->fcb_fsize = sftp->sft_size;
|
||||
lpFcb->fcb_date = sftp->sft_date;
|
||||
lpFcb->fcb_time = sftp->sft_time;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
STATIC fcb FAR *ExtFcbToFcb(xfcb FAR * lpExtFcb)
|
||||
{
|
||||
if (*((UBYTE FAR *) lpExtFcb) == 0xff)
|
||||
|
@ -535,45 +545,6 @@ void FcbNameInit(fcb FAR * lpFcb, BYTE * szBuffer, COUNT * pCurDrive)
|
|||
/* XXX fix truename error handling */
|
||||
}
|
||||
|
||||
BOOL FcbOpen(xfcb FAR * lpXfcb)
|
||||
{
|
||||
sft FAR *sftp;
|
||||
struct dhdr FAR *dhp;
|
||||
COUNT FcbDrive, sft_idx;
|
||||
|
||||
/* Build a traditional DOS file name */
|
||||
lpFcb = CommonFcbInit(lpXfcb, PriPathName, &FcbDrive);
|
||||
|
||||
sft_idx = DosOpenSft(PriPathName, O_RDWR);
|
||||
if (sft_idx < 0)
|
||||
return FALSE;
|
||||
|
||||
sftp = idx_to_sft(sft_idx);
|
||||
sftp->sft_mode |= SFT_MFCB;
|
||||
|
||||
/* check for a device */
|
||||
lpFcb->fcb_curec = 0;
|
||||
lpFcb->fcb_rndm = 0;
|
||||
lpFcb->fcb_sftno = sft_idx;
|
||||
dhp = IsDevice(PriPathName);
|
||||
if (dhp)
|
||||
{
|
||||
lpFcb->fcb_recsiz = 0;
|
||||
lpFcb->fcb_fsize = 0;
|
||||
lpFcb->fcb_date = dos_getdate();
|
||||
lpFcb->fcb_time = dos_gettime();
|
||||
}
|
||||
else
|
||||
{
|
||||
lpFcb->fcb_drive = FcbDrive;
|
||||
lpFcb->fcb_recsiz = 128;
|
||||
lpFcb->fcb_fsize = sftp->sft_size;
|
||||
lpFcb->fcb_date = sftp->sft_date;
|
||||
lpFcb->fcb_time = sftp->sft_time;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL FcbDelete(xfcb FAR * lpXfcb)
|
||||
{
|
||||
COUNT FcbDrive;
|
||||
|
@ -739,7 +710,7 @@ BOOL FcbClose(xfcb FAR * lpXfcb)
|
|||
if (!(s->sft_flags & SFT_FSHARED))
|
||||
dos_setfsize(s->sft_status, lpFcb->fcb_fsize);
|
||||
DosSetFtimeSft(lpFcb->fcb_sftno, lpFcb->fcb_date, lpFcb->fcb_time);
|
||||
if (DosCloseSft(lpFcb->fcb_sftno) == SUCCESS)
|
||||
if (DosCloseSft(lpFcb->fcb_sftno, FALSE) == SUCCESS)
|
||||
{
|
||||
lpFcb->fcb_sftno = (BYTE) 0xff;
|
||||
return TRUE;
|
||||
|
@ -755,7 +726,7 @@ VOID FcbCloseAll()
|
|||
|
||||
for (idx = 0; (sftp = idx_to_sft(idx)) != (sft FAR *) - 1; idx++)
|
||||
if ((sftp->sft_mode & SFT_MFCB) && sftp->sft_psp == cu_psp)
|
||||
DosCloseSft(idx);
|
||||
DosCloseSft(idx, FALSE);
|
||||
}
|
||||
|
||||
BOOL FcbFindFirst(xfcb FAR * lpXfcb)
|
||||
|
|
183
kernel/globals.h
183
kernel/globals.h
|
@ -43,7 +43,6 @@ static BYTE *Globals_hRcsId =
|
|||
#include "fcb.h"
|
||||
#include "tail.h"
|
||||
#include "process.h"
|
||||
#include "dcb.h"
|
||||
#include "sft.h"
|
||||
#include "cds.h"
|
||||
#include "exe.h"
|
||||
|
@ -57,8 +56,24 @@ static BYTE *Globals_hRcsId =
|
|||
#include "network.h"
|
||||
#include "config.h"
|
||||
#include "buffer.h"
|
||||
#include "dcb.h"
|
||||
#include "xstructs.h"
|
||||
|
||||
/* fatfs.c */
|
||||
#ifdef WITHFAT32
|
||||
VOID bpb_to_dpb(bpb FAR * bpbp, REG struct dpb FAR * dpbp, BOOL extended);
|
||||
#else
|
||||
VOID bpb_to_dpb(bpb FAR * bpbp, REG struct dpb FAR * dpbp);
|
||||
#endif
|
||||
|
||||
#ifdef WITHFAT32
|
||||
struct dpb FAR *GetDriveDPB(UBYTE drive, COUNT * rc);
|
||||
#endif
|
||||
|
||||
extern struct dpb
|
||||
FAR * ASM DPBp; /* First drive Parameter Block */
|
||||
|
||||
|
||||
/* JPP: for testing/debuging disk IO */
|
||||
/*#define DISPLAY_GETBLOCK */
|
||||
|
||||
|
@ -155,12 +170,12 @@ typedef BYTE *UPMAP;
|
|||
/* External Assembly variables */
|
||||
/* */
|
||||
extern struct dhdr
|
||||
FAR clk_dev, /* Clock device driver */
|
||||
FAR con_dev, /* Console device driver */
|
||||
FAR prn_dev, /* Generic printer device driver */
|
||||
FAR aux_dev, /* Generic aux device driver */
|
||||
FAR blk_dev; /* Block device (Disk) driver */
|
||||
extern UWORD ram_top; /* How much ram in Kbytes */
|
||||
FAR ASM clk_dev, /* Clock device driver */
|
||||
FAR ASM con_dev, /* Console device driver */
|
||||
FAR ASM prn_dev, /* Generic printer device driver */
|
||||
FAR ASM aux_dev, /* Generic aux device driver */
|
||||
FAR ASM blk_dev; /* Block device (Disk) driver */
|
||||
extern UWORD ASM ram_top; /* How much ram in Kbytes */
|
||||
extern COUNT *error_tos, /* error stack */
|
||||
disk_api_tos, /* API handler stack - disk fns */
|
||||
char_api_tos; /* API handler stack - char fns */
|
||||
|
@ -172,7 +187,7 @@ extern
|
|||
BYTE DosLoadedInHMA; /* if InitHMA has moved DOS up */
|
||||
|
||||
extern struct ClockRecord
|
||||
ClkRecord;
|
||||
ASM ClkRecord;
|
||||
|
||||
/* */
|
||||
/* Global variables */
|
||||
|
@ -239,66 +254,64 @@ Freeman Publishing, Lawrence KS, USA (ISBN 0-87930-436-7).\n\
|
|||
/* ARE DOCUMENTED AS UNDOCUMENTED (?) AND HAVE MANY PROGRAMS AND TSR'S */
|
||||
/* ACCESSING THEM */
|
||||
|
||||
extern UWORD NetBios;
|
||||
extern BYTE *net_name;
|
||||
extern BYTE net_set_count;
|
||||
extern BYTE NetDelay, NetRetry;
|
||||
extern UWORD ASM NetBios;
|
||||
extern BYTE * ASM net_name;
|
||||
extern BYTE ASM net_set_count;
|
||||
extern BYTE ASM NetDelay, ASM NetRetry;
|
||||
|
||||
extern UWORD first_mcb, /* Start of user memory */
|
||||
UMB_top, umb_start, uppermem_root; /* Start of umb chain ? */
|
||||
extern struct dpb
|
||||
FAR *DPBp; /* First drive Parameter Block */
|
||||
extern sfttbl FAR * sfthead; /* System File Table head */
|
||||
extern UWORD ASM first_mcb, /* Start of user memory */
|
||||
ASM UMB_top, ASM umb_start, ASM uppermem_root; /* Start of umb chain ? */
|
||||
extern sfttbl FAR * ASM sfthead; /* System File Table head */
|
||||
extern struct dhdr
|
||||
FAR *clock, /* CLOCK$ device */
|
||||
FAR * syscon; /* console device */
|
||||
extern WORD maxbksize; /* Number of Drives in system */
|
||||
FAR * ASM clock, /* CLOCK$ device */
|
||||
FAR * ASM syscon; /* console device */
|
||||
extern WORD ASM maxbksize; /* Number of Drives in system */
|
||||
extern struct buffer
|
||||
FAR *firstbuf; /* head of buffers linked list */
|
||||
extern cdstbl FAR * CDSp; /* Current Directory Structure */
|
||||
FAR *ASM firstbuf; /* head of buffers linked list */
|
||||
extern cdstbl FAR * ASM CDSp; /* Current Directory Structure */
|
||||
extern
|
||||
struct cds FAR *current_ldt;
|
||||
extern LONG current_filepos; /* current file position */
|
||||
extern sfttbl FAR * FCBp; /* FCB table pointer */
|
||||
extern WORD nprotfcb; /* number of protected fcbs */
|
||||
extern UBYTE nblkdev, /* number of block devices */
|
||||
lastdrive, /* value of last drive */
|
||||
uppermem_link, /* UMB Link flag */
|
||||
PrinterEcho; /* Printer Echo Flag */
|
||||
struct cds FAR * ASM current_ldt;
|
||||
extern LONG ASM current_filepos; /* current file position */
|
||||
extern sfttbl FAR * ASM FCBp; /* FCB table pointer */
|
||||
extern WORD ASM nprotfcb; /* number of protected fcbs */
|
||||
extern UBYTE ASM nblkdev, /* number of block devices */
|
||||
ASM lastdrive, /* value of last drive */
|
||||
ASM uppermem_link, /* UMB Link flag */
|
||||
ASM PrinterEcho; /* Printer Echo Flag */
|
||||
|
||||
extern UWORD LoL_nbuffers; /* Number of buffers */
|
||||
extern UWORD ASM LoL_nbuffers; /* Number of buffers */
|
||||
|
||||
extern struct dhdr
|
||||
nul_dev;
|
||||
extern UBYTE mem_access_mode; /* memory allocation scheme */
|
||||
extern BYTE ErrorMode, /* Critical error flag */
|
||||
InDOS, /* In DOS critical section */
|
||||
OpenMode, /* File Open Attributes */
|
||||
SAttr, /* Attrib Mask for Dir Search */
|
||||
dosidle_flag, Server_Call, CritErrLocus, CritErrAction, CritErrClass, VgaSet, njoined; /* number of joined devices */
|
||||
ASM nul_dev;
|
||||
extern UBYTE ASM mem_access_mode; /* memory allocation scheme */
|
||||
extern BYTE ASM ErrorMode, /* Critical error flag */
|
||||
ASM InDOS, /* In DOS critical section */
|
||||
ASM OpenMode, /* File Open Attributes */
|
||||
ASM SAttr, /* Attrib Mask for Dir Search */
|
||||
ASM dosidle_flag, ASM Server_Call, ASM CritErrLocus, ASM CritErrAction, ASM CritErrClass, VgaSet, njoined; /* number of joined devices */
|
||||
|
||||
extern UWORD Int21AX;
|
||||
extern COUNT CritErrCode;
|
||||
extern BYTE FAR *CritErrDev;
|
||||
extern UWORD ASM Int21AX;
|
||||
extern COUNT ASM CritErrCode;
|
||||
extern BYTE FAR * ASM CritErrDev;
|
||||
|
||||
extern struct dirent
|
||||
SearchDir;
|
||||
ASM SearchDir;
|
||||
|
||||
extern struct {
|
||||
COUNT nDrive;
|
||||
BYTE szName[FNAME_SIZE + 1];
|
||||
BYTE szExt[FEXT_SIZE + 1];
|
||||
} FcbSearchBuffer;
|
||||
} ASM FcbSearchBuffer;
|
||||
|
||||
extern struct /* Path name parsing buffer */
|
||||
{
|
||||
BYTE _PriPathName[128];
|
||||
} _PriPathBuffer;
|
||||
} ASM _PriPathBuffer;
|
||||
|
||||
extern struct {
|
||||
BYTE _fname[FNAME_SIZE];
|
||||
BYTE _fext[FEXT_SIZE + 1]; /* space for 0 */
|
||||
} szNames;
|
||||
} ASM szNames;
|
||||
|
||||
#define PriPathName _PriPathBuffer._PriPathName
|
||||
#define szDirName TempCDS.cdsCurrentPath
|
||||
|
@ -308,49 +321,46 @@ extern struct {
|
|||
extern struct /* Alternate path name parsing buffer */
|
||||
{
|
||||
BYTE _SecPathName[128];
|
||||
} _SecPathBuffer;
|
||||
} ASM _SecPathBuffer;
|
||||
|
||||
#define SecPathName _SecPathBuffer._SecPathName
|
||||
|
||||
extern UWORD wAttr;
|
||||
extern UWORD ASM wAttr;
|
||||
|
||||
extern BYTE default_drive; /* default drive for dos */
|
||||
extern BYTE ASM default_drive; /* default drive for dos */
|
||||
|
||||
extern BYTE TempBuffer[], /* Temporary general purpose buffer */
|
||||
FAR internal_data[], /* sda areas */
|
||||
FAR swap_always[], /* " " */
|
||||
FAR swap_indos[], /* " " */
|
||||
tsr, /* true if program is TSR */
|
||||
break_flg, /* true if break was detected */
|
||||
break_ena, /* break enabled flag */
|
||||
FAR * dta; /* Disk transfer area (kludge) */
|
||||
extern seg cu_psp; /* current psp segment */
|
||||
extern iregs FAR * user_r; /* User registers for int 21h call */
|
||||
extern BYTE ASM TempBuffer[], /* Temporary general purpose buffer */
|
||||
FAR ASM internal_data[], /* sda areas */
|
||||
FAR ASM swap_always[], /* " " */
|
||||
FAR ASM swap_indos[], /* " " */
|
||||
ASM tsr, /* true if program is TSR */
|
||||
ASM break_flg, /* true if break was detected */
|
||||
ASM break_ena, /* break enabled flag */
|
||||
FAR * ASM dta; /* Disk transfer area (kludge) */
|
||||
extern seg ASM cu_psp; /* current psp segment */
|
||||
extern iregs FAR * ASM user_r; /* User registers for int 21h call */
|
||||
|
||||
extern struct dirent /* Temporary directory entry */
|
||||
DirEntBuffer;
|
||||
ASM DirEntBuffer;
|
||||
|
||||
extern request /* I/O Request packets */
|
||||
CharReqHdr, IoReqHdr, MediaReqHdr;
|
||||
extern fcb FAR * ASM lpFcb; /* Pointer to users fcb */
|
||||
|
||||
extern fcb FAR * lpFcb; /* Pointer to users fcb */
|
||||
extern sft FAR * ASM lpCurSft;
|
||||
|
||||
extern sft FAR * lpCurSft;
|
||||
extern BYTE ASM verify_ena, /* verify enabled flag */
|
||||
ASM switchar, /* switch char */
|
||||
ASM return_mode, /* Process termination rets */
|
||||
ASM return_code; /* " " " */
|
||||
|
||||
extern BYTE verify_ena, /* verify enabled flag */
|
||||
switchar, /* switch char */
|
||||
return_mode, /* Process termination rets */
|
||||
return_code; /* " " " */
|
||||
|
||||
extern BYTE BootDrive, /* Drive we came up from */
|
||||
scr_pos; /* screen position for bs, ht, etc */
|
||||
extern BYTE ASM BootDrive, /* Drive we came up from */
|
||||
ASM scr_pos; /* screen position for bs, ht, etc */
|
||||
/*extern WORD
|
||||
NumFloppies; !!*//* How many floppies we have */
|
||||
|
||||
extern keyboard kb_buf;
|
||||
extern keyboard ASM kb_buf;
|
||||
|
||||
extern struct cds
|
||||
TempCDS;
|
||||
ASM TempCDS;
|
||||
|
||||
/* start of uncontrolled variables */
|
||||
GLOBAL seg RootPsp; /* Root process -- do not abort */
|
||||
|
@ -382,28 +392,25 @@ GLOBAL UWORD f_nodes_cnt; /* number of allocated f_nodes */
|
|||
|
||||
/* Process related functions - not under automatic generation. */
|
||||
/* Typically, these are in ".asm" files. */
|
||||
VOID FAR ASMCFUNC cpm_entry(VOID)
|
||||
VOID ASMCFUNC FAR cpm_entry(VOID)
|
||||
/*INRPT FAR handle_break(VOID) */ ;
|
||||
VOID enable(VOID), disable(VOID);
|
||||
COUNT
|
||||
ASMCFUNC CriticalError(COUNT nFlag, COUNT nDrive, COUNT nError,
|
||||
COUNT ASMCFUNC
|
||||
CriticalError(COUNT nFlag, COUNT nDrive, COUNT nError,
|
||||
struct dhdr FAR * lpDevice);
|
||||
|
||||
#ifdef PROTO
|
||||
VOID FAR ASMCFUNC CharMapSrvc(VOID);
|
||||
VOID FAR ASMCFUNC set_stack(VOID);
|
||||
VOID FAR ASMCFUNC restore_stack(VOID);
|
||||
WORD ASMCFUNC execrh(request FAR *, struct dhdr FAR *);
|
||||
VOID exit(COUNT);
|
||||
VOID ASMCFUNC FAR CharMapSrvc(VOID);
|
||||
VOID ASMCFUNC FAR set_stack(VOID);
|
||||
VOID ASMCFUNC FAR restore_stack(VOID);
|
||||
/*VOID INRPT FAR handle_break(VOID); */
|
||||
VOID ASMCFUNC tmark(VOID);
|
||||
BOOL ASMCFUNC tdelay(LONG);
|
||||
BYTE FAR *ASMCFUNC device_end(VOID);
|
||||
VOID ASMCFUNC ReadPCClock(ULONG *);
|
||||
BYTE FAR * ASMCFUNC device_end(VOID);
|
||||
COUNT ASMCFUNC kb_data(VOID);
|
||||
COUNT ASMCFUNC kb_input(VOID);
|
||||
COUNT ASMCFUNC kb_init(VOID);
|
||||
VOID ASMCFUNC setvec(UWORD, VOID(INRPT FAR *) ());
|
||||
BYTE FAR *ASMCFUNC getvec(UWORD);
|
||||
VOID ASMCFUNC setvec(UWORD, intvec);
|
||||
intvec ASMCFUNC getvec(UWORD);
|
||||
COUNT con(COUNT);
|
||||
#else
|
||||
VOID FAR CharMapSrvc();
|
||||
|
@ -412,14 +419,12 @@ VOID FAR restore_stack();
|
|||
WORD execrh();
|
||||
VOID exit();
|
||||
/*VOID INRPT FAR handle_break(); */
|
||||
VOID tmark();
|
||||
BOOL tdelay();
|
||||
BYTE FAR *device_end();
|
||||
COUNT kb_data();
|
||||
COUNT kb_input();
|
||||
COUNT kb_init();
|
||||
VOID setvec();
|
||||
BYTE FAR *getvec();
|
||||
intvec getvec();
|
||||
COUNT con();
|
||||
#endif
|
||||
|
||||
|
@ -459,7 +464,7 @@ VOID fputbyte();
|
|||
#endif
|
||||
|
||||
#ifdef I86
|
||||
#define setvec(n, isr) (void)(*(VOID (INRPT FAR * FAR *)())(MK_FP(0,4 * (n))) = (isr))
|
||||
#define setvec(n, isr) (void)(*(intvec FAR *)MK_FP(0,4 * (n)) = (isr))
|
||||
#endif
|
||||
/*#define is_leap_year(y) ((y) & 3 ? 0 : (y) % 100 ? 1 : (y) % 400 ? 0 : 1) */
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "fat.h"
|
||||
#include "fnode.h"
|
||||
#include "file.h"
|
||||
#include "dcb.h"
|
||||
#include "cds.h"
|
||||
#include "device.h"
|
||||
#include "kbd.h"
|
||||
|
@ -20,15 +19,11 @@
|
|||
#include "pcb.h"
|
||||
#include "nls.h"
|
||||
#include "buffer.h"
|
||||
#include "dcb.h"
|
||||
|
||||
#include "KConfig.h"
|
||||
extern struct _KernelConfig InitKernelConfig;
|
||||
|
||||
/*
|
||||
* The null macro `INIT' can be used to allow the reader to differentiate
|
||||
* between functions defined in `INIT_TEXT' and those defined in `_TEXT'.
|
||||
*/
|
||||
#define INIT
|
||||
/*
|
||||
* Functions in `INIT_TEXT' may need to call functions in `_TEXT'. The entry
|
||||
* calls for the latter functions therefore need to be wrapped up with far
|
||||
|
@ -57,9 +52,9 @@ COUNT ASMCFUNC strlen(REG BYTE * s);
|
|||
|
||||
/*inithma.c*/
|
||||
extern BYTE DosLoadedInHMA;
|
||||
extern fmemcmp(BYTE far * s1, BYTE FAR * s2, unsigned len);
|
||||
int fmemcmp(BYTE far * s1, BYTE FAR * s2, unsigned len);
|
||||
|
||||
#define setvec(n, isr) (void)(*(VOID (FAR * FAR *)())(MK_FP(0,4 * (n))) = (isr))
|
||||
#define setvec(n, isr) (void)(*(intvec FAR *)MK_FP(0,4 * (n)) = (isr))
|
||||
|
||||
#define fbcopy(s, d, n) fmemcpy(d,s,n)
|
||||
#define GLOBAL extern
|
||||
|
@ -69,7 +64,7 @@ extern fmemcmp(BYTE far * s1, BYTE FAR * s2, unsigned len);
|
|||
#define NFCBS 16 /* number of fcbs */
|
||||
#define NSTACKS 8 /* number of stacks */
|
||||
#define NLAST 5 /* last drive */
|
||||
#define NUMBUFF 6 /* Number of track buffers */
|
||||
#define NUMBUFF 20 /* Number of track buffers at INIT time */
|
||||
/* -- must be at least 3 */
|
||||
#define MAX_HARD_DRIVE 8
|
||||
#define NDEV 26 /* up to Z: */
|
||||
|
@ -116,22 +111,22 @@ struct config {
|
|||
extern struct config Config;
|
||||
|
||||
/* config.c */
|
||||
INIT VOID PreConfig(VOID);
|
||||
INIT VOID DoConfig(VOID);
|
||||
INIT VOID PostConfig(VOID);
|
||||
INIT BYTE FAR *KernelAlloc(WORD nBytes);
|
||||
INIT BYTE *skipwh(BYTE * s);
|
||||
INIT BYTE *scan(BYTE * s, BYTE * d);
|
||||
INIT BOOL isnum(BYTE * pszString);
|
||||
INIT BYTE *GetNumber(REG BYTE * pszString, REG COUNT * pnNum);
|
||||
INIT COUNT tolower(COUNT c);
|
||||
INIT COUNT toupper(COUNT c);
|
||||
INIT VOID mcb_init(UCOUNT seg, UWORD size);
|
||||
INIT VOID strcat(REG BYTE * d, REG BYTE * s);
|
||||
INIT BYTE FAR *KernelAlloc(WORD nBytes);
|
||||
INIT COUNT ASMCFUNC Umb_Test(void);
|
||||
INIT COUNT ASMCFUNC UMB_get_largest(UCOUNT * seg, UCOUNT * size);
|
||||
INIT BYTE *GetStringArg(BYTE * pLine, BYTE * pszString);
|
||||
VOID PreConfig(VOID);
|
||||
VOID DoConfig(int pass);
|
||||
VOID PostConfig(VOID);
|
||||
BYTE FAR * KernelAlloc(WORD nBytes);
|
||||
BYTE * skipwh(BYTE * s);
|
||||
BYTE * scan(BYTE * s, BYTE * d);
|
||||
BOOL isnum(BYTE * pszString);
|
||||
BYTE * GetNumber(REG BYTE * pszString, REG COUNT * pnNum);
|
||||
COUNT tolower(COUNT c);
|
||||
COUNT toupper(COUNT c);
|
||||
VOID mcb_init(UCOUNT seg, UWORD size);
|
||||
VOID strcat(REG BYTE * d, REG BYTE * s);
|
||||
BYTE FAR * KernelAlloc(WORD nBytes);
|
||||
COUNT ASMCFUNC Umb_Test(void);
|
||||
COUNT ASMCFUNC UMB_get_largest(UCOUNT * seg, UCOUNT * size);
|
||||
BYTE * GetStringArg(BYTE * pLine, BYTE * pszString);
|
||||
|
||||
/* diskinit.c */
|
||||
COUNT dsk_init(VOID);
|
||||
|
@ -141,7 +136,7 @@ COUNT ASMCFUNC Umb_Test(void);
|
|||
|
||||
/* inithma.c */
|
||||
int MoveKernelToHMA(void);
|
||||
VOID FAR *HMAalloc(COUNT bytesToAllocate);
|
||||
VOID FAR * HMAalloc(COUNT bytesToAllocate);
|
||||
|
||||
/* initoem.c */
|
||||
UWORD init_oem(void);
|
||||
|
@ -154,43 +149,43 @@ int ASMCFUNC open(const char *pathname, int flags);
|
|||
int ASMCFUNC close(int fd);
|
||||
int ASMCFUNC dup2(int oldfd, int newfd);
|
||||
int ASMCFUNC allocmem(UWORD size, seg * segp);
|
||||
INIT VOID ASMCFUNC init_PSPInit(seg psp_seg);
|
||||
INIT VOID ASMCFUNC init_PSPSet(seg psp_seg);
|
||||
INIT COUNT ASMCFUNC init_DosExec(COUNT mode, exec_blk * ep, BYTE * lp);
|
||||
INIT VOID ASMCFUNC keycheck(VOID);
|
||||
VOID ASMCFUNC init_PSPInit(seg psp_seg);
|
||||
VOID ASMCFUNC init_PSPSet(seg psp_seg);
|
||||
COUNT ASMCFUNC init_DosExec(COUNT mode, exec_blk * ep, BYTE * lp);
|
||||
VOID ASMCFUNC keycheck(VOID);
|
||||
|
||||
/* irqstack.asm */
|
||||
VOID ASMCFUNC init_stacks(VOID FAR * stack_base, COUNT nStacks,
|
||||
WORD stackSize);
|
||||
|
||||
/* inthndlr.c */
|
||||
VOID far ASMCFUNC int21_entry(iregs UserRegs);
|
||||
VOID ASMCFUNC FAR int21_entry(iregs UserRegs);
|
||||
VOID ASMCFUNC int21_service(iregs far * r);
|
||||
VOID FAR ASMCFUNC int0_handler(void);
|
||||
VOID FAR ASMCFUNC int6_handler(void);
|
||||
VOID FAR ASMCFUNC empty_handler(void);
|
||||
VOID far ASMCFUNC got_cbreak(void); /* procsupt.asm */
|
||||
VOID far ASMCFUNC int20_handler(iregs UserRegs);
|
||||
VOID far ASMCFUNC int21_handler(iregs UserRegs);
|
||||
VOID FAR ASMCFUNC int22_handler(void);
|
||||
VOID FAR ASMCFUNC int24_handler(void);
|
||||
VOID FAR ASMCFUNC low_int25_handler(void);
|
||||
VOID FAR ASMCFUNC low_int26_handler(void);
|
||||
VOID FAR ASMCFUNC int27_handler(void);
|
||||
VOID FAR ASMCFUNC int28_handler(void);
|
||||
VOID FAR ASMCFUNC int29_handler(void);
|
||||
VOID FAR ASMCFUNC int2a_handler(void);
|
||||
VOID FAR ASMCFUNC int2f_handler(void);
|
||||
VOID CDECL FAR int0_handler(void);
|
||||
VOID ASMCFUNC FAR int6_handler(void);
|
||||
VOID ASMCFUNC FAR empty_handler(void);
|
||||
VOID ASMCFUNC FAR got_cbreak(void); /* procsupt.asm */
|
||||
VOID ASMCFUNC FAR int20_handler(iregs UserRegs);
|
||||
VOID ASMCFUNC FAR int21_handler(iregs UserRegs);
|
||||
VOID ASMCFUNC FAR int22_handler(void);
|
||||
VOID ASMCFUNC FAR int24_handler(void);
|
||||
VOID ASMCFUNC FAR low_int25_handler(void);
|
||||
VOID ASMCFUNC FAR low_int26_handler(void);
|
||||
VOID ASMCFUNC FAR int27_handler(void);
|
||||
VOID ASMCFUNC FAR int28_handler(void);
|
||||
VOID ASMCFUNC FAR int29_handler(void);
|
||||
VOID ASMCFUNC FAR int2a_handler(void);
|
||||
VOID ASMCFUNC FAR int2f_handler(void);
|
||||
|
||||
/* main.c */
|
||||
INIT VOID ASMCFUNC FreeDOSmain(void);
|
||||
INIT BOOL init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine,
|
||||
VOID ASMCFUNC FreeDOSmain(void);
|
||||
BOOL init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine,
|
||||
COUNT mode, COUNT top);
|
||||
INIT VOID init_fatal(BYTE * err_msg);
|
||||
VOID init_fatal(BYTE * err_msg);
|
||||
|
||||
/* prf.c */
|
||||
WORD init_printf(CONST BYTE * fmt, ...);
|
||||
WORD init_sprintf(BYTE * buff, CONST BYTE * fmt, ...);
|
||||
WORD ASMCFUNC init_printf(CONST BYTE * fmt, ...);
|
||||
WORD ASMCFUNC init_sprintf(BYTE * buff, CONST BYTE * fmt, ...);
|
||||
|
||||
void MoveKernel(unsigned NewKernelSegment);
|
||||
extern WORD HMAFree; /* first byte in HMA not yet used */
|
||||
|
@ -198,8 +193,8 @@ extern WORD HMAFree; /* first byte in HMA not yet used */
|
|||
extern unsigned CurrentKernelSegment;
|
||||
|
||||
#if defined(WATCOM) && 0
|
||||
ULONG FAR ASMCFUNC MULULUS(ULONG mul1, UWORD mul2); /* MULtiply ULong by UShort */
|
||||
ULONG FAR ASMCFUNC MULULUL(ULONG mul1, ULONG mul2); /* MULtiply ULong by ULong */
|
||||
ULONG FAR ASMCFUNC DIVULUS(ULONG mul1, UWORD mul2); /* DIVide ULong by UShort */
|
||||
ULONG FAR ASMCFUNC DIVMODULUS(ULONG mul1, UWORD mul2, UWORD * rem); /* DIVide ULong by UShort */
|
||||
ULONG ASMCFUNC FAR MULULUS(ULONG mul1, UWORD mul2); /* MULtiply ULong by UShort */
|
||||
ULONG ASMCFUNC FAR MULULUL(ULONG mul1, ULONG mul2); /* MULtiply ULong by ULong */
|
||||
ULONG ASMCFUNC FAR DIVULUS(ULONG mul1, UWORD mul2); /* DIVide ULong by UShort */
|
||||
ULONG ASMCFUNC FAR DIVMODULUS(ULONG mul1, UWORD mul2, UWORD * rem); /* DIVide ULong by UShort */
|
||||
#endif
|
||||
|
|
|
@ -271,6 +271,8 @@ struct PartTableEntry /* INTERNAL representation of partition table en
|
|||
internal global data
|
||||
*/
|
||||
|
||||
BOOL ExtLBAForce = FALSE;
|
||||
|
||||
COUNT init_readdasd(UBYTE drive)
|
||||
{
|
||||
static iregs regs;
|
||||
|
@ -435,7 +437,7 @@ VOID CalculateFATData(ddt FAR * pddt, ULONG NumSectors, UBYTE FileSystem)
|
|||
if (maxclust > FAT12MAX)
|
||||
maxclust = FAT12MAX;
|
||||
DebugPrintf(("FAT12: #clu=%lu, fatlen=%lu, maxclu=%lu, limit=%u\n",
|
||||
clust, fatlength, maxclust, FATMAX12));
|
||||
clust, fatlength, maxclust, FAT12MAX));
|
||||
if (clust > maxclust - 2)
|
||||
{
|
||||
clust = maxclust - 2;
|
||||
|
@ -524,7 +526,7 @@ VOID CalculateFATData(ddt FAR * pddt, ULONG NumSectors, UBYTE FileSystem)
|
|||
if (maxclust > FAT32MAX)
|
||||
maxclust = FAT32MAX;
|
||||
DebugPrintf(("FAT32: #clu=%u, fatlen=%u, maxclu=%u, limit=%u\n",
|
||||
clust, fatlength, maxclust, FATMAX32));
|
||||
clust, fatlength, maxclust, FAT32MAX));
|
||||
if (clust > maxclust - 2)
|
||||
{
|
||||
clust = 0;
|
||||
|
@ -563,13 +565,15 @@ void DosDefinePartition(struct DriveParamS *driveParam,
|
|||
return; /* we are done */
|
||||
}
|
||||
|
||||
(pddt-1)->ddt_next = pddt;
|
||||
pddt->ddt_next = MK_FP(0, 0xffff);
|
||||
pddt->ddt_driveno = driveParam->driveno;
|
||||
pddt->ddt_logdriveno = nUnits;
|
||||
pddt->ddt_LBASupported = driveParam->LBA_supported;
|
||||
/* Turn of LBA if not forced and the partition is within 1023 cyls and of the right type */
|
||||
/* the FileSystem type was internally converted to LBA_xxxx if a non-LBA partition
|
||||
above cylinder 1023 was found */
|
||||
if (!InitKernelConfig.ForceLBA && !IsLBAPartition(pEntry->FileSystem))
|
||||
if (!InitKernelConfig.ForceLBA && !ExtLBAForce && !IsLBAPartition(pEntry->FileSystem))
|
||||
pddt->ddt_LBASupported = FALSE;
|
||||
pddt->ddt_WriteVerifySupported = driveParam->WriteVerifySupported;
|
||||
pddt->ddt_ncyl = driveParam->chs.Cylinder;
|
||||
|
@ -681,6 +685,7 @@ int LBA_Get_Drive_Parameters(int drive, struct DriveParamS *driveParam)
|
|||
regs.d.b.l = drive;
|
||||
init_call_intr(0x13, ®s);
|
||||
|
||||
/* error or DMA boundary errors not handled transparently */
|
||||
if (regs.flags & 0x01)
|
||||
{
|
||||
goto StandardBios;
|
||||
|
@ -885,7 +890,7 @@ ScanForPrimaryPartitions(struct DriveParamS * driveParam, int scan_type,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!InitKernelConfig.ForceLBA
|
||||
if (!InitKernelConfig.ForceLBA && !ExtLBAForce
|
||||
&& !IsLBAPartition(pEntry->FileSystem))
|
||||
{
|
||||
printf
|
||||
|
@ -1012,6 +1017,8 @@ int ProcessDisk(int scanType, unsigned drive, int PartitionsToIgnore)
|
|||
|
||||
struct DriveParamS driveParam;
|
||||
|
||||
ExtLBAForce = FALSE;
|
||||
|
||||
/* Get the hard drive parameters and ensure that the drive exists. */
|
||||
/* If there was an error accessing the drive, skip that drive. */
|
||||
|
||||
|
@ -1084,6 +1091,8 @@ strange_restart:
|
|||
if (ExtendedPartitionOffset == 0)
|
||||
{
|
||||
ExtendedPartitionOffset = PTable[iPart].RelSect;
|
||||
/* grand parent LBA -> all children and grandchildren LBA */
|
||||
ExtLBAForce = (PTable[iPart].FileSystem == EXTENDED_LBA);
|
||||
}
|
||||
|
||||
num_extended_found++;
|
||||
|
@ -1233,6 +1242,8 @@ void ReadAllPartitionTables(void)
|
|||
{
|
||||
pddt = DynAlloc("ddt", 1, sizeof(ddt));
|
||||
|
||||
if (Unit > 0) (pddt-1)->ddt_next = pddt;
|
||||
pddt->ddt_next = MK_FP(0, 0xffff);
|
||||
pddt->ddt_driveno = 0;
|
||||
pddt->ddt_logdriveno = Unit;
|
||||
pddt->ddt_type = init_getdriveparm(0, &pddt->ddt_defbpb);
|
||||
|
|
|
@ -67,9 +67,9 @@
|
|||
#include "init-mod.h"
|
||||
#include "init-dat.h"
|
||||
|
||||
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 FAR ASM _HMATextAvailable, /* first byte of available CODE area */
|
||||
FAR ASM _HMATextStart[], /* first byte of HMAable CODE area */
|
||||
FAR ASM _HMATextEnd[]; /* and the last byte of it */
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *RcsId =
|
||||
|
@ -78,14 +78,14 @@ static BYTE *RcsId =
|
|||
|
||||
BYTE DosLoadedInHMA = FALSE; /* set to TRUE if loaded HIGH */
|
||||
BYTE HMAclaimed = FALSE; /* set to TRUE if claimed from HIMEM */
|
||||
WORD HMAFree = 0; /* first byte in HMA not yet used */
|
||||
WORD HMAFree = 0; /* first byte in HMA not yet used */
|
||||
|
||||
extern BYTE FAR *DOSTEXTFAR ASMCFUNC XMSDriverAddress;
|
||||
extern FAR ASMCFUNC _EnableA20(VOID);
|
||||
extern FAR ASMCFUNC _DisableA20(VOID);
|
||||
extern void FAR *DOSTEXTFAR ASM XMSDriverAddress;
|
||||
VOID ASMCFUNC FAR _EnableA20(VOID);
|
||||
VOID ASMCFUNC FAR _DisableA20(VOID);
|
||||
|
||||
extern void FAR *ASMCFUNC DetectXMSDriver(VOID);
|
||||
extern int ASMCFUNC init_call_XMScall(void FAR * driverAddress, UWORD ax,
|
||||
void FAR * ASMCFUNC DetectXMSDriver(VOID);
|
||||
int ASMCFUNC init_call_XMScall(void FAR * driverAddress, UWORD ax,
|
||||
UWORD dx);
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -127,7 +127,7 @@ VOID hdump(BYTE FAR * p)
|
|||
#define KeyboardShiftState() (*(BYTE FAR *)(MK_FP(0x40,0x17)))
|
||||
|
||||
/* of course, this should go to ASMSUPT */
|
||||
fmemcmp(BYTE far * s1, BYTE FAR * s2, unsigned len)
|
||||
int fmemcmp(BYTE far * s1, BYTE FAR * s2, unsigned len)
|
||||
{
|
||||
for (; len; s1++, s2++, --len)
|
||||
{
|
||||
|
@ -316,7 +316,7 @@ void HMAconfig(int finalize)
|
|||
only available if DOS=HIGH was successful
|
||||
*/
|
||||
|
||||
VOID FAR *HMAalloc(COUNT bytesToAllocate)
|
||||
VOID FAR * HMAalloc(COUNT bytesToAllocate)
|
||||
{
|
||||
VOID FAR *HMAptr;
|
||||
|
||||
|
@ -416,8 +416,8 @@ void MoveKernel(unsigned NewKernelSegment)
|
|||
UWORD jmpSegment;
|
||||
};
|
||||
extern struct RelocationTable
|
||||
DOSTEXTFAR _HMARelocationTableStart[],
|
||||
DOSTEXTFAR _HMARelocationTableEnd[];
|
||||
DOSTEXTFAR ASM _HMARelocationTableStart[],
|
||||
DOSTEXTFAR ASM _HMARelocationTableEnd[];
|
||||
|
||||
struct RelocationTable FAR *rp, rtemp;
|
||||
|
||||
|
@ -469,7 +469,7 @@ void MoveKernel(unsigned NewKernelSegment)
|
|||
UWORD jmpSegment;
|
||||
};
|
||||
extern struct initRelocationTable
|
||||
_HMAinitRelocationTableStart[], _HMAinitRelocationTableEnd[];
|
||||
ASM _HMAinitRelocationTableStart[], ASM _HMAinitRelocationTableEnd[];
|
||||
struct initRelocationTable *rp;
|
||||
|
||||
/* verify, that all entries are valid */
|
||||
|
|
|
@ -58,6 +58,8 @@ Int2f3:
|
|||
je IntDosCal ; Dos Internal calls
|
||||
cmp ah,10h ; SHARE.EXE interrupt?
|
||||
je Int2f1 ; yes, do installation check
|
||||
cmp ah,08h
|
||||
je DriverSysCal ; DRIVER.SYS calls
|
||||
cmp ah,14h ; NLSFUNC.EXE interrupt?
|
||||
jne Int2f?iret ; yes, do installation check
|
||||
Int2f?14: ;; MUX-14 -- NLSFUNC API
|
||||
|
@ -81,6 +83,15 @@ Int2f?14?1: or BYTE [bp-6], 1
|
|||
Int2f?iret:
|
||||
iret
|
||||
|
||||
; DRIVER.SYS calls - now only 0803.
|
||||
DriverSysCal:
|
||||
extern _Dyn:wrt DGROUP
|
||||
cmp al, 3
|
||||
jne Int2f?iret
|
||||
mov di, seg _Dyn
|
||||
mov ds, di
|
||||
mov di, _Dyn+2
|
||||
jmp short Int2f?iret
|
||||
|
||||
|
||||
;***********************************************************
|
||||
|
@ -151,6 +162,11 @@ _remote_close:
|
|||
mov al, 06h
|
||||
jmp short call_int2f
|
||||
|
||||
global _remote_commit
|
||||
_remote_commit:
|
||||
mov al, 07h
|
||||
jmp short call_int2f
|
||||
|
||||
global _remote_read
|
||||
_remote_read: mov al, 08h
|
||||
jmp short call_int2f
|
||||
|
|
|
@ -37,7 +37,7 @@ BYTE *RcsId =
|
|||
#endif
|
||||
|
||||
#ifdef TSC
|
||||
static VOID StartTrace(VOID);
|
||||
STATIC VOID StartTrace(VOID);
|
||||
static bTraceNext = FALSE;
|
||||
#endif
|
||||
|
||||
|
@ -368,7 +368,7 @@ dispatch:
|
|||
|
||||
case 0x14:
|
||||
{
|
||||
if (FcbRead(FP_DS_DX, &CritErrCode))
|
||||
if (FcbRead(FP_DS_DX, &CritErrCode, 0))
|
||||
r->AL = 0;
|
||||
else
|
||||
r->AL = CritErrCode;
|
||||
|
@ -377,7 +377,7 @@ dispatch:
|
|||
|
||||
case 0x15:
|
||||
{
|
||||
if (FcbWrite(FP_DS_DX, &CritErrCode))
|
||||
if (FcbWrite(FP_DS_DX, &CritErrCode, 0))
|
||||
r->AL = 0;
|
||||
else
|
||||
r->AL = CritErrCode;
|
||||
|
@ -497,11 +497,7 @@ dispatch:
|
|||
|
||||
/* Set Interrupt Vector */
|
||||
case 0x25:
|
||||
{
|
||||
VOID(INRPT FAR * p) () = FP_DS_DX;
|
||||
|
||||
setvec(r->AL, p);
|
||||
}
|
||||
setvec(r->AL, FP_DS_DX);
|
||||
break;
|
||||
|
||||
/* Dos Create New Psp */
|
||||
|
@ -701,9 +697,7 @@ dispatch:
|
|||
/* Get Interrupt Vector */
|
||||
case 0x35:
|
||||
{
|
||||
BYTE FAR *p;
|
||||
|
||||
p = getvec((COUNT) r->AL);
|
||||
intvec p = getvec((COUNT) r->AL);
|
||||
r->ES = FP_SEG(p);
|
||||
r->BX = FP_OFF(p);
|
||||
}
|
||||
|
@ -1221,8 +1215,8 @@ dispatch:
|
|||
case 0x06:
|
||||
r->DS = FP_SEG(internal_data);
|
||||
r->SI = FP_OFF(internal_data);
|
||||
r->CX = swap_always - internal_data;
|
||||
r->DX = swap_indos - internal_data;
|
||||
r->CX = swap_indos - internal_data;
|
||||
r->DX = swap_always - internal_data;
|
||||
CLEAR_CARRY_FLAG();
|
||||
break;
|
||||
|
||||
|
@ -1427,7 +1421,10 @@ dispatch:
|
|||
/* Flush file buffer -- COMMIT FILE -- dummy function right now. */
|
||||
case 0x68:
|
||||
case 0x6a:
|
||||
CLEAR_CARRY_FLAG();
|
||||
if ((rc = DosCommit(r->BX)) < 0)
|
||||
goto error_exit;
|
||||
else
|
||||
CLEAR_CARRY_FLAG();
|
||||
break;
|
||||
|
||||
/* Get/Set Serial Number */
|
||||
|
@ -1718,16 +1715,15 @@ dispatch:
|
|||
CLEAR_CARRY_FLAG();
|
||||
|
||||
if (r->SI == 0)
|
||||
mode = DSKREAD;
|
||||
mode = DSKREADINT25;
|
||||
else
|
||||
mode = DSKWRITE;
|
||||
InDOS++;
|
||||
mode = DSKWRITEINT26;
|
||||
|
||||
r->AX =
|
||||
dskxfer(r->DL - 1, SectorBlock->blkno, SectorBlock->buf,
|
||||
SectorBlock->nblks, mode);
|
||||
|
||||
if (mode == DSKWRITE)
|
||||
if (mode == DSKWRITEINT26)
|
||||
if (r->AX <= 0)
|
||||
setinvld(r->DL - 1);
|
||||
|
||||
|
@ -1735,15 +1731,12 @@ dispatch:
|
|||
{
|
||||
r->AX = 0x20c;
|
||||
r->flags |= FLG_CARRY;
|
||||
--InDOS;
|
||||
return;
|
||||
}
|
||||
|
||||
r->AX = 0;
|
||||
r->flags &= ~FLG_CARRY;
|
||||
--InDOS;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
goto error_invalid;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1754,49 +1747,36 @@ dispatch:
|
|||
{
|
||||
switch (r->AL)
|
||||
{
|
||||
/* Allocate LFN inode */
|
||||
/* Allocate LFN inode */
|
||||
case 0x01:
|
||||
{
|
||||
r->AX = lfn_allocate_inode();
|
||||
break;
|
||||
}
|
||||
/* Free LFN inode */
|
||||
rc = lfn_allocate_inode();
|
||||
break;
|
||||
/* Free LFN inode */
|
||||
case 0x02:
|
||||
{
|
||||
r->AX = lfn_free_inode(r->BX);
|
||||
break;
|
||||
}
|
||||
/* Setup LFN inode */
|
||||
rc = lfn_free_inode(r->BX);
|
||||
break;
|
||||
/* Setup LFN inode */
|
||||
case 0x03:
|
||||
{
|
||||
r->AX = lfn_setup_inode(r->BX, r->CX, r->DX);
|
||||
break;
|
||||
}
|
||||
/* Create LFN entries */
|
||||
rc = lfn_setup_inode(r->BX, ((ULONG)r->CX << 16) | r->DX, ((ULONG)r->SI << 16) | r->DI);
|
||||
break;
|
||||
/* Create LFN entries */
|
||||
case 0x04:
|
||||
{
|
||||
r->AX = lfn_create_entries(r->BX, (lfn_inode_ptr) FP_DS_DX);
|
||||
break;
|
||||
}
|
||||
/* Delete LFN entries */
|
||||
rc = lfn_create_entries(r->BX, (lfn_inode_ptr)FP_DS_DX);
|
||||
break;
|
||||
/* Read next LFN */
|
||||
case 0x05:
|
||||
{
|
||||
r->AX = lfn_remove_entries(r->BX);
|
||||
break;
|
||||
}
|
||||
/* Read next LFN */
|
||||
rc = lfn_dir_read(r->BX, (lfn_inode_ptr)FP_DS_DX);
|
||||
break;
|
||||
/* Write SFN pointed by LFN inode */
|
||||
case 0x06:
|
||||
{
|
||||
r->AX = lfn_dir_read(r->BX, (lfn_inode_ptr) FP_DS_DX);
|
||||
break;
|
||||
}
|
||||
/* Write SFN pointed by LFN inode */
|
||||
case 0x07:
|
||||
{
|
||||
r->AX = lfn_dir_write(r->BX);
|
||||
break;
|
||||
}
|
||||
rc = lfn_dir_write(r->BX);
|
||||
break;
|
||||
default:
|
||||
goto error_invalid;
|
||||
}
|
||||
r->AX = rc;
|
||||
if (rc < 0) goto error_out;
|
||||
else CLEAR_CARRY_FLAG();
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
@ -1912,7 +1892,7 @@ VOID int26_handler(struct int25regs FAR * r) { int2526_handler(DSKWRITE,r); }
|
|||
*/
|
||||
|
||||
#ifdef TSC
|
||||
static VOID StartTrace(VOID)
|
||||
STATIC VOID StartTrace(VOID)
|
||||
{
|
||||
if (bTraceNext)
|
||||
{
|
||||
|
|
|
@ -6,4 +6,4 @@ struct REGPACK {
|
|||
unsigned r_bp, r_di, r_si, r_ds, r_es, r_flags;
|
||||
};
|
||||
|
||||
extern void ASMCFUNC intr(int intrnr, struct REGPACK *rp);
|
||||
void ASMCFUNC intr(int intrnr, struct REGPACK *rp);
|
||||
|
|
|
@ -170,19 +170,9 @@ _blk_dev equ $
|
|||
dw 08c2h ; block device with ioctl
|
||||
dw GenStrategy
|
||||
dw blk_entry
|
||||
global _nblk_rel
|
||||
_nblk_rel db 4
|
||||
db 4
|
||||
db 0,0,0,0,0,0,0
|
||||
|
||||
; quick hack for MSC
|
||||
global _Get_nblk_rel
|
||||
_Get_nblk_rel:
|
||||
mov ah,0
|
||||
mov al,[cs:_nblk_rel]
|
||||
retf
|
||||
;end of hack
|
||||
|
||||
|
||||
|
||||
;
|
||||
; Temporary table until next release
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
;
|
||||
|
||||
%include "segs.inc"
|
||||
%include "ludivmul.inc"
|
||||
|
||||
|
||||
segment PSP
|
||||
|
@ -98,9 +99,9 @@ realentry: ; execution continues here
|
|||
beyond_entry: resb 256-(beyond_entry-entry)
|
||||
; scratch area for data (DOS_PSP)
|
||||
|
||||
segment INIT_TEXT
|
||||
segment INIT_TEXT
|
||||
|
||||
extern _FreeDOSmain:wrt IGROUP
|
||||
extern _FreeDOSmain:wrt I_GROUP
|
||||
|
||||
;
|
||||
; kernel start-up
|
||||
|
@ -117,7 +118,7 @@ kernel_start:
|
|||
pop bx
|
||||
pop ax
|
||||
|
||||
mov ax,IGROUP
|
||||
mov ax,I_GROUP
|
||||
cli
|
||||
mov ss,ax
|
||||
mov sp,init_tos
|
||||
|
@ -170,7 +171,7 @@ cont: ; inititalize api stacks for high water tests
|
|||
popf
|
||||
pop bx
|
||||
pop ax
|
||||
|
||||
|
||||
inc bl
|
||||
jns floppy
|
||||
add bl,3-1-128
|
||||
|
@ -182,11 +183,21 @@ floppy: mov byte [_BootDrive],bl ; tell where we came from
|
|||
;!! inc al
|
||||
;!! mov byte [_NumFloppies],al ; and how many
|
||||
|
||||
mov ax,cs
|
||||
mov ax,ss
|
||||
mov ds,ax
|
||||
mov es,ax
|
||||
jmp _FreeDOSmain
|
||||
|
||||
%ifdef WATCOM
|
||||
global _IU4M
|
||||
_IU4M:
|
||||
LMULU
|
||||
global _IU4D
|
||||
_IU4D:
|
||||
LDIVMODU
|
||||
%endif
|
||||
|
||||
|
||||
segment INIT_TEXT_END
|
||||
|
||||
|
||||
|
@ -621,7 +632,7 @@ __ib_end:
|
|||
;; do not clear the other init BSS variables + STACK: too late.
|
||||
|
||||
retoff resw 1 ; return offset to jump to from HMA_TEXT
|
||||
|
||||
|
||||
; kernel startup stack
|
||||
global init_tos
|
||||
resw 512
|
||||
|
@ -651,6 +662,16 @@ clk_stk_top:
|
|||
|
||||
global __bssend
|
||||
__bssend:
|
||||
|
||||
; Dynamic data:
|
||||
; member of the DOS DATA GROUP
|
||||
; and marks definitive end of all used data in kernel data segment
|
||||
;
|
||||
|
||||
segment DYN_DATA
|
||||
global _Dyn
|
||||
_Dyn:
|
||||
DynAllocated dw 0
|
||||
|
||||
segment ID_B
|
||||
global __INIT_DATA_START
|
||||
|
@ -684,6 +705,16 @@ begin_hma:
|
|||
times 20h db 0
|
||||
db 0
|
||||
|
||||
%ifdef WATCOM
|
||||
; 32 bit multiplication + division
|
||||
global __U4M
|
||||
__U4M:
|
||||
LMULU
|
||||
global __U4D
|
||||
__U4D:
|
||||
LDIVMODU
|
||||
%endif
|
||||
|
||||
init_ret_np: push ds
|
||||
push word [retoff]
|
||||
retf ; return from init_calls.
|
||||
|
|
468
kernel/lfnapi.c
468
kernel/lfnapi.c
|
@ -16,112 +16,322 @@ static BYTE *lfnaidRcsId =
|
|||
|
||||
#ifdef WITHLFNAPI
|
||||
|
||||
#define LHE_INVLDHNDL -1
|
||||
#define LHE_NOFREEHNDL -2
|
||||
#define LHE_IOERROR -3
|
||||
#define LHE_INVLDDRV -4
|
||||
#define LHE_DAMAGEDFS -5
|
||||
#define LHE_NOSPACE -6
|
||||
#define LHE_SEEK -7
|
||||
#define RESERVED_FNODES 3 /* # of reserved fnodes for the kernel internal *
|
||||
* usage. If something wrong happens with the *
|
||||
* driver using helper API and it grabs all *
|
||||
* possible fnodes, the kernel doesn't hang. */
|
||||
|
||||
/* All possible error codes, returned by directory access functions */
|
||||
/* Note. SUCCESS is returned if all OK. */
|
||||
#define LHE_INVLDHNDL -1 /* Invalid inode handle passed. */
|
||||
#define LHE_NOFREEHNDL -2 /* Couldn't allocate another inode handle. */
|
||||
#define LHE_IOERROR -3 /* Couldn't do I/O because of the lack of *
|
||||
* memory or due to a physical damage. */
|
||||
#define LHE_INVLDDRV -4 /* Invalid drive chosen. */
|
||||
#define LHE_DAMAGEDFS -5 /* Damaged file system encountered. */
|
||||
#define LHE_NOSPACE -6 /* There are no free clusters on drive. */
|
||||
#define LHE_SEEK -7 /* Attempt to read beyound the end of the dir. */
|
||||
|
||||
#define lfn(fnp) ((struct lfn_entry FAR *)&(fnp->f_dir))
|
||||
#define CHARS_IN_LFN_ENTRY 13
|
||||
#define UNICODE_FILLER 0xffff
|
||||
|
||||
COUNT ufstrlen(REG UNICODE FAR *); /* fstrlen for UNICODE strings */
|
||||
UBYTE lfn_checksum(UBYTE *);
|
||||
COUNT ufstrlen(REG UNICODE FAR *); /* fstrlen for UNICODE strings */
|
||||
UBYTE lfn_checksum(UBYTE FAR *);
|
||||
COUNT extend_dir(f_node_ptr);
|
||||
COUNT remove_lfn_entries(f_node_ptr fnp);
|
||||
BOOL lfn_to_unicode(UNICODE FAR **name, struct lfn_entry FAR *lep);
|
||||
VOID unicode_to_lfn(UNICODE FAR **name, struct lfn_entry FAR *lep);
|
||||
|
||||
/* Description.
|
||||
* Allocates internal fnode and returns it's handle.
|
||||
* Return value.
|
||||
* LHE_NOFREEHNDL, LHE_INVLDDRV
|
||||
* >= 0 - handle of the allocated fnode.
|
||||
*/
|
||||
COUNT lfn_allocate_inode(VOID)
|
||||
{
|
||||
f_node_ptr fnp = get_f_node();
|
||||
struct cds FAR *cdsp;
|
||||
if (fnp == 0)
|
||||
return LHE_NOFREEHNDL;
|
||||
COUNT handle;
|
||||
if (fnp == 0) return LHE_NOFREEHNDL;
|
||||
|
||||
handle = xlt_fnp(fnp);
|
||||
/* Check if there is at least # RESERVED_FNODES left for the kernel */
|
||||
if (f_nodes_cnt - handle < RESERVED_FNODES)
|
||||
{
|
||||
release_f_node(fnp);
|
||||
return LHE_NOFREEHNDL;
|
||||
}
|
||||
|
||||
/* Check that default drive is a block device */
|
||||
cdsp = &CDSp->cds_table[default_drive];
|
||||
|
||||
if (cdsp->cdsDpb == 0)
|
||||
{
|
||||
release_f_node(fnp);
|
||||
return LHE_INVLDDRV;
|
||||
}
|
||||
{
|
||||
release_f_node(fnp);
|
||||
return LHE_INVLDDRV;
|
||||
}
|
||||
|
||||
fnp->f_dpb = cdsp->cdsDpb;
|
||||
|
||||
if (media_check(fnp->f_dpb) < 0)
|
||||
{
|
||||
release_f_node(fnp);
|
||||
return LHE_INVLDDRV;
|
||||
}
|
||||
{
|
||||
release_f_node(fnp);
|
||||
return LHE_INVLDDRV;
|
||||
}
|
||||
|
||||
return xlt_fnp(fnp);
|
||||
return handle;
|
||||
}
|
||||
|
||||
/* Description.
|
||||
* Free allocated internal fnode.
|
||||
* Return value.
|
||||
* SUCCESS, LHE_INVLDHNDL
|
||||
*/
|
||||
COUNT lfn_free_inode(COUNT handle)
|
||||
{
|
||||
f_node_ptr fnp = xlt_fd(handle);
|
||||
if (fnp == 0 || fnp->f_count <= 0)
|
||||
return LHE_INVLDHNDL;
|
||||
if (fnp == 0 || fnp->f_count <= 0) return LHE_INVLDHNDL;
|
||||
|
||||
release_f_node(fnp);
|
||||
dir_close(fnp);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
COUNT lfn_setup_inode(COUNT handle, CLUSTER dirstart, ULONG diroff)
|
||||
/* Description.
|
||||
* Initialize internal fnode, so that it'll point to the directory entry
|
||||
* at "diroff" byte offset from the start of the directory with the "dirstart"
|
||||
* starting cluster.
|
||||
* Return value.
|
||||
* SUCCESS, LHE_INVLDHNDL
|
||||
*/
|
||||
COUNT lfn_setup_inode(COUNT handle, ULONG dirstart, ULONG diroff)
|
||||
{
|
||||
f_node_ptr fnp = xlt_fd(handle);
|
||||
if (fnp == 0 || fnp->f_count <= 0)
|
||||
return LHE_INVLDHNDL;
|
||||
if (fnp == 0 || fnp->f_count <= 0) return LHE_INVLDHNDL;
|
||||
|
||||
dir_init_fnode(fnp, dirstart);
|
||||
dir_init_fnode(fnp, (CLUSTER)dirstart);
|
||||
fnp->f_diroff = diroff;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
BOOL transfer_unicode(UNICODE FAR ** dptr, UNICODE FAR ** sptr,
|
||||
COUNT count)
|
||||
/* Description.
|
||||
* Create LFN directory entries for the long name "lip->l_name", followed
|
||||
* by the SFN entry with raw image "lip->l_dir". The "lip->l_diroff" points
|
||||
* to the SFN entry on return.
|
||||
* The internal fnode is released on fatal error, except LHE_INVLDHNDL of
|
||||
* course.
|
||||
* Return value.
|
||||
* SUCCESS, LHE_INVLDHNDL, LHE_IOERROR, LHE_NOSPACE
|
||||
*/
|
||||
COUNT lfn_create_entries(COUNT handle, lfn_inode_ptr lip)
|
||||
{
|
||||
f_node_ptr fnp = xlt_fd(handle);
|
||||
COUNT entries_needed, free_entries, i, rc;
|
||||
UNICODE FAR *lfn_name = lip->l_name;
|
||||
UBYTE id = 1, sfn_checksum = lfn_checksum(lip->l_dir.dir_name);
|
||||
ULONG sfn_offset;
|
||||
if (fnp == 0 || fnp->f_count <= 0) return LHE_INVLDHNDL;
|
||||
|
||||
entries_needed = (ufstrlen(lfn_name) + CHARS_IN_LFN_ENTRY - 1)
|
||||
/ CHARS_IN_LFN_ENTRY + 1; /* We want to create SFN entry too */
|
||||
|
||||
/* Scan the directory from the very begining for the free directory entries */
|
||||
lfn_setup_inode(handle, fnp->f_dirstart, 0);
|
||||
|
||||
free_entries = 0;
|
||||
while (TRUE)
|
||||
{
|
||||
rc = dir_read(fnp);
|
||||
if (rc == 0 || fnp->f_dir.dir_name[0] == DELETED)
|
||||
{
|
||||
free_entries++;
|
||||
if (free_entries == entries_needed)
|
||||
break;
|
||||
}
|
||||
else if (rc == DE_BLKINVLD)
|
||||
{
|
||||
dir_close(fnp);
|
||||
return LHE_IOERROR;
|
||||
}
|
||||
else if (rc == DE_SEEK)
|
||||
{
|
||||
if (extend_dir(fnp) != SUCCESS) return LHE_NOSPACE;
|
||||
/* fnp points to the first free dir entry on return from extend_dir,
|
||||
* so we go to previous entry to read this free entry on next cycle */
|
||||
fnp->f_diroff -= DIRENT_SIZE;
|
||||
}
|
||||
else free_entries = 0; /* rc == 1 here => we've read some sfn entry */
|
||||
}
|
||||
sfn_offset = fnp->f_diroff;
|
||||
|
||||
fnp->f_flags.f_dmod = TRUE;
|
||||
/* Write SFN entry */
|
||||
fmemcpy(&fnp->f_dir, &lip->l_dir, sizeof(struct dirent));
|
||||
dir_write(fnp);
|
||||
|
||||
fnp->f_diroff -= DIRENT_SIZE;
|
||||
/* Go in the reverse direction and create LFN entries */
|
||||
for (i = 0; i < entries_needed - 1; i++, id++)
|
||||
{
|
||||
/* If this is the last LFN entry mark it's as those (6th bit is on) */
|
||||
if (i == (entries_needed - 2)) id |= 0x40;
|
||||
lfn_name = &lip->l_name[i * CHARS_IN_LFN_ENTRY];
|
||||
unicode_to_lfn(&lfn_name, lfn(fnp));
|
||||
lfn(fnp)->lfn_checksum = sfn_checksum;
|
||||
lfn(fnp)->lfn_id = id;
|
||||
fnp->f_dir.dir_attrib = D_LFN;
|
||||
if (!dir_write(fnp)) return LHE_IOERROR;
|
||||
fnp->f_diroff -= DIRENT_SIZE;
|
||||
}
|
||||
fnp->f_flags.f_dmod = FALSE;
|
||||
|
||||
fnp->f_diroff = sfn_offset;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* Description.
|
||||
* Read next consequitve long file name. The LFN is stored into the
|
||||
* "lip->l_name" in unicode and the corresponding SFN entry raw image into the
|
||||
* "lip->l_dir". If directory entry being read is a 8.3 file name, then
|
||||
* it's image is stored into the "lip->l_dir" and "lip->l_name" has zero
|
||||
* length, i.e. "lip->l_name[0]" == 0.
|
||||
* Return value.
|
||||
* SUCCESS, LHE_INVLDHNDL, LHE_IOERROR, LHE_SEEK, LHE_DAMAGEDFS
|
||||
*/
|
||||
COUNT lfn_dir_read(COUNT handle, lfn_inode_ptr lip)
|
||||
{
|
||||
COUNT rc;
|
||||
UBYTE id = 1, real_id;
|
||||
UNICODE FAR *lfn_name = lip->l_name;
|
||||
ULONG sfn_diroff;
|
||||
BOOL name_tail;
|
||||
f_node_ptr fnp = xlt_fd(handle);
|
||||
if (fnp == 0 || fnp->f_count <= 0) return LHE_INVLDHNDL;
|
||||
|
||||
/* Scan a directory for the next valid SFN entry */
|
||||
while (TRUE)
|
||||
{
|
||||
rc = dir_read(fnp);
|
||||
if (rc == DE_SEEK) return LHE_SEEK;
|
||||
else if (rc == DE_BLKINVLD) return LHE_IOERROR;
|
||||
if (fnp->f_dir.dir_name[0] != DELETED && fnp->f_dir.dir_attrib != D_LFN)
|
||||
{
|
||||
fmemcpy(&lip->l_dir, &fnp->f_dir, sizeof(struct dirent));
|
||||
sfn_diroff = fnp->f_diroff;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Go in the reverse direction and find the LFN entries corresponding to
|
||||
* the found SFN entry */
|
||||
while (TRUE)
|
||||
{
|
||||
if (fnp->f_diroff == 0) break;
|
||||
fnp->f_diroff -= 2*DIRENT_SIZE;
|
||||
rc = dir_read(fnp);
|
||||
if (rc == DE_BLKINVLD) return LHE_IOERROR;
|
||||
if (fnp->f_dir.dir_name[0] == DELETED
|
||||
|| fnp->f_dir.dir_attrib != D_LFN) break;
|
||||
real_id = lfn(fnp)->lfn_id;
|
||||
if ((real_id & 0x3f) > 20) return LHE_DAMAGEDFS;
|
||||
name_tail = lfn_to_unicode(&lfn_name, lfn(fnp));
|
||||
if (real_id & 0x40)
|
||||
{
|
||||
if ((id | 0x40) != real_id) return LHE_DAMAGEDFS;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (name_tail || real_id != id
|
||||
|| lfn(fnp)->lfn_checksum != lfn_checksum(lip->l_dir.dir_name))
|
||||
return LHE_DAMAGEDFS;
|
||||
}
|
||||
id++;
|
||||
}
|
||||
|
||||
*lfn_name = 0; /* Terminate LFN string */
|
||||
|
||||
fnp->f_diroff = lip->l_diroff = sfn_diroff;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* Description.
|
||||
* Writes directory entry pointed by internal fnode to disk.
|
||||
* The fnode is released on error.
|
||||
* Return value.
|
||||
* SUCCESS, LHE_INVLDHNDL, LHE_IOERROR.
|
||||
*/
|
||||
COUNT lfn_dir_write(COUNT handle)
|
||||
{
|
||||
f_node_ptr fnp = xlt_fd(handle);
|
||||
if (fnp == 0 || fnp->f_count <= 0) return LHE_INVLDHNDL;
|
||||
|
||||
fnp->f_flags.f_dmod = TRUE;
|
||||
if (!dir_write(fnp)) return LHE_IOERROR;
|
||||
fnp->f_flags.f_dmod = FALSE;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/*********************************************************************/
|
||||
/* Miscellaneous functions. These functions are not part of the API. */
|
||||
/*********************************************************************/
|
||||
|
||||
/* Description.
|
||||
* Copy the block of "count" unicode characters from source pointed by
|
||||
* "sptr" to destination pointed by "dptr". The trailing characters of
|
||||
* destination are filled with "UNICODE_FILLER".
|
||||
* Return value.
|
||||
* TRUE - The source string is too short, trailing characters are filled
|
||||
* with "UNICODE_FILLER".
|
||||
* FALSE - The unicode strings have the same size, no filling occured.
|
||||
*/
|
||||
BOOL transfer_unicode(UNICODE FAR **dptr, UNICODE FAR **sptr, COUNT count)
|
||||
{
|
||||
COUNT j;
|
||||
BOOL found_zerro = FALSE;
|
||||
|
||||
for (j = 0; j < count; j++, (*dptr)++, (*sptr)++)
|
||||
{
|
||||
if (found_zerro)
|
||||
**dptr = UNICODE_FILLER;
|
||||
else
|
||||
**dptr = **sptr;
|
||||
if (**sptr == 0)
|
||||
found_zerro = TRUE;
|
||||
}
|
||||
{
|
||||
if (found_zerro) **dptr = UNICODE_FILLER;
|
||||
else **dptr = **sptr;
|
||||
if (**sptr == 0) found_zerro = TRUE;
|
||||
}
|
||||
|
||||
return found_zerro;
|
||||
}
|
||||
|
||||
BOOL lfn_to_unicode(UNICODE FAR ** name, struct lfn_entry FAR * lep)
|
||||
/* Description.
|
||||
* Retrieve the LFN string chunk from the directory entry "lep" and store it
|
||||
* to the "name" unicode string.
|
||||
* Return value.
|
||||
* TRUE - The LFN string chunk contains zero character.
|
||||
* FALSE - Doesn't terminate with zero.
|
||||
*/
|
||||
BOOL lfn_to_unicode(UNICODE FAR **name, struct lfn_entry FAR *lep)
|
||||
{
|
||||
UNICODE FAR *ptr;
|
||||
|
||||
|
||||
ptr = lep->lfn_name0_4;
|
||||
if (!transfer_unicode(name, &ptr, 5))
|
||||
return FALSE;
|
||||
if (transfer_unicode(name, &ptr, 5)) return TRUE;
|
||||
ptr = lep->lfn_name5_10;
|
||||
if (!transfer_unicode(name, &ptr, 6))
|
||||
return FALSE;
|
||||
if (transfer_unicode(name, &ptr, 6)) return TRUE;
|
||||
ptr = lep->lfn_name11_12;
|
||||
if (!transfer_unicode(name, &ptr, 2))
|
||||
return FALSE;
|
||||
if (transfer_unicode(name, &ptr, 2)) return TRUE;
|
||||
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
VOID unicode_to_lfn(UNICODE FAR ** name, struct lfn_entry FAR * lep)
|
||||
/* Description.
|
||||
*/
|
||||
VOID unicode_to_lfn(UNICODE FAR **name, struct lfn_entry FAR *lep)
|
||||
{
|
||||
UNICODE FAR *ptr;
|
||||
|
||||
|
||||
ptr = lep->lfn_name0_4;
|
||||
transfer_unicode(&ptr, name, 5);
|
||||
ptr = lep->lfn_name5_10;
|
||||
|
@ -130,164 +340,8 @@ VOID unicode_to_lfn(UNICODE FAR ** name, struct lfn_entry FAR * lep)
|
|||
transfer_unicode(&ptr, name, 2);
|
||||
}
|
||||
|
||||
COUNT lfn_dir_read(COUNT handle, lfn_inode_ptr lip)
|
||||
{
|
||||
COUNT rc;
|
||||
UBYTE id = 1, real_id;
|
||||
UNICODE FAR *lfn_name = lip->name;
|
||||
ULONG sfn_diroff;
|
||||
BOOL name_tail = FALSE;
|
||||
f_node_ptr fnp = xlt_fd(handle);
|
||||
if (fnp == 0 || fnp->f_count <= 0)
|
||||
return LHE_INVLDHNDL;
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
rc = dir_read(fnp);
|
||||
if (rc == 0)
|
||||
return SUCCESS;
|
||||
else if (rc == DE_SEEK)
|
||||
return LHE_SEEK;
|
||||
else if (rc == DE_BLKINVLD)
|
||||
return LHE_IOERROR;
|
||||
if (fnp->f_dir.dir_name[0] != DELETED
|
||||
&& fnp->f_dir.dir_attrib != D_LFN)
|
||||
{
|
||||
fmemcpy(&lip->l_dir, &fnp->f_dir, sizeof(struct dirent));
|
||||
sfn_diroff = fnp->f_diroff;
|
||||
break;
|
||||
}
|
||||
}
|
||||
fnp->f_diroff = lip->l_diroff;
|
||||
|
||||
fmemset(lip->name, 0, 256 * sizeof(UNICODE));
|
||||
while (TRUE)
|
||||
{
|
||||
if (fnp->f_diroff == 0)
|
||||
break;
|
||||
fnp->f_diroff -= 2 * DIRENT_SIZE;
|
||||
rc = dir_read(fnp);
|
||||
if (rc == DE_BLKINVLD)
|
||||
return LHE_IOERROR;
|
||||
if (fnp->f_dir.dir_name[0] == DELETED
|
||||
|| fnp->f_dir.dir_attrib != D_LFN)
|
||||
break;
|
||||
name_tail = lfn_to_unicode(&lfn_name, lfn(fnp));
|
||||
real_id = lfn(fnp)->lfn_id;
|
||||
if (real_id & 0x40)
|
||||
{
|
||||
if ((real_id | 0x40) != id)
|
||||
return LHE_DAMAGEDFS;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (name_tail || real_id != id
|
||||
|| lfn(fnp)->lfn_checksum != lfn_checksum(fnp->f_dir.dir_name))
|
||||
return LHE_DAMAGEDFS;
|
||||
}
|
||||
}
|
||||
|
||||
fnp->f_diroff = lip->l_diroff = sfn_diroff;
|
||||
fnp->f_flags.f_dnew = TRUE;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
COUNT lfn_dir_write(COUNT handle)
|
||||
{
|
||||
f_node_ptr fnp = xlt_fd(handle);
|
||||
if (fnp == 0 || fnp->f_count <= 0)
|
||||
return LHE_INVLDHNDL;
|
||||
|
||||
if (!dir_write(fnp))
|
||||
{
|
||||
lfn_allocate_inode(); /* protection against dir_write fault
|
||||
* this must restore things to the state before
|
||||
* the call */
|
||||
/* Yes, it's a hack! */
|
||||
return LHE_IOERROR;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
COUNT lfn_create_entries(COUNT handle, lfn_inode_ptr lip)
|
||||
{
|
||||
f_node_ptr fnp = xlt_fd(handle);
|
||||
COUNT entries_needed, free_entries, i, rc;
|
||||
UNICODE FAR *lfn_name = lip->name;
|
||||
ULONG sfn_offset;
|
||||
if (fnp == 0 || fnp->f_count <= 0)
|
||||
return LHE_INVLDHNDL;
|
||||
|
||||
entries_needed = (ufstrlen(lfn_name) + CHARS_IN_LFN_ENTRY - 1) / CHARS_IN_LFN_ENTRY + 1; /* We want to create SFN entry too */
|
||||
|
||||
/* Scan the directory from the very begining for the free directory entries */
|
||||
lfn_setup_inode(handle, fnp->f_dirstart, 0);
|
||||
|
||||
free_entries = 0;
|
||||
while ((rc = dir_read(fnp)) == 1)
|
||||
{
|
||||
if (fnp->f_dir.dir_name[0] == DELETED)
|
||||
{
|
||||
free_entries++;
|
||||
if (free_entries == entries_needed)
|
||||
break;
|
||||
}
|
||||
else
|
||||
free_entries = 0;
|
||||
}
|
||||
if (rc == DE_BLKINVLD)
|
||||
return LHE_IOERROR;
|
||||
/* We have reached the end of the directory here. */
|
||||
|
||||
if (free_entries != entries_needed)
|
||||
free_entries = 0;
|
||||
while (free_entries != entries_needed)
|
||||
{
|
||||
rc = dir_read(fnp);
|
||||
if (rc == 0)
|
||||
free_entries++;
|
||||
else if (rc == DE_BLKINVLD)
|
||||
return LHE_IOERROR;
|
||||
else if (rc == DE_SEEK && extend_dir(fnp) != SUCCESS)
|
||||
{
|
||||
lfn_allocate_inode(); /* Another hack. */
|
||||
return LHE_IOERROR;
|
||||
}
|
||||
}
|
||||
sfn_offset = fnp->f_diroff;
|
||||
fnp->f_diroff -= DIRENT_SIZE;
|
||||
|
||||
for (i = entries_needed - 2; i >= 0; i++)
|
||||
{
|
||||
lfn_name = &lip->name[i * CHARS_IN_LFN_ENTRY];
|
||||
unicode_to_lfn(&lfn_name, lfn(fnp));
|
||||
fnp->f_dir.dir_attrib = D_LFN;
|
||||
if (!dir_write(fnp))
|
||||
return LHE_IOERROR;
|
||||
fnp->f_diroff -= DIRENT_SIZE;
|
||||
}
|
||||
|
||||
fnp->f_diroff = sfn_offset;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
COUNT lfn_remove_entries(COUNT handle)
|
||||
{
|
||||
f_node_ptr fnp = xlt_fd(handle);
|
||||
if (fnp == 0 || fnp->f_count <= 0)
|
||||
return LHE_INVLDHNDL;
|
||||
|
||||
if (remove_lfn_entries(fnp) < 0)
|
||||
return LHE_IOERROR;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* Calculate checksum for the 8.3 name */
|
||||
UBYTE lfn_checksum(UBYTE * sfn_name)
|
||||
UBYTE lfn_checksum(UBYTE FAR *sfn_name)
|
||||
{
|
||||
UBYTE sum;
|
||||
COUNT i;
|
||||
|
@ -298,7 +352,7 @@ UBYTE lfn_checksum(UBYTE * sfn_name)
|
|||
return sum;
|
||||
}
|
||||
|
||||
COUNT ufstrlen(REG UNICODE FAR * s)
|
||||
COUNT ufstrlen(REG UNICODE FAR *s)
|
||||
{
|
||||
REG COUNT cnt = 0;
|
||||
|
||||
|
|
|
@ -0,0 +1,144 @@
|
|||
; these are adapted from elks, http://elks.sourceforge.net
|
||||
; multiply cx:bx * dx:ax, result in dx:ax
|
||||
|
||||
%macro LMULU 0
|
||||
|
||||
push si
|
||||
push cx
|
||||
mov si,ax ; save _ax in si
|
||||
mov ax,bx ; cx:ax = _cx:_bx
|
||||
mul dx ; dx:ax = _bx*_dx (forget dx)
|
||||
xchg cx,ax ; cx = low(_dx*_bx)
|
||||
mul si ; dx:ax = _cx*_ax (forget dx)
|
||||
add cx,ax ; cx = low(_cx*_ax + _dx*_bx)
|
||||
mov ax,si ; restore _ax
|
||||
mul bx ; dx:ax = _bx*_ax
|
||||
add dx,cx ; dx = high(_bx*_ax)+low(_cx*_ax + _dx*_bx)
|
||||
pop cx
|
||||
pop si
|
||||
ret
|
||||
|
||||
%endmacro
|
||||
|
||||
; divide dx:ax / cx:bx, quotient in dx:ax, remainder in cx:bx
|
||||
|
||||
%macro LDIVMODU 0
|
||||
; ldivmod.s - 32 over 32 to 32 bit division and remainder for 8086
|
||||
|
||||
; ludivmod( dividend bx:ax, divisor di:cx ) [ unsigned quot di:cx, rem bx:ax ]
|
||||
|
||||
; dx is not preserved
|
||||
|
||||
|
||||
; NB negatives are handled correctly, unlike by the processor
|
||||
; divison by zero does not trap
|
||||
|
||||
|
||||
; let dividend = a, divisor = b, quotient = q, remainder = r
|
||||
; a = b * q + r mod 2^32
|
||||
; where:
|
||||
|
||||
; if b = 0, q = 0 and r = a
|
||||
|
||||
; otherwise, q and r are uniquely determined by the requirements:
|
||||
; r has the same sign as b and absolute value smaller than that of b, i.e.
|
||||
; 0 <= r < b
|
||||
|
||||
push di
|
||||
mov di,cx
|
||||
mov cx,bx
|
||||
mov bx,dx
|
||||
|
||||
push bp
|
||||
push si
|
||||
mov bp,sp
|
||||
push di ; remember b
|
||||
push cx
|
||||
|
||||
%assign b0 -4
|
||||
%assign b16 -2
|
||||
|
||||
test di,di
|
||||
jne %%divlarge
|
||||
test cx,cx
|
||||
je %%return ; divzero: return q = 0 and r = a
|
||||
cmp bx,cx
|
||||
jae %%divlarge ; would overflow
|
||||
mov dx,bx ; a in dx:ax
|
||||
div cx
|
||||
xchg cx,ax ; q in di:cx, junk in ax
|
||||
xchg ax,dx ; r in ax, junk in dx
|
||||
mov bx,di ; r in bx:ax
|
||||
jmp %%return
|
||||
|
||||
%%divlarge:
|
||||
mov si,di ; w in si:dx, initially b from di:cx
|
||||
mov dx,cx
|
||||
xor cx,cx ; q in di:cx, initially 0
|
||||
mov di,cx
|
||||
|
||||
; r in bx:ax, initially a
|
||||
; use di:cx rather than dx:cx in order to
|
||||
; have dx free for a byte pair later
|
||||
|
||||
cmp si,bx
|
||||
jb %%loop1
|
||||
ja %%return ; finished if b > r
|
||||
cmp dx,ax
|
||||
ja %%return
|
||||
|
||||
; rotate w (= b) to greatest dyadic multiple of b <= r
|
||||
|
||||
%%loop1:
|
||||
shl dx,1 ; w = 2*w
|
||||
rcl si,1
|
||||
jc %%loop1_exit ; w was > r counting overflow (unsigned)
|
||||
cmp si,bx ; while w <= r (unsigned)
|
||||
jb %%loop1
|
||||
ja %%loop1_exit
|
||||
cmp dx,ax
|
||||
jbe %%loop1 ; else exit with carry clear for rcr
|
||||
|
||||
%%loop1_exit:
|
||||
rcr si,1
|
||||
rcr dx,1
|
||||
|
||||
%%loop2:
|
||||
shl cx,1 ; q = 2*q
|
||||
rcl di,1
|
||||
cmp si,bx ; if w <= r
|
||||
jb %%loop2_over
|
||||
ja %%loop2_test
|
||||
cmp dx,ax
|
||||
ja %%loop2_test
|
||||
|
||||
%%loop2_over:
|
||||
add cx,1 ; q++
|
||||
adc di,0
|
||||
sub ax,dx ; r = r-w
|
||||
sbb bx,si
|
||||
|
||||
%%loop2_test:
|
||||
shr si,1 ; w = w/2
|
||||
rcr dx,1
|
||||
cmp si,[bp+b16] ; while w >= b
|
||||
ja %%loop2
|
||||
jb %%return
|
||||
cmp dx,[bp+b0]
|
||||
jae %%loop2
|
||||
|
||||
%%return:
|
||||
mov sp,bp
|
||||
pop si
|
||||
pop bp
|
||||
|
||||
mov dx,bx
|
||||
mov bx,ax
|
||||
mov ax,cx
|
||||
mov cx,dx
|
||||
mov dx,di
|
||||
pop di
|
||||
|
||||
ret
|
||||
|
||||
%endmacro
|
132
kernel/main.c
132
kernel/main.c
|
@ -47,28 +47,30 @@ GLOBAL BYTE copyright[] =
|
|||
|
||||
-- Bart
|
||||
*/
|
||||
extern UBYTE DOSFAR nblkdev, DOSFAR lastdrive; /* value of last drive */
|
||||
extern UBYTE DOSFAR ASM nblkdev, DOSFAR ASM lastdrive; /* value of last drive */
|
||||
|
||||
GLOBAL BYTE DOSFAR os_major, /* major version number */
|
||||
DOSFAR os_minor, /* minor version number */
|
||||
DOSFAR dosidle_flag, DOSFAR BootDrive, /* Drive we came up from */
|
||||
DOSFAR default_drive; /* default drive for dos */
|
||||
DOSFAR dosidle_flag, DOSFAR ASM BootDrive, /* Drive we came up from */
|
||||
DOSFAR ASM default_drive; /* default drive for dos */
|
||||
|
||||
GLOBAL BYTE DOSFAR os_release[];
|
||||
/* GLOBAL BYTE DOSFAR copyright[]; */
|
||||
GLOBAL seg DOSFAR RootPsp; /* Root process -- do not abort */
|
||||
|
||||
extern struct dpb FAR *DOSFAR DPBp; /* First drive Parameter Block */
|
||||
extern cdstbl FAR *DOSFAR CDSp; /* Current Directory Structure */
|
||||
extern struct dpb FAR *DOSFAR ASM DPBp; /* First drive Parameter Block */
|
||||
extern cdstbl FAR *DOSFAR ASM CDSp; /* Current Directory Structure */
|
||||
|
||||
extern struct dhdr FAR *DOSFAR clock, /* CLOCK$ device */
|
||||
FAR * DOSFAR syscon; /* console device */
|
||||
extern struct dhdr DOSTEXTFAR con_dev, /* console device drive */
|
||||
DOSTEXTFAR clk_dev, /* Clock device driver */
|
||||
DOSTEXTFAR blk_dev; /* Block device (Disk) driver */
|
||||
extern UWORD DOSFAR ram_top; /* How much ram in Kbytes */
|
||||
extern iregs FAR *DOSFAR user_r; /* User registers for int 21h call */
|
||||
extern BYTE FAR _HMATextEnd[];
|
||||
extern struct dhdr FAR *DOSFAR ASM clock, /* CLOCK$ device */
|
||||
FAR * DOSFAR ASM syscon; /* console device */
|
||||
extern struct dhdr ASM DOSTEXTFAR con_dev, /* console device drive */
|
||||
DOSTEXTFAR ASM clk_dev, /* Clock device driver */
|
||||
DOSTEXTFAR ASM blk_dev; /* Block device (Disk) driver */
|
||||
extern UWORD DOSFAR ASM ram_top; /* How much ram in Kbytes */
|
||||
extern iregs FAR *DOSFAR ASM user_r; /* User registers for int 21h call */
|
||||
extern BYTE FAR ASM _HMATextEnd[];
|
||||
|
||||
extern struct _KernelConfig FAR ASM LowKernelConfig;
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *mainRcsId =
|
||||
|
@ -82,17 +84,17 @@ extern BYTE FAR *lpBase;
|
|||
extern BYTE FAR *lpOldTop;
|
||||
extern BYTE FAR *lpTop;
|
||||
extern BYTE FAR *upBase;
|
||||
extern BYTE _ib_start[], _ib_end[], _init_end[];
|
||||
extern BYTE ASM _ib_start[], ASM _ib_end[], ASM _init_end[];
|
||||
|
||||
INIT VOID configDone(VOID);
|
||||
INIT static void InitIO(void);
|
||||
VOID configDone(VOID);
|
||||
STATIC VOID InitIO(void);
|
||||
|
||||
INIT static VOID update_dcb(struct dhdr FAR *);
|
||||
INIT static VOID init_kernel(VOID);
|
||||
INIT static VOID signon(VOID);
|
||||
INIT VOID kernel(VOID);
|
||||
INIT VOID FsConfig(VOID);
|
||||
INIT VOID InitPrinters(VOID);
|
||||
STATIC VOID update_dcb(struct dhdr FAR *);
|
||||
STATIC VOID init_kernel(VOID);
|
||||
STATIC VOID signon(VOID);
|
||||
STATIC VOID kernel(VOID);
|
||||
STATIC VOID FsConfig(VOID);
|
||||
STATIC VOID InitPrinters(VOID);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
BYTE _acrtused = 0;
|
||||
|
@ -106,7 +108,7 @@ __segment DosTextSeg = 0;
|
|||
|
||||
#endif
|
||||
|
||||
INIT VOID ASMCFUNC FreeDOSmain(void)
|
||||
VOID ASMCFUNC FreeDOSmain(void)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
extern FAR DATASTART;
|
||||
|
@ -115,7 +117,33 @@ INIT VOID ASMCFUNC FreeDOSmain(void)
|
|||
DosTextSeg = (__segment) & prn_dev;
|
||||
#endif
|
||||
|
||||
fmemcpy(&InitKernelConfig, &LowKernelConfig, sizeof(InitKernelConfig));
|
||||
|
||||
/* if the kernel has been UPX'ed,
|
||||
CONFIG info is stored at 50:e2 ..fc
|
||||
and the bootdrive (passed from BIOS)
|
||||
at 50:e0
|
||||
*/
|
||||
|
||||
if (fmemcmp(MK_FP(0x50,0xe0+2),"CONFIG",6) == 0) /* UPX */
|
||||
{
|
||||
fmemcpy(&InitKernelConfig, MK_FP(0x50,0xe0+2), sizeof(InitKernelConfig));
|
||||
|
||||
BootDrive = *(BYTE FAR *)MK_FP(0x50,0xe0);
|
||||
|
||||
BootDrive ++;
|
||||
|
||||
if ((unsigned)BootDrive >= 0x80)
|
||||
BootDrive += 3-1-128;
|
||||
|
||||
|
||||
*(DWORD FAR *)MK_FP(0x50,0xe0+2) = 0;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
fmemcpy(&InitKernelConfig, &LowKernelConfig, sizeof(InitKernelConfig));
|
||||
}
|
||||
|
||||
setvec(0, int0_handler); /* zero divide */
|
||||
setvec(1, empty_handler); /* single step */
|
||||
|
@ -157,7 +185,7 @@ void InitializeAllBPBs(VOID)
|
|||
}
|
||||
}
|
||||
|
||||
INIT void init_kernel(void)
|
||||
STATIC void init_kernel(void)
|
||||
{
|
||||
COUNT i;
|
||||
|
||||
|
@ -223,7 +251,8 @@ INIT void init_kernel(void)
|
|||
|
||||
#ifndef KDB
|
||||
/* Now process CONFIG.SYS */
|
||||
DoConfig();
|
||||
DoConfig(0);
|
||||
DoConfig(1);
|
||||
|
||||
/* Close all (device) files */
|
||||
for (i = 0; i < lastdrive; i++)
|
||||
|
@ -238,7 +267,7 @@ INIT void init_kernel(void)
|
|||
FsConfig();
|
||||
|
||||
/* and process CONFIG.SYS one last time to load device drivers. */
|
||||
DoConfig();
|
||||
DoConfig(2);
|
||||
configDone();
|
||||
|
||||
/* Close all (device) files */
|
||||
|
@ -252,29 +281,11 @@ INIT void init_kernel(void)
|
|||
InitializeAllBPBs();
|
||||
}
|
||||
|
||||
INIT VOID FsConfig(VOID)
|
||||
STATIC VOID FsConfig(VOID)
|
||||
{
|
||||
REG COUNT i;
|
||||
struct dpb FAR *dpb;
|
||||
|
||||
/* The system file tables need special handling and are "hand */
|
||||
/* built. Included is the stdin, stdout, stdaux and stdprn. */
|
||||
|
||||
/* 0 is /dev/con (stdin) */
|
||||
open("CON", O_RDWR);
|
||||
|
||||
/* 1 is /dev/con (stdout) */
|
||||
dup2(STDIN, STDOUT);
|
||||
|
||||
/* 2 is /dev/con (stderr) */
|
||||
dup2(STDIN, STDERR);
|
||||
|
||||
/* 3 is /dev/aux */
|
||||
open("AUX", O_RDWR);
|
||||
|
||||
/* 4 is /dev/prn */
|
||||
open("PRN", O_WRONLY);
|
||||
|
||||
/* Log-in the default drive. */
|
||||
/* Get the boot drive from the ipl and use it for default. */
|
||||
default_drive = BootDrive - 1;
|
||||
|
@ -305,11 +316,29 @@ INIT VOID FsConfig(VOID)
|
|||
pcds_table->cdsJoinOffset = 2;
|
||||
}
|
||||
|
||||
/* The system file tables need special handling and are "hand */
|
||||
/* built. Included is the stdin, stdout, stdaux and stdprn. */
|
||||
|
||||
/* 0 is /dev/con (stdin) */
|
||||
open("CON", O_RDWR);
|
||||
|
||||
/* 1 is /dev/con (stdout) */
|
||||
dup2(STDIN, STDOUT);
|
||||
|
||||
/* 2 is /dev/con (stderr) */
|
||||
dup2(STDIN, STDERR);
|
||||
|
||||
/* 3 is /dev/aux */
|
||||
open("AUX", O_RDWR);
|
||||
|
||||
/* 4 is /dev/prn */
|
||||
open("PRN", O_WRONLY);
|
||||
|
||||
/* Initialize the disk buffer management functions */
|
||||
/* init_call_init_buffers(); done from CONFIG.C */
|
||||
}
|
||||
|
||||
INIT VOID signon()
|
||||
STATIC VOID signon()
|
||||
{
|
||||
printf("\n%S", (void FAR *)os_release);
|
||||
|
||||
|
@ -336,7 +365,7 @@ INIT VOID signon()
|
|||
printf("\n\n%S", (void FAR *)copyright);
|
||||
}
|
||||
|
||||
INIT void kernel()
|
||||
STATIC void kernel()
|
||||
{
|
||||
#if 0
|
||||
BYTE FAR *ep, *sp;
|
||||
|
@ -465,7 +494,7 @@ INIT void kernel()
|
|||
}
|
||||
|
||||
/* check for a block device and update device control block */
|
||||
static VOID update_dcb(struct dhdr FAR * dhp)
|
||||
STATIC VOID update_dcb(struct dhdr FAR * dhp)
|
||||
{
|
||||
REG COUNT Index;
|
||||
COUNT nunits = dhp->dh_name[0];
|
||||
|
@ -563,10 +592,9 @@ BOOL init_device(struct dhdr FAR * dhp, BYTE FAR * cmdLine, COUNT mode,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
INIT static void InitIO(void)
|
||||
STATIC void InitIO(void)
|
||||
{
|
||||
/* Initialize driver chain */
|
||||
|
||||
setvec(0x29, int29_handler); /* Requires Fast Con Driver */
|
||||
init_device(&con_dev, NULL, NULL, ram_top);
|
||||
init_device(&clk_dev, NULL, NULL, ram_top);
|
||||
|
@ -587,7 +615,7 @@ VOID init_fatal(BYTE * err_msg)
|
|||
I usually much more often reset my system, then I print :-)
|
||||
*/
|
||||
|
||||
INIT VOID InitPrinters(VOID)
|
||||
STATIC VOID InitPrinters(VOID)
|
||||
{
|
||||
iregs r;
|
||||
int num_printers, i;
|
||||
|
|
|
@ -26,15 +26,14 @@ HDR=../hdr/
|
|||
# 'standard' compiles
|
||||
|
||||
.c.obj :
|
||||
$(CC) $(CFLAGS) -c $*.c
|
||||
$(PATCHOBJ) $*.obj $(STDPATCH)
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
$(STDPATCH) $*.obj
|
||||
|
||||
# *List Macros*
|
||||
|
||||
|
||||
EXE_dependencies = \
|
||||
apisupt.obj \
|
||||
rtlsupt.obj \
|
||||
asmsupt.obj \
|
||||
blockio.obj \
|
||||
break.obj \
|
||||
|
@ -81,7 +80,6 @@ EXE_dependencies = \
|
|||
systime.obj \
|
||||
task.obj \
|
||||
inithma.obj \
|
||||
dyndata.obj \
|
||||
dyninit.obj
|
||||
|
||||
# *Explicit Rules*
|
||||
|
@ -94,7 +92,8 @@ production: ..\bin\kernel.sys
|
|||
copy kernel.map ..\bin\$(THETARGET).map
|
||||
|
||||
kernel.sys: kernel.exe ..\utils\exeflat.exe
|
||||
..\utils\exeflat kernel.exe kernel.sys 0x60 -S0x10 -S0x8B
|
||||
$(XUPX) kernel.exe
|
||||
..\utils\exeflat kernel.exe kernel.sys 0x60 -S0x10 -S0x8B $(UPXOPT)
|
||||
|
||||
clobber: clean
|
||||
-$(RM) kernel.exe kernel.sys status.me
|
||||
|
@ -113,9 +112,9 @@ kernel.exe: $(EXE_dependencies) $(LIBS)
|
|||
$(LIBUTIL) kernel.lib $(LIBPLUS)dosnames.obj $(LIBPLUS)prf.obj $(LIBPLUS)strings.obj $(LIBPLUS)network.obj $(LIBPLUS)sysclk.obj $(LIBPLUS)syspack.obj$(LIBTERM)
|
||||
$(LIBUTIL) kernel.lib $(LIBPLUS)systime.obj $(LIBPLUS)task.obj $(LIBPLUS)int2f.obj $(LIBPLUS)irqstack.obj $(LIBPLUS)apisupt.obj$(LIBTERM)
|
||||
$(LIBUTIL) kernel.lib $(LIBPLUS)asmsupt.obj $(LIBPLUS)execrh.obj $(LIBPLUS)nlssupt.obj $(LIBPLUS)procsupt.obj $(LIBPLUS)break.obj$(LIBTERM)
|
||||
$(LIBUTIL) kernel.lib $(LIBPLUS)dosidle.obj $(LIBPLUS)dyndata.obj $(LIBPLUS)dyninit.obj $(LIBPLUS)rtlsupt.obj $(LIBTERM)
|
||||
$(LIBUTIL) kernel.lib $(LIBPLUS)dosidle.obj $(LIBPLUS)dyninit.obj $(LIBPLUS)lfnapi.obj $(LIBTERM)
|
||||
-$(RM) kernel.bak
|
||||
$(LINK) kernel iprf,kernel,kernel,kernel+$(LIBS);
|
||||
$(LINK) kernel iprf,kernel,kernel,kernel+$(LIBS)+..\lib\libm.lib;
|
||||
-$(RM) kernel.lib
|
||||
|
||||
# *Individual File Dependencies*
|
||||
|
@ -131,8 +130,6 @@ entry.obj: entry.asm segs.inc $(HDR)stacks.inc
|
|||
|
||||
apisupt.obj: apisupt.asm segs.inc
|
||||
|
||||
rtlsupt.obj: rtlsupt.asm segs.inc
|
||||
|
||||
execrh.obj: execrh.asm segs.inc
|
||||
|
||||
int2f.obj: int2f.asm segs.inc
|
||||
|
@ -168,43 +165,43 @@ HEADERS=\
|
|||
# XXX: I generated these using `gcc -MM' and `sed', so they may not be
|
||||
# completely correct... -- ror4
|
||||
|
||||
blockio.obj: blockio.c $(HEADERS) $(CONFIGURATION)
|
||||
#blockio.obj: blockio.c $(HEADERS) $(CONFIGURATION)
|
||||
|
||||
break.obj: break.c $(HEADERS) $(CONFIGURATION)
|
||||
#break.obj: break.c $(HEADERS) $(CONFIGURATION)
|
||||
|
||||
chario.obj: chario.c $(HEADERS) $(CONFIGURATION)
|
||||
#chario.obj: chario.c $(HEADERS) $(CONFIGURATION)
|
||||
|
||||
dosfns.obj: dosfns.c $(HEADERS) $(CONFIGURATION)
|
||||
#dosfns.obj: dosfns.c $(HEADERS) $(CONFIGURATION)
|
||||
|
||||
dosnames.obj: dosnames.c $(HEADERS) $(CONFIGURATION)
|
||||
#dosnames.obj: dosnames.c $(HEADERS) $(CONFIGURATION)
|
||||
|
||||
dsk.obj: dsk.c $(HEADERS) $(CONFIGURATION)
|
||||
#dsk.obj: dsk.c $(HEADERS) $(CONFIGURATION)
|
||||
|
||||
error.obj: error.c $(HEADERS) $(CONFIGURATION)
|
||||
#error.obj: error.c $(HEADERS) $(CONFIGURATION)
|
||||
|
||||
fatdir.obj: fatdir.c $(HEADERS) $(CONFIGURATION)
|
||||
#fatdir.obj: fatdir.c $(HEADERS) $(CONFIGURATION)
|
||||
|
||||
fatfs.obj: fatfs.c $(HEADERS) $(CONFIGURATION)
|
||||
#fatfs.obj: fatfs.c $(HEADERS) $(CONFIGURATION)
|
||||
|
||||
fattab.obj: fattab.c $(HEADERS) $(CONFIGURATION)
|
||||
#fattab.obj: fattab.c $(HEADERS) $(CONFIGURATION)
|
||||
|
||||
fcbfns.obj: fcbfns.c $(HEADERS) $(CONFIGURATION)
|
||||
#fcbfns.obj: fcbfns.c $(HEADERS) $(CONFIGURATION)
|
||||
|
||||
inthndlr.obj: inthndlr.c $(HEADERS) $(CONFIGURATION)
|
||||
#inthndlr.obj: inthndlr.c $(HEADERS) $(CONFIGURATION)
|
||||
|
||||
ioctl.obj: ioctl.c $(HEADERS) $(CONFIGURATION)
|
||||
#ioctl.obj: ioctl.c $(HEADERS) $(CONFIGURATION)
|
||||
|
||||
memmgr.obj: memmgr.c $(HEADERS) $(CONFIGURATION)
|
||||
#memmgr.obj: memmgr.c $(HEADERS) $(CONFIGURATION)
|
||||
|
||||
misc.obj: misc.c $(HEADERS) $(CONFIGURATION)
|
||||
#misc.obj: misc.c $(HEADERS) $(CONFIGURATION)
|
||||
|
||||
lfnapi.obj: lfnapi.c $(HEADERS) $(CONFIGURATION)
|
||||
#lfnapi.obj: lfnapi.c $(HEADERS) $(CONFIGURATION)
|
||||
|
||||
newstuff.obj: newstuff.c $(HEADERS) $(CONFIGURATION)
|
||||
#newstuff.obj: newstuff.c $(HEADERS) $(CONFIGURATION)
|
||||
|
||||
network.obj: network.c $(HEADERS) $(CONFIGURATION)
|
||||
#network.obj: network.c $(HEADERS) $(CONFIGURATION)
|
||||
|
||||
nls.obj: nls.c $(HEADERS) $(CONFIGURATION)
|
||||
#nls.obj: nls.c $(HEADERS) $(CONFIGURATION)
|
||||
|
||||
# \
|
||||
# 001-437.nls
|
||||
|
@ -229,37 +226,32 @@ task.obj: task.c $(HEADERS) $(CONFIGURATION)
|
|||
|
||||
config.obj: config.c $(INITHEADERS) $(HEADERS) $(CONFIGURATION)
|
||||
$(CC) $(INITCFLAGS) -c $*.c
|
||||
$(PATCHOBJ) $*.obj $(INITPATCH)
|
||||
$(INITPATCH) $*.obj
|
||||
|
||||
initoem.obj: initoem.c $(INITHEADERS) $(HEADERS) $(CONFIGURATION)
|
||||
$(CC) $(INITCFLAGS) -c $*.c
|
||||
$(PATCHOBJ) $*.obj $(INITPATCH)
|
||||
$(INITPATCH) $*.obj
|
||||
|
||||
main.obj: main.c $(INITHEADERS) $(HEADERS) $(CONFIGURATION)
|
||||
$(CC) $(INITCFLAGS) -c $*.c
|
||||
$(PATCHOBJ) $*.obj $(INITPATCH)
|
||||
$(INITPATCH) $*.obj
|
||||
|
||||
inithma.obj: inithma.c $(INITHEADERS) $(HEADERS) $(CONFIGURATION)
|
||||
$(CC) $(INITCFLAGS) -c $*.c
|
||||
$(PATCHOBJ) $*.obj $(INITPATCH)
|
||||
$(INITPATCH) $*.obj
|
||||
|
||||
dyninit.obj: dyninit.c $(INITHEADERS) $(HEADERS) $(CONFIGURATION)
|
||||
$(CC) $(INITCFLAGS) -c $*.c
|
||||
$(PATCHOBJ) $*.obj $(INITPATCH)
|
||||
$(INITPATCH) $*.obj
|
||||
|
||||
initdisk.obj: initdisk.c $(INITHEADERS) $(HEADERS) $(CONFIGURATION)
|
||||
$(CC) $(INITCFLAGS) -c $*.c
|
||||
$(PATCHOBJ) $*.obj $(INITPATCH)
|
||||
$(INITPATCH) $*.obj
|
||||
|
||||
#the printf for INIT_TEXT - yet another special case, this file includes prf.c
|
||||
iprf.obj: iprf.c prf.c $(HDR)\portab.h $(CONFIGURATION)
|
||||
$(CC) $(INITCFLAGS) -c $*.c
|
||||
$(PATCHOBJ) $*.obj $(INITPATCH)
|
||||
|
||||
#dynamic NEAR data
|
||||
dyndata.obj: dyndata.c dyndata.h
|
||||
$(CC) $(DYNCFLAGS) -c $*.c
|
||||
$(PATCHOBJ) $*.obj $(DYNPATCH)
|
||||
$(INITPATCH) $*.obj
|
||||
|
||||
# Log: makefile,v
|
||||
#
|
||||
|
|
|
@ -60,7 +60,7 @@ void FAR *nxtMCBsize(mcb FAR * Mcb, int size)
|
|||
* SUCCESS: on success
|
||||
* else: error number <<currently DE_MCBDESTRY only>>
|
||||
*/
|
||||
static COUNT joinMCBs(mcb FAR * p)
|
||||
STATIC COUNT joinMCBs(mcb FAR * p)
|
||||
{
|
||||
mcb FAR *q;
|
||||
|
||||
|
@ -95,7 +95,7 @@ seg long2para(ULONG size)
|
|||
/*
|
||||
* Add a displacement to a far pointer and return the result normalized.
|
||||
*/
|
||||
VOID FAR *add_far(VOID FAR * fp, ULONG off)
|
||||
VOID FAR * add_far(VOID FAR * fp, ULONG off)
|
||||
{
|
||||
UWORD off2;
|
||||
|
||||
|
@ -111,7 +111,7 @@ VOID FAR *add_far(VOID FAR * fp, ULONG off)
|
|||
/*
|
||||
* Return a normalized far pointer
|
||||
*/
|
||||
VOID FAR *adjust_far(VOID FAR * fp)
|
||||
VOID FAR * adjust_far(VOID FAR * fp)
|
||||
{
|
||||
/* and return an adddress adjusted to the nearest paragraph */
|
||||
/* boundary. */
|
||||
|
|
|
@ -32,7 +32,6 @@ static BYTE *mainRcsId =
|
|||
|
||||
#include "portab.h"
|
||||
#include "globals.h"
|
||||
#include "proto.h"
|
||||
|
||||
/*
|
||||
TE-TODO: if called repeatedly by same process,
|
||||
|
@ -158,7 +157,7 @@ COUNT get_verify_drive(char FAR * src)
|
|||
|
||||
*/
|
||||
|
||||
COUNT ASMCFUNC truename(char FAR * src, char FAR * dest, COUNT t)
|
||||
COUNT truename(char FAR * src, char FAR * dest, COUNT t)
|
||||
{
|
||||
static char buf[128] = "A:\\\0\0\0\0\0\0\0\0\0";
|
||||
char *bufp = buf + 3;
|
||||
|
|
|
@ -42,14 +42,14 @@ static BYTE *RcsId =
|
|||
#define cntry Config.cfgCSYS_cntry
|
||||
#define cp Config.cfgCSYS_cp
|
||||
|
||||
static int err(void)
|
||||
STATIC int err(void)
|
||||
{
|
||||
printf("Syntax error in or invalid COUNTRY.SYS: \"%s\"\n", filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define readStruct(s) readStructure(&(s), sizeof(s), fd)
|
||||
static int readStructure(void *buf, int size, COUNT fd)
|
||||
STATIC int readStructure(void *buf, int size, COUNT fd)
|
||||
{
|
||||
if (DosRead(fd, buf, size) == size)
|
||||
return 1;
|
||||
|
@ -102,7 +102,7 @@ COUNT csysOpen(void)
|
|||
|
||||
/* Searches for function definition of table #fctID and
|
||||
moves it at index idx */
|
||||
static int chkTable(int idx, int fctID, struct csys_function *fcts,
|
||||
STATIC int chkTable(int idx, int fctID, struct csys_function *fcts,
|
||||
int numFct)
|
||||
{
|
||||
struct csys_function *fct, hfct;
|
||||
|
|
83
kernel/prf.c
83
kernel/prf.c
|
@ -28,10 +28,21 @@
|
|||
|
||||
#include "portab.h"
|
||||
|
||||
/*#define DOSEMU*/
|
||||
#ifdef FORSYS
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
/*#define DOSEMU */
|
||||
|
||||
#ifdef DOSEMU
|
||||
#define MAX_BUFSIZE 80 /* adjust if necessary */
|
||||
static int buff_offset = 0;
|
||||
static char buff[MAX_BUFSIZE];
|
||||
#endif
|
||||
|
||||
#ifdef _INIT
|
||||
#define fstrlen reloc_call_fstrlen
|
||||
#define handle_char init_handle_char
|
||||
#define put_console init_put_console
|
||||
#define ltob init_ltob
|
||||
#define do_printf init_do_printf
|
||||
|
@ -50,24 +61,14 @@ static BYTE *prfRcsId =
|
|||
|
||||
static BYTE *charp = 0;
|
||||
|
||||
#ifdef PROTO
|
||||
VOID handle_char(COUNT);
|
||||
VOID put_console(COUNT);
|
||||
BYTE *ltob(LONG, BYTE *, COUNT);
|
||||
COUNT do_printf(CONST BYTE *, REG BYTE **);
|
||||
#else
|
||||
VOID handle_char();
|
||||
VOID put_console();
|
||||
BYTE *ltob();
|
||||
COUNT do_printf();
|
||||
#endif
|
||||
STATIC VOID handle_char(COUNT);
|
||||
STATIC VOID put_console(COUNT);
|
||||
STATIC BYTE * ltob(LONG, BYTE *, COUNT);
|
||||
STATIC COUNT do_printf(CONST BYTE *, REG BYTE **);
|
||||
WORD CDECL printf(CONST BYTE * fmt, ...);
|
||||
|
||||
/* The following is user supplied and must match the following prototype */
|
||||
#ifdef PROTO
|
||||
VOID cso(COUNT);
|
||||
#else
|
||||
VOID cso();
|
||||
#endif
|
||||
|
||||
#ifdef FORSYS
|
||||
COUNT fstrlen(BYTE FAR * s) /* don't want globals.h, sorry */
|
||||
|
@ -82,6 +83,30 @@ COUNT fstrlen(BYTE FAR * s) /* don't want globals.h, sorry */
|
|||
#endif
|
||||
|
||||
/* special console output routine */
|
||||
#ifdef DOSEMU
|
||||
VOID put_console(COUNT c)
|
||||
{
|
||||
if (buff_offset >= MAX_BUFSIZE)
|
||||
{
|
||||
buff_offset = 0;
|
||||
printf("Printf buffer overflow!\n");
|
||||
}
|
||||
if (c == '\n')
|
||||
{
|
||||
buff[buff_offset] = 0;
|
||||
buff_offset = 0;
|
||||
_ES = FP_SEG(buff);
|
||||
_DX = FP_OFF(buff);
|
||||
_AX = 0x13;
|
||||
__int__(0xe6);
|
||||
}
|
||||
else
|
||||
{
|
||||
buff[buff_offset] = c;
|
||||
buff_offset++;
|
||||
}
|
||||
}
|
||||
#else
|
||||
VOID put_console(COUNT c)
|
||||
{
|
||||
if (c == '\n')
|
||||
|
@ -103,11 +128,12 @@ VOID put_console(COUNT c)
|
|||
int 0x10;
|
||||
}
|
||||
#endif /* __TURBO__ */
|
||||
#endif
|
||||
#endif /* FORSYS */
|
||||
}
|
||||
#endif /* DOSEMU */
|
||||
|
||||
/* special handler to switch between sprintf and printf */
|
||||
static VOID handle_char(COUNT c)
|
||||
STATIC VOID handle_char(COUNT c)
|
||||
{
|
||||
if (charp == 0)
|
||||
put_console(c);
|
||||
|
@ -157,30 +183,13 @@ BYTE *ltob(LONG n, BYTE * s, COUNT base)
|
|||
#define RIGHT 1
|
||||
|
||||
/* printf -- short version of printf to conserve space */
|
||||
#ifdef DOSEMU
|
||||
WORD printf(CONST BYTE * fmt, ...)
|
||||
{
|
||||
WORD ret;
|
||||
|
||||
static char buff[80]; /* adjust if necessary */
|
||||
charp = buff;
|
||||
ret = do_printf(fmt, (BYTE **) & fmt + 1);
|
||||
handle_char(NULL);
|
||||
_ES = FP_SEG(buff);
|
||||
_DX = FP_OFF(buff);
|
||||
_AX = 0x13;
|
||||
__int__(0xe6);
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
WORD printf(CONST BYTE * fmt, ...)
|
||||
WORD CDECL printf(CONST BYTE * fmt, ...)
|
||||
{
|
||||
charp = 0;
|
||||
return do_printf(fmt, (BYTE **) & fmt + 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
WORD sprintf(BYTE * buff, CONST BYTE * fmt, ...)
|
||||
WORD CDECL sprintf(BYTE * buff, CONST BYTE * fmt, ...)
|
||||
{
|
||||
WORD ret;
|
||||
|
||||
|
|
|
@ -66,16 +66,13 @@ UCOUNT sti(keyboard * kp);
|
|||
sft FAR *get_sft(UCOUNT);
|
||||
|
||||
/* dosfns.c */
|
||||
#ifdef WITHFAT32
|
||||
struct dpb FAR *GetDriveDPB(UBYTE drive, COUNT * rc);
|
||||
#endif
|
||||
BYTE FAR *get_root(BYTE FAR *);
|
||||
BOOL fnmatch(BYTE FAR *, BYTE FAR *, COUNT, COUNT);
|
||||
BOOL check_break(void);
|
||||
UCOUNT GenericReadSft(sft far * sftp, UCOUNT n, BYTE FAR * bp,
|
||||
COUNT FAR * err, BOOL force_binary);
|
||||
COUNT SftSeek(sft FAR * sftp, LONG new_pos, COUNT mode);
|
||||
/* COUNT DosRead(COUNT hndl, UCOUNT n, BYTE FAR * bp, COUNT FAR * err); */
|
||||
/*COUNT DosRead(COUNT hndl, UCOUNT n, BYTE FAR * bp, COUNT FAR * err); */
|
||||
#define GenericRead(hndl, n, bp, err, t) GenericReadSft(get_sft(hndl), n, bp, err, t)
|
||||
#define DosRead(hndl, n, bp, err) GenericRead(hndl, n, bp, err, FALSE)
|
||||
#define DosReadSft(sftp, n, bp, err) GenericReadSft(sftp, n, bp, err, FALSE)
|
||||
|
@ -91,10 +88,10 @@ COUNT DosForceDup(COUNT OldHandle, COUNT NewHandle);
|
|||
COUNT DosOpen(BYTE FAR * fname, COUNT mode);
|
||||
COUNT DosOpenSft(BYTE * fname, COUNT mode);
|
||||
COUNT DosClose(COUNT hndl);
|
||||
COUNT DosCloseSft(WORD sft_idx);
|
||||
COUNT DosCloseSft(WORD sft_idx, BOOL commitonly);
|
||||
#define DosCommit(hndl) DosCloseSft(get_sft_idx(hndl), TRUE)
|
||||
BOOL DosGetFree(UBYTE drive, UCOUNT FAR * spc, UCOUNT FAR * navc,
|
||||
UCOUNT FAR * bps, UCOUNT FAR * nc);
|
||||
COUNT DosGetExtFree(BYTE FAR * DriveString, struct xfreespace FAR * xfsp);
|
||||
COUNT DosGetCuDir(UBYTE drive, BYTE FAR * s);
|
||||
COUNT DosChangeDir(BYTE FAR * s);
|
||||
COUNT DosFindFirst(UCOUNT attr, BYTE FAR * name);
|
||||
|
@ -122,18 +119,12 @@ VOID ASMCFUNC DosIdle_int(void);
|
|||
/* dosnames.c */
|
||||
VOID SpacePad(BYTE *, COUNT);
|
||||
COUNT ParseDosName(BYTE *, COUNT *, BYTE *, BYTE *, BYTE *, BOOL);
|
||||
/* COUNT ParseDosPath(BYTE *, COUNT *, BYTE *, BYTE FAR *); */
|
||||
|
||||
/* dsk.c */
|
||||
COUNT FAR ASMCFUNC blk_driver(rqptr rp);
|
||||
ddt *getddt(int dev);
|
||||
/*COUNT ParseDosPath(BYTE *, COUNT *, BYTE *, BYTE FAR *); */
|
||||
|
||||
/* error.c */
|
||||
VOID dump(void);
|
||||
VOID panic(BYTE * s);
|
||||
VOID fatal(BYTE * err_msg);
|
||||
COUNT char_error(request * rq, struct dhdr FAR * lpDevice);
|
||||
COUNT block_error(request * rq, COUNT nDrive, struct dhdr FAR * lpDevice);
|
||||
|
||||
/* fatdir.c */
|
||||
VOID dir_init_fnode(f_node_ptr fnp, CLUSTER dirstart);
|
||||
|
@ -153,6 +144,7 @@ BOOL fcmp(BYTE * s1, BYTE * s2, COUNT n);
|
|||
BOOL fcmp_wild(BYTE FAR * s1, BYTE FAR * s2, COUNT n);
|
||||
VOID touc(BYTE * s, COUNT n);
|
||||
COUNT dos_close(COUNT fd);
|
||||
COUNT dos_commit(COUNT fd);
|
||||
COUNT dos_creat(BYTE * path, COUNT attrib);
|
||||
COUNT dos_delete(BYTE * path);
|
||||
COUNT dos_rmdir(BYTE * path);
|
||||
|
@ -186,12 +178,7 @@ COUNT dos_setfattr(BYTE * name, UWORD attrp);
|
|||
COUNT media_check(REG struct dpb FAR * dpbp);
|
||||
f_node_ptr xlt_fd(COUNT fd);
|
||||
COUNT xlt_fnp(f_node_ptr fnp);
|
||||
struct dhdr FAR *select_unit(COUNT drive);
|
||||
#ifdef WITHFAT32
|
||||
VOID bpb_to_dpb(bpb FAR * bpbp, REG struct dpb FAR * dpbp, BOOL extended);
|
||||
#else
|
||||
VOID bpb_to_dpb(bpb FAR * bpbp, REG struct dpb FAR * dpbp);
|
||||
#endif
|
||||
struct dhdr FAR * select_unit(COUNT drive);
|
||||
|
||||
/* fattab.c */
|
||||
void read_fsinfo(struct dpb FAR * dpbp);
|
||||
|
@ -224,20 +211,20 @@ BOOL TestCmnSeps(BYTE FAR * lpFileName);
|
|||
BOOL TestFieldSeps(BYTE FAR * lpFileName);
|
||||
BYTE FAR *GetNameField(BYTE FAR * lpFileName, BYTE FAR * lpDestField,
|
||||
COUNT nFieldSize, BOOL * pbWildCard);
|
||||
BOOL FcbRead(xfcb FAR * lpXfcb, COUNT * nErrorCode);
|
||||
BOOL FcbWrite(xfcb FAR * lpXfcb, COUNT * nErrorCode);
|
||||
typedef BOOL FcbFunc_t (xfcb FAR *, COUNT *, UCOUNT);
|
||||
FcbFunc_t FcbRead, FcbWrite;
|
||||
BOOL FcbGetFileSize(xfcb FAR * lpXfcb);
|
||||
BOOL FcbSetRandom(xfcb FAR * lpXfcb);
|
||||
BOOL FcbCalcRec(xfcb FAR * lpXfcb);
|
||||
BOOL FcbRandomBlockRead(xfcb FAR * lpXfcb, COUNT nRecords,
|
||||
COUNT * nErrorCode);
|
||||
BOOL FcbRandomBlockWrite(xfcb FAR * lpXfcb, COUNT nRecords,
|
||||
COUNT * nErrorCode);
|
||||
BOOL FcbRandomIO(xfcb FAR * lpXfcb, COUNT * nErrorCode,
|
||||
BOOL(*FcbFunc) (xfcb FAR *, COUNT *));
|
||||
BOOL FcbCreate(xfcb FAR * lpXfcb);
|
||||
COUNT * nErrorCode);
|
||||
BOOL FcbRandomIO(xfcb FAR * lpXfcb, COUNT * nErrorCode, FcbFunc_t *FcbFunc);
|
||||
BOOL FcbOpenCreate(xfcb FAR * lpXfcb, BOOL Create);
|
||||
#define FcbOpen(fcb) FcbOpenCreate(fcb, FALSE)
|
||||
#define FcbCreate(fcb) FcbOpenCreate(fcb, TRUE)
|
||||
void FcbNameInit(fcb FAR * lpFcb, BYTE * pszBuffer, COUNT * pCurDrive);
|
||||
BOOL FcbOpen(xfcb FAR * lpXfcb);
|
||||
BOOL FcbDelete(xfcb FAR * lpXfcb);
|
||||
BOOL FcbRename(xfcb FAR * lpXfcb);
|
||||
BOOL FcbClose(xfcb FAR * lpXfcb);
|
||||
|
@ -266,10 +253,9 @@ VOID DosUmbLink(BYTE n);
|
|||
VOID mcb_print(mcb FAR * mcbp);
|
||||
|
||||
/* misc.c */
|
||||
VOID strcpy(REG BYTE * d, REG BYTE * s);
|
||||
VOID ASMCFUNC strcpy(REG BYTE * d, REG BYTE * s);
|
||||
VOID ASMCFUNC fmemcpy(REG VOID FAR * d, REG VOID FAR * s, REG COUNT n);
|
||||
VOID ASMCFUNC fstrcpy(REG BYTE FAR * d, REG BYTE FAR * s);
|
||||
VOID ASMCFUNC fstrcpy(REG BYTE FAR * d, REG BYTE FAR * s);
|
||||
void ASMCFUNC memcpy(REG void *d, REG VOID * s, REG COUNT n);
|
||||
void ASMCFUNC fmemset(REG VOID FAR * s, REG int ch, REG COUNT n);
|
||||
void ASMCFUNC memset(REG VOID * s, REG int ch, REG COUNT n);
|
||||
|
@ -278,7 +264,7 @@ void ASMCFUNC memset(REG VOID * s, REG int ch, REG COUNT n);
|
|||
COUNT lfn_allocate_inode(VOID);
|
||||
COUNT lfn_free_inode(COUNT handle);
|
||||
|
||||
COUNT lfn_setup_inode(COUNT handle, CLUSTER dirstart, ULONG diroff);
|
||||
COUNT lfn_setup_inode(COUNT handle, ULONG dirstart, ULONG diroff);
|
||||
|
||||
COUNT lfn_create_entries(COUNT handle, lfn_inode_ptr lip);
|
||||
COUNT lfn_remove_entries(COUNT handle);
|
||||
|
@ -310,8 +296,8 @@ UWORD ASMCFUNC syscall_MUX14(DIRECT_IREGS);
|
|||
|
||||
/* prf.c */
|
||||
VOID put_console(COUNT c);
|
||||
WORD printf(CONST BYTE * fmt, ...);
|
||||
WORD sprintf(BYTE * buff, CONST BYTE * fmt, ...);
|
||||
WORD CDECL printf(CONST BYTE * fmt, ...);
|
||||
WORD CDECL sprintf(BYTE * buff, CONST BYTE * fmt, ...);
|
||||
VOID hexd(char *title, VOID FAR * p, COUNT numBytes);
|
||||
|
||||
/* strings.c */
|
||||
|
@ -323,17 +309,10 @@ COUNT ASMCFUNC strcmp(REG BYTE * d, REG BYTE * s);
|
|||
COUNT ASMCFUNC fstrcmp(REG BYTE FAR * d, REG BYTE FAR * s);
|
||||
COUNT ASMCFUNC fstrncmp(REG BYTE FAR * d, REG BYTE FAR * s, COUNT l);
|
||||
COUNT ASMCFUNC strncmp(REG BYTE * d, REG BYTE * 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 ASMCFUNC fstrncpy(REG BYTE FAR * d, REG BYTE FAR * s, COUNT l);
|
||||
#define fsncopy(s,d,l) fstrncpy(d,s,l)
|
||||
|
||||
BYTE *ASMCFUNC strchr(BYTE * s, BYTE c);
|
||||
BYTE * ASMCFUNC strchr(BYTE * s, BYTE c);
|
||||
|
||||
/* sysclk.c */
|
||||
WORD FAR ASMCFUNC clk_driver(rqptr rp);
|
||||
COUNT BcdToByte(COUNT x);
|
||||
COUNT BcdToWord(BYTE * x, UWORD * mon, UWORD * day, UWORD * yr);
|
||||
COUNT ByteToBcd(COUNT x);
|
||||
|
@ -348,10 +327,6 @@ VOID putdirent(struct dirent FAR * dp, BYTE FAR * vp);
|
|||
#define putdirent(dp, vp) fmemcpy(vp, dp, sizeof(struct dirent))
|
||||
#endif
|
||||
|
||||
/* syscon.c */
|
||||
WORD con_driver(rqptr rp);
|
||||
VOID break_handler(void);
|
||||
|
||||
/* systime.c */
|
||||
VOID DosGetTime(BYTE FAR * hp, BYTE FAR * mp, BYTE FAR * sp,
|
||||
BYTE FAR * hdp);
|
||||
|
@ -376,7 +351,7 @@ VOID InitPSP(VOID);
|
|||
int SetJFTSize(UWORD nHandles);
|
||||
int DosMkTmp(BYTE FAR * pathname, UWORD attr);
|
||||
COUNT get_verify_drive(char FAR * src);
|
||||
COUNT ASMCFUNC truename(char FAR * src, char FAR * dest, COUNT t);
|
||||
COUNT truename(char FAR * src, char FAR * dest, COUNT t);
|
||||
|
||||
/* network.c */
|
||||
COUNT ASMCFUNC remote_doredirect(UWORD b, UCOUNT n, UWORD d, VOID FAR * s,
|
||||
|
@ -402,6 +377,7 @@ UCOUNT ASMCFUNC remote_write(sft FAR * s, UCOUNT n, COUNT * err);
|
|||
COUNT ASMCFUNC remote_creat(sft FAR * s, COUNT attr);
|
||||
COUNT ASMCFUNC remote_setfattr(COUNT attr);
|
||||
COUNT ASMCFUNC remote_printredir(UCOUNT dx, UCOUNT ax);
|
||||
COUNT ASMCFUNC remote_commit(sft FAR * s);
|
||||
COUNT ASMCFUNC remote_close(sft FAR * s);
|
||||
COUNT ASMCFUNC QRemote_Fn(char FAR * s, char FAR * d);
|
||||
|
||||
|
@ -411,9 +387,6 @@ VOID set_machine_name(BYTE FAR * netname, UWORD name_num);
|
|||
/* procsupt.asm */
|
||||
VOID ASMCFUNC exec_user(iregs FAR * irp);
|
||||
|
||||
/* detect.c */
|
||||
unsigned long FAR is_dosemu(void);
|
||||
|
||||
/* new by TE */
|
||||
|
||||
/*
|
||||
|
@ -426,13 +399,6 @@ unsigned long FAR is_dosemu(void);
|
|||
|
||||
#define ASSERT_CONST(x) { typedef struct { char _xx[x ? 1 : -1]; } xx ; }
|
||||
|
||||
#if defined(WATCOM) && 0
|
||||
ULONG FAR ASMCFUNC MULULUS(ULONG mul1, UWORD mul2); /* MULtiply ULong by UShort */
|
||||
ULONG FAR ASMCFUNC MULULUL(ULONG mul1, ULONG mul2); /* MULtiply ULong by ULong */
|
||||
ULONG FAR ASMCFUNC DIVULUS(ULONG mul1, UWORD mul2); /* DIVide ULong by UShort */
|
||||
ULONG FAR ASMCFUNC DIVMODULUS(ULONG mul1, UWORD mul2, UWORD * rem); /* DIVide ULong by UShort */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Log: proto.h,v
|
||||
*
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
; File:
|
||||
; rtlsupt.asm
|
||||
; Description:
|
||||
; Assembly support routines for long mul/div
|
||||
; was forced to do that for WATCOM C, which has _near
|
||||
; LMUL/LDIV routines. shouldn't harm for others
|
||||
;
|
||||
; Copyright (c) 2001
|
||||
; tom ehlert
|
||||
; All Rights Reserved
|
||||
;
|
||||
; This file is part of DOS-C.
|
||||
;
|
||||
; DOS-C is free software; you can redistribute it and/or
|
||||
; modify it under the terms of the GNU General Public License
|
||||
; as published by the Free Software Foundation; either version
|
||||
; 2, or (at your option) any later version.
|
||||
;
|
||||
; DOS-C is distributed in the hope that it will be useful, but
|
||||
; WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
|
||||
; the GNU General Public License for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public
|
||||
; License along with DOS-C; see the file COPYING. If not,
|
||||
; write to the Free Software Foundation, 675 Mass Ave,
|
||||
; Cambridge, MA 02139, USA.
|
||||
;
|
||||
; $Id$
|
||||
;
|
||||
;
|
||||
|
||||
%include "segs.inc"
|
||||
|
||||
|
||||
segment _TEXT
|
||||
|
||||
;
|
||||
; cdecl calling conventions
|
||||
;
|
||||
; ULONG FAR MULULUS(ULONG mul1, USHORT mul2) - MULtiply ULong by UShort
|
||||
;
|
||||
%IFNDEF I386
|
||||
P8086
|
||||
%ELSE
|
||||
P386 ; Turn on 386 instructions.
|
||||
%ENDIF ; I386
|
||||
|
||||
|
||||
global _MULULUS
|
||||
_MULULUS:
|
||||
|
||||
push bp
|
||||
mov bp,sp
|
||||
mov bx,[bp+6+4] ; short mul2
|
||||
mov ax,[bp+6+2] ; high part of mul1
|
||||
mul bx
|
||||
mov cx,ax
|
||||
mov ax,[bp+6+0] ; low part of mul1
|
||||
mul bx
|
||||
add dx,cx ; add in high part of result
|
||||
|
||||
pop bp
|
||||
retf
|
||||
|
|
@ -28,10 +28,10 @@
|
|||
;
|
||||
|
||||
group PGROUP PSP
|
||||
group TGROUP _TEXT _IO_TEXT _IO_FIXED_DATA
|
||||
group DGROUP _FIXED_DATA _DATA _BSSSTART _BSS _BSSEND DYN_DATA DCONST
|
||||
group HGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END
|
||||
group IGROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END ID_B ID ID_E IB_B IB IB_E IC IDATA
|
||||
group TGROUP _TEXT _IO_TEXT _IO_FIXED_DATA
|
||||
group DGROUP _FIXED_DATA _DATA _BSSSTART _BSS _BSSEND DYN_DATA DCONST
|
||||
group I_GROUP INIT_TEXT_START INIT_TEXT INIT_TEXT_END ID_B ID ID_E IC IDATA ICONST ICONST2 I_DATA I_BSS IB_B IB IB_E
|
||||
group HGROUP HMA_TEXT_START HMA_TEXT HMA_TEXT_END
|
||||
|
||||
segment PSP class=PSP
|
||||
segment _TEXT class=CODE
|
||||
|
@ -44,21 +44,28 @@ segment _BSS class=BSS align=2
|
|||
segment _BSSEND class=BSS
|
||||
;for MSC
|
||||
segment DCONST class=DCONST align=2
|
||||
segment DYN_DATA class=DYN_DATA
|
||||
segment DYN_DATA class=DYN_DATA
|
||||
segment HMA_TEXT_START class=HMA align=16
|
||||
segment HMA_TEXT class=HMA
|
||||
segment HMA_TEXT_END class=HMA
|
||||
segment INIT_TEXT_START class=INIT align=16
|
||||
segment HMA_TEXT_END class=HMA
|
||||
segment INIT_TEXT_START class=INIT align=16
|
||||
segment INIT_TEXT class=INIT
|
||||
segment INIT_TEXT_END class=INIT
|
||||
segment INIT_TEXT_END class=INIT
|
||||
segment ID_B class=ID align=2
|
||||
segment ID class=ID align=2
|
||||
segment ID_E class=ID align=2
|
||||
segment IDATA class=ID align=2
|
||||
segment IC class=IC align=2
|
||||
|
||||
;for Watcom
|
||||
segment ICONST class=FAR_DATA align=2
|
||||
segment ICONST2 class=FAR_DATA align=2
|
||||
segment I_DATA class=FAR_DATA align=2
|
||||
segment I_BSS class=FAR_DATA align=2
|
||||
|
||||
segment IB_B class=IB align=2
|
||||
segment IB class=IB align=2
|
||||
segment IB_E class=IB align=2
|
||||
segment IC class=IC align=2
|
||||
|
||||
; Log: segs.inc,v
|
||||
;
|
||||
|
|
|
@ -35,7 +35,6 @@ static BYTE *RcsId =
|
|||
#endif
|
||||
|
||||
#ifdef PROTO
|
||||
BOOL ASMCFUNC ReadPCClock(ULONG *);
|
||||
VOID ASMCFUNC WriteATClock(BYTE *, BYTE, BYTE, BYTE);
|
||||
VOID ASMCFUNC WritePCClock(ULONG);
|
||||
COUNT BcdToByte(COUNT);
|
||||
|
@ -43,7 +42,6 @@ COUNT BcdToWord(BYTE *, UWORD *, UWORD *, UWORD *);
|
|||
COUNT ByteToBcd(COUNT);
|
||||
VOID DayToBcd(BYTE *, UWORD *, UWORD *, UWORD *);
|
||||
#else
|
||||
BOOL ReadPCClock();
|
||||
VOID WriteATClock();
|
||||
VOID WritePCClock();
|
||||
COUNT BcdToByte();
|
||||
|
@ -71,16 +69,16 @@ static BYTE bcdSeconds;
|
|||
|
||||
static ULONG Ticks;
|
||||
*/
|
||||
UWORD DaysSinceEpoch = 0;
|
||||
UWORD ASM DaysSinceEpoch = 0;
|
||||
|
||||
BOOL ASMCFUNC ReadATClock(BYTE *, BYTE *, BYTE *, BYTE *);
|
||||
|
||||
static COUNT BcdToByte(COUNT x)
|
||||
STATIC COUNT BcdToByte(COUNT x)
|
||||
{
|
||||
return ((((x) >> 4) & 0xf) * 10 + ((x) & 0xf));
|
||||
}
|
||||
|
||||
WORD FAR ASMCFUNC clk_driver(rqptr rp)
|
||||
WORD ASMCFUNC FAR clk_driver(rqptr rp)
|
||||
{
|
||||
COUNT c;
|
||||
UWORD *pdays;
|
||||
|
@ -120,8 +118,7 @@ WORD FAR ASMCFUNC clk_driver(rqptr rp)
|
|||
case C_INPUT:
|
||||
{
|
||||
ULONG remainder, hs;
|
||||
if (ReadPCClock(&Ticks))
|
||||
++DaysSinceEpoch;
|
||||
ReadPCClock(&Ticks);
|
||||
clk.clkDays = DaysSinceEpoch;
|
||||
/*
|
||||
* Another tricky calculation (after the one in `main.c'). This time
|
||||
|
|
|
@ -41,7 +41,7 @@ UWORD days[2][13] = {
|
|||
{0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366}
|
||||
};
|
||||
|
||||
extern request ClkReqHdr;
|
||||
extern request ASM ClkReqHdr;
|
||||
|
||||
/*
|
||||
return a pointer to an array with the days for that year
|
||||
|
|
|
@ -185,7 +185,7 @@ VOID new_psp(psp FAR * p, int psize)
|
|||
|
||||
/* CP/M-like entry point - jump to special entry */
|
||||
p->ps_farcall = 0xea;
|
||||
p->ps_reentry = (VOID(FAR *) ())cpm_entry;
|
||||
p->ps_reentry = cpm_entry;
|
||||
/* unix style call - 0xcd 0x21 0xcb (int 21, retf) */
|
||||
p->ps_unix[0] = 0xcd;
|
||||
p->ps_unix[1] = 0x21;
|
||||
|
@ -206,11 +206,11 @@ VOID new_psp(psp FAR * p, int psize)
|
|||
p->ps_dta = (BYTE FAR *) (&p->ps_cmd_count);
|
||||
|
||||
/* terminate address */
|
||||
p->ps_isv22 = (VOID(INRPT FAR *) (void))getvec(0x22);
|
||||
p->ps_isv22 = getvec(0x22);
|
||||
/* break address */
|
||||
p->ps_isv23 = (VOID(INRPT FAR *) (void))getvec(0x23);
|
||||
p->ps_isv23 = getvec(0x23);
|
||||
/* critical error address */
|
||||
p->ps_isv24 = (VOID(INRPT FAR *) (void))getvec(0x24);
|
||||
p->ps_isv24 = getvec(0x24);
|
||||
|
||||
/* File System parameters */
|
||||
/* user stack pointer - int 21 */
|
||||
|
@ -394,6 +394,9 @@ COUNT DosComLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
|||
DosUmbLink(UMBstate); /* restore link state */
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("DosComLoader. Loading '%S' at %04x\n", namep, mem);
|
||||
#endif
|
||||
/* Now load the executable */
|
||||
/* If file not found - error */
|
||||
/* NOTE - this is fatal because we lost it in transit */
|
||||
|
@ -435,7 +438,7 @@ COUNT DosComLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
|||
|
||||
/* point to the PSP so we can build it */
|
||||
p = MK_FP(mem, 0);
|
||||
setvec(0x22, (VOID(INRPT FAR *) (VOID)) MK_FP(user_r->CS, user_r->IP));
|
||||
setvec(0x22, MK_FP(user_r->CS, user_r->IP));
|
||||
new_psp(p, mem + asize);
|
||||
|
||||
asize = patchPSP(mem - 1, env, exp, namep); /* asize=fcbcode for ax */
|
||||
|
@ -667,7 +670,7 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
|||
asize = exe_size;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("loading '%S' at %04x\n", namep, mem);
|
||||
printf("DosExeLoader. Loading '%S' at %04x\n", namep, mem);
|
||||
#endif
|
||||
|
||||
/* /// Added open curly brace and "else" clause. We should not attempt
|
||||
|
@ -801,7 +804,7 @@ COUNT DosExeLoader(BYTE FAR * namep, exec_blk FAR * exp, COUNT mode)
|
|||
|
||||
/* point to the PSP so we can build it */
|
||||
p = MK_FP(mem, 0);
|
||||
setvec(0x22, (VOID(INRPT FAR *) (VOID)) MK_FP(user_r->CS, user_r->IP));
|
||||
setvec(0x22, MK_FP(user_r->CS, user_r->IP));
|
||||
new_psp(p, mem + asize);
|
||||
|
||||
asize = patchPSP(mem - 1, env, exp, namep); /* asize = fcbcode */
|
||||
|
|
|
@ -47,6 +47,5 @@ MATH_INSERT=+H_LDIV +H_LLSH +H_LURSH +N_LXMUL +F_LXMUL +H_LRSH
|
|||
# ALLCFLAGS specified by turbo.cfg and config.mak
|
||||
#
|
||||
ALLCFLAGS=$(TARGETOPT) $(ALLCFLAGS)
|
||||
INITCFLAGS=$(ALLCFLAGS) -zAINIT -zCINIT_TEXT -zDIB -zRID -zTID -zPIGROUP -zBIB -zGIGROUP -zSIGROUP
|
||||
INITCFLAGS=$(ALLCFLAGS) -zAINIT -zCINIT_TEXT -zDIB -zRID -zTID -zPI_GROUP -zBIB -zGI_GROUP -zSI_GROUP
|
||||
CFLAGS=$(ALLCFLAGS) -zAHMA -zCHMA_TEXT
|
||||
DYNCFLAGS=$(ALLCFLAGS) -zRDYN_DATA -zTDYN_DATA -zDDYN_DATA -zBDYN_DATA
|
||||
|
|
|
@ -27,10 +27,8 @@ NASMFLAGS = $(NASMFLAGS) -i../hdr/
|
|||
|
||||
LINK=$(XLINK)
|
||||
|
||||
PATCHOBJ=@rem
|
||||
INITPATCH = CODE=INIT _DATA=IDATA DATA=ID BSS=ID DGROUP=IGROUP CONST=IC
|
||||
STDPATCH = CODE=HMA CONST=DCONST
|
||||
DYNPATCH = _DATA=DYN_DATA DATA=DYN_DATA CODE=HMA CONST=DCONST
|
||||
STDPATCH=@rem
|
||||
INITPATCH=@rem
|
||||
|
||||
!include "..\mkfiles\$(COMPILER).mak"
|
||||
|
||||
|
@ -38,7 +36,7 @@ THETARGET=$(TARGET)$(XCPU)$(XFAT)
|
|||
RM=..\utils\rmfiles
|
||||
|
||||
.asm.obj :
|
||||
$(NASM) $(NASMFLAGS) -f obj $*.asm
|
||||
$(NASM) -D$(COMPILER) $(NASMFLAGS) -f obj $*.asm
|
||||
|
||||
# *Implicit Rules*
|
||||
.c.obj :
|
||||
|
|
|
@ -7,8 +7,8 @@ COMPILERPATH=$(MS_BASE)
|
|||
COMPILERBIN=$(COMPILERPATH)\bin
|
||||
INCLUDEPATH=$(COMPILERPATH)\include
|
||||
CC=$(COMPILERBIN)\cl
|
||||
CFLAGST=/Fm /AT /Os
|
||||
CFLAGSC=/Fm /AL /Os
|
||||
CFLAGST=/Fm /AT /Os /Zp1
|
||||
CFLAGSC=/Fm /AL /Os /Zp1
|
||||
LIBPATH=$(COMPILERPATH)\lib
|
||||
LIB=$(COMPILERPATH)\lib
|
||||
INCLUDE=$(COMPILERPATH)\include
|
||||
|
@ -38,9 +38,9 @@ TARGET=KMS
|
|||
# heavy stuff - building
|
||||
|
||||
|
||||
ALLCFLAGS=-I..\hdr $(TARGETOPT) $(ALLCFLAGS) -nologo -Zl -Fc -Zp1 -WX -Gr -f- -Os -Gs -Ob1 -OV4 -Gy -Oe
|
||||
ALLCFLAGS=-I..\hdr $(TARGETOPT) $(ALLCFLAGS) -nologo -Zl -Fc -WX -Gr -f- -Os -Gs -Ob1 -OV4 -Gy -Oe -Zp1
|
||||
|
||||
INITCFLAGS=$(ALLCFLAGS) -NTINIT_TEXT -AT
|
||||
CFLAGS=$(ALLCFLAGS) -NTHMA_TEXT
|
||||
DYNCFLAGS=$(ALLCFLAGS) -NTHMA_TEXT
|
||||
PATCHOBJ=patchobj
|
||||
INITPATCH = ..\utils\patchobj CODE=INIT _DATA=IDATA DATA=ID BSS=ID DGROUP=I_GROUP CONST=IC
|
||||
STDPATCH = ..\utils\patchobj CODE=HMA CONST=DCONST
|
||||
|
|
|
@ -47,6 +47,5 @@ MATH_INSERT=+LDIV +LXMUL +LURSH +LLSH +LRSH
|
|||
# ALLCFLAGS specified by turbo.cfg and config.mak
|
||||
#
|
||||
ALLCFLAGS=$(TARGETOPT) $(ALLCFLAGS)
|
||||
INITCFLAGS=$(ALLCFLAGS) -zAINIT -zCINIT_TEXT -zDIB -zRID -zTID -zPIGROUP -zBIB -zGIGROUP -zSIGROUP
|
||||
INITCFLAGS=$(ALLCFLAGS) -zAINIT -zCINIT_TEXT -zDIB -zRID -zTID -zPI_GROUP -zBIB -zGI_GROUP -zSI_GROUP
|
||||
CFLAGS=$(ALLCFLAGS) -zAHMA -zCHMA_TEXT
|
||||
DYNCFLAGS=$(ALLCFLAGS) -zRDYN_DATA -zTDYN_DATA -zDDYN_DATA -zBDYN_DATA
|
||||
|
|
|
@ -47,6 +47,5 @@ MATH_INSERT=+H_LDIV +H_LLSH +H_LURSH +N_LXMUL +F_LXMUL +H_LRSH
|
|||
# ALLCFLAGS specified by turbo.cfg and config.mak
|
||||
#
|
||||
ALLCFLAGS=$(TARGETOPT) $(ALLCFLAGS)
|
||||
INITCFLAGS=$(ALLCFLAGS) -zAINIT -zCINIT_TEXT -zDIB -zRID -zTID -zPIGROUP -zBIB -zGIGROUP -zSIGROUP
|
||||
INITCFLAGS=$(ALLCFLAGS) -zAINIT -zCINIT_TEXT -zDIB -zRID -zTID -zPI_GROUP -zBIB -zGI_GROUP -zSI_GROUP
|
||||
CFLAGS=$(ALLCFLAGS) -zAHMA -zCHMA_TEXT
|
||||
DYNCFLAGS=$(ALLCFLAGS) -zRDYN_DATA -zTDYN_DATA -zDDYN_DATA -zBDYN_DATA
|
||||
|
|
|
@ -47,6 +47,5 @@ MATH_INSERT=+H_LDIV +F_LXMUL +H_LURSH +H_LLSH +H_LRSH
|
|||
# ALLCFLAGS specified by turbo.cfg and config.mak
|
||||
#
|
||||
ALLCFLAGS=$(TARGETOPT) $(ALLCFLAGS)
|
||||
INITCFLAGS=$(ALLCFLAGS) -zAINIT -zCINIT_TEXT -zDIB -zRID -zTID -zPIGROUP -zBIB -zGIGROUP -zSIGROUP
|
||||
INITCFLAGS=$(ALLCFLAGS) -zAINIT -zCINIT_TEXT -zDIB -zRID -zTID -zPI_GROUP -zBIB -zGI_GROUP -zSI_GROUP
|
||||
CFLAGS=$(ALLCFLAGS) -zAHMA -zCHMA_TEXT
|
||||
DYNCFLAGS=$(ALLCFLAGS) -zRDYN_DATA -zTDYN_DATA -zDDYN_DATA -zBDYN_DATA
|
||||
|
|
|
@ -28,7 +28,7 @@ TARGET=KWC
|
|||
|
||||
# used for building the library
|
||||
|
||||
CLIB=$(COMPILERPATH)\lib286\dos\clibs.lib
|
||||
CLIB=$(COMPILERPATH)\lib286\dos\clibm.lib
|
||||
|
||||
#
|
||||
#MATH_EXTRACT=*i4d *i4m
|
||||
|
@ -37,11 +37,9 @@ CLIB=$(COMPILERPATH)\lib286\dos\clibs.lib
|
|||
# these are NOT usable, as they are called NEAR, and are in TEXT segment.
|
||||
# so we can't use them, when moving the kernel. called ~15 times
|
||||
#
|
||||
# so I include 1 dummy library routine (stridup()), to make lib happy
|
||||
# we use our own ones, which override these ones when linking.
|
||||
#
|
||||
|
||||
MATH_EXTRACT=*_icstrdu
|
||||
MATH_INSERT= +_icstrdu
|
||||
MATH_EXTRACT=*i4d *i4m
|
||||
MATH_INSERT= +i4d +i4m
|
||||
|
||||
|
@ -69,8 +67,8 @@ MATH_INSERT= +i4d +i4m
|
|||
# -3 optimization for 386 - given in CONFIG.MAK, not here
|
||||
#
|
||||
|
||||
ALLCFLAGS=-I..\hdr $(TARGETOPT) $(ALLCFLAGS) -zq -os -ms -s -e=5 -j -zl -zp=1 -we
|
||||
INITCFLAGS=$(ALLCFLAGS) -nt=INIT_TEXT -nc=INIT -g=IGROUP
|
||||
ALLCFLAGS=-I..\hdr $(TARGETOPT) $(ALLCFLAGS) -zq -os -s -e=5 -j -zl -zp=1 -we
|
||||
INITCFLAGS=$(ALLCFLAGS) -nt=INIT_TEXT -nc=INIT -nd=I -g=I_GROUP
|
||||
CFLAGS=$(ALLCFLAGS) -nt=HMA_TEXT -nc=HMA -g=HGROUP
|
||||
DYNCFLAGS=$(ALLCFLAGS)
|
||||
INITPATCH=..\utils\patchobj __U4D=_IU4D __U4M=_IU4M
|
||||
|
||||
|
|
17
sys/sys.c
17
sys/sys.c
|
@ -38,7 +38,7 @@
|
|||
|
||||
#define SYS_VERSION "v2.3"
|
||||
|
||||
#include <stdio.h>
|
||||
/* #include <stdio.h> */
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
|
@ -51,9 +51,10 @@
|
|||
#include <memory.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
/*#include <dir.h> */
|
||||
#define MAXPATH 260
|
||||
#include <dir.h>
|
||||
#define SYS_MAXPATH 260
|
||||
#include "portab.h"
|
||||
extern WORD CDECL printf(CONST BYTE * fmt, ...);
|
||||
|
||||
#include "b_fat12.h"
|
||||
#include "b_fat16.h"
|
||||
|
@ -70,7 +71,7 @@ COUNT DiskRead(WORD, WORD, WORD, WORD, WORD, BYTE FAR *);
|
|||
COUNT DiskWrite(WORD, WORD, WORD, WORD, WORD, BYTE FAR *);
|
||||
|
||||
#define SEC_SIZE 512
|
||||
#define COPY_SIZE 32768u
|
||||
#define COPY_SIZE 24576u
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(1)
|
||||
|
@ -159,7 +160,7 @@ int main(int argc, char **argv)
|
|||
COUNT drivearg = 0; /* drive argument position */
|
||||
BYTE *bsFile = NULL; /* user specified destination boot sector */
|
||||
COUNT srcDrive; /* source drive */
|
||||
BYTE srcPath[MAXPATH]; /* user specified source drive and/or path */
|
||||
BYTE srcPath[SYS_MAXPATH]; /* user specified source drive and/or path */
|
||||
BYTE rootPath[4]; /* alternate source path to try if not '\0' */
|
||||
WORD slen;
|
||||
|
||||
|
@ -177,9 +178,9 @@ int main(int argc, char **argv)
|
|||
if (argc > 2 && argv[2][1] == ':' && argv[2][2] == '\0')
|
||||
{
|
||||
drivearg = 2;
|
||||
strncpy(srcPath, argv[1], MAXPATH - 12);
|
||||
strncpy(srcPath, argv[1], SYS_MAXPATH - 12);
|
||||
/* leave room for COMMAND.COM\0 */
|
||||
srcPath[MAXPATH - 13] = '\0';
|
||||
srcPath[SYS_MAXPATH - 13] = '\0';
|
||||
/* make sure srcPath + "file" is a valid path */
|
||||
slen = strlen(srcPath);
|
||||
if ((srcPath[slen - 1] != ':') &&
|
||||
|
@ -597,7 +598,7 @@ BYTE copybuffer[COPY_SIZE];
|
|||
|
||||
BOOL copy(COUNT drive, BYTE * srcPath, BYTE * rootPath, BYTE * file)
|
||||
{
|
||||
BYTE dest[MAXPATH], source[MAXPATH];
|
||||
BYTE dest[SYS_MAXPATH], source[SYS_MAXPATH];
|
||||
COUNT ifd, ofd;
|
||||
unsigned ret;
|
||||
int fdin, fdout;
|
||||
|
|
102
utils/exeflat.c
102
utils/exeflat.c
|
@ -34,6 +34,16 @@ large portions copied from task.c
|
|||
|
||||
*/
|
||||
|
||||
/* history
|
||||
|
||||
10/??/01 - Bart Oldeman
|
||||
primary release
|
||||
|
||||
11/28/01 - tom ehlert
|
||||
added -UPX option to make the kernel compressable with UPX
|
||||
|
||||
*/
|
||||
|
||||
#include "portab.h"
|
||||
#include "exe.h"
|
||||
#include <stdio.h>
|
||||
|
@ -68,7 +78,7 @@ void usage()
|
|||
printf("usage: exeflat (src.exe) (dest.sys) (relocation-factor)\n");
|
||||
printf
|
||||
(" -S10 - Silent relocate segment 10 (down list)\n");
|
||||
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -84,19 +94,23 @@ int main(int argc, char **argv)
|
|||
UBYTE **curbuf;
|
||||
FILE *src, *dest;
|
||||
short silentSegments[20], silentcount = 0, silentdone = 0;
|
||||
int UPX = FALSE;
|
||||
|
||||
/* do optional argument processing here */
|
||||
for (i = 4; i < argc; i++)
|
||||
{
|
||||
char *argptr = argv[i];
|
||||
|
||||
|
||||
if (argptr[0] != '-' && argptr[0] != '/')
|
||||
usage();
|
||||
|
||||
|
||||
argptr++;
|
||||
|
||||
switch (toupper(argptr[0]))
|
||||
{
|
||||
case 'U':
|
||||
UPX = TRUE;
|
||||
break;
|
||||
case 'S':
|
||||
if (silentcount >= LENGTH(silentSegments))
|
||||
{
|
||||
|
@ -104,10 +118,10 @@ int main(int argc, char **argv)
|
|||
LENGTH(silentSegments));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
silentSegments[silentcount++] = strtol(argptr + 1, NULL, 0);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
|
@ -115,7 +129,7 @@ int main(int argc, char **argv)
|
|||
|
||||
/* arguments left :
|
||||
infile outfile relocation offset */
|
||||
|
||||
|
||||
if ((src = fopen(argv[1], "rb")) == NULL)
|
||||
{
|
||||
printf("Source file %s could not be opened\n", argv[1]);
|
||||
|
@ -195,23 +209,56 @@ int main(int argc, char **argv)
|
|||
UBYTE *spot0 = &buffers[spot / BUFSIZE][spot % BUFSIZE];
|
||||
UBYTE *spot1 = &buffers[(spot + 1) / BUFSIZE][(spot + 1) % BUFSIZE];
|
||||
UWORD segment = ((UWORD) * spot1 << 8) + *spot0;
|
||||
|
||||
|
||||
for (j = 0; j < silentcount; j++)
|
||||
if (segment == silentSegments[j])
|
||||
{
|
||||
silentdone++;
|
||||
goto dontPrint;
|
||||
}
|
||||
|
||||
|
||||
printf("relocation at 0x%04x:0x%04x ->%04x\n", reloc[i].seg,
|
||||
reloc[i].off, segment);
|
||||
|
||||
|
||||
dontPrint:
|
||||
|
||||
|
||||
segment += start_seg;
|
||||
*spot0 = segment & 0xff;
|
||||
*spot1 = segment >> 8;
|
||||
}
|
||||
|
||||
if (UPX)
|
||||
{
|
||||
/* UPX HEADER jump $+2+size */
|
||||
static char JumpBehindCode[] = {
|
||||
/* kernel config header - 32 bytes */
|
||||
0xeb, 0x1b, /* jmp short realentry */
|
||||
'C', 'O', 'N', 'F', 'I', 'G', 32 - 2 - 6 - 2 - 3, 0, /* WORD */
|
||||
0, /* DLASortByDriveNo db 0 */
|
||||
1, /* InitDiskShowDriveAssignment db 1 */
|
||||
2, /* SkipConfigSeconds db 2 */
|
||||
0, /* ForceLBA db 0 */
|
||||
1, /* GlobalEnableLBAsupport db 1 */
|
||||
'u', 'n', 'u', 's', 'e', 'd', /* unused filler bytes */
|
||||
8, 7, 6, 5, 4, 3, 2, 1,
|
||||
/* real-entry: jump over the 'real' image do the trailer */
|
||||
0xe9, 0, 0 /* 100: jmp 103 */
|
||||
};
|
||||
|
||||
struct x {
|
||||
char y[sizeof(JumpBehindCode) == 0x20 ? 1 : -1];
|
||||
};
|
||||
|
||||
if (size >= 0xfe00u)
|
||||
{
|
||||
printf("kernel; size too large - must be <= 0xfe00\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* this assumes <= 0xfe00 code in kernel */
|
||||
*(short *)&JumpBehindCode[0x1e] += size;
|
||||
fwrite(JumpBehindCode, 1, 0x20, dest);
|
||||
}
|
||||
|
||||
/* write dest file from memory chunks */
|
||||
bufsize = BUFSIZE;
|
||||
|
@ -227,9 +274,38 @@ int main(int argc, char **argv)
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (UPX)
|
||||
{
|
||||
/* UPX trailer */
|
||||
/* hand assembled - so this reamins ANSI C ;-) */
|
||||
static char trailer[] = { /* shift down everything by sizeof JumpBehindCode */
|
||||
0xE8, 0x00, 0x00, /* call 103 */
|
||||
0x59, /* pop cx */
|
||||
0x0E, /* push cs */
|
||||
0x1F, /* pop ds */
|
||||
0x8c, 0xc8, /* mov ax,cs */
|
||||
0x48, /* dec ax */
|
||||
0x48, /* dec ax */
|
||||
0x8e, 0xc0, /* mov es,ax */
|
||||
0x31, 0xFF, /* xor di,di */
|
||||
0xBE, 0x00, 0x00, /* mov si,0x00 */
|
||||
0xFC, /* cld */
|
||||
0xF3, 0xA4, /* rep movsb */
|
||||
0x26, 0x88, 0x1e, 0x00, 0x00, /* mov es:[0],bl */
|
||||
0xB8, 0x00, 0x00, /* mov ax,0000h */
|
||||
0x8E, 0xD0, /* mov ss,ax */
|
||||
0xBC, 0x00, 0x00, /* mov sp,0000h */
|
||||
0x31, 0xC0, /* xor ax,ax */
|
||||
0x50, /* push ax */
|
||||
0xC3 /* ret */
|
||||
};
|
||||
*(short *)&trailer[26] = start_seg + header.exInitSS;
|
||||
*(short *)&trailer[31] = header.exInitSP;
|
||||
fwrite(trailer, 1, sizeof(trailer), dest);
|
||||
}
|
||||
fclose(dest);
|
||||
printf("\nProcessed %d relocations, %d not shown\n", header.exRelocItems,
|
||||
silentdone);
|
||||
printf("\nProcessed %d relocations, %d not shown\n",
|
||||
header.exRelocItems, silentdone);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ exeflat.exe: exeflat.c ..\hdr\exe.h
|
|||
|
||||
|
||||
clobber: clean
|
||||
$(RM) bin2c.com exeflat.exe patchobj.exe
|
||||
$(RM) bin2c.com exeflat.exe patchobj.exe patchobj.com
|
||||
|
||||
clean:
|
||||
$(RM) *.obj *.bak *.crf *.xrf *.map *.lst *.las *.cod *.err status.me
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE (1==1)
|
||||
|
@ -26,6 +27,8 @@ struct {
|
|||
} repl[100];
|
||||
int repl_count;
|
||||
|
||||
void go_records(FILE * fdin, FILE * fdo);
|
||||
|
||||
void quit(char *s, ...)
|
||||
{
|
||||
vprintf(s, (void *)((char *)&s + sizeof(s)));
|
||||
|
@ -54,7 +57,6 @@ int main(int argc, char *argv[])
|
|||
char *argptr;
|
||||
int argloop;
|
||||
int cont;
|
||||
int file = 0;
|
||||
FILE *fd, *fdo;
|
||||
char *inname = 0, *outname = "~patchob.tmp";
|
||||
|
||||
|
@ -66,9 +68,9 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
argptr = *argv;
|
||||
|
||||
if (*argptr != '-' && *argptr != '-')
|
||||
if (*argptr != '-' && *argptr != '/')
|
||||
{
|
||||
if (inname == 0)
|
||||
if (argc == 1)
|
||||
{
|
||||
inname = argptr;
|
||||
continue;
|
||||
|
@ -114,21 +116,15 @@ int main(int argc, char *argv[])
|
|||
|
||||
}
|
||||
|
||||
usage()
|
||||
{
|
||||
fputs("DELSYM V1.0 5'95by tom ehlert, SIG Aachen\n"
|
||||
" delete symbolic info in object files\n"
|
||||
"usage:\n" " DELSYM infile [outfile]\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
struct record {
|
||||
unsigned char rectyp;
|
||||
unsigned datalen;
|
||||
unsigned char buffer[0x2000];
|
||||
} Record, Outrecord;
|
||||
|
||||
go_records(FILE * fdin, FILE * fdo)
|
||||
struct verify_pack1 { char x[ sizeof(struct record) == 0x2003 ? 1 : -1];};
|
||||
|
||||
void go_records(FILE * fdin, FILE * fdo)
|
||||
{
|
||||
unsigned char stringlen;
|
||||
unsigned char *string, *s;
|
||||
|
@ -151,13 +147,15 @@ go_records(FILE * fdin, FILE * fdo)
|
|||
quit("can't continue\n");
|
||||
}
|
||||
|
||||
if (Record.rectyp != 0x96) /* we are only interested in LNAMES */
|
||||
if (Record.rectyp != 0x96 && Record.rectyp != 0x8c) /* we are only interested in LNAMES */
|
||||
{
|
||||
fwrite(&Record, 1, 3 + Record.datalen, fdo);
|
||||
continue;
|
||||
}
|
||||
|
||||
Outrecord.rectyp = 0x96;
|
||||
/* printf("at %lx - record type %x len %x\n",ftell(fdin)-3,Record.rectyp,
|
||||
Record.datalen);*/
|
||||
Outrecord.rectyp = Record.rectyp;
|
||||
Outrecord.datalen = 0;
|
||||
|
||||
for (i = 0; i < Record.datalen - 1;)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
:loop_commandline
|
||||
|
||||
if \%1 == \ goto done_with_commandline
|
||||
del %1
|
||||
if exist %1 del %1
|
||||
shift
|
||||
goto loop_commandline
|
||||
|
||||
|
|
Loading…
Reference in New Issue