Programming under Unix-like operating systems

From WikiTI
Revision as of 22:46, 5 August 2006 by Premchai21 (Talk | contribs)

Jump to: navigation, search

Here are the different tools at your disposal:

Emulators

  • TilEm [1]
  • VTI (with Wine)

Syntax highlighting

Several editors have native or extensional support for editing Z80 assembly code with syntax highlighting:

  • Kwrite and Kate can be made to syntax-highlight Z80 assembly with the appropriate definition file. The file can be placed in /usr/share/apps/katepart/syntax to install it.
  • SciTE and Emacs both have native modes for assembly code. For Emacs, one must make sure to turn on Font Lock mode as well.
  • The Z80 Assembly IDE has simple syntax highlighting built-in.
  • Users of Vim and WLA DX can use this syntax file.

Assembling

SPASM

Author: Spencer Putt

Home Page: http://www.revsoft.org/phpBB2/viewforum.php?f=21

SPASM is a portable Z80 assembler released under the GPL. Its distinguishing features are extremely fast assembly and powerful macro support. The output is only available in binary form, however with the use of Wabbitsign, written by James Montelongo and Spencer Putt, it can easily be converted to any desired program type.

assembler foo.asm foo.bin
wabbit foo.bin foo.8xp

tpasm

Author: Todd Squires

Home page: http://www.sqrt.com/

tpasm is a Free (GPL) assembler which supports the Z80 as well as the 6805, 6809, 68HC11, 6502, Sunplus, 8051, PIC, and AVR. It uses syntax very similar to ZMASM.

tpasm 1.2 does not support binary file output, but you can use objcopy (from the GNU binutils package) to convert its Intel Hex output into binary; e.g.

tpasm foo.asm -o intel foo.hex -l foo.lst
objcopy -I ihex foo.hex -O binary foo.bin

ASxxxx

Author: Alan R. Baldwin

Home page: http://shop-pdp.kent.edu/ashtml/asxxxx.htm

ASxxxx is a freeware assembler which supports the Z80 along with a large variety of other processors. It more closely resembles a modern PC assembler than a typical Z80 assembler, as it assembles each file into a relocatable object format which can then be linked with other files to produce the complete program. The linking is done by a separate program called ASlink (included with the package.)

To assemble and link a simple program you might do something like

asz80 -plogff foo.asm
aslink -u -b _CODE=0x9D95 -i foo.ihx foo.rel
objcopy -I ihex foo.ihx -O binary foo.bin

Note that the syntax is rather different from that of most Z80 assemblers. The important differences are

  • Immediate values are marked with #.
  • Indexed memory access is written as N(ix) rather than (ix+N).
  • Constants are written differently: 0xAA, 0hAA, or $$AA for hexadecimal; 0o252, 0q252, or $&252 for octal; 0b10101010 or $%10101010 for binary.

For example,

ld hl,#str_hello
add a,3(ix)
xor #0x0f

There is also a modified version of ASxxxx distributed with the Small Device C Compiler. This version is, if anything, more confusing to use due to the poorly-documented changes made by the SDCC team.

TASM

Author: Thomas N. Anderson

Home page: http://home.comcast.net/~tasm/

TASM is a shareware assembler which also supports a variety of processors.

There are several ways that you can use tasm under Linux:

  • The TASM 3.1 for Linux shareware release is still in the wild. To use this you will need to enable "a.out" support in your kernel (it may be available as the module binfmt_aout.) You will also need to obtain the ancient Linux libc version 4 (not glibc) which can be found here.
  • You can use TASM 3.2 for Windows with Wine.
  • You can pay the $40 and compile it yourself on the platform of your choice.

Brass

Author: benryves

Home page http://benryves.com/bin/brass/

Brass runs under Linux thanks to Mono.

WLA DX

Author: Ville Helin

Home page http://users.tkk.fi/~vhelin/wla.html

WLA DX is another open-source (GNU GPL) cross-assembler with a primary focus on targeting video game consoles. It is a high-powered assembler with a wide variety of features such as, e.g. separate compilation, POSIX-like file I/O, and code sectioning. However it is cumbersome when assembling small projects, and semantics are unorthodox compared to other assemblers. (~ is the XOR operator, macro arguments are passed by value, etc.) Furthermore, development appears to have ceased since January 2006.

WLA DX has had an influence in the development of Brass.

Sending programs to the calc

  • TILP
  • titranz : commandline tool, only works for TI-83/TI-83+