xref: /csrg-svn/sys/tahoe/align/Awrite_word.c (revision 45760)
1*45760Sbostic /*-
2*45760Sbostic  * Copyright (c) 1986 The Regents of the University of California.
3*45760Sbostic  * All rights reserved.
4*45760Sbostic  *
5*45760Sbostic  * This code is derived from software contributed to Berkeley by
6*45760Sbostic  * Computer Consoles Inc.
7*45760Sbostic  *
8*45760Sbostic  * %sccs.include.redist.c%
9*45760Sbostic  *
10*45760Sbostic  *	@(#)Awrite_word.c	7.1 (Berkeley) 12/06/90
11*45760Sbostic  */
1229643Ssam 
1345699Sbostic #include	"align.h"
1429643Ssam 
write_word(infop,word,where)1529643Ssam write_word (infop, word, where)
1629643Ssam process_info	*infop;
1729643Ssam long 		word;
1829643Ssam struct oprnd 	*where;
1929643Ssam /*
2029643Ssam /*	Put the word at the given address in
2129643Ssam /*	tahoe's memory.
2229643Ssam /*
2329643Ssam /*	1. The least significant word is written.
2429643Ssam /*
2529643Ssam /**************************************************/
2629643Ssam {
2729643Ssam 	register struct operand_des *look_at;
2829643Ssam 
2929643Ssam 	look_at = &Table[opCODE].operand[last_operand];
3029643Ssam 	if (! (look_at->add_modes & NOVF))
3129643Ssam 		if (word > 0x7fff || word < -0x8000) overflow_1;
3229643Ssam 	if (! (where->mode & W)) exception(infop, ILL_ADDRMOD);
3329643Ssam 	switch (where->mode & ADDFIELD)	/* Mask out R/W bits */
3429643Ssam 	{
3529643Ssam 	case Add:
3629643Ssam 		put_word (infop, word, where->address);
3729643Ssam 		break;
3829643Ssam 	case Dir:
3929643Ssam 		Replace (infop, where->reg_number, word);
4029643Ssam 		break;
4129643Ssam 	case SPmode:
4229643Ssam 		where->mode = where->mode & ~SPmode | Add;
4329643Ssam 		write_longword (infop, word, where);
4429643Ssam 		break;
4529643Ssam 	default:
4629643Ssam 		printf("Unknown destination in write_word (alignment code)\n");
4729643Ssam 	};
4829643Ssam }
49