The TI-82/83 Porter's Guide
By Anonymous
This article explains how to port assembly programs between TI-82 and TI-83 Calculators

Table of Contents

  • Introduction
  • Basic Changes
  • Other Changes
  • Author's Notes

  • Introduction

    Well, so you have a game on the 82 that you want on the 83 or vice versa, eh? Well, porting between these two calculators is usually not that hard, thank God :P Ok, I will say certain things are tough, but since they are not in the every day game, you shouldn't have a problem with them. What makes porting between these two calculators so easy is the similar screen size. If it wasn't for this, porting would be a lot harder than it is now. So, this toutorial will help you by telling you the basics of porting a game between these two calculators. This document assumes that you have basic assembly knowledge of one or both of these calculators.

    Basic Changes

    This will go through some of the basic changes you have to go through in order to port the game from one calculator to another. First of all, the include files. Depending on the game you are porting, you will have to change these. Here is a table telling you what to change.

    #include ""
    #include "keys.h"
    .org START_ADDR
    .DB "My Game version 1.0",0
    #define equ .equ
    #define EQU .equ
    #define end .end
    #include ""
    .org 9327h
    #include ""
    .DB "My Game Version 1.0",0
    " "

    Ok, let me do some explaining here. Of course a / indicates a new line, I just used it to make it easier to do the HTML code here :P. The first Ti-82 set of commands [for those of you with 83's] is for calculators using Ash 3.0. As for the second Ti-82 include, that is for people using Crash. These are different shells, so they use different include files. Notice that the Crash one does not have a .org statement, because in Crash, the .org statement is stored in the include file, along with the .end statement. As for the .DB stuff, that specifies the program name. In order to get that to come along on the Ti-83, you need to put a shell description, to use one of the 83 shells. For this example, I'll use the AShell ones, because SOS detects them. They go like this: nop / jr prog_start / .dw $0000 / .dw Description. Description is a zero terminated string, so you'd do Description: .db "My Cool Game",0. Notice that this must be after the include files but before the actual code. prog_start is the label of starting in your program. This can be renamed if you wish.

    Now there are some minor differences between the calls. For example, on the Ti-83, you simply do call _clrLCDFull. Whereas on the 82, you have to do a ROM_CALL(CLEARLCD). There aren't too many instructions like this. Here are the main ones and their equivilents, as well as some other commands and their equivelents.

    ROM_CALL(DISP_GRAPH) [Ash 3.0+ or CrAsh]
    call CRGRBcopy [Crash or Ash 3.1+]

    Those basic commands are the type of things that you do a search and replace with on your text editor. Now with these commands, you'll probably have enough to compile it.. but make sure you look at the next section for use of keys, memory addresses, etc.

    Other Important Changes

    Now then, there are a few other important things you need before this program will work correctly. First and foremost, the memory addresses. This is a table for their use...

    TEXT_MEMTEXTSHADOW [Must use res 1,(iy+13) at start]
    TEXT_MEM2CMDSHADOW [Crashes SOS/AShell] or STATVARS [Must use res 6,(iy+9) at start]
    GRAPH_MEM / $88b8$8e29 / PLOTSSCREEN

    Now then, those are the most important and common memory addresses you will see in Assembly programs. Now, there are some things that save memory on the 83 versus the 82. For example, call _grbufclr clears the 83 graph buffer. On the 82, on the other hand, you have to do something like: ld hl,$88B8 / ld de,$88B9 / ld bc,$2FF / ld (hl),0 / ldir.

    Of course, you could use that on the 83 if you replaced 88b8 with 8e29 and 88b9 with 8e30. But that way saves some memory. As for keypresses, for they come in many different ways. All programs on the Ti-82 use GET_KEY or direct input. As for the 83, some people use Direct Input, others use GET_KEY, and those who don't know GET_KEY end up using _getkey or _getk. Here is how they work:

    GET_KEYGets a key without waiting for a user to press itTI-82, or $4014 on the TI-83. Key input can be found in in the ASH file.
    _getkeyWaits for a key press... does nothing until you press something. Usually used for pause.TI-83. Use GET_KEY for a loop, like call GET_KEY / or a / jr z,Pause / ret nz
    _getkySort of like GET_KEY, but gets the key# in the form of the TI-BASIC through the OPs.TI-83. Use GET_KEY instead, faster and less memory.
    Direct Input[ld a,0ffh or ld a,%11111111 or similar, using in and out]This is the fastest method, used for multiple keypresses. Similar to GET_KEY Works the same on both calcs. The only thing I noticed is that on the 82, they sometimes use P_KEYBOARD, and P_KEYBOARD = 1.

    Ok, so this gives you the basic key presses and memory location. Now for a few routines on either calculator. This table will help out somewhat...

    Display HL in small fontpush de / push hl / ld de,string+5 / xor a / ld (de),a / Repeat: / call UNPACK_HL / add a,'0' / dec de / ld (de),a / ld a,h / or l / jr nz,Repeat / ex de,hl / ROM_CALL(D_ZM_STR) / pop hl / pop de call _setxxxxop2 / call _op2toop1 / call _dispop1a
    Gets Status of a Pixel or changes or puts oneROM_CALL(FIND_PIXEL)call _ipoint
    Compares HL and DEcall CP_HL_DEpush hl / or a / sbc hl,de / pop hl / ret

    Well, that pretty much sums up most of the important commands. With that, your programs should compile and run in a flash!

    Autor's Notes

    If your doing some heavy duty porting of many games, I suggest making an include file. This should include all of the equivelent memory locations and include files to make things easier. Link routines and VAT operations are tough. I suggest looking at ZTetris's linkrout.h for information on the link, and any of Joe's games with VAT for 83 VAT info, or the Penguins Level Editor source for 82 info.