Topic : TOS - The Operating System Author : Version : tos.hyp (December 19, 2008) Subject : Programmieren/Atari Nodes : 3010 Index Size : 93790 HCP-Version : 5 Compiled on : Atari @charset : atarist @lang : @default : Title @help : @options : +g -i -s +x +zz -t4 @width : 70 View Ref-File8.2.10 AES bindings TOS The AES is called via a single subprogram that is passed 6 parameters; these are addresses of various arrays that are used for input/output communications. To call an AES function, the following parameter block must be populated with the addresses of the arrays described below: typedef struct { int16_t *cb_pcontrol; /* Pointer to control array */ int16_t *cb_pglobal; /* Pointer to global array */ int16_t *cb_pintin; /* Pointer to int_in array */ int16_t *cb_pintout; /* Pointer to int_out array */ int16_t *cb_padrin; /* Pointer to adr_in array */ int16_t *cb_padrout; /* Pointer to adr_out array */ } AESPB; The address of this parameter block (which lies on the stack) must be entered in register d1, and subsequently register d0.w must be filled with the magic value 0xc8 (200). With a TRAP #2 system call the AES can then be called directly. For the Pure-Assembler this could look like this, for instance: .EXPORT aes ; Export function .CODE ; Start of the code-segment aes: MOVE.L 4(sp),d1 ; Address of the parameter blocks MOVE.W #200,d0 ; Opcode of the AES TRAP #2 ; Call GEM RTS ; And exit .END ; End of the module There is no clear information available about which registers may be altered. In fact, however, the corresponding routines in ROM save all registers. Now to the individual arrays. With each field, designated input or output functions can be performed. The following apply: int16_t control[5] With this field information about the called function and its parameters can be determined. The following apply: control[0] = Function number (opcode) control[1] = Number of elements in int_in array the function is being sent control[2] = Number of elements in int_out array the function is being sent control[3] = Number of elements in addr_in array the function returns control[4] = Number of elements in addr_out array the function returns There is no clear information about which elements must be set before an AES call. It is required in each case for elements [0],[1] and [3]. It seems less sensible for the elements [2] and [4] - after all the AES functions know how many values they return in the output fields. int16_t global[15] This field contains global data for the application and is used partly by appl_init and partly by other AES functions, and is filled automatically. The following apply: global[0] Version number of the AES global[1] Number of applications that can run concurrently; with a value of -1 there is no limit global[2] Unique ID number of the application global[3,4] Miscellaneous information that only has meanning for the application, and can be set and read by it global[5,6] Pointer to a list of pointers to the object trees of the application (is set by rsrc_load) global[7,8] Address of the memory reserved for the resource file. Only documented by Digital Research and not by Atari. global[9] Length of the reserved memory. Only documented by Digital Research and not by Atari. global[10] Number of colour planes. Only documented by Digital Research and not by Atari. global[11,12] Reserved global[13] Maximum height of a character, which is used by the AES for the vst_height call. This entry is only available as of AES Version 4.0, and also only documented by Atari. As of PC-GEM Version 2.0 this value is interpreted as a bit- vector with the drives registered with the desktop (bit 15 = Drive A:). global[14] Minimum height of a character, which is used by the AES for the vst_height call. This entry is only available as of AES Version 4.0, and also only documented by Atari. As of PC-GEM Version 2.0 this value is interpreted as a bit- vector that specifies which of the drives listed in global[13] can be regarded as hard drives. int16_t int_in[16] All 16-bit-sized input parameters are passed with this field. int16_t int_out[10] All 16-bit-sized return values are supplied by the AES via this field. int32_t addr_in[8] This field serves for the transmission of pointers (e.g. pointers to character strings) to the AES functions. int32_t addr_out[2] All 32-bit-sized return values are supplied by the AES via this field. Warning: If the operating system supports threads, then it is impera tive that a multithread-safe library is used. In particular one must ensure that each thread receives its own global field (see above). See Also: Sample binding VDI bindings TOS list