FORMATASM;---------------------------------
;      PROGRAMM FORMAT
;
;FORMATIERUNG DER AUSGABE UEBER
;AUSGABEKANAL 2/3
;---------------------------------
	ORG 0BA00H
;
; Definition des Ausgabekanals
;
UOUT:	DEFB 2		;Nummer (2/3)
;
; Adresse des Sprungs in den Kanal + 1
;
ADROUT:	EQU 0B7BEH	;B7BE/B7C4
;
; Vorgabewerte als gepackte Dezimal-
; zahlen
;
LR:	DEFB 10H	;RAND = 10
ZMAX:	DEFB 60H	;ZEILEN = 60
;
;
NAME:	DEFM '                '
	NOP
ZEILE:	DEFB 0
SEITE:	DEFB 0
AKTIV:	DEFB 0
SPRUNG:	JP RET
FTAST:	NOP
	DEFB 05H
	NOP
	DEFB 06H
	NOP
	DEFB 9CH
	NOP
	DEFB 8FH
	NOP
	DEFB 8CH
	NOP
PARA:	LD B,A
	LD A,(0B782H)
	DEC A
	DAA
	LD (SEITE),A
	DEC B
	RET Z
	LD A,(0B784H)
	LD (LR),A
	DEC B
	RET Z
	LD A,(0B786H)
	CP 8
	JR NC R20
	LD A,8
R20:	LD (ZMAX),A
RET:	RET
	DEFW 7F7FH
	DEFM 'FORMAT'
	DEFB 1
	JR INIT2
	DEFW 0DDDDH
	DEFM 'FORMAT'
	DEFB 1
INIT0:	LD HL,FTAST
	LD DE,0B900H
	LD BC,0000BH
	LDIR
INIT2:	AND A
	CALL NZ PARA
	CALL 0F003H
	DEFB 023H
	DEFB 002H
	DEFM 'S# LR Z/S Name:"        '
	DEFM '        "'
	NOP
	LD A,16
	LD (0B7A0H),A
	CALL 0F003H
	DEFB 017H
	EX DE,HL
	LD BC,16
	ADD HL,BC
	LD DE,NAME
	LD BC,00010H
	LDIR
	XOR A
	LD (ZEILE),A
INIT1:	LD HL,AKTIV
	LD A,M
	AND A
	JR NZ R18
	INC M
	LD HL,(ADROUT)
	LD (SPRUNG+1),HL
R18:	LD HL,OUT
	LD (ADROUT),HL
	RET
OUT:	CP 9CH
	JP Z AUS
	CP 8CH
	JP Z FFEED
	CP 8FH
	RET Z
	AND 07FH
	PUSH AF
	LD A,(ZEILE)
	AND A
	CALL Z KOPF
	POP AF
	CP 0DH
	CALL Z ENDE
	CP 0AH
	RET Z
	CALL SPRUNG
	RET
KOPF:	LD HL,(SPRUNG+1)
	LD (ADROUT),HL
	LD HL,(0B7B9H)
	PUSH HL
	LD HL,UOUT
	LD (0B7B9H),HL
	LD A,0DH
	CALL SPRUNG
	CALL RAND
	LD HL,NAME
	CALL 0F003H
	DEFB 45H
	LD B,48
	CALL RAND1
	CALL 0F003H
	DEFM '#- '
	NOP
	LD HL,SEITE
	LD A,M
	INC A
	DAA
	LD M,A
	CALL 0F003H
	DEFB 01CH
	CALL 0F003H
	DEFM '# -'
	DEFW 0A0AH
	DEFW 0A0DH
	NOP
	POP HL
	LD (0B7B9H),HL
	LD HL,OUT
	LD (ADROUT),HL
	LD A,3
	LD (ZEILE),A
	CALL RAND
	RET
RAND:	LD A,(LR)
	AND A
	RET Z
	LD B,A
RAND1:	LD A,020H
	PUSH BC
	CALL SPRUNG
	POP BC
	LD A,B
	DEC A
	DAA
	LD B,A
	JR NZ RAND1
	RET
ENDE:	LD HL,ZMAX
	LD A,(ZEILE)
	INC A
	DAA
	LD (ZEILE),A
	CP M
	JR NC,FFEED
	LD A,00DH
	CALL SPRUNG
	LD A,00AH
	CALL SPRUNG
	CALL RAND
	XOR A
	RET
FFEED:	XOR A
	LD (ZEILE),A
	LD A,0CH
	CALL SPRUNG
	RES 0,(IX+08H)
	CALL 0F003H
	DEFB 004H
	XOR A
	RET
AUS:	LD HL,FREI
	LD (ADROUT),HL
	RET
FREI:	CP  08FH
	RET NZ
	LD HL,OUT
	LD (ADROUT),HL
	RET
;---------------------------------
	DEFW 0DDDDH
	DEFM 'PLABEL'
	DEFB 1
PLABEL:	CALL INIT1
	LD HL,(0B7B9H)
	PUSH HL
	LD HL,UOUT
	LD (0B7B9H),HL
	LD HL,(00074H)
	CALL 0F003H
	DEFB 2CH
	LD B,5
	JR R35
R34:	LD B,4
R33:	LD E,(HL)
	INC HL
	LD D,(HL)
	INC HL
	INC HL
	EX DE,HL
	CALL 0F003H
	DEFB 01AH
	LD C,000H
	EX DE,HL
R30:	LD A,(HL)
	CALL 0F003H
	DEFB 024H
	INC C
	INC HL
	LD A,(HL)
	CP  03AH
	JR NZ,R30
	INC HL
	LD A,9
	SUB C
	LD C,A
R31:	CALL 0F003H
	DEFB 02BH
	DEC C
	JR NZ,R31
R35:	AND A
	PUSH HL
	PUSH BC
	LD BC,(00072H)
	SBC HL,BC
	POP BC
	POP HL
	JR NC,R32
	DJNZ R33
	CALL 0F003H
	DEFB 02CH
	CALL 0F003H
	DEFB 2AH
	JR C R36
	JR R34
R32:	CALL 0F003H
	DEFB 02CH
R36:	POP HL
	LD (0B7B9H),HL
	RET
Ы€Л—У€~#ю
(ъю(тGЫ€ЛЧУ€xЙ(нн Лr(сдяяяяя