User`s guide

; ******************************************
;* *
;* loop back to "ready" after each command *
;* *
;******************************************
ready:
; file is ready for processing
014b cD3C02 call readcom ;read next command
014E 227D00 shld ranrec ;store input record*
0151 217F00 lxi h,ran0vf
0154 71 mov m,c ;set ranrec high byte
0155 FE51 cpi 'Q' ;quit?
0157 C26901 jnz notq
; quit processing, close file
0isa 0E10 mvi c,closef
01SC 115C00 lxi d,fcb
015F CD0500 call bdos
0162 3C inr a ;err 255 becomes 0
0163 CaFF0l jz error ;error meSsage ' retry
0166 c30000 jmp reboot iback to ccP
;
;******************************
;* end of quit command, pr0cess write *
;* *
;***************************************************
notq:
; not the quit command, random Write?
0169 FES7 cpi 'W'
016b C29C01 jnz notw
; this is a random Write, fill buffer until cr
016E 11b302 lxi d,datmsg
0171 CD3102 call Print ;data Prompt
0174 0E7F mvi c,127 ;UP to 127 characters
0176 218000 lxi h,buff;destination
rloop: ;read next character to buff
0179 C5 push b ;save counter
017a E5 push h ;next destination
017b CD0802 call getchr;character to a
017E El pop h +;irestore counter
017F C1 pop b ;restore next to fill
0180 FE0D cpi Cr ;end of line?
0182 Ca8b0l jz erloop
4-13
4.3 A Sample Random Access Program CP/M 3 Programmer's Guide