1 #ifndef EXHAUST_H 2 #define EXHAUST_H 3 /* exhaust.h: Global constants, structures, and types 4 * $Id: exhaust.h,v 1.1.1.1 2003/08/26 16:57:01 varfar Exp $ 5 */ 6 7 /* This file is part of `exhaust', a memory array redcode simulator. 8 * Copyright (C) 2002 M Joonas Pihlaja 9 * Public Domain. 10 */ 11 12 13 /* global debug level */ 14 #ifndef DEBUG 15 #define DEBUG 0 16 #endif 17 18 19 /* 20 * Global constants 21 * 22 */ 23 24 #define MAXLENGTH 100 25 /* max length of warrior */ 26 27 28 /* 29 * Global types 30 * 31 */ 32 33 /* misc. integral types */ 34 typedef unsigned char u8_t; 35 typedef unsigned short u16_t; 36 typedef unsigned long u32_t; 37 typedef long s32_t; 38 39 /* Choose an appropriate field_t width. In a field_t variable 40 * we hold unsigned integers in 0..CORESIZE-1 41 */ 42 #define FIELD_T_WIDTH 16 43 44 #if FIELD_T_WIDTH <= 8 45 typedef u8_t field_t; 46 #elif FIELD_T_WIDTH <= 16 47 typedef u16_t field_t; 48 #else 49 typedef u32_t field_t; 50 #endif 51 52 /* 53 * Instructions in core: 54 */ 55 typedef struct insn_st { 56 u16_t in; /* flags, opcode, modifier, a- and b-modes */ 57 field_t a, b; /* a-value, b-value */ 58 } insn_t; 59 60 61 /* 62 * Warrior struct 63 */ 64 typedef struct warrior_st { 65 insn_t code[ MAXLENGTH ]; /* code of warrior */ 66 unsigned int len; /* length of -"- */ 67 unsigned int start; /* start relative to first insn */ 68 69 int have_pin; /* does warrior have pin? */ 70 u32_t pin; /* pin of warrior or garbage. */ 71 72 /* info fields -- these aren't automatically set or used */ 73 char *name; 74 int no; /* warrior no. */ 75 } warrior_t; 76 77 78 #endif /* EXHAUST_H */ 79