Basic program operations [PICProgramm.cs]

This commit is contained in:
2017-05-10 12:00:41 +02:00
parent fd747d6c87
commit 65864ecd4e
40 changed files with 3740 additions and 3545 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>

View File

@@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PIC_Simulator
{
class Befehlssatz
{
}
}

View File

@@ -1,68 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace PIC_Simulator
{
public class Einlesen
{
//Globale Variablen der Klasse:
public int LengthArray = 0;
public string[] result;
public int writeToArray(StreamReader sr)
{
// StreamReader jede Zeile in Listenelement schreiben
var list = new List<string>();
string line;
while ((line = sr.ReadLine()) != null)
{ if (!line.StartsWith(" ") )
{
list.Add(line);
}
}
//Schreiben der Listenelemente in String Array
result = list.ToArray();
LengthArray = result.Length -1; //-1 Wegen Start des Arrays bei Index 0!
// MessageBox.Show("Zeilen des Programms:" + LengthArray );
//PCount Variable von Form1 holen und für readExec als Param nutzen
Form1 instForm1 = new Form1();
readExecCode(instForm1.PCounter);
return LengthArray;
}
//Ausführbarer Maschinencode aus Zeile des Arrays herausschneiden
public void readExecCode(int index) {
try
{
result[index] = result[index].Substring(5, 4);
// MessageBox.Show(result[index]);
execCode(index);
}
catch { }
}
public string execCode(int index) {
// MessageBox.Show("Index der Row welche ausgeführt werden soll" + index);
MessageBox.Show("Code der ausgeführt werden soll" + result[index]);
Register Ausführen = new Register();
Ausführen.findOrder(result[index].ToString());
return result[index];
// Hier ist der Start für die Befehlsausführung des PIC bzw. Übergabe an Befehlssatz
// Return übergibt Auszuführenden Code!!
}
}
}

View File

