src/mess/drivers/digel804.c
| r12431 | r12432 | |
| 7 | 7 | * DONE: |
| 8 | 8 | * figure out z80 address space and hook up roms and rams (done) |
| 9 | 9 | * 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) |
| 11 | 11 | * tentatively figure out how flow control from ACIA works (/NMI)? |
| 12 | 12 | * 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) |
| 13 | 15 | * |
| 14 | 16 | * TODO: |
| 15 | 17 | * figure out the rest of the i/o map |
| r12431 | r12432 | |
| 18 | 20 | * hook up r6551 serial and attach terminal to it |
| 19 | 21 | * correctly hook up 10937 vfd controller |
| 20 | 22 | * hook up keypad and mode buttons |
| 21 | | * hook up leds on front panel |
| 23 | |
| 22 | 24 | * artwork |
| 23 | 25 | * |
| 24 | 26 | ******************************************************************************/ |
| r12431 | r12432 | |
| 49 | 51 | DECLARE_WRITE8_MEMBER( port_43_w ); |
| 50 | 52 | DECLARE_READ8_MEMBER( port_43_r ); |
| 51 | 53 | 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 ); |
| 53 | 57 | // return for port 43 (mode/status reg) |
| 54 | 58 | UINT8 port43_rtn; |
| 55 | 59 | // vfd helper stuff for port 44, should be unnecessary after 10937 gets a proper device |
| r12431 | r12432 | |
| 88 | 92 | |
| 89 | 93 | READ8_MEMBER( digel804_state::port_43_r ) |
| 90 | 94 | { |
| 91 | | /* Register 0x43: |
| 95 | /* Register 0x43: status/mode register |
| 92 | 96 | bits 76543210 |
| 93 | 97 | |||||||\- unknown, always 0? |
| 94 | 98 | ||||||\-- 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 |
| 96 | 100 | |||\\---- mode selected? (01 = key, 10 = remote, 11 = sim) |
| 97 | 101 | ||\------ ram enable for internal use? (not sure, clear in sim mode) |
| 98 | 102 | |\------- power failure status (1 = power has failed, 0 = ok) |
| r12431 | r12432 | |
| 109 | 113 | in sim mode: |
| 110 | 114 | 0x9E 10011110 when no keypad key pressed |
| 111 | 115 | 0x9A 10011010 when keypad key pressed |
| 116 | in off mode (before z80 is powered down): |
| 117 | 0xFE 11111110 |
| 118 | |
| 112 | 119 | */ |
| 113 | 120 | // HACK to dump display contents to stderr |
| 114 | 121 | 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); |
| 116 | 123 | return port43_rtn; |
| 117 | 124 | } |
| 118 | 125 | |
| r12431 | r12432 | |
| 121 | 128 | //m_ram_bank = data&7; |
| 122 | 129 | //digel804_set_ram_bank( machine() ); |
| 123 | 130 | //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); |
| 124 | 132 | } |
| 125 | 133 | |
| 126 | 134 | WRITE8_MEMBER( digel804_state::port_44_w ) |
| 127 | 135 | { |
| 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); |
| 128 | 145 | // latch vfd data on falling edge of clock only; this should really be part of the 10937 device, not here! |
| 129 | 146 | if ((vfd_old&1) && ((data&1)==0)) |
| 130 | 147 | { |
| r12431 | r12432 | |
| 142 | 159 | vfd_old = data; |
| 143 | 160 | } |
| 144 | 161 | |
| 145 | | WRITE8_MEMBER( digel804_state::port_45_w ) |
| 162 | WRITE8_MEMBER( digel804_state::speaker_w ) |
| 146 | 163 | { |
| 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); |
| 148 | 167 | speaker_state ^= 0xFF; |
| 149 | 168 | speaker_level_w(m_speaker, speaker_state); |
| 150 | 169 | } |
| 151 | 170 | |
| 171 | WRITE8_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 | |
| 190 | READ8_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 | |
| 152 | 205 | /****************************************************************************** |
| 153 | 206 | Address Maps |
| 154 | 207 | ******************************************************************************/ |
| r12431 | r12432 | |
| 184 | 237 | static ADDRESS_MAP_START(z80_io, AS_IO, 8, digel804_state) |
| 185 | 238 | ADDRESS_MAP_UNMAP_HIGH |
| 186 | 239 | 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. |
| 192 | 247 | //AM_RANGE(0x47, 0x47) AM_WRITE // gets 00 written to it |
| 193 | 248 | //AM_RANGE(0x83, 0x83) AM_WRITE // may be acia? |
| 194 | 249 | ADDRESS_MAP_END |