Author Topic: Reading programs in Axe  (Read 14989 times)

0 Members and 1 Guest are viewing this topic.

Offline E37

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +23/-0
  • Trial and error is the best teacher
    • View Profile
Reading programs in Axe
« on: October 27, 2015, 05:16:20 pm »
So... I've been trying to make a program editor with Axe that acts like the default editor but with the small graph screen sized text.
The large font has been annoying me lately and I could see more with the smaller font size.
My current attempts have lead to multiple RAM wipes and wierd font.
Can anyone point me in the right direction? Is this really hard or just impossible (maybe I am missing something really obvious).   ;D
I'm still around... kind of.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Reading programs in Axe
« Reply #1 on: October 27, 2015, 05:44:24 pm »
It's certainly not impossible to build your own program editor. However, there are lots of OS calls that would assist in providing functionality of the OS editor that you don't have access to in Axe. Namely, you'd have to handle input entirely yourself, translating keypresses to tokens and making your own menus.

If there are any specific problems you're running into, ask directly about those.


By the way, if you simply wanted a small font program editor to use, there's a version of zStart that replaces the OS editor with one. It was released in a mostly completed state when the developer was more or less stopping calculator development, so there may be a few things wrong with it that won't be fixed. But I think it works for the most part. And zStart provides other nice features, especially for Axe developers, so you should have some version of it anyways. If you're interested, grab the proper version attached to this post (the first is for the 84+ and the second is for the 83+).

Offline E37

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +23/-0
  • Trial and error is the best teacher
    • View Profile
Re: Reading programs in Axe
« Reply #2 on: October 27, 2015, 05:57:41 pm »
Thanks! All I was trying to do was enable the small font size editor.
I looked through zStart (I already had it installed) and I couldn't find how to enable it.
Also, I heard it could let you jump to labels and couldn't find that feature either.



On the subject of reading files, I've tried to convert compiled programs to hex using the >Hex command.
I got the program to work but the code doesn't work.
Is it possible to convert a compiled program to hex?
I want to run some asm commands in Axe that don't exist (like powering the calc off).

Edit (Eeems): Merged double post.
« Last Edit: October 27, 2015, 06:15:36 pm by Eeems »
I'm still around... kind of.

Offline Ivoah

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +3/-0
    • View Profile
    • Codinghobbit
Re: Reading programs in Axe
« Reply #3 on: October 27, 2015, 06:22:09 pm »
Isn't that what the Asm( token is for?
Quote
Asm(HEX)   Native assembly code written in hexadecimal is inserted at the current position.
http://codinghobbit.no-ip.org
My Calcs:
TI-86 (now broken) $2
TI SR-56 - $0
TI-Nspire CX CAS - $152
TI-84+ Silver Edition - $56
TI-84+ Silver Edition - $0
TI-85 - $0
TI-73 Explorer VS - $10
ViewScreen - $3

Offline E37

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +23/-0
  • Trial and error is the best teacher
    • View Profile
Re: Reading programs in Axe
« Reply #4 on: October 27, 2015, 06:28:06 pm »
Yes, I am trying to convert compiled asm code to hex to run in Axe.
I just used to power off feature as an example.
I am also just trying out different commands. I never know when this knowledge might be useful!  ;D
I'm still around... kind of.

Offline Ivoah

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +3/-0
    • View Profile
    • Codinghobbit
Re: Reading programs in Axe
« Reply #5 on: October 27, 2015, 06:33:54 pm »
Yes, I am trying to convert compiled asm code to hex to run in Axe.
I just used to power off feature as an example.
I am also just trying out different commands. I never know when this knowledge might be useful!  ;D

Then you'll want to use this tool to "unsquish" the program into the hex bytes.
http://codinghobbit.no-ip.org
My Calcs:
TI-86 (now broken) $2
TI SR-56 - $0
TI-Nspire CX CAS - $152
TI-84+ Silver Edition - $56
TI-84+ Silver Edition - $0
TI-85 - $0
TI-73 Explorer VS - $10
ViewScreen - $3

Offline E37

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +23/-0
  • Trial and error is the best teacher
    • View Profile
Re: Reading programs in Axe
« Reply #6 on: October 27, 2015, 06:37:58 pm »
Yes, I am trying to convert compiled asm code to hex to run in Axe.
I just used to power off feature as an example.
I am also just trying out different commands. I never know when this knowledge might be useful!  ;D

Then you'll want to use this tool to "unsquish" the program into the hex bytes.
Thanks!
Do you know how to enable the small font on zStart?
I'm still around... kind of.

Offline Ivoah

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +3/-0
    • View Profile
    • Codinghobbit
Re: Reading programs in Axe
« Reply #7 on: October 27, 2015, 06:45:31 pm »
I think only the specific version that Runer112 linked to has that feature.

If you're interested, grab the proper version attached to this post (the first is for the 84+ and the second is for the 83+).
http://codinghobbit.no-ip.org
My Calcs:
TI-86 (now broken) $2
TI SR-56 - $0
TI-Nspire CX CAS - $152
TI-84+ Silver Edition - $56
TI-84+ Silver Edition - $0
TI-85 - $0
TI-73 Explorer VS - $10
ViewScreen - $3

Offline E37

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +23/-0
  • Trial and error is the best teacher
    • View Profile
