1.1 --- a/vga.S Sun May 28 17:04:48 2017 +0200
1.2 +++ b/vga.S Sun May 28 19:03:58 2017 +0200
1.3 @@ -19,20 +19,7 @@
1.4
1.5 #include "mips.h"
1.6 #include "pic32.h"
1.7 -
1.8 -#define LINE_LENGTH 160 /* pixels */
1.9 -
1.10 -#define HFREQ_LIMIT 643 /* 24MHz cycles */
1.11 -#define HSYNC_START 460 /* 24MHz cycles */
1.12 -#define HSYNC_LIMIT 64 /* 24MHz cycles */
1.13 -#define HSYNC_END (HSYNC_START + HSYNC_LIMIT)
1.14 -
1.15 -#define VISIBLE_START 70 /* horizontal lines, back porch end */
1.16 -#define VFP_START 582 /* horizontal lines, front porch start */
1.17 -#define VSYNC_START 620 /* horizontal lines, front porch end */
1.18 -#define VSYNC_END 622 /* horizontal lines, back porch start */
1.19 -
1.20 -#define SCREEN_SIZE (40 * 1024)
1.21 +#include "vga.h"
1.22
1.23 /* Disable JTAG functionality on pins. */
1.24
1.25 @@ -67,6 +54,7 @@
1.26
1.27 .text
1.28 .globl _start
1.29 +.extern init_framebuffer_with_pattern
1.30
1.31 _start:
1.32 /*
1.33 @@ -126,7 +114,7 @@
1.34
1.35 /* Initialise framebuffer. */
1.36
1.37 - jal init_framebuffer
1.38 + jal init_framebuffer_with_pattern
1.39 nop
1.40
1.41 sync
1.42 @@ -589,78 +577,6 @@
1.43
1.44
1.45
1.46 -init_framebuffer_with_pattern:
1.47 - li $v0, KSEG1_BASE
1.48 - li $t8, SCREEN_SIZE
1.49 - move $t2, $zero /* x div 20 */
1.50 - move $t3, $zero /* x mod 20 */
1.51 - move $t4, $zero /* y mod 16 */
1.52 - move $t5, $zero /* base value: [(0...15) << 2] * 4 */
1.53 - move $t6, $zero /* offset value: [0...7] * 4 */
1.54 -
1.55 -_init_fbwp_loop:
1.56 - li $t9, 0xfcfcfcfc
1.57 - and $t9, $t9, $t5 /* get bits 5...2 of the base value */
1.58 - or $t9, $t9, $t6 /* combine base<5:2> and offset values */
1.59 -
1.60 - /* Test for bit 2 and set bit 7 if set, thus setting the intensity. */
1.61 -
1.62 - andi $t7, $t5, 0b00000100
1.63 - beqz $t7, _init_fbwp_loop_write
1.64 - nop
1.65 -
1.66 - li $t7, 0x80808080
1.67 - or $t9, $t9, $t7 /* set intensity in each byte */
1.68 -
1.69 -_init_fbwp_loop_write:
1.70 - sw $t9, 0($v0)
1.71 - addiu $v0, $v0, 4
1.72 -
1.73 - addiu $t3, $t3, 1 /* (x mod 20) += 1 */
1.74 -
1.75 - /* Update the offset value every twenty pixels. */
1.76 -
1.77 - addiu $t9, $t3, -5
1.78 - bnez $t9, _init_fbwp_loop_end
1.79 - nop
1.80 -
1.81 - li $t9, 0x01010101
1.82 - addu $t6, $t6, $t9 /* offset += [1] * 4 */
1.83 - addiu $t2, $t2, 1 /* (x div 20) += 1 */
1.84 - move $t3, $zero /* (x mod 20) = 0 */
1.85 -
1.86 - /* Test for the next line. */
1.87 -
1.88 - addiu $t9, $t2, -8
1.89 - bnez $t9, _init_fbwp_loop_end
1.90 - nop
1.91 -
1.92 - move $t2, $zero /* (x div 20) = 0 */
1.93 - move $t6, $zero /* offset = 0 */
1.94 -
1.95 -_init_fbwp_loop_next_y:
1.96 - addiu $t4, $t4, 1 /* (y mod 16) += 1 */
1.97 -
1.98 - /* Update the base value every sixteen rows. */
1.99 -
1.100 - addiu $t9, $t4, -16
1.101 - bnez $t9, _init_fbwp_loop_end
1.102 - nop
1.103 -
1.104 - li $t9, 0x04040404
1.105 - addu $t5, $t5, $t9 /* base += [(1 << 2)] * 4 */
1.106 - move $t4, $zero /* (y mod 16) = 0 */
1.107 -
1.108 -_init_fbwp_loop_end:
1.109 - addiu $t8, $t8, -4
1.110 - bnez $t8, _init_fbwp_loop
1.111 - nop
1.112 -
1.113 - jr $ra
1.114 - nop
1.115 -
1.116 -
1.117 -
1.118 /* Utilities. */
1.119
1.120 handle_error_level: