src/mess/video/kaypro.c
| r4526 | r4527 | |
| 9 | 9 | |
| 10 | 10 | static const device_config *mc6845; |
| 11 | 11 | static const UINT8 *FNT; |
| 12 | | static UINT8 chr,gfx,fg,bg; |
| 13 | | static UINT16 mem,x; |
| 14 | | static UINT8 framecnt=0; |
| 15 | | static UINT8 speed,flash; |
| 16 | | static UINT16 cursor; |
| 17 | | static UINT16 mc6845_video_address; |
| 12 | static UINT8 chr,gfx,fg,bg,attr,speed,flash,framecnt=0; |
| 13 | static UINT16 mem,x,cursor,mc6845_video_address; |
| 18 | 14 | |
| 19 | 15 | /*********************************************************** |
| 20 | 16 | |
| r4526 | r4527 | |
| 24 | 20 | |
| 25 | 21 | PALETTE_INIT( kaypro ) |
| 26 | 22 | { |
| 27 | | palette_set_color(machine,0,RGB_BLACK); /* black */ |
| 28 | | palette_set_color(machine,1,MAKE_RGB(0, 220, 0)); /* green */ |
| 23 | palette_set_color(machine, 0, RGB_BLACK); /* black */ |
| 24 | palette_set_color(machine, 1, MAKE_RGB(0, 220, 0)); /* green */ |
| 25 | palette_set_color(machine, 2, MAKE_RGB(0, 110, 0)); /* low intensity green */ |
| 29 | 26 | } |
| 30 | 27 | |
| 31 | 28 | VIDEO_UPDATE( kayproii ) |
| r4526 | r4527 | |
| 135 | 132 | return 0; |
| 136 | 133 | } |
| 137 | 134 | |
| 138 | | /* bit 6 of kaypro2x_system_port selects alternate characters (A12 on character generator rom) */ |
| 135 | /* bit 6 of kaypro2x_system_port selects alternate characters (A12 on character generator rom). |
| 136 | The diagram specifies a 2732 with 28 pins, and more address pins. Possibly a 2764 or 27128. |
| 137 | Since our dump only goes up to A11, the alternate character set doesn't exist. |
| 139 | 138 | |
| 139 | 0000-07FF of videoram is memory-mapped characters; 0800-0FFF is equivalent attribute bytes. |
| 140 | d3 Underline |
| 141 | d2 blinking (at unknown rate) |
| 142 | d1 low intensity |
| 143 | d0 reverse video */ |
| 140 | 144 | |
| 145 | |
| 141 | 146 | MC6845_UPDATE_ROW( kaypro2x_update_row ) |
| 142 | 147 | { |
| 143 | 148 | UINT16 *p = BITMAP_ADDR16(bitmap, y, 0); |
| 144 | 149 | |
| 145 | | fg = 1; |
| 146 | | bg=0; |
| 147 | | |
| 148 | 150 | for (x = 0; x < x_count; x++) // for each character |
| 149 | 151 | { |
| 150 | 152 | UINT8 inv=0; |
| 151 | 153 | // if (x == cursor_x) inv=0xff; /* uncomment when mame fixed */ |
| 152 | | mem = (ma + x) & 0xfff; |
| 154 | mem = (ma + x) & 0x7ff; |
| 153 | 155 | chr = videoram[mem]; |
| 156 | attr = videoram[mem | 0x800]; |
| 154 | 157 | |
| 155 | | /* get colour or b&w */ |
| 156 | | // col = 5; /* green */ |
| 157 | | // if ((options & 0x60) == 0x60) col = 15; /* b&w */ |
| 158 | | // if (!(options & 0x40)) col = colorram[mem]; // read a byte of colour |
| 158 | if ((attr & 3) == 3) |
| 159 | { |
| 160 | fg = 0; |
| 161 | bg = 2; |
| 162 | } |
| 163 | else |
| 164 | if ((attr & 3) == 2) |
| 165 | { |
| 166 | fg = 2; |
| 167 | bg = 0; |
| 168 | } |
| 169 | else |
| 170 | if ((attr & 3) == 1) |
| 171 | { |
| 172 | fg = 0; |
| 173 | bg = 1; |
| 174 | } |
| 175 | else |
| 176 | { |
| 177 | fg = 1; |
| 178 | bg = 0; |
| 179 | } |
| 159 | 180 | |
| 160 | | /* if inverse mode, replace any pcgram chrs with inverse chrs */ |
| 161 | | // if ((!super80v_rom_pcg) && (chr & 0x80)) // is it a high chr in inverse mode |
| 162 | | // { |
| 163 | | // inv ^= 0xff; // invert the chr |
| 164 | | // chr &= 0x7f; // and drop bit 7 |
| 165 | | // } |
| 181 | /* Take care of flashing characters */ |
| 182 | if ((attr & 4) && (framecnt & 8)) |
| 183 | fg = bg; |
| 166 | 184 | |
| 167 | 185 | /* process cursor - remove when mame fixed */ |
| 168 | 186 | if ((((!flash) && (!speed)) || |
| r4526 | r4527 | |
| 174 | 192 | /* get pattern of pixels for that character scanline */ |
| 175 | 193 | gfx = FNT[(chr<<4) | ra ]; |
| 176 | 194 | |
| 177 | | /* Display a scanline of a character (7 pixels) */ |
| 195 | /* Display a scanline of a character (8 pixels) */ |
| 178 | 196 | *p = ( gfx & 0x80 ) ? fg : bg; p++; |
| 179 | 197 | *p = ( gfx & 0x40 ) ? fg : bg; p++; |
| 180 | 198 | *p = ( gfx & 0x20 ) ? fg : bg; p++; |
| r4526 | r4527 | |
| 182 | 200 | *p = ( gfx & 0x08 ) ? fg : bg; p++; |
| 183 | 201 | *p = ( gfx & 0x04 ) ? fg : bg; p++; |
| 184 | 202 | *p = ( gfx & 0x02 ) ? fg : bg; p++; |
| 185 | | *p = ( gfx & 0x01 ) ? fg : bg; p++; |
| 203 | |
| 204 | /* underline */ |
| 205 | if (attr & 8) |
| 206 | *p = fg; |
| 207 | else |
| 208 | *p = ( gfx & 0x01 ) ? fg : bg; |
| 209 | |
| 210 | p++; |
| 186 | 211 | } |
| 187 | 212 | } |
| 188 | 213 | |
| r4526 | r4527 | |
| 223 | 248 | if (curs_type == 3) for (i = r11; i < r10;i++) mc6845_cursor[i]=0; // now take a bite out of the middle |
| 224 | 249 | } |
| 225 | 250 | |
| 226 | | /* Resize the screen within the limits of the hardware. Expand the image to fill the screen area */ |
| 251 | /* Resize the screen within the limits of the hardware. Expand the image to fill the screen area. |
| 252 | Standard screen is 640 x 400 = 0x7d0 bytes. */ |
| 253 | |
| 227 | 254 | static void mc6845_screen_configure(running_machine *machine) |
| 228 | 255 | { |
| 229 | 256 | rectangle visarea; |
| 230 | 257 | |
| 231 | | UINT16 width = mc6845_reg[1]*7-1; // width in pixels |
| 258 | UINT16 width = mc6845_reg[1]*8-1; // width in pixels |
| 232 | 259 | UINT16 height = mc6845_reg[6]*(mc6845_reg[9]+1)-1; // height in pixels |
| 233 | 260 | UINT16 bytes = mc6845_reg[1]*mc6845_reg[6]-1; // video ram needed -1 |
| 234 | 261 | |
| r4526 | r4527 | |
| 237 | 264 | visarea.max_x = width-1; |
| 238 | 265 | visarea.min_y = 0; |
| 239 | 266 | visarea.max_y = height-1; |
| 240 | | if ((width < 610) && (height < 460) && (bytes < 0x1000)) /* bounds checking to prevent an assert or violation */ |
| 267 | if ((width < 640) && (height < 400) && (bytes < 0x800)) /* bounds checking to prevent an assert or violation */ |
| 241 | 268 | video_screen_set_visarea(machine->primary_screen, 0, width, 0, height); |
| 242 | 269 | } |
| 243 | 270 | |
| 244 | 271 | |
| 245 | 272 | /**************************** I/O PORTS *****************************************************************/ |
| 246 | 273 | |
| 274 | READ8_HANDLER( kaypro2x_status_r ) |
| 275 | { |
| 276 | /* Need bit 7 high or computer hangs */ |
| 277 | |
| 278 | return 0x80 | mc6845_register_r( mc6845, 0); |
| 279 | } |
| 280 | |
| 247 | 281 | WRITE8_HANDLER( kaypro2x_index_w ) |
| 248 | 282 | { |
| 249 | | if (data < 32) mc6845_ind = data; else mc6845_ind = 32; /* make sure if you try using an invalid register your write will go nowhere */ |
| 283 | mc6845_ind = data & 0x1f; |
| 250 | 284 | mc6845_address_w( mc6845, 0, data ); |
| 251 | 285 | } |
| 252 | 286 | |
| 253 | | WRITE8_HANDLER( kaypro2x_data_w ) |
| 287 | WRITE8_HANDLER( kaypro2x_register_w ) |
| 254 | 288 | { |
| 255 | 289 | if (mc6845_ind < 16) |
| 256 | 290 | mc6845_reg[mc6845_ind] = data & mc6845_mask[mc6845_ind]; /* save data in register */ |
| r4526 | r4527 | |
| 264 | 298 | mc6845_cursor_configure(); /* adjust cursor shape - remove when mame fixed */ |
| 265 | 299 | |
| 266 | 300 | if ((mc6845_ind > 17) && (mc6845_ind < 20)) |
| 267 | | mc6845_video_address = mc6845_reg[19] | (mc6845_reg[18] << 8); /* internal ULA address */ |
| 301 | mc6845_video_address = mc6845_reg[19] | ((mc6845_reg[18] & 0x3f) << 8); /* internal ULA address */ |
| 268 | 302 | |
| 269 | | if (mc6845_ind == 31) |
| 270 | | kaypro_videoram_w(space, mc6845_video_address, data); |
| 271 | | |
| 272 | 303 | mc6845_register_w( mc6845, 0, data ); |
| 273 | 304 | } |
| 274 | 305 | |
| r4526 | r4527 | |
| 282 | 313 | videoram[offset] = data; |
| 283 | 314 | } |
| 284 | 315 | |
| 316 | READ8_HANDLER( kaypro2x_videoram_r ) |
| 317 | { |
| 318 | return videoram[mc6845_video_address]; |
| 319 | } |
| 320 | |
| 321 | WRITE8_HANDLER( kaypro2x_videoram_w ) |
| 322 | { |
| 323 | videoram[mc6845_video_address] = data; |
| 324 | } |
| 325 | |
| 285 | 326 | VIDEO_START( kaypro ) |
| 286 | 327 | { |
| 287 | 328 | mc6845 = devtag_get_device(machine, "crtc"); |
src/mess/drivers/kaypro.c
| r4526 | r4527 | |
| 74 | 74 | AM_RANGE(0x13, 0x13) AM_DEVREADWRITE("wd1793", wd17xx_data_r, wd17xx_data_w) |
| 75 | 75 | AM_RANGE(0x14, 0x17) AM_READWRITE(kaypro2x_system_port_r,kaypro2x_system_port_w) |
| 76 | 76 | AM_RANGE(0x18, 0x1b) AM_DEVWRITE("centronics", centronics_data_w) |
| 77 | | AM_RANGE(0x1c, 0x1c) AM_MIRROR(2) AM_WRITE(kaypro2x_index_w) |
| 78 | | AM_RANGE(0x1d, 0x1d) AM_MIRROR(2) AM_DEVREAD("crtc", mc6845_register_r) AM_WRITE(kaypro2x_data_w) |
| 77 | AM_RANGE(0x1c, 0x1c) AM_READWRITE(kaypro2x_status_r,kaypro2x_index_w) |
| 78 | AM_RANGE(0x1d, 0x1d) AM_DEVREAD("crtc", mc6845_register_r) AM_WRITE(kaypro2x_register_w) |
| 79 | AM_RANGE(0x1f, 0x1f) AM_READWRITE(kaypro2x_videoram_r,kaypro2x_videoram_w) |
| 80 | |
| 81 | /* The below are not emulated */ |
| 82 | /* AM_RANGE(0x20, 0x23) AM_DEVREADWRITE("z80pio", kaypro2x_pio_r, kaypro2x_pio_w) - for RTC and Modem |
| 83 | AM_RANGE(0x24, 0x27) communicate with MM58167A RTC. Modem uses TMS99531 and TMS99532 chips. |
| 84 | AM_RANGE(0x80, 0x80) Hard drive controller card I/O port - 10MB hard drive only fitted to the Kaypro 10 |
| 85 | AM_RANGE(0x81, 0x81) Hard Drive READ error register, WRITE precomp |
| 86 | AM_RANGE(0x82, 0x82) Hard Drive Sector register count I/O |
| 87 | AM_RANGE(0x83, 0x83) Hard Drive Sector register number I/O |
| 88 | AM_RANGE(0x84, 0x84) Hard Drive Cylinder low register I/O |
| 89 | AM_RANGE(0x85, 0x85) Hard Drive Cylinder high register I/O |
| 90 | AM_RANGE(0x86, 0x86) Hard Drive Size / Drive / Head register I/O |
| 91 | AM_RANGE(0x87, 0x87) Hard Drive READ status register, WRITE command register */ |
| 92 | AM_RANGE(0x20, 0x87) AM_NOP |
| 79 | 93 | ADDRESS_MAP_END |
| 80 | 94 | |
| 81 | 95 | |
| r4526 | r4527 | |
| 174 | 188 | MDRV_SCREEN_REFRESH_RATE(60) |
| 175 | 189 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 176 | 190 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 177 | | MDRV_SCREEN_SIZE(80*8, 24*16) |
| 178 | | MDRV_SCREEN_VISIBLE_AREA(0,80*8-1,0,24*16-1) |
| 179 | | MDRV_PALETTE_LENGTH(2) |
| 191 | MDRV_SCREEN_SIZE(80*8, 25*16) |
| 192 | MDRV_SCREEN_VISIBLE_AREA(0,80*8-1,0,25*16-1) |
| 193 | MDRV_PALETTE_LENGTH(3) |
| 180 | 194 | MDRV_PALETTE_INIT(kaypro) |
| 181 | 195 | |
| 182 | | MDRV_MC6845_ADD("crtc", MC6845, 1500000 , kaypro2x_crtc) /* speed to be determined ****************/ |
| 196 | MDRV_MC6845_ADD("crtc", MC6845, 1500000, kaypro2x_crtc) /* comes out of ULA - needs to be measured */ |
| 183 | 197 | |
| 184 | 198 | MDRV_VIDEO_START( kaypro ) |
| 185 | 199 | MDRV_VIDEO_UPDATE( kaypro2x ) |
| r4526 | r4527 | |
| 202 | 216 | |
| 203 | 217 | ************************************************************/ |
| 204 | 218 | |
| 205 | | /* The roms need to be renamed to their part numbers (81-xxx) when known */ |
| 219 | /* The detested bios "universal rom" is part number 81-478 */ |
| 206 | 220 | |
| 207 | 221 | ROM_START(kayproii) |
| 208 | 222 | /* The board could take a 2716 or 2732 */ |
| r4526 | r4527 | |
| 272 | 286 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ |
| 273 | 287 | COMP( 1983, kayproii, 0, 0, kayproii, kay_kbd, 0, kayproii, "Non Linear Systems", "Kaypro II - 2/83" , GAME_NOT_WORKING ) |
| 274 | 288 | COMP( 198?, kaypro4, kayproii, 0, kayproii, kay_kbd, 0, kayproii, "Non Linear Systems", "Kaypro 4 - 4/83" , GAME_NOT_WORKING ) |
| 275 | | COMP( 198?, omni2, kayproii, 0, omni2, kay_kbd, 0, kayproii, "Non Linear Systems", "Omni II" , GAME_NOT_WORKING ) |
| 276 | | COMP( 1984, kaypro2x, 0, 0, kaypro2x, kay_kbd, 0, kaypro2x, "Non Linear Systems", "Kaypro 2x" , GAME_NOT_WORKING ) |
| 289 | COMP( 198?, omni2, kayproii, 0, omni2, kay_kbd, 0, kayproii, "Unknown", "Omni II" , GAME_NOT_WORKING ) |
| 290 | COMP( 1984, kaypro2x, 0, 0, kaypro2x, kay_kbd, 0, kayproii, "Non Linear Systems", "Kaypro 2x" , GAME_NOT_WORKING ) |
| 277 | 291 | COMP( 198?, kaypro10, 0, 0, kaypro2x, kay_kbd, 0, kaypro2x, "Non Linear Systems", "Kaypro 10" , GAME_NOT_WORKING ) |