Skip to content

Commit 5e234f3

Browse files
authored
Merge pull request #32 from gusmanb/features/next
Bugs in next build
2 parents 64549cc + d356874 commit 5e234f3

4 files changed

Lines changed: 129 additions & 63 deletions

File tree

ZXBStudio/App.axaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,47 @@
8787
<Setter Property="CornerRadius" Value="4" />
8888
<Setter Property="Focusable" Value="False"></Setter>
8989
</Style>
90+
91+
<Style Selector="Button.toolbar_r90">
92+
<Setter Property="Background" Value="#ffb0b0b0" />
93+
<Setter Property="Width" Value="24" />
94+
<Setter Property="Height" Value="24" />
95+
<Setter Property="Padding" Value="2" />
96+
<Setter Property="CornerRadius" Value="4" />
97+
<Setter Property="Focusable" Value="False"></Setter>
98+
<Setter Property="RenderTransform">
99+
<Setter.Value>
100+
<RotateTransform Angle="90"/>
101+
</Setter.Value>
102+
</Setter>
103+
</Style>
104+
<Style Selector="Button.toolbar_r270">
105+
<Setter Property="Background" Value="#ffb0b0b0" />
106+
<Setter Property="Width" Value="24" />
107+
<Setter Property="Height" Value="24" />
108+
<Setter Property="Padding" Value="2" />
109+
<Setter Property="CornerRadius" Value="4" />
110+
<Setter Property="Focusable" Value="False"></Setter>
111+
<Setter Property="RenderTransform">
112+
<Setter.Value>
113+
<RotateTransform Angle="270"/>
114+
</Setter.Value>
115+
</Setter>
116+
</Style>
117+
<Style Selector="Button.toolbar_hMirror">
118+
<Setter Property="Background" Value="#ffb0b0b0" />
119+
<Setter Property="Width" Value="24" />
120+
<Setter Property="Height" Value="24" />
121+
<Setter Property="Padding" Value="2" />
122+
<Setter Property="CornerRadius" Value="4" />
123+
<Setter Property="Focusable" Value="False"></Setter>
124+
<Setter Property="RenderTransform">
125+
<Setter.Value>
126+
<ScaleTransform ScaleX="-1"/>
127+
</Setter.Value>
128+
</Setter>
129+
</Style>
130+
90131
<Style Selector="ToggleButton.toolbar">
91132
<Setter Property="Background" Value="#fff0f0f0" />
92133
<Setter Property="Width" Value="24" />
@@ -105,6 +146,24 @@
105146
<Style Selector="Button.toolbar:pressed /template/ ContentPresenter#PART_ContentPresenter">
106147
<Setter Property="Background" Value="#ff606060" />
107148
</Style>
149+
<Style Selector="Button.toolbar_r90:pointerover /template/ ContentPresenter#PART_ContentPresenter">
150+
<Setter Property="Background" Value="#fff0f0f0" />
151+
</Style>
152+
<Style Selector="Button.toolbar_r90:pressed /template/ ContentPresenter#PART_ContentPresenter">
153+
<Setter Property="Background" Value="#ff606060" />
154+
</Style>
155+
<Style Selector="Button.toolbar_r270:pointerover /template/ ContentPresenter#PART_ContentPresenter">
156+
<Setter Property="Background" Value="#fff0f0f0" />
157+
</Style>
158+
<Style Selector="Button.toolbar_r270:pressed /template/ ContentPresenter#PART_ContentPresenter">
159+
<Setter Property="Background" Value="#ff606060" />
160+
</Style>
161+
<Style Selector="Button.toolbar_hMirror:pointerover /template/ ContentPresenter#PART_ContentPresenter">
162+
<Setter Property="Background" Value="#fff0f0f0" />
163+
</Style>
164+
<Style Selector="Button.toolbar_hMirror:pressed /template/ ContentPresenter#PART_ContentPresenter">
165+
<Setter Property="Background" Value="#ff606060" />
166+
</Style>
108167
<Style Selector="ComboBox.toolbar">
109168
<Setter Property="Margin" Value="0"></Setter>
110169
<Setter Property="CornerRadius" Value="5"></Setter>

