	title	MLOAD Test Programm

; Das Programm stellt generische CP/M Routinen zur Verfuegung.

	aseg
	org	0200h

BDOS	equ	0005h

.condir	equ	6

lf	equ	0ah
eot	equ	'$'

; Sprungleiste

	jp	setmem
	jp	clrscr
	jp	atxy
	jp	idstrg

; ------------------------------------
;
; Speicherinitialisierung
; Registerpaar HL haelt die hoechste Speicheradresse
; Diese wird abgelegt und als Stackpointer verwendet
; Bei Rueckkehr haelt Registerpaar HL die erste freie Adresse
;
setmem:
	ld	(last),hl	; Adresse speichern
	pop	bc
	ld	sp,hl		; Stackpointer laden
	push	bc
	ld	hl,top		; Freie Adresse laden
	ret
;
; Bildschirm loeschen
;
clrscr:
	ld	b,24		; Anzahl Zeilen
clr:
	ld	a,lf
	call	cot		; Zeilen vorwaerts
	djnz	clr
	ret
;
; Cursor positionieren auf H=Reihe und L=Spalte
;
atxy:
	ld	b,h		; Anzahl Zeilen
	call	clr		; Bildschirm schieben
	ld	b,l		; Anzahl Spalten
at:
	ld	a,' '
	call	cot		; Cursor nach rechts
	djnz	at
	ret
;
; Zeichen im Akku ausgebebn
;
cot:
	push	bc
	push	de
	push	hl
	ld	e,a
	ld	c,.condir
	call	BDOS		; Ausgabe
	pop	hl
	pop	de
	pop	bc
	ret
;
; Maschinennamen laden
;
idstrg:
	ld	de,$IDSTRG
	ret
$IDSTRG:
	db	'GENERIC CP/M'
	db	eot
last:
	ds	2
top:

	end


