This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's Your Projects subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Project Ideas/Start New Projects => Your Projects
Author Message
Rebma Boss


Member


Joined: 16 Dec 2007
Posts: 116

Posted: 18 Feb 2008 10:42:57 pm    Post subject:

As everybody knows, Ti-Basic programs running ASM commands are not as fast as ASM programs.

But frankly, I was looking at my process for TIBASICP, which would have been written in Ti-Basic and used the aid of Celtic III and Xlib. This would have been debugging like death. So, just in case anyone is interested, I'm writing TIBASICP in ASM language. Instead of commands such as "GETKEY" -> Str0, I'll simply take commands from Ans like Codex.

Just for a rehash, TIBASICP is a program that Ti-Basic+ programmers include on the calculator to allow their TI-Basic programs to do more, therefore allowing smoother translations for TI-Basic+.

Like I promised, I arranged my schedule to allow more work on this project. Expect a post containing updated information soon.
Back to top
Art_of_camelot


Member


Joined: 05 Jan 2008
Posts: 152

Posted: 19 Feb 2008 12:47:58 am    Post subject:

Im not sure I follow you. What is TIBASICP ? Is it a seprate entity from your TI-BASIC+ project that is similar X-LIB or Celtic ? If not, what is it's purpose? I thought that TI-BASIC+ would generate all the code, and for functions not avalible in basic you were going to include a readme to explain what the additonal commands were and how to use them . Then, when the translator came across the new commands it would genrate code just as though it were any other command that already existed in BASIC.
Back to top
Rebma Boss


Member


Joined: 16 Dec 2007
Posts: 116

Posted: 19 Feb 2008 09:47:14 am    Post subject:

Quote:
I thought that TI-BASIC+ would generate all the code, and for functions not avalible in basic you were going to include a readme to explain what the additonal commands were and how to use them . Then, when the translator came across the new commands it would genrate code just as though it were any other command that already existed in BASIC.


That's exactly correct--you hit the nail on the head! Smile

TIBASICP is indeed similar to X-LIB and Celtic. You DO NOT need it to write programs that Ti-Basic+ can translate, but you do need it if you want to debug programs on your calculator instead of on the computer.

Example:

If the user wanted to draw a black rectangle in his/her application, the following command, "DRAWFILLEDRECT(A, B, C, D)" (Where a, b, c and d are any constants) would be included in the program. Ti-Basic+ would read this command, and translate it into corresponding ASM, as if DRAWRECT was already a Ti-Basic command. HOWEVER, if the user wanted to debug the program on the calculator, then TIBASICP would be needed to translate the command DRAWRECT so that the calculator would know what to do.


