1
0
Fork 0

MCB structure now endian safe

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@613
This commit is contained in:
Sjoerd van der Berg 2002-12-31 13:26:23 +00:00
parent 4376052e99
commit ec8b4e3ec2

View file

@ -29,14 +29,6 @@ struct CommandTail{
} GCC_ATTRIBUTE(packed);
struct MCB {
Bit8u type;
Bit16u psp_segment;
Bit16u size;
Bit8u unused[3];
Bit8u filename[8];
} GCC_ATTRIBUTE(packed);
#pragma pack ()
struct DOS_Date {
@ -419,10 +411,32 @@ private:
#pragma pack ()
};
class DOS_MCB : public MemStruct{
public:
DOS_MCB(Bit16u seg) { SetPt(seg); }
void SetFileName(char * _name) { MEM_BlockWrite(pt+offsetof(sMCB,filename),_name,8); }
void GetFileName(char * _name) { MEM_BlockRead(pt+offsetof(sMCB,filename),_name,8);_name[8]=0;}
void SetType(Bit8u _type) { sSave(sMCB,type,_type);}
void SetSize(Bit16u _size) { sSave(sMCB,size,_size);}
void SetPSPSeg(Bit16u _pspseg) { sSave(sMCB,psp_segment,_pspseg);}
Bit8u GetType(void) { return sGet(sMCB,type);}
Bit16u GetSize(void) { return sGet(sMCB,size);}
Bit16u GetPSPSeg(void) { return sGet(sMCB,psp_segment);}
private:
#pragma pack (1)
struct sMCB {
Bit8u type;
Bit16u psp_segment;
Bit16u size;
Bit8u unused[3];
Bit8u filename[8];
} GCC_ATTRIBUTE(packed);
#pragma pack ()
};
extern DOS_InfoBlock dos_infoblock;;
INLINE Bit8u RealHandle(Bit16u handle) {
DOS_PSP psp(dos.psp);
return psp.GetFileHandle(handle);
}