I'm just curious, since I've gotten a bit into app writing, how you would swap a flash page, call a routine on another page, then return to the page you were on.
I typically copy some code to RAM to do that task. For example, if you are not using the region. You can copy the code like this:

Code:

CallIXNextPage:
     ld de,8000h
     push de
     ld hl,CallData
     ld bc,CallDataEnd-CallData
     ldir
     ld (8006h),ix
     ret
CallData:
     in a,(6)
     inc a
     out (6),a
     call yerackshulcall
     in a,(6)
     dec a
     out (6),a
     ret     
CallDataEnd:

You store the location of the call in ix and then you call CallIXNextPage. That will just call something on the next page. That code can be better tailored to what you need, but I am not sure of the circumstances :/
I do almost the exact same thing, except that I throw the new page to be loaded into th eaccumulator before CallData since I generally want to reuse the routine for plenty of different page swaps.
Well, I was actually interested in, say, calling the DCS GUI functions from within another app.
Another thing you can do is keep a spot of memory that contains the page your app is on and then you don't need to save your app page again, you can just load from that spot in memory before restoring the flash page Smile
Xeda112358 wrote:
Another thing you can do is keep a spot of memory that contains the page your app is on and then you don't need to save your app page again, you can just load from that spot in memory before restoring the flash page Smile
The only difficulty there is making sure the code on whatever you call into won't directly or indirectly wipe out (a) the part of memory where your routine stub is and/or (b) the part of memory where the return page is stored.
.in App programming, can I use the .branch directive to add a DCS GUI function to the branch table? Or any other app routine, for that matter?
No, because it's in another App. .branch is only for routines in your own app, on any of its pages.
Is there any way, at all, to use a routine from another app?
Yes. You will first need to swap the relevant application's page in manually; to do this, use the FindApp routine to search for the application and which page it's on. To swap the page in output the page number to port memPageAPort. Naturally, doing so will swap out the page you were previously on, so you'll likely need to copy a small stub of code to RAM so you have a safe location to invoke the function from.

Code:

ld hl, $          ;is there a symbol for the current executing address?
push hl
ld hl, code to copy
ld de, saferam1
ld bc, size of code
ldir
jr z, saferam1


@saferam1
//code I copied
pop hl
jr hl ?? Can I do that?


Is that good?
Don't bother with all that manual pushing and popping - just call saferam1 and ret when you're done.

You might also find the .relocate directive useful.
  
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