Memory Mapper

Introduction

The Memotech Memory Map is a complicated thing,
populated to various degrees in various systems,
to varying degrees of quality.

We assign each physical 16KB of memory a letter.
Greek letters, then lower-case, then upper-case.

We can then talk about which physical page we expect to see when
setting RELCPMH, P3,P2,P1,P0 and A15,A14 to particular values :-

RELCPM=0

RELCPMH=1

Both

0x0000..0x3fff

0x4000..0x7fff

0x8000..0xbfff

ROMs

γ

β

a

δ

c

b

e

d

g

f

i

h

k

j

m

l

o

n

q

p

s

r

u

t

w

v

y

x

A

z

C

B

0x0000..0x3fff

0x4000..0x7fff

0x8000..0xbfff

δ

γ

β

a

b

c

d

e

f

g

h

i

j

k

l

m

n

o

p

q

r

s

t

u

v

w

x

y

z

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

0xc000..0xffff

P3,P2,P1,P0

α

0

1

2

3

4

5

6

7

8

9

A

B

C

D

E

F

MEMMAP.RUN and MEMMAPC.COM are simple
programs to stab each possible memory page with a distinct value,
and then read them back to see where the memory actually is.

Usage

From CP/M :-

A>MEMMAPC

From MTX BASIC :-

ROM 5
USER RUN "MEMMAP.RUN"

Memory has now been corrupted, so power off your system.

Send the generated .OUT file to me,
or perhaps you'd like to interpret it, using the information below.

What it does

Both programs do the same thing.
I only bother to supply two variants, in case you don't have CP/M,
or you don't have the SDX feature.

The programs make 4 passes :-

Write in RELCPMH=0 mode, read back in RELCPMH=0.
These are the pages which are visible to MTX BASIC,
and are reflected by PRINT PEEK(64122).

Write in RELCPMH=1 mode, read back in RELCPMH=1.
These are the pages used by CP/M and by the RAM Disc support.

Write in RELCPMH=1 mode, read back in RELCPMH=0.
This is to determine the mapping between the modes.

Write in RELCPMH=0 mode, read back in RELCPMH=1.
This is to determine the mapping between the modes.

The logic of the program is as follows :-

for relcpmh_w,relcpmh_r in 0,0 1,1 1,0 0,1
for page in 0 to 15
set iobyte to relcpmh_w*080H+page
for address in 0000H,04000H,08000H,0C000H
mem[address] = page*4+address/04000H
for page in 0 to 15
set iobyte to relcpmh_r*080H+page
for address in 0000H,04000H,08000H,0C000H
write mem[address] to disk

Interpreting the results

MEMMAP.RUN and MEMMAPC.COM produce
either MEMMAP.OUT or MEMMAPC.OUT files.
Although the names differ, the content is in the same format.

Interpreting the files is a little messy, so I use my
Binary Editor.
This editor is a very powerful tool, but we are only using a small part of
its functionality here

eg:

$ be -i memmap.ini MEMMAPC.OUT

Enter then + will select and expand the first section,
to show something like this :-

MTX512 S2

In a MTX512 S2, there is 256KB on the motherboard,
but limitations of address decode PAL and the yellow wiring mean that
the δ page doesn't work as described as above.
RELCPMH=0 mode, RAM Page 1, addresses 08000H-0BFFFH actually accesses page c.

This means that programs that rely on the page "moving" don't work.
An example of this is LOADMTX.

Why is the t replaced by z in the last table above?
Its a quirk of the fact the same page of memory is written to more than the
intended one time.
This is because during this test, it just so happened that the special
RAM Page 14 and 15 windows happen to alias to the same physical page.

A similar reason explains why we see 0x3d instead of the
word rom above also.
By quirk of the memory windows, we actually overwrote the first byte
of the OS ROM!

SDX with 512KB

An MTX512 with an SDX with 512KB of RAM, should look something like this :-

Note that the extra memory is only visible in RELCPMH=1 mode.
This is a pattern I have copied with my
MTX Memory Card
designs.
No known MTX BASIC program needs the extra memory,
but it is handy for CP/M to use as a RAM Disc.
Only providing extra memory in one mode simplifies the logic,
and avoids problems like the one that follows.

Daves MTX512 S2 + SDX with 512KB

This is like an SDX except it makes more memory available in
RELCPMH=0 mode :-