|   |
![]() |
||||||||||||||
Home |
I encourage you to study and play with the experiments on this site. Hopefully they pay off to be educational in exercising your MPF-1 which has been standing there collecting dust all those years. I've made it all as easy as possible for you. How can I participate in the experiments? Simple, download the software package of the experiment you want from my site. Unpack it somewhere on your hard drive. If you want to modify or assemble the programs yourself I recommend you to unpack the package in a subdirectory of the SB-Assembler main directory. This will allow you to simply type "sbasm program" to assemble it. Anyway, if you unpack an experiment's package you will usually end up with 4 files:
The assembler source files are highly commented and should explain the main issues of the program.
If I feel like it I may highlight some parts of the program on the program description page to explain the program even further.
The list file can be useful if you feel like typing the program into the MPF-1's memory. I will explain shortly how this is done. The HEX file can also be used to type the program into the MPF-1's memory. However HEX files are usually harder to read because of the dense code they contain.
The mp3 file is the easiest way to enter a program into the MPF-1's memory.
Simply use the TAPE RD monitor function and use your PC as tape recorder.
Below you'll see a little excerpt from the .lst file of the first experiment. I use it only for demonstration here. This is not a complete program, so please go to the experiments page to get the entire program if you want to try your luck on a real program. 1800-1E C1 56 KEYMAP LD E,11000001B Starting output mask 1802-16 00 57 LD D,0 Clear the column index 1804-2E 06 58 LD L,6 Set the column counter to 6 1806- 59 1806- 60 .COLUMN ; Column scan loop 1806-7B 61 LD A,E Make only current column low 1807-2F 62 CPL 1808-F6 C0 63 OR 11000000B Don't mess with these two bits! 180A-D3 02 64 OUT (DIGIT),A 180C- 65 180C-06 06 66 LD B,6 Set row counter to 6 180E-0E 00 67 LD C,0 Clear the row index 1810-DB 00 68 IN A,(KIN) See if key down in this column 1812-67 69 LD H,A What do we see here?
The first column of each line holds the starting address of the code on that line.
This starting address is followed by a dash.
The next column is simply a line number. It can be useful if the assembler reports some errors on line-x. Otherwise you may forget about line numbers here. Behind the line number column you see the 4 usual assembler columns: Label, mnemonic, operand and remark fields. These are the fields which originally were in the .asm source file. Here's the key sequence you'll have to follow in order to type this example into the MPF-1's memory: ADDR, 1, 8, 0, 0, DATA, 1, E, +, C, 1, +, 1, 6, +, 0, 0, +, 2, E, +, 0, 6, +, 7, B, +, 2, F, +, F, 6, +, C, 0, +, D, 3, +, 0, 2, +, 0, 6, +, 0, 6, +, 0, E, +, 0, 0, +, D, B, +, 0, 0, +, 6, 7. You can also copy the code from the .hex output file. However because of the dense nature of these files you may easily get lost between all the digits. Soon you may find yourself skipping digits or entering the same line twice.
Of course you can use a real tape recorder to save your own programs. But saving it to the PC is more comfortable, and even more reliable. But you'll have to make some small modifications to the MPF-1 to make it work properly.
Originally the microphone output level of the MPF-1 is far too low.
OK, I can use an external amplifier to increase the output level.
However it is far easier to change the attenuation of the output level, after all we start off with a 5 V square wave!
With this increased output level it is now possible to record the tape signal on my computer. I use the program Audacity to record the signal, which is stored as an MP3 file at a bit rate of 40k @ 44k1 sample rate. This results in about the highest possible compression, which can still be read back if you play it loud enough.
OK, you may have guessed by now that I've written all the example programs using my SB-Assembler, I've never made a secret about that. But how are the programs transferred from the PC to the MPF-1? We can't use the MP3 trick during development/debugging simply because the program doesn't exist yet. And surely the programs were not entered by hand during debugging! Mind you, in the old days this was the only way to enter your programs for the first time! Some clever people have developed a way to connect the MPF-1's extension connector to the PC's parallel printer port. With a small addition to the monitor ROM this allowed easy transfer of programs from the computer to the MPF-1. I may include the details of this little trick later, for now I can only show you how I have done it.
I simply used my Tiny EPROM Simulator.
This little gadget connects to the SB-Bus (or just about any serial port) and simply pretends to be a 32k EPROM.
This simulated EPROM is connected to the U7 socket of the MPF-1, which is originally intended to hold an extra EEPROM or RAM chip.
offset = - (06000H - 01800H) = 0B800H
So far our program, which should start at address 01800H, can now be seen by the MPF-1 at address 02000H.
Before we can run the program we must copy the range from 02000H to 026FFH to the destination address starting at 01800H.
Why not the entire range?
Because usually the highest page in RAM is not occupied by any program, instead it is often used as stack and variables area.
.OR 02800H Ends up at address 03000H
LD HL,02000H Move the program from U7
LD DE,01800H to RAM
LD BC,00700H
LDIR
JP 01800H Start the program
After assembling the program, it can now be started by pressing ADDR, 3, 0, 0, 0, GO. To prove that this all works I have included the following listing. Simply copy it into an empty file, name it proof.asm, assemble it, set the offset to $B800 on the Tiny EPROM Simulator, write the Intel hex file to the Tiny EPROM Simulator and press the above mentioned keys to start the program.
;------------------------------------------------------------------------
; Some proof that the 0B800H offset is correct
;------------------------------------------------------------------------
.CR Z80
.OR 01800H
.TF PROOF.HEX,INT
;------------------------------------------------------------------------
; This part of the program ends up at address 01800H
;------------------------------------------------------------------------
PROOF LD IX,DSP_BFFR
CALL 005FEH Call SCAN routine
JR PROOF
DSP_BFFR .DA #0 Display buffer (from right to
.DA #%0000.1111 left)
.DA #%1010.0011
.DA #%1010.0011
.DA #%0000.0011
.DA #%0001.1111
;------------------------------------------------------------------------
; Install and run, ends up at 03000H (Offset 0B800H)
;------------------------------------------------------------------------
.OR 02800H
LD HL,02000H
LD DE,01800H
LD BC,00700H
LDIR
JP 01800H
One last tip: Because Hyperterminal is a very peculiar program it insists on a .txt extension for files to send. Therefore it is better to name your object file proof.txt instead of proof.hex, this will save you a lot of clicking every time you want to upload the file. |