; -*- MIDAS -*-

	TITLE RMAIL LOADER

;Assemble this into SYS1; TS RMAIL.
;Runs SYS2;TS EMACS with jcl of "2,MM RMAIL" and whatever JCL you gave it.
;The "2," causes it to kill itself if exited with Q but not if exited
;temporarily with ^X.  Also have to save and restore Q9 which it smashes somewhere.
;Only works under DDT.

A=1
B=2
C=3
D=4
E=5
P=17

VAL:	ASCII /    :JCL /	;10 characters
JCL:	ASCII /[9 2,MM RMAIL/	;15 characters
JCL1:	BLOCK 200		;Original JCL here

GO:	.BREAK 12,[5,,JCL1]	;Get jcl
	MOVE A,[440700,,JCL1]	;Find end of it
FEND:	ILDB C,A
	CAIE C,^C
	 CAIN C,^M
	  JRST FENDD
	JUMPN C,FEND
FENDD:	MOVEI C,"
	DPB C,A
	MOVE B,[440700,,[ASCIZ /]9ī:LOAD DSK:SYS2;TS EMACSī:GOī/]]
PLOAD:	ILDB C,B
	IDPB C,A
	JUMPN C,PLOAD
	.VALUE VAL

	END GO
