star/star.c
/*
** Special case for when you need to load a word and sign-extend it.
** This cuts some fat out of a few instructions (i.e. MOVEA).
*/
Special case for when you need to load a word and sign-extend it.
This cuts some fat out of a few instructions .
Special case for when you need to load a word and sign - extend it . This cuts some fat out of a few instructions .
static void ea_step_read_signword(enum eamode mode, int reg) {
	char regs[100];
	if(reg == -1) sprintf(regs, "ebx*4");
	else sprintf(regs, "%d", reg * 4);
	switch(mode) {
	case dreg: emit("movsx ecx,word[__dreg+%s]\n", regs); break;
	case areg: emit("movsx ecx,word[__areg+%s]\n", regs); break;
	case aind: case ainc: case adec:
	case adsp: case axdp:
	case absw: case absl:
	case pcdp: case pcxd:
		emit("call readmemory%s\n", sizename[2]);
		emit("movsx ecx,cx\n");
		break;
	case immd:
		emit("movsx ecx,word[esi]\n");
		emit("add esi,byte 2\n");
		break;
	default:
		emit("#error ea_step_read_signword\n");
		break;
	}
}
static void ea_step_read_signword ( enum eamode mode , int reg ) { char regs [ 100 ] ; if ( reg == -1 ) sprintf ( regs , " " ) ; else sprintf ( regs , " " , reg * 4 ) ; switch ( mode ) { case dreg : emit ( " \n " , regs ) ; break ; case areg : emit ( " \n " , regs ) ; break ; case aind : case ainc : case adec : case adsp : case axdp : case absw : case absl : case pcdp : case pcxd : emit ( " \n " , sizename [ 2 ] ) ; emit ( " \n " ) ; break ; case immd : emit ( " \n " ) ; emit ( " \n " ) ; break ; default : emit ( " \n " ) ; break ; } }
Special case for when you need to load a word and sign-extend it.
Special case for when you need to load a word and sign - extend it .