Incidentally, you can also use Ti-Basic+ to translate back and forth between Ti-Basic+ and QBasic. (QBasic will have some subs-functions with Ti-Basic wording, such as TLine, TCircle, TDisplay, TOutput, etc. so that the program can easily be followed, this means that you can't use native QBasic code.) About half the documentation discusses using Qbasic and Ti-Basic as partners rather than using one or the other. There are no disadvantages to either one, but here are some advantages:

Using Ti-Basic--Programs can be debugged and edited on the calculator on the go (TIBASICP can also be edited using the source code)
Using QBasic--Programs can be debugged at the speed of the calculator, and the user can edit subs and functions. The programming environment is also better.


Last edited by Guest on 19 Feb 2008 09:47:55 am; edited 1 time in total
Back to top
Rebma Boss


Member


Joined: 16 Dec 2007
Posts: 116

Posted: 21 Feb 2008 10:13:56 am    Post subject:

I need some opinions here.

As you all know, TIBASICP runs commands to allow a TI-Basic program to function like an ASM program, using commands formed in Ans. One of the things is using TIBASICP to store extra-long any-name variables for debugging on the calculator so that when TI-Basic+ translates, the resulting code has better variable names.

For storing variables on the calculator (and I mean variables with names like HighScore or Dog, not just "A" or "C") that can be translated with Ti-Basic+, I'm using the following structure:

value -> variable (This stores a value to any editable calculator variable, including X, Y, A, C, Ans., etc.)

"STO_LONGVARIABLE" (Stores the value from variable into any variable name. Example: "STO_XPosition", "STO_High_Score"

Asm(TIBASICP)


"RCL_LONGVARIABLE" (Recalls the value from your variable into variable, an error occurs if LONGVARIABLE does not exist.

Asm(TIBASICP)



So, for instance, I want to store HighScore1. I put "200" into variable, then type "STO_HighScore1" into the calculator, then run TIBASICP. The value is store. If I type "RCL_HighScore1," the answer will be stored into variable, which can be recalled using TiBasic.

Now when Ti-Basic+ translates this, the resulting code will be:

HighScore1 .EQU AppBackUpScreen + 1

ld a, 200
ld (HighScore1), a

ld a, (HighScore1)




THE QUESTION IS: I'm thinking about using Theta for variable, in other words, variables are recalled into theta and stored from theta. Is using theta a good idea? If not, please let me know and suggest another variable, otherwise I will use theta.

NOTE: REMEMBER THAT THIS IS ONLY SO THAT THE CALCULATOR CAN DO VARIABLES IN TI-BASIC DURING DEBUGGING. Ti-Basic+ will translate this into ASM with no trouble.


Last edited by Guest on 21 Feb 2008 01:13:24 pm; edited 1 time in total
Back to top
magicdanw
pcGuru()


Calc Guru


Joined: 14 Feb 2007
Posts: 1110

Posted: 21 Feb 2008 02:54:19 pm    Post subject:

This idea I had doesn't really help with your current question, and it would require extra work, but I thought I'd say it any way.

How about writing debugging hooks? A parser hook in a debugging application will let you intercept many commands. I'm not sure what ones will work easily, but you might be able to do something like:

Code:
123->LONGVAR
and intercept it. If not, you could certainly do something like
Code:
real(50,123,"LONGVAR
and intercept it correctly. Using a parser hook like this would let the program run faster while debugging, and allow for more flexibility.

If you don't know much about hooks, let me know and I can fill you in. Also, check out wikiti (sorry, I don't have a link on hand), which documents most (all?) known hooks very nicely.
Back to top
Art_of_camelot


Member


Joined: 05 Jan 2008
Posts: 152

Posted: 21 Feb 2008 03:09:12 pm    Post subject:

Ok, thanks for clearing that up. THat makes much more sense now. In response to your question; I don't see that using theta would hurt anything.
Back to top
Rebma Boss


Member


Joined: 16 Dec 2007
Posts: 116

Posted: 21 Feb 2008 05:57:56 pm    Post subject:

Quote:
How about writing debugging hooks? A parser hook in a debugging application will let you intercept many commands.


Both are your suggestions are really great, magicdanw. If all my commands for TIBASICP were like this, I would consider hooks. But most of my commands for translation are in Ti-Basic syntax, so it's not worth the time and effort learning about hooks, which I know extremely little about.

The command for variables is one of the exceptions to Ti-Basic syntax. Under normal circumstances, I would have something like "4->LONGVARIABLE", in quotes, and TIBASICP would read this string from Ans. The reason I'm not doing it this way is that TIBASICP will not translate equations, the reason being I'm trying to keep the program as small as possible. So the inputs are either single-letter variables or constants--no functions such as sin, ^, or +. I realize that with hooks I could use functions as inputs for parameters, but like I said, I'm trying to keep everything in an easy-to-understand Ti-Basic syntax.

Thanks for the suggestions, though! Smile


Last edited by Guest on 21 Feb 2008 05:58:53 pm; edited 1 time in total
Back to top
Rebma Boss


Member


Joined: 16 Dec 2007
Posts: 116

Posted: 25 Feb 2008 12:22:00 am    Post subject:

I have a confession that even though I've programmed in ASM before, this is my first time working with Application Variables.

So I have a problem. So far, TIBASICP reads the variable name (The command "STO_" will come later) and saves the name for later. Then, the program creates an AppVar meant to hold variable names and their values.

This all works perfectly. The difficulty is, the variable name and the value from Theta are being stored into the AppVar "vars" as partial gibberish. So, I've posted my code, and I'm hoping someone can help me. Please make sure all criticism is constructive--like I said, I've done ASM, but have never done AppVars before.

In the mean time, the next thing I am working on is using TIBASICP to draw boxes--filled, box outlines, etc.

Thanks for any help!

;Here, the variable from Ans is recalled


Code:
 B_CALL zeroop1
 B_CALL rclans

 ld hl, Command

;Read the variable to store into command
 
ReadVariable:

 inc de
 inc de;Where to start reading the command string from Ans
 
 
 
 ld a, (de)
 
 cp 0 ;Is this the end of the command
 jp z, TranslateCommand;If it is, find out what the command is


 ld (hl), a;If not, read another character to continue the command
 
 inc hl;Next character

 jp ReadVariable


;This code is not necessary yet, but will be
;--------------------------------------------
 
 TranslateCommand:;Now to find what the command is
 
 ld hl, Command
 ld a, (hl)
 cp 83;Does the command begin with S?
 jp z, SCommands
 b_call getkey
 jp EndProgram

;--------------------------------------------
SCommands:

;Search for application variable, or create it

 ld hl, Variables;Name of vars variable
 B_CALL mov9toop1
 B_CALL chkfindsym;Does the Appvar "vars" exist?

 jp nc, CheckIfArchived;It does exist, so see if it is archived or not

 ld hl, 9
 B_CALL createappvar

;So, de should be the data pointer
 
 push de
 
 B_CALL op4toop1
 
 pop de


 jp StoreVariable

 CheckIfArchived:



 ld a, b
 or a
 jr z, StoreVariable
 
 B_CALL arc_unarc


 
;This is where I'm having trouble.
 
StoreVariable:

;1. Right here, the values of hl and de are supposed to be exchanged,
;   because the value of theta is being stored into de.  This means
;   that temporarily, hl holds the data pointer, or what should be the
;   data pointer
 
 ex hl, de;    We need de to hold the data from theta, so the data pointer
    ;is store in hl instead

;2. Recall theta and store the value into de

 push hl;    Save the data pointer for later

 B_CALL thetaname
 B_CALL rclvarsym;Recall theta
 B_CALL convop1;Store the value from theta into de
 
 pop hl
 

;3. Now, hl contains the value of theta, and de holds the data pointer

 ex hl, de

 inc de
 inc de;Now, de should hold where the data goes

 
 push hl
 
;I'm going to edit this later so that only the memory needed is stored
 
 ld hl, 10
 B_CALL insertmem

;de = pointer
;hl = value
 
 pop hl

;4. Read the variable name

 ld bc, Command

;5. The process in this next sub is that the variable name is being stored into Vars
;   so that when it's recalled, the program looks for the name and it's value

StoreVariableIntoVars:


 
 ld a, (bc)
 cp 0
 jr z, StoreTheta
 ld (de), a
 inc bc
 inc de
 jp StoreVariableIntoVars


;6. Store the value of theta
 
 StoreTheta:

 inc de
 ld a, h
 ld (de), a
 inc de
 ld a, l
 ld (de),a

 

Variables:

 db appvarobj, "vars", 0
Back to top
Rebma Boss


Member


Joined: 16 Dec 2007
Posts: 116

Posted: 25 Feb 2008 10:57:12 am    Post subject:

I'm having a thought.

I can write all of Ti-Basic+ by myself if I have to, but if there's anybody needing something to work on, I could certainly use some help getting done in a timely manner.

If there are any volunteers, I'm looking for someone who can pick a letter from the catalog and translate every command beginning with that letter into ASM code. For instance, if one were to choose the E's, one would look through the E section of the catalog and translate all the E commands into ASM. (Some commands are either unnecessary or are commands that I am working on, so I would be quick to point these commands out).

The only guidelines: The code has to be able to successfully translate the Ti-Basic command into ASM code that the calculator can run, and the source code must be provided with enough comments so that I can follow through and write the code that TI-Basic+ needs to translate the Ti-Basic command into corresponding ASM. Also, the ASM code must be as optimized as possible.

Any help would be great, and at the very least, I will mention peoples names in the credits and the special thanks sections.

Feel free to post questions, and once again, any help would be great.


Last edited by Guest on 25 Feb 2008 11:11:58 am; edited 1 time in total
Back to top
bananaman
Indestructible


Calc Guru


Joined: 12 Sep 2005
Posts: 1124

Posted: 25 Feb 2008 12:21:51 pm    Post subject:

I'm not sure exactly what you mean by this. Let me provide a quick example.

If the command was '+'.
I might write something like ...

Code:
x+y

translates into

Code:
ld a,x;
ld b,y;
add a,b;
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 25 Feb 2008 12:53:25 pm    Post subject:

Another question - how are you going to distinguish between integer and floating-point math?
Back to top
Rebma Boss


Member


Joined: 16 Dec 2007
Posts: 116

Posted: 25 Feb 2008 01:55:00 pm    Post subject:

Quote:
I'm not sure exactly what you mean by this. Let me provide a quick example.

If the command was '+'.
I might write something like ...
x+y
translates into
ld a,x;
ld b,y;
add a,b;


I'm confused--are you talking about the help I need? If that's so, that's exactly right! Although, like I said, it's for catalog functions, because there are some other functions that I would be translating, such as non Ti-Basic functions and things such as the aforementioned "+". I need help to get this done in a timely manner so that people won't have to wait too long.

Quote:
Another question - how are you going to distinguish between integer and floating-point math?


This will come later.


Last edited by Guest on 25 Feb 2008 01:56:04 pm; edited 1 time in total
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 25 Feb 2008 04:55:32 pm    Post subject:

Rebma Boss wrote:
Quote:
Another question - how are you going to distinguish between integer and floating-point math?


This will come later.
[post="120744"]<{POST_SNAPBACK}>[/post]
It has to come now. Virtually all of the TI-Basic commands rely on floating-point math; it's impossible to write them without supporting this in some way, or providing an alternative of some sort.
Back to top
Rebma Boss


Member


Joined: 16 Dec 2007
Posts: 116

Posted: 25 Feb 2008 06:03:24 pm    Post subject:

Quote:
It has to come now. Virtually all of the TI-Basic commands rely on floating-point math; it's impossible to write them without supporting this in some way, or providing an alternative of some sort.


Are you saying this in conjunction with volunteer work? If so, it's a very valid point--here's what I'mthinking, and you can let me know if I'm still missing something.

Floating-point arithematic will be taken care of with Ti-Basic+. I'm hoping with the volunteer work that volunteers will write the code for use with integers. The point of sending the code to me is not to have Ti-Basic+ translate it in it's original form. What I plan to do with it is make a few changes (including support with floating point arithematic) while keeping most of the original form, and Ti-Basic+ will translate this instead.

Does this sound good?

One more thing: If anyone does plan on helping, please let me know which sub-section of the catalog you plan on doing. There are two reasons for this:

1. Some functions do not need to be translated, because they are used for heavy math that almost no processor-intensive programs use, or because I know what I want to do with them
2. I don't want several people working on the same sub-category for their sakes.

Thanks again for any help from anyone!


Last edited by Guest on 25 Feb 2008 06:04:44 pm; edited 1 time in total
Back to top
David
The XORcist!


Advanced Member


Joined: 20 May 2003
Posts: 268

Posted: 26 Feb 2008 03:33:48 pm    Post subject:

Rebma Boss wrote:
I have a confession that even though I've programmed in ASM before, this is my first time working with Application Variables. 

So I have a problem.  So far, TIBASICP reads the variable name (The command "STO_" will come later) and saves the name for later.  Then, the program creates an AppVar meant to hold variable names and their values.

This all works perfectly.  The difficulty is, the variable name and the value from Theta are being stored into the AppVar "vars" as partial gibberish.  So, I've posted my code, and I'm hoping someone can help me.  Please make sure all criticism is constructive--like I said, I've done ASM, but have never done AppVars before.

In the mean time, the next thing I am working on is using TIBASICP to draw boxes--filled, box outlines, etc.

Thanks for any help!

;Here, the variable from Ans is recalled


Code:
<see original post>

[post="120732"]<{POST_SNAPBACK}>[/post]

Hi Rebma.
I must say I am impressed by your unbridled enthusiasm in this project :)

Anyway, I took a quick look at the code you posted. Dunno if this will help, you might want to give it a try perhaps.

1) The first part of the code that copies the command text, works on the premise that the string in Ans is zero-terminated. To my knowledge, TI-OS doesn't employ this, which is why this routine is likely to copy more bytes than intended.

2) The INC DE at the beginning of storeTheta may be unnecessary. It looks to me that DE will point to the byte _after_ the command string upon leaving the StoreVariableIntoVars loop.
Back to top
Rebma Boss


