trunk/src/mess/drivers/hprot1.c
| r30992 | r30993 | |
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | | HENRY Prot I - brazilian document timestamp printer |
| 3 | HENRY Prot I/II - brazilian document timestamp printers |
| 4 | 4 | http://www.dataponto.com.br/protocoladores-prot1.html |
| 5 | 5 | |
| 6 | 6 | Driver by Felipe Sanches |
| r30992 | r30993 | |
| 12 | 12 | |
| 13 | 13 | Changelog: |
| 14 | 14 | |
| 15 | 2014 JUN 13 [Felipe Sanches]: |
| 16 | * new derivative "CARD I PCB rev.08A" |
| 17 | * new derivative "CARD II PCB rev.6" |
| 18 | * fixed LCD rendering (now both lines are displayed properly) |
| 19 | * inverted logic of the inputs so that now we can navigate the menu |
| 20 | |
| 15 | 21 | 2014 JAN 03 [Felipe Sanches]: |
| 16 | 22 | * Initial driver skeleton |
| 17 | 23 | * Address lines bitswaping |
| r30992 | r30993 | |
| 20 | 26 | |
| 21 | 27 | TO-DO list: |
| 22 | 28 | |
| 29 | ======= hprotr8a =========== |
| 30 | Loops during boot displaying an error message related to low power supply voltage. |
| 31 | We need to emulate the ADM695AN chip (Microprocessor Supervisory Circuits) in order to properly boot the device. |
| 32 | |
| 33 | ======= hprot2r6 =========== |
| 34 | There are unhandled memory writes at 0xE000 and 0xA000 |
| 35 | |
| 36 | LCD commands are sent, but nothing shows up on screen. |
| 37 | The commands sent are supposed to display the message: |
| 38 | |
| 39 | "*Pouca Energia*" (LCD cmds range: 80-8F) (cmds logged but not displayed on screen) |
| 40 | "* no Sistema *" (LCD cmds range: C0-CF) (cmds logged but not displayed on screen) |
| 41 | |
| 42 | which means something like "too little energy for the system to operate". |
| 43 | We need to emulate the ADM695AN chip (Microprocessor Supervisory Circuits) in order to properly boot the device. |
| 44 | |
| 45 | Infinite loop is reached at address 0x7699 |
| 46 | ======= hprot1 =========== |
| 47 | |
| 23 | 48 | There seems to be an eeprom or a realtime clock placed at U2 (DIP8): |
| 24 | 49 | pin1 -> 8031 pin 14 (T0: Timer 0 external input) |
| 25 | 50 | pin2 -> crystal at X2 (labeled 32.768) |
| r30992 | r30993 | |
| 30 | 55 | pin7 -> 8031 pin 4 (Port 1 bit 3) |
| 31 | 56 | pin8 -> VCC |
| 32 | 57 | |
| 33 | | (no context): unmapped io memory write to 20003 = FF & FF |
| 34 | | (no context): unmapped io memory write to 20002 = FF & FF |
| 35 | | (no context): unmapped io memory write to 20001 = FF & FF |
| 36 | | (no context): unmapped io memory write to 20000 = FF & FF |
| 37 | | ':maincpu' (01EB): unmapped io memory write to 20001 = 7F & FF |
| 38 | | ':maincpu' (01EE): unmapped io memory write to 20003 = FF & FF |
| 39 | | ':maincpu' (01F0): unmapped io memory write to 20001 = 77 & FF |
| 40 | | ':maincpu' (3500): unmapped io memory write to 20003 = FF & FF |
| 41 | | ':maincpu' (0208): unmapped io memory write to 20001 = 77 & FF |
| 42 | | ':maincpu' (13F7): unmapped io memory write to 20001 = 77 & FF |
| 43 | | ':maincpu' (13EF): unmapped io memory write to 20001 = 67 & FF |
| 44 | | ':maincpu' (13F7): unmapped io memory write to 20001 = 77 & FF |
| 45 | | The last 2 lines repeat endlessly. |
| 46 | | |
| 47 | 58 | ****************************************************************************/ |
| 48 | 59 | |
| 49 | 60 | #include "emu.h" |
| 50 | 61 | #include "cpu/mcs51/mcs51.h" |
| 51 | 62 | #include "video/hd44780.h" |
| 63 | #include "sound/speaker.h" |
| 52 | 64 | #include "rendlay.h" |
| 53 | 65 | |
| 54 | 66 | class hprot1_state : public driver_device |
| r30992 | r30993 | |
| 100 | 112 | //11?? 00?? ??11 ???? read command |
| 101 | 113 | //mirror=0x33cf |
| 102 | 114 | |
| 103 | | //write: 0xc400 => U12 (?) |
| 104 | | //write: 0xc800 => U11 (?) |
| 115 | //write: 0xc400 => U12 (74373 - possibly for the dot matrix printhead ?) |
| 116 | //write: 0xc800 => U11 (74373 - possibly for the dot matrix printhead ?) |
| 105 | 117 | //read: 0xc020 => display |
| 106 | 118 | //write: 0xc000 => display |
| 107 | 119 | //write: 0xc010 => display |
| r30992 | r30993 | |
| 110 | 122 | |
| 111 | 123 | static ADDRESS_MAP_START(i80c31_io, AS_IO, 8, hprot1_state) |
| 112 | 124 | AM_RANGE(0x0000,0x7fff) AM_RAM |
| 113 | | AM_RANGE(0xc000,0xc000) AM_MIRROR(0x33cf) AM_DEVWRITE("hd44780", hd44780_device, control_write) |
| 114 | | AM_RANGE(0xc010,0xc010) AM_MIRROR(0x33cf) AM_DEVWRITE("hd44780", hd44780_device, data_write) |
| 115 | | AM_RANGE(0xc020,0xc020) AM_MIRROR(0x33cf) AM_DEVREAD("hd44780", hd44780_device, control_read) |
| 116 | | AM_RANGE(0xc030,0xc030) AM_MIRROR(0x33cf) AM_DEVREAD("hd44780", hd44780_device, data_read) |
| 125 | /*TODO: verify the mirror mask value for the HD44780 device */ |
| 126 | AM_RANGE(0xc000,0xc000) AM_MIRROR(0x13cf) AM_DEVWRITE("hd44780", hd44780_device, control_write) |
| 127 | AM_RANGE(0xc010,0xc010) AM_MIRROR(0x13cf) AM_DEVWRITE("hd44780", hd44780_device, data_write) |
| 128 | AM_RANGE(0xc020,0xc020) AM_MIRROR(0x13cf) AM_DEVREAD("hd44780", hd44780_device, control_read) |
| 129 | AM_RANGE(0xc030,0xc030) AM_MIRROR(0x13cf) AM_DEVREAD("hd44780", hd44780_device, data_read) |
| 130 | /*TODO: attach the watchdog/brownout reset device: |
| 131 | AM_RANGE(0xe000,0xe0??) AM_MIRROR(?) AM_DEVREAD("adm965an", adm965an_device, data_read) */ |
| 132 | |
| 117 | 133 | //AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READWRITE(henry_io_r, henry_io_w) |
| 118 | 134 | AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READ(henry_io_r) |
| 119 | 135 | ADDRESS_MAP_END |
| 120 | 136 | |
| 121 | 137 | static INPUT_PORTS_START( hprot1 ) |
| 138 | /* FIXME: I am still unsure whether all these inputs are Active High or Active Low: */ |
| 122 | 139 | PORT_START("inputs") |
| 123 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Upper Black Button") PORT_CODE(KEYCODE_A) |
| 124 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Lower Black Button") PORT_CODE(KEYCODE_B) |
| 125 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Blue Button") PORT_CODE(KEYCODE_C) |
| 140 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Upper Black Button") PORT_CODE(KEYCODE_A) |
| 141 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Lower Black Button") PORT_CODE(KEYCODE_B) |
| 142 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Blue Button") PORT_CODE(KEYCODE_C) |
| 143 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 144 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 126 | 145 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Paper Detector") PORT_CODE(KEYCODE_D) |
| 127 | 146 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("XMIN Endstop") PORT_CODE(KEYCODE_E) |
| 147 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 128 | 148 | INPUT_PORTS_END |
| 129 | 149 | |
| 150 | static INPUT_PORTS_START( hprot_jumpers ) |
| 151 | /* |
| 152 | There is a set of 3 jumpers that switch the communications circuitry between a |
| 153 | RS232 chip (U8: MAX232AN) and a differential bus transceiver (U7: SN65176BP) |
| 154 | |
| 155 | It seems that all three jumpers must select the same configuration: |
| 156 | eighter differential bus or RS232. |
| 157 | And I don't see yet how this could affect the emulation of the device, so, for now, I'll |
| 158 | simply leave this note here but not actually include this details in the driver code. |
| 159 | |
| 160 | PORT_START("jumpers") |
| 161 | PORT_DIPNAME( 0x01, 0x01, "TX") |
| 162 | PORT_DIPSETTING( 0x01, "differential bus") |
| 163 | PORT_DIPSETTING( 0x00, "RS232") |
| 164 | PORT_DIPNAME( 0x02, 0x02, "RX") |
| 165 | PORT_DIPSETTING( 0x02, "differential bus") |
| 166 | PORT_DIPSETTING( 0x00, "RS232") |
| 167 | PORT_DIPNAME( 0x04, 0x04, "CPU-TX") |
| 168 | PORT_DIPSETTING( 0x04, "differential bus") |
| 169 | PORT_DIPSETTING( 0x00, "RS232") |
| 170 | */ |
| 171 | INPUT_PORTS_END |
| 172 | |
| 173 | /* TODO: meanings for the jumpers may be different among machines, |
| 174 | so we may have to have individual declarations for each board. */ |
| 175 | static INPUT_PORTS_START( hprot2r6 ) |
| 176 | PORT_INCLUDE(hprot1) |
| 177 | PORT_INCLUDE(hprot_jumpers) |
| 178 | INPUT_PORTS_END |
| 179 | |
| 180 | static INPUT_PORTS_START( hprotr8a ) |
| 181 | PORT_INCLUDE(hprot1) |
| 182 | PORT_INCLUDE(hprot_jumpers) |
| 183 | INPUT_PORTS_END |
| 184 | |
| 130 | 185 | void hprot1_state::machine_start() |
| 131 | 186 | { |
| 132 | 187 | } |
| r30992 | r30993 | |
| 141 | 196 | { |
| 142 | 197 | case 0x01: |
| 143 | 198 | { |
| 144 | | UINT8 value = (ioport("inputs")->read()) & 0x67; |
| 199 | UINT8 value = ioport("inputs")->read(); |
| 145 | 200 | #if LOG_IO_PORTS |
| 146 | 201 | printf("value:%02X\n", value); |
| 147 | 202 | #endif |
| r30992 | r30993 | |
| 231 | 286 | GFXDECODE_ENTRY( "hd44780:cgrom", 0x0000, henry_prot_charlayout, 0, 1 ) |
| 232 | 287 | GFXDECODE_END |
| 233 | 288 | |
| 289 | static HD44780_PIXEL_UPDATE(hprot1_pixel_update) |
| 290 | { |
| 291 | if ( pos < 16 && line==0 ) |
| 292 | { |
| 293 | bitmap.pix16(y, pos*6 + x) = state; |
| 294 | } |
| 295 | |
| 296 | if ( pos >= 64 && pos < 80 && line==0 ) |
| 297 | { |
| 298 | bitmap.pix16(y+9,(pos-64)*6 + x) = state; |
| 299 | } |
| 300 | } |
| 301 | |
| 234 | 302 | static MACHINE_CONFIG_START( hprot1, hprot1_state ) |
| 235 | 303 | /* basic machine hardware */ |
| 236 | 304 | MCFG_CPU_ADD("maincpu", I80C31, XTAL_10MHz) |
| r30992 | r30993 | |
| 253 | 321 | |
| 254 | 322 | MCFG_HD44780_ADD("hd44780") |
| 255 | 323 | MCFG_HD44780_LCD_SIZE(2, 16) |
| 324 | MCFG_HD44780_PIXEL_UPDATE_CB(hprot1_pixel_update) |
| 325 | |
| 326 | /* TODO: figure out which RTC chip is in use. */ |
| 327 | |
| 328 | /* TODO: emulate the ADM695AN chip (watchdog/brownout reset)*/ |
| 256 | 329 | MACHINE_CONFIG_END |
| 257 | 330 | |
| 331 | static MACHINE_CONFIG_DERIVED( hprotr8a, hprot1 ) |
| 332 | MCFG_CPU_REPLACE("maincpu", I80C31, 11059200) // value of X1 cristal on the PCB |
| 333 | MCFG_CPU_PROGRAM_MAP(i80c31_prg) |
| 334 | MCFG_CPU_IO_MAP(i80c31_io) |
| 335 | |
| 336 | /* sound hardware */ |
| 337 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 338 | MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) |
| 339 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 340 | |
| 341 | /* TODO: add an RS232 interface (emulate MAX232N chip) |
| 342 | (the board has GND/VCC/RX/TX pins available in a connector) */ |
| 343 | |
| 344 | /* TODO: add an I2C interface (the board has GND/VCC/SDA/SCL pins available in a connector) */ |
| 345 | MACHINE_CONFIG_END |
| 346 | |
| 347 | static MACHINE_CONFIG_DERIVED( hprot2r6, hprot1 ) |
| 348 | MCFG_CPU_REPLACE("maincpu", I80C31, 11059200) // value of X1 cristal on the PCB |
| 349 | MCFG_CPU_PROGRAM_MAP(i80c31_prg) |
| 350 | MCFG_CPU_IO_MAP(i80c31_io) |
| 351 | |
| 352 | /* sound hardware */ |
| 353 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 354 | MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) |
| 355 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 356 | |
| 357 | /* TODO: add an RS232 interface (emulate MAX232N chip) */ |
| 358 | MACHINE_CONFIG_END |
| 359 | |
| 258 | 360 | ROM_START( hprot1 ) |
| 259 | 361 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 260 | 362 | ROM_LOAD( "henry_prot1_rev1_v19.bin", 0x00000, 0x10000, CRC(dd7787fd) SHA1(61a37dd406b3440d568bd6da75a9fdc8a0f0e1e3) ) |
| 261 | 363 | ROM_END |
| 262 | 364 | |
| 263 | | /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ |
| 264 | | COMP( 2004, hprot1, 0, 0, hprot1, hprot1, hprot1_state, hprot1, "HENRY", "Henry Prot I v19 (REV.1)", GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND) |
| 365 | ROM_START( hprotr8a ) |
| 366 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 367 | ROM_LOAD( "hprot_card1_rev08a.u2", 0x00000, 0x10000, CRC(e827480f) SHA1(bd53e6cce9a0832ca01f1a485ddaab43c0baa136) ) |
| 368 | ROM_END |
| 369 | |
| 370 | ROM_START( hprot2r6 ) |
| 371 | ROM_REGION( 0x10000, "maincpu", 0 ) |
| 372 | ROM_LOAD( "hprot_card2_rev6.u2", 0x00000, 0x10000, CRC(791f2425) SHA1(70af8911a27921cac6d98a5cd07602a7f59c2848) ) |
| 373 | ROM_END |
| 374 | |
| 375 | /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ |
| 376 | COMP( 2002, hprot1, 0, 0, hprot1, hprot1, hprot1_state, hprot1, "HENRY", "Henry Prot I v19 (REV.1)", GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND) |
| 377 | /* fw version: "R19" Release date: February 1st, 2002. */ |
| 378 | |
| 379 | COMP( 2006, hprotr8a, hprot1, 0, hprotr8a, hprotr8a, hprot1_state, hprot1, "HENRY", "Henry Prot CARD I (REV.08A)", GAME_NOT_WORKING) |
| 380 | /* fw version: "V6.5QI I" Release date: September 18th, 2006. */ |
| 381 | |
| 382 | COMP( 2003, hprot2r6, hprot1, 0, hprot2r6, hprot2r6, hprot1_state, hprot1, "HENRY", "Henry Prot CARD II (REV.6)", GAME_NOT_WORKING) |
| 383 | /* fw version: "V5.8CF II" Release date: June 23rd, 2003. */ |