revert changes from r29 - no longer necessary

This commit is contained in:
dborth 2009-05-07 04:56:59 +00:00
parent bc3863ebf4
commit bd8e629a05
2 changed files with 48 additions and 77 deletions

View File

@ -286,19 +286,19 @@ public:
void SaveVectors (void); void SaveVectors (void);
void RestoreVectors (void); void RestoreVectors (void);
void SetSize (Bit16u size) { SaveIt(2,0x02,size); /*sSave(sPSP,next_seg,size);*/ }; void SetSize (Bit16u size) { sSave(sPSP,next_seg,size); };
Bit16u GetSize (void) { return (Bit16u)GetIt(2,0x02); /*sGet(sPSP,next_seg);*/ }; Bit16u GetSize (void) { return (Bit16u)sGet(sPSP,next_seg); };
void SetEnvironment (Bit16u envseg) { SaveIt(2,0x2c,envseg);/*sSave(sPSP,environment,envseg);*/ }; void SetEnvironment (Bit16u envseg) { sSave(sPSP,environment,envseg); };
Bit16u GetEnvironment (void) { return (Bit16u)GetIt(2,0x2c);/*return (Bit16u)sGet(sPSP,environment);*/ }; Bit16u GetEnvironment (void) { return (Bit16u)sGet(sPSP,environment); };
Bit16u GetSegment (void) { return seg; }; Bit16u GetSegment (void) { return seg; };
void SetFileHandle (Bit16u index, Bit8u handle); void SetFileHandle (Bit16u index, Bit8u handle);
Bit8u GetFileHandle (Bit16u index); Bit8u GetFileHandle (Bit16u index);
void SetParent (Bit16u parent) { SaveIt(2,0x16,parent); /*sSave(sPSP,psp_parent,parent);*/ }; void SetParent (Bit16u parent) { sSave(sPSP,psp_parent,parent); };
Bit16u GetParent (void) { return (Bit16u)GetIt(2,0x16);/*sGet(sPSP,psp_parent);*/ }; Bit16u GetParent (void) { return (Bit16u)sGet(sPSP,psp_parent); };
void SetStack (RealPt stackpt) { SaveIt(4,0x2e,stackpt); /*sSave(sPSP,stack,stackpt);*/ }; void SetStack (RealPt stackpt) { sSave(sPSP,stack,stackpt); };
RealPt GetStack (void) { return GetIt(4,0x2e);/*sGet(sPSP,stack);*/ }; RealPt GetStack (void) { return sGet(sPSP,stack); };
void SetInt22 (RealPt int22pt) { SaveIt(4,0x0A,int22pt);/*sSave(sPSP,int_22,int22pt);*/ }; void SetInt22 (RealPt int22pt) { sSave(sPSP,int_22,int22pt); };
RealPt GetInt22 (void) { return GetIt(4,0x0A); /*sGet(sPSP,int_22);*/ }; RealPt GetInt22 (void) { return sGet(sPSP,int_22); };
void SetFCB1 (RealPt src); void SetFCB1 (RealPt src);
void SetFCB2 (RealPt src); void SetFCB2 (RealPt src);
void SetCommandTail (RealPt src); void SetCommandTail (RealPt src);

View File

