Setting up AxeDCS in an AP-enabled program
AxeDCS works a bit differently with AP-enabled program, a.k.a viewers.
Your AP-enabled programs will need a special header to work correctly ; a header that Axe can't provide. So if you want to compile an AP-enabled program :
- copy the content of DCSAP.8xp at the really beginning of your file, before any code and right after the Axe source header
- AP-enabled programs starts at a different address than the beginning of the code when it's opened through a file. Set the
beginning of the code that open the current file with
:Lbl APStart :Asm(DDE5E1)->*variable name here*
and then the indicated variable will contain a pointer on the opened file (see below for more info).
- compile it for Noshell ; that's very important. The program will still not run without DCS7.
Don't forget that these parts are only required if your program is AP-enabled. If it's not, don't apply any of these latters and compile your program for DoorsCS 7.
Using files for AP-enabled programs
Files are special ASM programs that contains data to be interpreted by a particular program called a viewer. If you program a viewer (or as I said before, an AP-enabled program), you might want to make it able to open and read files.
First, set the number of supported file types at the end of the header, at the address 9DA5h (see the comments in the header or DCSAP.8xp), and once you're done with it you can set the supported file types. A file type is a set of 3 bytes which doesn't have any other sense than the one you give to it.
But how to create recognizable files ? That's pretty easy. All files have a common format that is to be respected :
BB6D <- if you compile your file for Noshell with Axe, it's automatically added C9 <- Return in Axe 3180 <- required, indicates that it's an AP file 000000 <- the 3-byte filetype ...datas here...
And that's all. Then, when the user clicks on a file that has one of the type you set, DCS7 automatically opens the corresponding viewer, load the file, and using the Asm() line I provided above, returns the first byte of data of the file (that is, the byte after the 8-bytes header, so you don't have to add any value to access the file's core).