diff options
| author | 2026-04-09 03:02:26 -0400 | |
|---|---|---|
| committer | 2026-04-09 09:02:26 +0200 | |
| commit | 4350d24822f870e19d2cd975133944c3b55fa913 (patch) | |
| tree | ced342a47d4d7ac51bfb7775a60d30e505e898e5 | |
| parent | 160421f9b9759903ccfae0d250fb7da358cb1b81 (diff) | |
sinclair/*: Moved macro constants into local scope. (#15209)
| -rw-r--r-- | src/mame/sinclair/spec128.h | 15 | ||||
| -rw-r--r-- | src/mame/sinclair/spectrum.h | 42 | ||||
| -rw-r--r-- | src/mame/sinclair/sprinter.cpp | 36 | ||||
| -rw-r--r-- | src/mame/sinclair/timex.h | 23 |
4 files changed, 57 insertions, 59 deletions
diff --git a/src/mame/sinclair/spec128.h b/src/mame/sinclair/spec128.h index d5072c99eec..726cdcc4a71 100644 --- a/src/mame/sinclair/spec128.h +++ b/src/mame/sinclair/spec128.h @@ -26,6 +26,13 @@ public: void spectrum_128(machine_config &config); protected: + static inline constexpr XTAL X1_128_SINCLAIR = 35.469_MHz_XTAL; // Main clock (Sinclair 128K model) + + // 128K machines take an extra 4 cycles per scan line - add this to retrace + static inline constexpr int SPEC128_UNSEEN_LINES = 15; + static inline constexpr int SPEC128_RETRACE_CYCLES = 52; + static inline constexpr int SPEC128_CYCLES_PER_LINE = 228; + memory_bank_array_creator<1> m_bank_rom; memory_bank_array_creator<4> m_bank_ram; @@ -58,12 +65,4 @@ private: void spectrum_128_fetch(address_map &map) ATTR_COLD; }; -#define X1_128_AMSTRAD 35'469'000 // Main clock (Amstrad 128K model, +2A?) -#define X1_128_SINCLAIR 35.469_MHz_XTAL // Main clock (Sinclair 128K model) - -// 128K machines take an extra 4 cycles per scan line - add this to retrace -#define SPEC128_UNSEEN_LINES 15 -#define SPEC128_RETRACE_CYCLES 52 -#define SPEC128_CYCLES_PER_LINE 228 - #endif // MAME_SINCLAIR_SPEC128_H diff --git a/src/mame/sinclair/spectrum.h b/src/mame/sinclair/spectrum.h index 2cb4408e90e..80eefcc2a95 100644 --- a/src/mame/sinclair/spectrum.h +++ b/src/mame/sinclair/spectrum.h @@ -25,27 +25,6 @@ // Spectrum crystals -#define X1 14_MHz_XTAL // Main clock (48k Spectrum) -#define X2 XTAL(4'433'619) // PAL color subcarrier - -// Spectrum screen size in pixels -#define SPEC_UNSEEN_LINES 16 // Non-visible scanlines before first border line. Some of these may be vertical retrace. -#define SPEC_TOP_BORDER 48 // Number of border lines before actual screen -#define SPEC_DISPLAY_YSIZE 192 // Vertical screen resolution -#define SPEC_BOTTOM_BORDER 56 // Number of border lines at bottom of screen -#define SPEC_SCREEN_HEIGHT (SPEC_TOP_BORDER + SPEC_DISPLAY_YSIZE + SPEC_BOTTOM_BORDER) - -#define SPEC_LEFT_BORDER 48 // Number of left hand border pixels -#define SPEC_DISPLAY_XSIZE 256 // Horizontal screen resolution -#define SPEC_RIGHT_BORDER 48 // Number of right hand border pixels -#define SPEC_SCREEN_WIDTH (SPEC_LEFT_BORDER + SPEC_DISPLAY_XSIZE + SPEC_RIGHT_BORDER) - -#define SPEC_LEFT_BORDER_CYCLES 24 // Cycles to display left hand border -#define SPEC_DISPLAY_XSIZE_CYCLES 128 // Horizontal screen resolution -#define SPEC_RIGHT_BORDER_CYCLES 24 // Cycles to display right hand border -#define SPEC_RETRACE_CYCLES 48 // Cycles taken for horizontal retrace -#define SPEC_CYCLES_PER_LINE 224 // Number of cycles to display a single line - class spectrum_state : public driver_device { public: @@ -87,6 +66,27 @@ public: void init_spectrum(); protected: + static inline constexpr XTAL X1 = 14_MHz_XTAL; // Main clock (48k Spectrum) + static inline constexpr XTAL X2 = XTAL(4'433'619); // PAL color subcarrier + + // Spectrum screen size in pixels + static inline constexpr int SPEC_UNSEEN_LINES = 16; // Non-visible scanlines before first border line. Some of these may be vertical retrace. + static inline constexpr int SPEC_TOP_BORDER = 48; // Number of border lines before actual screen + static inline constexpr int SPEC_DISPLAY_YSIZE = 192; // Vertical screen resolution + static inline constexpr int SPEC_BOTTOM_BORDER = 56; // Number of border lines at bottom of screen + static inline constexpr int SPEC_SCREEN_HEIGHT = (SPEC_TOP_BORDER + SPEC_DISPLAY_YSIZE + SPEC_BOTTOM_BORDER); + + static inline constexpr int SPEC_LEFT_BORDER = 48; // Number of left hand border pixels + static inline constexpr int SPEC_DISPLAY_XSIZE = 256; // Horizontal screen resolution + static inline constexpr int SPEC_RIGHT_BORDER = 48; // Number of right hand border pixels + static inline constexpr int SPEC_SCREEN_WIDTH = (SPEC_LEFT_BORDER + SPEC_DISPLAY_XSIZE + SPEC_RIGHT_BORDER); + + static inline constexpr int SPEC_LEFT_BORDER_CYCLES = 24; // Cycles to display left hand border + static inline constexpr int SPEC_DISPLAY_XSIZE_CYCLES = 128; // Horizontal screen resolution + static inline constexpr int SPEC_RIGHT_BORDER_CYCLES = 24; // Cycles to display right hand border + static inline constexpr int SPEC_RETRACE_CYCLES = 48; // Cycles taken for horizontal retrace + static inline constexpr int SPEC_CYCLES_PER_LINE = 224; // Number of cycles to display a single line + memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific m_program; memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific m_io; diff --git a/src/mame/sinclair/sprinter.cpp b/src/mame/sinclair/sprinter.cpp index bdb15e89310..dfd1c43e719 100644 --- a/src/mame/sinclair/sprinter.cpp +++ b/src/mame/sinclair/sprinter.cpp @@ -175,24 +175,24 @@ private: ACCEL_ON }; - static constexpr XTAL X_SP = 42_MHz_XTAL; // TODO X1 after spectrumless - - static constexpr u16 SPRINT_WIDTH = 896; - static constexpr u16 SPRINT_BORDER_RIGHT = 48; - static constexpr u16 SPRINT_SCREEN_XSIZE = 640; - static constexpr u16 SPRINT_BORDER_LEFT = 48; - static constexpr u16 SPRINT_XVIS = SPRINT_BORDER_RIGHT + SPRINT_SCREEN_XSIZE + SPRINT_BORDER_LEFT; - - static constexpr u16 SPRINT_HEIGHT = 320; - static constexpr u16 SPRINT_BORDER_TOP = 16; - static constexpr u16 SPRINT_SCREEN_YSIZE = 256; - static constexpr u16 SPRINT_BORDER_BOTTOM = 16; - static constexpr u16 SPRINT_YVIS = SPRINT_BORDER_TOP + SPRINT_SCREEN_YSIZE + SPRINT_BORDER_BOTTOM; - - static constexpr u16 BANK_RAM_MASK = 1 << 8; - static constexpr u16 BANK_FASTRAM_MASK = 1 << 9; - static constexpr u16 BANK_ISA_MASK = 1 << 10; - static constexpr u16 BANK_WRDISBL_MASK = 1 << 12; + static inline constexpr XTAL X_SP = 42_MHz_XTAL; // TODO X1 after spectrumless + + static inline constexpr u16 SPRINT_WIDTH = 896; + static inline constexpr u16 SPRINT_BORDER_RIGHT = 48; + static inline constexpr u16 SPRINT_SCREEN_XSIZE = 640; + static inline constexpr u16 SPRINT_BORDER_LEFT = 48; + static inline constexpr u16 SPRINT_XVIS = SPRINT_BORDER_RIGHT + SPRINT_SCREEN_XSIZE + SPRINT_BORDER_LEFT; + + static inline constexpr u16 SPRINT_HEIGHT = 320; + static inline constexpr u16 SPRINT_BORDER_TOP = 16; + static inline constexpr u16 SPRINT_SCREEN_YSIZE = 256; + static inline constexpr u16 SPRINT_BORDER_BOTTOM = 16; + static inline constexpr u16 SPRINT_YVIS = SPRINT_BORDER_TOP + SPRINT_SCREEN_YSIZE + SPRINT_BORDER_BOTTOM; + + static inline constexpr u16 BANK_RAM_MASK = 1 << 8; + static inline constexpr u16 BANK_FASTRAM_MASK = 1 << 9; + static inline constexpr u16 BANK_ISA_MASK = 1 << 10; + static inline constexpr u16 BANK_WRDISBL_MASK = 1 << 12; bool acc_ena() const { return BIT(m_all_mode, 0); } bool cbl_mode() const { return BIT(m_cbl_xx, 7); } diff --git a/src/mame/sinclair/timex.h b/src/mame/sinclair/timex.h index 33f29531f49..47632f869df 100644 --- a/src/mame/sinclair/timex.h +++ b/src/mame/sinclair/timex.h @@ -16,18 +16,6 @@ #include "bus/generic/carts.h" #include "bus/generic/slot.h" -/* Border sizes for TS2068. These are guesses based on the number of cycles - available per frame. */ -#define TS2068_TOP_BORDER 32 -#define TS2068_BOTTOM_BORDER 32 -#define TS2068_SCREEN_HEIGHT (TS2068_TOP_BORDER + SPEC_DISPLAY_YSIZE + TS2068_BOTTOM_BORDER) - -/* Double the border sizes to maintain ratio of screen to border */ -#define TS2068_LEFT_BORDER 96 /* Number of left hand border pixels */ -#define TS2068_DISPLAY_XSIZE 512 /* Horizontal screen resolution */ -#define TS2068_RIGHT_BORDER 96 /* Number of right hand border pixels */ -#define TS2068_SCREEN_WIDTH (TS2068_LEFT_BORDER + TS2068_DISPLAY_XSIZE + TS2068_RIGHT_BORDER) - class tc2048_state : public spectrum_128_state { public: @@ -39,6 +27,17 @@ public: void tc2048(machine_config &config); protected: + // Border sizes for TS2068. These are guesses based on the number of cycles available per frame. + static inline constexpr int TS2068_TOP_BORDER = 32; + static inline constexpr int TS2068_BOTTOM_BORDER = 32; + static inline constexpr int TS2068_SCREEN_HEIGHT = (TS2068_TOP_BORDER + SPEC_DISPLAY_YSIZE + TS2068_BOTTOM_BORDER); + + // Double the border sizes to maintain ratio of screen to border + static inline constexpr int TS2068_LEFT_BORDER = 96; // Number of left hand border pixels + static inline constexpr int TS2068_DISPLAY_XSIZE = 512; // Horizontal screen resolution + static inline constexpr int TS2068_RIGHT_BORDER = 96; // Number of right hand border pixels + static inline constexpr int TS2068_SCREEN_WIDTH = (TS2068_LEFT_BORDER + TS2068_DISPLAY_XSIZE + TS2068_RIGHT_BORDER); + virtual void machine_reset() override ATTR_COLD; u8 port_ff_r(); |
