@ COPY by Rick Grevelle.
@ Input: Port Number (2-33).
@ Bitcopies entire card in port 1 to that port then turns HP48 off.
::
  CK1NOLASTWD	*
  CK&DISPATCH1	*
  real		*
  ::		*
    COERCE
    #1- 	* - asterisked lines added by -jkh-

CODE
=BANKMTHDS	EQU	#70601
=MOVEDOWNcov	EQU	#718E5
=CONFTAB	EQU	#8052B

	GOSBVL	=POP#
	GOSBVL	=SAVPTR
	D0=(5)	(=CONFTAB)+4
	C=DAT0	X
	?CBIT=0	3		port 1 readable?
	GOYES	no_card		NO, bailout!
	?CBIT=1	1		port 1 merged?
	GOYES	no_card		YES, bailout!
	?CBIT=0	11		port 2 readable?
	GOYES	no_card		NO, bailout!
	?CBIT=0	10		port 2 writeable?
	GOYES	no_card		NO, bailout!
	P=	4
	?CBIT=1	5		port 1 128k ?
	GOYES	do_size		YES, keep size
	P=	1
do_size	C=0	A
	CPEX	4
	R2=C.F	A
	A=A-1	A
	GOC	no_card
	D0=D0+	4
	C=0	A
	C=DAT0	B
	?A<C	A		valid bank?
	GOYES	do_bank		YES, get method
no_card	LA(5)	=SETPORTNOTAV
	GOSBVL	=GETPTR
	PC=(A)
do_bank	LC(5)	=BANKMTHDS
	C=C+A	A
	A=A+A	A
	A=A+A	A
	C=C+A	A
	D0=C
	C=DAT0	A
	CR2EX.F	A
	D0=(5)	#C0000
	D1=(5)	#C0000
	GOSBVL	=MOVEDOWNcov
	GOVLNG	=GETPTRLOOP
ENDCODE
    DEEPSLEEP	*
  ;
;
