Changes

CP/M 2.2

2,372 bytes added, 12:05, 15 December 2019
/* Console Output */
CP/M 2.2 was the first CP/M avaiable for the Amstrad CPC. A minimum requirement to run CP/M was a disc drive therefore CP/M 2.2 came bundled with the Amstrad [[DDI-1]] discdrive with the BIOS in the AMSDOS ROM, making it possible to run CP/M 2.2 on the Amstrad CPC 464. Later when the Amstrad CPC 664 was released, CP/M 2.2 came together with this machine as the 664 had a built in discdrive. With the CPC6128 it was on one of the two system discs, with CPM+ on the other.
 
== Tips ==
 
CPM 2.2 doesn't allow a program to handle BDOS errors itself like CPM+ does therefore you need to take additional steps to avoid them if you wish your program to continue:
 
=== Deleting a file that doesn't exist ===
 
First check if a file exists before deleting it:
 
ld c,&11 ;; search for first
ld de,fcb
call BDOS
cp 255
jr z,doesnt_exist
ld c,&13 ;; delete file
ld de,fcb
call BDOS
doesnt_exist:
 
=== Disc change ===
 
If the disc is changed, e.g. another disc is inserted into drive A in a single disc system, then the disc will be marked as read-only. Any modification operations (e.g. delete or write) will fail and the program will be aborted with a BDOS read-only error.
 
To avoid this reset the disk system and re-select the current drive:
 
ld c,&19 ;; get current disk
call BDOS
push af
ld c,&0d ;; reset disk system
call BDOS
pop af
ld e,a
ld c,&0e ;; select disk restoring it to read/write state
call BDOS
== Implementations ==
* [[Vortex CPM]]
 
=== Dk'Tronics 61K TPA CPM 2.2 ===
 
* [[DkTronics_CPM|Dk'Tronics CP/M]]
=== Amstrad's implementation of CPM 2.2 ===
You can then add additional files using FILECOPY.
 
==== Extra memory ====
 
CPM2.2 doesn't use any extra memory, and since it runs in configuration 'C0' accessing extra memory is much quicker and easier than under CPM3.0.
You should ensure your code (within the TPA) is in a safe region (0000-3fff, 8000-ffff), you can then page in the memory and copy it out to your destination directly as long as the destination is also within the safe area. It is much safer and simpler to use.
 
NOTE: This can't be used on other CPM2.2 variants on the CPC.
 
==== Console Input ====
 
Console input (via BDOS functions) uses firmware functions and returns firmware key codes when a key is pressed. i.e. &f0 is cursor up.
 
==== Console Output ====
 
Console output (via BDOS functions) ultimately uses TXT OUTPUT so has the potential to execute firmware control codes and display CPC firmware characters.
 
However, BDOS function 2 (Console output), which has control before TXT OUTPUT, looks for some specific characters and will perform specific processing regardless of whether it is part of a control character sequence or not.
 
Fore example, Console Output looks for TAB (&09).
 
Therefore use BDOS function 6 (Direct console input/output) to avoid this processing. With this function you can use the control codes to define windows, change modes, change colours etc.
==== Serial number ====
otherwise you're using the stack set for CCP.
==== MOVCPM .COM ====
MOVCPM .COM is used to change the size of the TPA which is the area used by programs. This relocates CCP and BDOS. SYSGEN then writes this to a disc so that when this disc is booted CP/M has a different sized TPA. By reducing the TPA, memory is freed up which is not touched by CPM and which can be used by the user.
CPM 2.2 is generated using MOVCPM on the CPM 2.2 disc as follows:
2,541
edits