Jump to content

Emulating SR's with Scan Matrix


Recommended Posts

Hi,

I'm trying to interface c64 keyboard to MBSEQ2.4c. It's working but I can't figure out how to set mios_tables.inc.

How does scan matrix relates to simulating shift registers. For example if I press button which is on Col: 6 Row: 2 what is passed to USER_DIN_NotifyToggle? How to set eg. GP#1 to number 1 on c64 keyboard. As I said I'ts working but who knows where GP#1 is currently set. I'm sorry if this is obvious but these large asm apps are confusing me. I'm just not used to code like this.

Thanx,

Zoran

Link to comment
Share on other sites

have you seen this yet?

http://www.midibox.org/dokuwiki/doku.php?id=midiboxkb_-_using_a_c64_keyboard_as_input

There is a table in setup_mbseq_v2.asm


SEQ_IO_TABLE_DIN
;; Function name SR# Pin#
;; NOTE: the pins of the 16 general purpose buttons are assigned at main.asm
#if DEFAULT_ENC_DATAWHEEL < 0
DIN_ENTRY CS_MENU_BUTTON_Left, 1, 0
DIN_ENTRY CS_MENU_BUTTON_Right, 1, 1
#endif
DIN_ENTRY SEQ_BUTTON_Scrub, 1, 2
DIN_ENTRY SEQ_BUTTON_Metronome, 1, 3

DIN_ENTRY SEQ_BUTTON_Stop, 1, 4
DIN_ENTRY SEQ_BUTTON_Pause, 1, 5
DIN_ENTRY SEQ_BUTTON_Play, 1, 6
DIN_ENTRY SEQ_BUTTON_Rew, 1, 7
DIN_ENTRY SEQ_BUTTON_Fwd, 2, 0

DIN_ENTRY SEQ_BUTTON_F1, 2, 1
DIN_ENTRY SEQ_BUTTON_F2, 2, 2
DIN_ENTRY SEQ_BUTTON_F3, 2, 3
DIN_ENTRY SEQ_BUTTON_F4, 2, 4

DIN_ENTRY SEQ_BUTTON_Menu, 2, 5
DIN_ENTRY SEQ_BUTTON_Select, 2, 6
DIN_ENTRY SEQ_BUTTON_Exit, 2, 7

DIN_ENTRY SEQ_BUTTON_Track1, 3, 0
DIN_ENTRY SEQ_BUTTON_Track2, 3, 1
DIN_ENTRY SEQ_BUTTON_Track3, 3, 2
DIN_ENTRY SEQ_BUTTON_Track4, 3, 3

DIN_ENTRY SEQ_BUTTON_LayerA, 3, 4
DIN_ENTRY SEQ_BUTTON_LayerB, 3, 5
DIN_ENTRY SEQ_BUTTON_LayerC, 3, 6

DIN_ENTRY SEQ_BUTTON_Edit, 4, 0
DIN_ENTRY SEQ_BUTTON_Mute, 4, 1
DIN_ENTRY SEQ_BUTTON_Pattern, 4, 2
DIN_ENTRY SEQ_BUTTON_Song, 4, 3

DIN_ENTRY SEQ_BUTTON_Solo, 4, 4
DIN_ENTRY SEQ_BUTTON_Fast, 4, 5
DIN_ENTRY SEQ_BUTTON_All, 4, 6

DIN_ENTRY_EOT
[/code] That table gets referred to when DIN events happen, and calls the appropriate routine. Also...
[code]
; Some menus are provide the possibility to use 16 "general purpose" buttons
; Define the two shift registers which are assigned to this function here:
; (valid numbers: 1-16)
#define DEFAULT_GP_DIN_SR0 7 ; first GP DIN shift register assigned to SR#7
#define DEFAULT_GP_DIN_SR1 10 ; second GP DIN shift register assigned to SR#10

The code looks at the pins set on those DIN shift registers (i.e. if it gets an event on SR=7).

That should be enough for you to simulate button presses from your scan matrix routine.

Link to comment
Share on other sites

Hi,

thanks for trying to help. I understand all that. I made SM interface, connected c64 keyboard, added calls to SM functions to main.asm, added declarations which are needed to app_defines.h to free mem locations 0x360-0x374, assembled everything and it works. Things that aren't clear to me are how does SM relate to SR chain. Which SR and pin is invoked when pressing for example F1 on c64 keyboard. I read this http://www.midibox.org/forum/index.php?topic=7168.0 but it's not clear to me. I'm calling USER_DIN_NotifyToggle from SM_NotifyToggle

and moxi's calling his own function. Maybe I need to make my own function which will pass something to MIOS_PARAMETER3. I don't know.

Thanks,

Zoran.

Link to comment
Share on other sites

I don't know enough about your configuration to give a concise answer...

Assuming all your buttons are in a scan matrix, you're (probably) using one DIN shift register to get the button states as part of the scan matrix routine. In this case, it is best to move the code in USER_DIN_NotifyToggle to a new routine (i.e. SM_NotifyToggle), and put in an empty USER_DIN_NotifyToggle. MIOS calls USER_DIN_NotifyToggle when the DIN inputs change, which will ALSO be when they change as part of your scan matrix. So you want to ignore those events, and instead simulate them from your scan matrix routine by calling SM_NotifyToggle with a simulated shift register and pin number.

If only some of your buttons are directly connected to DIN inputs, then you will need to handle things differently... again, it's hard to comment until I know more about what you're doing.

Link to comment
Share on other sites

Hi Wilba,

this is what I want to accomplish. As described in MBSEQ tutorial #3:

Note: if the 16 step encoders are not stuffed, the parameters can be modified by pressing the appr. general purpose button two times. Thereafter the value can be changed with the datawheel (hint: this means that a nice MBSEQ based drum computer can be built without the 16 encoders)

I want to make c64 a small drum computer. This means that one more DOUT for encoder should be added as well aditional DOUT's for leds. This maybe complicates things a little. I know how to program in assembly but not all things are clear to me like passing multiple parameters to functions and stuff. So lets say in this case first DIN SR should be of SM and second in chain is for one encoder, also first DOUT SR is of SM and next one's are for 16 GP leds, track leds and so on. How could this be realized? I think it should not be hard, most of it already works.

Reason I want to do this is to give some purpose to all these c64's without SID.I dont wanna throw them away. Modifications are small so other people could build this if they find this usefull. I have some other ideas for those old boxes but that will probably be C project from ground up.

Thanks,

Zoran.

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