Hi Cemetech,

through the production of my Shell Xenon, I have been wondering how to add a basic/[TI] Program Editor to a program. I have seen many things ICE can do and I would love to know how to add the editor function in an ICE program.

Thank you, Alvajoy123
P_T wrote:

2:27:30 PM [#] [P_T] Pro tip: GetTokenString
2:27:11 PM [#] [P_T] Alvajoy: just write a UI and use the file I/O commands to update the BASIC 2:46:14 PM [#] [P_T] Alvajoy: you can get the BASIC tokens using GetChar, or the characters with GetTokenString(GetDataPtr(SLOT))
2:48:27 PM [#] [P_T] Alvajoy: keep displaying the characters until you found a newline ($3F), and then go to the next line


Thank you for the Information I will put it to good use Good Idea
Hello Ladies and Gems.
I and Beck Have been working on basic code to display what's inside a program....IT'S BEEN HARD

Am posting the code here to see if any can help
CODE DOES NOT WORK !!

Code:

[i]EDITOR
det(0
sum(0
[i] temporary appvar (ICE will squish this)
"6103→TEMPFILE
0→A→B
[i]  Example program
sum(2,"TEST","r",5→S
[i]  gets Size and program Pointer
sum(16,S→SIZE
sum(18,S→PTR
sum(6,D→C
[i] close the file, because there's not much point keeping it open
sum(3,S
[i] if program TEST is not found, then quit
If C=-1
Goto END
End
PTR+SIZE→MAXPTR
[i] open a temporary file, because ICE currently has no way of dynamically allocating extra memory
sum(1,TEMPFILE,"w→D
[i] Repeat until the pointer is at the end of the file
Repeat PTR=MAXPTR
[i] get the token string from Pointer
sum(17,°PTR,°A,°B→X
[i]write pointer to file
sum(4,C,length(X),1,D
End
[i]end of string character
sum(7,0,D
sum(3,D
[i]  displays SIZE and token string
det(19,1,1
det(16,SIZE,5
det(19,1,10
sum(1,TEMPFILE,"r→D
det(17,sum(18,D
sum(3,D
pause
Lbl END
sum(8,TEMPFILE
sum(0
det(0
I don't know who has been spreading this, but you should NEVER close the file if you have an open pointer to it. Whoever thinks you can do that is sorely mistaken.
I'm sorry, but the way you posted that question doesn't make anyone want to help you. What have you tried? What are you trying to do with the code? How does the code not work?

Check out this video, it puts it better than I ever could:
boop
_iPhoenix_ wrote:
What have you tried? How does the code not work?


The Bug is the repeat loop seems to be crashing the the program.
I have tried changing the repeat loop from PTR=MAXPTR to PTR≥MAXPTR and it still crashes. Sad

_iPhoenix_ wrote:
What are you trying to do with the code?

I am trying to make a Basic Editor to view and edit other program code, while learning more about ICE.
right now it's in it's CUI stages. Exclamation
MateoConLechuga wrote:
I don't know who has been spreading this, but you should NEVER close the file if you have an open pointer to it. Whoever thinks you can do that is sorely mistaken.


that's not what I meant. I agree that an archived file can't be edited from a pointer, but it can still be read from. I should have mentioned that, but i had forgot at the time. Alvajoy you will need to keep the program open if you want to write to it. However, if the program is not archived, you can write to it from the data pointer, as long as you don't write outside the bounds of the file.
I would recommend writing the data to a temporary program, and keeping that open instead of the original program, writing the data back to the original file upon exiting.

MateoC: a closed file can still be read from, as long as nothing modifies it's place In memory. I know this because I have done it successfully. I have also been able to write to a variable pointer, as long as the size is not modified and the position remains constant, as well as the variable being In RAM. I will send a working example if you would like, so you can see for yourself.

Note: I am using the C function "getDataPtr" to get the variable pointer, so this is possible In ICE, Asm and C.

EDIT: I misunderstood what you said Mateo
Did you see these lines, though?

Code:

[i] open a temporary file, because ICE currently has no way of dynamically allocating extra memory
sum(1,TEMPFILE,"w→D

That is the file that is being written to in the main loop Razz
  
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
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement