2 * Sources of the "ARRAY" group instructions
5 /* $Id: do_array.c,v 2.4 1994/06/24 10:46:01 ceriel Exp $ */
24 /* LAR w: Load array element, descriptor contains integers of size w */
25 LOG(("@A6 DoLAR(%ld)", arg));
26 arr(LAR, arg_wi(arg));
32 /* SAR w: Store array element */
33 LOG(("@A6 DoSAR(%ld)", arg));
34 arr(SAR, arg_wi(arg));
40 /* AAR w: Load address of array element */
41 LOG(("@A6 DoAAR(%ld)", arg));
42 arr(AAR, arg_wi(arg));
46 /********************************************************
49 * 1. The address of the descriptor is popped. *
50 * 2. The index is popped. *
51 * 3. Calculate index - lower bound. *
52 * 4. Check if in range. *
53 * 5. Calculate object size. *
54 * 6. Perform the correct function. *
55 *********************************************************/
57 PRIVATE arr(type, elm_size)
58 int type; /* operation TYPE */
59 size elm_size; /* ELeMent SIZE */
61 register ptr desc = dppop(); /* array DESCriptor */
62 register size obj_size; /* OBJect SIZE */
63 register long diff = /* between index and lower bound */
64 spop(elm_size) - mem_lds(desc, elm_size);
65 register ptr arr_addr = dppop();/* ARRay ADDRess */
67 if (must_test && !(IgnMask&BIT(EARRAY))) {
68 if (diff < 0 || diff > mem_lds(desc + elm_size, elm_size)) {
72 obj_size = mem_lds(desc + (2*elm_size), elm_size);
73 obj_size = arg_o(((long) obj_size));
74 spoilFRA(); /* array functions don't retain FRA */
77 push_m(arr_addr + diff * obj_size, obj_size);
80 pop_m(arr_addr + diff * obj_size, obj_size);
83 dppush(arr_addr + diff * obj_size);