00001 #ifndef _S5_CPU_H
00002 #define _S5_CPU_H 1
00003
00004 struct Baustein_Infos
00005 { bool vorhanden;
00006 int AnzahlNetzwerke;
00007 };
00008
00009 struct StruturCode{
00010 int Code;
00011 char MarkeName[10];
00012 int AusgabeZeileStatus;
00013 };
00014
00015 struct StructBefehle {
00016 short Befehl;
00017 short Operand;
00018 short Wert;
00019 char MarkeName[10];
00020 };
00021
00022 struct StructProzess {
00023 bool Bearbeitet;
00024 short Vek;
00025 short Inhalt;
00026 short Akku1;
00027 short Akku2;
00028 };
00029
00030 class CPU_sps
00031 { public:
00032 void popStack(int Op,short wert);
00033 short pushStack(int &Op,short &wert);
00034 int SPS_Interpreter(int BausteinName,int BausteinNr);
00035 bool TImpulse_LowToHighFlanke(short Nr,bool Signal);
00036 bool TImpuls_HighToLowFlanke(short Nr, bool Signal);
00037 bool Zaehler_SET_Impulse_LowToHighFlanke(short Nr,bool Signal);
00038 short SI_Timer(short Nr, short BDC_Zahl, bool Signal);
00039 short SV_Timer(short Nr, short BDC_Zahl, bool Signal);
00040 short SE_Timer(short Nr, short BDC_Zahl, bool Signal);
00041 short SS_Timer(short Nr, short BDC_Zahl, bool Signal);
00042 short SA_Timer(short Nr, short BDC_Zahl, bool Signal);
00043 void Function_Reset_Timer(short Nr, bool Signal);
00044 short Zaehler_ZV(short Nr, bool Signal);
00045 short Zaehler_ZR(short Nr, bool Signal);
00046 unsigned int getBit(unsigned int Operand,unsigned int BitNr);
00047 void SetBit(unsigned int Operand,unsigned int BitNr,unsigned int Signal);
00048 short HexToDez(char *Hexzahl);
00049 void DezToHex(short Dez,char *Hexzahl);
00050 short BinToDez(char *Binzahl);
00051 void DezToBin(short Dez,char * ZahlenStr);
00052 short KT_DezToBCD(char *pChar);
00053 short KZ_DezToBCD(char *pChar);
00054 short BcdToDez(short BCD_Zahl);
00055 short DezToBcd(short Dezimal);
00056 short KT_BcdToDez(short BCD_Zahl,short &Zeit_Basis);
00057 short KZ_BcdToDez(short BCD_Zahl);
00058 short KyToZahl(char *ky_Zahl);
00059 void ZahlToKy(short Dez,char *ky_Zahl);
00060 short Load(short Operand,short Nr);
00061 void ProzessabBild(short* Daten);
00062 void AG_Neustart();
00063 unsigned char EByte[256];
00064 unsigned char AByte[256];
00065 unsigned char MByte[256];
00066 unsigned char ZByte[256];
00067 unsigned char TByte[256];
00068 short Z_KZ[256],Z_Stand[256],ZV_Flanke[256], ZR_Flanke[256];
00069 short T_KT[256],T_Input[256],TLaufZeit[256];
00070 short Zeitraster[256],Reset_Timer[256],TimerZaehler[256],T_sperren[256];
00071 bool MTimerFlanke_LH[256],MTimerFlanke_HL[256];
00072 bool MZaehlerFlanke_LH[256];
00073
00074 int StackPointer;
00075 int WStack[1000];
00076 int OStack[1000];
00077 short Alu,Bit_Register,Akku1, Akku2,zwSpeicher;
00078 bool AluLaden;
00079 int returnWertInterpreter;
00080 short Nr;
00081 bool AG_Stop;
00082 int Befehl,Operand,ZahlenWert,Inhalt;
00083 int BefehlsLaenge[512];
00084 CPU_sps(void);
00085 ~CPU_sps(){};
00086 };
00087
00088 #endif