trunk/src/mess/drivers/modellot.c
| r25442 | r25443 | |
| 1 | | /*************************************************************************** |
| 1 | /********************************************************************************** |
| 2 | 2 | |
| 3 | | General Processor Modello T |
| 3 | General Processor Modello T |
| 4 | 4 | |
| 5 | | 10/12/2012 Skeleton driver. |
| 5 | 2012-12-10 Skeleton driver. |
| 6 | 2013-09-27 Added keyboard and cursor. |
| 6 | 7 | |
| 7 | | ****************************************************************************/ |
| 8 | Made in Italy, a single board with numerous small daughter boards. |
| 9 | The 3 units (keyboard, disk drives, main unit) had wooden cabinets. |
| 10 | It had an inbuilt small green-screen CRT, like a Kaypro, and the RAM could |
| 11 | be 16, 32, or 48k. The FDC is a FD1791. |
| 8 | 12 | |
| 13 | All the articles and doco (what there is of it) is all in Italian. |
| 14 | |
| 15 | ***********************************************************************************/ |
| 16 | |
| 9 | 17 | #include "emu.h" |
| 10 | 18 | #include "cpu/z80/z80.h" |
| 19 | #include "machine/keyboard.h" |
| 11 | 20 | |
| 12 | 21 | |
| 13 | 22 | class modellot_state : public driver_device |
| 14 | 23 | { |
| 15 | 24 | public: |
| 16 | 25 | modellot_state(const machine_config &mconfig, device_type type, const char *tag) |
| 17 | | : driver_device(mconfig, type, tag), |
| 18 | | m_maincpu(*this, "maincpu") , |
| 19 | | m_video_ram(*this, "video_ram") |
| 26 | : driver_device(mconfig, type, tag) |
| 27 | , m_p_videoram(*this, "videoram") |
| 28 | , m_maincpu(*this, "maincpu") |
| 20 | 29 | { } |
| 21 | 30 | |
| 22 | | required_device<cpu_device> m_maincpu; |
| 23 | | required_shared_ptr<UINT8> m_video_ram; |
| 31 | DECLARE_READ8_MEMBER(port77_r); |
| 32 | DECLARE_READ8_MEMBER(portff_r); |
| 33 | DECLARE_WRITE8_MEMBER(kbd_put); |
| 24 | 34 | UINT32 screen_update_modellot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 25 | | |
| 35 | required_shared_ptr<UINT8> m_p_videoram; |
| 36 | private: |
| 37 | UINT8 m_term_data; |
| 38 | const UINT8 *m_p_chargen; |
| 26 | 39 | virtual void machine_reset(); |
| 27 | | |
| 28 | | DECLARE_READ8_MEMBER(modellot_77); |
| 29 | | DECLARE_READ8_MEMBER(modellot_ff); |
| 40 | required_device<cpu_device> m_maincpu; |
| 30 | 41 | }; |
| 31 | 42 | |
| 32 | 43 | static ADDRESS_MAP_START(modellot_mem, AS_PROGRAM, 8, modellot_state) |
| 33 | 44 | ADDRESS_MAP_UNMAP_HIGH |
| 34 | | AM_RANGE(0x0000, 0xbfff) AM_RAM |
| 35 | | AM_RANGE(0xc000, 0xc3ff) AM_RAM AM_SHARE("video_ram") |
| 45 | AM_RANGE(0x0000, 0xbfff) AM_RAM // 48k ram |
| 46 | AM_RANGE(0xc000, 0xc3ff) AM_RAM AM_SHARE("videoram") |
| 36 | 47 | AM_RANGE(0xe000, 0xffff) AM_ROM |
| 37 | 48 | ADDRESS_MAP_END |
| 38 | 49 | |
| 39 | 50 | static ADDRESS_MAP_START(modellot_io, AS_IO, 8, modellot_state) |
| 40 | 51 | ADDRESS_MAP_UNMAP_HIGH |
| 41 | 52 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 42 | | AM_RANGE(0x77, 0x77) AM_READ(modellot_77) |
| 43 | | AM_RANGE(0xff, 0xff) AM_READ(modellot_ff) |
| 53 | AM_RANGE(0x77, 0x77) AM_READ(port77_r) |
| 54 | AM_RANGE(0xff, 0xff) AM_READ(portff_r) |
| 44 | 55 | ADDRESS_MAP_END |
| 45 | 56 | |
| 46 | 57 | |
| r25442 | r25443 | |
| 48 | 59 | static INPUT_PORTS_START( modellot ) |
| 49 | 60 | INPUT_PORTS_END |
| 50 | 61 | |
| 51 | | READ8_MEMBER( modellot_state::modellot_77) |
| 62 | READ8_MEMBER( modellot_state::port77_r) |
| 52 | 63 | { |
| 53 | | return 0x04; |
| 64 | return 4; |
| 54 | 65 | } |
| 55 | 66 | |
| 56 | | READ8_MEMBER( modellot_state::modellot_ff) |
| 67 | READ8_MEMBER( modellot_state::portff_r) |
| 57 | 68 | { |
| 58 | | return 0x00; |
| 69 | UINT8 data = (m_term_data) ? m_term_data ^ 0x7f : 0xff; |
| 70 | m_term_data = 0; |
| 71 | return data; |
| 59 | 72 | } |
| 60 | 73 | |
| 74 | WRITE8_MEMBER( modellot_state::kbd_put ) |
| 75 | { |
| 76 | m_term_data = data; |
| 77 | } |
| 78 | |
| 79 | static ASCII_KEYBOARD_INTERFACE( keyboard_intf ) |
| 80 | { |
| 81 | DEVCB_DRIVER_MEMBER(modellot_state, kbd_put) |
| 82 | }; |
| 83 | |
| 61 | 84 | void modellot_state::machine_reset() |
| 62 | 85 | { |
| 86 | m_term_data = 1; |
| 87 | m_p_chargen = memregion("chargen")->base(); |
| 63 | 88 | m_maincpu->set_state_int(Z80_PC, 0xe000); |
| 64 | 89 | } |
| 65 | 90 | |
| r25442 | r25443 | |
| 82 | 107 | |
| 83 | 108 | UINT32 modellot_state::screen_update_modellot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 84 | 109 | { |
| 85 | | int x,y; |
| 110 | UINT8 y,ra,chr,gfx,inv; |
| 111 | UINT16 sy=0,ma=0,x; |
| 86 | 112 | |
| 87 | | for(y = 0; y < 16; y++ ) |
| 113 | for (y = 0; y < 16; y++) |
| 88 | 114 | { |
| 89 | | for(x = 0; x < 64; x++ ) |
| 115 | for (ra = 0; ra < 16; ra++) |
| 90 | 116 | { |
| 91 | | int code = m_video_ram[x + y*64]; |
| 92 | | drawgfx_opaque(bitmap, cliprect, machine().gfx[0], code, 0, 0, 0, x*8, y*16); |
| 117 | UINT16 *p = &bitmap.pix16(sy++); |
| 118 | |
| 119 | for (x = 0; x < 64; x++) |
| 120 | { |
| 121 | inv = 0; |
| 122 | |
| 123 | chr = m_p_videoram[x+ma]; |
| 124 | |
| 125 | if BIT(chr, 7) inv = 0xff; |
| 126 | |
| 127 | chr &= 0x7f; // cursor |
| 128 | |
| 129 | if (ra < 8) |
| 130 | gfx = m_p_chargen[(chr<<3) | ra ]; |
| 131 | else |
| 132 | gfx = m_p_chargen[(chr<<3) | (ra-8) | 0x400]; |
| 133 | |
| 134 | gfx ^= inv; |
| 135 | |
| 136 | /* Display a scanline of a character */ |
| 137 | *p++ = BIT(gfx, 7); |
| 138 | *p++ = BIT(gfx, 6); |
| 139 | *p++ = BIT(gfx, 5); |
| 140 | *p++ = BIT(gfx, 4); |
| 141 | *p++ = BIT(gfx, 3); |
| 142 | *p++ = BIT(gfx, 2); |
| 143 | *p++ = BIT(gfx, 1); |
| 144 | *p++ = BIT(gfx, 0); |
| 145 | } |
| 93 | 146 | } |
| 147 | ma+=64; |
| 94 | 148 | } |
| 95 | 149 | return 0; |
| 96 | 150 | } |
| r25442 | r25443 | |
| 108 | 162 | MCFG_SCREEN_SIZE(64*8, 16*16) |
| 109 | 163 | MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 16*16-1) |
| 110 | 164 | MCFG_SCREEN_UPDATE_DRIVER(modellot_state, screen_update_modellot) |
| 111 | | |
| 112 | 165 | MCFG_GFXDECODE( modellot ) |
| 166 | MCFG_PALETTE_LENGTH(2) |
| 167 | MCFG_PALETTE_INIT_OVERRIDE(driver_device, monochrome_green) |
| 113 | 168 | |
| 114 | | MCFG_PALETTE_LENGTH(2) |
| 115 | | MCFG_PALETTE_INIT_OVERRIDE(driver_device, black_and_white) |
| 169 | /* Devices */ |
| 170 | MCFG_ASCII_KEYBOARD_ADD(KEYBOARD_TAG, keyboard_intf) |
| 116 | 171 | MACHINE_CONFIG_END |
| 117 | 172 | |
| 118 | 173 | /* ROM definition */ |