mirror of https://github.com/FDOS/kernel.git
Eliminate intr() from resident code. Saves ~200 bytes of HMA resident code.
Also made the nls.c functions SS!=DS safe. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@802 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
aeec36ea4b
commit
28be8284a8
138
kernel/dosfns.c
138
kernel/dosfns.c
|
@ -45,14 +45,16 @@ BYTE share_installed = 0;
|
||||||
error. If < 0 is returned, it is the negated error return
|
error. If < 0 is returned, it is the negated error return
|
||||||
code, so DOS simply negates this value and returns it in
|
code, so DOS simply negates this value and returns it in
|
||||||
AX. */
|
AX. */
|
||||||
STATIC int share_open_check(char * filename, /* pointer to fully qualified filename */
|
extern int ASMPASCAL
|
||||||
|
share_open_check(char * filename, /* pointer to fully qualified filename */
|
||||||
unsigned short pspseg, /* psp segment address of owner process */
|
unsigned short pspseg, /* psp segment address of owner process */
|
||||||
int openmode, /* 0=read-only, 1=write-only, 2=read-write */
|
int openmode, /* 0=read-only, 1=write-only, 2=read-write */
|
||||||
int sharemode); /* SHARE_COMPAT, etc... */
|
int sharemode); /* SHARE_COMPAT, etc... */
|
||||||
|
|
||||||
/* DOS calls this to record the fact that it has successfully
|
/* DOS calls this to record the fact that it has successfully
|
||||||
closed a file, or the fact that the open for this file failed. */
|
closed a file, or the fact that the open for this file failed. */
|
||||||
STATIC void share_close_file(int fileno); /* file_table entry number */
|
extern void ASMPASCAL
|
||||||
|
share_close_file(int fileno); /* file_table entry number */
|
||||||
|
|
||||||
/* DOS calls this to determine whether it can access (read or
|
/* DOS calls this to determine whether it can access (read or
|
||||||
write) a specific section of a file. We call it internally
|
write) a specific section of a file. We call it internally
|
||||||
|
@ -65,7 +67,8 @@ STATIC void share_close_file(int fileno); /* file_table entry number */
|
||||||
generates a critical error (if allowcriter is non-zero).
|
generates a critical error (if allowcriter is non-zero).
|
||||||
If non-zero is returned, it is the negated return value for
|
If non-zero is returned, it is the negated return value for
|
||||||
the DOS call. */
|
the DOS call. */
|
||||||
STATIC int share_access_check(unsigned short pspseg, /* psp segment address of owner process */
|
extern int ASMPASCAL
|
||||||
|
share_access_check(unsigned short pspseg, /* psp segment address of owner process */
|
||||||
int fileno, /* file_table entry number */
|
int fileno, /* file_table entry number */
|
||||||
unsigned long ofs, /* offset into file */
|
unsigned long ofs, /* offset into file */
|
||||||
unsigned long len, /* length (in bytes) of region to access */
|
unsigned long len, /* length (in bytes) of region to access */
|
||||||
|
@ -76,18 +79,20 @@ STATIC int share_access_check(unsigned short pspseg, /* psp segment address o
|
||||||
returns non-zero.
|
returns non-zero.
|
||||||
If the return value is non-zero, it is the negated error
|
If the return value is non-zero, it is the negated error
|
||||||
return code for the DOS 0x5c call. */
|
return code for the DOS 0x5c call. */
|
||||||
STATIC int share_lock_unlock(unsigned short pspseg, /* psp segment address of owner process */
|
extern int ASMPASCAL
|
||||||
|
share_lock_unlock(unsigned short pspseg, /* psp segment address of owner process */
|
||||||
int fileno, /* file_table entry number */
|
int fileno, /* file_table entry number */
|
||||||
unsigned long ofs, /* offset into file */
|
unsigned long ofs, /* offset into file */
|
||||||
unsigned long len, /* length (in bytes) of region to lock or unlock */
|
unsigned long len, /* length (in bytes) of region to lock or unlock */
|
||||||
int unlock); /* non-zero to unlock; zero to lock */
|
int unlock); /* one to unlock; zero to lock */
|
||||||
|
|
||||||
/* /// End of additions for SHARE. - Ron Cemer */
|
/* /// End of additions for SHARE. - Ron Cemer */
|
||||||
|
|
||||||
STATIC int remote_lock_unlock(sft FAR *sftp, /* SFT for file */
|
extern int ASMCFUNC
|
||||||
|
remote_lock_unlock(sft FAR *sftp, /* SFT for file */
|
||||||
unsigned long ofs, /* offset into file */
|
unsigned long ofs, /* offset into file */
|
||||||
unsigned long len, /* length (in bytes) of region to lock or unlock */
|
unsigned long len, /* length (in bytes) of region to lock or unlock */
|
||||||
int unlock); /* non-zero to unlock; zero to lock */
|
int unlock); /* one to unlock; zero to lock */
|
||||||
|
|
||||||
/* get current directory structure for drive
|
/* get current directory structure for drive
|
||||||
return NULL if the CDS is not valid or the
|
return NULL if the CDS is not valid or the
|
||||||
|
@ -1437,126 +1442,13 @@ struct dhdr FAR *IsDevice(const char FAR * fname)
|
||||||
|
|
||||||
BOOL IsShareInstalled(void)
|
BOOL IsShareInstalled(void)
|
||||||
{
|
{
|
||||||
if (!share_installed)
|
extern unsigned char ASMPASCAL share_check(void);
|
||||||
{
|
if (!share_installed && share_check() == 0xff)
|
||||||
iregs regs;
|
share_installed = TRUE;
|
||||||
|
|
||||||
regs.a.x = 0x1000;
|
|
||||||
intr(0x2f, ®s);
|
|
||||||
share_installed = ((regs.a.x & 0xff) == 0xff);
|
|
||||||
}
|
|
||||||
return share_installed;
|
return share_installed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DOS calls this to see if it's okay to open the file.
|
|
||||||
Returns a file_table entry number to use (>= 0) if okay
|
|
||||||
to open. Otherwise returns < 0 and may generate a critical
|
|
||||||
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 * filename, /* 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... */
|
|
||||||
iregs regs;
|
|
||||||
|
|
||||||
regs.a.x = 0x10a0;
|
|
||||||
regs.ds = FP_SEG(filename);
|
|
||||||
regs.si = FP_OFF(filename);
|
|
||||||
regs.b.x = pspseg;
|
|
||||||
regs.c.x = openmode;
|
|
||||||
regs.d.x = sharemode;
|
|
||||||
intr(0x2f, ®s);
|
|
||||||
return (int)regs.a.x;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 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 */
|
|
||||||
iregs regs;
|
|
||||||
|
|
||||||
regs.a.x = 0x10a1;
|
|
||||||
regs.b.x = fileno;
|
|
||||||
intr(0x2f, ®s);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* DOS calls this to determine whether it can access (read or
|
|
||||||
write) a specific section of a file. We call it internally
|
|
||||||
from lock_unlock (only when locking) to see if any portion
|
|
||||||
of the requested region is already locked. If pspseg is zero,
|
|
||||||
then it matches any pspseg in the lock table. Otherwise, only
|
|
||||||
locks which DO NOT belong to pspseg will be considered.
|
|
||||||
Returns zero if okay to access or lock (no portion of the
|
|
||||||
region is already locked). Otherwise returns non-zero and
|
|
||||||
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 */
|
|
||||||
int fileno, /* file_table entry number */
|
|
||||||
unsigned long ofs, /* offset into file */
|
|
||||||
unsigned long len, /* length (in bytes) of region to access */
|
|
||||||
int allowcriter)
|
|
||||||
{ /* allow a critical error to be generated */
|
|
||||||
iregs regs;
|
|
||||||
|
|
||||||
regs.a.x = 0x10a2 | (allowcriter ? 0x01 : 0x00);
|
|
||||||
regs.b.x = pspseg;
|
|
||||||
regs.c.x = fileno;
|
|
||||||
regs.si = (unsigned short)((ofs >> 16) & 0xffffL);
|
|
||||||
regs.di = (unsigned short)(ofs & 0xffffL);
|
|
||||||
regs.es = (unsigned short)((len >> 16) & 0xffffL);
|
|
||||||
regs.d.x = (unsigned short)(len & 0xffffL);
|
|
||||||
intr(0x2f, ®s);
|
|
||||||
return (int)regs.a.x;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* DOS calls this to lock or unlock a specific section of a file.
|
|
||||||
Returns zero if successfully locked or unlocked. Otherwise
|
|
||||||
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 */
|
|
||||||
int fileno, /* file_table entry number */
|
|
||||||
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;
|
|
||||||
|
|
||||||
regs.a.x = 0x10a4 | (unlock ? 0x01 : 0x00);
|
|
||||||
regs.b.x = pspseg;
|
|
||||||
regs.c.x = fileno;
|
|
||||||
regs.si = (unsigned short)((ofs >> 16) & 0xffffL);
|
|
||||||
regs.di = (unsigned short)(ofs & 0xffffL);
|
|
||||||
regs.es = (unsigned short)((len >> 16) & 0xffffL);
|
|
||||||
regs.d.x = (unsigned short)(len & 0xffffL);
|
|
||||||
intr(0x2f, ®s);
|
|
||||||
return (int)regs.a.x;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* /// End of additions for SHARE. - Ron Cemer */
|
/* /// 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
COUNT DosTruename(const char FAR *src, char FAR *dest)
|
COUNT DosTruename(const char FAR *src, char FAR *dest)
|
||||||
{
|
{
|
||||||
|
|
151
kernel/int2f.asm
151
kernel/int2f.asm
|
@ -166,6 +166,104 @@ IntDosCal:
|
||||||
|
|
||||||
iret
|
iret
|
||||||
|
|
||||||
|
global SHARE_CHECK
|
||||||
|
SHARE_CHECK:
|
||||||
|
mov ax, 0x1000
|
||||||
|
int 0x2f
|
||||||
|
ret
|
||||||
|
|
||||||
|
; DOS calls this to see if it's okay to open the file.
|
||||||
|
; Returns a file_table entry number to use (>= 0) if okay
|
||||||
|
; to open. Otherwise returns < 0 and may generate a critical
|
||||||
|
; 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 * filename,
|
||||||
|
; /* 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... */
|
||||||
|
global SHARE_OPEN_CHECK
|
||||||
|
SHARE_OPEN_CHECK:
|
||||||
|
mov es, si ; save si
|
||||||
|
pop ax ; return address
|
||||||
|
pop dx ; sharemode;
|
||||||
|
pop cx ; openmode;
|
||||||
|
pop bx ; pspseg;
|
||||||
|
pop si ; filename
|
||||||
|
push ax ; return address
|
||||||
|
mov ax, 0x10a0
|
||||||
|
int 0x2f ; returns ax
|
||||||
|
mov si, es ; restore si
|
||||||
|
ret
|
||||||
|
|
||||||
|
; 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 */
|
||||||
|
|
||||||
|
global SHARE_CLOSE_FILE
|
||||||
|
SHARE_CLOSE_FILE:
|
||||||
|
pop ax
|
||||||
|
pop bx
|
||||||
|
push ax
|
||||||
|
mov ax, 0x10a1
|
||||||
|
int 0x2f
|
||||||
|
ret
|
||||||
|
|
||||||
|
; DOS calls this to determine whether it can access (read or
|
||||||
|
; write) a specific section of a file. We call it internally
|
||||||
|
; from lock_unlock (only when locking) to see if any portion
|
||||||
|
; of the requested region is already locked. If pspseg is zero,
|
||||||
|
; then it matches any pspseg in the lock table. Otherwise, only
|
||||||
|
; locks which DO NOT belong to pspseg will be considered.
|
||||||
|
; Returns zero if okay to access or lock (no portion of the
|
||||||
|
; region is already locked). Otherwise returns non-zero and
|
||||||
|
; 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 */
|
||||||
|
; int fileno, /* file_table entry number */
|
||||||
|
; unsigned long ofs, /* offset into file */
|
||||||
|
; unsigned long len, /* length (in bytes) of region to access */
|
||||||
|
; int allowcriter) /* allow a critical error to be generated */
|
||||||
|
global SHARE_ACCESS_CHECK
|
||||||
|
SHARE_ACCESS_CHECK:
|
||||||
|
mov ax, 0x10a2
|
||||||
|
share_common:
|
||||||
|
push bp
|
||||||
|
mov bp, sp
|
||||||
|
push si
|
||||||
|
push di
|
||||||
|
mov bx, [bp + 16] ; pspseg
|
||||||
|
mov cx, [bp + 14] ; fileno
|
||||||
|
mov si, [bp + 12] ; high word of ofs
|
||||||
|
mov di, [bp + 10] ; low word of ofs
|
||||||
|
les dx, [bp + 6] ; len
|
||||||
|
or ax, [bp + 4] ; allowcriter/unlock
|
||||||
|
int 0x2f
|
||||||
|
pop di
|
||||||
|
pop si
|
||||||
|
pop bp
|
||||||
|
ret 14 ; returns ax
|
||||||
|
|
||||||
|
; DOS calls this to lock or unlock a specific section of a file.
|
||||||
|
; Returns zero if successfully locked or unlocked. Otherwise
|
||||||
|
; 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 */
|
||||||
|
; int fileno, /* file_table entry number */
|
||||||
|
; unsigned long ofs, /* offset into file */
|
||||||
|
; unsigned long len, /* length (in bytes) of region to lock or unlock */
|
||||||
|
; int unlock) /* one to unlock; zero to lock */
|
||||||
|
global SHARE_LOCK_UNLOCK
|
||||||
|
SHARE_LOCK_UNLOCK:
|
||||||
|
mov ax,0x10a4
|
||||||
|
jmp short share_common
|
||||||
|
|
||||||
; Int 2F Multipurpose Remote System Calls
|
; Int 2F Multipurpose Remote System Calls
|
||||||
;
|
;
|
||||||
; added by James Tabor jimtabor@infohwy.com
|
; added by James Tabor jimtabor@infohwy.com
|
||||||
|
@ -430,6 +528,59 @@ _remote_process_end: ; Terminate process
|
||||||
pop ds
|
pop ds
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
;STATIC int ASMCFUNC 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)
|
||||||
|
; one to unlock; zero to lock
|
||||||
|
global _remote_lock_unlock
|
||||||
|
_remote_lock_unlock:
|
||||||
|
push bp
|
||||||
|
mov bp, sp
|
||||||
|
push di
|
||||||
|
les di, [bp + 4] ; sftp
|
||||||
|
lea dx, [bp + 8] ; parameter block on the stack!
|
||||||
|
mov bl, [bp + 16] ; unlock
|
||||||
|
mov ax, 0x110a
|
||||||
|
mov cx, 1
|
||||||
|
int 0x2f
|
||||||
|
mov ah, 0
|
||||||
|
jc lock_error
|
||||||
|
mov al, 0
|
||||||
|
lock_error:
|
||||||
|
neg al
|
||||||
|
pop di
|
||||||
|
pop bp
|
||||||
|
ret
|
||||||
|
|
||||||
|
; extern UWORD ASMCFUNC call_nls(UWORD subfct, struct nlsInfoBlock *nlsinfo,
|
||||||
|
; UWORD bp, UWORD cp, UWORD cntry, UWORD bufsize, UWORD FAR *buf, UWORD *id);
|
||||||
|
|
||||||
|
global _call_nls
|
||||||
|
_call_nls:
|
||||||
|
push bp
|
||||||
|
mov bp, sp
|
||||||
|
push si
|
||||||
|
mov al, [bp + 4] ; subfct
|
||||||
|
mov ah, 0x14
|
||||||
|
mov si, [bp + 6] ; nlsinfo
|
||||||
|
mov bx, [bp + 10] ; cp
|
||||||
|
mov dx, [bp + 12] ; cntry
|
||||||
|
mov cx, [bp + 14] ; bufsize
|
||||||
|
les di, [bp + 16] ; buf
|
||||||
|
push bp
|
||||||
|
mov bp, [bp + 8] ; bp
|
||||||
|
int 0x2f
|
||||||
|
pop bp
|
||||||
|
mov bp, [bp + 20] ; store id (in SS:) unless it's NULL
|
||||||
|
or bp, bp
|
||||||
|
jz nostore
|
||||||
|
mov [bp], bx
|
||||||
|
nostore:
|
||||||
|
pop si
|
||||||
|
pop bp
|
||||||
|
ret
|
||||||
|
|
||||||
%if 0
|
%if 0
|
||||||
; int_2f_111e_call(iregs FAR *iregs)
|
; int_2f_111e_call(iregs FAR *iregs)
|
||||||
;
|
;
|
||||||
|
|
|
@ -79,15 +79,6 @@
|
||||||
%endmacro
|
%endmacro
|
||||||
|
|
||||||
segment HMA_TEXT
|
segment HMA_TEXT
|
||||||
;
|
|
||||||
; void intr(nr, rp)
|
|
||||||
; REG int nr
|
|
||||||
; REG struct REGPACK *rp
|
|
||||||
;
|
|
||||||
;
|
|
||||||
global _intr
|
|
||||||
_intr:
|
|
||||||
INTR
|
|
||||||
|
|
||||||
;; COUNT ASMCFUNC res_DosExec(COUNT mode, exec_blk * ep, BYTE * lp)
|
;; COUNT ASMCFUNC res_DosExec(COUNT mode, exec_blk * ep, BYTE * lp)
|
||||||
global _res_DosExec
|
global _res_DosExec
|
||||||
|
@ -125,7 +116,6 @@ segment INIT_TEXT
|
||||||
; REG int nr
|
; REG int nr
|
||||||
; REG struct REGPACK *rp
|
; REG struct REGPACK *rp
|
||||||
;
|
;
|
||||||
; same stuff as above, but in INIT_SEGMENT
|
|
||||||
global _init_call_intr
|
global _init_call_intr
|
||||||
_init_call_intr:
|
_init_call_intr:
|
||||||
INTR
|
INTR
|
||||||
|
|
71
kernel/nls.c
71
kernel/nls.c
|
@ -43,22 +43,10 @@ static BYTE *RcsId =
|
||||||
"$Id$";
|
"$Id$";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* assertDSeqSS() - test if DS == SS
|
|
||||||
* Otherwise pointers to local variables (that ones on the stack) will
|
|
||||||
* be referenced via DS, which will cause to use wrong values.
|
|
||||||
*/
|
|
||||||
#ifdef NLS_DEBUG
|
#ifdef NLS_DEBUG
|
||||||
#define assertDSeqSS() if(_DS != _SS) assertDSneSS();
|
|
||||||
void assertDSneSS(void)
|
|
||||||
{
|
|
||||||
panic("DS unequal to SS");
|
|
||||||
}
|
|
||||||
|
|
||||||
#define log(a) printf a
|
#define log(a) printf a
|
||||||
#define log1(a) printf a
|
#define log1(a) printf a
|
||||||
#else
|
#else
|
||||||
#define assertDSeqSS()
|
|
||||||
#define log(a)
|
#define log(a)
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
#define log1(a)
|
#define log1(a)
|
||||||
|
@ -103,18 +91,19 @@ struct nlsInfoBlock nlsInfo = {
|
||||||
***** MUX calling functions ****************************************
|
***** MUX calling functions ****************************************
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
extern int ASMCFUNC call_nls(UWORD, struct nlsInfoBlock *, UWORD, UWORD, UWORD,
|
||||||
|
UWORD, void FAR *, UWORD *);
|
||||||
/*== DS:SI _always_ points to global NLS info structure <-> no
|
/*== DS:SI _always_ points to global NLS info structure <-> no
|
||||||
* subfct can use these registers for anything different. ==ska*/
|
* subfct can use these registers for anything different. ==ska*/
|
||||||
STATIC COUNT muxGo(int subfct, iregs * rp)
|
STATIC COUNT muxGo(int subfct, UWORD bp, UWORD cp, UWORD cntry, UWORD bufsize,
|
||||||
|
void FAR *buf, UWORD *id)
|
||||||
{
|
{
|
||||||
log(("NLS: muxGo(): subfct=%x, cntry=%u, cp=%u, ES:DI=%04x:%04x\n",
|
int ret;
|
||||||
subfct, rp->DX, rp->BX, rp->ES, rp->DI));
|
log(("NLS: muxGo(): subfct=%x, cntry=%u, cp=%u, ES:DI=%p\n",
|
||||||
rp->SI = FP_OFF(&nlsInfo);
|
subfct, cntry, cp, buf));
|
||||||
rp->DS = FP_SEG(&nlsInfo);
|
ret = call_nls(subfct, &nlsInfo, bp, cp, cntry, bufsize, buf, id);
|
||||||
rp->AX = 0x1400 | subfct;
|
log(("NLS: muxGo(): return value = %d\n", ret));
|
||||||
intr(0x2f, rp);
|
return ret;
|
||||||
log(("NLS: muxGo(): return value = %d\n", rp->AX));
|
|
||||||
return rp->AX;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -122,49 +111,36 @@ STATIC COUNT muxGo(int subfct, iregs * rp)
|
||||||
*/
|
*/
|
||||||
COUNT muxLoadPkg(UWORD cp, UWORD cntry)
|
COUNT muxLoadPkg(UWORD cp, UWORD cntry)
|
||||||
{
|
{
|
||||||
iregs r;
|
UWORD id; /* on stack, call_nls in int2f.asm takes care of this
|
||||||
|
* if DS != SS */
|
||||||
assertDSeqSS(); /* because "&r" */
|
|
||||||
|
|
||||||
/* 0x1400 == not installed, ok to install */
|
/* 0x1400 == not installed, ok to install */
|
||||||
/* 0x1401 == not installed, not ok to install */
|
/* 0x1401 == not installed, not ok to install */
|
||||||
/* 0x14FF == installed */
|
/* 0x14FF == installed */
|
||||||
|
|
||||||
r.BX = NLS_FREEDOS_NLSFUNC_VERSION; /* What version of nlsInfo */
|
|
||||||
#if NLS_FREEDOS_NLSFUNC_VERSION == NLS_FREEDOS_NLSFUNC_ID
|
#if NLS_FREEDOS_NLSFUNC_VERSION == NLS_FREEDOS_NLSFUNC_ID
|
||||||
/* make sure the NLSFUNC ID is updated */
|
/* make sure the NLSFUNC ID is updated */
|
||||||
#error "NLS_FREEDOS_NLSFUNC_VERSION == NLS_FREEDOS_NLSFUNC_ID"
|
#error "NLS_FREEDOS_NLSFUNC_VERSION == NLS_FREEDOS_NLSFUNC_ID"
|
||||||
#endif
|
#endif
|
||||||
r.CX = NLS_FREEDOS_NLSFUNC_ID;
|
if (muxGo(0, 0, NLS_FREEDOS_NLSFUNC_VERSION, 0, NLS_FREEDOS_NLSFUNC_ID, 0,
|
||||||
if (muxGo(0, &r) != 0x14ff)
|
(UWORD *)&id) != 0x14ff)
|
||||||
return DE_FILENOTFND; /* No NLSFUNC --> no load */
|
return DE_FILENOTFND; /* No NLSFUNC --> no load */
|
||||||
if (r.BX != NLS_FREEDOS_NLSFUNC_ID) /* FreeDOS NLSFUNC will return */
|
if (id != NLS_FREEDOS_NLSFUNC_ID) /* FreeDOS NLSFUNC will return */
|
||||||
return DE_INVLDACC; /* This magic number */
|
return DE_INVLDACC; /* This magic number */
|
||||||
|
|
||||||
/* OK, the correct NLSFUNC is available --> load pkg */
|
/* OK, the correct NLSFUNC is available --> load pkg */
|
||||||
/* If BX == -1 on entry, NLSFUNC updates BX to the codepage loaded
|
/* If cp == -1 on entry, NLSFUNC updates cp to the codepage loaded
|
||||||
into memory. The system must then change to this one later */
|
into memory. The system must then change to this one later */
|
||||||
r.DX = cntry;
|
return muxGo(NLSFUNC_LOAD_PKG, 0, cp, cntry, 0, 0, 0);
|
||||||
r.BX = cp;
|
|
||||||
return muxGo(NLSFUNC_LOAD_PKG, &r);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC int muxBufGo(int subfct, int bp, UWORD cp, UWORD cntry,
|
STATIC int muxBufGo(int subfct, int bp, UWORD cp, UWORD cntry,
|
||||||
UWORD bufsize, VOID FAR * buf)
|
UWORD bufsize, VOID FAR * buf)
|
||||||
{
|
{
|
||||||
iregs r;
|
log(("NLS: muxBufGo(): subfct=%x, BP=%u, cp=%u, cntry=%u, len=%u, buf=%p\n",
|
||||||
|
subfct, bp, cp, cntry, bufsize, buf));
|
||||||
|
|
||||||
assertDSeqSS(); /* because "&r" */
|
return muxGo(subfct, bp, cp, cntry, bufsize, buf, 0);
|
||||||
|
|
||||||
log(("NLS: muxBufGo(): subfct=%x, BP=%u, cp=%u, cntry=%u, len=%u, buf=%04x:%04x\n", subfct, bp, cp, cntry, bufsize, FP_SEG(buf), FP_OFF(buf)));
|
|
||||||
|
|
||||||
r.DX = cntry;
|
|
||||||
r.BX = cp;
|
|
||||||
r.ES = FP_SEG(buf);
|
|
||||||
r.DI = FP_OFF(buf);
|
|
||||||
r.CX = bufsize;
|
|
||||||
r.BP = bp;
|
|
||||||
return muxGo(subfct, &r);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define mux65(s,cp,cc,bs,b) muxBufGo(2, (s), (cp), (cc), (bs), (b))
|
#define mux65(s,cp,cc,bs,b) muxBufGo(2, (s), (cp), (cc), (bs), (b))
|
||||||
|
@ -427,11 +403,9 @@ STATIC VOID xUpMem(struct nlsPackage FAR * nls, VOID FAR * str,
|
||||||
|
|
||||||
STATIC int nlsYesNo(struct nlsPackage FAR * nls, unsigned char ch)
|
STATIC int nlsYesNo(struct nlsPackage FAR * nls, unsigned char ch)
|
||||||
{
|
{
|
||||||
assertDSeqSS(); /* because "&ch" */
|
|
||||||
|
|
||||||
log(("NLS: nlsYesNo(): in ch=%u (%c)\n", ch, ch > 32 ? ch : ' '));
|
log(("NLS: nlsYesNo(): in ch=%u (%c)\n", ch, ch > 32 ? ch : ' '));
|
||||||
|
|
||||||
xUpMem(nls, &ch, 1); /* Upcase character */
|
xUpMem(nls, MK_FP(_SS, &ch), 1); /* Upcase character */
|
||||||
/* Cannot use DosUpChar(), because
|
/* Cannot use DosUpChar(), because
|
||||||
maybe: nls != current NLS pkg
|
maybe: nls != current NLS pkg
|
||||||
However: Upcase character within lowlevel
|
However: Upcase character within lowlevel
|
||||||
|
@ -507,8 +481,7 @@ VOID DosUpFMem(VOID FAR * str, unsigned len)
|
||||||
unsigned char DosUpFChar(unsigned char ch)
|
unsigned char DosUpFChar(unsigned char ch)
|
||||||
/* upcase a single character for file names */
|
/* upcase a single character for file names */
|
||||||
{
|
{
|
||||||
assertDSeqSS(); /* because "&ch" */
|
DosUpFMem(MK_FP(_SS, & ch), 1);
|
||||||
DosUpFMem((UBYTE FAR *) & ch, 1);
|
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue