Bladeren bron

Port ttunpack code to GNU as and drop hex array hack.

git-svn-id: file:///var/svn/tigccpp/trunk@489 9552661e-59e3-4036-b4f2-dbe53926924f
kevinkofler 18 jaren geleden
bovenliggende
commit
20cca3871d

+ 554 - 292
tigcc/pstarter/pst-ttuf.h

@@ -109,296 +109,558 @@ tst.w %d0
 jbne invalid_archive
 .endm
 
-.text
+|-----------------------------------------------------------------------
+|INTRODUCTION:
+|
+|   This is a 100% assembly version of the ttunpack routine, which is
+|   based on code by Pasi 'Albert' Ojala, albert@cs.tut.fi, then
+|   reduced by Thomas Nussbaumer to fit his needs.  For a full details
+|   on the algorithm see:
+|
+|	  http://www.cs.tut.fi/~albert/Dev/pucrunch/index.html
+|
+|   Version 2.28 Fast
+|
+| 2006-03-20 Kevin Kofler: Ported to GNU as. Removed options not used in
+|                          pstarter.
+|
+|THE LICENSE:
+|
+| Copyright (C) 2004-2005 Samuel Stearley
+|
+|               wxWindows Library Licence, Version 3.1
+|               ======================================
+|
+| Copyright (C) 1998-2005 Julian Smart, Robert Roebling et al
+|
+| Everyone is permitted to copy and distribute verbatim copies
+| of this licence document, but changing it is not allowed.
+|
+|                      WXWINDOWS LIBRARY LICENCE
+|    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+|
+| This library is free software; you can redistribute it and/or modify it
+| under the terms of the GNU Library General Public Licence as published by
+| the Free Software Foundation; either version 2 of the Licence, or (at
+| your option) any later version.
+|
+| This library is distributed in the hope that it will be useful, but
+| WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
+| General Public Licence for more details.
+|
+| You should have received a copy of the GNU Library General Public Licence
+| along with this software, usually in a file named COPYING.LIB.  If not,
+| write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+| Boston, MA 02111-1307 USA.
+|
+| EXCEPTION NOTICE
+|
+| 1. As a special exception, the copyright holders of this library give
+| permission for additional uses of the text contained in this release of
+| the library as licenced under the wxWindows Library Licence, applying
+| either version 3.1 of the Licence, or (at your option) any later version of
+| the Licence as published by the copyright holders of version
+| 3.1 of the Licence document.
+|
+| 2. The exception is that you may use, copy, link, modify and distribute
+| under your own terms, binary object code versions of works based
+| on the Library.
+|
+| 3. If you copy code from files distributed under the terms of the GNU
+| General Public Licence or the GNU Library General Public Licence into a
+| copy of this library, as this licence permits, the exception does not
+| apply to the code that you add in this way.  To avoid misleading anyone as
+| to the status of such modified files, you must delete this exception
+| notice from such code and/or adjust the licensing conditions notice
+| accordingly.
+|
+| 4. If you write modifications of your own for this library, it is your
+| choice whether to permit this exception to apply to your modifications. 
+| If you do not wish that, you must delete the exception notice from such
+| code and/or adjust the licensing conditions notice accordingly.
+|
+|
+|NOTES:
+|
+|1) There were several other names associated with this, but not
+|   anymore ;)
+|
+|
+|2) There should be an unpack.c distributed with this that has
+|   additional comments that will help clarify what this is doing.
+|   But maybe not.  It depends on where you got this.  you should
+|   always be able to find this on my site:  http://www.nyall.net
+|
+|
+|3) If caller wants, they can alter the default int priority to
+|   speed up execution before calling this routine.
+|
+|
+|4) The code was written with wordpad.  It might look better if
+|   opened with that program.
+|----------------------------------------------------------------------
+
+.include "os.h"
+
+.equ osize_lo,0    |original size lowbyte
+.equ osize_hi,1    |original size highbyte
+.equ magic1,2      |must be equal to UNPACK_MAGIC1
+.equ magic2,3      |must be equal to UNPACK_MAGIC2
+.equ csize_lo,4    |compressed size lowbyte
+.equ csize_hi,5    |compressed size lowbyte
+.equ esc1,6        |escape >> (8-escBits)
+.equ notused3,7    |
+.equ notused4,8    |
+.equ esc2,9        |escBits
+.equ gamma1,10     |maxGamma + 1
+.equ gamma2,11     |(1<<maxGamma)
+.equ extralz,12    |extraLZPosBits
+.equ notused1,13   |
+.equ notused2,14   |
+.equ rleentries,15 |rleUsed
+
+.equ HEADER_SIZE,16
+
+.equ __MAGIC_CHAR1,$54
+.equ __MAGIC_CHAR2,$50
+
+.equ __ERRPCK_OKAY,0
+.equ __ERRPCK_NOESCFOUND,8    |248
+.equ __ERRPCK_ESCBITS,7       |249
+.equ __ERRPCK_MAXGAMMA,6      |250
+.equ __ERRPCK_EXTRALZP,5      |251
+.equ __ERRPCK_NOMAGIC,4       |252
+.equ __ERRPCK_OUTBUFOVERRUN,3 |253
+.equ __ERRPCK_LZPOSUNDERRUN,2 |254
+
+|-----------------------------------------------------------------------
+|Notes on register useage, might be good Idea to print this.
+|
+|	a0 => trashing, but may not be used by the subroutines
+|	a1 => extra z position bits
+|	a2 => a table that maps a byte to the highest bit set in it.
+|	a3 => the bytecodevec table
+|	a4 => The point to jump to when doing a continue
+|	a5 => the destination buffer
+|	a6 => points to the next byte of the compressed data.
+|		updated when d7 overflows.
+|
+|	d0 => trashing, output of __GetBits and __GetValue
+|	d1 => trashing, input to __GetBits
+|	d2 => prepared mask for isolating # of escape bits
+|	d3 => trashing but only by the main routine, not the subroutines
+|		It is usually the prepared count.
+|	d4 => # of escape bits
+|	d5 => start escape
+|	d6 => the current compressed byte, updated when d7 overflows.
+|	d7 => which bit we are at in the compressed data.
+|-----------------------------------------------------------------------
+
+CORRECT_IN_MASK	MACRO
+	tst.b		%d7
+	bne.s		\@fun
+	moveq		#8,%d7
+	move.b	(%a6)+,%d6
+\@fun
+	ENDM
+
+
+
 ttunpack_decompress:
