Jump to content

1 button to rotate banksticks on mbSID


sineSurfer
 Share

Recommended Posts

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 pressed

CS_MENU_BUTTON_SELECT_BANKSTICK

;as you can add banksticks on the fly, we need to check the # of banksticks each time the button is pressed

amountOfBanksticks=n ;is there a function to check this number?

nextBankstick=selectedBankstick+1;

if (nextBankstick > amountOfBanksticks){

nextBankstick=0;

}

;;then we change the bankstick

movlw  bankSticks[nextBankstick]; <-- again, is this possible on asm?

movwf  SID_BANK

goto  CS_MENU_MS_NotifyBankChange

anyone can help me to translate this to real and usable code? I learn quick following examples ;)

thanks!

Link to comment
Share on other sites

...

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 stuff

incf SID_BANK, W ; increment bank, load result into w

andlw 0x07 ; this keeps result from getting bigger than 7

movwf SID_BANK

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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 enough

I 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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

See fossi, thats what I got by following your advice: "Don't go to university." ;D

mmm... 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

Link to comment
Share on other sites

  • 1 month later...

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 <4

edit: You bastard! Editing your repy is not fair ;-)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...