├── Core ├── Archive.cpp ├── Archive.h ├── Bios.cpp ├── Bios.h ├── Cartridge.cpp ├── Cartridge.h ├── Equates.h ├── Hash.cpp ├── Hash.h ├── Logger.cpp ├── Logger.h ├── Maria.cpp ├── Maria.h ├── Memory.cpp ├── Memory.h ├── Pair.h ├── Palette.cpp ├── Palette.h ├── Pokey.cpp ├── Pokey.h ├── ProSystem.cpp ├── ProSystem.h ├── Rect.h ├── Region.cpp ├── Region.h ├── Riot.cpp ├── Riot.h ├── Sally.cpp ├── Sally.h ├── Tia.cpp └── Tia.h ├── Help ├── CommandLine.htm ├── Display.htm ├── Emulation.htm ├── File.htm ├── Help.htm ├── History.htm ├── Images │ ├── BiosDialog.jpg │ ├── ConsoleDialog.jpg │ ├── Controller1Dialog.jpg │ ├── Controller2Dialog.jpg │ ├── DatabaseDialog.jpg │ ├── FileDialog.jpg │ ├── PaletteDialog.jpg │ ├── Screenshot1.jpg │ ├── Screenshot2.jpg │ └── UserDialog.jpg ├── Input.htm ├── Introduction.htm ├── Options.htm ├── Overview.htm ├── ProSystem.hhc ├── ProSystem.hhk ├── ProSystem.hhp ├── Requirements.htm ├── Sound.htm └── Troubleshooting.html ├── Lib ├── Crypt.h ├── HtmlHelp.h ├── HtmlHelp.lib ├── Ioapi.h ├── Unzip.h ├── Zconf.h ├── Zip.h ├── Zlib.h └── Zlib.lib ├── License.txt ├── ProSystem.dat ├── ProSystem.dsp ├── ProSystem.dsw ├── ProSystem.opt ├── README.md ├── Web ├── images │ ├── Screenshot1.jpg │ └── Screenshot2.jpg └── index.html ├── Win ├── About.cpp ├── About.h ├── Common.cpp ├── Common.h ├── Configuration.cpp ├── Configuration.h ├── Console.cpp ├── Console.h ├── Database.cpp ├── Database.h ├── Display.cpp ├── Display.h ├── Help.cpp ├── Help.h ├── Input.cpp ├── Input.h ├── Main.cpp ├── Menu.cpp ├── Menu.h ├── ProSystem.aps ├── ProSystem.ico ├── ProSystem.rc ├── Sound.cpp ├── Sound.h ├── Timer.cpp ├── Timer.h └── resource.h └── mssccprj.scc /Core/Archive.cpp: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Archive.cpp 24 | // ---------------------------------------------------------------------------- 25 | #include "Archive.h" 26 | 27 | // ---------------------------------------------------------------------------- 28 | // GetUncompressedFileSize 29 | // ---------------------------------------------------------------------------- 30 | uint archive_GetUncompressedFileSize(std::string filename) { 31 | if((filename.empty( ) || filename.size( ) == 0)) { 32 | logger_LogError(IDS_ZIP1,""); 33 | return 0; 34 | } 35 | 36 | unzFile file = unzOpen(filename.c_str( )); 37 | if(file == NULL) { 38 | logger_LogInfo(IDS_ZIP2,filename); 39 | return 0; 40 | } 41 | 42 | int result = unzGoToFirstFile(file); 43 | if(result != UNZ_OK) { 44 | logger_LogInfo(IDS_ZIP3, ""); 45 | unzClose(file); 46 | return 0; 47 | } 48 | 49 | unz_file_info_s zipInfo = {0}; 50 | char buffer[_MAX_PATH] = {0}; 51 | result = unzGetCurrentFileInfo(file, &zipInfo, buffer, _MAX_PATH, NULL, 0, NULL, 0); 52 | if(result != UNZ_OK) { 53 | logger_LogInfo(IDS_ZIP5, ""); 54 | unzClose(file); 55 | return 0; 56 | } 57 | 58 | uint size = zipInfo.uncompressed_size; 59 | unzClose(file); 60 | return size; 61 | } 62 | 63 | // ---------------------------------------------------------------------------- 64 | // Uncompress 65 | // ---------------------------------------------------------------------------- 66 | bool archive_Uncompress(std::string filename, byte* data, uint size) { 67 | if(filename.empty( ) || filename.size( ) == 0) { 68 | logger_LogError(IDS_ZIP1,""); 69 | return false; 70 | } 71 | if(data == NULL) { 72 | logger_LogError(IDS_ZIP6,""); 73 | return false; 74 | } 75 | 76 | unzFile file = unzOpen(filename.c_str( )); 77 | if(file == NULL) { 78 | logger_LogInfo(IDS_ZIP2,filename); 79 | return false; 80 | } 81 | 82 | int result = unzGoToFirstFile(file); 83 | if(result != UNZ_OK) { 84 | logger_LogInfo(IDS_ZIP3 ,filename); 85 | unzClose(file); 86 | return false; 87 | } 88 | 89 | result = unzOpenCurrentFile(file); 90 | if(result != UNZ_OK) { 91 | logger_LogInfo(IDS_ZIP3 ,filename); 92 | unzClose(file); 93 | return false; 94 | } 95 | 96 | result = unzReadCurrentFile(file, data, size); 97 | if(result != size) { 98 | logger_LogInfo(IDS_ZIP8 ,filename); 99 | unzCloseCurrentFile(file); 100 | unzClose(file); 101 | return false; 102 | } 103 | 104 | unzCloseCurrentFile(file); 105 | unzClose(file); 106 | return true; 107 | } 108 | 109 | // ---------------------------------------------------------------------------- 110 | // Compress 111 | // ---------------------------------------------------------------------------- 112 | bool archive_Compress(std::string zipFilename, std::string filename, const byte* data, uint size) { 113 | if(zipFilename.empty( ) || zipFilename.size( ) == 0) { 114 | logger_LogError(IDS_ZIP1,""); 115 | return false; 116 | } 117 | if(filename.empty( ) || filename.size( ) == 0) { 118 | logger_LogError(IDS_ZIP9,""); 119 | return false; 120 | } 121 | if(data == NULL) { 122 | logger_LogError(IDS_ZIP6,""); 123 | return false; 124 | } 125 | 126 | zipFile file = zipOpen(zipFilename.c_str( ), APPEND_STATUS_CREATE); 127 | if(file == NULL) { 128 | logger_LogInfo(IDS_ZIP10, zipFilename); 129 | return false; 130 | } 131 | 132 | zip_fileinfo fileInfo = {0}; 133 | fileInfo.dosDate = 1; 134 | 135 | int result = zipOpenNewFileInZip(file, filename.c_str( ), &fileInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_BEST_COMPRESSION); 136 | if(result != ZIP_OK) { 137 | logger_LogInfo(IDS_ZIP11, filename); 138 | zipClose(file, "Failed to compress."); 139 | return false; 140 | } 141 | 142 | result = zipWriteInFileInZip(file, data, size); 143 | if(result != ZIP_OK) { 144 | logger_LogInfo(IDS_ZIP12, filename); 145 | zipCloseFileInZip(file); 146 | zipClose(file, "Failed to compress."); 147 | return false; 148 | } 149 | 150 | zipCloseFileInZip(file); 151 | zipClose(file, "Comment"); 152 | return true; 153 | } -------------------------------------------------------------------------------- /Core/Archive.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Archive.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef ARCHIVE_H 26 | #define ARCHIVE_H 27 | 28 | #include 29 | #include "Logger.h" 30 | #include "Cartridge.h" 31 | #include "Zip.h" 32 | #include "Unzip.h" 33 | 34 | typedef unsigned char byte; 35 | typedef unsigned short word; 36 | typedef unsigned int uint; 37 | 38 | extern uint archive_GetUncompressedFileSize(std::string filename); 39 | extern bool archive_Uncompress(std::string filename, byte* data, uint size); 40 | extern bool archive_Compress(std::string zipFilename, std::string filename, const byte* data, uint size); 41 | 42 | #endif -------------------------------------------------------------------------------- /Core/Bios.cpp: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Bios.cpp 24 | // ---------------------------------------------------------------------------- 25 | #include "Bios.h" 26 | 27 | bool bios_enabled = false; 28 | std::string bios_filename; 29 | 30 | static byte* bios_data = NULL; 31 | static word bios_size = 0; 32 | 33 | // ---------------------------------------------------------------------------- 34 | // Load 35 | // ---------------------------------------------------------------------------- 36 | bool bios_Load(std::string filename) { 37 | if(filename.empty( ) || filename.length( ) == 0) { 38 | logger_LogError(IDS_BIOS1, ""); 39 | return false; 40 | } 41 | 42 | bios_Release( ); 43 | logger_LogInfo(IDS_BIOS2, filename); 44 | 45 | bios_size = archive_GetUncompressedFileSize(filename); 46 | if(bios_size == 0) { 47 | FILE* file = fopen(filename.c_str( ), "rb"); 48 | if(file == NULL) { 49 | logger_LogError(IDS_BIOS3, filename); 50 | return false; 51 | } 52 | 53 | if(fseek(file, 0, SEEK_END)) { 54 | fclose(file); 55 | logger_LogError(IDS_BIOS4,""); 56 | return false; 57 | } 58 | 59 | bios_size = ftell(file); 60 | if(fseek(file, 0, SEEK_SET)) { 61 | fclose(file); 62 | logger_LogError(IDS_BIOS5,""); 63 | return false; 64 | } 65 | 66 | bios_data = new byte[bios_size]; 67 | if(fread(bios_data, 1, bios_size, file) != bios_size && ferror(file)) { 68 | fclose(file); 69 | logger_LogError(IDS_BIOS6,""); 70 | bios_Release( ); 71 | return false; 72 | } 73 | 74 | fclose(file); 75 | } 76 | else { 77 | bios_data = new byte[bios_size]; 78 | archive_Uncompress(filename, bios_data, bios_size); 79 | } 80 | 81 | bios_filename = filename; 82 | return true; 83 | } 84 | 85 | // ---------------------------------------------------------------------------- 86 | // IsLoaded 87 | // ---------------------------------------------------------------------------- 88 | bool bios_IsLoaded( ) { 89 | return (bios_data != NULL)? true: false; 90 | } 91 | 92 | // ---------------------------------------------------------------------------- 93 | // Release 94 | // ---------------------------------------------------------------------------- 95 | void bios_Release( ) { 96 | if(bios_data) { 97 | delete [ ] bios_data; 98 | bios_size = 0; 99 | bios_data = NULL; 100 | } 101 | } 102 | 103 | // ---------------------------------------------------------------------------- 104 | // Store 105 | // ---------------------------------------------------------------------------- 106 | void bios_Store( ) { 107 | if(bios_data != NULL && bios_enabled) { 108 | memory_WriteROM(65536 - bios_size, bios_size, bios_data); 109 | } 110 | } -------------------------------------------------------------------------------- /Core/Bios.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Bios.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef BIOS_H 26 | #define BIOS_H 27 | #define NULL 0 28 | 29 | #include 30 | #include "Memory.h" 31 | #include "Archive.h" 32 | #include "Logger.h" 33 | 34 | typedef unsigned char byte; 35 | typedef unsigned short word; 36 | typedef unsigned int uint; 37 | 38 | extern bool bios_Load(std::string filename); 39 | extern bool bios_IsLoaded( ); 40 | extern void bios_Store( ); 41 | extern void bios_Release( ); 42 | extern std::string bios_filename; 43 | extern bool bios_enabled; 44 | 45 | #endif -------------------------------------------------------------------------------- /Core/Cartridge.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Cartridge.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef CARTRIDGE_H 26 | #define CARTRIDGE_H 27 | #define CARTRIDGE_TYPE_NORMAL 0 28 | #define CARTRIDGE_TYPE_SUPERCART 1 29 | #define CARTRIDGE_TYPE_SUPERCART_LARGE 2 30 | #define CARTRIDGE_TYPE_SUPERCART_RAM 3 31 | #define CARTRIDGE_TYPE_SUPERCART_ROM 4 32 | #define CARTRIDGE_TYPE_ABSOLUTE 5 33 | #define CARTRIDGE_TYPE_ACTIVISION 6 34 | #define CARTRIDGE_CONTROLLER_NONE 0 35 | #define CARTRIDGE_CONTROLLER_JOYSTICK 1 36 | #define CARTRIDGE_CONTROLLER_LIGHTGUN 2 37 | #define CARTRIDGE_WSYNC_MASK 2 38 | #define CARTRIDGE_CYCLE_STEALING_MASK 1 39 | #define NULL 0 40 | 41 | #include 42 | #include 43 | #include "Equates.h" 44 | #include "Memory.h" 45 | #include "Hash.h" 46 | #include "Logger.h" 47 | #include "Pokey.h" 48 | #include "Archive.h" 49 | 50 | typedef unsigned char byte; 51 | typedef unsigned short word; 52 | typedef unsigned int uint; 53 | 54 | extern bool cartridge_Load(std::string filename); 55 | extern void cartridge_Store( ); 56 | extern void cartridge_StoreBank(byte bank); 57 | extern void cartridge_Write(word address, byte data); 58 | extern bool cartridge_IsLoaded( ); 59 | extern void cartridge_Release( ); 60 | extern std::string cartridge_digest; 61 | extern std::string cartridge_title; 62 | extern std::string cartridge_description; 63 | extern std::string cartridge_year; 64 | extern std::string cartridge_maker; 65 | extern std::string cartridge_filename; 66 | extern byte cartridge_type; 67 | extern byte cartridge_region; 68 | extern bool cartridge_pokey; 69 | extern byte cartridge_controller[2]; 70 | extern byte cartridge_bank; 71 | extern uint cartridge_flags; 72 | 73 | #endif -------------------------------------------------------------------------------- /Core/Equates.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Equates.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef EQUATES_H 26 | #define EQUATES_H 27 | 28 | #define INPTCTRL 1 29 | #define INPT0 8 30 | #define INPT1 9 31 | #define INPT2 10 32 | #define INPT3 11 33 | #define INPT4 12 34 | #define INPT5 13 35 | #define AUDC0 21 36 | #define AUDC1 22 37 | #define AUDF0 23 38 | #define AUDF1 24 39 | #define AUDV0 25 40 | #define AUDV1 26 41 | #define BACKGRND 32 42 | #define P0C1 33 43 | #define P0C2 34 44 | #define P0C3 35 45 | #define WSYNC 36 46 | #define P1C1 37 47 | #define P1C2 38 48 | #define P1C3 39 49 | #define MSTAT 40 50 | #define P2C1 41 51 | #define P2C2 42 52 | #define P2C3 43 53 | #define DPPH 44 54 | #define P3C1 45 55 | #define P3C2 46 56 | #define P3C3 47 57 | #define DPPL 48 58 | #define P4C1 49 59 | #define P4C2 50 60 | #define P4C3 51 61 | #define CHARBASE 52 62 | #define P5C1 53 63 | #define P5C2 54 64 | #define P5C3 55 65 | #define OFFSET 56 66 | #define P6C1 57 67 | #define P6C2 58 68 | #define P6C3 59 69 | #define CTRL 60 70 | #define P7C1 61 71 | #define P7C2 62 72 | #define P7C3 63 73 | #define SWCHA 640 74 | #define CTLSWA 641 75 | #define SWCHB 642 76 | #define CTLSWB 643 77 | #define INTIM 644 78 | #define INTFLG 645 79 | #define TIM1T 660 80 | #define TIM8T 661 81 | #define TIM64T 662 82 | #define T1024T 663 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /Core/Hash.cpp: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Hash.cpp 24 | // ---------------------------------------------------------------------------- 25 | #include "Hash.h" 26 | 27 | // ---------------------------------------------------------------------------- 28 | // Step1 29 | // ---------------------------------------------------------------------------- 30 | static uint hash_Step1(uint w, uint x, uint y, uint z, uint data, uint s) { 31 | w += (z ^ (x & (y ^ z))) + data; 32 | w = w << s | w >> (32 - s); 33 | w += x; 34 | return w; 35 | } 36 | 37 | // ---------------------------------------------------------------------------- 38 | // Step2 39 | // ---------------------------------------------------------------------------- 40 | static uint hash_Step2(uint w, uint x, uint y, uint z, uint data, uint s) { 41 | w += (y ^ (z & (x ^ y))) + data; 42 | w = w << s | w >> (32 - s); 43 | w += x; 44 | return w; 45 | } 46 | 47 | // ---------------------------------------------------------------------------- 48 | // Step3 49 | // ---------------------------------------------------------------------------- 50 | static uint hash_Step3(uint w, uint x, uint y, uint z, uint data, uint s) { 51 | w += (x ^ y ^ z) + data; 52 | w = w << s | w >> (32 - s); 53 | w += x; 54 | return w; 55 | } 56 | 57 | // ---------------------------------------------------------------------------- 58 | // Step4 59 | // ---------------------------------------------------------------------------- 60 | static uint hash_Step4(uint w, uint x, uint y, uint z, uint data, uint s) { 61 | w += (y ^ (x | ~z)) + data; 62 | w = w << s | w >> (32 - s); 63 | w += x; 64 | return w; 65 | } 66 | 67 | // ---------------------------------------------------------------------------- 68 | // Transform 69 | // ---------------------------------------------------------------------------- 70 | static void hash_Transform(uint out[4], uint in[16]) { 71 | uint a, b, c, d; 72 | 73 | a = out[0]; 74 | b = out[1]; 75 | c = out[2]; 76 | d = out[3]; 77 | 78 | a = hash_Step1(a, b, c, d, in[0] + 0xd76aa478, 7); 79 | d = hash_Step1(d, a, b, c, in[1] + 0xe8c7b756, 12); 80 | c = hash_Step1(c, d, a, b, in[2] + 0x242070db, 17); 81 | b = hash_Step1(b, c, d, a, in[3] + 0xc1bdceee, 22); 82 | a = hash_Step1(a, b, c, d, in[4] + 0xf57c0faf, 7); 83 | d = hash_Step1(d, a, b, c, in[5] + 0x4787c62a, 12); 84 | c = hash_Step1(c, d, a, b, in[6] + 0xa8304613, 17); 85 | b = hash_Step1(b, c, d, a, in[7] + 0xfd469501, 22); 86 | a = hash_Step1(a, b, c, d, in[8] + 0x698098d8, 7); 87 | d = hash_Step1(d, a, b, c, in[9] + 0x8b44f7af, 12); 88 | c = hash_Step1(c, d, a, b, in[10] + 0xffff5bb1, 17); 89 | b = hash_Step1(b, c, d, a, in[11] + 0x895cd7be, 22); 90 | a = hash_Step1(a, b, c, d, in[12] + 0x6b901122, 7); 91 | d = hash_Step1(d, a, b, c, in[13] + 0xfd987193, 12); 92 | c = hash_Step1(c, d, a, b, in[14] + 0xa679438e, 17); 93 | b = hash_Step1(b, c, d, a, in[15] + 0x49b40821, 22); 94 | 95 | a = hash_Step2(a, b, c, d, in[1] + 0xf61e2562, 5); 96 | d = hash_Step2(d, a, b, c, in[6] + 0xc040b340, 9); 97 | c = hash_Step2(c, d, a, b, in[11] + 0x265e5a51, 14); 98 | b = hash_Step2(b, c, d, a, in[0] + 0xe9b6c7aa, 20); 99 | a = hash_Step2(a, b, c, d, in[5] + 0xd62f105d, 5); 100 | d = hash_Step2(d, a, b, c, in[10] + 0x02441453, 9); 101 | c = hash_Step2(c, d, a, b, in[15] + 0xd8a1e681, 14); 102 | b = hash_Step2(b, c, d, a, in[4] + 0xe7d3fbc8, 20); 103 | a = hash_Step2(a, b, c, d, in[9] + 0x21e1cde6, 5); 104 | d = hash_Step2(d, a, b, c, in[14] + 0xc33707d6, 9); 105 | c = hash_Step2(c, d, a, b, in[3] + 0xf4d50d87, 14); 106 | b = hash_Step2(b, c, d, a, in[8] + 0x455a14ed, 20); 107 | a = hash_Step2(a, b, c, d, in[13] + 0xa9e3e905, 5); 108 | d = hash_Step2(d, a, b, c, in[2] + 0xfcefa3f8, 9); 109 | c = hash_Step2(c, d, a, b, in[7] + 0x676f02d9, 14); 110 | b = hash_Step2(b, c, d, a, in[12] + 0x8d2a4c8a, 20); 111 | 112 | a = hash_Step3(a, b, c, d, in[5] + 0xfffa3942, 4); 113 | d = hash_Step3(d, a, b, c, in[8] + 0x8771f681, 11); 114 | c = hash_Step3(c, d, a, b, in[11] + 0x6d9d6122, 16); 115 | b = hash_Step3(b, c, d, a, in[14] + 0xfde5380c, 23); 116 | a = hash_Step3(a, b, c, d, in[1] + 0xa4beea44, 4); 117 | d = hash_Step3(d, a, b, c, in[4] + 0x4bdecfa9, 11); 118 | c = hash_Step3(c, d, a, b, in[7] + 0xf6bb4b60, 16); 119 | b = hash_Step3(b, c, d, a, in[10] + 0xbebfbc70, 23); 120 | a = hash_Step3(a, b, c, d, in[13] + 0x289b7ec6, 4); 121 | d = hash_Step3(d, a, b, c, in[0] + 0xeaa127fa, 11); 122 | c = hash_Step3(c, d, a, b, in[3] + 0xd4ef3085, 16); 123 | b = hash_Step3(b, c, d, a, in[6] + 0x04881d05, 23); 124 | a = hash_Step3(a, b, c, d, in[9] + 0xd9d4d039, 4); 125 | d = hash_Step3(d, a, b, c, in[12] + 0xe6db99e5, 11); 126 | c = hash_Step3(c, d, a, b, in[15] + 0x1fa27cf8, 16); 127 | b = hash_Step3(b, c, d, a, in[2] + 0xc4ac5665, 23); 128 | 129 | a = hash_Step4(a, b, c, d, in[0] + 0xf4292244, 6); 130 | d = hash_Step4(d, a, b, c, in[7] + 0x432aff97, 10); 131 | c = hash_Step4(c, d, a, b, in[14] + 0xab9423a7, 15); 132 | b = hash_Step4(b, c, d, a, in[5] + 0xfc93a039, 21); 133 | a = hash_Step4(a, b, c, d, in[12] + 0x655b59c3, 6); 134 | d = hash_Step4(d, a, b, c, in[3] + 0x8f0ccc92, 10); 135 | c = hash_Step4(c, d, a, b, in[10] + 0xffeff47d, 15); 136 | b = hash_Step4(b, c, d, a, in[1] + 0x85845dd1, 21); 137 | a = hash_Step4(a, b, c, d, in[8] + 0x6fa87e4f, 6); 138 | d = hash_Step4(d, a, b, c, in[15] + 0xfe2ce6e0, 10); 139 | c = hash_Step4(c, d, a, b, in[6] + 0xa3014314, 15); 140 | b = hash_Step4(b, c, d, a, in[13] + 0x4e0811a1, 21); 141 | a = hash_Step4(a, b, c, d, in[4] + 0xf7537e82, 6); 142 | d = hash_Step4(d, a, b, c, in[11] + 0xbd3af235, 10); 143 | c = hash_Step4(c, d, a, b, in[2] + 0x2ad7d2bb, 15); 144 | b = hash_Step4(b, c, d, a, in[9] + 0xeb86d391, 21); 145 | 146 | out[0] += a; 147 | out[1] += b; 148 | out[2] += c; 149 | out[3] += d; 150 | } 151 | 152 | // ---------------------------------------------------------------------------- 153 | // Compute 154 | // ---------------------------------------------------------------------------- 155 | std::string hash_Compute(const byte* source, uint length) { 156 | uint buffer1[4] = {0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476}; 157 | uint buffer2[2] = {0}; 158 | byte buffer3[64] = {0}; 159 | 160 | uint temp = buffer2[0]; 161 | if((buffer2[0] = temp + ((uint)length << 3)) < temp) { 162 | buffer2[1]++; 163 | } 164 | buffer2[1] += length >> 29; 165 | 166 | temp = (temp >> 3) & 0x3f; 167 | if(temp) { 168 | byte* ptr = (byte*)buffer3 + temp; 169 | temp = 64 - temp; 170 | if(length < temp) { 171 | for(uint index = 0; index < length; index++) { 172 | ptr[index] = source[index]; 173 | } 174 | } 175 | 176 | for(uint index = 0; index < temp; index++) { 177 | ptr[index] = source[index]; 178 | } 179 | 180 | hash_Transform(buffer1, (uint*)buffer3); 181 | source += temp; 182 | length -= temp; 183 | } 184 | 185 | while(length >= 64) { 186 | for(uint index = 0; index < 64; index++) { 187 | buffer3[index] = source[index]; 188 | } 189 | hash_Transform(buffer1, (uint*)buffer3); 190 | source += 64; 191 | length -= 64; 192 | } 193 | 194 | for(uint index = 0; index < length; index++) { 195 | buffer3[index] = source[index]; 196 | } 197 | 198 | uint count = (buffer2[0] >> 3) & 0x3f; 199 | byte* ptr = buffer3 + count; 200 | *ptr++ = 0x80; 201 | 202 | count = 63 - count; 203 | 204 | if(count < 8) { 205 | uint index; 206 | for(index = 0; index < count; index++) { 207 | ptr[index] = 0; 208 | } 209 | hash_Transform(buffer1, (uint*)buffer3); 210 | 211 | for(index = 0; index < 56; index++) { 212 | buffer3[index] = 0; 213 | } 214 | } 215 | else { 216 | for(index = 0; index < count - 8; index++) { 217 | ptr[index] = 0; 218 | } 219 | } 220 | 221 | ((uint*)buffer3)[14] = buffer2[0]; 222 | ((uint*)buffer3)[15] = buffer2[1]; 223 | 224 | hash_Transform(buffer1, (uint*)buffer3); 225 | 226 | byte digest[16]; 227 | byte* bufferptr = (byte*)buffer1; 228 | for(index = 0; index < 16; index++) { 229 | digest[index] = bufferptr[index]; 230 | } 231 | 232 | char buffer[33] = {0}; 233 | sprintf(buffer, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", digest[0], digest[1], digest[2], digest[3], digest[4], digest[5], digest[6], digest[7], digest[8], digest[9], digest[10], digest[11], digest[12], digest[13], digest[14], digest[15]); 234 | return std::string(buffer); 235 | } 236 | 237 | -------------------------------------------------------------------------------- /Core/Hash.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Hash.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef HASH_H 26 | #define HASH_H 27 | 28 | #include 29 | 30 | typedef unsigned char byte; 31 | typedef unsigned short word; 32 | typedef unsigned int uint; 33 | 34 | extern std::string hash_Compute(const byte* source, uint length); 35 | 36 | #endif -------------------------------------------------------------------------------- /Core/Logger.cpp: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Logger.cpp 24 | // ---------------------------------------------------------------------------- 25 | #include "Logger.h" 26 | #define LOGGER_FILENAME "ProSystem.log" 27 | 28 | byte logger_level = LOGGER_LEVEL_DEBUG; 29 | static FILE* logger_file = NULL; 30 | char a[255]=""; 31 | 32 | // ---------------------------------------------------------------------------- 33 | // GetTime 34 | // ---------------------------------------------------------------------------- 35 | static std::string logger_GetTime( ) { 36 | time_t current; 37 | time(¤t); 38 | std::string timestring = ctime(¤t); 39 | return timestring.erase(timestring.find_first_of("\n"), 1); 40 | } 41 | 42 | // ---------------------------------------------------------------------------- 43 | // Log 44 | // ---------------------------------------------------------------------------- 45 | static void logger_Log(std::string message, byte level, std::string source) { 46 | if(logger_file != NULL) { 47 | std::string entry = "[" + logger_GetTime( ) + "]"; 48 | switch(level) { 49 | case LOGGER_LEVEL_ERROR: 50 | entry += "[ERROR]"; 51 | break; 52 | case LOGGER_LEVEL_INFO: 53 | entry += "[INFO ]"; 54 | break; 55 | default: 56 | entry += "[DEBUG]"; 57 | break; 58 | } 59 | entry += " " + message; 60 | if(source.length( ) > 0) { 61 | entry += " " + source; 62 | } 63 | entry += "\n"; 64 | fwrite(entry.c_str( ), 1, entry.length( ), logger_file); 65 | fflush(logger_file); 66 | } 67 | } 68 | 69 | // ---------------------------------------------------------------------------- 70 | // Initialize 71 | // ---------------------------------------------------------------------------- 72 | bool logger_Initialize( ) { 73 | logger_file = fopen(LOGGER_FILENAME, "w"); 74 | return (logger_file != NULL); 75 | } 76 | 77 | // ---------------------------------------------------------------------------- 78 | // Initialize 79 | // ---------------------------------------------------------------------------- 80 | bool logger_Initialize(std::string filename) { 81 | logger_file = fopen(filename.c_str( ), "w"); 82 | return (logger_file != NULL); 83 | } 84 | 85 | 86 | // ---------------------------------------------------------------------------- 87 | // LogError ////////// 88 | // ---------------------------------------------------------------------------- 89 | void logger_LogError(int message, std::string source) { 90 | if(logger_level == LOGGER_LEVEL_ERROR || logger_level == LOGGER_LEVEL_INFO || logger_level == LOGGER_LEVEL_DEBUG) { 91 | LoadString(GetModuleHandle(NULL),message, a, 180); 92 | std::string b(a); 93 | logger_Log(b, LOGGER_LEVEL_ERROR, source); 94 | } 95 | } 96 | 97 | // ---------------------------------------------------------------------------- 98 | // LogError 99 | // ---------------------------------------------------------------------------- 100 | void logger_LogError(std::string message, std::string source) { 101 | if(logger_level == LOGGER_LEVEL_ERROR || logger_level == LOGGER_LEVEL_INFO || logger_level == LOGGER_LEVEL_DEBUG) { 102 | logger_Log(message, LOGGER_LEVEL_ERROR, source); 103 | } 104 | } 105 | 106 | 107 | // ---------------------------------------------------------------------------- 108 | // LogInfo 109 | // ---------------------------------------------------------------------------- 110 | void logger_LogInfo(int message, std::string source) { 111 | if(logger_level == LOGGER_LEVEL_INFO || logger_level == LOGGER_LEVEL_DEBUG) { 112 | LoadString(GetModuleHandle(NULL),message, a, 180); 113 | std::string b(a); 114 | logger_Log(b, LOGGER_LEVEL_INFO, source); 115 | } 116 | } 117 | 118 | // ---------------------------------------------------------------------------- 119 | // LogInfo ///////// 120 | // ---------------------------------------------------------------------------- 121 | void logger_LogInfo(std::string message, std::string source) { 122 | if(logger_level == LOGGER_LEVEL_INFO || logger_level == LOGGER_LEVEL_DEBUG) { 123 | logger_Log(message, LOGGER_LEVEL_INFO, source); 124 | } 125 | } 126 | 127 | // ---------------------------------------------------------------------------- 128 | // LogDebug //////////// 129 | // ---------------------------------------------------------------------------- 130 | void logger_LogDebug(int message, std::string source) { 131 | if(logger_level == LOGGER_LEVEL_DEBUG) { 132 | LoadString(GetModuleHandle(NULL),message, a, 180); 133 | std::string b(a); 134 | logger_Log(b, LOGGER_LEVEL_DEBUG, source); 135 | } 136 | } 137 | 138 | // ---------------------------------------------------------------------------- 139 | // LogDebug 140 | // ---------------------------------------------------------------------------- 141 | void logger_LogDebug(std::string message, std::string source) { 142 | if(logger_level == LOGGER_LEVEL_DEBUG) { 143 | logger_Log(message, LOGGER_LEVEL_DEBUG, source); 144 | } 145 | } 146 | 147 | // ---------------------------------------------------------------------------- 148 | // Release 149 | // ---------------------------------------------------------------------------- 150 | void logger_Release( ) { 151 | if(logger_file != NULL) { 152 | fclose(logger_file); 153 | } 154 | } -------------------------------------------------------------------------------- /Core/Logger.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Logger.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef LOGGER_H 26 | #define LOGGER_H 27 | #define LOGGER_LEVEL_DEBUG 0 28 | #define LOGGER_LEVEL_INFO 1 29 | #define LOGGER_LEVEL_ERROR 2 30 | #define NULL 0 31 | 32 | #include 33 | #include 34 | #include 35 | #include "Windows.h" 36 | #include "Resource.h" 37 | 38 | 39 | typedef unsigned char byte; 40 | typedef unsigned short word; 41 | typedef unsigned int uint; 42 | 43 | extern bool logger_Initialize( ); 44 | extern bool logger_Initialize(std::string filename); 45 | extern void logger_LogError(std::string message, std::string source); 46 | extern void logger_LogError(int message, std::string source); 47 | extern void logger_LogInfo(std::string message, std::string source); 48 | extern void logger_LogInfo(int message, std::string source); 49 | extern void logger_LogDebug(std::string message, std::string source); 50 | extern void logger_LogDebug(int, std::string source); 51 | extern void logger_Release( ); 52 | extern byte logger_level; 53 | 54 | #endif -------------------------------------------------------------------------------- /Core/Maria.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Maria.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef MARIA_H 26 | #define MARIA_H 27 | #define MARIA_SURFACE_SIZE 93440 28 | 29 | #include "Equates.h" 30 | #include "Pair.h" 31 | #include "Memory.h" 32 | #include "Rect.h" 33 | #include "Sally.h" 34 | 35 | typedef unsigned char byte; 36 | typedef unsigned short word; 37 | typedef unsigned int uint; 38 | 39 | extern void maria_Reset( ); 40 | extern uint maria_RenderScanline( ); 41 | extern void maria_Clear( ); 42 | extern rect maria_displayArea; 43 | extern rect maria_visibleArea; 44 | extern byte maria_surface[MARIA_SURFACE_SIZE]; 45 | extern word maria_scanline; 46 | 47 | #endif -------------------------------------------------------------------------------- /Core/Memory.cpp: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Memory.cpp 24 | // ---------------------------------------------------------------------------- 25 | #include "Memory.h" 26 | 27 | byte memory_ram[MEMORY_SIZE] = {0}; 28 | byte memory_rom[MEMORY_SIZE] = {0}; 29 | 30 | // ---------------------------------------------------------------------------- 31 | // Reset 32 | // ---------------------------------------------------------------------------- 33 | void memory_Reset( ) { 34 | uint index; 35 | for(index = 0; index < MEMORY_SIZE; index++) { 36 | memory_ram[index] = 0; 37 | memory_rom[index] = 1; 38 | } 39 | for(index = 0; index < 16384; index++) { 40 | memory_rom[index] = 0; 41 | } 42 | } 43 | // ---------------------------------------------------------------------------- 44 | // Read 45 | // ---------------------------------------------------------------------------- 46 | byte memory_Read(word address) { 47 | byte tmp_byte; 48 | 49 | switch ( address ) { 50 | case INTIM: 51 | case INTIM | 0x2: 52 | memory_ram[INTFLG] &= 0x7f; 53 | return memory_ram[INTIM]; 54 | break; 55 | case INTFLG: 56 | case INTFLG | 0x2: 57 | tmp_byte = memory_ram[INTFLG]; 58 | memory_ram[INTFLG] &= 0x7f; 59 | return tmp_byte; 60 | break; 61 | default: 62 | return memory_ram[address]; 63 | break; 64 | } 65 | } 66 | 67 | // ---------------------------------------------------------------------------- 68 | // Write 69 | // ---------------------------------------------------------------------------- 70 | void memory_Write(word address, byte data) { 71 | if(!memory_rom[address]) { 72 | switch(address) { 73 | case WSYNC: 74 | if(!(cartridge_flags & 128)) { 75 | memory_ram[WSYNC] = true; 76 | } 77 | break; 78 | case INPTCTRL: 79 | if(data == 22 && cartridge_IsLoaded( )) { 80 | cartridge_Store( ); 81 | } 82 | else if(data == 2 && bios_enabled) { 83 | bios_Store( ); 84 | } 85 | break; 86 | case INPT0: 87 | break; 88 | case INPT1: 89 | break; 90 | case INPT2: 91 | break; 92 | case INPT3: 93 | break; 94 | case INPT4: 95 | break; 96 | case INPT5: 97 | break; 98 | case AUDC0: 99 | tia_SetRegister(AUDC0, data); 100 | break; 101 | case AUDC1: 102 | tia_SetRegister(AUDC1, data); 103 | break; 104 | case AUDF0: 105 | tia_SetRegister(AUDF0, data); 106 | break; 107 | case AUDF1: 108 | tia_SetRegister(AUDF1, data); 109 | break; 110 | case AUDV0: 111 | tia_SetRegister(AUDV0, data); 112 | break; 113 | case AUDV1: 114 | tia_SetRegister(AUDV1, data); 115 | break; 116 | case SWCHB: 117 | break; 118 | case CTLSWB: 119 | break; 120 | case TIM1T: 121 | case TIM1T | 0x8: 122 | riot_SetTimer(TIM1T, data); 123 | break; 124 | case TIM8T: 125 | case TIM8T | 0x8: 126 | riot_SetTimer(TIM8T, data); 127 | break; 128 | case TIM64T: 129 | case TIM64T | 0x8: 130 | riot_SetTimer(TIM64T, data); 131 | break; 132 | case T1024T: 133 | case T1024T | 0x8: 134 | riot_SetTimer(T1024T, data); 135 | break; 136 | default: 137 | memory_ram[address] = data; 138 | if(address >= 8256 && address <= 8447) { 139 | memory_ram[address - 8192] = data; 140 | } 141 | else if(address >= 8512 && address <= 8702) { 142 | memory_ram[address - 8192] = data; 143 | } 144 | else if(address >= 64 && address <= 255) { 145 | memory_ram[address + 8192] = data; 146 | } 147 | else if(address >= 320 && address <= 511) { 148 | memory_ram[address + 8192] = data; 149 | } 150 | break; 151 | } 152 | } 153 | else { 154 | cartridge_Write(address, data); 155 | } 156 | } 157 | 158 | // ---------------------------------------------------------------------------- 159 | // WriteROM 160 | // ---------------------------------------------------------------------------- 161 | void memory_WriteROM(word address, word size, const byte* data) { 162 | if((address + size) <= MEMORY_SIZE && data != NULL) { 163 | for(uint index = 0; index < size; index++) { 164 | memory_ram[address + index] = data[index]; 165 | memory_rom[address + index] = 1; 166 | } 167 | } 168 | } 169 | 170 | // ---------------------------------------------------------------------------- 171 | // ClearROM 172 | // ---------------------------------------------------------------------------- 173 | void memory_ClearROM(word address, word size) { 174 | if((address + size) <= MEMORY_SIZE) { 175 | for(uint index = 0; index < size; index++) { 176 | memory_ram[address + index] = 0; 177 | memory_rom[address + index] = 0; 178 | } 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /Core/Memory.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Memory.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef MEMORY_H 26 | #define MEMORY_H 27 | #define MEMORY_SIZE 65536 28 | #define NULL 0 29 | 30 | #include "Equates.h" 31 | #include "Bios.h" 32 | #include "Cartridge.h" 33 | #include "Tia.h" 34 | #include "Riot.h" 35 | 36 | typedef unsigned char byte; 37 | typedef unsigned short word; 38 | typedef unsigned int uint; 39 | 40 | extern void memory_Reset( ); 41 | extern byte memory_Read(word address); 42 | extern void memory_Write(word address, byte data); 43 | extern void memory_WriteROM(word address, word size, const byte* data); 44 | extern void memory_ClearROM(word address, word size); 45 | extern byte memory_ram[MEMORY_SIZE]; 46 | extern byte memory_rom[MEMORY_SIZE]; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /Core/Pair.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Pair.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef PAIR_H 26 | #define PAIR_H 27 | 28 | typedef unsigned char byte; 29 | typedef unsigned short word; 30 | typedef unsigned int uint; 31 | 32 | union Pair { 33 | word w; 34 | struct Join { 35 | byte l; 36 | byte h; 37 | } b; 38 | }; 39 | 40 | typedef Pair pair; 41 | #endif 42 | -------------------------------------------------------------------------------- /Core/Palette.cpp: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Palette.h 24 | // ---------------------------------------------------------------------------- 25 | #include "Palette.h" 26 | 27 | std::string palette_filename; 28 | bool palette_default = true; 29 | byte palette_data[PALETTE_SIZE] = { 30 | 0x00,0x00,0x00,0x25,0x25,0x25,0x34,0x34,0x34,0x4F,0x4F,0x4F, 31 | 0x5B,0x5B,0x5B,0x69,0x69,0x69,0x7B,0x7B,0x7B,0x8A,0x8A,0x8A, 32 | 0xA7,0xA7,0xA7,0xB9,0xB9,0xB9,0xC5,0xC5,0xC5,0xD0,0xD0,0xD0, 33 | 0xD7,0xD7,0xD7,0xE1,0xE1,0xE1,0xF4,0xF4,0xF4,0xFF,0xFF,0xFF, 34 | 0x4C,0x32,0x00,0x62,0x3A,0x00,0x7B,0x4A,0x00,0x9A,0x60,0x00, 35 | 0xB5,0x74,0x00,0xCC,0x85,0x00,0xE7,0x9E,0x08,0xF7,0xAF,0x10, 36 | 0xFF,0xC3,0x18,0xFF,0xD0,0x20,0xFF,0xD8,0x28,0xFF,0xDF,0x30, 37 | 0xFF,0xE6,0x3B,0xFF,0xF4,0x40,0xFF,0xFA,0x4B,0xFF,0xFF,0x50, 38 | 0x99,0x25,0x00,0xAA,0x25,0x00,0xB4,0x25,0x00,0xD3,0x30,0x00, 39 | 0xDD,0x48,0x02,0xE2,0x50,0x09,0xF4,0x67,0x00,0xF4,0x75,0x10, 40 | 0xFF,0x9E,0x10,0xFF,0xAC,0x20,0xFF,0xBA,0x3A,0xFF,0xBF,0x50, 41 | 0xFF,0xC6,0x6D,0xFF,0xD5,0x80,0xFF,0xE4,0x90,0xFF,0xE6,0x99, 42 | 0x98,0x0C,0x0C,0x99,0x0C,0x0C,0xC2,0x13,0x00,0xD3,0x13,0x00, 43 | 0xE2,0x35,0x00,0xE3,0x40,0x00,0xE4,0x40,0x20,0xE5,0x52,0x30, 44 | 0xFD,0x78,0x54,0xFF,0x8A,0x6A,0xFF,0x98,0x7C,0xFF,0xA4,0x8B, 45 | 0xFF,0xB3,0x9E,0xFF,0xC2,0xB2,0xFF,0xD0,0xBA,0xFF,0xD7,0xC0, 46 | 0x99,0x00,0x00,0xA9,0x00,0x00,0xC2,0x04,0x00,0xD3,0x04,0x00, 47 | 0xDA,0x04,0x00,0xDB,0x08,0x00,0xE4,0x20,0x20,0xF6,0x40,0x40, 48 | 0xFB,0x70,0x70,0xFB,0x7E,0x7E,0xFB,0x8F,0x8F,0xFF,0x9F,0x9F, 49 | 0xFF,0xAB,0xAB,0xFF,0xB9,0xB9,0xFF,0xC9,0xC9,0xFF,0xCF,0xCF, 50 | 0x7E,0x00,0x50,0x80,0x00,0x50,0x80,0x00,0x5F,0x95,0x0B,0x74, 51 | 0xAA,0x22,0x88,0xBB,0x2F,0x9A,0xCE,0x3F,0xAD,0xD7,0x5A,0xB6, 52 | 0xE4,0x67,0xC3,0xEF,0x72,0xCE,0xFB,0x7E,0xDA,0xFF,0x8D,0xE1, 53 | 0xFF,0x9D,0xE5,0xFF,0xA5,0xE7,0xFF,0xAF,0xEA,0xFF,0xB8,0xEC, 54 | 0x48,0x00,0x6C,0x5C,0x04,0x88,0x65,0x0D,0x90,0x7B,0x23,0xA7, 55 | 0x93,0x3B,0xBF,0x9D,0x45,0xC9,0xA7,0x4F,0xD3,0xB2,0x5A,0xDE, 56 | 0xBD,0x65,0xE9,0xC5,0x6D,0xF1,0xCE,0x76,0xFA,0xD5,0x83,0xFF, 57 | 0xDA,0x90,0xFF,0xDE,0x9C,0xFF,0xE2,0xA9,0xFF,0xE6,0xB6,0xFF, 58 | 0x1B,0x00,0x70,0x22,0x1B,0x8D,0x37,0x30,0xA2,0x48,0x41,0xB3, 59 | 0x59,0x52,0xC4,0x63,0x5C,0xCE,0x6F,0x68,0xDA,0x7D,0x76,0xE8, 60 | 0x87,0x80,0xF8,0x93,0x8C,0xFF,0x9D,0x97,0xFF,0xA8,0xA3,0xFF, 61 | 0xB3,0xAF,0xFF,0xBC,0xB8,0xFF,0xC4,0xC1,0xFF,0xDA,0xD1,0xFF, 62 | 0x00,0x0D,0x7F,0x00,0x12,0xA7,0x00,0x18,0xC0,0x0A,0x2B,0xD1, 63 | 0x1B,0x4A,0xE3,0x2F,0x58,0xF0,0x37,0x68,0xFF,0x49,0x79,0xFF, 64 | 0x5B,0x85,0xFF,0x6D,0x96,0xFF,0x7F,0xA3,0xFF,0x8C,0xAD,0xFF, 65 | 0x96,0xB4,0xFF,0xA8,0xC0,0xFF,0xB7,0xCB,0xFF,0xC6,0xD6,0xFF, 66 | 0x00,0x29,0x5A,0x00,0x38,0x76,0x00,0x48,0x92,0x00,0x5C,0xAC, 67 | 0x00,0x71,0xC6,0x00,0x86,0xD0,0x0A,0x9B,0xDF,0x1A,0xA8,0xEC, 68 | 0x2B,0xB6,0xFF,0x3F,0xC2,0xFF,0x45,0xCB,0xFF,0x59,0xD3,0xFF, 69 | 0x7F,0xDA,0xFF,0x8F,0xDE,0xFF,0xA0,0xE2,0xFF,0xB0,0xEB,0xFF, 70 | 0x00,0x4A,0x00,0x00,0x4C,0x00,0x00,0x6A,0x20,0x50,0x8E,0x79, 71 | 0x40,0x99,0x99,0x00,0x9C,0xAA,0x00,0xA1,0xBB,0x01,0xA4,0xCC, 72 | 0x03,0xA5,0xD7,0x05,0xDA,0xE2,0x18,0xE5,0xFF,0x34,0xEA,0xFF, 73 | 0x49,0xEF,0xFF,0x66,0xF2,0xFF,0x84,0xF4,0xFF,0x9E,0xF9,0xFF, 74 | 0x00,0x4A,0x00,0x00,0x5D,0x00,0x00,0x70,0x00,0x00,0x83,0x00, 75 | 0x00,0x95,0x00,0x00,0xAB,0x00,0x07,0xBD,0x07,0x0A,0xD0,0x0A, 76 | 0x1A,0xD5,0x40,0x5A,0xF1,0x77,0x82,0xEF,0xA7,0x84,0xED,0xD1, 77 | 0x89,0xFF,0xED,0x7D,0xFF,0xFF,0x93,0xFF,0xFF,0x9B,0xFF,0xFF, 78 | 0x22,0x4A,0x03,0x27,0x53,0x04,0x30,0x64,0x05,0x3C,0x77,0x0C, 79 | 0x45,0x8C,0x11,0x5A,0xA5,0x13,0x1B,0xD2,0x09,0x1F,0xDD,0x00, 80 | 0x3D,0xCD,0x2D,0x3D,0xCD,0x30,0x58,0xCC,0x40,0x60,0xD3,0x50, 81 | 0xA2,0xEC,0x55,0xB3,0xF2,0x4A,0xBB,0xF6,0x5D,0xC4,0xF8,0x70, 82 | 0x2E,0x3F,0x0C,0x36,0x4A,0x0F,0x40,0x56,0x15,0x46,0x5F,0x17, 83 | 0x57,0x77,0x1A,0x65,0x85,0x1C,0x74,0x93,0x1D,0x8F,0xA5,0x25, 84 | 0xAD,0xB7,0x2C,0xBC,0xC7,0x30,0xC9,0xD5,0x33,0xD4,0xE0,0x3B, 85 | 0xE0,0xEC,0x42,0xEA,0xF6,0x45,0xF0,0xFD,0x47,0xF4,0xFF,0x6F, 86 | 0x55,0x24,0x00,0x5A,0x2C,0x00,0x6C,0x3B,0x00,0x79,0x4B,0x00, 87 | 0xB9,0x75,0x00,0xBB,0x85,0x00,0xC1,0xA1,0x20,0xD0,0xB0,0x2F, 88 | 0xDE,0xBE,0x3F,0xE6,0xC6,0x45,0xED,0xCD,0x57,0xF5,0xDB,0x62, 89 | 0xFB,0xE5,0x69,0xFC,0xEE,0x6F,0xFD,0xF3,0x77,0xFD,0xF3,0x7F, 90 | 0x5C,0x27,0x00,0x5C,0x2F,0x00,0x71,0x3B,0x00,0x7B,0x48,0x00, 91 | 0xB9,0x68,0x20,0xBB,0x72,0x20,0xC5,0x86,0x29,0xD7,0x96,0x33, 92 | 0xE6,0xA4,0x40,0xF4,0xB1,0x4B,0xFD,0xC1,0x58,0xFF,0xCC,0x55, 93 | 0xFF,0xD4,0x61,0xFF,0xDD,0x69,0xFF,0xE6,0x79,0xFF,0xEA,0x98 94 | }; 95 | 96 | // ---------------------------------------------------------------------------- 97 | // Load 98 | // ---------------------------------------------------------------------------- 99 | bool palette_Load(std::string filename) { 100 | if(filename.empty( ) || filename.length( ) == 0) { 101 | logger_LogError(IDS_PALETTE1,""); 102 | return false; 103 | } 104 | 105 | logger_LogInfo(IDS_PALETTE2,filename); 106 | 107 | FILE* file = fopen(filename.c_str( ), "rb"); 108 | if(file == NULL) { 109 | logger_LogError(IDS_PALETTE3,filename); 110 | return false; 111 | } 112 | 113 | if(fread(palette_data, 1, PALETTE_SIZE, file) != PALETTE_SIZE) { 114 | fclose(file); 115 | logger_LogError(IDS_PALETTE4,""); 116 | return false; 117 | } 118 | 119 | fclose(file); 120 | palette_filename = filename; 121 | return true; 122 | } 123 | 124 | // ---------------------------------------------------------------------------- 125 | // Load 126 | // ---------------------------------------------------------------------------- 127 | void palette_Load(const byte* data) { 128 | for(int index = 0; index < PALETTE_SIZE; index++) { 129 | palette_data[index] = data[index]; 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /Core/Palette.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Palette.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef PALETTE_H 26 | #define PALETTE_H 27 | #define PALETTE_SIZE 768 28 | #define NULL 0 29 | 30 | #include 31 | #include "Logger.h" 32 | 33 | typedef unsigned char byte; 34 | typedef unsigned short word; 35 | typedef unsigned int uint; 36 | 37 | extern bool palette_Load(std::string filename); 38 | extern void palette_Load(const byte* data); 39 | extern std::string palette_filename; 40 | extern byte palette_data[PALETTE_SIZE]; 41 | extern bool palette_default; 42 | 43 | #endif -------------------------------------------------------------------------------- /Core/Pokey.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // PokeySound is Copyright(c) 1997 by Ron Fries 24 | // 25 | // This library is free software; you can redistribute it and/or modify it 26 | // under the terms of version 2 of the GNU Library General Public License 27 | // as published by the Free Software Foundation. 28 | // 29 | // This library is distributed in the hope that it will be useful, but 30 | // WITHOUT ANY WARRANTY; without even the implied warranty of 31 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library 32 | // General Public License for more details. 33 | // To obtain a copy of the GNU Library General Public License, write to the 34 | // Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 35 | // 36 | // Any permitted reproduction of these routines, in whole or in part, must 37 | // bear this legend. 38 | // ---------------------------------------------------------------------------- 39 | // Pokey.h 40 | // ---------------------------------------------------------------------------- 41 | #ifndef POKEY_H 42 | #define POKEY_H 43 | #define POKEY_BUFFER_SIZE 624 44 | #define POKEY_AUDF1 0x4000 45 | #define POKEY_AUDC1 0x4001 46 | #define POKEY_AUDF2 0x4002 47 | #define POKEY_AUDC2 0x4003 48 | #define POKEY_AUDF3 0x4004 49 | #define POKEY_AUDC3 0x4005 50 | #define POKEY_AUDF4 0x4006 51 | #define POKEY_AUDC4 0x4007 52 | #define POKEY_AUDCTL 0x4008 53 | 54 | typedef unsigned char byte; 55 | typedef unsigned short word; 56 | typedef unsigned int uint; 57 | 58 | extern void pokey_Reset( ); 59 | extern void pokey_SetRegister(word address, byte value); 60 | extern void pokey_Process(uint length); 61 | extern void pokey_Clear( ); 62 | extern byte pokey_buffer[POKEY_BUFFER_SIZE]; 63 | extern uint pokey_size; 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /Core/ProSystem.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // ProSystem.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef PRO_SYSTEM_H 26 | #define PRO_SYSTEM_H 27 | #define NULL 0 28 | 29 | #include 30 | #include 31 | #include "Equates.h" 32 | #include "Bios.h" 33 | #include "Cartridge.h" 34 | #include "Maria.h" 35 | #include "Memory.h" 36 | #include "Region.h" 37 | #include "Riot.h" 38 | #include "Sally.h" 39 | #include "Archive.h" 40 | #include "Tia.h" 41 | #include "Pokey.h" 42 | 43 | typedef unsigned char byte; 44 | typedef unsigned short word; 45 | typedef unsigned int uint; 46 | 47 | extern void prosystem_Reset( ); 48 | extern void prosystem_ExecuteFrame(const byte* input); 49 | extern bool prosystem_Save(std::string filename, bool compress); 50 | extern bool prosystem_Load(std::string filename); 51 | extern void prosystem_Pause(bool pause); 52 | extern void prosystem_Close( ); 53 | extern bool prosystem_active; 54 | extern bool prosystem_paused; 55 | extern word prosystem_frequency; 56 | extern byte prosystem_frame; 57 | extern word prosystem_scanlines; 58 | extern uint prosystem_cycles; 59 | 60 | #endif -------------------------------------------------------------------------------- /Core/Rect.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Rect.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef RECT_H 26 | #define RECT_H 27 | 28 | typedef unsigned char byte; 29 | typedef unsigned short word; 30 | typedef unsigned int uint; 31 | 32 | struct Rect { 33 | uint left; 34 | uint top; 35 | uint right; 36 | uint bottom; 37 | 38 | uint GetArea( ) { 39 | return GetLength( ) * GetHeight( ); 40 | } 41 | 42 | uint GetLength( ) { 43 | return (right - left) + 1; 44 | } 45 | 46 | uint GetHeight( ) { 47 | return (bottom - top) + 1; 48 | } 49 | }; 50 | 51 | typedef Rect rect; 52 | #endif -------------------------------------------------------------------------------- /Core/Region.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Region.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef REGION_H 26 | #define REGION_H 27 | #define REGION_NTSC 0 28 | #define REGION_PAL 1 29 | #define REGION_AUTO 2 30 | 31 | #include "Cartridge.h" 32 | #include "ProSystem.h" 33 | #include "Maria.h" 34 | #include "Palette.h" 35 | #include "Tia.h" 36 | 37 | typedef unsigned char byte; 38 | typedef unsigned short word; 39 | typedef unsigned int uint; 40 | 41 | extern void region_Reset( ); 42 | extern byte region_type; 43 | 44 | #endif -------------------------------------------------------------------------------- /Core/Riot.cpp: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Riot.cpp 24 | // ---------------------------------------------------------------------------- 25 | #include "Riot.h" 26 | 27 | bool riot_timing = false; 28 | word riot_timer = TIM64T; 29 | byte riot_intervals; 30 | 31 | static bool riot_elapsed; 32 | static int riot_currentTime; 33 | static word riot_clocks; 34 | 35 | void riot_Reset(void) { 36 | } 37 | 38 | // ---------------------------------------------------------------------------- 39 | // SetInput 40 | // +----------+--------------+------------------------------------------------- 41 | // | Offset | Controller | Control 42 | // +----------+--------------+------------------------------------------------- 43 | // | 00 | Joystick 1 | Right 44 | // | 01 | Joystick 1 | Left 45 | // | 02 | Joystick 1 | Down 46 | // | 03 | Joystick 1 | Up 47 | // | 04 | Joystick 1 | Button 1 48 | // | 05 | Joystick 1 | Button 2 49 | // | 06 | Joystick 2 | Right 50 | // | 07 | Joystick 2 | Left 51 | // | 08 | Joystick 2 | Down 52 | // | 09 | Joystick 2 | Up 53 | // | 10 | Joystick 2 | Button 1 54 | // | 11 | Joystick 2 | Button 2 55 | // | 12 | Console | Reset 56 | // | 13 | Console | Select 57 | // | 14 | Console | Pause 58 | // | 15 | Console | Left Difficulty 59 | // | 16 | Console | Right Difficulty 60 | // +----------+--------------+------------------------------------------------- 61 | void riot_SetInput(const byte* input) { 62 | (input[0x00])? memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x80: memory_ram[SWCHA] = memory_ram[SWCHA] | 0x80; 63 | (input[0x01])? memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x40: memory_ram[SWCHA] = memory_ram[SWCHA] | 0x40; 64 | (input[0x02])? memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x20: memory_ram[SWCHA] = memory_ram[SWCHA] | 0x20; 65 | (input[0x03])? memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x10: memory_ram[SWCHA] = memory_ram[SWCHA] | 0x10; 66 | if(input[0x04]) { 67 | memory_ram[INPT0] = memory_ram[INPT0] | 0x80; 68 | memory_ram[INPT4] = memory_ram[INPT4] &~ 0x80; 69 | } 70 | else { 71 | memory_ram[INPT0] = memory_ram[INPT0] &~ 0x80; 72 | memory_ram[INPT4] = memory_ram[INPT4] | 0x80; 73 | } 74 | if(input[0x05]) { 75 | memory_ram[INPT1] = memory_ram[INPT1] | 0x80; 76 | memory_ram[INPT4] = memory_ram[INPT4] &~ 0x80; 77 | } 78 | else { 79 | memory_ram[INPT1] = memory_ram[INPT1] &~ 0x80; 80 | memory_ram[INPT4] = memory_ram[INPT4] | 0x80; 81 | } 82 | (input[0x06])? memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x08: memory_ram[SWCHA] = memory_ram[SWCHA] | 0x08; 83 | (input[0x07])? memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x04: memory_ram[SWCHA] = memory_ram[SWCHA] | 0x04; 84 | (input[0x08])? memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x02: memory_ram[SWCHA] = memory_ram[SWCHA] | 0x02; 85 | (input[0x09])? memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x01: memory_ram[SWCHA] = memory_ram[SWCHA] | 0x01; 86 | if(input[0x0a]) { 87 | memory_ram[INPT2] = memory_ram[INPT2] | 0x80; 88 | memory_ram[INPT5] = memory_ram[INPT5] &~ 0x80; 89 | } 90 | else { 91 | memory_ram[INPT2] = memory_ram[INPT2] &~ 0x80; 92 | memory_ram[INPT5] = memory_ram[INPT5] | 0x80; 93 | } 94 | if(input[0x0b]) { 95 | memory_ram[INPT3] = memory_ram[INPT3] | 0x80; 96 | memory_ram[INPT5] = memory_ram[INPT5] &~ 0x80; 97 | } 98 | else { 99 | memory_ram[INPT3] = memory_ram[INPT3] &~ 0x80; 100 | memory_ram[INPT5] = memory_ram[INPT5] | 0x80; 101 | } 102 | (input[0x0c])? memory_ram[SWCHB] = memory_ram[SWCHB] &~ 0x01: memory_ram[SWCHB] = memory_ram[SWCHB] | 0x01; 103 | (input[0x0d])? memory_ram[SWCHB] = memory_ram[SWCHB] &~ 0x02: memory_ram[SWCHB] = memory_ram[SWCHB] | 0x02; 104 | (input[0x0e])? memory_ram[SWCHB] = memory_ram[SWCHB] &~ 0x08: memory_ram[SWCHB] = memory_ram[SWCHB] | 0x08; 105 | (input[0x0f])? memory_ram[SWCHB] = memory_ram[SWCHB] &~ 0x40: memory_ram[SWCHB] = memory_ram[SWCHB] | 0x40; 106 | (input[0x10])? memory_ram[SWCHB] = memory_ram[SWCHB] &~ 0x80: memory_ram[SWCHB] = memory_ram[SWCHB] | 0x80; 107 | } 108 | 109 | // ---------------------------------------------------------------------------- 110 | // SetTimer 111 | // ---------------------------------------------------------------------------- 112 | void riot_SetTimer(word timer, byte intervals) { 113 | riot_timer = timer; 114 | riot_intervals = intervals; 115 | switch(timer) { 116 | case T1024T: 117 | riot_clocks = 1024; 118 | riot_timing = true; 119 | break; 120 | case TIM1T: 121 | riot_clocks = 1; 122 | riot_timing = true; 123 | break; 124 | case TIM8T: 125 | riot_clocks = 8; 126 | riot_timing = true; 127 | break; 128 | case TIM64T: 129 | riot_clocks = 64; 130 | riot_timing = true; 131 | break; 132 | } 133 | if(riot_timing) { 134 | riot_currentTime = riot_clocks * intervals; 135 | riot_elapsed = false; 136 | } 137 | } 138 | 139 | // ---------------------------------------------------------------------------- 140 | // UpdateTimer 141 | // ---------------------------------------------------------------------------- 142 | void riot_UpdateTimer(byte cycles) { 143 | riot_currentTime -= cycles; 144 | if(!riot_elapsed && riot_currentTime > 0) { 145 | memory_Write(INTIM, riot_currentTime / riot_clocks); 146 | } 147 | else { 148 | if(riot_elapsed) { 149 | if(riot_currentTime >= -255) { 150 | memory_Write(INTIM, riot_currentTime); 151 | } 152 | else { 153 | memory_Write(INTIM, 0); 154 | riot_timing = false; 155 | } 156 | } 157 | else { 158 | riot_currentTime = riot_clocks; 159 | memory_Write(INTIM, 0); 160 | memory_ram[INTFLG] |= 0x80; 161 | riot_elapsed = true; 162 | } 163 | } 164 | } 165 | -------------------------------------------------------------------------------- /Core/Riot.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Riot.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef RIOT_H 26 | #define RIOT_H 27 | 28 | #include "Equates.h" 29 | #include "Memory.h" 30 | 31 | typedef unsigned char byte; 32 | typedef unsigned short word; 33 | typedef unsigned int uint; 34 | 35 | extern void riot_Reset(void); 36 | extern void riot_SetInput(const byte* input); 37 | extern void riot_SetTimer(word timer, byte intervals); 38 | extern void riot_UpdateTimer(byte cycles); 39 | extern bool riot_timing; 40 | extern word riot_timer; 41 | extern byte riot_intervals; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /Core/Sally.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Sally.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef SALLY_H 26 | #define SALLY_H 27 | 28 | #include "Memory.h" 29 | #include "Pair.h" 30 | 31 | typedef unsigned char byte; 32 | typedef unsigned short word; 33 | typedef unsigned int uint; 34 | 35 | extern void sally_Reset( ); 36 | extern uint sally_ExecuteInstruction( ); 37 | extern uint sally_ExecuteRES( ); 38 | extern uint sally_ExecuteNMI( ); 39 | extern uint sally_ExecuteIRQ( ); 40 | extern byte sally_a; 41 | extern byte sally_x; 42 | extern byte sally_y; 43 | extern byte sally_p; 44 | extern byte sally_s; 45 | extern pair sally_pc; 46 | 47 | #endif -------------------------------------------------------------------------------- /Core/Tia.cpp: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // TiaSound is Copyright(c) 1997 by Ron Fries 24 | // 25 | // This library is free software; you can redistribute it and/or modify it 26 | // under the terms of version 2 of the GNU Library General Public License 27 | // as published by the Free Software Foundation. 28 | // 29 | // This library is distributed in the hope that it will be useful, but 30 | // WITHOUT ANY WARRANTY; without even the implied warranty of 31 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library 32 | // General Public License for more details. 33 | // To obtain a copy of the GNU Library General Public License, write to the 34 | // Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 35 | // 36 | // Any permitted reproduction of these routines, in whole or in part, must 37 | // bear this legend. 38 | // ---------------------------------------------------------------------------- 39 | // Tia.cpp 40 | // ---------------------------------------------------------------------------- 41 | #include "Tia.h" 42 | #define TIA_POLY4_SIZE 15 43 | #define TIA_POLY5_SIZE 31 44 | #define TIA_POLY9_SIZE 511 45 | 46 | byte tia_buffer[TIA_BUFFER_SIZE] = {0}; 47 | uint tia_size = 524; 48 | 49 | static const byte TIA_POLY4[ ] = {1,1,0,1,1,1,0,0,0,0,1,0,1,0,0}; 50 | static const byte TIA_POLY5[ ] = {0,0,1,0,1,1,0,0,1,1,1,1,1,0,0,0,1,1,0,1,1,1,0,1,0,1,0,0,0,0,1}; 51 | static const byte TIA_POLY9[ ] = {0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,1,1,1,0,0,1,0,1,0,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,0,1,1,1,0,1,1,0,0,1,0,0,1,1,1,1,0,1,0,0,0,0,1,1,0,1,1,0,0,0,1,0,0,0,1,1,1,1,0,1,0,1,1,0,1,0,1,0,0,0,0,1,1,0,1,0,1,0,0,0,1,0,1,0,0,0,1,1,1,0,0,1,1,0,1,1,0,0,1,1,1,1,1,0,0,1,1,0,0,0,1,1,0,1,0,0,0,1,1,0,0,1,1,1,1,0,0,1,0,0,0,1,1,1,0,0,1,1,0,1,0,1,1,0,1,1,0,1,0,0,1,0,0,1,1,1,1,1,1,0,1,1,1,1,0,1,1,0,0,0,0,1,1,1,1,1,0,0,0,1,0,0,0,0,1,0,0,0,1,0,1,0,1,1,0,0,0,0,1,0,1,1,1,1,0,1,0,0,0,1,1,0,0,0,1,1,1,0,1,1,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,1,0,0,0,1,0,0,0,1,0,1,1,1,1,0,0,0,1,1,1,0,0,0,1,0,0,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,0,1,0,1,1,1,1,0,0,1,0,1,0,1,1,1,0,0,0,0,0,1,1,0,1,1,0,0,0,1,0,1,0,1,0,0,0,0,1,0,1,1,1,0,0,0,0,1,0,0,1,0,1,0,0,0,1,0,1,1,1,0,0,1,1,1,1,1,1,1,0,0,0,0,0,1,0,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,0,1,1,0,1,0,0,0,0,0,1,1,1,1,0,0,1,0,0,1,0,1,1,1,1,1,1,1,0,1,0,0,1,0,0,0,1,1,0,1,1,1,0,0,0,1,0,1,0,0,1,0,1,0,1,0,1,1,1,0,0,1,0,1,1,0,0,1,1,1,1,1,0,0,0,1,1,0}; 52 | static const byte TIA_DIV31[ ] = {1,0,0,0,0,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}; 53 | static byte tia_volume[2] = {0}; 54 | static byte tia_counterMax[2] = {0}; 55 | static byte tia_counter[2] = {0}; 56 | static byte tia_audc[2] = {0}; 57 | static byte tia_audf[2] = {0}; 58 | static byte tia_audv[2] = {0}; 59 | static uint tia_poly4Cntr[2] = {0}; 60 | static uint tia_poly5Cntr[2] = {0}; 61 | static uint tia_poly9Cntr[2] = {0}; 62 | static uint tia_soundCntr = 0; 63 | 64 | // ---------------------------------------------------------------------------- 65 | // ProcessChannel 66 | // ---------------------------------------------------------------------------- 67 | static void tia_ProcessChannel(byte channel) { 68 | tia_poly5Cntr[channel]++; 69 | if(tia_poly5Cntr[channel] == TIA_POLY5_SIZE) { 70 | tia_poly5Cntr[channel] = 0; 71 | } 72 | if(((tia_audc[channel] & 2) == 0) || (((tia_audc[channel] & 1) == 0) && TIA_DIV31[tia_poly5Cntr[channel]]) || (((tia_audc[channel] & 1) == 1) && TIA_POLY5[tia_poly5Cntr[channel]])) { 73 | if(tia_audc[channel] & 4) { 74 | tia_volume[channel] = (!tia_volume[channel])? tia_audv[channel]: 0; 75 | } 76 | else if(tia_audc[channel] & 8) { 77 | if(tia_audc[channel] == 8) { 78 | tia_poly9Cntr[channel]++; 79 | if(tia_poly9Cntr[channel] == TIA_POLY9_SIZE) { 80 | tia_poly9Cntr[channel] = 0; 81 | } 82 | tia_volume[channel] = (TIA_POLY9[tia_poly9Cntr[channel]])? tia_audv[channel]: 0; 83 | } 84 | else { 85 | tia_volume[channel] = (TIA_POLY5[tia_poly5Cntr[channel]])? tia_audv[channel]: 0; 86 | } 87 | } 88 | else { 89 | tia_poly4Cntr[channel]++; 90 | if(tia_poly4Cntr[channel] == TIA_POLY4_SIZE) { 91 | tia_poly4Cntr[channel] = 0; 92 | } 93 | tia_volume[channel] = (TIA_POLY4[tia_poly4Cntr[channel]])? tia_audv[channel]: 0; 94 | } 95 | } 96 | } 97 | 98 | 99 | // ---------------------------------------------------------------------------- 100 | // Reset 101 | // ---------------------------------------------------------------------------- 102 | void tia_Reset( ) { 103 | tia_soundCntr = 0; 104 | for(int index = 0; index < 2; index++) { 105 | tia_volume[index] = 0; 106 | tia_counterMax[index] = 0; 107 | tia_counter[index] = 0; 108 | tia_audc[index] = 0; 109 | tia_audf[index] = 0; 110 | tia_audv[index] = 0; 111 | tia_poly4Cntr[index] = 0; 112 | tia_poly5Cntr[index] = 0; 113 | tia_poly9Cntr[index] = 0; 114 | } 115 | tia_Clear( ); 116 | } 117 | 118 | // ---------------------------------------------------------------------------- 119 | // Clear 120 | // ---------------------------------------------------------------------------- 121 | void tia_Clear( ) { 122 | for(int index = 0; index < TIA_BUFFER_SIZE; index++) { 123 | tia_buffer[index] = 0; 124 | } 125 | } 126 | 127 | // ---------------------------------------------------------------------------- 128 | // SetRegister 129 | // ---------------------------------------------------------------------------- 130 | void tia_SetRegister(word address, byte data) { 131 | byte channel; 132 | byte frequency; 133 | 134 | switch(address) { 135 | case AUDC0: 136 | tia_audc[0] = data & 15; 137 | channel = 0; 138 | break; 139 | case AUDC1: 140 | tia_audc[1] = data & 15; 141 | channel = 1; 142 | break; 143 | case AUDF0: 144 | tia_audf[0] = data & 31; 145 | channel = 0; 146 | break; 147 | case AUDF1: 148 | tia_audf[1] = data & 31; 149 | channel = 1; 150 | break; 151 | case AUDV0: 152 | tia_audv[0] = (data & 15) << 2; 153 | channel = 0; 154 | break; 155 | case AUDV1: 156 | tia_audv[1] = (data & 15) << 2; 157 | channel = 1; 158 | break; 159 | default: 160 | return; 161 | } 162 | 163 | if(tia_audc[channel] == 0) { 164 | frequency = 0; 165 | tia_volume[channel] = tia_audv[channel]; 166 | } 167 | else { 168 | frequency = tia_audf[channel] + 1; 169 | if(tia_audc[channel] > 11) { 170 | frequency *= 3; 171 | } 172 | } 173 | 174 | if(frequency != tia_counterMax[channel]) { 175 | tia_counterMax[channel] = frequency; 176 | if(tia_counter[channel] == 0 || frequency == 0) { 177 | tia_counter[channel] = frequency; 178 | } 179 | } 180 | } 181 | 182 | // -------------------------------------------------------------------------------------- 183 | // Process 184 | // -------------------------------------------------------------------------------------- 185 | void tia_Process(uint length) { 186 | for(uint index = 0; index < length; index++) { 187 | if(tia_counter[0] > 1) { 188 | tia_counter[0]--; 189 | } 190 | else if(tia_counter[0] == 1) { 191 | tia_counter[0] = tia_counterMax[0]; 192 | tia_ProcessChannel(0); 193 | } 194 | if(tia_counter[1] > 1) { 195 | tia_counter[1]--; 196 | } 197 | else if(tia_counter[1] == 1) { 198 | tia_counter[1] = tia_counterMax[1]; 199 | tia_ProcessChannel(1); 200 | } 201 | tia_buffer[tia_soundCntr++] = tia_volume[0] + tia_volume[1]; 202 | if(tia_soundCntr >= tia_size) { 203 | tia_soundCntr = 0; 204 | } 205 | } 206 | } -------------------------------------------------------------------------------- /Core/Tia.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // TiaSound is Copyright(c) 1997 by Ron Fries 24 | // 25 | // This library is free software; you can redistribute it and/or modify it 26 | // under the terms of version 2 of the GNU Library General Public License 27 | // as published by the Free Software Foundation. 28 | // 29 | // This library is distributed in the hope that it will be useful, but 30 | // WITHOUT ANY WARRANTY; without even the implied warranty of 31 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library 32 | // General Public License for more details. 33 | // To obtain a copy of the GNU Library General Public License, write to the 34 | // Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 35 | // 36 | // Any permitted reproduction of these routines, in whole or in part, must 37 | // bear this legend. 38 | // ---------------------------------------------------------------------------- 39 | // Tia.h 40 | // ---------------------------------------------------------------------------- 41 | #ifndef TIA_H 42 | #define TIA_H 43 | #define TIA_BUFFER_SIZE 624 44 | 45 | #include "Equates.h" 46 | 47 | typedef unsigned char byte; 48 | typedef unsigned short word; 49 | typedef unsigned int uint; 50 | 51 | extern void tia_Reset( ); 52 | extern void tia_SetRegister(word address, byte data); 53 | extern void tia_Clear( ); 54 | extern void tia_Process(uint length); 55 | extern byte tia_buffer[TIA_BUFFER_SIZE]; 56 | extern uint tia_size; 57 | 58 | #endif -------------------------------------------------------------------------------- /Help/CommandLine.htm: -------------------------------------------------------------------------------- 1 | 2 | Input 3 | 4 | 5 | 6 | 7 | 8 | 9 |
ProSystem Emulator 10 | Documentation

