Sharp logo
MZ-700 memory map 
( storage management )

Storage structure at power on ( MZ-80K / MZ-80A mode )

Structure of the storage after power on


After power on the structure of the storage is built as shown in the picture. The partition between $D000 and $DFFF of the MZ-700 is not according to the MZ-80K / MZ-80A, but the entry address of the monitor ROM has the same entry point address as that of the MZ-80K / MZ-80A, the execution starts at $0000 after reset or after power on ( a function of the Z80 CPU ).

Storage structure after loading of a system program using the monitor's load command "L" ( bootstrap )

Storage structure after LOAD

With the input of the LOAD command of the monitor, the BASIC loading program is transferred to the system area composed of the RAM and starts to bootstrap. ( Only the cassette tape is subject to bootstrapping in this case ).

If you have typed in the monitor's load command "L" to load an assembler program from tape, the first program found on tape will be loaded to the storage address in the DRAM as defined by the tape header at location $14 and in the length as defined by the tape header at location $12. The job is done by the monitor's load routine.

The execution starts at the storage address as defined by the tape header at location $16. The tape header is loaded into the monitor's work area starting at address $10F0 in the length of 128 bytes.

The first byte at location $10F0, this equals to the tape header location $00, defines the attribute of the file. This will be the attribute for a program either written in assembler or written in BASIC, but it could be the attribute of a data file too. Special codes for MZ-80K files are also possible.

The name of the file starts at location $10F1 in the length of 16 bytes and is followed by $0D ( CR ). If the name of the file is less than 16 characters in length, then the remaining bytes are filled with $0D.

As described above the name of the file is followed by the order of the byte size ( 2 bytes ), the load address ( 2 bytes ) and the execution address ( 2 bytes ). A comment area in the length of 104 bytes starts at location $1108 and has no special meaning. Use this area for your own purposes.

location
in tape
header
loc. in
monitor's
work area
location in
S-BASIC
1Z-013B
length meaning
$00 ( 0 )
$10F0
$0FFC
1
attribute of the file:
01 machine code program file
02 MZ-80 BASIC program file
03 MZ-80 data file
04 MZ-700 data file
05 MZ-700 BASIC program file
$01 ( 1 )
$10F1
$0FFD
17
file name ( end = $0D )
$12 ( 18 )
$1102
$100E
2
byte size of the file
$14 ( 20 )
$1104
$1010
2
load address of a program file
$16 ( 22 )
$1106
$1012
2
execution address of a program file
$18 ( 24 )
$1108
$1014
104
comment

You can find in the comment area of your original BASIC load tape a tiny program written in machine code to copy your BASIC tape. To get more details about this click here.

Storage structure after load of the BASIC interpreter ( MZ-700 mode, system initiation )

The BASIC interpreter will be loaded by the monitor into the storage starting at location $1200 as defined by the tape header. For this, no bank switching must be performed. To the area from location $1200 is RAM allocated every time.

The execution starts at location $7D79 as defined by the tape header too. At startup the BASIC interpreter on tape has a trailer to load itself to the RAM location $0000. See the code:

7D79 AF		XOR	A 
7D7A 110000	LD	DE,$0000 
7D7D CD3300	CALL	$0033	   ; perform time set (init to 0) 
7D80 2A7111	LD	HL,($1171) ; transfer displ. coordinates
                                   ; from monitor 
7D83 225412	LD	($1254),HL ; to the BASIC interpreter 
7D86 110000	LD	DE,$0000   ; starting address
                                   ; for LDIR command 
7D89 21796B	LD	HL,$6B79   ; length of data to be moved
                                   ; by LDIR 
7D8C B7		OR	A	   ; reset carry flag
                                   ; for arithmetic SBC 
7D8D ED52	SBC	HL,DE	   ; compute length 
7D8F 4D		LD	C,L	   ; set BC to the start address
                                   ; for LDIR 
7D90 44		LD	B,H	   ; 
7D91 210012	LD	HL,$1200   ; set HL to start
                                   ; of data to be moved 
