NEW
PREFIX
AUTO 4,1
				.LIST OFF	
*--------------------------------------
Pak.In.Init		>LDYA Pak.SrcPtr
				>STYA ZPSrcPtr

				lda Pak.Hdr+S.PAKHDR.LEN
				eor #$ff
				sta Pak.SrcCnt
				
				lda Pak.Hdr+S.PAKHDR.LEN+1
				eor #$ff
				sta Pak.SrcCnt+1

				rts
*--------------------------------------
Pak.In.GetRH	lda #$ff
				cmp Pak.SrcCnt+1		return 255 if not $ffxx
				bne .1
				
				lda Pak.SrcCnt
				eor #$ff				return !xx if $ffxx
				
.1				rts	
*--------------------------------------
Pak.In.MoveFWA	clc
				adc ZPSrcPtr
				sta ZPSrcPtr
				bcc .8
				inc ZPSrcPtr+1
				
.8				rts
*--------------------------------------
Pak.In.Get8Bits	ldy #8
				.HS 2C					bit abs
Pak.In.Get4Bits	ldy #4
				lda #0					make sure to reset A before reading less than 8 bits only	
.1				jsr Pak.In.GetBit		and to exit with CC if even if 8 bits read
				rol
				dey
				bne .1
				rts						always CC
*--------------------------------------
Pak.In.GetBit	ldx Pak.In.Mask
				bne .1
				jsr Pak.In.NxtByte
				
				ldx #8
				
.1				dex				
				stx Pak.In.GetBit+1
				
				pha						Don't trash A
				lda (UnZPSrcPtr)
				and Pak.In.BitMask,x
				cmp #1					if 0:CC, i>0 CS
				
				pla
				rts						Bit is in C				
*--------------------------------------
Pak.In.GetByte	lda (UnZPSrcPtr)
Pak.In.NxtByte	inc UnZPSrcPtr
				bne .8
				inc UnZPSrcPtr+1
.8				rts
*--------------------------------------
MAN
SAVE USR/SRC/LIB/LIBPAK.S.IN
ASM
