src/mess/drivers/pda600.c
| r14292 | r14293 | |
| 56 | 56 | |
| 57 | 57 | #include "emu.h" |
| 58 | 58 | #include "cpu/z180/z180.h" |
| 59 | #include "machine/nvram.h" |
| 60 | #include "rendlay.h" |
| 59 | 61 | |
| 60 | 62 | |
| 61 | 63 | class pda600_state : public driver_device |
| 62 | 64 | { |
| 63 | 65 | public: |
| 64 | 66 | pda600_state(const machine_config &mconfig, device_type type, const char *tag) |
| 65 | | : driver_device(mconfig, type, tag) { } |
| 67 | : driver_device(mconfig, type, tag), |
| 68 | m_maincpu(*this, "maincpu") |
| 69 | {} |
| 66 | 70 | |
| 71 | required_device<cpu_device> m_maincpu; |
| 72 | |
| 73 | virtual void video_start(); |
| 74 | virtual void machine_reset(); |
| 75 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 76 | |
| 77 | UINT8 * m_video_ram; |
| 67 | 78 | }; |
| 68 | 79 | |
| 69 | 80 | |
| 70 | 81 | static ADDRESS_MAP_START(pda600_mem, AS_PROGRAM, 8, pda600_state) |
| 71 | 82 | ADDRESS_MAP_UNMAP_HIGH |
| 72 | 83 | AM_RANGE(0x00000, 0x1ffff) AM_ROM |
| 73 | | AM_RANGE(0x20000, 0x3ffff) AM_RAM |
| 74 | | //AM_RANGE(0x90000, 0x92fff) AM_RAM // video ram |
| 75 | | AM_RANGE(0xf0000, 0xfffff) AM_RAM |
| 84 | //AM_RANGE(0x20000, 0x9ffff) AM_RAM // PCMCIA Card |
| 85 | AM_RANGE(0xa0000, 0xa7fff) AM_RAM AM_REGION("videoram", 0) |
| 86 | AM_RANGE(0xe0000, 0xfffff) AM_RAM AM_REGION("mainram", 0) AM_SHARE("nvram") |
| 76 | 87 | ADDRESS_MAP_END |
| 77 | 88 | |
| 78 | 89 | static ADDRESS_MAP_START(pda600_io, AS_IO, 8, pda600_state) |
| r14292 | r14293 | |
| 90 | 101 | INPUT_PORTS_END |
| 91 | 102 | |
| 92 | 103 | |
| 93 | | static MACHINE_RESET(pda600) |
| 104 | void pda600_state::machine_reset() |
| 94 | 105 | { |
| 106 | // the PDA600 soon after start waits for something from the Z180 CSIO, I do not know exactly for what |
| 107 | // the CSIO is used and for now I forced the CNTR End-Flag bit to 1 for allow the emulation to continue. |
| 108 | cpu_set_reg(m_maincpu, Z180_CNTR, cpu_get_reg(m_maincpu, Z180_CNTR) | 0x80); |
| 95 | 109 | } |
| 96 | 110 | |
| 97 | | static VIDEO_START( pda600 ) |
| 111 | void pda600_state::video_start() |
| 98 | 112 | { |
| 113 | m_video_ram = machine().region("videoram")->base(); |
| 99 | 114 | } |
| 100 | 115 | |
| 101 | | static SCREEN_UPDATE_IND16( pda600 ) |
| 116 | UINT32 pda600_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 102 | 117 | { |
| 118 | for (int y=0; y<320; y++) |
| 119 | for (int x=0; x<30; x++) |
| 120 | { |
| 121 | UINT8 data = m_video_ram[y*30 + x]; |
| 122 | |
| 123 | for (int px=0; px<8; px++) |
| 124 | { |
| 125 | bitmap.pix16(y, (x * 8) + px) = BIT(data, 7); |
| 126 | data <<= 1; |
| 127 | } |
| 128 | } |
| 129 | |
| 103 | 130 | return 0; |
| 104 | 131 | } |
| 105 | 132 | |
| r14292 | r14293 | |
| 172 | 199 | MCFG_CPU_PROGRAM_MAP(pda600_mem) |
| 173 | 200 | MCFG_CPU_IO_MAP(pda600_io) |
| 174 | 201 | |
| 175 | | MCFG_MACHINE_RESET(pda600) |
| 176 | | |
| 177 | 202 | /* video hardware */ |
| 178 | 203 | MCFG_SCREEN_ADD("screen", RASTER) |
| 179 | 204 | MCFG_SCREEN_REFRESH_RATE(50) |
| 180 | 205 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 181 | 206 | MCFG_SCREEN_SIZE(240, 320) |
| 182 | 207 | MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 320-1) |
| 183 | | MCFG_VIDEO_START(pda600) |
| 184 | | MCFG_SCREEN_UPDATE_STATIC(pda600) |
| 208 | MCFG_SCREEN_UPDATE_DRIVER( pda600_state, screen_update ) |
| 185 | 209 | MCFG_GFXDECODE(pda600) |
| 210 | MCFG_DEFAULT_LAYOUT(layout_lcd) |
| 186 | 211 | MCFG_PALETTE_LENGTH(2) |
| 187 | 212 | MCFG_PALETTE_INIT(black_and_white) |
| 213 | |
| 214 | // NVRAM needs to be filled with random data to fail the checksum and be initialized correctly |
| 215 | MCFG_NVRAM_ADD_RANDOM_FILL("nvram") |
| 188 | 216 | MACHINE_CONFIG_END |
| 189 | 217 | |
| 190 | 218 | /* ROM definition */ |
| 191 | 219 | ROM_START( pda600 ) |
| 192 | 220 | ROM_REGION( 0x20000, "maincpu", ROMREGION_ERASEFF ) |
| 193 | 221 | ROM_LOAD( "pdarom.bin", 0x00000, 0x20000, CRC(f793a6c5) SHA1(ab14b0fdcedb927c66357368a2bfff605ba758fb)) |
| 222 | |
| 223 | // 128KB RAM |
| 224 | ROM_REGION( 0x20000, "mainram", ROMREGION_ERASE ) |
| 225 | |
| 226 | // 32KB Video RAM |
| 227 | ROM_REGION( 0x8000, "videoram", ROMREGION_ERASE ) |
| 194 | 228 | ROM_END |
| 195 | 229 | |
| 196 | 230 | /* Driver */ |