Leading the way to the Future
Welcome Guest, Login!
12 Dec 2011 02:08:28 pm by the_mad_joob 8X+ > opening the prgm editor upon exiting an app Quote
Yo there...

Here is where i need help :

I need to find a way to automatically open up the os prgm editor for a defined prgm, right after exiting the application i'm working on.
I precise i don't need to return back to the app code after doing so.
Also, the idea is to be able to make the cursor point to the location i want.
I already have the obj+name and error token address for the concerned prgm.
Before you ask, no need to call _jerror cause my app already displays its own error messages.

If you know "Axe", this is exactly how i want it to work (when [PRGM] is pressed if an error is encountered).
Unfortunately, its creator doesn't answer my call so i hope someone can around here...

Thx in advance =]
14 Dec 2011 06:26:53 am by quigibo Quote
I actually just fixed that routine recently Laughing Maybe Kerm will fix it in DCS too if he didn't already, which I think he might of since that was over a year ago.

Anyway, here goes. There are 2 blanks that need to be filled in depending on which program, and where in the program you plan to jump to. Sorry its not commented...
Code:

EditorExit:
;'HL points to the name of the program to edit'
   ld   hl,_Your_Prgm_Name_
   ld   de,progToEdit
   ld   bc,8
   ldir
   xor   a
   ld   (de),a
   ld   a,kPrgmEd
   B_CALL(_NewContext)
;'BC should hold the offset you would like to jump to'
   ld   bc,_Your_Offset_
   ld   de,(editTop)
   ld   hl,(editTail)
   ldir
   ld   (editCursor),de
   ld   (editTail),hl
   ld   h,b
   ld   l,c
   push   hl
EditorLoop:
   ld   de,(editTop)
   or   a
   sbc   hl,de
   jr   z,EditorFound
   B_CALL(_BufLeft)
   ld   hl,(editCursor)
   ld   a,(hl)
   cp   tEnter
   jr   z,EditorFound
   pop   hl
   inc   hl
   push   hl
   jr   EditorLoop
EditorFound:
   B_CALL(_BufRight)
   B_CALL(_DispEOW)
   pop   hl
   ld   a,h
   or   l
   jr   z,EditorMon
EditorScroll:
   dec   hl
   ld   a,h
   or   l
   jr   z,EditorMon
   push   hl
   B_CALL(_CursorRight)
   pop   hl
   jr   EditorScroll
EditorMon:
   res   2,(iy+50)
   res   7,(iy+20)
   res   3,(iy+5)
   B_JUMP(_Mon)
14 Dec 2011 09:23:08 am by the_mad_joob Quote
Thx man...
I'll give it a try as soon as possible.
U rock =]
16 Dec 2011 05:58:38 pm by the_mad_joob Quote
Just tried it.
It kinda works, except for 2 things :

1) It seems impossible to make the cursor point to a tenter token.
It'll automatically point to the next token instead.
2) It behaves very strangely if there is no tenter token before the inputted offset (in other words, if it's located in the first line of the prgm).

I'll try to figure out why...
17 Dec 2011 10:51:27 pm by quigibo Quote
Oh right, that's because its directly from the Axe source where those effects are what I desire. Remove the "B_CALL(_BufRight)" if you want to be able to put the cursor over a tEnter token. I think this might solve both problems, but I'm not sure.

EDIT: Also move the "jr z,EditorFound" to after the pop inc push thing.
18 Dec 2011 12:32:13 am by the_mad_joob Quote
While doing some tests, i figured out how the whole thing works so i'm gonna modify it to suit my needs.
I actually found a way to avoid both the bufleft and bufright bcalls.

Anyway, there's a place for you in my project credits.
Thx again =]
21 Dec 2011 01:58:27 pm by KermMartian Quote
Glad you were able to get this resolved, The_Mad_Joob.
23 Dec 2011 04:07:10 am by the_mad_joob Quote
I'm glad you're glad.
Thx =]