Removed mis-aligned accesses during BIOS/DOS data initialization.
This commit is contained in:
parent
9299890257
commit
0121ac1a12
|
@ -74,6 +74,51 @@ typedef struct
|
||||||
BYTE DiskDataRate; /* 8B: Last disk data rate selected */
|
BYTE DiskDataRate; /* 8B: Last disk data rate selected */
|
||||||
} BIOSDATA;
|
} BIOSDATA;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
DWORD StaticFuncTable; /* 00: static functionality table */
|
||||||
|
BYTE VideoMode; /* 04: video mode in effect */
|
||||||
|
WORD NumberColumns; /* 05: number of columns */
|
||||||
|
WORD RegenBufLen; /* 07: length of regen buffer in bytes */
|
||||||
|
WORD RegenBufAddr; /* 09: starting address of regen buffer */
|
||||||
|
WORD CursorPos[8]; /* 0B: cursor position for page 0..7 */
|
||||||
|
WORD CursorType; /* 1B: cursor "type" (start/stop scan lines) */
|
||||||
|
BYTE ActivePage; /* 1D: active display page */
|
||||||
|
WORD CRTCPort; /* 1E: CRTC port address */
|
||||||
|
BYTE Port3x8; /* 20: current setting of PORT 03x8h */
|
||||||
|
BYTE Port3x9; /* 21: current setting of PORT 03x9h */
|
||||||
|
BYTE NumberRows; /* 22: number of rows - 1 */
|
||||||
|
WORD BytesPerChar; /* 23: bytes/character */
|
||||||
|
BYTE DCCActive; /* 25: display combination code of active display */
|
||||||
|
BYTE DCCAlternate; /* 26: DCC of alternate display */
|
||||||
|
WORD NumberColors; /* 27: number of colors supported in current mode (0000h = mono) */
|
||||||
|
BYTE NumberPages; /* 29: number of pages supported in current mode */
|
||||||
|
BYTE NumberScanlines; /* 2A: number of scan lines active */
|
||||||
|
BYTE CharBlockPrimary; /* 2B: primary character block */
|
||||||
|
BYTE CharBlockSecondary; /* 2C: secondary character block */
|
||||||
|
BYTE MiscFlags; /* 2D: miscellaneous flags */
|
||||||
|
BYTE NonVGASupport; /* 2E: non-VGA mode support */
|
||||||
|
BYTE _reserved1[2]; /* 2F: */
|
||||||
|
BYTE VideoMem; /* 31: video memory available */
|
||||||
|
BYTE SavePointerState; /* 32: save pointer state flags */
|
||||||
|
BYTE DisplayStatus; /* 33: display information and status */
|
||||||
|
BYTE _reserved2[12]; /* 34: */
|
||||||
|
|
||||||
|
} VIDEOSTATE;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
BYTE ModeSupport[7]; /* 00: modes supported 1..7 */
|
||||||
|
BYTE ScanlineSupport; /* 07: scan lines supported */
|
||||||
|
BYTE NumberCharBlocks; /* 08: total number of character blocks */
|
||||||
|
BYTE ActiveCharBlocks; /* 09: max. number of active character blocks */
|
||||||
|
WORD MiscFlags; /* 0A: miscellaneous function support flags */
|
||||||
|
WORD _reserved1; /* 0C: */
|
||||||
|
BYTE SavePointerFlags; /* 0E: save pointer function flags */
|
||||||
|
BYTE _reserved2; /* OF: */
|
||||||
|
|
||||||
|
} VIDEOFUNCTIONALITY;
|
||||||
|
|
||||||
#include "poppack.h"
|
#include "poppack.h"
|
||||||
|
|
||||||
extern HANDLE16 DOSMEM_BiosDataSeg;
|
extern HANDLE16 DOSMEM_BiosDataSeg;
|
||||||
|
|
144
msdos/devices.c
144
msdos/devices.c
|
@ -15,12 +15,11 @@
|
||||||
#include "pshpack1.h"
|
#include "pshpack1.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
DOS_DEVICE_HEADER hdr;
|
|
||||||
BYTE ljmp1;
|
BYTE ljmp1;
|
||||||
RMCBPROC strategy;
|
RMCBPROC strategy;
|
||||||
BYTE ljmp2;
|
BYTE ljmp2;
|
||||||
RMCBPROC interrupt;
|
RMCBPROC interrupt;
|
||||||
} WINEDEV;
|
} WINEDEV_THUNK;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
BYTE size; /* length of header + data */
|
BYTE size; /* length of header + data */
|
||||||
|
@ -46,13 +45,11 @@ typedef struct {
|
||||||
|
|
||||||
#include "poppack.h"
|
#include "poppack.h"
|
||||||
|
|
||||||
#define REQ_SCRATCH sizeof(REQ_IO)
|
#define CON_BUFFER 128
|
||||||
|
|
||||||
#define SYSTEM_STRATEGY_NUL 0x0100
|
#define SYSTEM_STRATEGY_NUL 0x0100
|
||||||
#define SYSTEM_STRATEGY_CON 0x0101
|
#define SYSTEM_STRATEGY_CON 0x0101
|
||||||
|
|
||||||
DWORD DOS_LOLSeg;
|
|
||||||
|
|
||||||
#define NONEXT ((DWORD)-1)
|
#define NONEXT ((DWORD)-1)
|
||||||
|
|
||||||
#define ATTR_STDIN 0x0001
|
#define ATTR_STDIN 0x0001
|
||||||
|
@ -94,10 +91,6 @@ DWORD DOS_LOLSeg;
|
||||||
|
|
||||||
#define LJMP 0xea
|
#define LJMP 0xea
|
||||||
|
|
||||||
#define DEV0_OFS (sizeof(DOS_LISTOFLISTS) - sizeof(DOS_DEVICE_HEADER))
|
|
||||||
#define DEV1_OFS (DEV0_OFS + sizeof(WINEDEV))
|
|
||||||
#define ALLDEV_OFS (DEV1_OFS + sizeof(devs))
|
|
||||||
#define ALL_OFS (ALLDEV_OFS + REQ_SCRATCH)
|
|
||||||
|
|
||||||
/* prototypes */
|
/* prototypes */
|
||||||
static void WINAPI nul_strategy(CONTEXT86*ctx);
|
static void WINAPI nul_strategy(CONTEXT86*ctx);
|
||||||
|
@ -105,27 +98,44 @@ static void WINAPI nul_interrupt(CONTEXT86*ctx);
|
||||||
static void WINAPI con_strategy(CONTEXT86*ctx);
|
static void WINAPI con_strategy(CONTEXT86*ctx);
|
||||||
static void WINAPI con_interrupt(CONTEXT86*ctx);
|
static void WINAPI con_interrupt(CONTEXT86*ctx);
|
||||||
|
|
||||||
/* the device headers */
|
/* devices */
|
||||||
#define STRATEGY_OFS sizeof(DOS_DEVICE_HEADER)
|
typedef struct
|
||||||
#define INTERRUPT_OFS STRATEGY_OFS+5
|
|
||||||
|
|
||||||
static DOS_DEVICE_HEADER dev_nul_hdr={
|
|
||||||
NONEXT,
|
|
||||||
ATTR_CHAR|ATTR_NUL|ATTR_DEVICE,
|
|
||||||
STRATEGY_OFS,INTERRUPT_OFS,
|
|
||||||
"NUL "
|
|
||||||
};
|
|
||||||
|
|
||||||
static WINEDEV devs[]={
|
|
||||||
{
|
{
|
||||||
{NONEXT,
|
char name[8];
|
||||||
ATTR_CHAR|ATTR_STDIN|ATTR_STDOUT|ATTR_FASTCON|ATTR_NOTEOF|ATTR_DEVICE,
|
WORD attr;
|
||||||
STRATEGY_OFS,INTERRUPT_OFS,
|
RMCBPROC strategy;
|
||||||
"CON "},
|
RMCBPROC interrupt;
|
||||||
LJMP,con_strategy,
|
|
||||||
LJMP,con_interrupt}
|
} WINEDEV;
|
||||||
|
|
||||||
|
static WINEDEV devs[] =
|
||||||
|
{
|
||||||
|
{ "NUL ",
|
||||||
|
ATTR_CHAR|ATTR_NUL|ATTR_DEVICE,
|
||||||
|
nul_strategy, nul_interrupt },
|
||||||
|
|
||||||
|
{ "CON ",
|
||||||
|
ATTR_CHAR|ATTR_STDIN|ATTR_STDOUT|ATTR_FASTCON|ATTR_NOTEOF|ATTR_DEVICE,
|
||||||
|
con_strategy, con_interrupt }
|
||||||
};
|
};
|
||||||
#define nr_devs (sizeof(devs)/sizeof(WINEDEV))
|
|
||||||
|
#define NR_DEVS (sizeof(devs)/sizeof(WINEDEV))
|
||||||
|
|
||||||
|
/* DOS data segment */
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
DOS_LISTOFLISTS lol;
|
||||||
|
DOS_DEVICE_HEADER dev[NR_DEVS-1];
|
||||||
|
WINEDEV_THUNK thunk[NR_DEVS];
|
||||||
|
REQ_IO req;
|
||||||
|
BYTE buffer[CON_BUFFER];
|
||||||
|
|
||||||
|
} DOS_DATASEG;
|
||||||
|
|
||||||
|
#define DOS_DATASEG_OFF(xxx) FIELD_OFFSET(DOS_DATASEG, xxx)
|
||||||
|
|
||||||
|
DWORD DOS_LOLSeg;
|
||||||
|
|
||||||
|
|
||||||
/* the device implementations */
|
/* the device implementations */
|
||||||
static void do_lret(CONTEXT86*ctx)
|
static void do_lret(CONTEXT86*ctx)
|
||||||
|
@ -182,8 +192,6 @@ static void WINAPI nul_interrupt(CONTEXT86*ctx)
|
||||||
do_lret(ctx);
|
do_lret(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CON_BUFFER 128
|
|
||||||
|
|
||||||
static void WINAPI con_strategy(CONTEXT86*ctx)
|
static void WINAPI con_strategy(CONTEXT86*ctx)
|
||||||
{
|
{
|
||||||
do_strategy(ctx, SYSTEM_STRATEGY_CON, sizeof(int));
|
do_strategy(ctx, SYSTEM_STRATEGY_CON, sizeof(int));
|
||||||
|
@ -196,10 +204,11 @@ static void WINAPI con_interrupt(CONTEXT86*ctx)
|
||||||
BIOSDATA *bios = DOSMEM_BiosData();
|
BIOSDATA *bios = DOSMEM_BiosData();
|
||||||
WORD CurOfs = bios->NextKbdCharPtr;
|
WORD CurOfs = bios->NextKbdCharPtr;
|
||||||
DOS_LISTOFLISTS *lol = DOSMEM_LOL();
|
DOS_LISTOFLISTS *lol = DOSMEM_LOL();
|
||||||
BYTE *linebuffer = ((BYTE*)lol) + ALL_OFS;
|
DOS_DATASEG *dataseg = (DOS_DATASEG *)lol;
|
||||||
|
BYTE *linebuffer = dataseg->buffer;
|
||||||
BYTE *curbuffer = (lol->offs_unread_CON) ?
|
BYTE *curbuffer = (lol->offs_unread_CON) ?
|
||||||
(((BYTE*)lol) + lol->offs_unread_CON) : (BYTE*)NULL;
|
(((BYTE*)dataseg) + lol->offs_unread_CON) : (BYTE*)NULL;
|
||||||
DOS_DEVICE_HEADER *con = (DOS_DEVICE_HEADER*)(((BYTE*)lol) + DEV1_OFS);
|
DOS_DEVICE_HEADER *con = dataseg->dev;
|
||||||
LPDOSTASK lpDosTask = MZ_Current();
|
LPDOSTASK lpDosTask = MZ_Current();
|
||||||
|
|
||||||
switch (hdr->command) {
|
switch (hdr->command) {
|
||||||
|
@ -429,50 +438,47 @@ Output of DOS 6.22:
|
||||||
|
|
||||||
void DOSDEV_InstallDOSDevices(void)
|
void DOSDEV_InstallDOSDevices(void)
|
||||||
{
|
{
|
||||||
WINEDEV *dev;
|
DOS_DATASEG *dataseg;
|
||||||
DOS_DEVICE_HEADER *pdev;
|
|
||||||
UINT16 seg;
|
UINT16 seg;
|
||||||
int n;
|
int n;
|
||||||
WORD ofs = DEV0_OFS;
|
|
||||||
DOS_LISTOFLISTS *DOS_LOL;
|
|
||||||
|
|
||||||
/* allocate DOS data segment or something */
|
/* allocate DOS data segment or something */
|
||||||
DOS_LOLSeg = GlobalDOSAlloc16(ALL_OFS+CON_BUFFER);
|
DOS_LOLSeg = GlobalDOSAlloc16(sizeof(DOS_DATASEG));
|
||||||
seg = HIWORD(DOS_LOLSeg);
|
seg = HIWORD(DOS_LOLSeg);
|
||||||
DOS_LOL = PTR_SEG_OFF_TO_LIN(LOWORD(DOS_LOLSeg), 0);
|
dataseg = PTR_SEG_OFF_TO_LIN(LOWORD(DOS_LOLSeg), 0);
|
||||||
|
|
||||||
/* initialize the magnificent List Of Lists */
|
/* initialize the magnificent List Of Lists */
|
||||||
InitListOfLists(DOS_LOL);
|
InitListOfLists(&dataseg->lol);
|
||||||
|
|
||||||
/* copy first device (NUL) */
|
/* Set up first device (NUL) */
|
||||||
pdev = &(DOS_LOL->NUL_dev);
|
dataseg->lol.NUL_dev.next_dev = PTR_SEG_OFF_TO_SEGPTR(seg, DOS_DATASEG_OFF(dev[0]));
|
||||||
memcpy(pdev,&dev_nul_hdr,sizeof(DOS_DEVICE_HEADER));
|
dataseg->lol.NUL_dev.attr = devs[0].attr;
|
||||||
pdev->strategy += ofs;
|
dataseg->lol.NUL_dev.strategy = DOS_DATASEG_OFF(thunk[0].ljmp1);
|
||||||
pdev->interrupt += ofs;
|
dataseg->lol.NUL_dev.interrupt = DOS_DATASEG_OFF(thunk[0].ljmp2);
|
||||||
/* set up dev so we can copy over the rest */
|
memcpy(dataseg->lol.NUL_dev.name, devs[0].name, 8);
|
||||||
dev = (WINEDEV*)(((char*)DOS_LOL)+ofs);
|
|
||||||
dev[0].ljmp1 = LJMP;
|
|
||||||
dev[0].strategy = (RMCBPROC)DPMI_AllocInternalRMCB(nul_strategy);
|
|
||||||
dev[0].ljmp2 = LJMP;
|
|
||||||
dev[0].interrupt = (RMCBPROC)DPMI_AllocInternalRMCB(nul_interrupt);
|
|
||||||
|
|
||||||
dev++;
|
/* Set up the remaining devices */
|
||||||
ofs += sizeof(WINEDEV);
|
for (n = 1; n < NR_DEVS; n++)
|
||||||
|
{
|
||||||
/* first of remaining devices is CON */
|
dataseg->dev[n-1].next_dev = (n+1) == NR_DEVS ? NONEXT :
|
||||||
DOS_LOL->ptr_CON_dev_hdr = PTR_SEG_OFF_TO_SEGPTR(seg, ofs);
|
PTR_SEG_OFF_TO_SEGPTR(seg, DOS_DATASEG_OFF(dev[n]));
|
||||||
|
dataseg->dev[n-1].attr = devs[n].attr;
|
||||||
/* copy remaining devices */
|
dataseg->dev[n-1].strategy = DOS_DATASEG_OFF(thunk[n].ljmp1);
|
||||||
memcpy(dev,&devs,sizeof(devs));
|
dataseg->dev[n-1].interrupt = DOS_DATASEG_OFF(thunk[n].ljmp2);
|
||||||
for (n=0; n<nr_devs; n++) {
|
memcpy(dataseg->dev[n-1].name, devs[n].name, 8);
|
||||||
pdev->next_dev = PTR_SEG_OFF_TO_SEGPTR(seg, ofs);
|
|
||||||
dev[n].hdr.strategy += ofs;
|
|
||||||
dev[n].hdr.interrupt += ofs;
|
|
||||||
dev[n].strategy = (RMCBPROC)DPMI_AllocInternalRMCB(dev[n].strategy);
|
|
||||||
dev[n].interrupt = (RMCBPROC)DPMI_AllocInternalRMCB(dev[n].interrupt);
|
|
||||||
ofs += sizeof(WINEDEV);
|
|
||||||
pdev = &(dev[n].hdr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set up thunks */
|
||||||
|
for (n = 0; n < NR_DEVS; n++)
|
||||||
|
{
|
||||||
|
dataseg->thunk[n].ljmp1 = LJMP;
|
||||||
|
dataseg->thunk[n].strategy = (RMCBPROC)DPMI_AllocInternalRMCB(devs[n].strategy);
|
||||||
|
dataseg->thunk[n].ljmp2 = LJMP;
|
||||||
|
dataseg->thunk[n].interrupt = (RMCBPROC)DPMI_AllocInternalRMCB(devs[n].interrupt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* CON is device 1 */
|
||||||
|
dataseg->lol.ptr_CON_dev_hdr = PTR_SEG_OFF_TO_SEGPTR(seg, DOS_DATASEG_OFF(dev[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD DOSDEV_Console(void)
|
DWORD DOSDEV_Console(void)
|
||||||
|
@ -513,7 +519,7 @@ static void DOSDEV_DoReq(void*req, DWORD dev)
|
||||||
char *phdr;
|
char *phdr;
|
||||||
|
|
||||||
dhdr = DOSMEM_MapRealToLinear(dev);
|
dhdr = DOSMEM_MapRealToLinear(dev);
|
||||||
phdr = ((char*)DOSMEM_LOL()) + ALLDEV_OFS;
|
phdr = ((char*)DOSMEM_LOL()) + DOS_DATASEG_OFF(req);
|
||||||
|
|
||||||
/* copy request to request scratch area */
|
/* copy request to request scratch area */
|
||||||
memcpy(phdr, req, hdr->size);
|
memcpy(phdr, req, hdr->size);
|
||||||
|
@ -523,7 +529,7 @@ static void DOSDEV_DoReq(void*req, DWORD dev)
|
||||||
|
|
||||||
/* ES:BX points to request for strategy routine */
|
/* ES:BX points to request for strategy routine */
|
||||||
ES_reg(&ctx) = HIWORD(DOS_LOLSeg);
|
ES_reg(&ctx) = HIWORD(DOS_LOLSeg);
|
||||||
EBX_reg(&ctx) = ALLDEV_OFS;
|
EBX_reg(&ctx) = DOS_DATASEG_OFF(req);
|
||||||
|
|
||||||
/* call strategy routine */
|
/* call strategy routine */
|
||||||
CS_reg(&ctx) = SELECTOROF(dev);
|
CS_reg(&ctx) = SELECTOROF(dev);
|
||||||
|
|
|
@ -174,13 +174,14 @@ static void DOSMEM_FillBiosSegments(void)
|
||||||
BIOSDATA *pBiosData = (BIOSDATA *)GlobalLock16( DOSMEM_BiosDataSeg );
|
BIOSDATA *pBiosData = (BIOSDATA *)GlobalLock16( DOSMEM_BiosDataSeg );
|
||||||
|
|
||||||
/* bogus 0xe0xx addresses !! Adapt int 0x10/0x1b if change needed */
|
/* bogus 0xe0xx addresses !! Adapt int 0x10/0x1b if change needed */
|
||||||
BYTE *pVideoStaticFuncTable = pBiosSys+0xe000;
|
VIDEOFUNCTIONALITY *pVidFunc = (VIDEOFUNCTIONALITY *)(pBiosSys+0xe000);
|
||||||
BYTE *pVideoStateInfo = pBiosSys+0xe010;
|
VIDEOSTATE *pVidState = (VIDEOSTATE *)(pBiosSys+0xe010);
|
||||||
BYTE *p;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Clear all unused values */
|
/* Clear all unused values */
|
||||||
memset( pBiosData, 0, sizeof(*pBiosData) );
|
memset( pBiosData, 0, sizeof(*pBiosData) );
|
||||||
|
memset( pVidFunc, 0, sizeof(*pVidFunc ) );
|
||||||
|
memset( pVidState, 0, sizeof(*pVidState) );
|
||||||
|
|
||||||
/* FIXME: should check the number of configured drives and ports */
|
/* FIXME: should check the number of configured drives and ports */
|
||||||
|
|
||||||
|
@ -210,7 +211,8 @@ static void DOSMEM_FillBiosSegments(void)
|
||||||
pBiosData->DiskDataRate = 0;
|
pBiosData->DiskDataRate = 0;
|
||||||
|
|
||||||
/* fill ROM configuration table (values from Award) */
|
/* fill ROM configuration table (values from Award) */
|
||||||
*(WORD *)(pBiosROMTable)= 0x08; /* number of bytes following */
|
*(pBiosROMTable+0x0) = 0x08; /* number of bytes following LO */
|
||||||
|
*(pBiosROMTable+0x1) = 0x00; /* number of bytes following HI */
|
||||||
*(pBiosROMTable+0x2) = 0xfc; /* model */
|
*(pBiosROMTable+0x2) = 0xfc; /* model */
|
||||||
*(pBiosROMTable+0x3) = 0x01; /* submodel */
|
*(pBiosROMTable+0x3) = 0x01; /* submodel */
|
||||||
*(pBiosROMTable+0x4) = 0x00; /* BIOS revision */
|
*(pBiosROMTable+0x4) = 0x00; /* BIOS revision */
|
||||||
|
@ -220,59 +222,46 @@ static void DOSMEM_FillBiosSegments(void)
|
||||||
*(pBiosROMTable+0x8) = 0x00; /* feature byte 4 */
|
*(pBiosROMTable+0x8) = 0x00; /* feature byte 4 */
|
||||||
*(pBiosROMTable+0x9) = 0x00; /* feature byte 5 */
|
*(pBiosROMTable+0x9) = 0x00; /* feature byte 5 */
|
||||||
|
|
||||||
p = pVideoStaticFuncTable;
|
|
||||||
for (i=0; i < 7; i++)
|
|
||||||
*(p+i) = 0xff; /* modes supported 1 to 7 */
|
|
||||||
|
|
||||||
*(p+0x7) = 7; /* scan lines supported */
|
for (i = 0; i < 7; i++)
|
||||||
*(p+0x8) = 0; /* tot nr of char blocks in text mode */
|
pVidFunc->ModeSupport[i] = 0xff;
|
||||||
*(p+0x9) = 0; /* max nr of active char blocks in text */
|
|
||||||
*(WORD *)(p+0xa) = 0x8ff; /* misc support flags */
|
pVidFunc->ScanlineSupport = 7;
|
||||||
*(WORD *)(p+0xc) = 0; /* reserved */
|
pVidFunc->NumberCharBlocks = 0;
|
||||||
*(p+0xe) = 0x3f; /* save pointer function flags */
|
pVidFunc->ActiveCharBlocks = 0;
|
||||||
*(p+0xf) = 0; /* reserved */
|
pVidFunc->MiscFlags = 0x8ff;
|
||||||
|
pVidFunc->SavePointerFlags = 0x3f;
|
||||||
|
|
||||||
p = pVideoStateInfo;
|
pVidState->StaticFuncTable = 0xf000e000; /* FIXME: always real mode ? */
|
||||||
*(DWORD *)p = 0xf000e000; /* address of pVideoStaticFuncTable, FIXME: always real mode ? */
|
pVidState->VideoMode = pBiosData->VideoMode; /* needs updates! */
|
||||||
*(p+0x04) = /* current video mode, needs updates ! */
|
pVidState->NumberColumns = pBiosData->VideoColumns; /* needs updates! */
|
||||||
pBiosData->VideoMode;
|
pVidState->RegenBufLen = 0;
|
||||||
*(WORD *)(p+0x05) = /* number of columns, needs updates ! */
|
pVidState->RegenBufAddr = 0;
|
||||||
pBiosData->VideoColumns;
|
|
||||||
*(WORD *)(p+0x07) = 0; /* length of regen (???) buffer in bytes */
|
for (i = 0; i < 8; i++)
|
||||||
*(WORD *)(p+0x09) = 0; /* starting address of regen (?) buffer */
|
pVidState->CursorPos[i] = 0;
|
||||||
*(WORD *)(p+0x0b) = 0; /* cursorpos page 0 */
|
|
||||||
*(WORD *)(p+0x0d) = 0; /* cursorpos page 1 */
|
pVidState->CursorType = 0x0a0b; /* start/end line */
|
||||||
*(WORD *)(p+0x0f) = 0; /* page 2 */
|
pVidState->ActivePage = 0;
|
||||||
*(WORD *)(p+0x11) = 0; /* page 3 */
|
pVidState->CRTCPort = 0x3da;
|
||||||
*(WORD *)(p+0x13) = 0; /* page 4 */
|
pVidState->Port3x8 = 0;
|
||||||
*(WORD *)(p+0x15) = 0; /* page 5 */
|
pVidState->Port3x9 = 0;
|
||||||
*(WORD *)(p+0x17) = 0; /* page 6 */
|
pVidState->NumberRows = 23; /* number of rows - 1 */
|
||||||
*(WORD *)(p+0x19) = 0; /* page 7 */
|
pVidState->BytesPerChar = 0x10;
|
||||||
*(WORD *)(p+0x1b) = 0x0a0b; /* cursor size (start/end line) */
|
pVidState->DCCActive = pBiosData->DisplayCombination;
|
||||||
*(p+0x1d) = 0; /* active display page */
|
pVidState->DCCAlternate = 0;
|
||||||
*(WORD *)(p+0x1e) = 0x3da; /* CRTC port address */
|
pVidState->NumberColors = 16;
|
||||||
*(p+0x20) = 0x0; /* current setting of port 0x3x8 */
|
pVidState->NumberPages = 1;
|
||||||
*(p+0x21) = 0x0; /* current setting of port 0x3x9 */
|
pVidState->NumberScanlines = 3; /* (0,1,2,3) = (200,350,400,480) */
|
||||||
*(p+0x22) = 23; /* number of rows - 1 */
|
pVidState->CharBlockPrimary = 0;
|
||||||
*(WORD *)(p+0x23) = 0x10; /* bytes/character */
|
pVidState->CharBlockSecondary = 0;
|
||||||
*(p+0x25) = /* comb. of active display */
|
pVidState->MiscFlags =
|
||||||
pBiosData->DisplayCombination;
|
(pBiosData->VGASettings & 0x0f)
|
||||||
*(p+0x26) = 0; /* DCC (???) of alternate display */
|
| ((pBiosData->ModeOptions & 1) << 4); /* cursor emulation */
|
||||||
*(WORD *)(p+0x27) = 16; /* number of colors in current mode */
|
pVidState->NonVGASupport = 0;
|
||||||
*(p+0x29) = 1; /* number of pages in current mode */
|
pVidState->VideoMem = (pBiosData->ModeOptions & 0x60 >> 5);
|
||||||
*(p+0x2a) = 3; /* number of scan lines active */
|
pVidState->SavePointerState = 0;
|
||||||
/* (0,1,2,3) = (200,350,400,480) */
|
pVidState->DisplayStatus = 4;
|
||||||
*(p+0x2b) = 0; /* primary character block (?) */
|
|
||||||
*(p+0x2c) = 0; /* secondary character block (?) */
|
|
||||||
*(p+0x2d) = /* miscellaneous flags */
|
|
||||||
(pBiosData->VGASettings & 0x0f)
|
|
||||||
| ((pBiosData->ModeOptions & 1) << 4); /* cursor emulation */
|
|
||||||
*(p+0x2e) = 0; /* non-VGA mode support */
|
|
||||||
*(WORD *)(p+0x2f) = 0; /* reserved */
|
|
||||||
*(p+0x31) = /* video memory available */
|
|
||||||
(pBiosData->ModeOptions & 0x60 >> 5);
|
|
||||||
*(p+0x32) = 0; /* save pointer state flags */
|
|
||||||
*(p+0x33) = 4; /* display info and status */
|
|
||||||
|
|
||||||
/* BIOS date string */
|
/* BIOS date string */
|
||||||
strcpy((char *)pBiosSys+0xfff5, "13/01/99");
|
strcpy((char *)pBiosSys+0xfff5, "13/01/99");
|
||||||
|
|
|
@ -495,7 +495,7 @@ static RMCB *DPMI_AllocRMCB( void )
|
||||||
the DPMI 0.9 spec states that if it doesn't, it will be called again */
|
the DPMI 0.9 spec states that if it doesn't, it will be called again */
|
||||||
*p++ = 0xeb;
|
*p++ = 0xeb;
|
||||||
*p++ = 0xfc; /* jmp RMCB */
|
*p++ = 0xfc; /* jmp RMCB */
|
||||||
#else
|
#elif defined(__i386__)
|
||||||
LPVOID RMCBmem = DOSMEM_GetBlock(0, 15, &uParagraph);
|
LPVOID RMCBmem = DOSMEM_GetBlock(0, 15, &uParagraph);
|
||||||
LPBYTE p = RMCBmem;
|
LPBYTE p = RMCBmem;
|
||||||
|
|
||||||
|
@ -508,6 +508,8 @@ static RMCB *DPMI_AllocRMCB( void )
|
||||||
*(WORD *)p = __get_cs();
|
*(WORD *)p = __get_cs();
|
||||||
p+=2;
|
p+=2;
|
||||||
*p++=0xc3; /* lret (FIXME?) */
|
*p++=0xc3; /* lret (FIXME?) */
|
||||||
|
#else
|
||||||
|
uParagraph = 0;
|
||||||
#endif
|
#endif
|
||||||
NewRMCB->address = MAKELONG(0, uParagraph);
|
NewRMCB->address = MAKELONG(0, uParagraph);
|
||||||
NewRMCB->next = FirstRMCB;
|
NewRMCB->next = FirstRMCB;
|
||||||
|
|
Loading…
Reference in New Issue