mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-02-17 06:31:14 +00:00
Extend NativeOp count to 64 (6-bit value), aka fix NATIVE_FILLRECT opcpdes.
Translate NQD_{bitblt,fillrect,invrect} to direct native calls. Use Mac2HostAddr() for converting Mac base address to native.
This commit is contained in:
parent
8b40a7e721
commit
ba7bfc478e
@ -1696,7 +1696,7 @@ void NQD_invrect(uint32 p)
|
|||||||
// And perform the inversion
|
// And perform the inversion
|
||||||
const int bpp = bytes_per_pixel(ReadMacInt32(p + acclDestPixelSize));
|
const int bpp = bytes_per_pixel(ReadMacInt32(p + acclDestPixelSize));
|
||||||
const int dest_row_bytes = (int32)ReadMacInt32(p + acclDestRowBytes);
|
const int dest_row_bytes = (int32)ReadMacInt32(p + acclDestRowBytes);
|
||||||
uint8 *dest = (uint8 *)(ReadMacInt32(p + acclDestBaseAddr) + (dest_Y * dest_row_bytes) + (dest_X * bpp));
|
uint8 *dest = Mac2HostAddr(ReadMacInt32(p + acclDestBaseAddr) + (dest_Y * dest_row_bytes) + (dest_X * bpp));
|
||||||
width *= bpp;
|
width *= bpp;
|
||||||
switch (bpp) {
|
switch (bpp) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -1806,7 +1806,7 @@ void NQD_fillrect(uint32 p)
|
|||||||
// And perform the fill
|
// And perform the fill
|
||||||
const int bpp = bytes_per_pixel(ReadMacInt32(p + acclDestPixelSize));
|
const int bpp = bytes_per_pixel(ReadMacInt32(p + acclDestPixelSize));
|
||||||
const int dest_row_bytes = (int32)ReadMacInt32(p + acclDestRowBytes);
|
const int dest_row_bytes = (int32)ReadMacInt32(p + acclDestRowBytes);
|
||||||
uint8 *dest = (uint8 *)(ReadMacInt32(p + acclDestBaseAddr) + (dest_Y * dest_row_bytes) + (dest_X * bpp));
|
uint8 *dest = Mac2HostAddr(ReadMacInt32(p + acclDestBaseAddr) + (dest_Y * dest_row_bytes) + (dest_X * bpp));
|
||||||
width *= bpp;
|
width *= bpp;
|
||||||
switch (bpp) {
|
switch (bpp) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -1874,8 +1874,8 @@ void NQD_bitblt(uint32 p)
|
|||||||
if ((int32)ReadMacInt32(p + acclSrcRowBytes) > 0) {
|
if ((int32)ReadMacInt32(p + acclSrcRowBytes) > 0) {
|
||||||
const int src_row_bytes = (int32)ReadMacInt32(p + acclSrcRowBytes);
|
const int src_row_bytes = (int32)ReadMacInt32(p + acclSrcRowBytes);
|
||||||
const int dst_row_bytes = (int32)ReadMacInt32(p + acclDestRowBytes);
|
const int dst_row_bytes = (int32)ReadMacInt32(p + acclDestRowBytes);
|
||||||
uint8 *src = (uint8 *)ReadMacInt32(p + acclSrcBaseAddr) + (src_Y * src_row_bytes) + (src_X * bpp);
|
uint8 *src = Mac2HostAddr(ReadMacInt32(p + acclSrcBaseAddr) + (src_Y * src_row_bytes) + (src_X * bpp));
|
||||||
uint8 *dst = (uint8 *)ReadMacInt32(p + acclDestBaseAddr) + (dest_Y * dst_row_bytes) + (dest_X * bpp);
|
uint8 *dst = Mac2HostAddr(ReadMacInt32(p + acclDestBaseAddr) + (dest_Y * dst_row_bytes) + (dest_X * bpp));
|
||||||
for (int i = 0; i < height; i++) {
|
for (int i = 0; i < height; i++) {
|
||||||
memcpy(dst, src, width);
|
memcpy(dst, src, width);
|
||||||
src += src_row_bytes;
|
src += src_row_bytes;
|
||||||
@ -1885,8 +1885,8 @@ void NQD_bitblt(uint32 p)
|
|||||||
else {
|
else {
|
||||||
const int src_row_bytes = -(int32)ReadMacInt32(p + acclSrcRowBytes);
|
const int src_row_bytes = -(int32)ReadMacInt32(p + acclSrcRowBytes);
|
||||||
const int dst_row_bytes = -(int32)ReadMacInt32(p + acclDestRowBytes);
|
const int dst_row_bytes = -(int32)ReadMacInt32(p + acclDestRowBytes);
|
||||||
uint8 *src = (uint8 *)ReadMacInt32(p + acclSrcBaseAddr) + ((src_Y + height - 1) * src_row_bytes) + (src_X * bpp);
|
uint8 *src = Mac2HostAddr(ReadMacInt32(p + acclSrcBaseAddr) + ((src_Y + height - 1) * src_row_bytes) + (src_X * bpp));
|
||||||
uint8 *dst = (uint8 *)ReadMacInt32(p + acclDestBaseAddr) + ((dest_Y + height - 1) * dst_row_bytes) + (dest_X * bpp);
|
uint8 *dst = Mac2HostAddr(ReadMacInt32(p + acclDestBaseAddr) + ((dest_Y + height - 1) * dst_row_bytes) + (dest_X * bpp));
|
||||||
for (int i = height - 1; i >= 0; i--) {
|
for (int i = height - 1; i >= 0; i--) {
|
||||||
memcpy(dst, src, width);
|
memcpy(dst, src, width);
|
||||||
src -= src_row_bytes;
|
src -= src_row_bytes;
|
||||||
|
@ -225,14 +225,14 @@ void sheepshaver_cpu::init_decoder()
|
|||||||
static void NativeOp(int selector);
|
static void NativeOp(int selector);
|
||||||
|
|
||||||
/* NativeOp instruction format:
|
/* NativeOp instruction format:
|
||||||
+------------+--------------------------+--+----------+------------+
|
+------------+-------------------------+--+-----------+------------+
|
||||||
| 6 | |FN| OP | 2 |
|
| 6 | |FN| OP | 2 |
|
||||||
+------------+--------------------------+--+----------+------------+
|
+------------+-------------------------+--+-----------+------------+
|
||||||
0 5 |6 19 20 21 25 26 31
|
0 5 |6 18 19 20 25 26 31
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef bit_field< 20, 20 > FN_field;
|
typedef bit_field< 19, 19 > FN_field;
|
||||||
typedef bit_field< 21, 25 > NATIVE_OP_field;
|
typedef bit_field< 20, 25 > NATIVE_OP_field;
|
||||||
typedef bit_field< 26, 31 > EMUL_OP_field;
|
typedef bit_field< 26, 31 > EMUL_OP_field;
|
||||||
|
|
||||||
// Execute EMUL_OP routine
|
// Execute EMUL_OP routine
|
||||||
@ -362,6 +362,21 @@ bool sheepshaver_cpu::compile1(codegen_context_t & cg_context)
|
|||||||
dg.gen_invoke_T0_T1_T2((void (*)(uint32, uint32, uint32))check_load_invoc);
|
dg.gen_invoke_T0_T1_T2((void (*)(uint32, uint32, uint32))check_load_invoc);
|
||||||
compiled = true;
|
compiled = true;
|
||||||
break;
|
break;
|
||||||
|
case NATIVE_BITBLT:
|
||||||
|
dg.gen_load_T0_GPR(3);
|
||||||
|
dg.gen_invoke_T0((void (*)(uint32))NQD_bitblt);
|
||||||
|
compiled = true;
|
||||||
|
break;
|
||||||
|
case NATIVE_INVRECT:
|
||||||
|
dg.gen_load_T0_GPR(3);
|
||||||
|
dg.gen_invoke_T0((void (*)(uint32))NQD_invrect);
|
||||||
|
compiled = true;
|
||||||
|
break;
|
||||||
|
case NATIVE_FILLRECT:
|
||||||
|
dg.gen_load_T0_GPR(3);
|
||||||
|
dg.gen_invoke_T0((void (*)(uint32))NQD_fillrect);
|
||||||
|
compiled = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (FN_field::test(opcode)) {
|
if (FN_field::test(opcode)) {
|
||||||
if (compiled) {
|
if (compiled) {
|
||||||
|
@ -37,14 +37,14 @@
|
|||||||
|
|
||||||
|
|
||||||
/* NativeOp instruction format:
|
/* NativeOp instruction format:
|
||||||
+------------+--------------------------+--+----------+------------+
|
+------------+-------------------------+--+-----------+------------+
|
||||||
| 6 | |FN| OP | 2 |
|
| 6 | |FN| OP | 2 |
|
||||||
+------------+--------------------------+--+----------+------------+
|
+------------+-------------------------+--+-----------+------------+
|
||||||
0 5 |6 19 20 21 25 26 31
|
0 5 |6 18 19 20 25 26 31
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define POWERPC_NATIVE_OP(LR, OP) \
|
#define POWERPC_NATIVE_OP(FN, OP) \
|
||||||
(POWERPC_EMUL_OP | ((LR) << 11) | (((uint32)OP) << 6) | 2)
|
(POWERPC_EMUL_OP | ((FN) << 12) | (((uint32)OP) << 6) | 2)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the fake PowerPC opcode to handle specified native code
|
* Return the fake PowerPC opcode to handle specified native code
|
||||||
|
Loading…
x
Reference in New Issue
Block a user