Software

Here we describe the software in REMEMOTECH :-

REBOOT

REBOOT is the REMEMOTECH boot code.

It is stored in on-chip memory in the FPGA. It is the very first thing the T80 processor executes after a system reset.

The Memotech ROMs and the initial RAM Disc image are too large to store in on-chip memory, and so they are stored in Flash memory.

REBOOTs purpose in life is to allow you to :-

REMEMOTECH is rebooted by powering it on, or by pressing KEY3, or by pressing both Windows keys either side of the space bar at the same time.

If when reset happens, KEY2 is also pressed, SD Card is copied to Flash. While this is happening, the seven-segment displays will display 20xx, where xx is the 16KB page being flashed. If the SD Card cannot be accessed, the displays will show EE01. If the SD Card cannot be initialised, the displays will show EE02. If the SD Card cannot be read, the displays will show EE03.

If when reset happens, KEY1 is also pressed, ROM images are copied from Flash to SRAM. While this is happening, the seven-segment displays will display 10xx, where xx is the 16KB page being copied.

If when reset happens, KEY0 is also pressed, the initial RAM Disc image is copied from Flash to SRAM. While this is happening, the seven-segment displays will display 00xx, there xx is the 16KB page being copied.

After this, REBOOT will then check that REMON is present, and jump to it. If REMON is not present, the displays will show EEFF.

REMON

REMON is the REMEMOTECH monitor. Think of it like a BIOS.

It is one of the ROM images initially introduced via the SD Card, which gets stored on Flash. It is not visible to the T80 processor via the usual MTX memory map. Instead it is visible via the RELCPMH=1, RAM Page 15 special backdoor onto any page of SRAM. In this case, REMON sits in the top 8KB of SRAM page 8. Therefore, from the processor point of view, it starts from 0x6000 in memory.

Ordinarily, REMON does nothing special. However, if on booting, a special key is pressed, it gets control. A special key is one of the number pad keys which do not correspond to an MTX keyboard key, such as NumEnter. Today REMON is exited by pressing a special key again.

Ultimately REMON will provide a command line shell with diagnostic commands to do things like read and write memory, input and output to ports, and read and write the SD Card.

When REMON is done, it selects RELCPMH=0, ROM Page 0, RAM Page 0, and jumps to 0x0000, thus initiating the normal Memotech boot sequence.

OS ROM

The OS ROM sits in the fixed ROM page.

It is the patched version which does not do a memory check by writing a pattern on RAM pages, and reading it back. As a result, it will not corrupt the RAM Disc. This is the version used in SDX systems which support CP/M.

This ROM is also patched so that the INOUT cassette routine at 0x0aae copies from "virtual cassette tape", which is in fact a hidden area of SRAM, or areas of Flash memory.

BASIC ROM

The BASIC ROM sits in ROM page 0.

ASSEM ROM

The ASSEM ROM sits in ROM page 1.

CP/M boot ROM

The CP/M boot ROM sits in ROM page 4.

It is different to the version found in an FDX or found in an SDX with CP/M support, and has been specially developed for REMEMOTECH. It is constructed from the same code base, but with customisations. A similar version is used on REMEMOrizer.

It is broken into a number of modules.

The AZMON module is the initial monitor. It is modified to boot F:52, B:18, B:19, ..., B:1F. It always loads the RAM Disc support, whether you boot from it or not. If both Shift keys are pressed during resetting, it doesn't boot CP/M and returns to BASIC instead.

As REMEMOTECH r3 includes serial port support, AZMON now includes the code for the Remote Command mode. You can use the ZMON Remote Command mode tool to transfer data to and from REMEMOTECH r3.

The ASDXKBD module is the keyboard driver. It has been modified to detect the speed that REMEMOTECH is running at, and choose a keyboard debounce value suitable for that speed. Without this, due to the way the keyboard routine is level rather than edge driven, and the way debouncing is done, keyboard bounce is terrible at high speed.