Command Line switches
The following list the command 12 | line switches allowed in ProSytem. If loading a rom file on the command line, it 13 | must be the last parameter in the list. 14 |
-Fullscreen   value
Use value = 1 for 15 | fullscreen
Use value = 0 for 16 | windowed

-MenuEnabled   value
Use value = 17 | 1 to enable the menu bar
Use value = 0 for no menu 18 | bar

-Palette   filename
filename is the 19 | palette to use. If the name contains spaces, be sure to surround it with 20 | quotes

-Zoom   value
Value can be 1 to 4 21 | to increase the window 22 | size

-Mute   value
Use value = 1 to mute 23 | the sound
Use value = 0 to enable 24 | sound

-Latency   value
Set to desired 25 | Sound Latency (0 to 26 | 5)

-SampleRate   value
Set to desired 27 | Sound Sample Rate (11025, 22050, 31440, 44100, 48000, 28 | 96000)

-Region   value
Use value = PAL 29 | for PAL
Use value = NTSC for NTSC
Use value = AUTO for 30 | Auto-Detect

Example

ProSystem -Fullscreen 0 31 | -MenuEnabled 1 C:\centipede.a78

This will start ProSystem in 32 | windowed mode, with the menu bar enabled, and with C:\centipede.a78 as the rom 33 | to load.
34 | -------------------------------------------------------------------------------- /Help/Display.htm: -------------------------------------------------------------------------------- 1 | 2 | Display 3 | 4 | 5 | 6 | 7 | 8 | 9 |
ProSystem Emulator 10 | Documentation
11 |

