1 /*-
2 * Copyright (c) 1986 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Computer Consoles Inc.
7 *
8 * %sccs.include.redist.c%
9 *
10 * @(#)Awrite_word.c 7.1 (Berkeley) 12/06/90
11 */
12
13 #include "align.h"
14
write_word(infop,word,where)15 write_word (infop, word, where)
16 process_info *infop;
17 long word;
18 struct oprnd *where;
19 /*
20 /* Put the word at the given address in
21 /* tahoe's memory.
22 /*
23 /* 1. The least significant word is written.
24 /*
25 /**************************************************/
26 {
27 register struct operand_des *look_at;
28
29 look_at = &Table[opCODE].operand[last_operand];
30 if (! (look_at->add_modes & NOVF))
31 if (word > 0x7fff || word < -0x8000) overflow_1;
32 if (! (where->mode & W)) exception(infop, ILL_ADDRMOD);
33 switch (where->mode & ADDFIELD) /* Mask out R/W bits */
34 {
35 case Add:
36 put_word (infop, word, where->address);
37 break;
38 case Dir:
39 Replace (infop, where->reg_number, word);
40 break;
41 case SPmode:
42 where->mode = where->mode & ~SPmode | Add;
43 write_longword (infop, word, where);
44 break;
45 default:
46 printf("Unknown destination in write_word (alignment code)\n");
47 };
48 }
49