@@ -1,372 +1,365 @@
namespace PIC_Simulator
{
partial class Form1
{
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Verwendete Ressourcen bereinigen.
/// </summary>
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Vom Windows Form-Designer generierter Code
/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.ListViewItem listViewItem2 = new System.Windows.Forms.ListViewItem("INDF");
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.box_CodeView = new System.Windows.Forms.RichTextBox();
this.lbl_path = new System.Windows.Forms.Label();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.cmd_Start = new System.Windows.Forms.Button();
this.cmd_next = new System.Windows.Forms.Button();
this.cmd_reset = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.cmdOpenFile = new System.Windows.Forms.ToolStripMenuItem();
this.programmÖffnenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.beendenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.hilfeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.cmdOpenDoc = new System.Windows.Forms.ToolStripMenuItem();
this.label4 = new System.Windows.Forms.Label();
this.cmdSetClock = new System.Windows.Forms.Button();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.listView1 = new System.Windows.Forms.ListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader7 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader8 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.cmd_Stop = new System.Windows.Forms.Button();
this.lbl_Timer = new System.Windows.Forms.Label();
this.insertTime = new System.Windows.Forms.TextBox();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.SystemColors.Control;
this.label1.Location = new System.Drawing.Point(39, 96);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(0, 17);
this.label1.TabIndex = 1;
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(11, 577);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(105, 17);
this.label2.TabIndex = 2;
this.label2.Text = "Programmpfad:";
//
// box_CodeView
//
this.box_CodeView.Location = new System.Drawing.Point(11, 95);
this.box_CodeView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.box_CodeView.Name = "box_CodeView";
this.box_CodeView.Size = new System.Drawing.Size(833, 462);
this.box_CodeView.TabIndex = 3;
this.box_CodeView.Text = "";
this.box_CodeView.WordWrap = false;
//
// lbl_path
//
this.lbl_path.AutoSize = true;
this.lbl_path.Location = new System.Drawing.Point(116, 577);
this.lbl_path.Name = "lbl_path";
this.lbl_path.Size = new System.Drawing.Size(0, 17);
this.lbl_path.TabIndex = 4;
//
// openFileDialog1
//
this.openFileDialog1.FileName = "openFileDialog1";
//
// cmd_Start
//
this.cmd_Start.Location = new System.Drawing.Point(15, 36);
this.cmd_Start.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.cmd_Start.Name = "cmd_Start";
this.cmd_Start.Size = new System.Drawing.Size(67, 28);
this.cmd_Start.TabIndex = 5;
this.cmd_Start.Text = "Start";
this.cmd_Start.UseVisualStyleBackColor = true;
this.cmd_Start.Click += new System.EventHandler(this.cmd_Start_Click);
//
// cmd_next
//
this.cmd_next.Location = new System.Drawing.Point(168, 38);
this.cmd_next.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.cmd_next.Name = "cmd_next";
this.cmd_next.Size = new System.Drawing.Size(67, 26);
this.cmd_next.TabIndex = 6;
this.cmd_next.Text = "Schritt";
this.cmd_next.UseVisualStyleBackColor = true;
this.cmd_next.Click += new System.EventHandler(this.cmd_next_Click);
//
// cmd_reset
//
this.cmd_reset.Location = new System.Drawing.Point(253, 38);
this.cmd_reset.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.cmd_reset.Name = "cmd_reset";
this.cmd_reset.Size = new System.Drawing.Size(67, 26);
this.cmd_reset.TabIndex = 7;
this.cmd_reset.Text = "Reset";
this.cmd_reset.UseVisualStyleBackColor = true;
this.cmd_reset.Click += new System.EventHandler(this.cmd_reset_Click);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(331, 42);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(112, 17);
this.label3.TabIndex = 8;
this.label3.Text = "Programmzähler";
//
// menuStrip1
//
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24);
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.cmdOpenFile,
this.hilfeToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Padding = new System.Windows.Forms.Padding(5, 2, 0, 2);
this.menuStrip1.Size = new System.Drawing.Size(1397, 28);
this.menuStrip1.TabIndex = 9;
this.menuStrip1.Text = "menuStrip1";
//
// cmdOpenFile
//
this.cmdOpenFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.programmÖffnenToolStripMenuItem,
this.beendenToolStripMenuItem});
this.cmdOpenFile.Name = "cmdOpenFile";
this.cmdOpenFile.Size = new System.Drawing.Size(57, 24);
this.cmdOpenFile.Text = "Datei";
//
// programmÖffnenToolStripMenuItem
//
this.programmÖffnenToolStripMenuItem.Name = "programmÖffnenToolStripMenuItem";
this.programmÖffnenToolStripMenuItem.Size = new System.Drawing.Size(201, 26);
this.programmÖffnenToolStripMenuItem.Text = "Programm öffnen";
this.programmÖffnenToolStripMenuItem.Click += new System.EventHandler(this.programmÖffnenToolStripMenuItem_Click);
//
// beendenToolStripMenuItem
//
this.beendenToolStripMenuItem.Name = "beendenToolStripMenuItem";
this.beendenToolStripMenuItem.Size = new System.Drawing.Size(201, 26);
this.beendenToolStripMenuItem.Text = "Beenden";
this.beendenToolStripMenuItem.Click += new System.EventHandler(this.beendenToolStripMenuItem_Click);
//
// hilfeToolStripMenuItem
//
this.hilfeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.cmdOpenDoc});
this.hilfeToolStripMenuItem.Name = "hilfeToolStripMenuItem";
this.hilfeToolStripMenuItem.Size = new System.Drawing.Size(53, 24);
this.hilfeToolStripMenuItem.Text = "Hilfe";
//
// cmdOpenDoc
//
this.cmdOpenDoc.Name = "cmdOpenDoc";
this.cmdOpenDoc.Size = new System.Drawing.Size(234, 26);
this.cmdOpenDoc.Text = "Dokumentation öffnen";
this.cmdOpenDoc.Click += new System.EventHandler(this.cmdOpenDoc_Click);
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(1038, 36);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(129, 17);
this.label4.TabIndex = 10;
this.label4.Text = "Quarzfrequenz in s";
//
// cmdSetClock
//
this.cmdSetClock.Location = new System.Drawing.Point(1273, 34);
this.cmdSetClock.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.cmdSetClock.Name = "cmdSetClock";
this.cmdSetClock.Size = new System.Drawing.Size(67, 24);
this.cmdSetClock.TabIndex = 11;
this.cmdSetClock.Text = "setzen";
this.cmdSetClock.UseVisualStyleBackColor = true;
this.cmdSetClock.Click += new System.EventHandler(this.cmdSetClock_Click);
//
// timer1
//
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// listView1
//
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader2,
this.columnHeader3,
this.columnHeader4,
this.columnHeader5,
this.columnHeader6,
this.columnHeader7,
this.columnHeader8});
this.listView1.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
listViewItem2});
this.listView1.Location = new System.Drawing.Point(906, 95);
this.listView1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(434, 350);
this.listView1.TabIndex = 14;
this.listView1.UseCompatibleStateImageBehavior = false;
this.listView1.View = System.Windows.Forms.View.Details;
//
// columnHeader1
//
this.columnHeader1.Text = "0";
//
// columnHeader2
//
this.columnHeader2.Text = "1";
//
// columnHeader3
//
this.columnHeader3.Text = "2";
//
// columnHeader4
//
this.columnHeader4.Text = "3";
//
// columnHeader5
//
this.columnHeader5.Text = "4";
//
// columnHeader6
//
this.columnHeader6.Text = "5";
this.columnHeader6.Width = 62;
//
// columnHeader7
//
this.columnHeader7.Text = "6";
//
// columnHeader8
//
this.columnHeader8.Text = "7";
//
// cmd_Stop
//
this.cmd_Stop.Location = new System.Drawing.Point(85, 37);
this.cmd_Stop.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.cmd_Stop.Name = "cmd_Stop";
this.cmd_Stop.Size = new System.Drawing.Size(67, 27);
this.cmd_Stop.TabIndex = 15;
this.cmd_Stop.Text = "Stop";
this.cmd_Stop.UseVisualStyleBackColor = true;
this.cmd_Stop.Click += new System.EventHandler(this.cmd_Stop_Click);
//
// lbl_Timer
//
this.lbl_Timer.AutoSize = true;
this.lbl_Timer.Location = new System.Drawing.Point(940, 34);
this.lbl_Timer.Name = "lbl_Timer";
this.lbl_Timer.Size = new System.Drawing.Size(44, 17);
this.lbl_Timer.TabIndex = 16;
this.lbl_Timer.Text = "Timer";
//
// insertTime
//
this.insertTime.Location = new System.Drawing.Point(1192, 38);
this.insertTime.Name = "insertTime";
this.insertTime.Size = new System.Drawing.Size(61, 22);
this.insertTime.TabIndex = 17;
this.insertTime.Text = "100";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1397, 600);
this.Controls.Add(this.insertTime);
this.Controls.Add(this.lbl_Timer);
this.Controls.Add(this.cmd_Stop);
this.Controls.Add(this.listView1);
this.Controls.Add(this.cmdSetClock);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.cmd_reset);
this.Controls.Add(this.cmd_next);
this.Controls.Add(this.cmd_Start);
this.Controls.Add(this.lbl_path);
this.Controls.Add(this.box_CodeView);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "PIC Simulator";
this.Load += new System.EventHandler(this.Form1_Load);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.RichTextBox box_CodeView;
private System.Windows.Forms.Label lbl_path;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.Button cmd_Start;
private System.Windows.Forms.Button cmd_next;
private System.Windows.Forms.Button cmd_reset;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem cmdOpenFile;
private System.Windows.Forms.ToolStripMenuItem programmÖffnenToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem hilfeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem cmdOpenDoc;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button cmdSetClock;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.ListView listView1;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.ColumnHeader columnHeader3;
private System.Windows.Forms.ColumnHeader columnHeader4;
private System.Windows.Forms.ColumnHeader columnHeader5;
private System.Windows.Forms.ColumnHeader columnHeader6;
private System.Windows.Forms.ColumnHeader columnHeader7;
private System.Windows.Forms.ColumnHeader columnHeader8;
private System.Windows.Forms.ToolStripMenuItem beendenToolStripMenuItem;
private System.Windows.Forms.Button cmd_Stop;
private System.Windows.Forms.Label lbl_Timer;
private System.Windows.Forms.TextBox insertTime;
}
}
namespace PIC_Simulator
{
partial class Form1
{
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Verwendete Ressourcen bereinigen.
/// </summary>
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Vom Windows Form-Designer generierter Code
/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.ListViewItem listViewItem2 = new System.Windows.Forms.ListViewItem("INDF");
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.box_CodeView = new System.Windows.Forms.RichTextBox();
this.lbl_path = new System.Windows.Forms.Label();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.cmd_Start = new System.Windows.Forms.Button();
this.cmd_next = new System.Windows.Forms.Button();
this.cmd_reset = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.cmdOpenFile = new System.Windows.Forms.ToolStripMenuItem();
this.programmÖffnenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.beendenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.hilfeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.cmdOpenDoc = new System.Windows.Forms.ToolStripMenuItem();
this.label4 = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.listView1 = new System.Windows.Forms.ListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader7 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader8 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.cmd_Stop = new System.Windows.Forms.Button();
this.lbl_Timer = new System.Windows.Forms.Label();
this.insertTime = new System.Windows.Forms.TextBox();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.SystemColors.Control;
this.label1.Location = new System.Drawing.Point(29, 78);
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(0, 13);
this.label1.TabIndex = 1;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(8, 469);
this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(78, 13);
this.label2.TabIndex = 2;
this.label2.Text = "Programmpfad:";
//
// box_CodeView
//
this.box_CodeView.Location = new System.Drawing.Point(8, 77);
this.box_CodeView.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.box_CodeView.Name = "box_CodeView";
this.box_CodeView.ReadOnly = true;
this.box_CodeView.Size = new System.Drawing.Size(626, 376);
this.box_CodeView.TabIndex = 3;
this.box_CodeView.Text = "";
this.box_CodeView.WordWrap = false;
//
// lbl_path
//
this.lbl_path.AutoSize = true;
this.lbl_path.Location = new System.Drawing.Point(87, 469);
this.lbl_path.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lbl_path.Name = "lbl_path";
this.lbl_path.Size = new System.Drawing.Size(0, 13);
this.lbl_path.TabIndex = 4;
//
// openFileDialog1
//
this.openFileDialog1.FileName = "openFileDialog1";
//
// cmd_Start
//
this.cmd_Start.Location = new System.Drawing.Point(11, 29);
this.cmd_Start.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.cmd_Start.Name = "cmd_Start";
this.cmd_Start.Size = new System.Drawing.Size(50, 23);
this.cmd_Start.TabIndex = 5;
this.cmd_Start.Text = "Start";
this.cmd_Start.UseVisualStyleBackColor = true;
this.cmd_Start.Click += new System.EventHandler(this.cmd_Start_Click);
//
// cmd_next
//
this.cmd_next.Location = new System.Drawing.Point(126, 31);
this.cmd_next.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.cmd_next.Name = "cmd_next";
this.cmd_next.Size = new System.Drawing.Size(50, 21);
this.cmd_next.TabIndex = 6;
this.cmd_next.Text = "Schritt";
this.cmd_next.UseVisualStyleBackColor = true;
this.cmd_next.Click += new System.EventHandler(this.cmd_next_Click);
//
// cmd_reset
//
this.cmd_reset.Location = new System.Drawing.Point(190, 31);
this.cmd_reset.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.cmd_reset.Name = "cmd_reset";
this.cmd_reset.Size = new System.Drawing.Size(50, 21);
this.cmd_reset.TabIndex = 7;
this.cmd_reset.Text = "Reset";
this.cmd_reset.UseVisualStyleBackColor = true;
this.cmd_reset.Click += new System.EventHandler(this.cmd_reset_Click);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(248, 34);
this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(82, 13);
this.label3.TabIndex = 8;
this.label3.Text = "Programmzähler";
//
// menuStrip1
//
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24);
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.cmdOpenFile,
this.hilfeToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Padding = new System.Windows.Forms.Padding(4, 2, 0, 2);
this.menuStrip1.Size = new System.Drawing.Size(1048, 24);
this.menuStrip1.TabIndex = 9;
this.menuStrip1.Text = "menuStrip1";
//
// cmdOpenFile
//
this.cmdOpenFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.programmÖffnenToolStripMenuItem,
this.beendenToolStripMenuItem});
this.cmdOpenFile.Name = "cmdOpenFile";
this.cmdOpenFile.Size = new System.Drawing.Size(46, 20);
this.cmdOpenFile.Text = "Datei";
//
// programmÖffnenToolStripMenuItem
//
this.programmÖffnenToolStripMenuItem.Name = "programmÖffnenToolStripMenuItem";
this.programmÖffnenToolStripMenuItem.Size = new System.Drawing.Size(169, 22);
this.programmÖffnenToolStripMenuItem.Text = "Programm öffnen";
this.programmÖffnenToolStripMenuItem.Click += new System.EventHandler(this.programmÖffnenToolStripMenuItem_Click);
//
// beendenToolStripMenuItem
//
this.beendenToolStripMenuItem.Name = "beendenToolStripMenuItem";
this.beendenToolStripMenuItem.Size = new System.Drawing.Size(169, 22);
this.beendenToolStripMenuItem.Text = "Beenden";
this.beendenToolStripMenuItem.Click += new System.EventHandler(this.beendenToolStripMenuItem_Click);
//
// hilfeToolStripMenuItem
//
this.hilfeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.cmdOpenDoc});
this.hilfeToolStripMenuItem.Name = "hilfeToolStripMenuItem";
this.hilfeToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.hilfeToolStripMenuItem.Text = "Hilfe";
//
// cmdOpenDoc
//
this.cmdOpenDoc.Name = "cmdOpenDoc";
this.cmdOpenDoc.Size = new System.Drawing.Size(195, 22);
this.cmdOpenDoc.Text = "Dokumentation öffnen";
this.cmdOpenDoc.Click += new System.EventHandler(this.cmdOpenDoc_Click);
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(778, 29);
this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(95, 13);
this.label4.TabIndex = 10;
this.label4.Text = "Quarzfrequenz in s";
//
// timer1
//
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// listView1
//
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader2,
this.columnHeader3,
this.columnHeader4,
this.columnHeader5,
this.columnHeader6,
this.columnHeader7,
this.columnHeader8});
this.listView1.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
listViewItem2});
this.listView1.Location = new System.Drawing.Point(680, 77);
this.listView1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(326, 285);
this.listView1.TabIndex = 14;
this.listView1.UseCompatibleStateImageBehavior = false;
this.listView1.View = System.Windows.Forms.View.Details;
//
// columnHeader1
//
this.columnHeader1.Text = "0";
//
// columnHeader2
//
this.columnHeader2.Text = "1";
//
// columnHeader3
//
this.columnHeader3.Text = "2";
//
// columnHeader4
//
this.columnHeader4.Text = "3";
//
// columnHeader5
//
this.columnHeader5.Text = "4";
//
// columnHeader6
//
this.columnHeader6.Text = "5";
this.columnHeader6.Width = 62;
//
// columnHeader7
//
this.columnHeader7.Text = "6";
//
// columnHeader8
//
this.columnHeader8.Text = "7";
//
// cmd_Stop
//
this.cmd_Stop.Location = new System.Drawing.Point(64, 30);
this.cmd_Stop.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.cmd_Stop.Name = "cmd_Stop";
this.cmd_Stop.Size = new System.Drawing.Size(50, 22);
this.cmd_Stop.TabIndex = 15;
this.cmd_Stop.Text = "Stop";
this.cmd_Stop.UseVisualStyleBackColor = true;
this.cmd_Stop.Click += new System.EventHandler(this.cmd_Stop_Click);
//
// lbl_Timer
//
this.lbl_Timer.AutoSize = true;
this.lbl_Timer.Location = new System.Drawing.Point(705, 28);
this.lbl_Timer.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lbl_Timer.Name = "lbl_Timer";
this.lbl_Timer.Size = new System.Drawing.Size(33, 13);
this.lbl_Timer.TabIndex = 16;
this.lbl_Timer.Text = "Timer";
//
// insertTime
//
this.insertTime.Location = new System.Drawing.Point(894, 31);
this.insertTime.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.insertTime.Name = "insertTime";
this.insertTime.Size = new System.Drawing.Size(47, 20);
this.insertTime.TabIndex = 17;
this.insertTime.Text = "100";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1048, 488);
this.Controls.Add(this.insertTime);
this.Controls.Add(this.lbl_Timer);
this.Controls.Add(this.cmd_Stop);
this.Controls.Add(this.listView1);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.cmd_reset);
this.Controls.Add(this.cmd_next);
this.Controls.Add(this.cmd_Start);
this.Controls.Add(this.lbl_path);
this.Controls.Add(this.box_CodeView);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "PIC Simulator";
this.Load += new System.EventHandler(this.Form1_Load);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.RichTextBox box_CodeView;
private System.Windows.Forms.Label lbl_path;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.Button cmd_Start;
private System.Windows.Forms.Button cmd_next;
private System.Windows.Forms.Button cmd_reset;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem cmdOpenFile;
private System.Windows.Forms.ToolStripMenuItem programmÖffnenToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem hilfeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem cmdOpenDoc;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.ListView listView1;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.ColumnHeader columnHeader3;
private System.Windows.Forms.ColumnHeader columnHeader4;
private System.Windows.Forms.ColumnHeader columnHeader5;
private System.Windows.Forms.ColumnHeader columnHeader6;
private System.Windows.Forms.ColumnHeader columnHeader7;
private System.Windows.Forms.ColumnHeader columnHeader8;
private System.Windows.Forms.ToolStripMenuItem beendenToolStripMenuItem;
private System.Windows.Forms.Button cmd_Stop;
private System.Windows.Forms.Label lbl_Timer;
private System.Windows.Forms.TextBox insertTime;
}
}

