📄 fxinst.cpp
字号:
a = GSU.apvScreen[y >> 3] + GSU.x[x >> 3] + ((y & 7) << 1); v = 128 >> (x&7); DREG = 0; DREG |= ((uint32)((a[0] & v) != 0)) << 0; DREG |= ((uint32)((a[1] & v) != 0)) << 1; TESTR14;}/* 4c - plot - plot pixel with R1,R2 as x,y and the color register as the color */static void fx_plot_4bit(){ uint32 x = USEX8(R1); uint32 y = USEX8(R2); uint8 *a; uint8 v,c; R15++; CLRFLAGS; R1++; #ifdef CHECK_LIMITS if(y >= GSU.vScreenHeight) return;#endif if(GSU.vPlotOptionReg & 0x02) c = (x^y)&1 ? (uint8)(GSU.vColorReg>>4) : (uint8)GSU.vColorReg; else c = (uint8)GSU.vColorReg; if( !(GSU.vPlotOptionReg & 0x01) && !(c & 0xf)) return; a = GSU.apvScreen[y >> 3] + GSU.x[x >> 3] + ((y & 7) << 1); v = 128 >> (x&7); if(c & 0x01) a[0x00] |= v; else a[0x00] &= ~v; if(c & 0x02) a[0x01] |= v; else a[0x01] &= ~v; if(c & 0x04) a[0x10] |= v; else a[0x10] &= ~v; if(c & 0x08) a[0x11] |= v; else a[0x11] &= ~v;}/* 4c(ALT1) - rpix - read color of the pixel with R1,R2 as x,y */static void fx_rpix_4bit(){ uint32 x = USEX8(R1); uint32 y = USEX8(R2); uint8 *a; uint8 v; R15++; CLRFLAGS;#ifdef CHECK_LIMITS if(y >= GSU.vScreenHeight) return;#endif a = GSU.apvScreen[y >> 3] + GSU.x[x >> 3] + ((y & 7) << 1); v = 128 >> (x&7); DREG = 0; DREG |= ((uint32)((a[0x00] & v) != 0)) << 0; DREG |= ((uint32)((a[0x01] & v) != 0)) << 1; DREG |= ((uint32)((a[0x10] & v) != 0)) << 2; DREG |= ((uint32)((a[0x11] & v) != 0)) << 3; TESTR14;}/* 8c - plot - plot pixel with R1,R2 as x,y and the color register as the color */static void fx_plot_8bit(){ uint32 x = USEX8(R1); uint32 y = USEX8(R2); uint8 *a; uint8 v,c; R15++; CLRFLAGS; R1++; #ifdef CHECK_LIMITS if(y >= GSU.vScreenHeight) return;#endif c = (uint8)GSU.vColorReg; if(GSU.vPlotOptionReg & 0x10) if( !(GSU.vPlotOptionReg & 0x01) && !(c&0xf)) return; else if( !(GSU.vPlotOptionReg & 0x01) && !c) return; a = GSU.apvScreen[y >> 3] + GSU.x[x >> 3] + ((y & 7) << 1); v = 128 >> (x&7); if(c & 0x01) a[0x00] |= v; else a[0x00] &= ~v; if(c & 0x02) a[0x01] |= v; else a[0x01] &= ~v; if(c & 0x04) a[0x10] |= v; else a[0x10] &= ~v; if(c & 0x08) a[0x11] |= v; else a[0x11] &= ~v; if(c & 0x10) a[0x20] |= v; else a[0x20] &= ~v; if(c & 0x20) a[0x21] |= v; else a[0x21] &= ~v; if(c & 0x40) a[0x30] |= v; else a[0x30] &= ~v; if(c & 0x80) a[0x31] |= v; else a[0x31] &= ~v;}/* 4c(ALT1) - rpix - read color of the pixel with R1,R2 as x,y */static void fx_rpix_8bit(){ uint32 x = USEX8(R1); uint32 y = USEX8(R2); uint8 *a; uint8 v; R15++; CLRFLAGS;#ifdef CHECK_LIMITS if(y >= GSU.vScreenHeight) return;#endif a = GSU.apvScreen[y >> 3] + GSU.x[x >> 3] + ((y & 7) << 1); v = 128 >> (x&7); DREG = 0; DREG |= ((uint32)((a[0x00] & v) != 0)) << 0; DREG |= ((uint32)((a[0x01] & v) != 0)) << 1; DREG |= ((uint32)((a[0x10] & v) != 0)) << 2; DREG |= ((uint32)((a[0x11] & v) != 0)) << 3; DREG |= ((uint32)((a[0x20] & v) != 0)) << 4; DREG |= ((uint32)((a[0x21] & v) != 0)) << 5; DREG |= ((uint32)((a[0x30] & v) != 0)) << 6; DREG |= ((uint32)((a[0x31] & v) != 0)) << 7; TESTR14;}/* 4o - plot - plot pixel with R1,R2 as x,y and the color register as the color */static void fx_plot_obj(){ printf ("ERROR fx_plot_obj called\n");}/* 4c(ALT1) - rpix - read color of the pixel with R1,R2 as x,y */static void fx_rpix_obj(){ printf ("ERROR fx_rpix_obj called\n");}/* 4d - swap - swap upper and lower byte of a register */static void fx_swap(){ uint8 c = (uint8)SREG; uint8 d = (uint8)(SREG>>8); uint32 v = (((uint32)c)<<8)|((uint32)d); R15++; DREG = v; GSU.vSign = v; GSU.vZero = v; TESTR14; CLRFLAGS;}/* 4e - color - copy source register to color register */static void fx_color(){ uint8 c = (uint8)SREG; if(GSU.vPlotOptionReg & 0x04) c = (c&0xf0) | (c>>4); if(GSU.vPlotOptionReg & 0x08) { GSU.vColorReg &= 0xf0; GSU.vColorReg |= c & 0x0f; } else GSU.vColorReg = USEX8(c); CLRFLAGS; R15++;}/* 4e(ALT1) - cmode - set plot option register */static void fx_cmode(){ GSU.vPlotOptionReg = SREG; if(GSU.vPlotOptionReg & 0x10) { /* OBJ Mode (for drawing into sprites) */ GSU.vScreenHeight = 256; } else GSU.vScreenHeight = GSU.vScreenRealHeight; fx_computeScreenPointers (); CLRFLAGS; R15++;}/* 4f - not - perform exclusive exor with 1 on all bits */static void fx_not(){ uint32 v = ~SREG; R15++; DREG = v; GSU.vSign = v; GSU.vZero = v; TESTR14; CLRFLAGS;}/* 50-5f - add rn - add, register + register */#define FX_ADD(reg) \int32 s = SUSEX16(SREG) + SUSEX16(GSU.avReg[reg]); \GSU.vCarry = s >= 0x10000; \GSU.vOverflow = ~(SREG ^ GSU.avReg[reg]) & (GSU.avReg[reg] ^ s) & 0x8000; \GSU.vSign = s; \GSU.vZero = s; \R15++; DREG = s; \TESTR14; \CLRFLAGSstatic void fx_add_r0() { FX_ADD(0); }static void fx_add_r1() { FX_ADD(1); }static void fx_add_r2() { FX_ADD(2); }static void fx_add_r3() { FX_ADD(3); }static void fx_add_r4() { FX_ADD(4); }static void fx_add_r5() { FX_ADD(5); }static void fx_add_r6() { FX_ADD(6); }static void fx_add_r7() { FX_ADD(7); }static void fx_add_r8() { FX_ADD(8); }static void fx_add_r9() { FX_ADD(9); }static void fx_add_r10() { FX_ADD(10); }static void fx_add_r11() { FX_ADD(11); }static void fx_add_r12() { FX_ADD(12); }static void fx_add_r13() { FX_ADD(13); }static void fx_add_r14() { FX_ADD(14); }static void fx_add_r15() { FX_ADD(15); }/* 50-5f(ALT1) - adc rn - add with carry, register + register */#define FX_ADC(reg) \int32 s = SUSEX16(SREG) + SUSEX16(GSU.avReg[reg]) + SEX16(GSU.vCarry); \GSU.vCarry = s >= 0x10000; \GSU.vOverflow = ~(SREG ^ GSU.avReg[reg]) & (GSU.avReg[reg] ^ s) & 0x8000; \GSU.vSign = s; \GSU.vZero = s; \R15++; DREG = s; \TESTR14; \CLRFLAGSstatic void fx_adc_r0() { FX_ADC(0); }static void fx_adc_r1() { FX_ADC(1); }static void fx_adc_r2() { FX_ADC(2); }static void fx_adc_r3() { FX_ADC(3); }static void fx_adc_r4() { FX_ADC(4); }static void fx_adc_r5() { FX_ADC(5); }static void fx_adc_r6() { FX_ADC(6); }static void fx_adc_r7() { FX_ADC(7); }static void fx_adc_r8() { FX_ADC(8); }static void fx_adc_r9() { FX_ADC(9); }static void fx_adc_r10() { FX_ADC(10); }static void fx_adc_r11() { FX_ADC(11); }static void fx_adc_r12() { FX_ADC(12); }static void fx_adc_r13() { FX_ADC(13); }static void fx_adc_r14() { FX_ADC(14); }static void fx_adc_r15() { FX_ADC(15); }/* 50-5f(ALT2) - add #n - add, register + immediate */#define FX_ADD_I(imm) \int32 s = SUSEX16(SREG) + imm; \GSU.vCarry = s >= 0x10000; \GSU.vOverflow = ~(SREG ^ imm) & (imm ^ s) & 0x8000; \GSU.vSign = s; \GSU.vZero = s; \R15++; DREG = s; \TESTR14; \CLRFLAGSstatic void fx_add_i0() { FX_ADD_I(0); }static void fx_add_i1() { FX_ADD_I(1); }static void fx_add_i2() { FX_ADD_I(2); }static void fx_add_i3() { FX_ADD_I(3); }static void fx_add_i4() { FX_ADD_I(4); }static void fx_add_i5() { FX_ADD_I(5); }static void fx_add_i6() { FX_ADD_I(6); }static void fx_add_i7() { FX_ADD_I(7); }static void fx_add_i8() { FX_ADD_I(8); }static void fx_add_i9() { FX_ADD_I(9); }static void fx_add_i10() { FX_ADD_I(10); }static void fx_add_i11() { FX_ADD_I(11); }static void fx_add_i12() { FX_ADD_I(12); }static void fx_add_i13() { FX_ADD_I(13); }static void fx_add_i14() { FX_ADD_I(14); }static void fx_add_i15() { FX_ADD_I(15); }/* 50-5f(ALT3) - adc #n - add with carry, register + immediate */#define FX_ADC_I(imm) \int32 s = SUSEX16(SREG) + imm + SUSEX16(GSU.vCarry); \GSU.vCarry = s >= 0x10000; \GSU.vOverflow = ~(SREG ^ imm) & (imm ^ s) & 0x8000; \GSU.vSign = s; \GSU.vZero = s; \R15++; DREG = s; \TESTR14; \CLRFLAGSstatic void fx_adc_i0() { FX_ADC_I(0); }static void fx_adc_i1() { FX_ADC_I(1); }static void fx_adc_i2() { FX_ADC_I(2); }static void fx_adc_i3() { FX_ADC_I(3); }static void fx_adc_i4() { FX_ADC_I(4); }static void fx_adc_i5() { FX_ADC_I(5); }static void fx_adc_i6() { FX_ADC_I(6); }static void fx_adc_i7() { FX_ADC_I(7); }static void fx_adc_i8() { FX_ADC_I(8); }static void fx_adc_i9() { FX_ADC_I(9); }static void fx_adc_i10() { FX_ADC_I(10); }static void fx_adc_i11() { FX_ADC_I(11); }static void fx_adc_i12() { FX_ADC_I(12); }static void fx_adc_i13() { FX_ADC_I(13); }static void fx_adc_i14() { FX_ADC_I(14); }static void fx_adc_i15() { FX_ADC_I(15); }/* 60-6f - sub rn - subtract, register - register */#define FX_SUB(reg) \int32 s = SUSEX16(SREG) - SUSEX16(GSU.avReg[reg]); \GSU.vCarry = s >= 0; \GSU.vOverflow = (SREG ^ GSU.avReg[reg]) & (SREG ^ s) & 0x8000; \GSU.vSign = s; \GSU.vZero = s; \R15++; DREG = s; \TESTR14; \CLRFLAGSstatic void fx_sub_r0() { FX_SUB(0); }static void fx_sub_r1() { FX_SUB(1); }static void fx_sub_r2() { FX_SUB(2); }static void fx_sub_r3() { FX_SUB(3); }static void fx_sub_r4() { FX_SUB(4); }static void fx_sub_r5() { FX_SUB(5); }static void fx_sub_r6() { FX_SUB(6); }static void fx_sub_r7() { FX_SUB(7); }static void fx_sub_r8() { FX_SUB(8); }static void fx_sub_r9() { FX_SUB(9); }static void fx_sub_r10() { FX_SUB(10); }static void fx_sub_r11() { FX_SUB(11); }static void fx_sub_r12() { FX_SUB(12); }static void fx_sub_r13() { FX_SUB(13); }static void fx_sub_r14() { FX_SUB(14); }static void fx_sub_r15() { FX_SUB(15); }/* 60-6f(ALT1) - sbc rn - subtract with carry, register - register */#define FX_SBC(reg) \int32 s = SUSEX16(SREG) - SUSEX16(GSU.avReg[reg]) - (SUSEX16(GSU.vCarry^1)); \GSU.vCarry = s >= 0; \GSU.vOverflow = (SREG ^ GSU.avReg[reg]) & (SREG ^ s) & 0x8000; \GSU.vSign = s; \GSU.vZero = s; \R15++; DREG = s; \TESTR14; \CLRFLAGSstatic void fx_sbc_r0() { FX_SBC(0); }static void fx_sbc_r1() { FX_SBC(1); }static void fx_sbc_r2() { FX_SBC(2); }static void fx_sbc_r3() { FX_SBC(3); }static void fx_sbc_r4() { FX_SBC(4); }static void fx_sbc_r5() { FX_SBC(5); }static void fx_sbc_r6() { FX_SBC(6); }static void fx_sbc_r7() { FX_SBC(7); }static void fx_sbc_r8() { FX_SBC(8); }static void fx_sbc_r9() { FX_SBC(9); }static void fx_sbc_r10() { FX_SBC(10); }static void fx_sbc_r11() { FX_SBC(11); }static void fx_sbc_r12() { FX_SBC(12); }static void fx_sbc_r13() { FX_SBC(13); }static void fx_sbc_r14() { FX_SBC(14); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -