adriweb / tipycomp

Compiles Python modules for TI-83PCE EP / TI-84+CE-T PE graphing calculators

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tipycomp

A tool for compiling Python modules for the TI-83 Premium CE EP / TI-84 Plus CE-T Python Edition.

Installation

You will need convbin. If you have the CE toolchain installed, you most likely already have this tool.

You will also need version 1.9.3 specifically of the mpy-cross module. You can install it using pip install -Iv mpy_cross==1.9.3.

To use the disassembly mode of tipydecomp, you will need to build mpy-disasm by running make in its directory.

Usage

tipycomp

python tipycomp.py pyfile menufile outfile varname (mpy-cross args)

where pyfile is the Python file to compile, menufile is a text file containing menu definitions, outfile is the output 8xv, and varname is the name of the appvar. You may also optionally pass additional arguments to mpy-cross by adding them after the other four arguments.

To use the module, send it to the calculator using TI-Connect CE. In the Python editor, add the line from varname import *, where varname is the name of the appvar. You can then see the module's menu by pressing "math" and selecting it from the modules list.

tipydecomp

python tipydecomp.py menu infile.8xv

to dump the menu definitions of infile.8xv.

python tipydecomp.py disasm infile.8xv

to disassemble the MicroPython bytecode of infile.8xv.

Menu file format

The menu definitions file is a plain text file containing the menu structure for the module. It consists of a series of directives, one per line. All official TI modules use Unix-style line endings, although Windows-style line endings also appear to work.

There are four kinds of directive:

  • #MENULABEL (text) - Displays an option containing (text) in the Modules menu, which can be opened by pressing "math." When clicked, it will open a menu that is defined by all directives following this one but before the next #MENULABEL directive.
  • #MENUTITLE (text) - Sets the title of the first page of the menu to (text).
  • #MENUTOP (text) - Adds a new page to the menu with a title of (text). Pages can be switched between using the left and right arrow keys.
  • #MENUITEM (display)|(insert)|(offset) - Adds a menu option to the page defined by the previous #MENUTITLE or #MENUTOP directive. In the menu, the text (display) will be shown. When clicked, it will insert the text (insert). (offset) is the number of characters before the end of the inserted text to place the cursor. |(offset) can be omitted if the cursor is placed at the end of the insertion.

The following special characters may be used in menu text:

<%TAB%>
<%NL%>
<%ELLIPSIS%>
<%LEFT_ARROW_HEAD%>
<%RIGHT_ARROW_HEAD%>
<%UP_ARROW_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UMFLEX%>
<%A_TILDE%>
<%A_DIAERESIS%>
<%A_RING%>
<%AE%>
<%C_CEDILLA%>
<%E_GRAVE%>
<%E_ACUTE%>
<%E_CIRCUMFLEX%>
<%E_DIAERESIS%>
<%I_GRAVE%>
<%I_ACUTE%>
<%I_CIRCUMFLEX%>
<%I_DIAERESIS%>
<%ETH%>
<%N_TILDE%>
<%O_GRAVE%>
<%O_ACUTE%>
<%O_CIRCUMFLEX%>
<%O_TILDE%>
<%O_DIAERESIS%>
<%DIVIDE%>
<%O_STROKE%>
<%U_GRAVE%>
<%U_ACUTE%>
<%U_CIRCUMFLEX%>
<%U_DIAERESIS%>
<%Y_ACUTE%>
<%THORN%>
<%Y_DIAERESIS%>

The following color codes can be used in menu text:

<@BLACK@>
<@BLUE@>
<@GREEN@>
<@CYAN@>
<@RED@>
<@MAGENTA@>
<@YELLOW@>
<@GRAY@>
<@WHITE@>

Example:

#MENULABEL my_module<%ELLIPSIS%>
#MENUTITLE my_module
#MENUITEM myfunc(<@BLUE@>num<@BLACK@>)|myfunc()|1

About

Compiles Python modules for TI-83PCE EP / TI-84+CE-T PE graphing calculators


Languages

Language:C 70.2%Language:Python 17.3%Language:Makefile 12.4%