7D94 D3E0	OUT	(E0),A	   ; bank switch to RAM
                                   ; ($0000 - $0FFF) 
7D96 EDB0	LDIR		   ; move data 
7D98 C30000	JP	$0000	   ; execute BASIC  

This program is available at the startup of the BASIC interpreter only, it will be deleted when the startup is completed.

Structure of the storage after load of BASIC


This figure shows the structure of the storage after the load of the BASIC interpreter.

You can switch the bank for accessing the I/O ports ( see memory mapped I/O ) by OUT ($E3),A and to return back by OUT ($E1),A ( see bank switching ) by imbedded machine code programs in your BASIC program ( BASIC command USR ).

Storage structure at the time of manual reset

Structure of the storage after resetting the MZ-7xx manually


Both structures, the structure of the storage after resetting the MZ-700 manually and the structure of the storage after turning the power on ( see storage structure at power on ), are identically.

If you press the RESET-key at the reverse side of the MZ-700 and the CTRL-key coincidentally the existing program in the RAM will be executed starting with the first instruction at the location $0000 in the RAM.

Unpredictable results will occur if you had no program loaded to this place. :-)

To this the monitor program in the ROM checks if the CTRL-key is pressed at startup.

Note The startup procedure will be performed only after power on or after resetting the computer. The following steps will be performed:

First, bank switching to the RAM at location $D000 will be done by the bank switching command OUT ($E1),A. Next, a tiny instruction set consisting of two instructions is stored to the top of the RAM in the length of 5 bytes starting at location $FFF0. Note, the RAM at this location is now active. Last, the instruction set at location $FFF0 will be executed. See the monitor's routine for this:

	CP	$20	 ; CTRL key?
	JR	NZ,ST0	 ; no, go normal process
CMY0:	OUT	($E1),A	 ; $D000 - $FFFF is RAM now
			 ; and the ports and the V-RAM is deactivated
	LD	DE,$FFF0 ; transfer address
	LD	HL,MCP	 ; address of memory change program
	LD	BC,$0005 ; byte size of memory change program
	LDIR		 ; move up memory change program
	JP	$FFF0	 ; start memory change program
MCP:	OUT	($E0),A	 ; $0000 - $0FFF is RAM
			 ; and the monitor is deactivated
	JP $0000	 ; start at $0000 in RAM
ST0:.....normal process

The first instruction of the set at the symbolic address MCP activates the RAM storage starting at location $0000 by the bank switching command OUT ($E0),A and by this, the monitor's ROM is deactivated. The second instruction is a jump command JMP $0000. If the CPU executed the jump command the execution of the program at address $0000 in the RAM starts.

The same procedure as described above will be performed if you press the #-key first and then the CR-key at the monitor's response line and at any time you're working with the monitor.

See the disassembled and reassembled monitor ROM ( download now ) at location $0057 for this procedure and take a look at the structure of the storage after execution of the procedure:

Structure of the storage pressing RESET/CTRL-keys

RAM between $0000 and $0FFF and between $D000 and $FFFF will be allocated by pressing the RESET key and the CTRL key coincidentally.

Floppy bootstrap

Floppy bootstrap

Because the floppy control area is mapped to $F000 for compatibility with the MZ-80K-series, boot begins from the address $F000.

Map configuration after boot will be considered separately.

 

Bank switching

There are two areas which can be bank switched. The first area starts at location $0000 and ends at location $0FFF ( 4 kbytes ). The second area starts at location $D000 and ends at location $FFFF.

You can allocate RAM or the monitor's ROM to the first area by bank switching commands.

You can allocate RAM or the V-Ram and I/O ports to the second area by bank switching commands .

The RAM you can allocate to both areas can be used by any programs. There is no limitation of the usage of the RAM.

