+
+bool ButchIsReadyToSend(void)
+{
+ return (cdRam[I2CNTRL + 3] & 0x02 ? true : false);
+}
+
+//
+// This simulates a read from BUTCH over the SSI to JERRY. Uses real reading!
+//
+void SetSSIWordsXmittedFromButch(void)
+{
+
+// The problem comes in here. Really, we should generate the IRQ once we've stuffed
+// our values into the DAC L/RRXD ports...
+// But then again, the whole IRQ system needs an overhaul in order to make it more
+// cycle accurate WRT to the various CPUs. Right now, it's catch-as-catch-can, which
+// means that IRQs get serviced on scanline boundaries instead of when they occur.
+
+// NOTE: The CD BIOS uses the following SMODE:
+// DAC: M68K writing to SMODE. Bits: WSEN FALLING [68K PC=00050D8C]
+ cdBufPtr += 4;
+
+ if (cdBufPtr >= 2352)
+ {
+WriteLog("CDROM: Reading block #%u...\n", block);
+ //No error checking. !!! FIX !!!
+//NOTE: We have to subtract out the 1st track start as well (in cdintf_foo.cpp)!
+// CDIntfReadBlock(block - 150, cdBuf);
+
+//Crappy kludge for shitty shit. Lesse if it works!
+//It does! That means my CD is WRONG! FUCK!
+
+// But, then again, according to Belboz at AA the two zeroes in front *ARE* necessary...
+// So that means my CD is OK, just this method is wrong!
+// It all depends on whether or not the interrupt occurs on the RISING or FALLING edge
+// of the word strobe... !!! FIX !!!
+
+// When WS rises, left channel was done transmitting. When WS falls, right channel is done.
+// CDIntfReadBlock(block - 150, cdBuf2);
+// CDIntfReadBlock(block - 149, cdBuf3);
+ CDIntfReadBlock(block, cdBuf2);
+ CDIntfReadBlock(block + 1, cdBuf3);
+ memcpy(cdBuf, cdBuf2 + 2, 2350);
+ cdBuf[2350] = cdBuf3[0];
+ cdBuf[2351] = cdBuf3[1];//*/
+
+ block++, cdBufPtr = 0;
+
+/*extern bool doDSPDis;
+static int foo = 0;
+if (block == 244968)
+{
+ foo++;
+WriteLog("\n***** foo = %u, block = %u *****\n\n", foo, block);
+ if (foo == 2)
+ doDSPDis = true;
+}//*/
+ }
+
+
+WriteLog("[%02X%02X %02X%02X]", cdBuf[cdBufPtr+1], cdBuf[cdBufPtr+0], cdBuf[cdBufPtr+3], cdBuf[cdBufPtr+2]);
+if (cdBufPtr % 32 == 28)
+ WriteLog("\n");
+
+//This probably isn't endian safe...
+// But then again... It seems that even though the data on the CD is organized as
+// LL LH RL RH the way it expects to see the data is RH RL LH LL.
+// D'oh! It doesn't matter *how* the data comes in, since it puts each sample into
+// its own left or right side queue, i.e. it reads them 32 bits at a time and puts
+// them into their L/R channel queues. It does seem, though, that it expects the
+// right channel to be the upper 16 bits and the left to be the lower 16.
+
+// This behavior is strictly a function of *where* the WS creates an IRQ. If the data
+// is shifted by two zeroes (00 00 in front of the data file) then this *is* the
+// correct behavior, since the left channel will be xmitted followed by the right
+
+// Now we have definitive proof: The MYST CD shows a word offset. So that means we have
+// to figure out how to make that work here *without* having to load 2 sectors, offset, etc.
+// !!! FIX !!!
+ lrxd = (cdBuf[cdBufPtr + 3] << 8) | cdBuf[cdBufPtr + 2],
+ rrxd = (cdBuf[cdBufPtr + 1] << 8) | cdBuf[cdBufPtr + 0];
+}
+
+/*
+[18667]
+TOC for MYST
+
+CDINTF: Disc summary
+ # of sessions: 2, # of tracks: 10
+ Session info:
+ 1: min track= 1, max track= 1, lead out= 1:36:67
+ 2: min track= 2, max track=10, lead out=55:24:71
+ Track info:
+ 1: start= 0:02:00
+ 2: start= 4:08:67
+ 3: start= 4:16:65
+ 4: start= 4:29:19
+ 5: start=29:31:03
+ 6: start=33:38:50
+ 7: start=41:38:60
+ 8: start=44:52:18
+ 9: start=51:51:22
+ 10: start=55:18:73
+
+CDROM: Read sector 18517 (18667 - 150)...
+
+0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0018: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0048: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0078: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00A8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00D8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0108: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0138: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0168: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0198: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+01B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+01C8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+01E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+01F8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0210: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0228: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0258: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0270: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0288: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+02A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+02B8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+02D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+02E8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0318: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0330: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0348: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0360: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0378: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0390: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+03A8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+03C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+03D8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+03F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0408: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0420: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0438: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0450: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0468: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0498: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+04B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+04C8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+04E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+04F8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0510: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0528: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0540: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0558: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0570: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0588: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+05A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+05B8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+05D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+05E8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0618: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0630: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0648: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0660: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0678: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0690: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+06A8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+06C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+06D8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+06F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0708: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0720: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0738: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0750: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0768: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+0798: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+07B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+07C8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00[54 41 49 52]54 41
+07E0: 49 52 54 41 49 52 54 41 49 52 54 41 49 52 54 41 49 52 54 41 49 52 54 41
+07F8: 49 52 54 41 49 52 54 41 49 52 54 41 49 52 54 41 49 52 54 41 49 52 54 41
+0810: 49 52 54 41 49 52[54 41 49 52]54 41 52 41 20 49 50 41 52 50 56 4F 44 45
+0828: 44 20 54 41 20 41 45 48 44 41 52 45 41 20 52 54 20 49[00 00 00 50]01 00
+0840: 80 83 FC 23 07 00 07 00 F0 00 0C 21 FC 23 07 00 07 00 F1 00 0C A1 FC 33
+0858: FF FF F0 00 4E 00 7C 2E 1F 00 FC FF 00 61 08 00 F9 4E 00 00 00 51 E7 48
+0870: 00 FE 39 30 F1 00 02 40 40 02 10 00 00 67 1C 00 79 42 01 00 8C D3 3C 34
+0888: 37 03 3C 30 81 05 3C 3C 0A 01 3C 38 F1 00 00 60 1A 00 FC 33 01 00 01 00
+08A0: 8C D3 3C 34 4B 03 3C 30 65 05 3C 3C 42 01 3C 38 1F 01 C0 33 01 00 88 D3
+08B8: C4 33 01 00 8A D3 00 32 41 E2 41 94 7C D4 04 00 7C 92 01 00 41 00 00 04
+08D0: C1 33 01 00 82 D3 C1 33 F0 00 3C 00 C2 33 01 00 80 D3 C2 33 F0 00 38 00
+08E8: C2 33 F0 00 3A 00 06 3A 44 9A C5 33 01 00 84 D3 44 DC C6 33 01 00 86 D3
+0900: F9 33 01 00 84 D3 F0 00 46 00 FC 33 FF FF F0 00 48 00 FC 23 00 00 00 00
+0918: F0 00 2A 00 FC 33 00 00 F0 00 58 00 DF 4C 7F 00 75 4E 00 00 00 00 00 00
+
+Raw P-W subchannel data:
+
+00: 80 80 C0 80 80 80 80 C0 80 80 80 80 80 80 C0 80
+10: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80
+20: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 C0
+30: 80 80 80 80 80 80 80 80 80 80 80 80 80 C0 80 80
+40: 80 80 80 80 C0 80 80 80 80 C0 C0 80 80 C0 C0 80
+50: C0 80 80 C0 C0 C0 80 80 C0 80 80 80 C0 80 80 80
+
+P subchannel data: FF FF FF FF FF FF FF FF FF FF FF FF
+Q subchannel data: 21 02 00 00 00 01 00 04 08 66 9C 88
+
+Run address: $5000, Length: $18380
+*/
+
+
+/*
+CD_read function from the CD BIOS: Note that it seems to direct the EXT1 interrupt
+to the GPU--so that would mean *any* interrupt that BUTCH generates would be routed
+to the GPU...
+
+read:
+ btst.l #31,d0
+ bne.w .play
+ subq.l #4,a0 ; Make up for ISR pre-increment
+ move.l d0,-(sp)
+ move.l BUTCH,d0
+ and.l #$ffff0000,d0
+ move.l d0,BUTCH ; NO INTERRUPTS!!!!!!!!!!!
+ move.l (sp)+,d0
+; move.l #0,BUTCH
+
+ move.w #$101,J_INT
+
+ move.l d1,-(sp)
+ move.l I2CNTRL,d1 ;Read I2S Control Register
+ bclr #2,d1 ; Stop data
+ move.l d1,I2CNTRL
+ move.l (sp)+,d1
+
+ move.l PTRLOC,a2
+ move.l a0,(a2)+
+ move.l a1,(a2)+
+ move.l #0,(a2)+
+
+ btst.b #7,INITTYPE
+ beq .not_bad
+ move.l PTRLOC,a0
+ asl.l #5,d2
+
+ move.l d2,-(sp)
+
+ or.l #$089a3c1a,d2 ; These instructions include the bclr
+ move.l d2,188(a0)
+
+ move.l (sp)+,d2
+
+ swap d2
+ or.l #$3c1a1838,d2 ; These instructions include the bclr
+ move.l d2,196(a0)
+
+ move.l #16,(a2)+
+ move.l d1,(a2)
+
+.not_bad:
+
+ move.w DS_DATA,d1 ; Clear any pending DSARX states
+ move.l I2CNTRL,d1 ; Clear any pending errors
+
+; Drain the FIFO so that we don't get overloaded
+
+.dump:
+ move.l FIFO_DATA,d1
+ move.l I2CNTRL,d1
+ btst #4,d1
+ bne.b .dump
+
+.butch_go:
+ move.l BUTCH,d1
+ and.l #$FFFF0000,d1
+ or.l #%000100001,d1 ;Enable DSARX interrupt
+ move.l d1,BUTCH
+; move.l #%000100001,BUTCH ;Enable DSARX interrupt
+
+; Do a play @
+
+.play: move.l d0,d1 ; mess with copy in d1
+ lsr.l #8,d1 ; shift the byte over
+ lsr.w #8,d1
+ or.w #$1000,d1 ; format it for goto
+ move.w d1,DS_DATA ; DSA tx
+ bsr.b DSA_tx
+
+ move.l d0,d1 ; mess with copy in d1
+ lsr.w #8,d1
+ or.w #$1100,d1 ; format it for goto
+ move.w d1,DS_DATA ; DSA tx
+ bsr.b DSA_tx
+
+ move.l d0,d1 ; mess with copy in d1
+ and.w #$00FF,d1 ; mask for minutes
+ or.w #$1200,d1 ; format it for goto
+ move.w d1,DS_DATA ; DSA tx
+ bsr.b DSA_tx
+
+ rts
+
+
+****************************
+* Here's the GPU interrupt *
+****************************
+
+JERRY_ISR:
+ movei #G_FLAGS,r30
+ load (r30),r29 ;read the flags
+
+ movei #BUTCH,r24
+
+make_ptr:
+ move pc,Ptrloc
+ movei #(make_ptr-PTRPOS),TEMP
+ sub TEMP,Ptrloc
+
+HERE:
+ move pc,r25
+ movei #(EXIT_ISR-HERE),r27
+ add r27,r25
+
+; Is this a DSARX interrupt?
+
+ load (r24),r27 ;check for DSARX int pending
+ btst #13,r27
+ jr z,fifo_read ; This should ALWAYS fall thru the first time
+
+; Set the match bit, to allow data
+; moveq #3,r26 ; enable FIFO only
+; Don't just jam a value
+; Clear the DSARX and set FIFO
+ bclr #5,r27
+ bset #1,r27
+ store r27,(r24)
+ addq #$10,r24
+ load (r24),r27
+ bset #2,r27
+ store r27,(r24) ; Disable SUBCODE match
+
+; Now we clear the DSARX interrupt in Butch
+
+ subq #12,r24 ; does what the above says
+ load (r24),r26 ;Clears DSA pending interrupt
+ addq #6,r24
+ loadw (r24),r27 ; Read DSA response
+ btst #10,r27 ; Check for error
+ jr nz,error
+ or r26,r26
+ jump (r25)
+; nop
+
+fifo_read:
+; Check for ERROR!!!!!!!!!!!!!!!!!!!!!
+ btst #14,r27
+ jr z,noerror
+ bset #31,r27
+error:
+ addq #$10,r24
+ load (r24),TEMP
+ or TEMP,TEMP
+ subq #$10,r24
+ load (Ptrloc),TEMP
+ addq #8,Ptrloc
+ store TEMP,(Ptrloc)
+ subq #8,Ptrloc
+noerror:
+ load (Ptrloc),Dataptr ;get pointer
+
+; Check to see if we should stop
+ addq #4,Ptrloc
+ load (Ptrloc),TEMP
+ subq #4,Ptrloc
+ cmp Dataptr,TEMP
+ jr pl,notend
+; nop
+ bclr #0,r27
+ store r27,(r24)
+
+notend:
+ movei #FIFO_DATA,CDdata
+ move CDdata,r25
+ addq #4,CDdata
+loptop:
+ load (CDdata),TEMP
+ load (r25),r30
+ load (CDdata),r21
+ load (r25),r22
+ load (CDdata),r24
+ load (r25),r20
+ load (CDdata),r19
+ load (r25),r18
+ addq #4,Dataptr
+ store TEMP,(Dataptr)
+ addqt #4,Dataptr
+ store r30,(Dataptr)
+ addqt #4,Dataptr
+ store r21,(Dataptr)
+ addqt #4,Dataptr
+ store r22,(Dataptr)
+ addqt #4,Dataptr
+ store r24,(Dataptr)
+ addqt #4,Dataptr
+ store r20,(Dataptr)
+ addqt #4,Dataptr
+ store r19,(Dataptr)
+ addqt #4,Dataptr
+ store r18,(Dataptr)
+
+ store Dataptr,(Ptrloc)
+
+exit_isr:
+ movei #J_INT,r24 ; Acknowledge in Jerry
+ moveq #1,TEMP
+ bset #8,TEMP
+ storew TEMP,(r24)
+
+.if FLAG
+; Stack r18
+ load (r31),r18
+ addq #4,r31
+
+; Stack r19
+ load (r31),r19
+ addq #4,r31
+
+; Stack r20
+ load (r31),r20
+ addq #4,r31
+
+; Stack r21
+ load (r31),r21
+ addq #4,r31
+
+; Stack r22
+ load (r31),r22
+ addq #4,r31
+
+; Stack r23
+ load (r31),r23
+ addq #4,r31
+
+; Stack r26
+ load (r31),r26
+ addq #4,r31
+
+; Stack r27
+ load (r31),r27
+ addq #4,r31
+
+; Stack r24
+ load (r31),r24
+ addq #4,r31
+
+; Stack r25
+ load (r31),r25
+ addq #4,r31
+.endif
+
+ movei #G_FLAGS,r30
+
+;r29 already has flags
+ bclr #3,r29 ;IMASK
+ bset #10,r29 ;Clear DSP int bit in TOM
+
+ load (r31),r28 ;Load return address
+
+
+ addq #2,r28 ;Fix it up
+ addq #4,r31
+ jump (r28) ;Return
+ store r29,(r30) ;Restore broken flags
+
+
+ align long
+
+stackbot:
+ ds.l 20
+STACK:
+
+
+*/
+