1.1 --- a/examples/vga/main.c Fri Nov 09 21:04:23 2018 +0100
1.2 +++ b/examples/vga/main.c Fri Nov 09 21:05:06 2018 +0100
1.3 @@ -89,6 +89,10 @@
1.4
1.5 static uint8_t framebuffer[FRAME_SIZE * FRAME_COUNT];
1.6
1.7 +/* Screen start values for each frame. */
1.8 +
1.9 +uint8_t *screen_starts[FRAME_COUNT];
1.10 +
1.11
1.12
1.13 /* Bundled image and font data. */
1.14 @@ -210,10 +214,6 @@
1.15 int background_x[FRAME_COUNT], background_y[FRAME_COUNT];
1.16 int background_stored[FRAME_COUNT];
1.17
1.18 - /* Screen start values for each frame. */
1.19 -
1.20 - uint32_t frame_offset[FRAME_COUNT];
1.21 -
1.22 /* Sprite position. */
1.23
1.24 int x, y;
1.25 @@ -242,7 +242,6 @@
1.26 for (frame = 0; frame < display_config.frames; frame++)
1.27 {
1.28 background_stored[frame] = 0;
1.29 - frame_offset[frame] = 0;
1.30 xorigins[frame] = xorigin;
1.31 yorigins[frame] = yorigin;
1.32 }
1.33 @@ -273,7 +272,7 @@
1.34 /* Select the next frame to plot to. */
1.35
1.36 frame = wrap_value(frame + 1, display_config.frames);
1.37 - display_select_frame(&display_config, frame, frame_offset[frame]);
1.38 + display_select_frame(&display_config, frame);
1.39
1.40 /* Prepare the frame for updates. */
1.41
1.42 @@ -312,10 +311,6 @@
1.43 display_scroll(&display_config, xstep / SCROLL_XSTEP,
1.44 ystep / SOURCE_YSTEP);
1.45
1.46 - /* Record the new screen start offset. */
1.47 -
1.48 - frame_offset[frame] = display_get_start_offset(&display_config);
1.49 -
1.50 /* For horizontal scrolling, plot the exposed column at the left
1.51 (if scrolling left) or at the right (if scrolling right). */
1.52
1.53 @@ -372,7 +367,7 @@
1.54 {
1.55 /* Obtain the frame. */
1.56
1.57 - display_select_frame(&display_config, frame, 0);
1.58 + display_select_frame(&display_config, frame);
1.59
1.60 /* Plot the image centred on the screen. */
1.61
1.62 @@ -388,7 +383,7 @@
1.63 write_chars();
1.64 }
1.65
1.66 - display_select_frame(&display_config, 0, 0);
1.67 + display_select_frame(&display_config, 0);
1.68 }
1.69
1.70
1.71 @@ -425,7 +420,8 @@
1.72
1.73 /* Initialise memory for a double-buffered display. */
1.74
1.75 - init_display(&display_config, framebuffer, LINE_LENGTH, LINE_COUNT, FRAME_COUNT);
1.76 + init_display(&display_config, framebuffer, LINE_LENGTH, LINE_COUNT,
1.77 + FRAME_COUNT, screen_starts);
1.78
1.79 /* Initialise VGA output with one or two line channels, configuring a line
1.80 timer and any transfer timer, with an initiating channel being introduced