6502 emulator for Commodore 64 ROMs, serial terminal edition for MBED. Recommend terminal echo on, line edit on, caps lock, 115200bps, implicit carriage return on newline, currently non-buffered so don't paste lots of stuff
More details at:
[https://github.com/davervw] [https://techwithdave.davevw.com/2020/03/simple-emu-c64.html]
main.cpp@9:b4293b01083b, 2020-04-17 (annotated)
- Committer:
- davervw
- Date:
- Fri Apr 17 09:15:50 2020 +0000
- Revision:
- 9:b4293b01083b
- Parent:
- 8:519febdce8db
comment updates, and implemented optional #define LOCAL_LOAD // for loading from Mbed filesystem
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
davervw | 0:90de1cbc8a5f | 1 | // c-simple-emu-cbm.cs - main() |
davervw | 0:90de1cbc8a5f | 2 | // |
davervw | 0:90de1cbc8a5f | 3 | //////////////////////////////////////////////////////////////////////////////// |
davervw | 0:90de1cbc8a5f | 4 | // |
davervw | 0:90de1cbc8a5f | 5 | // c-simple-emu-cbm (C Portable Version) |
davervw | 7:f49fa56672d8 | 6 | // C64/6502 Emulator for Terminal Console |
davervw | 0:90de1cbc8a5f | 7 | // |
davervw | 0:90de1cbc8a5f | 8 | // MIT License |
davervw | 0:90de1cbc8a5f | 9 | // |
davervw | 7:f49fa56672d8 | 10 | // Copyright(c) 2020 by David R. Van Wagner |
davervw | 0:90de1cbc8a5f | 11 | // davevw.com |
davervw | 0:90de1cbc8a5f | 12 | // |
davervw | 0:90de1cbc8a5f | 13 | // Permission is hereby granted, free of charge, to any person obtaining a copy |
davervw | 0:90de1cbc8a5f | 14 | // of this software and associated documentation files (the "Software"), to deal |
davervw | 0:90de1cbc8a5f | 15 | // in the Software without restriction, including without limitation the rights |
davervw | 0:90de1cbc8a5f | 16 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
davervw | 0:90de1cbc8a5f | 17 | // copies of the Software, and to permit persons to whom the Software is |
davervw | 0:90de1cbc8a5f | 18 | // furnished to do so, subject to the following conditions: |
davervw | 0:90de1cbc8a5f | 19 | // |
davervw | 0:90de1cbc8a5f | 20 | // The above copyright notice and this permission notice shall be included in all |
davervw | 0:90de1cbc8a5f | 21 | // copies or substantial portions of the Software. |
davervw | 0:90de1cbc8a5f | 22 | // |
davervw | 0:90de1cbc8a5f | 23 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
davervw | 0:90de1cbc8a5f | 24 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
davervw | 0:90de1cbc8a5f | 25 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE |
davervw | 0:90de1cbc8a5f | 26 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
davervw | 0:90de1cbc8a5f | 27 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
davervw | 0:90de1cbc8a5f | 28 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
davervw | 0:90de1cbc8a5f | 29 | // SOFTWARE. |
davervw | 0:90de1cbc8a5f | 30 | // |
davervw | 0:90de1cbc8a5f | 31 | //////////////////////////////////////////////////////////////////////////////// |
davervw | 0:90de1cbc8a5f | 32 | |
davervw | 0:90de1cbc8a5f | 33 | #include <mbed.h> |
davervw | 0:90de1cbc8a5f | 34 | #include "cbmconsole.h" |
davervw | 0:90de1cbc8a5f | 35 | #include "emuc64.h" |
davervw | 0:90de1cbc8a5f | 36 | #include "emu6502.h" |
davervw | 0:90de1cbc8a5f | 37 | |
davervw | 9:b4293b01083b | 38 | #ifdef LOCAL_LOAD |
davervw | 9:b4293b01083b | 39 | #include <LocalFileSystem.h> |
davervw | 9:b4293b01083b | 40 | LocalFileSystem local("local"); |
davervw | 9:b4293b01083b | 41 | #endif |
davervw | 9:b4293b01083b | 42 | |
davervw | 0:90de1cbc8a5f | 43 | Serial pc(USBTX, USBRX, 115200); |
davervw | 9:b4293b01083b | 44 | //Serial pc(p9, p10, 115200); |
davervw | 0:90de1cbc8a5f | 45 | |
davervw | 0:90de1cbc8a5f | 46 | int main(/*int argc, char* argv[]*/) |
davervw | 0:90de1cbc8a5f | 47 | { |
davervw | 0:90de1cbc8a5f | 48 | pc.printf("\n"); |
davervw | 9:b4293b01083b | 49 | pc.printf("c-simple-emu-cbm version 1.7 for Mbed\n"); |
davervw | 0:90de1cbc8a5f | 50 | pc.printf("Copyright (c) 2020 by David R. Van Wagner\n"); |
davervw | 9:b4293b01083b | 51 | pc.printf("Open Source - MIT License\n"); |
davervw | 0:90de1cbc8a5f | 52 | pc.printf("github.com/davervw\n"); |
davervw | 0:90de1cbc8a5f | 53 | pc.printf("\n"); |
davervw | 9:b4293b01083b | 54 | pc.printf("Contains other licensed software\n"); |
davervw | 9:b4293b01083b | 55 | pc.printf(" ARM MBED OS\n"); |
davervw | 9:b4293b01083b | 56 | pc.printf("\n"); |
davervw | 9:b4293b01083b | 57 | pc.printf("Commodore ROMs not licensed\n"); |
davervw | 9:b4293b01083b | 58 | pc.printf("\n"); |
davervw | 9:b4293b01083b | 59 | |
davervw | 9:b4293b01083b | 60 | #ifdef LOCAL_LOAD |
davervw | 9:b4293b01083b | 61 | // note: requires a file system implementation (SD, Mbed MSD, etc.) |
davervw | 9:b4293b01083b | 62 | StartupPRG = "/local/startup.prg"; |
davervw | 9:b4293b01083b | 63 | #endif |
davervw | 9:b4293b01083b | 64 | |
davervw | 8:519febdce8db | 65 | C64_Init("/local/basic", "/local/chargen", "/local/kernal"); |
davervw | 0:90de1cbc8a5f | 66 | ResetRun(ExecutePatch); |
davervw | 0:90de1cbc8a5f | 67 | return 0; |
davervw | 0:90de1cbc8a5f | 68 | } |