Member


Joined: 16 Dec 2007
Posts: 116

Posted: 26 Feb 2008 04:22:38 pm    Post subject:

Quote:
2) The INC DE at the beginning of storeTheta may be unnecessary. It looks to me that DE will point to the byte _after_ the command string upon leaving the StoreVariableIntoVars loop.


I never noticed! I think I'm going to keep that in, though, to mark the end of a zero-terminated string in the AppVar.

Quote:
...works on the premise that the string in Ans is zero-terminated. To my knowledge, TI-OS doesn't employ this...


Hmmm...you're probably correct. I'll look into that.

Thanks for the hints!
Back to top
magicdanw
pcGuru()


Calc Guru


Joined: 14 Feb 2007
Posts: 1110

Posted: 26 Feb 2008 05:23:32 pm    Post subject:

David's right. TI-OS strings are preceded by two size bytes, and are not zero terminated. AFAIK, this applies to all TI-OS variable types (although some don't record the size in # of bytes - lists record it in # of elements.)
Back to top
Rebma Boss


Member


Joined: 16 Dec 2007
Posts: 116

Posted: 28 Feb 2008 11:46:35 am    Post subject:

Basic+ is on hold until next Tuesday. I have a big composition that I have due on Tuesday, involving writing a piece for trumpet and piano. I apologize for this.
Back to top
magicdanw
pcGuru()


Calc Guru


Joined: 14 Feb 2007
Posts: 1110

Posted: 28 Feb 2008 04:09:28 pm    Post subject:

Good luck! If it comes out well, and you're able to record it, I hope you'll upload it here for us to listen to! Smile
Back to top
WikiGuru
ADOS (Attention deficit... Oh! Shiny!)


Elite


Joined: 15 Sep 2005
Posts: 923

Posted: 29 Feb 2008 06:13:15 pm    Post subject:

I have an idea: let users create their own routines. ex:


Code:
;really simple example, draws text

NewTextFunction(str Text, int Xc, int Yc){
 ld h,Xc
 ld l,Yc
 ld (curRow),hl
 ld hl,Text
 bcall(_PutS)
 ret
}


similar to C-style programming, except it allows users to create routines basically in Assembly, but then can call them using a "C-Style" call.
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    » Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
» View previous topic :: View next topic  
Page 4 of 7 » All times are UTC - 5 Hours

 

Advertisement