The Monitor

The MPF-1 monitor provides the necessary functions for the user to develop his programs. These functions include:

  • The ability to enter the user's program into RAM and to check and modify the program.
  • Execute the user's program which is stored beginning from the address on the display.
  • Using "Single Step" or break points to debug your programs. After each step or at a break point control is returned to the monitor, at which point the user can examine/alter memory locations and processor registers. That way you can verify if a program performs as you expected.
  • Other support functions include audio tape control and relative address calculation.

You'll only have to know how to load a program into memory and start it in order to get going with the experiments on this web site. So you'll have to read at least the parts which explain how to enter data and programs into memory. Possibly you'll have to read how to read and store programs on audio tape. Remember that all your typing will vanish into thin air as soon as the power is removed!
All other features of the monitor can be learned whenever you really think you need them or when you're feeling up to it. Don't worry though, it is all not that complicated.

Examine Or Modify Memory

In order to operate the MPF-1 you should at least have to know how to examine memory and modify data in RAM memory. Remember that a program can also be considered to be data, a program is simply a set of executable data.
Let's start right away:

Press the ADDR key. The display should now show something like this: 0.

This brings us to the first definition: The dots on the display indicate the entry field. In this case we can enter 4 digits, which is not really a surprise because an address is 16-bits long, which can be represented by 4 hexadecimal digits.

Now type the digits 0000. The display should now show 6, thus telling us that the contents of address 0000H are 06H, which is in ROM and should be the same on all models.
Now press the + key. The display now shows 0 0 0 1 0.0.. This tells us that the contents of address 0001H are 00H.
Good, press the + key several times in a row, and you will get the general idea about the left 4 digits being the address and the right 2 digits being the data in that address.
I wonder what the - key does? It is for you to try out, but probably you can already guess what it will do.

Maybe you've noticed that the entry field has changed from the address field to the data field after we've pressed the + key the first time. You can tell it has changed by the dots being to the right of the two right most digits, which is the data field.
So now you may expect you can change the data on this address. Errr, wrong! Suppose the display now reads 0 0 0 6 d.3.. Type some numbers on the hexadecimal key pad. Nothing changes. Remember that the ROM ranges from address 0000H until 0FFFH, and ROM data simply can't be changed. They don't call it Read Only Memory for nothing you know!

We're going to try our luck on RAM memory now. RAM memory on the standard MPF-1 ranges from 1800H to 1FFFH. Press the ADDR key again and then type 1800. After you've entered the address the display should look something like this 0 (the data field may differ from what you see here).
Please notice that the dots still indicate that I can alter the address. Enter some more digits and you'll see that the address keeps changing. New digits are shifted in from the right, and the left most digits will disappear. This feature may come in handy if you make a typing error, simply keep typing until you've got it right. Also note that the data field always reflects the data in the location pointed to by the address from the address field, even if the address field is not complete yet.
Now enter the address 1800 again before we continue. Then press the DATA key. This changes the display to 1 8 0 0 0.0., which indicates that the entry field has changed to the data field. Type two random hexadecimal digits and you'll see the data field change accordingly.
Press the + key followed by the - key and convince yourself that the data really changed to what you've entered.

Well done, we already know how to enter data into memory now. I want you to enter the following data in memory starting at location 1800H for me.

DD 21 09 18 CD 24 06 18 FB 02 BD 85 85 8F 37

I'll give you a hint on how to do that, just in case you are not sure about yourself yet:
Press ADDR, 1, 8, 0, 0, DATA, DD, +, 21, +, 09, +, etc, etc.

After entering this data you can verify that the data you've entered is correct (just to be sure this time). Do this by going back to address 1800H again and use the + to walk through the memory until the end of the table.

Congratulations, you've just entered your very first program into the MPF-1 (at least some of you have). You start this program by going back to address 1800H and press GO.
The display should now show HELLO-. Not very spectacular if you ask me, but it is a start anyway.

To stop your program and return to the monitor you'll have to press the RESET key. Don't worry, your program will still be there. You can start it again by going back to address 1800H and press GO again.
The memory contents will only be lost when you disconnect the power.

BTW, the GO key only works if the address field on the display really holds an address. So far this was always the case, but later in this chapter we'll see that other information can be displayed there as well (for instance register contents).

So far we have almost covered 2/3 of the keys on the keyboard. Not too bad in such a short time eh! A few keys more and we know everything there is to know about the monitor. But if you are anxious to start with the experiments right away I would urge you to read one more paragraph, the one about Tape Read/Write. That way you'll be able to store your programs on tape (or in the computer nowadays).

