vic.h
1 /* 2 Copyright Frank Bösing, 2017 3 4 This file is part of Teensy64. 5 6 Teensy64 is free software: you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation, either version 3 of the License, or 9 (at your option) any later version. 10 11 Teensy64 is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with Teensy64. If not, see <http://www.gnu.org/licenses/>. 18 19 Diese Datei ist Teil von Teensy64. 20 21 Teensy64 ist Freie Software: Sie können es unter den Bedingungen 22 der GNU General Public License, wie von der Free Software Foundation, 23 Version 3 der Lizenz oder (nach Ihrer Wahl) jeder späteren 24 veröffentlichten Version, weiterverbreiten und/oder modifizieren. 25 26 Teensy64 wird in der Hoffnung, dass es nützlich sein wird, aber 27 OHNE JEDE GEWÄHRLEISTUNG, bereitgestellt; sogar ohne die implizite 28 Gewährleistung der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK. 29 Siehe die GNU General Public License für weitere Details. 30 31 Sie sollten eine Kopie der GNU General Public License zusammen mit diesem 32 Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>. 33 34 */ 35 36 #ifndef Teensy64_vic_h_ 37 #define Teensy64_vic_h_ 38 39 #include "Teensy64.h" 40 #include "IntervalTimer.h" 41 42 43 44 #define SPRITE_MAX_X (320 + 24) 45 46 /* for later use 47 struct tsprite { 48 uint8_t MC; //Mob Data Counter 49 uint8_t MCBase; //Mob Data Counter Base 50 uint8_t MobYexpand; //Y-Epansion FlipFlop 51 }; 52 */ 53 54 struct tvic { 55 uint32_t timeStart, neededTime; 56 int intRasterLine; //Interruptsetting 57 int rasterLine; 58 uint16_t bank; 59 uint16_t vcbase; 60 uint8_t rc; 61 62 uint8_t borderFlag; //Top-Bottom border flag 63 uint8_t borderFlagH; //Left-Right border flag 64 uint8_t idle; 65 uint8_t denLatch; 66 uint8_t badline; 67 uint8_t BAsignal; 68 uint8_t lineHasSprites; 69 int8_t spriteCycles0_2; 70 int8_t spriteCycles3_7; 71 int fgcollision; 72 73 uint8_t * charsetPtrBase; 74 uint8_t * charsetPtr; 75 uint8_t * bitmapPtr; 76 uint16_t videomatrix; 77 78 uint16_t colors[15]; // translated ([palette]) colors 79 uint16_t palette[16]; 80 81 MyIntervalTimer lineClock; 82 83 union { 84 uint8_t R[0x40]; 85 struct { 86 uint8_t M0X, M0Y, M1X, M1Y, M2X, M2Y, M3X, M3Y, M4X, M4Y, M5X, M5Y, M6X, M6Y, M7X, M7Y; 87 uint8_t MX8; // Sprite-X Bit 8 $D010 88 uint8_t YSCROLL: 3, RSEL: 1, DEN: 1, BMM: 1, ECM: 1, RST8: 1; // $D011 89 uint8_t RASTER; // Rasterline $D012 90 uint8_t LPX; // Lightpen X $D013 91 uint8_t LPY; // Lightpen Y $D014 92 uint8_t ME; // Sprite Enable $D015 93 uint8_t XSCROLL: 3, CSEL: 1, MCM: 1, RES: 1, : 2; // $D016 94 uint8_t MYE; // Sprite Y-Expansion $D017 95 uint8_t : 1, CB: 3, VM: 4; // $D018 96 uint8_t IRST: 1, IMBC: 1, IMMC: 1, ILP: 1, : 3, IRQ: 1; // $D019 97 uint8_t ERST: 1, EMBC: 1, EMMC: 1, ELP: 1, : 4; // $D01A 98 uint8_t MDP; // Sprite-Daten-Priority $D01B 99 uint8_t MMC; // Sprite Multicolor $D01C 100 uint8_t MXE; // Sprite X-Expansion $D01D 101 uint8_t MM; // Sprite-Sprite collision $D01E 102 uint8_t MD; // Sprite-Data collision $D01F 103 uint8_t EC: 4, : 4; // Bordercolor $D020 104 uint8_t B0C: 4, : 4; // Backgroundcolor 0 $D021 105 uint8_t B1C: 4, : 4; // Backgroundcolor 1 $D022 106 uint8_t B2C: 4, : 4; // Backgroundcolor 2 $D023 107 uint8_t B3C: 4, : 4; // Backgroundcolor 3 $D024 108 uint8_t MM0: 4, : 4; // Sprite Multicolor 0 $D025 109 uint8_t MM1: 4, : 4; // Sprite Multicolor 1 $D026 110 uint8_t M0C: 4, : 4; // Spritecolor 0 $D027 111 uint8_t M1C: 4, : 4; // Spritecolor 1 $D028 112 uint8_t M2C: 4, : 4; // Spritecolor 2 $D029 113 uint8_t M3C: 4, : 4; // Spritecolor 3 $D02A 114 uint8_t M4C: 4, : 4; // Spritecolor 4 $D02B 115 uint8_t M5C: 4, : 4; // Spritecolor 5 $D02C 116 uint8_t M6C: 4, : 4; // Spritecolor 6 $D02D 117 uint8_t M7C: 4, : 4; // Spritecolor 7 $D02E 118 }; 119 }; 120 121 //tsprite spriteInfo[8];//todo 122 uint16_t spriteLine[SPRITE_MAX_X]; 123 124 uint8_t lineMemChr[40]; 125 uint8_t lineMemCol[40]; 126 uint8_t COLORRAM[1024]; 127 128 }; 129 130 void vic_do(void); 131 void vic_do_simple(void); 132 void vic_displaySimpleModeScreen(void); 133 134 void vic_write(uint32_t address, uint8_t value) ; 135 uint8_t vic_read(uint32_t address); 136 137 void vic_colorwrite(uint32_t address, uint8_t value); 138 uint8_t vic_colorread(uint32_t address); 139 140 void vic_adrchange(void); 141 142 void resetVic(void); 143 144 #endif