static void dc_callvm_argFloat_mips_o32(DCCallVM* in_self, DCfloat x) { DCCallVM_mips_o32* self = (DCCallVM_mips_o32*)in_self; dcVecAppend(&self->mVecHead, &x, sizeof(DCfloat) ); if (self->mArgCount < 2) { #if defined(DC__Endian_LITTLE) self->mRegData.u[self->mArgCount].f[0] = x; #else self->mRegData.u[self->mArgCount].f[1] = x; #endif #if 0 self->mRegData.u[self->mArgCount].f[1] = x; call kernel mips: lwc1 $f12, 4($5) <--- byte offset 4 lwc1 $f13, 0($5) lwc1 $f14, 12($5) <--- byte offset 12 lwc1 $f15, 8($5) mipsel: lwc1 $f12, 0($5) <--- byte offset 4 lwc1 $f13, 4($5) lwc1 $f14, 8($5) <--- byte offset 12 lwc1 $f15, 12($5) #if defined(DC__Endian_LITTLE) /* index 0 and 2 */ self->mRegData.floats[self->mArgCount*2] = x; #else /* index 1 and 3 */ self->mRegData.floats[self->mArgCount*2+1] = x; #endif #endif }
asm void bsp_flash_init( void ) { extern uint32_t _internal_ram_end; enum { BIUCR = 0xC3F8801Cul }; nofralloc mflr r7 /**< no stack available here */ lis r5, __set_value@h /**< __set_value fcall - source */ ori r5, r5, __set_value@l /**< __set_value fcall - dest */ lis r6, _internal_ram_end@h ori r6, r6, (_internal_ram_end-sizeof(__set_value))@l /**< unrolled copy */ lwz r4, 0(r5) /**< __set_value[0] */ stw r4, 0(r6) lwz r4, 4(r5) /**< __set_value[1] */ stw r4, 4(r6) lwz r4, 8(r5) /**< __set_value[2] */ stw r4, 8(r6) lwz r4, 12(r5) /**< __set_value[3] */ stw r4, 12(r6) lis r4, BIUCR@h /**< BIUCR (base) */ ori r4, r4, BIUCR@l /* */ lis r3, 0x0001 /**< 82MHz operation, I+D prefetch*/ ori r3, r3, 0x6B55 /* enabled */ xor r5, r5, r5 /**< BIUCR+0=BIUCR */ mtlr r6 /**< addr of __set_value() */ blrl lis r3, (3<<14) /**< 3 buf inst, 1 buf data */ li r5, 8 /**< BIUCR+8=BIUCR2 */ mtlr r6 /**< addr of __set_value() */ blrl xor r3, r3, r3 /**< NO prefetching on Bank1 */ li r5, 12 /**< BIUCR+12=PFCR3 */ mtlr r6 /**< addr of __set_value() */ blrl mtlr r7 blr }
void transCALL(FILE *f, WORD p, WORD q) { transBase(f,p); fprintf(f,"\ addi $sp, $sp, -16\n\ sw $s2, 0($sp)\n\ sw $s0, 8($sp)\n\ addi $s0, $sp, 12\n\ addi $sp, $sp, 16\n\ jal label%d\n",q); }
// Files void LoadToVRAM(const char* filename, u16 x, u16 y) { filename; x; y; //subRom.SX = (u16)filename; //subRom.SY = 0; //subRom.DX = x; //subRom.DY = y; //subRom.NX = 0; //subRom.NY = 0; //subRom.CLR = 0; //subRom.ARG = 0; //subRom.CMD = 0; #define EXTROM #0x015F #define BLTVD #0x019D #define SX #0xF562 // X-coordinate of the source #define SY #0xF564 // Y-coordinate of the source #define DX #0xF566 // X-coordinate of the destination #define DY #0xF568 // Y-coordinate of the destination #define NX #0xF56A // number of dots in the X direction #define NY #0xF56C // number of dots in the Y direction #define CDUMMY #0xF56E // dummy (not required to be set) #define ARG #0xF56F // selects the direction and expansion RAM (same as VDP R#45) #define LOGOP #0xF570 // logical operation code (same as the logical operation code of VDP) __asm ;// Init data ld l,4(ix) ld h,5(ix) ld (SX), hl ld l,6(ix) ld h,7(ix) ld (DX), hl ld l,8(ix) ld h,9(ix) ld (DY), hl xor a ld (ARG), a ;// ARG doit toujours être mis à zéro !!! ld (LOGOP), a ;// Idem LOGOP ;// Call BLTVD function di ld hl, #0xF562 ld ix, BLTVD call EXTROM ei __endasm; }
static void dc_callvm_argFloat_mips_o32(DCCallVM* in_self, DCfloat x) { DCCallVM_mips_o32* self = (DCCallVM_mips_o32*)in_self; dcVecAppend(&self->mVecHead, &x, sizeof(DCfloat)); #if defined(DC__ABI_HARDFLOAT) if (self->mArgCount < 2) { /* @@@ unsure if we should zero init, here; seems to work as-is */ # if defined(DC__Endian_LITTLE) self->mRegData.u[self->mArgCount].f[0] = x; # else self->mRegData.u[self->mArgCount].f[1] = x; // floats in regs always right justified # endif # if 0 self->mRegData.u[self->mArgCount].f[1] = x; call kernel mips: lwc1 $f12, 4($5) <--- byte offset 4 lwc1 $f13, 0($5) lwc1 $f14, 12($5) <--- byte offset 12 lwc1 $f15, 8($5) mipsel: lwc1 $f12, 0($5) <--- byte offset 4 lwc1 $f13, 4($5) lwc1 $f14, 8($5) <--- byte offset 12 lwc1 $f15, 12($5) # if defined(DC__Endian_LITTLE) /* index 0 and 2 */ self->mRegData.floats[self->mArgCount*2] = x; # else /* index 1 and 3 */ self->mRegData.floats[self->mArgCount*2+1] = x; # endif # endif }
} extern "C" void abort (void); int glob = 0; int other (); extern "C" int stubfn (); int localfn () { return other (); } asm void foo(int arg) { nofralloc mflr r0 stmw r30,(-8)(r1) stw r0,8(r1) stwu r1,(-80)(r1) bl stubfn addi r1,r1,80 lwz r0,8(r1) lmw r30,(-8)(r1) mtlr r0 b localfn } void bar (int arg) { stubfn (); localfn (); }
} // ----------------------------------------------------------------------- // This function handles IRQ's for the P6502 by jumping to the address // at 0xFFFE. asm void N6502::_IRQ() { lbz r5,_F(r3) andi. r7,r5,I_FLAG bnelr // save regs stw r24,-4(SP) stw r25,-8(SP) stw r27,-12(SP) lwz r8,_MEM_X(r3) lbz r6,_SP(r3) // setup regs for _PUSHB macro lwz r27,RAMSeg1_Ind(r8) addi r25,r6,0x100 lhz r24,_PC(r3) li r9,D_FLAG srwi r7,r24,8 // push pc,flags li r8,B_FLAG _pushb (r7) not r8,r8 not r9,r9 _pushb (r24)