config system cleanup - hex values
This commit is contained in:
1 parent
299e9cd524
commit
d0081fd21e
8 files changed
+43
-19
No files matched your search
@@ -1,5 +1,5 @@
|
||||
|
||||
!set CONFIG_ID = $00 ; should be 1 byte, different for each config file!
|
||||
;; #CONFIG# ID $00 ; should be 1 byte, different for each config file!
|
||||
|
||||
;
|
||||
; Please read CONFIG.md before modifying this file!
|
||||
@@ -65,8 +65,8 @@
|
||||
|
||||
; Sound support
|
||||
|
||||
; !set CONFIG_SID_2ND_ADDRESS = $D420
|
||||
; !set CONFIG_SID_3RD_ADDRESS = $D440
|
||||
;; #CONFIG# SID_2ND_ADDRESS NO
|
||||
;; #CONFIG# SID_3RD_ADDRESS NO
|
||||
;; #CONFIG# SID_D4XX NO
|
||||
;; #CONFIG# SID_D5XX NO
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
|
||||
!set CONFIG_ID = $04 ; should be 1 byte, different for each config file!
|
||||
;; #CONFIG# ID $04 ; should be 1 byte, different for each config file!
|
||||
|
||||
;
|
||||
; Please read CONFIG.md before modifying this file!
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
!set CONFIG_ID = $01 ; should be 1 byte, different for each config file!
|
||||
;; #CONFIG# ID $01 ; should be 1 byte, different for each config file!
|
||||
|
||||
;
|
||||
; Please read CONFIG.md before modifying this file!
|
||||
@@ -55,8 +55,8 @@
|
||||
|
||||
; Sound support
|
||||
|
||||
; !set CONFIG_SID_2ND_ADDRESS = $D420
|
||||
; !set CONFIG_SID_3RD_ADDRESS = $D440
|
||||
;; #CONFIG# SID_2ND_ADDRESS NO
|
||||
;; #CONFIG# SID_3RD_ADDRESS NO
|
||||
;; #CONFIG# SID_D4XX NO
|
||||
;; #CONFIG# SID_D5XX NO
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
!set CONFIG_ID = $02 ; should be 1 byte, different for each config file!
|
||||
;; #CONFIG# ID $02 ; should be 1 byte, different for each config file!
|
||||
|
||||
;
|
||||
; Please read CONFIG.md before modifying this file!
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
!set CONFIG_ID = $F0 ; should be 1 byte, different for each config file!
|
||||
;; #CONFIG# ID $F0 ; should be 1 byte, different for each config file!
|
||||
|
||||
;
|
||||
; Please read CONFIG.md before modifying this file!
|
||||
@@ -55,8 +55,8 @@
|
||||
|
||||
; Sound support
|
||||
|
||||
; !set CONFIG_SID_2ND_ADDRESS = $D420
|
||||
; !set CONFIG_SID_3RD_ADDRESS = $D440
|
||||
;; #CONFIG# SID_2ND_ADDRESS NO
|
||||
;; #CONFIG# SID_3RD_ADDRESS NO
|
||||
;; #CONFIG# SID_D4XX NO
|
||||
;; #CONFIG# SID_D5XX NO
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
!set CONFIG_ID = $03 ; should be 1 byte, different for each config file!
|
||||
;; #CONFIG# ID $03 ; should be 1 byte, different for each config file!
|
||||
|
||||
;
|
||||
; Please read CONFIG.md before modifying this file!
|
||||
@@ -45,8 +45,8 @@
|
||||
|
||||
; Sound support
|
||||
|
||||
; !set CONFIG_SID_2ND_ADDRESS = $D420
|
||||
; !set CONFIG_SID_3RD_ADDRESS = $D440
|
||||
;; #CONFIG# SID_2ND_ADDRESS NO
|
||||
;; #CONFIG# SID_3RD_ADDRESS NO
|
||||
;; #CONFIG# SID_D4XX YES
|
||||
;; #CONFIG# SID_D5XX YES
|
||||
|
||||
|
||||
@@ -189,10 +189,16 @@
|
||||
!if (counter != 0) { !error "Do not use CONFIG_SID_* options for MEGA65 motherboard" }
|
||||
}
|
||||
!ifdef CONFIG_SID_2ND_ADDRESS {
|
||||
!if (CONFIG_SID_2ND_ADDRESS = $D400) { !error "CONFIG_SID_2ND_ADDRESS points to the 1st SID" }
|
||||
!if (CONFIG_SID_2ND_ADDRESS = $D400) { !error "CONFIG_SID_2ND_ADDRESS points to the 1st SID" }
|
||||
!if (CONFIG_SID_2ND_ADDRESS < $D420) { !error "CONFIG_SID_2ND_ADDRESS needs hex value from $D420-$D7E0 range" }
|
||||
!if (CONFIG_SID_2ND_ADDRESS > $D7E0) { !error "CONFIG_SID_2ND_ADDRESS needs hex value from $D420-$D7E0 range" }
|
||||
!if ((CONFIG_SID_2ND_ADDRESS % $20) != 0) { !error "CONFIG_SID_2ND_ADDRESS has to be aligned to $20" }
|
||||
}
|
||||
!ifdef CONFIG_SID_3RD_ADDRESS {
|
||||
!if (CONFIG_SID_3RD_ADDRESS = $D400) { !error "CONFIG_SID_3RD_ADDRESS points to the 1st SID" }
|
||||
!if (CONFIG_SID_3RD_ADDRESS = $D400) { !error "CONFIG_SID_3RD_ADDRESS points to the 1st SID" }
|
||||
!if (CONFIG_SID_3RD_ADDRESS < $D420) { !error "CONFIG_SID_3RD_ADDRESS needs hex value from $D420-$D7E0 range" }
|
||||
!if (CONFIG_SID_3RD_ADDRESS > $D7E0) { !error "CONFIG_SID_3RD_ADDRESS needs hex value from $D420-$D7E0 range" }
|
||||
!if ((CONFIG_SID_3RD_ADDRESS % $20) != 0) { !error "CONFIG_SID_3RD_ADDRESS has to be aligned to $20" }
|
||||
}
|
||||
!ifdef CONFIG_SID_2ND_ADDRESS { !ifdef CONFIG_SID_3RD_ADDRESS {
|
||||
!if (CONFIG_SID_2ND_ADDRESS = CONFIG_SID_3RD_ADDRESS) { !error "Configured SIDs have the same addresses" }
|
||||
|
||||
+21
-3
@@ -117,6 +117,8 @@ private:
|
||||
typedef struct ConfigEntry {
|
||||
std::string key;
|
||||
std::string valStr; // XXX add support for string values
|
||||
uint32_t valInt;
|
||||
bool valIntValid;
|
||||
} ConfigEntry;
|
||||
|
||||
std::map<uint32_t, ConfigEntry> configEntries;
|
||||
@@ -725,8 +727,17 @@ void SourceFile::preprocess()
|
||||
{
|
||||
// XXX add spacing
|
||||
// XXX add support for string values
|
||||
outStream << "!set CONFIG_" << configEntries[lineNum].key << " = 1" <<
|
||||
" " << line;
|
||||
outStream << "!set CONFIG_" << configEntries[lineNum].key << " = ";
|
||||
if (configEntries[lineNum].valIntValid)
|
||||
{
|
||||
outStream << "$" << std::hex << configEntries[lineNum].valInt;
|
||||
}
|
||||
else
|
||||
{
|
||||
outStream << "1";
|
||||
}
|
||||
|
||||
outStream << " " << line;
|
||||
|
||||
const std::string outString = outStream.str();
|
||||
content.insert(content.end(), outString.begin(), outString.end());
|
||||
@@ -818,7 +829,14 @@ void SourceFile::preprocessLine_Config(const std::list<std::string> &tokens, std
|
||||
if (valStr.compare("NO") == 0) return;
|
||||
else if (valStr.compare("YES") == 0)
|
||||
{
|
||||
configEntries[lineNum].key = key;
|
||||
configEntries[lineNum].key = key;
|
||||
configEntries[lineNum].valIntValid = false;
|
||||
}
|
||||
else if (valStr.length() > 1 && valStr[0] == '$')
|
||||
{
|
||||
configEntries[lineNum].key = key;
|
||||
configEntries[lineNum].valInt = std::stoul(valStr.substr(1, std::string::npos), nullptr, 16);
|
||||
configEntries[lineNum].valIntValid = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user