mpw/toolbox/rm.cpp

97 lines
1.5 KiB
C++
Raw Normal View History

2013-02-06 23:44:12 -05:00
#include "rm.h"
2013-02-13 23:07:33 -05:00
#include "toolbox.h"
2013-02-06 23:44:12 -05:00
#include <cpu/defs.h>
#include <cpu/CpuModule.h>
#include <cpu/fmem.h>
#include <string>
2013-02-15 20:42:20 -05:00
#include "stackframe.h"
2013-02-06 23:44:12 -05:00
2013-02-16 18:51:28 -05:00
using ToolBox::Log;
2013-02-06 23:44:12 -05:00
namespace RM
{
2013-02-07 22:12:30 -05:00
uint16_t Get1NamedResource(uint16_t trap)
2013-02-06 23:44:12 -05:00
{
// Get1NamedResource (theType: ResType; name: Str255) : Handle;
/*
* -----------
* +8 outHandle
* ------------
* +4 theType
* ------------
* +0 name
* ------------
*
*/
// nb - return address is not on the stack.
uint32_t sp;
uint32_t theType;
uint32_t name;
2013-02-15 20:42:20 -05:00
sp = StackFrame<8>(theType, name);
2013-02-06 23:44:12 -05:00
2013-02-13 23:07:33 -05:00
std::string sname = ToolBox::ReadPString(name);
2013-02-06 23:44:12 -05:00
2013-02-16 18:51:28 -05:00
Log("%04x Get1NamedResource(%08x, %s)\n", trap, theType, sname.c_str());
2013-02-06 23:44:12 -05:00
2013-02-15 20:42:20 -05:00
ToolReturn<4>(sp, 0);
2013-02-07 19:21:47 -05:00
return -192;
2013-02-06 23:44:12 -05:00
}
2013-02-13 23:07:33 -05:00
uint16_t GetResource(uint16_t trap)
{
// GetResource (theType: ResType; theID: Integer): Handle;
/*
* -----------
* +6 outHandle
* ------------
* +2 theType
* ------------
* +0 theID
* ------------
*
*/
// nb - return address is not on the stack.
uint32_t sp;
uint32_t theType;
uint16_t theID;
2013-02-15 20:42:20 -05:00
sp = StackFrame<6>(theType, theID);
2013-02-13 23:07:33 -05:00
2013-02-16 18:51:28 -05:00
Log("%04x GetResource(%08x, %04x)\n", trap, theType, theID);
2013-02-13 23:07:33 -05:00
2013-02-15 20:42:20 -05:00
ToolReturn<4>(sp, 0);
2013-02-13 23:07:33 -05:00
return -192;
}
2013-02-15 20:42:20 -05:00
uint16_t UnloadSeg(uint16_t trap)
{
// UnloadSeg (routineAddr: Ptr);
/*
* ------------
* +0 routineAddr
* ------------
*
*/
uint32_t sp;
uint32_t routineAddr;
sp = StackFrame<4>(routineAddr);
2013-02-16 18:51:28 -05:00
Log("%04x UnloadSeg(%08x)\n", trap, routineAddr);
2013-02-15 20:42:20 -05:00
return 0;
}
2013-02-06 23:44:12 -05:00
}