Appendix J
Source compatibility with M80
This appendix is for readers who have sources written for M80 and want to assemble them with TATARA. It compares TATARA with MSX-M80, the M80 in ASCII’s MSX-DOS2 TOOLS, whose listings call it MSX.M-80 2.00.
Most Z80 sources written for M80 assemble with TATARA unchanged. A few directives and forms need changing, and are listed below with what to write instead. Object files are not interchangeable: TATARA writes object files of its own (appendix F), not M80’s .REL files.
J.1 What carries over
These work in TATARA as they do in M80:
- The statement format: a label, the operation, the operands and a comment, with the label in column 1 or followed by a colon, and name:: for a label that is also PUBLIC (chapter 6).
- Numbers with the suffixes B, D, O, Q and H, character constants of up to two characters (” is 0), strings in either kind of quotation mark, and $ for the location counter. A number larger than 16 bits keeps its low 16 bits, as in M80.
- The operators and their levels (appendix C).
- ASEG, CSEG, DSEG and ORG (chapter 10).
- DB, DW, DS and DC, and EQU and DEFL.
- PUBLIC, EXTRN and END.
- The conditionals, from IF to IFDIF, with ELSE and ENDIF (chapter 15).
- MACRO, REPT, IRP, IRPC, LOCAL, EXITM and ENDM, and the special forms of macros: &, ;;, !, angle brackets, and % for an argument passed by value (chapters 16 and 17).
- TITLE, SUBTTL, PAGE and the listing controls, from .LIST to .TFCOND (chapter 18).
M80’s other names for directives are accepted too: COND and IFT for IF, IFF for IFE, DEFB and DEFM for DB, DEFS for DS, DEFW for DW, ENTRY for PUBLIC, EXT for EXTRN, and *EJECT and $EJECT, in column 1, for PAGE (section A.4).
J.2 M80 directives that TATARA does not accept
The directives in table J.1 stop TATARA with not a directive, a macro or an instruction., or, for the two control lines, with only *EJECT and its dollar spelling are control lines.
|
Table J.1: M80 directives that TATARA does not accept, and what to write instead.
|
|
|
M80 |
In TATARA |
|
|
|
|
SET |
DEFL, which does the same (section 12.4). |
|
GLOBAL |
|
|
EXTERNAL |
|
|
ENDC |
|
|
MACLIB, $INCLUDE, *INCLUDE |
|
|
*TITLE, $TITLE |
|
|
.Z80 |
Delete it. TATARA always assembles Z80 instructions. |
|
.8080 |
TATARA has no 8080 mode. The source has to be rewritten with Z80 mnemonics. |
|
.RADIX |
Write each number with its suffix: 0FFh, not 0FF after .radix 16. |
|
COMMON |
Define the variables in one module and share them with PUBLIC and EXTRN (section 12.5); for blocks that take turns in the same memory, use a transient segment (chapter 29). |
|
NAME |
Delete it. The name of a module is the name of its source file (section F.1). |
|
.COMMENT |
Start each line of the comment with ;, or put the block between if 0 and ENDIF. |
|
.PRINTX |
No equivalent. Delete it. |
|
.REQUEST |
Name the file on TANREN’s command line or in a link file (chapter 21). |
|
.PHASE, .DEPHASE |
No equivalent. |
|
.CREF, .XCREF |
Delete them. TATARA makes no cross-reference file. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
J.3 Other forms
Table J.2 compares the other parts of a source that differ, or that a reader who knows M80 may wonder about.
|
Table J.2: Other forms in M80 sources, and how TATARA reads them.
|
|
|
M80 form |
In TATARA |
|
|
|
|
foo:: |
|
|
far## |
Not accepted: undefined symbol in an expression. Declare the name with EXTRN and write it without ##. |
|
X’41’ |
Not accepted: undefined symbol in an expression. Write 41h. |
|
NUL |
Not accepted. Test an argument with IFB or IFNB (section 16.6). |
|
TYPE |
Not accepted, and has no equivalent. IFDEF tells whether a name is defined. |
|
%lb in a macro argument |
The same: the value of lb is passed, in decimal. |
|
a!;b and <a;b> |
The same: both pass a;b, with the semicolon. |
|
;; in a macro |
The same: the comment is not kept in the expansion. |
|
An expression alone on a line |
Not accepted. M80 takes 41h on its own as db 41h; in TATARA, write the DB. |
|
8080 mnemonics |
Not accepted: mvi a,1 is ld a,1. |
|
A word in column 1 that starts with * or $ |
A control line, as in M80. Only *EJECT and $EJECT are accepted; any other stops TATARA, so $loop: cannot be a label. |
|
A label with other characters |
Refused: a name may hold only letters, digits, ? @ . _ and the dollar sign. |
|
The length of a name |
M80 uses only the first six characters of a name; TATARA uses all of them, up to 255 (section 7.2). Two names that M80 took as one, such as buffer1 and buffer2, are two names in TATARA. |
|
Upper and lower case |
The same by default: they do not matter in a name. /C makes them matter (section 7.3). |
|
The length of a line |
M80 reads 132 characters; TATARA reads 255. |
|
A label named IXH, IXL, IYH or IYL |
Legal in M80, refused in TATARA, where the four are registers: IXH, IXL, IYH and IYL are registers, not names. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
J.4 What TATARA adds
TATARA does more than MSX-M80 in these ways:
- The undocumented instructions: SLL, the index halves IXH to IYL, IN F,(C) and OUT (C),0 (section 9.5). MSX-M80 has none of them.
- Long symbol names, all of whose characters count (section 7.2 and chapter 31).
- Named segments and GROUP, and transient segments for variables that share memory (section 10.5 and chapter 29).
- A wider search for include files: the directory of the including file, the current directory, then each directory of TATARA (chapter 13 and appendix I). MSX-M80 looks in one place only: the directory named by the environment variable INCLUDE if it is set, which MSX-C also uses, and the current directory if it is not.
- MSX-DOS2 directories in every filename (chapter 34).
- Large programs: the tables are kept in the memory mapper, not in the 64 KB the Z80 sees (appendix G).
- A symbol table with the segment and kind of each name, printed with /S (chapter 19).
- Messages that say what is wrong, with the file and line, and the chain of include files and macros that led to it (chapter 20).
J.5 Other differences
- The command line.
-
MSX-M80 takes a command such as m80 =hello/l, with the output files before the =. TATARA takes the source first: tatara /l hello.as (chapter 5).
- The object file.
-
TATARA writes a .TRO file, which TANREN links (appendix F). It cannot write a .REL file, and TANREN cannot read one, so every module of a program is assembled with TATARA.
- The listing.
-
The layout is close to M80’s, with the differences noted in chapter 18.
- Messages.
-
M80 marks a line with a letter, such as U or V, and goes on to the end of the source. TATARA prints a sentence and stops at the first error (section 20.2, appendix D).
J.6 Converting a source
To assemble a source written for MSX-M80 with TATARA:
- Delete .Z80, NAME, .PRINTX, .CREF and .XCREF.
- Change SET to DEFL, GLOBAL to PUBLIC, EXTERNAL to EXTRN, ENDC to ENDIF, MACLIB, $INCLUDE and *INCLUDE to INCLUDE, and $TITLE or *TITLE to SUBTTL.
- Replace name## with EXTRN declarations, X’nn’ with nnH, and numbers written after .RADIX with numbers that carry their suffix.
- Rewrite .COMMENT blocks, COMMON blocks and any expression alone on a line, as in tables J.1 and J.2.
- Set TATARA to the directories of the include files, if they are not beside the source or in the current directory. TATARA does not read INCLUDE.
- Rename any label called IXH, IXL, IYH or IYL.
- Look for names that differ only after their sixth character: M80 took them as one name, TATARA does not.
- Assemble. TATARA stops at the first line it cannot take, and the message names the file and line, so the rest can be found one at a time.
- Assemble every module of the program with TATARA, and link them with TANREN.