Previous 15994 Revisions Next

r12432 Monday 1st August, 2011 at 00:35:02 UTC by Jonathan Gevaryahu
Figured out LED outputs, figured out keypad inputs [Lord Nightmare]
[src/mess/drivers]digel804.c

src/mess/drivers/digel804.c
r12431r12432
77*  DONE:
88*  figure out z80 address space and hook up roms and rams (done)
99*  figure out where 10937 vfd controller lives (port 0x44 bits 7 and 0)
10*  figure out how keypresses are detected (/INT and port 0x43)
10*  figure out how keypresses are detected (/INT, port 0x43, and port 0x46)
1111*  tentatively figure out how flow control from ACIA works (/NMI)?
1212*  hook up the speaker/beeper (port 0x45)
13*  hook up vfd controller (done to stderr, no artwork)
14*  hook up leds on front panel (done to stderr)
1315*
1416*  TODO:
1517*  figure out the rest of the i/o map
r12431r12432
1820*  hook up r6551 serial and attach terminal to it
1921*  correctly hook up 10937 vfd controller
2022*  hook up keypad and mode buttons
21*  hook up leds on front panel
23
2224*  artwork
2325*
2426******************************************************************************/
r12431r12432
4951   DECLARE_WRITE8_MEMBER( port_43_w );
5052   DECLARE_READ8_MEMBER( port_43_r );
5153   DECLARE_WRITE8_MEMBER( port_44_w );
52   DECLARE_WRITE8_MEMBER( port_45_w );
54   DECLARE_WRITE8_MEMBER( speaker_w );
55   DECLARE_WRITE8_MEMBER( led_control_w );
56   DECLARE_READ8_MEMBER( keypad_r );
5357   // return for port 43 (mode/status reg)
5458   UINT8 port43_rtn;
5559   // vfd helper stuff for port 44, should be unnecessary after 10937 gets a proper device
r12431r12432
8892
8993READ8_MEMBER( digel804_state::port_43_r )
9094{
91   /* Register 0x43:
95   /* Register 0x43: status/mode register
9296    bits 76543210
9397         |||||||\- unknown, always 0?
9498         ||||||\-- unknown, always 1?
95         |||||\--- any key pressed on keypad (0 = one or more pressed, 1 = none pressed)
99         |||||\--- any key pressed on keypad (0 = one or more pressed, 1 = none pressed) * if upper byte is 0xF and this bit is set, unit is about to turn off
96100         |||\\---- mode selected? (01 = key, 10 = remote, 11 = sim)
97101         ||\------ ram enable for internal use? (not sure, clear in sim mode)
98102         |\------- power failure status (1 = power has failed, 0 = ok)
r12431r12432
109113    in sim mode:
110114    0x9E 10011110 when no keypad key pressed
111115    0x9A 10011010 when keypad key pressed
116    in off mode (before z80 is powered down):
117    0xFE 11111110
118   
112119   */
113120   // HACK to dump display contents to stderr
114121   fprintf(stderr,"%s\n",ROC10937_get_string(0));
115   logerror("Digel804: returning %02X for port 43 read\n", port43_rtn);
122   logerror("Digel804: returning %02X for port 43 status read\n", port43_rtn);
116123   return port43_rtn;
117124}
118125
r12431r12432
121128   //m_ram_bank = data&7;
122129   //digel804_set_ram_bank( machine() );
123130   //memory_set_bankptr( machine(), "bankedram", machine().region("user_ram")->base() + ( m_ram_bank * 0x10000 ));
131   logerror("Digel804: port 0x43 unknown had %02x written to it!\n", data);
124132}
125133
126134WRITE8_MEMBER( digel804_state::port_44_w )
127135{
136   /* writes to 0x44 control the 10937 vfd chip
137    * bits:76543210
138    *      |||||||\- VFD chip clock
139    *      ||||||\-- unknown, always 1?
140    *      |\\\\\--- unknown, always 0?
141    *      \-------- VFD chip data
142    */
143   if (data%0x7E != 0x02)
144      logerror("Digel804: port 0x44 vfd control had %02x written to it!\n", data);
128145   // latch vfd data on falling edge of clock only; this should really be part of the 10937 device, not here!
129146   if ((vfd_old&1) && ((data&1)==0))
130147   {
r12431r12432
142159   vfd_old = data;
143160}
144161
145WRITE8_MEMBER( digel804_state::port_45_w )
162WRITE8_MEMBER( digel804_state::speaker_w )
146163{
147   // it APPEARS all writes here invert the speaker state
164   // it APPEARS all writes here invert the speaker state, but not certain!
165   if ((data != 0x00) && (data != 0x01))
166      logerror("Digel804: port 0x45 speaker control had %02x written to it!\n", data);
148167   speaker_state ^= 0xFF;
149168   speaker_level_w(m_speaker, speaker_state);
150169}
151170
171WRITE8_MEMBER( digel804_state::led_control_w )
172{
173   /* writes to 0x46 control the LEDS on the front panel
174    * bits:76543210
175    *      ||||\\\\- these four bits choose which of the 16 function leds is lit; the number is INVERTED first
176    *      |||\----- if this bit is 1, the function leds are disabled
177    *      ||\------ this bit controls the 'error' led; 1 = on
178    *      |\------- this bit controls the 'busy' led; 1 = on
179    *      \-------- this bit controls the 'input' led; 1 = on
180    */
181    logerror("Digel804: port 0x46 LED control had %02x written to it!\n", data);
182    fprintf(stderr,"LEDS: ");
183    if (data&0x80) fprintf(stderr,"INPUT "); else fprintf(stderr,"----- ");
184    if (data&0x40) fprintf(stderr,"BUSY "); else fprintf(stderr,"---- ");
185    if (data&0x20) fprintf(stderr,"ERROR "); else fprintf(stderr,"----- ");
186    fprintf(stderr,"  function selected: ");
187    if (data&0x10) fprintf(stderr,"none\n"); else fprintf(stderr,"%01X\n", ~data&0xF);
188}
189
190READ8_MEMBER( digel804_state::keypad_r )
191{
192   /* reads E* for a keypad number 0-F
193    * reads F0 for enter
194    * reads F4 for next
195    * reads F8 for rept
196    * reads FC for clear
197    * F* takes precedence over E*
198    * higher numbers take precedence over lower ones
199    * this value auto-latches on a key press and remains through multiple reads
200   */
201   logerror("Digel804: returning 0xF0 for port 46 keypad read\n");
202   return 0xF0; // enter
203}
204
152205/******************************************************************************
153206 Address Maps
154207******************************************************************************/
r12431r12432
184237static ADDRESS_MAP_START(z80_io, AS_IO, 8, digel804_state)
185238   ADDRESS_MAP_UNMAP_HIGH
186239   ADDRESS_MAP_GLOBAL_MASK(0xff)
187   //AM_RANGE(0x42, 0x42) AM_WRITE // gets 00 written to it
188   AM_RANGE(0x43, 0x43) AM_READWRITE(port_43_r, port_43_w) // mode and status register, also checks if keypad is pressed
189   AM_RANGE(0x44, 0x44) AM_WRITE(port_44_w) // 10937 vfd controller clock on d0, data on d8; other bits unknown
190   AM_RANGE(0x45, 0x45) AM_WRITE(port_45_w) // speaker bit; every write inverts state
191   //AM_RANGE(0x46, 0x46) AM_WRITE // gets 50 or 30 written to it
240   //AM_RANGE(0x40, 0x40) AM_WRITE // W, unknown
241   //AM_RANGE(0x41, 0x41) AM_WRITE // W, unknown
242   //AM_RANGE(0x42, 0x42) AM_WRITE // W, gets 00 written to it
243   AM_RANGE(0x43, 0x43) AM_READWRITE(port_43_r, port_43_w) // RW, mode and status register, also checks if keypad is pressed
244   AM_RANGE(0x44, 0x44) AM_WRITE(port_44_w) // W, 10937 vfd controller clock on d0, data on d8; other bits unknown
245   AM_RANGE(0x45, 0x45) AM_WRITE(speaker_w) // W, speaker bit; every write inverts state
246   AM_RANGE(0x46, 0x46) AM_READWRITE(keypad_r, led_control_w) // RW, reads keypad, writes controls the front panel leds.
192247   //AM_RANGE(0x47, 0x47) AM_WRITE // gets 00 written to it
193248   //AM_RANGE(0x83, 0x83) AM_WRITE // may be acia?
194249ADDRESS_MAP_END

Previous 15994 Revisions Next


© 1998-2018 The MESS Team