Difference between revisions of "Programming cross z80 calculators"

From WikiTI
Jump to: navigation, search
(added more info)
(completing the info, a more neutral view)
Line 1: Line 1:
{{stub}}
 
 
== Introduction ==
 
== 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.
 
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.
 
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. (use strange bcalls and specific stuff)
+
Some cases might be a nightmare (in practical too difficult) or simply impossible.
  
== Calculators Current Interest ==
+
== 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. And this calculators specifics are used as reference to what is normal feature.
+
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, TI-83 (Regular) users. They will rejoice without 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.
+
  
By any means feel unmotivated or affected by the current interest, there are still old calculator enthusiasts who enjoy new stuff for their legacy calculator. Also assembling for more models is a nice thing to do.
+
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 ==
 
== General Advices ==
Line 18: Line 20:
 
* use a linker capable to output all z80 calculators format (notably SPASM)
 
* 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...)
 
* 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 ==
 
== Help Documentation ==
Line 23: Line 26:
 
=== Safe Rams ===
 
=== Safe Rams ===
 
Safe ram is simply some portions of fixed ram (re)usable to programmers without any conflict to the TI-OS.
 
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.
+
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.
Here is a table to illustrate what is available or not across the z80 calculators:
+
 
{{stub}}
+
This table illustrates what safe ram locations are available in the various calculator models.
 +
 
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
!  Safe ram location / Calculator Model
+
!  Safe Ram Name
 +
!  Size
 
!  TI-82
 
!  TI-82
 
!  TI-83
 
!  TI-83
 +
!  TI-83+/84+/SE
 
!  TI-85
 
!  TI-85
 
!  TI-86
 
!  TI-86
TI-83+/84+/SE
+
Use it?
 +
|-
 +
|  APD_BUF (savesscreen)
 +
|  768
 +
|  Available (with CrASH, after disabling interrupts) $8228
 +
|  Available $8265
 +
|  Available $86EC
 +
|  ???
 +
|  ???
 +
|  ???
 
|-
 
|-
tempswaparea
+
TEXT_MEM (textshadow)
 
|   
 
|   
 
|   
 
|   
Line 42: Line 57:
 
|
 
|
 
|-
 
|-
plotsscreen
+
OPs
 +
 +
 +
|
 +
|
 +
|
 +
|-
 +
|  cmdShadow / TEXT_MEM2
 +
 +
 +
|
 +
|
 +
|
 +
|-
 +
|  StatRam
 +
 +
 +
|
 +
|
 +
|
 +
|-
 +
|  imathptrs
 +
 +
 +
|
 +
|
 +
|
 +
|-
 +
|  appBackupScreen
 +
 +
 +
|
 +
|
 +
|
 +
|-
 +
|  tempSwapArea
 
|   
 
|   
 
|   
 
|   
Line 50: Line 100:
 
|}
 
|}
  
=== bcalls (system calls) ===
+
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.
There are two advices to solve the bcalls across calculators:
+
- do not use bcalls (or just a few)
+
- use complete include files and bcall macro for each calculator model
+
  
Note that on TI-83, there is no bcall macro, you just use a normal call to a jump table.
+
=== 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 ===
 
=== Shells ===
Line 168: Line 224:
  
 
  </nowiki>
 
  </nowiki>
 +
 +
== Related Topics and sources of info ==
 +
* THE TI-82/83(+) UNIFICATION FAQ by Guillaume Hoffmann

Revision as of 10:48, 19 April 2010

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