# HG changeset patch # User Paul Boddie # Date 1495991329 -7200 # Node ID 8486ec92869e722b0df07751b8f3a0d73a30e69d # Parent ea2ae1af65d5962444d4b03cb687912bb8e57026 Moved the framebuffer copying routine into a separate function. diff -r ea2ae1af65d5 -r 8486ec92869e display.c --- a/display.c Sun May 28 19:03:58 2017 +0200 +++ b/display.c Sun May 28 19:08:49 2017 +0200 @@ -21,6 +21,22 @@ #include "mips.h" #include "vga.h" +void init_framebuffer(uint32_t *data) +{ + uint32_t *addr = (uint32_t *) KSEG1_BASE; + uint16_t x, y; + + for (y = 0; y < LINE_COUNT; y++) + { + for (x = 0; x < LINE_LENGTH; x += 4) + { + *addr = *data; + addr++; + data++; + } + } +} + void init_framebuffer_with_pattern() { uint32_t *addr = (uint32_t *) KSEG1_BASE; diff -r ea2ae1af65d5 -r 8486ec92869e vga.S --- a/vga.S Sun May 28 19:03:58 2017 +0200 +++ b/vga.S Sun May 28 19:08:49 2017 +0200 @@ -54,6 +54,7 @@ .text .globl _start +.extern init_framebuffer .extern init_framebuffer_with_pattern _start: @@ -114,7 +115,8 @@ /* Initialise framebuffer. */ - jal init_framebuffer_with_pattern + la $a0, screendata + jal init_framebuffer nop sync @@ -556,27 +558,6 @@ -/* Framebuffer initialisation. */ - -init_framebuffer: - li $v0, KSEG1_BASE - la $v1, screendata - li $t8, SCREEN_SIZE - -_init_fb_loop: - lw $t9, 0($v1) - sw $t9, 0($v0) - addiu $v0, $v0, 4 - addiu $v1, $v1, 4 - addiu $t8, $t8, -4 - bnez $t8, _init_fb_loop - nop - - jr $ra - nop - - - /* Utilities. */ handle_error_level: