I confused as to how DoorsCS passes information from an associated program to a parent, do it have the same output as the FileOpen routine?If not please explain.I'd also like to know how the FileSaveAs routine works since dcs.cemetech is missing its page. I currently have 3 projects that all of which need these instructions. (MusicMaker:25%, Paint:%95, Secret(it's a surprise!):%10)
In your header, include this:

Code:
   .dw Apstart         ;the routine to open files.  DCS will start you here instead of at $9D95 if an AP file is pending
   .db $31,$7F         ;argh, this be an APMain
   .db $02            ;number of accepted filetypes

as described here: http://dcs.cemetech.net/index.php?title=ASM_Header_%28Doors_CS_6%29#Header_for_AP-Enabled_Programs

At Apstart, have this:

Code:
Apstart:
call FileOpen

As described here: http://dcs.cemetech.net/index.php?title=FileOpen
A pointer to the associated file will be stored in hl.
*I know the header, my programs always have it* I need to know how you load the data from an associated program when you click on it from the desktop, (NOT USING FILEOPEN!) I know it's possible because DocDE6 does it.
Notice that FileOpen has no inputs? Just call FileOpen and see if it works, that's the best I can find out from the API.
An alternate possibility that the results of FileOpen are already there and that hl is already pointing to the file, as evidenced by "When the user runs the data files, Doors CS recognizes them as AP files and instead launches the viewer program, giving it pointers to the data file as necessary."
SirCmpwn wrote:
At Apstart, have this:

Code:
Apstart:
call FileOpen

As described here: http://dcs.cemetech.net/index.php?title=FileOpen
A pointer to the associated file will be stored in hl.
Incorrect. I don't actually have it well-documented. Here's what Document DE does at APStart:


Code:
Apstart:                              ;set up ap pointers now
   push ix
   pop hl
   ld de,-8
   add hl,de
   ld (SavedFilePtr),hl
   dec hl
   dec hl
   bcall(_ldhlind)
   ld (OldSize),hl
   ld a,1
   ld (OpenFileFlag),a
   jp RenderMain


So if your program starts at APStart instead of at $9d95, it will have a pointer to the FIRST *DATA* BYTE of the AP file in ix, which I really don't have written down anywhere (sorry guys). The first byte of the program itself is at ix-8, before the header (the header is in ix-8 through ix-1), and the size of the full AP file is in its normal place at ix-10 and ix-9. Makes sense? Smile I'll update the wiki.

Edit: Of course note that SavedFilePtr, OldSize, and OpenFileFlag are just variables that Document DE has, not part of the AP system as a whole. All you need to know is that Doors CS will give your program ix.

Edit #2: Updated this page with more information: http://dcs.cemetech.net/index.php?title=Associated_Programs

Edit #3: As requested by the original poster, I also recreated the missing FileSaveAs page: http://dcs.cemetech.net/index.php?title=FileSaveAs
Sweeet! Now I can finish up a few projects! Very Happy

One more thing, the documentation for the FileSaveAs routine is missing from dcs.cemetech.net. Can you post it here?
xenonparadox wrote:
Sweeet! Now I can finish up a few projects! Very Happy

One more thing, the documentation for the FileSaveAs routine is missing from dcs.cemetech.net. Can you post it here?


KermMartian wrote:
Edit #3: As requested by the original poster, I also recreated the missing FileSaveAs page: http://dcs.cemetech.net/index.php?title=FileSaveAs
As noted, I recreated that page. Razz
Shanks! While waiting for a reply to the first question, I managed to find out how to locate data in archive. Whoever first made the routine had a glitch and it took me 3 hours to find out what he did wrong in a routine I had no sense of what was going on and even managed to change the output to put the size in BC instead of DE. So I guess this kinda killed 3 birds with 1 stone. Razz
xenonparadox wrote:
Shanks! While waiting for a reply to the first question, I managed to find out how to locate data in archive. Whoever first made the routine had a glitch and it took me 3 hours to find out what he did wrong in a routine I had no sense of what was going on and even managed to change the output to put the size in BC instead of DE. So I guess this kinda killed 3 birds with 1 stone. Razz
Awesome, glad to hear it. Would you mind posting the source of this routine, annotating the fix you made, so I or someone else could take a look and see how it works, any possible optimizations, etc?
  
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