Skip to content

Commit

Permalink
Release 0.7.0.9
Browse files Browse the repository at this point in the history
---------------
PR #62: clandrew - Add --exec-breakpoint command line option for adding a breakpoint on launch.
Fixed the RTC not raising alerts correctly.
Fixed stack overflow issue with 6502 processor.
  • Loading branch information
Daniel Tremblay committed Sep 25, 2024
1 parent 6aa01cd commit 0189675
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 18 deletions.
25 changes: 16 additions & 9 deletions Main/Devices/RTC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,19 @@ public override byte ReadByte(int Address)
data[13] = 0;
return value;
}
return base.ReadByte(Address);
return data[Address];
}
public override void WriteByte(int Address, byte Value)
{
// Allow writing to the control register
switch (Address)
{
case 1:
case 3:
case 5:
case 7:
data[Address] = Value;
break;
case 0xB:
// reset the value of the hi-res periodic timer - the watch dog is ignored
freq = 0.0305175f * (1 << (Value & 0xF)); // ms
Expand All @@ -216,15 +222,16 @@ public override void WriteByte(int Address, byte Value)
freq = 200;
}
data[0xB] = (byte)(Value & 0x7F);
periodicTimer.Interval = freq;
break;
case 0xC:
// Enables Register
data[0xC] = (byte)(Value & 0xF);
isAlarmEnabled = (Value & 8) != 0;
isPeriodicEnabled = (Value & 4) != 0;
if (periodicTimer != null && !isPeriodicEnabled)
if (periodicTimer != null)
{
periodicTimer.Enabled = false;
periodicTimer.Enabled = isPeriodicEnabled;
}
if (isPeriodicEnabled)
{
Expand Down Expand Up @@ -253,12 +260,12 @@ public override void WriteByte(int Address, byte Value)
}
data[0xE] = (byte)(Value & 0xF);
break;


}
if (is_UTI_Set && (Address < 0xB || Address == 0xF))
{
tempValues[Address] = Value;
default:
if (is_UTI_Set)
{
tempValues[Address] = Value;
}
break;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Main/MemoryLocations/MemoryMap_Page00.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public static partial class MemoryMap


public const int VECTOR_ECOP = 0x00FFF4; // 2 Bytes Emulation mode interrupt handler
public const int VECTOR_EBRK = 0x00FFF6; // 2 Bytes Emulation mode interrupt handler
public const int VECTOR_EBRK = 0x00FFFE; // 2 Bytes Emulation mode interrupt handler
public const int VECTOR_EABORT = 0x00FFF8; // 2 Bytes Emulation mode interrupt handler
public const int VECTOR_ENMI = 0x00FFFA; // 2 Bytes Emulation mode interrupt handler
public const int VECTOR_ERESET = 0x00FFFC; // 2 Bytes Emulation mode interrupt handler
Expand Down
11 changes: 10 additions & 1 deletion Main/Processor/CPU.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public partial class CPU

public const int DefaultStackValueNative = 0xd6ff;
public const int DefaultStackValueEmulation = 0x01ff;
private bool is6502 = false;

public int ClockSpeed
{
Expand Down Expand Up @@ -101,6 +102,7 @@ public CPU(MemoryManager mm, int clock, bool is6502)
Operations operations = new Operations(this);
operations.SimulatorCommand += Operations_SimulatorCommand;
opcodes = new OpcodeList(operations, this, is6502);
this.is6502 = is6502;
Flags.Emulation = true;
}

Expand Down Expand Up @@ -269,7 +271,7 @@ public int ReadSignature(int length, int pc)
}

/// <summary>
/// Clock cycles used for performance counte This will be periodically reset to zero
/// Clock cycles used for performance counter. This will be periodically reset to zero
/// as the throttling routine adjusts the system performance.
/// </summary>
public int CycleCounter
Expand Down Expand Up @@ -323,6 +325,11 @@ public void Push(int value, int bytes)
throw new Exception("bytes must be between 1 and 3. Got " + bytes.ToString());

Stack.Value -= bytes;
// Check if the stack has overflowed
if (is6502 && (Stack.Value & 0xFF00 ) != 0x100)
{
Stack.Value = 0x100 + (Stack.Value & 0xFF);
}
MemMgr.Write(Stack.Value + 1, value, bytes);
}

Expand All @@ -339,7 +346,9 @@ public void Push(Register Reg)
public int Pull(int bytes)
{
if (bytes < 1 || bytes > 3)
{
throw new Exception("bytes must be between 1 and 3. got " + bytes.ToString());
}

int ret = MemMgr.Read(Stack.Value + 1, bytes);

Expand Down
4 changes: 2 additions & 2 deletions Main/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.7.0.8")]
[assembly: AssemblyFileVersion("0.7.0.8")]
[assembly: AssemblyVersion("0.7.0.9")]
[assembly: AssemblyFileVersion("0.7.0.9")]
2 changes: 1 addition & 1 deletion Main/UI/CPUWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ private bool ShouldBreakExecution(int nextPC, ref int breakAddress)
return true;
}

if (kernel.CPU.CurrentOpcode.Value == 0)
if (kernel.CPU.CurrentOpcode.Value == 0 && nextPC == 0)
{
breakAddress = 0;
return true;
Expand Down
16 changes: 12 additions & 4 deletions Release Notes.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
Release 0.7.0.8
Release 0.7.0.9
---------------
PR #61: clandrew - Don't let the user "add watch" on an invisible element
PR #60: clandrew - Fix problem where new breakpoints don't "take effect" until after you pause the debugger
PR #59: clandrew - Show debugger's breakpoint address instead of hardcoded FFFFFFFF
PR #62: clandrew - Add --exec-breakpoint command line option for adding a breakpoint on launch.
Fixed the RTC not raising alerts correctly.
Fixed stack overflow issue with 6502 processor.

** TODO: Users can now modify the CPU registers when in debug mode. The registers have a white background when editable.
** TODO: Implemented the various cursor modes and rates.
** TODO: Implement an IEC interface to connect via USB to XUM1541 (try using the SerialPort class?).
Expand All @@ -15,6 +16,13 @@ PR #59: clandrew - Show debugger's breakpoint address instead of hardcoded FFFFF
** TODO: Saving basic files to emulated SD card often doesn't work or crashes the emulator.
** TODO: Support two joysticks and allow for multiple joystick buttons

Release 0.7.0.8
---------------
PR #61: clandrew - Don't let the user "add watch" on an invisible element
PR #60: clandrew - Fix problem where new breakpoints don't "take effect" until after you pause the debugger
PR #59: clandrew - Show debugger's breakpoint address instead of hardcoded FFFFFFFF


Release 0.7.0.7
---------------
Fixed typo in CPU Window - Address was mis-spelled.
Expand Down

0 comments on commit 0189675

Please sign in to comment.