mirror of
https://github.com/fadden/6502bench.git
synced 2025-03-03 14:32:06 +00:00
Add default text encoding mode to system definition
This allows C64/C128/Pet projects to start out with PETSCII set as the default text encoding mode.
This commit is contained in:
parent
8fd469b81f
commit
176e1ad6af
@ -260,6 +260,9 @@ namespace SourceGen {
|
||||
ProjectProps.IncludeUndocumentedInstr = includeUndoc;
|
||||
UpdateCpuDef();
|
||||
|
||||
ProjectProps.AnalysisParams.DefaultTextScanMode =
|
||||
SystemDefaults.GetTextScanMode(sysDef);
|
||||
|
||||
ProjectProps.EntryFlags = SystemDefaults.GetEntryFlags(sysDef);
|
||||
|
||||
// Configure the load address.
|
||||
|
@ -35,6 +35,8 @@ The currently-supported parameters are:
|
||||
opcodes. They are disabled by default.
|
||||
* first-word-is-load-addr={true|false} - If true, the first two bytes of
|
||||
the file contain the load address.
|
||||
* default-text-encoding=<mode> - Specify default character encoding.
|
||||
Use "c64-petscii" for PETSCII. The default is low/high ASCII.
|
||||
|
||||
All of these things can be changed after the project has begun, but it's
|
||||
nice to have them configured in advance.
|
||||
|
@ -176,7 +176,8 @@
|
||||
"ExtensionScripts" : [
|
||||
],
|
||||
"Parameters" : {
|
||||
"first-word-is-load-addr":"true"
|
||||
"first-word-is-load-addr":"true",
|
||||
"default-text-encoding":"c64-petscii"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -191,6 +192,7 @@
|
||||
"ExtensionScripts" : [
|
||||
],
|
||||
"Parameters" : {
|
||||
"default-text-encoding":"c64-petscii"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -206,6 +208,7 @@
|
||||
"ExtensionScripts" : [
|
||||
],
|
||||
"Parameters" : {
|
||||
"default-text-encoding":"c64-petscii"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -219,6 +222,7 @@
|
||||
"ExtensionScripts" : [
|
||||
],
|
||||
"Parameters" : {
|
||||
"default-text-encoding":"c64-petscii"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -18,6 +18,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
||||
using Asm65;
|
||||
using TextScanMode = SourceGen.ProjectProperties.AnalysisParameters.TextScanMode;
|
||||
|
||||
namespace SourceGen {
|
||||
/// <summary>
|
||||
@ -28,11 +29,14 @@ namespace SourceGen {
|
||||
private const string ENTRY_FLAGS = "entry-flags";
|
||||
private const string UNDOCUMENTED_OPCODES = "undocumented-opcodes";
|
||||
private const string FIRST_WORD_IS_LOAD_ADDR = "first-word-is-load-addr";
|
||||
private const string DEFAULT_TEXT_ENCODING = "default-text-encoding";
|
||||
|
||||
private const string ENTRY_FLAG_EMULATION = "emulation";
|
||||
private const string ENTRY_FLAG_NATIVE_LONG = "native-long";
|
||||
private const string ENTRY_FLAG_NATIVE_SHORT = "native-short";
|
||||
|
||||
private const string TEXT_ENCODING_C64_PETSCII = "c64-petscii";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default load address.
|
||||
@ -105,16 +109,33 @@ namespace SourceGen {
|
||||
/// Gets the default setting for using the first two bytes of the file as the
|
||||
/// load address.
|
||||
///
|
||||
/// This is primarily for C64. Apple II DOS 3.3 binary files also put the load
|
||||
/// address first, followed by the length, but that's typically stripped out when
|
||||
/// This is primarily for C64 PRG files. Apple II DOS 3.3 binary files also put the
|
||||
/// load address first, followed by the length, but that's typically stripped out when
|
||||
/// the file is extracted.
|
||||
/// </summary>
|
||||
/// <param name="sysDef"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="sysDef">SystemDef instance.</param>
|
||||
/// <returns>True if the first word holds the load address.</returns>
|
||||
public static bool GetFirstWordIsLoadAddr(SystemDef sysDef) {
|
||||
return GetBoolParam(sysDef, FIRST_WORD_IS_LOAD_ADDR, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default setting for the text scan encoding mode.
|
||||
/// </summary>
|
||||
/// <param name="sysDef">SystemDef instance.</param>
|
||||
/// <returns>Preferred text scan mode.</returns>
|
||||
public static TextScanMode GetTextScanMode(SystemDef sysDef) {
|
||||
Dictionary<string, string> parms = sysDef.Parameters;
|
||||
TextScanMode mode = TextScanMode.LowHighAscii;
|
||||
|
||||
if (parms.TryGetValue(DEFAULT_TEXT_ENCODING, out string valueStr)) {
|
||||
if (valueStr == TEXT_ENCODING_C64_PETSCII) {
|
||||
mode = TextScanMode.C64Petscii;
|
||||
}
|
||||
}
|
||||
return mode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks for a parameter with a matching name and a boolean value.
|
||||
/// </summary>
|
||||
|
Loading…
x
Reference in New Issue
Block a user