.nolist
#include "include.inc"
.list
.org	ProgStart83p
	B_CALL(_rclans)			;returns de as a pointer to the string
	ex	de,hl			;hl=pointer to string
	ld	c,(hl)			;c=low byte of length
	inc	hl			;high byte of length..
	ld	b,(hl)			;b=high byte of length
	inc	hl			;now we're at the (un)archive define " /*"
	ld	a,(hl)			;a='*' for archiving, ' ' for unarchiving
	push	af			;save a
	inc	hl			;start of name data
	push	hl			;save hl for _zeroOp1
	B_CALL(_zeroOp1)		;set Op1 to zeros
	pop	hl			;restore hl
	ld	a,5			;5 for program definition
	ld	(op1),a			;load it into Op1
	ld	de,op1+1		;de=pointer to op1+1
	ldir				;copy name of prog to the rest of Op1
	B_CALL(_chkfindsym)		;look it up (returns archive status in b)
	jr	c,quit			;if carry is set, program wasn't found so quit
	pop	af			;restore a - a now equals the " /*" flag
	cp	tmul			;compare it to '*'
	jr	z,archive		;if it is '*', archive the program
					;
	cp	tspace			;compare it to ' '
	ret	nz			;if it isn't ' ', quit
	ld	a,b			;load archive status of program into a
	or	a			;
	ret	z			;if it is zero,program is already unarchived so quit
	jr	done			;unarchive the prog
archive:				;
	ld	a,b			;a=archive status
	or	a			;
	ret	nz			;if it isn't zero, then the program is already archived so quit
done:	B_CALL(_arc_unarc)		;archive (or unarchive) the program, quit
	push	af
quit:
	pop	af
	ret				;quit
.end
END