Skip to content

Commit b452079

Browse files
chore: MAJ LOGO example from v6 to V11 of Spice86
1 parent 3eda4e0 commit b452079

6 files changed

Lines changed: 54 additions & 12 deletions

File tree

GeneratedCode.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ public class RewrittenOverrides : CSharpOverrideHelper
1717
/// </summary>
1818
private const ushort EntrySegmentAddress = 0x1000;
1919

20-
public RewrittenOverrides(Dictionary<SegmentedAddress, FunctionInformation> functionInformations, Machine machine, ILoggerService loggerService, Configuration configuration, ushort entrySegment = 0x1000) : base(functionInformations, machine, loggerService, configuration)
20+
public RewrittenOverrides(Dictionary<SegmentedAddress, FunctionInformation> functionInformations, Machine machine, ILoggerService loggerService, Configuration configuration, ushort entrySegment = 0x1000)
21+
: base(functionInformations, machine, loggerService, configuration)
2122
{
2223
DefineGeneratedCodeOverrides();
2324
SetProvidedInterruptHandlersAsOverridden();
2425
}
2526

26-
public Dictionary<SegmentedAddress, FunctionInformation> FunctionInformations => _functionInformations;
27-
2827
public void DefineGeneratedCodeOverrides()
2928
{
3029
DefineFunction(EntrySegmentAddress, 0x0, EntryPoint_OpenLogoHnmFileAndRun_1000_0000_10000, false);
@@ -50,7 +49,7 @@ public virtual Action EntryPoint_OpenLogoHnmFileAndRun_1000_0000_10000(int offse
5049
Memory.SetZeroTerminatedString(MemoryUtils.ToPhysicalAddress(DS,DI), ".HNM", 5);
5150
}
5251
// Open file handle (LOGO.HNM)
53-
Machine.Dos.DosInt21Handler.OpenFile(false);
52+
Machine.Dos.DosInt21Handler.OpenFileorDevice(false);
5453
DX = 0x2E;
5554
if (!CarryFlag)
5655
{
@@ -559,7 +558,7 @@ public void CommonUnknown_display_1000_0E59_10E59()
559558
public void UpdatePaletteDataAddress_1000_0E86_10E86()
560559
{
561560
SegmentedAddress pointer = PaletteDataAddress;
562-
ushort newSegmentOffset = (ushort)(UInt16[pointer.ToPhysical()] + pointer.Offset);
561+
ushort newSegmentOffset = (ushort)(UInt16[pointer.Linear] + pointer.Offset);
563562
ushort newSegment = (ushort)((newSegmentOffset >> 4) + pointer.Segment);
564563
ushort newOffset = (ushort)(newSegmentOffset & 0xF);
565564
WritePaletteDataAddress(newSegment, newOffset);

GeneratedCode_DecompiledAsm.cs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ public class GeneratedOverrides_DecompiledAsm : CSharpOverrideHelper
2323
protected ushort cs2; // 0xF000
2424

2525

26-
public GeneratedOverrides_DecompiledAsm(Dictionary<SegmentedAddress, FunctionInformation> functionInformations, Machine machine, ILoggerService loggerService, Configuration configuration, ushort entrySegment = 0x1000) : base(functionInformations, machine, loggerService, configuration)
26+
public GeneratedOverrides_DecompiledAsm(Dictionary<SegmentedAddress, FunctionInformation> functionInformations, Machine machine, ILoggerService loggerService, Configuration configuration, ushort entrySegment = 0x1000)
27+
: base(functionInformations, machine, loggerService, configuration)
2728
{
2829
// Observed cs1 address at generation time is 0x1000. Do not set entrySegment to something else if the program is not relocatable.
2930
cs1 = (ushort)(entrySegment + 0x0);
@@ -33,8 +34,6 @@ public GeneratedOverrides_DecompiledAsm(Dictionary<SegmentedAddress, FunctionInf
3334
DetectCodeRewrites();
3435
SetProvidedInterruptHandlersAsOverridden();
3536
}
36-
37-
public Dictionary<SegmentedAddress, FunctionInformation> FunctionInformations => _functionInformations;
3837

3938
public void DefineGeneratedCodeOverrides()
4039
{
@@ -90,6 +89,25 @@ public void DetectCodeRewrites()
9089
DefineExecutableArea(0xF0020, 0xF0023);
9190
}
9291

92+
//
93+
// Summary:
94+
// Defines an executable area in memory by registering a memory write break point
95+
// for every byte in the specified address range.
96+
//
97+
// Parameters:
98+
// startAddress:
99+
// The start address of the executable area.
100+
//
101+
// endAddress:
102+
// The end address of the executable area.
103+
public void DefineExecutableArea(uint startAddress, uint endAddress)
104+
{
105+
for (uint num = startAddress; num <= endAddress; num++)
106+
{
107+
Cpu.ExecutionFlowRecorder.RegisterExecutableByteModificationBreakPoint(Memory, State, EmulatorBreakpointsManager, num);
108+
}
109+
}
110+
93111
/// <summary>
94112
/// First pass rewrite done by the .NET Roslyn compiler (ReadyToRun pre-compilation)
95113
/// </summary>

GeneratedCode_OriginalAsm.cs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ public GeneratedOverrides_OriginalAsm(Dictionary<SegmentedAddress, FunctionInfor
3535
SetProvidedInterruptHandlersAsOverridden();
3636
}
3737

38-
public Dictionary<SegmentedAddress, FunctionInformation> FunctionInformations => _functionInformations;
39-
4038
public void DefineGeneratedCodeOverrides()
4139
{
4240
// 0x1000
@@ -92,6 +90,25 @@ public void DetectCodeRewrites()
9290
DefineExecutableArea(0xF0020, 0xF0023);
9391
}
9492

93+
//
94+
// Summary:
95+
// Defines an executable area in memory by registering a memory write break point
96+
// for every byte in the specified address range.
97+
//
98+
// Parameters:
99+
// startAddress:
100+
// The start address of the executable area.
101+
//
102+
// endAddress:
103+
// The end address of the executable area.
104+
public void DefineExecutableArea(uint startAddress, uint endAddress)
105+
{
106+
for (uint num = startAddress; num <= endAddress; num++)
107+
{
108+
Cpu.ExecutionFlowRecorder.RegisterExecutableByteModificationBreakPoint(Memory, State, EmulatorBreakpointsManager, num);
109+
}
110+
}
111+
95112
public virtual Action EntryPoint_OpenLogoHnmFileAndRun_1000_0000_10000(int loadOffset)
96113
{
97114
// MOV AX,0x111c (1000_0000 / 0x10000)

PaletteData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class PaletteData : MemoryBasedDataStructure
1111
{
1212
public SegmentedAddress _address;
1313

14-
public PaletteData(IByteReaderWriter byteReaderWriter, SegmentedAddress baseAddress): base(byteReaderWriter, baseAddress.ToPhysical())
14+
public PaletteData(IByteReaderWriter byteReaderWriter, SegmentedAddress baseAddress): base(byteReaderWriter, baseAddress.Linear)
1515
{
1616
_address = baseAddress;
1717
}

Properties/launchSettings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"profiles": {
3+
"logo": {
4+
"commandName": "Project",
5+
"commandLineArgs": "--UseCodeOverride true -e \"C:\\Jeux\\Dune_21\\LOGO.EXE\""
6+
}
7+
}
8+
}

logo.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
<Using Include="Spice86.Core.Emulator.Function" />
1717
</ItemGroup>
1818
<ItemGroup>
19-
<PackageReference Include="Spice86" Version="6.4.2" />
19+
<PackageReference Include="Spice86" Version="11.1.0" />
2020
</ItemGroup>
2121
</Project>

0 commit comments

Comments
 (0)