Tatara

Project sheet


Year

2026

Status

RELEASED

Type

Development tool

Platforms

Any MSX computer running MSX-DOS2 or Nextor

License

Apache License, Version 2.0

Project URL

Summary

Tatara is a macro assembler and linker that I wrote for MSX computers. It runs on the MSX itself, under MSX-DOS2 or Nextor, and it reads the same source syntax as Microsoft's M80. Unlike M80, it supports MSX-DOS2 directories, environment variables, and is able to use the full memory mapper. Both tools are written in Z80 assembly, and they are built with themselves, on the MSX. I'm making it freely available under the Apache 2.0 license, together with a full user manual in English and Japanese.

Description

The package has two programs: TATARA, the assembler, and TANREN, the linker. TATARA reads assembly source files and turns them into relocatable object files. TANREN takes one or more of those object files and links them into a finished program.

Most people who write MSX software today use cross-assemblers running on a PC. Tatara is different: it runs on the MSX, in the same environment as the programs it builds. It works on any MSX2, MSX2+ or MSX turbo R running MSX-DOS2 or Nextor, and also in emulators such as openMSX.

Why I wrote it

For years my assembler of choice on the MSX was the AS.COM/LD.COM pair by SOLiD (Egor Voznesensky). These tools work fine for smaller programs, but they run into issues when building bigger projects. Sadly, Egor passed away in 2014, his website disappeared some time later, and the tools are no longer maintained. Microsoft's M80/L80, the other common option, were written for CP/M and know nothing about MSX-DOS2 directories, environment variables or memory mappers.

I also wanted to learn how assemblers and linkers work internally, so I read David Salomon's excellent book Assemblers and Loaders, which gave me a high-level understanding of implementation strategies and the moving parts involved. It seemed doable.

There are already a number of excellent assemblers out there that generate Z80 code, such as Konamiman's Nestor80 or the sdas and sdld assembler and linker included with the SDCC compiler. However, these run on modern platforms (Windows, Linux, macOS), so they require doing the development on a different machine and then moving the binaries over to the MSX.

That doesn't work for me because I like doing my MSX development on the MSX itself.

The names

The names come from the traditional way of making a Japanese sword. A tatara (たたら) is a clay furnace where iron sand and charcoal are burnt, over about three days, until they turn into raw steel. Tanren (鍛錬) is the forging that follows: the smith heats the raw steel, hammers it and folds it until it becomes a finished blade.

The two tools do the same two jobs for a program. TATARA turns source files into object files (real machine code, but not yet a program that can run), and TANREN forges them into the finished program.

Features

  • Runs on the MSX. No cross-assembler and no other computer are needed. A floppy disk is enough for small programs; an SD or CompactFlash card makes larger projects easier.
  • Uses the memory mapper. The symbol table, the macro text and the linker's output image are stored in mapper RAM (using my MapperHeap library). The size of a program is limited by the amount of memory in the computer, not by the free TPA.
  • M80-compatible. Sources written for M80 assemble with few or no changes. The manual includes a checklist for converting them.
  • Long symbol names. Up to 255 characters, all of them significant. Symbols are case-insensitive by default, and an option makes them case-sensitive.
  • Macros and conditional assembly, including repeat blocks (REPT, IRP and IRPC) and local labels.
  • Named segments. Code and data can go in any number of named segments. Transient data segments (the GROUP directive) let variables that are never needed at the same time share the same memory.
  • Directory and environment variable support. INCLUDE files and object files are searched for in the directory of the source file, the current directory, and the directories given in the TATARA and TANREN environment variables.
  • Ready-made include files for your projects with over 900 entries such as MSX-DOS2 function calls and error codes, BIOS and SUB-ROM entry points, the system work area, hooks and I/O ports.
  • Error messages cite the original line. Messages name the file and line that the programmer wrote, even when the error happens inside a macro expansion or an included file.
  • Several output formats. TANREN can write .COM programs, BLOAD binaries for MSX-BASIC, ROM cartridge images and raw binaries for any address.
  • Linker command files. If the list of modules to link is too long to fit in the MSX-DOS2 command line, these can be read from a file instead, so it's possible to link programs that use too many modules to fit on the command line.
  • R800 and undocumented Z80 instructions. Tatara assembles the R800's MULUB and MULUW, and undocumented Z80 instructions such as SLL and the ones using IXH, IXL, IYH and IYL.
  • Extensive manual, both in English and Japanese. The PDF versions are about 390 pages. Other assemblers for the MSX come with rudimentary documentation, making them very difficult to understand and use for new developers. They're also available online in HTML format.

Self-hosting

I bootstrapped Tatara with SOLID's AS/LD. Now it assembles and links itself: every TATARA.COM and TANREN.COM is built from its own sources, on the MSX, by the previous version of itself.

Documentation

Tatara comes with a full user manual, Tatara and Tanren User Manual, in English and Japanese, both online and as PDF. It is written for MSX users who are learning Z80 assembly, and it includes step-by-step guides that go from a first program to a 16 KB ROM cartridge. The example programs in the manual are included in the download.

- Tatara website

- Online manual

License

The software is released under the Apache License, Version 2.0. The manual is under CC BY 4.0, and its example programs are under Apache 2.0.