Computers Overview
Commodore PET
Sinclair ZX80
Sinclair ZX81
BBC Micro
Sinclair Spectrum
Memotech MTX
    About
    Library
    Manuals
    Options
    Photos
    Projects
    Repairs
    Software
    Tools
      Development
          Dev. Corner
              Assembler
                  MTX Shell
                  RISCOS
              Noddy+
          EXEROM
          FUZIX
          Resources
          SDCC
          Z88DK
      Web Tools
    User Groups
    Video Wall
Memotech CP/M
Atari ST
Commodore Amiga
PDAs
DEC 3000 AXP
OpenVMS
Raspberry Pi

 

 
 
 

The Memotech MTX Series

MTX  / Z80 Assembly Language

Introduction

Paul Daniels is working on an Assembler environment for the MTX under Windows, but it should also work under Linux

If anyone has any ideas or code that would be useful when writing games please let Paul know via the Memorum forum thread.

 

The shell takes over the machine, setting up its own VDP interrupt, scans for the joystick and incorporates PSGLib. Compiling a bit of code should be as easy as editing the main_assem.z80 file and then typing "nmake". The nmake command is usually provided by Microsoft's free C compiler.

Make files are used to simplify the process. There is an env.bat file which sets up the path for wla-dx, memu and mtx2bas. Update as required.  

There is a make file to generate a MAIN.mtx file.

There is a user defined section in the Make file :-
MACHINE=MTX512 Builds a 48Kb image for MTX512
MACHINE-MTX500 Builds a 32Kb image for MTX500 and MTX512
PAYLOAD=1 Compiles the code so that it is loaded at $4100 or $8100
PAYLOAD=2   Compiles the code as part of a ASSEM statement
AUTOSTART=0   Don't auto-start the program
AUTOSTART=1    Auto-start the program

Sprites

 To use sprites, a table at VDP_SPR_TAB is used to hold the Sprite Attributes. This differs from the VDP sprite attribute table in that the horizontal coordinate is 16bit. The other change is vertical sprite coordinates are from 0 to 208 and horizontal coordinates from 0 to 272.

Coordinate 0 is 16 pixels before the actual screen so the sprite will not be seen. Coordinate 16 is the first pixal on the screen. likewise vertical coordinate 208 will put the sprite below the screen and 272 to the left of the screen. This should allow easy placement of sprites for bleed-in from the edges.

Another variable, VDP_SPR_CNT, holds the number of sprites to process. This is reset after every interrupt. The VDP Interrupt handles the conversion to coordinates required by the VDP, e.g. Early Clock.

 

Prerequisites

  • WLA DX - A cross-platform macro-assembler, used to compile

Optional

  • MEMU - For testing

  • MTX2BAS - A program to convert .mtx, .sdx and .run files to text

  • PSGLib - Z80 ASM library (and C conversion/compression tools) to allow replay of VGMs as background music/SFX in SEGA 8 bit homebrew programs

 

 

 

Zip Version Description
v0.6
06/01/18
Put Events into own library.
Triggered event returns event number in A reg
Add zx7 decompression to RAM.
Added macros :
    VDP_SETUPFONT, VDP_SETSPRDATA, VDP_SETSPRATR,
    VDP_SETVDPINT, VDP_SETNAMPOS_W, VDP_SETNAMPOS_R,
    VDP_WRITE_A, VDP_WRITE_N, VDP_READ_A, VDP_FILL_A,
    VDP_WRITE_STR, SCO_INIT, SCO_PRINT, SCO_ADDVAL, SCO_ADDHI Added VDP_WRITE_FF.
Document library functions in header files.
Add defines for VDP graphic type, sprite size and mag.
Add defines for border colour.
Also includes the game Head On, as demonstrated at Memofest 2017.
v0.5
27/10/16
Released at Memofest 2016
WLA-DX Libraries now being used.
Improved WLA-DX memory mapping.
Restructured folders.
Added ZX7 decoder by Einar Saukas & Urusergi.
ZX7 updated by Daniel Bienvenu for VRAM decompression.
Added 61Hz CTC interrupt.
Renamed JOY_READ to JOY_ISR.
Added simple Event semaphore.
Added EVT_UNSET to remove given event.
Updated VDP to allow for other interrupt sources.
Constants for VDP registers now using values from include file.
Replace VDP_CLRNAM with VDP_FILL routine.
Swapped hl & de register usage for VDL_LDIR to match ldir.
Added VDP_SETFONT routine.
v0.4
10/03/16
Change Log (Now included in the archive file)
Changelog added.
Readme added.
Licence added - GPL v3.0.
Pass initial paper/border colour to VDP_INIT.
Change PAYLOAD to use CODE and BASIC.
Change MTX512 and MTX500 to be MACHINE=MTX???.
Change AUTOSTART to be YES or NO.
User code now appears in usercode.z80.
Change VDP_SPR_CNT to be a pointer, not a table.
New lib_stdlib.inc file with standard library functions.
Add random number generator, a CMWC from WOS by Patrik Rak.
Changed to 256 char font from a 768 char font.
Add Event system.
Demo of Events to bounce skull around screen and change colour.
v0.3
04/12/15
Change Log
Single Project which can build either 32kb or 48kb images.
Code payload can be included as part of BASIC or loaded afterwards.
Ability to Auto-start.
Interface to VDP sprites.
Demo of 32 sprites being moved by Joystick or numeric keypad, showing how sprites can hide behind the borders.
  v0.2
14/11/15

Change Log
The memory model is now determined by a variable in the Makefile  
Started to use headers and include files for the libraries (a la "C")

The font used is apparently the Namco arcade one. The Code project uses the music from the first level of Sonic the Hedgehog, the Basic project uses the music from Rainbow Island (I think).
Added  :
1. VDP interrupt based.
2. Joystick sensing.

3. PSGLib providing interrupt VGM music and effects

v0.1 Initial release 02/11/2015

mailto: Webmaster

 Terms & Conditions