paul@41 | 1 | /* |
paul@41 | 2 | * Common display-related functions. |
paul@41 | 3 | * |
paul@41 | 4 | * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> |
paul@41 | 5 | * |
paul@41 | 6 | * This program is free software: you can redistribute it and/or modify |
paul@41 | 7 | * it under the terms of the GNU General Public License as published by |
paul@41 | 8 | * the Free Software Foundation, either version 3 of the License, or |
paul@41 | 9 | * (at your option) any later version. |
paul@41 | 10 | * |
paul@41 | 11 | * This program is distributed in the hope that it will be useful, |
paul@41 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@41 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@41 | 14 | * GNU General Public License for more details. |
paul@41 | 15 | * |
paul@41 | 16 | * You should have received a copy of the GNU General Public License |
paul@41 | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
paul@41 | 18 | */ |
paul@41 | 19 | |
paul@41 | 20 | #include "display.h" |
paul@41 | 21 | |
paul@41 | 22 | /* Provided by the application. */ |
paul@41 | 23 | |
paul@41 | 24 | #include "vga.h" |
paul@41 | 25 | |
paul@41 | 26 | |
paul@41 | 27 | |
paul@41 | 28 | /* Provide a pattern to test the line data. */ |
paul@41 | 29 | |
paul@41 | 30 | void test_linedata(uint8_t *framebuffer) |
paul@41 | 31 | { |
paul@41 | 32 | int x, y; |
paul@41 | 33 | uint8_t *linedata = framebuffer; |
paul@41 | 34 | |
paul@41 | 35 | for (y = 0; y < LINE_COUNT; y++) |
paul@41 | 36 | { |
paul@41 | 37 | for (x = 0; x < LINE_LENGTH; x++) |
paul@41 | 38 | { |
paul@41 | 39 | /* Pixel: I0RRGGBB = Y0YYYYXX */ |
paul@41 | 40 | |
paul@41 | 41 | linedata[x] = (x % 2) ? |
paul@41 | 42 | (((y / (LINE_COUNT / 32)) & 0b1) << 7) | |
paul@41 | 43 | (((y / (LINE_COUNT / 16)) & 0b1111) << 2) | |
paul@41 | 44 | ((x / (LINE_LENGTH / 4)) & 0b11) : |
paul@41 | 45 | 0x00; |
paul@41 | 46 | } |
paul@41 | 47 | |
paul@41 | 48 | linedata += LINE_LENGTH; |
paul@41 | 49 | } |
paul@41 | 50 | } |