Programming under Unix-like operating systems

From WikiTI
Revision as of 13:14, 12 August 2008 by Gambit (Talk | contribs)

Jump to: navigation, search

Here are the different tools at your disposal:

General Overviews

Emulators

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 must be placed in /usr/share/apps/katepart/syntax .
  • 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


SPASM and Wabbitsign are included in Z80 Assembly IDE 1.32 by burntfuse

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

tpasm 1.4 has a bug where the set pseudo-opcode takes precedence over the Z80 set instruction. A quickfix is to disable the set pseudo-opcode by commenting line 86 of pseudo.c (.set is still available).

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.

Zasm

Author: Steven Deprez

Home page: http://lpg.ticalc.org/prj_zasm/index.html

Zasm is an open source assembler that is almost fully compatible with Tasm and ZDS.

WLA DX

Author: Ville Helin

Home page: http://www.villehelin.com/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.).

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

Pasmo

Author: Julián Albo

Home page: http://www.arrakis.es/~ninsesabe/pasmo/

Pasmo is another standalone Z80 cross-assembler with basic macro support, but without the ability to generate relocatable object files. It is licensed under the GNU GPL, and exists as the package pasmo in the Debian pool.

z80asm

Author: Bas Wijnen

Home page: http://savannah.nongnu.org/projects/z80asm/

z80asm is a standalone Z80 cross-assembler similar in nature to Pasmo, in that it has macro support but cannot generate relocatable object files. It too is licensed under the GNU GPL (version 2 or later), and exists as the package z80asm in the Debian pool.

GNU as

Author: the GNU binutils team

Home page: http://www.gnu.org/software/binutils/

Starting from version 2.17, the GNU assembler, part of the binutils package, is capable of cross-assembling Z80 code when configured for it at compile-time, such as with --target=z80-unknown-coff. binutils includes a powerful assembler and linker both, along with various utilities for handling object files, such as objcopy and objdump; for Z80, COFF is used for relocatable objects, with raw binary and Intel hex formats also supported. While this is probably one of the more powerful tools in the list for Z80 development, it also requires more work to start with, as the traditional way to get a cross-assembling binutils is to compile it oneself. Being a GNU package, binutils is naturally licensed under the GNU GPL (version 2 or later). Prepackaged binary versions of binutils are very common, but usually do not have cross-assembling capability.

Sending programs to the calc

FreeBSD

Much of the aforementioned software should compile independently without problem or with minor tweaking under FreeBSD, but it is best to utilize the ports collection whenever possible. Unfortunately, the current state of calculator-related software in the FreeBSD Ports Collection is lacking in variety.

  • Development
Port Current Version Location
tpasm 1.2_1 devel/tpasm
z80asm 1.6_1 devel/z80asm
z80-asm 0.1_1 devel/z80-asm
TI-GCC 0.96.b8 devel/tigcc
libtifiles2 1.0.1 devel/libtifiles2
  • Communications
Port Current Version Location
TiLP-II 1.01 comms/tilp2
libticables2 1.0.2 comms/libticables2
libticalcs2 1.0.1 comms/libticalcs2
  • Converters
Port Current Version Location
libticonv 1.0.0 converters/libticonv
  • Emulation
Port Current Version Location
TIEmu 2 2.08 emulators/tiemu2

Mac OS X

(Note that all of these assesments were made on a MacBook running 10.4.9 Intel. Mileage may vary on other versions and of course the Darwine stuff won't work on PPC.)

TiLP-II is known to compile and work properly with SilverLink and Direct USB cables with the 83+, 84+SE, and 89Ti, so there is no reason to believe it will not work with the other calculators. TI Connect X works well enough on Intel Macs even though it is not officially supported, however it seems to be more strict with the format of .8xk files than TiLP or TI Connect (Windows).

Brass works in Mono. Wabbitspasm compiles and works properly. ZDS works in Darwine.

TilEm compiles but seems to have some issues with multiple ROM versions. It is unclear to me if this is a problem with the build or TilEm itself. PindurTI is somewhat usable in Darwine: You must use the send.exe utility to send the ROM image, then it will emulate properly. However, it makes extensive use of the F-keys, including the Exposé ones. Remapping the Exposé keys is the only solution. TI FLASH Debugger runs in Darwine but the calculator windows are unskinned: You must either use the keyboard or click blindly in the window. The display output is fine, and other debugger windows appear to function properly. VirtualTI (2.5) should run OK after putting the ROM files somewhere Darwine knows about (I was lazy).

Other Unixes

This section is a stub. Please add it it.