loki@moncam.co.uk (Never Kid A Kidder) (09/26/89)
I've read as many different definitions of AES/VDI as I have documents on these chaps, and my head is in danger of falling off. I've looked at the Sozobon library sources, and it would appear that AES calls are made with a trap #2, with the AES opcode in d0 and some kind of parameter in d1. However, my VDI manual says you need to set up a parameter block consisting of pointers to a control array, an input parameter array, an input point coordinate array, an output parameter array and an output point coordinate array, with the opcode in the first byte of the control array, and bung that into d0 - nothing about d1 mentioned here - and then do a trap #2. I have a complete, if obscure, description of VDI, but NOTHING on AES apart from the code in crystal.s in the Sozobon library, which gives a list of function numbers, but not what they do. I therefore have no idea how to call AES. Sooo... (1) do I have AES or VDI? I'm running a very early TOS. (2) do AES and VDI differ in the ways I have described above, or have I misread something? (3) Can anyone give me a help file, or even a source listing for AES, so that I can actually use it? (4) Books? Will Abacus' ``GEM Programmer's Ref'' help me out with AES? Thanks in advance to anyone that can help. -- Harry Fearnhamm, EMAIL: harry@moncam.co.uk Monotype ADG, ...!ukc!acorn!moncam!harry Science Park, VOICE: +44 (0)223 420018 Cambridge, FAX: +44 (0)223 420911 CB4 4FQ, ENGLAND.
steve@thelake.UUCP (Steve Yelvington) (09/27/89)
Warning: This is long and includes a bunch of C code. Skip it now or forever hold your peace... [In <LOKI.89Sep26121943@marvin.moncam.co.uk> loki@moncam.co.uk writes...] > I've read as many different definitions of AES/VDI as I have documents > on these chaps, and my head is in danger of falling off. I've looked > at the Sozobon library sources, and it would appear that AES calls are > made with a trap #2, with the AES opcode in d0 and some kind of > parameter in d1. However, my VDI manual says you need to set up a > parameter block consisting of pointers to a control array, an input > parameter array, an input point coordinate array, an output parameter > array and an output point coordinate array, with the opcode in the > first byte of the control array, and bung that into d0 - nothing about > d1 mentioned here - and then do a trap #2. The AES procedure is to place a parameter block pointer in d1 and a "magic number" of 200 in d0. All the function-specific information is contained in the arrays. You probably could do the whole set of bindings with the C preprocessor if you drank enough coffee. > I have a complete, if obscure, description of VDI, but NOTHING on AES > apart from the code in crystal.s in the Sozobon library, which gives a > list of function numbers, but not what they do. I therefore have no > idea how to call AES. > > Sooo... > > (1) do I have AES or VDI? I'm running a very early TOS. Yes. Absolutely. Even "thelake Mark 1," my homely 1985-model ST that died last year, had it. > (2) do AES and VDI differ in the ways I have described above, or have > I misread something? AES is a library of high-level services. It is implemented in ways that are similar to that of the VDI, but they are quite distinct. For details, see below. > (3) Can anyone give me a help file, or even a source listing for AES, > so that I can actually use it? Ask the archive-server%panarthea@sun.com to send you Ian Lepore's GEMFAST AES/VDI libraries, which work with Sozobon C, Laser C, Alcyon C and/or MadMac assembler. Source code is available as well as the bindings libraries. All you have to do is call the proper functions and link the GEM libraries at compile time. It's free. I wrote an almost complete GEM AES binding library in C when I was testing a prerelease copy of the Sozobon compiler. It was not hard, just tedious. Before I got around to grappling with the VDI, I discovered a set of Alcyon-compatible bindings written in assembler by Don Farmer, so I gave up the project. No use in reinventing the wheel. I now use Ian's bindings 90% of the time, and fall back on Don's when I get hit by a bug. Ian's bindings are more complete and generally are smaller and faster. For curiosity's sake, here is some source code from my original bindings. Before you read it, consider: (1) I am not a registered Atari developer, just a basement hacker. (2) I am not a professional programmer. (3) I only took one computer science class in my life, and that was back in the days of the Commodore PET. (3) I do not always know what I'm talking about, but the code seems to work. (4) I had intended to get around to commenting and documenting the following, but didn't. There's an object lesson in there someplace. O/ --cut here O\---------------------------------------- /*************************************************** The AES Application Manager library ***************************************************/ #define WORD int WORD control[4], global[15], int_in[16], int_out[7]; char *addr_in[2], *addr_out[1]; WORD appl_init() { return _aesop(10); } WORD appl_read(id, length, pbuff) WORD id, length; char *pbuff; { int_in[0] = id; int_in[1] = length; addr_in[0] = pbuff; return _aesop(11); } WORD appl_write(id, length, pbuff) WORD id, length; char *pbuff; { int_in[0] = id; int_in[1] = length; addr_in[0] = pbuff; return _aesop(12); } WORD appl_find(ap_filename) char *ap_filename; /* * find the GEM application ID of another application in the system. * the filename of the application MUST contain exactly eight characters; * if necessary, pad it with spaces to fill it out. */ { addr_in[0] = ap_filename; return _aesop(13); } WORD appl_tplay(aptmen, aptnum, aptscale) char *aptmen; WORD aptnum, aptscale; { addr_in[0] = aptmen; int_in[0] = aptnum; int_in[1] = aptscale; return _aesop(14); } WORD appl_trecord(aptmen, aptcount) char *aptmen; WORD aptcount; { addr_in[0] = aptmen; int_in[0] = aptcount; return _aesop(15); } WORD appl_exit() { return _aesop(19); } O/ --cut here O\---------------------------------------- /* aeslib.h -- included in all modules except for appl_* module */ #ifndef WORD #define WORD int /* 16-bit value */ #endif #ifndef OBJECT #define OBJECT char #endif extern WORD control[4], global[15], int_in[16], int_out[7]; extern char *addr_in[2], *addr_out[1]; O/ --cut here O\---------------------------------------- /************************************************************************* The AES file selector library *************************************************************************/ #include "aeslib.h" WORD fsel_input(ipath, isel, iexbutton) char *ipath, *isel; WORD *iexbutton; { addr_in[0] = ipath; addr_in[1] = isel; _aesop(90); *iexbutton = int_out[1]; return int_out[0]; } O/ --cut here O\---------------------------------------- Anyway, you get the idea. Basically, each function stuffs its arguments into the proper array "mailboxes", then calls _aesop, which looks up the AES control codes from the _cntrl_cnts: array in crystal.s, then puts the AES parameter block address on the stack and calls crystal. (crystal itself is commented out in crystal.s; you should restore it if you want to roll your own library.) The AES parameter block is an array of pointers to the various mailboxes. I think control[1 .. 3] contain the number of ints, points, addresses to be supplied. (If I had written a few comments here I'd remember, wouldn't I?) Here's aesop.c: O/ --cut here O\---------------------------------------- #include "aeslib.h" extern char ctrl_cnts[115][3]; WORD *aespb[6] = { control, global, int_in, int_out, (WORD *)addr_in, (WORD *)addr_out}; /* * function _aesop(opcode) * sets the control arrays, kicks AES into action, * and returns int_out[0] for good measure. */ WORD _aesop(opcode) WORD opcode; { register int x; x = opcode - 10; control[0] = opcode; control[1] = (int) ctrl_cnts[x][0]; control[2] = (int) ctrl_cnts[x][1]; control[3] = (int) ctrl_cnts[x][2]; crystal(aespb); return int_out[0]; } O/ --cut here O\---------------------------------------- All the above is the result of my tinkering, plus the encouragement and moral support of dal and jls, and is in the public domain. If there is sufficient interest, I can post the whole AES library (minus a couple of unimplemented functions) to comp.src.atari.st. Steve Yelvington, up at the lake in Minnesota ... pwcs.StPaul.GOV!stag!thelake!steve (Usenet) ... {playgrnd,moundst,class68}!thelake!steve (Citadel)