Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 127 users online: 7 members, 89 guests and 31 bots. Members: Deep Thought, DHerls, drywood, Eeems, geekboy1011. Bots: Spinn3r (3), MSN/Bing (3), Magpie Crawler (3), VoilaBot (3), Googlebot (19).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
|
| Author |
Message |
|
ACagliano
Super-Expert

Joined: 08 Feb 2010 Posts: 924
|
Posted: 16 Jan 2012 12:02:05 am Post subject: Swapping Flash Pages |
|
|
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. _________________ -ACagliano
Current Projects
Legend of Zelda. "Ganon's Rage"
51% |
|
| Back to top |
|
|
Xeda112358
Power User

Joined: 09 Nov 2010 Posts: 353
|
Posted: 16 Jan 2012 01:02:32 am Post subject: |
|
|
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 :/ |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55751 Location: Earth, Sol, Milky Way
|
Posted: 16 Jan 2012 09:25:30 am Post subject: |
|
|
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. _________________
 |
|
| Back to top |
|
|
ACagliano
Super-Expert

Joined: 08 Feb 2010 Posts: 924
|
Posted: 16 Jan 2012 10:02:48 am Post subject: |
|
|
Well, I was actually interested in, say, calling the DCS GUI functions from within another app. _________________ -ACagliano
Current Projects
Legend of Zelda. "Ganon's Rage"
51% |
|
| Back to top |
|
|
Xeda112358
Power User

Joined: 09 Nov 2010 Posts: 353
|
Posted: 16 Jan 2012 12:47:05 pm Post subject: |
|
|
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  |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55751 Location: Earth, Sol, Milky Way
|
Posted: 16 Jan 2012 01:24:56 pm Post subject: |
|
|
| 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  | 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. _________________
 |
|
| Back to top |
|
|
ACagliano
Super-Expert

Joined: 08 Feb 2010 Posts: 924
|
Posted: 08 Feb 2012 07:02:03 pm Post subject: |
|
|
.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? _________________ -ACagliano
Current Projects
Legend of Zelda. "Ganon's Rage"
51% |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55751 Location: Earth, Sol, Milky Way
|
Posted: 08 Feb 2012 07:45:01 pm Post subject: |
|
|
No, because it's in another App. .branch is only for routines in your own app, on any of its pages. _________________
 |
|
| Back to top |
|
|
ACagliano
Super-Expert

Joined: 08 Feb 2010 Posts: 924
|
Posted: 09 Feb 2012 09:14:51 am Post subject: |
|
|
Is there any way, at all, to use a routine from another app? _________________ -ACagliano
Current Projects
Legend of Zelda. "Ganon's Rage"
51% |
|
| Back to top |
|
|
benryves

Cemetech Expert

Joined: 12 Aug 2008 Posts: 1359 Location: London, United Kingdom
|
Posted: 09 Feb 2012 09:29:35 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
|
ACagliano
Super-Expert

Joined: 08 Feb 2010 Posts: 924
|
Posted: 09 Feb 2012 09:40:17 am Post subject: |
|
|
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? _________________ -ACagliano
Current Projects
Legend of Zelda. "Ganon's Rage"
51% |
|
| Back to top |
|
|
benryves

Cemetech Expert

Joined: 12 Aug 2008 Posts: 1359 Location: London, United Kingdom
|
Posted: 09 Feb 2012 09:43:29 am Post subject: |
|
|
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. |
|
| Back to top |
|
|
|
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
|
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
|
© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.028229 seconds.
|