xref: /original-bsd/sys/tahoe/align/Awrite_byte.c (revision f3c03cba)
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_byte.c	7.1 (Berkeley) 12/06/90
11  */
12 
13 #include	"align.h"
14 
15 write_byte (infop,byte, where)
16 process_info	*infop;
17 long		byte;
18 struct oprnd 	*where;
19 /*
20 /*	Put the 'byte' at the given address in
21 /*	tahoe's memory.
22 /*
23 /*	1. Only the least significant byte 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 (byte > 0x7f || byte < -0x80) 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_byte(infop, byte, where->address);
37 		break;
38 	case Dir:
39 		Replace (infop, where->reg_number, byte);
40 		break;
41 	case SPmode:
42 		where->mode = where->mode & ~SPmode | Add;
43 		write_longword (infop, byte, where);
44 		break;
45 	default:
46 		printf("Unknown destination in write_byte (alignment code)\n");
47 	};
48 }
49