int
build_un( char * buf, unsigned int locaddr, unsigned int retaddr, unsigned int
offset, unsigned int base )
{
unsigned char b0, b1, b2, b3;
int start = ( (base / ADD) + 1 ) * ADD;
int sz;

OCT( b0, b1, b2, b3, locaddr, "[ locaddr ]" );
sz = snprintf( buf, FOUR + 1, /* 16 char to have the 4 addresses */
"%c%c%c%c" /* + 1 for the ending \0 */
"%c%c%c%c"
"%c%c%c%c"
"%c%c%c%c",
b3, b2, b1, b0,
b3 + 1, b2, b1, b0,
b3 + 2, b2, b1, b0,
b3 + 3, b2, b1, b0 );

OCT( b0, b1, b2, b3, retaddr, "[ retaddr ]" );

return snprintf( buf + sz, MAX_FMT_LENGTH,
"%%%dx%%%d$n%%%dx%%%d$n%%%dx%%%d$n%%%dx%%%d$n",
b3 - FOUR + start - base, offset,
b2 - b3 + start, offset + 1,
b1 - b2 + start, offset + 2,
b0 - b1 + start, offset + 3 );
}
Esempio n. 2
0
char * mk_fmt_string( 	unsigned int align, 
			unsigned int offset, 
			unsigned long retloc, 
			unsigned long retaddr,
			int written )
{
	int  	tow0, tow1, tow2, tow3 ;
		
	char 	* addr = (char *)xmalloc(128);
	char 	* fmt = (char *)xmalloc(516);
        char 	* buf = (char *)xmalloc(1024);
        char 	* ptr = addr ;
        
	char 	b0, b1, b2, b3 ;
	
        OCT ( b0, b1, b2, b3, retloc );

        while (( align-- ) && (align < 16 ))
                *addr++ = 0x41 ;

	*addr++ = b3 + 0 ; *addr++ = b2 ; *addr++ = b1 ; *addr++ = b0 ;
	*addr++ = b3 + 1 ; *addr++ = b2 ; *addr++ = b1 ; *addr++ = b0 ;
	*addr++ = b3 + 2 ; *addr++ = b2 ; *addr++ = b1 ; *addr++ = b0 ;
	*addr++ = b3 + 3 ; *addr++ = b2 ; *addr++ = b1 ; *addr++ = b0 ;
	
	*addr++ = 0 ;
	
        OCT ( b0, b1, b2, b3, retaddr );
        
	tow3 = TOWCALC(b3, written);	written += tow3 ;
	tow2 = TOWCALC(b2, written);	written += tow2 ;
	tow1 = TOWCALC(b1, written);	written += tow1 ;
	tow0 = TOWCALC(b0, written);	
	
        snprintf(fmt,516,
#ifdef DEBUG
        "%%%dx|%%%d$08x|%%%dx|%%%d$08x|%%%dx|%%%d$08x|%%%dx|%%%d$08x|",
#else
        "%%%dx%%%d$n%%%dx%%%d$n%%%dx%%%d$n%%%dx%%%d$n",
#endif
                tow3,			offset,
                tow2,			offset + 1,
                tow1,			offset + 2,
                tow0,			offset + 3);
	
        snprintf(buf,1024,"%s%s",ptr,fmt);
	
	free(ptr);
	free(fmt);
        return(buf);
}
Esempio n. 3
0
File: scsp.c Progetto: LeWoY/MAMEHub
static void Compute_EG(scsp_state *scsp,SLOT *slot)
{
	int octave=(OCT(slot)^8)-8;
	int rate;
	if(KRS(slot)!=0xf)
		rate=octave+2*KRS(slot)+((FNS(slot)>>9)&1);
	else
Esempio n. 4
0
File: scsp.cpp Progetto: Fulg/mame
void scsp_device::Compute_EG(SCSP_SLOT *slot)
{
	int octave=(OCT(slot)^8)-8;
	int rate;
	if(KRS(slot)!=0xf)
		rate=octave+2*KRS(slot)+((FNS(slot)>>9)&1);
	else
Esempio n. 5
0
static void Compute_EG(aica_state *AICA,struct _SLOT *slot)
{
	int octave=(OCT(slot)^8)-8;
	int rate;
	if(KRS(slot)!=0xf)
		rate=octave+2*KRS(slot)+((FNS(slot)>>9)&1);
	else
Esempio n. 6
0
static void Compute_EG(struct _AICA *AICA,struct _SLOT *slot)
{
	int octave=OCT(slot);
	int rate;
	if(octave&8) octave=octave-16;
	if(KRS(slot)!=0xf)
		rate=octave+2*KRS(slot)+((FNS(slot)>>9)&1);
	else
Esempio n. 7
0
static void Compute_EG(struct _SCSP *SCSP,struct _SLOT *slot)
{
	int octave=OCT(slot);
	int rate;
	if(octave&8) octave=octave-16;
	if(KRS(slot)!=0xf)
		rate=2*(octave+KRS(slot))+((FNS(slot)>>9)&1);
	else
Esempio n. 8
0
static data32_t SCSP_Step(struct _SLOT *slot)
{
	int octave=OCT(slot);
	int Fo=44100;
	int Fn;
	if(octave&8)
		Fo>>=(16-octave);
	else