;*                 USAGE: ›,33;40mExCom ›0m[N] [C]

;*            ExCom V1.00 ©1993 by Testaware

;*        ExCom  erstellt eine ausführbare Datei
;*        die zuvor  mit  Kommandos  installiert
;*        wurde.  Der Parameter  C erstellt eine
;*        Objektdatei  die  vor  Ausführung  der
;*        Kommandos nach  einem Codewort fragt !
;*        Der Parameter N bewirkt ein sofortiges
;*        ausführen  der installierten Kommandos
;*        nach Aufruf der Kommando-Objektdatei !

;*           (w) 05/04/93 by Volker Stepprath
;* Sprache: SEKA Assembler V3.0 (PROMAX of KEFRENS `89)


;* Variablen definieren *
Execbase:	equ	   4
Open:		equ	- 30
Close:		equ	- 36
Read:		equ	- 42
Write:		equ	- 48
Output:		equ	- 60
CloseLibrary:	equ	-414
OpenLibrary:	equ	-552


;* Parameter retten *
bclr	#5,0(a0)
move.l	a0,d6


;* Hauptprogramm *
bsr	xOPENDOS
bsr	xPARAMETER
bra	xCLOSEDOS


;* Parameter auswerten *
xPARAMETER:
	move.l	d6,a1
	cmp.b	#`C`,0(a1)	;* Mit Codeabfrage ?
	beq	xCODEJA
	cmp.b	#`N`,0(a1)	;* Ohne Codeabfrage ?
	beq	xCODENEIN

	move.l	#UsageS,d2
	move.l	#UsageE,d3
	bra	xSCHREIBEN


;* Ohne Codewort [N] *
xCODENEIN:
	move.l	#InfoS,d2
	move.l	#InfoE,d3
	bsr	xSCHREIBEN

	lea	ExcomN,a2
	add.l	#98,a2		;* KommandoADR
	clr.l	d4
	bsr	xEINGABE

	move.l	#ExComN,d6	;* ObjectdateiADR
	move.l	#460,d7		;* Anzahl Bytes
	bra	xDOEXCOM


;* Mit Codewort [C] *
xCODEJA:
	move.l	#InfoS,d2
	move.l	#InfoE,d3
	bsr	xSCHREIBEN

	lea	ExcomC,a2
	add.l	#242,a2		;* KommandoADR
	clr.l	d4
	bsr	xEINGABE

	move.l	#CodeS,d2
	move.l	#CodeE,d3
	bsr	xSCHREIBEN

	move.l	#ExComC,d2
	add.l	#620,d2		;* PufferADR für Codewort
	moveq	#63,d3
	move.l	Handle,d1
	jsr	Read(a6)

	move.l	#ExComC,d6	;* ObjectdateiADR
	move.l	#744,d7		;* Anzahl Bytes
	bra	xDOEXCOM


;* Kommandos installieren *
xEINGABE:
	move.l	#EntercomS,d2
	move.l	#EntercomE,d3
	bsr	xSCHREIBEN

	move.l	Handle,d1
	move.l	#InfoS,d2
	move.l	#InfoE,d3
	sub.l	d2,d3
	jsr	Read(a6)
	subq	#1,d0
	cmp.l	#0,d0
	beq	xEINGABEEND

	move.l	#InfoS,a1
	xLOOP:
	addq	#1,d4
	cmp.l	#312,d4		;* Max. Kommandolänge in Bytes
	beq	xEINGABEEND
	move.b	(a1)+,(a2)+
	dbra	d0,xLOOP
	bra	xEINGABE
	xEINGABEEND:
	rts


;* Objectdatei erstellen *
xDOEXCOM:
	move.l	#EnterdatS,d2
	move.l	#EnterdatE,d3
	bsr	xSCHREIBEN

	move.l	Handle,d1
	move.l	#InfoS,d2
	move.l	#infoE,d3
	sub.l	d2,d3
	jsr	Read(a6)
	cmp.l	#1,d0
	beq	xFEHLER

	lea	InfoS,a0
	add.l	d0,a0
	subq	#1,a0
	move.b	#0,(a0)
	move.l	#InfoS,d1
	move.l	#1006,d2
	jsr	Open(a6)
	cmp.l	#0,d0
	beq	xFEHLER
	move.l	d0,Handledat

	move.l	Handledat,d1
	move.l	d6,d2		;* ObjectdateiADR C|N
	move.l	d7,d3		;* Anzahl Bytes C|N
	jsr	Write(a6)

	move.l	Handledat,d1
	jsr	Close(a6)
	move.l	#EndS,d2
	move.l	#EndE,d3
	bsr	xSCHREIBEN
	rts


;* Fehler aufgetreten *
xFEHLER:
	move.l	#ErrS,d2
	move.l	#ErrE,d3


;* Texte ausgeben *
xSCHREIBEN:
	move.l	Dosbase,a6
	move.l	Handle,d1
	sub.l	d2,d3
	jsr	Write(a6)
	rts


;* Library & Fenster öffnen *
xOPENDOS:
	move.l	ExecBase,a6
	move.l	#Dosname,a1
	clr.l	d0
	jsr	OpenLibrary(a6)
	move.l	d0,Dosbase

	move.l	Dosbase,a6
	jsr	Output(a6)
	move.l	d0,Handle
	rts


;* Library schließen *
xCLOSEDOS:
	move.l	ExecBase,a6
	move.l	Dosbase,a1
	jsr	CloseLibrary(a6)
	rts


;* Speicherreservierung *
Dosname:   dc.b `dos.library`,0
Dosbase:   dc.l 0
Handle:    dc.l 0
Handledat: dc.l 0

InfoS:
dc.b $9b,$c
dc.b $9b,`33;40mExCom V1.00  written in 4/93 by Volker Stepprath`,10
dc.b 10,$9b,`0mEnter some commands to execute them continously:`,10
dc.b `------------------------------------------------`,10,10
InfoE:

UsageS:
dc.b `USAGE: `,$9b,`33;40mExCom `,$9b,`0m[N] [C]`,10
dc.b `N = executes the given commands immediate !`,10
dc.b `C = first asking for a code before executing the commands.`,10
dc.b `    If answered with the wrong, your system will be reset !`,10
UsageE:

EntercomS:
dc.b $9b,`33;40mEnter command`,$9b,`0m: `
EntercomE:

CodeS:
dc.b 10,$9b,`33;40mEnter codeword`,$9b,`0m: `
CodeE:

EnterdatS:
dc.b 10,$9b,`33;40mEnter commandfile`,$9b,`0m: `
EnterdatE:

EndS:
dc.b 10,`Now copy the RUN command in the C: directory of`,10
dc.b `your bootdisk and call up your new commandfile !`,10,10
EndE:

ErrS:
dc.b 10,`Can't open commandfile !`,10,10
ErrE:

Even
ExComN:
dc.l $3F3,0,2,0,1,$60,1,$3E9,$60,$2C790000,$443F9,$32
dc.l $42804EAE,$FE682800,$2C44223C,$3E,$42824283,$4EAEFF22
dc.l $2C790000,$42244,$4EAEFE62,$4E75646F,$732E6C69,$62726172
dc.l $79000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.l 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.l 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.l $A0000,0,$3EC,2,0,8,$18,0,$3F2,$3EB,1,$3F2

ExComC:
dc.l $3F3,0,2,0,1,$A3,1,$3E9,$A3,$2C790000,$443F9,$C2
dc.l $42804EAE,$FE682800,$2C444EAE,$FFC42A00,$2205243C,$20B
dc.l $76114EAE,$FFD02205,$243C0000,$20B763F,$4EAEFFD6,$534043F9
dc.l $20B,$45F90000,$248B509,$66000022,$51C8FFF8,$223C0000
dc.l $CE4282,$42834EAE,$FF222C79,4,$22444EAE,$FE624E75
dc.l $33FC4000,$DFF09A,$2C790000,$4223C,$AAAABBBB,$2D410024
dc.l $2D410026,$2D41003E,$2D41004E,$2D410052,$2D41022A,$C6E0024
dc.l $146D04,$4EEEFD2A,$4BFA0008,$4EAEFFE2,$207C,$1000000
dc.l $91E8FFEC,$20680004,$55884E70,$4ED0646F,$732E6C69,$62726172
dc.l $79000000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.l 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.l 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dc.l $A000A,$456E7465,$7220636F,$6465776F,$72643A20,0,0,0,0,0,0
dc.l 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,$3EC,6
dc.l 0,8,$20,$2E,$3C,$42,$52,0,$3F2,$3EB,1,$3F2
