MAMEWorld >> Programming
Previous thread Previous  View all threads Index   Next thread Next   Threaded Mode Threaded  

Pages: 1

palindrome
MAME Fan
Reged: 05/15/09
Posts: 14
Loc: NSW, Australia
Send PM


Rotary DIP switches
#193940 - 06/22/09 10:53 AM


Just wondering if these types of DIP switches are supported in MAME ? If not then what would be the best way to go about it.

I have four of these on the board that I am emulating.

Thanks..




Vas Crabb
BOFH
Reged: 12/13/05
Posts: 4462
Loc: Melbourne, Australia
Send PM


Re: Rotary DIP switches new [Re: palindrome]
#193943 - 06/22/09 12:37 PM


> Just wondering if these types of DIP switches are supported in MAME ? If not then
> what would be the best way to go about it.
>
> I have four of these on the board that I am emulating.
>
> Thanks..

They usually behave like four DIP switches and make BCD codes.



palindrome
MAME Fan
Reged: 05/15/09
Posts: 14
Loc: NSW, Australia
Send PM


Re: Rotary DIP switches new [Re: Vas Crabb]
#194008 - 06/23/09 07:38 AM


Do you mean 4 independent switches for each DIP package ?

That will give max binary value of 0x0F with all of the switches on per DIP but I only need to use a value from 0x0 to 0x9.

Thanks



Vas Crabb
BOFH
Reged: 12/13/05
Posts: 4462
Loc: Melbourne, Australia
Send PM


Re: Rotary DIP switches new [Re: palindrome]
#194037 - 06/23/09 01:46 PM


> Do you mean 4 independent switches for each DIP package ?
>
> That will give max binary value of 0x0F with all of the switches on per DIP but I
> only need to use a value from 0x0 to 0x9.
>
> Thanks

Do you know what BCD is?



Kale
Il Sindaco
Reged: 09/26/03
Posts: 155
Loc: Naples, Italy
Send PM


Re: Rotary DIP switches new [Re: palindrome]
#194061 - 06/23/09 05:24 PM



Code:

	
PORT_START("name_of_the_bcd_dipsw_tag")
PORT_DIPNAME( 0x0f, default_val, whatever_the_dip_does ) //BCD DIP-SW
PORT_DIPSETTING( 0x00, "value_0" )
PORT_DIPSETTING( 0x01, "value_1" )
...
PORT_DIPSETTING( 0x09, "value_9" )
//A-F invalid / doesn't exist



In short, it's not necessary that you call all the dipsettings of a given input (there are various examples in the source that does that).



palindrome
MAME Fan
Reged: 05/15/09
Posts: 14
Loc: NSW, Australia
Send PM


Re: Rotary DIP switches new [Re: Kale]
#194135 - 06/24/09 05:00 AM


Thanks Kale, that works well with my read handler.


Pages: 1

MAMEWorld >> Programming
Previous thread Previous  View all threads Index   Next thread Next   Threaded Mode Threaded  

Extra information Permissions
Moderator:  Pi 
0 registered and 46 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 3869