Source code for /engineering/bos/BOS.HOriginal file BOS.H
   1 /*
   2 	BattleOS : Engage battling programs.
   3 
   4 	Copyright (C) 1993 Erich P Gatejen    ALL RIGHTS RESERVED
   5 
   6 
   7 	File     : BOS.h
   8 	Purpose  : Header file for the BattleOS Assembler
   9 
  10 */
  11 
  12 /* Defines */
  13 #define   FALSE	0
  14 #define   TRUE      1
  15 
  16 
  17 /* Define machine instruction tokens */
  18 #define   DAT       0    /* Data						 */
  19 #define	MOV		1	/* Move                             */
  20 #define   CMP		2    /* Compare                          */
  21 #define   JE		3    /* Jump on =					 */
  22 #define   JB        4    /* Jump below					 */
  23 #define   JA        5    /* Jump above					 */
  24 #define   JMP       6    /* Jump						 */
  25 #define   INC		7    /* Increment				      */
  26 #define   DEC       8    /* Decrement                        */
  27 #define   ADD       9    /* Add						 */
  28 #define   SUB      10    /* Subtract					 */
  29 #define   LOP      11    /* Loop of register C			 */
  30 
  31 /* Define BattleOS instruction tokens */
  32 #define   RND      12    /* Random number				 */
  33 #define   WT       13    /* Put wait					 */
  34 #define   TMR      14    /* Time event                       */
  35 #define   HLT      15    /* Halt program till timer or wait  */
  36 
  37 #define   Numtokens 	16 /* Number of defined tokens	 */
  38 
  39 #define   TInstr_RegionM	   224	/* For masking	non-token	 */
  40 
  41 #define   TauntPresent	   128  /* Set taunt present bit    */
  42 #define   Max_Taunt           7  /* Maximum taunt number ( start at 0 ) */
  43 
  44 /* Define Operand Tokens */
  45 #define   NOTOKEN           0  /* No token for this operand  */
  46 #define	REG			   1  /* Direct register			 */
  47 #define   PTR			   2  /* Pointer				 */
  48 #define   MEM               4  /* Direct memory	 	      */
  49 #define   IMMEDIATE		   8  /* Immediate value			 */
  50 
  51 /* Register definitions	*/
  52 #define   REGPTRBIT           128			/* Register is a ptr bit */
  53 #define   AREGISTER			'A'
  54 #define   BREGISTER			'B'
  55 #define   CREGISTER			'C'
  56 #define   AREGPTR 			(AREGISTER + REGPTRBIT)
  57 #define   BREGPTR			(BREGISTER + REGPTRBIT)
  58 #define   CREGPTR 			(CREGISTER + REGPTRBIT)
  59 
  60 
  61 /* General defines */
  62 #define   PROGNAMESIZE       32  /* Size of program name     */
  63 
  64 
  65 /* Type definitions */
  66 
  67 /* Define pointer types */
  68 
  69 
  70 /* Define structures */
  71 
  72 /* Define the 'instruction' structure.  Actually each core location. */
  73 typedef struct Instr{
  74 					unsigned char  Token;	 /* Token of instruction  */
  75 					unsigned char  OpToken;   /* Token of operand type */
  76 					int            Operand1;  /* Operand 1			 */
  77 					int			Operand2;  /* Operand 2             */
  78 					unsigned char	OwnerHandl;/* USED by BOS.  Handle  */
  79 										 /* to owner of core loc  */
  80 };
  81 
  82 
  83 /* Define taunt */
  84 #define   TAUNTSIZE  	   40
  85 #define 	TAUNTSNUMBER       8   /* Number of taunts         */
  86 typedef  char		Taunt[TAUNTSIZE];
  87 
  88 /* Define Program states	*/
  89 enum  PCB_State  {
  90 				READY_RUN,	/* Execute instruction on cycle */
  91 				HELD,		/* Spawned but held by BOS	  */
  92 				WAIT,          /* Wait event				  */
  93 				NEW,			/* Loaded but not spawned	  */
  94 				KILLED,        /* Program was killed		  */
  95 				UNUSED		/* PCB not used			  */
  96 };
  97 
  98 /* Maximum number of programs (PCBs) and other constants */
  99 #define  MAXPCB	20
 100 #define  BASEPCB     0
 101 #define  NOHANDLE   MAXPCB	/* A programs handle is its PCBs position
 102 						   in the PCBList.  An out-of -range value
 103 						   indicates 'no handle '.			   */
 104 #define  WAITFLAG   128       /* Flags that memory location has a wait
 105 						   placed on it					   */
 106 
 107 
 108 /* Program Control Block */
 109 #define  PNameText	 10
 110 #define  PNameHandle 2		/* Allows for up to 99 unique program names */
 111 
 112 typedef  struct PCB {
 113 				  char			ProgramName[PNameText+PNameHandle+1];
 114 				  unsigned int      InstrPointer;    /* Core IP	   */
 115 				  unsigned int      ProgSize;        /* Load size    */
 116 				  unsigned int    	State;           /* PCB_State    */
 117 				  unsigned int		WaitPointer;     /* Core addr	   */
 118 				  unsigned int      WaitSite;        /* Core addr    */
 119 				  unsigned int      TimerPointer;    /* Core addr    */
 120 				  unsigned int      TickCount;       /* Ticks to go  */
 121                       long			TotalClocks;     /* Total run    */
 122 
 123 				  unsigned int		CoreHeld;        /* Amount owned */
 124 				  unsigned int      WhosCode;		  /* Handle of code */
 125 
 126 				  struct Instr 	A, B, C;         /* Registers      */
 127 				  int			CMPResult;       /* Compare result */
 128 
 129                       Taunt			TauntList[TAUNTSNUMBER];
 130 
 131 };
 132 
 133 /* VERSION DISCRIPTOR... !!!!DO NOT CHANGE!!!!! 		*/
 134 #define  VERSIONDISC    100	   /* indicates v1.00    */
 135 
 136 /* COPYRIGHT NOTICE..... !!!!DO NOT CHANGE!!!!!        */
 137 #define  COPYRIGHTNOTICE "BOS1.00/Copyright Erich P Gatejen 1993/All Rights Reserved"
 138 #define  NOTICESIZE		58
 139 
 140 /* ---- System defines	------ */
 141 #define	MAXCORESPEC	    9000	/* Max size of core */
 142 #define	MINCORESPEC		256  /* Min size of core */
 143 
 144 #define   NOERROR			  0  /* No critical program error         */
 145 #define   ERROR			  1  /* A critical program error exists   */
 146 
 147 #define   MINPCB			  0  /* Minimum PCB handle number         */
 148 
 149 /* ---- MMI defines  ---------- */
 150 #define   MAXCMDSIZE		 60  /* Max inputed command size */
 151 #define   MAXARGSIZE		 15  /* Max arg text size */
 152 #define   MAXARGS			  8  /* Maximum arguments per MMI command */
 153 
 154 
 155 /* -------- TYPEDEFS -----------------------------------------------------*/
 156    typedef  char	ArgText[MAXARGSIZE+1];  /* Text for parsed MMI arg    */
 157 
 158 
 159    enum     MsgModes  { BAREM, TIMEM, SYSCNTM }; /* Which Msg format to use*/