User`s guide

The program begins with an initialization section where the input file is opened or
created, followed by a continuous loop at the label ready where the individual com-
mands are interpreted. The program uses the default file control block at 005CH and
the default buffer at 0080H in all disk operations. The utility subroutines that follow
contain the principal input line processor, called readc. This particular program shows
the elements of random access processing and can be used as the basis for further
program development.
;*******************************************
;* *
;* sample random access Program for cP/m 3 *
;* *
;*******************************************
0100 org l00h ;base of tpa
0000 = reboot equ 0000h ;system reboot
0005 = bdos equ 0005h ;bdos entry Point
0001 - coninp equ 1 ;console input function
0002 - conout equ 2 ;console outPut functo0n
0009 - pstring equ 9 ;Print string until '$'
000a = rstring equ 10 ;read console buffer
000c - version equ 12 ;return version number
00of = openf equ 15 ;file open function
0010 - closef equ 16 ;close function
0016 - makef equ 22 ;make file function
0021 - readr equ 33 ;read random
0022 - Writer equ 34 ;write random
0028 - Wrtrzf equ 40 ;Write random zero fill
0098 - parsef equ 152 ;parse function
005c - fcb equ 00Sch ;default file control block
007D - ranrec equ fcb+33 ;random record Position
007F = ran0vf equ fcb+35;high order (overflow) byte
0080 = buff equ 0080h ;buffer address
000D = or equ 0dh ;carriage return
000a = 1f equ 0ah ;line feed
4-11
4.3 A Sample Random Access Program CP/M 3 Programmer's Guide