View File

@@ -1,173 +1,111 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using PIC_Simulator;
namespace PIC_Simulator
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
// Globale Variablen
public int ArrayLaenge =0;
public int PCounter = -1;
public int time;
public int timeIntervall;
Einlesen instEinlesen = new Einlesen();
private void label1_Click(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
box_CodeView.Font = new Font("Consolas", 8);
timeIntervall = 1000;
}
private void cmd_Start_Click(object sender, EventArgs e)
{
timer1.Interval = timeIntervall; // 1 Sekunde
timer1.Enabled = true;
}
private void cmd_next_Click(object sender, EventArgs e)
{
// MessageBox.Show("Array laenge übergeben:" + ArrayLaenge);
if (PCounter == ArrayLaenge) { MessageBox.Show("Programm ist komplett durchlaufen!"); }
else {
PCounter = PCounter + 1;
try
{
//Zeilenmarkierung aufheben
highLightALine(box_CodeView, PCounter - 1, Color.White);
}
catch { }
//Counter im Label inkrementieren
int shownCounter = PCounter;
shownCounter++;
label3.Text = shownCounter.ToString();
}
//Aktuelle Zeile markieren
highLightALine(box_CodeView, PCounter, Color.Green);
instEinlesen.readExecCode(PCounter);
}
private int getPCounter() {
return PCounter;
}
private void programmÖffnenToolStripMenuItem_Click(object sender, EventArgs e)
{
// Datei über openFileDialog1 Auswählen und in Anzeige öffnen
FileStream fs;
StreamReader sr;
string zeile;
if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
sr = new
StreamReader(openFileDialog1.FileName);
DialogResult = MessageBox.Show(sr.ReadToEnd(), "Programm Vorschau", MessageBoxButtons.OKCancel);
sr.Close();
// Abfrage von Ergebnis des Dialogs, wenn ja Datei laden
if (DialogResult == DialogResult.OK)
{
fs = new FileStream(openFileDialog1.FileName, FileMode.Open);
sr = new StreamReader(fs);
while (sr.Peek() != -1)
{
zeile = sr.ReadLine();
box_CodeView.Text += zeile + "\n";
}
sr.Close();
lbl_path.Text = openFileDialog1.FileName;
// StreamReader jede Zeile in Listenelement schreiben über Funktionsaufruf in der Klasse Einlesen
ArrayLaenge = instEinlesen.writeToArray(sr = new StreamReader(openFileDialog1.FileName));
}
}
}
private void cmdOpenDoc_Click(object sender, EventArgs e)
{
string path = Application.StartupPath;
MessageBox.Show( path);
System.Diagnostics.Process.Start(@"C:\Users\nicol\Desktop\Projekte\PIC_Simulator\Projektinformationen\DataSheet.pdf");
}
//Funktion um Zeile aktuell ausgeführte Zeile zu markieren
void highLightALine(RichTextBox rtb, int line, Color hiLight)
{
int i1 = rtb.GetFirstCharIndexFromLine(line);
int i2 = rtb.GetFirstCharIndexFromLine(line + 1);
if (i2 < 0) i2 = rtb.Text.Length;
rtb.SelectionStart = i1;
rtb.SelectionLength = i2 - i1;
rtb.SelectionBackColor = hiLight;
}
private void cmdSetClock_Click(object sender, EventArgs e)
{
timeIntervall = Convert.ToInt32(insertTime.Text);
}
private void cmd_reset_Click(object sender, EventArgs e)
{ //######################### Muss ergänzt und getestet werden !!!
// Hier müssen alle Werte wieder auf den Standard gesetzt werden!
highLightALine(box_CodeView, PCounter, Color.White);
PCounter = -1;
label3.Text = PCounter.ToString();
//######################### Muss ergänzt und getestet werden !!!
}
private void buildtbl_Register() {
}
private void beendenToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
private void timer1_Tick(object sender, EventArgs e)
{
Einlesen QuarzExec = new Einlesen();
PCounter = PCounter + 1;
label3.Text = PCounter.ToString();
}
private void cmd_Stop_Click(object sender, EventArgs e)
{
timer1.Enabled = false;
}
}
}
using PIC_Simulator.PIC;
using PIC_Simulator.Properties;
using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
namespace PIC_Simulator
{
public partial class Form1 : Form
{
private PICProgramm programm;
private Timer quartztimer = new Timer();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
box_CodeView.Font = new Font("Consolas", 8);
box_CodeView.Text = Resources.TPicSim1;
programm = new PICProgramm();
programm.Laden(Resources.TPicSim1);
}
private void cmd_Start_Click(object sender, EventArgs e)
{
quartztimer.Stop();
quartztimer.Interval = int.Parse(insertTime.Text);
quartztimer.Start();
}
private void cmd_next_Click(object sender, EventArgs e)
{
StepProgramm();
}
private void programmÖffnenToolStripMenuItem_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
string datei = File.ReadAllText(openFileDialog1.FileName);
box_CodeView.Text = datei;
programm = new PICProgramm();
programm.Laden(datei);
}
}
private void cmdOpenDoc_Click(object sender, EventArgs e)
{
string path = Path.GetTempFileName() + ".pdf";
File.WriteAllBytes(path, Resources.DataSheet);
System.Diagnostics.Process.Start(path);
}
//Funktion um Zeile aktuell ausgeführte Zeile zu markieren
void Highlight(int line)
{
int i1 = box_CodeView.GetFirstCharIndexFromLine(line);
int i2 = box_CodeView.GetFirstCharIndexFromLine(line + 1);
if (i2 < 0 || i1 < 0)
{
box_CodeView.SelectionColor = Color.Transparent;
}
else
{
box_CodeView.SelectionStart = i1;
box_CodeView.SelectionLength = i2 - i1;
box_CodeView.SelectionBackColor = Color.SteelBlue;
}
}
private void cmd_reset_Click(object sender, EventArgs e)
{
//TODO
}
private void beendenToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
private void timer1_Tick(object sender, EventArgs e)
{
StepProgramm();
}
private void cmd_Stop_Click(object sender, EventArgs e)
{
quartztimer.Stop();
}
private void StepProgramm()
{
bool finished = programm.Step();
if (finished) { quartztimer.Stop(); return; }
Highlight(programm.befehle[programm.PCCounter].zeilennummer);
}
}
}