Re: Reading programs in Axe
« Reply #8 on: October 27, 2015, 06:47:44 pm »
I loaded it in wabbitemu and the version numbers are the same.
When I looked through it it was the same.

Also, through the getcalc( command is is possible to create self modifying code assuming you knew what you were doing?
« Last Edit: October 27, 2015, 06:53:47 pm by E37 »
I'm still around... kind of.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Reading programs in Axe
« Reply #9 on: October 27, 2015, 08:31:38 pm »
I loaded it in wabbitemu and the version numbers are the same.

Since the small font editor version was not actually officially released, I think the author didn't increment the version numbers. Perhaps the easiest way to know if you have this version or not is that all previous versions of zStart are only one page (16834 bytes) large, while the version with the small font editor is two pages (32768 bytes) large. Also, you can't actually turn the small font editor off, so you'd certainly know if you had it.

Also, through the getcalc( command is is possible to create self modifying code assuming you knew what you were doing?

Self-modifying code is certainly doable in Axe if you know what you're doing. But I'm not sure how GetCalc() would factor into it without knowing more about your intent.

Offline E37

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +23/-0
  • Trial and error is the best teacher
    • View Profile
Re: Reading programs in Axe
« Reply #10 on: November 01, 2015, 05:02:29 pm »
I am writing a program to restore some of my files (after RAM clear thanks to zStart) and I am using the copy command.
Does the size command {pointer-2} not work of files? It works fine if I just manually input the size but otherwise it just copy's one bite.
On a different subject is there a way to run already compiled programs (including the ability to call subroutines) to bypass the compiled code limit?
I know about axioms to circumvent this need but I would like to not have to use them.

For self modifying code what numbers correspond to which command tokens?
« Last Edit: November 01, 2015, 05:33:38 pm by E37 »
I'm still around... kind of.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Reading programs in Axe
« Reply #11 on: November 01, 2015, 08:43:03 pm »
I am writing a program to restore some of my files (after RAM clear thanks to zStart) and I am using the copy command.

I'm skeptical that zStart would actually cause a RAM clear unless it was abused a bit... but anyways, you should really keep all your source code archived to keep it safe, since zStart lets you edit archived programs.

Does the size command {pointer-2} not work of files? It works fine if I just manually input the size but otherwise it just copy's one bite.

As far as I know, that works for files. Make sure you're reading a 2-byte value by appending r to the closing brace. If this isn't the issue, I can't immediately offer any ideas to fix it.

On a different subject is there a way to run already compiled programs (including the ability to call subroutines) to bypass the compiled code limit?
I know about axioms to circumvent this need but I would like to not have to use them.

I know you said you'd like not to use Axioms, but there's really no easy way to do what you're specifying without one. Specifically, the RunPrgm Axiom lets you run external assembly programs. If you wanted to run specific subroutines, you'd need to create your own convention, but that shouldn't actually be that hard.

But before turning to this, there may be a few less radical ways to solve this problem. If the issue is that you're running into the executable code limit, which is about 8KB, try compiling your code as an application or using the Fullrene Axiom. Both remove the executable code limit, although the total size of your code and data combined is limited to 16KB for applications and however much RAM the user has available (you can generally expect about 20KB) for programs using Fullrene. Also, Fullrene is known be a bit unreliable.

If the issue is that your application or program is too large due to containing lots of data, try externalizing data into appvars to keep the size of your actual program to a minimum. There's no clear/documented way to do this, but if you'd like to, ask and ye shall receive help.

For self modifying code what numbers correspond to which command tokens?

If you're aiming to change more than just a numeric value in code, SMC is probably not the way to go, because code can vary wildly in size and format based on what it's doing. In what context are you imagining using SMC? I'd imagine that there's probably a more reasonable solution.
« Last Edit: November 01, 2015, 08:46:07 pm by Runer112 »

Offline E37

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +23/-0
  • Trial and error is the best teacher
    • View Profile
Re: Reading programs in Axe
« Reply #12 on: November 01, 2015, 09:15:05 pm »
zStart dosen't cause any ram wipes I meant that zStart would run the restore program.
For self modifying code I would like to try to have the program insert a comment when I overflow an array (which I commonly do).
I am not sure how to check for an overflow. I know I could just display text to the screen but SMC is way cooler.
I'm still around... kind of.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Reading programs in Axe
« Reply #13 on: November 01, 2015, 09:20:29 pm »
SMC generally means modifying the currently-running executable, which is different from the source code. So even if you did this, the results would not be visible later. Simply displaying information like this is the easiest (and the sane) way to go.

Offline E37

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +23/-0
  • Trial and error is the best teacher
    • View Profile
Re: Reading programs in Axe
« Reply #14 on: November 03, 2015, 05:29:23 pm »
I have decided to go ahead with the small font program editor. So far I have have figured how to convert back and forth form decimal and tokens (If  = 206).
I am not sure whether to go with writing out programs by letters (which would be easier to display and make the editor smaller) or by tokens (which would make the editor much bigger but the saved files smaller).
It looks like reading and writing the programs will be the hardest part (so I can compile code written in the editor or edit it in the basic editor also).

It would be really cool if it could display code like "{L1 +8}" as "boss1hp" if the user declares the name. That way variables can have really long custom names and there (theoretically) is not a name limit.

Any ideas (or ways to do any of this) would be awesome!
« Last Edit: November 03, 2015, 07:45:55 pm by E37 »
I'm still around... kind of.