Mord Posted August 9, 2007 Share Posted August 9, 2007 Whatever is wrong with Action RPG at present, for some reason it feels like it's a problem with using the super chip. I declare all my variables in a separate file and just include it to the source at the beginning. Makes it easier to for me to double check variables without scrolling up and down a lot. Anyway, the file contains two main SEGs, one for main ram, one for Superchip as follows: SEG.U RAM_Variables; ORG $80 ; start of RAM RORG $80 ; snip the variable declarations SEG.U SuperChip_RAM_Variables; ORG $F000 ; Write portion RORG $F000 Write_Spirit_Realm ds 1 ; Current Realm of Spirit. (sta) ; snip rest of variables . ORG $F080; Read Portion of variables. RORG $F080 Read_Spirit_Realm ds 1 ; Current Realm of Spirit. (lda) ; snip rest of variables. The only things snipped out are the variable declarations, otherwise the two SEGs appear exactly like that. It's a bankswitched rom (currently 8k, but I'm expecting to need more banks before I finish.) but I compile each rom separately then link them at the dos prompt. One routine I have init's all the ram to 0's prior to loading defaults etc. I use Andrew's routine he gave in the tutorials forum for the main ram+registers, and wrote this little routine for zero-ing the SuperChip's ram: ; Init the Sally Chip to all 0's as well. ldx #$7F lda #0 .InitAgain sta Write_Spirit_Realm,x dex bpl .InitAgain Where Write_Spirit_Realm is at $F000 as per the variable declaration file. The problem I'm getting with my code at present, as per the rom on my blog, is that if I start the rom up in an emulator, various aspects of the player gets messed up. but stays messed up consistantly if you stop and start the rom without shutting down the emulator. If you kill the emulator and start it up again, then load the rom, you get a different messed up settings - again consistantly until you kill the emulator. (I use Stella for this.) Running the rom on real hardware works a little differently in that I always get the exact same messed up config as I turn on and off the emulator. Where this is me using the krocodile cart for this, I don't know if that's playing a part for that behaviour or not. Trying to widdle away at some of the potential causes as I continuously recede my hairline looking for the problem. So for those who are familiar with superchip programming does the code setup above look legit? Quote Link to comment Share on other sites More sharing options...
+batari Posted August 9, 2007 Share Posted August 9, 2007 I downloaded the binary from your blog, and the problem seems to have absolutely nothing to do with Superchip. I think it has to do with a failure to clear main RAM. Your start routine looks like this: NOP NOP NOP LDX #$01 TXS PHA TXA .1 PHA DEX BNE .1 This doesn't clear RAM, as the BNE .1 never branches since X=1 initially. I'd recommend scrapping this routine and using CLEAN_START. Quote Link to comment Share on other sites More sharing options...
Mord Posted August 10, 2007 Author Share Posted August 10, 2007 I downloaded the binary from your blog, and the problem seems to have absolutely nothing to do with Superchip. I think it has to do with a failure to clear main RAM. Your start routine looks like this: NOP NOP NOP LDX #$01 TXS PHA TXA .1 PHA DEX BNE .1 This doesn't clear RAM, as the BNE .1 never branches since X=1 initially. I'd recommend scrapping this routine and using CLEAN_START. hm. that's the "obscure initilization" code I copied from Andrew's tutorials, or apparently an incorrect version of it. Hm. I wonder if the copy of the routine I used was from the earlier chapters, where I think it was written incorrectly. Apparently the proper version of it is: ldx #0 txa Clear dex txs pha bne Clear I'll see how things go with that changed around, although I'm still not sure why the bug started becoming visible right after I started using the superchip. Ah well, I'll work on getting the code working again this weekend once I'm awake. Quote Link to comment Share on other sites More sharing options...
Mord Posted August 12, 2007 Author Share Posted August 12, 2007 Ended up being (primarily) the initialization messing things up. A bunch of other smaller errors were floating around as well, but they were far easier to track down once the randomness stopped. As such, finally got objects working, if just as a special case for now. After I fix up a graphics bug, I'll work on expanding the object handling routines to be more generalized for all objects. Thanks! 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.