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