[Featured][Beta] API - Why hasn't this been done yet?!

Here you can find side projects of the staff and great projects which we think should get extra support. (Note that featured projects are not projects by staff members of MaxCoderz)

Moderator: MaxCoderz Staff

Post Reply
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

[Featured][Beta] API - Why hasn't this been done yet?!

Post by Timendus »

[edit]

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

And convert it to working code. This will ask you a few questions in the graph screen, and respond depending on whatever you type in.

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"

The ones that are more complex than a few lines call one of the routines that you include at the bottom of your file (or wherever you like) like this:

Code: Select all

#define api_routines
#include "api.inc"

TASM will "know" which routines need to be included and which need to be left out based on the ones that you actually use, so it shouldn't clutter up your memory with useless code.

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)

I'm currently working on link.println(str) and link.readln(buffer,maxsize) to enable writing a string over the link port, but the Ti-OS routines don't seem to be willing... And I NEED to go get some sleep because I have to get on a bus to Germany in seven hours :(

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)

I don't really plan on making all that myself, but since this is all just a collection of routines anyone can optimize it and add to the API once I release the source. I plan on making a simple website where you can download the latest version, and submit ideas/improvements et cetera.

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!
Last edited by Timendus on Fri 21 Jul, 2006 10:54 am, edited 2 times in total.
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
necro
Calc King
Posts: 1619
Joined: Sat 26 Mar, 2005 2:45 am
Location: your shadow

Post by necro »

Sounds cool...except I don't understand it much...well, API like code is always a good thing to see I guess
User avatar
crzyrbl
Calc Wizard
Posts: 518
Joined: Wed 06 Jul, 2005 4:56 pm
Location: 3rd rock....

Post by crzyrbl »

awsome idea :D too bad i dont prgm asm
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.

Image
User avatar
kalan_vod
Calc King
Posts: 2932
Joined: Sat 18 Dec, 2004 6:46 am
Contact:

Post by kalan_vod »

I didn't understand too much :D, but sounds like it will be usefull.
necro
Calc King
Posts: 1619
Joined: Sat 26 Mar, 2005 2:45 am
Location: your shadow

Post by necro »

so, do you think you could explain this a little better for us with little to no asm understanding?
User avatar
Jim e
Calc King
Posts: 2457
Joined: Sun 26 Dec, 2004 5:27 am
Location: SXIOPO = Infinite lives for both players
Contact:

Post by Jim e »

well basically rather than having to write the several lines of code for certain functions you simply have to remember macros. The benefits is it would be quicker to code simple interfaces that would normally take couple hours for inexperienced coder. Interface can be a time consuming part of coding, I can imagine this might speed things up a bit.


I hope you plan on include graphic routines.(Sprite, mapping)

How do you plan on handling a variable or constant? like say something like this:

Code: Select all

   graph.println(pointer)

pointer:
 .dw somestring
Somestring:
 .db "Hello",0
Image
Liazon
Calc Guru
Posts: 962
Joined: Thu 27 Oct, 2005 8:28 pm

Post by Liazon »

wow, it cut's the esotericity out of ASM.

me likes, and me no likes
Image Image Image
User avatar
L4E_WakaMol-King
Maxcoderz Staff
Posts: 342
Joined: Tue 01 Nov, 2005 6:34 am

Post by L4E_WakaMol-King »

Wow! I'm impressed. You're right... why had this never been done before?
Image - Now Under Development - [Progress]
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

Thanks :P

I've slept for the amazing amount of three hours because I couldn't stop thinking about this :x But anyway, here's some short answers before I go get my bus:

Jim e wrote:I hope you plan on include graphic routines.(Sprite, mapping)

How do you plan on handling a variable or constant?

Well, the big idea is that everyone will be able to add and improve routines, it's like a replacement for that codebank idea that kv and I were working on a while ago, so yes I do expect sprite and mapping routines to be included in the near future :)
And at the moment you just give it a pointer to a string, and it displays it. To make a string with changing content, you could point it to a buffer and use the string routines (that haven't been made yet :)) to copy/paste some text in it. Or you could call the println routine "by hand".

necro wrote:so, do you think you could explain this a little better for us with little to no asm understanding?

Well, think of it like this: in the final state where I hope to get, this include file would contain the combined knowlegde of half the community. So when writing a program you could rely on other people's routines, without having to copy them in and understand what it does. You only have to deal with the interface. In other words: ASM will become almost as simple to code in as Basic (except for if-statements and for-loops).

crzyrbl wrote:awsome idea :D too bad i dont prgm asm

Maybe you will with this ;)
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
User avatar
benryves
Maxcoderz Staff
Posts: 3078
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

I've done something similar in the past, but it didn't get too far. ;)

TASM's macro system is pretty primitive... http://users.tkk.fi/~vhelin/wla.html might allow you more flexibility. (I've never tried building a TI-8? file in it though).

EDIT: I was writing a simple Z80 OS a while ago which has a bunch of string manipulation routines (reverse string, string->number, number->string, convert to hex, that sort of thing) - any use to you?
User avatar
MissingIntellect
Regular Member
Posts: 102
Joined: Tue 21 Dec, 2004 2:46 pm
Location: Santa Clarita, California
Contact:

Post by MissingIntellect »

I was working on a project similar to this, of doing an GUI API, but it's kind of on the back burner now...
--Steve Riekeberg
MaxCoderz Co-Founder, Ex-Staff Member
Image
http://www.missingintellect.net
Kozak
Maxcoderz Staff
Posts: 791
Joined: Fri 17 Dec, 2004 5:33 pm
Location: On the dark side of the moon.
Contact:

Post by Kozak »

What does it add besides looking good and structured.?
"They say that sea was created by a man named Maarten Zwartbol, a long time ago...." - Duck, an old Corbin version
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4128
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

Isnt EZAsm supposed to be like this? (A set of macros).
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
User avatar
dysfunction
Calc Master
Posts: 1454
Joined: Wed 22 Dec, 2004 3:07 am
Location: Through the Aura

Post by dysfunction »

EZAsm was pretty limited in its macros however.
Image


"You're very clever, young man, but it's turtles all the way down!"
threefingeredguy
Calc King
Posts: 2195
Joined: Sun 27 Mar, 2005 4:06 am
Location: sleeping
Contact:

Post by threefingeredguy »

Kozak wrote:What does it add besides looking good and structured.?

No offense, but all it will add is size and slowness. It may be a good way to start learning, but the code will be unoptimized.
Image
Post Reply