For anyone who's new to this:
The Ti calculator API is a set of macro's and routines that is assembled to make calculator programming in z80 more simple. Normally, you have to deal with all those pesky registers and Ti-OS routines, even if you just want to display a simple string. With the Ti API you just tell the API to output the string for you, and it'll do all the boring work!
More information: http://api.timendus.com
Original first post follows:
[/edit]
I've started working on an include file today, that will allow you to write something like this:
Code: Select all
graph.clear()
graph.println(welcome)
graph.println(type)
graph.readln(buffer, 128)
graph.print(think)
graph.print(buffer)
graph.println(think2)
graph.readln(buffer, 128)
string.compare(buffer,yes)
jp z,goyes
string.compare(buffer,no)
jp z,gono
graph.println(exit)
graph.waitkey()
ret
welcome:
.db "Welcome!",0
type:
.db "Type something useless:",0
think:
.db "So you think ",0
think2:
.db " is useless?",0
yes:
.db "YES",0
no:
.db "NO",0
exit:
.db "Not playing along, are we? Leave then!",0
buffer:
.fill 128,0
goyes:
graph.clear()
graph.println(well)
...
ret
well:
.db "You really think a lot of yourself, don't you?",0
gono:
...
ret
I'm not sure if this is worth the name API, but I guess it's as close as it gets to one on a calculator And I must say it's a hell of a lot more fun to code simple things like in- and output in this way than in pure asm.
How it works
Nope, it's not object based, nope it doesn't add redundant code and nope you don't need a new compiler. The include file that I'm working on defines a few macros for TASM if you include this at the beginning of your file:
Code: Select all
#define api_defines
#include "api.inc"
Code: Select all
#define api_routines
#include "api.inc"
Commands that are currently understood by this "API":
Code: Select all
Homescreen:
disp.clear()
disp.print(str)
disp.println(str)
disp.readln(buffer,maxsize)
disp.waitkey()
disp.newline()
Graphscreen:
graph.clear()
graph.print(str)
graph.println(str)
graph.readln(buffer,maxsize)
graph.waitkey()
graph.newline()
String:
string.compare(str1,str2)
The input routines are pretty crude at the moment. You can type in caps when you turn Alpha on, and space works, but that's about it. I hope to be able to use Ben's routines once he's done with his keyboard project, so that you can use just the Ti keyboard or also an external one by adding another define. Either way, it would be abstract to the programmer where the input comes from, as long as he gets some input from the API.
Anyway, my list of ideas (so far):
Code: Select all
- Add word wrapping (it wraps already, also in the graphscreen, but not at words)
- More String routines (append,copy,etc)
- Better linking (get it working :)/faster/running in background/more than 2 calcs)
- file.read(filename) / file.write(filename,data) for programs
- var.read(varletter) / var.write(varletter,value) for A-Z vars
- str.read(strnumber) / str.write(strnumber,data) for str0-str9
- menu.choice(str1,str2) to give a choice between two things (return in z and a)
- menu.alert(str) to give an alert that goes away after a keypress
- menu.question(str) to ask "str? Yes/No" (return in z and a)
- menu.options(menu) to give a proper menu (.db 1,"Option one" \ .db 2,"Option two" \ ... \ .db $FF) (return in a)
Please let me know what you think, but don't expect any response from me untill after the weekend. (Convention in Germany, see my girlfriend, party in Groningen on saterday night, calc convention on sunday in Amsterdam... so much to do ) Good night!