UT-88. Using OS CP/M. Part 2/2.

Tags: No Tags
Comments: No Comments
Published on: 31/03/2012

In this post we will check some programs for CP/M and learn how to load your own programs on “RAM-disk”.

External command POWER is intended to work with files in a RAM and the “RAM-disk”. It allows to view files, edit them, rename or erase them, as well as to view and edit data in RAM. POWER also can display information about a disk, test it and isolate mulfunctioned areas.

Program can be loaded from a tape. After POWER command is entered the following invitation message appears:

А!

The POWER command recognises metasymbols as well. For instance, to view a file list with files that have R as a first character in their names the following command can be used:

А! R*.*

To see the list of all commands that can be used in POWER program, you can use this command:

А! ?

The following command shows the list of all hidden commands:

A! ??

For disk test you can use this command:

А! TEST

Disk will be read, a control sum be generated and damaged sectors will be isolated in a file “===.===” for further desisions.

Disk info, including its capacity and format, can be shown with the following command:

А! DISK

Free disk info as well as file statuses (R/W ― read & write, R/O ― read only) can be displayed with this command:

А! STAT

To see a file list command DIR is used.

CommandSORT is used for file sorting.

There are five ways to sort files:

А! SORT 1 (by file names)

А! SORT 2 (by file names but with executable files at the end)

А! SORT 3 (by file extensions)

А! SORT 4 (by file extensions but with system files at the end)

А! SORT 0 (without any sorting)

Files can be renamed with REN command:

A! REN *** (old name)

To mark file as system and make it visible only for CP/M command SETSYS is used:

А! SETSYS *** (file name)

Command SETDIR is opposite to SETSYS command.

To change file staus to “read only” command SETRO can be used:

A! SETRO *** (file name)

Command SETWR changes file status to “read & write”.

Very detailed file info can be received with SIZE command.

The first column shows sectors that are used, the second – free sectors, the third – file size in Kbytes, the forth – a size of group of files in Kbytes.

Commands to copy data from RAM to disk and back:

1. А! LOAD (имя файла, тип) ХХХХ

This command loads file from a disk to RAM from address ХХХХН > 4000Н.

After thet the command shows the end RAM address and amount of sectors that is used by file.

2. А! SAVE (name.ext) ХХХХ YY

This command loads file from RAM to a disk from address ХХХХН to disk taking YY sectors (if the file has been previously loaded with LOAD command and its size hasn’t been changed, then amount of sectors can be voided).

3. DUMPA ― view file as ASCII characters.

DUMPH ― view file as hex data.

DUMPX ― view file in both formats.

There are several way of using command DUMP:

A! DUMPH ХХХХ YYYY ― show data from address ХХХХН to YYYYH

А! DUMPH XXXX,N ― show N bytes of data from address ХХХХН.

A! DUMPH ХХХХ ― show all memory starting from address ХХХХН.

4. To view and edit text command DS is used:

A! DS ХХХХ

ХХХХН ― starting address. The following data is displayed:

address, hex code, decimal code, binary code, ASCII code , ENTER (.)

ENTER ― shows in which code type changes are going to be made: (А), (Н), (В), (D). To change code command .В(.) can be used ― (code type symbol in brackets). Data can be viewed in forward or back direction. To change a direction to opposite “^” needs to be entered. “-“ symbol will be added to address in back direction is used. To exit from the editor two dots are entered.

5. Fill a memory range with a constant

А! FILL ХХХХ YYYY ZZ

Start address ХХХХН, end address YYYYH and the constant ZZH.

6. To move memory range command MOVE is used:

А! MOVE ХХХХ YYYY ZZZZ

ХХХХН ―start address, YYYYH ― end address, ZZZZH ― new start address.

7. Comparison of two memory ranges can be done with СМ command:

А! СМ ХХХХ YYYY ZZZZ

XXXXH, YYYYH ―the first and the last address of the first memory range, ZZZZH― the start address of the second memory range.

8. Command SEARCH searches a string in memory.

This command displays addresses and data (in ASCII format) of cells that match to the search string. The string length can be up to 128 characters.

А! SEARCH (start address) (end address) (byte) (byte)

Normally the command searches hex codes but if you put a search character in quotes it will be searching the ASCII symbol.

