src/mess/video/epnick.c
| r4173 | r4174 | |
| 3 | 3 | * video/epnick.c |
| 4 | 4 | * |
| 5 | 5 | * Nick Graphics Chip - found in Enterprise |
| 6 | | * |
| 6 | * |
| 7 | 7 | * this is a display list graphics chip, with bitmap, |
| 8 | 8 | * character and attribute graphics modes. Each entry in the |
| 9 | 9 | * display list defines a char line, with variable number of |
| 10 | 10 | * scanlines. Colour modes are 2,4, 16 and 256 colour. |
| 11 | 11 | * Nick has 256 colours, 3 bits for R and G, with 2 bits for Blue. |
| 12 | 12 | * It's a nice and flexible graphics processor.......... |
| 13 | | * |
| 13 | * |
| 14 | 14 | ****************************************************************************/ |
| 15 | 15 | |
| 16 | 16 | #include "driver.h" |
| 17 | 17 | #include "epnick.h" |
| 18 | 18 | |
| 19 | 19 | |
| 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 |
| 45 | Tables, this is the form of the data */ |
| 46 | typedef 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 | |
| 59 | typedef 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 | |
| 20 | 128 | /*************************************************************/ |
| 21 | 129 | /* MESS stuff */ |
| 22 | 130 | static NICK_STATE Nick; |
| r4173 | r4174 | |
| 112 | 220 | Nick_PenIndexLookup_16Colour[i] = PenIndex; |
| 113 | 221 | } |
| 114 | 222 | |
| 115 | | Nick_CalcVisibleClocks(50*16); |
| 223 | Nick_CalcVisibleClocks(ENTERPRISE_SCREEN_WIDTH); |
| 116 | 224 | |
| 117 | 225 | // Nick.BORDER = 0; |
| 118 | 226 | // Nick.FIXBIAS = 0; |
| r4173 | r4174 | |
| 913 | 1021 | /* next line */ |
| 914 | 1022 | line++; |
| 915 | 1023 | } |
| 916 | | while (((Nick.LPT.MB & 0x080)==0) && (line<(35*8))); |
| 1024 | while (((Nick.LPT.MB & 0x080)==0) && (line<ENTERPRISE_SCREEN_HEIGHT)); |
| 917 | 1025 | |
| 918 | 1026 | } |
| 919 | 1027 | |
| 920 | 1028 | |
| 1029 | VIDEO_START( nick ) |
| 1030 | { |
| 1031 | Nick_vh_start(); |
| 1032 | VIDEO_START_CALL(generic_bitmapped); |
| 1033 | } |
| 921 | 1034 | |
| 922 | 1035 | |
| 923 | | |
| 924 | | |
| 925 | | |
| 926 | | |
| 927 | | |
| 928 | | |
| 929 | | |
| 930 | | |
| 931 | | |
| 932 | | |
| 933 | | |
| 934 | | |
| 935 | | |
| 936 | | |
| 937 | | |
| 938 | | |
| 939 | | |
| 940 | | |
| 1036 | VIDEO_UPDATE( nick ) |
| 1037 | { |
| 1038 | Nick_DoScreen(tmpbitmap); |
| 1039 | return VIDEO_UPDATE_CALL(generic_bitmapped); |
| 1040 | } |
src/mess/video/epnick.h
| r4173 | r4174 | |
| 1 | 1 | /***************************************************************************** |
| 2 | 2 | * |
| 3 | 3 | * video/epnick.h |
| 4 | | * |
| 4 | * |
| 5 | 5 | * Nick Graphics Chip - found in Enterprise |
| 6 | 6 | * |
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| 9 | | #ifndef EPNICK_H_ |
| 10 | | #define EPNICK_H_ |
| 9 | #ifndef __EPNICK_H__ |
| 10 | #define __EPNICK_H__ |
| 11 | 11 | |
| 12 | 12 | |
| 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) |
| 15 | 16 | |
| 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) |
| 23 | 20 | |
| 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) |
| 31 | 21 | |
| 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 |
| 38 | 23 | |
| 39 | 24 | |
| 40 | | /* Nick executes a Display list, in the form of a list of Line Parameter |
| 41 | | Tables, this is the form of the data */ |
| 42 | | typedef 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 | | |
| 55 | | typedef 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 | | |
| 124 | 25 | /*----------- defined in video/epnick.c -----------*/ |
| 125 | 26 | |
| 126 | | /* initialise palette function */ |
| 127 | | extern PALETTE_INIT( nick ); |
| 27 | PALETTE_INIT( nick ); |
| 28 | VIDEO_START( nick ); |
| 29 | VIDEO_UPDATE( nick ); |
| 128 | 30 | |
| 129 | | int Nick_vh_start(void); |
| 130 | | void Nick_DoScreen(bitmap_t *bm); |
| 31 | WRITE8_HANDLER( Nick_reg_w ); |
| 131 | 32 | |
| 132 | | #if 0 |
| 133 | | int Nick_reg_r(int); |
| 134 | | #endif |
| 135 | | WRITE8_HANDLER ( Nick_reg_w ); |
| 136 | 33 | |
| 137 | | |
| 138 | | #endif /* EPNICK_H_ */ |
| 34 | #endif /* __EPNICK_H__ */ |
src/mess/drivers/enterp.c
| r4173 | r4174 | |
| 25 | 25 | |
| 26 | 26 | #define ENTERPRISE_XTAL_X1 XTAL_8MHz |
| 27 | 27 | |
| 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) |
| 34 | 28 | |
| 35 | | |
| 36 | 29 | /* state of the wd1770 irq/drq lines */ |
| 37 | 30 | static UINT8 exdos_card_value = 0; |
| 38 | 31 | |
| r4173 | r4174 | |
| 199 | 192 | |
| 200 | 193 | |
| 201 | 194 | /*************************************************************************** |
| 202 | | VIDEO |
| 203 | | ***************************************************************************/ |
| 204 | | |
| 205 | | static VIDEO_START( enterprise ) |
| 206 | | { |
| 207 | | Nick_vh_start(); |
| 208 | | VIDEO_START_CALL(generic_bitmapped); |
| 209 | | } |
| 210 | | |
| 211 | | |
| 212 | | static VIDEO_UPDATE( enterprise ) |
| 213 | | { |
| 214 | | Nick_DoScreen(tmpbitmap); |
| 215 | | return VIDEO_UPDATE_CALL(generic_bitmapped); |
| 216 | | } |
| 217 | | |
| 218 | | |
| 219 | | /*************************************************************************** |
| 220 | 195 | FLOPPY/EXDOS |
| 221 | 196 | ***************************************************************************/ |
| 222 | 197 | |
| r4173 | r4174 | |
| 482 | 457 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 483 | 458 | MDRV_SCREEN_SIZE(ENTERPRISE_SCREEN_WIDTH, ENTERPRISE_SCREEN_HEIGHT) |
| 484 | 459 | MDRV_SCREEN_VISIBLE_AREA(0, ENTERPRISE_SCREEN_WIDTH-1, 0, ENTERPRISE_SCREEN_HEIGHT-1) |
| 485 | | /* MDRV_GFXDECODE( enterprise ) */ |
| 460 | |
| 486 | 461 | MDRV_PALETTE_LENGTH(NICK_PALETTE_SIZE) |
| 487 | | MDRV_PALETTE_INIT( nick ) |
| 462 | MDRV_PALETTE_INIT(nick) |
| 488 | 463 | |
| 489 | | MDRV_VIDEO_START( enterprise ) |
| 490 | | MDRV_VIDEO_UPDATE( enterprise ) |
| 464 | MDRV_VIDEO_START(nick) |
| 465 | MDRV_VIDEO_UPDATE(nick) |
| 491 | 466 | |
| 492 | 467 | /* sound hardware */ |
| 493 | 468 | MDRV_SPEAKER_STANDARD_MONO("mono") |