Display
The Display menu 12 | allows you to set the display properties of the emulator like the display mode, 13 | zoom and stretch, and window mode. You can also set the custom palette or 14 | default palette and take snapshots of the current display.

Setting 15 | fullscreen mode
You can set the emulator to display graphics in 16 | fullscreen mode by going to the display sub-menu (in the options menu) and selecting the Fullscreen menu item or 18 | use the shortcut Ctrl+F. You can also choose 19 | which display mode is used in the fullscreen window by going to the modes 20 | sub-menu in the display menu and select one of the display modes (all fullscreen 21 | display modes use 8 bpp). The display mode will change immediately after 22 | selecting the menu-item if you are in the fullscreen mode, otherwise the display 23 | mode will be displayed when you change to the fullscreen mode. The default 24 | display mode is 640x480x8. You can also choose to stretch the display so that it 25 | fills the entire screen by selecting the Stretched menu item from the display 26 | sub-menu. A check mark will be next to the display mode, stretched and 27 | fullscreen menu items indicating the current selection.

Setting window 28 | mode
The window mode is the default mode. You can switch to window mode 29 | if you are in fullscreen mode by going to the display sub-menu and selecting the 30 | fullscreen menu item or use the shortcut Ctrl+F. 31 | Display modes and the stretching option have no effect in window mode, but can 32 | be selected so that the changes take effect when you choose to go to fullscreen 33 | mode. You can also set the zoom level of the window by going to the display 34 | sub-menu and choosing the x1, x2, x3, or x4 menu item. This will set how much 35 | the window is resized in respect to the display dimensions. A check mark will be 36 | next to the zoom menu item indicating the zoom level chosen.

