1 // license:BSD-3-Clause
2 // copyright-holders:AJR
3 /***********************************************************************************************************************************
4 
5     Skeleton driver for Wyse WY-150 and related terminals.
6 
7     The WY-150, originally introduced in Nov. 1988, was the first of the "terminals of the future" that Wyse sold well into the
8     1990s. The WY-160 is a graphical terminal that runs on different but clearly related hardware.
9 
10     All video functions in these terminals are integrated into ASICs (e.g. 211009-01, 211009-02). The 8032 generates all active
11     signals for both the main serial port and the serial keyboard. Three 8Kx8 SRAMs are used to store characters, attributes and
12     font data; the second is also battery-backed.
13 
14 ************************************************************************************************************************************/
15 
16 #include "emu.h"
17 #include "cpu/mcs51/mcs51.h"
18 #include "machine/nvram.h"
19 #include "screen.h"
20 
21 class wy150_state : public driver_device
22 {
23 public:
wy150_state(const machine_config & mconfig,device_type type,const char * tag)24 	wy150_state(const machine_config &mconfig, device_type type, const char *tag)
25 		: driver_device(mconfig, type, tag)
26 		, m_screen(*this, "screen")
27 	{
28 	}
29 
30 	void wy150(machine_config &config);
31 
32 protected:
33 	virtual void machine_start() override;
34 	virtual void driver_start() override;
35 
36 private:
37 	u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
38 
39 	void prog_map(address_map &map);
40 	void ext_map(address_map &map);
41 
42 	required_device<screen_device> m_screen;
43 };
44 
45 
machine_start()46 void wy150_state::machine_start()
47 {
48 }
49 
screen_update(screen_device & screen,bitmap_rgb32 & bitmap,const rectangle & cliprect)50 u32 wy150_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
51 {
52 	return 0;
53 }
54 
prog_map(address_map & map)55 void wy150_state::prog_map(address_map &map)
56 {
57 	map(0x0000, 0xffff).rom().region("program", 0);
58 }
59 
ext_map(address_map & map)60 void wy150_state::ext_map(address_map &map)
61 {
62 	map(0x0000, 0x1fff).ram().share("nvram");
63 	map(0x2000, 0x3fff).ram();
64 	map(0x4000, 0x5fff).ram();
65 }
66 
67 
INPUT_PORTS_START(wy150)68 static INPUT_PORTS_START(wy150)
69 INPUT_PORTS_END
70 
71 
72 void wy150_state::wy150(machine_config &config)
73 {
74 	i80c32_device &maincpu(I80C32(config, "maincpu", 11_MHz_XTAL)); // Philips P80C32SBPN (e.g.)
75 	maincpu.set_addrmap(AS_PROGRAM, &wy150_state::prog_map);
76 	maincpu.set_addrmap(AS_IO, &wy150_state::ext_map);
77 
78 	NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); // 8464 or 5564 or similar (e.g. Winbond W2465-70LL) + battery
79 
80 	SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
81 	m_screen->set_raw(48_MHz_XTAL, 1530, 0, 1200, 523, 0, 416); // 31.372 kHz horizontal
82 	//m_screen->set_raw(48_MHz_XTAL, 1530, 0, 1188, 402, 0, 338);
83 	// TBD: WY-160 should have different parameters (has 76 Hz refresh rate rather than 78 Hz)
84 	m_screen->set_screen_update(FUNC(wy150_state::screen_update));
85 }
86 
87 
88 ROM_START(wy150)
89 	ROM_REGION(0x10000, "program", 0)
90 	ROM_LOAD("251167-01.bin", 0x00000, 0x10000, CRC(4f425b11) SHA1(e44f54aa98d9f9c668a6ad674ec07e47879fc2a0))
91 
92 	ROM_REGION(0x20000, "link", 0)
93 	ROM_LOAD("link_mc3.bin",            0x00000, 0x10000, CRC(9e1d37d9) SHA1(d74c0faf6cf1eb06243607931967cf35a633ac8e))
94 	ROM_LOAD("link_mc5_xerox-wy30.bin", 0x10000, 0x10000, CRC(1aa00cb4) SHA1(6a7267132fe35c8e07deccd67c0fb4fe5a240c99))
95 ROM_END
96 
ROM_START(wy120)97 ROM_START(wy120) // b&w
98 	ROM_REGION(0x10000, "program", 0)
99 	ROM_LOAD("wy120_ver1.4.bin", 0x00000, 0x10000, CRC(6de23624) SHA1(ad90087237347662b5ae4fcc8a05d66d76c46a26))
100 ROM_END
101 
102 ROM_START(wy160)
103 	ROM_REGION(0x10000, "program", 0)
104 	ROM_LOAD("251167-06.bin", 0x00000, 0x10000, CRC(36e920df) SHA1(8fb7f51b4f47ef63b21d421227d6fef98001e4e9))
105 ROM_END
106 
107 void wy150_state::driver_start()
108 {
109 	uint8_t *rom = memregion("program")->base();
110 	for (offs_t base = 0x00000; base < 0x10000; base += 0x4000)
111 	{
112 		std::vector<uint8_t> orig(&rom[base], &rom[base + 0x4000]);
113 
114 		// Line swap is provided by schematic in WY-120 Maintenance Manual
115 		for (offs_t offset = 0; offset < 0x4000; offset++)
116 			rom[base | offset] = bitswap<8>(orig[bitswap<14>(offset, 7, 8, 6, 5, 4, 3, 9, 10, 11, 12, 13, 2, 1, 0)], 3, 4, 2, 5, 1, 6, 0, 7);
117 	}
118 }
119 
120 COMP(1991, wy150, 0, 0, wy150, wy150, wy150_state, empty_init, "Wyse Technology", "WY-150 (v1.0)", MACHINE_IS_SKELETON)
121 COMP(1992, wy120, 0, 0, wy150, wy150, wy150_state, empty_init, "Wyse Technology", "WY-120 (v1.4)", MACHINE_IS_SKELETON)
122 COMP(1994, wy160, 0, 0, wy150, wy150, wy150_state, empty_init, "Wyse Technology", "WY-160 (v1.7)", MACHINE_IS_SKELETON)
123