# HG changeset patch # User Paul Boddie # Date 1541289846 -3600 # Node ID ac56affd799c8b77c66051fc056449a5e2898578 # Parent 6c506a72cab09e32ee32403c1fe56582ebed51c4 Introduced a separate function to set up the background image. diff -r 6c506a72cab0 -r ac56affd799c examples/vga/main.c --- a/examples/vga/main.c Sun Nov 04 00:46:43 2018 +0100 +++ b/examples/vga/main.c Sun Nov 04 01:04:06 2018 +0100 @@ -312,6 +312,32 @@ } } +/* Set up a background. */ + +static void setup(void) +{ + int frame; + + for (frame = 0; frame < display_config.frames; frame++) + { + /* Obtain the frame. */ + + select_frame(&display_config, frame, 0); + + /* Plot the image centred on the screen. */ + + copy_display(&display_config, screendata, screendata_width, screendata_height, + (display_config.line_length - screendata_width) / 2, + (display_config.line_count - screendata_height) / 2, -1, 1); + + /* Write a sequence of characters. */ + + write_chars(); + } + + select_frame(&display_config, 0, 0); +} + /* Main program. */ @@ -362,18 +388,9 @@ interrupts_on(); - /* Plot the image centred on the screen. */ - - copy_display(&display_config, screendata, screendata_width, screendata_height, - (display_config.line_length - screendata_width) / 2, - (display_config.line_count - screendata_height) / 2, -1, 1); - - /* Write a sequence of characters. */ - - write_chars(); - /* Move a sprite around on the screen with a delay between each movement. */ + setup(); animate(1 << 18); }