Using 37 | palettes
You can choose to use a custom palette or default palette by 38 | going to the display sub-menu and selecting the palette menu item. The Palette 39 | dialog box will be displayed, which will allow you to select the target palette 40 | file to be loaded. If a palette file has already been loaded, it will be 41 | displayed in the Palette dialog box. Navigate to the palette file and select the 42 | Open button. If you want to use the default palette instead of a custom palette, 43 | you can select the default button in the dialog box.



Palette files have a size of 768 bytes. 45 | Each collection of 3 bytes define the RGB color. The C++ code to create the 46 | palette would look like the following:

struct 47 | rgb {
  unsigned char r;
  unsigned char 48 | g;
  unsigned char b;
}

rgb palette[255] = 49 | {...}

Taking screen snapshots
You can take snapshots of 50 | the screen by going to the display sub-menu and selecting the snapshot menu item 51 | or use the shortcut F12. The snapshots are saved 52 | as bitmap files. Every file is stored in .BMP format with the same name as ROM + 53 | unique number (as in MESS, MAME).
54 |
 
55 |
For better conveniences, after cartridge loading, it is possible to 56 | adjust a format of screenshots. Remove non-web 57 | symbols - deletes from a name of a screenshot symbols which can 58 | cause problems at the publication of pictures on the Internet. Replace spaces by "_" replaces all symbols 60 | of space (" ") with an underlining sign "_" (it the problem of 61 | compatibility with some web servers 62 | dares).

63 | -------------------------------------------------------------------------------- /Help/Emulation.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | Emulation 4 | 5 | 6 | 7 |
ProSystem Emulator Documentation

8 | Emulation
9 | The emulation menu allows you to set general emulation properties such as the frame rate skip, supported region, and enable the bios and database.
10 |
11 | Setting the frame skip rate
12 | You can set the number of frames skipped by the emulator in a second by going to the emulation sub-menu in the options menu. Select the frame rate sub-menu and than choose a menu item. The number frames you can skip ranges from 0 (no frames are skipped) to 30 frames skipped. Skipping frames will ensure that the emulator can run on slower computers. A check mark next to the menu item indicates that that frame rate skip value has been chosen.
13 |
14 | Setting the region
15 | You can set the region that ProSystem will emulate by going to the region sub-menu and selecting a region menu item. You can choose to emulate a NTSC or PAL console or have ProSystem detect which region it should emulate by selecting the AUTO menu item. A check mark next to the menu item indicates the region has been chosen.
16 |
17 | Enabling and disabling the bios
18 | You can enable or disable a bios rom image by going to the emulation sub-menu and choosing the bios menu item. The bios dialog box will be displayed and will allow you to choose the target bios file to be loaded and enabled. If a bios file has already been loaded, it will be displayed in the filename text box and the folder where the loaded bios file is located will be displayed in the file explorer view. To accept the bios file, select the Enable button. To disable the bios from being displayed, select the Disable button. A check mark next to the bios menu item indicates that a bios has been loaded and is enabled. A bios rom image is not necessary to run the emulator.
19 |
20 |
21 |
22 | Enabled and disabling the database
23 | You can enable or disable the database that is used to configure loaded rom images by going to the emulation sub-menu and choosing the database menu item. The database dialog box will be displayed and will allow you to choose the target database file to be loaded and enabled. If a database file has already been loaded, it will be displayed in the filename text box and the folder where the loaded database file is located will be displayed in the file explorer view. To accept the database file, select the Enable button. To disable the bios from being displayed, select the Disable button. A check mark next to the database menu item indicates that a database has been loaded and is enabled.
24 |
25 |
26 |
27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Help/File.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | File 4 | 5 | 6 | 7 |
ProSystem Emulator Documentation