ZXBStudio/BuildSystem/ZXProjectBuilder.cs

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -153,18 +153,23 @@ private static bool BuildNexFile(byte[] binary, ZXBuildSettings settings, ZXProj
153153
sb.AppendLine("!MMU./sysvars.inc,10,$1C00");
154154
}
155155
// Origin
156-
{
157-
int org = settings.Origin == null ? 32768 : settings.Origin.Value;
158-
sb.AppendLine(string.Format("!PCSP${0:X2},${1:X2}", org, org - 2));
159-
}
156+
int org = settings.Origin == null ? 32768 : settings.Origin.Value;
157+
sb.AppendLine(string.Format("!PCSP${0:X2},${1:X2}", org, org - 2));
160158
// Main file
161159
{
162-
var bank = 5;
163-
var address = 0x2000;
160+
int[] nextBank16K = { 255, 5, 2, 0 };
161+
int bank = org/16384;
162+
int offset = org-(bank * 16384);
163+
if(bank<0 || bank > 3)
164+
{
165+
outputLogWritter.WriteLine("Error: Invalid ORG direction, must be >0 and <65535");
166+
return false;
167+
}
168+
bank = nextBank16K[bank];
164169
sb.AppendLine(string.Format(".\\{0},{1},${2:X2}",
165170
Path.Combine(Path.GetFileNameWithoutExtension(settings.MainFile) + ".bin"),
166171
bank,
167-
address));
172+
offset));
168173
}
169174
// Save nex.cfg file
170175
{
@@ -200,16 +205,27 @@ private static bool BuildNexFile(byte[] binary, ZXBuildSettings settings, ZXProj
200205

201206
outputLogWritter.WriteLine("Building .nex file...");
202207
Process process = new Process();
203-
process.StartInfo.FileName = "python.exe";
204-
process.StartInfo.Arguments = string.Format("{0} nex.cfg {1}",
205-
Path.Combine(Path.GetDirectoryName(ZXOptions.Current.ZxbcPath), "tools", "nextcreator.py"),
206-
Path.GetFileNameWithoutExtension(settings.MainFile) + ".nex");
207-
process.StartInfo.WorkingDirectory = project.ProjectPath;
208-
process.StartInfo.UseShellExecute = false;
209-
process.StartInfo.CreateNoWindow = true;
210-
process.StartInfo.RedirectStandardOutput = true;
208+
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
209+
{
210+
process.StartInfo.FileName = "python";
211+
process.StartInfo.Arguments = string.Format("{0} nex.cfg {1}",
212+
Path.Combine(Path.GetDirectoryName(ZXOptions.Current.ZxbcPath), "tools", "nextcreator.py"),
213+
Path.GetFileNameWithoutExtension(settings.MainFile) + ".nex");
214+
process.StartInfo.WorkingDirectory = project.ProjectPath;
215+
process.StartInfo.UseShellExecute = false;
216+
process.StartInfo.CreateNoWindow = true;
217+
process.StartInfo.RedirectStandardOutput = true;
218+
}
219+
else
220+
{
221+
process.StartInfo.FileName = Path.Combine(Path.GetDirectoryName(ZXOptions.Current.ZxbcPath), "tools", "nextcreator.py");
222+
process.StartInfo.Arguments = "nex.cfg " + Path.GetFileNameWithoutExtension(settings.MainFile) + ".nex";
223+
process.StartInfo.WorkingDirectory = project.ProjectPath;
224+
process.StartInfo.UseShellExecute = false;
225+
process.StartInfo.CreateNoWindow = true;
226+
process.StartInfo.RedirectStandardOutput = true;
227+
}
211228
process.Start();
212-
213229
process.WaitForExit();
214230

215231
if (!File.Exists(nexFile))

ZXBStudio/DocumentEditors/ZXGraphics/FontGDUEditor.axaml

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,45 +8,7 @@
88
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
99
Focusable ="True"
1010
Background="#ff202020"
11-
x:Class="ZXBasicStudio.DocumentEditors.ZXGraphics.FontGDUEditor">
12-
<UserControl.Styles>
13-
<Style Selector="Button.toolbar_r90">
14-
<Setter Property="Background" Value="#fff0f0f0" />
15-
<Setter Property="Width" Value="32" />
16-
<Setter Property="Height" Value="32" />
17-
<Setter Property="Padding" Value="4" />
18-
<Setter Property="CornerRadius" Value="4" />
19-
<Setter Property="RenderTransform">
20-
<Setter.Value>
21-
<RotateTransform Angle="90"/>
22-
</Setter.Value>
23-
</Setter>
24-
</Style>
25-
<Style Selector="Button.toolbar_r270">
26-
<Setter Property="Background" Value="#fff0f0f0" />
27-
<Setter Property="Width" Value="32" />
28-
<Setter Property="Height" Value="32" />
29-
<Setter Property="Padding" Value="4" />
30-
<Setter Property="CornerRadius" Value="4" />
31-
<Setter Property="RenderTransform">
32-
<Setter.Value>
33-
<RotateTransform Angle="270"/>
34-
</Setter.Value>
35-
</Setter>
36-
</Style>
37-
<Style Selector="Button.toolbar_hMirror">
38-
<Setter Property="Background" Value="#fff0f0f0" />
39-
<Setter Property="Width" Value="32" />
40-
<Setter Property="Height" Value="32" />
41-
<Setter Property="Padding" Value="4" />
42-
<Setter Property="CornerRadius" Value="4" />
43-
<Setter Property="RenderTransform">
44-
<Setter.Value>
45-
<ScaleTransform ScaleX="-1"/>
46-
</Setter.Value>
47-
</Setter>
48-
</Style>
49-
</UserControl.Styles>
11+
x:Class="ZXBasicStudio.DocumentEditors.ZXGraphics.FontGDUEditor">
5012

5113
<Grid Name="grdMain">
5214
<Grid Name="grdEditor" ColumnDefinitions="180,4,*,4,200" Margin="0,8,0,0">

ZXBStudio/MainWindow.axaml.cs

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,38 +1427,67 @@ private async void BuildAndRun(object? sender, Avalonia.Interactivity.RoutedEven
14271427
}
14281428
else
14291429
{
1430+
// Cleaning...
1431+
{
1432+
outLog.Writer.WriteLine("Cleaning temp files...");
1433+
var file = Path.Combine(project.ProjectPath, Path.GetFileNameWithoutExtension(settings.MainFile) + ".bin");
1434+
if (File.Exists(file))
1435+
{
1436+
File.Delete(file);
1437+
}
1438+
file = Path.Combine(project.ProjectPath, "nex.cfg");
1439+
if (File.Exists(file))
1440+
{
1441+
File.Delete(file);
1442+
}
1443+
file = Path.Combine(project.ProjectPath, "sysvars.inc");
1444+
if (File.Exists(file))
1445+
{
1446+
File.Delete(file);
1447+
}
1448+
file = Path.Combine(project.ProjectPath, Path.GetFileNameWithoutExtension(settings.MainFile) + ".nex");
1449+
if (File.Exists(file))
1450+
{
1451+
File.Delete(file);
1452+
}
1453+
}
1454+
14301455
try
14311456
{
1432-
var emulatorName = Path.GetFileName(emulatorPath);
1457+
var emulatorName = Path.GetFileNameWithoutExtension(emulatorPath);
1458+
var nextDrive = Path.Combine(project.ProjectPath, "nextdrive");
14331459
switch (emulatorName.ToLower())
14341460
{
1435-
case "cspect.exe":
1461+
case "cspect":
14361462
{
14371463
outLog.Writer.WriteLine("Launching CSpect...");
14381464
Process process = new Process();
14391465
process.StartInfo.FileName = emulatorPath;
14401466
process.StartInfo.Arguments = string.Format(
1441-
"-zxnext -tv -w3 -brk -r -mmc=.\\nextdrive\\ .\\nextdrive\\{0}",
1442-
Path.GetFileNameWithoutExtension(settings.MainFile) + ".nex");
1467+
"-zxnext -tv -w3 -brk -r -mmc=\"{0}\" \"{1}\"",
1468+
nextDrive,
1469+
Path.Combine(nextDrive, Path.GetFileNameWithoutExtension(settings.MainFile) + ".nex"));
14431470
process.StartInfo.WorkingDirectory = project.ProjectPath;
14441471
process.StartInfo.UseShellExecute = true;
14451472
process.StartInfo.CreateNoWindow = false;
1473+
outLog.Writer.WriteLine(process.StartInfo.FileName+" "+process.StartInfo.Arguments);
14461474
process.Start();
14471475
process.WaitForExit();
14481476
}
14491477
break;
1450-
case "zesarux.exe":
1478+
case "zesarux":
14511479
{
14521480
outLog.Writer.WriteLine("Launching ZEsarUX...");
14531481
Process process = new Process();
14541482
process.StartInfo.FileName = emulatorPath;
14551483
process.StartInfo.Arguments = string.Format(
1456-
"--noconfigfile --zoom 1 --machine TBBlue --realvideo --enabletimexvideo --tbblue-fast-boot-mode --enable-esxdos-handler --esxdos-root-dir {0} {1} --snap-no-change-machine",
1457-
Path.Combine(project.ProjectPath, "nextdrive"),
1458-
Path.Combine(project.ProjectPath, "nextdrive", Path.GetFileNameWithoutExtension(settings.MainFile) + ".nex"));
1484+
"--noconfigfile --zoom 1 --machine TBBlue --realvideo --enabletimexvideo --tbblue-fast-boot-mode --enable-esxdos-handler --esxdos-root-dir \"{0}\" \"{1}\" --snap-no-change-machine",
1485+
nextDrive,
1486+
Path.Combine(nextDrive, Path.GetFileNameWithoutExtension(settings.MainFile) + ".nex"));
14591487
process.StartInfo.WorkingDirectory = Path.GetDirectoryName(emulatorPath);
14601488
process.StartInfo.UseShellExecute = true;
14611489
process.StartInfo.CreateNoWindow = false;
1490+
outLog.Writer.WriteLine(process.StartInfo.FileName + " " + process.StartInfo.Arguments);
14621491
process.Start();
14631492
process.WaitForExit();
14641493
}

0 commit comments

Comments
 (0)