Tape Read/Write

Programs in RAM are highly volatile, they will immediately disappear as soon as the power is removed from the system. That's why it is quite handy if we can store the programs somewhere. We can! On audio tape.

Maybe you are too young to remember the audio cassette, which was the main storage medium for home computers in the seventies and eighties. The MPF-1 uses the audio tape as its main non volatile memory too.
Fortunately we can now use MP3 players or our PC as mass storage medium instead of real audio tapes, in case you don't have a cassette recorder.

The TAPE WR key is used to store your programs or data to tape. The TAPE RD key is used to read your data back again.
The right jack plug in the upper right corner of the board is the microphone output which should be connected to the tape recorder (or PC) input. The plug on the left of it is the speaker input, which comes from the headphones connection of your cassette player (or PC or MP3 player).

Example Writing To Tape

As an example we're going to save our HELLO program to tape. After that we're going to remove the power from the board for a short while, effectively erasing our program. Then we'll read the program back from tape again.

Press the TAPE WR key and the display will show something like F. The F on the display is the prompt to let you know that you now should enter the "file name". It is not a file name as we know it from the PC of course, it is simply a 4 digit hexadecimal number to identify your file with. As this is our first program, let's number it 0001H. So type 0, 0, 0, 1 and then +.

Now the display shows something like this: S. Our prompt now is the letter "S" (not the digit 5). This "S" stands for start address. It may come as no surprise to you that we should enter 1800 here, because that is the starting address of the program we want to save at the moment.
Enter 1, 8, 0, 0 and press the + key again.

Again we get another entry field, followed by the "E" prompt, which looks something like this E. We'll have to enter the end address of the data block we want to send here. In our case this is address 180EH. Please note that the end address is inclusive, which means it will be the last byte to be written to tape.
Enter 1, 8, 0, E and don't press anything else yet!

Now set the tape to its proper position and start the recording. Only then it's time to press the GO key. Don't worry, there's nothing wrong with your MPF-1! The noise it makes after pressing GO is perfectly normal! It is also quite normal that the display blanks during this noise because the Z80 is executing some very precise timing loops and it can't handle the display at this moment. The green LED should be on now too. In fact the green LED, the speaker and the MIC output are all driven by the same output bit of the 8255.
You can stop the recorder after the noise has stopped. However, just to be on the safe side, I usually start another tape write. You won't be the first to find out that you've started your tape too early on the blank lead-in, or to find out that there was a drop out on the tape during your precious program.
The MPF-1 is rather clever, because you simply have to press TAPE WR, +, + and GO to restart the write operation. The filename, start address and end address were not changed since last time.

Example Reading From Tape