8 | File
9 | The file menu allows you to open and close rom images, save and load game states and exit the application.
10 |
11 | Opening and closing rom images
12 | You can open rom images to play in the emulator by going to the file menu and selecting the Open menu item or using the shortcut Ctrl+O. A file dialog box will be displayed to allow you to select a rom image file. Select a rom image file and press the Open button. The emulator supports .a78 files with the proper header format, raw binary files if the database option is enabled (see the Options section), and zip files that contain an archived rom image file. Once the rom image file has been loaded, it will start to play immediately. You can also open rom images through the recent sub-menu which contains the last ten rom images files that were opened in the emulator. Just select one of these menu items to load that rom image. The image files are ordered from latest (at the top of the recent sub-menu) to the oldest. You can also close the rom image when you are done by selecting the close menu item from the file menu.
13 |
14 |
15 |
16 | Rom images can also be loaded from the command line as the first and only argument. You can also associate a file type (such as .a78) with ProSystem emulator executable so that you can double click the rom image file to launch ProSystem and load the selected rom image automatically.
17 |
18 | Saving and loading game states
19 | You can save and load game states once a rom image has been opened in the emulator. To save a game state, go to the file menu and select the Save menu item or use the shortcut Ctrl+S. A file dialog box will be displayed to allow you to select the destination of the game state file. Once the destination folder has been selected, type a name for the save state and select the save type as a uncompressed .sav file or compressed .zip file. Press the Save button when you are ready to save the game. To load a game state, go to the file menu and select the Load menu item or use the shortcut Ctrl+L. A file dialog box will be displayed to allow you to select the game state file to load. Press the open button to load the game state file into the emulator. The load will only succeed if the game state file was saved with the same rom image that is currently loaded in the emulator. Once a game state file has been loaded, the game will start from that saved state immediately.
20 |
21 | Exiting the emulator
22 | You can exit the emulator by going to the file menu and selecting the Exit menu item or the close button on the title bar in the far right corner of the window. The current configuration will be saved to the ProSystem.ini file.
23 |
24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Help/Help.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | Help 4 | 5 | 6 | 7 |
ProSystem Emulator Documentation

8 | Help
9 | The help menu allows you to view the online documentation for the ProSystem emulator and view the about dialog box.
10 |
11 | Finding help
12 | You can view the online help by going to the help menu and selecting the contents or index menu items or use the shortcut F1. The help window will open and will allow you to view the user's guide.
13 |
14 | About ProSystem emulator
15 | You can view the about dialog box by going to the help menu and selecting the about menu item.
16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /Help/History.htm: -------------------------------------------------------------------------------- 1 | 2 | History 3 | 4 | 5 | 6 | 7 | 8 | 9 |
ProSystem Emulator 10 | Documentation
11 |

History
List of revisions, 12 | enhancements and bug fixes for each release of the ProSystem 13 | Emulator.

Version 0.1 (02/14/2005)
Initial 14 | release


Version 1.1 (01/07/2007)
* Fixed Palette file not 15 | being used on reset
* Changed default palette to Nabuko78's palette
* 16 | Added joystick support
Updated by Brian Berlin 17 | (jberlin@cfl.rr.com)

Version 1.2 (04/28/2007)
* Implemented 18 | INTFLG (Beef Drop now works)
* Added Command Line parameters
* Added 19 | mapping of Exit and Menu Enable keys
* Added storing of Menu Enable 20 | parameter
Updated by Brian Berlin (jberlin@cfl.rr.com)
22 |
 
23 |
Version 1.3 (05/12/2008)
* Modified snapshot 24 | engine
25 |
* Take screenshots by press F12 without any prompt
26 |
* Insignificant changes in the menu
27 |
* Moved all texts in resource (for future translations)
28 |
* Has put check on attempt to load CC2 hack's (in log 29 | file registers "ProSystem do not want to execute CC2 hacks.")
30 |
* The default palette is updated to Underball's latest palette. It is the 31 | best palette available with Hex values taken directly from a 7800.
32 |
* A little optimisation in logging messages
33 |
* "Unfortunately, everytime you exit and relaunch Prosystem it returns 34 | back to its default setting of 44100." - Fixed
35 |
* Command line "-SampleRate" - Fixed
36 |
* Help file updated
37 |
* "If you launch a ROM from the command line the sound is a second or 38 | two behind the action, regardless of the sound latency setting. This is fixed by 39 | hitting 'Tab' bringing up the menu bar (And then hit 'Tab' again to get rid of 40 | it). However, it would be nice for the sound to be in sync when launching from a 41 | command line without the need of bringing up the file bar menu." - 42 | Fixed
43 |
Updated by Leonis (tv-games@yandex.ru) (sorry for my English) 45 | :)
46 | 47 | -------------------------------------------------------------------------------- /Help/Images/BiosDialog.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gstanton/ProSystem1_3/3040295934c68024ecf89b45b50107ea1c271e66/Help/Images/BiosDialog.jpg -------------------------------------------------------------------------------- /Help/Images/ConsoleDialog.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gstanton/ProSystem1_3/3040295934c68024ecf89b45b50107ea1c271e66/Help/Images/ConsoleDialog.jpg -------------------------------------------------------------------------------- /Help/Images/Controller1Dialog.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gstanton/ProSystem1_3/3040295934c68024ecf89b45b50107ea1c271e66/Help/Images/Controller1Dialog.jpg -------------------------------------------------------------------------------- /Help/Images/Controller2Dialog.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gstanton/ProSystem1_3/3040295934c68024ecf89b45b50107ea1c271e66/Help/Images/Controller2Dialog.jpg -------------------------------------------------------------------------------- /Help/Images/DatabaseDialog.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gstanton/ProSystem1_3/3040295934c68024ecf89b45b50107ea1c271e66/Help/Images/DatabaseDialog.jpg -------------------------------------------------------------------------------- /Help/Images/FileDialog.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gstanton/ProSystem1_3/3040295934c68024ecf89b45b50107ea1c271e66/Help/Images/FileDialog.jpg -------------------------------------------------------------------------------- /Help/Images/PaletteDialog.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gstanton/ProSystem1_3/3040295934c68024ecf89b45b50107ea1c271e66/Help/Images/PaletteDialog.jpg -------------------------------------------------------------------------------- /Help/Images/Screenshot1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gstanton/ProSystem1_3/3040295934c68024ecf89b45b50107ea1c271e66/Help/Images/Screenshot1.jpg -------------------------------------------------------------------------------- /Help/Images/Screenshot2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gstanton/ProSystem1_3/3040295934c68024ecf89b45b50107ea1c271e66/Help/Images/Screenshot2.jpg -------------------------------------------------------------------------------- /Help/Images/UserDialog.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gstanton/ProSystem1_3/3040295934c68024ecf89b45b50107ea1c271e66/Help/Images/UserDialog.jpg -------------------------------------------------------------------------------- /Help/Input.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | Input 4 | 5 | 6 | 7 |
ProSystem Emulator Documentation

8 | Input
9 | The input menu allows you to setup the game controls. You can setup the keyboard mapping for both controllers and the console switches.
10 |
11 | Configuring the controllers
12 | You can configure both the emulated controllers by going to the input sub-menu in the options menu and selecting the controller 1 or controller 2 menu items. The controller dialog box will be displayed that will allow you to choose keyboard keys or joystick parts for the emulated controller directions and fire buttons. The default keyboard mapping is included in the pictures below of the controller dialog boxes. After choosing the new keys for the controller, press the OK button to apply the changes.
13 |
14 |        15 |
16 |
17 | Configuring the console switches
18 | You can configure the emulated console switches by going to the input menu and selecting the console menu item. The console dialog box will be displayed that will allow you to choose the keyboard keys or joystick parts for the emulated console switches. The default key keyboard mapping is included in the picture of the console switch dialog box. After choosing the new keys for the console switches, press the OK button to apply the changes.
19 |
20 |
21 |
22 | Configuring user input
23 | You can configure user input by going to the input menu and selecting the user menu item. The user dialog box will be displayed that will allow you to choose the keyboard keys or joystick parts for the user input. Use the modifier dropdown to create keyboard combinations for the user input. The default key keyboard mapping is included in the picture of the user dialog box. After choosing the new keys for user input, press the OK button to apply the changes.
24 |
25 |
26 | 27 | 28 | -------------------------------------------------------------------------------- /Help/Introduction.htm: -------------------------------------------------------------------------------- 1 | 2 | Introduction 3 | 4 | 5 | 6 | 7 | 8 | 9 |
ProSystem Emulator 10 | Documentation

Introduction
ProSystem is an emulator for the Windows 12 | operating system that will allow you to play Atari 7800 video games on your PC. 13 | An emulator is a program that has the ability to imitate another program, 14 | device, or computer. The ProSystem emulator imitates the Atari 7800's CPU, 15 | video, audio, joystick controls, etc. Before you can use the emulator, you will 16 | need to obtain rom images that are compatible with the Atari 7800. The rom 17 | images are the actual data that is loaded into the emulator which allows you to 18 | play the game. The rom images can be downloaded from various sources on the 19 | internet. Please don't ask me for rom images.

The ProSystem emulator was 20 | written in the C/C++ language and uses the Windows API and DirectX to help 21 | emulate the display, sound and input. It emulates both the NTSC and PAL 22 | consoles. Please see the documentation for a description of the other 23 | features.

  

Please read the license included with the 25 | software before using the emulator.

Credit
Thanks to Ron Fries 26 | for his Tia and Pokey source code which I modified to work with the ProSystem 27 | emulator. Additional thanks to Eckhard Stolberg for his 7800 Bank Switching 28 | Guide. And finally, thanks to Dan Boris for his Atari 7800 source code and 29 | information on his web site that helped guide my development 30 | effort.

Disclaimer
I'm not responsible for any loss or damage 31 | that may occur from the use or misuse of the ProSystem emulator. Use this 32 | software at your own risk. If you do not agree with these terms, please remove 33 | the software.

Contact
Please contact me if you find any defects 34 | or to suggest any enhancements. If possible, please include the hardware (video 35 | card, sound card, etc) and software (operating system, directX version) on the 36 | system.

Greg Stanton
https://home.comcast.net/~gscottstanton/
gscottstanton@comcast.net

39 |
40 |
ProSystem Emulator
Copyright(C) 2005 Greg Stanton

This program is 41 | free software; you can redistribute it and/or modify it under the terms of the 42 | GNU General Public License as published by the Free Software Foundation; either 43 | version 2 of the License, or (at your option) any later version.

This 44 | program is distributed in the hope that it will be useful, but WITHOUT ANY 45 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 46 | PARTICULAR PURPOSE. See the GNU General Public License for more 47 | details.

You should have received a copy of the GNU General Public 48 | License along with this program; if not, write to the Free Software Foundation, 49 | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 50 | USA

51 | -------------------------------------------------------------------------------- /Help/Options.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options 4 | 5 | 6 | 7 |
ProSystem Emulator Documentation

8 | Options
9 | The options menu allows you to reset and pause the current game and remove the menu. It also contains sub-menus for the display, sound, emulation and input. For more information about the sub-menus please see the following sections:
10 |
11 | Display
12 | Sound
13 | Emulation
14 | Input
15 |
16 | Pausing and Resetting
17 | You can pause and reset a game once a rom image has been opened in the emulator. To reset the game, go to the options menu and select the Reset menu item or use the shortcut Ctrl+R. This will immediately reset the game. To pause the game, go to the options menu and select the Pause menu item or use the shortcut Ctrl+P. Use the Pause menu item or shortcut again to un-pause the game. The game will also be un-paused if you reset it. Pausing and Resetting from the menu is not the same as pausing and resetting with the console keyboard keys (see the input section). A check mark next to the pause menu item indicates that the emulator is paused.
18 |
19 | Removing the menu
20 | You can remove the menu from the window by going to the options menu and selecting the "Menu" menu item or use the shortcut Esc. To display the menu again, use the shortcut Esc.
21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /Help/Overview.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | Overview 4 | 5 | 6 | 7 |
ProSystem Emulator Documentation

8 | Overview
9 | You can start the ProSystem emulator by double clicking the executable in windows explorer or running it from the command line. The command line accepts one optional argument, the name of a rom image file that will be opened automatically when the emulator starts.
10 |
11 | The first time the emulator is started, it will display a window with a main menu. Most of the options for the ProSystem emulator are set through the menus. The rest of this guide describes the menu and sub-menu options.
12 |
13 | File
14 | Options
15 | Display
16 | Sound
17 | Emulation
18 | Input
19 | Help
20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /Help/ProSystem.hhc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
    9 |
  • 10 | 11 | 12 | 13 |
  • 14 | 15 | 16 | 17 |
  • 18 | 19 | 20 | 21 |
  • 22 | 23 | 24 | 25 |
  • 26 | 27 | 28 | 29 |
  • 30 | 31 | 32 | 33 |
  • 34 | 35 | 36 | 37 |
  • 38 | 39 | 40 | 41 |
  • 42 | 43 | 44 | 45 |
  • 46 | 47 | 48 | 49 |
  • 50 | 51 | 52 | 53 |
  • 54 | 55 | 56 | 57 |
  • 58 | 59 | 60 | 61 |
62 | -------------------------------------------------------------------------------- /Help/ProSystem.hhk: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
    8 |
9 | 10 | -------------------------------------------------------------------------------- /Help/ProSystem.hhp: -------------------------------------------------------------------------------- 1 | [OPTIONS] 2 | Compatibility=1.1 or later 3 | Compiled file=ProSystem.chm 4 | Contents file=ProSystem.hhc 5 | Default topic=Introduction.htm 6 | Display compile progress=Yes 7 | Full-text search=Yes 8 | Index file=ProSystem.hhk 9 | Language=0x409 English (United States) 10 | Title=ProSystem Documentation 11 | 12 | 13 | [FILES] 14 | Introduction.htm 15 | Input.htm 16 | Display.htm 17 | Sound.htm 18 | Emulation.htm 19 | Options.htm 20 | File.htm 21 | Help.htm 22 | History.htm 23 | Requirements.htm 24 | Overview.htm 25 | 26 | [INFOTYPES] 27 | 28 | -------------------------------------------------------------------------------- /Help/Requirements.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | Requirements 4 | 5 | 6 | 7 |
ProSystem Emulator Documentation

8 | Requirements
9 | Below is a list of the minimum and recommended requirements needed to run the ProSystem emulator. Meeting the minimum requirements means that you can run the emulator but you may have to change some of the settings (turn off the sound, run in fullscreen mode, use frame skipping). Meeting the recommended requirements means that you may be able to run the emulator with all the options enabled. Neither set of requirements guarantees that the emulator will perform as advertised.
10 |
11 | Minimum Requirements
12 |
    13 |
  • PC running Windows 98/98SE/ME/2000/XP 14 |
  • 128MB of system memory 15 |
  • Pentium class processor or better running at 400MHZ 16 |
  • Video card that supports DirectX and has 8MB of video RAM 17 |
  • Sound card that supports DirectX 18 |
  • DirectX 6 19 |
20 | Recommended Requirements
21 |
    22 |
  • PC runing Windows 98/98SE/ME/2000/XP 23 |
  • 256MB of system memory 24 |
  • Pentium class processor or better running at 1GHZ 25 |
  • Video card that supports DirectX and has 64MB of video RAM 26 |
  • Sound card that supports DirectX 27 |
  • DirectX 9 28 |
29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Help/Sound.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | Sound 4 | 5 | 6 | 7 |
ProSystem Emulator Documentation

8 | Sound
9 | The sound menu allows you set the sound properties for the emulator including the sample rate, latency and muting the sound.
10 |
11 | Turning the sound on and off
12 | You can turn on and off the sound by going to the sound sub-menu in the options menu and select the mute menu item or use the shortcut Ctrl+M. A check mark next to the mute menu item indicates that the sound is muted.
13 |
14 | Setting the sample rate and latency
15 | You can set the sample rate of the sound by going to the sound sub-menu and choose the sample rate sub-menu and select a sample rate menu item. The sample rates range from 11025 hz - 90000 hz. The default sample rate is 44100 which should be fine for most sound cards. You can also set the latency of the sound by going to the latency sub-menu and selecting a latency value. The default latency should work fine for most situations. Setting the sample rate and lantency take effect immediately after the user selects the menu-item. A check mark next to the menu item indicates the sample rate and latency chosen.
16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Help/Troubleshooting.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
ProSystem Emulator 10 | Documentation
11 |

Blank 12 | screen
13 |
You can get blank screen after loading these 14 | games:
15 |
 
16 |
Realsports Baseball
Tank Command
Tower 17 | Toppler
Water Ski
18 |
 
If this happens, use a different version of 20 | the ROM (for example, from the collection TOSEC). It is likely that 21 | other games not listed above may have a similar problem. 22 |
 
