#ifndef _PROC_H
#define _PROC_H

/*
 * This file and its contents are supplied under the terms of the
 * Mozilla Public License (MPL) version 2.0.  You may only use this
 * file in accordance with the terms of version 2.0 of the MPL.
 *
 * A full copy of the text of the MPL should have accompanied this
 * source.  A copy of the MPL is also available via the Internet at
 * https://www.mozilla.org/en-CA/MPL/2.0.
 *
 * This Source Code Form is "Incompatible With Secondary Licenses",
 * as defined by the Mozilla Public License, v. 2.0.
 *
 * This is the header file for processes (aka coroutines).
 *
 * (C) Copyright Rich Teer 1990, 2023, 2026.
 */

#define address int
#define word unsigned short
#define MAIN 0
#define NUMBER_OF_PROCS 10
#define TRAP_0 0x400040
#define TRAP_1 0x400046
#define TRAP_2 0x40004C
#define TRAP_3 0x400052
#define TRAP_4 0x400058
#define TRAP_5 0x40005E
#define TRAP_6 0x400064
#define TRAP_7 0x40006A
#define TRAP_8 0x400070
#define TRAP_9 0x400076
#define TRAP_10 0x40007C
#define VECTOR_64 0x400082
#define VECTOR_65 0x400088
#define VECTOR_66 0x40008E
#define VECTOR_67 0x400094
#define VECTOR_68 0x40009A
#define VECTOR_69 0x4000A0
#define VECTOR_70 0x4000A6
#define VECTOR_71 0x4000AC

typedef struct proc {
	address sp;						/* This process' Stack Pointer */
	address a0;						/* Space for A0 */
	address a1;						/* Space for A1 */
	address a2;						/* Space for A2 */
	address a3;						/* Space for A3 */
	address a4;						/* Space for A4 */
	address a5;						/* Space for A5 */
	address a6;						/* Space for A6 */
	address d0;						/* Space for D0 */
	address d1;						/* Space for D1 */
	address d2;						/* Space for D2 */
	address d3;						/* Space for D3 */
	address d4;						/* Space for D4 */
	address d5;						/* Space for D5 */
	address d6;						/* Space for D6 */
	address d7;						/* Space for D7 */
	word sr;						/* Space for Status Register */
	address sb;						/* Base address of stack */
} proc_t;

#endif
