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

baritonomarchetto
MAME Fan
Reged: 11/22/10
Posts: 18
Send PM
Re: Need help with Cruis'n World driver
09/06/12 02:52 PM


Thank you all for the help

I was sure that the table had something weird, only i coudn't see what ... the question rises anyhow: why should those bits be counted from right to left? By convention?

The code works and it's very clear: essentially you "flatten" all the 4 view bits (5th to 8th) to "1111" with viewval = (viewval | 0xf0) and then assign the zero to the desired view bit with viewval = viewval & 0xef for bit 5, and so on.

To complete it it should be introduced some flag to avoid the view "shaking" while keeping the button pressed. I made a try, even if it doesn't work (it detects the first press, then nothing)


Code:


static READ32_HANDLER( port1_r )
{
static UINT8 cur_view = 0;
UINT16 viewval = readinputport(1); //actual values stored in memory
UINT8 button_pressed = viewval & 0x0010;
int diff=1; //the flag

if (button_pressed){diff=0;}//if you release the button, the cycle is ready to be triggered by button press

if (!button_pressed && diff==0) // button is pressed and the button was released
{
diff=1; //this should stop the cycling untill the button is released ...
cur_view++;

if (cur_view == 4){cur_view = 0;}

switch (cur_view)
{
case 0:
viewval = (viewval | 0xf0) & 0xef;
break;
case 1:
viewval = (viewval | 0xf0) & 0xdf;
break;
case 2:
viewval = (viewval | 0xf0) & 0xbf;
break;
case 3:
viewval = (viewval | 0xf0) & 0x7f;
break;
}
}
return (viewval << 16) | viewval;
}

Any idea on what's wrong here?

Thanks!!







Entire thread
Subject Posted by Posted on
* Need help with Cruis'n World driver baritonomarchetto 08/27/12 04:12 PM
. * Re: Need help with Cruis'n World driver sz72  08/27/12 08:44 PM
. * Re: Need help with Cruis'n World driver baritonomarchetto  08/28/12 09:23 AM
. * Re: Need help with Cruis'n World driver sz72  08/28/12 01:30 PM
. * Re: Need help with Cruis'n World driver baritonomarchetto  08/28/12 02:01 PM
. * Re: Need help with Cruis'n World driver sz72  08/28/12 03:51 PM
. * Re: Need help with Cruis'n World driver baritonomarchetto  08/28/12 04:19 PM
. * Re: Need help with Cruis'n World driver sz72  08/28/12 06:55 PM
. * Re: Need help with Cruis'n World driver baritonomarchetto  08/29/12 02:27 PM
. * Re: Need help with Cruis'n World driver etabeta  08/29/12 04:04 PM
. * Re: Need help with Cruis'n World driver baritonomarchetto  08/29/12 04:37 PM
. * Re: Need help with Cruis'n World driver etabeta  08/30/12 07:32 AM
. * Re: Need help with Cruis'n World driver baritonomarchetto  08/30/12 05:54 PM
. * Re: Need help with Cruis'n World driver etabeta  08/31/12 08:27 AM
. * Re: Need help with Cruis'n World driver baritonomarchetto  09/03/12 07:21 PM
. * Re: Need help with Cruis'n World driver any  09/06/12 06:04 AM
. * Re: Need help with Cruis'n World driver baritonomarchetto  09/06/12 02:52 PM
. * Re: Need help with Cruis'n World driver any  09/07/12 05:52 AM
. * Re: Need help with Cruis'n World driver baritonomarchetto  09/10/12 02:19 PM
. * Re: Need help with Cruis'n World driver baritonomarchetto  09/13/12 05:05 PM
. * Re: Need help with Cruis'n World driver R. Belmont  09/18/12 05:05 PM
. * Re: Need help with Cruis'n World driver baritonomarchetto  09/18/12 05:28 PM

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