Skip to content

Commit

Permalink
m68k-asm-to-c conversions continued
Browse files Browse the repository at this point in the history
  • Loading branch information
ipr committed Feb 12, 2012
1 parent 7f1b649 commit 15b350f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
4 changes: 3 additions & 1 deletion qXpkLib/XfdSlave.h
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,9 @@ class XfdSlave

//statusreg sr;
ccreg ccr; // keep this at least?


// constructor is protected:
// must use derived
XfdSlave(CIOBuffer *pIn)
: m_pIn(pIn)
, D0(),D1(),D2(),D3(),D4(),D5(),D6(),D7()
Expand Down
31 changes: 22 additions & 9 deletions xpkFAST/FAST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ bool CFAST::decrunch(CReadBuffer *pIn, CReadBuffer *pOut, const uint32_t chunkIn

//move.l d0,a4 // <- 32-bit into to address? -> replace
//add.l a0,a4 ;a4:=behind the end of input block
A4.src += D0.l;
A4.src += D0.l; // <- count pointer to end of input

//moveq.l #0,d4 ;d4:=0
D4.l = 0;
Expand All @@ -161,14 +161,15 @@ bool CFAST::decrunch(CReadBuffer *pIn, CReadBuffer *pOut, const uint32_t chunkIn
D1.w = 0x8000; //move.w #$8000,d1
D1.w += D1.w; // add.w d1,d1

/*
oloop:

D1.w = A4.wM(); // auto-decrement //move.w -(a4),d1

TODO: handle addx
addx.w d1,d1 ; add extended, source+dest+x-bit
bcs.s Copy0 // carry-set branch -> goto Copy0;


Lit0:
//DOLITERAL // move.b (a0)+,(a1)+ ;Literal item means copy a byte.
A1.setb(A0); // (macro inlined)
Expand All @@ -192,6 +193,7 @@ bool CFAST::decrunch(CReadBuffer *pIn, CReadBuffer *pOut, const uint32_t chunkIn

D1.w = A4.wM(); // auto-decrement //move.w -(a4),d1

TODO: handle addx
addx.w d1,d1 ; add extended, source+dest+x-bit
bcc.s Lit0 // carry clear -> goto Lit0;

Expand All @@ -209,19 +211,30 @@ bool CFAST::decrunch(CReadBuffer *pIn, CReadBuffer *pOut, const uint32_t chunkIn

D1.w += D1.w; //add.w d1,d1
bcc.W Lit0 // carry-clear branch -> goto Lit0;
// ?? if D1.w <= MAXWORD ??
bne.s Copy0 // not equal branch -> goto Copy0;
cmp.l a4,a0
bcs.W oloop // carry-set branch -> goto oloop;
// ?? if D1.w != 0 ??

*/

/*
// check of end of input
//cmp.l a4,a0
if ((A0.src - A4.src) < 0)
{
//bcs.W oloop // carry-set branch -> resume loop
goto oloop;
}
*/
// simplified: position before end of input -> resume
if (A0.src < A4.src)
{
goto oloop;
}

finish:
// movem.l (sp)+,a0-a2/a4-a5/d1-d5 // restore stack
// movem.l (sp)+,a0-a2/a4-a5/d1-d5 // restore stack -> no need
// rts
return true;

err:
return false;
}

0 comments on commit 15b350f

Please sign in to comment.