*/
//NOTE: The way to fix the CD BIOS is to uncomment below and comment the stuff after
// the phrase mode mucking around. But it fucks up everything else...
-#define SCREWY_CD_DEPENDENT
+//#define SCREWY_CD_DEPENDENT
#ifdef SCREWY_CD_DEPENDENT
a1_x += a1_step_x;
a1_y += a1_step_y;
{
gd_c[0] = blitter_ram[PATTERNDATA + 6];
gd_i[0] = ((uint32)blitter_ram[PATTERNDATA + 7] << 16)
- | ((uint32)blitter_ram[SRCDATA + 6] << 8) | blitter_ram[SRCDATA + 1];
+ | ((uint32)blitter_ram[SRCDATA + 6] << 8) | blitter_ram[SRCDATA + 7];
gd_c[1] = blitter_ram[PATTERNDATA + 4];
gd_i[1] = ((uint32)blitter_ram[PATTERNDATA + 5] << 16)
- | ((uint32)blitter_ram[SRCDATA + 4] << 8) | blitter_ram[SRCDATA + 3];
+ | ((uint32)blitter_ram[SRCDATA + 4] << 8) | blitter_ram[SRCDATA + 5];
gd_c[2] = blitter_ram[PATTERNDATA + 2];
gd_i[2] = ((uint32)blitter_ram[PATTERNDATA + 3] << 16)
- | ((uint32)blitter_ram[SRCDATA + 2] << 8) | blitter_ram[SRCDATA + 5];
+ | ((uint32)blitter_ram[SRCDATA + 2] << 8) | blitter_ram[SRCDATA + 3];
gd_c[3] = blitter_ram[PATTERNDATA + 0];
gd_i[3] = ((uint32)blitter_ram[PATTERNDATA + 1] << 16)
- | ((uint32)blitter_ram[SRCDATA + 0] << 8) | blitter_ram[SRCDATA + 7];
+ | ((uint32)blitter_ram[SRCDATA + 0] << 8) | blitter_ram[SRCDATA + 1];
gouraud_add = REG(INTENSITYINC);
}
#endif
-/*
-Here's a collection of various blits that aren't handled correctly yet...
-
-Spinning cube in Jaguar BIOS opening:
-
- COMMAND = 41802F41
- a1_base = 0015B000
- a1_flags = 00033020 (0 0 0 11 . 011000 000 100 . 00)
- pitch=0, pixSz=4, zOff=0, width=64, xCtrl=3
- a1_clip = 64, 64 (00400040)
- a1_pixel = 0, 65534 (FFFE0000)
- a1_step = -64, -1 (FFFFFFC0)
- a1_fstep = 0, 18161 (46F10000)
- a1_fpixel= 32768, 42497 (A6018000)
- a1_inc = 1, 0 (00000001)
- a1_finc = 0, 1926 (07860000)
- a2_base = 0014B000
- a2_flags = 00013820 (0 0 0 01 0 011100 000 100 . 00)
- pitch=0, pixSz=4, zOff=0, width=128, xCtrl=1
- a2_mask = 0, 0 (00000000)
- a2_pixel = 33, 55 (00370021)
- a2_step = -64, 1 (0001FFC0)
- count = 64 x 57
- SRCEN = 1
- SRCENZ = 0
- SRCENX = 0
- DSTEN = 0
- DSTENZ = 0
- DSTWRZ = 0
- CLIPA1 = 1
- UPDA1F = 1
- UPDA1 = 1
- UPDA2 = 1
- DSTA2 = 1
- ZOP =
---LFUFUNC = LFU_REPLACE
-| PATDSEL = 0 (PD=0000000000000000)
---ADDDSEL = 0
- CMPDST = 0
- BCOMPEN = 0
- DCOMPEN = 0
- TOPBEN = 0
- TOPNEN = 0
- BKGWREN = 0
- GOURD = 0 (II=00FCDC80, SD=FF00FF00FF00FF00)
- GOURZ = 1 (ZI=00000000, ZD=0000000000000000, SZ1=0000000000000000, SZ2=0000000000000000)
- SRCSHADE = 1
-*/
+//
+// Here's attempt #2--taken from the Oberon chip specs!
+//
#ifdef USE_MIDSUMMER_BLITTER_MKII
-// Here's attempt #2--taken from the Oberon chip specs!
void ADDRGEN(uint32 &, uint32 &, bool, bool,
uint16, uint16, uint32, uint8, uint8, uint8, uint8,
void DATAMUX(int16 &data_x, int16 &data_y, uint32 gpu_din, int16 addq_x, int16 addq_y, bool addqsel);
void ADDRADD(int16 &addq_x, int16 &addq_y, bool a1fracldi,
uint16 adda_x, uint16 adda_y, uint16 addb_x, uint16 addb_y, uint8 modx, bool suba_x, bool suba_y);
-void DATA (uint64 &wdata, uint8 &dcomp, uint8 &zcomp, bool &nowrite,
+void DATA(uint64 &wdata, uint8 &dcomp, uint8 &zcomp, bool &nowrite,
bool big_pix, bool cmpdst, uint8 daddasel, uint8 daddbsel, uint8 daddmode, bool daddq_sel, uint8 data_sel,
- uint8 dbinh, uint8 dend, uint8 dstart, uint64 dstd, uint32 iinc, uint8 lfu_func, uint64 patd, bool patdadd,
+ uint8 dbinh, uint8 dend, uint8 dstart, uint64 dstd, uint32 iinc, uint8 lfu_func, uint64 &patd, bool patdadd,
bool phrase_mode, uint64 srcd, bool srcdread, bool srczread, bool srcz2add, uint8 zmode,
bool bcompen, bool bkgwren, bool dcompen, uint8 icount, uint8 pixsize);
void COMP_CTRL(uint8 &dbinh, bool &nowrite,
// $01800005 has SRCENX, may have to investigate further...
// $00011008 has GOURD & DSTEN.
// $41802F41 has SRCSHADE, CLIPA1
-logBlit = false;
-/*if (
- cmd != 0x00010200
- && cmd != 0x01800001
+/*logBlit = false;
+if (
+ cmd != 0x00010200 && // PATDSEL
+ cmd != 0x01800001
&& cmd != 0x01800005
//Boot ROM ATARI letters:
&& cmd != 0x00011008 // DSTEN GOURD PATDSEL
//T2K TEMPEST letters:
&& cmd != 0x09800741 // SRCEN CLIP_A1 UPDA1 UPDA1F UPDA2 LFUFUNC=C DCOMPEN
//Static letters on Cybermorph intro screen:
- && cmd != 0x09800609 // DCOMPEN
+ && cmd != 0x09800609 // SRCEN DSTEN UPDA1 UPDA2 LFUFUNC=C DCOMPEN
//Static pic on title screen:
&& cmd != 0x01800601 // SRCEN UPDA1 UPDA2 LFUFUNC=C
//Turning letters on Cybermorph intro screen:
&& cmd != 0x00010000 // PATDSEL
//Hover Strike text:
&& cmd != 0x1401060C // SRCENX DSTEN UPDA1 UPDA2 PATDSEL BCOMPEN BKGWREN
+//Trevor McFur stuff:
+ && cmd != 0x05810601 // SRCEN UPDA1 UPDA2 PATDSEL BCOMPEN
+ && cmd != 0x01800201 // SRCEN UPDA1 LFUFUNC=C
+//T2K:
+ && cmd != 0x00011000 // GOURD PATDSEL
+ && cmd != 0x00011040 // CLIP_A1 GOURD PATDSEL
)
logBlit = true;//*/
+if (blit_start_log == 0) // Wait for the signal...
+ logBlit = false;//*/
+/*
+Some T2K unique blits:
+logBlit = F, cmd = 00010200 *
+logBlit = F, cmd = 00011000
+logBlit = F, cmd = 00011040
+logBlit = F, cmd = 01800005 *
+logBlit = F, cmd = 09800741 *
+*/
//printf("logBlit = %s, cmd = %08X\n", (logBlit ? "T" : "F"), cmd);
//fflush(stdout);
+//logBlit = true;
+
+/*
+Blit! (CMD = 00011040)
+Flags: CLIP_A1 GOURD PATDSEL
+ count = 18 x 1
+ a1_base = 00100000, a2_base = 0081F6A8
+ a1_x = 00A7, a1_y = 0014, a1_frac_x = 0000, a1_frac_y = 0000, a2_x = 0001, a2_y = 0000
+ a1_step_x = FE80, a1_step_y = 0001, a1_stepf_x = 0000, a1_stepf_y = 0000, a2_step_x = FFF8, a2_step_y = 0001
+ a1_inc_x = 0001, a1_inc_y = 0000, a1_incf_x = 0000, a1_incf_y = 0000
+ a1_win_x = 0180, a1_win_y = 0118, a2_mask_x = 0000, a2_mask_y = 0000
+ a2_mask=F a1add=+phr/+0 a2add=+phr/+0
+ a1_pixsize = 4, a2_pixsize = 4
+*/
+//Testing T2K...
+/*logBlit = false;
+if (cmd == 0x00011040
+ && (GET16(blitter_ram, A1_PIXEL + 2) == 0x00A7) && (GET16(blitter_ram, A1_PIXEL + 0) == 0x0014)
+ && (GET16(blitter_ram, A2_PIXEL + 2) == 0x0001) && (GET16(blitter_ram, A2_PIXEL + 0) == 0x0000)
+ && (GET16(blitter_ram, PIXLINECOUNTER + 2) == 18))
+ logBlit = true;*/
// Line states passed in via the command register
dcompen = (DCOMPEN), bkgwren = (BKGWREN), srcshade = (SRCSHADE);
uint8 zmode = (cmd & 0x01C0000) >> 18, lfufunc = (cmd & 0x1E00000) >> 21;
-//Missing: ZMODE, LFUFUNC, BUSHI
+//Missing: BUSHI
//Where to find various lines:
// clip_a1 -> inner
// gourd -> dcontrol, inner, outer, state
uint8 pixsize = (dsta2 ? a2_pixsize : a1_pixsize); // From ACONTROL
+//Testing Trevor McFur--I *think* it's the circle on the lower RHS of the screen...
+/*logBlit = false;
+if (cmd == 0x05810601 && (GET16(blitter_ram, PIXLINECOUNTER + 2) == 96)
+ && (GET16(blitter_ram, PIXLINECOUNTER + 0) == 72))
+ logBlit = true;//*/
//Testing...
//if (cmd == 0x1401060C) patd = 0xFFFFFFFFFFFFFFFFLL;
//if (cmd == 0x1401060C) patd = 0x00000000000000FFLL;
So... It's reversed! The data organization of the patd register is [low 32][high 32]! !!! FIX !!! [DONE]
And fix all the other 64 bit registers [DONE]
*/
-
-if (cmd == 0x1401060C)
+/*if (cmd == 0x1401060C)
{
printf("logBlit = %s, cmd = %08X\n", (logBlit ? "T" : "F"), cmd);
fflush(stdout);
-}
+}*/
+/*logBlit = false;
+if ((cmd == 0x00010200) && (GET16(blitter_ram, PIXLINECOUNTER + 2) == 9))
+ logBlit = true;
+
+; Pink altimeter bar
+
+Blit! (00110000 <- 000BF010) count: 9 x 23, A1/2_FLAGS: 000042E2/00010020 [cmd: 00010200]
+ CMD -> src: dst: misc: a1ctl: UPDA1 mode: ity: PATDSEL z-op: op: LFU_CLEAR ctrl:
+ A1 step values: -10 (X), 1 (Y)
+ A1 -> pitch: 4 phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
+ A2 -> pitch: 1 phrases, depth: 16bpp, z-off: 0, width: 1 (00), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
+ A1 x/y: 262/132, A2 x/y: 129/0
+;x-coord is 257 in pic, so add 5
+;20 for ship, 33 for #... Let's see if we can find 'em!
+
+; Black altimeter bar
+
+Blit! (00110000 <- 000BF010) count: 5 x 29, A1/2_FLAGS: 000042E2/00010020 [cmd: 00010200]
+ CMD -> src: dst: misc: a1ctl: UPDA1 mode: ity: PATDSEL z-op: op: LFU_CLEAR ctrl:
+ A1 step values: -8 (X), 1 (Y)
+ A1 -> pitch: 4 phrases, depth: 16bpp, z-off: 3, width: 320 (21), addctl: XADDPHR YADD0 XSIGNADD YSIGNADD
+ A2 -> pitch: 1 phrases, depth: 16bpp, z-off: 0, width: 1 (00), addctl: XADDPIX YADD0 XSIGNADD YSIGNADD
+ A1 x/y: 264/126, A2 x/y: 336/0
+
+Here's the pink bar--note that it's phrase mode without dread, so how does this work???
+Not sure, but I *think* that somehow it MUXes the data at the write site in on the left or right side
+of the write data when masked in phrase mode. I'll have to do some tracing to see if this is the mechanism
+it uses or not...
+
+Blit! (CMD = 00010200)
+Flags: UPDA1 PATDSEL
+ count = 9 x 11
+ a1_base = 00110010, a2_base = 000BD7E0
+ a1_x = 0106, a1_y = 0090, a1_frac_x = 0000, a1_frac_y = 8000, a2_x = 025A, a2_y = 0000
+ a1_step_x = FFF6, a1_step_y = 0001, a1_stepf_x = 5E00, a1_stepf_y = D100, a2_step_x = FFF7, a2_step_y = 0001
+ a1_inc_x = 0001, a1_inc_y = FFFF, a1_incf_x = 0000, a1_incf_y = E000
+ a1_win_x = 0000, a1_win_y = 0000, a2_mask_x = 0000, a2_mask_y = 0000
+ a2_mask=F a1add=+phr/+0 a2add=+1/+0
+ a1_pixsize = 4, a2_pixsize = 4
+ srcd=BAC673AC2C92E578 dstd=0000000000000000 patd=74C074C074C074C0 iinc=0002E398
+ srcz1=7E127E12000088DA srcz2=DBE06DF000000000 dstz=0000000000000000 zinc=FFFE4840, coll=0
+ Phrase mode is ON
+ [in=T a1f=F a1=F zf=F z=F a2=F iif=F iii=F izf=F izi=F]
+ Entering INNER state...
+ Entering DWRITE state...
+ Dest write address/pix address: 0016A830/0 [dstart=20 dend=40 pwidth=8 srcshift=0][daas=0 dabs=0 dam=7 ds=0 daq=F] [7400000074C074C0] (icount=0007, inc=2)
+ Entering A1_ADD state [a1_x=0106, a1_y=0090, addasel=0, addbsel=0, modx=2, addareg=F, adda_xconst=2, adda_yconst=0]...
+ Entering DWRITE state...
+ Dest write address/pix address: 0016A850/0 [dstart=0 dend=40 pwidth=8 srcshift=0][daas=0 dabs=0 dam=7 ds=0 daq=F] [74C074C074C074C0] (icount=0003, inc=4)
+ Entering A1_ADD state [a1_x=0108, a1_y=0090, addasel=0, addbsel=0, modx=2, addareg=F, adda_xconst=2, adda_yconst=0]...
+ Entering DWRITE state...
+ Dest write address/pix address: 0016A870/0 [dstart=0 dend=30 pwidth=8 srcshift=0][daas=0 dabs=0 dam=7 ds=0 daq=F] [74C074C074C00000] (icount=FFFF, inc=4)
+ Entering A1_ADD state [a1_x=010C, a1_y=0090, addasel=0, addbsel=0, modx=2, addareg=F, adda_xconst=2, adda_yconst=0]...
+ Entering IDLE_INNER state...
+ Leaving INNER state... (ocount=000A)
+ [in=F a1f=F a1=T zf=F z=F a2=F iif=F iii=F izf=F izi=F]
+ Entering A1UPDATE state... (272/144 -> 262/145)
+ [in=T a1f=F a1=F zf=F z=F a2=F iif=F iii=F izf=F izi=F]
+ Entering INNER state...
+*/
+
// Bugs in Jaguar I
a2addy = a1addy; // A2 channel Y add bit is tied to A1's
fflush(stdout);
}
#endif
+//logBlit = false;
// Stopgap vars to simulate various lines
//Kludge to take pixel size into account...
if (!phrase_mode)
{
- if (pixsize == 5)
- srcd1 >>= 32;
- else if (pixsize == 4)
- srcd1 >>= 48;
- else
+ if (bcompen)
srcd1 >>= 56;
+ else
+ {
+ if (pixsize == 5)
+ srcd1 >>= 32;
+ else if (pixsize == 4)
+ srcd1 >>= 48;
+ else
+ srcd1 >>= 56;
+ }
}
#ifdef VERBOSE_BLITTER_LOGGING
if (logBlit)
#ifdef VERBOSE_BLITTER_LOGGING
if (logBlit)
{
-printf(" Entering SZREADX state...\n");
+printf(" Entering SZREAD state...\n");
fflush(stdout);
}
#endif
}
#endif
+//More testing... This is almost certainly wrong, but how else does this work???
+//Seems to kinda work... But still, this doesn't seem to make any sense!
+if (phrase_mode && !dsten)
+ dstd = ((uint64)JaguarReadLong(address, BLITTER) << 32) | (uint64)JaguarReadLong(address + 4, BLITTER);
+
//Testing only... for now...
//This is wrong because the write data is a combination of srcd and dstd--either run
-//thru the LFU or in PATDSEL or ADDDSEL mode.
+//thru the LFU or in PATDSEL or ADDDSEL mode. [DONE now, thru DATA module]
// Precedence is ADDDSEL > PATDSEL > LFU.
//Also, doesn't take into account the start & end masks, or the phrase width...
//Now it does!
if (srcshift == 0)
srcd = srcd1;
-//Temporary kludge, to see if the fractional pattern does anything...
-//This works, BTW
-if (patfadd)
-{
- uint16 addq[4];
- uint8 initcin[4] = { 0, 0, 0, 0 };
- ADDARRAY(addq, 4/*daddasel*/, 4/*daddbsel*/, 0/*daddmode*/, dstd, iinc, initcin, 0, 0, 0, patd, srcd, 0, 0, 0, 0);
- srcd1 = ((uint64)addq[3] << 48) | ((uint64)addq[2] << 32) | ((uint64)addq[1] << 16) | (uint64)addq[0];
-}
-
-//Note that we still don't take atick[0] & [1] into account here, so this will skip half of the data needed... !!! FIX !!!
-//Not yet enumerated: dbinh, srcdread, srczread
-
//When in SRCSHADE mode, it adds the IINC to the read source (from LFU???)
//According to following line, it gets LFU mode. But does it feed the source into the LFU
//after the add?
//Seems to work... Not 100% sure tho.
//end try this
+//Temporary kludge, to see if the fractional pattern does anything...
+//This works, BTW
+//But it seems to mess up in Cybermorph... the shading should be smooth but it isn't...
+//Seems the carry out is lost again... !!! FIX !!!
+if (patfadd)
+{
+ uint16 addq[4];
+ uint8 initcin[4] = { 0, 0, 0, 0 };
+ ADDARRAY(addq, 4/*daddasel*/, 4/*daddbsel*/, 0/*daddmode*/, dstd, iinc, initcin, 0, 0, 0, patd, srcd, 0, 0, 0, 0);
+ srcd1 = ((uint64)addq[3] << 48) | ((uint64)addq[2] << 32) | ((uint64)addq[1] << 16) | (uint64)addq[0];
+}
+
+//Note that we still don't take atick[0] & [1] into account here, so this will skip half of the data needed... !!! FIX !!!
+//Not yet enumerated: dbinh, srcdread, srczread
+
bool winhibit;// = false;
uint64 wdata;
uint8 dcomp, zcomp;
dend, dstart, dstd, iinc, lfufunc, patd, patdadd,
phrase_mode, srcd, false/*srcdread*/, false/*srczread*/, srcz2add, zmode,
bcompen, bkgwren, dcompen, icount & 0x07, pixsize);
-// bool bcompen, bool bkgwren, bool dcompen, uint8 icount, uint8 pixsize)
+/*
+Seems that the phrase mode writes with DCOMPEN and DSTEN are corrupting inside of DATA: !!! FIX !!!
+It's fairly random as well. 7CFE -> 7DFE, 7FCA -> 78CA, 7FA4 -> 78A4, 7F88 -> 8F88
+It could be related to an uninitialized variable, like the zmode bug...
+[DONE]
+It was a bug in the dech38el data--it returned $FF for ungated instead of $00...
+
+Blit! (CMD = 09800609)
+Flags: SRCEN DSTEN UPDA1 UPDA2 LFUFUNC=C DCOMPEN
+ count = 10 x 12
+ a1_base = 00110000, a2_base = 0010B2A8
+ a1_x = 004B, a1_y = 00D8, a1_frac_x = 0000, a1_frac_y = 0000, a2_x = 0704, a2_y = 0000
+ a1_step_x = FFF3, a1_step_y = 0001, a1_stepf_x = 0000, a1_stepf_y = 0000, a2_step_x = FFFC, a2_step_y = 0000
+ a1_inc_x = 0000, a1_inc_y = 0000, a1_incf_x = 0000, a1_incf_y = 0000
+ a1_win_x = 0000, a1_win_y = 0000, a2_mask_x = 0000, a2_mask_y = 0000
+ a2_mask=F a1add=+phr/+0 a2add=+phr/+0
+ a1_pixsize = 4, a2_pixsize = 4
+ srcd=0000000000000000 dstd=0000000000000000 patd=0000000000000000 iinc=00000000
+ srcz1=0000000000000000 srcz2=0000000000000000 dstz=0000000000000000 zinc=00000000, coll=0
+ Phrase mode is ON
+ [in=T a1f=F a1=F zf=F z=F a2=F iif=F iii=F izf=F izi=F]
+ Entering INNER state...
+ Entering SREAD state... Source read address/pix address: 0010C0B0/0 [0000000078047804]
+ Entering A2_ADD state [a2_x=0704, a2_y=0000, addasel=0, addbsel=1, modx=2, addareg=F, adda_xconst=2, adda_yconst=0]...
+ Entering DREAD state...
+ Dest read address/pix address: 00197240/0 [0000000000000028]
+ Entering DWRITE state...
+ Dest write address/pix address: 00197240/0 [dstart=30 dend=40 pwidth=8 srcshift=30][daas=0 dabs=0 dam=7 ds=1 daq=F] [0000000000000028] (icount=0009, inc=1)
+ Entering A1_ADD state [a1_x=004B, a1_y=00D8, addasel=0, addbsel=0, modx=2, addareg=F, adda_xconst=2, adda_yconst=0]...
+ Entering SREAD state... Source read address/pix address: 0010C0B8/0 [7804780478047804]
+ Entering A2_ADD state [a2_x=0708, a2_y=0000, addasel=0, addbsel=1, modx=2, addareg=F, adda_xconst=2, adda_yconst=0]...
+ Entering DREAD state...
+ Dest read address/pix address: 00197260/0 [0028000000200008]
+ Entering DWRITE state...
+ Dest write address/pix address: 00197260/0 [dstart=0 dend=40 pwidth=8 srcshift=30][daas=0 dabs=0 dam=7 ds=1 daq=F] [0028780478047804] (icount=0005, inc=4)
+ Entering A1_ADD state [a1_x=004C, a1_y=00D8, addasel=0, addbsel=0, modx=2, addareg=F, adda_xconst=2, adda_yconst=0]...
+ Entering SREAD state... Source read address/pix address: 0010C0C0/0 [0000000000000000]
+ Entering A2_ADD state [a2_x=070C, a2_y=0000, addasel=0, addbsel=1, modx=2, addareg=F, adda_xconst=2, adda_yconst=0]...
+ Entering DREAD state...
+ Dest read address/pix address: 00197280/0 [0008001800180018]
+ Entering DWRITE state...
+ Dest write address/pix address: 00197280/0 [dstart=0 dend=40 pwidth=8 srcshift=30][daas=0 dabs=0 dam=7 ds=1 daq=F] [7804780478040018] (icount=0001, inc=4)
+ Entering A1_ADD state [a1_x=0050, a1_y=00D8, addasel=0, addbsel=0, modx=2, addareg=F, adda_xconst=2, adda_yconst=0]...
+ Entering SREAD state... Source read address/pix address: 0010C0C8/0 [000078047BFE7BFE]
+ Entering A2_ADD state [a2_x=0710, a2_y=0000, addasel=0, addbsel=1, modx=2, addareg=F, adda_xconst=2, adda_yconst=0]...
+ Entering DREAD state...
+ Dest read address/pix address: 001972A0/0 [0008002000000000]
+ Entering DWRITE state...
+ Dest write address/pix address: 001972A0/0 [dstart=0 dend=10 pwidth=8 srcshift=30][daas=0 dabs=0 dam=7 ds=1 daq=F] [0008002000000000] (icount=FFFD, inc=4)
+ Entering A1_ADD state [a1_x=0054, a1_y=00D8, addasel=0, addbsel=0, modx=2, addareg=F, adda_xconst=2, adda_yconst=0]...
+ Entering IDLE_INNER state...
+*/
-if (patdadd)
- patd = wdata;
+//Why isn't this taken care of in DATA? Because, DATA is modifying its local copy instead of the one used here.
+//!!! FIX !!! [DONE]
+//if (patdadd)
+// patd = wdata;
//if (patfadd)
// srcd1 = wdata;
A1_outside := OR6 (a1_outside, a1_x{15}, a1xgr, a1xeq, a1_y{15}, a1ygr, a1yeq);
*/
//NOTE: There seems to be an off-by-one bug here in the clip_a1 section... !!! FIX !!!
+// Actually, seems to be related to phrase mode writes...
if (clip_a1 && ((a1_x & 0x8000) || (a1_y & 0x8000) || (a1_x >= a1_win_x) || (a1_y >= a1_win_y)))
winhibit = true;
-/*if (dcompen)
-{
-//This is currently not correct for phrase mode. !!! FIX !!!
- if ((pixsize == 3 && (dcomp & 0x01))
- || (pixsize == 4 && (dcomp & 0x03)))
- winhibit = true;
-}*/
-
if (!winhibit)
{
if (phrase_mode)
*/
void ADD16SAT(uint16 &r, uint8 &co, uint16 a, uint16 b, uint8 cin, bool sat, bool eightbit, bool hicinh)
{
+/*if (logBlit)
+{
+ printf("--> [sat=%s 8b=%s hicinh=%s] %04X + %04X (+ %u) = ", (sat ? "T" : "F"), (eightbit ? "T" : "F"), (hicinh ? "T" : "F"), a, b, cin);
+ fflush(stdout);
+}*/
uint8 carry[4];
uint32 qt = (a & 0xFF) + (b & 0xFF) + cin;
carry[0] = (qt & 0x0100 ? 1 : 0);
bool saturate = sat && (btop ^ ctop);
bool hisaturate = saturate && !eightbit;
+/*if (logBlit)
+{
+ printf("bt=%u ct=%u s=%u hs=%u] ", btop, ctop, saturate, hisaturate);
+ fflush(stdout);
+}*/
r = (saturate ? (ctop ? 0x00FF : 0x0000) : q & 0x00FF);
r |= (hisaturate ? (ctop ? 0xFF00 : 0x0000) : q & 0xFF00);
+/*if (logBlit)
+{
+ printf("%04X (co=%u)\n", r, co);
+ fflush(stdout);
+}*/
}
/** ADDAMUX - Address adder input A selection *******************
:IN);
*/
-void DATA (uint64 &wdata, uint8 &dcomp, uint8 &zcomp, bool &nowrite,
+void DATA(uint64 &wdata, uint8 &dcomp, uint8 &zcomp, bool &nowrite,
bool big_pix, bool cmpdst, uint8 daddasel, uint8 daddbsel, uint8 daddmode, bool daddq_sel, uint8 data_sel,
- uint8 dbinh, uint8 dend, uint8 dstart, uint64 dstd, uint32 iinc, uint8 lfu_func, uint64 patd, bool patdadd,
+ uint8 dbinh, uint8 dend, uint8 dstart, uint64 dstd, uint32 iinc, uint8 lfu_func, uint64 &patd, bool patdadd,
bool phrase_mode, uint64 srcd, bool srcdread, bool srczread, bool srcz2add, uint8 zmode,
bool bcompen, bool bkgwren, bool dcompen, uint8 icount, uint8 pixsize)
{
ADDARRAY(addq, daddasel, daddbsel, daddmode, dstd, iinc, initcin, 0, 0, 0, patd, srcd, 0, 0, 0, 0);
//This is normally done asynchronously above (thru local_data) when in patdadd mode...
+//And now it's passed back to the caller to be persistent between calls...!
+//But it's causing some serious fuck-ups in T2K now... !!! FIX !!!
+//Weird! It doesn't anymore...!
if (patdadd)
patd = ((uint64)addq[3] << 48) | ((uint64)addq[2] << 32) | ((uint64)addq[1] << 16) | (uint64)addq[0];
//////////////////////////////////////////////////////////////////////////////////////
{ 0xFE, 0xFD, 0xFB, 0xF7, 0xEF, 0xDF, 0xBF, 0x7F } };
uint8 dech38[8] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
uint8 dech38el[2][8] = { { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 },
- { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF } };
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
int en = (dend & 0x3F ? 1 : 0);
uint8 e_coarse = decl38e[en][(dend & 0x38) >> 3]; // Actually, this is e_coarse inverted...
wdata |= (mask & 0x1000 ? ddat : dstd) & 0x0000FF0000000000LL;
wdata |= (mask & 0x2000 ? ddat : dstd) & 0x00FF000000000000LL;
wdata |= (mask & 0x4000 ? ddat : dstd) & 0xFF00000000000000LL;
+/*if (logBlit)
+{
+ printf("\n[ddat=%08X%08X dstd=%08X%08X wdata=%08X%08X mask=%04X]\n",
+ (uint32)(ddat >> 32), (uint32)(ddat & 0xFFFFFFFF),
+ (uint32)(dstd >> 32), (uint32)(dstd & 0xFFFFFFFF),
+ (uint32)(wdata >> 32), (uint32)(wdata & 0xFFFFFFFF), mask);
+ fflush(stdout);
+}//*/
//////////////////////////////////////////////////////////////////////////////////////
/*Data_enab[0-1] := BUF8 (data_enab[0-1], data_ena);