23 | -------------------------------------------------------------------------------- /Lib/Crypt.h: -------------------------------------------------------------------------------- 1 | /* crypt.h -- base code for crypt/uncrypt ZIPfile 2 | 3 | 4 | Version 1.01e, February 12th, 2005 5 | 6 | Copyright (C) 1998-2005 Gilles Vollant 7 | 8 | This code is a modified version of crypting code in Infozip distribution 9 | 10 | The encryption/decryption parts of this source code (as opposed to the 11 | non-echoing password parts) were originally written in Europe. The 12 | whole source package can be freely distributed, including from the USA. 13 | (Prior to January 2000, re-export from the US was a violation of US law.) 14 | 15 | This encryption code is a direct transcription of the algorithm from 16 | Roger Schlafly, described by Phil Katz in the file appnote.txt. This 17 | file (appnote.txt) is distributed with the PKZIP program (even in the 18 | version without encryption capabilities). 19 | 20 | If you don't need crypting in your application, just define symbols 21 | NOCRYPT and NOUNCRYPT. 22 | 23 | This code support the "Traditional PKWARE Encryption". 24 | 25 | The new AES encryption added on Zip format by Winzip (see the page 26 | http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong 27 | Encryption is not supported. 28 | */ 29 | 30 | #define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8)) 31 | 32 | /*********************************************************************** 33 | * Return the next byte in the pseudo-random sequence 34 | */ 35 | static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab) 36 | { 37 | unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an 38 | * unpredictable manner on 16-bit systems; not a problem 39 | * with any known compiler so far, though */ 40 | 41 | temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2; 42 | return (int)(((temp * (temp ^ 1)) >> 8) & 0xff); 43 | } 44 | 45 | /*********************************************************************** 46 | * Update the encryption keys with the next byte of plain text 47 | */ 48 | static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c) 49 | { 50 | (*(pkeys+0)) = CRC32((*(pkeys+0)), c); 51 | (*(pkeys+1)) += (*(pkeys+0)) & 0xff; 52 | (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; 53 | { 54 | register int keyshift = (int)((*(pkeys+1)) >> 24); 55 | (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift); 56 | } 57 | return c; 58 | } 59 | 60 | 61 | /*********************************************************************** 62 | * Initialize the encryption keys and the random header according to 63 | * the given password. 64 | */ 65 | static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab) 66 | { 67 | *(pkeys+0) = 305419896L; 68 | *(pkeys+1) = 591751049L; 69 | *(pkeys+2) = 878082192L; 70 | while (*passwd != '\0') { 71 | update_keys(pkeys,pcrc_32_tab,(int)*passwd); 72 | passwd++; 73 | } 74 | } 75 | 76 | #define zdecode(pkeys,pcrc_32_tab,c) \ 77 | (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab))) 78 | 79 | #define zencode(pkeys,pcrc_32_tab,c,t) \ 80 | (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c)) 81 | 82 | #ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED 83 | 84 | #define RAND_HEAD_LEN 12 85 | /* "last resort" source for second part of crypt seed pattern */ 86 | # ifndef ZCR_SEED2 87 | # define ZCR_SEED2 3141592654UL /* use PI as default pattern */ 88 | # endif 89 | 90 | static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting) 91 | const char *passwd; /* password string */ 92 | unsigned char *buf; /* where to write header */ 93 | int bufSize; 94 | unsigned long* pkeys; 95 | const unsigned long* pcrc_32_tab; 96 | unsigned long crcForCrypting; 97 | { 98 | int n; /* index in random header */ 99 | int t; /* temporary */ 100 | int c; /* random byte */ 101 | unsigned char header[RAND_HEAD_LEN-2]; /* random header */ 102 | static unsigned calls = 0; /* ensure different random header each time */ 103 | 104 | if (bufSize> 7) & 0xff; 119 | header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t); 120 | } 121 | /* Encrypt random header (last two bytes is high word of crc) */ 122 | init_keys(passwd, pkeys, pcrc_32_tab); 123 | for (n = 0; n < RAND_HEAD_LEN-2; n++) 124 | { 125 | buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t); 126 | } 127 | buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t); 128 | buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t); 129 | return n; 130 | } 131 | 132 | #endif 133 | -------------------------------------------------------------------------------- /Lib/HtmlHelp.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gstanton/ProSystem1_3/3040295934c68024ecf89b45b50107ea1c271e66/Lib/HtmlHelp.lib -------------------------------------------------------------------------------- /Lib/Ioapi.h: -------------------------------------------------------------------------------- 1 | /* ioapi.h -- IO base function header for compress/uncompress .zip 2 | files using zlib + zip or unzip API 3 | 4 | Version 1.01e, February 12th, 2005 5 | 6 | Copyright (C) 1998-2005 Gilles Vollant 7 | */ 8 | 9 | #ifndef _ZLIBIOAPI_H 10 | #define _ZLIBIOAPI_H 11 | 12 | 13 | #define ZLIB_FILEFUNC_SEEK_CUR (1) 14 | #define ZLIB_FILEFUNC_SEEK_END (2) 15 | #define ZLIB_FILEFUNC_SEEK_SET (0) 16 | 17 | #define ZLIB_FILEFUNC_MODE_READ (1) 18 | #define ZLIB_FILEFUNC_MODE_WRITE (2) 19 | #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3) 20 | 21 | #define ZLIB_FILEFUNC_MODE_EXISTING (4) 22 | #define ZLIB_FILEFUNC_MODE_CREATE (8) 23 | 24 | 25 | #ifndef ZCALLBACK 26 | 27 | #if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK) 28 | #define ZCALLBACK CALLBACK 29 | #else 30 | #define ZCALLBACK 31 | #endif 32 | #endif 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); 39 | typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); 40 | typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); 41 | typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream)); 42 | typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin)); 43 | typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream)); 44 | typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream)); 45 | 46 | typedef struct zlib_filefunc_def_s 47 | { 48 | open_file_func zopen_file; 49 | read_file_func zread_file; 50 | write_file_func zwrite_file; 51 | tell_file_func ztell_file; 52 | seek_file_func zseek_file; 53 | close_file_func zclose_file; 54 | testerror_file_func zerror_file; 55 | voidpf opaque; 56 | } zlib_filefunc_def; 57 | 58 | 59 | 60 | void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); 61 | 62 | #define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size)) 63 | #define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size)) 64 | #define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream)) 65 | #define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode)) 66 | #define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream)) 67 | #define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream)) 68 | 69 | 70 | #ifdef __cplusplus 71 | } 72 | #endif 73 | 74 | #endif 75 | 76 | -------------------------------------------------------------------------------- /Lib/Zconf.h: -------------------------------------------------------------------------------- 1 | /* zconf.h -- configuration of the zlib compression library 2 | * Copyright (C) 1995-2003 Jean-loup Gailly. 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #ifndef ZCONF_H 9 | #define ZCONF_H 10 | 11 | /* 12 | * If you *really* need a unique prefix for all types and library functions, 13 | * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. 14 | */ 15 | #ifdef Z_PREFIX 16 | # define deflateInit_ z_deflateInit_ 17 | # define deflate z_deflate 18 | # define deflateEnd z_deflateEnd 19 | # define inflateInit_ z_inflateInit_ 20 | # define inflate z_inflate 21 | # define inflateEnd z_inflateEnd 22 | # define deflateInit2_ z_deflateInit2_ 23 | # define deflateSetDictionary z_deflateSetDictionary 24 | # define deflateCopy z_deflateCopy 25 | # define deflateReset z_deflateReset 26 | # define deflatePrime z_deflatePrime 27 | # define deflateParams z_deflateParams 28 | # define deflateBound z_deflateBound 29 | # define inflateInit2_ z_inflateInit2_ 30 | # define inflateSetDictionary z_inflateSetDictionary 31 | # define inflateSync z_inflateSync 32 | # define inflateSyncPoint z_inflateSyncPoint 33 | # define inflateCopy z_inflateCopy 34 | # define inflateReset z_inflateReset 35 | # define compress z_compress 36 | # define compress2 z_compress2 37 | # define compressBound z_compressBound 38 | # define uncompress z_uncompress 39 | # define adler32 z_adler32 40 | # define crc32 z_crc32 41 | # define get_crc_table z_get_crc_table 42 | 43 | # define Byte z_Byte 44 | # define uInt z_uInt 45 | # define uLong z_uLong 46 | # define Bytef z_Bytef 47 | # define charf z_charf 48 | # define intf z_intf 49 | # define uIntf z_uIntf 50 | # define uLongf z_uLongf 51 | # define voidpf z_voidpf 52 | # define voidp z_voidp 53 | #endif 54 | 55 | #if defined(__MSDOS__) && !defined(MSDOS) 56 | # define MSDOS 57 | #endif 58 | #if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) 59 | # define OS2 60 | #endif 61 | #if defined(_WINDOWS) && !defined(WINDOWS) 62 | # define WINDOWS 63 | #endif 64 | #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) 65 | # define WIN32 66 | #endif 67 | #if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) 68 | # if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) 69 | # ifndef SYS16BIT 70 | # define SYS16BIT 71 | # endif 72 | # endif 73 | #endif 74 | 75 | /* 76 | * Compile with -DMAXSEG_64K if the alloc function cannot allocate more 77 | * than 64k bytes at a time (needed on systems with 16-bit int). 78 | */ 79 | #ifdef SYS16BIT 80 | # define MAXSEG_64K 81 | #endif 82 | #ifdef MSDOS 83 | # define UNALIGNED_OK 84 | #endif 85 | 86 | #ifdef __STDC_VERSION__ 87 | # ifndef STDC 88 | # define STDC 89 | # endif 90 | # if __STDC_VERSION__ >= 199901L 91 | # ifndef STDC99 92 | # define STDC99 93 | # endif 94 | # endif 95 | #endif 96 | #if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) 97 | # define STDC 98 | #endif 99 | #if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) 100 | # define STDC 101 | #endif 102 | #if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) 103 | # define STDC 104 | #endif 105 | #if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) 106 | # define STDC 107 | #endif 108 | 109 | #if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ 110 | # define STDC 111 | #endif 112 | 113 | #ifndef STDC 114 | # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ 115 | # define const /* note: need a more gentle solution here */ 116 | # endif 117 | #endif 118 | 119 | /* Some Mac compilers merge all .h files incorrectly: */ 120 | #if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) 121 | # define NO_DUMMY_DECL 122 | #endif 123 | 124 | /* Maximum value for memLevel in deflateInit2 */ 125 | #ifndef MAX_MEM_LEVEL 126 | # ifdef MAXSEG_64K 127 | # define MAX_MEM_LEVEL 8 128 | # else 129 | # define MAX_MEM_LEVEL 9 130 | # endif 131 | #endif 132 | 133 | /* Maximum value for windowBits in deflateInit2 and inflateInit2. 134 | * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files 135 | * created by gzip. (Files created by minigzip can still be extracted by 136 | * gzip.) 137 | */ 138 | #ifndef MAX_WBITS 139 | # define MAX_WBITS 15 /* 32K LZ77 window */ 140 | #endif 141 | 142 | /* The memory requirements for deflate are (in bytes): 143 | (1 << (windowBits+2)) + (1 << (memLevel+9)) 144 | that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) 145 | plus a few kilobytes for small objects. For example, if you want to reduce 146 | the default memory requirements from 256K to 128K, compile with 147 | make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" 148 | Of course this will generally degrade compression (there's no free lunch). 149 | 150 | The memory requirements for inflate are (in bytes) 1 << windowBits 151 | that is, 32K for windowBits=15 (default value) plus a few kilobytes 152 | for small objects. 153 | */ 154 | 155 | /* Type declarations */ 156 | 157 | #ifndef OF /* function prototypes */ 158 | # ifdef STDC 159 | # define OF(args) args 160 | # else 161 | # define OF(args) () 162 | # endif 163 | #endif 164 | 165 | /* The following definitions for FAR are needed only for MSDOS mixed 166 | * model programming (small or medium model with some far allocations). 167 | * This was tested only with MSC; for other MSDOS compilers you may have 168 | * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, 169 | * just define FAR to be empty. 170 | */ 171 | #ifdef SYS16BIT 172 | # if defined(M_I86SM) || defined(M_I86MM) 173 | /* MSC small or medium model */ 174 | # define SMALL_MEDIUM 175 | # ifdef _MSC_VER 176 | # define FAR _far 177 | # else 178 | # define FAR far 179 | # endif 180 | # endif 181 | # if (defined(__SMALL__) || defined(__MEDIUM__)) 182 | /* Turbo C small or medium model */ 183 | # define SMALL_MEDIUM 184 | # ifdef __BORLANDC__ 185 | # define FAR _far 186 | # else 187 | # define FAR far 188 | # endif 189 | # endif 190 | #endif 191 | 192 | #if defined(WINDOWS) || defined(WIN32) 193 | /* If building or using zlib as a DLL, define ZLIB_DLL. 194 | * This is not mandatory, but it offers a little performance increase. 195 | */ 196 | # ifdef ZLIB_DLL 197 | # if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) 198 | # ifdef ZLIB_INTERNAL 199 | # define ZEXTERN extern __declspec(dllexport) 200 | # else 201 | # define ZEXTERN extern __declspec(dllimport) 202 | # endif 203 | # endif 204 | # endif /* ZLIB_DLL */ 205 | /* If building or using zlib with the WINAPI/WINAPIV calling convention, 206 | * define ZLIB_WINAPI. 207 | * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. 208 | */ 209 | # ifdef ZLIB_WINAPI 210 | # ifdef FAR 211 | # undef FAR 212 | # endif 213 | # include 214 | /* No need for _export, use ZLIB.DEF instead. */ 215 | /* For complete Windows compatibility, use WINAPI, not __stdcall. */ 216 | # define ZEXPORT WINAPI 217 | # ifdef WIN32 218 | # define ZEXPORTVA WINAPIV 219 | # else 220 | # define ZEXPORTVA FAR CDECL 221 | # endif 222 | # endif 223 | #endif 224 | 225 | #if defined (__BEOS__) 226 | # ifdef ZLIB_DLL 227 | # ifdef ZLIB_INTERNAL 228 | # define ZEXPORT __declspec(dllexport) 229 | # define ZEXPORTVA __declspec(dllexport) 230 | # else 231 | # define ZEXPORT __declspec(dllimport) 232 | # define ZEXPORTVA __declspec(dllimport) 233 | # endif 234 | # endif 235 | #endif 236 | 237 | #ifndef ZEXTERN 238 | # define ZEXTERN extern 239 | #endif 240 | #ifndef ZEXPORT 241 | # define ZEXPORT 242 | #endif 243 | #ifndef ZEXPORTVA 244 | # define ZEXPORTVA 245 | #endif 246 | 247 | #ifndef FAR 248 | # define FAR 249 | #endif 250 | 251 | #if !defined(__MACTYPES__) 252 | typedef unsigned char Byte; /* 8 bits */ 253 | #endif 254 | typedef unsigned int uInt; /* 16 bits or more */ 255 | typedef unsigned long uLong; /* 32 bits or more */ 256 | 257 | #ifdef SMALL_MEDIUM 258 | /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ 259 | # define Bytef Byte FAR 260 | #else 261 | typedef Byte FAR Bytef; 262 | #endif 263 | typedef char FAR charf; 264 | typedef int FAR intf; 265 | typedef uInt FAR uIntf; 266 | typedef uLong FAR uLongf; 267 | 268 | #ifdef STDC 269 | typedef void const *voidpc; 270 | typedef void FAR *voidpf; 271 | typedef void *voidp; 272 | #else 273 | typedef Byte const *voidpc; 274 | typedef Byte FAR *voidpf; 275 | typedef Byte *voidp; 276 | #endif 277 | 278 | #if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ 279 | # include /* for off_t */ 280 | # include /* for SEEK_* and off_t */ 281 | # ifdef VMS 282 | # include /* for off_t */ 283 | # endif 284 | # define z_off_t off_t 285 | #endif 286 | #ifndef SEEK_SET 287 | # define SEEK_SET 0 /* Seek from beginning of file. */ 288 | # define SEEK_CUR 1 /* Seek from current position. */ 289 | # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ 290 | #endif 291 | #ifndef z_off_t 292 | # define z_off_t long 293 | #endif 294 | 295 | #if defined(__OS400__) 296 | #define NO_vsnprintf 297 | #endif 298 | 299 | #if defined(__MVS__) 300 | # define NO_vsnprintf 301 | # ifdef FAR 302 | # undef FAR 303 | # endif 304 | #endif 305 | 306 | /* MVS linker does not support external names larger than 8 bytes */ 307 | #if defined(__MVS__) 308 | # pragma map(deflateInit_,"DEIN") 309 | # pragma map(deflateInit2_,"DEIN2") 310 | # pragma map(deflateEnd,"DEEND") 311 | # pragma map(deflateBound,"DEBND") 312 | # pragma map(inflateInit_,"ININ") 313 | # pragma map(inflateInit2_,"ININ2") 314 | # pragma map(inflateEnd,"INEND") 315 | # pragma map(inflateSync,"INSY") 316 | # pragma map(inflateSetDictionary,"INSEDI") 317 | # pragma map(compressBound,"CMBND") 318 | # pragma map(inflate_table,"INTABL") 319 | # pragma map(inflate_fast,"INFA") 320 | # pragma map(inflate_copyright,"INCOPY") 321 | #endif 322 | 323 | #endif /* ZCONF_H */ 324 | -------------------------------------------------------------------------------- /Lib/Zip.h: -------------------------------------------------------------------------------- 1 | /* zip.h -- IO for compress .zip files using zlib 2 | Version 1.01e, February 12th, 2005 3 | 4 | Copyright (C) 1998-2005 Gilles Vollant 5 | 6 | This unzip package allow creates .ZIP file, compatible with PKZip 2.04g 7 | WinZip, InfoZip tools and compatible. 8 | Multi volume ZipFile (span) are not supported. 9 | Encryption compatible with pkzip 2.04g only supported 10 | Old compressions used by old PKZip 1.x are not supported 11 | 12 | For uncompress .zip file, look at unzip.h 13 | 14 | 15 | I WAIT FEEDBACK at mail info@winimage.com 16 | Visit also http://www.winimage.com/zLibDll/unzip.html for evolution 17 | 18 | Condition of use and distribution are the same than zlib : 19 | 20 | This software is provided 'as-is', without any express or implied 21 | warranty. In no event will the authors be held liable for any damages 22 | arising from the use of this software. 23 | 24 | Permission is granted to anyone to use this software for any purpose, 25 | including commercial applications, and to alter it and redistribute it 26 | freely, subject to the following restrictions: 27 | 28 | 1. The origin of this software must not be misrepresented; you must not 29 | claim that you wrote the original software. If you use this software 30 | in a product, an acknowledgment in the product documentation would be 31 | appreciated but is not required. 32 | 2. Altered source versions must be plainly marked as such, and must not be 33 | misrepresented as being the original software. 34 | 3. This notice may not be removed or altered from any source distribution. 35 | 36 | 37 | */ 38 | 39 | /* for more info about .ZIP format, see 40 | http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip 41 | http://www.info-zip.org/pub/infozip/doc/ 42 | PkWare has also a specification at : 43 | ftp://ftp.pkware.com/probdesc.zip 44 | */ 45 | 46 | #ifndef _zip_H 47 | #define _zip_H 48 | 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | 53 | #ifndef _ZLIB_H 54 | #include "zlib.h" 55 | #endif 56 | 57 | #ifndef _ZLIBIOAPI_H 58 | #include "ioapi.h" 59 | #endif 60 | 61 | #if defined(STRICTZIP) || defined(STRICTZIPUNZIP) 62 | /* like the STRICT of WIN32, we define a pointer that cannot be converted 63 | from (void*) without cast */ 64 | typedef struct TagzipFile__ { int unused; } zipFile__; 65 | typedef zipFile__ *zipFile; 66 | #else 67 | typedef voidp zipFile; 68 | #endif 69 | 70 | #define ZIP_OK (0) 71 | #define ZIP_EOF (0) 72 | #define ZIP_ERRNO (Z_ERRNO) 73 | #define ZIP_PARAMERROR (-102) 74 | #define ZIP_BADZIPFILE (-103) 75 | #define ZIP_INTERNALERROR (-104) 76 | 77 | #ifndef DEF_MEM_LEVEL 78 | # if MAX_MEM_LEVEL >= 8 79 | # define DEF_MEM_LEVEL 8 80 | # else 81 | # define DEF_MEM_LEVEL MAX_MEM_LEVEL 82 | # endif 83 | #endif 84 | /* default memLevel */ 85 | 86 | /* tm_zip contain date/time info */ 87 | typedef struct tm_zip_s 88 | { 89 | uInt tm_sec; /* seconds after the minute - [0,59] */ 90 | uInt tm_min; /* minutes after the hour - [0,59] */ 91 | uInt tm_hour; /* hours since midnight - [0,23] */ 92 | uInt tm_mday; /* day of the month - [1,31] */ 93 | uInt tm_mon; /* months since January - [0,11] */ 94 | uInt tm_year; /* years - [1980..2044] */ 95 | } tm_zip; 96 | 97 | typedef struct 98 | { 99 | tm_zip tmz_date; /* date in understandable format */ 100 | uLong dosDate; /* if dos_date == 0, tmu_date is used */ 101 | /* uLong flag; */ /* general purpose bit flag 2 bytes */ 102 | 103 | uLong internal_fa; /* internal file attributes 2 bytes */ 104 | uLong external_fa; /* external file attributes 4 bytes */ 105 | } zip_fileinfo; 106 | 107 | typedef const char* zipcharpc; 108 | 109 | 110 | #define APPEND_STATUS_CREATE (0) 111 | #define APPEND_STATUS_CREATEAFTER (1) 112 | #define APPEND_STATUS_ADDINZIP (2) 113 | 114 | extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append)); 115 | /* 116 | Create a zipfile. 117 | pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on 118 | an Unix computer "zlib/zlib113.zip". 119 | if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip 120 | will be created at the end of the file. 121 | (useful if the file contain a self extractor code) 122 | if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will 123 | add files in existing zip (be sure you don't add file that doesn't exist) 124 | If the zipfile cannot be opened, the return value is NULL. 125 | Else, the return value is a zipFile Handle, usable with other function 126 | of this zip package. 127 | */ 128 | 129 | /* Note : there is no delete function into a zipfile. 130 | If you want delete file into a zipfile, you must open a zipfile, and create another 131 | Of couse, you can use RAW reading and writing to copy the file you did not want delte 132 | */ 133 | 134 | extern zipFile ZEXPORT zipOpen2 OF((const char *pathname, 135 | int append, 136 | zipcharpc* globalcomment, 137 | zlib_filefunc_def* pzlib_filefunc_def)); 138 | 139 | extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, 140 | const char* filename, 141 | const zip_fileinfo* zipfi, 142 | const void* extrafield_local, 143 | uInt size_extrafield_local, 144 | const void* extrafield_global, 145 | uInt size_extrafield_global, 146 | const char* comment, 147 | int method, 148 | int level)); 149 | /* 150 | Open a file in the ZIP for writing. 151 | filename : the filename in zip (if NULL, '-' without quote will be used 152 | *zipfi contain supplemental information 153 | if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local 154 | contains the extrafield data the the local header 155 | if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global 156 | contains the extrafield data the the local header 157 | if comment != NULL, comment contain the comment string 158 | method contain the compression method (0 for store, Z_DEFLATED for deflate) 159 | level contain the level of compression (can be Z_DEFAULT_COMPRESSION) 160 | */ 161 | 162 | 163 | extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file, 164 | const char* filename, 165 | const zip_fileinfo* zipfi, 166 | const void* extrafield_local, 167 | uInt size_extrafield_local, 168 | const void* extrafield_global, 169 | uInt size_extrafield_global, 170 | const char* comment, 171 | int method, 172 | int level, 173 | int raw)); 174 | 175 | /* 176 | Same than zipOpenNewFileInZip, except if raw=1, we write raw file 177 | */ 178 | 179 | extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file, 180 | const char* filename, 181 | const zip_fileinfo* zipfi, 182 | const void* extrafield_local, 183 | uInt size_extrafield_local, 184 | const void* extrafield_global, 185 | uInt size_extrafield_global, 186 | const char* comment, 187 | int method, 188 | int level, 189 | int raw, 190 | int windowBits, 191 | int memLevel, 192 | int strategy, 193 | const char* password, 194 | uLong crcForCtypting)); 195 | 196 | /* 197 | Same than zipOpenNewFileInZip2, except 198 | windowBits,memLevel,,strategy : see parameter strategy in deflateInit2 199 | password : crypting password (NULL for no crypting) 200 | crcForCtypting : crc of file to compress (needed for crypting) 201 | */ 202 | 203 | 204 | extern int ZEXPORT zipWriteInFileInZip OF((zipFile file, 205 | const void* buf, 206 | unsigned len)); 207 | /* 208 | Write data in the zipfile 209 | */ 210 | 211 | extern int ZEXPORT zipCloseFileInZip OF((zipFile file)); 212 | /* 213 | Close the current file in the zipfile 214 | */ 215 | 216 | extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file, 217 | uLong uncompressed_size, 218 | uLong crc32)); 219 | /* 220 | Close the current file in the zipfile, for fiel opened with 221 | parameter raw=1 in zipOpenNewFileInZip2 222 | uncompressed_size and crc32 are value for the uncompressed size 223 | */ 224 | 225 | extern int ZEXPORT zipClose OF((zipFile file, 226 | const char* global_comment)); 227 | /* 228 | Close the zipfile 229 | */ 230 | 231 | #ifdef __cplusplus 232 | } 233 | #endif 234 | 235 | #endif /* _zip_H */ 236 | -------------------------------------------------------------------------------- /Lib/Zlib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gstanton/ProSystem1_3/3040295934c68024ecf89b45b50107ea1c271e66/Lib/Zlib.lib -------------------------------------------------------------------------------- /ProSystem.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="ProSystem" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Application" 0x0101 6 | 7 | CFG=ProSystem - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "ProSystem.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "ProSystem.mak" CFG="ProSystem - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "ProSystem - Win32 Release" (based on "Win32 (x86) Application") 21 | !MESSAGE "ProSystem - Win32 Debug" (based on "Win32 (x86) Application") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | MTL=midl.exe 30 | RSC=rc.exe 31 | 32 | !IF "$(CFG)" == "ProSystem - Win32 Release" 33 | 34 | # PROP BASE Use_MFC 0 35 | # PROP BASE Use_Debug_Libraries 0 36 | # PROP BASE Output_Dir "Release" 37 | # PROP BASE Intermediate_Dir "Release" 38 | # PROP BASE Target_Dir "" 39 | # PROP Use_MFC 0 40 | # PROP Use_Debug_Libraries 0 41 | # PROP Output_Dir ".\Bin\Release" 42 | # PROP Intermediate_Dir ".\Bin\Release" 43 | # PROP Ignore_Export_Lib 0 44 | # PROP Target_Dir "" 45 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c 46 | # ADD CPP /nologo /W3 /GX /O2 /Ob2 /I "Core" /I "Win" /I "Lib" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FR /FD /c 47 | # SUBTRACT CPP /YX 48 | # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 49 | # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 50 | # ADD BASE RSC /l 0x409 /d "NDEBUG" 51 | # ADD RSC /l 0x409 /d "NDEBUG" 52 | BSC32=bscmake.exe 53 | # ADD BASE BSC32 /nologo 54 | # ADD BSC32 /nologo 55 | LINK32=link.exe 56 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 57 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ddraw.lib dinput.lib dxguid.lib winmm.lib dsound.lib htmlhelp.lib zlib.lib /nologo /subsystem:windows /machine:I386 /libpath:"Lib" 58 | 59 | !ELSEIF "$(CFG)" == "ProSystem - Win32 Debug" 60 | 61 | # PROP BASE Use_MFC 0 62 | # PROP BASE Use_Debug_Libraries 1 63 | # PROP BASE Output_Dir "Debug" 64 | # PROP BASE Intermediate_Dir "Debug" 65 | # PROP BASE Target_Dir "" 66 | # PROP Use_MFC 0 67 | # PROP Use_Debug_Libraries 1 68 | # PROP Output_Dir ".\Bin\Debug" 69 | # PROP Intermediate_Dir ".\Bin\Debug" 70 | # PROP Ignore_Export_Lib 0 71 | # PROP Target_Dir "" 72 | # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c 73 | # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "Core" /I "Win" /I "Lib" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX /FD /GZ /c 74 | # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 75 | # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 76 | # ADD BASE RSC /l 0x409 /d "_DEBUG" 77 | # ADD RSC /l 0x409 /d "_DEBUG" 78 | BSC32=bscmake.exe 79 | # ADD BASE BSC32 /nologo 80 | # ADD BSC32 /nologo 81 | LINK32=link.exe 82 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept 83 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ddraw.lib dinput.lib dxguid.lib winmm.lib dsound.lib htmlhelp.lib zlib.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"Lib" 84 | 85 | !ENDIF 86 | 87 | # Begin Target 88 | 89 | # Name "ProSystem - Win32 Release" 90 | # Name "ProSystem - Win32 Debug" 91 | # Begin Group "Core" 92 | 93 | # PROP Default_Filter "" 94 | # Begin Source File 95 | 96 | SOURCE=.\Core\Archive.cpp 97 | # End Source File 98 | # Begin Source File 99 | 100 | SOURCE=.\Core\Archive.h 101 | # End Source File 102 | # Begin Source File 103 | 104 | SOURCE=.\Core\Bios.cpp 105 | # End Source File 106 | # Begin Source File 107 | 108 | SOURCE=.\Core\Bios.h 109 | # End Source File 110 | # Begin Source File 111 | 112 | SOURCE=.\Core\Cartridge.cpp 113 | # End Source File 114 | # Begin Source File 115 | 116 | SOURCE=.\Core\Cartridge.h 117 | # End Source File 118 | # Begin Source File 119 | 120 | SOURCE=.\Core\Equates.h 121 | # End Source File 122 | # Begin Source File 123 | 124 | SOURCE=.\Core\Hash.cpp 125 | # End Source File 126 | # Begin Source File 127 | 128 | SOURCE=.\Core\Hash.h 129 | # End Source File 130 | # Begin Source File 131 | 132 | SOURCE=.\Core\Logger.cpp 133 | # End Source File 134 | # Begin Source File 135 | 136 | SOURCE=.\Core\Logger.h 137 | # End Source File 138 | # Begin Source File 139 | 140 | SOURCE=.\Core\Maria.cpp 141 | # End Source File 142 | # Begin Source File 143 | 144 | SOURCE=.\Core\Maria.h 145 | # End Source File 146 | # Begin Source File 147 | 148 | SOURCE=.\Core\Memory.cpp 149 | # End Source File 150 | # Begin Source File 151 | 152 | SOURCE=.\Core\Memory.h 153 | # End Source File 154 | # Begin Source File 155 | 156 | SOURCE=.\Core\Pair.h 157 | # End Source File 158 | # Begin Source File 159 | 160 | SOURCE=.\Core\Palette.cpp 161 | # End Source File 162 | # Begin Source File 163 | 164 | SOURCE=.\Core\Palette.h 165 | # End Source File 166 | # Begin Source File 167 | 168 | SOURCE=.\Core\Pokey.cpp 169 | # End Source File 170 | # Begin Source File 171 | 172 | SOURCE=.\Core\Pokey.h 173 | # End Source File 174 | # Begin Source File 175 | 176 | SOURCE=.\Core\ProSystem.cpp 177 | # End Source File 178 | # Begin Source File 179 | 180 | SOURCE=.\Core\ProSystem.h 181 | # End Source File 182 | # Begin Source File 183 | 184 | SOURCE=.\Core\Rect.h 185 | # End Source File 186 | # Begin Source File 187 | 188 | SOURCE=.\Core\Region.cpp 189 | # End Source File 190 | # Begin Source File 191 | 192 | SOURCE=.\Core\Region.h 193 | # End Source File 194 | # Begin Source File 195 | 196 | SOURCE=.\Core\Riot.cpp 197 | # End Source File 198 | # Begin Source File 199 | 200 | SOURCE=.\Core\Riot.h 201 | # End Source File 202 | # Begin Source File 203 | 204 | SOURCE=.\Core\Sally.cpp 205 | # End Source File 206 | # Begin Source File 207 | 208 | SOURCE=.\Core\Sally.h 209 | # End Source File 210 | # Begin Source File 211 | 212 | SOURCE=.\Core\Tia.cpp 213 | # End Source File 214 | # Begin Source File 215 | 216 | SOURCE=.\Core\Tia.h 217 | # End Source File 218 | # End Group 219 | # Begin Group "Win" 220 | 221 | # PROP Default_Filter "" 222 | # Begin Source File 223 | 224 | SOURCE=.\Win\About.cpp 225 | # End Source File 226 | # Begin Source File 227 | 228 | SOURCE=.\Win\About.h 229 | # End Source File 230 | # Begin Source File 231 | 232 | SOURCE=.\Win\Common.cpp 233 | # End Source File 234 | # Begin Source File 235 | 236 | SOURCE=.\Win\Common.h 237 | # End Source File 238 | # Begin Source File 239 | 240 | SOURCE=.\Win\Configuration.cpp 241 | # End Source File 242 | # Begin Source File 243 | 244 | SOURCE=.\Win\Configuration.h 245 | # End Source File 246 | # Begin Source File 247 | 248 | SOURCE=.\Win\Console.cpp 249 | # End Source File 250 | # Begin Source File 251 | 252 | SOURCE=.\Win\Console.h 253 | # End Source File 254 | # Begin Source File 255 | 256 | SOURCE=.\Win\Database.cpp 257 | # End Source File 258 | # Begin Source File 259 | 260 | SOURCE=.\Win\Database.h 261 | # End Source File 262 | # Begin Source File 263 | 264 | SOURCE=.\Win\Display.cpp 265 | # End Source File 266 | # Begin Source File 267 | 268 | SOURCE=.\Win\Display.h 269 | # End Source File 270 | # Begin Source File 271 | 272 | SOURCE=.\Win\Help.cpp 273 | # End Source File 274 | # Begin Source File 275 | 276 | SOURCE=.\Win\Help.h 277 | # End Source File 278 | # Begin Source File 279 | 280 | SOURCE=.\Win\Input.cpp 281 | # End Source File 282 | # Begin Source File 283 | 284 | SOURCE=.\Win\Input.h 285 | # End Source File 286 | # Begin Source File 287 | 288 | SOURCE=.\Win\Main.cpp 289 | # End Source File 290 | # Begin Source File 291 | 292 | SOURCE=.\Win\Menu.cpp 293 | # End Source File 294 | # Begin Source File 295 | 296 | SOURCE=.\Win\Menu.h 297 | # End Source File 298 | # Begin Source File 299 | 300 | SOURCE=.\Win\ProSystem.ico 301 | # End Source File 302 | # Begin Source File 303 | 304 | SOURCE=.\Win\ProSystem.rc 305 | # End Source File 306 | # Begin Source File 307 | 308 | SOURCE=.\Win\Resource.h 309 | # End Source File 310 | # Begin Source File 311 | 312 | SOURCE=.\Win\Sound.cpp 313 | # End Source File 314 | # Begin Source File 315 | 316 | SOURCE=.\Win\Sound.h 317 | # End Source File 318 | # Begin Source File 319 | 320 | SOURCE=.\Win\Timer.cpp 321 | # End Source File 322 | # Begin Source File 323 | 324 | SOURCE=.\Win\Timer.h 325 | # End Source File 326 | # End Group 327 | # Begin Group "Lib" 328 | 329 | # PROP Default_Filter "" 330 | # Begin Source File 331 | 332 | SOURCE=.\Lib\Crypt.h 333 | # End Source File 334 | # Begin Source File 335 | 336 | SOURCE=.\Lib\HtmlHelp.h 337 | # End Source File 338 | # Begin Source File 339 | 340 | SOURCE=.\Lib\Ioapi.h 341 | # End Source File 342 | # Begin Source File 343 | 344 | SOURCE=.\Lib\Unzip.h 345 | # End Source File 346 | # Begin Source File 347 | 348 | SOURCE=.\Lib\Zconf.h 349 | # End Source File 350 | # Begin Source File 351 | 352 | SOURCE=.\Lib\Zip.h 353 | # End Source File 354 | # Begin Source File 355 | 356 | SOURCE=.\Lib\Zlib.h 357 | # End Source File 358 | # End Group 359 | # Begin Group "Web" 360 | 361 | # PROP Default_Filter "" 362 | # Begin Source File 363 | 364 | SOURCE=.\Web\index.html 365 | # End Source File 366 | # End Group 367 | # Begin Source File 368 | 369 | SOURCE=.\License.txt 370 | # End Source File 371 | # Begin Source File 372 | 373 | SOURCE=.\ProSystem.dat 374 | # End Source File 375 | # End Target 376 | # End Project 377 | -------------------------------------------------------------------------------- /ProSystem.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "ProSystem"=.\ProSystem.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /ProSystem.opt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gstanton/ProSystem1_3/3040295934c68024ecf89b45b50107ea1c271e66/ProSystem.opt -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Prosystem Emulator Version 1.3 2 | The ProSystem Emulator is an Atari 7800 emulator for the PC and Windows OS. The emulator was written in C++ using the Windows API and DirectX. It emulates the Atari 7800 NTSC and PAL TV standards. The emulator was originally written by Greg Stanton and then updated by others. 3 | 4 | See the project web site for more details: 5 | http://gstanton.github.io/ProSystem1_3/ 6 | -------------------------------------------------------------------------------- /Web/images/Screenshot1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gstanton/ProSystem1_3/3040295934c68024ecf89b45b50107ea1c271e66/Web/images/Screenshot1.jpg -------------------------------------------------------------------------------- /Web/images/Screenshot2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gstanton/ProSystem1_3/3040295934c68024ecf89b45b50107ea1c271e66/Web/images/Screenshot2.jpg -------------------------------------------------------------------------------- /Web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | ProSystem Emulator 4 | 5 | 6 | 7 |
ProSystem Emulator

