+karri Posted January 8, 2011 Share Posted January 8, 2011 Hi, I am currently rewriting parts of the cc65 boot system and I found out that I need to understand how the boot process really goes. Does someone have some original bootloader documentation available? Right now I know the private and public keys and I even understand how the small rom inside the Lynx decrypts the cart. As the Lynx decrypts the blocks 51 bytes at a time I wonder if it would be possible to just set up a downloader in 51 bytes. This downloader would load in 256 bytes somewhere and jump there to do the rest. -- Karri Quote Link to comment Share on other sites More sharing options...
Wookie Posted January 10, 2011 Share Posted January 10, 2011 I designed a new loader that is in two parts: a micro-loader that gets encrypted that can only load 256 bytes to a fixed address in RAM, and a secondary loader that can load the main executable and run it. The microloader source is here: https://bitbucket.org/wookie/hlakit/src/bb69265cc98f/examples/6502/lynx/micro_loader.s The secondary loader source is here: https://bitbucket.org/wookie/hlakit/src/bb69265cc98f/examples/6502/lynx/secondary_loader.s The microloader is 51 bytes and is the only thing that needs to be encrypted. I created this loading system to get past the decryption phase as fast as possible and to simplify the whole process of building a runnable ROM. I tested the microloader in mednafen. I haven't done testing on real hardware yet. Note that the loaders are written in HLA. --wookie Quote Link to comment Share on other sites More sharing options...
+karri Posted January 10, 2011 Author Share Posted January 10, 2011 (edited) I designed a new loader that is in two parts: a micro-loader that gets encrypted that can only load 256 bytes to a fixed address in RAM, and a secondary loader that can load the main executable and run it. The microloader source is here: https://bitbucket.org/wookie/hlakit/src/bb69265cc98f/examples/6502/lynx/micro_loader.s The secondary loader source is here: https://bitbucket.org/wookie/hlakit/src/bb69265cc98f/examples/6502/lynx/secondary_loader.s The microloader is 51 bytes and is the only thing that needs to be encrypted. I created this loading system to get past the decryption phase as fast as possible and to simplify the whole process of building a runnable ROM. I tested the microloader in mednafen. I haven't done testing on real hardware yet. Note that the loaders are written in HLA. --wookie YES!!! May I use it in the cc65 compiler as the default loader? Edit: I read through this and found out that you already have some licensing header on it. The maintainer of the cc65 packet wants to simplify things and they accept stuff to the cc65 kit that comply with the license below. User contributions for cc65, the libraries and binary tools are highly appreciated! Because I would like to keep the licensing terms as uniform and as free as possible, authors of contributions that are to be included in the source and binary distributions must agree that their contributions are donated to the cc65 project under the terms of the following license (this is a copy of the above, and a copy of the zlib license): Copyright © (year) (copyright holder) This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. When submitting material that is to be included into cc65, please state that you agree with this license. -- Karri Edited January 10, 2011 by karri Quote Link to comment Share on other sites More sharing options...
+karri Posted January 10, 2011 Author Share Posted January 10, 2011 I read through your code and if I understand it correctly it will work with any block sizes as long as I specify home many 256 byte chunks fit into one segment (blocksize). This approach would be ideal for the lseek and open-methods I implemented in the cc65 toolchain last week. You could the create the build for different cart sizes by specifying eg. __BLOCKSIZE__=2048 on the command line or in the lynx.cfg file. -- Karri Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.