GetFPos (SC)

This commit is contained in:
Kelvin Sherlock 2013-05-18 00:00:47 -04:00
parent be3c728185
commit 722aa2e18a
3 changed files with 34 additions and 0 deletions

View File

@ -581,6 +581,35 @@ namespace OS
return d0;
}
uint16_t GetFPos(uint16_t trap)
{
uint32_t d0;
uint32_t parm = cpuGetAReg(0);
Log("%04x GetFPos(%08x)\n", trap, parm);
//uint32_t ioCompletion = memoryReadLong(parm + 12);
uint16_t ioRefNum = memoryReadWord(parm + 24);
int rv = ::lseek(ioRefNum, 0, SEEK_CUR);
if (rv < 0)
{
d0 = errno_to_oserr(errno);
}
else
{
memoryWriteLong(0, parm + 36); // ioReqCount
memoryWriteLong(0, parm + 40); // ioActCount
memoryWriteWord(0, parm + 44); // ioPosMode
memoryWriteLong(rv, parm + 46); // ioPosOffset
d0 = 0;
}
memoryWriteWord(d0, parm + 16);
return d0;
}
uint16_t SetFPos(uint16_t trap)
{
uint32_t d0;

View File

@ -46,6 +46,7 @@ namespace OS
uint16_t GetEOF(uint16_t trap);
uint16_t SetEOF(uint16_t trap);
uint16_t GetFPos(uint16_t trap);
uint16_t SetFPos(uint16_t trap);
uint16_t GetVol(uint16_t trap);

View File

@ -80,6 +80,10 @@ namespace ToolBox {
d0 = OS::HGetVol(trap);
break;
case 0xa018:
d0 = OS::GetFPos(trap);
break;
case 0xa044:
d0 = OS::SetFPos(trap);
break;