User`s guide

4.2 A Sample File Dump Utility
The following dump program reads an input file specified in the CCP command
line, and then displays the content of each record in hexadecimal format at the
console. DUMP Program reads input file and displays hex data
; DUMP program reads input file and displays hex data
;
0100 org l00h
0005 = bd0s equ 0005h ;bdos entry point
0001 = c0ns equ 1 ;read console
0002 = typef equ 2 ;type function
0009 = printf equ 9 ;buffer print entry
000b = brkf equ 11 ;break key functi0n (true if char
000f = openf equ 15 ;file open
0014 = readf equ 20 ;read function
005c = fcb equ Sch ;file control block address
0080 = buff equ 80h ;input disk buffer address
; non graphic characters
000d = cr equ 0dh ;carriage return
000a = lf equ 0ah ;line feed
; file control block definitions
005c = fcbdn equ fcb+0 ;disk name
005d = fcbfn equ fcb+1 ;file name
0065 = fcbft equ fcb+B ;disk file tyPe (3 characters)
0068 = fcbrl equ fcb+12 ;file's current reel number
00Gb = fcbrc equ fcb+15 ;file's record count (0 to 128)
007c = fcbcr equ fcb+32 ;current (next) record number (0
007d = fcbln equ fcb+33;fcb length
; set up stack
0100 210000 lxi h,0
0103 39 dad sp
; entry stack pointer in hi from the ccp
0104 221502 shld oldsp
; set sp to local stack area (restored at finis)
0107 315702 lxi sp,stktop
; read and Print successive buffers
0l0a cdcl0l call setup ;set up input file
0l0d feff cpi 255 ;255 if file not present
0l0f c2lb0l jnz openok ;skip if open is ok
;
4-5
4.2 A Sample File Dump Utility CP/M 3 Programmer's Guide