src/mess/drivers/argo.c
| r11146 | r11147 | |
| 26 | 26 | |
| 27 | 27 | required_device<cpu_device> m_maincpu; |
| 28 | 28 | DECLARE_WRITE8_MEMBER(argo_videoram_w); |
| 29 | DECLARE_WRITE8_MEMBER(argo_io_w); |
| 29 | 30 | UINT8 *m_p_videoram; |
| 30 | 31 | const UINT8 *m_p_chargen; |
| 31 | 32 | UINT8 m_framecnt; |
| 33 | UINT8 m_cursor_pos[3]; |
| 34 | UINT8 m_cur; |
| 35 | bool m_ram_ctrl; |
| 32 | 36 | virtual void machine_reset(); |
| 33 | 37 | virtual void video_start(); |
| 34 | 38 | virtual bool screen_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect); |
| 35 | 39 | }; |
| 36 | 40 | |
| 41 | // write to videoram if following 'out b9,61' otherwise discard |
| 37 | 42 | WRITE8_MEMBER(argo_state::argo_videoram_w) |
| 38 | 43 | { |
| 39 | | UINT8 *RAM = machine().region("videoram")->base(); |
| 40 | | RAM[offset] = data; |
| 44 | if (m_ram_ctrl) |
| 45 | { |
| 46 | UINT8 *RAM = machine().region("videoram")->base(); |
| 47 | RAM[offset] = data; |
| 48 | } |
| 41 | 49 | } |
| 42 | 50 | |
| 51 | WRITE8_MEMBER(argo_state::argo_io_w) |
| 52 | { |
| 53 | UINT8 low_io = offset; |
| 54 | |
| 55 | switch (low_io) |
| 56 | { |
| 57 | case 0xC0: // store cursor position if it followed 'out c4,80' |
| 58 | if (m_cur > 0) m_cursor_pos[m_cur]=data; |
| 59 | if (m_cur < 2) m_cur++; |
| 60 | break; |
| 61 | case 0xC4: |
| 62 | if (data == 0x80) m_cur=1; else m_cur=0; |
| 63 | break; |
| 64 | case 0xB9: |
| 65 | m_ram_ctrl = (data == 0x61); |
| 66 | break; |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | |
| 71 | |
| 43 | 72 | static ADDRESS_MAP_START(argo_mem, AS_PROGRAM, 8, argo_state) |
| 44 | 73 | ADDRESS_MAP_UNMAP_HIGH |
| 45 | 74 | AM_RANGE(0x0000, 0x07ff) AM_RAMBANK("boot") |
| r11146 | r11147 | |
| 62 | 91 | AM_RANGE(0x09A1, 0x09A1) AM_READ_PORT("X9") |
| 63 | 92 | AM_RANGE(0x0AA1, 0x0AA1) AM_READ_PORT("XA") |
| 64 | 93 | AM_RANGE(0x0BA1, 0x0BA1) AM_READ_PORT("XB") |
| 94 | AM_RANGE(0x0000, 0xFFFF) AM_WRITE(argo_io_w) |
| 65 | 95 | ADDRESS_MAP_END |
| 66 | 96 | |
| 67 | 97 | /* Input ports */ |
| r11146 | r11147 | |
| 108 | 138 | { |
| 109 | 139 | UINT8 y,ra,chr,gfx; |
| 110 | 140 | UINT16 sy=0,ma=0,x; |
| 111 | | UINT8 *vram = m_p_videoram; |
| 141 | UINT8 *p_vram = m_p_videoram; |
| 112 | 142 | |
| 113 | 143 | m_framecnt++; |
| 114 | 144 | |
| r11146 | r11147 | |
| 118 | 148 | { |
| 119 | 149 | UINT16 *p = BITMAP_ADDR16(&bitmap, sy++, 0); |
| 120 | 150 | |
| 121 | | for (x = ma; x < ma + 80; x++) |
| 151 | for (x = 1; x < 81; x++) // align x to the cursor position numbers |
| 122 | 152 | { |
| 123 | 153 | gfx = 0; |
| 124 | 154 | |
| 125 | 155 | if (ra < 9) |
| 126 | 156 | { |
| 127 | | chr = vram[x]; |
| 157 | chr = p_vram[x+ma-1]; |
| 128 | 158 | |
| 129 | 159 | /* Take care of flashing characters */ |
| 130 | | if ((chr & 0x80) && (m_framecnt & 0x08)) |
| 131 | | chr = 0x20; |
| 160 | //if ((chr & 0x80) && (m_framecnt & 0x08)) |
| 161 | // chr = 0x20; |
| 132 | 162 | |
| 133 | 163 | chr &= 0x7f; |
| 134 | 164 | |
| 135 | 165 | gfx = m_p_chargen[(chr<<4) | ra ]; |
| 136 | 166 | } |
| 167 | else |
| 168 | // display cursor if at cursor position and flash on |
| 169 | if ((x==m_cursor_pos[1]) && (y==m_cursor_pos[2]) && (m_framecnt & 0x08)) |
| 170 | gfx = 0xff; |
| 137 | 171 | |
| 138 | 172 | /* Display a scanline of a character */ |
| 139 | 173 | *p++ = BIT(gfx, 7); |
| r11146 | r11147 | |
| 152 | 186 | else |
| 153 | 187 | { |
| 154 | 188 | ma=0; |
| 155 | | vram = machine().region("videoram")->base(); |
| 189 | p_vram = machine().region("videoram")->base(); |
| 156 | 190 | } |
| 157 | 191 | } |
| 158 | 192 | return 0; |