Previous 15994 Revisions Next

r4527 Monday 20th April, 2009 at 12:53:53 UTC by Robbbert
[KAYPRO] WIP
[src/mess/drivers]kaypro.c
[src/mess/includes]kaypro.h
[src/mess/machine]kaypro.c
[src/mess/video]kaypro.c

src/mess/video/kaypro.c
r4526r4527
99
1010static const device_config *mc6845;
1111static const UINT8 *FNT;
12static UINT8 chr,gfx,fg,bg;
13static UINT16 mem,x;
14static UINT8 framecnt=0;
15static UINT8 speed,flash;
16static UINT16 cursor;
17static UINT16 mc6845_video_address;
12static UINT8 chr,gfx,fg,bg,attr,speed,flash,framecnt=0;
13static UINT16 mem,x,cursor,mc6845_video_address;
1814
1915/***********************************************************
2016
r4526r4527
2420
2521PALETTE_INIT( kaypro )
2622{
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 */   
2926}
3027
3128VIDEO_UPDATE( kayproii )
r4526r4527
135132   return 0;
136133}
137134
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.
139138
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 */
140144
145
141146MC6845_UPDATE_ROW( kaypro2x_update_row )
142147{
143148   UINT16  *p = BITMAP_ADDR16(bitmap, y, 0);
144149
145   fg = 1;
146   bg=0;
147
148150   for (x = 0; x < x_count; x++)            // for each character
149151   {
150152      UINT8 inv=0;
151153      //      if (x == cursor_x) inv=0xff;   /* uncomment when mame fixed */
152      mem = (ma + x) & 0xfff;
154      mem = (ma + x) & 0x7ff;
153155      chr = videoram[mem];
156      attr = videoram[mem | 0x800];
154157
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      }
159180
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;
166184
167185      /* process cursor - remove when mame fixed */
168186      if ((((!flash) && (!speed)) ||
r4526r4527
174192      /* get pattern of pixels for that character scanline */
175193      gfx = FNT[(chr<<4) | ra ];
176194
177      /* Display a scanline of a character (7 pixels) */
195      /* Display a scanline of a character (8 pixels) */
178196      *p = ( gfx & 0x80 ) ? fg : bg; p++;
179197      *p = ( gfx & 0x40 ) ? fg : bg; p++;
180198      *p = ( gfx & 0x20 ) ? fg : bg; p++;
r4526r4527
182200      *p = ( gfx & 0x08 ) ? fg : bg; p++;
183201      *p = ( gfx & 0x04 ) ? fg : bg; p++;
184202      *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++;
186211   }
187212}
188213
r4526r4527
223248   if (curs_type == 3) for (i = r11; i < r10;i++) mc6845_cursor[i]=0; // now take a bite out of the middle
224249}
225250
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
227254static void mc6845_screen_configure(running_machine *machine)
228255{
229256   rectangle visarea;
230257
231   UINT16 width = mc6845_reg[1]*7-1;                     // width in pixels
258   UINT16 width = mc6845_reg[1]*8-1;                     // width in pixels
232259   UINT16 height = mc6845_reg[6]*(mc6845_reg[9]+1)-1;               // height in pixels
233260   UINT16 bytes = mc6845_reg[1]*mc6845_reg[6]-1;                  // video ram needed -1
234261
r4526r4527
237264   visarea.max_x = width-1;
238265   visarea.min_y = 0;
239266   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 */
241268      video_screen_set_visarea(machine->primary_screen, 0, width, 0, height);
242269}
243270
244271
245272/**************************** I/O PORTS *****************************************************************/
246273
274READ8_HANDLER( kaypro2x_status_r )
275{
276/* Need bit 7 high or computer hangs */
277
278   return 0x80 | mc6845_register_r( mc6845, 0);
279}
280
247281WRITE8_HANDLER( kaypro2x_index_w )
248282{
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;
250284   mc6845_address_w( mc6845, 0, data );
251285}
252286
253WRITE8_HANDLER( kaypro2x_data_w )
287WRITE8_HANDLER( kaypro2x_register_w )
254288{
255289   if (mc6845_ind < 16)
256290      mc6845_reg[mc6845_ind] = data & mc6845_mask[mc6845_ind];   /* save data in register */
r4526r4527
264298      mc6845_cursor_configure();      /* adjust cursor shape - remove when mame fixed */
265299
266300   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 */
268302
269   if (mc6845_ind == 31)
270      kaypro_videoram_w(space, mc6845_video_address, data);
271
272303   mc6845_register_w( mc6845, 0, data );
273304}
274305
r4526r4527
282313   videoram[offset] = data;
283314}
284315
316READ8_HANDLER( kaypro2x_videoram_r )
317{
318   return videoram[mc6845_video_address];
319}
320
321WRITE8_HANDLER( kaypro2x_videoram_w )
322{
323   videoram[mc6845_video_address] = data;
324}
325
285326VIDEO_START( kaypro )
286327{
287328   mc6845 = devtag_get_device(machine, "crtc");
src/mess/includes/kaypro.h
r4526r4527
4545VIDEO_UPDATE( kaypro2x );
4646
4747READ8_HANDLER( kaypro_videoram_r );
48READ8_HANDLER( kaypro2x_status_r );
49READ8_HANDLER( kaypro2x_videoram_r );
50
4851WRITE8_HANDLER( kaypro_videoram_w );
4952WRITE8_HANDLER( kaypro2x_index_w );
50WRITE8_HANDLER( kaypro2x_data_w );
53WRITE8_HANDLER( kaypro2x_register_w );
54WRITE8_HANDLER( kaypro2x_videoram_w );
src/mess/machine/kaypro.c
r4526r4527
369369   }
370370}
371371
372/* all machines have 2 floppies except kaypro 10 has one floppy and one hard drive */
372373void kaypro2x_floppy_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
373374{
374375   /* floppy */
375376   switch(state)
376377   {
377378      /* --- the following bits of info are returned as 64-bit signed integers --- */
378      case MESS_DEVINFO_INT_COUNT:         info->i = 4; break;
379      case MESS_DEVINFO_INT_COUNT:         info->i = 1; break;
379380
380381      /* --- the following bits of info are returned as pointers to data or functions --- */
381382//      case MESS_DEVINFO_PTR_LOAD:         info->load = DEVICE_IMAGE_LOAD_NAME(kaypro2_floppy); break;
src/mess/drivers/kaypro.c
r4526r4527
7474   AM_RANGE(0x13, 0x13) AM_DEVREADWRITE("wd1793", wd17xx_data_r, wd17xx_data_w)
7575   AM_RANGE(0x14, 0x17) AM_READWRITE(kaypro2x_system_port_r,kaypro2x_system_port_w)
7676   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
7993ADDRESS_MAP_END
8094
8195
r4526r4527
174188   MDRV_SCREEN_REFRESH_RATE(60)
175189   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
176190   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)
180194   MDRV_PALETTE_INIT(kaypro)
181195
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 */
183197
184198   MDRV_VIDEO_START( kaypro )
185199   MDRV_VIDEO_UPDATE( kaypro2x )
r4526r4527
202216
203217************************************************************/
204218
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 */
206220
207221ROM_START(kayproii)
208222   /* The board could take a 2716 or 2732 */
r4526r4527
272286/*    YEAR  NAME      PARENT    COMPAT  MACHINE     INPUT    INIT      CONFIG       COMPANY  FULLNAME */
273287COMP( 1983, kayproii, 0,        0,      kayproii, kay_kbd, 0,        kayproii,     "Non Linear Systems",  "Kaypro II - 2/83" , GAME_NOT_WORKING )
274288COMP( 198?, kaypro4,  kayproii, 0,      kayproii, kay_kbd, 0,        kayproii,     "Non Linear Systems",  "Kaypro 4 - 4/83" , GAME_NOT_WORKING )
275COMP( 198?, omni2,    kayproii, 0,      omni2,    kay_kbd, 0,        kayproii,     "Non Linear Systems",  "Omni II" , GAME_NOT_WORKING )
276COMP( 1984, kaypro2x, 0,        0,      kaypro2x, kay_kbd, 0,        kaypro2x,     "Non Linear Systems",  "Kaypro 2x" , GAME_NOT_WORKING )
289COMP( 198?, omni2,    kayproii, 0,      omni2,    kay_kbd, 0,        kayproii,     "Unknown",  "Omni II" , GAME_NOT_WORKING )
290COMP( 1984, kaypro2x, 0,        0,      kaypro2x, kay_kbd, 0,        kayproii,     "Non Linear Systems",  "Kaypro 2x" , GAME_NOT_WORKING )
277291COMP( 198?, kaypro10, 0,        0,      kaypro2x, kay_kbd, 0,        kaypro2x,     "Non Linear Systems",  "Kaypro 10" , GAME_NOT_WORKING )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team