MZ-80K monitor SP-1002
The 48 kbytes RAM of the MZ-80K are free and not allocated after power on / RESET. A program to be executed must be loaded first into the storage by the data recorder, a disk drive, or manually by the keyboard. The monitor program is needed to load the program to be executed. It is resident in a 4 Kb ROM and it does the work like a boot loader or an IPL ( Initial Program Loader ). The monitor program SP-1002 is activated after power on first and the blinking cursor waits for your input command ( see screenshot above).
The following monitor commands are available and described in detail later in this section:
|FD||load machine code program stored on cassette to RAM, for example BASIC|
|GOTO||transfer the control to the machine code beginning at the specified address|
|LOAD||loads a program file from the data recorder into the storage, for example BASIC|
|SG||keyboard beep-tone on|
|SS||keyboard beep-tone off|
Detailed syntax of the monitor commands
Commands will be executed when you enter the command and afterwards the enter key CR was pressed. Numerical values must be entered in hexadecimal notation. Don’t use spaces and don’t omit preceding zeroes. Please select one of the following commands to see the syntax of the command:
LOAD loads the next machine code file found on tape, whereas
LOADMYPROG loads the file “MYPROG” from tape ( if any was saved with this filename ).
The monitor will response: PLAY if the PLAY button isn’t pressed at this time.
Press now the PLAY button at your data recorder. If the monitor has found a machine code program, the monitor responses:
To premature end the load process press the BREAK-key.
After loading is complete control is passed to the loaded program code.
The program at the location aaaa will be executed. The monitor transfers the control to this program. Example to start a program with its entry point at $C000:
The normal starting address for machine code programs is $1200, hence control can be passed to a machine code routine using GOTO$1200.
Don’t use the assembler RET command to return to the monitor, unpredictable results can occur if you use the same stack in your program and if you don’t set up the stack before returning to the monitor. Use the following commands instead of the assembler RET command to return to the monitor program:
LD SP,$10F0 ; re-initiate monitor's stack JP $0082 ; goback to the monitor
SG command ( Sound Generate )
If you enter the SG command you can hear a short beep-tone over the loudspeaker while pressing any key.
SS ( Sound Stop ) command
If you enter the SS command the beeping while pressing a key will be stopped.
Floppy Disk access
If you type in the command FD the monitor checks the byte at location $F000. If the value of this byte is $00 the control is transferred to $F000, otherwise the monitor ignores the command. $F000 is the address of the floppy disk bootstrap routine ( held in ROM on the optional disk interface board ).
The response will be:
This function can be used for some own purposes too. Connect your own ROM or RAM and put $00 to this location and use the FD command to start your own application from this location. $00 is a NOP only.
The monitor’s work area
The work area of the monitor starts at location $1000 and ends at location $11F5.
The contents of the monitor’s work area shows the following table:
|free area; unused by the monitor|
|Jump command to the time interrupt routine at location $0392. Contents is $C39203. Set by monitor during startup. Can be modified for own interrupt routines.|
|SP||The stack of the monitor from $103C to $10EF ( top down processed, $103B unused ) for max. 90 stack entries ( all needed? ). Set to $10F0 by the monitor during startup.|
|IBUFE||The tape buffer contains the tape header during read / write.|
|ATRB||The attribute of the file.
01 = machine code program
02 = BASIC program file
03 = BASIC data file
04 = Editor-ASCII file
05 = assembler RB file
|NAME||The name of the file ( max. 16 + $0D )|
|SIZE||The length of the file.|
|DTADR||The storage address the file was saved from. ( equals to the load address for the load process )|
|EXADR||This is the execution address the file is to be executed after loading the file. ( autostart function )|
|COMNT||Unused by the monitor. This is the comment area of the tape header. Can be in use by other programs for specific functions. Can be used for own purposes if unused ( e.g. own loader or copyright information etc. )|
|KANAF||00 = capital letters
01 = SML ( small )
|DSPXY||Column / row pointer of the current cursor position.
$1171 = column ( X ). Possible values: $00 – $27 ( 40 columns )
$1172 = row ( Y ). Possible values: $00 – $18 ( 25 lines )
|MANG||work area mainly used for scrolling. Contains line pointers ( 40 / 80 char. / line )|
|FLASH||Contains the character at the cursor-position to restore the display character when the cursor changes from on to off.|
|FLPST||flashing position; absolute address of the cursor|
|FLSST||0 = cursor off
1 = cursor on
|FLSDT||character code of the cursor|
|STRGF||quotation mark counter; indicates insert / normal mode. 0 = normal, <> 0 insert|
|DPRNT||length of input line ( number of characters in the input line )|
|TMCNT||controls the number of tape mark pulses during read|
|SUMDT||current check sum of logical-1-bits of the tape file during read / write.|
|CSMDT||check sum value of logical-1-bits used by the verify process.|
|AMPM||AM / PM value used by the internal clock ( 8253 ):
$00 = AM
$01 = PM
|TIMFG||$F0 set by the time set routine normally. The subroutines RDI ( $0027 ) and RDD
( $02A ) disable interrupts by DI but don’t enable further interrupts by EI at the end of execution if this time flag is not $F0. $F0 means clock is running
|SWRK||Controls the bell. The bell is on if bit 0 is off and beeps every time a key is pressed. Used by the beep command.|
|TEMPW||Controls the tempo of a melody to be played. The valid range is from $01 to $07. $01 is quick, $04 is normal, and $07 is slow. Note, the order of the values from quick to slow ( $01 to $07 ) is contrary to the order of the values used by the subroutine $0041.|
|ONTYO||work area used by ONPU subroutine at $021C to compute the interval ( note length ) of a note. If you code a note without its interval, the last specified interval to a note / pause is used or the default value 0 if never an interval was specified before. To this, ONTYO contains the last specified interval or the default value 0.|
|OCTV||work area used by the melody play subroutine to operate the octave internally.
01 = upper octave
02 = middle octave
03 = lower octave
The values in the tables at $0271 and $0289 are multiplied by OCTV to compute the value RATIO.
|RATIO||used by the melody play subroutine and the monitor’s subroutine $0044 to set the output frequency of counter 0 of the 8253 ( note frequency )|
|BUFER||input line buffer used by the monitor’s get line routine at $0003 / $07E6.|
|end of the monitor’s work area.|
|start of free area.|