mirror of
https://github.com/ksherlock/mpw.git
synced 2024-11-22 00:32:44 +00:00
Open/OpenRF should use the directory id / fs spec.
This commit is contained in:
parent
148b13cdf1
commit
a4e89626d5
@ -52,7 +52,7 @@
|
|||||||
#include "os_internal.h"
|
#include "os_internal.h"
|
||||||
#include "toolbox.h"
|
#include "toolbox.h"
|
||||||
#include "stackframe.h"
|
#include "stackframe.h"
|
||||||
|
#include "fs_spec.h"
|
||||||
|
|
||||||
using ToolBox::Log;
|
using ToolBox::Log;
|
||||||
|
|
||||||
@ -339,6 +339,31 @@ namespace OS
|
|||||||
|
|
||||||
uint16_t Open(uint16_t trap)
|
uint16_t Open(uint16_t trap)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
enum {
|
||||||
|
/* IOParam */
|
||||||
|
_qLink = 0,
|
||||||
|
_qType = 4,
|
||||||
|
_ioTrap = 6,
|
||||||
|
_ioCmdAddr = 8,
|
||||||
|
_ioCompletion = 12,
|
||||||
|
_ioResult = 16,
|
||||||
|
_ioNamePtr = 18,
|
||||||
|
_ioVRefNum = 22,
|
||||||
|
_ioRefNum = 24,
|
||||||
|
_ioVersNum = 26,
|
||||||
|
_ioPermssn = 27,
|
||||||
|
_ioMisc = 28,
|
||||||
|
_ioBuffer = 32,
|
||||||
|
_ioReqCount = 36,
|
||||||
|
_ioActCount = 40,
|
||||||
|
_ioPosMode = 44,
|
||||||
|
_ioPosOffset = 46,
|
||||||
|
|
||||||
|
_ioDirID = 48,
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
uint32_t d0;
|
uint32_t d0;
|
||||||
|
|
||||||
int fd;
|
int fd;
|
||||||
@ -348,25 +373,54 @@ namespace OS
|
|||||||
|
|
||||||
Log("%04x Open(%08x)\n", trap, parm);
|
Log("%04x Open(%08x)\n", trap, parm);
|
||||||
|
|
||||||
uint32_t namePtr = memoryReadLong(parm + 18);
|
uint32_t namePtr = memoryReadLong(parm + _ioNamePtr);
|
||||||
|
uint32_t ioDirID = memoryReadLong(parm + _ioDirID);
|
||||||
|
|
||||||
uint8_t ioPermission = memoryReadByte(parm + 27);
|
uint8_t ioPermission = memoryReadByte(parm + _ioPermssn);
|
||||||
|
|
||||||
std::string sname = ToolBox::ReadPString(namePtr, true);
|
std::string sname = ToolBox::ReadPString(namePtr, true);
|
||||||
|
sname = FSSpecManager::ExpandPath(sname, ioDirID);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fd = Internal::FDEntry::open(sname, ioPermission, false);
|
fd = Internal::FDEntry::open(sname, ioPermission, false);
|
||||||
d0 = fd < 0 ? fd : 0;
|
d0 = fd < 0 ? fd : 0;
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
{
|
{
|
||||||
memoryWriteWord(fd, parm + 24);
|
memoryWriteWord(fd, parm + _ioRefNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
memoryWriteWord(d0, parm + 16);
|
memoryWriteWord(d0, parm + _ioResult);
|
||||||
return d0;
|
return d0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t OpenRF(uint16_t trap)
|
uint16_t OpenRF(uint16_t trap)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
enum {
|
||||||
|
/* IOParam */
|
||||||
|
_qLink = 0,
|
||||||
|
_qType = 4,
|
||||||
|
_ioTrap = 6,
|
||||||
|
_ioCmdAddr = 8,
|
||||||
|
_ioCompletion = 12,
|
||||||
|
_ioResult = 16,
|
||||||
|
_ioNamePtr = 18,
|
||||||
|
_ioVRefNum = 22,
|
||||||
|
_ioRefNum = 24,
|
||||||
|
_ioVersNum = 26,
|
||||||
|
_ioPermssn = 27,
|
||||||
|
_ioMisc = 28,
|
||||||
|
_ioBuffer = 32,
|
||||||
|
_ioReqCount = 36,
|
||||||
|
_ioActCount = 40,
|
||||||
|
_ioPosMode = 44,
|
||||||
|
_ioPosOffset = 46,
|
||||||
|
|
||||||
|
_ioDirID = 48,
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
uint32_t d0;
|
uint32_t d0;
|
||||||
|
|
||||||
int fd;
|
int fd;
|
||||||
@ -376,20 +430,22 @@ namespace OS
|
|||||||
|
|
||||||
Log("%04x OpenRF(%08x)\n", trap, parm);
|
Log("%04x OpenRF(%08x)\n", trap, parm);
|
||||||
|
|
||||||
uint32_t namePtr = memoryReadLong(parm + 18);
|
uint32_t namePtr = memoryReadLong(parm + _ioNamePtr);
|
||||||
|
uint32_t ioDirID = memoryReadLong(parm + _ioDirID);
|
||||||
|
|
||||||
uint8_t ioPermission = memoryReadByte(parm + 27);
|
uint8_t ioPermission = memoryReadByte(parm + _ioPermssn);
|
||||||
|
|
||||||
std::string sname = ToolBox::ReadPString(namePtr, true);
|
std::string sname = ToolBox::ReadPString(namePtr, true);
|
||||||
|
sname = FSSpecManager::ExpandPath(sname, ioDirID);
|
||||||
|
|
||||||
fd = Internal::FDEntry::open(sname, ioPermission, true);
|
fd = Internal::FDEntry::open(sname, ioPermission, true);
|
||||||
d0 = fd < 0 ? fd : 0;
|
d0 = fd < 0 ? fd : 0;
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
{
|
{
|
||||||
memoryWriteWord(fd, parm + 24);
|
memoryWriteWord(fd, parm + _ioRefNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
memoryWriteWord(d0, parm + 16);
|
memoryWriteWord(d0, parm + _ioResult);
|
||||||
return d0;
|
return d0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user