8 | Introduction
9 | ProSystem is an emulator for the Windows operating system that will allow you to play Atari 10 | 7800 video games on your PC. An emulator is a program that has the ability to imitate another 11 | program, device, or computer. The ProSystem emulator imitates the Atari 7800's CPU, video, audio, 12 | joystick controls, etc. Before you can use the emulator, you will need to obtain rom images that 13 | are compatible with the Atari 7800. The rom images are the actual data that is loaded into 14 | the emulator which allows you to play the game. The rom images can be downloaded from various 15 | sources on the internet. Please don't ask me for rom images.
16 |
17 | The ProSystem emulator was written in the C/C++ language and uses the Windows API and 18 | DirectX to help emulate the display, sound and input. It emulates both the NTSC and 19 | PAL consoles. Please see the documentation for a description of the other features.
20 |
21 |    22 |
23 |
24 | Downloads
25 | To start using the emulator, download the ProSystem.zip file and unzip it to a directory on your 26 | local drive. Execute the ProSystem.exe file to start the emulator. Please read the license 27 | and documenation included with the software before using the emulator.
28 | ProSystem 1.0
29 |
30 | You can also download the documentation. After it has been downloaded to your local drive, execute 31 | it like any other program.
32 | ProSystem Documentation
33 |
34 | Contact
35 | ProSystem Emulator was developed by Greg Stanton. To contact Greg Stanton about the software, 36 | please read the documentation to obtain an email address. Thanks.
37 |
38 |
39 | You are visitor #   40 |
41 |
42 | 43 | 44 | -------------------------------------------------------------------------------- /Win/About.cpp: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // About.cpp 24 | // ---------------------------------------------------------------------------- 25 | #include "About.h" 26 | 27 | // ---------------------------------------------------------------------------- 28 | // Procedure 29 | // ---------------------------------------------------------------------------- 30 | static BOOL CALLBACK about_Procedure(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { 31 | if(message == WM_INITDIALOG) { 32 | HWND hStaticVersion = GetDlgItem(hWnd, IDC_STATIC_VERSION2); 33 | std::string versionText = "Version " + common_Format(CONSOLE_VERSION, "%1.1f"); 34 | SetWindowText(hStaticVersion, versionText.c_str( )); 35 | } 36 | else if(message == WM_COMMAND) { 37 | if(LOWORD(wParam) == IDCANCEL || LOWORD(wParam) == IDC_BUTTON_ABOUT_OK) { 38 | EndDialog(hWnd, 0); 39 | return 1; 40 | } 41 | } 42 | return 0; 43 | } 44 | 45 | // ---------------------------------------------------------------------------- 46 | // Show 47 | // ---------------------------------------------------------------------------- 48 | void about_Show(HWND hWnd, HINSTANCE hInstance) { 49 | DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG_ABOUT), hWnd, (DLGPROC)about_Procedure); 50 | } -------------------------------------------------------------------------------- /Win/About.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // About.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef ABOUT_H 26 | #define ABOUT_H 27 | 28 | #include 29 | #include "Resource.h" 30 | #include "Common.h" 31 | #include "Console.h" 32 | 33 | typedef unsigned char byte; 34 | typedef unsigned short word; 35 | typedef unsigned int uint; 36 | 37 | extern void about_Show(HWND hWnd, HINSTANCE hInstance); 38 | 39 | #endif -------------------------------------------------------------------------------- /Win/Common.cpp: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Common.cpp 24 | // ---------------------------------------------------------------------------- 25 | #include "Common.h" 26 | 27 | std::string common_defaultPath; 28 | 29 | // ---------------------------------------------------------------------------- 30 | // Format 31 | // ---------------------------------------------------------------------------- 32 | std::string common_Format(double value) { 33 | return common_Format(value, "%f"); 34 | } 35 | 36 | // ---------------------------------------------------------------------------- 37 | // Format 38 | // ---------------------------------------------------------------------------- 39 | std::string common_Format(double value, std::string specification) { 40 | char buffer[17] = {0}; 41 | sprintf(buffer, specification.c_str( ), value); 42 | return std::string(buffer); 43 | } 44 | 45 | // ---------------------------------------------------------------------------- 46 | // Format 47 | // ---------------------------------------------------------------------------- 48 | std::string common_Format(uint value) { 49 | char buffer[11] = {0}; 50 | sprintf(buffer, "%d", value); 51 | return std::string(buffer); 52 | } 53 | 54 | // ---------------------------------------------------------------------------- 55 | // Format 56 | // ---------------------------------------------------------------------------- 57 | std::string common_Format(word value) { 58 | char buffer[6] = {0}; 59 | sprintf(buffer, "%d", value); 60 | return std::string(buffer); 61 | } 62 | 63 | // ---------------------------------------------------------------------------- 64 | // Format 65 | // ---------------------------------------------------------------------------- 66 | std::string common_Format(byte value) { 67 | char buffer[4] = {0}; 68 | sprintf(buffer, "%d", value); 69 | return std::string(buffer); 70 | } 71 | 72 | // ---------------------------------------------------------------------------- 73 | // Format 74 | // ---------------------------------------------------------------------------- 75 | std::string common_Format(bool value) { 76 | return (value)? "true": "false"; 77 | } 78 | 79 | // ---------------------------------------------------------------------------- 80 | // Format 81 | // ---------------------------------------------------------------------------- 82 | std::string common_Format(HRESULT result) { 83 | char buffer[10] = {0}; 84 | sprintf(buffer, "%#8x", result); 85 | return std::string(buffer); 86 | } 87 | 88 | // ---------------------------------------------------------------------------- 89 | // ParseUint 90 | // ---------------------------------------------------------------------------- 91 | uint common_ParseUint(std::string text) { 92 | return (uint)atoi(text.c_str( )); 93 | } 94 | 95 | // ---------------------------------------------------------------------------- 96 | // ParseWord 97 | // ---------------------------------------------------------------------------- 98 | word common_ParseWord(std::string text) { 99 | return (word)atoi(text.c_str( )); 100 | } 101 | 102 | // ---------------------------------------------------------------------------- 103 | // ParseByte 104 | // ---------------------------------------------------------------------------- 105 | byte common_ParseByte(std::string text) { 106 | return (byte)atoi(text.c_str( )); 107 | } 108 | 109 | // ---------------------------------------------------------------------------- 110 | // ParseBool 111 | // ---------------------------------------------------------------------------- 112 | bool common_ParseBool(std::string text) { 113 | if(text.compare("true") == 0 || text.compare("TRUE") == 0 || text.compare("True") == 0) { 114 | return true; 115 | } 116 | if(atoi(text.c_str( )) == 1) { 117 | return true; 118 | } 119 | return false; 120 | } 121 | 122 | // ---------------------------------------------------------------------------- 123 | // Trim 124 | // ---------------------------------------------------------------------------- 125 | std::string common_Trim(std::string target) { 126 | int index; 127 | for(index = target.length( ) - 1; index >= 0; index--) { 128 | if(target[index] != 0x20 && target[index] != '\n') { 129 | break; 130 | } 131 | } 132 | return target.substr(0, index + 1); 133 | } 134 | 135 | // ---------------------------------------------------------------------------- 136 | // Remove 137 | // ---------------------------------------------------------------------------- 138 | std::string common_Remove(std::string target, char value) { 139 | int length = 0; 140 | int index; 141 | for(index = 0; index < target.size( ); index++) { 142 | if(target[index] != value) { 143 | length++; 144 | } 145 | } 146 | 147 | char* buffer = new char[length + 1]; 148 | int count = 0; 149 | for(index = 0; index < target.size( ); index++) { 150 | if(target[index] != value) { 151 | buffer[count] = target[index]; 152 | count++; 153 | } 154 | } 155 | 156 | buffer[length] = 0; 157 | std::string source = buffer; 158 | delete[ ] buffer; 159 | return source; 160 | } 161 | 162 | // ---------------------------------------------------------------------------- 163 | // Replace (string, from, to) 164 | // ---------------------------------------------------------------------------- 165 | std::string common_Replace(std::string target, char value1, char value2) { 166 | int length = 0; 167 | int index; 168 | for(index = 0; index < target.size( ); index++) { 169 | length++; 170 | } 171 | 172 | char* buffer = new char[length + 1]; 173 | for(index = 0; index < target.size( ); index++) { 174 | if(target[index] != value1) { 175 | buffer[index] = target[index]; 176 | } 177 | else 178 | { 179 | buffer[index] = value2; 180 | } 181 | } 182 | 183 | buffer[length] = 0; 184 | std::string source = buffer; 185 | delete[ ] buffer; 186 | return source; 187 | } 188 | 189 | // ---------------------------------------------------------------------------- 190 | // GetErrorMessage 191 | // ---------------------------------------------------------------------------- 192 | std::string common_GetErrorMessage( ) { 193 | return common_GetErrorMessage(GetLastError( )); 194 | } 195 | 196 | // ---------------------------------------------------------------------------- 197 | // GetErrorMessage 198 | // ---------------------------------------------------------------------------- 199 | std::string common_GetErrorMessage(DWORD error) { 200 | void* buffer; 201 | FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&buffer, 0, NULL); 202 | std::string message((char*)buffer); 203 | LocalFree(buffer); 204 | return message; 205 | } 206 | 207 | // ---------------------------------------------------------------------------- 208 | // GetExtension 209 | // ---------------------------------------------------------------------------- 210 | std::string common_GetExtension(std::string filename) { 211 | int position = filename.rfind('.'); 212 | if(position != -1) { 213 | return filename.substr(position); 214 | } 215 | return ""; 216 | } 217 | -------------------------------------------------------------------------------- /Win/Common.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Common.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef COMMON_H 26 | #define COMMON_H 27 | 28 | #include 29 | #include 30 | 31 | typedef unsigned char byte; 32 | typedef unsigned short word; 33 | typedef unsigned int uint; 34 | 35 | extern std::string common_Format(double value); 36 | extern std::string common_Format(double value, std::string specification); 37 | extern std::string common_Format(uint value); 38 | extern std::string common_Format(word value); 39 | extern std::string common_Format(byte value); 40 | extern std::string common_Format(bool value); 41 | extern std::string common_Format(HRESULT result); 42 | extern std::string common_Trim(std::string target); 43 | extern std::string common_Remove(std::string target, char value); 44 | extern std::string common_Replace(std::string target, char value1, char value2); 45 | extern std::string common_GetErrorMessage( ); 46 | extern std::string common_GetErrorMessage(DWORD error); 47 | extern std::string common_GetExtension(std::string filename); 48 | extern uint common_ParseUint(std::string text); 49 | extern word common_ParseWord(std::string text); 50 | extern byte common_ParseByte(std::string text); 51 | extern bool common_ParseBool(std::string text); 52 | extern std::string common_defaultPath; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /Win/Configuration.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Configuration.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef CONFIGURATION_H 26 | #define CONFIGURATION_H 27 | 28 | #include 29 | #include 30 | #include "Console.h" 31 | 32 | 33 | typedef unsigned char byte; 34 | typedef unsigned short word; 35 | typedef unsigned int uint; 36 | 37 | extern std::string configuration_CommandLine(std::string commandLine); 38 | extern std::string configuration_Load(std::string filename, std::string commandLine); 39 | extern void configuration_Save(std::string filename); 40 | extern bool configuration_enabled; 41 | extern uint samplerate; 42 | 43 | #endif -------------------------------------------------------------------------------- /Win/Console.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Console.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef CONSOLE_H 26 | #define CONSOLE_H 27 | #define CONSOLE_VERSION 1.3 28 | #define CONSOLE_TITLE "ProSystem Emulator" 29 | #define NULL 0 30 | 31 | #include 32 | #include 33 | #include "Resource.h" 34 | #include "Menu.h" 35 | #include "Configuration.h" 36 | #include "Display.h" 37 | #include "Input.h" 38 | #include "Database.h" 39 | #include "Sound.h" 40 | #include "Timer.h" 41 | #include "ProSystem.h" 42 | #include "Help.h" 43 | #include "About.h" 44 | 45 | typedef unsigned char byte; 46 | typedef unsigned short word; 47 | typedef unsigned int uint; 48 | 49 | extern bool console_Initialize(HINSTANCE hInstance, std::string commandLine); 50 | extern void console_Run( ); 51 | extern void console_Open(std::string filename); 52 | extern void console_SetZoom(byte zoom); 53 | extern void console_SetFullscreen(bool fullscreen); 54 | extern RECT console_GetWindowRect( ); 55 | extern void console_SetWindowRect(RECT windowRect); 56 | extern void console_SetMenuEnabled(bool enabled); 57 | extern void console_SetUserInput(byte *data, int index); 58 | extern void console_Exit(void); 59 | extern std::string console_recent[10]; 60 | extern std::string console_savePath; 61 | extern byte console_frameSkip; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /Win/Database.cpp: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Database.cpp 24 | // ---------------------------------------------------------------------------- 25 | #include "Database.h" 26 | 27 | bool database_enabled = true; 28 | std::string database_filename; 29 | 30 | static std::string database_GetValue(std::string entry) { 31 | int index = entry.rfind('='); 32 | return entry.substr(index + 1); 33 | } 34 | 35 | // ---------------------------------------------------------------------------- 36 | // Initialize 37 | // ---------------------------------------------------------------------------- 38 | void database_Initialize( ) { 39 | database_filename = common_defaultPath + "ProSystem.dat"; 40 | } 41 | 42 | // ---------------------------------------------------------------------------- 43 | // Load 44 | // ---------------------------------------------------------------------------- 45 | bool database_Load(std::string digest) { 46 | if(database_enabled) { 47 | logger_LogInfo(IDS_DATABASE1, database_filename); 48 | 49 | FILE* file = fopen(database_filename.c_str( ), "r"); 50 | if(file == NULL) { 51 | logger_LogError(IDS_DATABASE2,""); 52 | return false; 53 | } 54 | 55 | char buffer[256]; 56 | while(fgets(buffer, 256, file) != NULL) { 57 | std::string line = buffer; 58 | if(line.compare(1, 32, digest.c_str( )) == 0) { 59 | std::string entry[7]; 60 | for(int index = 0; index < 7; index++) { 61 | fgets(buffer, 256, file); 62 | entry[index] = common_Remove(buffer, '\n'); 63 | } 64 | 65 | cartridge_title = database_GetValue(entry[0]); 66 | cartridge_type = common_ParseByte(database_GetValue(entry[1])); 67 | cartridge_pokey = common_ParseBool(database_GetValue(entry[2])); 68 | cartridge_controller[0] = common_ParseByte(database_GetValue(entry[3])); 69 | cartridge_controller[1] = common_ParseByte(database_GetValue(entry[4])); 70 | cartridge_region = common_ParseByte(database_GetValue(entry[5])); 71 | cartridge_flags = common_ParseUint(database_GetValue(entry[6])); 72 | break; 73 | } 74 | } 75 | 76 | fclose(file); 77 | } 78 | return true; 79 | } 80 | 81 | 82 | -------------------------------------------------------------------------------- /Win/Database.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Database.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef DATABASE_H 26 | #define DATABASE_H 27 | 28 | #include 29 | #include 30 | #include "Cartridge.h" 31 | #include "Logger.h" 32 | #include "Common.h" 33 | 34 | typedef unsigned char byte; 35 | typedef unsigned short word; 36 | typedef unsigned int uint; 37 | 38 | extern void database_Initialize( ); 39 | extern bool database_Load(std::string digest); 40 | extern bool database_enabled; 41 | extern std::string database_filename; 42 | 43 | #endif -------------------------------------------------------------------------------- /Win/Display.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Display.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef DISPLAY_H 26 | #define DISPLAY_H 27 | #define NULL 0 28 | 29 | #include 30 | #include 31 | #include 32 | #include "Palette.h" 33 | #include "Maria.h" 34 | #include "Common.h" 35 | #include "Logger.h" 36 | 37 | typedef unsigned char byte; 38 | typedef unsigned short word; 39 | typedef unsigned int uint; 40 | 41 | struct Mode { 42 | uint width; 43 | uint height; 44 | uint bpp; 45 | uint rmask; 46 | uint gmask; 47 | uint bmask; 48 | }; 49 | 50 | extern bool display_Initialize(HWND hWnd); 51 | extern bool display_SetFullscreen( ); 52 | extern bool display_SetWindowed( ); 53 | extern bool display_Show( ); 54 | extern bool display_ResetPalette( ); 55 | extern bool display_TakeScreenshot(std::string filename); 56 | extern bool display_Clear( ); 57 | extern bool display_IsFullscreen( ); 58 | extern void display_Release( ); 59 | extern bool display_stretched; 60 | extern bool display_fullscreen; 61 | extern bool display_menuenabled; 62 | extern byte display_zoom; 63 | extern std::vector display_modes; 64 | extern Mode display_mode; 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /Win/Help.cpp: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Help.cpp 24 | // ---------------------------------------------------------------------------- 25 | #include "Help.h" 26 | 27 | static std::string help_filename; 28 | static HWND common_hWnd = NULL; 29 | 30 | // ---------------------------------------------------------------------------- 31 | // Initialize 32 | // ---------------------------------------------------------------------------- 33 | void help_Initialize(HWND hWnd) { 34 | help_filename = common_defaultPath + "ProSystem.chm"; 35 | common_hWnd = hWnd; 36 | } 37 | 38 | // ---------------------------------------------------------------------------- 39 | // ShowContents 40 | // ---------------------------------------------------------------------------- 41 | void help_ShowContents( ) { 42 | HtmlHelp(common_hWnd, help_filename.c_str( ), HH_DISPLAY_TOC, NULL); 43 | } 44 | 45 | // ---------------------------------------------------------------------------- 46 | // ShowIndex 47 | // ---------------------------------------------------------------------------- 48 | void help_ShowIndex( ) { 49 | HtmlHelp(common_hWnd, help_filename.c_str( ), HH_DISPLAY_INDEX, NULL); 50 | } 51 | 52 | -------------------------------------------------------------------------------- /Win/Help.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Help.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef HELP_H 26 | #define HELP_H 27 | #define NULL 0 28 | 29 | #include 30 | #include 31 | #include "Htmlhelp.h" 32 | #include "Common.h" 33 | 34 | typedef unsigned char byte; 35 | typedef unsigned short word; 36 | typedef unsigned int uint; 37 | 38 | extern void help_Initialize(HWND hWnd); 39 | extern void help_ShowContents( ); 40 | extern void help_ShowIndex( ); 41 | 42 | #endif -------------------------------------------------------------------------------- /Win/Input.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Input.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef INPUT_H 26 | #define INPUT_H 27 | #ifndef DIRECTINPUT_VERSION 28 | #define DIRECTINPUT_VERSION 0x0700 29 | #define NULL 0 30 | #endif 31 | 32 | typedef enum { 33 | JOY_AXIS_UP, 34 | JOY_AXIS_DOWN, 35 | JOY_AXIS_LEFT, 36 | JOY_AXIS_RIGHT, 37 | JOY_PAD_UP, 38 | JOY_PAD_DOWN, 39 | JOY_PAD_LEFT, 40 | JOY_PAD_RIGHT, 41 | JOY_BUTTON_1, 42 | JOY_BUTTON_2, 43 | JOY_BUTTON_3, 44 | JOY_BUTTON_4, 45 | JOY_BUTTON_5, 46 | JOY_BUTTON_6, 47 | JOY_BUTTON_7, 48 | JOY_BUTTON_8, 49 | JOY_BUTTON_9, 50 | JOY_BUTTON_10, 51 | JOY_BUTTON_11, 52 | JOY_BUTTON_12 53 | } e_joy_value; 54 | 55 | #include 56 | #include 57 | #include "Resource.h" 58 | #include "Common.h" 59 | #include "Logger.h" 60 | 61 | typedef unsigned char byte; 62 | typedef unsigned short word; 63 | typedef unsigned int uint; 64 | 65 | extern bool input_Initialize(HWND hWnd, HINSTANCE hInstance); 66 | extern bool input_GetKeyboardState(byte* input); 67 | extern void input_Release( ); 68 | extern void input_ReleaseJoysticks( ); 69 | extern void input_ShowController1Dialog(HWND hWnd, HINSTANCE hInstance); 70 | extern void input_ShowController2Dialog(HWND hWnd, HINSTANCE hInstance); 71 | extern void input_ShowConsoleDialog(HWND hWnd, HINSTANCE hInstance); 72 | extern void input_ShowUserDialog(HWND hWnd, HINSTANCE hInstance); 73 | extern byte input_keys[17]; 74 | extern byte input_devices[17]; 75 | extern byte user_keys[2]; 76 | extern byte user_devices[2]; 77 | extern byte user_modifiers[2]; 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /Win/Main.cpp: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Main.cpp 24 | // ---------------------------------------------------------------------------- 25 | #include 26 | #include 27 | #include "Console.h" 28 | #include "Common.h" 29 | #include "Logger.h" 30 | #include "Input.h" 31 | #define NULL 0 32 | 33 | // ---------------------------------------------------------------------------- 34 | // ParseDefaultPath 35 | // ---------------------------------------------------------------------------- 36 | void main_ParseDefaultPath( ) { 37 | std::string commandLine = GetCommandLine( ); 38 | if(commandLine[0] == '"') { 39 | common_defaultPath = common_Remove(commandLine.substr(0, commandLine.find('"', 1)), '"'); 40 | common_defaultPath = common_defaultPath.substr(0, common_defaultPath.rfind("\\") + 1); 41 | } 42 | else { 43 | common_defaultPath = commandLine.substr(0, commandLine.find(' ')); 44 | common_defaultPath = common_defaultPath.substr(0, common_defaultPath.rfind("\\") + 1); 45 | } 46 | } 47 | 48 | // ---------------------------------------------------------------------------- 49 | // WinMain 50 | // ---------------------------------------------------------------------------- 51 | int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR commandLine, int showCommand) { 52 | main_ParseDefaultPath( ); 53 | logger_Initialize(common_defaultPath + "ProSystem.log"); 54 | logger_level = LOGGER_LEVEL_DEBUG; 55 | 56 | console_Initialize(hInstance, commandLine); 57 | 58 | console_Run( ); 59 | 60 | logger_Release( ); 61 | return 1; 62 | } 63 | -------------------------------------------------------------------------------- /Win/Menu.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Menu.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef MENU_H 26 | #define MENU_H 27 | #define NULL 0 28 | 29 | #include 30 | #include 31 | #include "Resource.h" 32 | #include "Logger.h" 33 | #include "Console.h" 34 | #include "Common.h" 35 | #include "Display.h" 36 | #include "Sound.h" 37 | #include "Database.h" 38 | #include "Bios.h" 39 | 40 | typedef unsigned char byte; 41 | typedef unsigned short word; 42 | typedef unsigned int uint; 43 | 44 | extern bool menu_Initialize(HWND hWnd, HINSTANCE hInstance); 45 | extern void menu_Refresh( ); 46 | extern void menu_SetEnabled(bool enabled); 47 | extern bool menu_IsEnabled( ); 48 | extern HACCEL menu_hAccel; 49 | extern bool screenshot1; 50 | extern bool screenshot2; 51 | 52 | 53 | #endif -------------------------------------------------------------------------------- /Win/ProSystem.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gstanton/ProSystem1_3/3040295934c68024ecf89b45b50107ea1c271e66/Win/ProSystem.aps -------------------------------------------------------------------------------- /Win/ProSystem.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gstanton/ProSystem1_3/3040295934c68024ecf89b45b50107ea1c271e66/Win/ProSystem.ico -------------------------------------------------------------------------------- /Win/Sound.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Sound.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef SOUND_H 26 | #define SOUND_H 27 | #define SOUND_LATENCY_NONE 0 28 | #define SOUND_LATENCY_VERY_LOW 1 29 | #define SOUND_LATENCY_LOW 2 30 | #define SOUND_LATENCY_MEDIUM 3 31 | #define SOUND_LATENCY_HIGH 4 32 | #define SOUND_LATENCY_VERY_HIGH 5 33 | #define NULL 0 34 | 35 | #include 36 | #include "Common.h" 37 | #include "Logger.h" 38 | #include "ProSystem.h" 39 | #include "Configuration.h" 40 | #include "Tia.h" 41 | #include "Pokey.h" 42 | 43 | typedef unsigned char byte; 44 | typedef unsigned short word; 45 | typedef unsigned int uint; 46 | 47 | extern bool sound_Initialize(HWND hWnd); 48 | extern bool sound_Store( ); 49 | extern bool sound_Clear( ); 50 | extern bool sound_SetFormat(WAVEFORMATEX format); 51 | extern bool sound_Play( ); 52 | extern bool sound_Stop( ); 53 | extern bool sound_SetSampleRate(uint rate); 54 | extern uint sound_GetSampleRate( ); 55 | extern bool sound_SetMuted(bool muted); 56 | extern bool sound_IsMuted( ); 57 | extern void sound_Release( ); 58 | extern byte sound_latency; 59 | 60 | #endif -------------------------------------------------------------------------------- /Win/Timer.cpp: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Timer.cpp 24 | // ---------------------------------------------------------------------------- 25 | #include "Timer.h" 26 | 27 | static LONGLONG timer_currentTime; 28 | static LONGLONG timer_nextTime; 29 | static LONGLONG timer_counterFrequency; 30 | static uint timer_frameTime; 31 | static bool timer_usingCounter = false; 32 | 33 | // ---------------------------------------------------------------------------- 34 | // Initialize 35 | // ---------------------------------------------------------------------------- 36 | void timer_Initialize( ) { 37 | timer_usingCounter = (QueryPerformanceFrequency((LARGE_INTEGER*)&timer_counterFrequency))? true: false; 38 | timeBeginPeriod(1); 39 | } 40 | 41 | // ---------------------------------------------------------------------------- 42 | // Reset 43 | // ---------------------------------------------------------------------------- 44 | void timer_Reset( ) { 45 | if(timer_usingCounter) { 46 | QueryPerformanceCounter((LARGE_INTEGER*)&timer_nextTime); 47 | timer_frameTime = timer_counterFrequency / prosystem_frequency; 48 | timer_nextTime += timer_frameTime; 49 | } 50 | else { 51 | timer_frameTime = (1000.0 / (double)prosystem_frequency) * 1000; 52 | timer_currentTime = timeGetTime( ) * 1000; 53 | timer_nextTime = timer_currentTime + timer_frameTime; 54 | } 55 | } 56 | 57 | // ---------------------------------------------------------------------------- 58 | // IsTime 59 | // ---------------------------------------------------------------------------- 60 | bool timer_IsTime( ) { 61 | if(timer_usingCounter) { 62 | QueryPerformanceCounter((LARGE_INTEGER*)&timer_currentTime); 63 | } 64 | else { 65 | timer_currentTime = timeGetTime( ) * 1000; 66 | } 67 | 68 | if(timer_currentTime >= timer_nextTime) { 69 | timer_nextTime += timer_frameTime; 70 | return true; 71 | } 72 | return false; 73 | } 74 | -------------------------------------------------------------------------------- /Win/Timer.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // ___ ___ ___ ___ ___ ____ ___ _ _ 3 | // /__/ /__/ / / /__ /__/ /__ / /_ / |/ / 4 | // / / \ /__/ ___/ ___/ ___/ / /__ / / emulator 5 | // 6 | // ---------------------------------------------------------------------------- 7 | // Copyright 2005 Greg Stanton 8 | // 9 | // This program is free software; you can redistribute it and/or modify 10 | // it under the terms of the GNU General Public License as published by 11 | // the Free Software Foundation; either version 2 of the License, or 12 | // (at your option) any later version. 13 | // 14 | // This program is distributed in the hope that it will be useful, 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | // GNU General Public License for more details. 18 | // 19 | // You should have received a copy of the GNU General Public License 20 | // along with this program; if not, write to the Free Software 21 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | // ---------------------------------------------------------------------------- 23 | // Timer.h 24 | // ---------------------------------------------------------------------------- 25 | #ifndef TIMER_H 26 | #define TIMER_H 27 | 28 | #include 29 | #include "ProSystem.h" 30 | #include "Logger.h" 31 | #include "Common.h" 32 | 33 | extern void timer_Initialize( ); 34 | extern void timer_Reset( ); 35 | extern bool timer_IsTime( ); 36 | 37 | #endif -------------------------------------------------------------------------------- /mssccprj.scc: -------------------------------------------------------------------------------- 1 | SCC = This is a Source Code Control file 2 | 3 | [ProSystem.dsp] 4 | SCC_Aux_Path = "C:\Program Files\Microsoft Visual Studio\VSS" 5 | SCC_Project_Name = "$/ProSystem", UPAAAAAA 6 | --------------------------------------------------------------------------------