Difference between revisions of "Programming under Unix-like operating systems"

From WikiTI
Jump to: navigation, search
 
(Assembling: more info about a few assemblers)
Line 9: Line 9:
 
* some editors have an "assembler" syntax coloring that fits quite well (like scite).  
 
* some editors have an "assembler" syntax coloring that fits quite well (like scite).  
 
   
 
   
==Assembling==
+
== Assembling ==
* tpasm
+
 
* tasm + Wine
+
=== 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 [http://sdcc.sf.net/ 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 [http://ftp.linux.org.uk/pub/linux/libc/ here].
 +
* You can use TASM 3.2 for Windows with [http://www.winehq.com Wine].
 +
* You can pay the $40 and compile it yourself on the platform of your choice.
  
 
==Sending programs to the calc==
 
==Sending programs to the calc==
 
* TILP
 
* TILP
 
* titranz : commandline tool, only works for TI-83/TI-83+
 
* titranz : commandline tool, only works for TI-83/TI-83+

Revision as of 09:35, 15 July 2006

Here are the different tools at your disposal:

Emulators

  • TilEm [1]
  • VTI (with Wine)

Syntax coloring

  • there is a file that enables syntax highlighting for z80 asm for Kwrite and Kate here. You have to put it in /usr/share/apps/katepart/syntax.
  • some editors have an "assembler" syntax coloring that fits quite well (like scite).

Assembling

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.

Sending programs to the calc

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