megadrive_test2
changeset 8:403367d5df5a
added 8x8 font data
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 22 Jun 2017 07:44:48 +0300 |
parents | 108ecc582a11 |
children | 6ecf2f3ff05a |
files | src/dbgfont.h src/debug.c src/debug.h src/io.h src/main.c src/vdp.h |
diffstat | 6 files changed, 943 insertions(+), 2 deletions(-) [+] |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/dbgfont.h Thu Jun 22 07:44:48 2017 +0300 1.3 @@ -0,0 +1,868 @@ 1.4 +#ifndef DBGFONT_H_ 1.5 +#define DBGFONT_H_ 1.6 + 1.7 +#define ROM __attribute__((section(".rodata"))) 1.8 + 1.9 +#define FONT_FIRST 32 1.10 +#define FONT_COUNT (sizeof font / sizeof *font) 1.11 + 1.12 +static unsigned long font[][8] ROM = { 1.13 + { 1.14 + 0x00000000, 1.15 + 0x00000000, 1.16 + 0x00000000, 1.17 + 0x00000000, 1.18 + 0x00000000, 1.19 + 0x00000000, 1.20 + 0x00000000, 1.21 + 0x00000000 1.22 + }, { 1.23 + 0x00ff0000, 1.24 + 0x0ffff000, 1.25 + 0x0ffff000, 1.26 + 0x00ff0000, 1.27 + 0x00ff0000, 1.28 + 0x00000000, 1.29 + 0x00ff0000, 1.30 + 0x00000000 1.31 + }, { 1.32 + 0x0ff0ff00, 1.33 + 0x0ff0ff00, 1.34 + 0x0ff0ff00, 1.35 + 0x00000000, 1.36 + 0x00000000, 1.37 + 0x00000000, 1.38 + 0x00000000, 1.39 + 0x00000000 1.40 + }, { 1.41 + 0x0ff0ff00, 1.42 + 0x0ff0ff00, 1.43 + 0xfffffff0, 1.44 + 0x0ff0ff00, 1.45 + 0xfffffff0, 1.46 + 0x0ff0ff00, 1.47 + 0x0ff0ff00, 1.48 + 0x00000000 1.49 + }, { 1.50 + 0x00ff0000, 1.51 + 0x0fffff00, 1.52 + 0xff000000, 1.53 + 0x0ffff000, 1.54 + 0x0000ff00, 1.55 + 0xfffff000, 1.56 + 0x00ff0000, 1.57 + 0x00000000 1.58 + }, { 1.59 + 0x00000000, 1.60 + 0xff000ff0, 1.61 + 0xff00ff00, 1.62 + 0x000ff000, 1.63 + 0x00ff0000, 1.64 + 0x0ff00ff0, 1.65 + 0xff000ff0, 1.66 + 0x00000000 1.67 + }, { 1.68 + 0x00fff000, 1.69 + 0x0ff0ff00, 1.70 + 0x00fff000, 1.71 + 0x0fff0ff0, 1.72 + 0xff0fff00, 1.73 + 0xff00ff00, 1.74 + 0x0fff0ff0, 1.75 + 0x00000000 1.76 + }, { 1.77 + 0x0ff00000, 1.78 + 0x0ff00000, 1.79 + 0xff000000, 1.80 + 0x00000000, 1.81 + 0x00000000, 1.82 + 0x00000000, 1.83 + 0x00000000, 1.84 + 0x00000000 1.85 + }, { 1.86 + 0x000ff000, 1.87 + 0x00ff0000, 1.88 + 0x0ff00000, 1.89 + 0x0ff00000, 1.90 + 0x0ff00000, 1.91 + 0x00ff0000, 1.92 + 0x000ff000, 1.93 + 0x00000000 1.94 + }, { 1.95 + 0x0ff00000, 1.96 + 0x00ff0000, 1.97 + 0x000ff000, 1.98 + 0x000ff000, 1.99 + 0x000ff000, 1.100 + 0x00ff0000, 1.101 + 0x0ff00000, 1.102 + 0x00000000 1.103 + }, { 1.104 + 0x00000000, 1.105 + 0x0ff00ff0, 1.106 + 0x00ffff00, 1.107 + 0xffffffff, 1.108 + 0x00ffff00, 1.109 + 0x0ff00ff0, 1.110 + 0x00000000, 1.111 + 0x00000000 1.112 + }, { 1.113 + 0x00000000, 1.114 + 0x00ff0000, 1.115 + 0x00ff0000, 1.116 + 0xffffff00, 1.117 + 0x00ff0000, 1.118 + 0x00ff0000, 1.119 + 0x00000000, 1.120 + 0x00000000 1.121 + }, { 1.122 + 0x00000000, 1.123 + 0x00000000, 1.124 + 0x00000000, 1.125 + 0x00000000, 1.126 + 0x00000000, 1.127 + 0x00ff0000, 1.128 + 0x00ff0000, 1.129 + 0x0ff00000 1.130 + }, { 1.131 + 0x00000000, 1.132 + 0x00000000, 1.133 + 0x00000000, 1.134 + 0xffffff00, 1.135 + 0x00000000, 1.136 + 0x00000000, 1.137 + 0x00000000, 1.138 + 0x00000000 1.139 + }, { 1.140 + 0x00000000, 1.141 + 0x00000000, 1.142 + 0x00000000, 1.143 + 0x00000000, 1.144 + 0x00000000, 1.145 + 0x00ff0000, 1.146 + 0x00ff0000, 1.147 + 0x00000000 1.148 + }, { 1.149 + 0x00000ff0, 1.150 + 0x0000ff00, 1.151 + 0x000ff000, 1.152 + 0x00ff0000, 1.153 + 0x0ff00000, 1.154 + 0xff000000, 1.155 + 0xf0000000, 1.156 + 0x00000000 1.157 + }, { 1.158 + 0x0fffff00, 1.159 + 0xff000ff0, 1.160 + 0xff00fff0, 1.161 + 0xff0ffff0, 1.162 + 0xffff0ff0, 1.163 + 0xfff00ff0, 1.164 + 0x0fffff00, 1.165 + 0x00000000 1.166 + }, { 1.167 + 0x00ff0000, 1.168 + 0x0fff0000, 1.169 + 0x00ff0000, 1.170 + 0x00ff0000, 1.171 + 0x00ff0000, 1.172 + 0x00ff0000, 1.173 + 0xffffff00, 1.174 + 0x00000000 1.175 + }, { 1.176 + 0x0ffff000, 1.177 + 0xff00ff00, 1.178 + 0x0000ff00, 1.179 + 0x00fff000, 1.180 + 0x0ff00000, 1.181 + 0xff000f00, 1.182 + 0xffffff00, 1.183 + 0x00000000 1.184 + }, { 1.185 + 0x0ffff000, 1.186 + 0xff00ff00, 1.187 + 0x0000ff00, 1.188 + 0x00fff000, 1.189 + 0x0000ff00, 1.190 + 0xff00ff00, 1.191 + 0x0ffff000, 1.192 + 0x00000000 1.193 + }, { 1.194 + 0x000fff00, 1.195 + 0x00ffff00, 1.196 + 0x0ff0ff00, 1.197 + 0xff00ff00, 1.198 + 0xfffffff0, 1.199 + 0x0000ff00, 1.200 + 0x000ffff0, 1.201 + 0x00000000 1.202 + }, { 1.203 + 0xffffff00, 1.204 + 0xff000000, 1.205 + 0xfffff000, 1.206 + 0x0000ff00, 1.207 + 0x0000ff00, 1.208 + 0xff00ff00, 1.209 + 0x0ffff000, 1.210 + 0x00000000 1.211 + }, { 1.212 + 0x00fff000, 1.213 + 0x0ff00000, 1.214 + 0xff000000, 1.215 + 0xfffff000, 1.216 + 0xff00ff00, 1.217 + 0xff00ff00, 1.218 + 0x0ffff000, 1.219 + 0x00000000 1.220 + }, { 1.221 + 0xffffff00, 1.222 + 0xff00ff00, 1.223 + 0x0000ff00, 1.224 + 0x000ff000, 1.225 + 0x00ff0000, 1.226 + 0x00ff0000, 1.227 + 0x00ff0000, 1.228 + 0x00000000 1.229 + }, { 1.230 + 0x0ffff000, 1.231 + 0xff00ff00, 1.232 + 0xff00ff00, 1.233 + 0x0ffff000, 1.234 + 0xff00ff00, 1.235 + 0xff00ff00, 1.236 + 0x0ffff000, 1.237 + 0x00000000 1.238 + }, { 1.239 + 0x0ffff000, 1.240 + 0xff00ff00, 1.241 + 0xff00ff00, 1.242 + 0x0fffff00, 1.243 + 0x0000ff00, 1.244 + 0x000ff000, 1.245 + 0x0fff0000, 1.246 + 0x00000000 1.247 + }, { 1.248 + 0x00000000, 1.249 + 0x00ff0000, 1.250 + 0x00ff0000, 1.251 + 0x00000000, 1.252 + 0x00000000, 1.253 + 0x00ff0000, 1.254 + 0x00ff0000, 1.255 + 0x00000000 1.256 + }, { 1.257 + 0x00000000, 1.258 + 0x00ff0000, 1.259 + 0x00ff0000, 1.260 + 0x00000000, 1.261 + 0x00ff0000, 1.262 + 0x00ff0000, 1.263 + 0x0ff00000, 1.264 + 0x00000000 1.265 + }, { 1.266 + 0x000ff000, 1.267 + 0x00ff0000, 1.268 + 0x0ff00000, 1.269 + 0xff000000, 1.270 + 0x0ff00000, 1.271 + 0x00ff0000, 1.272 + 0x000ff000, 1.273 + 0x00000000 1.274 + }, { 1.275 + 0x00000000, 1.276 + 0x00000000, 1.277 + 0xffffff00, 1.278 + 0x00000000, 1.279 + 0x00000000, 1.280 + 0xffffff00, 1.281 + 0x00000000, 1.282 + 0x00000000 1.283 + }, { 1.284 + 0x0ff00000, 1.285 + 0x00ff0000, 1.286 + 0x000ff000, 1.287 + 0x0000ff00, 1.288 + 0x000ff000, 1.289 + 0x00ff0000, 1.290 + 0x0ff00000, 1.291 + 0x00000000 1.292 + }, { 1.293 + 0x0ffff000, 1.294 + 0xff00ff00, 1.295 + 0x0000ff00, 1.296 + 0x000ff000, 1.297 + 0x00ff0000, 1.298 + 0x00000000, 1.299 + 0x00ff0000, 1.300 + 0x00000000 1.301 + }, { 1.302 + 0x0fffff00, 1.303 + 0xff000ff0, 1.304 + 0xff0ffff0, 1.305 + 0xff0ffff0, 1.306 + 0xff0ffff0, 1.307 + 0xff000000, 1.308 + 0x0ffff000, 1.309 + 0x00000000 1.310 + }, { 1.311 + 0x00ff0000, 1.312 + 0x0ffff000, 1.313 + 0xff00ff00, 1.314 + 0xff00ff00, 1.315 + 0xffffff00, 1.316 + 0xff00ff00, 1.317 + 0xff00ff00, 1.318 + 0x00000000 1.319 + }, { 1.320 + 0xffffff00, 1.321 + 0x0ff00ff0, 1.322 + 0x0ff00ff0, 1.323 + 0x0fffff00, 1.324 + 0x0ff00ff0, 1.325 + 0x0ff00ff0, 1.326 + 0xffffff00, 1.327 + 0x00000000 1.328 + }, { 1.329 + 0x00ffff00, 1.330 + 0x0ff00ff0, 1.331 + 0xff000000, 1.332 + 0xff000000, 1.333 + 0xff000000, 1.334 + 0x0ff00ff0, 1.335 + 0x00ffff00, 1.336 + 0x00000000 1.337 + }, { 1.338 + 0xfffff000, 1.339 + 0x0ff0ff00, 1.340 + 0x0ff00ff0, 1.341 + 0x0ff00ff0, 1.342 + 0x0ff00ff0, 1.343 + 0x0ff0ff00, 1.344 + 0xfffff000, 1.345 + 0x00000000 1.346 + }, { 1.347 + 0xfffffff0, 1.348 + 0x0ff000f0, 1.349 + 0x0ff0f000, 1.350 + 0x0ffff000, 1.351 + 0x0ff0f000, 1.352 + 0x0ff000f0, 1.353 + 0xfffffff0, 1.354 + 0x00000000 1.355 + }, { 1.356 + 0xfffffff0, 1.357 + 0x0ff000f0, 1.358 + 0x0ff0f000, 1.359 + 0x0ffff000, 1.360 + 0x0ff0f000, 1.361 + 0x0ff00000, 1.362 + 0xffff0000, 1.363 + 0x00000000 1.364 + }, { 1.365 + 0x00ffff00, 1.366 + 0x0ff00ff0, 1.367 + 0xff000000, 1.368 + 0xff000000, 1.369 + 0xff00fff0, 1.370 + 0x0ff00ff0, 1.371 + 0x00fffff0, 1.372 + 0x00000000 1.373 + }, { 1.374 + 0xff00ff00, 1.375 + 0xff00ff00, 1.376 + 0xff00ff00, 1.377 + 0xffffff00, 1.378 + 0xff00ff00, 1.379 + 0xff00ff00, 1.380 + 0xff00ff00, 1.381 + 0x00000000 1.382 + }, { 1.383 + 0x0ffff000, 1.384 + 0x00ff0000, 1.385 + 0x00ff0000, 1.386 + 0x00ff0000, 1.387 + 0x00ff0000, 1.388 + 0x00ff0000, 1.389 + 0x0ffff000, 1.390 + 0x00000000 1.391 + }, { 1.392 + 0x000ffff0, 1.393 + 0x0000ff00, 1.394 + 0x0000ff00, 1.395 + 0x0000ff00, 1.396 + 0xff00ff00, 1.397 + 0xff00ff00, 1.398 + 0x0ffff000, 1.399 + 0x00000000 1.400 + }, { 1.401 + 0xfff00ff0, 1.402 + 0x0ff00ff0, 1.403 + 0x0ff0ff00, 1.404 + 0x0ffff000, 1.405 + 0x0ff0ff00, 1.406 + 0x0ff00ff0, 1.407 + 0xfff00ff0, 1.408 + 0x00000000 1.409 + }, { 1.410 + 0xffff0000, 1.411 + 0x0ff00000, 1.412 + 0x0ff00000, 1.413 + 0x0ff00000, 1.414 + 0x0ff000f0, 1.415 + 0x0ff00ff0, 1.416 + 0xfffffff0, 1.417 + 0x00000000 1.418 + }, { 1.419 + 0xff000ff0, 1.420 + 0xfff0fff0, 1.421 + 0xfffffff0, 1.422 + 0xfffffff0, 1.423 + 0xff0f0ff0, 1.424 + 0xff000ff0, 1.425 + 0xff000ff0, 1.426 + 0x00000000 1.427 + }, { 1.428 + 0xff000ff0, 1.429 + 0xfff00ff0, 1.430 + 0xffff0ff0, 1.431 + 0xff0ffff0, 1.432 + 0xff00fff0, 1.433 + 0xff000ff0, 1.434 + 0xff000ff0, 1.435 + 0x00000000 1.436 + }, { 1.437 + 0x00fff000, 1.438 + 0x0ff0ff00, 1.439 + 0xff000ff0, 1.440 + 0xff000ff0, 1.441 + 0xff000ff0, 1.442 + 0x0ff0ff00, 1.443 + 0x00fff000, 1.444 + 0x00000000 1.445 + }, { 1.446 + 0xffffff00, 1.447 + 0x0ff00ff0, 1.448 + 0x0ff00ff0, 1.449 + 0x0fffff00, 1.450 + 0x0ff00000, 1.451 + 0x0ff00000, 1.452 + 0xffff0000, 1.453 + 0x00000000 1.454 + }, { 1.455 + 0x0ffff000, 1.456 + 0xff00ff00, 1.457 + 0xff00ff00, 1.458 + 0xff00ff00, 1.459 + 0xff0fff00, 1.460 + 0x0ffff000, 1.461 + 0x000fff00, 1.462 + 0x00000000 1.463 + }, { 1.464 + 0xffffff00, 1.465 + 0x0ff00ff0, 1.466 + 0x0ff00ff0, 1.467 + 0x0fffff00, 1.468 + 0x0ff0ff00, 1.469 + 0x0ff00ff0, 1.470 + 0xfff00ff0, 1.471 + 0x00000000 1.472 + }, { 1.473 + 0x0ffff000, 1.474 + 0xff00ff00, 1.475 + 0xfff00000, 1.476 + 0x0fff0000, 1.477 + 0x000fff00, 1.478 + 0xff00ff00, 1.479 + 0x0ffff000, 1.480 + 0x00000000 1.481 + }, { 1.482 + 0xffffff00, 1.483 + 0xf0ff0f00, 1.484 + 0x00ff0000, 1.485 + 0x00ff0000, 1.486 + 0x00ff0000, 1.487 + 0x00ff0000, 1.488 + 0x0ffff000, 1.489 + 0x00000000 1.490 + }, { 1.491 + 0xff00ff00, 1.492 + 0xff00ff00, 1.493 + 0xff00ff00, 1.494 + 0xff00ff00, 1.495 + 0xff00ff00, 1.496 + 0xff00ff00, 1.497 + 0xffffff00, 1.498 + 0x00000000 1.499 + }, { 1.500 + 0xff00ff00, 1.501 + 0xff00ff00, 1.502 + 0xff00ff00, 1.503 + 0xff00ff00, 1.504 + 0xff00ff00, 1.505 + 0x0ffff000, 1.506 + 0x00ff0000, 1.507 + 0x00000000 1.508 + }, { 1.509 + 0xff000ff0, 1.510 + 0xff000ff0, 1.511 + 0xff000ff0, 1.512 + 0xff0f0ff0, 1.513 + 0xfffffff0, 1.514 + 0xfff0fff0, 1.515 + 0xff000ff0, 1.516 + 0x00000000 1.517 + }, { 1.518 + 0xff000ff0, 1.519 + 0xff000ff0, 1.520 + 0x0ff0ff00, 1.521 + 0x00fff000, 1.522 + 0x00fff000, 1.523 + 0x0ff0ff00, 1.524 + 0xff000ff0, 1.525 + 0x00000000 1.526 + }, { 1.527 + 0xff00ff00, 1.528 + 0xff00ff00, 1.529 + 0xff00ff00, 1.530 + 0x0ffff000, 1.531 + 0x00ff0000, 1.532 + 0x00ff0000, 1.533 + 0x0ffff000, 1.534 + 0x00000000 1.535 + }, { 1.536 + 0xfffffff0, 1.537 + 0xff000ff0, 1.538 + 0xf000ff00, 1.539 + 0x000ff000, 1.540 + 0x00ff00f0, 1.541 + 0x0ff00ff0, 1.542 + 0xfffffff0, 1.543 + 0x00000000 1.544 + }, { 1.545 + 0x0ffff000, 1.546 + 0x0ff00000, 1.547 + 0x0ff00000, 1.548 + 0x0ff00000, 1.549 + 0x0ff00000, 1.550 + 0x0ff00000, 1.551 + 0x0ffff000, 1.552 + 0x00000000 1.553 + }, { 1.554 + 0xff000000, 1.555 + 0x0ff00000, 1.556 + 0x00ff0000, 1.557 + 0x000ff000, 1.558 + 0x0000ff00, 1.559 + 0x00000ff0, 1.560 + 0x000000f0, 1.561 + 0x00000000 1.562 + }, { 1.563 + 0x0ffff000, 1.564 + 0x000ff000, 1.565 + 0x000ff000, 1.566 + 0x000ff000, 1.567 + 0x000ff000, 1.568 + 0x000ff000, 1.569 + 0x0ffff000, 1.570 + 0x00000000 1.571 + }, { 1.572 + 0x000f0000, 1.573 + 0x00fff000, 1.574 + 0x0ff0ff00, 1.575 + 0xff000ff0, 1.576 + 0x00000000, 1.577 + 0x00000000, 1.578 + 0x00000000, 1.579 + 0x00000000 1.580 + }, { 1.581 + 0x00000000, 1.582 + 0x00000000, 1.583 + 0x00000000, 1.584 + 0x00000000, 1.585 + 0x00000000, 1.586 + 0x00000000, 1.587 + 0x00000000, 1.588 + 0xffffffff 1.589 + }, { 1.590 + 0x00ff0000, 1.591 + 0x00ff0000, 1.592 + 0x000ff000, 1.593 + 0x00000000, 1.594 + 0x00000000, 1.595 + 0x00000000, 1.596 + 0x00000000, 1.597 + 0x00000000 1.598 + }, { 1.599 + 0x00000000, 1.600 + 0x00000000, 1.601 + 0x0ffff000, 1.602 + 0x0000ff00, 1.603 + 0x0fffff00, 1.604 + 0xff00ff00, 1.605 + 0x0fff0ff0, 1.606 + 0x00000000 1.607 + }, { 1.608 + 0xfff00000, 1.609 + 0x0ff00000, 1.610 + 0x0ff00000, 1.611 + 0x0fffff00, 1.612 + 0x0ff00ff0, 1.613 + 0x0ff00ff0, 1.614 + 0xff0fff00, 1.615 + 0x00000000 1.616 + }, { 1.617 + 0x00000000, 1.618 + 0x00000000, 1.619 + 0x0ffff000, 1.620 + 0xff00ff00, 1.621 + 0xff000000, 1.622 + 0xff00ff00, 1.623 + 0x0ffff000, 1.624 + 0x00000000 1.625 + }, { 1.626 + 0x000fff00, 1.627 + 0x0000ff00, 1.628 + 0x0000ff00, 1.629 + 0x0fffff00, 1.630 + 0xff00ff00, 1.631 + 0xff00ff00, 1.632 + 0x0fff0ff0, 1.633 + 0x00000000 1.634 + }, { 1.635 + 0x00000000, 1.636 + 0x00000000, 1.637 + 0x0ffff000, 1.638 + 0xff00ff00, 1.639 + 0xffffff00, 1.640 + 0xff000000, 1.641 + 0x0ffff000, 1.642 + 0x00000000 1.643 + }, { 1.644 + 0x00fff000, 1.645 + 0x0ff0ff00, 1.646 + 0x0ff00000, 1.647 + 0xffff0000, 1.648 + 0x0ff00000, 1.649 + 0x0ff00000, 1.650 + 0xffff0000, 1.651 + 0x00000000 1.652 + }, { 1.653 + 0x00000000, 1.654 + 0x00000000, 1.655 + 0x0fff0ff0, 1.656 + 0xff00ff00, 1.657 + 0xff00ff00, 1.658 + 0x0fffff00, 1.659 + 0x0000ff00, 1.660 + 0xfffff000 1.661 + }, { 1.662 + 0xfff00000, 1.663 + 0x0ff00000, 1.664 + 0x0ff0ff00, 1.665 + 0x0fff0ff0, 1.666 + 0x0ff00ff0, 1.667 + 0x0ff00ff0, 1.668 + 0xfff00ff0, 1.669 + 0x00000000 1.670 + }, { 1.671 + 0x00ff0000, 1.672 + 0x00000000, 1.673 + 0x0fff0000, 1.674 + 0x00ff0000, 1.675 + 0x00ff0000, 1.676 + 0x00ff0000, 1.677 + 0x0ffff000, 1.678 + 0x00000000 1.679 + }, { 1.680 + 0x0000ff00, 1.681 + 0x00000000, 1.682 + 0x0000ff00, 1.683 + 0x0000ff00, 1.684 + 0x0000ff00, 1.685 + 0xff00ff00, 1.686 + 0xff00ff00, 1.687 + 0x0ffff000 1.688 + }, { 1.689 + 0xfff00000, 1.690 + 0x0ff00000, 1.691 + 0x0ff00ff0, 1.692 + 0x0ff0ff00, 1.693 + 0x0ffff000, 1.694 + 0x0ff0ff00, 1.695 + 0xfff00ff0, 1.696 + 0x00000000 1.697 + }, { 1.698 + 0x0fff0000, 1.699 + 0x00ff0000, 1.700 + 0x00ff0000, 1.701 + 0x00ff0000, 1.702 + 0x00ff0000, 1.703 + 0x00ff0000, 1.704 + 0x0ffff000, 1.705 + 0x00000000 1.706 + }, { 1.707 + 0x00000000, 1.708 + 0x00000000, 1.709 + 0xff00ff00, 1.710 + 0xfffffff0, 1.711 + 0xfffffff0, 1.712 + 0xff0f0ff0, 1.713 + 0xff000ff0, 1.714 + 0x00000000 1.715 + }, { 1.716 + 0x00000000, 1.717 + 0x00000000, 1.718 + 0xfffff000, 1.719 + 0xff00ff00, 1.720 + 0xff00ff00, 1.721 + 0xff00ff00, 1.722 + 0xff00ff00, 1.723 + 0x00000000 1.724 + }, { 1.725 + 0x00000000, 1.726 + 0x00000000, 1.727 + 0x0ffff000, 1.728 + 0xff00ff00, 1.729 + 0xff00ff00, 1.730 + 0xff00ff00, 1.731 + 0x0ffff000, 1.732 + 0x00000000 1.733 + }, { 1.734 + 0x00000000, 1.735 + 0x00000000, 1.736 + 0xff0fff00, 1.737 + 0x0ff00ff0, 1.738 + 0x0ff00ff0, 1.739 + 0x0fffff00, 1.740 + 0x0ff00000, 1.741 + 0xffff0000 1.742 + }, { 1.743 + 0x00000000, 1.744 + 0x00000000, 1.745 + 0x0fff0ff0, 1.746 + 0xff00ff00, 1.747 + 0xff00ff00, 1.748 + 0x0fffff00, 1.749 + 0x0000ff00, 1.750 + 0x000ffff0 1.751 + }, { 1.752 + 0x00000000, 1.753 + 0x00000000, 1.754 + 0xff0fff00, 1.755 + 0x0fff0ff0, 1.756 + 0x0ff00ff0, 1.757 + 0x0ff00000, 1.758 + 0xffff0000, 1.759 + 0x00000000 1.760 + }, { 1.761 + 0x00000000, 1.762 + 0x00000000, 1.763 + 0x0fffff00, 1.764 + 0xff000000, 1.765 + 0x0ffff000, 1.766 + 0x0000ff00, 1.767 + 0xfffff000, 1.768 + 0x00000000 1.769 + }, { 1.770 + 0x000f0000, 1.771 + 0x00ff0000, 1.772 + 0x0fffff00, 1.773 + 0x00ff0000, 1.774 + 0x00ff0000, 1.775 + 0x00ff0f00, 1.776 + 0x000ff000, 1.777 + 0x00000000 1.778 + }, { 1.779 + 0x00000000, 1.780 + 0x00000000, 1.781 + 0xff00ff00, 1.782 + 0xff00ff00, 1.783 + 0xff00ff00, 1.784 + 0xff00ff00, 1.785 + 0x0fff0ff0, 1.786 + 0x00000000 1.787 + }, { 1.788 + 0x00000000, 1.789 + 0x00000000, 1.790 + 0xff00ff00, 1.791 + 0xff00ff00, 1.792 + 0xff00ff00, 1.793 + 0x0ffff000, 1.794 + 0x00ff0000, 1.795 + 0x00000000 1.796 + }, { 1.797 + 0x00000000, 1.798 + 0x00000000, 1.799 + 0xff000ff0, 1.800 + 0xff0f0ff0, 1.801 + 0xfffffff0, 1.802 + 0xfffffff0, 1.803 + 0x0ff0ff00, 1.804 + 0x00000000 1.805 + }, { 1.806 + 0x00000000, 1.807 + 0x00000000, 1.808 + 0xff000ff0, 1.809 + 0x0ff0ff00, 1.810 + 0x00fff000, 1.811 + 0x0ff0ff00, 1.812 + 0xff000ff0, 1.813 + 0x00000000 1.814 + }, { 1.815 + 0x00000000, 1.816 + 0x00000000, 1.817 + 0xff00ff00, 1.818 + 0xff00ff00, 1.819 + 0xff00ff00, 1.820 + 0x0fffff00, 1.821 + 0x0000ff00, 1.822 + 0xfffff000 1.823 + }, { 1.824 + 0x00000000, 1.825 + 0x00000000, 1.826 + 0xffffff00, 1.827 + 0xf00ff000, 1.828 + 0x00ff0000, 1.829 + 0x0ff00f00, 1.830 + 0xffffff00, 1.831 + 0x00000000 1.832 + }, { 1.833 + 0x000fff00, 1.834 + 0x00ff0000, 1.835 + 0x00ff0000, 1.836 + 0xfff00000, 1.837 + 0x00ff0000, 1.838 + 0x00ff0000, 1.839 + 0x000fff00, 1.840 + 0x00000000 1.841 + }, { 1.842 + 0x000ff000, 1.843 + 0x000ff000, 1.844 + 0x000ff000, 1.845 + 0x00000000, 1.846 + 0x000ff000, 1.847 + 0x000ff000, 1.848 + 0x000ff000, 1.849 + 0x00000000 1.850 + }, { 1.851 + 0xfff00000, 1.852 + 0x00ff0000, 1.853 + 0x00ff0000, 1.854 + 0x000fff00, 1.855 + 0x00ff0000, 1.856 + 0x00ff0000, 1.857 + 0xfff00000, 1.858 + 0x00000000 1.859 + }, { 1.860 + 0x0fff0ff0, 1.861 + 0xf00fff00, 1.862 + 0x00000000, 1.863 + 0x00000000, 1.864 + 0x00000000, 1.865 + 0x00000000, 1.866 + 0x00000000, 1.867 + 0x00000000 1.868 + } 1.869 +}; 1.870 + 1.871 +#endif /* DBGFONT_H_ */
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/src/debug.c Thu Jun 22 07:44:48 2017 +0300 2.3 @@ -0,0 +1,17 @@ 2.4 +#include "debug.h" 2.5 +#include "dbgfont.h" 2.6 + 2.7 +static int init_done; 2.8 + 2.9 +static void init_font(void) 2.10 +{ 2.11 + /* TODO allocate tiles, prepare palette etc */ 2.12 +} 2.13 + 2.14 +void dbg_print(const char *s) 2.15 +{ 2.16 + if(!init_done) { 2.17 + init_font(); 2.18 + init_done = 1; 2.19 + } 2.20 +}
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/src/debug.h Thu Jun 22 07:44:48 2017 +0300 3.3 @@ -0,0 +1,6 @@ 3.4 +#ifndef MD_DEBUG_H_ 3.5 +#define MD_DEBUG_H_ 3.6 + 3.7 +void dbg_print(const char *s); 3.8 + 3.9 +#endif /* MD_DEBUG_H_ */
4.1 --- a/src/io.h Wed Jun 21 06:49:50 2017 +0300 4.2 +++ b/src/io.h Thu Jun 22 07:44:48 2017 +0300 4.3 @@ -22,6 +22,9 @@ 4.4 #define IO_REG_LOCK *((volatile uint8_t*)0xa14000) 4.5 #define IO_REG_TMSS *((volatile uint8_t*)0xa14101) 4.6 4.7 +#define IO_REG_DATA(x) *((volatile uint8_t*)0xa10003 + ((x) << 1)) 4.8 +#define IO_REG_CTRL(x) *((volatile uint8_t*)0xa10009 + ((x) << 1)) 4.9 + 4.10 4.11 enum { 4.12 IO_VER_VERSION_MASK = 0x0f, 4.13 @@ -30,4 +33,32 @@ 4.14 IO_VER_NONJP = 0x80 4.15 }; 4.16 4.17 +enum { 4.18 + IO_PAD_UP = 1, 4.19 + IO_PAD_DOWN = 2, 4.20 + IO_PAD_LEFT = 4, 4.21 + IO_PAD_RIGHT = 8, 4.22 + IO_PAD_B = 16, 4.23 + IO_PAD_C = 32, 4.24 + IO_PAD_A = 64, 4.25 + IO_PAD_START = 128 4.26 +}; 4.27 + 4.28 +static inline void io_setdir(int port, uint8_t dir) 4.29 +{ 4.30 + IO_REG_CTRL(port) = dir; 4.31 +} 4.32 + 4.33 +static inline uint16_t io_readpad(int port) 4.34 +{ 4.35 + uint16_t bnstate; 4.36 + 4.37 + io_setdir(port, 0x40); /* pin 6 (multiplexer) output, 0-5 inputs */ 4.38 + IO_REG_DATA(port) = 0x40; /* select mode 1 */ 4.39 + bnstate = IO_REG_DATA(port); 4.40 + IO_REG_DATA(port) = 0; /* select mode 0 */ 4.41 + bnstate |= (IO_REG_DATA(port) << 2) & (IO_PAD_A | IO_PAD_START); 4.42 + return bnstate; 4.43 +} 4.44 + 4.45 #endif /* MEGADRIVE_IO_H_ */
5.1 --- a/src/main.c Wed Jun 21 06:49:50 2017 +0300 5.2 +++ b/src/main.c Thu Jun 22 07:44:48 2017 +0300 5.3 @@ -25,6 +25,8 @@ 5.4 VDP_PACK_RGB(7, 0, 3) /* 15: fixed */ 5.5 }; 5.6 5.7 +static int running = 1; 5.8 + 5.9 5.10 int main(void) 5.11 { 5.12 @@ -58,7 +60,15 @@ 5.13 //vdp_enable_hintr(12); 5.14 vdp_enable_vintr(); 5.15 5.16 - for(;;); 5.17 + for(;;) { 5.18 + uint16_t bnstate = io_readpad(0); 5.19 + 5.20 + if(bnstate & IO_PAD_START) { 5.21 + running = !running; 5.22 + } 5.23 + 5.24 + vdp_wait_vblank(); 5.25 + } 5.26 5.27 return 0; 5.28 } 5.29 @@ -89,7 +99,11 @@ 5.30 void vblank_handler(void) 5.31 { 5.32 int idx = CYCLE_BEG; 5.33 - uint16_t first = pal[idx]; 5.34 + uint16_t first; 5.35 + 5.36 + if(!running) return; 5.37 + 5.38 + first = pal[idx]; 5.39 5.40 vdp_begin_palette(0, idx); 5.41 while(idx < CYCLE_END) {
6.1 --- a/src/vdp.h Wed Jun 21 06:49:50 2017 +0300 6.2 +++ b/src/vdp.h Thu Jun 22 07:44:48 2017 +0300 6.3 @@ -247,6 +247,11 @@ 6.4 vdp_setreg(VDP_REG_SCROLL_TAB, addr >> 10); 6.5 } 6.6 6.7 +static inline void vdp_wait_vblank(void) 6.8 +{ 6.9 + while(!(VDP_PORT_STATUS & 0x0008)); 6.10 +} 6.11 + 6.12 void vdp_init(void); 6.13 6.14 #endif /* VDP_H_ */