Core Wars (fixes?)

Myke Reynolds myke at gitpyr.UUCP
Fri Dec 20 08:39:40 AEST 1985


>>>>>>>> marks a changed line in rcasm.[ly]

in rcasm.l: starting at line 40
--------------------------------------------------------------------------------
{L}	{
		static	char	bufs[2][LABEL_LEN+1];
		auto	int	len = min(yyleng+1, LABEL_LEN);
		auto	char	**ptr;

		if (orc == 1)
			ptr = &blabel;
		else
			ptr = (toggle ? &blabel : &alabel);
		strncpy(bufs[toggle], &(yytext[1]), len);
		bufs[toggle][len] = '\0';
		*ptr = bufs[toggle];
		toggle = (toggle ? 0 : 1);
>>>>>>>>	blabel = *ptr;				/* ADD THIS! */
		return(LABEL);
	}


and in rcasm.y: starting at line 137
--------------------------------------------------------------------------------
word order is reverse on our machine, when you set:
$$ = inst.modb = $1;  modb is a bit field in inst, so when $1 gets passed though
inst, it is put in the wrong place and yyval ($$) gets entirely the wrong value.
--------------------------------------------------------------------------------
arga	:	addr INTEGER	/* returns addr */
		{
>>>>>>>>		inst.moda = $$ = $1;
			inst.arga = $2;
		}
	|	addr LABEL
		{
>>>>>>>>		inst.moda = $$ = $1;
			inst.arga = getsymval(alabel, 0);
		}
	;

argb	:	addr INTEGER	/* returns addr */
		{
>>>>>>>>		inst.modb = $$ = $1;
			inst.argb = $2;
		}
	|	addr LABEL
		{
>>>>>>>>		inst.modb = $$ = $1;
			inst.argb = getsymval(blabel, 1);
		}
	;
-- 
Myke Reynolds
Office of Telecommunications and Networking
Georgia Insitute of Technology, Atlanta Georgia, 30332
...!{akgua,allegra,amd,hplabs,ihnp4,seismo,ut-ngp}!gatech!gitpyr!myke

"Drawing from my fine command of the english language, I said nothing."



More information about the Comp.sources.bugs mailing list