From 0136084aa318626542502e9ad0ac60b88eec801f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Thu, 11 May 2017 12:48:41 +0200 Subject: [PATCH] bf --- PIC_Simulator/PIC/PICProgramm.cs | 8 +++++--- PIC_Simulator/PIC/RS232Verbindung.cs | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/PIC_Simulator/PIC/PICProgramm.cs b/PIC_Simulator/PIC/PICProgramm.cs index ba0f1f8..206ef8f 100644 --- a/PIC_Simulator/PIC/PICProgramm.cs +++ b/PIC_Simulator/PIC/PICProgramm.cs @@ -139,6 +139,8 @@ namespace PIC_Simulator.PIC SetRegisterOhneBank(ADDR_EECON1, 0x00); SetRegisterOhneBank(ADDR_EECON2, 0x00); + + PCCounter = 0; } public void Laden(string code) @@ -225,7 +227,7 @@ namespace PIC_Simulator.PIC if (TaktgeberAktiviert) { TaktgeberZahler += frequenz; - if (TaktgeberZahler > TaktgeberFrequenz) + if (TaktgeberZahler >= TaktgeberFrequenz) { TaktgeberZahler = 0; SetRegisterOhneBank(TaktgeberAdresse, TaktgeberBitnummer, !GetRegisterOhneBank(TaktgeberAdresse, TaktgeberBitnummer)); @@ -809,7 +811,7 @@ namespace PIC_Simulator.PIC if (index == ADDR_INDF) // indirekte adresierung { - if (Register[ADDR_FSR] % 0x80 != 0) SetRegister(Register[ADDR_FSR], wert); + if (Register[ADDR_FSR] % 0x80 != 0) Register[Register[ADDR_FSR]] = wert; return; } @@ -831,7 +833,7 @@ namespace PIC_Simulator.PIC if (index == ADDR_INDF) // indirekte adresierung { if (Register[ADDR_FSR] % 0x80 != 0) return 0; - return GetRegister(Register[ADDR_FSR]); + return Register[Register[ADDR_FSR]]; } return Register[index]; diff --git a/PIC_Simulator/PIC/RS232Verbindung.cs b/PIC_Simulator/PIC/RS232Verbindung.cs index 96d0cba..f9415cf 100644 --- a/PIC_Simulator/PIC/RS232Verbindung.cs +++ b/PIC_Simulator/PIC/RS232Verbindung.cs @@ -86,6 +86,7 @@ namespace PIC_Simulator.PIC public void Disconnect() { + if (ComPort == null) return; ComPort.Close(); ComPort = null; }