-	.word	18663
-	.word	7998
-	.word	11375
-	.word	44
-	.word	10863
-	.word	48
-	.word	18414
-	.word	15
-	.word	31232
-	.word	6702
-	.word	6
-	.word	32264
-	.word	28676
-	.word	3118
-	.word	84
-	.word	2
-	.word	26236
-	.word	3118
-	.word	80
-	.word	3
-	.word	26228
-	.word	28678
-	.word	3118
-	.word	8
-	.word	10
-	.word	26218
-	.word	3118
-	.word	128
-	.word	11
-	.word	26210
-	.word	28679
-	.word	29184
-	.word	4654
-	.word	9
-	.word	10241
-	.word	20801
-	.word	25172
-	.word	28677
-	.word	29184
-	.word	4654
-	.word	12
-	.word	8769
-	.word	23361
-	.word	28230
-	.word	29696
-	.word	2498
-	.word	21314
-	.word	-6086
-	.word	-6083
-	.word	28672
-	.word	4115
-	.word	19958
-	.word	16
-	.word	18938
-	.word	60
-	.word	18948
-	.word	26116
-	.word	18938
-	.word	82
-	.word	20463
-	.word	-260
-	.word	9295
-	.word	16922
-	.word	28672
-	.word	29191
-	.word	30208
-	.word	451
-	.word	5312
-	.word	21315
-	.word	26362
-	.word	21056
-	.word	20937
-	.word	-14
-	.word	9295
-	.word	7198
-	.word	20180
-	.word	28672
-	.word	20463
-	.word	260
-	.word	17408
-	.word	19679
-	.word	31992
-	.word	20085
-	.word	6848
-	.word	7942
-	.word	12319
-	.word	7198
-	.word	4102
-	.word	-4504
-	.word	4610
-	.word	-15872
-	.word	-19963
-	.word	26348
-	.word	21902
-	.word	7198
-	.word	-25020
-	.word	25092
-	.word	7198
-	.word	20551
-	.word	24832
-	.word	272
-	.word	13824
-	.word	21312
-	.word	26488
-	.word	24832
-	.word	262
-	.word	20992
-	.word	26156
-	.word	22851
-	.word	26044
-	.word	22595
-	.word	4614
-	.word	18497
-	.word	7966
-	.word	12831
-	.word	4638
-	.word	7169
-	.word	-4439
-	.word	28927
-	.word	4097
-	.word	16129
-	.word	4639
-	.word	16885
-	.word	0
-	.word	4120
-	.word	-12287
-	.word	6848
-	.word	20939
-	.word	-8
-	.word	20180
-	.word	21760
-	.word	12809
-	.word	26396
-	.word	-7320
-	.word	29184
-	.word	4033
-	.word	21313
-	.word	-15866
-	.word	-25015
-	.word	25098
-	.word	7198
-	.word	7937
-	.word	12831
-	.word	4614
-	.word	20551
-	.word	-4503
-	.word	-32703
-	.word	29184
-	.word	7936
-	.word	12831
-	.word	7942
-	.word	12319
-	.word	7198
-	.word	4102
-	.word	-4504
-	.word	4608
-	.word	17921
-	.word	18049
-	.word	16885
-	.word	6144
-	.word	6872
-	.word	20939
-	.word	-4
-	.word	20180
-	.word	21255
-	.word	3846
-	.word	26474
-	.word	18951
-	.word	26116
-	.word	32264
-	.word	7198
-	.word	21255
-	.word	3846
-	.word	26368
-	.word	198
-	.word	18951
-	.word	26116
-	.word	32264
-	.word	7198
-	.word	24944
-	.word	5632
-	.word	27164
-	.word	-10749
-	.word	21255
-	.word	3846
-	.word	22208
-	.word	-27136
-	.word	18951
-	.word	26116
-	.word	32264
-	.word	7198
-	.word	24920
-	.word	21248
-	.word	16131
-	.word	7808
-	.word	13855
-	.word	24910
-	.word	3072
-	.word	32
-	.word	25606
-	.word	4147
-	.word	0
-	.word	24602
-	.word	-6392
-	.word	4614
-	.word	22343
-	.word	25098
-	.word	7198
-	.word	7937
-	.word	12831
-	.word	4614
-	.word	20551
-	.word	-4503
-	.word	513
-	.word	7
-	.word	-32767
-	.word	6848
-	.word	20939
-	.word	-4
-	.word	20180
-	.word	18951
-	.word	26116
-	.word	32264
-	.word	7198
-	.word	7942
-	.word	12831
-	.word	7198
-	.word	4614
-	.word	-4503
-	.word	30463
-	.word	5633
-	.word	16885
-	.word	14336
-	.word	6872
-	.word	6872
-	.word	20180
-	.word	28672
-	.word	12807
-	.word	4032
-	.word	21312
-	.word	-13312
-	.word	-17152
-	.word	26118
-	.word	4118
-	.word	17920
-	.word	20545
-	.word	-28110
-	.word	0
-	.word	3073
-	.word	8
-	.word	25860
-	.word	29192
-	.word	21063
-	.word	-25023
-	.word	25092
-	.word	20551
-	.word	7198
-	.word	28672
-	.word	21249
-	.word	26390
-	.word	4032
-	.word	21312
-	.word	-16378
-	.word	-25023
-	.word	25098
-	.word	7198
-	.word	7936
-	.word	12319
-	.word	4102
-	.word	20551
-	.word	-4504
-	.word	960
-	.word	20085
-	.word	18951
-	.word	26116
-	.word	32264
-	.word	7198
-	.word	7942
-	.word	12319
-	.word	4126
-	.word	7168
-	.word	-4504
-	.word	4613
-	.word	6658
-	.word	-13824
-	.word	17922
-	.word	-16382
-	.word	17922
-	.word	-32767
-	.word	6848
-	.word	20180
+	movem.l	%d3-%d7/%a2-%a6,-(%a7)
+	move.l	4+10*4(%a7),%a6
+	move.l	8+10*4(%a7),%a5
+|--------------------------------------------------------
+|  startesc = cth->esc1;     //d5
+|  bytecodevec = &src[15];   //a3
+|  __imask__   = 0x80;	     //d7
+|
+|These are initialized here to insure that certain
+|branches can use the short form.
+|--------------------------------------------------------
+	lea		15(%a6),%a3			|'bytecodevec'
+	moveq		#0,%d5
+	move.b	esc1(%a6),%d5			|'StartEsc'
+	moveq		#8,%d7				|which bit i am at
+|-------------------------------------------------------------------------------------------------
+|  if (cth->magic1 != __MAGIC_CHAR1 || cth->magic2 != __MAGIC_CHAR2) return __ERRPCK_NOMAGIC;
+|  if (cth->gamma1 != 8 || cth->gamma2 != 128)                       return __ERRPCK_MAXGAMMA;
+|  if ((escbits = cth->esc2) > 8)                                    return __ERRPCK_ESCBITS;
+|  if ((extralzposbits = cth->extralz) > 4)                          return __ERRPCK_EXTRALZP;
+|-------------------------------------------------------------------------------------------------
+	moveq		#__ERRPCK_NOMAGIC,%d0
+	cmp.b		#__MAGIC_CHAR1,magic1(%a6)	|these could be optimized into 1 word compare
+	bne.s		__ReturnError			|  if evenly aligned.
+	cmp.b		#__MAGIC_CHAR2,magic2(%a6)
+	bne.s		__ReturnError
+
+	moveq		#__ERRPCK_MAXGAMMA,%d0
+	cmp.b		#8,gamma1(%a6)
+	bne.s		__ReturnError
+	cmp.b		#128,gamma2(%a6)
+	bne.s		__ReturnError
+
+	moveq		#__ERRPCK_ESCBITS,%d0
+	moveq		#0,%d1
+	move.b	esc2(%a6),%d1
+	move.l	%d1,%d4
+	subq.w	#8,%d1
+	bhi.s		__ReturnError
+
+	moveq		#__ERRPCK_EXTRALZP,%d0
+	moveq		#0,%d1
+	move.b	extralz(%a6),%d1
+	move.l	%d1,%a1			|extralz pos bits
+	subq.w	#5,%d1
+	bgt.s		__ReturnError
+|--------------------------------------------------------
+|  escbits8 = 8 - escbits;   //not used
+|  __ibuffer__ = src + sizeof(__PACKHEADER) + cth->rleentries;  //a6
+|--------------------------------------------------------
+	moveq		#0,%d2
+	bset		%d4,%d2
+	subq.w	#1,%d2			|the mask for the number of escape bits
+	ror.b		%d4,%d2			|set the upper bits
+	ror.b		%d4,%d5			|shift up start escape
+	moveq		#0,%d0
+	move.b	(%a3),%d0		
+	lea		HEADER_SIZE(%a6,%d0),%a6
+|--------------------------------------------------------
+|To remove checking if escbits == 0 in the literal byte
+|  loop, there are two points used for continuing.
+|--------------------------------------------------------
+	lea		__ReturnPointForNonZeroEscapeBits(pc),%a4
+	tst.b		%d4
+	bne.s		__Skipper
+	lea		__SelIsStartEscape(pc),%a4
+__Skipper:
+|--------------------------------------------------------
+|a2 will point to a table that maps a byte to the
+|  highest bit set in it.  0 will be mapped to zero,
+|  this is important.
+|--------------------------------------------------------
+	lea		-260(%a7),%a7
+	move.l	%a7,%a2
+	clr.b		(%a2)+
+	moveq		#0,%d0
+	moveq		#7,%d1
+AllBytes:
+	moveq		#0,%d3
+	bset		%d0,%d3
+ThisByte:
+	move.b	%d0,(%a2)+
+	subq.w	#1,%d3
+	bne.s		ThisByte
+	addq.w	#1,%d0
+	dbra    	%d1,AllBytes
+	move.l	%a7,%a2
+	move.b	(%a6)+,%d6		|very first byte of compressed data
+	jmp		(%a4)			|jump into the loop
+|---------------------------------------------------------
+|And when all is done branch here
+|---------------------------------------------------------
+__WeAreDone:
+	moveq		#0,%d0			|return value
+	lea		260(%a7),%a7
+__ReturnError:
+	neg.b		%d0			|turn loaded error code into actual value
+	movem.l	(%a7)+,%d3-%d7/%a2-%a6
+	rts
+
+|---------------------------------------------------------
+|  *outbuffer++ = (sel<<escbits8) | __GetBits(escbits8);
+|  continue;
+|---------------------------------------------------------
+__SelIsNOTStartEscape:
+	move.b	%d0,(%a5)+			|put litteral byte to the output
+|---------------------------------------------------------
+|The while(1) loop:
+|
+|  sel = (escbits) ? __GetBits(escbits) : startesc;
+|  if (sel == startesc) {
+|---------------------------------------------------------
+__ReturnPointForNonZeroEscapeBits
+	move.b	%d6,-(%a7)
+	move.w	(%a7)+,%d0
+	move.b	(%a6)+,%d6
+	move.b	%d6,%d0
+	lsr.w		%d7,%d0				|__get8bits() done
+	move.b	%d2,%d1
+	and.b		%d0,%d1				|isolate the upper escape bits
+	cmp.b		%d5,%d1				|are they 'startesc'
+	bne.s		__SelIsNOTStartEscape
+	subq.l	#2,%a6
+	move.b	(%a6)+,%d6
+	sub.w		%d4,%d7
+	bhi.s		__StillInSameByte2
+	move.b	(%a6)+,%d6
+	addq.w	#8,%d7
+__StillInSameByte2:
+|---------------------------------------------------------
+|The following code is entered if sel == startesc
+|but it does not actually use the sel variable
+|
+|  lzlen = __GetValue();
+|  if (lzlen != 1) {
+|---------------------------------------------------------
+__SelIsStartEscape:
+	bsr		__GetValue		|get a value for 'lzlen'
+	move.w	%d0,%d3			|save 'lzlen'
+	subq.w	#1,%d0			|does 'lzlen' == 1 ?
+	beq.s		__RleDecoding
+|---------------------------------------------------------
+|Zip decoding
+|
+|  lzposhi = __GetValue() - 1;
+|  if (lzposhi == 254) {
+|---------------------------------------------------------
+
+	bsr		__GetValue		|if it equals 254, then lzlen must be > 3 because
+	addq.b	#1,%d0			|  there is no other possiblity because Delta decompression
+	beq.s		__WeAreDone		|  is not being used.  It the branch is not taken it
+						|  drops through to the __LzPosHi_IsNot254
+|----------------------------------------------------------------------------------------
+|  if (extralzposbits) lzposhi = (lzposhi<<extralzposbits) | __GetBits(extralzposbits);
+|  lzposlo = __Get8Bit() ^ 0xff;
+|  lzpos   = COMBINE_LOWHIGH(lzposlo,lzposhi);
+|
+| d0= lzPosHi, d3.w = lzlen, d1.l =lzpos
+|----------------------------------------------------------------------------------------
+__LzPosHi_IsNot254:
+	subq.b	#2,%d0				|undo the addq.b #1
+	move.w	%a1,%d1				|is 'extralzposbits' == 0?
+	beq.s		__extralZposBitsIsZero
+	lsl.w		%d1,%d0				|shift it by 'extralzposbits'
+	moveq		#0,%d1
+	bset.w	%d7,%d1
+	subq.w	#1,%d1
+	and.b		%d6,%d1
+	sub.w		%a1,%d7
+	bhi.s		__StillInSameByte61
+	move.b	(%a6)+,%d6
+	move.b	%d1,-(%a7)
+	move.w	(%a7)+,%d1
+	move.b	%d6,%d1
+	addq.w	#8,%d7
+__StillInSameByte61:
+	lsr.w		%d7,%d1
+	or.w		%d1,%d0				|or them back together
+__extralZposBitsIsZero:				|at this point d0.b == 'lzposhi'
+	moveq		#0,%d1
+	move.b	%d0,-(%a7)			|a faster way to do lsl.w #8
+	move.w	(%a7)+,%d1			|shift it into the high byte of 'lzpos', first step of COMBINE_LOWHIGH
+	move.b	%d6,-(%a7)			|start the __Get8Bit
+	move.w	(%a7)+,%d0
+	move.b	(%a6)+,%d6
+	move.b	%d6,%d0
+	lsr.w		%d7,%d0				|get 8 bit done
+	move.b	%d0,%d1				|COMBINE_LOWHIGH
+	not.b		%d1
+	not.l		%d1
+|-----------------------------------------------------------------------------------
+|  for (i=0; i<=lzlen; i++) {
+|    *outbuffer = *(outbuffer - lzpos - 1); //no 'add' variable
+|    outbuffer++;
+|  }
+|
+| d2.l must be -lzpos+1
+| d3.w must be lzlen
+|------------------------------------------------------------------------------------
+	lea		0(%a5,%d1.l),%a0
+
+__WriteDataLoop:
+	move.b	(%a0)+,(%a5)+
+	dbra		%d3,__WriteDataLoop
+
+	jmp		(%a4)				|continue
+|----------------------------------------------------------------------
+|'lzlen' = 1
+|    RLE decoding, OR 2 byte zip, OR escape from the escape
+|----------------------------------------------------------------------
+__RleDecoding:
+	subq.b	#1,%d7
+	btst.b	%d7,%d6
+	beq.s		__NextBitClear_DoZipAfterAll
+
+ CORRECT_IN_MASK
+
+|The second NEXT_BIT_SET()
+
+	subq.b	#1,%d7
+	btst.b	%d7,%d6
+	beq		__NextBitIsClear_EscapeFromEscape
+|-----------------------------------------------------------------
+|  rlelen = __GetValue();
+|  if (rlelen >= 128) {
+|     rlelen = ((rlelen-128)<<1) | __GetBits(1);
+|     rlelen |= (((__GetValue())-1)<<8);
+|  }
+|------------------------------------------------------------------
+__NextBitIsSet_RunLengthEncoding:
+ CORRECT_IN_MASK
+
+	bsr.s		__GetValue		|get 'rlelen' into d0, limited to 8 bit values.
+	move.b	%d0,%d3			|copy it and check sign bit to see if >= 128
+	bpl.s		__LessThan128
+|	sub.w		#128,%d3		|not needed
+	add.b		%d3,%d3			|double it, this clears the high bit so there is no need to subtract 128
+
+|-----An Inlined version of __GetBits optimized for an input of 1 --------
+
+	subq.b	#1,%d7
+	btst.b	%d7,%d6
+	sne		%d0
+	sub.b		%d0,%d3			|subtract -1 if the bit was set = add 1
+ CORRECT_IN_MASK
+
+	bsr.s		__GetValue
+	subq.b	#1,%d0
+	move.w	%d3,-(%a7)
+	move.b	%d0,(%a7)
+	move.w	(%a7)+,%d3
+|-------------------------------------------------------------------
+|Need the byte to copy
+|
+|  bytecode = __GetValue();
+|  if (bytecode < 32) byte = bytecodevec[bytecode];
+|  else               byte = ((bytecode-32)<<3) | __GetBits(3); //subracting 32 not needed
+|-------------------------------------------------------------------
+__LessThan128:
+	bsr.s		__GetValue			|get bytecode
+	cmp.b		#32,%d0
+	bcc.s		__GreaterThanOrEqual32
+	move.b	0(%a3,%d0.w),%d0		|byte = bytecodevec[bytecode];
+	bra.s		__RleCopy
+__GreaterThanOrEqual32:
+
+|-----An Inlined version of GetBits that is optimized for an input of 3-------
+
+	lsl.b		#3,%d0
+	move.b	%d6,%d1
+	subq.w	#3,%d7
+	bhi.s		__StillInSameByte2345
+	move.b	(%a6)+,%d6
+	move.b	%d1,-(%a7)
+	move.w	(%a7)+,%d1
+	move.b	%d6,%d1
+	addq.w	#8,%d7
+__StillInSameByte2345:
+	lsr.w		%d7,%d1
+	and.b		#$7,%d1
+	or.b		%d1,%d0
+|--------------------------------------------------------
+|  for (i=0; i<=rlelen; i++) *outbuffer++ = byte;
+|  continue;   // continue the main loop ...
+|
+|Rle loop expects
+| d0 = byte
+| d3 = number of em to copy, no need to subtract 1 for
+|	 dbra
+|--------------------------------------------------------
+__RleCopy:
+
+__RleLoop:
+	move.b	%d0,(%a5)+
+	dbra		%d3,__RleLoop
+
+	jmp		(%a4)
+|---------------------------------------------------------
+|  lzpos = __Get8Bit() ^ 0xff;
+|---------------------------------------------------------
+__NextBitClear_DoZipAfterAll:
+ CORRECT_IN_MASK
+	move.b	%d6,-(%a7)		|current byte
+	move.w	(%a7)+,%d1
+	move.b	(%a6)+,%d6		|next byte
+	move.b	%d6,%d1
+	lsr.w		%d7,%d1
+	moveq		#-1,%d3
+	move.b	%d1,%d3
+	lea		0(%a5,%d3.l),%a0
+	move.b	(%a0)+,(%a5)+
+	move.b	(%a0)+,(%a5)+		|'lzlen' is 1, means 2 byte copy.
+	jmp		(%a4)			|continue
+|-------------------------------------------------------------
+|  __GetValue returns a value in d0.l
+|  __GetBits takes as its input d1.b, returns a value in d0.l
+|
+| The outputs can be manipulated as:
+|	unsigned character,
+|	unsigned shorts,
+|	unsigned longs
+|
+| They may update
+|	d6, d7, a6
+|
+| They may not destroy 
+|	d3-d5/a0-a5
+|
+| They expect a2 to be a table that tells the number of the
+|	highest bit that is set
+|
+|--------------------------------------------------------------
+__GetValue:					|This function has a goal of counting till it finds
+	moveq		#0,%d0
+	move.w	%d7,%d1
+	bset.w	%d7,%d0
+	subq.w	#1,%d0			|made the mask
+	and.b		%d0,%d6			|mask out bits of interest, clear bits that we have already
+						|  passed by
+	eor.b		%d6,%d0			|invert the bits of interest
+	bne.s		__BitsSetInThisByte
+	move.b	(%a6),%d0
+	not.b		%d0
+	addq.w	#8,%d1
+__BitsSetInThisByte:
+	sub.b		0(%a2,%d0.w),%d1
+	cmp.b		#8,%d1
+	bcs.s		__LessThan7
+	moveq		#8,%d1
+	addq.w	#1,%d7
+__LessThan7:
+	sub.w		%d1,%d7
+	bhi.s		__SameByte
+	addq.w	#8,%d7
+	move.b	(%a6)+,%d6
+__SameByte:
+	moveq		#0,%d0
+	subq.b	#1,%d1
+	beq.s       __inl_exit4
+	bset.w	%d7,%d0
+	subq.w	#1,%d0
+	and.b		%d6,%d0
+	sub.w		%d1,%d7
+	bhi.s		__StillInSameByte4
+	move.b	(%a6)+,%d6
+	move.b	%d0,-(%a7)
+	move.w	(%a7)+,%d0
+	move.b	%d6,%d0
+	addq.w	#8,%d7
+__StillInSameByte4:
+	lsr.w		%d7,%d0
+__inl_exit4:
+	bset.b	%d1,%d0
+	rts
+|-----------------------------------------------------------------
+|  newesc = __GetBits(escbits);
+|  *outbuffer++ = (startesc<<escbits8) | __GetBits(escbits8);
+|  startesc = newesc;
+|  continue;
+|-----------------------------------------------------------------
+__NextBitIsClear_EscapeFromEscape:
+ CORRECT_IN_MASK
+	move.b	%d6,-(%a7)
+	move.w	(%a7)+,%d0
+	move.b	(%a6)+,%d0
+	move.b	%d0,%d6
+	lsr.w		%d7,%d0			|get8bits done
+	move.b	%d5,%d1			|save old 'startesc'
+	move.b	%d2,%d5
+	and.b		%d0,%d5			|set the new start esc
+	not.b		%d2
+	and.b		%d2,%d0			|isolate the lower bits
+	not.b		%d2
+	or.b		%d1,%d0			|recombine
+	move.b	%d0,(%a5)+
+	jmp		(%a4)

+ 385 - 100
tigcc/pstarter/pst-ttup.h

@@ -106,104 +106,389 @@ tst.w %d0
 jbne invalid_archive
 .endm
 
-.text
+|-----------------------------------------------------------------------
+|INTRODUCTION:
+|
+|   This is a 100% assembly version of the ttunpack routine, which is
+|   based on code by Pasi 'Albert' Ojala, albert@cs.tut.fi, then
+|   reduced by Thomas Nussbaumer to fit his needs.  For a full details
+|   on the algorithm see:
+|
+|	  http://www.cs.tut.fi/~albert/Dev/pucrunch/index.html
+|
+|   Version: 2.33 Super Small, Improper Return Value
+|			Requires even alignment
+|			Register Parameters, a0 -> dest, a3 -> source
+|			Removed optional delta_lz code
+|			Fixed a bug in header error checks
+|
+| 2006-03-20 Kevin Kofler: Ported to GNU as.
+|
+|THE LICENSE:
+|
+| Copyright (C) 2004-2005 Samuel Stearley
+|
+|               wxWindows Library Licence, Version 3.1
+|               ======================================
+|
+| Copyright (C) 1998-2005 Julian Smart, Robert Roebling et al
+|
+| Everyone is permitted to copy and distribute verbatim copies
+| of this licence document, but changing it is not allowed.
+|
+|                      WXWINDOWS LIBRARY LICENCE
+|    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+|
+| This library is free software; you can redistribute it and/or modify it
+| under the terms of the GNU Library General Public Licence as published by
+| the Free Software Foundation; either version 2 of the Licence, or (at
+| your option) any later version.
+|
+| This library is distributed in the hope that it will be useful, but
+| WITHOUT ANY WARRANTY; without even the implied warranty of
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
+| General Public Licence for more details.
+|
+| You should have received a copy of the GNU Library General Public Licence
+| along with this software, usually in a file named COPYING.LIB.  If not,
+| write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+| Boston, MA 02111-1307 USA.
+|
+| EXCEPTION NOTICE
+|
+| 1. As a special exception, the copyright holders of this library give
+| permission for additional uses of the text contained in this release of
+| the library as licenced under the wxWindows Library Licence, applying
+| either version 3.1 of the Licence, or (at your option) any later version of
+| the Licence as published by the copyright holders of version
+| 3.1 of the Licence document.
+|
+| 2. The exception is that you may use, copy, link, modify and distribute
+| under your own terms, binary object code versions of works based
+| on the Library.
+|
+| 3. If you copy code from files distributed under the terms of the GNU
+| General Public Licence or the GNU Library General Public Licence into a
+| copy of this library, as this licence permits, the exception does not
+| apply to the code that you add in this way.  To avoid misleading anyone as
+| to the status of such modified files, you must delete this exception
+| notice from such code and/or adjust the licensing conditions notice
+| accordingly.
+|
+| 4. If you write modifications of your own for this library, it is your
+| choice whether to permit this exception to apply to your modifications. 
+| If you do not wish that, you must delete the exception notice from such
+| code and/or adjust the licensing conditions notice accordingly.
+|
+|
+|NOTES:
+|
+|1) There were several other names associated with this, but not
+|   anymore ;)
+|
+|
+|2) The code was written with wordpad.  It might look better if
+|   opened with that program.
+|----------------------------------------------------------------------
+
+.include "os.h"
+
+|------------------------------------------------------------------
+|The data structure defines and error return values
+|------------------------------------------------------------------
+
+.equ osize_lo,0    |original size lowbyte
+.equ osize_hi,1    |original size highbyte
+.equ magic1,2      |must be equal to UNPACK_MAGIC1
+.equ magic2,3      |must be equal to UNPACK_MAGIC2
+.equ csize_lo,4    |compressed size lowbyte
+.equ csize_hi,5    |compressed size lowbyte
+.equ esc1,6        |escape >> (8-escBits)
+.equ notused3,7    |
+.equ notused4,8    |
+.equ esc2,9        |escBits
+.equ gamma1,10     |maxGamma + 1
+.equ gamma2,11     |(1<<maxGamma)
+.equ extralz,12    |extraLZPosBits
+.equ notused1,13   |
+.equ notused2,14   |
+.equ rleentries,15 |rleUsed
+
+.equ HEADER_SIZE,16
+
+.equ __MAGIC_CHAR1,$54
+.equ __MAGIC_CHAR2,$50
+
+.equ __ERRPCK_OKAY,0
+.equ __ERRPCK_NOESCFOUND,8    |248
+.equ __ERRPCK_ESCBITS,7       |249
+.equ __ERRPCK_MAXGAMMA,6      |250
+.equ __ERRPCK_EXTRALZP,5      |251
+.equ __ERRPCK_NOMAGIC,4       |252
+.equ __ERRPCK_OUTBUFOVERRUN,3 |253
+.equ __ERRPCK_LZPOSUNDERRUN,2 |254
+
+|-----------------------------------------------------------------------
+|Notes on register useage, might be good Idea to print this.
+|
+|	a0 => Input: The destination buffer
+|	a1 => Points to the next byte of the compressed data.
+|		udated when d7 overflows.
+|	a2 => NOT USED
+|	a3 => Input: The source data
+|		Used during error checking, will point to extralz bits
+|		Used to access 'bytecodevec' table
+|	a4 => NOT USED
+|	a5 => NOT USED
+|	a6 => NOT USED
+|
+|	d0 => Trashing, output of __GetBits and __GetValue
+|	d1 => Trashing, input to __GetBits
+|	d2 => Trashing by __GetValue
+|	d3 => Trashing but only by the main routine, not the subroutines
+|	d4 => # of escape bits
+|	d5 => Start escape
+|	d6 => Current byte of data.
+|	d7 => Which bit we are at in the compressed data.
+|
+|-----------------------------------------------------------------------
 ttunpack_decompress:
