1.1 --- a/display.c Sun May 28 19:03:58 2017 +0200
1.2 +++ b/display.c Sun May 28 19:08:49 2017 +0200
1.3 @@ -21,6 +21,22 @@
1.4 #include "mips.h"
1.5 #include "vga.h"
1.6
1.7 +void init_framebuffer(uint32_t *data)
1.8 +{
1.9 + uint32_t *addr = (uint32_t *) KSEG1_BASE;
1.10 + uint16_t x, y;
1.11 +
1.12 + for (y = 0; y < LINE_COUNT; y++)
1.13 + {
1.14 + for (x = 0; x < LINE_LENGTH; x += 4)
1.15 + {
1.16 + *addr = *data;
1.17 + addr++;
1.18 + data++;
1.19 + }
1.20 + }
1.21 +}
1.22 +
1.23 void init_framebuffer_with_pattern()
1.24 {
1.25 uint32_t *addr = (uint32_t *) KSEG1_BASE;
2.1 --- a/vga.S Sun May 28 19:03:58 2017 +0200
2.2 +++ b/vga.S Sun May 28 19:08:49 2017 +0200
2.3 @@ -54,6 +54,7 @@
2.4
2.5 .text
2.6 .globl _start
2.7 +.extern init_framebuffer
2.8 .extern init_framebuffer_with_pattern
2.9
2.10 _start:
2.11 @@ -114,7 +115,8 @@
2.12
2.13 /* Initialise framebuffer. */
2.14
2.15 - jal init_framebuffer_with_pattern
2.16 + la $a0, screendata
2.17 + jal init_framebuffer
2.18 nop
2.19
2.20 sync
2.21 @@ -556,27 +558,6 @@
2.22
2.23
2.24
2.25 -/* Framebuffer initialisation. */
2.26 -
2.27 -init_framebuffer:
2.28 - li $v0, KSEG1_BASE
2.29 - la $v1, screendata
2.30 - li $t8, SCREEN_SIZE
2.31 -
2.32 -_init_fb_loop:
2.33 - lw $t9, 0($v1)
2.34 - sw $t9, 0($v0)
2.35 - addiu $v0, $v0, 4
2.36 - addiu $v1, $v1, 4
2.37 - addiu $t8, $t8, -4
2.38 - bnez $t8, _init_fb_loop
2.39 - nop
2.40 -
2.41 - jr $ra
2.42 - nop
2.43 -
2.44 -
2.45 -
2.46 /* Utilities. */
2.47
2.48 handle_error_level: