; ----- Print a registration form (REGISTER.FRM) ------------------
;	----------------------------------------
;	Open the form-file
;
	SET FLAG(9) OFF			; Clear ESC flag
	ON ESCAPE GOSUB Escape		; Set ESC handler
	FOPENI "register.frm" text
	IF FAILED
	   WOPEN 10,1  12,78 (default) ESCAPE
	   ATSAY 10,3  (default) " Print Registration "
	   ATSAY 11,3  (default) "REGISTER.FRM is not on the current subdirectory."
	   ATSAY 12,29 (default) " Press any key to exit "
	   KEYGET S0			; Wait for any key
	   WCLOSE			; Close open window
	   GOTO Exit			; Exit if ESC
	   ENDIF
;
;	Wait for the printer to be prepared...
;
	WOPEN 10,1  12,78 (default) ESCAPE
	ATSAY 10,3  (default) " Print Registration "
	ATSAY 11,3  (default) "Please prepare the printer.  Press any key to start."
	ATSAY 12,30 (default) " Press ESC to cancel "
	KEYGET S0			; Wait for any key
	WCLOSE				; Close open window
	IF FLAG(9) GOTO Exit		; Exit if ESC
	GOTO Start
;
; ----- Subroutine: ESC handler: Close open windows and exit script
;
Escape:
	SET FLAG(9) ON			; Mark ESC pressed
	RETURN
;
; ----- Exit routine
;
Exit:
	IF FCALLED FRET			; Return if fcalled
	EXIT
;
; ----- Print registration form
;
Start:
	READ S0 80 N0			; Read a line of the form
	IF NOT EOF			; If not end-file
	   PRESERVE S0			; Preserve !s ^s and `s
	   PRINT S0&""			; Print the line
	   PRINT "^M^J"			; .. and a cr/lf
	   IF FLAG(9) GOTO Exit		; Exit on Escape
	   GOTO Start			; Loop until EOF
	   ENDIF
;
;	End-File on input
;
	PRINT "^L"			; Print a final tof
	FCLOSEI				; Close input file
	GOTO Exit			; And done
