Skip to content

Commit

Permalink
Added basic loader for RAMDisk blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
gusmanb committed Feb 16, 2024
1 parent 3abcfd3 commit dbc767f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class ZXTapeBuilderFile
public ZXTapeBuilderDataBlock[]? DataBlocks { get; set; }
public bool IncludeRAMDisk { get; set; }
public ZXRAMDiskOrder RAMDiskOrder { get; set; }
public bool BasicLoadRAMDisk { get; set; } = true;
}

public enum ZXRAMDiskOrder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,16 @@
</Border>
<TextBlock Grid.Row="2" Margin="15,0,0,0" Padding="5" Background="#202020" HorizontalAlignment="Left" VerticalAlignment="Top">Data blocks</TextBlock>
<Border Grid.Row="3" Margin="5,14,5,5" BorderBrush="White" BorderThickness="1" CornerRadius="5">
<Grid ColumnDefinitions="140,32,100,150,*">
<Grid ColumnDefinitions="140,32,100,150,100,32,*">
<TextBlock VerticalAlignment="Center" Margin="15,0,0,0" HorizontalAlignment="Right">Include RAM disk blocks:</TextBlock>
<CheckBox Name="ckRAMDisk" Grid.Column="1" VerticalAlignment="Center" Margin="5" HorizontalAlignment="Left"></CheckBox>
<TextBlock Grid.Column="2" VerticalAlignment="Center" Margin="15,0,0,0" HorizontalAlignment="Right">Inclusion order:</TextBlock>
<ComboBox Grid.Column="3" Classes="dialog" SelectedIndex="0" Margin="5,0,0,0" Name="cbRAMDiskOrder">
<ComboBoxItem>Before data blocks</ComboBoxItem>
<ComboBoxItem>After data blocks</ComboBoxItem>
</ComboBox>
<TextBlock Grid.Column="4" VerticalAlignment="Center" Margin="15,0,0,0" HorizontalAlignment="Right">Basic loader:</TextBlock>
<CheckBox Name="ckBasicRAMDisk" Grid.Column="5" VerticalAlignment="Center" Margin="5" HorizontalAlignment="Left"></CheckBox>
</Grid>
</Border>
<TextBlock Grid.Row="3" Margin="15,0,0,0" Padding="5" Background="#202020" HorizontalAlignment="Left" VerticalAlignment="Top">RAM disk</TextBlock>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public ZXTapeBuilderEditor(string DocumentPath)
txtScreenFile.TextChanged += DocumentChanged;
ckRAMDisk.IsCheckedChanged += DocumentChanged;
cbRAMDiskOrder.SelectionChanged += DocumentChanged;
ckBasicRAMDisk.IsCheckedChanged += DocumentChanged;

btnSelectScreen.Click += BtnSelectScreen_Click;
btnSelectBlock.Click += BtnSelectBlock_Click;
Expand Down Expand Up @@ -311,6 +312,8 @@ bool UpdateFileName(string NewPath)

//RAM disk
ckRAMDisk.IsChecked = fileContent.IncludeRAMDisk;
ckBasicRAMDisk.IsChecked = fileContent.BasicLoadRAMDisk;

if (fileContent.RAMDiskOrder == ZXRAMDiskOrder.Before)
cbRAMDiskOrder.SelectedIndex = 0;
else
Expand Down Expand Up @@ -424,7 +427,8 @@ public override bool SaveDocument(TextWriter OutputLog)
ScreenName = txtScreenName.Text,
DataBlocks = _blocks.ToArray(),
IncludeRAMDisk = ckRAMDisk.IsChecked ?? false,
RAMDiskOrder = cbRAMDiskOrder.SelectedIndex == 0 ? ZXRAMDiskOrder.Before : ZXRAMDiskOrder.After
RAMDiskOrder = cbRAMDiskOrder.SelectedIndex == 0 ? ZXRAMDiskOrder.Before : ZXRAMDiskOrder.After,
BasicLoadRAMDisk = ckBasicRAMDisk.IsChecked ?? false
};

string content = JsonConvert.SerializeObject(fileContent, Formatting.Indented);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public bool Build(string BuildPath, ZXBuildStage Stage, ZXBuildType BuildType, Z

line.AddTokens(I.LOAD, "\"\"", I.CODE, CompiledProgram.Org);

if (buildFile.IncludeRAMDisk && buildFile.RAMDiskOrder == ZXRAMDiskOrder.Before)
if (buildFile.IncludeRAMDisk && buildFile.BasicLoadRAMDisk && buildFile.RAMDiskOrder == ZXRAMDiskOrder.Before)
{
foreach (var bank in CompiledProgram.Banks)
{
Expand All @@ -121,7 +121,7 @@ public bool Build(string BuildPath, ZXBuildStage Stage, ZXBuildType BuildType, Z
line.AddTokens(I.LOAD, "\"\"", I.CODE, block.BlockAddress);
}

if (buildFile.IncludeRAMDisk && buildFile.RAMDiskOrder == ZXRAMDiskOrder.After)
if (buildFile.IncludeRAMDisk && buildFile.BasicLoadRAMDisk && buildFile.RAMDiskOrder == ZXRAMDiskOrder.After)
{
foreach (var bank in CompiledProgram.Banks)
{
Expand All @@ -134,15 +134,6 @@ public bool Build(string BuildPath, ZXBuildStage Stage, ZXBuildType BuildType, Z
line.AddTokens(I.OUT, 32765, ",", 16);
}










if (buildFile.HideHeaders)
line.AddTokens(I.POKE, 23739, ",", 244);

Expand Down

0 comments on commit dbc767f

Please sign in to comment.