Bayley Wang
/
manworm_tv_raster
cube
Fork of manworm_tv_gpu by
main.cpp@3:d9edc0575aa3, 2017-11-19 (annotated)
- Committer:
- bwang
- Date:
- Sun Nov 19 05:00:14 2017 +0000
- Revision:
- 3:d9edc0575aa3
- Parent:
- 2:1d16e99f334b
- Child:
- 4:02e3ae7a3aea
pang, fash, and damo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dicarloj | 0:7757ab3f7206 | 1 | #include "mbed.h" |
dicarloj | 0:7757ab3f7206 | 2 | #define V_RES 220 |
dicarloj | 0:7757ab3f7206 | 3 | #define H_RES 100 |
dicarloj | 0:7757ab3f7206 | 4 | #include <math.h> |
dicarloj | 0:7757ab3f7206 | 5 | #define X_MIN 24 |
dicarloj | 0:7757ab3f7206 | 6 | #define X_MAX (76+18) |
dicarloj | 0:7757ab3f7206 | 7 | #define Y_MIN 7 |
dicarloj | 0:7757ab3f7206 | 8 | #define Y_MAX (V_RES/4 - 15) |
dicarloj | 0:7757ab3f7206 | 9 | |
bwang | 1:24fd07a24094 | 10 | int SX_MIN = 30; |
bwang | 2:1d16e99f334b | 11 | int SX_MAX = 95; |
bwang | 1:24fd07a24094 | 12 | int SY_MIN = 10; |
bwang | 3:d9edc0575aa3 | 13 | int SY_MAX = 48; |
bwang | 1:24fd07a24094 | 14 | int PADDLE_LEN = 10; |
bwang | 1:24fd07a24094 | 15 | |
dicarloj | 0:7757ab3f7206 | 16 | #define Y_0 ( (Y_MIN + Y_MAX)/2 ) |
dicarloj | 0:7757ab3f7206 | 17 | #define X_0 ( (X_MIN + X_MAX)/2 ) |
dicarloj | 0:7757ab3f7206 | 18 | #define SIDE 8 |
dicarloj | 0:7757ab3f7206 | 19 | #define HSIDE 8 |
dicarloj | 0:7757ab3f7206 | 20 | #define SIN_V (0.03) |
dicarloj | 0:7757ab3f7206 | 21 | #define COS_V (0.99955f) |
dicarloj | 0:7757ab3f7206 | 22 | #define BX_0 30 |
dicarloj | 0:7757ab3f7206 | 23 | #define BY_0 (V_RES/4 - 15) |
dicarloj | 0:7757ab3f7206 | 24 | #define BX 42 |
dicarloj | 0:7757ab3f7206 | 25 | #define BY 15 |
dicarloj | 0:7757ab3f7206 | 26 | #define DEMO_LENGTH 600 |
dicarloj | 0:7757ab3f7206 | 27 | |
dicarloj | 0:7757ab3f7206 | 28 | |
dicarloj | 0:7757ab3f7206 | 29 | DigitalOut sout(D8); //sync |
dicarloj | 0:7757ab3f7206 | 30 | DigitalOut vout(D7); //video |
dicarloj | 0:7757ab3f7206 | 31 | Ticker t; |
dicarloj | 0:7757ab3f7206 | 32 | uint8_t draw_line_inv = 0; |
dicarloj | 0:7757ab3f7206 | 33 | //9x42 |
dicarloj | 0:7757ab3f7206 | 34 | uint8_t miters[] = { |
dicarloj | 0:7757ab3f7206 | 35 | 1,1,1,1,1,1,1,1,1,1,0,0,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, |
dicarloj | 0:7757ab3f7206 | 36 | 1,1,1,1,1,1,1,1,1,1,0,0,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, |
dicarloj | 0:7757ab3f7206 | 37 | 1,1,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
dicarloj | 0:7757ab3f7206 | 38 | 1,1,0,0,1,1,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,1,1,1,1,1,0,0,1,1,0,0,0,0,0,0,1,1,1,1,1,1, |
dicarloj | 0:7757ab3f7206 | 39 | 1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,1,0,0,1,1,1,1,1,1,0,0,1,1,1,1,1,1, |
dicarloj | 0:7757ab3f7206 | 40 | 1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,1,1,0,0,0, |
dicarloj | 0:7757ab3f7206 | 41 | 1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,0,0, |
dicarloj | 0:7757ab3f7206 | 42 | 1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,1,1,1,1,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1,1, |
dicarloj | 0:7757ab3f7206 | 43 | 1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,1,1,1,1,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1,1, |
dicarloj | 0:7757ab3f7206 | 44 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
dicarloj | 0:7757ab3f7206 | 45 | 0,0,0,0,0,0,0,1,1,0,1,0,1,0,1,1,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,1,1,0,0,0,0,0,0, |
dicarloj | 0:7757ab3f7206 | 46 | 1,1,1,1,1,0,1,0,0,1,1,0,1,1,0,0,1,0,1,1,0,0,0,1,1,0,1,1,0,1,1,0,1,1,0,0,0,1,1,1,1,1, |
dicarloj | 0:7757ab3f7206 | 47 | 1,0,1,0,1,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,1,0,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,0,1, |
dicarloj | 0:7757ab3f7206 | 48 | 1,0,1,0,1,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,1,0,0,1,1,0,1,1,0,1,0,0,0,0,1,0,1,0,1, |
dicarloj | 0:7757ab3f7206 | 49 | 1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,0,1,0,0,0,1,1,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,1,0,1, |
dicarloj | 0:7757ab3f7206 | 50 | |
dicarloj | 0:7757ab3f7206 | 51 | }; |
dicarloj | 0:7757ab3f7206 | 52 | |
dicarloj | 0:7757ab3f7206 | 53 | uint8_t tv[] = { |
dicarloj | 0:7757ab3f7206 | 54 | 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
dicarloj | 0:7757ab3f7206 | 55 | 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
dicarloj | 0:7757ab3f7206 | 56 | 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0, |
dicarloj | 0:7757ab3f7206 | 57 | 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0, |
dicarloj | 0:7757ab3f7206 | 58 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0, |
dicarloj | 0:7757ab3f7206 | 59 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0, |
dicarloj | 0:7757ab3f7206 | 60 | 0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0, |
dicarloj | 0:7757ab3f7206 | 61 | 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0, |
dicarloj | 0:7757ab3f7206 | 62 | 0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,1,0,0,0,1,0,1,0,1,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0, |
dicarloj | 0:7757ab3f7206 | 63 | 0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,1,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0, |
dicarloj | 0:7757ab3f7206 | 64 | 0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,1,0,1,0,0,1,0,1,0,0,0,0,0,0,0,0, |
dicarloj | 0:7757ab3f7206 | 65 | 0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,1,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0, |
dicarloj | 0:7757ab3f7206 | 66 | 0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
dicarloj | 0:7757ab3f7206 | 67 | 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,0,1,1,1,0,0,0,0,0,0,0,0, |
dicarloj | 0:7757ab3f7206 | 68 | 0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,0,1,1,1,0,0,0,0,0,0,0,0}; |
dicarloj | 0:7757ab3f7206 | 69 | |
bwang | 3:d9edc0575aa3 | 70 | uint8_t chr_A[] = { |
bwang | 3:d9edc0575aa3 | 71 | 0,0,1,1,0,0, |
bwang | 3:d9edc0575aa3 | 72 | 0,1,0,0,1,0, |
bwang | 3:d9edc0575aa3 | 73 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 74 | 1,1,1,1,1,1, |
bwang | 3:d9edc0575aa3 | 75 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 76 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 77 | 1,0,0,0,0,1,}; |
dicarloj | 0:7757ab3f7206 | 78 | |
bwang | 3:d9edc0575aa3 | 79 | uint8_t chr_D[] = { |
bwang | 3:d9edc0575aa3 | 80 | 1,1,1,1,1,0, |
bwang | 3:d9edc0575aa3 | 81 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 82 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 83 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 84 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 85 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 86 | 1,1,1,1,1,0,}; |
bwang | 3:d9edc0575aa3 | 87 | |
bwang | 3:d9edc0575aa3 | 88 | uint8_t chr_F[] = { |
bwang | 3:d9edc0575aa3 | 89 | 1,1,1,1,1,1, |
bwang | 3:d9edc0575aa3 | 90 | 1,0,0,0,0,0, |
bwang | 3:d9edc0575aa3 | 91 | 1,0,0,0,0,0, |
bwang | 3:d9edc0575aa3 | 92 | 1,1,1,1,1,1, |
bwang | 3:d9edc0575aa3 | 93 | 1,0,0,0,0,0, |
bwang | 3:d9edc0575aa3 | 94 | 1,0,0,0,0,0, |
bwang | 3:d9edc0575aa3 | 95 | 1,0,0,0,0,0,}; |
bwang | 3:d9edc0575aa3 | 96 | |
bwang | 3:d9edc0575aa3 | 97 | uint8_t chr_G[] = { |
bwang | 3:d9edc0575aa3 | 98 | 0,1,1,1,1,0, |
bwang | 3:d9edc0575aa3 | 99 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 100 | 1,0,0,0,0,0, |
bwang | 3:d9edc0575aa3 | 101 | 1,0,0,1,1,1, |
bwang | 3:d9edc0575aa3 | 102 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 103 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 104 | 0,1,1,1,1,0,}; |
bwang | 3:d9edc0575aa3 | 105 | |
bwang | 3:d9edc0575aa3 | 106 | uint8_t chr_H[] = { |
bwang | 3:d9edc0575aa3 | 107 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 108 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 109 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 110 | 1,1,1,1,1,1, |
bwang | 3:d9edc0575aa3 | 111 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 112 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 113 | 1,0,0,0,0,1,}; |
bwang | 3:d9edc0575aa3 | 114 | |
bwang | 3:d9edc0575aa3 | 115 | uint8_t chr_M[] = { |
bwang | 3:d9edc0575aa3 | 116 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 117 | 1,1,0,0,1,1, |
bwang | 3:d9edc0575aa3 | 118 | 1,0,1,1,0,1, |
bwang | 3:d9edc0575aa3 | 119 | 1,0,1,1,0,1, |
bwang | 3:d9edc0575aa3 | 120 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 121 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 122 | 1,0,0,0,0,1,}; |
bwang | 3:d9edc0575aa3 | 123 | |
bwang | 3:d9edc0575aa3 | 124 | uint8_t chr_N[] = { |
bwang | 3:d9edc0575aa3 | 125 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 126 | 1,1,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 127 | 1,0,1,0,0,1, |
bwang | 3:d9edc0575aa3 | 128 | 1,0,0,1,0,1, |
bwang | 3:d9edc0575aa3 | 129 | 1,0,0,0,1,1, |
bwang | 3:d9edc0575aa3 | 130 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 131 | 1,0,0,0,0,1,}; |
bwang | 3:d9edc0575aa3 | 132 | |
bwang | 3:d9edc0575aa3 | 133 | uint8_t chr_O[] = { |
bwang | 3:d9edc0575aa3 | 134 | 0,1,1,1,1,0, |
bwang | 3:d9edc0575aa3 | 135 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 136 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 137 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 138 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 139 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 140 | 0,1,1,1,1,0,}; |
bwang | 3:d9edc0575aa3 | 141 | |
bwang | 3:d9edc0575aa3 | 142 | uint8_t chr_P[] = { |
bwang | 3:d9edc0575aa3 | 143 | 1,1,1,1,1,0, |
bwang | 3:d9edc0575aa3 | 144 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 145 | 1,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 146 | 1,1,1,1,1,0, |
bwang | 3:d9edc0575aa3 | 147 | 1,0,0,0,0,0, |
bwang | 3:d9edc0575aa3 | 148 | 1,0,0,0,0,0, |
bwang | 3:d9edc0575aa3 | 149 | 1,0,0,0,0,0,}; |
bwang | 3:d9edc0575aa3 | 150 | |
bwang | 3:d9edc0575aa3 | 151 | uint8_t chr_S[] = { |
bwang | 3:d9edc0575aa3 | 152 | 0,1,1,1,1,1, |
bwang | 3:d9edc0575aa3 | 153 | 1,0,0,0,0,0, |
bwang | 3:d9edc0575aa3 | 154 | 1,0,0,0,0,0, |
bwang | 3:d9edc0575aa3 | 155 | 0,1,1,1,1,0, |
bwang | 3:d9edc0575aa3 | 156 | 0,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 157 | 0,0,0,0,0,1, |
bwang | 3:d9edc0575aa3 | 158 | 1,1,1,1,1,0,}; |
dicarloj | 0:7757ab3f7206 | 159 | |
dicarloj | 0:7757ab3f7206 | 160 | uint16_t l=0; //current line of scan |
dicarloj | 0:7757ab3f7206 | 161 | |
dicarloj | 0:7757ab3f7206 | 162 | uint8_t im_line_s[H_RES]; //image sync buffer |
dicarloj | 0:7757ab3f7206 | 163 | |
dicarloj | 0:7757ab3f7206 | 164 | uint8_t bl_line_s[H_RES]; //lower 1/4 of screen sync buffer |
dicarloj | 0:7757ab3f7206 | 165 | uint8_t bl_line_v[H_RES]; //lower 1/4 of screen video buffer |
dicarloj | 0:7757ab3f7206 | 166 | uint8_t vb_line_s[H_RES]; //vertical sync, sync buffer |
dicarloj | 0:7757ab3f7206 | 167 | uint8_t vb_line_v[H_RES]; //vertical sync, video buffer |
dicarloj | 0:7757ab3f7206 | 168 | |
dicarloj | 0:7757ab3f7206 | 169 | float cube_a[3] = {15.f, 0.f, 0.f}; |
dicarloj | 0:7757ab3f7206 | 170 | |
dicarloj | 0:7757ab3f7206 | 171 | |
dicarloj | 0:7757ab3f7206 | 172 | float cube_pts[8][3] = { {SIDE,SIDE,HSIDE}, |
dicarloj | 0:7757ab3f7206 | 173 | {-SIDE,SIDE,HSIDE}, |
dicarloj | 0:7757ab3f7206 | 174 | {-SIDE,-SIDE,HSIDE}, |
dicarloj | 0:7757ab3f7206 | 175 | {SIDE,-SIDE,HSIDE}, |
dicarloj | 0:7757ab3f7206 | 176 | {SIDE,-SIDE,-HSIDE}, |
dicarloj | 0:7757ab3f7206 | 177 | {-SIDE,-SIDE,-HSIDE}, |
dicarloj | 0:7757ab3f7206 | 178 | {-SIDE,SIDE,-HSIDE}, |
dicarloj | 0:7757ab3f7206 | 179 | {SIDE,SIDE,-HSIDE} }; |
dicarloj | 0:7757ab3f7206 | 180 | |
dicarloj | 0:7757ab3f7206 | 181 | float x_rot[3][3] = { {1.f, 0.f, 0.f}, |
dicarloj | 0:7757ab3f7206 | 182 | {0.f, COS_V, -SIN_V}, |
dicarloj | 0:7757ab3f7206 | 183 | {0.f, SIN_V, COS_V} }; |
dicarloj | 0:7757ab3f7206 | 184 | |
dicarloj | 0:7757ab3f7206 | 185 | float y_rot[3][3] = { {COS_V, 0.f, SIN_V}, |
dicarloj | 0:7757ab3f7206 | 186 | {0.f, 1.f, 0.f}, |
dicarloj | 0:7757ab3f7206 | 187 | {-SIN_V, 0, COS_V} }; |
dicarloj | 0:7757ab3f7206 | 188 | |
dicarloj | 0:7757ab3f7206 | 189 | float z_rot[3][3] = { {COS_V, -SIN_V, 0.f}, |
dicarloj | 0:7757ab3f7206 | 190 | {SIN_V, COS_V, 0.f}, |
dicarloj | 0:7757ab3f7206 | 191 | {0.f, 0.f, 1.f} }; |
dicarloj | 0:7757ab3f7206 | 192 | |
dicarloj | 0:7757ab3f7206 | 193 | |
dicarloj | 0:7757ab3f7206 | 194 | uint8_t im_line_va[H_RES*V_RES]; //image buffer |
dicarloj | 0:7757ab3f7206 | 195 | |
bwang | 1:24fd07a24094 | 196 | //pong variables |
bwang | 1:24fd07a24094 | 197 | float p1 = (SY_MIN+SY_MAX)/2-PADDLE_LEN/2, p2 = (SY_MIN+SY_MAX)/2-PADDLE_LEN/2; |
bwang | 1:24fd07a24094 | 198 | float p1v = 0.1, p2v = -0.1; |
bwang | 1:24fd07a24094 | 199 | |
bwang | 1:24fd07a24094 | 200 | float bx = (SX_MIN+SX_MAX)/2, by = (SY_MIN+SY_MAX)/2; |
bwang | 1:24fd07a24094 | 201 | float bxv = 0.03, byv = 0.03; |
bwang | 1:24fd07a24094 | 202 | |
bwang | 2:1d16e99f334b | 203 | int s1 = 0, s2 = 0; |
bwang | 2:1d16e99f334b | 204 | |
bwang | 3:d9edc0575aa3 | 205 | //fish variables |
bwang | 3:d9edc0575aa3 | 206 | #define FDEATH_RESET 30000 |
bwang | 3:d9edc0575aa3 | 207 | float fx = (SX_MAX+SX_MIN)/2.f, fy = (SY_MIN+SY_MAX)/2.f, fv = 0.02f, ftheta = 0.0, fa = 0.002; |
bwang | 3:d9edc0575aa3 | 208 | float uv = 0.005; |
bwang | 3:d9edc0575aa3 | 209 | float ux[8] = {53,70,78,78,70,53,45,45}; |
bwang | 3:d9edc0575aa3 | 210 | float uy[8] = {10,10,20,35,50,50,35,20}; |
bwang | 3:d9edc0575aa3 | 211 | float uvx[8] = {-1,1,1,1,1,-1,-1,-1}; |
bwang | 3:d9edc0575aa3 | 212 | float uvy[8] = {1,1,1,-1,-1,-1,-1,1}; |
bwang | 3:d9edc0575aa3 | 213 | int ulive[8] = {1,1,1,1,1,1,1,1}; |
bwang | 3:d9edc0575aa3 | 214 | |
bwang | 3:d9edc0575aa3 | 215 | int fdeath_ticker = FDEATH_RESET; |
bwang | 3:d9edc0575aa3 | 216 | float fs = 0; |
bwang | 3:d9edc0575aa3 | 217 | |
bwang | 2:1d16e99f334b | 218 | DigitalIn p1_in(A1); |
bwang | 2:1d16e99f334b | 219 | DigitalIn p2_in(A0); |
bwang | 1:24fd07a24094 | 220 | |
dicarloj | 0:7757ab3f7206 | 221 | void make_checkerboard() |
dicarloj | 0:7757ab3f7206 | 222 | { |
dicarloj | 0:7757ab3f7206 | 223 | for(int i = 0; i < H_RES; i++) |
dicarloj | 0:7757ab3f7206 | 224 | for(int j = 0; j < V_RES; j++) |
bwang | 1:24fd07a24094 | 225 | im_line_va[i+j*H_RES] = 0*((i > 20) && (i < 98)) && ((j%2) ^ (i%2)); //checkerboard |
dicarloj | 0:7757ab3f7206 | 226 | |
dicarloj | 0:7757ab3f7206 | 227 | } |
dicarloj | 0:7757ab3f7206 | 228 | |
bwang | 3:d9edc0575aa3 | 229 | void clr() |
bwang | 3:d9edc0575aa3 | 230 | { |
bwang | 3:d9edc0575aa3 | 231 | for(int i = 0; i < H_RES; i++) |
bwang | 3:d9edc0575aa3 | 232 | for(int j = 0; j < V_RES; j++) |
bwang | 3:d9edc0575aa3 | 233 | im_line_va[i+j*H_RES] = 0; |
bwang | 3:d9edc0575aa3 | 234 | |
bwang | 3:d9edc0575aa3 | 235 | } |
bwang | 3:d9edc0575aa3 | 236 | |
dicarloj | 0:7757ab3f7206 | 237 | void init_buffers() |
dicarloj | 0:7757ab3f7206 | 238 | { |
bwang | 3:d9edc0575aa3 | 239 | clr(); |
dicarloj | 0:7757ab3f7206 | 240 | for(int i = 0; i < H_RES; i++) |
dicarloj | 0:7757ab3f7206 | 241 | { |
dicarloj | 0:7757ab3f7206 | 242 | im_line_s[i] = 1; |
dicarloj | 0:7757ab3f7206 | 243 | bl_line_s[i] = 1; |
dicarloj | 0:7757ab3f7206 | 244 | bl_line_v[i] = 0; |
dicarloj | 0:7757ab3f7206 | 245 | vb_line_s[i] = 0; |
dicarloj | 0:7757ab3f7206 | 246 | vb_line_v[i] = 0; |
dicarloj | 0:7757ab3f7206 | 247 | } |
dicarloj | 0:7757ab3f7206 | 248 | im_line_s[0] = 0; |
dicarloj | 0:7757ab3f7206 | 249 | im_line_s[1] = 0; |
dicarloj | 0:7757ab3f7206 | 250 | im_line_s[2] = 0; |
dicarloj | 0:7757ab3f7206 | 251 | bl_line_s[0] = 0; |
dicarloj | 0:7757ab3f7206 | 252 | vb_line_s[0] = 1; |
dicarloj | 0:7757ab3f7206 | 253 | bl_line_s[1] = 0; |
dicarloj | 0:7757ab3f7206 | 254 | vb_line_s[1] = 1; |
dicarloj | 0:7757ab3f7206 | 255 | |
dicarloj | 0:7757ab3f7206 | 256 | |
dicarloj | 0:7757ab3f7206 | 257 | |
dicarloj | 0:7757ab3f7206 | 258 | } |
dicarloj | 0:7757ab3f7206 | 259 | void isr() |
dicarloj | 0:7757ab3f7206 | 260 | { |
dicarloj | 0:7757ab3f7206 | 261 | uint8_t nop = 0; //use nops or use wait_us |
dicarloj | 0:7757ab3f7206 | 262 | uint8_t* sptr; //pointer to sync buffer for line |
dicarloj | 0:7757ab3f7206 | 263 | uint8_t* vptr; //pointer to video buffer for line |
dicarloj | 0:7757ab3f7206 | 264 | if(l < V_RES){ vptr = im_line_va + ((l/4)*H_RES); sptr = im_line_s; nop = 1; } //pick line buffers |
dicarloj | 0:7757ab3f7206 | 265 | else if(l < 254){ vptr = bl_line_v; sptr = bl_line_s; nop = 0; } |
dicarloj | 0:7757ab3f7206 | 266 | else{ vptr = vb_line_v; sptr = vb_line_s; nop = 1;} |
dicarloj | 0:7757ab3f7206 | 267 | uint8_t lmax = nop?H_RES:12; //number of columns |
dicarloj | 0:7757ab3f7206 | 268 | for(uint8_t i = 0; i < lmax; i++) //loop over each column |
dicarloj | 0:7757ab3f7206 | 269 | { |
dicarloj | 0:7757ab3f7206 | 270 | vout = vptr[i]; //set output pins |
dicarloj | 0:7757ab3f7206 | 271 | sout = sptr[i]; |
dicarloj | 0:7757ab3f7206 | 272 | if(nop) //nop delay |
dicarloj | 0:7757ab3f7206 | 273 | { |
dicarloj | 0:7757ab3f7206 | 274 | asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");//asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop"); |
dicarloj | 0:7757ab3f7206 | 275 | } |
dicarloj | 0:7757ab3f7206 | 276 | else {wait_us(1); if(i > 2) i++;} //wait delay |
dicarloj | 0:7757ab3f7206 | 277 | |
dicarloj | 0:7757ab3f7206 | 278 | |
dicarloj | 0:7757ab3f7206 | 279 | } |
dicarloj | 0:7757ab3f7206 | 280 | //move to next line |
dicarloj | 0:7757ab3f7206 | 281 | l++; |
dicarloj | 0:7757ab3f7206 | 282 | if(l > 255) l = 0; |
dicarloj | 0:7757ab3f7206 | 283 | } |
dicarloj | 0:7757ab3f7206 | 284 | |
dicarloj | 0:7757ab3f7206 | 285 | //coordinates for bouncing ball |
dicarloj | 0:7757ab3f7206 | 286 | |
dicarloj | 0:7757ab3f7206 | 287 | |
dicarloj | 0:7757ab3f7206 | 288 | |
dicarloj | 0:7757ab3f7206 | 289 | int k = 0; |
dicarloj | 0:7757ab3f7206 | 290 | uint16_t px = X_0*10; |
dicarloj | 0:7757ab3f7206 | 291 | uint16_t py = Y_0*10; |
dicarloj | 0:7757ab3f7206 | 292 | uint16_t vx = 10; |
dicarloj | 0:7757ab3f7206 | 293 | uint16_t vy = 10; |
dicarloj | 0:7757ab3f7206 | 294 | uint16_t px2 = X_0*10 + 80; |
dicarloj | 0:7757ab3f7206 | 295 | uint16_t py2 = Y_0*10 - 40; |
dicarloj | 0:7757ab3f7206 | 296 | uint16_t vx2 = 3; |
dicarloj | 0:7757ab3f7206 | 297 | uint16_t vy2 = -4; |
dicarloj | 0:7757ab3f7206 | 298 | |
dicarloj | 0:7757ab3f7206 | 299 | int16_t sign(int16_t a) |
dicarloj | 0:7757ab3f7206 | 300 | { |
dicarloj | 0:7757ab3f7206 | 301 | if(a > 0) return 1; |
dicarloj | 0:7757ab3f7206 | 302 | if(a < 0) return -1; |
dicarloj | 0:7757ab3f7206 | 303 | return 0; |
dicarloj | 0:7757ab3f7206 | 304 | } |
dicarloj | 0:7757ab3f7206 | 305 | |
dicarloj | 0:7757ab3f7206 | 306 | void draw_vert(int16_t y0, int16_t y1, int16_t x0) |
dicarloj | 0:7757ab3f7206 | 307 | { |
dicarloj | 0:7757ab3f7206 | 308 | for(int16_t i = y0; i < y1; i++) |
dicarloj | 0:7757ab3f7206 | 309 | im_line_va[H_RES*i + x0] = 1; |
dicarloj | 0:7757ab3f7206 | 310 | } |
dicarloj | 0:7757ab3f7206 | 311 | |
dicarloj | 0:7757ab3f7206 | 312 | void draw_horiz(int16_t x0, int16_t x1, int16_t y0) |
dicarloj | 0:7757ab3f7206 | 313 | { |
dicarloj | 0:7757ab3f7206 | 314 | for(int16_t i = x0; i < x1; i++) |
dicarloj | 0:7757ab3f7206 | 315 | im_line_va[H_RES*y0 + i] = 1; |
dicarloj | 0:7757ab3f7206 | 316 | } |
dicarloj | 0:7757ab3f7206 | 317 | |
dicarloj | 0:7757ab3f7206 | 318 | int16_t imin(int16_t a, int16_t b) |
dicarloj | 0:7757ab3f7206 | 319 | { |
dicarloj | 0:7757ab3f7206 | 320 | if(a<b) return a; |
dicarloj | 0:7757ab3f7206 | 321 | return b; |
dicarloj | 0:7757ab3f7206 | 322 | } |
dicarloj | 0:7757ab3f7206 | 323 | |
dicarloj | 0:7757ab3f7206 | 324 | int16_t imax(int16_t a, int16_t b) |
dicarloj | 0:7757ab3f7206 | 325 | { |
dicarloj | 0:7757ab3f7206 | 326 | if(a>b) return a; |
dicarloj | 0:7757ab3f7206 | 327 | return b; |
dicarloj | 0:7757ab3f7206 | 328 | } |
dicarloj | 0:7757ab3f7206 | 329 | |
dicarloj | 0:7757ab3f7206 | 330 | void draw_line(int16_t x0, int16_t y0, int16_t x1, int16_t y1) |
dicarloj | 0:7757ab3f7206 | 331 | { |
dicarloj | 0:7757ab3f7206 | 332 | if(x0 > x1){ x0 = x0 ^ x1; x1 = x1^x0; x0 = x0^x1;y0 = y0 ^ y1; y1 = y1^y0; y0 = y0^y1; } |
dicarloj | 0:7757ab3f7206 | 333 | if(x0 == x1){draw_vert(y0,y1,x0);} |
dicarloj | 0:7757ab3f7206 | 334 | if(y0 == y1){draw_horiz(x0,x1,y0);} |
dicarloj | 0:7757ab3f7206 | 335 | int16_t dx = x1 - x0; |
dicarloj | 0:7757ab3f7206 | 336 | int16_t dy = y1 - y0; |
dicarloj | 0:7757ab3f7206 | 337 | float derr = fabs((float)(dy)/(float)(dx)); |
dicarloj | 0:7757ab3f7206 | 338 | float err = 0.f; |
dicarloj | 0:7757ab3f7206 | 339 | int16_t y = y0; |
dicarloj | 0:7757ab3f7206 | 340 | for(int16_t x = x0; x < x1; x++) |
dicarloj | 0:7757ab3f7206 | 341 | { |
dicarloj | 0:7757ab3f7206 | 342 | //plotxy |
dicarloj | 0:7757ab3f7206 | 343 | im_line_va[H_RES*y + x] = !draw_line_inv; |
dicarloj | 0:7757ab3f7206 | 344 | err += derr; |
dicarloj | 0:7757ab3f7206 | 345 | while(err >= 0.5f) |
dicarloj | 0:7757ab3f7206 | 346 | { |
dicarloj | 0:7757ab3f7206 | 347 | y += sign(dy); |
dicarloj | 0:7757ab3f7206 | 348 | im_line_va[H_RES*y + x] = !draw_line_inv; |
dicarloj | 0:7757ab3f7206 | 349 | err -= 1.f; |
dicarloj | 0:7757ab3f7206 | 350 | } |
dicarloj | 0:7757ab3f7206 | 351 | } |
dicarloj | 0:7757ab3f7206 | 352 | } |
dicarloj | 0:7757ab3f7206 | 353 | |
dicarloj | 0:7757ab3f7206 | 354 | void draw_cube(float cp[][3]) |
dicarloj | 0:7757ab3f7206 | 355 | { |
dicarloj | 0:7757ab3f7206 | 356 | for(uint8_t i = 0; i < 7; i++) |
dicarloj | 0:7757ab3f7206 | 357 | { |
dicarloj | 0:7757ab3f7206 | 358 | draw_line((int16_t)cp[i][0]+cube_a[0]+X_0,(int16_t)cp[i][1]+cube_a[1]+Y_0,(int16_t)cp[i+1][0]+cube_a[0]+X_0,(int16_t)cp[i+1][1]+cube_a[1]+Y_0); |
dicarloj | 0:7757ab3f7206 | 359 | } |
dicarloj | 0:7757ab3f7206 | 360 | draw_line((int16_t)cp[0][0]+cube_a[0]+X_0,(int16_t)cp[0][1]+cube_a[1]+Y_0,(int16_t)cp[3][0]+cube_a[0]+X_0,(int16_t)cp[3][1]+cube_a[1]+Y_0); |
dicarloj | 0:7757ab3f7206 | 361 | draw_line((int16_t)cp[4][0]+cube_a[0]+X_0,(int16_t)cp[4][1]+cube_a[1]+Y_0,(int16_t)cp[7][0]+cube_a[0]+X_0,(int16_t)cp[7][1]+cube_a[1]+Y_0); |
dicarloj | 0:7757ab3f7206 | 362 | draw_line((int16_t)cp[0][0]+cube_a[0]+X_0,(int16_t)cp[0][1]+cube_a[1]+Y_0,(int16_t)cp[7][0]+cube_a[0]+X_0,(int16_t)cp[7][1]+cube_a[1]+Y_0); |
dicarloj | 0:7757ab3f7206 | 363 | draw_line((int16_t)cp[1][0]+cube_a[0]+X_0,(int16_t)cp[1][1]+cube_a[1]+Y_0,(int16_t)cp[6][0]+cube_a[0]+X_0,(int16_t)cp[6][1]+cube_a[1]+Y_0); |
dicarloj | 0:7757ab3f7206 | 364 | draw_line((int16_t)cp[2][0]+cube_a[0]+X_0,(int16_t)cp[2][1]+cube_a[1]+Y_0,(int16_t)cp[5][0]+cube_a[0]+X_0,(int16_t)cp[5][1]+cube_a[1]+Y_0); |
dicarloj | 0:7757ab3f7206 | 365 | } |
dicarloj | 0:7757ab3f7206 | 366 | |
dicarloj | 0:7757ab3f7206 | 367 | void apply_rot(float cp[][3], float r[][3]) |
dicarloj | 0:7757ab3f7206 | 368 | { |
dicarloj | 0:7757ab3f7206 | 369 | for(uint8_t pti = 0; pti < 8; pti++) |
dicarloj | 0:7757ab3f7206 | 370 | { |
dicarloj | 0:7757ab3f7206 | 371 | float* cpt = cp[pti]; |
dicarloj | 0:7757ab3f7206 | 372 | float xn = r[0][0] * cpt[0] + r[0][1] * cpt[1] + r[0][2] * cpt[2]; |
dicarloj | 0:7757ab3f7206 | 373 | float yn = r[1][0] * cpt[0] + r[1][1] * cpt[1] + r[1][2] * cpt[2]; |
dicarloj | 0:7757ab3f7206 | 374 | float zn = r[2][0] * cpt[0] + r[2][1] * cpt[1] + r[2][2] * cpt[2]; |
dicarloj | 0:7757ab3f7206 | 375 | cpt[0] = xn; |
dicarloj | 0:7757ab3f7206 | 376 | cpt[1] = yn; |
dicarloj | 0:7757ab3f7206 | 377 | cpt[2] = zn; |
dicarloj | 0:7757ab3f7206 | 378 | } |
dicarloj | 0:7757ab3f7206 | 379 | } |
dicarloj | 0:7757ab3f7206 | 380 | |
dicarloj | 0:7757ab3f7206 | 381 | void apply_xf_rot(float cpt[], float r[][3]) |
dicarloj | 0:7757ab3f7206 | 382 | { |
dicarloj | 0:7757ab3f7206 | 383 | float xn = r[0][0] * cpt[0] + r[0][1] * cpt[1] + r[0][2] * cpt[2]; |
dicarloj | 0:7757ab3f7206 | 384 | float yn = r[1][0] * cpt[0] + r[1][1] * cpt[1] + r[1][2] * cpt[2]; |
dicarloj | 0:7757ab3f7206 | 385 | float zn = r[2][0] * cpt[0] + r[2][1] * cpt[1] + r[2][2] * cpt[2]; |
dicarloj | 0:7757ab3f7206 | 386 | cpt[0] = xn; |
dicarloj | 0:7757ab3f7206 | 387 | cpt[1] = yn; |
dicarloj | 0:7757ab3f7206 | 388 | cpt[2] = zn; |
dicarloj | 0:7757ab3f7206 | 389 | } |
dicarloj | 0:7757ab3f7206 | 390 | |
dicarloj | 0:7757ab3f7206 | 391 | void draw_v_check(int8_t r,uint8_t tt) |
dicarloj | 0:7757ab3f7206 | 392 | { |
dicarloj | 0:7757ab3f7206 | 393 | for(int i = 0; i < H_RES; i++) |
dicarloj | 0:7757ab3f7206 | 394 | for(int j = 0; j < V_RES; j++) |
dicarloj | 0:7757ab3f7206 | 395 | im_line_va[i+j*H_RES] = (((i > 20) && (i < 98)) && ( tt ^(((j%(r*2))>=r) ^ ((i%(r*2)))>=r))); //checkerboard |
dicarloj | 0:7757ab3f7206 | 396 | } |
dicarloj | 0:7757ab3f7206 | 397 | |
dicarloj | 0:7757ab3f7206 | 398 | |
dicarloj | 0:7757ab3f7206 | 399 | int jjj = 0; |
dicarloj | 0:7757ab3f7206 | 400 | int f_count = DEMO_LENGTH + 10; |
dicarloj | 0:7757ab3f7206 | 401 | void draw_cube_spin(int kkkk); |
dicarloj | 0:7757ab3f7206 | 402 | //update bouncing balls |
dicarloj | 0:7757ab3f7206 | 403 | |
dicarloj | 0:7757ab3f7206 | 404 | void draw_blank() |
dicarloj | 0:7757ab3f7206 | 405 | { |
dicarloj | 0:7757ab3f7206 | 406 | for(uint16_t h = X_MIN; h < X_MAX; h++) |
dicarloj | 0:7757ab3f7206 | 407 | { |
dicarloj | 0:7757ab3f7206 | 408 | for(uint16_t v = Y_MIN; v < Y_MAX+15; v++) |
dicarloj | 0:7757ab3f7206 | 409 | { |
dicarloj | 0:7757ab3f7206 | 410 | im_line_va[v*H_RES + h] = 0; |
dicarloj | 0:7757ab3f7206 | 411 | } |
dicarloj | 0:7757ab3f7206 | 412 | } |
dicarloj | 0:7757ab3f7206 | 413 | } |
dicarloj | 0:7757ab3f7206 | 414 | |
dicarloj | 0:7757ab3f7206 | 415 | void wipe(); |
dicarloj | 0:7757ab3f7206 | 416 | |
dicarloj | 0:7757ab3f7206 | 417 | void update_image() |
dicarloj | 0:7757ab3f7206 | 418 | { |
dicarloj | 0:7757ab3f7206 | 419 | //delay |
dicarloj | 0:7757ab3f7206 | 420 | k++; |
dicarloj | 0:7757ab3f7206 | 421 | if(k%4000) return; |
dicarloj | 0:7757ab3f7206 | 422 | f_count++; |
dicarloj | 0:7757ab3f7206 | 423 | if(f_count < DEMO_LENGTH/2) |
dicarloj | 0:7757ab3f7206 | 424 | { |
dicarloj | 0:7757ab3f7206 | 425 | draw_cube_spin(0); |
dicarloj | 0:7757ab3f7206 | 426 | } |
dicarloj | 0:7757ab3f7206 | 427 | else if(f_count < DEMO_LENGTH) |
dicarloj | 0:7757ab3f7206 | 428 | { |
bwang | 1:24fd07a24094 | 429 | draw_cube_spin(0); |
dicarloj | 0:7757ab3f7206 | 430 | } |
bwang | 1:24fd07a24094 | 431 | else if(f_count < DEMO_LENGTH * 1.22) |
dicarloj | 0:7757ab3f7206 | 432 | { |
dicarloj | 0:7757ab3f7206 | 433 | for(int k = 1; k < 10; k++) |
bwang | 1:24fd07a24094 | 434 | //for(int kk = 1; kk < 3; kk++) |
dicarloj | 0:7757ab3f7206 | 435 | { |
dicarloj | 0:7757ab3f7206 | 436 | draw_v_check(k,1); |
dicarloj | 0:7757ab3f7206 | 437 | draw_v_check(k,1); |
dicarloj | 0:7757ab3f7206 | 438 | draw_v_check(k,0); |
dicarloj | 0:7757ab3f7206 | 439 | draw_v_check(k,0); |
dicarloj | 0:7757ab3f7206 | 440 | } |
dicarloj | 0:7757ab3f7206 | 441 | |
dicarloj | 0:7757ab3f7206 | 442 | draw_v_check(1,0); |
dicarloj | 0:7757ab3f7206 | 443 | wipe(); |
dicarloj | 0:7757ab3f7206 | 444 | f_count = 0; |
dicarloj | 0:7757ab3f7206 | 445 | } |
dicarloj | 0:7757ab3f7206 | 446 | } |
dicarloj | 0:7757ab3f7206 | 447 | |
dicarloj | 0:7757ab3f7206 | 448 | void wipe() |
dicarloj | 0:7757ab3f7206 | 449 | { |
dicarloj | 0:7757ab3f7206 | 450 | for(int v = Y_MIN; v < Y_MAX+15; v++) |
dicarloj | 0:7757ab3f7206 | 451 | { |
dicarloj | 0:7757ab3f7206 | 452 | for(uint16_t h = X_MIN; h < X_MAX; h++) |
dicarloj | 0:7757ab3f7206 | 453 | { |
dicarloj | 0:7757ab3f7206 | 454 | im_line_va[v*H_RES+h] = 1; |
dicarloj | 0:7757ab3f7206 | 455 | } |
bwang | 1:24fd07a24094 | 456 | wait(.01); |
dicarloj | 0:7757ab3f7206 | 457 | } |
dicarloj | 0:7757ab3f7206 | 458 | |
dicarloj | 0:7757ab3f7206 | 459 | for(int v = Y_MAX+15; v > Y_MIN; v--) |
dicarloj | 0:7757ab3f7206 | 460 | { |
dicarloj | 0:7757ab3f7206 | 461 | for(uint16_t h = X_MIN; h < X_MAX; h++) |
dicarloj | 0:7757ab3f7206 | 462 | { |
dicarloj | 0:7757ab3f7206 | 463 | im_line_va[v*H_RES+h] = 0; |
dicarloj | 0:7757ab3f7206 | 464 | } |
bwang | 1:24fd07a24094 | 465 | wait(.005); |
dicarloj | 0:7757ab3f7206 | 466 | } |
dicarloj | 0:7757ab3f7206 | 467 | |
dicarloj | 0:7757ab3f7206 | 468 | for(uint16_t h = X_MIN; h < X_MAX; h++) |
dicarloj | 0:7757ab3f7206 | 469 | { |
dicarloj | 0:7757ab3f7206 | 470 | for(uint16_t v = Y_MIN; v < Y_MAX+15; v++) |
dicarloj | 0:7757ab3f7206 | 471 | { |
dicarloj | 0:7757ab3f7206 | 472 | im_line_va[v*H_RES + h] = 1; |
dicarloj | 0:7757ab3f7206 | 473 | } |
bwang | 1:24fd07a24094 | 474 | wait(.005); |
dicarloj | 0:7757ab3f7206 | 475 | } |
dicarloj | 0:7757ab3f7206 | 476 | |
dicarloj | 0:7757ab3f7206 | 477 | for(uint16_t h = X_MIN; h < X_MAX; h++) |
dicarloj | 0:7757ab3f7206 | 478 | { |
dicarloj | 0:7757ab3f7206 | 479 | for(uint16_t v = Y_MIN; v < Y_MAX+15; v++) |
dicarloj | 0:7757ab3f7206 | 480 | { |
dicarloj | 0:7757ab3f7206 | 481 | im_line_va[v*H_RES + h] = 0; |
dicarloj | 0:7757ab3f7206 | 482 | } |
bwang | 1:24fd07a24094 | 483 | wait(.005); |
dicarloj | 0:7757ab3f7206 | 484 | } |
dicarloj | 0:7757ab3f7206 | 485 | |
dicarloj | 0:7757ab3f7206 | 486 | for(int v = Y_MIN; v < Y_MAX+15; v++) |
dicarloj | 0:7757ab3f7206 | 487 | { |
dicarloj | 0:7757ab3f7206 | 488 | for(uint16_t h = X_MIN; h < X_MAX; h++) |
dicarloj | 0:7757ab3f7206 | 489 | { |
dicarloj | 0:7757ab3f7206 | 490 | im_line_va[v*H_RES+h] = 0; |
dicarloj | 0:7757ab3f7206 | 491 | } |
dicarloj | 0:7757ab3f7206 | 492 | } |
dicarloj | 0:7757ab3f7206 | 493 | } |
dicarloj | 0:7757ab3f7206 | 494 | |
dicarloj | 0:7757ab3f7206 | 495 | void draw_cube_spin(int kkkk) |
dicarloj | 0:7757ab3f7206 | 496 | { |
dicarloj | 0:7757ab3f7206 | 497 | draw_line_inv = kkkk; |
dicarloj | 0:7757ab3f7206 | 498 | //blank |
dicarloj | 0:7757ab3f7206 | 499 | for(uint16_t h = X_MIN; h < X_MAX; h++) |
dicarloj | 0:7757ab3f7206 | 500 | { |
dicarloj | 0:7757ab3f7206 | 501 | for(uint16_t v = Y_MIN; v < Y_MAX; v++) |
dicarloj | 0:7757ab3f7206 | 502 | { |
dicarloj | 0:7757ab3f7206 | 503 | if( (h > 22) && (h < 76+18)) |
dicarloj | 0:7757ab3f7206 | 504 | im_line_va[v*H_RES + h] = kkkk; |
dicarloj | 0:7757ab3f7206 | 505 | } |
dicarloj | 0:7757ab3f7206 | 506 | } |
dicarloj | 0:7757ab3f7206 | 507 | apply_xf_rot(cube_a,y_rot); |
dicarloj | 0:7757ab3f7206 | 508 | apply_xf_rot(cube_a,y_rot); |
dicarloj | 0:7757ab3f7206 | 509 | apply_rot(cube_pts,x_rot); |
dicarloj | 0:7757ab3f7206 | 510 | apply_rot(cube_pts,x_rot); |
dicarloj | 0:7757ab3f7206 | 511 | apply_rot(cube_pts,y_rot); |
dicarloj | 0:7757ab3f7206 | 512 | apply_rot(cube_pts,y_rot); |
dicarloj | 0:7757ab3f7206 | 513 | apply_rot(cube_pts,z_rot); |
dicarloj | 0:7757ab3f7206 | 514 | //draw ball |
dicarloj | 0:7757ab3f7206 | 515 | im_line_va[(py/10)*H_RES + (px/10)] = 1; |
dicarloj | 0:7757ab3f7206 | 516 | draw_line(X_0,Y_0,(px/10),(py/10)); |
dicarloj | 0:7757ab3f7206 | 517 | draw_cube(cube_pts); |
dicarloj | 0:7757ab3f7206 | 518 | |
dicarloj | 0:7757ab3f7206 | 519 | //update position/check for bounces |
dicarloj | 0:7757ab3f7206 | 520 | px += vx; |
dicarloj | 0:7757ab3f7206 | 521 | py += vy; |
dicarloj | 0:7757ab3f7206 | 522 | px2 += vx2; |
dicarloj | 0:7757ab3f7206 | 523 | py2 += vy2; |
dicarloj | 0:7757ab3f7206 | 524 | if(px/10 > (X_MAX-2) || px/10 < (X_MIN+1)) vx = -vx; |
dicarloj | 0:7757ab3f7206 | 525 | if(py/10 > (Y_MAX-2) || py/10 < (Y_MIN+1)) vy = -vy; |
dicarloj | 0:7757ab3f7206 | 526 | if(px2/10 > (X_MAX-2) || px2/10 < (X_MIN+1)) vx2 = -vx2; |
dicarloj | 0:7757ab3f7206 | 527 | if(py2/10 > (Y_MAX-2) || py2/10 < (Y_MIN+1)) vy2 = -vy2; |
dicarloj | 0:7757ab3f7206 | 528 | if(k%(8000*50)) return; |
dicarloj | 0:7757ab3f7206 | 529 | |
dicarloj | 0:7757ab3f7206 | 530 | jjj = !jjj; |
dicarloj | 0:7757ab3f7206 | 531 | int bmi = 0; |
dicarloj | 0:7757ab3f7206 | 532 | for(int y = BY_0; y < BY_0 + BY; y++) |
dicarloj | 0:7757ab3f7206 | 533 | { |
dicarloj | 0:7757ab3f7206 | 534 | for(int x = BX_0; x < BX_0 + BX; x++) |
dicarloj | 0:7757ab3f7206 | 535 | { |
dicarloj | 0:7757ab3f7206 | 536 | im_line_va[H_RES*y + x] = kkkk^(miters[bmi]*jjj + (!jjj)*tv[bmi]); |
dicarloj | 0:7757ab3f7206 | 537 | bmi++; |
dicarloj | 0:7757ab3f7206 | 538 | } |
dicarloj | 0:7757ab3f7206 | 539 | } |
dicarloj | 0:7757ab3f7206 | 540 | } |
dicarloj | 0:7757ab3f7206 | 541 | |
bwang | 3:d9edc0575aa3 | 542 | int flappy_pong() { |
bwang | 3:d9edc0575aa3 | 543 | |
bwang | 3:d9edc0575aa3 | 544 | //clear frame |
bwang | 3:d9edc0575aa3 | 545 | for(int y = 0; y < PADDLE_LEN; y++) { |
bwang | 3:d9edc0575aa3 | 546 | im_line_va[H_RES*(y+(int)p1)+SX_MIN] = 0; |
bwang | 3:d9edc0575aa3 | 547 | im_line_va[H_RES*(y+(int)p2)+SX_MAX] = 0; |
bwang | 3:d9edc0575aa3 | 548 | } |
bwang | 3:d9edc0575aa3 | 549 | im_line_va[H_RES*(int)by+(int)bx] = 0; |
bwang | 3:d9edc0575aa3 | 550 | //read inputs |
bwang | 3:d9edc0575aa3 | 551 | int cmd1 = p1_in.read(); |
bwang | 3:d9edc0575aa3 | 552 | int cmd2 = p2_in.read(); |
bwang | 3:d9edc0575aa3 | 553 | if (cmd1 == 0) p1v = 0.1; else p1v = -0.1f; |
bwang | 3:d9edc0575aa3 | 554 | if (cmd2 == 0) p2v = 0.1; else p2v = -0.1f; |
bwang | 3:d9edc0575aa3 | 555 | |
bwang | 3:d9edc0575aa3 | 556 | p1 += p1v; |
bwang | 3:d9edc0575aa3 | 557 | p2 += p2v; |
bwang | 3:d9edc0575aa3 | 558 | bx += bxv; |
bwang | 3:d9edc0575aa3 | 559 | by += byv; |
bwang | 3:d9edc0575aa3 | 560 | |
bwang | 3:d9edc0575aa3 | 561 | if (p1 < SY_MIN) p1 = SY_MIN; |
bwang | 3:d9edc0575aa3 | 562 | if (p1 > SY_MAX-PADDLE_LEN) p1 = SY_MAX-PADDLE_LEN; |
bwang | 3:d9edc0575aa3 | 563 | if (p2 < SY_MIN) p2 = SY_MIN; |
bwang | 3:d9edc0575aa3 | 564 | if (p2 > SY_MAX-PADDLE_LEN) p2 = SY_MAX-PADDLE_LEN; |
bwang | 3:d9edc0575aa3 | 565 | |
bwang | 3:d9edc0575aa3 | 566 | if (bx < SX_MIN) { |
bwang | 3:d9edc0575aa3 | 567 | bxv = -bxv; |
bwang | 3:d9edc0575aa3 | 568 | bx = SX_MIN; |
bwang | 3:d9edc0575aa3 | 569 | if (by < p1 - 3 || by > p1 + PADDLE_LEN + 3) { |
bwang | 3:d9edc0575aa3 | 570 | im_line_va[H_RES*(SY_MIN-2)+2*s1+SX_MIN] = 1; |
bwang | 3:d9edc0575aa3 | 571 | bx = (SX_MIN+SX_MAX)/2, by = (SY_MIN+SY_MAX)/2; |
bwang | 3:d9edc0575aa3 | 572 | s1++; |
bwang | 3:d9edc0575aa3 | 573 | if (s1>14) return 0; |
bwang | 3:d9edc0575aa3 | 574 | } |
bwang | 3:d9edc0575aa3 | 575 | } |
bwang | 3:d9edc0575aa3 | 576 | if (bx > SX_MAX) { |
bwang | 3:d9edc0575aa3 | 577 | bxv = -bxv; |
bwang | 3:d9edc0575aa3 | 578 | bx = SX_MAX; |
bwang | 3:d9edc0575aa3 | 579 | if (by < p2 - 3 || by > p2 + PADDLE_LEN + 3) { |
bwang | 3:d9edc0575aa3 | 580 | im_line_va[H_RES*(SY_MAX+2)+2*s2+SX_MIN] = 1; |
bwang | 3:d9edc0575aa3 | 581 | bx = (SX_MIN+SX_MAX)/2, by = (SY_MIN+SY_MAX)/2; |
bwang | 3:d9edc0575aa3 | 582 | s2++; |
bwang | 3:d9edc0575aa3 | 583 | if (s2>14) return 0; |
bwang | 3:d9edc0575aa3 | 584 | } |
bwang | 3:d9edc0575aa3 | 585 | } |
bwang | 3:d9edc0575aa3 | 586 | if (by < SY_MIN) {byv = -byv; by = SY_MIN;} |
bwang | 3:d9edc0575aa3 | 587 | if (by > SY_MAX) {byv = -byv; by = SY_MAX;} |
bwang | 3:d9edc0575aa3 | 588 | |
bwang | 1:24fd07a24094 | 589 | for(int y = 0; y < PADDLE_LEN; y++) { |
bwang | 1:24fd07a24094 | 590 | im_line_va[H_RES*(y+(int)p1)+SX_MIN] = 1; |
bwang | 1:24fd07a24094 | 591 | im_line_va[H_RES*(y+(int)p2)+SX_MAX] = 1; |
bwang | 1:24fd07a24094 | 592 | } |
bwang | 1:24fd07a24094 | 593 | im_line_va[H_RES*(int)by+(int)bx] = 1; |
bwang | 3:d9edc0575aa3 | 594 | |
bwang | 3:d9edc0575aa3 | 595 | wait(1/1200.0f); |
bwang | 3:d9edc0575aa3 | 596 | return 1; |
bwang | 3:d9edc0575aa3 | 597 | } |
bwang | 3:d9edc0575aa3 | 598 | |
bwang | 3:d9edc0575aa3 | 599 | int fishy() { |
bwang | 3:d9edc0575aa3 | 600 | uint16_t xstart, ystart, xend, yend; |
bwang | 3:d9edc0575aa3 | 601 | float s = sinf(ftheta); |
bwang | 3:d9edc0575aa3 | 602 | float c = cosf(ftheta); |
bwang | 3:d9edc0575aa3 | 603 | |
bwang | 3:d9edc0575aa3 | 604 | xstart = (uint16_t) fx; |
bwang | 3:d9edc0575aa3 | 605 | ystart = (uint16_t) fy; |
bwang | 3:d9edc0575aa3 | 606 | |
bwang | 3:d9edc0575aa3 | 607 | |
bwang | 3:d9edc0575aa3 | 608 | for(int x = xstart-5; x < xstart + 5; x++) { |
bwang | 3:d9edc0575aa3 | 609 | for (int y = ystart - 5; y < ystart + 5; y++) { |
bwang | 3:d9edc0575aa3 | 610 | im_line_va[H_RES*y+x] = 0; |
bwang | 3:d9edc0575aa3 | 611 | } |
bwang | 3:d9edc0575aa3 | 612 | } |
bwang | 3:d9edc0575aa3 | 613 | for (int i = 0; i < 8; i++) { |
bwang | 3:d9edc0575aa3 | 614 | int index = H_RES*(int)uy[i]+(int)ux[i]; |
bwang | 3:d9edc0575aa3 | 615 | im_line_va[index] = 0; |
bwang | 3:d9edc0575aa3 | 616 | } |
bwang | 3:d9edc0575aa3 | 617 | |
bwang | 3:d9edc0575aa3 | 618 | float fx_old = fx, fy_old = fy; |
bwang | 3:d9edc0575aa3 | 619 | fx += fv * s; |
bwang | 3:d9edc0575aa3 | 620 | fy += fv * c; |
bwang | 3:d9edc0575aa3 | 621 | int cmd = p1_in.read(); |
bwang | 3:d9edc0575aa3 | 622 | if (cmd) ftheta += fa; else ftheta -= fa; |
bwang | 3:d9edc0575aa3 | 623 | if (ftheta >= 2 * 3.1415926) ftheta -= 2 * 3.1415926; |
bwang | 3:d9edc0575aa3 | 624 | if (ftheta < 0) ftheta += 2 * 3.1415926; |
bwang | 3:d9edc0575aa3 | 625 | |
bwang | 3:d9edc0575aa3 | 626 | s = sinf(ftheta); |
bwang | 3:d9edc0575aa3 | 627 | c = cosf(ftheta); |
bwang | 3:d9edc0575aa3 | 628 | |
bwang | 3:d9edc0575aa3 | 629 | xstart = (uint16_t)fx; |
bwang | 3:d9edc0575aa3 | 630 | ystart = (uint16_t)fy; |
bwang | 3:d9edc0575aa3 | 631 | xend = (uint16_t)(fx+s*4); |
bwang | 3:d9edc0575aa3 | 632 | yend = (uint16_t)(fy+c*4); |
bwang | 3:d9edc0575aa3 | 633 | |
bwang | 3:d9edc0575aa3 | 634 | if (xstart < SX_MIN || xstart > SX_MAX || |
bwang | 3:d9edc0575aa3 | 635 | ystart < SY_MIN || ystart > SY_MAX || |
bwang | 3:d9edc0575aa3 | 636 | xend < SX_MIN || xend > SX_MAX || |
bwang | 3:d9edc0575aa3 | 637 | yend < SY_MIN || yend > SY_MAX) { |
bwang | 3:d9edc0575aa3 | 638 | fx = fx_old; |
bwang | 3:d9edc0575aa3 | 639 | fy = fy_old; |
bwang | 3:d9edc0575aa3 | 640 | xstart = (uint16_t)fx; |
bwang | 3:d9edc0575aa3 | 641 | ystart = (uint16_t)fy; |
bwang | 3:d9edc0575aa3 | 642 | xend = (uint16_t)(fx+s*4); |
bwang | 3:d9edc0575aa3 | 643 | yend = (uint16_t)(fy+c*4); |
bwang | 3:d9edc0575aa3 | 644 | } |
bwang | 3:d9edc0575aa3 | 645 | |
bwang | 3:d9edc0575aa3 | 646 | draw_line(xstart, ystart, xend, yend); |
bwang | 3:d9edc0575aa3 | 647 | for (int i = 0; i < 8; i++) { |
bwang | 3:d9edc0575aa3 | 648 | if (!ulive[i]) continue; |
bwang | 3:d9edc0575aa3 | 649 | if (xstart == (int)ux[i] && ystart == (int)uy[i]) { |
bwang | 3:d9edc0575aa3 | 650 | fdeath_ticker = FDEATH_RESET; |
bwang | 3:d9edc0575aa3 | 651 | fs+=1; |
bwang | 3:d9edc0575aa3 | 652 | ulive[i] = 0; |
bwang | 3:d9edc0575aa3 | 653 | } |
bwang | 3:d9edc0575aa3 | 654 | ux[i]+= uv*uvx[i]; |
bwang | 3:d9edc0575aa3 | 655 | uy[i]+= uv*uvy[i]; |
bwang | 3:d9edc0575aa3 | 656 | if (ux[i] < SX_MIN) {ux[i] = SX_MIN; uvx[i] = -uvx[i];} |
bwang | 3:d9edc0575aa3 | 657 | if (ux[i] > SX_MAX) {ux[i] = SX_MAX; uvx[i] = -uvx[i];} |
bwang | 3:d9edc0575aa3 | 658 | if (uy[i] < SY_MIN) {uy[i] = SY_MIN; uvy[i] = -uvy[i];} |
bwang | 3:d9edc0575aa3 | 659 | if (uy[i] > SY_MAX) {uy[i] = SY_MAX; uvy[i] = -uvy[i];} |
bwang | 3:d9edc0575aa3 | 660 | |
bwang | 3:d9edc0575aa3 | 661 | int index = H_RES*(int)uy[i]+(int)ux[i]; |
bwang | 3:d9edc0575aa3 | 662 | im_line_va[index] = 1; |
bwang | 3:d9edc0575aa3 | 663 | } |
bwang | 3:d9edc0575aa3 | 664 | for (int i = 0; i < 8; i++) { |
bwang | 3:d9edc0575aa3 | 665 | im_line_va[H_RES*(SY_MAX+6)+2*(int)i+SX_MIN] = 0; |
bwang | 3:d9edc0575aa3 | 666 | } |
bwang | 3:d9edc0575aa3 | 667 | for (int i = 0; i < fs; i++) { |
bwang | 3:d9edc0575aa3 | 668 | im_line_va[H_RES*(SY_MAX+6)+2*(int)i+SX_MIN] = 1; |
bwang | 3:d9edc0575aa3 | 669 | } |
bwang | 3:d9edc0575aa3 | 670 | fdeath_ticker--; |
bwang | 3:d9edc0575aa3 | 671 | if (fdeath_ticker < 0) fs -= 0.0001f; |
bwang | 3:d9edc0575aa3 | 672 | if (fs < 0) fs = 0; |
bwang | 3:d9edc0575aa3 | 673 | |
bwang | 3:d9edc0575aa3 | 674 | return 1; |
bwang | 3:d9edc0575aa3 | 675 | } |
bwang | 3:d9edc0575aa3 | 676 | |
bwang | 3:d9edc0575aa3 | 677 | void dispchr(int x0, int y0, uint8_t* chr) { |
bwang | 3:d9edc0575aa3 | 678 | int bmi = 0; |
bwang | 3:d9edc0575aa3 | 679 | for(int y = SY_MIN + y0; y < SY_MIN + y0 + 7; y++) |
bwang | 1:24fd07a24094 | 680 | { |
bwang | 3:d9edc0575aa3 | 681 | for(int x = SX_MIN + x0; x < SX_MIN + x0 + 6; x++) |
bwang | 3:d9edc0575aa3 | 682 | { |
bwang | 3:d9edc0575aa3 | 683 | im_line_va[H_RES*y + x] = chr[bmi]; |
bwang | 3:d9edc0575aa3 | 684 | bmi++; |
bwang | 1:24fd07a24094 | 685 | } |
bwang | 3:d9edc0575aa3 | 686 | } |
bwang | 3:d9edc0575aa3 | 687 | } |
bwang | 3:d9edc0575aa3 | 688 | |
bwang | 3:d9edc0575aa3 | 689 | int main() { |
bwang | 3:d9edc0575aa3 | 690 | potato: |
bwang | 3:d9edc0575aa3 | 691 | init_buffers(); |
bwang | 3:d9edc0575aa3 | 692 | t.attach_us(&isr,63); |
bwang | 3:d9edc0575aa3 | 693 | |
bwang | 3:d9edc0575aa3 | 694 | int bmi = 0; |
bwang | 3:d9edc0575aa3 | 695 | |
bwang | 3:d9edc0575aa3 | 696 | for(int y = SY_MIN; y < SY_MIN + BY; y++) |
bwang | 3:d9edc0575aa3 | 697 | { |
bwang | 3:d9edc0575aa3 | 698 | for(int x = SX_MIN; x < SX_MIN + BX; x++) |
bwang | 3:d9edc0575aa3 | 699 | { |
bwang | 3:d9edc0575aa3 | 700 | im_line_va[H_RES*y + x] = miters[bmi]; |
bwang | 3:d9edc0575aa3 | 701 | bmi++; |
bwang | 3:d9edc0575aa3 | 702 | } |
bwang | 3:d9edc0575aa3 | 703 | } |
bwang | 3:d9edc0575aa3 | 704 | |
bwang | 3:d9edc0575aa3 | 705 | dispchr(4, BY+2, chr_P); |
bwang | 3:d9edc0575aa3 | 706 | dispchr(11, BY+2, chr_A); |
bwang | 3:d9edc0575aa3 | 707 | dispchr(18, BY+2, chr_N); |
bwang | 3:d9edc0575aa3 | 708 | dispchr(25, BY+2, chr_G); |
bwang | 3:d9edc0575aa3 | 709 | |
bwang | 3:d9edc0575aa3 | 710 | dispchr(4, BY+10, chr_F); |
bwang | 3:d9edc0575aa3 | 711 | dispchr(11, BY+10, chr_A); |
bwang | 3:d9edc0575aa3 | 712 | dispchr(18, BY+10, chr_S); |
bwang | 3:d9edc0575aa3 | 713 | dispchr(25, BY+10, chr_H); |
bwang | 3:d9edc0575aa3 | 714 | |
bwang | 3:d9edc0575aa3 | 715 | dispchr(4, BY+18, chr_D); |
bwang | 3:d9edc0575aa3 | 716 | dispchr(11, BY+18, chr_A); |
bwang | 3:d9edc0575aa3 | 717 | dispchr(18, BY+18, chr_M); |
bwang | 3:d9edc0575aa3 | 718 | dispchr(25, BY+18, chr_O); |
bwang | 3:d9edc0575aa3 | 719 | |
bwang | 3:d9edc0575aa3 | 720 | int cursor_pos = 0; |
bwang | 3:d9edc0575aa3 | 721 | |
bwang | 3:d9edc0575aa3 | 722 | for (;;) { |
bwang | 1:24fd07a24094 | 723 | int cmd1 = p1_in.read(); |
bwang | 1:24fd07a24094 | 724 | int cmd2 = p2_in.read(); |
bwang | 3:d9edc0575aa3 | 725 | |
bwang | 3:d9edc0575aa3 | 726 | int cursor_x = SX_MIN; |
bwang | 3:d9edc0575aa3 | 727 | int cursor_y = SY_MIN + 8*cursor_pos + BY + 5; |
bwang | 1:24fd07a24094 | 728 | |
bwang | 3:d9edc0575aa3 | 729 | if (cmd1 || cmd2) im_line_va[H_RES*cursor_y+cursor_x] = 0; |
bwang | 1:24fd07a24094 | 730 | |
bwang | 3:d9edc0575aa3 | 731 | if (!cmd1) cursor_pos++; |
bwang | 3:d9edc0575aa3 | 732 | if (!cmd2) cursor_pos--; |
bwang | 3:d9edc0575aa3 | 733 | if (!cmd1 && !cmd2) break; |
bwang | 1:24fd07a24094 | 734 | |
bwang | 3:d9edc0575aa3 | 735 | if (cursor_pos < 0) cursor_pos = 0; |
bwang | 3:d9edc0575aa3 | 736 | if (cursor_pos > 2) cursor_pos = 2; |
bwang | 1:24fd07a24094 | 737 | |
bwang | 3:d9edc0575aa3 | 738 | cursor_x = SX_MIN; |
bwang | 3:d9edc0575aa3 | 739 | cursor_y = SY_MIN + 8*cursor_pos + BY + 5; |
bwang | 1:24fd07a24094 | 740 | |
bwang | 3:d9edc0575aa3 | 741 | im_line_va[H_RES*cursor_y+cursor_x] = 1; |
bwang | 3:d9edc0575aa3 | 742 | |
bwang | 3:d9edc0575aa3 | 743 | wait(0.1); |
bwang | 1:24fd07a24094 | 744 | } |
bwang | 1:24fd07a24094 | 745 | |
bwang | 3:d9edc0575aa3 | 746 | init_buffers(); |
bwang | 2:1d16e99f334b | 747 | |
bwang | 3:d9edc0575aa3 | 748 | if (cursor_pos == 0) { |
bwang | 3:d9edc0575aa3 | 749 | for (;;) { |
bwang | 3:d9edc0575aa3 | 750 | if (!flappy_pong()) break; |
bwang | 3:d9edc0575aa3 | 751 | } |
bwang | 3:d9edc0575aa3 | 752 | } else if (cursor_pos == 1) { |
bwang | 3:d9edc0575aa3 | 753 | for (;;) fishy(); |
bwang | 3:d9edc0575aa3 | 754 | } else { |
bwang | 3:d9edc0575aa3 | 755 | for (;;) update_image(); |
dicarloj | 0:7757ab3f7206 | 756 | } |
bwang | 3:d9edc0575aa3 | 757 | goto potato; |
dicarloj | 0:7757ab3f7206 | 758 | } |