Previous 15994 Revisions Next

r4141 Friday 16th January, 2009 at 08:50:21 UTC by Miodrag Milanović
[SPECTRUM] Fixed Spectrum video, joined video implementations
[src/mess]mess.mak
[src/mess/drivers]pentagon.c scorpion.c spec128.c specpls3.c spectrum.c
[src/mess/includes]spectrum.h
[src/mess/video]spec128.c spectrum.c

src/mess/video/spec128.c
r4140r4141
1/***************************************************************************
2
3  spectrum.c
4
5  Functions to emulate the video hardware of the ZX Spectrum.
6
7  Changes:
8
9  DJR 08/02/00 - Added support for FLASH 1.
10  DJR 16/05/00 - Support for TS2068/TC2048 hires and 64 column modes.
11  DJR 19/05/00 - Speeded up Spectrum 128 screen refresh.
12  DJR 23/05/00 - Preliminary support for border colour emulation.
13
14***************************************************************************/
15
16#include "driver.h"
17#include "includes/spectrum.h"
18#include "eventlst.h"
19#include "video/border.h"
20
21INLINE void spectrum_plot_pixel(bitmap_t *bitmap, int x, int y, UINT32 color)
22{
23   *BITMAP_ADDR16(bitmap, y, x) = (UINT16)color;
24}
25
26
27VIDEO_START( spectrum_128 )
28{
29   frame_number = 0;
30   flash_invert = 0;
31
32   EventList_Initialise(30000);
33}
34
35/* Refresh the spectrum 128 screen (code modified from COUPE.C) */
36VIDEO_UPDATE( spectrum_128 )
37{
38        /* for now do a full-refresh */
39        int x, y, b, scrx, scry;
40        unsigned short ink, pap;
41        unsigned char *attr, *scr;
42      int full_refresh = 1;
43
44        scr=spectrum_128_screen_location;
45
46        for (y=0; y<192; y++)
47        {
48                scrx=SPEC_LEFT_BORDER;
49                scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0);
50                attr=spectrum_128_screen_location + ((scry>>3)*32) + 0x1800;
51
52                for (x=0;x<32;x++)
53                {
54                        /* Get ink and paper colour with bright */
55                        if (flash_invert && (*attr & 0x80))
56                        {
57                                ink=((*attr)>>3) & 0x0f;
58                                pap=((*attr) & 0x07) + (((*attr)>>3) & 0x08);
59                        }
60                        else
61                        {
62                                ink=((*attr) & 0x07) + (((*attr)>>3) & 0x08);
63                                pap=((*attr)>>3) & 0x0f;
64                        }
65
66                        for (b=0x80;b!=0;b>>=1)
67                        {
68                                if (*scr&b)
69                                        spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,ink);
70                                else
71                                        spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,pap);
72         }
73                scr++;
74                attr++;
75                }
76   }
77
78   draw_border(screen->machine, bitmap, full_refresh,
79      SPEC_TOP_BORDER, SPEC_DISPLAY_YSIZE, SPEC_BOTTOM_BORDER,
80      SPEC_LEFT_BORDER, SPEC_DISPLAY_XSIZE, SPEC_RIGHT_BORDER,
81      SPEC_LEFT_BORDER_CYCLES, SPEC_DISPLAY_XSIZE_CYCLES,
82      SPEC_RIGHT_BORDER_CYCLES, SPEC128_RETRACE_CYCLES, 200, 0xfe);
83   return 0;
84}
85
86
87
88static const rgb_t spectrum_128_palette[16] = {
89   MAKE_RGB(0x00, 0x00, 0x00),
90   MAKE_RGB(0x00, 0x00, 0xbf),
91   MAKE_RGB(0xbf, 0x00, 0x00),
92   MAKE_RGB(0xbf, 0x00, 0xbf),
93   MAKE_RGB(0x00, 0xbf, 0x00),
94   MAKE_RGB(0x00, 0xbf, 0xbf),
95   MAKE_RGB(0xbf, 0xbf, 0x00),
96   MAKE_RGB(0xbf, 0xbf, 0xbf),
97   MAKE_RGB(0x00, 0x00, 0x00),
98   MAKE_RGB(0x00, 0x00, 0xff),
99   MAKE_RGB(0xff, 0x00, 0x00),
100   MAKE_RGB(0xff, 0x00, 0xff),
101   MAKE_RGB(0x00, 0xff, 0x00),
102   MAKE_RGB(0x00, 0xff, 0xff),
103   MAKE_RGB(0xff, 0xff, 0x00),
104   MAKE_RGB(0xff, 0xff, 0xff)
105};
106
107PALETTE_INIT( spectrum_128 )
108{   
109   palette_set_colors(machine, 0, spectrum_128_palette, ARRAY_LENGTH(spectrum_128_palette));
110}
111
src/mess/video/spectrum.c
r4140r4141
1919#include "video/border.h"
2020
2121
22UINT8 *spectrum_characterram;
23UINT8 *spectrum_colorram;
24
22unsigned char *spectrum_video_ram;
23UINT8 retrace_cycles;
2524int frame_number;    /* Used for handling FLASH 1 */
2625int flash_invert;
2726
r4140r4141
3231{
3332   frame_number = 0;
3433   flash_invert = 0;
34   
3535   EventList_Initialise(30000);
36
37   retrace_cycles = SPEC_RETRACE_CYCLES;
38   
39   spectrum_screen_location = spectrum_video_ram;
3640}
3741
42VIDEO_START( spectrum_128 )
43{
44   frame_number = 0;
45   flash_invert = 0;
3846
47   EventList_Initialise(30000);
48   
49   retrace_cycles = SPEC128_RETRACE_CYCLES;
50}
51
52
3953/* return the color to be used inverting FLASHing colors if necessary */
4054INLINE unsigned char get_display_color (unsigned char color, int invert)
4155{
r4140r4141
97111
98112***************************************************************************/
99113
114INLINE void spectrum_plot_pixel(bitmap_t *bitmap, int x, int y, UINT32 color)
115{
116   *BITMAP_ADDR16(bitmap, y, x) = (UINT16)color;
117}
118
100119VIDEO_UPDATE( spectrum )
101120{
102   int count;
103   int full_refresh = 1;
104    static int last_invert = 0;
121        /* for now do a full-refresh */
122        int x, y, b, scrx, scry;
123        unsigned short ink, pap;
124        unsigned char *attr, *scr;
125      int full_refresh = 1;
105126
106   if (full_refresh)
107   {
108      last_invert = flash_invert;
109   }
110   else
111   {
112      /* Update all flashing characters when necessary */
113      if (last_invert != flash_invert)
114      {
115         last_invert = flash_invert;
116      }
117   }
127        scr=spectrum_screen_location;
118128
119    for (count=0;count<32*8;count++)
120    {
121      gfx_element_mark_dirty( screen->machine->gfx[0],count);
122      gfx_element_mark_dirty( screen->machine->gfx[1],count);
123      gfx_element_mark_dirty( screen->machine->gfx[2],count);
124   }
129        for (y=0; y<192; y++)
130        {
131                scrx=SPEC_LEFT_BORDER;
132                scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0);
133                attr=spectrum_screen_location + ((scry>>3)*32) + 0x1800;
125134
126    for (count=0;count<32*8;count++)
127    {
128      int sx=count%32;
129      int sy=count/32;
130      unsigned char color;
135                for (x=0;x<32;x++)
136                {
137                        /* Get ink and paper colour with bright */
138                        if (flash_invert && (*attr & 0x80))
139                        {
140                                ink=((*attr)>>3) & 0x0f;
141                                pap=((*attr) & 0x07) + (((*attr)>>3) & 0x08);
142                        }
143                        else
144                        {
145                                ink=((*attr) & 0x07) + (((*attr)>>3) & 0x08);
146                                pap=((*attr)>>3) & 0x0f;
147                        }
131148
132        color=get_display_color(spectrum_colorram[count],flash_invert);
133      drawgfx(bitmap,screen->machine->gfx[0],
134         count,
135         color+8, // use 2nd part of palette
136         0,0,
137           (sx*8)+SPEC_LEFT_BORDER,(sy*8)+SPEC_TOP_BORDER,
138         0,TRANSPARENCY_NONE,0);
139
140        color=get_display_color(spectrum_colorram[count+0x100],flash_invert);
141      drawgfx(bitmap,screen->machine->gfx[1],
142         count,
143         color+8, // use 2nd part of palette
144         0,0,
145         (sx*8)+SPEC_LEFT_BORDER,((sy+8)*8)+SPEC_TOP_BORDER,
146         0,TRANSPARENCY_NONE,0);
147           
148        color=get_display_color(spectrum_colorram[count+0x200],flash_invert);
149      drawgfx(bitmap,screen->machine->gfx[2],
150         count,
151         color+8, // use 2nd part of palette
152         0,0,
153         (sx*8)+SPEC_LEFT_BORDER,((sy+16)*8)+SPEC_TOP_BORDER,
154         0,TRANSPARENCY_NONE,0);
149                        for (b=0x80;b!=0;b>>=1)
150                        {
151                                if (*scr&b)
152                                        spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,ink);
153                                else
154                                        spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,pap);
155         }
156                scr++;
157                attr++;
158                }
155159   }
156160
157    /* When screen refresh is called there is only one blank line
158        (synchronised with start of screen data) before the border lines.
159        There should be 16 blank lines after an interrupt is called.
160    */
161    draw_border(screen->machine, bitmap, full_refresh,
162            SPEC_TOP_BORDER, SPEC_DISPLAY_YSIZE, SPEC_BOTTOM_BORDER,
163            SPEC_LEFT_BORDER, SPEC_DISPLAY_XSIZE, SPEC_RIGHT_BORDER,
164            SPEC_LEFT_BORDER_CYCLES, SPEC_DISPLAY_XSIZE_CYCLES,
165            SPEC_RIGHT_BORDER_CYCLES, SPEC_RETRACE_CYCLES, 200, 0xfe);
161   draw_border(screen->machine, bitmap, full_refresh,
162      SPEC_TOP_BORDER, SPEC_DISPLAY_YSIZE, SPEC_BOTTOM_BORDER,
163      SPEC_LEFT_BORDER, SPEC_DISPLAY_XSIZE, SPEC_RIGHT_BORDER,
164      SPEC_LEFT_BORDER_CYCLES, SPEC_DISPLAY_XSIZE_CYCLES,
165      SPEC_RIGHT_BORDER_CYCLES, retrace_cycles, 200, 0xfe);
166166   return 0;
167167}
168168
169const gfx_layout spectrum_charlayout =
170{
171   8,8,
172   256,
173   1,                  /* 1 bits per pixel */
174169
175   { 0 },               /* no bitplanes; 1 bit per pixel */
176
177   { 0, 1, 2, 3, 4, 5, 6, 7 },
178   { 0, 8*256, 16*256, 24*256, 32*256, 40*256, 48*256, 56*256 },
179
180   8            /* every char takes 1 consecutive byte */
170static const rgb_t spectrum_palette[16] = {
171   MAKE_RGB(0x00, 0x00, 0x00),
172   MAKE_RGB(0x00, 0x00, 0xbf),
173   MAKE_RGB(0xbf, 0x00, 0x00),
174   MAKE_RGB(0xbf, 0x00, 0xbf),
175   MAKE_RGB(0x00, 0xbf, 0x00),
176   MAKE_RGB(0x00, 0xbf, 0xbf),
177   MAKE_RGB(0xbf, 0xbf, 0x00),
178   MAKE_RGB(0xbf, 0xbf, 0xbf),
179   MAKE_RGB(0x00, 0x00, 0x00),
180   MAKE_RGB(0x00, 0x00, 0xff),
181   MAKE_RGB(0xff, 0x00, 0x00),
182   MAKE_RGB(0xff, 0x00, 0xff),
183   MAKE_RGB(0x00, 0xff, 0x00),
184   MAKE_RGB(0x00, 0xff, 0xff),
185   MAKE_RGB(0xff, 0xff, 0x00),
186   MAKE_RGB(0xff, 0xff, 0xff)
181187};
182
183#define ZX_COL_0   MAKE_RGB(0x00, 0x00, 0x00)
184#define ZX_COL_1   MAKE_RGB(0x00, 0x00, 0xbf)
185#define ZX_COL_2   MAKE_RGB(0xbf, 0x00, 0x00)
186#define ZX_COL_3   MAKE_RGB(0xbf, 0x00, 0xbf)
187#define ZX_COL_4   MAKE_RGB(0x00, 0xbf, 0x00)
188#define ZX_COL_5   MAKE_RGB(0x00, 0xbf, 0xbf)
189#define ZX_COL_6   MAKE_RGB(0xbf, 0xbf, 0x00)
190#define ZX_COL_7   MAKE_RGB(0xbf, 0xbf, 0xbf)
191#define ZX_COL_8   MAKE_RGB(0x00, 0x00, 0x00)
192#define ZX_COL_9   MAKE_RGB(0x00, 0x00, 0xff)
193#define ZX_COL_A   MAKE_RGB(0xff, 0x00, 0x00)
194#define ZX_COL_B   MAKE_RGB(0xff, 0x00, 0xff)
195#define ZX_COL_C   MAKE_RGB(0x00, 0xff, 0x00)
196#define ZX_COL_D   MAKE_RGB(0x00, 0xff, 0xff)
197#define ZX_COL_E   MAKE_RGB(0xff, 0xff, 0x00)
198#define ZX_COL_F   MAKE_RGB(0xff, 0xff, 0xff)
199
200static const rgb_t spectrum_palette[256 + 16] = {
201   ZX_COL_0,ZX_COL_1,ZX_COL_2,ZX_COL_3,ZX_COL_4,ZX_COL_5,ZX_COL_6,ZX_COL_7,ZX_COL_8,ZX_COL_9,ZX_COL_A,ZX_COL_B,ZX_COL_C,ZX_COL_D,ZX_COL_E,ZX_COL_F,
202   
203   ZX_COL_0,ZX_COL_0,ZX_COL_0,ZX_COL_1,ZX_COL_0,ZX_COL_2,ZX_COL_0,ZX_COL_3,ZX_COL_0,ZX_COL_4,ZX_COL_0,ZX_COL_5,ZX_COL_0,ZX_COL_6,ZX_COL_0,ZX_COL_7,
204   ZX_COL_1,ZX_COL_0,ZX_COL_1,ZX_COL_1,ZX_COL_1,ZX_COL_2,ZX_COL_1,ZX_COL_3,ZX_COL_1,ZX_COL_4,ZX_COL_1,ZX_COL_5,ZX_COL_1,ZX_COL_6,ZX_COL_1,ZX_CO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_E,ZX_COL_F,ZX_COL_F
219   };
220
221
222188/* Initialise the palette */
223189PALETTE_INIT( spectrum )
224190{
src/mess/includes/spectrum.h
r4140r4141
5555} TIMEX_CART_TYPE;
5656
5757/*----------- defined in machine/spectrum.c -----------*/
58
5958extern TIMEX_CART_TYPE timex_cart_type;
6059extern UINT8 timex_cart_chunks;
6160extern UINT8 * timex_cart_data;
r4140r4141
7069
7170
7271/*----------- defined in drivers/spectrum.c -----------*/
72extern unsigned char *spectrum_screen_location;
73
7374INPUT_PORTS_EXTERN( spectrum );
7475MACHINE_DRIVER_EXTERN( spectrum );
7576SYSTEM_CONFIG_EXTERN(spectrum)
r4140r4141
8485/*----------- defined in drivers/spec128.c -----------*/
8586MACHINE_DRIVER_EXTERN( spectrum_128 );
8687
87extern unsigned char *spectrum_128_screen_location;
8888extern void spectrum_128_update_memory(running_machine *machine);
8989extern int spectrum_128_port_7ffd_data;
9090
r4140r4141
104104extern PALETTE_INIT( spectrum );
105105
106106extern VIDEO_START( spectrum );
107extern VIDEO_START( spectrum_128 );
108
107109extern VIDEO_UPDATE( spectrum );
108110extern VIDEO_EOF( spectrum );
109111
110extern unsigned char *spectrum_characterram;
111extern unsigned char *spectrum_colorram;
112extern unsigned char *spectrum_video_ram;
113extern UINT8 retrace_cycles;
112114
113115extern const gfx_layout spectrum_charlayout;
114116
115/*----------- defined in video/spec128.c -----------*/
116extern PALETTE_INIT( spectrum_128 );
117
118extern VIDEO_START( spectrum_128 );
119extern VIDEO_UPDATE( spectrum_128 );
120
121
122117/*----------- defined in video/timex.c -----------*/
123118extern VIDEO_EOF( ts2068 );
124119extern VIDEO_UPDATE( ts2068 );
src/mess/mess.mak
r4140r4141
739739$(MESSOBJ)/sinclair.a: \
740740   $(MESS_VIDEO)/border.o      \
741741   $(MESS_VIDEO)/spectrum.o      \
742   $(MESS_VIDEO)/spec128.o      \
743742   $(MESS_VIDEO)/timex.o      \
744743   $(MESS_VIDEO)/zx.o      \
745744   $(MESS_DRIVERS)/zx.o      \
src/mess/drivers/pentagon.c
r4140r4141
4141
4242static void pentagon_update_memory(running_machine *machine)
4343{   
44   spectrum_128_screen_location = mess_ram + ((spectrum_128_port_7ffd_data & 8) ? (7<<14) : (5<<14));
44   spectrum_screen_location = mess_ram + ((spectrum_128_port_7ffd_data & 8) ? (7<<14) : (5<<14));
4545
4646   memory_set_bankptr(machine, 4, mess_ram + ((spectrum_128_port_7ffd_data & 0x07) * 0x4000));
4747
src/mess/drivers/scorpion.c
r4140r4141
194194static void scorpion_update_memory(running_machine *machine)
195195{
196196   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
197   spectrum_128_screen_location = mess_ram + ((spectrum_128_port_7ffd_data & 8) ? (7<<14) : (5<<14));
197   spectrum_screen_location = mess_ram + ((spectrum_128_port_7ffd_data & 8) ? (7<<14) : (5<<14));
198198
199199   memory_set_bankptr(machine, 4, mess_ram + (((spectrum_128_port_7ffd_data & 0x07) | ((scorpion_256_port_1ffd_data & 0x10)>>1)) * 0x4000));
200200
src/mess/drivers/specpls3.c
r4140r4141
215215   if (spectrum_128_port_7ffd_data & 8)
216216   {
217217         logerror("+3 SCREEN 1: BLOCK 7\n");
218         spectrum_128_screen_location = mess_ram + (7<<14);
218         spectrum_screen_location = mess_ram + (7<<14);
219219   }
220220   else
221221   {
222222         logerror("+3 SCREEN 0: BLOCK 5\n");
223         spectrum_128_screen_location = mess_ram + (5<<14);
223         spectrum_screen_location = mess_ram + (5<<14);
224224   }
225225
226226   if ((spectrum_plus3_port_1ffd_data & 0x01)==0)
src/mess/drivers/spectrum.c
r4140r4141
155155#include "devices/cassette.h"
156156#include "formats/tzx_cas.h"
157157
158unsigned char *spectrum_screen_location = NULL;
158159
159
160160/****************************************************************************************************/
161161/* Spectrum 48k functions */
162162
r4140r4141
199199
200200static ADDRESS_MAP_START (spectrum_mem, ADDRESS_SPACE_PROGRAM, 8)
201201   AM_RANGE(0x0000, 0x3fff) AM_ROM
202   AM_RANGE(0x4000, 0x57ff) AM_RAM AM_BASE(&spectrum_characterram )
203   AM_RANGE(0x5800, 0x5aff) AM_RAM AM_BASE(&spectrum_colorram )
202   AM_RANGE(0x4000, 0x5aff) AM_RAM AM_BASE(&spectrum_video_ram )
204203   AM_RANGE(0x5b00, 0xffff) AM_RAM
205204ADDRESS_MAP_END
206205
r4140r4141
294293
295294static  READ8_HANDLER ( spectrum_port_ula_r )
296295{
297   return video_screen_get_vpos(space->machine->primary_screen)<193 ? spectrum_colorram[(video_screen_get_vpos(space->machine->primary_screen)&0xf8)<<2]:0xff;
296   return video_screen_get_vpos(space->machine->primary_screen)<193 ? spectrum_video_ram[(video_screen_get_vpos(space->machine->primary_screen)&0xf8)<<2]:0xff;
298297}
299298
300299/* ports are not decoded full.
r4140r4141
308307ADDRESS_MAP_END
309308
310309/****************************************************************************************************/
311static GFXDECODE_START( spectrum )
312   GFXDECODE_ENTRY( 0, 0x0, spectrum_charlayout, 0, 0x80 )
313   GFXDECODE_ENTRY( 0, 0x0, spectrum_charlayout, 0, 0x80 )
314   GFXDECODE_ENTRY( 0, 0x0, spectrum_charlayout, 0, 0x80 )
315GFXDECODE_END
316
317310INPUT_PORTS_START( spectrum )
318311   PORT_START("LINE0") /* [0] 0xFEFE */
319312   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CAPS SHIFT") PORT_CODE(KEYCODE_LSHIFT)
r4140r4141
472465   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
473466   MDRV_SCREEN_SIZE(SPEC_SCREEN_WIDTH, SPEC_SCREEN_HEIGHT)
474467   MDRV_SCREEN_VISIBLE_AREA(0, SPEC_SCREEN_WIDTH-1, 0, SPEC_SCREEN_HEIGHT-1)
475   MDRV_GFXDECODE( spectrum )
476   MDRV_PALETTE_LENGTH(256 + 16)
468   MDRV_PALETTE_LENGTH(16)
477469   MDRV_PALETTE_INIT( spectrum )
478470
479471   MDRV_VIDEO_START( spectrum )
src/mess/drivers/spec128.c
r4140r4141
166166/* Spectrum 128 specific functions */
167167
168168int spectrum_128_port_7ffd_data = -1;
169unsigned char *spectrum_128_screen_location = NULL;
170169
171170static WRITE8_HANDLER(spectrum_128_port_7ffd_w)
172171{
r4140r4141
194193   if (spectrum_128_port_7ffd_data & 8)
195194   {
196195         logerror("SCREEN 1: BLOCK 7\n");
197         spectrum_128_screen_location = mess_ram + (7<<14);
196         spectrum_screen_location = mess_ram + (7<<14);
198197   }
199198   else
200199   {
201200         logerror("SCREEN 0: BLOCK 5\n");
202         spectrum_128_screen_location = mess_ram + (5<<14);
201         spectrum_screen_location = mess_ram + (5<<14);
203202   }
204203
205204   /* select ram at 0x0c000-0x0ffff */
r4140r4141
229228
230229static  READ8_HANDLER ( spectrum_128_ula_r )
231230{
232   return video_screen_get_vpos(space->machine->primary_screen)<193 ? spectrum_128_screen_location[0x1800|(video_screen_get_vpos(space->machine->primary_screen)&0xf8)<<2]:0xff;
231   return video_screen_get_vpos(space->machine->primary_screen)<193 ? spectrum_screen_location[0x1800|(video_screen_get_vpos(space->machine->primary_screen)&0xf8)<<2]:0xff;
233232}
234233
235234static ADDRESS_MAP_START (spectrum_128_io, ADDRESS_SPACE_IO, 8)
r4140r4141
280279    /* video hardware */
281280   MDRV_SCREEN_MODIFY("main")
282281   MDRV_PALETTE_LENGTH(16)
283   MDRV_PALETTE_INIT( spectrum_128 )
282   MDRV_PALETTE_INIT( spectrum )
284283   MDRV_SCREEN_REFRESH_RATE(50.021)
285284   MDRV_VIDEO_START( spectrum_128 )
286   MDRV_VIDEO_UPDATE( spectrum_128 )
287285
288286   /* sound hardware */
289287   MDRV_SOUND_ADD("ay8912", AY8912, 1773400)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team