Page 1 of 2

Memotech HRG: ROM mirroring!

Posted: Thu Feb 22, 2018 12:23 am
by XavSnap
Hi,
I target the code to reinit the Memotech HRG:
;------------------------------------
;-Basic sub-routine entry. -
;+----------------------------------+
; Lb4082 ; <- USR Basic Enty.
;+----------------------------------+
ORG $4082 ; [@16514/@h4082]
Lb4082: ; <- USR Basic Enty.
LD HL,$0000
LD DE,$0000
LD BC,$0400
LDIR
RET ; ==========================
I had to create a buffer (ram 0 to &400) in Vb81...

But, in EO... this program can't work properly:
FR.P
Memotech HRG RAM 0-h400
(3.73 KiB) Downloaded 221 times
Text&P file:http://zx81.ordi5.free.fr/programmes/Me ... ncais.zip (Type RUN, and NEW)

Image

... the ROM steel in read-only statement.
A "write" process (POKE/LD/LDIR...) seem to be the trigger to read the mirrored ROM.
:?

Re: Memotech HRG: ROM mirroring!

Posted: Thu Feb 22, 2018 10:02 am
by siggi
Hi Xav
did you disable "write protect" of the ROM (in "Advanced settings": "Protect ROM from Writes")?
Write-Protect-Rom.jpg
Regards
Siggi

Re: Memotech HRG: ROM mirroring!

Posted: Thu Feb 22, 2018 2:37 pm
by sirmorris
Hmm.

Code: Select all

        // Memotech Hi-res board has 1k of RAM available at address 8192
        // permanently and overlaid the ROM at address 0 when z80.i is odd
        // or data is written to address 0-1k

        if (Address<=zx81.ROMTOP && zx81.protectROM)
        {
                if ((zx81.truehires==HIRESMEMOTECH) && (Address<1024))
                        memhrg[Address]=Data;
                return;
        }
It looks like EO handles this already. ROM protection must be enabled. Disable RAM at 8K. Have you enabled memotech hires in the options?

So what is this program supposed to do? My school-boy french hints that it might be a fun translation of the ZX81 commands into French. The thing is, the RAM will only be overlaid on the ROM when the i register is odd.

Code: Select all

        // Memotech Hi-res board has 1k of RAM available at address 8192
        // permanently and overlaid the ROM at address 0 when z80.i is odd
        if ((Address<1024 && (zx81.truehires==HIRESMEMOTECH)) && (z80.i&1))
        {
                data=memhrg[Address];
        }
Changing the i register will affect character rendering so how is this supposed to work?

Re: Memotech HRG: ROM mirroring!

Posted: Thu Feb 22, 2018 3:09 pm
by sirmorris
Hmm the second.

Wilf has analysed the board and produced some hints. I think there is a button which needs to be pressed to toggle the RAM/ROM overlaying. I also think that some initialisation of the HRG is necessary before things work as expected.

Re: Memotech HRG: ROM mirroring!

Posted: Thu Feb 22, 2018 4:33 pm
by Moggy
sirmorris wrote: Thu Feb 22, 2018 3:09 pm Hmm the second.

Wilf has analysed the board and produced some hints. I think there is a button which needs to be pressed to toggle the RAM/ROM overlaying. I also think that some initialisation of the HRG is necessary before things work as expected.
Correct on both points.

The manual can be found here...

http://www.zx81.de/memotech/_frame_e.htm

Re: Memotech HRG: ROM mirroring!

Posted: Thu Feb 22, 2018 4:38 pm
by gammaray
translation memotech.png
Very ZEN...or very THEN which will get you THEN!

Immerse yourself into "being the program" ;)

Re: Memotech HRG: ROM mirroring!

Posted: Thu Feb 22, 2018 7:52 pm
by 1024MAK
I think Google lost the plot in the last sentence :lol:

Mark

Re: Memotech HRG: ROM mirroring!

Posted: Fri Feb 23, 2018 1:06 am
by XavSnap
:lol:

@siggi, Yes, but the rom seem to be "protected" or reloaded anyway.
// Memotech Hi-res board has 1k of RAM available at address 8192
// permanently and overlaid the ROM at address 0 when z80.i is odd
All POKE in the 0-400 memory room are stored At 2000...

POKE 276,CODE"a" equal POKE 276+8193,CODE"a"
A PEEK (276+8193) must be CODE"a"
and
PRINT PEEK (276) =CODE "a"
But I don't (can't) understand where the Z80 peek them datas!
In the rom, or in the mirror!
The LDIR function can't Peek in the rom to copy it.... and Peek in the buffer after it's copy!
If the copy is an inboard process like the Larken buffering, the Basic monitor can't read the buffer from the ZX cpu call!
:?
This program can't run as is...
:mrgreen:

Re: Memotech HRG: ROM mirroring!

Posted: Fri Feb 23, 2018 2:29 am
by XavSnap
On the XuR,
I buffered the first segment (0-&400), but the binary reader don't display it! :?

This segment is a RAM, but filled at the reset... not, by the "LDIR" from the Memotech ROM. (peek<&400=ROM source if h2000>PC>h2800..)

All Pokes are sent to the buffer... how replace the main rom.
The HRG Rom is located at &2000, and can't be the buffer Ram // or // the poked byte is redirect in a ram at the same location...
HRG0.JPG
HRG1.JPG
HRG2.JPG
But, this mirroring was build to run this demo on this emulator, and, I don't know if it work on a true HRG board!
:oops:

Another mystery in this program:
The rom is patched on a blank ram!!!
And updated on itself after changes!
POKEs... and the LDIR function...
The best way to mirror the rom is to LDIR (copy) the Rom in the Ram THEN it able to patch it in the RAM!

Note: Not easy to type-in a program in French!!!
:lol:

Re: Memotech HRG: ROM mirroring!

Posted: Fri Feb 23, 2018 3:21 pm
by sirmorris
The Memotech hardware presumably does something like this:

when you write to addresses 0000-0fff enable RAM, disable ROM
when you read from addresses 0000-0fff and I register is even, disable RAM, enable the ROM
when you read from addresses 0000-0fff and I register is odd, enable RAM, disable ROM

Under normal circumstances you cannot replace the ROM at 0000-0fff with the shadow RAM because the I register needs to be set to $1E in order for the character generator to work. If you change I register then the characters on screen will be messed up, psuedo hires.

When the button is pressed the normal display is switched for the hires display routine and the I register can be changed. THis will allow the RAM to shadow the ROM.

The switch needs to be emulated in order for the display swapping, and therefore the ROM overlay, to work.

I think.