-	.word	18663
-	.word	7998
-	.word	6699
-	.word	6
-	.word	32384
-	.word	28680
-	.word	21643
-	.word	3163
-	.word	21584
-	.word	26140
-	.word	23179
-	.word	6171
-	.word	-18432
-	.word	25108
-	.word	3163
-	.word	2176
-	.word	26126
-	.word	-12245
-	.word	3
-	.word	17395
-	.word	2300
-	.word	3091
-	.word	5
-	.word	25874
-	.word	19679
-	.word	31992
-	.word	20085
-	.word	24886
-	.word	-16059
-	.word	29192
-	.word	-28156
-	.word	24894
-	.word	4288
-	.word	24874
-	.word	-20475
-	.word	26354
-	.word	24892
-	.word	13824
-	.word	21312
-	.word	26438
-	.word	24884
-	.word	20992
-	.word	26586
-	.word	21760
-	.word	4627
-	.word	24866
-	.word	29191
-	.word	24852
-	.word	17920
-	.word	17536
-	.word	4336
-	.word	2303
-	.word	20939
-	.word	-6
-	.word	24788
-	.word	4612
-	.word	28672
-	.word	24586
-	.word	-7393
-	.word	25602
-	.word	7193
-	.word	-9210
-	.word	-11968
-	.word	21249
-	.word	27378
-	.word	17600
-	.word	20085
-	.word	29702
-	.word	25066
-	.word	21706
-	.word	-4
-	.word	29190
-	.word	-28094
-	.word	28673
-	.word	24808
-	.word	25052
-	.word	25794
-	.word	25048
-	.word	25752
-	.word	25062
-	.word	5632
-	.word	27148
-	.word	25038
-	.word	16128
-	.word	25052
-	.word	21248
-	.word	7808
-	.word	13855
-	.word	25044
-	.word	21762
-	.word	27398
-	.word	4147
-	.word	3
-	.word	24580
-	.word	29186
-	.word	25012
-	.word	4288
-	.word	28672
-	.word	24738
+	movem.l	%d3-%d7/%a2-%a6,-(%a7)
+|	move.l	4+10*4(%a7),%a3
+|	move.l	8+10*4(%a7),%a0
+|--------------------------------------------------------
+|  startesc = cth->esc1;     //d5
+|  bytecodevec = &src[15];   //a3
+|  __imask__   = 0x80;	     //d7
+|
+|These are initialized here to insure that certain
+|branches can use the short form.
+|--------------------------------------------------------
+	move.b	esc1(%a3),%d5		|'StartEsc'
+	moveq		#-128,%d7		|which bit i am at.
+|-------------------------------------------------------------------------------------------------
+|  if (cth->magic1 != __MAGIC_CHAR1 || cth->magic2 != __MAGIC_CHAR2) return __ERRPCK_NOMAGIC;
+|  if (cth->gamma1 != 8 || cth->gamma2 != 128)                       return __ERRPCK_MAXGAMMA;
+|  if ((escbits = cth->esc2) > 8)                                    return __ERRPCK_ESCBITS;
+|  if ((extralzposbits = cth->extralz) > 4)                          return __ERRPCK_EXTRALZP;
+|-------------------------------------------------------------------------------------------------
+	moveq		#8,%d0			|code for error is non-zero
+	addq.l	#2,%a3
+	cmp.w		#__MAGIC_CHAR1*256+__MAGIC_CHAR2,(%a3)+
+	bne.s		__ReturnError
+
+	addq.l	#5,%a3			|point to esc2
+	move.b	(%a3)+,%d4		|get esc2 and point to gamma1
+	cmp.b		%d0,%d4
+	bhi.s		__ReturnError
+
+	cmp.w		#8*256+128,(%a3)+	|gamma1 = 8 and gamma2 = 128?
+	bne.s		__ReturnError
+|--------------------------------------------------------
+|  __ibuffer__ = src + sizeof(__PACKHEADER) + cth->rleentries;  //a1
+|--------------------------------------------------------
+	add.b		3(%a3),%d0		|upper bytes of d0.l = 0, add (not load) in case a3 points to a zero
+	lea		4-8(%a3,%d0.l),%a1	|  because d0 is the error code must not be zero.
+	cmp.b		#5,(%a3)
+	bcs.s		__DecompressLoop	|jump into the loop if 4..0
+|---------------------------------------------------------
+|And when all is done branch here
+|  If success d0 will be zero
+|---------------------------------------------------------
+__ReturnError:
+__WeAreDone:
+	movem.l	(%a7)+,%d3-%d7/%a2-%a6
+	rts
+|-----------------------------------------------------------------
+|  newesc = __GetBits(escbits);
+|  *outbuffer++ = (startesc<<escbits8) | __GetBits(escbits8);
+|  startesc = newesc;
+|  continue;
+|-----------------------------------------------------------------
+__NextBitIsClear_EscapeFromEscape:
+	bsr.s		__GetBits_D4Input	|d0 is 'newesc'
+	exg		%d0,%d5			|'startesc' = 'newesc'; and d0 = OLD_startesc
+|---------------------------------------------------------
+|  *outbuffer++ = (sel<<escbits8) | __GetBits(escbits8);
+|  continue;
+|---------------------------------------------------------
+__SelIsNOTStartEscape:
+	moveq		#8,%d1
+	sub.b		%d4,%d1			|'escbits8'
+	bsr.s		__GetBits_D0_IS_Loaded_For_Shifting
+	move.b	%d0,(%a0)+
+|---------------------------------------------------------
+|The while(1) loop, just a label ;)
+|---------------------------------------------------------
+__DecompressLoop:
+
+|---------------------------------------------------------
+|  sel = (escbits) ? __GetBits(escbits) : startesc;
+|  if (sel == startesc) {
+|---------------------------------------------------------
+	bsr.s		__GetBits_D4Input	|get the bits, input is in d4
+	cmp.b		%d5,%d0			|did __getBits return 'startesc' into 'sel'?
+	bne.s		__SelIsNOTStartEscape
+|---------------------------------------------------------
+|The following code is entered if sel = start escape
+|but it does not actually use the sel variable
+|
+|  lzlen = __GetValue();
+|  if (lzlen != 1) {
+|---------------------------------------------------------
+__SelIsStartEscape:
+	bsr.s		__GetValue		|get a value for 'lzlen', d1 will be negative from above __GetBits
+						|  as a side effect d1 will be negative
+	move.w	%d0,%d3			|save 'lzlen'
+	subq.w	#1,%d0			|does 'lzlen' == 1 ?
+	beq.s		__RleDecoding	|this destination requires d0 = 0
+|---------------------------------------------------------
+|Zip decoding
+|
+|  lzposhi = __GetValue() - 1;
+|  if (lzposhi == 254) {
+|---------------------------------------------------------
+	bsr.s		__GetValue		|if it equals 254, then lzlen must be > 3 because
+	addq.b	#1,%d0			|  there is no other possiblity because Delta decompression
+	beq.s		__WeAreDone		|  is not being used.  It the branch is not taken it
+						|  drops through to the __LzPosHi_IsNot254
+						|  This __GetValue relies on d1 = negative from above __GetValue
+|----------------------------------------------------------------------------------------
+|  if (extralzposbits) lzposhi = (lzposhi<<extralzposbits) | __GetBits(extralzposbits);
+|  lzposlo = __Get8Bit() ^ 0xff;
+|  lzpos   = COMBINE_LOWHIGH(lzposlo,lzposhi);
+|
+| d0= lzPosHi, d3.w = lzlen, d2.l =lzpos
+|----------------------------------------------------------------------------------------
+__LzPosHi_IsNot254:
+	subq.b	#2,%d0				|undo the addq.b #1 and do the subtract that wasn't done
+	move.b	(%a3),%d1			|get 'extralzposbits'
+	bsr.s		__GetBits_D0_IS_Loaded_For_Shifting
+__NextBitClear_DoZipAfterAll:			|to jump here be sure that d0.l = 0
+	moveq		#7,%d1
+	bsr.s		__GetBits_D0_IS_Loaded_For_Shifting_D1_is_not_Variable
+|-----------------------------------------------------------------------------------
+|  for (i=0; i<=lzlen; i++) {
+|    *outbuffer = *(outbuffer - lzpos - 1); //no 'add' variable
+|    outbuffer++;
+|  }
+|
+| d0.l must be lzpos
+| d3.w must be lzlen
+|------------------------------------------------------------------------------------
+	not.b		%d0
+	neg.l		%d0
+__WriteDataLoop:
+	move.b	-1(%a0,%d0.l),(%a0)+		|18 cycles
+__UseZipCopyLoop:					|entrance for the rle code
+	dbra		%d3,__WriteDataLoop
+	bra.s		__DecompressLoop		|continue
+|-------------------------------------------------------------
+|  __GetValue returns an 8 bit value in d0.l  It can be used
+|  as an:
+|	unsigned character
+|	unsigned short
+|	unsigned long
+|
+|  __GetBits takes as its input d1.b, returns a value in d0.w
+|  There is a limit on it being 16 bit output.  With the
+|  upper bits being 0 so it can be used as an:
+|	unsigned character, if 8 bits or less are requested.
+|	unsigned short
+|	unsigned long
+|
+|  __GetBits has two other entrances, that assume a value in d0
+|  is ready to be shifted up as bits are shifted in.  This is
+|  limited to 16 bit values, with no guarantee about the upper
+|  bits.
+|
+|  '__GetBits_D0_IS_Loaded_For_Shifting_D1_is_not_Variable' is
+|  used when there is no possiblity that the input is 0.  For
+|  example: __getBits(3)
+|
+|--------------------------------------------------------------
+__GetBits_D4Input:
+	move.b	%d4,%d1
+__GetBits:
+	moveq		#0,%d0
+	bra.s		__IntoLoop
+__GetBits_D0_IS_Loaded_For_Shifting_D1_is_not_Variable:
+__inl_loop0:
+__CheckBitProceed:			|to call this like the old 'CheckBitProceed' make sure d1 = negative
+	rol.b		#1,%d7
+	bcc.s		__NotInNext
+	move.b	(%a1)+,%d6
+__NotInNext:
+	add.b		%d6,%d6
+	addx.w	%d0,%d0
+__GetBits_D0_IS_Loaded_For_Shifting:
+__IntoLoop:
+	subq.b	#1,%d1			|must be byte valued, if d1.b = negative then drop through
+	bpl.s		__inl_loop0
+	move		%d0,%ccr		|put the last bit into the carry flag.
+	rts
+
+__GetValue:
+	moveq		#6,%d2
+__inl_loop1:
+	bsr.s		__CheckBitProceed
+	dbcc		%d2,__inl_loop1
+	moveq		#6,%d1
+	sub.w		%d2,%d1
+	moveq		#1,%d0
+	bra.s		__GetBits_D0_IS_Loaded_For_Shifting
+|---------------------------------------------------------
+|RLE decoding
+|---------------------------------------------------------
+__RleDecoding:						|important! at this point d0=0 and d1 = -1
+	bsr.s		__CheckBitProceed			|will modify d0 if the bit is set
+	bcc.s		__NextBitClear_DoZipAfterAll	|if it branches d0 is still 0, the destination requires this!
+	bsr.s		__CheckBitProceed
+	bcc.s		__NextBitIsClear_EscapeFromEscape
+|-----------------------------------------------------------------
+|  rlelen = __GetValue();
+|  if (rlelen >= 128) {
+|     rlelen = ((rlelen-128)<<1) | __GetBits(1);
+|     rlelen |= (((__GetValue())-1)<<8);
+|  }
+|------------------------------------------------------------------
+__NextBitIsSet_RunLengthEncoding:
+	bsr.s		__GetValue		|get 'rlelen' into d0, limited to 8 bit values. d1 = is still negative!
+						|  it gets the value and d1 is negative again
+	move.b	%d0,%d3			|copy it and check sign bit to see if >= 128
+	bpl.s		__LessThan128
+	bsr.s		__CheckBitProceed	|__getBits(1), important d1 is negative
+	move.w	%d0,-(%a7)
+	bsr.s		__GetValue		|relies on d1 being negative !  Satisfied by above __GetValue
+	subq.b	#1,%d0
+	move.b	%d0,(%a7)		|overwrites the high bit that is should be cleared by
+	move.w	(%a7)+,%d3		|  by the rlelen-128
+|-------------------------------------------------------------------
+|Need the byte to copy
+|
+|  bytecode = __GetValue();
+|  if (bytecode < 32) byte = bytecodevec[bytecode];
+|  else               byte = ((bytecode-32)<<3) | __GetBits(3);
+|-------------------------------------------------------------------
+__LessThan128:
+	bsr.s		__GetValue			|get 'bytecode'
+	subq.b	#2,%d2				|d2= (6- # of bits retireved) jump if 5 ,6, or 7
+	bmi.s		__GreaterThanOrEqual32	|   bits retrieved means that it is >= 32
+	move.b	3(%a3,%d0.w),%d0		|byte = bytecodevec[bytecode];
+	bra.s		__RleCopy
+__GreaterThanOrEqual32:
+	moveq		#2,%d1
+	bsr.s		__GetBits_D0_IS_Loaded_For_Shifting_D1_is_not_Variable
+|--------------------------------------------------------
+|  for (i=0; i<=rlelen; i++) *outbuffer++ = byte;
+|  continue;   // continue the main loop ...
+|
+|Rle loop expects
+| d0 = byte
+| d3 = number of em to copy, no need to subtract 1 for
+|	 dbra
+|--------------------------------------------------------
+__RleCopy:
+	move.b	%d0,(%a0)+
+	moveq		#0,%d0
+	bra.s		__UseZipCopyLoop

+ 0 - 12
tigcc/pstarter/ttunpack/hexarray.c

@@ -1,12 +0,0 @@
-unsigned short ttunpack_decompress[]=
-{\
-0x48e7,0x1f3e,0x1a2b,0x0006,0x7e80,0x7008,0x548b,0x0c5b,0x5450,0x661c,\
-0x5a8b,0x181b,0xb800,0x6214,0x0c5b,0x0880,0x660e,0xd02b,0x0003,0x43f3,\
-0x08fc,0x0c13,0x0005,0x6512,0x4cdf,0x7cf8,0x4e75,0x6136,0xc145,0x7208,\
-0x9204,0x613e,0x10c0,0x612a,0xb005,0x66f2,0x613c,0x3600,0x5340,0x6746,\
-0x6134,0x5200,0x67da,0x5500,0x1213,0x6122,0x7207,0x6114,0x4600,0x4480,\
-0x10f0,0x08ff,0x51cb,0xfffa,0x60d4,0x1204,0x7000,0x600a,0xe31f,0x6402,\
-0x1c19,0xdc06,0xd140,0x5301,0x6af2,0x44c0,0x4e75,0x7406,0x61ea,0x54ca,\
-0xfffc,0x7206,0x9242,0x7001,0x60e8,0x61dc,0x64c2,0x61d8,0x6498,0x61e6,\
-0x1600,0x6a0c,0x61ce,0x3f00,0x61dc,0x5300,0x1e80,0x361f,0x61d4,0x5502,\
-0x6b06,0x1033,0x0003,0x6004,0x7202,0x61b4,0x10c0,0x7000,0x60a2};

+ 0 - 107
tigcc/pstarter/ttunpack/hexarray.s

@@ -1,107 +0,0 @@
-	.file	"hexarray.c"
-#NO_APP
-	.text
-tigcc_compiled.:
-	.globl	ttunpack_decompress
-	.text
-	.even
-ttunpack_decompress:
-	.word	18663
-	.word	7998
-	.word	6699
-	.word	6
-	.word	32384
-	.word	28680
-	.word	21643
-	.word	3163
-	.word	21584
-	.word	26140
-	.word	23179
-	.word	6171
-	.word	-18432
-	.word	25108
-	.word	3163
-	.word	2176
-	.word	26126
-	.word	-12245
-	.word	3
-	.word	17395
-	.word	2300
-	.word	3091
-	.word	5
-	.word	25874
-	.word	19679
-	.word	31992
-	.word	20085
-	.word	24886
-	.word	-16059
-	.word	29192
-	.word	-28156
-	.word	24894
-	.word	4288
-	.word	24874
-	.word	-20475
-	.word	26354
-	.word	24892
-	.word	13824
-	.word	21312
-	.word	26438
-	.word	24884
-	.word	20992
-	.word	26586
-	.word	21760
-	.word	4627
-	.word	24866
-	.word	29191
-	.word	24852
-	.word	17920
-	.word	17536
-	.word	4336
-	.word	2303
-	.word	20939
-	.word	-6
-	.word	24788
-	.word	4612
-	.word	28672
-	.word	24586
-	.word	-7393
-	.word	25602
-	.word	7193
-	.word	-9210
-	.word	-11968
-	.word	21249
-	.word	27378
-	.word	17600
-	.word	20085
-	.word	29702
-	.word	25066
-	.word	21706
-	.word	-4
-	.word	29190
-	.word	-28094
-	.word	28673
-	.word	24808
-	.word	25052
-	.word	25794
-	.word	25048
-	.word	25752
-	.word	25062
-	.word	5632
-	.word	27148
-	.word	25038
-	.word	16128
-	.word	25052
-	.word	21248
-	.word	7808
-	.word	13855
-	.word	25044
-	.word	21762
-	.word	27398
-	.word	4147
-	.word	3
-	.word	24580
-	.word	29186
-	.word	25012
-	.word	4288
-	.word	28672
-	.word	24738

+ 0 - 53
tigcc/pstarter/ttunpack/license.txt

@@ -1,53 +0,0 @@
-                wxWindows Library Licence, Version 3.1
-                ======================================
-
-  Copyright (C) 1998-2005 Julian Smart, Robert Roebling et al
-
-  Everyone is permitted to copy and distribute verbatim copies
-  of this licence document, but changing it is not allowed.
-
-                       WXWINDOWS LIBRARY LICENCE
-     TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-  
-  This library is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Library General Public Licence as published by
-  the Free Software Foundation; either version 2 of the Licence, or (at
-  your option) any later version.
-  
-  This library is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
-  General Public Licence for more details.
-
-  You should have received a copy of the GNU Library General Public Licence
-  along with this software, usually in a file named COPYING.LIB.  If not,
-  write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
-  Boston, MA 02111-1307 USA.
-
-  EXCEPTION NOTICE
-
-  1. As a special exception, the copyright holders of this library give
-  permission for additional uses of the text contained in this release of
-  the library as licenced under the wxWindows Library Licence, applying
-  either version 3.1 of the Licence, or (at your option) any later version of
-  the Licence as published by the copyright holders of version
-  3.1 of the Licence document.
-
-  2. The exception is that you may use, copy, link, modify and distribute
-  under your own terms, binary object code versions of works based
-  on the Library.
-
-  3. If you copy code from files distributed under the terms of the GNU
-  General Public Licence or the GNU Library General Public Licence into a
-  copy of this library, as this licence permits, the exception does not
-  apply to the code that you add in this way.  To avoid misleading anyone as
-  to the status of such modified files, you must delete this exception
-  notice from such code and/or adjust the licensing conditions notice
-  accordingly.
-
-  4. If you write modifications of your own for this library, it is your
-  choice whether to permit this exception to apply to your modifications. 
-  If you do not wish that, you must delete the exception notice from such
-  code and/or adjust the licensing conditions notice accordingly.
-
-

+ 0 - 118
tigcc/pstarter/ttunpack/ttunpack.h

@@ -1,118 +0,0 @@
-/******************************************************************************
-*
-* project name:    TIGCC Tools Suite
-* file name:       ttunpack.h
-* initial date:    01/02/2001
-* authors:         thomas.nussbaumer@gmx.net
-*                  samuel@nyall.net
-*
-* description:     defines for exepack functionalities including unpack routine
-*                  (complete rewrite of TIGCC Tools Suite header file)
-*
-*   This is a 100% assembly version of the ttunpack routine, which is
-*   based on code by Pasi 'Albert' Ojala, albert@cs.tut.fi, then
-*   reduced by Thomas Nussbaumer to fit his needs.  For a full details
-*   on the algorithm see:
-*
-*	  http://www.cs.tut.fi/~albert/Dev/pucrunch/index.html
-*
-*
-* Liscense:
-*
-*   The liscense is quite similar to that of the origional version in c.
-*
-*   The code may be freely used in any non commercial application.  If
-*   you do use it please give credit to tict (http://tict.ticalc.org) and
-*   myself (Samuel Stearley).  I state this as a request but it is actually
-*   not.
-*
-*   The author(s) (Samuel/Tict/Any other contributor) make no
-*   representations or warranties about the suitability of the software,
-*   either express or implied. The author(s) shall not be liable for
-*   any damages suffered as a result of using or distributing this
-*   software.
-*
-*   If you distribute this file on a website or as part of
-*   the source of a project do not remove the liscense from this file.
-*
-*
-* $Id: ttunpack.h,v 1.1 2006-02-28 23:36:58 kevinkofler Exp $
-*
-******************************************************************************/
-#ifndef __TTUNPACK_H__
-#define __TTUNPACK_H__
-
-typedef struct {
-    unsigned char  osize_lo;   // original size lowbyte
-    unsigned char  osize_hi;   // original size highbyte
-    unsigned char  magic1;     // must be equal to TTUNPACK_MAGIC1
-    unsigned char  magic2;     // must be equal to TTUNPACK_MAGIC2
-    unsigned char  csize_lo;   // compressed size lowbyte
-    unsigned char  csize_hi;   // compressed size lowbyte
-    unsigned char  esc1;       // escape >> (8-escBits)
-    unsigned char  notused3;
-    unsigned char  notused4;
-    unsigned char  esc2;       // escBits
-    unsigned char  gamma1;     // maxGamma + 1
-    unsigned char  gamma2;     // (1<<maxGamma)
-    unsigned char  extralz;    // extraLZPosBits
-    unsigned char  notused1;
-    unsigned char  notused2;
-    unsigned char  rleentries; // rleUsed
-} TTUNPACK_HEADER;
-
-#define TTUNPACK_MAGIC1 0x54
-#define TTUNPACK_MAGIC2 0x50
-
-#define ttunpack_size(_p_)  ((unsigned short)(((TTUNPACK_HEADER*)(_p_))->osize_lo | (((TTUNPACK_HEADER*)(_p_))->osize_hi << 8)))
-#define ttunpack_valid(_p_) (((TTUNPACK_HEADER*)(_p_))->magic1 == TTUNPACK_MAGIC1 && ((TTUNPACK_HEADER*)(_p_))->magic2 == TTUNPACK_MAGIC2)
-
-#define TTUNPACK_OKAY             0
-#define TTUNPACK_NOESCFOUND     248
-#define TTUNPACK_ESCBITS        249
-#define TTUNPACK_MAXGAMMA       250
-#define TTUNPACK_EXTRALZP       251
-#define TTUNPACK_NOMAGIC        252
-#define TTUNPACK_OUTBUFOVERRUN  253
-#define TTUNPACK_LZPOSUNDERRUN  254
-
-#define ttunpack_decompress ((unsigned short(*)(unsigned char*,unsigned char*))(unsigned short[])\
-{\
-0x48e7,0x1f3e,0x1a2b,0x0006,0x7e80,0x7008,0x548b,0x0c5b,0x5450,0x661c,\
-0x5a8b,0x181b,0xb800,0x6214,0x0c5b,0x0880,0x660e,0xd02b,0x0003,0x43f3,\
-0x08fc,0x0c13,0x0005,0x6512,0x4cdf,0x7cf8,0x4e75,0x6136,0xc145,0x7208,\
-0x9204,0x613e,0x10c0,0x612a,0xb005,0x66f2,0x613c,0x3600,0x5340,0x6746,\
-0x6134,0x5200,0x67da,0x5500,0x1213,0x6122,0x7207,0x6114,0x4600,0x4480,\
-0x10f0,0x08ff,0x51cb,0xfffa,0x60d4,0x1204,0x7000,0x600a,0xe31f,0x6402,\
-0x1c19,0xdc06,0xd140,0x5301,0x6af2,0x44c0,0x4e75,0x7406,0x61ea,0x54ca,\
-0xfffc,0x7206,0x9242,0x7001,0x60e8,0x61dc,0x64c2,0x61d8,0x6498,0x61e6,\
-0x1600,0x6a0c,0x61ce,0x3f00,0x61dc,0x5300,0x1e80,0x361f,0x61d4,0x5502,\
-0x6b06,0x1033,0x0003,0x6004,0x7202,0x61b4,0x10c0,0x7000,0x60a2})
-
-#endif
-
-//=============================================================================
-// Revision History
-//=============================================================================
-//
-// $Log: not supported by cvs2svn $
-//
-// Revision 2.0  2004/08/30 12:00:00  Samuel Stearley
-// New extraction routine in 100% asm.
-//
-// Revision 1.4  2002/03/28 21:17:28  tnussb
-// project name in header changed to TIGCC Tools Suite
-//
-// Revision 1.3  2002/03/13 15:09:58  tnussb
-// new exepack decompression function generated from old/unpack.c added
-// (its a little bit smaller now). The new function should work as the old one,
-// but if there are problems I will leave the old hexcode array here, too
-//
-// Revision 1.2  2001/02/05 20:33:01  Thomas Nussbaumer
-// (1) magic of ttunpack header splitted again into 2 bytes to prevent address errors
-// (2) new (stable?) pc-relative version of unpacking routine
-//
-//
-
-
- 

+ 0 - 415
tigcc/pstarter/ttunpack/unpack.asm

@@ -1,415 +0,0 @@
-;-----------------------------------------------------------------------
-;INTRODUCTION:
-;
-;   This is a 100% assembly version of the ttunpack routine, which is
-;   based on code by Pasi 'Albert' Ojala, albert@cs.tut.fi, then
-;   reduced by Thomas Nussbaumer to fit his needs.  For a full details
-;   on the algorithm see:
-;
-;	  http://www.cs.tut.fi/~albert/Dev/pucrunch/index.html
-;
-;   Version: 2.33 Super Small, Improper Return Value
-;			Requires even alignment
-;			Register Parameters, a0 -> dest, a3 -> source
-;			Removed optional delta_lz code
-;			Fixed a bug in header error checks
-;
-;THE LICENSE:
-;
-; Copyright (C) 2004-2005 Samuel Stearley
-;
-;               wxWindows Library Licence, Version 3.1
-;               ======================================
-;
-; Copyright (C) 1998-2005 Julian Smart, Robert Roebling et al
-;
-; Everyone is permitted to copy and distribute verbatim copies
-; of this licence document, but changing it is not allowed.
-;
-;                      WXWINDOWS LIBRARY LICENCE
-;    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-;
-; This library is free software; you can redistribute it and/or modify it
-; under the terms of the GNU Library General Public Licence as published by
-; the Free Software Foundation; either version 2 of the Licence, or (at
-; your option) any later version.
-;
-; This library is distributed in the hope that it will be useful, but
-; WITHOUT ANY WARRANTY; without even the implied warranty of
-; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
-; General Public Licence for more details.
-;
-; You should have received a copy of the GNU Library General Public Licence
-; along with this software, usually in a file named COPYING.LIB.  If not,
-; write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
-; Boston, MA 02111-1307 USA.
-;
-; EXCEPTION NOTICE
-;
-; 1. As a special exception, the copyright holders of this library give
-; permission for additional uses of the text contained in this release of
-; the library as licenced under the wxWindows Library Licence, applying
-; either version 3.1 of the Licence, or (at your option) any later version of
-; the Licence as published by the copyright holders of version
-; 3.1 of the Licence document.
-;
-; 2. The exception is that you may use, copy, link, modify and distribute
-; under your own terms, binary object code versions of works based
-; on the Library.
-;
-; 3. If you copy code from files distributed under the terms of the GNU
-; General Public Licence or the GNU Library General Public Licence into a
-; copy of this library, as this licence permits, the exception does not
-; apply to the code that you add in this way.  To avoid misleading anyone as
-; to the status of such modified files, you must delete this exception
-; notice from such code and/or adjust the licensing conditions notice
-; accordingly.
-;
-; 4. If you write modifications of your own for this library, it is your
-; choice whether to permit this exception to apply to your modifications. 
-; If you do not wish that, you must delete the exception notice from such
-; code and/or adjust the licensing conditions notice accordingly.
-;
-;
-;NOTES:
-;
-;1) There were several other names associated with this, but not
-;   anymore ;)
-;
-;
-;2) The code was written with wordpad.  It might look better if
-;   opened with that program.
-;
-;
-;3) A version of this is included as a hex array for use with programs
-;   written with tigcc.  OR you can use this file directly with a
-;   tigcc project: add it to the project and remove the ';' from
-;   before the 'CALL_DIRECTLY' below.  Be sure to have the latest
-;   version of tigcc when doing this.
-;----------------------------------------------------------------------
-
-;CALL_DIRECTLY			;if this label is defined then this code can be used
-					;  directly as part of a tigcc project.
-
-
-
-
- ifd CALL_DIRECTLY
-	public ttunpack_decompress
- endc
-
- ifnd CALL_DIRECTLY
-	include "os.h"
-	xdef _ti89
-	xdef _nostub
- endc
-
-
-;------------------------------------------------------------------
-;The data structure defines and error return values
-;------------------------------------------------------------------
-
-osize_lo		equ	0	;original size lowbyte
-osize_hi		equ	1	;original size highbyte
-magic1		equ	2	;must be equal to UNPACK_MAGIC1
-magic2		equ	3	;must be equal to UNPACK_MAGIC2
-csize_lo		equ	4	;compressed size lowbyte
-csize_hi		equ	5	;compressed size lowbyte
-esc1			equ	6	;escape >> (8-escBits)
-notused3		equ	7	;
-notused4		equ	8	;
-esc2			equ	9	;escBits
-gamma1		equ	10	;maxGamma + 1
-gamma2		equ	11	;(1<<maxGamma)
-extralz		equ	12	;extraLZPosBits
-notused1		equ	13	;
-notused2		equ	14	;
-rleentries		equ	15	;rleUsed
-
-HEADER_SIZE		equ	16
-
-__MAGIC_CHAR1	equ	$54
-__MAGIC_CHAR2	equ	$50
-
-__ERRPCK_OKAY		equ	0
-__ERRPCK_NOESCFOUND	equ	8		;248
-__ERRPCK_ESCBITS		equ	7		;249
-__ERRPCK_MAXGAMMA		equ	6		;250
-__ERRPCK_EXTRALZP		equ	5		;251
-__ERRPCK_NOMAGIC		equ	4		;252
-__ERRPCK_OUTBUFOVERRUN	equ	3		;253
-__ERRPCK_LZPOSUNDERRUN	equ	2		;254
-
-;-----------------------------------------------------------------------
-;Notes on register useage, might be good Idea to print this.
-;
-;	a0 => Input: The destination buffer
-;	a1 => Points to the next byte of the compressed data.
-;		udated when d7 overflows.
-;	a2 => NOT USED
-;	a3 => Input: The source data
-;		Used during error checking, will point to extralz bits
-;		Used to access 'bytecodevec' table
-;	a4 => NOT USED
-;	a5 => NOT USED
-;	a6 => NOT USED
-;
-;	d0 => Trashing, output of __GetBits and __GetValue
-;	d1 => Trashing, input to __GetBits
-;	d2 => Trashing by __GetValue
-;	d3 => Trashing but only by the main routine, not the subroutines
-;	d4 => # of escape bits
-;	d5 => Start escape
-;	d6 => Current byte of data.
-;	d7 => Which bit we are at in the compressed data.
-;
-;-----------------------------------------------------------------------
-ttunpack_decompress:
-
- ifnd CALL_DIRECTLY
-	dc.b		"UNPACK_0"
- endc
-
-	movem.l	d3-d7/a2-a6,-(a7)
-;	move.l	4+10*4(a7),a3
-;	move.l	8+10*4(a7),a0
-;--------------------------------------------------------
-;  startesc = cth->esc1;     //d5
-;  bytecodevec = &src[15];   //a3
-;  __imask__   = 0x80;	     //d7
-;
-;These are initialized here to insure that certain
-;branches can use the short form.
-;--------------------------------------------------------
-	move.b	esc1(a3),d5		;'StartEsc'
-	moveq		#-128,d7		;which bit i am at.
-;-------------------------------------------------------------------------------------------------
-;  if (cth->magic1 != __MAGIC_CHAR1 || cth->magic2 != __MAGIC_CHAR2) return __ERRPCK_NOMAGIC;
-;  if (cth->gamma1 != 8 || cth->gamma2 != 128)                       return __ERRPCK_MAXGAMMA;
-;  if ((escbits = cth->esc2) > 8)                                    return __ERRPCK_ESCBITS;
-;  if ((extralzposbits = cth->extralz) > 4)                          return __ERRPCK_EXTRALZP;
-;-------------------------------------------------------------------------------------------------
-	moveq		#8,d0			;code for error is non-zero
-	addq.l	#2,a3
-	cmp.w		#__MAGIC_CHAR1*256+__MAGIC_CHAR2,(a3)+
-	bne.s		__ReturnError
-
-	addq.l	#5,a3			;point to esc2
-	move.b	(a3)+,d4		;get esc2 and point to gamma1
-	cmp.b		d0,d4
-	bhi.s		__ReturnError
-
-	cmp.w		#8*256+128,(a3)+	;gamma1 = 8 and gamma2 = 128?
-	bne.s		__ReturnError
-;--------------------------------------------------------
-;  __ibuffer__ = src + sizeof(__PACKHEADER) + cth->rleentries;  //a1
-;--------------------------------------------------------
-	add.b		3(a3),d0		;upper bytes of d0.l = 0, add (not load) in case a3 points to a zero
-	lea		4-8(a3,d0.l),a1	;  because d0 is the error code must not be zero.
-	cmp.b		#5,(a3)
-	bcs.s		__DecompressLoop	;jump into the loop if 4..0
-;---------------------------------------------------------
-;And when all is done branch here
-;  If success d0 will be zero
-;---------------------------------------------------------
-__ReturnError:
-__WeAreDone:
-	movem.l	(a7)+,d3-d7/a2-a6
-	rts
-;-----------------------------------------------------------------
-;  newesc = __GetBits(escbits);
-;  *outbuffer++ = (startesc<<escbits8) | __GetBits(escbits8);
-;  startesc = newesc;
-;  continue;
-;-----------------------------------------------------------------
-__NextBitIsClear_EscapeFromEscape:
-	bsr.s		__GetBits_D4Input	;d0 is 'newesc'
-	exg		d0,d5			;'startesc' = 'newesc'; and d0 = OLD_startesc
-;---------------------------------------------------------
-;  *outbuffer++ = (sel<<escbits8) | __GetBits(escbits8);
-;  continue;
-;---------------------------------------------------------
-__SelIsNOTStartEscape:
-	moveq		#8,d1
-	sub.b		d4,d1			;'escbits8'
-	bsr.s		__GetBits_D0_IS_Loaded_For_Shifting
-	move.b	d0,(a0)+
-;---------------------------------------------------------
-;The while(1) loop, just a label ;)
-;---------------------------------------------------------
-__DecompressLoop:
-
-;---------------------------------------------------------
-;  sel = (escbits) ? __GetBits(escbits) : startesc;
-;  if (sel == startesc) {
-;---------------------------------------------------------
-	bsr.s		__GetBits_D4Input	;get the bits, input is in d4
-	cmp.b		d5,d0			;did __getBits return 'startesc' into 'sel'?
-	bne.s		__SelIsNOTStartEscape
-;---------------------------------------------------------
-;The following code is entered if sel = start escape
-;but it does not actually use the sel variable
-;
-;  lzlen = __GetValue();
-;  if (lzlen != 1) {
-;---------------------------------------------------------
-__SelIsStartEscape:
-	bsr.s		__GetValue		;get a value for 'lzlen', d1 will be negative from above __GetBits
-						;  as a side effect d1 will be negative
-	move.w	d0,d3			;save 'lzlen'
-	subq.w	#1,d0			;does 'lzlen' == 1 ?
-	beq.s		__RleDecoding	;this destination requires d0 = 0
-;---------------------------------------------------------
-;Zip decoding
-;
-;  lzposhi = __GetValue() - 1;
-;  if (lzposhi == 254) {
-;---------------------------------------------------------
-	bsr.s		__GetValue		;if it equals 254, then lzlen must be > 3 because
-	addq.b	#1,d0			;  there is no other possiblity because Delta decompression
-	beq.s		__WeAreDone		;  is not being used.  It the branch is not taken it
-						;  drops through to the __LzPosHi_IsNot254
-						;  This __GetValue relies on d1 = negative from above __GetValue
-;----------------------------------------------------------------------------------------
-;  if (extralzposbits) lzposhi = (lzposhi<<extralzposbits) | __GetBits(extralzposbits);
-;  lzposlo = __Get8Bit() ^ 0xff;
-;  lzpos   = COMBINE_LOWHIGH(lzposlo,lzposhi);
-;
-; d0= lzPosHi, d3.w = lzlen, d2.l =lzpos
-;----------------------------------------------------------------------------------------
-__LzPosHi_IsNot254:
-	subq.b	#2,d0				;undo the addq.b #1 and do the subtract that wasn't done
-	move.b	(a3),d1			;get 'extralzposbits'
-	bsr.s		__GetBits_D0_IS_Loaded_For_Shifting
-__NextBitClear_DoZipAfterAll:			;to jump here be sure that d0.l = 0
-	moveq		#7,d1
-	bsr.s		__GetBits_D0_IS_Loaded_For_Shifting_D1_is_not_Variable
-;-----------------------------------------------------------------------------------
-;  for (i=0; i<=lzlen; i++) {
-;    *outbuffer = *(outbuffer - lzpos - 1); //no 'add' variable
-;    outbuffer++;
-;  }
-;
-; d0.l must be lzpos
-; d3.w must be lzlen
-;------------------------------------------------------------------------------------
-	not.b		d0
-	neg.l		d0
-__WriteDataLoop:
-	move.b	-1(a0,d0.l),(a0)+		;18 cycles
-__UseZipCopyLoop:					;entrance for the rle code
-	dbra		d3,__WriteDataLoop
-	bra.s		__DecompressLoop		;continue
-;-------------------------------------------------------------
-;  __GetValue returns an 8 bit value in d0.l  It can be used
-;  as an:
-;	unsigned character
-;	unsigned short
-;	unsigned long
-;
-;  __GetBits takes as its input d1.b, returns a value in d0.w
-;  There is a limit on it being 16 bit output.  With the
-;  upper bits being 0 so it can be used as an:
-;	unsigned character, if 8 bits or less are requested.
-;	unsigned short
-;	unsigned long
-;
-;  __GetBits has two other entrances, that assume a value in d0
-;  is ready to be shifted up as bits are shifted in.  This is
-;  limited to 16 bit values, with no guarantee about the upper
-;  bits.
-;
-;  '__GetBits_D0_IS_Loaded_For_Shifting_D1_is_not_Variable' is
-;  used when there is no possiblity that the input is 0.  For
-;  example: __getBits(3)
-;
-;--------------------------------------------------------------
-__GetBits_D4Input:
-	move.b	d4,d1
-__GetBits:
-	moveq		#0,d0
-	bra.s		__IntoLoop
-__GetBits_D0_IS_Loaded_For_Shifting_D1_is_not_Variable:
-__inl_loop0:
-__CheckBitProceed:			;to call this like the old 'CheckBitProceed' make sure d1 = negative
-	rol.b		#1,d7
-	bcc.s		__NotInNext
-	move.b	(a1)+,d6
-__NotInNext:
-	add.b		d6,d6
-	addx.w	d0,d0
-__GetBits_D0_IS_Loaded_For_Shifting:
-__IntoLoop:
-	subq.b	#1,d1			;must be byte valued, if d1.b = negative then drop through
-	bpl.s		__inl_loop0
-	move		d0,ccr		;put the last bit into the carry flag.
-	rts
-
-__GetValue:
-	moveq		#6,d2
-__inl_loop1:
-	bsr.s		__CheckBitProceed
-	dbcc		d2,__inl_loop1
-	moveq		#6,d1
-	sub.w		d2,d1
-	moveq		#1,d0
-	bra.s		__GetBits_D0_IS_Loaded_For_Shifting
-;---------------------------------------------------------
-;RLE decoding
-;---------------------------------------------------------
-__RleDecoding:						;important! at this point d0=0 and d1 = -1
-	bsr.s		__CheckBitProceed			;will modify d0 if the bit is set
-	bcc.s		__NextBitClear_DoZipAfterAll	;if it branches d0 is still 0, the destination requires this!
-	bsr.s		__CheckBitProceed
-	bcc.s		__NextBitIsClear_EscapeFromEscape
-;-----------------------------------------------------------------
-;  rlelen = __GetValue();
-;  if (rlelen >= 128) {
-;     rlelen = ((rlelen-128)<<1) | __GetBits(1);
-;     rlelen |= (((__GetValue())-1)<<8);
-;  }
-;------------------------------------------------------------------
-__NextBitIsSet_RunLengthEncoding:
-	bsr.s		__GetValue		;get 'rlelen' into d0, limited to 8 bit values. d1 = is still negative!
-						;  it gets the value and d1 is negative again
-	move.b	d0,d3			;copy it and check sign bit to see if >= 128
-	bpl.s		__LessThan128
-	bsr.s		__CheckBitProceed	;__getBits(1), important d1 is negative
-	move.w	d0,-(a7)
-	bsr.s		__GetValue		;relies on d1 being negative !  Satisfied by above __GetValue
-	subq.b	#1,d0
-	move.b	d0,(a7)		;overwrites the high bit that is should be cleared by
-	move.w	(a7)+,d3		;  by the rlelen-128
-;-------------------------------------------------------------------
-;Need the byte to copy
-;
-;  bytecode = __GetValue();
-;  if (bytecode < 32) byte = bytecodevec[bytecode];
-;  else               byte = ((bytecode-32)<<3) | __GetBits(3);
-;-------------------------------------------------------------------
-__LessThan128:
-	bsr.s		__GetValue			;get 'bytecode'
-	subq.b	#2,d2				;d2= (6- # of bits retireved) jump if 5 ,6, or 7
-	bmi.s		__GreaterThanOrEqual32	;   bits retrieved means that it is >= 32
-	move.b	3(a3,d0.w),d0		;byte = bytecodevec[bytecode];
-	bra.s		__RleCopy
-__GreaterThanOrEqual32:
-	moveq		#2,d1
-	bsr.s		__GetBits_D0_IS_Loaded_For_Shifting_D1_is_not_Variable
-;--------------------------------------------------------
-;  for (i=0; i<=rlelen; i++) *outbuffer++ = byte;
-;  continue;   // continue the main loop ...
-;
-;Rle loop expects
-; d0 = byte
-; d3 = number of em to copy, no need to subtract 1 for
-;	 dbra
-;--------------------------------------------------------
-__RleCopy:
-	move.b	d0,(a0)+
-	moveq		#0,d0
-	bra.s		__UseZipCopyLoop
-
- ifnd CALL_DIRECTLY
-	dc.b		"UNPACK_1"
- endc

+ 0 - 42
tigcc/pstarter/ttupfast/hexarray.c

@@ -1,42 +0,0 @@
-#include <default.h>
-
-asm("
-.xdef _ti89
-.xdef _ti92plus
-.xdef _v200
-.xdef _ti89ti
-.xdef _tigcc_native
-");
-
-unsigned short ttunpack_decompress[]=
-{\
-0x48e7,0x1f3e,0x2c6f,0x002c,0x2a6f,0x0030,0x47ee,0x000f,0x7a00,0x1a2e,\
-0x0006,0x7e08,0x7004,0x0c2e,0x0054,0x0002,0x667c,0x0c2e,0x0050,0x0003,\
-0x6674,0x7006,0x0c2e,0x0008,0x000a,0x666a,0x0c2e,0x0080,0x000b,0x6662,\
-0x7007,0x7200,0x122e,0x0009,0x2801,0x5141,0x6254,0x7005,0x7200,0x122e,\
-0x000c,0x2241,0x5b41,0x6e46,0x7400,0x09c2,0x5342,0xe83a,0xe83d,0x7000,\
-0x1013,0x4df6,0x0010,0x49fa,0x003c,0x4a04,0x6604,0x49fa,0x0052,0x4fef,\
-0xfefc,0x244f,0x421a,0x7000,0x7207,0x7600,0x01c3,0x14c0,0x5343,0x66fa,\
-0x5240,0x51c9,0xfff2,0x244f,0x1c1e,0x4ed4,0x7000,0x4fef,0x0104,0x4400,\
-0x4cdf,0x7cf8,0x4e75,0x1ac0,0x1f06,0x301f,0x1c1e,0x1006,0xee68,0x1202,\
-0xc200,0xb205,0x66ec,0x558e,0x1c1e,0x9e44,0x6204,0x1c1e,0x5047,0x6100,\
-0x0110,0x3600,0x5340,0x6778,0x6100,0x0106,0x5200,0x662c,0x5943,0x65bc,\
-0x5843,0x1206,0x4841,0x1f1e,0x321f,0x121e,0x1c01,0xeea9,0x70ff,0x1001,\
-0x3f01,0x121f,0x41f5,0x0000,0x1018,0xd001,0x1ac0,0x51cb,0xfff8,0x4ed4,\
-0x5500,0x3209,0x671c,0xe368,0x7200,0x0fc1,0x5341,0xc206,0x9e49,0x620a,\
-0x1c1e,0x1f01,0x321f,0x1206,0x5047,0xee69,0x8041,0x7200,0x1f00,0x321f,\
-0x1f06,0x301f,0x1c1e,0x1006,0xee68,0x1200,0x4601,0x4681,0x41f5,0x1800,\
-0x1ad8,0x51cb,0xfffc,0x4ed4,0x5307,0x0f06,0x676a,0x4a07,0x6604,0x7e08,\
-0x1c1e,0x5307,0x0f06,0x6700,0x00c6,0x4a07,0x6604,0x7e08,0x1c1e,0x6170,\
-0x1600,0x6a1c,0xd603,0x5307,0x0f06,0x56c0,0x9600,0x4a07,0x6604,0x7e08,\
-0x1c1e,0x6158,0x5300,0x3f03,0x1e80,0x361f,0x614e,0x0c00,0x0020,0x6406,\
-0x1033,0x0000,0x601a,0xe708,0x1206,0x5747,0x620a,0x1c1e,0x1f01,0x321f,\
-0x1206,0x5047,0xee69,0x0201,0x0007,0x8001,0x1ac0,0x51cb,0xfffc,0x4ed4,\
-0x4a07,0x6604,0x7e08,0x1c1e,0x1f06,0x321f,0x1c1e,0x1206,0xee69,0x76ff,\
-0x1601,0x41f5,0x3800,0x1ad8,0x1ad8,0x4ed4,0x7000,0x3207,0x0fc0,0x5340,\
-0xcc00,0xbd00,0x6606,0x1016,0x4600,0x5041,0x9232,0x0000,0x0c01,0x0008,\
-0x6504,0x7208,0x5247,0x9e41,0x6204,0x5047,0x1c1e,0x7000,0x5301,0x6716,\
-0x0fc0,0x5340,0xc006,0x9e41,0x620a,0x1c1e,0x1f00,0x301f,0x1006,0x5047,\
-0xee68,0x03c0,0x4e75,0x4a07,0x6604,0x7e08,0x1c1e,0x1f06,0x301f,0x101e,\
-0x1c00,0xee68,0x1205,0x1a02,0xca00,0x4602,0xc002,0x4602,0x8001,0x1ac0,\
-0x4ed4};

+ 0 - 317
tigcc/pstarter/ttupfast/hexarray.s

@@ -1,317 +0,0 @@
-	.file	"hexarray_fast.c"
-#NO_APP
-	.text
-tigcc_compiled.:
-#APP
-	.xdef __ref_all___startup_code
-	.xdef __ref_all___MIN_AMS_required
-	.xdef __ref_all___MIN_AMS_1_01
-	.set _A_LINE,0xA000
-	.xdef __ref_all___kernel_format_data_var
-	.xdef _tigcc_native
-	.xdef __ref_all___nostub
-	.xdef __ref_all___kernel_format_bss
-	.xdef __ref_all___kernel_format_rom_calls
-	
-.xdef _ti89
-.xdef _ti92plus
-.xdef _v200
-.xdef _ti89ti
-.xdef _tigcc_native
-
-#NO_APP
-	.globl	ttunpack_decompress
-	.text
-	.even
-ttunpack_decompress:
-	.word	18663
-	.word	7998
-	.word	11375
-	.word	44
-	.word	10863
-	.word	48
-	.word	18414
-	.word	15
-	.word	31232
-	.word	6702
-	.word	6
-	.word	32264
-	.word	28676
-	.word	3118
-	.word	84
-	.word	2
-	.word	26236
-	.word	3118
-	.word	80
-	.word	3
-	.word	26228
-	.word	28678
-	.word	3118
-	.word	8
-	.word	10
-	.word	26218
-	.word	3118
-	.word	128
-	.word	11
-	.word	26210
-	.word	28679
-	.word	29184
-	.word	4654
-	.word	9
-	.word	10241
-	.word	20801
-	.word	25172
-	.word	28677
-	.word	29184
-	.word	4654
-	.word	12
-	.word	8769
-	.word	23361
-	.word	28230
-	.word	29696
-	.word	2498
-	.word	21314
-	.word	-6086
-	.word	-6083
-	.word	28672
-	.word	4115
-	.word	19958
-	.word	16
-	.word	18938
-	.word	60
-	.word	18948
-	.word	26116
-	.word	18938
-	.word	82
-	.word	20463
-	.word	-260
-	.word	9295
-	.word	16922
-	.word	28672
-	.word	29191
-	.word	30208
-	.word	451
-	.word	5312
-	.word	21315
-	.word	26362
-	.word	21056
-	.word	20937
-	.word	-14
-	.word	9295
-	.word	7198
-	.word	20180
-	.word	28672
-	.word	20463
-	.word	260
-	.word	17408
-	.word	19679
-	.word	31992
-	.word	20085
-	.word	6848
-	.word	7942
-	.word	12319
-	.word	7198
-	.word	4102
-	.word	-4504
-	.word	4610
-	.word	-15872
-	.word	-19963
-	.word	26348
-	.word	21902
-	.word	7198
-	.word	-25020
-	.word	25092
-	.word	7198
-	.word	20551
-	.word	24832
-	.word	272
-	.word	13824
-	.word	21312
-	.word	26488
-	.word	24832
-	.word	262
-	.word	20992
-	.word	26156
-	.word	22851
-	.word	26044
-	.word	22595
-	.word	4614
-	.word	18497
-	.word	7966
-	.word	12831
-	.word	4638
-	.word	7169
-	.word	-4439
-	.word	28927
-	.word	4097
-	.word	16129
-	.word	4639
-	.word	16885
-	.word	0
-	.word	4120
-	.word	-12287
-	.word	6848
-	.word	20939
-	.word	-8
-	.word	20180
-	.word	21760
-	.word	12809
-	.word	26396
-	.word	-7320
-	.word	29184
-	.word	4033
-	.word	21313
-	.word	-15866
-	.word	-25015
-	.word	25098
-	.word	7198
-	.word	7937
-	.word	12831
-	.word	4614
-	.word	20551
-	.word	-4503
-	.word	-32703
-	.word	29184
-	.word	7936
-	.word	12831
-	.word	7942
-	.word	12319
-	.word	7198
-	.word	4102
-	.word	-4504
-	.word	4608
-	.word	17921
-	.word	18049
-	.word	16885
-	.word	6144
-	.word	6872
-	.word	20939
-	.word	-4
-	.word	20180
-	.word	21255
-	.word	3846
-	.word	26474
-	.word	18951
-	.word	26116
-	.word	32264
-	.word	7198
-	.word	21255
-	.word	3846
-	.word	26368
-	.word	198
-	.word	18951
-	.word	26116
-	.word	32264
-	.word	7198
-	.word	24944
-	.word	5632
-	.word	27164
-	.word	-10749
-	.word	21255
-	.word	3846
-	.word	22208
-	.word	-27136
-	.word	18951
-	.word	26116
-	.word	32264
-	.word	7198
-	.word	24920
-	.word	21248
-	.word	16131
-	.word	7808
-	.word	13855
-	.word	24910
-	.word	3072
-	.word	32
-	.word	25606
-	.word	4147
-	.word	0
-	.word	24602
-	.word	-6392
-	.word	4614
-	.word	22343
-	.word	25098
-	.word	7198
-	.word	7937
-	.word	12831
-	.word	4614
-	.word	20551
-	.word	-4503
-	.word	513
-	.word	7
-	.word	-32767
-	.word	6848
-	.word	20939
-	.word	-4
-	.word	20180
-	.word	18951
-	.word	26116
-	.word	32264
-	.word	7198
-	.word	7942
-	.word	12831
-	.word	7198
-	.word	4614
-	.word	-4503
-	.word	30463
-	.word	5633
-	.word	16885
-	.word	14336
-	.word	6872
-	.word	6872
-	.word	20180
-	.word	28672
-	.word	12807
-	.word	4032
-	.word	21312
-	.word	-13312
-	.word	-17152
-	.word	26118
-	.word	4118
-	.word	17920
-	.word	20545
-	.word	-28110
-	.word	0
-	.word	3073
-	.word	8
-	.word	25860
-	.word	29192
-	.word	21063
-	.word	-25023
-	.word	25092
-	.word	20551
-	.word	7198
-	.word	28672
-	.word	21249
-	.word	26390
-	.word	4032
-	.word	21312
-	.word	-16378
-	.word	-25023
-	.word	25098
-	.word	7198
-	.word	7936
-	.word	12319
-	.word	4102
-	.word	20551
-	.word	-4504
-	.word	960
-	.word	20085
-	.word	18951
-	.word	26116
-	.word	32264
-	.word	7198
-	.word	7942
-	.word	12319
-	.word	4126
-	.word	7168
-	.word	-4504
-	.word	4613
-	.word	6658
-	.word	-13824
-	.word	17922
-	.word	-16382
-	.word	17922
-	.word	-32767
-	.word	6848
-	.word	20180

+ 0 - 53
tigcc/pstarter/ttupfast/license.txt

@@ -1,53 +0,0 @@
-                wxWindows Library Licence, Version 3.1
-                ======================================
-
-  Copyright (C) 1998-2005 Julian Smart, Robert Roebling et al
-
-  Everyone is permitted to copy and distribute verbatim copies
-  of this licence document, but changing it is not allowed.
-
-                       WXWINDOWS LIBRARY LICENCE
-     TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-  
-  This library is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Library General Public Licence as published by
-  the Free Software Foundation; either version 2 of the Licence, or (at
-  your option) any later version.
-  
-  This library is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
-  General Public Licence for more details.
-
-  You should have received a copy of the GNU Library General Public Licence
-  along with this software, usually in a file named COPYING.LIB.  If not,
-  write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
-  Boston, MA 02111-1307 USA.
-
-  EXCEPTION NOTICE
-
-  1. As a special exception, the copyright holders of this library give
-  permission for additional uses of the text contained in this release of
-  the library as licenced under the wxWindows Library Licence, applying
-  either version 3.1 of the Licence, or (at your option) any later version of
-  the Licence as published by the copyright holders of version
-  3.1 of the Licence document.
-
-  2. The exception is that you may use, copy, link, modify and distribute
-  under your own terms, binary object code versions of works based
-  on the Library.
-
-  3. If you copy code from files distributed under the terms of the GNU
-  General Public Licence or the GNU Library General Public Licence into a
-  copy of this library, as this licence permits, the exception does not
-  apply to the code that you add in this way.  To avoid misleading anyone as
-  to the status of such modified files, you must delete this exception
-  notice from such code and/or adjust the licensing conditions notice
-  accordingly.
-
-  4. If you write modifications of your own for this library, it is your
-  choice whether to permit this exception to apply to your modifications. 
-  If you do not wish that, you must delete the exception notice from such
-  code and/or adjust the licensing conditions notice accordingly.
-
-

+ 0 - 140
tigcc/pstarter/ttupfast/ttunpack.h

@@ -1,140 +0,0 @@
-/******************************************************************************
-*
-* project name:    TIGCC Tools Suite
-* file name:       ttunpack.h
-* initial date:    01/02/2001
-* authors:         thomas.nussbaumer@gmx.net
-*                  samuel@nyall.net
-*
-* description:     defines for exepack functionalities including unpack routine
-*                  (complete rewrite of TIGCC Tools Suite header file)
-*
-*   This is a 100% assembly version of the ttunpack routine, which is
-*   based on code by Pasi 'Albert' Ojala, albert@cs.tut.fi, then
-*   reduced by Thomas Nussbaumer to fit his needs.  For a full details
-*   on the algorithm see:
-*
-*	  http://www.cs.tut.fi/~albert/Dev/pucrunch/index.html
-*
-*
-* Liscense:
-*
-*   The liscense is quite similar to that of the origional version in c.
-*
-*   The code may be freely used in any non commercial application.  If
-*   you do use it please give credit to tict (http://tict.ticalc.org) and
-*   myself (Samuel Stearley).  I state this as a request but it is actually
-*   not.
-*
-*   The author(s) (Samuel/Tict/Any other contributor) make no
-*   representations or warranties about the suitability of the software,
-*   either express or implied. The author(s) shall not be liable for
-*   any damages suffered as a result of using or distributing this
-*   software.
-*
-*   If you distribute this file on a website or as part of
-*   the source of a project do not remove the liscense from this file.
-*
-*
-* $Id: ttunpack.h,v 1.1 2006-02-28 23:36:58 kevinkofler Exp $
-*
-******************************************************************************/
-#ifndef __TTUNPACK_H__
-#define __TTUNPACK_H__
-
-typedef struct {
-    unsigned char  osize_lo;   // original size lowbyte
-    unsigned char  osize_hi;   // original size highbyte
-    unsigned char  magic1;     // must be equal to TTUNPACK_MAGIC1
-    unsigned char  magic2;     // must be equal to TTUNPACK_MAGIC2
-    unsigned char  csize_lo;   // compressed size lowbyte
-    unsigned char  csize_hi;   // compressed size lowbyte
-    unsigned char  esc1;       // escape >> (8-escBits)
-    unsigned char  notused3;
-    unsigned char  notused4;
-    unsigned char  esc2;       // escBits
-    unsigned char  gamma1;     // maxGamma + 1
-    unsigned char  gamma2;     // (1<<maxGamma)
-    unsigned char  extralz;    // extraLZPosBits
-    unsigned char  notused1;
-    unsigned char  notused2;
-    unsigned char  rleentries; // rleUsed
-} TTUNPACK_HEADER;
-
-#define TTUNPACK_MAGIC1 0x54
-#define TTUNPACK_MAGIC2 0x50
-
-#define ttunpack_size(_p_)  ((unsigned short)(((TTUNPACK_HEADER*)(_p_))->osize_lo | (((TTUNPACK_HEADER*)(_p_))->osize_hi << 8)))
-#define ttunpack_valid(_p_) (((TTUNPACK_HEADER*)(_p_))->magic1 == TTUNPACK_MAGIC1 && ((TTUNPACK_HEADER*)(_p_))->magic2 == TTUNPACK_MAGIC2)
-
-#define TTUNPACK_OKAY             0
-#define TTUNPACK_NOESCFOUND     248
-#define TTUNPACK_ESCBITS        249
-#define TTUNPACK_MAXGAMMA       250
-#define TTUNPACK_EXTRALZP       251
-#define TTUNPACK_NOMAGIC        252
-#define TTUNPACK_OUTBUFOVERRUN  253
-#define TTUNPACK_LZPOSUNDERRUN  254
-
-#define GREG_UNPACK_HEXARRAY
-
-#define ttunpack_decompress ((unsigned short(*)(unsigned char*,unsigned char*))(unsigned short[])\
-{\
-0x48e7,0x1f3e,0x2c6f,0x002c,0x2a6f,0x0030,0x47ee,0x000f,0x7a00,0x1a2e,\
-0x0006,0x7e08,0x7004,0x0c2e,0x0054,0x0002,0x667c,0x0c2e,0x0050,0x0003,\
-0x6674,0x7006,0x0c2e,0x0008,0x000a,0x666a,0x0c2e,0x0080,0x000b,0x6662,\
-0x7007,0x7200,0x122e,0x0009,0x2801,0x5141,0x6254,0x7005,0x7200,0x122e,\
-0x000c,0x2241,0x5b41,0x6e46,0x7400,0x09c2,0x5342,0xe83a,0xe83d,0x7000,\
-0x1013,0x4df6,0x0010,0x49fa,0x003c,0x4a04,0x6604,0x49fa,0x0052,0x4fef,\
-0xfefc,0x244f,0x421a,0x7000,0x7207,0x7600,0x01c3,0x14c0,0x5343,0x66fa,\
-0x5240,0x51c9,0xfff2,0x244f,0x1c1e,0x4ed4,0x7000,0x4fef,0x0104,0x4400,\
-0x4cdf,0x7cf8,0x4e75,0x1ac0,0x1f06,0x301f,0x1c1e,0x1006,0xee68,0x1202,\
-0xc200,0xb205,0x66ec,0x558e,0x1c1e,0x9e44,0x6204,0x1c1e,0x5047,0x6100,\
-0x0110,0x3600,0x5340,0x6778,0x6100,0x0106,0x5200,0x662c,0x5943,0x65bc,\
-0x5843,0x1206,0x4841,0x1f1e,0x321f,0x121e,0x1c01,0xeea9,0x70ff,0x1001,\
-0x3f01,0x121f,0x41f5,0x0000,0x1018,0xd001,0x1ac0,0x51cb,0xfff8,0x4ed4,\
-0x5500,0x3209,0x671c,0xe368,0x7200,0x0fc1,0x5341,0xc206,0x9e49,0x620a,\
-0x1c1e,0x1f01,0x321f,0x1206,0x5047,0xee69,0x8041,0x7200,0x1f00,0x321f,\
-0x1f06,0x301f,0x1c1e,0x1006,0xee68,0x1200,0x4601,0x4681,0x41f5,0x1800,\
-0x1ad8,0x51cb,0xfffc,0x4ed4,0x5307,0x0f06,0x676a,0x4a07,0x6604,0x7e08,\
-0x1c1e,0x5307,0x0f06,0x6700,0x00c6,0x4a07,0x6604,0x7e08,0x1c1e,0x6170,\
-0x1600,0x6a1c,0xd603,0x5307,0x0f06,0x56c0,0x9600,0x4a07,0x6604,0x7e08,\
-0x1c1e,0x6158,0x5300,0x3f03,0x1e80,0x361f,0x614e,0x0c00,0x0020,0x6406,\
-0x1033,0x0000,0x601a,0xe708,0x1206,0x5747,0x620a,0x1c1e,0x1f01,0x321f,\
-0x1206,0x5047,0xee69,0x0201,0x0007,0x8001,0x1ac0,0x51cb,0xfffc,0x4ed4,\
-0x4a07,0x6604,0x7e08,0x1c1e,0x1f06,0x321f,0x1c1e,0x1206,0xee69,0x76ff,\
-0x1601,0x41f5,0x3800,0x1ad8,0x1ad8,0x4ed4,0x7000,0x3207,0x0fc0,0x5340,\
-0xcc00,0xbd00,0x6606,0x1016,0x4600,0x5041,0x9232,0x0000,0x0c01,0x0008,\
-0x6504,0x7208,0x5247,0x9e41,0x6204,0x5047,0x1c1e,0x7000,0x5301,0x6716,\
-0x0fc0,0x5340,0xc006,0x9e41,0x620a,0x1c1e,0x1f00,0x301f,0x1006,0x5047,\
-0xee68,0x03c0,0x4e75,0x4a07,0x6604,0x7e08,0x1c1e,0x1f06,0x301f,0x101e,\
-0x1c00,0xee68,0x1205,0x1a02,0xca00,0x4602,0xc002,0x4602,0x8001,0x1ac0,\
-0x4ed4})
-
-#endif
-
-//=============================================================================
-// Revision History
-//=============================================================================
-//
-// $Log: not supported by cvs2svn $
-//
-// Revision 2.0  2004/08/30 12:00:00  Samuel Stearley
-// New extraction routine in 100% asm.
-//
-// Revision 1.4  2002/03/28 21:17:28  tnussb
-// project name in header changed to TIGCC Tools Suite
-//
-// Revision 1.3  2002/03/13 15:09:58  tnussb
-// new exepack decompression function generated from old/unpack.c added
-// (its a little bit smaller now). The new function should work as the old one,
-// but if there are problems I will leave the old hexcode array here, too
-//
-// Revision 1.2  2001/02/05 20:33:01  Thomas Nussbaumer
-// (1) magic of ttunpack header splitted again into 2 bytes to prevent address errors
-// (2) new (stable?) pc-relative version of unpacking routine
-//
-//
-
-
- 

+ 0 - 663
tigcc/pstarter/ttupfast/unpack.asm

@@ -1,663 +0,0 @@
-;-----------------------------------------------------------------------
-;INTRODUCTION:
-;
-;   This is a 100% assembly version of the ttunpack routine, which is
-;   based on code by Pasi 'Albert' Ojala, albert@cs.tut.fi, then
-;   reduced by Thomas Nussbaumer to fit his needs.  For a full details
-;   on the algorithm see:
-;
-;	  http://www.cs.tut.fi/~albert/Dev/pucrunch/index.html
-;
-;   Version 2.28 Fast
-;
-;
-;THE LICENSE:
-;
-; Copyright (C) 2004-2005 Samuel Stearley
-;
-;               wxWindows Library Licence, Version 3.1
-;               ======================================
-;
-; Copyright (C) 1998-2005 Julian Smart, Robert Roebling et al
-;
-; Everyone is permitted to copy and distribute verbatim copies
-; of this licence document, but changing it is not allowed.
-;
-;                      WXWINDOWS LIBRARY LICENCE
-;    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-;
-; This library is free software; you can redistribute it and/or modify it
-; under the terms of the GNU Library General Public Licence as published by
-; the Free Software Foundation; either version 2 of the Licence, or (at
-; your option) any later version.
-;
-; This library is distributed in the hope that it will be useful, but
-; WITHOUT ANY WARRANTY; without even the implied warranty of
-; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
-; General Public Licence for more details.
-;
-; You should have received a copy of the GNU Library General Public Licence
-; along with this software, usually in a file named COPYING.LIB.  If not,
-; write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
-; Boston, MA 02111-1307 USA.
-;
-; EXCEPTION NOTICE
-;
-; 1. As a special exception, the copyright holders of this library give
-; permission for additional uses of the text contained in this release of
-; the library as licenced under the wxWindows Library Licence, applying
-; either version 3.1 of the Licence, or (at your option) any later version of
-; the Licence as published by the copyright holders of version
-; 3.1 of the Licence document.
-;
-; 2. The exception is that you may use, copy, link, modify and distribute
-; under your own terms, binary object code versions of works based
-; on the Library.
-;
-; 3. If you copy code from files distributed under the terms of the GNU
-; General Public Licence or the GNU Library General Public Licence into a
-; copy of this library, as this licence permits, the exception does not
-; apply to the code that you add in this way.  To avoid misleading anyone as
-; to the status of such modified files, you must delete this exception
-; notice from such code and/or adjust the licensing conditions notice
-; accordingly.
-;
-; 4. If you write modifications of your own for this library, it is your
-; choice whether to permit this exception to apply to your modifications. 
-; If you do not wish that, you must delete the exception notice from such
-; code and/or adjust the licensing conditions notice accordingly.
-;
-;
-;NOTES:
-;
-;1) There were several other names associated with this, but not
-;   anymore ;)
-;
-;
-;2) There should be an unpack.c distributed with this that has
-;   additional comments that will help clarify what this is doing.
-;   But maybe not.  It depends on where you got this.  you should
-;   always be able to find this on my site:  http://www.nyall.net
-;
-;
-;3) If caller wants, they can alter the default int priority to
-;   speed up execution before calling this routine.
-;
-;
-;4) The code was written with wordpad.  It might look better if
-;   opened with that program.
-;
-;
-;5) A version of this is included as a hex array for use with programs
-;   written with tigcc.  OR you can use this file directly with a
-;   tigcc project: add it to the project and remove the ';' from
-;   before the 'CALL_DIRECTLY' below.  Be sure to have the latest
-;   version of tigcc when doing this.
-;----------------------------------------------------------------------
-
-;CALL_DIRECTLY		;if this label is defined then this code can be used
-				;  directly as part of a tigcc project.
-
-DELTA_LZ			;If defined it will include code to do DELTA lz decompression
-				;  ebooks and ppg compressed programs currently do not take advantage of
-				;  the -fdelta option of the compressor.
-
-;UNROLL_RLE
-
-;UNROLL_LZ
-
-
-
- ifd CALL_DIRECTLY
-	public ttunpack_decompress
- endc
-
-
- ifnd CALL_DIRECTLY
-	include "os.h"
-	xdef _ti89
-	xdef _nostub
- endc
-
-
-
-osize_lo		equ	0	;original size lowbyte
-osize_hi		equ	1	;original size highbyte
-magic1		equ	2	;must be equal to UNPACK_MAGIC1
-magic2		equ	3	;must be equal to UNPACK_MAGIC2
-csize_lo		equ	4	;compressed size lowbyte
-csize_hi		equ	5	;compressed size lowbyte
-esc1			equ	6	;escape >> (8-escBits)
-notused3		equ	7	;
-notused4		equ	8	;
-esc2			equ	9	;escBits
-gamma1		equ	10	;maxGamma + 1
-gamma2		equ	11	;(1<<maxGamma)
-extralz		equ	12	;extraLZPosBits
-notused1		equ	13	;
-notused2		equ	14	;
-rleentries		equ	15	;rleUsed
-
-HEADER_SIZE		equ	16
-
-__MAGIC_CHAR1	equ	$54
-__MAGIC_CHAR2	equ	$50
-
-__ERRPCK_OKAY		equ	0
-__ERRPCK_NOESCFOUND	equ	8		;248
-__ERRPCK_ESCBITS		equ	7		;249
-__ERRPCK_MAXGAMMA		equ	6		;250
-__ERRPCK_EXTRALZP		equ	5		;251
-__ERRPCK_NOMAGIC		equ	4		;252
-__ERRPCK_OUTBUFOVERRUN	equ	3		;253
-__ERRPCK_LZPOSUNDERRUN	equ	2		;254
-
-;-----------------------------------------------------------------------
-;Notes on register useage, might be good Idea to print this.
-;
-;	a0 => trashing, but may not be used by the subroutines
-;	a1 => extra z position bits
-;	a2 => a table that maps a byte to the highest bit set in it.
-;	a3 => the bytecodevec table
-;	a4 => The point to jump to when doing a continue
-;	a5 => the destination buffer
-;	a6 => points to the next byte of the compressed data.
-;		updated when d7 overflows.
-;
-;	d0 => trashing, output of __GetBits and __GetValue
-;	d1 => trashing, input to __GetBits
-;	d2 => prepared mask for isolating # of escape bits
-;	d3 => trashing but only by the main routine, not the subroutines
-;		It is usually the prepared count.
-;	d4 => # of escape bits
-;	d5 => start escape
-;	d6 => the current compressed byte, updated when d7 overflows.
-;	d7 => which bit we are at in the compressed data.
-;-----------------------------------------------------------------------
-
-CORRECT_IN_MASK	MACRO
-	tst.b		d7
-	bne.s		\@fun
-	moveq		#8,d7
-	move.b	(a6)+,d6
-\@fun
-	ENDM
-
-
-
-ttunpack_decompress:
-
- ifnd CALL_DIRECTLY
-	dc.b		"UNPACK_0"
- endc
-
-	movem.l	d3-d7/a2-a6,-(a7)
-	move.l	4+10*4(a7),a6
-	move.l	8+10*4(a7),a5
-;--------------------------------------------------------
-;  startesc = cth->esc1;     //d5
-;  bytecodevec = &src[15];   //a3
-;  __imask__   = 0x80;	     //d7
-;
-;These are initialized here to insure that certain
-;branches can use the short form.
-;--------------------------------------------------------
-	lea		15(a6),a3			;'bytecodevec'
-	moveq		#0,d5
-	move.b	esc1(a6),d5			;'StartEsc'
-	moveq		#8,d7				;which bit i am at
-;-------------------------------------------------------------------------------------------------
-;  if (cth->magic1 != __MAGIC_CHAR1 || cth->magic2 != __MAGIC_CHAR2) return __ERRPCK_NOMAGIC;
-;  if (cth->gamma1 != 8 || cth->gamma2 != 128)                       return __ERRPCK_MAXGAMMA;
-;  if ((escbits = cth->esc2) > 8)                                    return __ERRPCK_ESCBITS;
-;  if ((extralzposbits = cth->extralz) > 4)                          return __ERRPCK_EXTRALZP;
-;-------------------------------------------------------------------------------------------------
-	moveq		#__ERRPCK_NOMAGIC,d0
-	cmp.b		#__MAGIC_CHAR1,magic1(a6)	;these could be optimized into 1 word compare
-	bne.s		__ReturnError			;  if evenly aligned.
-	cmp.b		#__MAGIC_CHAR2,magic2(a6)
-	bne.s		__ReturnError
-
-	moveq		#__ERRPCK_MAXGAMMA,d0
-	cmp.b		#8,gamma1(a6)
-	bne.s		__ReturnError
-	cmp.b		#128,gamma2(a6)
-	bne.s		__ReturnError
-
-	moveq		#__ERRPCK_ESCBITS,d0
-	moveq		#0,d1
-	move.b	esc2(a6),d1
-	move.l	d1,d4
-	subq.w	#8,d1
-	bhi.s		__ReturnError
-
-	moveq		#__ERRPCK_EXTRALZP,d0
-	moveq		#0,d1
-	move.b	extralz(a6),d1
-	move.l	d1,a1			;extralz pos bits
-	subq.w	#5,d1
-	bgt.s		__ReturnError
-;--------------------------------------------------------
-;  escbits8 = 8 - escbits;   //not used
-;  __ibuffer__ = src + sizeof(__PACKHEADER) + cth->rleentries;  //a6
-;--------------------------------------------------------
-	moveq		#0,d2
-	bset		d4,d2
-	subq.w	#1,d2			;the mask for the number of escape bits
-	ror.b		d4,d2			;set the upper bits
-	ror.b		d4,d5			;shift up start escape
-	moveq		#0,d0
-	move.b	(a3),d0		
-	lea		HEADER_SIZE(a6,d0),a6
-;--------------------------------------------------------
-;To remove checking if escbits == 0 in the literal byte
-;  loop, there are two points used for continuing.
-;--------------------------------------------------------
-	lea		__ReturnPointForNonZeroEscapeBits(pc),a4
-	tst.b		d4
-	bne.s		__Skipper
-	lea		__SelIsStartEscape(pc),a4
-__Skipper:
-;--------------------------------------------------------
-;a2 will point to a table that maps a byte to the
-;  highest bit set in it.  0 will be mapped to zero,
-;  this is important.
-;--------------------------------------------------------
-	lea		-260(a7),a7
-	move.l	a7,a2
-	clr.b		(a2)+
-	moveq		#0,d0
-	moveq		#7,d1
-AllBytes:
-	moveq		#0,d3
-	bset		d0,d3
-ThisByte:
-	move.b	d0,(a2)+
-	subq.w	#1,d3
-	bne.s		ThisByte
-	addq.w	#1,d0
-	dbra    	d1,AllBytes
-	move.l	a7,a2
-	move.b	(a6)+,d6		;very first byte of compressed data
-	jmp		(a4)			;jump into the loop
-;---------------------------------------------------------
-;And when all is done branch here
-;---------------------------------------------------------
-__WeAreDone:
-	moveq		#0,d0			;return value
-	lea		260(a7),a7
-__ReturnError:
-	neg.b		d0			;turn loaded error code into actual value
-	movem.l	(a7)+,d3-d7/a2-a6
-	rts
-
-;---------------------------------------------------------
-;  *outbuffer++ = (sel<<escbits8) | __GetBits(escbits8);
-;  continue;
-;---------------------------------------------------------
-__SelIsNOTStartEscape:
-	move.b	d0,(a5)+			;put litteral byte to the output
-;---------------------------------------------------------
-;The while(1) loop:
-;
-;  sel = (escbits) ? __GetBits(escbits) : startesc;
-;  if (sel == startesc) {
-;---------------------------------------------------------
-__ReturnPointForNonZeroEscapeBits
-	move.b	d6,-(a7)
-	move.w	(a7)+,d0
-	move.b	(a6)+,d6
-	move.b	d6,d0
-	lsr.w		d7,d0				;__get8bits() done
-	move.b	d2,d1
-	and.b		d0,d1				;isolate the upper escape bits
-	cmp.b		d5,d1				;are they 'startesc'
-	bne.s		__SelIsNOTStartEscape
-	subq.l	#2,a6
-	move.b	(a6)+,d6
-	sub.w		d4,d7
-	bhi.s		__StillInSameByte2
-	move.b	(a6)+,d6
-	addq.w	#8,d7
-__StillInSameByte2:
-;---------------------------------------------------------
-;The following code is entered if sel == startesc
-;but it does not actually use the sel variable
-;
-;  lzlen = __GetValue();
-;  if (lzlen != 1) {
-;---------------------------------------------------------
-__SelIsStartEscape:
-	bsr		__GetValue		;get a value for 'lzlen'
-	move.w	d0,d3			;save 'lzlen'
-	subq.w	#1,d0			;does 'lzlen' == 1 ?
-	beq.s		__RleDecoding
-;---------------------------------------------------------
-;Zip decoding
-;
-;  lzposhi = __GetValue() - 1;
-;  if (lzposhi == 254) {
-;---------------------------------------------------------
-
- ifnd DELTA_LZ
-	bsr		__GetValue		;if it equals 254, then lzlen must be > 3 because
-	addq.b	#1,d0			;  there is no other possiblity because Delta decompression
-	beq.s		__WeAreDone		;  is not being used.  It the branch is not taken it
- endc						;  drops through to the __LzPosHi_IsNot254
-
-
- ifd DELTA_LZ
-		bsr		__GetValue		;get 'lzposhi', dont subtract 1 yet
-		addq.b	#1,d0			;does 'lzposhi' == 254, remember it has not yet subtracted 1
-		bne.s		__LzPosHi_IsNot254
-		subq.w	#4,d3			;is 'lzlen' greater than 3?
-		bcs.s		__WeAreDone		;destination is above
-	;---------------------------------------------------------
-	;  add   = __Get8Bit();			//put into d1
-	;  lzpos = __Get8Bit() ^ 0xff;	//put into d0
-	;
-	;take advantage of the fact that two __Get8Bit's are used
-	;sequentially by inlining them.
-	;
-	;the bit inverstion and the pointer subtraction will be
-	;  combined
-	;---------------------------------------------------------
-		addq.w	#4,d3			;undo above subq.w
-		move.b	d6,d1			;put current byte into d1
-		swap		d1			;put it in the upper word
-		move.b	(a6)+,-(a7)		;get the second byte
-		move.w	(a7)+,d1		;put it in d1
-		move.b	(a6)+,d1		;the third byte
-		move.b	d1,d6
-		lsr.l		d7,d1
-		moveq		#-1,d0
-		move.b	d1,d0			;d0 is -'lzpos' +1
-		move.w	d1,-(a7)
-		move.b	(a7)+,d1		;shift it 8 bits to the right
-	;---------------------------------------------------------
-	;  for (i=0; i<=lzlen; i++) {
-	;    *outbuffer = *(outbuffer - lzpos - 1) + add;
-	;    outbuffer++;
-	;  }
-	;---------------------------------------------------------
-		lea		0(a5,d0.w),a0
-	__WriteDataLoop2:
-		move.b	(a0)+,d0
-		add.b		d1,d0
-		move.b	d0,(a5)+
-		dbra		d3,__WriteDataLoop2
-		jmp		(a4)				;continue
- endc
-;----------------------------------------------------------------------------------------
-;  if (extralzposbits) lzposhi = (lzposhi<<extralzposbits) | __GetBits(extralzposbits);
-;  lzposlo = __Get8Bit() ^ 0xff;
-;  lzpos   = COMBINE_LOWHIGH(lzposlo,lzposhi);
-;
-; d0= lzPosHi, d3.w = lzlen, d1.l =lzpos
-;----------------------------------------------------------------------------------------
-__LzPosHi_IsNot254:
-	subq.b	#2,d0				;undo the addq.b #1
-	move.w	a1,d1				;is 'extralzposbits' == 0?
-	beq.s		__extralZposBitsIsZero
-	lsl.w		d1,d0				;shift it by 'extralzposbits'
-	moveq		#0,d1
-	bset.w	d7,d1
-	subq.w	#1,d1
-	and.b		d6,d1
-	sub.w		a1,d7
-	bhi.s		__StillInSameByte61
-	move.b	(a6)+,d6
-	move.b	d1,-(a7)
-	move.w	(a7)+,d1
-	move.b	d6,d1
-	addq.w	#8,d7
-__StillInSameByte61:
-	lsr.w		d7,d1
-	or.w		d1,d0				;or them back together
-__extralZposBitsIsZero:				;at this point d0.b == 'lzposhi'
-	moveq		#0,d1
-	move.b	d0,-(a7)			;a faster way to do lsl.w #8
-	move.w	(a7)+,d1			;shift it into the high byte of 'lzpos', first step of COMBINE_LOWHIGH
-	move.b	d6,-(a7)			;start the __Get8Bit
-	move.w	(a7)+,d0
-	move.b	(a6)+,d6
-	move.b	d6,d0
-	lsr.w		d7,d0				;get 8 bit done
-	move.b	d0,d1				;COMBINE_LOWHIGH
-	not.b		d1
-	not.l		d1
-;-----------------------------------------------------------------------------------
-;  for (i=0; i<=lzlen; i++) {
-;    *outbuffer = *(outbuffer - lzpos - 1); //no 'add' variable
-;    outbuffer++;
-;  }
-;
-; d2.l must be -lzpos+1
-; d3.w must be lzlen
-;------------------------------------------------------------------------------------
-	lea		0(a5,d1.l),a0
-
- ifd UNROLL_LZ
-	lsr.w		#1,d3
-	bcc.s		__FirstByte
-__WriteDataLoop:
-	move.b	(a0)+,(a5)+
-__FirstByte:
-	move.b	(a0)+,(a5)+
-	dbra		d3,__WriteDataLoop
- endc
-
- ifnd UNROLL_LZ
-__WriteDataLoop:
-	move.b	(a0)+,(a5)+
-	dbra		d3,__WriteDataLoop
- endc
-
-	jmp		(a4)				;continue
-;----------------------------------------------------------------------
-;'lzlen' = 1
-;    RLE decoding, OR 2 byte zip, OR escape from the escape
-;----------------------------------------------------------------------
-__RleDecoding:
-	subq.b	#1,d7
-	btst.b	d7,d6
-	beq.s		__NextBitClear_DoZipAfterAll
-
- CORRECT_IN_MASK
-
-;The second NEXT_BIT_SET()
-
-	subq.b	#1,d7
-	btst.b	d7,d6
-	beq		__NextBitIsClear_EscapeFromEscape
-;-----------------------------------------------------------------
-;  rlelen = __GetValue();
-;  if (rlelen >= 128) {
-;     rlelen = ((rlelen-128)<<1) | __GetBits(1);
-;     rlelen |= (((__GetValue())-1)<<8);
-;  }
-;------------------------------------------------------------------
-__NextBitIsSet_RunLengthEncoding:
- CORRECT_IN_MASK
-
-	bsr.s		__GetValue		;get 'rlelen' into d0, limited to 8 bit values.
-	move.b	d0,d3			;copy it and check sign bit to see if >= 128
-	bpl.s		__LessThan128
-;	sub.w		#128,d3		;not needed
-	add.b		d3,d3			;double it, this clears the high bit so there is no need to subtract 128
-
-;-----An Inlined version of __GetBits optimized for an input of 1 --------
-
-	subq.b	#1,d7
-	btst.b	d7,d6
-	sne		d0
-	sub.b		d0,d3			;subtract -1 if the bit was set = add 1
- CORRECT_IN_MASK
-
-	bsr.s		__GetValue
-	subq.b	#1,d0
-	move.w	d3,-(a7)
-	move.b	d0,(a7)
-	move.w	(a7)+,d3
-;-------------------------------------------------------------------
-;Need the byte to copy
-;
-;  bytecode = __GetValue();
-;  if (bytecode < 32) byte = bytecodevec[bytecode];
-;  else               byte = ((bytecode-32)<<3) | __GetBits(3); //subracting 32 not needed
-;-------------------------------------------------------------------
-__LessThan128:
-	bsr.s		__GetValue			;get bytecode
-	cmp.b		#32,d0
-	bcc.s		__GreaterThanOrEqual32
-	move.b	0(a3,d0.w),d0		;byte = bytecodevec[bytecode];
-	bra.s		__RleCopy
-__GreaterThanOrEqual32:
-
-;-----An Inlined version of GetBits that is optimized for an input of 3-------
-
-	lsl.b		#3,d0
-	move.b	d6,d1
-	subq.w	#3,d7
-	bhi.s		__StillInSameByte2345
-	move.b	(a6)+,d6
-	move.b	d1,-(a7)
-	move.w	(a7)+,d1
-	move.b	d6,d1
-	addq.w	#8,d7
-__StillInSameByte2345:
-	lsr.w		d7,d1
-	and.b		#$7,d1
-	or.b		d1,d0
-;--------------------------------------------------------
-;  for (i=0; i<=rlelen; i++) *outbuffer++ = byte;
-;  continue;   // continue the main loop ...
-;
-;Rle loop expects
-; d0 = byte
-; d3 = number of em to copy, no need to subtract 1 for
-;	 dbra
-;--------------------------------------------------------
-__RleCopy:
-
- ifd UNROLL_RLE
-	lsr.w		#1,d3
-	bcc.s		__FirstRleByte
-__RleLoop:
-	move.b	d0,(a5)+
-__FirstRleByte:
-	move.b	d0,(a5)+
-	dbra		d3,__RleLoop
- endc
-
- ifnd UNROLL_RLE
-__RleLoop:
-	move.b	d0,(a5)+
-	dbra		d3,__RleLoop
- endc
-
-	jmp		(a4)
-;---------------------------------------------------------
-;  lzpos = __Get8Bit() ^ 0xff;
-;---------------------------------------------------------
-__NextBitClear_DoZipAfterAll:
- CORRECT_IN_MASK
-	move.b	d6,-(a7)		;current byte
-	move.w	(a7)+,d1
-	move.b	(a6)+,d6		;next byte
-	move.b	d6,d1
-	lsr.w		d7,d1
-	moveq		#-1,d3
-	move.b	d1,d3
-	lea		0(a5,d3.l),a0
-	move.b	(a0)+,(a5)+
-	move.b	(a0)+,(a5)+		;'lzlen' is 1, means 2 byte copy.
-	jmp		(a4)			;continue
-;-------------------------------------------------------------
-;  __GetValue returns a value in d0.l
-;  __GetBits takes as its input d1.b, returns a value in d0.l
-;
-; The outputs can be manipulated as:
-;	unsigned character,
-;	unsigned shorts,
-;	unsigned longs
-;
-; They may update
-;	d6, d7, a6
-;
-; They may not destroy 
-;	d3-d5/a0-a5
-;
-; They expect a2 to be a table that tells the number of the
-;	highest bit that is set
-;
-;--------------------------------------------------------------
-__GetValue:					;This function has a goal of counting till it finds
-	moveq		#0,d0
-	move.w	d7,d1
-	bset.w	d7,d0
-	subq.w	#1,d0			;made the mask
-	and.b		d0,d6			;mask out bits of interest, clear bits that we have already
-						;  passed by
-	eor.b		d6,d0			;invert the bits of interest
-	bne.s		__BitsSetInThisByte
-	move.b	(a6),d0
-	not.b		d0
-	addq.w	#8,d1
-__BitsSetInThisByte:
-	sub.b		0(a2,d0.w),d1
-	cmp.b		#8,d1
-	bcs.s		__LessThan7
-	moveq		#8,d1
-	addq.w	#1,d7
-__LessThan7:
-	sub.w		d1,d7
-	bhi.s		__SameByte
-	addq.w	#8,d7
-	move.b	(a6)+,d6
-__SameByte:
-	moveq		#0,d0
-	subq.b	#1,d1
-	beq.s       __inl_exit4
-	bset.w	d7,d0
-	subq.w	#1,d0
-	and.b		d6,d0
-	sub.w		d1,d7
-	bhi.s		__StillInSameByte4
-	move.b	(a6)+,d6
-	move.b	d0,-(a7)
-	move.w	(a7)+,d0
-	move.b	d6,d0
-	addq.w	#8,d7
-__StillInSameByte4:
-	lsr.w		d7,d0
-__inl_exit4:
-	bset.b	d1,d0
-	rts
-;-----------------------------------------------------------------
-;  newesc = __GetBits(escbits);
-;  *outbuffer++ = (startesc<<escbits8) | __GetBits(escbits8);
-;  startesc = newesc;
-;  continue;
-;-----------------------------------------------------------------
-__NextBitIsClear_EscapeFromEscape:
- CORRECT_IN_MASK
-	move.b	d6,-(a7)
-	move.w	(a7)+,d0
-	move.b	(a6)+,d0
-	move.b	d0,d6
-	lsr.w		d7,d0			;get8bits done
-	move.b	d5,d1			;save old 'startesc'
-	move.b	d2,d5
-	and.b		d0,d5			;set the new start esc
-	not.b		d2
-	and.b		d2,d0			;isolate the lower bits
-	not.b		d2
-	or.b		d1,d0			;recombine
-	move.b	d0,(a5)+
-	jmp		(a4)
-
-
- ifnd CALL_DIRECTLY
-	dc.b		"UNPACK_1"
- endc