trunk/src/mess/drivers/harriet.c
| r24060 | r24061 | |
| 12 | 12 | |
| 13 | 13 | #include "emu.h" |
| 14 | 14 | #include "cpu/m68000/m68000.h" |
| 15 | | //#include "sound/ay8910.h" |
| 15 | #include "machine/terminal.h" |
| 16 | 16 | |
| 17 | 17 | class harriet_state : public driver_device |
| 18 | 18 | { |
| 19 | 19 | public: |
| 20 | 20 | harriet_state(const machine_config &mconfig, device_type type, const char *tag) |
| 21 | 21 | : driver_device(mconfig, type, tag), |
| 22 | | m_maincpu(*this, "maincpu") |
| 22 | m_maincpu(*this, "maincpu"), |
| 23 | m_terminal(*this, TERMINAL_TAG) |
| 23 | 24 | { } |
| 24 | 25 | |
| 25 | 26 | // devices |
| 26 | 27 | required_device<cpu_device> m_maincpu; |
| 28 | required_device<generic_terminal_device> m_terminal; |
| 27 | 29 | |
| 28 | 30 | // screen updates |
| 29 | 31 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 30 | 32 | |
| 33 | UINT8 m_teletype_data; |
| 34 | UINT8 m_teletype_status; |
| 35 | |
| 31 | 36 | DECLARE_READ8_MEMBER(unk_r); |
| 32 | 37 | DECLARE_WRITE8_MEMBER(unk_w); |
| 33 | 38 | DECLARE_WRITE8_MEMBER(serial_w); |
| 34 | 39 | DECLARE_READ8_MEMBER(unk2_r); |
| 35 | 40 | DECLARE_READ8_MEMBER(unk3_r); |
| 36 | | DECLARE_READ8_MEMBER(unk4_r); |
| 41 | DECLARE_READ8_MEMBER(keyboard_status_r); |
| 42 | DECLARE_WRITE8_MEMBER( kbd_put ); |
| 37 | 43 | |
| 38 | 44 | protected: |
| 39 | 45 | // driver_device overrides |
| r24060 | r24061 | |
| 76 | 82 | |
| 77 | 83 | WRITE8_MEMBER(harriet_state::serial_w) |
| 78 | 84 | { |
| 79 | | printf("%c",data); |
| 85 | m_terminal->write(space, 0, data); |
| 80 | 86 | } |
| 81 | 87 | |
| 82 | 88 | /* tested before putting data to serial port at PC=0x4c78 */ |
| r24060 | r24061 | |
| 85 | 91 | return 0xff;//machine().rand(); |
| 86 | 92 | } |
| 87 | 93 | |
| 88 | | /* 0x314c, terminal status? */ |
| 89 | | READ8_MEMBER(harriet_state::unk4_r) |
| 94 | /* 0x314c bit 7: keyboard status */ |
| 95 | READ8_MEMBER(harriet_state::keyboard_status_r) |
| 90 | 96 | { |
| 91 | | return 0;//machine().rand(); |
| 97 | UINT8 res; |
| 98 | |
| 99 | res = m_teletype_status | m_teletype_data; |
| 100 | m_teletype_status &= ~0x80; |
| 101 | |
| 102 | return res; |
| 92 | 103 | } |
| 93 | 104 | |
| 94 | 105 | static ADDRESS_MAP_START( harriet_map, AS_PROGRAM, 16, harriet_state ) |
| r24060 | r24061 | |
| 101 | 112 | AM_RANGE(0xf20024, 0xf20025) AM_READ8(unk2_r,0x00ff) |
| 102 | 113 | AM_RANGE(0xf2002c, 0xf2002d) AM_READ8(unk3_r,0x00ff) |
| 103 | 114 | AM_RANGE(0xf2002e, 0xf2002f) AM_WRITE8(serial_w,0x00ff) |
| 104 | | AM_RANGE(0xf4003e, 0xf4003f) AM_READ8(unk4_r,0x00ff) |
| 105 | | // AM_RANGE(0xf4002e, 0xf4002f) AM_READ8(unk4_r,0x00ff) |
| 106 | | // AM_RANGE(0xf4003e, 0xf4003f) AM_READ8(unk4_r,0x00ff) |
| 115 | // AM_RANGE(0xf4001e, 0xf4001f) AM_READ8(keyboard_status_r,0x00ff) |
| 116 | // AM_RANGE(0xf4002e, 0xf4002f) AM_READ8(keyboard_status_r,0x00ff) |
| 117 | AM_RANGE(0xf4003e, 0xf4003f) AM_READ8(keyboard_status_r,0x00ff) |
| 107 | 118 | ADDRESS_MAP_END |
| 108 | 119 | |
| 109 | 120 | static INPUT_PORTS_START( harriet ) |
| r24060 | r24061 | |
| 162 | 173 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 163 | 174 | INPUT_PORTS_END |
| 164 | 175 | |
| 176 | WRITE8_MEMBER( harriet_state::kbd_put ) |
| 177 | { |
| 178 | m_teletype_data = data; |
| 179 | m_teletype_status |= 0x80; |
| 180 | } |
| 165 | 181 | |
| 182 | static GENERIC_TERMINAL_INTERFACE( terminal_intf ) |
| 183 | { |
| 184 | DEVCB_DRIVER_MEMBER(harriet_state, kbd_put) |
| 185 | }; |
| 186 | |
| 166 | 187 | void harriet_state::machine_start() |
| 167 | 188 | { |
| 168 | 189 | } |
| r24060 | r24061 | |
| 176 | 197 | { |
| 177 | 198 | } |
| 178 | 199 | |
| 200 | |
| 201 | |
| 179 | 202 | static MACHINE_CONFIG_START( harriet, harriet_state ) |
| 180 | 203 | |
| 181 | 204 | /* basic machine hardware */ |
| r24060 | r24061 | |
| 183 | 206 | MCFG_CPU_PROGRAM_MAP(harriet_map) |
| 184 | 207 | |
| 185 | 208 | /* video hardware */ |
| 186 | | MCFG_SCREEN_ADD("screen", RASTER) |
| 187 | | MCFG_SCREEN_REFRESH_RATE(60) |
| 188 | | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) |
| 189 | | MCFG_SCREEN_UPDATE_DRIVER(harriet_state, screen_update) |
| 190 | | MCFG_SCREEN_SIZE(32*8, 32*8) |
| 191 | | MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) |
| 209 | MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf) |
| 192 | 210 | |
| 193 | 211 | MCFG_PALETTE_LENGTH(8) |
| 194 | 212 | |