If you use a port address between $E0 and $E6 by the assembler command OUT (port#),A bank switching is invoked as shown in the following table.

port# $0000 - $0FFF $D000 - $FFFF
$E0 RAM no action
$E1 no action RAM
$E2 ROM no action
$E3 no action V-RAM and I/O ports
$E4 ROM V-RAM and I/O ports
$E5 no action locked
$E6 no action unlock locked area by $E5

For example OUT ($E4),A configures the storage like pressing the reset key does. The content of the accumulator register A is optional. You don't have to establish the register before executing the bank switch command. Any value of the register content is valid.

OUT ($E0),A allocates RAM to the area between $0000 and $0FFF and
OUT ($E2),A allocates ROM to the same area. The bank between $D000 and $FFFF will not be switched.

OUT ($E1),A allocates RAM to the storage between $D000 and $FFFF whereas
OUT ($E3),A allocates the V-RAM and the I/O ports to the same area. The bank between $0000 and $0FFF will not be switched.

OUT ($E5),A prevents any access to the active storage between $D000 and $FFFF. The active storage between $0000 and $0FFF is accessible, but the active storage between $D000 and $FFFF is locked and un-accessible.

For example, if you invoke bank switching to V-RAM by OUT ($E3),A or by OUT ($E4),A and you execute OUT ($E5),A next, any access to V-RAM and the I/O ports does not work properly. Otherwise, if you invoke bank switching to the RAM by OUT ($E1),A followed by OUT ($E5),A access to the RAM does not work properly.

If you access the locked area by read, the data returned is invalid. If you access the locked area by write, no data will be written into the locked area. Any commands to access the locked area will be executed, but neither valid data will be read from the storage nor data will be written into the storage.

You cannot bank switch the area between $D000 and $FFFF if a lock is active. No bank switching will be done if you try.

You can unlock the area by OUT ($E6),A to get back access to the storage you had locked. Locking the RAM returns the RAM by unlocking and locking the V-RAM returns the V-Ram by unlocking.

You can unlock the area by OUT ($E4),A too, but you get back the V-RAM and I/O ports even you had locked the RAM before. Using OUT ($E4),A is the same like resetting the MZ-700 manually or like turning the power on: The same structure of the storage will be built. The monitor ROM is activated too.

Note The instruction pointer should never point to an address into an area you switch to. Be careful if you do intentionally, otherwise unpredictable results may occur like viruses do :-)

Video storage structure

Structure of the V-RAM (Video RAM)
Structure of the V-RAM ( Video RAM )

 

The character V-RAM starts at location $D000 in the length of $800 ( 2,048 ) bytes. The color V-RAM starts at $D800, its length equals to the length of the character V-RAM.

There are 2 Kbytes video RAM ( V-RAM ) available of the MZ-700, but 1 Kbytes is displayable only on the screen. The visible part of 1 Kbytes is scrollable within the available 2 Kbytes V-RAM.

visible part after reset

 

This picture shows the visible part after resetting the MZ-700 manually. The same visible part is displayed if the MZ-700 is powered on.

one line over the end

 

If you scroll now one line over the end of the V-RAM this part is visible.

In this case, the first line of the 2 Kbytes available is displayed again at the bottom of the visible area.

This way of scrolling is available with the BASIC interpreter 1Z-013B, it is not available with the monitor 1Z-013A. The monitor program is not designed to use scrolling.

The monitor scrolls up one line only showing the actual line in the last line of the visible part while the oldest line scrolls out at the top of the visible part. There is no way to show the line scrolled out again while the monitor is active.

You can scroll down and up all of the available 2 Kbytes V-RAM with the BASIC interpreter. Pressing the keys SHIFT and cursor up coincidentally will scroll the V-RAM up and pressing the keys SHIFT and cursor down coincidentally will scroll the V-RAM down.

scrolling

 

The visible part turns within the 2 kbytes V-RAM while scrolling. The actual end of the video RAM will be scrolled to the actual end of the visible part on both ways. The cursor doesn't move while scrolling.

Click here to view the details about the V-RAM.


Go to the top of this page Home

last updated August 4, 2002
sharpmz@sharpmz.org