@ -175,45 +175,32 @@ void DOS_PSP::MakeNew(Bit16u mem_size) {
// DOS_PSP prevpsp(dos.psp()); // DOS_PSP prevpsp(dos.psp());
/* Clear it first */ /* Clear it first */
Bitu i; Bitu i;
for (i=0;i<0x100;i++) mem_writeb(pt+i,0); for (i=0;i<sizeof(sPSP);i++) mem_writeb(pt+i,0);
// Set size // Set size
SaveIt(2,0x02,seg+mem_size); sSave(sPSP,next_seg,seg+mem_size);
//sSave(sPSP,next_seg,seg+mem_size);
/* far call opcode */ /* far call opcode */
SaveIt(1,0x05,0xea); sSave(sPSP,far_call,0xea);
//sSave(sPSP,far_call,0xea);
// far call to interrupt 0x21 - faked for bill & ted // far call to interrupt 0x21 - faked for bill & ted
// lets hope nobody really uses this address // lets hope nobody really uses this address
SaveIt(4,0x06,RealMake(0xDEAD,0xFFFF)); sSave(sPSP,cpm_entry,RealMake(0xDEAD,0xFFFF));
//sSave(sPSP,cpm_entry,RealMake(0xDEAD,0xFFFF));
/* Standard blocks,int 20 and int21 retf */ /* Standard blocks,int 20 and int21 retf */
SaveIt(1,0x00,0xcd); // INT... sSave(sPSP,exit[0],0xcd);
//sSave(sPSP,exit[0],0xcd); sSave(sPSP,exit[1],0x20);
SaveIt(1,0x01,0x20); // ...20H sSave(sPSP,service[0],0xcd);
//sSave(sPSP,exit[1],0x20); sSave(sPSP,service[1],0x21);
SaveIt(1,0x50,0xcd); // INT sSave(sPSP,service[2],0xcb);
SaveIt(1,0x51,0x21); // ...21H
SaveIt(1,0x52,0xcb); // RETF
//sSave(sPSP,service[0],0xcd);
//sSave(sPSP,service[1],0x21);
//sSave(sPSP,service[2],0xcb);
/* psp and psp-parent */ /* psp and psp-parent */
SaveIt(2,0x16,dos.psp()); sSave(sPSP,psp_parent,dos.psp());
SaveIt(4,0x38,0xffffffff); sSave(sPSP,prev_psp,0xffffffff);
SaveIt(2,0x40,0x0005); sSave(sPSP,dos_version,0x0005);
//sSave(sPSP,psp_parent,dos.psp());
//sSave(sPSP,prev_psp,0xffffffff);
//sSave(sPSP,dos_version,0x0005);
/* terminate 22,break 23,crititcal error 24 address stored */ /* terminate 22,break 23,crititcal error 24 address stored */
SaveVectors(); SaveVectors();
/* FCBs are filled with 0 */ /* FCBs are filled with 0 */
// .... // ....
/* Init file pointer and max_files */ /* Init file pointer and max_files */
SaveIt(4,0x34,RealMake(seg,offsetof(sPSP,files))); sSave(sPSP,file_table,RealMake(seg,offsetof(sPSP,files)));
//sSave(sPSP,file_table,RealMake(seg,offsetof(sPSP,files))); sSave(sPSP,max_files,20);
SaveIt(2,0x32,20);
//sSave(sPSP,max_files,20);
for (i=0;i<20;i++) SetFileHandle(i,0xff); for (i=0;i<20;i++) SetFileHandle(i,0xff);
/* User Stack pointer */ /* User Stack pointer */
@ -223,35 +210,29 @@ void DOS_PSP::MakeNew(Bit16u mem_size) {
} }
Bit8u DOS_PSP::GetFileHandle(Bit16u index) { Bit8u DOS_PSP::GetFileHandle(Bit16u index) {
if (index>=GetIt(2,0x32)) return 0xff; if (index>=sGet(sPSP,max_files)) return 0xff;
PhysPt files=Real2Phys(GetIt(4,0x34)); PhysPt files=Real2Phys(sGet(sPSP,file_table));
/*if (index>=sGet(sPSP,max_files)) return 0xff;
PhysPt files=Real2Phys(sGet(sPSP,file_table));*/
return mem_readb(files+index); return mem_readb(files+index);
} }
void DOS_PSP::SetFileHandle(Bit16u index, Bit8u handle) { void DOS_PSP::SetFileHandle(Bit16u index, Bit8u handle) {
if (index<GetIt(2,0x32)) { if (index<sGet(sPSP,max_files)) {
PhysPt files=Real2Phys(GetIt(4,0x34));
mem_writeb(files+index,handle);
}
/*if (index<sGet(sPSP,max_files)) {
PhysPt files=Real2Phys(sGet(sPSP,file_table)); PhysPt files=Real2Phys(sGet(sPSP,file_table));
mem_writeb(files+index,handle); mem_writeb(files+index,handle);
}*/ }
} }
Bit16u DOS_PSP::FindFreeFileEntry(void) { Bit16u DOS_PSP::FindFreeFileEntry(void) {
PhysPt files=Real2Phys(GetIt(4,0x34)); PhysPt files=Real2Phys(sGet(sPSP,file_table));
for (Bit16u i=0;i<GetIt(2,0x32);i++) { for (Bit16u i=0;i<sGet(sPSP,max_files);i++) {
if (mem_readb(files+i)==0xff) return i; if (mem_readb(files+i)==0xff) return i;
} }
return 0xff; return 0xff;
} }
Bit16u DOS_PSP::FindEntryByHandle(Bit8u handle) { Bit16u DOS_PSP::FindEntryByHandle(Bit8u handle) {
PhysPt files=Real2Phys(GetIt(4,0x34)); PhysPt files=Real2Phys(sGet(sPSP,file_table));
for (Bit16u i=0;i<GetIt(2,0x32);i++) { for (Bit16u i=0;i<sGet(sPSP,max_files);i++) {
if (mem_readb(files+i)==handle) return i; if (mem_readb(files+i)==handle) return i;
} }
return 0xFF; return 0xFF;
@ -282,47 +263,40 @@ void DOS_PSP::CopyFileTable(DOS_PSP* srcpsp,bool createchildpsp) {
} }
void DOS_PSP::CloseFiles(void) { void DOS_PSP::CloseFiles(void) {
for (Bit16u i=0;i<GetIt(2,0x32);i++) { for (Bit16u i=0;i<sGet(sPSP,max_files);i++) {
DOS_CloseFile(i); DOS_CloseFile(i);
} }
} }
void DOS_PSP::SaveVectors(void) { void DOS_PSP::SaveVectors(void) {
/* Save interrupt 22,23,24 */ /* Save interrupt 22,23,24 */
SaveIt(4,0x0A,RealGetVec(0x22)); sSave(sPSP,int_22,RealGetVec(0x22));
SaveIt(4,0x0E,RealGetVec(0x23)); sSave(sPSP,int_23,RealGetVec(0x23));
SaveIt(4,0x12,RealGetVec(0x24)); sSave(sPSP,int_24,RealGetVec(0x24));
//sSave(sPSP,int_22,RealGetVec(0x22));
//sSave(sPSP,int_23,RealGetVec(0x23));
//sSave(sPSP,int_24,RealGetVec(0x24));
} }
void DOS_PSP::RestoreVectors(void) { void DOS_PSP::RestoreVectors(void) {
/* Restore interrupt 22,23,24 */ /* Restore interrupt 22,23,24 */
RealSetVec(0x22,GetIt(4,0x0A)); RealSetVec(0x22,sGet(sPSP,int_22));
RealSetVec(0x23,GetIt(4,0x0E)); RealSetVec(0x23,sGet(sPSP,int_23));
RealSetVec(0x24,GetIt(4,0x12)); RealSetVec(0x24,sGet(sPSP,int_24));
//RealSetVec(0x22,sGet(sPSP,int_22));
//RealSetVec(0x23,sGet(sPSP,int_23));
//RealSetVec(0x24,sGet(sPSP,int_24));
} }
void DOS_PSP::SetCommandTail(RealPt src) { void DOS_PSP::SetCommandTail(RealPt src) {
if (src) { // valid source if (src) { // valid source
MEM_BlockCopy(pt+128,Real2Phys(src),128); MEM_BlockCopy(pt+offsetof(sPSP,cmdtail),Real2Phys(src),128);
} else { // empty } else { // empty
SaveIt(1,128,0); sSave(sPSP,cmdtail.count,0x00);
mem_writeb(pt+129,0x0d); mem_writeb(pt+offsetof(sPSP,cmdtail.buffer),0x0d);
}; };
} }
void DOS_PSP::SetFCB1(RealPt src) { void DOS_PSP::SetFCB1(RealPt src) {
if (src) MEM_BlockCopy(PhysMake(seg,0x5c),Real2Phys(src),16); if (src) MEM_BlockCopy(PhysMake(seg,offsetof(sPSP,fcb1)),Real2Phys(src),16);
} }
void DOS_PSP::SetFCB2(RealPt src) { void DOS_PSP::SetFCB2(RealPt src) {
if (src) MEM_BlockCopy(PhysMake(seg,0x6c),Real2Phys(src),16); if (src) MEM_BlockCopy(PhysMake(seg,offsetof(sPSP,fcb2)),Real2Phys(src),16);
} }
bool DOS_PSP::SetNumFiles(Bit16u fileNum) { bool DOS_PSP::SetNumFiles(Bit16u fileNum) {
@ -331,16 +305,13 @@ bool DOS_PSP::SetNumFiles(Bit16u fileNum) {
fileNum+=2; // Add a few more files for safety fileNum+=2; // Add a few more files for safety
Bit16u para = (fileNum/16)+((fileNum%16)>0); Bit16u para = (fileNum/16)+((fileNum%16)>0);
RealPt data = RealMake(DOS_GetMemory(para),0); RealPt data = RealMake(DOS_GetMemory(para),0);
SaveIt(4,0x34,data); sSave(sPSP,file_table,data);
//sSave(sPSP,file_table,data); sSave(sPSP,max_files,fileNum);
SaveIt(2,0x32,fileNum);
//sSave(sPSP,max_files,fileNum);
Bit16u i; Bit16u i;
for (i=0; i<20; i++) SetFileHandle(i,GetIt(1,0x18+i*1)/*sGet(sPSP,files[i])*/); for (i=0; i<20; i++) SetFileHandle(i,sGet(sPSP,files[i]));
for (i=20; i<fileNum; i++) SetFileHandle(i,0xFF); for (i=20; i<fileNum; i++) SetFileHandle(i,0xFF);
} else { } else {
SaveIt(2,0x32,fileNum); sSave(sPSP,max_files,fileNum);
//sSave(sPSP,max_files,fileNum);
}; };
return true; return true;
} }