OS::GetEOF

This commit is contained in:
Kelvin Sherlock 2013-02-16 16:11:10 -05:00
parent 04114124ac
commit c7ccb62e6c
3 changed files with 38 additions and 0 deletions

View File

@ -207,6 +207,38 @@ namespace OS
return d0;
}
uint16_t GetEOF(uint16_t trap)
{
uint32_t d0;
size_t size;
uint32_t parm = cpuGetAReg(0);
fprintf(stderr, "%04x GetEOF(%08x)\n", trap, parm);
uint32_t ioCompletion = memoryReadLong(parm + 12);
uint16_t ioRefNum = memoryReadWord(parm + 24);
struct stat st;
if (::fstat(ioRefNum, &st) < 0)
{
d0 = errno_to_oserr(errno);
size = 0;
}
else
{
d0 = 0;
size = st.st_size;
}
memoryWriteWord(d0, parm + 16);
memoryWriteLong(size, parm + 28);
return d0;
}
// return the name of the default volume.
// this does not translate well.

View File

@ -110,6 +110,7 @@ namespace OS
uint16_t GetFileInfo(uint16_t trap);
uint16_t SetFileInfo(uint16_t trap);
uint16_t GetEOF(uint16_t trap);
uint16_t GetVol(uint16_t trap);
}

View File

@ -41,10 +41,15 @@ namespace ToolBox {
case 0xA00C:
d0 = OS::GetFileInfo(trap);
break;
case 0xa00d:
d0 = OS::SetFileInfo(trap);
break;
case 0xa011:
d0 = OS::GetEOF(trap);
break;
case 0xa014:
d0 = OS::GetVol(trap);
break;