"basic label" jumper (in asm ofcourse)

Got a brilliant program idea? Let us know!

Moderator: MaxCoderz Staff

King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

"basic label" jumper (in asm ofcourse)

Post 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:
User avatar
Saibot84
New Member
Posts: 38
Joined: Fri 17 Feb, 2006 9:14 pm
Location: Jersey City, NJ

Post 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
threefingeredguy
Calc King
Posts: 2195
Joined: Sun 27 Mar, 2005 4:06 am
Location: sleeping
Contact:

Post by threefingeredguy »

Yes, it's been thought of before but never done. Go for it.
Image
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post 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..
chickendude
Extreme Poster
Posts: 340
Joined: Fri 07 Jul, 2006 2:39 pm

Post 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?
User avatar
elfprince13
Sir Posts-A-Lot
Posts: 234
Joined: Sun 11 Dec, 2005 2:21 am
Contact:

Post 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.
chickendude
Extreme Poster
Posts: 340
Joined: Fri 07 Jul, 2006 2:39 pm

Post 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
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post 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.. )
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

so what does this mean?

Code: Select all

stackname:
	call $2B41
	.dw $5AB3
	.db $78
chickendude
Extreme Poster
Posts: 340
Joined: Fri 07 Jul, 2006 2:39 pm

Post by chickendude »

I assume it's some system routine and the .dw and .db are its parameters? But I am not really sure either..
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

well.. its not in ti83plus.inc, not as $2B41, nor as 2B41h nor as 2B41
kinda odd..
chickendude
Extreme Poster
Posts: 340
Joined: Fri 07 Jul, 2006 2:39 pm

Post 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.
User avatar
Saibot84
New Member
Posts: 38
Joined: Fri 17 Feb, 2006 9:14 pm
Location: Jersey City, NJ

Post 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
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post 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?
User avatar
Saibot84
New Member
Posts: 38
Joined: Fri 17 Feb, 2006 9:14 pm
Location: Jersey City, NJ

Post 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
Post Reply