You may now stop the recording and rewind the tape to the beginning of the program. Remove the power from the MPF-1 to destroy your program in RAM (don't forget to reconnect the power :).

Press the TAPE RD key and you'll see a display similar as this F.F.F.F.- F. The right F prompts us for the filename, which was 0001 in our example.
Thus simply enter 0, 0, 0, 1 and then GO. The display should now read . . . . . .. Start playing back the tape. Maybe you'll have to adjust the volume to get the best "sound quality". In the mean time the MPF-1's speaker will echo everything that comes in. You may have to rewind the tape and try again if the volume was not set properly.
When all's well you will hear a constant beep, which is shortly interrupted by some noise. During this short interrupt the display should show you the filename which is read back from the tape (0 0 0 1 - F in our case). If it is the filename we want it will be read back into memory, otherwise this file will be skipped and we'll wait for the right filename to pass by. During the reading of the tape the display will show only dashes, shortly after that it shows the last address which was restored from tape (180E 3.7. in our example).

File Name Forgotten

What to do if you don't know what filename you used when you stored the program? Simple, press TAPE RD, press GO and start the tape. Watch the display carefully, it will show you all the filenames which happen to pass by. As soon as you found out what filename you should use you can press RESET, rewind the tape and start over again but this time with the right filename.

Editing Memory Locations

When you're entering a program by hand you are likely to make typing errors. You may even skip a byte, or type a few too many. It is also possible that you are developing a program and want to make room for some extra instructions somewhere in memory.
The MPF-1 has two keys which help you to insert or delete some bytes in memory. These two keys only work in the address range from 1800H to 1CFFH.

Inserting a byte

The INS key is used to insert one byte. This byte is inserted behind the current address, the address is incremented and the data at this address now holds 00H.
A byte which is at the end of the block at address 1CFFH will get lost when you insert a byte.

Deleting a byte

The DEL key is used to delete one byte. All memory from the current address+1 until 1CFFH is moved one position down, effectively deleting the current data. A value 00H is added at the end of the block at address 1CFFH to fill in the gap.

Be careful with these two keys, they are very primitive! Not only do they work on a very limited and fixed block of memory, they also don't adjust absolute addresses in your program. Simply inserting or deleting bytes will require a total review of your program!
Thus use these keys very carefully. This warning doesn't apply if you use these keys to correct typing errors while entering your program though. It only applies if you want to insert some bytes into an existing program.


You've written your own program and it doesn't do exactly what you had intended. What to do now? The MPF-1 features some simple debugging tools. You can set a break point for instance. You can then start the program and as soon as it reaches your break point it will stop and return you to the monitor. This gives you the opportunity to examine the processor register and memory contents. If you don't like what you see you can even alter the processor or memory contents before you continue the program.
You can also single step through a program. Single stepping means that the program is executed one step at a time. Again you have the possibility to examine or alter processor registers or memory locations after each step. You can also single step through your program after it has returned control to the monitor at a break point.
Finally you can interrupt a runaway program and return to the monitor. This could give you an idea where the program goes wrong.
In any case, after examining and/or altering registers and memory locations you can continue the program again as if nothing has happened.

In all honesty, the debugging tools of the MPF-1 are rather primitive. First of all you can only set one break point at a time, thus you'll have to know which path a program is going to take in order to set the break point at a strategic location.
But what's even worse is that the monitor is not excluded from the debugging features. This means that when you press the MONI key in a program which spends most of its time showing data on the display you are most likely to interrupt the program while it's inside the monitor. And correct me if I'm wrong, but you don't want to debug the monitor program. Single stepping through monitor routines is also something you don't really want to do.
I don't want to claim that the debugging capabilities of the MPF-1 are useless, I'm only warning you for its limited functionality.

SBR and CBR Break points

If you want to know what has happened to registers and/or memory locations at a certain point in your program you can set a break point there. A break point is simply set by pressing the SBR key. If the break point is successfully set the display will show address and data fields with all the dots visible (for instance

There are some restrictions on the use of the SBR key:

  • The address field of the display should show a valid address.
  • A break point can only be set in RAM memory.
  • A break point should always be set on the first byte of a multiple byte instruction!
  • Only one break point can be set. Setting a break point will automatically erase a previous one.

When you press GO the program is executed until and including the instruction where the break point is set. All processor registers are saved and can be examined and altered (see description of the REG key).
Important note: When you have returned to the monitor because of your break point you can single step through the rest of your program or you can press GO to continue your program. But before you press STEP or GO make sure the display shows the right address to continue from. This is especially important if you have examined other memory or register locations before you want to continue your program. The easiest way to do that is always press the PC key before continuing. The PC key always recalls the last known PC value.

If you no longer need your break point you can simply press the CBR key at any location in memory. The display will show F.F.F.F.F.F. to indicate that the break point is disabled.

STEP Single stepping

The STEP key allows you to go through your program one step at a time. It doesn't matter whether you start from the beginning of your program, or single step whenever you're returned to the monitor either by a break point or the MONI key. After each program step you are returned to the monitor again, where you can examine or alter register and memory contents.
Be sure to have the current Program Counter in the address field before you press STEP, otherwise you may find yourself single stepping through a completely different program. If the display doesn't show the current Program Counter simply press PC before you press STEP or GO.

It is also possible to restart the normal program execution, simply by pressing GO when the Program Counter is in the display.

Be carefull when you single step through the monitor routines. Chances are that you will find yourself stuck inside an endless loop because the monitor routines are not really designed for single stepping.

MONI Return to the Monitor

The MONI key may help you find the cause of a runaway program, even when you haven't set a break point. By pressing the MONI key you are immediately returned to the monitor, with all registers saved.
Again you can examine or change registers and memory. And you can single step through the rest of the program, or press GO to continue your program again.
As always you should have the current Program Counter in the display before you press STEP or GO.

If your runaway program uses one of the monitor's display scan routines heavily the MONI key may prove to be of little use. Chances are that you will always interrupt the scan routine instead of your own program simply because the processor is likely to spend much more time waiting inside the scan routine than it is actually running your program.

REG Examining registers

Finally the REG key allows you to examine or alter the processor's registers. These registers are used whenever you start, step through or continue your program.

By pressing the REG key followed by one of the digit keys the display changes into the register mode. In the register mode the left 4 digits show the contents of a register pair, followed by the name of the register pair. In this example 1 2 3 4 B C the digits 1 2 are the contents of the register B, while the digits 3 4 are the contents of the register C. B C is of course the register pair's name.

You may press more than one digit key after pressing REG, this will display all the requested registers in turn. This allows you to examine all the registers without having to press REG each time.

You may start altering register contents by pressing the DATA key when a register pair is displayed. As an example I display the contents of the AF register first by pressing REG and AF. The display may now look like this: 1 2 3 4 A F.
After pressing the DATA key the display will show 1 2 3.4. A F, indicating that you can now alter the contents of the F register. You may now alter the contents of the F register, or simply press + to switch to the A register, then the display may look like this: 1.2.3 4 A F.
Pressing + once more will switch you to the BC register pair, with the data entry field set to the C register. This may look like this: 5 6 7.8.B C.
This way you can walk through and alter all the Z80's registers to your liking. Whenever you start your program again or press STEP the new register values are used.

Be sure though to press PC every time you're in register display or edit mode before you press STEP or GO!

Moving Data

The monitor can help you to move some data around in memory. Usually this is necessary to make room for some modifications. Keep in mind thought that it is only a simple move, no absolute destination addresses are renumbered. This means that after moving a working program you'll probably end up with a non working program!

If the source block doesn't overlap the destination block the move is none destructive. This means that the source block will still exist after the move. In fact copy would be a more appropriate name for this monitor function.
The source and destination blocks may overlap. The software is clever enough to not to destroy data which has not been moved yet.

To move some data simply press the MOVE key. The display will now show something like this: F.F.F.F.- S, which means that you can now enter the Start address of the source block. After entering the start address of the source block you can press + to get a display similar like: F.F.F.F.- E. Now enter the End address of the source block and press + again. Finally F.F.F.F.- D prompts you to enter the start address of the Destination block. After entering this destination address you press GO to start the move operation.

The relatively high speed of the processor in combination with the fairly small memory capacity of the computer makes the move instantaneous. After the move the address field will show you the last address which was moved.

Relative Address Calculation

The monitor can also assist you in calculating relative addresses when you want to hand-assemble your programs. We will use the SB-Assembler to assemble our programs, making this monitor function obsolete for us.

JR and DNJZ instructions use relative addresses as operand. A relative address is the distance between the current address and the destination address. You can of course simply count your way to the destination, or you can use a hexadecimal calculator to this job. But you can also use the monitor to help you.

Press the RELA key and the display shows something like this: S. Now you can enter the Start address of the relative instruction. After entering this start address press + and the display will show something like: 1.8.F.F.- D. This prompts you to enter the destination address.
After entering the destination address press GO and the display will show you the result in the data field. But this is not the only thing the monitor has done! It has also stored this value in the Start address + 1 location. Suppose your start address was 1900H and your destination address was 1960H, the value 5EH is now stored at 1901H.
This is rather useful, because that is where the relative value should be put anyway. But be careful with this routine if you only want to use it as calculator, because it will alter your program.

This function will only work properly if Start address + 1 is in RAM memory!

The range of the relative addressing mode is from +127 to -128. If this range is exceeded the display will show - E r r     .

The Last Two Remaining Keys

We have almost covered all keys on the MPF-1's keyboard now. There are only 2 keys remaining to be explained, and that is quite an easy job because their function is rather straight forward.

The USER KEY is directly connected to Port A bit 6 of the 8255. This input is active low, which means that the key is pressed if this input reads 0.

The INTR is an Interrupt key. With this key you can experiment with Interrupts. When you press this key the current program is interrupted and control is transferred to the INT routine.
By default the processor runs in IM0 mode. When you press the INTR key your program is interrupted and the user changeable vector at 1FEEH and 1FEFH is called (as long as interrupts are enabled of course). This vector points at 0066H by default, a monitor interrupt routine.

Be careful with the interrupt key! In mode IM0 it is all straight forward. But if you're going to work with IM2, the sophisticated interrupt mode of the Z80 peripherals, you may be in for a surprise. When pressing INTR when the processor is in IM2 an interrupt is called at address (I)FFH. Thus if the I register of the Z80 holds 18H, the INTR key will use the values in 18FFH and 1900H as a vector to the interrupt handling routine.
Thus be sure you have an interrupt vector there! If you're not interested in the functionality of the INTR key let it simply call the default interrupt routine at 0066H.
If you fail to include a valid vector for the INTR key you may find your program to crash whenever you press INTR.

BTW, the MPF-1 has no NMI facilities.