Our Aerco FD-68 GURU Returns
Mr. Syd Wyncoop is one of the most expert of of FD-68 users. Syd began writing for UPDATE last year, and then the roof caved in upon him. His Job disappeared. Now, after some months of stress, landing a new job, and moving the family, Syd is back with us. A hearty WELCOME BACK, Syd!!
The FD-68 Update
First, let me apologize for missing the last few issues and leaving the FD-68 readers high and dry. I was in the process of relocating and all of my computer gear was in storage with the moving company for nearly 4 months. Talk about withdrawals! At any rate, the shakes have subsided and I have warmed up the old keyboard.
I promised Bill that I would do something for you CP/M fans. CP/M will open vast horizons for our humble doorstops but, it is definitely not a ‘user-friendly’ operating system. Perhaps the largest advantage to learning CP/M is the enormous amount of public domain software that is available.
But, I am getting ahead of myself. First, if you have not obtained RP/M, then get it. RP/M is truly an amazing bargain and well worth the price, ($25.00 in the last flyer I recall) even if you just want to experiment. RP/M is virtually the same as CP/M 2.2 and I have not found any CP/M software that will not run. Due to this, I will use the terms CP/M and RP/M interchangeably.
For those of you are using the Zebra disk system, much of this will be applicable. However, I do not own a Zebra system to test therefore, you should verify all addresses with whatever information you have for your system.
It is a much different experience to boot a computer and not be in a Basic interpreter. CP/M is an operating system and the letters stand for Control Program for Microcomputers. RP/M is Revised CP/M which is not written by Digital Research and has a few nice enhancements. Instead, RP/M was written by a company called Micro-Methods, as a direct replacement for CP/M.
There are many good books on CP/M at your local library, so I’ll not go into its history. The large and lasting mark that CP/M has left is to merge microcomputers with disk drives. CP/M was the first popular DOS for micro computers and is in fact, the grand-daddy of the popular MS-DOS operating system.
As an operating system, CP/M provides all I/O. This means that each device is controlled and accessed via CP/M. The natural or ‘resting’ mode is similar to your familiar Timex prompt and is similarly a command parsing loop. CP/M will load and run any program from disk but, it does nothing else. For example, if you want to run a Basic program, you must first load the Basic language from disk. Basic will use the CP/M I/O routines to load your program and then you are finally ‘in Basic.’
While CP/M at first seems limited, due to this method of operation, it is really very versatile as you can load and use any language or any application that is on the disk. The only big shortcoming of CP/M is that it was written to run on eight bit CPU’s, such as our Z80, and therefore can only directly access 64K of memory. For us, this is not a problem. We are accustomed to this memory size and to having 38K of available RAM. CP/M gives us approximately 55K of available RAM, plus random and sequential filing!
CP/M is also an assembly language programmer’s dream come true. Many beginning assembly language programmers have a difficult time interfacing their programs to the Timex Basic operating system. CP/M simplified this by providing function calls to do much of the hard work for you. I have included a table of these calls and we will discuss their use, as time and space permit. These function calls are similar to the theory that spawned the idea of the function dispatcher in the normal Timex operating system. See the Timex Technical Manual for details (they are available from Time Designs Magazine).
Other than the additional burden of learning CP/M, CP/M is an excellent tool for learning assembly language programming. This is due to the fact that an assembler was provided, as well as the function calls. In fact, if CP/M could be said to boot any language, it would be assembly language.
There are some important addresses and terms associated with these addresses that we should be aware of and that are detailed in the following paragraphs:
0000h This address contains a jump instruction to the
warmboot address of CP/M. Many CP/M programs end
with the instruction, JP 0000h, which effectively
means, GOTO CP/M. The warmboot routine resets
the CP/M stack, and reboots the CCP from the disk
by performing a disk reset function to disk A.
Addresses 0001h & 0002h are the actual start
location of the CBIOS.
0003h This address contains the I/O Byte. This byte
tells CP/M where to direct the standard I/O and
is bit-mapped as follows:
list punch reader console
bits 7, 6 bits 5, 4 bits 3, 2 bits 1, 0
The value in each two-bit field can be 0-3 and has the
following meanings:
list 0 = the teletype device (TTY:)
1 = the CRT device (CRT:)
2 = the line printer device (LPT:)
3 = the user defined list device (UL1:)
punch 0 = the teletype device (TTY:)
1 = the high speed punch device (PTP:)
2 = the user defined punch #1 (UP1:)
3 = the user defined punch #2 (UP2:)
reader 0 = the teletype device (TTY:)
1 = the high speed reader device (PTR:)
2 = the user defined reader device #1 (UR1:)
3 = the user defined reader device #2 (UR2:)
console 0 = the console printer device (TTY:)
1 = the CRT device (CRT:)
2 = batch mode (BAT:)
use reader device as the console for input
use list device as the console for output
3 = the user defined console device (UC1:)
0004h This location contains the default disk drive
designation. The values 0-15 equate to drives
A-P. You must be careful as CP/M will use 1-16
in other places and reserves 0 to mean the
current drive.
0005h This address contains a jump instruction to the
entry of your BDOS. This is the entry point to
the system function calls and will prove very
useful. The actual address of the BDOS is held
in 0006h & 0007h and is the lowest address which
is used by CP/M. Note: the CCP resides below
BDOS however, it can and often is overlaid by
applications programs.
0038h This is the entry to RST 38h (RST 7 in 8080 code)
and is used by the CP/M debugger, DDT, for single
stepping but is not otherwise used by CP/M.
005Ch- These addresses are the default FCB for transient
007Ch program use by the CCP. If a second filename was
entered on the command line, it will begin at the
address 006Ch.
007Dh- These addresses contain the default random record
007Fh position.
0080h- The default 128 byte disk buffer is located here
00FFh and is referred to as the default DMA. This is a
very important buffer for disk I/O and we will be
discussing the DMA in greater detail, later.
0100h The Transient Program Area (TPA) starts at 0100h
and is the address into which CP/M loads all
programs. This is also the start of available or
'free memory' and all memory from 0100h to the
CCP or to the BDOS, if the CCP is overlaid, is
available for your use.
3400h This address is not used by CP/M but, it forms
the base address for the original stock CP/M and
is the address from which CP/M is moved. This
moving or relocation of CP/M from 3400h is done
to customize CP/M to your memory size.
Originally, the minimum configuration of CP/M was
20K which was thought to be a lot of memory at
that time! Fortunately, this relocation was
planned for.
D400h This is the start of our CCP (Console Command
Processor). It is found by the formula:
3400h + ((memorysize - 20) * 1024)
DC06h This is the start of our BDOS (Basic Disk
Operating System) and provides the entry to the
CBIOS routines. The BDOS is not hardware
dependent and functions as the system manager.
The BDOS always starts at CCP + 806h
EA00h This is the start of the BIOS (Basic Input/Output
System) or more properly the CBIOS (Customized
BIOS) and is the workhorse. This is the hardware
dependent portion of CP/M and must be customized
for CP/M to be useful. The BIOS always starts at
CCP + 1600h.
FFFFh The usual top of memory.
That should be enough to absorb this time. I leave you with the CP/M function call table. Keep this table handy. We will discuss it further, as we proceed with CP/M.
Syd Wyncoop
[address omitted]
CP/M 2.2 BDOS Function Table
Function # Function Name Inputs Outputs
Dec Hex
0 00 System Reset none none
1 10 Console Input none A=Ascii char
2 02 Console Output E=Ascii char none
3 03 Reader Input none A=Ascii char
4 04 Punch Output E=Ascii char none
5 05 List Output E=Ascii char none
6 06 Direct Console I/O E=FFh (input) A=Ascii char
or Ascii char or status
(output) or
FEh (status)
7 07 Get I/O Byte none A=I/O Byte
value
8 08 Set I/O Byte E=I/O Byte none
value
9 09 Print String until $ DE=string none
address
10 0A Read Console Buffer DE=buffer console chars
address put in buffer
11 0B Get Console Status none A=status
12 0C Return Version Number none HL=version #
13 0D Reset Disk System none none
14 0E Select Disk E=disk number none
15 0F Open File DE=FCB address A=dir code
16 10 Close File DE=FCB address A=dir code
17 11 Search for First DE=FCB address A=dir code
18 12 Search for Next DE=FCB address A=dir code
19 13 Delete File DE=FCB address A=dir code
20 14 Read Sequential DE=FCB address A=error code
21 15 Write Sequential DE=FCB address A=error code
22 16 Make File DE=FCB address A=dir code
23 17 Rename File DE=FCB address A=dir code
24 18 Return Login Vector none HL=login
vector
25 19 Return Current Disk none A=current disk
number
26 1A Set DMA Address DE=DMA address none
27 1B Get Record Allocation none HL=allocation
Address address
28 1C Write Protect Disk none none
29 1D Get Read Only Vector none HL=read only
vector value
30 1E Set File Attributes DE=FCB address A=dir code
31 1F Get Disk Parameter none HL=DPB address
Block Address
32 20 Set/Get User Code E=FFh (get) A=user code
or user code
(set)
33 21 Read Random DE=FCB address A=error code
34 22 Write Random DE=FCB address A=error code
35 23 Compute File Size DE=FCB address random record
bytes=filesize
36 24 Set Random Record DE=FCB address random record
pointer set to
the selected
record
37 25 Reset Drive DE=drive A=0
vector
38 26 Access Drive not supported
39 27 Free Drive not supported
40 28 Write Random with DE=FCB address A=error code
Zero Fill