do you user-defined literal? also some more notes on the digital scale (nw)

This commit is contained in:
Vas Crabb 2018-01-24 00:51:23 +11:00
parent 30add0e064
commit 7168abee36
6 changed files with 44 additions and 16 deletions

View File

@ -162,7 +162,7 @@ device_t *machine_config::device_add(device_t *owner, const char *tag, device_ty
device_t *machine_config::device_add(device_t *owner, const char *tag, device_type type, const XTAL &clock) device_t *machine_config::device_add(device_t *owner, const char *tag, device_type type, const XTAL &clock)
{ {
std::string msg = std::string("Instantiating device ") + tag; std::string msg = std::string("Instantiating device ") + tag;
clock.check(msg); clock.validate(msg);
return device_add(owner, tag, type, clock.value()); return device_add(owner, tag, type, clock.value());
} }
@ -202,7 +202,7 @@ device_t *machine_config::device_replace(device_t *owner, const char *tag, devic
device_t *machine_config::device_replace(device_t *owner, const char *tag, device_type type, const XTAL &clock) device_t *machine_config::device_replace(device_t *owner, const char *tag, device_type type, const XTAL &clock)
{ {
std::string msg = std::string("Replacing device ") + tag; std::string msg = std::string("Replacing device ") + tag;
clock.check(msg); clock.validate(msg);
return device_replace(owner, tag, type, clock.value()); return device_replace(owner, tag, type, clock.value());
} }

View File

@ -96,6 +96,7 @@ const double XTAL::known_xtals[] = {
4'915'200, 4'915'200,
5'000'000, /* Mutant Night */ 5'000'000, /* Mutant Night */
5'068'800, /* Usually used as MC2661 or COM8116 baud rate clock */ 5'068'800, /* Usually used as MC2661 or COM8116 baud rate clock */
5'185'000, /* Intel INTELLEC® 4 */
5'460'000, /* ec1840 and ec1841 keyboard */ 5'460'000, /* ec1840 and ec1841 keyboard */
5'529'600, /* Kontron PSI98 keyboard */ 5'529'600, /* Kontron PSI98 keyboard */
5'626'000, /* RCA CDP1869 PAL dot clock */ 5'626'000, /* RCA CDP1869 PAL dot clock */
@ -343,7 +344,7 @@ double XTAL::last_correct_value = -1;
double XTAL::xtal_error_low = 0; double XTAL::xtal_error_low = 0;
double XTAL::xtal_error_high = 0; double XTAL::xtal_error_high = 0;
bool XTAL::check(double base_clock) bool XTAL::validate(double base_clock)
{ {
if(base_clock == last_correct_value) if(base_clock == last_correct_value)
return true; return true;
@ -396,15 +397,15 @@ bool XTAL::check(double base_clock)
return false; return false;
} }
void XTAL::check(const char *message) const void XTAL::validate(const char *message) const
{ {
if(!check(m_base_clock)) if(!validate(m_base_clock))
fail(m_base_clock, message); fail(m_base_clock, message);
} }
void XTAL::check(const std::string &message) const void XTAL::validate(const std::string &message) const
{ {
if(!check(m_base_clock)) if(!validate(m_base_clock))
fail(m_base_clock, message); fail(m_base_clock, message);
} }
@ -545,7 +546,6 @@ reveals the following shipping frequencies as of 1/1/2008:
5.000MHz 5.000MHz
5.0688MHz 5.0688MHz
5.120MHz 5.120MHz
5.185MHz
5.223438MHz 5.223438MHz
5.5MHz 5.5MHz
5.5296MHz 5.5296MHz

View File

@ -64,8 +64,8 @@ public:
friend constexpr XTAL operator *(unsigned int mult, const XTAL &xtal); friend constexpr XTAL operator *(unsigned int mult, const XTAL &xtal);
friend constexpr XTAL operator *(double mult, const XTAL &xtal); friend constexpr XTAL operator *(double mult, const XTAL &xtal);
void check(const char *message) const; void validate(const char *message) const;
void check(const std::string &message) const; void validate(const std::string &message) const;
private: private:
double m_base_clock, m_current_clock; double m_base_clock, m_current_clock;
@ -75,7 +75,7 @@ private:
static const double known_xtals[]; static const double known_xtals[];
static double last_correct_value, xtal_error_low, xtal_error_high; static double last_correct_value, xtal_error_low, xtal_error_high;
static void fail(double base_clock, std::string message); static void fail(double base_clock, std::string message);
static bool check(double base_clock); static bool validate(double base_clock);
static void check_ordering(); static void check_ordering();
}; };
@ -86,4 +86,8 @@ constexpr XTAL operator *(int mult, const XTAL &xtal) { return XTAL(xta
constexpr XTAL operator *(unsigned int mult, const XTAL &xtal) { return XTAL(xtal.base(), mult * xtal.dvalue()); } constexpr XTAL operator *(unsigned int mult, const XTAL &xtal) { return XTAL(xtal.base(), mult * xtal.dvalue()); }
constexpr XTAL operator *(double mult, const XTAL &xtal) { return XTAL(xtal.base(), mult * xtal.dvalue()); } constexpr XTAL operator *(double mult, const XTAL &xtal) { return XTAL(xtal.base(), mult * xtal.dvalue()); }
constexpr XTAL operator ""_Hz_XTAL(long double clock) { return XTAL(double(clock)); }
constexpr XTAL operator ""_kHz_XTAL(long double clock) { return XTAL(double(clock * 1e3)); }
constexpr XTAL operator ""_MHz_XTAL(long double clock) { return XTAL(double(clock * 1e6)); }
#endif // MAME_EMU_DRIVERS_XTAL_H #endif // MAME_EMU_DRIVERS_XTAL_H

View File

@ -1040,7 +1040,7 @@ private:
----------------------------------*/ ----------------------------------*/
MACHINE_CONFIG_DERIVED(mod4_state::mod4, intellec4) MACHINE_CONFIG_DERIVED(mod4_state::mod4, intellec4)
MCFG_CPU_ADD("maincpu", I4004, 5185000. / 7) MCFG_CPU_ADD("maincpu", I4004, 5.185_MHz_XTAL / 7)
MCFG_I4004_ROM_MAP(intellec4_rom) MCFG_I4004_ROM_MAP(intellec4_rom)
MCFG_I4004_RAM_MEMORY_MAP(intellec4_ram_memory) MCFG_I4004_RAM_MEMORY_MAP(intellec4_ram_memory)
MCFG_I4004_ROM_PORTS_MAP(intellec4_rom_ports) MCFG_I4004_ROM_PORTS_MAP(intellec4_rom_ports)
@ -1231,7 +1231,7 @@ private:
----------------------------------*/ ----------------------------------*/
MACHINE_CONFIG_DERIVED(mod40_state::mod40, intellec4) MACHINE_CONFIG_DERIVED(mod40_state::mod40, intellec4)
MCFG_CPU_ADD("maincpu", I4040, 5185000. / 7) MCFG_CPU_ADD("maincpu", I4040, 5.185_MHz_XTAL / 7)
MCFG_I4040_ROM_MAP(intellec4_rom) MCFG_I4040_ROM_MAP(intellec4_rom)
MCFG_I4040_RAM_MEMORY_MAP(intellec4_ram_memory) MCFG_I4040_RAM_MEMORY_MAP(intellec4_ram_memory)
MCFG_I4040_ROM_PORTS_MAP(intellec4_rom_ports) MCFG_I4040_ROM_PORTS_MAP(intellec4_rom_ports)

View File

@ -98,7 +98,7 @@ TODO:
#include "softlist.h" #include "softlist.h"
#define MAIN_CLOCK XTAL(15'974'400) static constexpr XTAL MAIN_CLOCK = 15.9744_MHz_XTAL;
static ADDRESS_MAP_START( osborne1_mem, AS_PROGRAM, 8, osborne1_state ) static ADDRESS_MAP_START( osborne1_mem, AS_PROGRAM, 8, osborne1_state )

View File

@ -2,8 +2,9 @@
/* /*
Sartorius 3733 digital scale Sartorius 3733 digital scale
Visible ICs: Mainboard:
* Intel D4040 CPU * 4194.304 kHz crystal
* Intel D4040 4-bit CPU
* Intel D4289 8-bit memory controller * Intel D4289 8-bit memory controller
* 2 * Intel P4002-1 (64+16)*4 RAM (sockets for 2 * Intel P4002-2 unpopulated) * 2 * Intel P4002-1 (64+16)*4 RAM (sockets for 2 * Intel P4002-2 unpopulated)
* 2 * 2708 1k*8 ROM labelled "129/0" and "129/1" * 2 * 2708 1k*8 ROM labelled "129/0" and "129/1"
@ -11,15 +12,38 @@
* Intersil IM6561AIJN 256*4 CMOS RAM * Intersil IM6561AIJN 256*4 CMOS RAM
* RCA CD4007AE dual complementary pair plus inverter * RCA CD4007AE dual complementary pair plus inverter
* National Semicondictor CD4049CN hex inverting buffer * National Semicondictor CD4049CN hex inverting buffer
* Intel P4201A clock generator
* 4 * Motorola MC14099B 8-bit addressable latch * 4 * Motorola MC14099B 8-bit addressable latch
* 2 * RCA CD4052BE 2-channel 4:1 analog switch * 2 * RCA CD4052BE 2-channel 4:1 analog switch
Display board (connects to mainboard via 28-pin edge connector):
* MM74C42 1-of-10 decoder
* RCA CD4071BE Quad 2-input OR gate
* RCA CD4011BE Quad 2-input NAND gate
* RCA CD4055BE BCD to 7-segment decoder with high-voltage outputs
* 12 TO-92 transistors near the MM74C42 and CD4071BE
* 7 TO-92 transistors near the CD4011BE
* 7 TO-92 transistors near the CD4055BE
Front panel has a digital display, an "R" button for switching between Front panel has a digital display, an "R" button for switching between
300g and 3kg ranges, and a T button for zeroing. Rear panel has a 300g and 3kg ranges, and a T button for zeroing. Rear panel has a
three-position rotary switch to select between standalone operation and three-position rotary switch to select between standalone operation and
data acquisition modes, and a 50-pin micro ribbon connector for data data acquisition modes, and a 50-pin micro ribbon connector for data
communication. communication.
The vacuum fluorescent display has seven 7-segment digits, each of
which can be followed by a . (stop) or , (comma) for digit grouping or
decimal point. The last digit can also show the vulgar fraction ½
using the G segment as the fraction bar and additional 1 and 2 segments
(these could potentially be used independently as well). To the right
of the least significant digit, the display can show % (percent) or g
(lowecase G). To the legt of the leftmost digit, the display has,
from top to bottom, + (plus), - (minus), and a small circle.
Strangely, the P4201A clock generator IC is a long way from the
crystal. The mode pin is tied to Vss, putting it in divide-by-seven
mode.
No dates or other ASCII strings in program ROM. IC date codes up to No dates or other ASCII strings in program ROM. IC date codes up to
1978. 1978.
*/ */