OS::Close

This commit is contained in:
Kelvin Sherlock 2013-02-25 17:34:25 -05:00
parent 1aa5c048ad
commit 9e6176001a
3 changed files with 29 additions and 0 deletions

View File

@ -273,6 +273,30 @@ namespace OS
return false;
}
uint16_t Close(uint16_t trap)
{
uint32_t d0;
uint32_t parm = cpuGetAReg(0);
Log("%04x Close(%08x)\n", trap, parm);
//uint32_t ioCompletion = memoryReadLong(parm + 12);
uint16_t ioRefNum = memoryReadWord(parm + 24);
int rv = ::close(ioRefNum);
if (rv < 0)
{
d0 = errno_to_oserr(errno);
}
else
{
d0 = 0;
}
memoryWriteWord(d0, parm + 16);
return d0;
}
uint16_t Create(uint16_t trap)

View File

@ -126,6 +126,7 @@ namespace OS
#pragma mark FS Utilities
uint16_t Close(uint16_t trap);
uint16_t Create(uint16_t trap);
uint16_t Delete(uint16_t trap);

View File

@ -34,6 +34,10 @@ namespace ToolBox {
d0 = OS::Open(trap);
break;
case 0xa001:
d0 = OS::Close(trap);
break;
case 0xa002:
d0 = OS::Read(trap);
break;