xref: /original-bsd/sys/tahoe/align/Awrite_byte.c (revision 2301fdfb)
1 /*	Awrite_byte.c	1.1	86/07/20	*/
2 
3 #include	"../tahoealign/align.h"
4 
5 write_byte (infop,byte, where)
6 process_info	*infop;
7 long		byte;
8 struct oprnd 	*where;
9 /*
10 /*	Put the 'byte' at the given address in
11 /*	tahoe's memory.
12 /*
13 /*	1. Only the least significant byte 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 (byte > 0x7f || byte < -0x80) 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_byte(infop, byte, where->address);
27 		break;
28 	case Dir:
29 		Replace (infop, where->reg_number, byte);
30 		break;
31 	case SPmode:
32 		where->mode = where->mode & ~SPmode | Add;
33 		write_longword (infop, byte, where);
34 		break;
35 	default:
36 		printf("Unknown destination in write_byte (alignment code)\n");
37 	};
38 }
39