Page 1 of 3

"basic label" jumper (in asm ofcourse)

Posted: Thu 24 Aug, 2006 1:29 pm
by King Harold
Lots of basic programmers are annoyed by basic's super slow labels (it is said the TI OS searches the program from the top untill it finds the right label).
I think it should be possible to run a program at the beginning of a program (or do something else if it has to be an app) which scans the whole program for "Label *" and stores the adress and label in a tabel, then when you "Goto *" it should be run again (parser hook or run the program with different input) and make the jump to "Label *" as a jump instead of searching the program for it.
The program will, as a whole, take longer to finish, but the part of the program that actually does something should become faster.

i think its a terribly good idea, but that's only because its my idea :wink:

Posted: Thu 24 Aug, 2006 3:46 pm
by Saibot84
Image I seem to remember a nice asm program i once found on ticalc... </me google-ing> </me found it> Subroutine v2.0: "This program lets you run internal subroutines from within BASIC programs." ;)
____________________
XDG Kat-Productions
-Michael Image Image
MyBlog ChatWithMe

Posted: Thu 24 Aug, 2006 4:15 pm
by threefingeredguy
Yes, it's been thought of before but never done. Go for it.

Posted: Thu 24 Aug, 2006 5:40 pm
by King Harold
@saibot: i know that one, but it doesnt do what i was thinking of, it just finds labels, i want to JUMP to labels, so almost instantly, so save all labels first then recalling them..
almost the same as the for(/repeat( trick and using End to return, but that takes up more memory and cant allways be used, also can cause memory leak, actually i know someone who had a Ti 83+ for 2 years and had a memory leak in every program he made, quote from him "HUH?!?!?! How can it be that your programs never get slower while they've been running for an hour??" -me "because i know how to avoid memory leak.." Also this program should be able to jump to any label (inside the programs it has been run in) not just the last one like with the repeat + end trick, so.. cool!
i might not be able to code it though.. im not much of a asm programmer yet..

Posted: Thu 24 Aug, 2006 9:20 pm
by chickendude
Well, you could still check out that program, he distributed the source with it. It's got to look through the program for the label, which is essentially what you need, right?

But, looking through the source, what does 'call $2B41' reference?

Posted: Thu 24 Aug, 2006 9:54 pm
by elfprince13
you know what would be cool having a program that uses that records all the instructions the TI-OS calls when running a TI-Basic program and essentially "precompile" it into the Asm that would get run anyway. this would make the program run a lot faster since it could be run as Assembly and wouldn't have to be translated as it was run.

Posted: Fri 25 Aug, 2006 2:05 am
by chickendude
There is already a BASIC>ASM program somewhere on ticalc, not sure how well it works though.

EDIT: http://www.ticalc.org/archives/files/fi ... 17882.html

Posted: Fri 25 Aug, 2006 7:23 am
by King Harold
Ive seen that one, i think elfprince means on-calc? right?
should be possible, afterall, we have the famous "three exec" and "fourexec" i dont see them being used a lot though lol
also, yes that program looks for "label" ofcourse, but it shouldnt be the hardest part to figure out, harder is to figure out where to store the labels, it may be possible someone has up to 36^2 labels, and they'd all take 2 bytes, that is a shitload of memory, although no serious program has 36^2 labels.. maybe 1 or 2..
if this gets to be an app that catches "goto *" (and "label *" to remember where it was) then you cant even writeback, can you? (can you write to flash just like that?) but aside from that, catching label and goto would allways make a basic program faster, provided that the label comes before the goto, if it would encounter an "unknown" goto it still has to seach, but atleast it only has to do it once, and not from the start since you allready know that any higher in the current program such label does not exist, else you would have found it allready.

does this make sence to you all?



edit: i tried to read the source of the "subroutine" program, but whoever wrote it seemed to have put a lot of efford into making it as unclear as possible (all bcalls have their $ number and he's doing some very confusing things with labels.. )

Posted: Fri 25 Aug, 2006 12:52 pm
by King Harold
so what does this mean?

Code: Select all

stackname:
	call $2B41
	.dw $5AB3
	.db $78

Posted: Fri 25 Aug, 2006 2:28 pm
by chickendude
I assume it's some system routine and the .dw and .db are its parameters? But I am not really sure either..

Posted: Fri 25 Aug, 2006 3:12 pm
by King Harold
well.. its not in ti83plus.inc, not as $2B41, nor as 2B41h nor as 2B41
kinda odd..

Posted: Fri 25 Aug, 2006 3:15 pm
by chickendude
Well it said something about requiring OS 1.14 to work, so I think there were a few undocumented ROM calls that they added? Something at $2B41?

It probably never got entered into ti83plus.inc. But I'm curious as to what it does.

Posted: Fri 25 Aug, 2006 3:43 pm
by Saibot84
Image I remember my friend Benny Baumann once discovering a bcall that he named _CallPrivateBC because it would call a private bcall. you did something like bcall $XXXX \ .dw Addr \ .db Page and it would call the routine @ Addr on page Page. Maybe $2B41 is the address of this bcall in TIOsv1.14 ;)... but i don't have TIOS w/ me to check :)
____________________
XDG Kat-Productions
-Michael Image Image
MyBlog ChatWithMe

Posted: Fri 25 Aug, 2006 5:52 pm
by King Harold
it says TI-OS 1.14 +, and you probebly have 2.4x by now dont you?
TI probebly didnt change that call but you never know..
but how do find out what that guy who wrote "Subroutine" meant?

Posted: Fri 25 Aug, 2006 8:57 pm
by Saibot84
Image follow the call with CalcSys or in the Flash Debugger and figure out what the call he's calling does ;)
____________________
XDG Kat-Productions
-Michael Image Image
MyBlog ChatWithMe