Programming cross z80 calculators
Contents
Introduction
It is a nice feature to do in your games and other programs to be able to use them across all the z80 calculators. Or this topic will help you in porting some programs to your calculator.
The difficulty to port depends on every case. In some games, it is enough changes in some graphics routines, safe ram locations and to bcalls to make it work. Some cases might be a nightmare (in practical too difficult) or simply impossible.
Calculators Series Current Interest
Note that the TI-83+ series (TI-83+, TI-83+SE, TI-84+, TI-84+SE) are the most common worldwide. Most development is done to this series. Historically, most times ports were done to this series.
There are in less number TI-82 and TI-83 (Regular) users. They will rejoice with a build for them.
TI-85 and TI-86 are no longer produced, there is few visible development and interest on them and are deprecated. TI-85 programs are compatible with TI-86. (really at 100%?)
By any means feel unmotivated or constricted by the current interest, there are still old calculator enthusiasts who enjoy new stuff for their legacy calculator. And assembling for more models can be an important feature.
General Advices
- avoid b_calls (when possible, of course)
- use a assembler that supports #if #else #endif directives (give a example on how to use)
- use a linker capable to output all z80 calculators format (notably SPASM)
- See in Z80 Routines a set of graphic routines to all calculators (not right now...)
- If you need memory in assembly programs in RAM, place variables in the program
Help Documentation
Safe Rams
Safe ram is simply some portions of fixed ram (re)usable to programmers without any conflict to the TI-OS. But their location and existence depend from calculator to calculator model. Because of this may be preferable to keep variables inside your program. The obvious disadvantage is your program will take more space.
This table illustrates what safe ram locations are available in the various calculator models.
Safe Ram Name | Size | TI-82 | TI-83 | TI-83+/84+/SE | TI-85 | TI-86 | Use it? |
---|---|---|---|---|---|---|---|
APD_BUF (savesscreen) | 768 | Available (with CrASH, after disabling interrupts) $8228 | Available $8265 | Available $86EC | ??? | ??? | ??? |
TEXT_MEM (textshadow) | |||||||
OPs | |||||||
cmdShadow / TEXT_MEM2 | |||||||
StatRam | |||||||
imathptrs | |||||||
appBackupScreen | |||||||
tempSwapArea |
The conclusion is using APD_BUF (savesscreen) because it has a good size, is present in all calculators and doesn't need to be restored after use.
bcalls, icalls (system calls)
There are two adviced ways here to solve the bcalls across calculators: - do not use bcalls (or just a few) - use complete include files, bcall macro for each calculator model and #ifdef directives when bcall names is different.
The system calls definition changes in the different calculator models:
- TI-82 - icall(xxxx) = call xxxx
- TI-83 - call xxxx
- TI-83+ - bcall(xxxx) = rst 28h \ .dw xxxx
- TI-85/86
Shells
While TI-83+ series run assembly programs without shells (called no-stub) all others require some shell or exploit to run assembly code. So knowing the shells is important for testing on emulator and release to public.
TI-82 TI-83 and TI-83+ most common shell is Ion and other compatible to it. TI-85 TI-86
Specific calculator info
Here you have important aspects of calculators, mostly hardware related.
TI-73
- just APPS programming (?)
TI-81
- there is no link cable, programs must be typed on the calculator
- note again that few people own one and very few use it
TI-82
- No Hooks
TI-85
- memory mapped LCD (great but others don't)
TI-86
- memory mapped LCD (great but others don't)
TI-83
- Link port is different from TI-83+
- there is no bcall, instead it is just a call
TI-83+
- most usual z80 platform, compatible with TI-83+SE and TI-84+ calculators
- APPS programming
TI-83+SE
- CPU is around 3x faster (16 MHz) (good but not always)
- time crystals
- APPS programming
TI-84+/84+SE
- CPU is around 3x faster (16 MHz) (good but not always)
- time crystals
- Some bad LCD can screw your beautiful graphics, use a safe fastcopy routine
- APPS programming
Program in RAM template
#ifdef TI73 #include ti73.inc ;TI73 asm execution normally is on a APPS #endif #ifdef TI82 ;#include ti82.inc ;depends on shell (?) #endif #ifdef TI83 #include ti83.inc .org userMem #endif #ifdef TI83P #include ti83plus.inc .org userMem-2 .db t2ByteTok,tAsmCmp ; .db $BB,$6D tokens for ASM program #endif #ifdef TI85 ;#include ti85.inc .org asm_exec_ram-2 .db $8E,$28 nop jp lblStart .dw 0 .dw tTitle ;no idea of what this is #endif #ifdef TI86 ;#include ti86.inc .org asm_exec_ram-2 .db $8E,$28 ;no idea of what this is nop jp lblStart .dw 0 .dw tTitle #endif Start: #ifdef TI83P b_call(_RunIndicOff) b_call(_GrBufClr) #endif ret End:
APPS template
;Free APPS header
Related Topics and sources of info
- THE TI-82/83(+) UNIFICATION FAQ by Guillaume Hoffmann