Author Topic: ASM code and program editoring  (Read 5807 times)

0 Members and 1 Guest are viewing this topic.

Offline rizoom

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 11
  • Rating: +1/-0
    • View Profile
ASM code and program editoring
« on: April 05, 2011, 12:15:22 pm »
Hi,

I saw that in the Axe Parser application, when an error occurs, it is always possible to press the "prgm" button, and it opens the program editor exactly where the error is located.

Because it is sometimes very painful to scroll down the entire program, I would like to make an Axe Parser program that can open another program at the location I want.

Is there an ASM code for that? How can I do?

Rizoom

Sorry if there are some english mistakes (I'm french)

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: ASM code and program editoring
« Reply #1 on: April 05, 2011, 12:18:11 pm »
I'm not sure how to do that, sorry :/ I am curious, too. It will probably involve installing hooks, though.

Offline rizoom

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 11
  • Rating: +1/-0
    • View Profile
Re: ASM code and program editoring
« Reply #2 on: April 05, 2011, 12:24:38 pm »
What's that?

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: ASM code and program editoring
« Reply #3 on: April 05, 2011, 12:29:28 pm »
Are you familiar with Celtic 3 or xLIB? They use hooks that change the way commands work. There might be a hook to change how errors work.

Sorry, my french is horrible XD :

Êtes-vous familiare avec les apps Celtic 3 et xLIB? Ils utilisent des <<hooks>> pour changer les commands. Peut-être il y a un <<hook>> pour les erreurs?

Offline FloppusMaximus

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +57/-5
    • View Profile
Re: ASM code and program editoring
« Reply #4 on: April 05, 2011, 09:22:02 pm »
I don't know how the Axe parser does it.  But what I would do is this:

- set parseVar to the name of the program, begPC and endPC to the starting and ending addresses, and curPC to the location of the error - just as if you're really executing the program
- set errNo to a valid error code greater than 128, indicating an editable error
- reset the stacks (B_CALL ResetStacks / ld sp, (onSP))
- load the cxError context (ld a, cxError / B_CALL NewContext0)
- and send a k2 keycode (ld a, k2 / B_JUMP MonForceKey)

This can only be done by a Flash app.

From an Asm( program, it's simpler: I would simply set up parseVar, begPC, curPC, and endPC, as before, then throw the desired error, and let the user choose whether to Quit or Goto it.  (If the built-in error messages aren't enough for you, you can use AppErr1/AppErr2 to display a custom error message.)  I don't think it would be worth trying to do anything fancier, and anything fancier would be likely to break in nasty ways.

Shell programs absolutely cannot do this kind of thing ever.

Edit: Oops, I made a couple of mistakes there.  You want an error code with bit 7 set, not bit 0, and it does have to be a valid error code.  And directly sending kGoto doesn't quite work because there's still a popup active.
« Last Edit: April 05, 2011, 10:48:08 pm by FloppusMaximus »

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: ASM code and program editoring
« Reply #5 on: April 06, 2011, 07:29:02 pm »
Wouldn't this force the program to scroll to the error rather than instantly appearing at the error?  Or does this do that for you when you set curPC?
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline FloppusMaximus

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +57/-5
    • View Profile
Re: ASM code and program editoring
« Reply #6 on: April 08, 2011, 12:00:43 am »
You're right, that does seem to be the case.  What would you do instead?