mirror of https://github.com/FDOS/kernel.git
Implement support for int2f/ax=1220.
Fix int2f/ax=1216 (needs sft handles, not psp handles, and to return the relative handle in BX, and to deal with carry) git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@712 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
5f6d47797e
commit
3fa044c149
|
@ -143,35 +143,41 @@ STATIC VOID DosGetFile(BYTE * lpszPath, BYTE FAR * lpszDosFileName)
|
|||
fmemcpy(lpszDosFileName, fcbname, FNAME_SIZE + FEXT_SIZE);
|
||||
}
|
||||
|
||||
sft FAR * idx_to_sft(int SftIndex)
|
||||
int idx_to_sft_(int SftIndex)
|
||||
{
|
||||
/*called from below and int2f/ax=1216*/
|
||||
sfttbl FAR *sp;
|
||||
|
||||
lpCurSft = (sft FAR *) - 1;
|
||||
if (SftIndex < 0)
|
||||
return (sft FAR *) - 1;
|
||||
return -1;
|
||||
|
||||
/* Get the SFT block that contains the SFT */
|
||||
for (sp = sfthead; sp != (sfttbl FAR *) - 1; sp = sp->sftt_next)
|
||||
{
|
||||
if (SftIndex < sp->sftt_count)
|
||||
{
|
||||
lpCurSft = (sft FAR *) & (sp->sftt_table[SftIndex]);
|
||||
|
||||
/* if not opened, the SFT is useless */
|
||||
if (lpCurSft->sft_count == 0)
|
||||
return (sft FAR *) - 1;
|
||||
|
||||
/* finally, point to the right entry */
|
||||
return lpCurSft;
|
||||
lpCurSft = (sft FAR *) & (sp->sftt_table[SftIndex]);
|
||||
return SftIndex;
|
||||
}
|
||||
else
|
||||
SftIndex -= sp->sftt_count;
|
||||
SftIndex -= sp->sftt_count;
|
||||
}
|
||||
/* If not found, return an error */
|
||||
|
||||
return (sft FAR *) - 1;
|
||||
/* If not found, return an error */
|
||||
return -1;
|
||||
}
|
||||
|
||||
sft FAR * idx_to_sft(int SftIndex)
|
||||
{
|
||||
/* called internally only */
|
||||
SftIndex = idx_to_sft_(SftIndex);
|
||||
/* if not opened, the SFT is useless */
|
||||
if (SftIndex == -1 || lpCurSft->sft_count == 0)
|
||||
return (sft FAR *) - 1;
|
||||
return lpCurSft;
|
||||
}
|
||||
|
||||
int get_sft_idx(unsigned hndl)
|
||||
{
|
||||
psp FAR *p = MK_FP(cu_psp, 0);
|
||||
|
|
|
@ -1913,15 +1913,24 @@ VOID ASMCFUNC int2F_12_handler(struct int2f12regs r)
|
|||
r.ax -= 'a' - 'A';
|
||||
break;
|
||||
|
||||
case 0x16: /* get address of system file table entry - used by NET.EXE
|
||||
BX system file table entry number ( such as returned from 2F/1220)
|
||||
returns
|
||||
ES:DI pointer to SFT entry */
|
||||
case 0x16:
|
||||
/* get address of system file table entry - used by NET.EXE
|
||||
BX system file table entry number ( such as returned from 2F/1220)
|
||||
returns
|
||||
ES:DI pointer to SFT entry
|
||||
BX relative entry number within SFT */
|
||||
{
|
||||
sft FAR *p = get_sft(r.bx);
|
||||
int rel_idx = idx_to_sft_(r.bx);
|
||||
|
||||
r.es = FP_SEG(p);
|
||||
r.di = FP_OFF(p);
|
||||
if (rel_idx == (size_t) - 1)
|
||||
{
|
||||
r.flags |= FLG_CARRY;
|
||||
break;
|
||||
}
|
||||
r.flags &= ~FLG_CARRY;
|
||||
r.bx = rel_idx;
|
||||
r.es = FP_SEG(lpCurSft);
|
||||
r.di = FP_OFF(lpCurSft);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1963,6 +1972,24 @@ VOID ASMCFUNC int2F_12_handler(struct int2f12regs r)
|
|||
r.ax = (r.ax & 0xff00) | (r.cx & 3 ? 28 : 29);
|
||||
break;
|
||||
|
||||
case 0x20: /* get job file table entry */
|
||||
{
|
||||
psp FAR *p = MK_FP(cu_psp, 0);
|
||||
unsigned char FAR *idx;
|
||||
|
||||
if (r.bx >= p->ps_maxfiles)
|
||||
{
|
||||
r.ax = (r.ax & 0xff00) | (-DE_INVLDHNDL);
|
||||
r.flags |= FLG_CARRY;
|
||||
break;
|
||||
}
|
||||
idx = &p->ps_filetab[r.bx];
|
||||
r.flags &= ~FLG_CARRY;
|
||||
r.es = FP_SEG(idx);
|
||||
r.di = FP_OFF(idx);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x21: /* truename */
|
||||
|
||||
DosTruename(MK_FP(r.ds, r.si), MK_FP(r.es, r.di));
|
||||
|
|
|
@ -114,6 +114,7 @@ COUNT DosRmdir(const char FAR * dir);
|
|||
struct dhdr FAR *IsDevice(const char FAR * FileName);
|
||||
BOOL IsShareInstalled(void);
|
||||
COUNT DosLockUnlock(COUNT hndl, LONG pos, LONG len, COUNT unlock);
|
||||
int idx_to_sft_(int SftIndex);
|
||||
sft FAR *idx_to_sft(int SftIndex);
|
||||
int get_sft_idx(UCOUNT hndl);
|
||||
struct cds FAR *get_cds(unsigned dsk);
|
||||
|
|
Loading…
Reference in New Issue