There are several commands in POWER to launch programs:

1. Command GO reads a program from disk, loads it to RAM and launches it. It is convenient to launch programs that have to be run from different address than standard 100Н.

A! GO (file name) ХХХХ

ХХХХН ― address to load a program from.

2. Command JP allows to run a program, that is already in RAM, from a specified address. Exit from POWER happens after that:

А! JP ХХХХ

ХХХХН ― start address of a program.

3. Command ЕХ is the same as previous one, but it returns to POWER after that.

In this case a program has to have code С9 (RETURN) ar the end.

4. Command RUN loads and runs one or several files.

Command CHECK is used for control sum calculaton:

А! CHECK (file name)

Also, there is a command to exit from POWER to СР/М:

А! EXIT

Lets have a look on some other CP/M programs.

ED.СОМ – a text string orientaded editor. Its description can be found here.

L80.СОМ – a program that links files after translation to an executable program. Also it merges several files in one. Its description is here: LINK-80.

M80.COM – Microsoft MacroAssembler. Allows to write programs on Assembler language. Its description is here: MACRO-80.

MBASIC.СОМ – BASIC interpretator.

BASCOM.СОМ – BASIC compiller.

Actually, most CP/M-80 (CP/M 2.2) can work on this computer. Many of them even don’t need any additional adjustments or installations. If you hava a CP/M program that you want to use on this computer, you can follow these steps to load it there:

  1. An emulator from here needs to be downloaded.
  2. Launch it on any Windows computer and choose “UT88″.

    Emulator (step 1)

  3. Go to View > Start Debugger to open debugger window.
  4. Press Ctrl-L and enter 0×0100 in field From and choose your CP/M file.
  5. Now file is loaded to emulator’s memory. But before you close debugger window, find what is the final address of your program in memory. To do this scroll the screen until zeros appear that uninterrupted up to address E000. Remember or write off this address. Decode two high digits of the address to decimal number. This number isa quantaty of blocks that your program requires on “RAM-disk”. For instance, if the last data of the program is in cell 2F55 after which only zeros in cells, then transfer2F to decimal number and get 47. It is number of blocks on disk that this program is required. Please remember or write it off.
  6. Now close the debugger window and in the emulator enter Monitor-F command O0100,XXXX (XXXX – end address of the program (for instance, 2F55from our example). But before you press ENTER button after the command, launch recording to wav file, clicking on this button:

    Emulator (step 2)

  7. When recording is completed and invitation message ” =>” appears, press the red cicle button again to stop recording to wav file. Emulator has completed its part of job. Now we use our computer on DE1.
  8. Load CP/M on your DE1 as usual, then press “RESET” (ESC button on PS/2 keyboard). Don’t forget to turn MONITOR-0 ROM befor this with SW[2] switch.
  9. Load MONITOR-F as usual and turn off MONITOR-0 ROM (SW[2] in position “0”).
  10. Load the wav file that we’ve got from emulator using command I through LINE IN jack. May be you a sound level needs to be adjusted if errors accurs (please read my previous post about MONITOR-F). Your program will be loaded from address 0100.
  11. After the program successfully loaded, CP/M can be launched by “hot start” with GDA00 command.
  12. Now we are able to save the program to “RAM-disk” with SAVE command using amount of blocks that you’ve recorded on step 5 and a file name. For instance:
 

A> SAVE 47 M80.COM

Now you can save file to tape using CHcommand to be able to load it later straight to CP/M. Or you can create a memory dump with this file, as I explained in one of my previous posts, through USB JTAG interface.

This computer doesn’t have a lot of programs. So, if you adapt or create any other programs for it and send them to me, I’ll add them to the library. Simple programs are easy to load through LINE IN, but for big ones or for collection of programs a memory dump is much more convenient.

I hope you enjoyed the posts about this unusial computer. I think it is the final post about it, but may be I’ll come back to this topic once again if any interest appears or some new information is found.

But now we will do much more serious project! I’m going to create a replica of another Soviet computer – AGAT-7. And this replica will use a real 6502 processor and FPGA as a replacement of original computer ICs. You can subscribe to the RSS feed with the button on the top right corner. See you soon!

Leave a Reply

Welcome , today is Monday, 20/10/2014