home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
BEEHIVE
/
OS
/
CPM22INF.ARC
/
CPM22.NOT
next >
Wrap
Text File
|
1990-07-21
|
62KB
|
1,477 lines
CP/M V2.2
Application Note 01, 2/20/82
The CCP Auto-Load Feature
Copyright 1982 by Digital Reserch
CP/M is a registered trademark of Digital Research.
DDT is a trademark of Digital Research.
Compiled November 1982
Applicable products and version numbers: CP/M V1.4, V2.0, V2.1,
and V2.2
Program: CCP (Console Command Processor)
Usually, you interact with the CP/M CCP following the sign-on
prompt. With the CCP Auto Load feature, CP/M executes an initial
program immediately after loading the operating system.
Under usual operation, the CCP receives control from the BIOS
upon a warm or cold boot. The beginning of the CCP module
contains a two-element jump vector and a command line that takes
the form:
CCP: JMP CCPSTART ;START THE CONSOLE PROCESSOR
JMP CCPCLEAR ;CLEAR THE INITIAL COMMAND
DB 127 ;MAXIMUM COMMAND LENGTH
CL: DB 0 ;COMMAND LENGTH
DB ' ' ;8 BLANK CHARACTERS
DB ' ' ; "
DB 'COPYRIGHT...' ;COPYRIGHT NOTICE
If control is transferred to location CCP (address 3400H in a
20K CP/M), the console processor examines the command length at
location CL (3407H in a 20K CP/M). If the command length byte is
zero, then you receive the sign-on prompt and the CCP waits for
console input. If the command length byte is not zero, the CCP
assumes an initial command has already been entered. The CCP
executes the command on each cold or warm boot if control is
transferred to location CCP. However, if control is transferred
to location CCP+3 (JMP CCPCLEAR), the initial command is cleared
and the program enters the CCP at the command line level,
displaying the default drive prompt.
Specify the length of the initial command using a nonzero CL
byte. The command must be followed by a terminating zero. CP/M
executes the command following that CL byte. Although only 16
blank spaces are provided, you can move the Digital Research
copyright notice for more spaces.
You can initialize the command line of the CCP on the
operating system tracks or in the relocatable image within the
MOVCPM data area. The initial command executes in distributed or
reconfigured CP/M systems.
Following SYSGEN and SAVE commands, save the CP/M memory
image above the cold boot loader code starting at location (980H).
If the system boot routines require more than 80H bytes, the CCP
code begins at location 0A00H.
Modifying MOVCPM.COM is similar to modifying the CCP. The
difference is that the CCP always begins at location 0A00H.
The following procedure uses DDT to modify the CCP,
allowing execution of the initial command DIR after each warm or
cold boot.
A>movcpm * *
CONSTRUCTING 64K CP/M Vers. 2.2
READY FOR "SYSGEN" OR
"SAVE 35 CPM64.COM
A>save 35 cpm64.com
A>ddt cpm64.com
DDT VERS 2.2
NEXT PC
2400 0100
-d980
0980 C3 5C E7 C3 58 E7 7F 00 20 20 20 20 20 20 20 20 ...X...
0990 20 20 20 20 20 20 20 20 43 4F 50 59 52 49 47 48 COPYRIGH
09A0 54 20 28 43 29 20 31 39 37 39 2C 20 44 49 47 49 T (C) 1979, DIGI
09B0 54 41 4C 20 52 45 53 45 41 52 43 48 20 20 00 00 TAL RESEARCH ..
09C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
-s987
0987 00 3
0988 20 44
0989 20 49
098A 20 52
098B 20 0
098C 20 .
-d980
0980 C3 5C E7 C3 58 E7 7F 03 44 49 52 00 20 20 20 20 ...X...DIR.
0990 20 20 20 20 20 20 20 20 43 4F 50 59 52 49 47 48 COPYRIGH
09A0 54 20 28 43 29 20 31 39 37 39 2C 20 44 49 47 49 T (C) 1979, DIGI
09B0 54 41 4C 20 52 45 53 45 41 52 43 48 20 20 00 00 TAL RESEARCH ..
09C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
-g0
A>save 35 cpm64.com
A>sysgen cpm64.com
SYSGEN VER 2.0
DESTINATION DRIVE NAME (OR RETURN TO REBOOT)b
DESTINATION ON B, THEN TYPE RETURN
FUNCTION COMPLETE
DESTINATION DRIVE NAME (OR RETURN TO REBOOT)
Licensed users are granted the right to include these
modifications in CP/M software.
CP/M V2.2
Application Note 02, 2/20/82
Reversing the BACKSPACE and RUBOUT Key Functions and
Making RUBOUT Identical to BACKSPACE
Copyright 1982 by Digital Research
CP/M is a registered trademark of Digital Research.
DDT and SID are trademarks of Digital Research.
Compiled November 1982
Applicable products and version numbers: CP/M V2.1 and V2.2
Program: BDOS
In the following code segment procedures, addresses given are
hexadecimal offsets from the base of the CP/M system. The CCP is
usually located at 980H but can be located at A00H if a two-sector
boot is used.
You can assemble the patch for your size memory system. The
cpmbase equals the BDOS entry point address at locations 6 and 7
in the base page of memory minus 806H. You must change this entry
point address when you load DDT or SID . Under DDT or SID,
follow the jump at location 5 until an address is found with a
least significant digit of 6. In the following example, the
cpmbase would be E506H-806H or DD00H.
0005 JMP CD00
CD00 JMP D3A4
D3A4 XTHL
D3A5 SHLD E452
D3A8 XTHL
D3A9 JMP E506
Procedure to reverse the BACKSPACE and RUBOUT key functions:
Patch into the SYSGEN or MOVCPM image exactly as you would
patch in a new version of your BIOS, using the DDT i command
followed by the DDT r command. You can use the same offset as
your custom BIOS and install the following code:
cpmbase equ ? ;subtrack 806h from address at location 6
org cpmbase + 0A02h
cpi 7fh ;was cpi 08h
org cpmbase + 0A16h
cpi 08h ;was cpi 7fh
Or, you can install the above procedure directly into MOVCPM
if you have MOVCPM.COM on your system disk. The patch is applied
automatically to any size system that you build using MOVCPM.
Make a back-up copy of MOVCPM.COM before using DDT to make the
following changes:
A>ddt movcpm.com
DDT VERS 2.2
NEXT PC
2700 0100
-l1402
1402 CPI 08
1404 JNZ 0A16
1407 MOV A,B
1408 ORA A
1409 JZ 09EF
140C DCR B
140D LDA 0B0C
1410 STA 0B0A
1413 JMP 0A70
1416 CPI 7F
1418 JNZ 0A26
-s1403
1403 08 7f
1404 C2 .
-s1417
1417 7f 8
1418 C2 .
-g0
A>save 38 movcpm1.com
Use the new program MOVCPM1.COM in place of MOVCPM.COM. The
BACKSPACE and RUBOUT key functions are reversed for any CP/M
system generated with MOVCPM1.COM.
Procedure to make RUBOUT identical to BACKSPACE:
Before you install this patch, the code at cpmbase + 0A1Bh
should read:
mov a,b
ora a
jz cpmbase + 09EFh
mov a,m
dcr b
dcx h
jmp cpmbase + 0AA9h
Patch into the SYSGEN or MOVCPM image exactly as you would
patch in a new version of your BIOS, using the DDT i command
followed by the DDT r command. Use the same offset as your custom
BIOS and install the following code:
cpmbase equ ?
;
;
org cpmbase + 0A1Bh
;
mvi a,8h
jmp cpmbase + 0A07h
end
Or, you can install the above procedure directly into MOVCPM
if you have MOVCPM.COM on your system disk. The patch is
installed automatically in any size system that you build using
MOVCPM. Make a back-up copy of MOVCPM.COM before using DDT to
make the following changes.
A>ddt movcpm.com
DDT VERS 2.2
NEXT PC
2700 0100
-l141b
141B MOV A,B
141C ORA A
141D JZ 09EF
1420 MOV A,M
1421 DCR B
. . .
-a141b
141B mvi a,8
141D jmp a07
1420 .
-g0
A>save 38 movcpm1.com
Use the new program MOVCPM1.COM in place of MOVCPM.COM. The
RUBOUT and BACKSPACE key functions are identical in any CP/M
system generated with MOVCPM1.COM.
Licensed users are granted the right to include these
modifications in CP/M V2.2 software.
CP/M 2.2
Application Note 03, 06/25/81
Sample BIOS for a Serial Printer Device
Copyright 1982 by Digital Research
CP/M is a registered trademark of Digital Research.
Compiled November 1982
Applicable products and version numbers: CP/M V1.4, V2.0, V2.1,
and V2.2
Program: BIOS
The following code fragment drives Diablo serial interface
printers or other serial devices that use the X ON/X OFF protocol
for synchronization. A device that uses this protocol receives data
faster than it can print. The device transmits a CTRL-S character
when its buffer becomes full, and a CTRL-Q to receive more data
after the buffer is emptied.
LIST$STAT EQU 00H
LIST$DATA EQU 01H
IN$MASK EQU 02H
OUT$MASK EQU 01H
LIST:
CALL LISTST ! JZ LIST
MOV A,C ! OUT LIST$DATA
RET
LISTST
;return list status (0 if not ready, FF if ready)
LXI H,LST$FLAG
IN LIST$STAT ! ANI INS$MASK ! JZ NO$INPUT
IN LIST$DATA ! ANI 7FH ! CPI 'Q'-'@' ! JNZ S?
MVI M OFFH
S? CPI 'S'-'@' ! JNZ NO$INPUT
MVI M,O
NO$INPUT:
IN LIST$STAT ! ANI OUT$MASK ! ANA M ! RZ
ORI 255
RET
LST$FLAG:
DB 255 ;must be 255 initially
Licensed users are granted the right to include these
modifications in CP/M software.
CP/M V2.2
Application Note 04, 2/20/82
BIOS Error Return Code Options
Copyright 1982 by Digital Research
CP/M is a registered trademark of Digital Trademark.
DDT and SID are trademarks of Digital Research.
Compiled November 1982
Applicable products and version numbers: CP/M V2.2
Program: BIOS
Usually, CP/M responds only to a zero or nonzero value as the
return code from the BIOS READ and WRITE entry points. If the value
in register A is zero, CP/M assumes that the disk operation was
completed successfully. If a nonzero value is in register A, the
BDOS returns the message BDOS ERR ON x: BAD SECTOR. You then have
the option of pressing the RETURN key to ignore the error, or CTRL-C
to abort.
This modification interjects three additional return codes for
the BIOS READ and WRITE routines in register A as shown below.
0 The disk Read or Write operation was successful.
1 Bad Sector--indicates permanent disk error.
2 Select Error--indicates the drive is not ready.
3 R/O--the disk is Read-Only (used by WRITE).
4 File R/O--not normally used.
In the following code segment, addresses given are hexadecimal
offsets from the base of the CP/M system. The CCP is usually located
at 980H, but can be located at A00H if you use a two-sector boot.
After modifying your BIOS READ and WRITE routines to pass the
extended error codes to the BDOS, you can assemble the BDOS patch for
your size memory system. The cpmbase equals the BDOS entry point
address at locations 6 and 7 in the base page of memory minus 806H.
You must change this entry point address when you load DDT or
SID . Under DDT or SID, follow the jump at location 5 until you
find an address with a least significant digit of 6. In the
following example, the cpmbase would be E506H-806H or DD00H.
0005 JMP CD00
CD00 JMP D3A4
D3A4 XTHL
D3A5 SHLD E452
D3A8 XTHL
D3A9 JMP E506
1
CP/M V2.2 Application Note 04
Patch into the SYSGEN or MOVCPM image exactly as you would patch
in a new version of your BIOS, using the DDT i command followed by
the DDT r command. Use the same offset as your custom BIOS.
Before installing this patch, the code at the cpmbase + BBDh
should read:
lxi h,cpmbase +809H
jmp cpmbase + B4AH
Replace the preceding code with the following code:
cpmbase equ ?
;
;
org cpmbase + BBDH
;
lxi h,cpmbase + 807H
jmp cpmbase + 83AH
end
Or, you can install this change directly into MOVCPM, if
MOVCPM.COM is on your system disk. The patch is installed in any
size system that you build using MOVCPM. Make a back-up copy of
MOVCPM.COM before using DDT to install the following procedure:
A>ddt movcpm.com
DDT VERS 2.2
NEXT PC
2700 0100
-l15bd
15BD LXI H,0809
15C0 JMP 0B4A
15C3 LHLD 15EA
. . .
-a15bd
15BD lxi h,807
15C0 jmp 83a
15C3 .
-g0
A>save 38 movcpm1.com
Use the new program MOVCPM1.COM in place of MOVCPM.COM.
Additional error return codes for the BIOS READ and WRITE routines
are supported in any CP/M system generated with MOVCPM1.COM.
Licensed users are granted the right to include these
modifications in CP/M V2.2 software.
2
CP/M V2.2
Application Note 05, 2/20/82
Improving the CTRL-S Function
Copyright 1982 by Digital Research
CP/M is a registered trademark of Digital Research.
DDT and SID are trademarks of Digital Research.
Compiled November 1982
Applicable products and version numbers: CP/M V2.2
Program: BDOS
The CTRL-S function controls screen scrolling during CRT output.
However, the system does not recognize CTRL-S if you type another
character before it.
In the following code segment procedures, addresses given are
hexadecimal offsets from the base of the CP/M system. The CCP is
usually located at 980H, but can be located at A00H if a two-sector
boot is used.
You can assemble the patch for your size memory system. The
cpmbase equals the BDOS entry point address at locations 6 and 7 in
the base page of memory minus 806H. You must change this entry point
address when you load DDT or SID . Under DDT or SID, follow the
jump at location 5 until you find an address with a least significant
digit of 6. In the following example, the cpmbase is E506H-806H or
DD00H.
0005 JMP CD00
CD00 JMP D3A4
D3A4 XTHL
D3A5 SHLD E452
D3A8 XTHL
D3A9 JMP E506
Patch into the SYSGEN or MOVCPM image exactly as you would patch
in a new version of your BIOS, using the DDT i command followed by
the DDT r command. Use the same offset as your custom BIOS. The
call at cpmbase + 950H should be cpmbase + 923H before installing the
following code:
cpmbase equ ?
;
;
org cpmbase + 950h
;
call cpmbase + 92Ah
end
1
CP/M V2.2 Application Note 05
Or, you can install the above procedure directly into MOVCPM, if
MOVCPM.COM is on your system disk. The patch is applied
automatically to any size system that you build using MOVCPM.
Make a back-up copy of MOVCPM.COM before using DDT to make the
following changes:
A>ddt movcpm.com
DDT VERS 2.2
NEXT PC
2700 0100
-l1350
1350 CALL 0923
1353 POP B
1354 PUSH B
. . .
-a1350
1350 call 92a
1353 .
-g0
A>save 38 movcpm1.com
Use the new program MOVCPM1.COM in place of MOVCPM.COM. Any
CP/M system generated with MOVCPM1.COM has the improved CTRL-S
function.
Licensed users are granted the right to include these
modifications in CP/M V2.2 software.
2
CP/M V2.2
Application Note 06, 2/20/82
Changing the Lines Per Page
Copyright 1982 by Digital Research
CP/M is a registered trademark of Digital Research.
DDT is a trademark of Digital Research.
Compiled November 1982
Applicable products and version numbers: CP/M V2.2 and V2.2 4200H
Program: ED.COM
This modification changes the number of lines scrolled by the P
command in ED.COM from 23 to 14. Add 4200H to each address shown
below for 4200H-based systems. Make a back-up copy of ED.COM before
you use DDT to make the following changes:
A>ddt ed.com
DDT VERS 2.2
NEXT PC
1B00 0100
-l17da
17DA LXI H,0017
17DD SHLD 1D1C
17E0 RET
.
.
.
-s17db
17DB 17 e
17DC 00 .
-^C
A>save 26 ed.com
Licensed users are granted the right to include these
modifications in CP/M V2.2 and V2.2 4200H software.
1
CP/M V2.2
Application Note 07, 2/20/82
Changing the Restart Number in DDT
Copyright 1982 by Digital Research
CP/M is a registered trademark of Digital Research.
DDT is a trademark of Digital Research.
Compiled November 1982
Applicable products and version numbers: CP/M V1.4, V2.0, V2.1,
and V2.2
Program: DDT.COM
DDT uses RST 7 (machine instruction 0FFH) to set break points.
To change the restart number, modify the three bytes indicated by ??
in the following procedure for a new restart instruction and
location. The restart instruction uses the bit pattern 11XXX111,
where XXX is the restart number you use. (AFH is RST 1, B7H is RST
2, and BFH is RST 3.) The restart location is usually the restart
number times 8. Do not use RST 0 because it is reserved for CP/M.
The following procedure applies to DDT supplied with CP/M V2.1
and V2.2. For V1.4 and V2.0, change the instructions at 19B and 19E
to the following:
019B sta fe4
019E sta 10ee
Make a back-up copy of DDT.COM before you use DDT to make the
following changes:
A>ddt ddt.com
DDT VERS 2.2
NEXT PC
1400 0100
-l103
103 JMP 013D
.
.
.
-a103
0103 jmp 18b
-a18b
018B lhld 1ec
018E shld 8e7
0191 inx h
0192 shld 8ed
0195 lda 1eb
0198 sta ad5
1
CP/M V2.2 Application Note 07
019B sta fea
019E sta 10f4
01A1 jmp 13d
- s1ec
01EB ?? f7
01EC ?? 30
01ED ?? 00
01EE ?? .
-g0
A>save 19 ddt6.com
To change the restart number for DDT in the future, modify only
the 3 bytes 1EBH, 1ECH and 1EDH.
Licensed users are granted the right to include these
modifications in CP/M software.
2
CP/M V2.2
Application Note 08, 2/20/82
Nested SUBMIT Files
Copyright 1982 by Digital Research
CP/M is a registered trademark of Digital Research.
DDT is a trademark of Digital Research.
Compiled November 1982
Applicable products and version numbers: CP/M V2.1 and V2.2
Program: SUBMIT.COM
The CP/M SUBMIT program allows you to embed another SUBMIT
command within a submit file. However, control does not return to
the original SUBMIT file after executing the nested SUBMIT command.
To return control to the original SUBMIT command, use any standard
editor to type the following procedure into a file named
SUBPATCH.ASM:
;
;
subfcb: equ 5bbh
bdos: equ 5
open: equ 211h
;
org 22dh ;submit erase subroutine
;
opsl: lda subfcb+15 ;file open ok if ext not full
ral
rnc
lxi h,subfcb+12 ;try next extent
inr m
ops: lxi d,subfcb ;open extent
jmp create
;
org 25dh ;submit create subroutine
create: call open
inr a
jnz opsl ;loop if open ok
lxi d,subfcb
mvi c,22
call bdos
adi 1
ret
;
; the following code calls the above routines
;
org 4feh
;
call ops ;open the $$$.sub file
jc 517h ;jump if not opened ok
lda subfcb+15 ;set current record to end
sta subfcb+32
jmp 51dh ;jump if open ok
;
org subfcb
db 1 ;force $$$.sub file to A:
;
end
Assemble SUBPATCH ASM to create the file SUBPATCH.HEX. Then use
DDT to insert SUBPATCH.HEX into the SUBMIT.COM program, as shown
below.
A>ddt submit.com
DDT VERS 2.2
NEXT PC
0600 0100
-isubpatch.hex
-r
-g0
A>save 5 submit1.com
In the new program SUBMIT1.COM, control returns to the original
SUBMIT file after the system executes embedded SUBMIT commands.
Licensed users are granted the right to include these
modifications in CP/M V2.1 and V2.2 software.
CP/M V2.2
Application Note 09, 2/02/82
Configuring CP/M for Page Boundaries
Copyright 1982 by Digital Research
CP/M is a registered trademark of Digital Research.
DDT is a trademark of Digital Research.
Compiled November 1982
Applicable products and version numbers: CP/M V2.2
Program: MOVCPM.COM
You can modify MOVCPM.COM to configure CP/M V2.2 for page
boundaries (256 bytes) instead of kilobyte boundaries.
Make a back-up copy of MOVCPM.COM before you use DDT to make
the following changes. Save the changes in a new file named
PGMOV.COM. The first argument designates the size of the system in
pages that PGMOV is to construct. The first argument is optional,
but must range between 64 and 255 (decimal) if used.
A>ddt movcpm.com
DDT VERS 2.2
NEXT PC
2700 0100
-l165
0165 CPI 10
0167 JC 0172
016A MVI L,00
016C MOV H,A
016D DAD H
-s166
0166 10 40
0167 DA .
-a16d
016D nop
016E nop
016F .
-l1a2
01A2 ANI FC
01A4 MOV H,A
01A5 PUSH H
01A6 LHLD 0006
-ala2
01A2 ani fe
01A4 .
-g0
A>save 38 pgmov.com
Licensed users are granted the right to include these
modifications in CP/M V2.2 software.
CP/M V2.2
Application Note 10, BDOS, 03/12/82
Booting CP/M on Drives Other Than Drive A
Copyright 1982 by Digital Research
CP/M is a registered trademark of Digital Research.
DDT is a trademark of Digital Research.
Compiled November 1982
Applicable products and version numbers: CP/M V2.2
Module: BDOS
Booting CP/M on a drive other than drive A changes the initial
prompt displayed after a cold boot. Instead of A>, you must specify
the drive intended to follow the cold boot in the following patch
procedure. Also, your BIOS must pass the intended boot drive to
register C in the CCP upon cold boots (see the CP/M Operating System
Manual). The intended boot drive in this patch procedure and in your
BIOS is indicated by a number relative to zero. (A=0, B=1, C=2, ...,
P=15.) This procedure changes the drive selected by BDOS Function 13
(Reset Disk System).
Use caution installing this patch because it requires
modification to the CP/M submit processor (SUBMIT.COM). SUBMIT must
write the $$$.SUB file to the boot drive you specify in this patch.
The procedure to modify SUBMIT is described in CP/M V2.2, Patch 03,
dated 1/21/82. Instead of setting the byte at 5BBH to 1, as
described in Patch 03, set the byte to the specified boot drive plus
1. For example, if the boot drive is 1 (the B drive), then set the
byte in SUBMIT.COM at 5BBH to 2.
Place the following code in a file named CPMxx.COM (xx = memory
size). Determine the CP/M base for your size memory and include it
in the code. Assemble and insert CPMxx.COM into the SYSGEN or MOVCPM
image exactly as you would patch in a new version of your BIOS. Use
the DDT i command followed by the DDT r command. Use the same
offset as your custom BIOS. Make a back-up copy of CPMxx.COM before
you make the changes.
cpmbase equ ?
drive equ ? ;boot drive
;0=A, 1=B, ..., 15=P
org cpmbase + 0148Ch
jmp cpmbase + 15EEh ;was "xra a"
org cpmbase + 15EEh
mvi a,drive ;was "nop"
sta cpmbase + 0B42h ;was "nop"
jmp cpmbase + 1490h ;was "nop"
Licensed users are granted the right to include these changes in
CP/M V2.2 software.
CP/M V2.2
Application Note 11 9/30/82
Chaining Programs
Copyright 1982 by Digital Research
CP/M and CP/NET are registered trademarks of Digital Research.
MP/M II and PL/I-80 are trademarks of Digital Research.
Compiled October 1982
Applicable products and version numbers: CP/M V2.2, CP/NET ,
and MP/M II .
Program: CHAIN1.COM and CHAIN2.COM
Menu-driven applications can be written to run under CP/M.
If you develop applications using PL/I-80 , you can write the
programs as a set of overlays. Often, the programs are written in
assembly language, or require too much memory to make the overlay
feature of PL/I-80 appropriate. Without using overlays, there are
only two effective methods of chaining under CP/M V2.2.
The first method uses the CP/M SUBMIT facility, in which the
main menu program creates a SUBMIT file that lists the programs to
be chained. The file must be written to drive A, and have the name
$$$.SUB.
The SUBMIT file consists of compatible lines, exactly like
those you type at the console, following the system prompt. The
commands are placed in reverse order, so the last command in the
file is the first to be executed. Each command is placed in a 128-
byte record with the following format:
:n:C1:C2:...:cn:0:...:
The first byte of the record contains the number of
characters in the command (n), followed by the characters (c1-cn),
and terminated with a zero. The number of characters in the command
is written as a binary number and each character is represented in
ASCII format. It does not matter what follows the terminating zero
in the record. For example, if the command was STAT*.*, the first
byte would be a binary 8, followed by the letters STAT*.* and
terminated with a zero.
The second method of program chaining is simpler. You
include a procedure in the menu program that loads the next program
and chains to it. Each program that might chain to another program
must include a copy of the procedure. The procedure must first move
itself out of the way so that it is not overwritten by the program
it is loading.
The example assembly language procedure is written to link
with PL/I-80 modules as an external procedure. It can also be used
in an assembly language menu program. To link to a PL/I-80 program,
the following entry declaration must be included in the PL/I-80
program that does the chaining:
dcl chain entry (char(12));
The character 12 variable consists of the standard CP/M File
Control Block (FCB) format. The format can be created in the PL/I-
80 program as a structure. A char(12) variable can then be based at
the same address as the structure for interfacing to the chain
procedure. (See the following PL/I-80 program.)
Note: the drive is not an ASCII character, but a binary number
between 0 and 16, where 0 is the current default drive and 1 through
16 represent the CP/M drives A through P, respectively.
chain 1: proc options(main);
/* chain subroutine tester */
dcl 1 fcb static
2 drive fixed(7) init(0),
2 name char(8) init('CHAIN2');
2 type char(3) init('COM'),
dummy char(12) based(db),
dp pointer,
chain entry(char(12));
put skip list('Chain Text program 1');
dp = addr(fcb);
call chain(dummy);
put skip(2) list('Shouldn''t be here!!);
end chain 1;
This program prints the message Chain Test program 1, and
chains to the program CHAIN2.COM on the default drive. CHAIN2 is a
program identical to CHAIN1, except that it prints Chain Test
Program 2 and chains to CHAIN1.COM. CHAIN1 and CHAIN2 then continue
to chain back and forth to each other.
Note: any statements following the call to the chain procedure are
not executed because the chain procedure never returns.
The chain procedure consists of two routines. An
initialization routine initializes the FCB for the program to be
loaded. Then, the initialization routine relocates the loader and
FCB to the very top of the Transient Program Area (TPA), immediately
below the BDOS, so it will not be overwritten by the loaded program.
The loader begins at the label, code:, and ends at the end of the
FCB, at the statement, codelen equ $-code.
The loader routine sets the DMA address, reads a sector,
checks for an end-of-file, increments the DMA addresses by 128
bytes, and repeats the process. When the end-of-file is detected,
it jumps to the chained program. The code is as follows:
public chain char(12)
extrn ?signal
,/* loads another COM file, and
executes it */
bdos equ 5
openf equ 15
readf equ 20
dmaf equ 26
cseq
chain. mov e,m ! inx h ! mov d, m ! xchg ;get first arg address
lxi d, fcb ! mvi c, 12 ! call move ;move string to FCB
lxi d, fcb+12 ! mvi a, 0 ! mvi c, 21
call fill ;zero rest of FCB
lhld bdos+1 ! lxi b, -code$len
dad b ;make space at
;top of TPA
shld jmpr + 1 ;jump address
push h ;save code address
;for RET
xchg ! lxi h, fcb-code ! dad d ;make address of FCB
shld FCBR+1 ;and fix LXI
push h ;save FCB
;destination address
lxi h, code ! mvi c, code$len
call move ;dest in DE
pop d ;recover address of FCB
mvi c, openf ! call BDOS ;open file
inr a ! jz sig ;if any error,
;signal error
pop h ! sphl ! push h ;point stack to top
;of TPA
;and save code addr
lxi h, 100h ;point to start of
;TPA
ret ;to loader "code"
code: push h ! xchg ! mvi c, dmaf
call BDOS ;set the DMA address
FCBR lxi d, $-$ ! mvi c, readf !
call BDOS ;read the next record
ora a ! jnz 100h ;EOF -| start TPA
pop h ! lxi d, 128 ! dad D ;recover and bump DMA
jmpr jmp $-$ ;jump to code
FCB: ds 1 ;drive code
CP/M V2.2 Application Note 11
ds 8 ;filename
ds 3 ;filetype
ds 4 ;control info
ds 16 ;disk map
ds 1 ;rrec
codelen equ $-code
move: ;c = # bytes, hi = source, de = desti-
nation
mov a,m ! stax d
inx h ! inx d ! dcr c
jnz move
ret
fill: ;a = byte to fill, c = # bytes, de = start ad-
dress
stax d ! inx d
dcr c ! jnz fill
ret
sig: lxi h, siglist ! call ?signal ! jmp 0;signal error
siglist: ;(fixed(6),
;bit(8),ptr,ptr)
dw sigcode, sigsub, sigfil, message
sigcode db 6 ;undefined file
;error
sigsub db 2 ;arbitrary subcode
;for id
sigfil dw fpb ;ptr to file
;parameter block
message dw quack ;auxiliary
;operator message
fpb ;PL/I fuke
;oaraneter bkicj
fcbptr dw FCB-1 ;fcb-1
fpblst dw 0 ;(unused)ptr
column dw 0 ;current column
;fixed(15)
curline dw 0 ;current line
;fixed(15)
curpage dw 0 ;current page
;fixed(15)
currec dw 0 ;(unused)fixed(15)
lookchr db 0 ;look ahead char
;char(1)
ioend dw 0 ;i/o end address
iostk dw 0 ;user stack upon
;sio entry
spacer ds 4 ;spacer
linesz dw 0 ;line size
;fixed(15)
pagesz dw 0 ;page size
;fixed(15)
fixedsz dw 0 ;fixed size
;fixed(15)
blocksz dw 0 ;block size
;fixed(15)
filedes dw 0 ;block size
;fixed(15)
dtitle db 0 ;default title
;char(14)varying
quack db 17,'Bad Chain Attempt',0 ;error message
Licensed users are granted the right to include these
modifications in CP/M, CP/NET and MP/M II software.
CP/M V2.2
Application Note 12, 11/1/82
Interpreting CTRL-Z in SUBMIT Files
Copyright 1982 by Digital Research
CP/M is a registered trademark of Digital Research.
DDT is a trademark of Digital Research.
Compiled November 1982
Applicable products and version numbers: CP/M V2.2
Program: SUBMIT.COM
SUBMIT does not accept control characters in SUB files. SUBMIT
recognizes certain control characters when preceded by an up arrow.
SUBMIT should interpret the two characters ^z as CTRL-Z.
Procedure:
Make a back-up copy of SUBMIT.COM before you use DDT to make
the following changes.
A>ddt submit.com
DDT V2.2
NEXT PC
0600 0100
-l0441
0441 SUI 61
0443 STA 0E7D
0446 MOV C,A
0447 MVI A,19
0449 CMP C
044A JNC 0456
044D LXI B,019D
0450 CALL 02A7
045 JMP 045E
0456 LDA 0E7D
0459 INR A
-s442
0442 61 41
0443 32 .
-g0
A>save 5 submit.com
Licensed users are granted the right to include these changes in
CP/M V2.2 software.
CP/M V2.2
Application Note 13, 01/21/82
Exiting PIP When Using SUBMIT and XSUB
Copyright 1982 by Digital Research
CP/M is a registered trademark of Digital Research.
DDT is a trademark of Digital Research.
Compiled November 1982
Applicable products and version numbers: CP/M V2.2
Program: PIP.COM
When using the SUBMIT and XSUB utilities to execute multiple
PIP commands from a SUBMIT file, it is not possible to exit from
PIP automatically. The SUBMIT utility does not accept lines with
only a carriage return.
This application note patch modifies PIP so a period can be
used to exit from PIP instead of a carriage return. In the submit
file, place a single period (.) on a line by itself after the last
PIP command to be executed.
Procedure:
Make a back-up copy of PIP.COM before you make any changes.
The program DDT is required to make the changes. Use the
following sequence of commands.
0A>ddt pip.com
DDT VERS 2.2
NEXT PC
1E00 0100
-l54f
054F CPI 00
0551 JNZ 055E
0554 LHLD 1DFC
. . .
-a54f
054F cpi 2
0551 jnc 55e
0554 .
-g0
A>save 29 pip.com
Licensed users are granted the right to include these changes
in CP/M 2.2 software.
CP/M V2.2
Application Note 14, 8/11/82
Turning CTRL-P On and Off from within a CP/M V2.2 SUBMIT File
Copyright 1982 by Digital Research
CP/M is a registered trademark of Digital Research.
Compiled November 1982
Applicable products and version numbers: CP/M V2.2
You can use the SUBMIT facility for batching job streams to
turn the CTRL-P toggle on and off from within that SUBMIT file.
Although there is a patch to SUBMIT that forces it to accept control
characters when preceded by an up-arrow, ^, SUBMIT does not act on a
CTRL-C nor a CTRL-P.
The assembly-language program which follows turns CTRL-P on or
off from within a SUBMIT file. The same assembly code can be used
from within an applications program to turn CTRL-P on and off. This
program must be executed before XSUB, if XSUB is to be active in the
SUBMIT file. Although the CP/M V2.2 Operating System Manual states,
"The XSUB command is included as the first line of your submit
file...," this is not necessary. XSUB can be activated and
deactivated within a SUBMIT file. An assembly-language program is
listed that deactivates XSUB and also turns off CTRL-P if it is on.
Use this program from within a SUBMIT file to turn the ^P
toggle on and off. This program can also be invoked from the
console. If the CTRL-P toggle is off, this program turns it on; if
on, the program turns it off. It issues an appropriate message to
the console that is also echoed on the list device.
The program calculates the location of the ^P toggle in the
BDOS by getting the BDOS address from the jump instruction located
at 0005h in page zero and adding 307h to that address. It then does
an exclusive on of the toggle byte to turn ^P on or off.
Note: if XSUB is to be active in the submit file, ^P must be turned
on before executing XSUB. To turn off ^P in a submit file in which
XSUB is active, execute a program that deactivates XSUB, such as the
DEXSUB program which is listed following this program.
CntlP:
org 100h ;start of TPA
bdos equ 5h ;BDOS jump instruction
bdosa equ bdos+1 ;BDOS entry address
pstr equ 9 ;print string function
testoff equ 2feh ;offset for verification
listcp equ 0dh ;^P offset in page
mvic equ 3eh ;MVI C,x instruction
cr equ 0dh ;carriage return
lf equ 0ah ;line feed
lhld bdosa ;pick up address of BDOS in HL
lxi d,testoff ;offset of ^P page in DE for add
dad d ;HL= compare area in BDOS
lxi d,string ;DE= compare string
compare:
ldax d ;is character a 0?
ora a ;
jz ok ;yes, we're done
cmp m ;is BDOS same as string?
inx h ;next byte
inx d ;
jz compare ;BDOS = string keep looping
error: mvi c,pstr ;else print error message
lxi d,errormsg ;
jmp bdos ;return to CCP from BDOS
ok: mvi l,listcp ;listcp page offset
mvi a,1 ;toggle ^P byte on or off
sub m ;true = 1, false = 0
mov m,a ;put results back in memory
cpi 0h ;see if on or off
jz othermsg ;to issue appropriate message
lxi d,onmsg ;^P turned on
jmp print ;go around
othermsg:
lxi d,offmsg ;^P turned off
print mvi c,pstr ;print sign-on message
jmp bdos ;return to CCP from BDOS
onmsg: db cr,lf,'(^P turned on)$'
offmsg db cr,lf,'(^P turned off)$'
errormsg:
db cr,lf,'Unable to find BDOS$'
string db ret,mvic,1,jmp,0
end
Dexsub:
org 100h ;start of TPA
bdos equ 0005h ;bdos location in base page
mvi c,9 ;print string = function 9
lxi d,msg ;
call bdos ;
mvi c,0 ;system reset = function 0
jmp bdos ;exit bdos to ccp
msg db 0dh,0ah,'(xsub deactivated; ^P turned off if on)$'
end
This application was developed and tested by Digital Research
Technical Support using standard Digital Research products.
Modifications required to assemble, compile, or execute under non-
standard or non-Digital Research products are the responsibility of
the user.
Digital Research specifically disclaims any express or implied
warranty and shall not be liable for any loss of profits, loss of
business, loss of use or of data, interruption of business, nor for
indirect, special, incidental, or consequential damages of any kind
caused by the use or adaptation of this application note.
Licensed users are granted the right to include these changes
in CP/M software.
CP/M V2.2
Aplication Note 15, 12/22/82
Debugging a CP/M V2.2 BIOS
Copyright 1982, 1983 by Digital Research
CP/M is a registered trademark of Digital Research.
DDT, MAC, and SID are trademarks of Digital Research.
Compiled February 1983
You can easily customize the CP/M V2.2 operating system for a
particular machine if you use the following steps when it is
necessary to debug a BIOS. You must have a system running under
CP/M with a minimum of 48K to implement this scheme. CP/M V1.4 is
all right, and the system need work only well enough to load DDT or
SID . (SID is preferable and should be used if available.)
1) Carefully do a thorough code walk-through. This should take
about eight hours. Pay particular attention to the Disk
Parameter Blocks and Disk Parameter Headers, especially if
you hand-coded these items to assemble your BIOS instead of
using the DISKDEF.LIB and MAC . A slight miscalculation
in a DPB or DPH can cause a BIOS to perform most functions
correctly but fails under obscure circumstances; or, BIOS
performs one function properly and fails to perform all
others.
2) Using your old CP/M system, create your new system and
configure it to 20K. Ensure that the old system does not
use location 38H, which is DDT's Restart7 location.
3) Load the new 20K system underneath DDT in the old 48K
system's TPA with the command DDT CPM20.COM. Figure 1-1
illustrates this scheme.
48K BIOS
48K BDOS
DDT or SID
4A00 20K BIOS
3C06 20K BDOS
3400 20K CCP
980
900 BOOT
SYSGEN or MOVCPM
100 BASE PAGE
Figure 1-1. Loading Your New System
1
CP/M V2.2 Application Note 15
4) At location 980 (A00h in some systems), you should find the
base of the CCP, recognized by two jumps followed by the
copyright message. Move the 20K system into its correct
W
memory location using the DDT M (move) command. If DDT
lists a next address of 2300, then this command is
M980,2300,3400.
5) In the 20K BIOS jump vector at 4A00h, insert breakpoints
with Restart7s, or, if you are using SID, insert
passpoints. This should be restricted to the disk entry
points unless you have a problem with console I/O. If the
problem occurs only under certain conditions, place a RST7
initially only at the write entry point. When the
conditions under which the problem occurs have been
established, use a SAVE 1 xxx to return to the debugger you
are using and to set additional breakpoints.
6) Run the 20K CP/M under the 48K CP/M's DDT. Issue the DDT
command G4A00, which executes the new BIOS cold boot entry
point. The cold boot initializes the base page for the 20K
system and jumps to the CCP, which performs a BDOS Function
13 disk reset. The disk reset reads the directory sectors
until it encounters a sector containing 0E5h in every byte.
7) If the problem you experienced fails to reappear when you
begin single-cycling, it might have been a timing problem.
If not timing then it is a logic or coding error, and you
must continue to single-cycle the machine, examining the
contents of registers and memory locations as you go. Pay
particular attention to the following parameters: Track,
Sector, Dmaad, Diskno, and the contents of Dirbuf. If you
are using blocking/deblocking, also observe the contents of
Sekdsk, Hstdsk, Sektrk, Hsttrk, Rsflag, Erflag, and the
contents of the host buffer(s).
Licensed users are granted the right to include these changes
in CP/M software.
2