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.1 Sample binding for AES functions TOS The function 'crys_if' (crystal interface) looks after the proper filling of the control arrays, and performs the actual AES call. It is passed one WORD parameter in d0 containing the funtion's opcode minus 10 multiplied by 4 (for faster table indexing); this gives an index into a table in which the values for control[1], control[2] and control[3] are entered for each individual AES function. AESPB c; int16_t crys_if (int16_t opcode) { int16_t i, *paesb; control[0] = opcode; paespb = &ctrl_cnts[ (opcode-10)*3 ]; for (i = 1; i < 4; i++) control[i] = *paespb++; aes (c); return (int_out[0]); } /* crys_if */ The table used for this could be built up as follows, for instance: .GLOBAL ctrl_cnts .DATA ctrl_cnts: .dc.b 0, 1, 0 ; appl_init .dc.b 2, 1, 1 ; appl_read .dc.b 2, 1, 1 ; appl_write ... ... ... .END A fuller version is given in The Atari Compendium pp. 6.39-41. Note that the rsrc_gaddr call must be special cased in a library if you want to use the crys_if binding to call the AES. See Also: AES bindings GEM