User Tools

Site Tools


34s:assembler

Online Assembler/Disassembler

This page holds an experimental online assembler/disassembler. This tool allows you to copy and paste WP 34S source code into the text field below, and it will be compiled into an object file which can be loaded into your calculator.

In order to use this tool, enter your email address below, confirm the agreement, and paste in the code you want to compile. The resulting .dat file, along with any output of the compile, will be emailed to the address you provide below.

The disassembler version of this tool will be available shortly.

Please understand that this tool is experimental in nature. We've provided it for convenience of those who do not have easy access to Perl. Use at your own risk!

WP 34s Assembler

If you can't read the letters on the image, download this .wav file to get them read to you.


Documentation


There is also a complete assembler/disassembler user's manual in PDF form available.

Man page
wp34s_asm.pl  - Assembler/Disassembler for the WP34s calculator.

Usage:
   wp34s_asm.pl src_file [src_file2 [src_file3]] -o out_binary  # assembly mode
   wp34s_asm.pl in_binary -dis [-o out_binary] > src_file       # disassembly mode

Parameters:
   src_file         One or more WP34s program source files. Conventionally, "wp34s" is used
                    as the filename extension.
   -o outfile       Output produced by the tool. In assembler mode, this is required and will be
                    the binary flash image. Assembler output extension is conventionally ".dat".
                    In disassembler mode, this is optional and will be the output ASCII source
                    listing, conventionally uses the ".wp34s" extension. I/O redirection can be
                    used as an alternate method of capturing the ASCII source listing in disassembler
                    mode.
   -dis             Disassemble the binary image file.
   -op infile       Optional opcode file to parse.              [Default: --internal table--]
   -fill fill_hex   Optional value to prefill flash image with. [Default: instruction 'ERR 03']
   -s number        Optional number of asterisks (stars) to prepend to labels in
                    disassembly mode.                           [Default: 0]
   -syntax outfile  Turns on syntax guide file dumping. Output will be sent to 'outfile'.
   -ns              Turn off step numbers in disassembler listing.
   -svn             Report compressed opcode table SVN version number to STDOUT.
   -h               This help script.

Examples:
  $ wp34s_asm.pl great_circle.wp34s -o wp34s-3.dat
  - Assembles the named WP34s program source file producing a flash image for the WP34s.
    MUST use -o to name the output file in assembler mode -- cannot use output redirection.

  $ wp34s_asm.pl  great_circle.wp34s floating_point.wp34s -o wp34s-1.dat  -fill FFFF
  - Assembles multiple WP34s program source files into a single contiguous flash image for
    the WP34s. Uses 0xFFFF as the optional fill value. Allows (and encourages) use of libraries
    of programs by concatenating the flash image from several source files.

  $ wp34s_asm.pl -dis wp34s-1.dat -s 3 > myProg.wp34s
  $ wp34s_asm.pl -dis wp34s-1.dat -s 3 -o myProg.wp34s
  - Disassembles a flash image from the WP34s. Prepend 3 asterisks to the front to each label to
    make then easier to find in the listing (they are ignored during assembly). Both invocation
    result in identical behaviour.

  $ wp34s_asm.pl -dis wp34s-0.dat -o test.wp34s; wp34s_asm.pl test.wp34s -o wp34s-0a.dat; diff wp34s-0.dat wp34s-0a.dat
  - An end-to-end test of the tool. Note that the blank fill mode will have to have been the same
    for the binaries to match.

Notes:
  1) Step numbers can be used in the source file but they are ignored. Since they are ignored,
     it doesn't matter if they are not contiguous (ie: 000, 003, 004) or not monotonic (ie: 000,
     004, 003). The disassembler does produce step numbers that are both contiguous and monotonic
     -- when not suppressed by the -ns switch.
  2) You can name a different opcode table using the -op switch. This can be used to translate a source
     written for a different SVN revision of the WP34s to move the program to a modern version of
     the WP34s. Typically, disassemble the old flash using the old opcode table and reassemble using
     the default (internal) table. This is also an insurance policy against the opcodes evolving as well.
     Simply target newer opcode tables as they become available. To generate an opcode table, using the
     following (Linux version shown. Windows is likely similar, though I have never tried):
      $ svn up
      $ cd ./trunk
      $ make
      $ ./Linux/calc opcodes > new_opcodes.map
      $ wp34s_asm.pl -dis wp34s-0.dat -op new_opcodes.map > source.wp34s
  3) The prefill-value will be interpreted as decimal if it contains only decimal digits. If it
     contains any hex digits or it starts with a "0x", it will be interpreted as a hex value. Thus
     "1234" will be decimal 1234 while "0x1234" will be the decimal value 4660. Both "EFA2" and "0xEFA2"
     will be interpreted as a hex value as well (61346). The leading "0x" is optional in this case.
  4) The order the command lines switches is not significant. There is no fixed order.
  5) There is subtle difference in using the disassembler with the "-o" switch and output redirection.
     With the "-o" switch, the resulting file will not contain the commented statistics -- these will
     be displayed on the screen. With redirection, all printed lines go to the file.
34s/assembler.txt · Last modified: 2011/07/15 10:58 by admin