[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

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

Post by Timendus »

Exactely. The entire API isn't very flag or register friendly, nor does it state what gets destroyed and what not. You could see that as a flaw, but it hasn't really bothered me yet when coding with the API. I think that the entire idea is that you're fiddling with blocks of data and with hardware rather than with registers...
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
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

To answer this question:
calcul831415 wrote:If this is all for the API, why not make API into it's own language? Like a better version of EZASM and Basic?
Does using libraries in C make it another programming language? Does including other packages in Java make it another programming language? Of course it doesn't. With the API included, you're still programming in z80, but you rely on other routines to do the really down to earth boring things, like you would in any other serious programming language.

That's why I wrote "why hasn't this been done yet?". On every other platform and language programmers have some form of libraries at their disposal, and all we have (had :)) are some stupid includes that define some memory areas and romcalls. Those can't DO anything for you, they just memorize some numbers. But you can actually let the API do some WORK for you :)
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
kalan_vod
Calc King
Posts: 2932
Joined: Sat 18 Dec, 2004 6:46 am
Contact:

Post by kalan_vod »

But doesn't ions' routines give us some routines at our disposal? Of course yours is a lot easier to use, but I just wanted to make sure Ion isn't left out :P. Btw I can't wait till you have this completed as it is already amazing!
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

Yes, you're right of course. The ION routines are the only exception. I'm sorry I forgot about them.

Anyway, "completed" is a pretty relative thing for this project :P I hope to see other people working on routines in the API long after I stop working on them myself :)

I'm still working on a few things to add at the moment, but at a very slow pace. Several other things currently have a higher priority.

Things I'm working on, in no particular order:
- Finally making that homescreen word wrap print routine
- Better/more key input (already have a few nice new routines to add on my PC, but need a few more)
- A graphical user interface (that DOESN'T resemble Windows in ANY way :mrgreen:) section (this has been my "secret" thing, because it's going to be really cool :P In fact, it already is, but a lot needs finishing)
- Link port routines with error handling shite (but I'm not sure how to do error handling with the TI-OS routines, could someone please tell me that?)
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
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

I just added the load macro to the API (I had forgotten all about it), and edited 74 routines to make use of it :P I have confirmed that the old demo still runs properly, so I guess I didn't make too many mistakes, and I'm going to bed now :mrgreen:

If someone could confirm that the demo still works with the new api.inc when compiled with TASM that would be nice :)
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 »

Timendus wrote:- A graphical user interface (that DOESN'T resemble Windows in ANY way :mrgreen:) section (this has been my "secret" thing, because it's going to be really cool :P In fact, it already is, but a lot needs finishing)
Any screenshots, so we can, uh, verify this non-Windows look? ;) Sounds very cool!
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

I'll try to make a nice one soon ;)
I'm not sure how the system should be used yet, so I'm still very much working on that (when I have the time :)).
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
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

Image

Here's the full code of this little game:

Code: Select all

init_all:

	math.random(10)				; Random a number for the user to guess
	ld (savesscreen),a
game:
	graph.clear()					; Clean up the screen
	gui.drawPlane(256*1+1,256*43+53)		; Draw three Planes
	gui.drawPlane(256*46+1,256*93+9)
	gui.drawPlane(256*46+12,256*93+53)
	gui.print(256*2+48,str,50)			; Print two texts
	gui.print(256*13+48,str2,40)
	gui.resetChoices()				; Reset the choices pane
	gui.setChoiceKeyHandler(myhandler)		; Add a keyhandler to the pane...
	gui.addChoice(new,newgo)			; and three choices
	gui.addChoice(quit,quitgo)
	gui.addChoice(about,aboutgo)
	gui.goChoices()				; Give execution to the choices pane

; Gets called by the choices pane if F1 is pressed
newgo:
	jp init_all
	
; Gets called by the choices pane if F2 is pressed
quitgo:
	ret
	
; Gets called by the choices pane if F3 is pressed
aboutgo:
	gui.alert("Number Guess by Timendus as an API demo")
	jp game

; Gets called by the choices pane if another button than F1-F5 is pressed
; a = Button pressed (getcsc-style)
myhandler:
	cp $21
	ld c,0
	jr z,myhandler_checkvalue
	cp $22
	ld c,1
	jr z,myhandler_checkvalue
	cp $1A
	ld c,2
	jr z,myhandler_checkvalue
	cp $12
	ld c,3
	jr z,myhandler_checkvalue
	cp $23
	ld c,4
	jr z,myhandler_checkvalue
	cp $1B
	ld c,5
	jr z,myhandler_checkvalue
	cp $13
	ld c,6
	jr z,myhandler_checkvalue
	cp $24
	ld c,7
	jr z,myhandler_checkvalue
	cp $1C
	ld c,8
	jr z,myhandler_checkvalue
	cp $14
	ld c,9
	jr z,myhandler_checkvalue
	ret
	
myhandler_checkvalue:
	push bc
	int.decToString(savesscreen+1,c)
	gui.print(256*2+3,myhandler_string,50)
	graph.print(savesscreen+1)
	pop bc
	ld a,(savesscreen)
	ld hl,good
	cp c
	jr z,myhandler_disp
	ld hl,higher
	jr nc,myhandler_disp
	ld hl,lower
myhandler_disp:
	gui.print(256*10+3,hl,40)
	call ionFastCopy
	ret

; Data

myhandler_string:
	.db "You tried ",0
higher:
	.db "Too low!",0
lower:
	.db "Too high!",0
good:
	.db "You guessed it! Congrats! :)",0

new:
	.db "New",0
about:
	.db "About",0
quit:
	.db "Exit",0
	
str:
	.db "Number guess",0
str2:
	.db "Guess a number between 0 and 9!",0
This code alone compiles to 384 bytes, and the API routines about triple that.

I have not yet added those routines to the API, because they aren't 100% stable yet, and they can be improved/optimized/expanded. But what do you think? :)
Last edited by Timendus on Tue 16 May, 2006 6:10 pm, edited 1 time 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
User avatar
kalan_vod
Calc King
Posts: 2932
Joined: Sat 18 Dec, 2004 6:46 am
Contact:

Post by kalan_vod »

Nice.
Stickmanofdoom
Regular Member
Posts: 86
Joined: Fri 17 Dec, 2004 8:20 pm
Contact:

Post by Stickmanofdoom »

Slick.
CoBB
MCF Legend
Posts: 1601
Joined: Mon 20 Dec, 2004 8:45 am
Location: Budapest, Absurdistan
Contact:

Post by CoBB »

What about a coordinate macro? pt(x,y) -> x*256+y
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

Hey, good idea :) I'll add it some time soon!
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 »

Looking very nice!
gangsta
Sir Posts-A-Lot
Posts: 171
Joined: Wed 12 Oct, 2005 10:46 pm

Post by gangsta »

add the gui stuff to the api!
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

Thanks for the compliments y'all ;)
I'll add the gui stuff as soon as it's finished. That's probably in a few weeks time, because I have exams, projects, work, et cetera ahead in the coming weeks...
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
Post Reply