ACRT is the 80 column card driver. This has been modified so that it knows that the REMEMOTECH screen buffer has 4096 character cells (rather than the 2048 in a normal card). It also supports a new 80x48 mode as well as the 80x24 mode. It provides new escape codes ^[Y and ^[Z to switch into 80x24 or 80x48 mode.

ASDCARD is the replacement for the usual floppy disc driver code found in normal Memotech FDX and SDX systems. It supports a single 8MB size of disk, but through the use of 8 drive type codes (18..1F) allows you to access 8 8MB partitions of the SD Card.

The SD Card hardware turns on LEDR0 when the SD Card is accessed and flashes it for a couple of seconds afterwards, and the user should not remove or change the SD Card until it goes off. The driver reads a port which tells it that the card was accessed in the last second, and if so, it can assume that whatever sector it read last is still what it would get if it read that sector again. In this way, sequential reads of N 128 byte sectors only result in N/4 512 byte block reads (instead of N 512 byte block reads). Also, sequential writes of N 128 byte sectors only result in N/4 512 byte block reads and N block writes (instead of N 512 byte block reads and N 512 byte writes). This feature produces a measurable speed increase, perhaps as much as 2x.

The ARAM module provides RAM Disc support. It is a subset of the SIDISC module in the original Memotech computers, which supported Silicon Disc and RAM Disc. 256KB type 50 RAM Discs are supported. 512KB type 51 RAM Discs are not supported - there isn't enough memory. A special 320KB type 52 has been defined so as to make full use of the memory available on REMEMOTECH. Conveniently this exactly matches the type 03 floppy in size and geometry.

ARAM is present in memory, whether you boot from RAM Disc or not. There is no need for a SIDISC.COM program.

SDX BASIC ROM

The SDX BASIC ROM sits in ROM page 5.

The SDX ROM in a real SDX provides USER commands to MTX BASIC, allowing the user to read and write files on a floppy disk. The SDX ROM in REMEMOTECH is different to the version found in a real SDX and has been specially developed. A similar version is used on REMEMOrizer. A real SDX ROM was disassembled and symbols and comments were retrofitted by consulting a PDF of a printout of the SDX ROM source. After establishing the original ROM could be generated from the source, customisations relating to REMEMOTECH were applied.

Instead of floppy disc, it supports SD Card partition 0. Unlike the original SDX ROM, this version also supports 320KB RAM Disc. In other words, the drive configuration supported is B:18,F:52.

To support these disk types, it was necessary to steal areas of high memory that would otherwise be used by the NODE RING ROM. This support is therefore incompatible with the NODE RING ROM, which is not a real issue, as REMEMOTECH doesn't have any ring hardware.

Remember, to use the SDX support, you must first use ROM 5. The first drive (SD Card partition 0) must contain a 59K CP/M system. If this is not the case, you'll get a DISC ERROR.

If you try to use USER FORMAT, you will get a Mistake error. Track and sector based formatting doesn't make sense for SD Card or RAM Disc media. Instead use the REFORMAT.COM CP/M executable.

CP/M utilities

RECONFIG.COM

RECONFIG.COM is a version of CONFIG.COM, but enhanced for REMEMOTECH and REMEMOrizer.

It gives give better error messages.

It has been enhanced to support extra drive types. It supports type 18..1F drives, which are 8MB SD Card partitions. Do not configure two drives with the same 1x type code, as this can cause data corruption. It also supports type 52 drives, which are 320KB RAM Discs.

Every time you configure or change a drive type, high memory is allocated for the allocation and check vectors. High memory is in short supply, and after configuring and reconfiguring lots of drives, you can run out. This issue can eased by using a 54K system disk, rather than 59K. This is made worse in REMEMOTECH and REMEMOrizer, as in order to access more of the SD Card, you may find yourself configuring and reconfiguring a drive to access different partitions on it. The included RECONFIG.COM is enhanced to spot reconfiguring a drive to a new type code with the same DPB (which implies the same geometry), and if so, it reuses the existing allocations and check vectors.

The new RECONFIG.COM is a superset of the original shipped by Memotech, and can actually be used on earlier Memotech systems.

REFORMAT.COM

Back in the day, there were 3 different formatting programs :-

REMEMOTECH includes REFORMAT.COM which doesn't issue hardware level formatting commands, and instead it overwrites the reserved tracks and directory area with sectors containing 0xe5 bytes. This can therefore be used to "format" the RAM Disc and SD Card found on REMEMOTECH. None of the original formatting programs are therefore needed, none of them work, and so none of them are included.

REFORMAT.COM can be used on an original Memotech system to wipe a disk, providing the disk is already formatted to the right type code.

RETAPE.COM

RETAPE.COM is a program for managing the virtual cassette tapes feature in REMEMOTECH. It is much like the REZTAPE.COM program used to do the same thing on REMEMOrizer.

There is one 48KB SRAM slot (slot number 0) and 56 64KB Flash slots (slot numbers 1 to 56).

The following commands can be used :-

RETAPE
List bytes 1-15 of each virtual cassette tape in each slot. ie: the name to LOAD from MTX BASIC.
RETAPE slot
Delete the contents of the indicated slot.
RETAPE INPUT.MTX slot
Read file INPUT.MTX and write it into the indicated slot. Note: The file cannot be larger than the size of the slot.
RETAPE slot OUTPUT.MTX
Read the indicated slot and write to a file called OUTPUT.MTX. Note: The resulting file will be the size of the slot, regardless of how many bytes have been saved to that virtual cassette tape.
RETAPE ?
Show help text, summarising the above.

The INOUT routine in the MTX BASIC ROM has been patched so that :-

LOAD ""
Loads from slot 0.
LOAD "NAME"
Looks for NAME in slots 0 to 56 and loads it. If no slot has this name, then a "No data" error results (a real Memotech MTX just keeps reading hoping that it will eventually find a saved file with this name, but REMEMOTECH knows it is not present and so gives up).
VERIFY ""
Verifies against the data in slot 0.
VERIFY "NAME"
Looks for NAME in slots 0 to 56 and verifies against it. If no slot has this name, then a "No data" error results.
SAVE "NAME"
Saves to slot 0.

The recommended approach to use is to use RETAPE.COM to write a selection of popular games to slots 1-56. See TAPES.SUB mentioned below. Then, when you wish to load something else, write it to slot 0 before switching to MTX BASIC. If you save anything from MTX BASIC, boot to CP/M afterwards and use RETAPE.COM to read slot 0 and write to a .MTX file.

MTX.COM, MTXL.COM and RUN.COM

It also has the MTX.COM and MTXL.COM programs, which can be used to switch into MTX BASIC. MTXL.COM is preferred, as it does not corrupt RAM Disc in the transition.

RUN.COM is a CP/M program which can be used to run some .RUN files, without having to switch into MTX BASIC, and use the SDX ROM to USER RUN "FILE.RUN" them. This program puts the file content directly into memory, switches into the right memory mode, and jumps to the start of the program. This means that MTX BASIC has never been running, and has not set up any of its system variables. As a result, some .RUN files may not run properly this way.

RENUMT.COM

This is a program designed to test the numeric accelerator built in to REMEMOTECH r2 or later. Its only likely to be interest to the author.

RENUM.COM

This program will enable the numeric accelerator built in to REMEMOTECH r2 or later. and then patch the MTX OS ROM and BASIC ROM 0 to use it. This change lasts until power off.

At this time, RENUM patches the calculator routines in the ROM which do addition, subtraction, multiplication and division.

It is interesting to note that although the hardware detects underflow conditions, the MTX ROM treats these as a zero result.

As a speed trial, various Memotech Mandlebrot set generators were developed and compared.

Summary: if you are serious about doing floating-point on a Memotech MTX, you'll only get a little speed-up using RENUM. You'll need to code in assembler, and ideally bypass the MTX BASIC ROM calculator routines and directly interact with the numeric accelerator to get the best performance.

There is scope to do more. I can probably significantly accelerate functions such as exp, ln, sin, cos and tan, by exploiting the fact the hardware has a built-in hardware stack, and many built-in constants. The tricky bit is patching the ROM and keeping it working.

Initial RAM Disc

The initial RAM Disc image is a 320KB type 52 CP/M 2.2 filesystem, in the file ramdisc.bin.

It has a 59KB CP/M system in the first 2 tracks. It contains PIP.COM, STAT.COM, ZSID.COM and a few other general CP/M files.

It has RECONFIG.COM, REFORMAT.COM and RETAPE.COM. It runs RECONFIG F:52,B:18,C:19 on startup.

The image also includes the normal FDX 80x24 NewWord, and a version patched for the 80x48 screen size.

Sample SD Card

The package includes a couple of sample SD Card images, in the file sddisc.bin and sddisc2.bin. They are 8MB SD Card partitions with CP/M 2.2 filesystems. The first has a 59K CP/M system on it, the second has 54K. If you copy them to the first and second 8MB of a SD Card, you can access them by configuring type 18 and type 19 drives.

These images have the same files found on the Initial RAM Disc and assorted extra files.

The first image has various games in .COM format. There are also a few games in .RUN file format, most of which can be run using the RUN.COM program. There are also some SDX BASIC .BAS files. It also has lots of .MTX files and a submit script called TAPES.SUB, allowing you to load them all up into virtual cassette slots in one command :-

A>SUB TAPES

The second image has Icicle Works, which needs a 54K CP/M system to work. I've never got to the bottom of why this is, and its tricky to debug. Interrupt the CP/M bootstrap by holding down Enter, then type BC19 to boot from the second partition, then run DT.COM followed by TLOAD.COM followed by TV.COM. Or type SUB ICICLE.