 COPY NPTDEFS
 org CXBUF
 xeq start
*
glutf ds 2
sfnum ds 1              old utility file number
mfnum ds 1              my utility file number
fname ascz "!message"   name of message file
*
start lxi sp,stack
 mvi a,0FFh
 lxi d,GLERM
 lhld SYSGLO
 dad d            sets up error returns for level 1 and 2 errors
 mov m,a
 inx h
 mov m,a
 lhld SYSGLO
 lxi d,GLERS
 dad d
 mov m,a
 inx h
 mov m,a
*
 lxi d,GLUTF
 lhld SYSGLO
 dad d
 shld glutf       saves actual GLUTF for later
 mov a,m
 sta sfnum              saves sytem utility file #
*
 lxi h,0
 lxi d,fname
 call SYS           opens my utility file
 db OPEOP
 jmp error
*
 sta mfnum
 lhld glutf        sets the system utilty file to my file #
 mov m,a
*                          generate a random byte in A
 lda random
 lxi h,0
rloop add m
 inr h
 jnz rloop
 sta 0
*
 ani 01Fh           only 32 message so far
 sta random
 call UTIL            read random module from message file
random ds 1
 jmp error
*                   HL will now point at the message string
loop mov a,m
 cpi 0              prints string
 jz done
 call CONOUT
 inx h
 jmp loop
*
done lda sfnum
 lhld glutf        reset system utility file number
 mov m,a
 lda mfnum
 call SYS       close my utility file
 db CLOOP
 jmp error
 call SYS         return to operating system
 db RETOP
*
error lda sfnum
 lhld glutf           resets system utility file number
 mov m,a
 jmp RESET
*
stack equ 0CB00h      SOLOS scratch area

