sineSurfer Posted January 10, 2008 Report Share Posted January 10, 2008 Hi, I'd like to have 1 button only to rotate the bankstick selection on each press, here is my pseudocode so far:;array defined somewhere on the .inc files, not sure in which one ???bankSticks=[0x00, 0x01 ,0x02 ,0x03 ,0x04 ,0x05 ,0x06 ,0x08]; <-- is this even possible on asm?selectedBankstick=0; or whichever was selected on startup;;when the change bank button gets pressedCS_MENU_BUTTON_SELECT_BANKSTICK;as you can add banksticks on the fly, we need to check the # of banksticks each time the button is pressedamountOfBanksticks=n ;is there a function to check this number? nextBankstick=selectedBankstick+1;if (nextBankstick > amountOfBanksticks){nextBankstick=0;};;then we change the bankstickmovlw bankSticks[nextBankstick]; <-- again, is this possible on asm?movwf SID_BANKgoto CS_MENU_MS_NotifyBankChangeanyone can help me to translate this to real and usable code? I learn quick following examples ;)thanks! Quote Link to comment Share on other sites More sharing options...
bugfight Posted January 10, 2008 Report Share Posted January 10, 2008 ...bankSticks=[0x00, 0x01 ,0x02 ,0x03 ,0x04 ,0x05 ,0x06 ,0x08]; <-- is this even possible on asm?...is that 0x08 intended?if not this should work instead of all that array stuffincf SID_BANK, W ; increment bank, load result into wandlw 0x07 ; this keeps result from getting bigger than 7movwf SID_BANK Quote Link to comment Share on other sites More sharing options...
nILS Posted January 10, 2008 Report Share Posted January 10, 2008 another problem - the way you're going about it, checking the number of banksticks wouldn't help since there could only be banksticks 1,3 and 8 in the system. But honestly, I don't see the point in chaning banksticks on the fly. 8 should be enoughm don't you think? Quote Link to comment Share on other sites More sharing options...
sineSurfer Posted January 10, 2008 Author Report Share Posted January 10, 2008 is that 0x08 intended?hehe, nope, my mistake bugfight, it should be 0x07 and there is no chance I would have figured out that code by myself ;D i'll test it later.checking the number of banksticks wouldn't help since there could only be banksticks 1,3 and 8 in the system.oops, you are right.from what I see, bugfight code - incf SID_BANK, W ; - somehow takes care of that, no? But honestly, I don't see the point in chaning banksticks on the fly. 8 should be enoughm don't you think?I meant to say add more banksticks on the fly :), 8 are enoughI was thinking about it as a generic approach so it could work for everybody, not only me, without needing to change anything on the hardware or software.Imagine someone having the 8 banksticks pcb built, but using only 2 or 3 banksticks for the moment, or like me right now, a veroboard wired for A0 and A1(will change to A0, A1, A7 later).I'm still wondering why it is not included already as a standard feature as it's easier to have 1 or 2 dedicated buttons to rotate banksticks instead of:button->encoder->button->encoder as you have to do now if you want to change bankstick from the mbSid box itself. Quote Link to comment Share on other sites More sharing options...
nILS Posted January 10, 2008 Report Share Posted January 10, 2008 Nope, bugfight's source does not take care of that. It simply and elegantly toggles though the Banksticks.I'd probably leave the generic solution with bankstick detection to some coding guru and go with a simple solution that works "just" for you :D Quote Link to comment Share on other sites More sharing options...
sineSurfer Posted January 10, 2008 Author Report Share Posted January 10, 2008 Nope, bugfight's source does not take care of that. It simply and elegantly toggles though the Banksticks.I'd probably leave the generic solution with bankstick detection to some coding guru and go with a simple solution that works "just" for you :DSee fossi, thats what I got by following your advice: "Don't go to university." ;Dmmm... I remember the menu tells you there is no bankstick connected if you want to switch to an address with no bankstick...ok, bugfight code will do then;D Quote Link to comment Share on other sites More sharing options...
nILS Posted February 20, 2008 Report Share Posted February 20, 2008 incf SID_BANK, W ; increment bank, load result into wandlw 0x03 ; this keeps result from getting bigger than 7movwf SID_BANKI just noticed - andlw 0x03 will keep the result < 4 ;-) 0x07 (00000111b) will keep it < 8. Quote Link to comment Share on other sites More sharing options...
bugfight Posted February 20, 2008 Report Share Posted February 20, 2008 ...will keep it < 8.what? what are you talking about??*whack* Quote Link to comment Share on other sites More sharing options...
nILS Posted February 20, 2008 Report Share Posted February 20, 2008 what? what are you talking about??*whack*I assumed we want to toggle between 8 banks. 0x03 = 00000011b -> "andlw 0x03" will cut off anything but the least significant 2 bits. 2 bits means 0..3 not 0..7. So "andlw 0x03" doesn't keep it <8 (well it does in a way) but keeps it <4edit: You bastard! Editing your repy is not fair ;-) Quote Link to comment Share on other sites More sharing options...
bugfight Posted February 20, 2008 Report Share Posted February 20, 2008 ...edit: You bastard! Editing your repy is not fair ;-)other than the obvious irony of all that...huh? what? *whack*p.s. it was edited only for content and to fit your television set 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.