;
;
; This RSX displays a history trace of <svc nr> of bdos calls.
;
; (C) 1986 by Michael D. Kersenbrock  Aloha, Oregon
;

serial:	db	0,0,0,0,0,0

start:	jmp	trace

next:	jmp	$-$

prev:	dw	0

remove:	db	0ffh		; remove with next load

nonbank: db	0		; both banked and non-banked are OK

thename:
	db	'BDOSTRSX'	; BDOS tracing RSX name

loader:	db	0		; load for banked AND non-banked systems

	db	0,0		; system use junque


trace:	push	psw		; save all at entry
	push	d
	push	h
	push	b

	mvi	a,'<'		; get leading output indicator
	call	putchar		; put to console screen
	pop	b		; get bdos function number
	push	b	
	mov	a,c		
	rrc!rrc!rrc!rrc		; put msn into lsn
	call	trascii		; translate msn to ascii
	call	putchar		; send it to console screen
	pop	b		; get function number again
	push	b
	mov	a,c
	call	trascii		; translate lsn to ascii
	call	putchar		; send it to console screen
	mvi	a,'>'		; get output string terminator
	call	putchar		; put it to screen
	pop	b		; return all registers back
	pop	h
	pop	d
	pop	psw
	jmp	next		; and let it continue with its business


trascii:
	ani	0fh		; make lsn "clean"
	adi	'0'		; assume it is numeric at first
	cpi	'9'+1		; numeric?
	rc			; yup
	adi	'A'-'0'-0ah	; nope, must be A-F
	ret

putchar:
	mvi	c,06h		; direct console i/o bdos call
	mov	e,a		; put character into place
	jmp	next		; put character to the screen, then return to
				; trace routine above (that called putchar).
w		; save all at entry
	push	d
	push	h
	push	