-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added cpct_loadBinaryFile and cpct_enableBackgroundROMs functions #132
base: development
Are you sure you want to change the base?
Added cpct_loadBinaryFile and cpct_enableBackgroundROMs functions #132
Conversation
cpct_loadBinaryFile I've mixed issue #50 code with Kevin's code at http://cpctech.cpc-live.com/source/loader.html, and I've used some explanations and structure from Mochilote at http://www.cpcmania.com/Docs/Programming/Files.htm Reading from disc means that disc ROM must be enabled again, so I've added cpct_enableBackgroundROMs. This enabling routine is a bit 'problematic' as it calls to mc_start_program, which resets the stack. |
I see what you mean, @nestornillo. I think you have done a nice job by tracking Kevin's routines, understanding them and adapting them to CPCtelera. With respect to the routines, loadFile is well done. I don't know at this time if it should be reviewed to test for cassete or disc or controlling other things, but it is usable and well done at its present state. The problem is with enableBackgroundROMs. This function is inadequate for general CPCtelera users as a way to load disc files at any moment in their execution (say to load a level). This is only okay to be used at the start of the program, and with some reserves. This routine loops through all connected ROMs from 0 to 7 and calls their INIT functions. This will cause this ROMs to modify RAM, saving space for their variables and overwritting things (that's what INIT is for, to set up initial values in RAM). Clearly, users won't like that :). In fact, for load to work the only required thing is to reenable firmware, in general, if the user respects disc RAM values that would have been inited during boot. This is the same as calling the KL_ROM_WALK at the start and then ensuring not to overwrite disc RAM values. But, of course, firmware needs to be operating. In any case, what we really need is a way to initialize DISC controller only. Preferably, if possible, finding a way to tell the controller which RAM to use for its values. Then reading the file, then closing and discarding ROM. I'm going to ask some people that know this part of the firmware better for help. I think that's the proper way for the user. Thanks again for all your efforts :) |
Yes, enableBackgroundROMs is not nice. I just adapted the code I mention in previous comment, but I agree that it would be better if only disc ROM has to be enabled (rom 7 as I understand). |
This PR tries to implement Kevin Thacker's contributed routine for binary loading from Issue #50