Previous 15994 Revisions Next

r4174 Wednesday 21st January, 2009 at 12:50:27 UTC by Dirk Best
[ENTERPRISE] Cleanups, moved video functions to epnick.c
[src/mess/drivers]enterp.c
[src/mess/video]epnick.c epnick.h

src/mess/video/epnick.c
r4173r4174
33 * video/epnick.c
44 *
55 * Nick Graphics Chip - found in Enterprise
6 *
6 *
77 * this is a display list graphics chip, with bitmap,
88 * character and attribute graphics modes. Each entry in the
99 * display list defines a char line, with variable number of
1010 * scanlines. Colour modes are 2,4, 16 and 256 colour.
1111 * Nick has 256 colours, 3 bits for R and G, with 2 bits for Blue.
1212 * It's a nice and flexible graphics processor..........
13 *
13 *
1414 ****************************************************************************/
1515
1616#include "driver.h"
1717#include "epnick.h"
1818
1919
20/* given a colour index in range 0..255 gives the Red component */
21#define NICK_GET_RED8(x) \
22   ((      \
23     ( ( (x & (1<<0)) >>0) <<2) | \
24     ( ( (x & (1<<3)) >>3) <<1) | \
25     ( ( (x & (1<<6)) >>6) <<0) \
26   )<<5)
27
28/* given a colour index in range 0..255 gives the Red component */
29#define NICK_GET_GREEN8(x) \
30   ((   \
31     ( ( (x & (1<<1)) >>1) <<2) | \
32     ( ( (x & (1<<4)) >>4) <<1) | \
33     ( ( (x & (1<<7)) >>7) <<0) \
34   )<<5)
35
36/* given a colour index in range 0..255 gives the Red component */
37#define NICK_GET_BLUE8(x) \
38   (( \
39     ( ( (x & (1<<2)) >>2) <<1) | \
40     ( ( (x & (1<<5)) >>5) <<0) \
41   )<<6)
42
43
44/* Nick executes a Display list, in the form of a list of Line Parameter
45Tables, this is the form of the data */
46typedef struct LPT_ENTRY
47{
48   unsigned char SC;      /* scanlines in this modeline (two's complement) */
49   unsigned char MB;      /* the MODEBYTE (defines video display mode) */
50   unsigned char LM;      /* left margin etc */
51   unsigned char RM;      /* right margin etc */
52   unsigned char LD1L;   /* (a7..a0) of line data pointer LD1 */
53   unsigned char LD1H;   /* (a8..a15) of line data pointer LD1 */
54   unsigned char LD2L;   /* (a7..a0) of line data pointer LD2 */
55   unsigned char LD2H;   /* (a8..a15) of line data pointer LD2 */
56   unsigned char COL[8];   /* COL0..COL7 */
57} LPT_ENTRY;
58
59typedef struct NICK_STATE
60{
61   /* horizontal position */
62   unsigned char HorizontalClockCount;
63   /* current scanline within LPT */
64   unsigned char ScanLineCount;
65
66   unsigned char FIXBIAS;
67   unsigned char BORDER;
68   unsigned char LPL;
69   unsigned char LPH;
70
71   unsigned long LD1;
72   unsigned long LD2;
73
74   LPT_ENTRY   LPT;
75
76   UINT16 *dest;
77   int dest_pos;
78   int dest_max_pos;
79
80   unsigned char Reg[16];
81} NICK_STATE;
82
83/* colour mode types */
84#define   NICK_2_COLOUR_MODE   0
85#define   NICK_4_COLOUR_MODE   1
86#define   NICK_16_COLOUR_MODE   2
87#define   NICK_256_COLOUR_MODE   3
88
89/* Display mode types */
90#define   NICK_VSYNC_MODE   0
91#define   NICK_PIXEL_MODE   1
92#define   NICK_ATTR_MODE   2
93#define   NICK_CH256_MODE   3
94#define   NICK_CH128_MODE   4
95#define   NICK_CH64_MODE   5
96#define   NICK_UNUSED_MODE   6
97#define   NICK_LPIXEL_MODE   7
98
99/* MODEBYTE defines */
100#define   NICK_MB_VIRQ         (1<<7)
101#define   NICK_MB_VRES         (1<<4)
102#define   NICK_MB_LPT_RELOAD      (1<<0)
103
104/* Left margin defines */
105#define   NICK_LM_MSBALT         (1<<7)
106#define   NICK_LM_LSBALT         (1<<6)
107
108/* Right margin defines */
109#define   NICK_RM_ALTIND1         (1<<7)
110#define   NICK_RM_ALTIND0         (1<<6)
111
112/* useful macros */
113#define   NICK_GET_LEFT_MARGIN(x)      (x & 0x03f)
114#define   NICK_GET_RIGHT_MARGIN(x)   (x & 0x03f)
115#define   NICK_GET_DISPLAY_MODE(x)   ((x>>1) & 0x07)
116#define   NICK_GET_COLOUR_MODE(x)      ((x>>5) & 0x03)
117
118#define NICK_RELOAD_LPT(x)         (x & 0x080)
119#define NICK_CLOCK_LPT(x)         (x & 0x040)
120
121/* Macros to generate memory address is CHx modes */
122/* x = LD2, y = buf1 */
123#define ADDR_CH256(x,y)      (((x & 0x0ff)<<8) | (y & 0x0ff))
124#define ADDR_CH128(x,y)      (((x & 0x01ff)<<7) | (y & 0x07f))
125#define ADDR_CH64(x,y)      (((x & 0x03ff)<<6) | (y & 0x03f))
126
127
20128/*************************************************************/
21129/* MESS stuff */
22130static NICK_STATE Nick;
r4173r4174
112220      Nick_PenIndexLookup_16Colour[i] = PenIndex;
113221   }
114222
115   Nick_CalcVisibleClocks(50*16);
223   Nick_CalcVisibleClocks(ENTERPRISE_SCREEN_WIDTH);
116224
117225//   Nick.BORDER = 0;
118226//   Nick.FIXBIAS = 0;
r4173r4174
9131021    /* next line */
9141022    line++;
9151023  }
916  while (((Nick.LPT.MB & 0x080)==0) && (line<(35*8)));
1024  while (((Nick.LPT.MB & 0x080)==0) && (line<ENTERPRISE_SCREEN_HEIGHT));
9171025
9181026}
9191027
9201028
1029VIDEO_START( nick )
1030{
1031   Nick_vh_start();
1032   VIDEO_START_CALL(generic_bitmapped);
1033}
9211034
9221035
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
1036VIDEO_UPDATE( nick )
1037{
1038   Nick_DoScreen(tmpbitmap);
1039   return VIDEO_UPDATE_CALL(generic_bitmapped);
1040}
src/mess/video/epnick.h
r4173r4174
11/*****************************************************************************
22 *
33 * video/epnick.h
4 *
4 *
55 * Nick Graphics Chip - found in Enterprise
66 *
77 ****************************************************************************/
88
9#ifndef EPNICK_H_
10#define EPNICK_H_
9#ifndef __EPNICK_H__
10#define __EPNICK_H__
1111
1212
13#define NICK_PALETTE_SIZE   256
14#define NICK_COLOURTABLE_SIZE   256
13/* there are 64us per line, although in reality
14   about 50 are visible. */
15#define ENTERPRISE_SCREEN_WIDTH (50*16)
1516
16/* given a colour index in range 0..255 gives the Red component */
17#define NICK_GET_RED8(x) \
18   ((      \
19     ( ( (x & (1<<0)) >>0) <<2) | \
20     ( ( (x & (1<<3)) >>3) <<1) | \
21     ( ( (x & (1<<6)) >>6) <<0) \
22   )<<5)
17/* there are 312 lines per screen, although in reality
18   about 35*8 are visible */
19#define ENTERPRISE_SCREEN_HEIGHT   (35*8)
2320
24/* given a colour index in range 0..255 gives the Red component */
25#define NICK_GET_GREEN8(x) \
26   ((   \
27     ( ( (x & (1<<1)) >>1) <<2) | \
28     ( ( (x & (1<<4)) >>4) <<1) | \
29     ( ( (x & (1<<7)) >>7) <<0) \
30   )<<5)
3121
32/* given a colour index in range 0..255 gives the Red component */
33#define NICK_GET_BLUE8(x) \
34   (( \
35     ( ( (x & (1<<2)) >>2) <<1) | \
36     ( ( (x & (1<<5)) >>5) <<0) \
37   )<<6)
22#define NICK_PALETTE_SIZE   256
3823
3924
40/* Nick executes a Display list, in the form of a list of Line Parameter
41Tables, this is the form of the data */
42typedef struct LPT_ENTRY
43{
44   unsigned char SC;      /* scanlines in this modeline (two's complement) */
45   unsigned char MB;      /* the MODEBYTE (defines video display mode) */
46   unsigned char LM;      /* left margin etc */
47   unsigned char RM;      /* right margin etc */
48   unsigned char LD1L;   /* (a7..a0) of line data pointer LD1 */
49   unsigned char LD1H;   /* (a8..a15) of line data pointer LD1 */
50   unsigned char LD2L;   /* (a7..a0) of line data pointer LD2 */
51   unsigned char LD2H;   /* (a8..a15) of line data pointer LD2 */
52   unsigned char COL[8];   /* COL0..COL7 */
53} LPT_ENTRY;
54
55typedef struct NICK_STATE
56{
57   /* horizontal position */
58   unsigned char HorizontalClockCount;
59   /* current scanline within LPT */
60   unsigned char ScanLineCount;
61
62   unsigned char FIXBIAS;
63   unsigned char BORDER;
64   unsigned char LPL;
65   unsigned char LPH;
66
67   unsigned long LD1;
68   unsigned long LD2;
69
70   LPT_ENTRY   LPT;
71
72   UINT16 *dest;
73   int dest_pos;
74   int dest_max_pos;
75
76   unsigned char Reg[16];
77} NICK_STATE;
78
79/* colour mode types */
80#define   NICK_2_COLOUR_MODE   0
81#define   NICK_4_COLOUR_MODE   1
82#define   NICK_16_COLOUR_MODE   2
83#define   NICK_256_COLOUR_MODE   3
84
85/* Display mode types */
86#define   NICK_VSYNC_MODE   0
87#define   NICK_PIXEL_MODE   1
88#define   NICK_ATTR_MODE   2
89#define   NICK_CH256_MODE   3
90#define   NICK_CH128_MODE   4
91#define   NICK_CH64_MODE   5
92#define   NICK_UNUSED_MODE   6
93#define   NICK_LPIXEL_MODE   7
94
95/* MODEBYTE defines */
96#define   NICK_MB_VIRQ         (1<<7)
97#define   NICK_MB_VRES         (1<<4)
98#define   NICK_MB_LPT_RELOAD      (1<<0)
99
100/* Left margin defines */
101#define   NICK_LM_MSBALT         (1<<7)
102#define   NICK_LM_LSBALT         (1<<6)
103
104/* Right margin defines */
105#define   NICK_RM_ALTIND1         (1<<7)
106#define   NICK_RM_ALTIND0         (1<<6)
107
108/* useful macros */
109#define   NICK_GET_LEFT_MARGIN(x)      (x & 0x03f)
110#define   NICK_GET_RIGHT_MARGIN(x)   (x & 0x03f)
111#define   NICK_GET_DISPLAY_MODE(x)   ((x>>1) & 0x07)
112#define   NICK_GET_COLOUR_MODE(x)      ((x>>5) & 0x03)
113
114#define NICK_RELOAD_LPT(x)         (x & 0x080)
115#define NICK_CLOCK_LPT(x)         (x & 0x040)
116
117/* Macros to generate memory address is CHx modes */
118/* x = LD2, y = buf1 */
119#define ADDR_CH256(x,y)      (((x & 0x0ff)<<8) | (y & 0x0ff))
120#define ADDR_CH128(x,y)      (((x & 0x01ff)<<7) | (y & 0x07f))
121#define ADDR_CH64(x,y)      (((x & 0x03ff)<<6) | (y & 0x03f))
122
123
12425/*----------- defined in video/epnick.c -----------*/
12526
126/* initialise palette function */
127extern PALETTE_INIT( nick );
27PALETTE_INIT( nick );
28VIDEO_START( nick );
29VIDEO_UPDATE( nick );
12830
129int Nick_vh_start(void);
130void Nick_DoScreen(bitmap_t *bm);
31WRITE8_HANDLER( Nick_reg_w );
13132
132#if 0
133int Nick_reg_r(int);
134#endif
135WRITE8_HANDLER ( Nick_reg_w );
13633
137
138#endif /* EPNICK_H_ */
34#endif /* __EPNICK_H__ */
src/mess/drivers/enterp.c
r4173r4174
2525
2626#define ENTERPRISE_XTAL_X1   XTAL_8MHz
2727
28/* there are 64us per line, although in reality
29   about 50 are visible. */
30/* there are 312 lines per screen, although in reality
31   about 35*8 are visible */
32#define ENTERPRISE_SCREEN_WIDTH (50*16)
33#define ENTERPRISE_SCREEN_HEIGHT   (35*8)
3428
35
3629/* state of the wd1770 irq/drq lines */
3730static UINT8 exdos_card_value = 0;
3831
r4173r4174
199192
200193
201194/***************************************************************************
202    VIDEO
203***************************************************************************/
204
205static VIDEO_START( enterprise )
206{
207   Nick_vh_start();
208   VIDEO_START_CALL(generic_bitmapped);
209}
210
211
212static VIDEO_UPDATE( enterprise )
213{
214   Nick_DoScreen(tmpbitmap);
215   return VIDEO_UPDATE_CALL(generic_bitmapped);
216}
217
218
219/***************************************************************************
220195    FLOPPY/EXDOS
221196***************************************************************************/
222197
r4173r4174
482457   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
483458   MDRV_SCREEN_SIZE(ENTERPRISE_SCREEN_WIDTH, ENTERPRISE_SCREEN_HEIGHT)
484459   MDRV_SCREEN_VISIBLE_AREA(0, ENTERPRISE_SCREEN_WIDTH-1, 0, ENTERPRISE_SCREEN_HEIGHT-1)
485   /* MDRV_GFXDECODE( enterprise ) */
460
486461   MDRV_PALETTE_LENGTH(NICK_PALETTE_SIZE)
487   MDRV_PALETTE_INIT( nick )
462   MDRV_PALETTE_INIT(nick)
488463
489   MDRV_VIDEO_START( enterprise )
490   MDRV_VIDEO_UPDATE( enterprise )
464   MDRV_VIDEO_START(nick)
465   MDRV_VIDEO_UPDATE(nick)
491466
492467   /* sound hardware */
493468   MDRV_SPEAKER_STANDARD_MONO("mono")

Previous 15994 Revisions Next


© 1998-2018 The MESS Team