Config settings cleanup: unused, misdocumented and misnamed settings

#723 · open · 3 comments

View on GitHub ↗

wdl1908

Wayne, Here is the analysis Claude did while preparing the SPEC and RULES for kconfig tool (see #722). If you want, I can go through them and make pull requests for the things that need changing. Or, if you'd rather handle them yourself, this is just a report of what could be fixed. Nothing is broken; these are just drifts that happen normally in a project this big. --- # RomWBW config settings analysis 2026-09-28, on upstream/master `5dc2ccfa` ## What was checked - `cfg_MASTER.asm`: 493 `.EQU` lines. 3 of them are constants, not settings (`EZ80TMR_NONE/INT/FIRM`, see B5), so 490 real settings. - 29 platform files (`cfg_<plt>.asm`) plus `cfg_TEMPLATE.asm`. `cfg_UNA.asm` left out, it doesn't use cfg_MASTER. - All 50 `Config/*.asm` files. - Every text source under `Source/` (asm, inc, z80, mac, c, h, lib, scripts), comments stripped, for where each setting name is read. `Source/Doc` left out. - Every finding below was looked at by hand in the source. Limits: "read" means the name appears in code outside the config files. A name used only inside dead code still counts as read, so the unused list is a lower bound. ## Summary | # | Finding | Count | Verdict | |---|---|---|---| | A1 | Switches nothing reads | 9 | redundant, remove or wire up | | A2 | Address constants nothing uses | 4 | redundant | | A3 | Address constants used only by other settings | 5 | keep, not really settings | | B1 | Pick-list comments that are wrong | 11 settings | adjust comment | | B2 | Pick-list comments missing `_NONE` | 26 settings | adjust comment | | B3 | Setting uses the wrong constant family | 1 (SYQMODE) | adjust value | | B4 | Duplicate `.SET` lines in one file | 2 files | remove duplicates | | B5 | Constants defined in cfg_MASTER | 3 | move to std.asm | | B6 | Settings without a comment | 16 | add comments | | B7 | cfg_TEMPLATE.asm is behind cfg_MASTER | 32 settings | add them | | B8 | Driver settings not named after their driver | 9 + 16 | rename | | C | std files restating inherited values | 1329 lines | by design, keep | | D | Checked, nothing found | | | ## A. Redundant settings ### A1. Switches nothing reads (9) These look like they turn something on or off, but no source file reads them. Changing them does nothing. | Setting | cfg_MASTER line | What's going on | |---|---|---| | `DS7RTCMODE` | 220 | Chose PCF8584 mode for the DS1307 driver. The `#IF` that read it was removed in `7835eb5d` (Wayne, "Duodyne Work in Progress", 2023-08-02). Still set in 24 platform files. | | `CHTRACE` | 446 | The CH drivers read `CHUSBTRACE` and `CHSDTRACE` (lines 447-448). `CHTRACE` is left over. | | `SN76489CHNOUT` | 605 | `sn76489.asm` never reads it; the `SNCHAN_*` constants exist in std.asm but nothing uses them either. Set in 20 platform files. | | `EZ80IOBASE` | 639 | Not read anywhere. Set in cfg_RCEZ80 and cfg_TEMPLATE. | | `PRPSDENABLE` | 458 | `prp.asm` always builds the SD part when `PRPENABLE` is on. | | `PRPCONENABLE` | 460 | Same, console part always built. | | `PPPSDENABLE` | 464 | `ppp.asm` always builds the SD part when `PPPENABLE` is on. | | `PPPCONENABLE` | 466 | Same, console part always built. | | `ESPCONENABLE` | 469 | `esp.asm` always builds the console part. | The five PRP/PPP/ESP ones look like real switches that were never wired up, so either remove them or make the drivers honor them. ### A2. Address constants nothing uses (4) `N8_PPI1` (103), `MK4_IDE` (114), `MK4_XAR` (115), `MK4_SD` (116). Set in their platform file and cfg_TEMPLATE, never read, not even as the value of another setting. They document the board's I/O map, nothing more. ### A3. Address constants used only by other settings (5) `N8_PPI0`, `N8_RTC`, `RPH_PPI0`, `RPH_RTC`, `MK4_RTC`. No driver reads them, but the platform files use them as values (`RTCIO .SET N8_RTC`, `PPIDE0BASE .SET N8_PPI0`, ...). They are useful and should stay. They aren't really settings, though: changing one only matters through the settings built from it. ## B. Settings that need adjusting ### B1. Pick-list comments that are wrong (11) The comment lists the choices by hand, and in these the list doesn't match the constants that really exist. | Setting | Comment says | Real constants | |---|---|---| | `PLATFORM` | `PLT_[...STDZ180...]` | `PLT_STDZ180` doesn't exist; `PLT_MSX` is missing | | `MEMMGR` | `MM_[SBC\|Z2\|...\|EZ512]` | missing `MM_ZRC`, `MM_SZ80`, `MM_MSX` | | `FDMODE` | `FDMODE_[...]` | missing `FDMODE_DUO` | | `SDMODE` | `SDMODE_[...]` | missing `SDMODE_T35ALT` | | `SCC1MODE` | `SIOMODE_[STD\|SZ80]` | it's an SCC: `SCCMODE_STD`, `SCCMODE_SZ80` (SCC0MODE is right) | | `PPIDE0MODE`, `PPIDE1MODE`, `PPIDE2MODE` | `IDEMODE_[STD\|S100A\|S100B]` | `PPIDEMODE_STD/S100A/S100B`, and `PPIDEMODE_MSX` is missing | | `EZ80_WSMD_TYP` | `EZ80WSMD_[CALC\|CYCLES]` | `EZ80WSMD_WAIT` not listed, maybe on purpose (FWSMD says "CYCLES NOT ALLOWED", this one says nothing) | | `EZ80_FWSMD_TYP` | `EZ80RMMD_[CALC\|WAIT]` | wrong prefix, `EZ80RMMD_` doesn't exist: `EZ80WSMD_CALC/WAIT` | | `DMAMODE` | `(NONE\|ECB\|...\|DUO)` | written without the prefix, and `DMAMODE_VDG` is missing | The same comments are copied into every platform file, so each fix is one line in cfg_MASTER plus the copies. ### B2. Pick-list comments missing `_NONE` (26) Most lists leave out the `_NONE` choice that the code does handle: `PLATFORM`, `CPUFAM`, `BIOS`, `MEMMGR`, `LEDMODE`, `VDAEMU` (`EMUTYP_NONE`), `DSRTCMODE`, `DS7RTCMODE`, `SIO0MODE`, `SIO1MODE`, `SCC0MODE`, `SCC1MODE`, `TMSMODE`, `FDMODE`, `FD0TYPE`, `FD1TYPE`, `IDE0-2MODE`, `PPIDE0-2MODE`, `SDMODE`, `SCSIMODE`, `AYMODE`, `EZ80TIMER` (`EZ80TMR_NONE`). Harmless, but a user reading the comment doesn't know the choice exists. ### B3. SYQMODE uses the IMM constants cfg_MASTER line 557: `SYQMODE .EQU IMMMODE_NONE`, and 15 platform and config files (plus cfg_TEMPLATE) set `SYQMODE .SET IMMMODE_MG014` or `IMMMODE_SPP`. `syq.asm` compares with `SYQMODE_MG014` / `SYQMODE_SPP`. It works only because both families have the same numbers (0, 1, 2 in std.asm lines 365-373). The comment already says `SYQMODE_[NONE|SPP|MG014]`. Fix: use the SYQMODE_ constants. ### B4. Duplicate `.SET` lines in one file - `Config/N8PC_std.asm`: `PKDENABLE` is set FALSE on line 69 and TRUE on line 94. The last one wins, so the first is misleading. `DSKYENABLE` (67, 93) and `FPSW_ENABLE` (65, 98) are set twice to the same value. - `Config/RCEZ80_std.asm`: the CH376 block (`CHNATIVEENABLE`, `CHSCSIENABLE`, `CHUFIENABLE`, `CHNATIVEEZ80`, `CHNATIVEFORCE`) appears twice, lines 77-81 and 92-96, same values. ### B5. Constants defined in cfg_MASTER `EZ80TMR_NONE`, `EZ80TMR_INT`, `EZ80TMR_FIRM` (lines 633-635) are the choices for `EZ80TIMER`, but they sit in cfg_MASTER as if they were settings. Every other pick list's constants are in std.asm or hbios.inc. Moving them to std.asm makes `EZ80TIMER` a normal pick list. ### B6. Settings without a comment (16) `I2CEEPROMSHIFT0-7` and `I2CEEPROMBLKCNT0-7` (lines 489-518). ### B7. cfg_TEMPLATE.asm is behind cfg_MASTER (32) cfg_TEMPLATE.asm (the starting point for a new platform file) has 461 of the 493 lines. Missing, all recent additions: `I2CPCF_MULTIMASTER`, `FP_USE_I2C`, `FP_I2CADR`, the whole I2CEEPROM set (`I2CEEPROMENABLE`, slots 0-7 with SHIFT/BLKCNT, `I2CEEPROMDETECT`, `I2CEEPROMDETMASK`), `SAAENABLE`, `SAABASE`. ### B8. Driver settings not named after their driver These settings belong to a driver, but their names don't start with the name in the driver's ENABLE setting, so a search for the driver's name doesn't find them: | Setting(s) | Driver ENABLE | Driver name | |---|---|---| | `AYMODE`, `AY_CLK`, `AY_FORCE` | `AY38910ENABLE` | `AY38910` | | `SNMODE`, `SN7CLK` | `SN76489ENABLE` | `SN76489` | | `VGMBASE` | `YM2612ENABLE` | `YM2612` | | `_CH376_DATA_PORT`, `_CH376_COMMAND_PORT`, `_USB_MODULE_LEDS` | `CHNATIVEENABLE` | `CHNATIVE` | | `I2CEEPROMSHIFTn`, `I2CEEPROMBLKCNTn` (16) | `I2CEEPROMnENABLE` | `I2CEEPROMn` | For the I2CEEPROM slots the slot number sits at the end of the name instead of right after `I2CEEPROM`, so a slot's settings don't share a common start. Renaming the older settings touches every platform and config file. The I2CEEPROM ones are new and set in few files, so renaming them (`I2CEEPROMnSHIFT`, `I2CEEPROMnBLKCNT`) is realistic. ## C. std files restating inherited values (by design) 1329 `.SET` lines in 48 of the 50 Config files set a value the file already inherits. Example: `RCZ80_std.asm` restates 46 of its 59 settings from `cfg_RCZ80.asm`; `MSX_std` restates all 37. Not a problem: the std file is the platform's baseline, its sensible defaults. A setting listed there says "this is one you'd typically change for this platform", even when the value is the same as cfg_<plt> or cfg_MASTER. Nothing to report upstream. The only non-std file with restated lines is `RCZ80_xosera.asm`, 2 of 6 (`XOS_BASE`, `XOSSIZ`), an example user file; harmless. Platform files restating cfg_MASTER defaults are the same idea (each `cfg_<plt>` is a near-complete list for its platform), not counted. ## D. Checked, nothing found - No TRUE/FALSE setting set to a non-TRUE/FALSE value anywhere. - No value outside a `(0-3)` style range given in its comment. - No `.SET` of a name that cfg_MASTER doesn't define (the assembler would refuse it anyway). ---

Comments

wwarthen

Hi @wdl1908, This is very helpful. I definitely want to work through these myself. A lot of these are very obvious/simple fixes. However, there are many that are "inconsistencies". Many of them I was already aware of, but had not addressed because of the impact on existing users who have their own config files. I will work through everything and document my actions in this issue. It will take some time. Thanks, Wayne

wwarthen

Latest check-in addresses all items in Part A. A binary comparison of the build output shows byte identical output. Part A raises an issue for me as to where platform specific constants should live. Thanks, Wayne

wwarthen

I have committed the corrections for part B. Parts C and D have no actions. I think this is done. Thanks, Wayne