View File

@@ -1,132 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="box_CodeView.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>211, 17</value>
</metadata>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>367, 17</value>
</metadata>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="box_CodeView.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>211, 17</value>
</metadata>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>367, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,646 @@

using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace PIC_Simulator.PIC
{
class PICBefehl
{
public string befehl;
public uint parameter_d;
public uint parameter_f;
public uint parameter_x;
public uint parameter_k;
public uint parameter_b;
public int zeilennummer;
}
class PICProgramm
{
public const uint ADDR_INDF = 0x00;
public const uint ADDR_TMR0 = 0x01;
public const uint ADDR_PCL = 0x02;
public const uint ADDR_STATUS = 0x03;
public const uint ADDR_FSR = 0x04;
public const uint ADDR_PORT_A = 0x05;
public const uint ADDR_PORT_B = 0x06;
public const uint ADDR_UNIMPL_A = 0x07;
public const uint ADDR_PCLATH = 0x0A;
public const uint ADDR_INTCON = 0x0B;
public const uint ADDR_OPTION = 0x81;
public const uint ADDR_TRIS_A = 0x85;
public const uint ADDR_TRIS_B = 0x86;
public const uint ADDR_UNIMPL_B = 0x87;
public const uint ADDR_EECON1 = 0x88;
public const uint ADDR_EECON2 = 0x89;
public const uint STATUS_BIT_IRP = 7; // Unused in PIC16C84
public const uint STATUS_BIT_RP1 = 6; // Register Bank Selection Bit [1] (Unused in PIC16C84)
public const uint STATUS_BIT_RP0 = 5; // Register Bank Selection Bit [0]
public const uint STATUS_BIT_TO = 4; // Time Out Bit
public const uint STATUS_BIT_PD = 3; // Power Down Bit
public const uint STATUS_BIT_Z = 2; // Zero Bit
public const uint STATUS_BIT_DC = 1; // Digit Carry Bit
public const uint STATUS_BIT_C = 0; // Carry Bit
public const uint OPTION_BIT_RBPU = 7; // PORT-B Pull-Up Enable Bit
public const uint OPTION_BIT_INTEDG = 6; // Interrupt Edge Select Bit
public const uint OPTION_BIT_T0CS = 5; // TMR0 Clock Source Select Bit
public const uint OPTION_BIT_T0SE = 4; // TMR0 Source Edge Select Bit
public const uint OPTION_BIT_PSA = 3; // Prescaler Alignment Bit
public const uint OPTION_BIT_PS2 = 2; // Prescaler Rate Select Bit [2]
public const uint OPTION_BIT_PS1 = 1; // Prescaler Rate Select Bit [1]
public const uint OPTION_BIT_PS0 = 0; // Prescaler Rate Select Bit [0]
public const uint INTCON_BIT_GIE = 7; // Global Interrupt Enable Bit
public const uint INTCON_BIT_EEIE = 6; // EE Write Complete Interrupt Enable Bit
public const uint INTCON_BIT_T0IE = 5; // TMR0 Overflow Interrupt Enable Bit
public const uint INTCON_BIT_INTE = 4; // RB0/INT Interrupt Bit
public const uint INTCON_BIT_RBIE = 3; // RB Port Change Interrupt Enable Bit
public const uint INTCON_BIT_T0IF = 2; // TMR0 Overflow Interrupt Flag Bit
public const uint INTCON_BIT_INTF = 1; // RB0/INT Interrupt Flag Bit
public const uint INTCON_BIT_RBIF = 0; // RB Port Change Interrupt Flag Bit
public const string ADDWF = "000111dfffffff";
public const string ANDWF = "000101dfffffff";
public const string CLRF = "0000011fffffff";
public const string CLRW = "0000010xxxxxxx";
public const string COMF = "001001dfffffff";
public const string DECF = "000011dfffffff";
public const string DECFSZ = "001011dfffffff";
public const string INCF = "001010dfffffff";
public const string INCFSZ = "001111dfffffff";
public const string IORWF = "000100dfffffff";
public const string MOVF = "001000dfffffff";
public const string MOVWF = "0000001fffffff";
public const string NOP = "0000000xx00000";
public const string RLF = "001101dfffffff";
public const string RRF = "001100dfffffff";
public const string SUBWF = "000010dfffffff";
public const string SWAPF = "001110dfffffff";
public const string XORWF = "000110dfffffff";
public const string BCF = "0100bbbfffffff";
public const string BSF = "0101bbbfffffff";
public const string BTFSC = "0110bbbfffffff";
public const string BTFSS = "0111bbbfffffff";
public const string ADDLW = "11111xkkkkkkkk";
public const string ANDLW = "111001kkkkkkkk";
public const string CALL = "100kkkkkkkkkkk";
public const string CLRWDT = "00000001100100";
public const string GOTO = "101kkkkkkkkkkk";
public const string IORLW = "111000kkkkkkkk";
public const string MOVLW = "1100xxkkkkkkkk";
public const string RETFIE = "00000000001001";
public const string RETLW = "1101xxkkkkkkkk";
public const string RETURN = "00000000001000";
public const string SLEEP = "00000001100011";
public const string SUBLW = "11110xkkkkkkkk";
public const string XORLW = "111010kkkkkkkk";
public string[] ALL_COMMANDS = {ADDWF, ANDWF, CLRF, CLRW, COMF, DECF, DECFSZ, INCF, INCFSZ, IORWF, MOVF, MOVWF, NOP, RLF, RRF, SUBWF, SWAPF, XORWF, BCF, BSF, BTFSC, BTFSS, ADDLW, ANDLW, CALL, CLRWDT, GOTO, IORLW, MOVLW, RETFIE, RETLW, RETURN, SLEEP, SUBLW, XORLW };
public List<PICBefehl> befehle;
public int PCCounter = 0; // -> nächster befehl
public uint Register_W = 0;
public uint[] Register = new uint[0x100];
public PICProgramm()
{
}
public void Laden(string code)
{
befehle = new List<PICBefehl>();
int zn = 0;
foreach (var zeile in Regex.Split(code, @"\r?\n"))
{
zn++;
if (zeile.StartsWith(" ")) continue;
if (zeile.Length < 10) continue;
befehle.Add(FindeBefehl(zeile, zn));
}
}
private PICBefehl FindeBefehl(string zeile, int zeilennummer)
{
foreach (var cmd in ALL_COMMANDS)
{
string bin = hex2binary(zeile.Substring(5, 4));
uint p_d = 0;
uint p_f = 0;
uint p_x = 0;
uint p_k = 0;
uint p_b = 0;
bool ok = true;
for (int i = 0; i < 14; i++)
{
if (cmd[i] == '0' && bin[i] == '0') continue;
if (cmd[i] == '1' && bin[i] == '1') continue;
if (cmd[i] == 'd' && bin[i] == '0') { p_d <<= 1; p_d |= 0; continue; }
if (cmd[i] == 'd' && bin[i] == '1') { p_d <<= 1; p_d |= 1; continue; }
if (cmd[i] == 'f' && bin[i] == '0') { p_f <<= 1; p_f |= 0; continue; }
if (cmd[i] == 'f' && bin[i] == '1') { p_f <<= 1; p_f |= 1; continue; }
if (cmd[i] == 'x' && bin[i] == '0') { p_x <<= 1; p_x |= 0; continue; }
if (cmd[i] == 'x' && bin[i] == '1') { p_x <<= 1; p_x |= 1; continue; }
if (cmd[i] == 'k' && bin[i] == '0') { p_k <<= 1; p_k |= 0; continue; }
if (cmd[i] == 'k' && bin[i] == '1') { p_k <<= 1; p_k |= 1; continue; }
if (cmd[i] == 'b' && bin[i] == '0') { p_b <<= 1; p_b |= 0; continue; }
if (cmd[i] == 'b' && bin[i] == '1') { p_b <<= 1; p_b |= 1; continue; }
if (cmd[i] == '0' && bin[i] == '1') { ok = false; break; }
if (cmd[i] == '1' && bin[i] == '0') { ok = false; continue; }
throw new Exception("Falscher wert in cmd");
}
if (ok)
{
PICBefehl b = new PICBefehl();
b.befehl = cmd;
b.parameter_d = p_d;
b.parameter_f = p_f;
b.parameter_k = p_k;
b.parameter_x = p_x;
b.parameter_b = p_b;
b.zeilennummer = zeilennummer;
return b;
}
}
throw new Exception("konnte befehl nicht finden: " + zeile);
}
private string hex2binary(string hexvalue)
{
string binaryval = "";
binaryval = Convert.ToString(Convert.ToInt32(hexvalue, 16), 2).PadLeft(14, '0');
return binaryval;
}
public bool Step()
{
if (PCCounter >= befehle.Count) return true;
PICBefehl aktueller_befehl = befehle[PCCounter];
if (aktueller_befehl.befehl == ADDWF)
{
uint a = GetRegister(aktueller_befehl.parameter_f);
uint b = Register_W;
uint Result = a + b;
bool dc = AdditionDigitCarry(a, b);
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_Z, (Result % 0x100) == 0);
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_DC, dc);
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_C, Result > 0xFF);
Result %= 0x100;
if (aktueller_befehl.parameter_d != 0)
SetRegister(aktueller_befehl.parameter_f, Result);
else
Register_W = Result;
}
else if (aktueller_befehl.befehl == ANDWF)
{
uint Result = Register_W & GetRegister(aktueller_befehl.parameter_f);
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_Z, Result == 0);
if (aktueller_befehl.parameter_d != 0)
SetRegister(aktueller_befehl.parameter_f, Result);
else
Register_W = Result;
}
else if (aktueller_befehl.befehl == CLRF)
{
SetRegister(aktueller_befehl.parameter_f, 0x00);
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_Z, true);
}
else if (aktueller_befehl.befehl == CLRW)
{
Register_W = 0;
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_Z, true);
}
else if (aktueller_befehl.befehl == COMF)
{
uint Result = ~GetRegister(aktueller_befehl.parameter_f);
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_Z, Result == 0);
if (aktueller_befehl.parameter_d != 0)
SetRegister(aktueller_befehl.parameter_f, Result);
else
Register_W = Result;
}
else if (aktueller_befehl.befehl == DECF)
{
uint Result = GetRegister(aktueller_befehl.parameter_f);
if (Result == 0)
Result = 0xFF;
else
Result -= 1;
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_Z, Result == 0);
if (aktueller_befehl.parameter_d != 0)
SetRegister(aktueller_befehl.parameter_f, Result);
else
Register_W = Result;
}
else if (aktueller_befehl.befehl == DECFSZ)
{
bool Cond = GetRegister(aktueller_befehl.parameter_f) == 1;
uint Result = GetRegister(aktueller_befehl.parameter_f);
if (Result == 0)
Result = 0xFF;
else
Result -= 1;
if (aktueller_befehl.parameter_d != 0)
SetRegister(aktueller_befehl.parameter_f, Result);
else
Register_W = Result;
if (Cond)
{
PCCounter++; // skip next
}
}
else if (aktueller_befehl.befehl == INCF)
{
uint Result = GetRegister(aktueller_befehl.parameter_f);
Result += 1;
Result %= 0x100;
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_Z, Result == 0);
if (aktueller_befehl.parameter_d != 0)
SetRegister(aktueller_befehl.parameter_f, Result);
else
Register_W = Result;
}
else if (aktueller_befehl.befehl == INCFSZ)
{
bool Cond = GetRegister(aktueller_befehl.parameter_f) == 0xFF;
uint Result = GetRegister(aktueller_befehl.parameter_f);
Result += 1;
Result %= 0x100;
if (aktueller_befehl.parameter_d != 0)
SetRegister(aktueller_befehl.parameter_f, Result);
else
Register_W = Result;
if (Cond)
{
PCCounter++; // skip next
}
}
else if (aktueller_befehl.befehl == IORWF)
{
uint Result = Register_W | GetRegister(aktueller_befehl.parameter_f);
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_Z, Result == 0);
if (aktueller_befehl.parameter_d != 0)
SetRegister(aktueller_befehl.parameter_f, Result);
else
Register_W = Result;
}
else if (aktueller_befehl.befehl == MOVF)
{
uint Result = GetRegister(aktueller_befehl.parameter_f);
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_Z, Result == 0);
if (aktueller_befehl.parameter_d != 0)
SetRegister(aktueller_befehl.parameter_f, Result);
else
Register_W = Result;
}
else if (aktueller_befehl.befehl == MOVWF)
{
SetRegister(aktueller_befehl.parameter_f, Register_W);
}
else if (aktueller_befehl.befehl == NOP)
{
// ~~~~~
}
else if (aktueller_befehl.befehl == RLF)
{
uint Result = GetRegister(aktueller_befehl.parameter_f);
uint Carry_Old = GetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_C) ? 1u : 0u;
uint Carry_New = (Result & 0x80) >> 7;
Result = Result << 1;
Result &= 0xFF;
Result |= Carry_Old;
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_C, Carry_New != 0);
if (aktueller_befehl.parameter_d != 0)
SetRegister(aktueller_befehl.parameter_f, Result);
else
Register_W = Result;
}
else if (aktueller_befehl.befehl == RRF)
{
uint Result = GetRegister(aktueller_befehl.parameter_f);
uint Carry_Old = GetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_C) ? 0x80u : 0x00u;
uint Carry_New = Result & 0x01;
Result = Result >> 1;
Result &= 0xFF;
Result |= Carry_Old;
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_C, Carry_New != 0);
if (aktueller_befehl.parameter_d != 0)
SetRegister(aktueller_befehl.parameter_f, Result);
else
Register_W = Result;
}
else if (aktueller_befehl.befehl == SUBWF)
{
uint a = GetRegister(aktueller_befehl.parameter_f);
uint b = Register_W;
bool carry;
bool dc = SubtractionDigitCarry(a, b);
if (carry = a < b)
{
a += 0x100;
}
uint Result = a - b;
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_Z, (Result % 0x100) == 0);
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_DC, dc);
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_C, !carry);
Result %= 0x100;
if (aktueller_befehl.parameter_d != 0)
SetRegister(aktueller_befehl.parameter_f, Result);
else
Register_W = Result;
}
else if (aktueller_befehl.befehl == SWAPF)
{
uint Result = GetRegister(aktueller_befehl.parameter_f);
uint Low = Result & 0x0F;
uint High = Result & 0xF0;
Result = (Low << 4) | (High >> 4);
if (aktueller_befehl.parameter_d != 0)
SetRegister(aktueller_befehl.parameter_f, Result);
else
Register_W = Result;
}
else if (aktueller_befehl.befehl == XORWF)
{
uint Result = Register_W ^ GetRegister(aktueller_befehl.parameter_f);
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_Z, Result == 0);
if (aktueller_befehl.parameter_d != 0)
SetRegister(aktueller_befehl.parameter_f, Result);
else
Register_W = Result;
}
else if (aktueller_befehl.befehl == BCF)
{
SetRegister(aktueller_befehl.parameter_f, aktueller_befehl.parameter_b, false);
}
else if (aktueller_befehl.befehl == BSF)
{
SetRegister(aktueller_befehl.parameter_f, aktueller_befehl.parameter_b, true);
}
else if (aktueller_befehl.befehl == BTFSC)
{
if (!GetBit(GetRegister(aktueller_befehl.parameter_f), aktueller_befehl.parameter_b))
{
PCCounter++;
}
}
else if (aktueller_befehl.befehl == BTFSS)
{
if (GetBit(GetRegister(aktueller_befehl.parameter_f), aktueller_befehl.parameter_b))
{
PCCounter++;
}
}
else if (aktueller_befehl.befehl == ADDLW)
{
uint a = Register_W;
uint b = aktueller_befehl.parameter_k;
uint Result = a + b;
bool dc = AdditionDigitCarry(a, b);
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_Z, (Result % 0x100) == 0);
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_DC, dc);
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_C, Result > 0xFF);
Result %= 0x100;
Register_W = Result;
}
else if (aktueller_befehl.befehl == ANDLW)
{
uint Result = Register_W & aktueller_befehl.parameter_k;
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_Z, Result == 0);
Register_W = Result;
}
else if (aktueller_befehl.befehl == CALL)
{
//TODO
}
else if (aktueller_befehl.befehl == CLRWDT)
{
//TODO
}
else if (aktueller_befehl.befehl == GOTO)
{
//TODO
}
else if (aktueller_befehl.befehl == IORLW)
{
uint Result = Register_W | aktueller_befehl.parameter_k;
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_Z, Result == 0);
Register_W = Result;
}
else if (aktueller_befehl.befehl == MOVLW)
{
Register_W = aktueller_befehl.parameter_k;
}
else if (aktueller_befehl.befehl == RETFIE)
{
//TODO
}
else if (aktueller_befehl.befehl == RETLW)
{
//TODO
}
else if (aktueller_befehl.befehl == RETURN)
{
//TODO
}
else if (aktueller_befehl.befehl == SLEEP)
{
//TODO
}
else if (aktueller_befehl.befehl == SUBLW)
{
uint a = aktueller_befehl.parameter_k;
uint b = Register_W;
bool carry;
bool dc = SubtractionDigitCarry(a, b);
if (carry = a < b)
{
a += 0x100;
}
uint Result = a - b;
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_Z, (Result % 0x100) == 0);
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_DC, dc);
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_C, !carry);
Result %= 0x100;
Register_W = Result;
}
else if (aktueller_befehl.befehl == XORLW)
{
uint Result = Register_W ^ aktueller_befehl.parameter_k;
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_Z, Result == 0);
Register_W = Result; ;
}
}
private uint GetRegister(uint index)
{
if ((Register[ADDR_STATUS] & STATUS_BIT_RP0) == STATUS_BIT_RP0)
{
return Register[0x80 + index];
}
else
{
return Register[index];
}
}
private void SetRegister(uint index, uint wert)
{
if ((Register[ADDR_STATUS] & STATUS_BIT_RP0) == STATUS_BIT_RP0)
{
Register[0x80 + index] = wert;
}
else
{
Register[index] = wert;
}
}
private void SetRegister(uint index, uint bit, bool wert)
{
if ((Register[ADDR_STATUS] & STATUS_BIT_RP0) == STATUS_BIT_RP0)
{
Register[0x80 + index] = SetBit(Register[index], bit, wert);
}
else
{
Register[index] = SetBit(Register[index], bit, wert);
}
}
private void SetRegisterOhneBank(uint index, uint bit, bool wert)
{
Register[index] = SetBit(Register[index], bit, wert);
}
private bool GetRegisterOhneBank(uint index, uint bit)
{
return GetBit(Register[index], bit);
}
public static bool AdditionDigitCarry(uint a, uint b)
{
a &= 0x0F;
b &= 0x0F;
return (a + b) > 0x0F;
}
public static bool SubtractionDigitCarry(uint a, uint b)
{
b = (~b) + 1;
return AdditionDigitCarry(a, b);
}
public static bool GetBit(uint val, uint pos)
{
return (val & SHL(1, pos)) != 0;
}
public static uint SHL(uint val, uint steps)
{
return (uint)((val) << ((int)steps));
}
public static uint SHR(uint val, uint steps)
{
return (uint)((val) >> ((int)steps));
}
public static uint SetBit(uint val, uint pos, bool bit)
{
return bit ? (val | SHL(1, pos)) : (val & ~SHL(1, pos));
}
}
}

