diff options
author | Bad Diode <bd@badd10de.dev> | 2021-06-03 11:24:31 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2021-06-03 11:24:31 +0200 |
commit | 0eda19bd2bb551bf9186b0fbe1a806a28d5a3597 (patch) | |
tree | 859aad06f65f2502a13d26c372c4978147fa1864 /src/main.c | |
parent | 6b68cbd8a25dc2e554cf6741ff61ef87c030d841 (diff) | |
download | stepper-0eda19bd2bb551bf9186b0fbe1a806a28d5a3597.tar.gz stepper-0eda19bd2bb551bf9186b0fbe1a806a28d5a3597.zip |
Add initial text background drawing functions
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -35,10 +35,14 @@ WITH REGARD TO THIS SOFTWARE. | |||
35 | do { \ | 35 | do { \ |
36 | txt_position((PROF_SHOW_X), (PROF_SHOW_Y));\ | 36 | txt_position((PROF_SHOW_X), (PROF_SHOW_Y));\ |
37 | txt_printf("EVAL: %lu ", eval_cycles);\ | 37 | txt_printf("EVAL: %lu ", eval_cycles);\ |
38 | txt_position((PROF_SHOW_X), (PROF_SHOW_Y));\ | 38 | txt_position((PROF_SHOW_X), (PROF_SHOW_Y)+1);\ |
39 | txt_printf("FLIP: %lu ", flip_cycles);\ | 39 | txt_printf("FLIP: %lu ", flip_cycles);\ |
40 | txt_position((PROF_SHOW_X), (PROF_SHOW_Y)+2);\ | ||
41 | txt_printf("FRAME: %lu ", frame_counter);\ | ||
42 | frame_counter++;\ | ||
40 | } while (0) | 43 | } while (0) |
41 | #define PROF_INIT() \ | 44 | #define PROF_INIT() \ |
45 | u32 frame_counter = 0;\ | ||
42 | u32 eval_cycles = 0;\ | 46 | u32 eval_cycles = 0;\ |
43 | u32 flip_cycles = 0; | 47 | u32 flip_cycles = 0; |
44 | #else | 48 | #else |
@@ -65,19 +69,19 @@ int main(void) { | |||
65 | draw_pixel(10, 1, 2); | 69 | draw_pixel(10, 1, 2); |
66 | draw_pixel(10, 2, 3); | 70 | draw_pixel(10, 2, 3); |
67 | draw_pixel(10, 3, 4); | 71 | draw_pixel(10, 3, 4); |
68 | draw_pixel(0, 0, 1); | 72 | draw_pixel( 0, 0, 1); |
69 | draw_pixel(0, 1, 2); | 73 | draw_pixel( 0, 1, 2); |
70 | draw_pixel(0, 2, 3); | 74 | draw_pixel( 0, 2, 3); |
71 | draw_pixel(0, 3, 4); | 75 | draw_pixel( 0, 3, 4); |
76 | txt_position(8, 8); | ||
77 | txt_printf("Hello world!"); | ||
72 | 78 | ||
73 | // Main loop. | 79 | // Main loop. |
74 | PROF_INIT(); | 80 | PROF_INIT(); |
75 | size_t frame_counter = 0; | ||
76 | while(true) { | 81 | while(true) { |
77 | bios_vblank_wait(); | 82 | bios_vblank_wait(); |
78 | PROF_SHOW(); | 83 | PROF_SHOW(); |
79 | PROF(flip_buffer(), flip_cycles); | 84 | PROF(flip_buffer(), flip_cycles); |
80 | frame_counter++; | ||
81 | } | 85 | } |
82 | 86 | ||
83 | return 0; | 87 | return 0; |