70
70
if (GetScrapFlavorSize(theScrap, type, &byteCount) == noErr) {
72
// Get the native clipboard data
73
uint8 *data = new uint8[byteCount];
74
if (GetScrapFlavorData(theScrap, type, &byteCount, data) == noErr) {
77
// Add new data to clipboard
78
static uint16 proc[] = {
79
0x598f, // subq.l #4,sp
80
0xa9fc, // ZeroScrap()
81
0x2f3c, 0, 0, // move.l #length,-(sp)
82
0x2f3c, 0, 0, // move.l #type,-(sp)
83
0x2f3c, 0, 0, // move.l #outbuf,-(sp)
85
0x588f, // addq.l #4,sp
88
uint32 proc_area = (uint32)proc;
89
WriteMacInt32(proc_area + 6, byteCount);
90
WriteMacInt32(proc_area + 12, type);
91
WriteMacInt32(proc_area + 18, (uint32)data);
92
we_put_this_data = true;
93
Execute68k(proc_area, &r);
72
// Allocate space for new scrap in MacOS side
75
Execute68kTrap(0xa71e, &r); // NewPtrSysClear()
76
uint32 scrap_area = r.a[0];
78
// Get the native clipboard data
80
uint8 * const data = Mac2HostAddr(scrap_area);
81
if (GetScrapFlavorData(theScrap, type, &byteCount, data) == noErr) {
83
// Add new data to clipboard
84
static uint8 proc[] = {
85
0x59, 0x8f, // subq.l #4,sp
86
0xa9, 0xfc, // ZeroScrap()
87
0x2f, 0x3c, 0, 0, 0, 0, // move.l #length,-(sp)
88
0x2f, 0x3c, 0, 0, 0, 0, // move.l #type,-(sp)
89
0x2f, 0x3c, 0, 0, 0, 0, // move.l #outbuf,-(sp)
90
0xa9, 0xfe, // PutScrap()
91
0x58, 0x8f, // addq.l #4,sp
92
M68K_RTS >> 8, M68K_RTS
94
r.d[0] = sizeof(proc);
95
Execute68kTrap(0xa71e, &r); // NewPtrSysClear()
96
uint32 proc_area = r.a[0];
99
Host2Mac_memcpy(proc_area, proc, sizeof(proc));
100
WriteMacInt32(proc_area + 6, byteCount);
101
WriteMacInt32(proc_area + 12, type);
102
WriteMacInt32(proc_area + 18, scrap_area);
103
we_put_this_data = true;
104
Execute68k(proc_area, &r);
107
Execute68kTrap(0xa01f, &r); // DisposePtr
112
Execute68kTrap(0xa01f, &r); // DisposePtr