View File

@@ -1,85 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{61AE0011-89B1-46B3-B2EA-E0949BD27605}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>PIC_Simulator</RootNamespace>
<AssemblyName>PIC_Simulator</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Befehlssatz.cs" />
<Compile Include="Einlesen.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Register.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{61AE0011-89B1-46B3-B2EA-E0949BD27605}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>PIC_Simulator</RootNamespace>
<AssemblyName>PIC_Simulator</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="PIC\PICProgramm.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<None Include="Resources\DataSheet.pdf" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\TPicSim1.LST" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -1,27 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace PIC_Simulator
{
static class Program
{
/// <summary>
/// Der Haupteinstiegspunkt für die Anwendung.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
using System;
using System.Windows.Forms;
namespace PIC_Simulator
{
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

View File

@@ -1,36 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("PIC_Simulator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PIC_Simulator")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("61ae0011-89b1-46b3-b2ea-e0949bd27605")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("PIC_Simulator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PIC_Simulator")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("61ae0011-89b1-46b3-b2ea-e0949bd27605")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -1,71 +1,90 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion: 4.0.30319.42000
//
// Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn
// der Code neu generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PIC_Simulator.Properties
{
/// <summary>
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary>
// Diese Klasse wurde von der StronglyTypedResourceBuilder-Klasse
// über ein Tool wie ResGen oder Visual Studio automatisch generiert.
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
// mit der Option /str erneut aus, oder erstellen Sie Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PIC_Simulator.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PIC_Simulator.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PIC_Simulator.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] DataSheet {
get {
object obj = ResourceManager.GetObject("DataSheet", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized string similar to 00001 ;TPicSim1
/// 00002 ;Programm zum Test des 16F84-Simulators.
/// 00003 ;Es werden alle Literal-Befehle geprüft
/// 00004 ;(c) St. Lehmann
/// 00005 ;Ersterstellung: 23.03.2016
/// 00006 ;
/// 00007 list c=132 ;Zeilenlänge im LST auf 132 Zeichen setzen
/// 00008
/// [rest of string was truncated]&quot;;.
/// </summary>
internal static string TPicSim1 {
get {
return ResourceManager.GetString("TPicSim1", resourceCulture);
}
}
}
}

View File

@@ -1,117 +1,127 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="DataSheet" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\DataSheet.pdf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="TPicSim1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\TPicSim1.LST;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
</root>

View File

@@ -1,30 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PIC_Simulator.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PIC_Simulator.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -1,357 +0,0 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Windows.Forms;
namespace PIC_Simulator
{
class Register
{
// Speicherarray anlegen:
List<int[]> arrMemList = new List<int[]>();
// BANK 0 definieren
byte BANK0_INDF = 0x0; //0000 0000
byte BANK0_TMR0 = 0x0; //0000 0000
byte BANK0_PCL = 0x0; //0000 0000
byte BANK0_STATUS = 0x18; //0001 1000
byte BANK0_FSR = 0x0; //0000 0000
byte BANK0_PORTA = 0x0; //0000 0000
byte BANK0_PORTB = 0x0; //0000 0000
byte BANK0_EEDATA = 0x0; //0000 0000
byte BANK0_EEADR = 0x0; //0000 0000
// BANK 1 definieren
byte BANK1_INDF = 0x0; //0000 0000
byte BANK1_OPTION_REG = 0xFF; //1111 1111
byte BANK1_PCL = 0x0; //0000 0000
byte BANK1_STATUS = 0x18; //0001 1000
byte BANK1_FSR = 0x0; //0000 0000
byte BANK1_TRISA = 0x1F; //0001 1111
byte BANK1_TRISB = 0xFF; //1111 1111
byte BANK1_EECON1 = 0x0; //0000 0000
byte BANK1_EECON2 = 0x0; //0000 0000
// Gemeinsam genutzte Register
byte BANK_PCLATH = 0x0; //0000 0000
byte BANK_INTCON = 0x0; //0000 0000
//############## PIC COMMANDS BINARY #############################
// --- Bit-Oriented File Register Operations ---
public string BCF = "0100"; // 4 Stellen zum Vergleichen
public string BSF = "0101";
public string BTFSC = "0110";
public string BTFSS = "0111";
//--- Byte-Oriented File Register Operations ---
public string ADDWF = "000111"; //6 Stellen zum Vergleichen
public string ANDWF = "000101"; //6
public string COMF = "001001"; //6
public string DECF = "000011"; //6
public string DECFSZ = "001011"; //6
public string INCF = "001010"; //6
public string INCFSZ = "001111"; //6
public string IORWF = "000100"; //6
public string MOVF = "001000"; //6
public string RLF = "001101"; //6
public string RRF = "001100"; //6
public string SUBWF = "000010"; //6
public string SWAPF = "001110"; //6
public string XORWF = "000110"; //6
public string CLRF = "0000011"; //7 Stellen zum Vergleichen
public string CLRW = "0000010"; //7
public string MOVWF = "0000001"; //7
public string NOP1 = "00000000000000"; //14 Stellen zum Vergleichen
public string NOP2 = "00000000100000"; //14
public string NOP3 = "00000001000000"; //14
public string NOP4 = "00000001100000"; //14
// --- Literal and Control Operations ---
public string CALL = "100"; //3 Stellen zum Vergleichen
public string GOTO = "101"; //3
public string MOVLW = "1100"; //4 Stellen zum Vergleichen
public string RETLW = "1101"; //4
public string SUBLW = "11110"; //5 Stellen zum Vergleichen
public string ADDLW = "11111"; //5
public string ANDLW = "111001"; //6 Stellen zum Vergleichen
public string IORLW = "111000"; //6
public string XORLW = "111010"; //6
public string CLRWDT = "00000001100100"; //14
public string RETFIE = "00000000001001"; //14
public string RETURN = "00000000001000"; //14
public string SLEEP = "00000001100011"; //14
//############## PIC COMMANDS BINARY #############################
// Findet den auszuführenden Befehl
public void findOrder(string Order)
{
string OrderBinary;
string Reduced;
// Hex to Int Umrechnung Funktionsaufruf
OrderBinary = hex2binary(Order);
// 14 Zeichen
Reduced = OrderBinary;
if (Reduced.Equals(NOP1))
{
MessageBox.Show("Erfolgreich NOP1" + Reduced);
}
else if (Reduced.Equals(NOP2))
{
MessageBox.Show("Erfolgreich NOP2" + Reduced);
}
else if (Reduced.Equals(NOP3))
{
MessageBox.Show("Erfolgreich NOP3" + Reduced);
}
else if (Reduced.Equals(NOP4))
{
MessageBox.Show("Erfolgreich NOP4" + Reduced);
}
else if (Reduced.Equals(CLRWDT))
{
MessageBox.Show("Erfolgreich CLRWDT" + Reduced);
}
else if (Reduced.Equals(RETFIE))
{
MessageBox.Show("Erfolgreich RETFIE" + Reduced);
}
else if (Reduced.Equals(RETURN))
{
MessageBox.Show("Erfolgreich RETURN" + Reduced);
}
else if (Reduced.Equals(SLEEP))
{
MessageBox.Show("Erfolgreich SLEEP" + Reduced);
}
else
{ // Reduzieren und Vergleich mit 7 Zeichen
Reduced = OrderBinary.Substring(0, 7);
}
//7 Zeichen
if (Reduced.Equals(CLRF))
{
MessageBox.Show("Erfolgreich CLRF" + Reduced);
}
else if (Reduced.Equals(CLRW))
{
MessageBox.Show("Erfolgreich CLRW" + Reduced);
}
else if (Reduced.Equals(MOVWF))
{
MessageBox.Show("Erfolgreich MOVWF" + Reduced);
}
else {
// Reduzieren und Vergleich mit 6 Zeichen
Reduced = OrderBinary.Substring(0, 6);
}
// 6 Zeichen
if (Reduced.Equals(ANDWF))
{
MessageBox.Show("Erfolgreich ANDWF " + Reduced);
}
else if (Reduced.Equals(COMF))
{
MessageBox.Show("Erfolgreich COMF " + Reduced);
}
else if (Reduced.Equals(DECF))
{
MessageBox.Show("Erfolgreich DECF " + Reduced);
}
else if (Reduced.Equals(DECFSZ))
{
MessageBox.Show("Erfolgreich DECFSZ " + Reduced);
}
else if (Reduced.Equals(INCF))
{
MessageBox.Show("Erfolgreich INCF " + Reduced);
}
else if (Reduced.Equals(INCFSZ))
{
MessageBox.Show("Erfolgreich INCFSZ " + Reduced);
}
else if (Reduced.Equals(IORWF))
{
MessageBox.Show("Erfolgreich IORWF " + Reduced);
}
else if (Reduced.Equals(MOVF))
{
MessageBox.Show("Erfolgreich MOVF " + Reduced);
}
else if (Reduced.Equals(RLF))
{
MessageBox.Show("Erfolgreich RLF " + Reduced);
}
else if (Reduced.Equals(RRF))
{
MessageBox.Show("Erfolgreich RRF " + Reduced);
}
else if (Reduced.Equals(SUBWF))
{
MessageBox.Show("Erfolgreich SUBWF " + Reduced);
}
else if (Reduced.Equals(SWAPF))
{
MessageBox.Show("Erfolgreich SWAPF " + Reduced);
}
else if (Reduced.Equals(XORWF))
{
MessageBox.Show("Erfolgreich XORWF " + Reduced);
}
else if (Reduced.Equals(ANDLW))
{
MessageBox.Show("Erfolgreich ANDLW " + Reduced);
}
else if (Reduced.Equals(IORLW))
{
MessageBox.Show("Erfolgreich IORLW " + Reduced);
}
else if (Reduced.Equals(XORLW))
{
MessageBox.Show("Erfolgreich XORLW " + Reduced);
}
else
{ // Reduzieren und Vergleich mit 5 Zeichen
Reduced = OrderBinary.Substring(0, 5);
}
// 5 Zeichen
if (Reduced.Equals(SUBLW))
{
MessageBox.Show("Erfolgreich SUBLW " + Reduced);
}
else if (Reduced.Equals(ADDLW))
{
MessageBox.Show("Erfolgreich ADDLW " + Reduced);
}
else
{ // Reduzieren und Vergleich mit 4 Zeichen
Reduced = OrderBinary.Substring(0, 4);
}
//4 Zeichen
if (Reduced.Equals(BCF))
{
MessageBox.Show("Erfolgreich BCF " + Reduced);
}
else if (Reduced.Equals(BSF))
{
MessageBox.Show("Erfolgreich BSF " + Reduced);
}
else if (Reduced.Equals(BTFSC))
{
MessageBox.Show("Erfolgreich DBTFSC " + Reduced);
}
else if (Reduced.Equals(BTFSS))
{
MessageBox.Show("Erfolgreich BTFSS " + Reduced);
}
else if (Reduced.Equals(MOVLW))
{
MessageBox.Show("Erfolgreich MOVLW " + Reduced);
}
else if (Reduced.Equals(RETLW))
{
MessageBox.Show("Erfolgreich RETLW " + Reduced);
}
else
{// Reduzieren und Vergleich mit 3 Zeichen
Reduced = OrderBinary.Substring(0, 3);
}
if (Reduced.Equals(CALL))
{
MessageBox.Show("Erfolgreich CALL " + Reduced);
}
else if (Reduced.Equals(GOTO))
{
MessageBox.Show("Erfolgreich GOTO " + Reduced);
}
else { }
}
private string hex2binary(string hexvalue)
{
string binaryval = "";
binaryval = Convert.ToString(Convert.ToInt32(hexvalue, 16), 2).PadLeft(14,'0');
return binaryval;
}
private void fillpicmemory()
{
int[] line1 = new int[8];
int[] line2 = new int[8];
int[] line3 = new int[8];
int[] line4 = new int[8];
int[] line5 = new int[8];
int[] line6 = new int[8];
int[] line7 = new int[8];
int[] line8 = new int[8];
int[] line9 = new int[8];
int[] line10 = new int[8];
int[] line11 = new int[8];
int[] line12 = new int[8];
int[] line13 = new int[8];
int[] line14 = new int[8];
int[] line15 = new int[8];
int[] line16 = new int[8];
int[] line17 = new int[8];
int[] line18 = new int[8];
int[] line19 = new int[8];
int[] line20 = new int[8];
int[] line21 = new int[8];
int[] line22 = new int[8];
int[] line23 = new int[8];
int[] line24 = new int[8];
int[] line25 = new int[8];
int[] line26 = new int[8];
int[] line27 = new int[8];
int[] line28 = new int[8];
int[] line29 = new int[8];
int[] line30 = new int[8];
int[] line31 = new int[8];
}
}
}

Binary file not shown.

View File

@@ -0,0 +1,35 @@
00001 ;TPicSim1
00002 ;Programm zum Test des 16F84-Simulators.
00003 ;Es werden alle Literal-Befehle gepr<70>ft
00004 ;(c) St. Lehmann
00005 ;Ersterstellung: 23.03.2016
00006 ;
00007 list c=132 ;Zeilenl<6E>nge im LST auf 132 Zeichen setzen
00008
00009 ;Definition einiger Symbole
00010 ;zuerst Hardware-Register
00011 status equ 03h
00012 ra equ 05h
00013 rb equ 06h
00014
00015 ;f<>r den Benutzer frei verwendbare Register
00016 count equ 0ch
00017
00018 ;Definition des Prozessors
00019 device 16F84
00020
00021 ;Festlegen des Codebeginns
00022 org 0
00023 start
0000 3011 00024 movlw 11h ;in W steht nun 11h, Statusreg. unver<65>ndert
0001 3930 00025 andlw 30h ;W = 10h, C=x, DC=x, Z=0
0002 380D 00026 iorlw 0Dh ;W = 1Dh, C=x, DC=x, Z=0
0003 3C3D 00027 sublw 3Dh ;W = 20h, C=1, DC=1, Z=0
0004 3A20 00028 xorlw 20h ;W = 00h, C=1, DC=1, Z=1
0005 3E25 00029 addlw 25h ;W = 25h, C=0, DC=0, Z=0
00030
00031
00032 ende
0006 2806 00033 goto ende ;Endlosschleife, verhindert Nirwana
00034
00035