NEW
PREFIX
AUTO 4,1
				.LIST OFF	
*--------------------------------------
Pak.Out.Init	lda #$80
				sta Pak.Out.Mask
				stz Pak.Out.Byte
				rts
*--------------------------------------
Pak.Out.Close	bit Pak.Out.Mask
				bmi .8
				lda Pak.Out.Byte
				jmp Pak.Out.PutByte
.8				clc
				rts
*--------------------------------------
Pak.Out.PutCA	jsr Pak.Out.PutBitC
				bcs Pak.Out.Put.rts

Pak.Out.PutA	ldy #8

.1				asl
				jsr Pak.Out.PutBitC
				bcs Pak.Out.Put.rts
				dey
				bne .1
				
Pak.Out.Put.rts	rts				
*--------------------------------------
Pak.Out.PutBitC	pha

				bcc .1
				lda Pak.Mask
				tsb Pak.Byte
				clc
				
.1				lsr Pak.Mask
				bne .8
				
				jsr Pak.Out.PutByte
				bcs .9
				
				jsr Pak.Out.Init
				
.8				pla
*				clc
				rts
				
.9				pla
*				sec
				rts
*--------------------------------------
Pak.Out.PutByte	inc Pak.DstCnt
				bne .1
				inc Pak.DstCnt+1
				beq .9
				
.1				ldx Pak.Pass
				bne .6
				
				phx
				tax
				
				inc Pak.CntL,x
				bne .2

				inc Pak.CntH,x
				
.2				plx
				bra .7
				
.6				sta (ZPDstPtr)

				inc ZPDstPtr
				bne .2
				inc ZPDstPtr+1
				
.7				inc Pak.Stat+S.PAKSTAT.PASS1,x
				bne .8
				inc Pak.Stat+S.PAKSTAT.PASS1+1,x
				
.8				clc
				rts
				
.9				sec
				rts
*--------------------------------------
MAN
SAVE USR/SRC/LIB/LIBPAK.S.OUT
ASM
