Previous 199869 Revisions Next

r19633 Monday 17th December, 2012 at 23:19:44 UTC by O. Galibert
(mess) sed1200 family of LCD controllers [O. Galibert]
[src/mess]mess.mak
[src/mess/machine]sed1200.c sed1200.h

trunk/src/mess/machine/sed1200.c
r19632r19633
1/***************************************************************************
2
3    SED1200
4
5    A LCD controller.
6
7    The D/F variants have a packaging difference (QFP80 vs. bare chip).
8
9    The A/B variants have an internal CGROM difference (jis
10    vs. european characters)
11
12****************************************************************************
13
14    Copyright Olivier Galibert
15    All rights reserved.
16
17    Redistribution and use in source and binary forms, with or without
18    modification, are permitted provided that the following conditions are
19    met:
20
21        * Redistributions of source code must retain the above copyright
22          notice, this list of conditions and the following disclaimer.
23        * Redistributions in binary form must reproduce the above copyright
24          notice, this list of conditions and the following disclaimer in
25          the documentation and/or other materials provided with the
26          distribution.
27        * Neither the name 'MAME' nor the names of its contributors may be
28          used to endorse or promote products derived from this software
29          without specific prior written permission.
30
31    THIS SOFTWARE IS PROVIDED BY OLIVIER GALIBERT ''AS IS'' AND ANY EXPRESS OR
32    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
33    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
34    DISCLAIMED. IN NO EVENT SHALL OLIVIER GALIBERT BE LIABLE FOR ANY DIRECT,
35    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
36    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
37    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39    STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40    IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41    POSSIBILITY OF SUCH DAMAGE.
42
43***************************************************************************/
44
45#include "emu.h"
46#include "sed1200.h"
47
48const device_type SED1200D0A = &device_creator<sed1200d0a_device>;
49const device_type SED1200F0A = &device_creator<sed1200f0a_device>;
50const device_type SED1200D0B = &device_creator<sed1200d0b_device>;
51const device_type SED1200F0B = &device_creator<sed1200f0b_device>;
52
53ROM_START( sed1200x0a )
54   ROM_REGION( 0x800, "cgrom", 0 )
55   ROM_LOAD( "sed1200-a.bin", 0x000, 0x800, CRC(e8c28054) SHA1(086406eb74e9ed97b309d2a4bdedc567626e9a98))
56ROM_END
57
58ROM_START( sed1200x0b )
59   ROM_REGION( 0x800, "cgrom", 0 )
60   ROM_LOAD( "sed1200-b.bin", 0x000, 0x800, CRC(d0741f51) SHA1(c8c856f1357286a2c8c806af81724a828345357e))
61ROM_END
62
63sed1200_device::sed1200_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) :
64   device_t(mconfig, type, name, tag, owner, clock)
65{
66   m_shortname = "sed1200";
67}
68
69sed1200d0a_device::sed1200d0a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
70   sed1200_device(mconfig, SED1200D0A, "sed1200d-0a", tag, owner, clock)
71{
72}
73
74sed1200f0a_device::sed1200f0a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
75   sed1200_device(mconfig, SED1200F0A, "sed1200f-0a", tag, owner, clock)
76{
77}
78
79sed1200d0b_device::sed1200d0b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
80   sed1200_device(mconfig, SED1200D0B, "sed1200d-0b", tag, owner, clock)
81{
82}
83
84sed1200f0b_device::sed1200f0b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
85   sed1200_device(mconfig, SED1200F0B, "sed1200f-0b", tag, owner, clock)
86{
87}
88
89const rom_entry *sed1200d0a_device::device_rom_region() const
90{
91   return ROM_NAME(sed1200x0a);
92}
93
94const rom_entry *sed1200f0a_device::device_rom_region() const
95{
96   return ROM_NAME(sed1200x0a);
97}
98
99const rom_entry *sed1200d0b_device::device_rom_region() const
100{
101   return ROM_NAME(sed1200x0b);
102}
103
104const rom_entry *sed1200f0b_device::device_rom_region() const
105{
106   return ROM_NAME(sed1200x0b);
107}
108
109void sed1200_device::device_start()
110{
111   memset(cgram, 0, sizeof(cgram));
112   memset(ddram, 0, sizeof(ddram));
113   if(memregion("cgrom"))
114      cgrom = memregion("cgrom")->base();
115   else
116      cgrom = NULL;
117
118   soft_reset();
119}
120
121void sed1200_device::soft_reset()
122{
123   cursor_direction = false;
124   cursor_blinking = false;
125   cursor_full = false;
126   cursor_on = false;
127   display_on = false;
128   cursor_address = 0x00;
129   cgram_address = 0x00;
130}
131
132void sed1200_device::control_w(UINT8 data)
133{
134   switch(data) {
135   case 0x04: case 0x05:
136      cursor_direction = data & 0x01;
137      break;
138   case 0x06: case 0x07:
139      cursor_step();
140      break;
141   case 0x08: case 0x09:
142      cursor_full = data & 0x01;
143      break;
144   case 0x0a: case 0x0b:
145      cursor_blinking = data & 0x01;
146      break;
147   case 0x0c: case 0x0d:
148      display_on = data & 0x01;
149      break;
150   case 0x0e: case 0x0f:
151      cursor_on = data & 0x01;
152      break;
153   case 0x10:
154      soft_reset();
155      break;
156   case 0x12: case 0x13:
157      break; // Number of lines selection
158   default:
159      if((data & 0xf0) == 0x20)
160         cgram_address = (data & 3)*8;
161      else if((data & 0xe0) == 0x40) {
162         cgram[cgram_address++] = data;
163         if(cgram_address == 4*8)
164            cgram_address = 0;
165      } else if(data & 0x80) {
166         cursor_address = data & 0x40 ? 10 : 0;
167         cursor_address += (data & 0x3f) >= 10 ? 9 : data & 0x3f;
168      }
169      break;
170   }
171}
172
173UINT8 sed1200_device::control_r()
174{
175   return 0x00;
176}
177
178void sed1200_device::data_w(UINT8 data)
179{
180   ddram[cursor_address] = data;
181   cursor_step();
182}
183
184void sed1200_device::cursor_step()
185{
186   if(cursor_direction) {
187      if(cursor_address == 0 || cursor_address == 10)
188         cursor_address += 9;
189      else
190         cursor_address --;
191   } else {
192      if(cursor_address == 9 || cursor_address == 19)
193         cursor_address -= 9;
194      else
195         cursor_address ++;
196   }
197}
198
199const UINT8 *sed1200_device::render()
200{
201   memset(render_buf, 0, 20*8);
202   if(!display_on)
203      return render_buf;
204
205   for(int i=0; i<20; i++) {
206      UINT8 c = ddram[i];
207      if(c < 4)
208         memcpy(render_buf + 8*i, cgram + 8*c, 8);
209      else if(cgrom)
210         memcpy(render_buf + 8*i, cgrom + 8*c, 8);
211   }
212
213   if(cursor_on && (!cursor_blinking || (machine().time().as_ticks(2) & 1))) {
214      if(cursor_full)
215         for(int i=0; i<8; i++)
216            render_buf[cursor_address*8+i] ^= 0x1f;
217      else
218         render_buf[cursor_address*8+7] ^= 0x1f;
219   }
220
221   return render_buf;
222}
trunk/src/mess/machine/sed1200.h
r19632r19633
1/***************************************************************************
2
3    SED1200
4
5    A LCD controller.
6
7    The D/F variants are a packaging difference (QFP80 vs. bare chip).
8    The A/B variants are an internal CGROM difference (jis
9    vs. european characters)
10
11****************************************************************************
12
13    Copyright Olivier Galibert
14    All rights reserved.
15
16    Redistribution and use in source and binary forms, with or without
17    modification, are permitted provided that the following conditions are
18    met:
19
20        * Redistributions of source code must retain the above copyright
21          notice, this list of conditions and the following disclaimer.
22        * Redistributions in binary form must reproduce the above copyright
23          notice, this list of conditions and the following disclaimer in
24          the documentation and/or other materials provided with the
25          distribution.
26        * Neither the name 'MAME' nor the names of its contributors may be
27          used to endorse or promote products derived from this software
28          without specific prior written permission.
29
30    THIS SOFTWARE IS PROVIDED BY OLIVIER GALIBERT ''AS IS'' AND ANY EXPRESS OR
31    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
32    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
33    DISCLAIMED. IN NO EVENT SHALL OLIVIER GALIBERT BE LIABLE FOR ANY DIRECT,
34    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
35    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
36    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
37    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
38    STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
39    IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
40    POSSIBILITY OF SUCH DAMAGE.
41
42***************************************************************************/
43
44#ifndef __SED1200_H__
45#define __SED1200_H__
46
47#define MCFG_SED1200D0A_ADD( _tag ) \
48   MCFG_DEVICE_ADD( _tag, SED1200D0A, 0 )
49
50#define MCFG_SED1200F0A_ADD( _tag ) \
51   MCFG_DEVICE_ADD( _tag, SED1200F0A, 0 )
52
53#define MCFG_SED1200D0B_ADD( _tag ) \
54   MCFG_DEVICE_ADD( _tag, SED1200D0B, 0 )
55
56#define MCFG_SED1200F0B_ADD( _tag ) \
57   MCFG_DEVICE_ADD( _tag, SED1200F0B, 0 )
58
59class sed1200_device : public device_t {
60public:
61   sed1200_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
62
63   void control_w(UINT8 data);
64   UINT8 control_r();
65   void data_w(UINT8 data);
66
67   const UINT8 *render();
68
69protected:
70   virtual void device_start();
71
72private:
73   UINT8 cgram[4*8];
74   UINT8 ddram[10*2];
75   UINT8 render_buf[20*8];
76   bool cursor_direction, cursor_blinking, cursor_full, cursor_on, display_on;
77   UINT8 cursor_address, cgram_address;
78   const UINT8 *cgrom;
79
80   void soft_reset();
81   void cursor_step();
82};
83
84class sed1200d0a_device : public sed1200_device {
85public:
86   sed1200d0a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
87
88protected:
89   virtual const rom_entry *device_rom_region() const;
90};
91
92class sed1200f0a_device : public sed1200_device {
93public:
94   sed1200f0a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
95
96protected:
97   virtual const rom_entry *device_rom_region() const;
98};
99
100class sed1200d0b_device : public sed1200_device {
101public:
102   sed1200d0b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
103
104protected:
105   virtual const rom_entry *device_rom_region() const;
106};
107
108class sed1200f0b_device : public sed1200_device {
109public:
110   sed1200f0b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
111
112protected:
113   virtual const rom_entry *device_rom_region() const;
114};
115
116extern const device_type SED1200D0A;
117extern const device_type SED1200F0A;
118extern const device_type SED1200D0B;
119extern const device_type SED1200F0B;
120
121#endif
trunk/src/mess/mess.mak
r19632r19633
527527   $(MESS_MACHINE)/mpc105.o   \
528528   $(MESS_MACHINE)/mos6530.o   \
529529   $(MESS_MACHINE)/s100.o      \
530   $(MESS_MACHINE)/sed1200.o   \
530531   $(MESS_MACHINE)/serial.o   \
531532   $(MESS_MACHINE)/ncr5380.o   \
532533   $(MESS_MACHINE)/ncr5390.o   \

Previous 199869 Revisions Next


© 1997-2024 The MAME Team