Author Topic: TI Basic Editor  (Read 22683 times)

0 Members and 1 Guest are viewing this topic.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
TI Basic Editor
« on: May 15, 2010, 04:25:11 pm »
So i was playing around with the idea of writing my own Small Font Basic editor in Axe, but i got stumped when it came to the idea of how to realocate memory when you insert text into a large file.  Like if you had an 8000 bytes program, and you add an extra digit on the first line.  Would i have to shift everything else down by a couple bytes?  Is there any fast way to handle the dynamic memory needed for a text editor?  And how does the Ti OS manage to do it so well?

Offline Galandros

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1140
  • Rating: +42/-10
    • View Profile
Re: TI Basic Editor
« Reply #1 on: May 15, 2010, 04:49:58 pm »
I don't know everything. But I have some hints to give you (is all I know of concrete):
Each time you edit a program, the TI-OS allocates all the free ram to that program.
When you exit, it shrinks down to the size used.


Now, the simplest way is indeed copy all the program one byte "down".
You could make secondary buffers to the inserts you put somewhere, but it will be hard to track all the changes you did to the program...


Because of allocating all memory to the program is more reachable from assembly, I say pure assembly is preferred to this task. But I wish best of luck to do it. I bet we can do a better job than TI even with Axe Parser. ::) The scrolls down for Rcl a program and Goto the error in TI-BASIC editor are complete nonsense. I bet Brandon Wilson ranted this at some time.
« Last Edit: May 15, 2010, 04:52:25 pm by Galandros »
Hobbing in calculator projects.

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: TI Basic Editor
« Reply #2 on: May 15, 2010, 05:02:34 pm »
That would be cool!  Yeah, you just copy all the bytes down one by one.  But remember this is asm, that takes about a millisecond.  The hard part is the fact that you have to put the calculator in edit mode first and then keep track of the edit mode pointers.  Basically, the calculator moves around all programs and variables so that your current program is last in the in line so expanding things to the end of it doesn't overwrite your other programs, you have the entire free ram to expand.  Then when you're done expanding, you have to update the size bytes of the file and close the edit mode.

You're looking for the assembly bcalls "EditProg" and "CloseProg".  Those require assembly input though, so even if you make it in Axe, you're still going to need some assembly.  Also there are 4 other pointers that you need to keep track of in $84D3, $84D5, $84D7, and $84D9 which hold important information related to the editing.

Good luck!  If you manage to get it working I would be very impressed.  This gave me a lot of trouble when I was using this in Axe Parser to create the assembly programs.  The TI-Developer's Guide is slightly wrong on some critical stuff so that really threw me off.  Specifically, you need to update the program size manually, even though it says its done automatically.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: TI Basic Editor
« Reply #3 on: May 15, 2010, 05:05:55 pm »
mhmm that would be interesting. I assume this wouldn't leave a lot of RAM for developers, right, tho? (unless programs could be edited from flash?)

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: TI Basic Editor
« Reply #4 on: May 15, 2010, 06:07:13 pm »
This would definitely be more useful in ASM, because then an app could be made, leaving ram free.
The main problem is that, yeah, the program would be kind of large, somewhat defeating the purpose. Still a good concept, though.
Oh, I just realized something: ->Frac displays characters, doesn't it? That means doing a little extra work because the editor must work with the tokens. How does one get the sequence of characters corresponding to a given one- or two-byte token?
« Last Edit: May 15, 2010, 06:07:27 pm by calcdude84se »
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: TI Basic Editor
« Reply #5 on: May 15, 2010, 06:19:41 pm »
Thats some good information :) Although it seems that this might be more difficult than i first imagined.  Once (and if) i finish the program, would it be possible for the raw Asm file to be converted into an APplication using a computer or something?  That way you really would have all the RAM you needed.  I think i might start in Basic first so i can get all the interface and things down to where i want them, and so i can work on the cursor movement, to get it as close to the Basic editor as possible.

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: TI Basic Editor
« Reply #6 on: May 15, 2010, 06:22:26 pm »
It would have to be recompiled from source, since all the jp's, call's and many ld's would have to be changed.
I'm not sure how hard it would be to make a slightly modified version of Axe where the program's .org is different.
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: TI Basic Editor
« Reply #7 on: May 15, 2010, 06:36:37 pm »
I could compile it for an app fairly easily (an app that is just hex code and not signed).  It would look just like a program, but unable to execute and you would have to extract the hex from that program on the computer and then sign it there and send it back as an app.

Is app signing on-calc really that hard?  How does app signing even work?  Isn't it just RSA encryption or something?
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: TI Basic Editor
« Reply #8 on: May 15, 2010, 06:51:01 pm »
I dont know, you should probably talk to Brandon Wilson, he knows lots of things ;D

_player1537

  • Guest
Re: TI Basic Editor
« Reply #9 on: May 15, 2010, 06:51:55 pm »
Brandon Wilson made a program that takes unsquished hex and makes it into an app, and signs it too

iirc signing means putting something at the beggining or end of a program to make it recognized on the calc
« Last Edit: May 15, 2010, 06:52:30 pm by _player1537 »

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: TI Basic Editor
« Reply #10 on: May 15, 2010, 06:52:19 pm »
IIRC correctly it just takes over 10 minutes if it's not an 83+, in which case it takes longer.
It just takes forever... it's doable, though. I can't remember the exact method, but RSA sounds right.
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: TI Basic Editor
« Reply #11 on: May 15, 2010, 06:55:03 pm »
You would probably need to ask BrandonW for that since he's the biggest expert in that stuff. That said, maybe FloppusMaximus on UTI or Calc84maniac might know a bit about that, too

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: TI Basic Editor
« Reply #12 on: May 16, 2010, 09:03:30 pm »
Hmm hey Quigibo, is GetCalc(Str,100) supposed to be able to create programs?  I can only get it to create AppVars on my Ti84SE

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: TI Basic Editor
« Reply #13 on: May 16, 2010, 10:05:17 pm »
Strange, just tried on emulator (OS 2.41) and it wouldn't create the program

"prgmLOL"->Str1
GetCalc(Str1,90)
« Last Edit: May 16, 2010, 10:05:28 pm by DJ Omnimaga »

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: TI Basic Editor
« Reply #14 on: May 17, 2010, 12:52:55 am »
So if/when creating a program is suppoorted, would that be a substitute for the assembly BCALLS you mentioned earlier?  FOr instance you could use GetCalc(Name,Size) to create a temp program for working space, and then worked on it from there