Previous 15994 Revisions Next

r8394 Monday 5th July, 2010 at 21:45:19 UTC by Miodrag Milanović
Moved border implementation to video/spectrum.c, this needs rewrite in future.
[src/mess]mess.mak
[src/mess/formats]spec_snqk.c timex_dck.c
[src/mess/includes]spectrum.h
[src/mess/video]border.c border.h rmnimbus.c spectrum.c timex.c

src/mess/includes/spectrum.h
r8393r8394
120120extern VIDEO_UPDATE( spectrum );
121121extern VIDEO_EOF( spectrum );
122122
123extern void border_force_redraw (void);
124extern void border_set_last_color (int NewColor);
125extern void border_draw(running_machine *machine, bitmap_t *bitmap, int full_refresh,
126                int TopBorderLines, int ScreenLines, int BottomBorderLines,
127                int LeftBorderPixels, int ScreenPixels, int RightBorderPixels,
128                int LeftBorderCycles, int ScreenCycles, int RightBorderCycles,
129                int HorizontalRetraceCycles, int VRetraceTime, int EventID);
130           
123131/*----------- defined in video/timex.c -----------*/
124132extern VIDEO_EOF( ts2068 );
125133extern VIDEO_UPDATE( ts2068 );
src/mess/video/border.c
r8393r8394
1/***************************************************************************
2        Border engine:
3
4        Functions for drawing multi-coloured screen borders using the
5        Event List processing.
6
7Changes:
8
928/05/2000 DJR - Initial implementation.
1008/06/2000 DJR - Now only uses events with the correct ID value.
1128/06/2000 DJR - draw_border now uses full_refresh flag.
12
13***************************************************************************/
14
15#include "emu.h"
16#include "border.h"
17#include "eventlst.h"
18
19/* Last border colour output in the previous frame */
20static int CurrBorderColor = 0;
21
22static int LastDisplayedBorderColor = -1; /* Negative value indicates redraw */
23
24/* Force the border to be redrawn on the next frame */
25void border_force_redraw (void)
26{
27        LastDisplayedBorderColor = -1;
28}
29
30/* Set the last border colour to have been displayed. Used when loading snap
31   shots and to record the last colour change in a frame that was skipped. */
32void border_set_last_color (int NewColor)
33{
34        CurrBorderColor = NewColor;
35}
36
37void border_draw(running_machine *machine, bitmap_t *bitmap,
38   int full_refresh,               /* Full refresh flag */
39   int TopBorderLines,             /* Border lines before actual screen */
40   int ScreenLines,                /* Screen height in pixels */
41   int BottomBorderLines,          /* Border lines below screen */
42   int LeftBorderPixels,           /* Border pixels to the left of each screen line */
43   int ScreenPixels,               /* Width of actual screen in pixels */
44   int RightBorderPixels,          /* Border pixels to the right of each screen line */
45   int LeftBorderCycles,           /* Cycles taken to draw left border of each scan line */
46   int ScreenCycles,               /* Cycles taken to draw screen data part of each scan line */
47   int RightBorderCycles,          /* Cycles taken to draw right border of each scan line */
48   int HorizontalRetraceCycles,    /* Cycles taken to return to LHS of CRT after each scan line */
49   int VRetraceTime,               /* Cycles taken before start of first border line */
50   int EventID)                    /* Event ID of border messages */
51{
52   EVENT_LIST_ITEM *pItem;
53   int TotalScreenHeight = TopBorderLines+ScreenLines+BottomBorderLines;
54   int TotalScreenWidth = LeftBorderPixels+ScreenPixels+RightBorderPixels;
55   int DisplayCyclesPerLine = LeftBorderCycles+ScreenCycles+RightBorderCycles;
56   int CyclesPerLine = DisplayCyclesPerLine+HorizontalRetraceCycles;
57   int CyclesSoFar = 0;
58   int NumItems, CurrItem = 0, NextItem;
59   int Count, ScrX, NextScrX, ScrY;
60   rectangle r;
61
62   pItem = EventList_GetFirstItem();
63   NumItems = EventList_NumEvents();
64
65   for (Count = 0; Count < NumItems; Count++)
66   {
67//      logerror ("Event no %05d, ID = %04x, data = %04x, time = %ld\n", Count, pItem[Count].Event_ID, pItem[Count].Event_Data, (long) pItem[Count].Event_Time);
68   }
69
70   /* Find the first and second events with the correct ID */
71   while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID))
72         CurrItem++;
73   NextItem = CurrItem + 1;
74   while ((NextItem < NumItems) && (pItem[NextItem].Event_ID != EventID))
75         NextItem++;
76
77   /* Single border colour */
78   if ((CurrItem < NumItems) && (NextItem >= NumItems))
79         CurrBorderColor = pItem[CurrItem].Event_Data;
80
81   if ((NextItem >= NumItems) && (CurrBorderColor==LastDisplayedBorderColor) && !full_refresh)
82   {
83         /* Do nothing if border colour has not changed */
84   }
85   else if (NextItem >= NumItems)
86   {
87         /* Single border colour - this is not strictly correct as the
88                colour change may have occurred midway through the frame
89                or after the last visible border line however the whole
90                border would be redrawn in the correct colour during the
91                next frame anyway! */
92         r.min_x = 0;
93         r.max_x = TotalScreenWidth-1;
94         r.min_y = 0;
95         r.max_y = TopBorderLines-1;
96         bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
97
98         r.min_x = 0;
99         r.max_x = LeftBorderPixels-1;
100         r.min_y = TopBorderLines;
101         r.max_y = TopBorderLines+ScreenLines-1;
102         bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
103
104         r.min_x = LeftBorderPixels+ScreenPixels;
105         r.max_x = TotalScreenWidth-1;
106         bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
107
108         r.min_x = 0;
109         r.max_x = TotalScreenWidth-1;
110         r.min_y = TopBorderLines+ScreenLines;
111         r.max_y = TotalScreenHeight-1;
112         bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
113
114//          logerror ("Setting border colour to %d (Last = %d, Full Refresh = %d)\n", CurrBorderColor, LastDisplayedBorderColor, full_refresh);
115         LastDisplayedBorderColor = CurrBorderColor;
116   }
117   else
118   {
119         /* Multiple border colours */
120
121         /* Process entries before first displayed line */
122         while ((CurrItem < NumItems) && (pItem[CurrItem].Event_Time <= VRetraceTime))
123         {
124               CurrBorderColor = pItem[CurrItem].Event_Data;
125               do {
126                     CurrItem++;
127               } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
128         }
129
130         /* Draw top border */
131         CyclesSoFar = VRetraceTime;
132         for (ScrY = 0; ScrY < TopBorderLines; ScrY++)
133         {
134               r.min_x = 0;
135               r.min_y = r.max_y = ScrY;
136               if ((CurrItem >= NumItems) || (pItem[CurrItem].Event_Time >= (CyclesSoFar+DisplayCyclesPerLine)))
137               {
138                     /* Single colour on line */
139                     r.max_x = TotalScreenWidth-1;
140                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
141               }
142               else
143               {
144                     /* Multiple colours on a line */
145                     ScrX = (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)TotalScreenWidth / (float)DisplayCyclesPerLine;
146                     r.max_x = ScrX-1;
147                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
148                     CurrBorderColor = pItem[CurrItem].Event_Data;
149                     do {
150                           CurrItem++;
151                     } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
152
153                     while ((CurrItem < NumItems) && (pItem[CurrItem].Event_Time < (CyclesSoFar+DisplayCyclesPerLine)))
154                     {
155                           NextScrX = (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)TotalScreenWidth / (float)DisplayCyclesPerLine;
156                           r.min_x = ScrX;
157                           r.max_x = NextScrX-1;
158                           bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
159                           ScrX = NextScrX;
160                           CurrBorderColor = pItem[CurrItem].Event_Data;
161                           do {
162                                 CurrItem++;
163                           } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
164                     }
165                     r.min_x = ScrX;
166                     r.max_x = TotalScreenWidth-1;
167                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
168               }
169
170               /* Process colour changes during horizontal retrace */
171               CyclesSoFar+= CyclesPerLine;
172               while ((CurrItem < NumItems) && (pItem[CurrItem].Event_Time <= CyclesSoFar))
173               {
174                     CurrBorderColor = pItem[CurrItem].Event_Data;
175                     do {
176                           CurrItem++;
177                     } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
178               }
179         }
180
181         /* Draw left and right borders next to screen lines */
182         for (ScrY = TopBorderLines; ScrY < (TopBorderLines+ScreenLines); ScrY++)
183         {
184               /* Draw left hand border */
185               r.min_x = 0;
186               r.min_y = r.max_y = ScrY;
187
188               if ((CurrItem >= NumItems) || (pItem[CurrItem].Event_Time >= (CyclesSoFar+LeftBorderCycles)))
189               {
190                     /* Single colour */
191                     r.max_x = LeftBorderPixels-1;
192                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
193               }
194               else
195               {
196                     /* Multiple colours */
197                     ScrX = (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)LeftBorderPixels / (float)LeftBorderCycles;
198                     r.max_x = ScrX-1;
199                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
200                     CurrBorderColor = pItem[CurrItem].Event_Data;
201                     do {
202                           CurrItem++;
203                     } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
204
205                     while ((CurrItem < NumItems) && (pItem[CurrItem].Event_Time < (CyclesSoFar+LeftBorderCycles)))
206                     {
207                           NextScrX = (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)LeftBorderPixels / (float)LeftBorderCycles;
208                           r.min_x = ScrX;
209                           r.max_x = NextScrX-1;
210                           bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
211                           ScrX = NextScrX;
212                           CurrBorderColor = pItem[CurrItem].Event_Data;
213                           do {
214                                 CurrItem++;
215                           } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
216                     }
217                     r.min_x = ScrX;
218                     r.max_x = LeftBorderPixels-1;
219                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
220               }
221
222               /* Process colour changes during screen draw */
223               while ((CurrItem < NumItems) && (pItem[CurrItem].Event_Time <= (CyclesSoFar+LeftBorderCycles+ScreenCycles)))
224               {
225                     CurrBorderColor = pItem[CurrItem].Event_Data;
226                     do {
227                           CurrItem++;
228                     } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
229               }
230
231               /* Draw right hand border */
232               r.min_x = LeftBorderPixels+ScreenPixels;
233               if ((CurrItem >= NumItems) || (pItem[CurrItem].Event_Time >= (CyclesSoFar+DisplayCyclesPerLine)))
234               {
235                     /* Single colour */
236                     r.max_x = TotalScreenWidth-1;
237                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
238               }
239               else
240               {
241                     /* Multiple colours */
242                     ScrX = LeftBorderPixels + ScreenPixels + (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)RightBorderPixels / (float)RightBorderCycles;
243                     r.max_x = ScrX-1;
244                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
245                     CurrBorderColor = pItem[CurrItem].Event_Data;
246                     do {
247                           CurrItem++;
248                     } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
249
250                     while ((CurrItem < NumItems) && (pItem[CurrItem].Event_Time < (CyclesSoFar+DisplayCyclesPerLine)))
251                     {
252                           NextScrX = LeftBorderPixels + ScreenPixels + (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)RightBorderPixels / (float)RightBorderCycles;
253                           r.min_x = ScrX;
254                           r.max_x = NextScrX-1;
255                           bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
256                           ScrX = NextScrX;
257                           CurrBorderColor = pItem[CurrItem].Event_Data;
258                           do {
259                                 CurrItem++;
260                           } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
261                     }
262                     r.min_x = ScrX;
263                     r.max_x = TotalScreenWidth-1;
264                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
265               }
266
267               /* Process colour changes during horizontal retrace */
268               CyclesSoFar+= CyclesPerLine;
269               while ((CurrItem < NumItems) && (pItem[CurrItem].Event_Time <= CyclesSoFar))
270               {
271                     CurrBorderColor = pItem[CurrItem].Event_Data;
272                     do {
273                           CurrItem++;
274                     } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
275               }
276         }
277
278         /* Draw bottom border */
279         for (ScrY = TopBorderLines+ScreenLines; ScrY < TotalScreenHeight; ScrY++)
280         {
281               r.min_x = 0;
282               r.min_y = r.max_y = ScrY;
283               if ((CurrItem >= NumItems) || (pItem[CurrItem].Event_Time >= (CyclesSoFar+DisplayCyclesPerLine)))
284               {
285                     /* Single colour on line */
286                     r.max_x = TotalScreenWidth-1;
287                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
288               }
289               else
290               {
291                     /* Multiple colours on a line */
292                     ScrX = (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)TotalScreenWidth / (float)DisplayCyclesPerLine;
293                     r.max_x = ScrX-1;
294                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
295                     CurrBorderColor = pItem[CurrItem].Event_Data;
296                     do {
297                           CurrItem++;
298                     } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
299
300                     while ((CurrItem < NumItems) && (pItem[CurrItem].Event_Time < (CyclesSoFar+DisplayCyclesPerLine)))
301                     {
302                           NextScrX = (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)TotalScreenWidth / (float)DisplayCyclesPerLine;
303                           r.min_x = ScrX;
304                           r.max_x = NextScrX-1;
305                           bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
306                           ScrX = NextScrX;
307                           CurrBorderColor = pItem[CurrItem].Event_Data;
308                           do {
309                                 CurrItem++;
310                           } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
311                     }
312                     r.min_x = ScrX;
313                     r.max_x = TotalScreenWidth-1;
314                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
315               }
316
317               /* Process colour changes during horizontal retrace */
318               CyclesSoFar+= CyclesPerLine;
319               while ((CurrItem < NumItems) && (pItem[CurrItem].Event_Time <= CyclesSoFar))
320               {
321                     CurrBorderColor = pItem[CurrItem].Event_Data;
322                     do {
323                           CurrItem++;
324                     } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
325               }
326         }
327
328         /* Process colour changes after last displayed line */
329         while (CurrItem < NumItems)
330         {
331               if (pItem[CurrItem].Event_ID == EventID)
332                     CurrBorderColor = pItem[CurrItem].Event_Data;
333               CurrItem++;
334         }
335
336         /* Set value to ensure redraw on next frame */
337         LastDisplayedBorderColor = -1;
338
339//          logerror ("Multi coloured border drawn (last colour = %d)\n", CurrBorderColor);
340   }
341
342   /* Assume all other routines have processed their data from the list */
343   EventList_Reset();
344   EventList_SetOffsetStartTime ( cpu_attotime_to_clocks(machine->firstcpu, attotime_mul(machine->primary_screen->scan_period(), machine->primary_screen->vpos())) );
345}
src/mess/video/border.h
r8393r8394
1extern void border_force_redraw (void);
2extern void border_set_last_color (int NewColor);
3extern void border_draw(running_machine *machine, bitmap_t *bitmap, int full_refresh,
4                int TopBorderLines, int ScreenLines, int BottomBorderLines,
5                int LeftBorderPixels, int ScreenPixels, int RightBorderPixels,
6                int LeftBorderCycles, int ScreenCycles, int RightBorderCycles,
7                int HorizontalRetraceCycles, int VRetraceTime, int EventID);
src/mess/video/spectrum.c
r8393r8394
1616#include "emu.h"
1717#include "includes/spectrum.h"
1818#include "eventlst.h"
19#include "video/border.h"
2019
2120
2221/***************************************************************************
r8393r8394
190189{
191190   palette_set_colors(machine, 0, spectrum_palette, ARRAY_LENGTH(spectrum_palette));
192191}
192
193/***************************************************************************
194        Border engine:
195
196        Functions for drawing multi-coloured screen borders using the
197        Event List processing.
198
199Changes:
200
20128/05/2000 DJR - Initial implementation.
20208/06/2000 DJR - Now only uses events with the correct ID value.
20328/06/2000 DJR - draw_border now uses full_refresh flag.
204
205***************************************************************************/
206
207/* Last border colour output in the previous frame */
208static int CurrBorderColor = 0;
209
210static int LastDisplayedBorderColor = -1; /* Negative value indicates redraw */
211
212/* Force the border to be redrawn on the next frame */
213void border_force_redraw (void)
214{
215        LastDisplayedBorderColor = -1;
216}
217
218/* Set the last border colour to have been displayed. Used when loading snap
219   shots and to record the last colour change in a frame that was skipped. */
220void border_set_last_color (int NewColor)
221{
222        CurrBorderColor = NewColor;
223}
224
225void border_draw(running_machine *machine, bitmap_t *bitmap,
226   int full_refresh,               /* Full refresh flag */
227   int TopBorderLines,             /* Border lines before actual screen */
228   int ScreenLines,                /* Screen height in pixels */
229   int BottomBorderLines,          /* Border lines below screen */
230   int LeftBorderPixels,           /* Border pixels to the left of each screen line */
231   int ScreenPixels,               /* Width of actual screen in pixels */
232   int RightBorderPixels,          /* Border pixels to the right of each screen line */
233   int LeftBorderCycles,           /* Cycles taken to draw left border of each scan line */
234   int ScreenCycles,               /* Cycles taken to draw screen data part of each scan line */
235   int RightBorderCycles,          /* Cycles taken to draw right border of each scan line */
236   int HorizontalRetraceCycles,    /* Cycles taken to return to LHS of CRT after each scan line */
237   int VRetraceTime,               /* Cycles taken before start of first border line */
238   int EventID)                    /* Event ID of border messages */
239{
240   EVENT_LIST_ITEM *pItem;
241   int TotalScreenHeight = TopBorderLines+ScreenLines+BottomBorderLines;
242   int TotalScreenWidth = LeftBorderPixels+ScreenPixels+RightBorderPixels;
243   int DisplayCyclesPerLine = LeftBorderCycles+ScreenCycles+RightBorderCycles;
244   int CyclesPerLine = DisplayCyclesPerLine+HorizontalRetraceCycles;
245   int CyclesSoFar = 0;
246   int NumItems, CurrItem = 0, NextItem;
247   int Count, ScrX, NextScrX, ScrY;
248   rectangle r;
249
250   pItem = EventList_GetFirstItem();
251   NumItems = EventList_NumEvents();
252
253   for (Count = 0; Count < NumItems; Count++)
254   {
255//      logerror ("Event no %05d, ID = %04x, data = %04x, time = %ld\n", Count, pItem[Count].Event_ID, pItem[Count].Event_Data, (long) pItem[Count].Event_Time);
256   }
257
258   /* Find the first and second events with the correct ID */
259   while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID))
260         CurrItem++;
261   NextItem = CurrItem + 1;
262   while ((NextItem < NumItems) && (pItem[NextItem].Event_ID != EventID))
263         NextItem++;
264
265   /* Single border colour */
266   if ((CurrItem < NumItems) && (NextItem >= NumItems))
267         CurrBorderColor = pItem[CurrItem].Event_Data;
268
269   if ((NextItem >= NumItems) && (CurrBorderColor==LastDisplayedBorderColor) && !full_refresh)
270   {
271         /* Do nothing if border colour has not changed */
272   }
273   else if (NextItem >= NumItems)
274   {
275         /* Single border colour - this is not strictly correct as the
276                colour change may have occurred midway through the frame
277                or after the last visible border line however the whole
278                border would be redrawn in the correct colour during the
279                next frame anyway! */
280         r.min_x = 0;
281         r.max_x = TotalScreenWidth-1;
282         r.min_y = 0;
283         r.max_y = TopBorderLines-1;
284         bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
285
286         r.min_x = 0;
287         r.max_x = LeftBorderPixels-1;
288         r.min_y = TopBorderLines;
289         r.max_y = TopBorderLines+ScreenLines-1;
290         bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
291
292         r.min_x = LeftBorderPixels+ScreenPixels;
293         r.max_x = TotalScreenWidth-1;
294         bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
295
296         r.min_x = 0;
297         r.max_x = TotalScreenWidth-1;
298         r.min_y = TopBorderLines+ScreenLines;
299         r.max_y = TotalScreenHeight-1;
300         bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
301
302//          logerror ("Setting border colour to %d (Last = %d, Full Refresh = %d)\n", CurrBorderColor, LastDisplayedBorderColor, full_refresh);
303         LastDisplayedBorderColor = CurrBorderColor;
304   }
305   else
306   {
307         /* Multiple border colours */
308
309         /* Process entries before first displayed line */
310         while ((CurrItem < NumItems) && (pItem[CurrItem].Event_Time <= VRetraceTime))
311         {
312               CurrBorderColor = pItem[CurrItem].Event_Data;
313               do {
314                     CurrItem++;
315               } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
316         }
317
318         /* Draw top border */
319         CyclesSoFar = VRetraceTime;
320         for (ScrY = 0; ScrY < TopBorderLines; ScrY++)
321         {
322               r.min_x = 0;
323               r.min_y = r.max_y = ScrY;
324               if ((CurrItem >= NumItems) || (pItem[CurrItem].Event_Time >= (CyclesSoFar+DisplayCyclesPerLine)))
325               {
326                     /* Single colour on line */
327                     r.max_x = TotalScreenWidth-1;
328                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
329               }
330               else
331               {
332                     /* Multiple colours on a line */
333                     ScrX = (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)TotalScreenWidth / (float)DisplayCyclesPerLine;
334                     r.max_x = ScrX-1;
335                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
336                     CurrBorderColor = pItem[CurrItem].Event_Data;
337                     do {
338                           CurrItem++;
339                     } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
340
341                     while ((CurrItem < NumItems) && (pItem[CurrItem].Event_Time < (CyclesSoFar+DisplayCyclesPerLine)))
342                     {
343                           NextScrX = (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)TotalScreenWidth / (float)DisplayCyclesPerLine;
344                           r.min_x = ScrX;
345                           r.max_x = NextScrX-1;
346                           bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
347                           ScrX = NextScrX;
348                           CurrBorderColor = pItem[CurrItem].Event_Data;
349                           do {
350                                 CurrItem++;
351                           } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
352                     }
353                     r.min_x = ScrX;
354                     r.max_x = TotalScreenWidth-1;
355                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
356               }
357
358               /* Process colour changes during horizontal retrace */
359               CyclesSoFar+= CyclesPerLine;
360               while ((CurrItem < NumItems) && (pItem[CurrItem].Event_Time <= CyclesSoFar))
361               {
362                     CurrBorderColor = pItem[CurrItem].Event_Data;
363                     do {
364                           CurrItem++;
365                     } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
366               }
367         }
368
369         /* Draw left and right borders next to screen lines */
370         for (ScrY = TopBorderLines; ScrY < (TopBorderLines+ScreenLines); ScrY++)
371         {
372               /* Draw left hand border */
373               r.min_x = 0;
374               r.min_y = r.max_y = ScrY;
375
376               if ((CurrItem >= NumItems) || (pItem[CurrItem].Event_Time >= (CyclesSoFar+LeftBorderCycles)))
377               {
378                     /* Single colour */
379                     r.max_x = LeftBorderPixels-1;
380                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
381               }
382               else
383               {
384                     /* Multiple colours */
385                     ScrX = (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)LeftBorderPixels / (float)LeftBorderCycles;
386                     r.max_x = ScrX-1;
387                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
388                     CurrBorderColor = pItem[CurrItem].Event_Data;
389                     do {
390                           CurrItem++;
391                     } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
392
393                     while ((CurrItem < NumItems) && (pItem[CurrItem].Event_Time < (CyclesSoFar+LeftBorderCycles)))
394                     {
395                           NextScrX = (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)LeftBorderPixels / (float)LeftBorderCycles;
396                           r.min_x = ScrX;
397                           r.max_x = NextScrX-1;
398                           bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
399                           ScrX = NextScrX;
400                           CurrBorderColor = pItem[CurrItem].Event_Data;
401                           do {
402                                 CurrItem++;
403                           } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
404                     }
405                     r.min_x = ScrX;
406                     r.max_x = LeftBorderPixels-1;
407                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
408               }
409
410               /* Process colour changes during screen draw */
411               while ((CurrItem < NumItems) && (pItem[CurrItem].Event_Time <= (CyclesSoFar+LeftBorderCycles+ScreenCycles)))
412               {
413                     CurrBorderColor = pItem[CurrItem].Event_Data;
414                     do {
415                           CurrItem++;
416                     } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
417               }
418
419               /* Draw right hand border */
420               r.min_x = LeftBorderPixels+ScreenPixels;
421               if ((CurrItem >= NumItems) || (pItem[CurrItem].Event_Time >= (CyclesSoFar+DisplayCyclesPerLine)))
422               {
423                     /* Single colour */
424                     r.max_x = TotalScreenWidth-1;
425                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
426               }
427               else
428               {
429                     /* Multiple colours */
430                     ScrX = LeftBorderPixels + ScreenPixels + (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)RightBorderPixels / (float)RightBorderCycles;
431                     r.max_x = ScrX-1;
432                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
433                     CurrBorderColor = pItem[CurrItem].Event_Data;
434                     do {
435                           CurrItem++;
436                     } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
437
438                     while ((CurrItem < NumItems) && (pItem[CurrItem].Event_Time < (CyclesSoFar+DisplayCyclesPerLine)))
439                     {
440                           NextScrX = LeftBorderPixels + ScreenPixels + (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)RightBorderPixels / (float)RightBorderCycles;
441                           r.min_x = ScrX;
442                           r.max_x = NextScrX-1;
443                           bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
444                           ScrX = NextScrX;
445                           CurrBorderColor = pItem[CurrItem].Event_Data;
446                           do {
447                                 CurrItem++;
448                           } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
449                     }
450                     r.min_x = ScrX;
451                     r.max_x = TotalScreenWidth-1;
452                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
453               }
454
455               /* Process colour changes during horizontal retrace */
456               CyclesSoFar+= CyclesPerLine;
457               while ((CurrItem < NumItems) && (pItem[CurrItem].Event_Time <= CyclesSoFar))
458               {
459                     CurrBorderColor = pItem[CurrItem].Event_Data;
460                     do {
461                           CurrItem++;
462                     } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
463               }
464         }
465
466         /* Draw bottom border */
467         for (ScrY = TopBorderLines+ScreenLines; ScrY < TotalScreenHeight; ScrY++)
468         {
469               r.min_x = 0;
470               r.min_y = r.max_y = ScrY;
471               if ((CurrItem >= NumItems) || (pItem[CurrItem].Event_Time >= (CyclesSoFar+DisplayCyclesPerLine)))
472               {
473                     /* Single colour on line */
474                     r.max_x = TotalScreenWidth-1;
475                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
476               }
477               else
478               {
479                     /* Multiple colours on a line */
480                     ScrX = (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)TotalScreenWidth / (float)DisplayCyclesPerLine;
481                     r.max_x = ScrX-1;
482                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
483                     CurrBorderColor = pItem[CurrItem].Event_Data;
484                     do {
485                           CurrItem++;
486                     } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
487
488                     while ((CurrItem < NumItems) && (pItem[CurrItem].Event_Time < (CyclesSoFar+DisplayCyclesPerLine)))
489                     {
490                           NextScrX = (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)TotalScreenWidth / (float)DisplayCyclesPerLine;
491                           r.min_x = ScrX;
492                           r.max_x = NextScrX-1;
493                           bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
494                           ScrX = NextScrX;
495                           CurrBorderColor = pItem[CurrItem].Event_Data;
496                           do {
497                                 CurrItem++;
498                           } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
499                     }
500                     r.min_x = ScrX;
501                     r.max_x = TotalScreenWidth-1;
502                     bitmap_fill(bitmap, &r, machine->pens[CurrBorderColor]);
503               }
504
505               /* Process colour changes during horizontal retrace */
506               CyclesSoFar+= CyclesPerLine;
507               while ((CurrItem < NumItems) && (pItem[CurrItem].Event_Time <= CyclesSoFar))
508               {
509                     CurrBorderColor = pItem[CurrItem].Event_Data;
510                     do {
511                           CurrItem++;
512                     } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
513               }
514         }
515
516         /* Process colour changes after last displayed line */
517         while (CurrItem < NumItems)
518         {
519               if (pItem[CurrItem].Event_ID == EventID)
520                     CurrBorderColor = pItem[CurrItem].Event_Data;
521               CurrItem++;
522         }
523
524         /* Set value to ensure redraw on next frame */
525         LastDisplayedBorderColor = -1;
526
527//          logerror ("Multi coloured border drawn (last colour = %d)\n", CurrBorderColor);
528   }
529
530   /* Assume all other routines have processed their data from the list */
531   EventList_Reset();
532   EventList_SetOffsetStartTime ( cpu_attotime_to_clocks(machine->firstcpu, attotime_mul(machine->primary_screen->scan_period(), machine->primary_screen->vpos())) );
533}
src/mess/video/timex.c
r8393r8394
1616#include "emu.h"
1717#include "includes/spectrum.h"
1818#include "eventlst.h"
19#include "video/border.h"
2019#include "devices/messram.h"
2120
2221INLINE void spectrum_plot_pixel(bitmap_t *bitmap, int x, int y, UINT32 color)
src/mess/video/rmnimbus.c
r8393r8394
2222*/
2323
2424#include "emu.h"
25#include "video/border.h"
2625#include "memory.h"
2726#include "debug/debugcpu.h"
2827#include "debug/debugcon.h"
src/mess/formats/spec_snqk.c
r8393r8394
2929#include "cpu/z80/z80.h"
3030#include "includes/spectrum.h"
3131#include "eventlst.h"
32#include "video/border.h"
3332#include "sound/ay8910.h"
3433#include "formats/spec_snqk.h"
3534#include "utils.h"
src/mess/formats/timex_dck.c
r8393r8394
2525
2626#include "emu.h"
2727#include "formats/timex_dck.h"
28#include "video/border.h"
2928#include "sound/ay8910.h"
3029#include "utils.h"
3130
src/mess/mess.mak
r8393r8394
13621362
13631363
13641364$(MESSOBJ)/sinclair.a:         \
1365   $(MESS_VIDEO)/border.o      \
13661365   $(MESS_VIDEO)/spectrum.o   \
13671366   $(MESS_VIDEO)/timex.o      \
13681367   $(MESS_VIDEO)/zx.o         \

Previous 15994 Revisions Next


© 1998-2018 The MESS Team