xref: /original-bsd/sys/tahoe/align/Awrite_word.c (revision 60c3b96a)
1 /*	Awrite_word.c	1.1	86/07/20	*/
2 
3 #include	"../tahoealign/align.h"
4 
5 write_word (infop, word, where)
6 process_info	*infop;
7 long 		word;
8 struct oprnd 	*where;
9 /*
10 /*	Put the word at the given address in
11 /*	tahoe's memory.
12 /*
13 /*	1. The least significant word is written.
14 /*
15 /**************************************************/
16 {
17 	register struct operand_des *look_at;
18 
19 	look_at = &Table[opCODE].operand[last_operand];
20 	if (! (look_at->add_modes & NOVF))
21 		if (word > 0x7fff || word < -0x8000) overflow_1;
22 	if (! (where->mode & W)) exception(infop, ILL_ADDRMOD);
23 	switch (where->mode & ADDFIELD)	/* Mask out R/W bits */
24 	{
25 	case Add:
26 		put_word (infop, word, where->address);
27 		break;
28 	case Dir:
29 		Replace (infop, where->reg_number, word);
30 		break;
31 	case SPmode:
32 		where->mode = where->mode & ~SPmode | Add;
33 		write_longword (infop, word, where);
34 		break;
35 	default:
36 		printf("Unknown destination in write_word (alignment code)\n");
37 	};
38 }
39