Exemplo n.º 1
0
static void DoStic(TCP_SOCKET socket, BYTE t) {
	BYTE ch;
	static double qw;
	static DWORD	ruti, eti, uti;
	WORD *ww = (WORD*)&httpData[0];

	if(t==1) {
		TCPPutROMString(socket,s_High); for(ch=1;ch<=32;ch++)	TCPPut(socket, 0x30+ch/10);
		TCPPutROMString(socket,s_Lowx); for(ch=1;ch<=32;ch++)	TCPPut(socket, 0x30+ch%10);
		TCPPutROMString(socket,s_Exst); for(ch=0;ch<32;ch++)	TCPPut(socket, GetExist(ch) ? 'O':'x');
	}	
	else if(t==2) {
		ruti = dwRunt/100ul;
		for(ch=0;ch<32;ch++) { if(ruti) { qw = (double)acci[ch]; qw /= (double)ruti; ww[ch] = (WORD)(qw * C_PERF); if(ww[ch]>=1000u) ww[ch]=999u; } else ww[ch] = 0ul; }
		TCPPutROMString(socket,(ROM BYTE*)"</font><font face=courier new size=2 color=white>");
		for(ch=0;ch<32;ch+=8)	OutShit(socket,ch);
	}	
	else if(t==3){
		ruti = dwRunt/100ul;
		TCPPutROMString(socket,s_gotn); OutLong(socket, gotn, 10);
		TCPPutROMString(socket,s_subm); OutLong(socket, subm, 10);
		if(ruti) { qw = (double)subm; qw /= (double)ruti; eti = (DWORD)(qw * C_PERF); uti = (DWORD)(qw * 6000.0); } else eti=uti=0ul;
		TCPPutROMString(socket,s_mhs); OutLong(socket, eti, 5);
		TCPPutROMString(socket,s_uts); OutDot(socket, uti);
		if(gotn) {	qw = (double)subm/(double)gotn;		qw *= 10000.0;	uti = (DWORD)qw;} else uti=0ul;
		TCPPutROMString(socket, s_effi); OutDot(socket,uti); TCPPutROMString(socket, smt);
		OutTime(socket, ruti/(3600ul * 24ul), 'd');	OutTime(socket, (ruti/(3600ul))%24ul, 'h');
		OutTime(socket, (ruti/60ul)%60ul, 'm');		OutTime(socket, ruti%60ul, 's');
		TCPPutROMString(socket, s_cpool); TCPPutROMString(socket, rMinPool[AppConfig.who]);	TCPPutROMString(socket,AppConfig.who ? s_PoolB:s_PoolA); 
		TCPPutROMString(socket, s_swm); TCPPutROMString(socket, AppConfig.sw_mode ? s_PB:s_EP);
		TCPPutROMString(socket, s_clk); TCPPutROMString(socket, (AppConfig.CkSel&1) ? s_CkLow:s_CkHigh);
	}
}
Exemplo n.º 2
0
//===========================================================================
// WriteTextureGroup
//===========================================================================
void WriteTextureGroup(int idx)
{
	char fn[256];
	FILE *file;
	int count, dirStart;
	int pos, i, k;
	def_t *it;

	sprintf(fn, "TEXTURE%i.LMP", idx + 1);
	// Count the number of texture definitions in the group.
	for(count = 0, it = root[idx].next; it != &root[idx]; 
		it = it->next, count++) {}
	if(!count) return; // Nothing to write!
	if((file = fopen(fn, "wb")) == NULL)
	{
		perror(fn);
		return;
	}
	OutLong(file, count); // Number of textures.
	// The directory (uninitialized).
	dirStart = ftell(file);
	for(i = 0; i < count; i++) OutLong(file, 0);
	// Write each texture def and update the directory entry.
	for(i = 0, it = root[idx].next; it != &root[idx]; it = it->next, i++)
	{
		pos = ftell(file);
		// Go back to the directory.
		fseek(file, dirStart + i*4, SEEK_SET);
		OutLong(file, pos);
		// Return to the def's position.
		fseek(file, pos, SEEK_SET);
		Out(file, it->tex.name, 8);
		OutLong(file, it->tex.flags);
		OutShort(file, it->tex.width);
		OutShort(file, it->tex.height);
		OutLong(file, it->tex.reserved);
		OutShort(file, it->tex.patchCount);
		// Write the patches.
		for(k = 0; k < it->tex.patchCount; k++)
		{
			OutShort(file, it->tex.patches[k].originX);
			OutShort(file, it->tex.patches[k].originY);
			OutShort(file, it->tex.patches[k].patch);
			OutShort(file, it->tex.patches[k].reserved1);
			OutShort(file, it->tex.patches[k].reserved2);
		}
	}
	fclose(file);
	// We're done.
	printf("%i texture%s written to %s.\n", count, PLURAL_S(count), fn);
}
Exemplo n.º 3
0
Arquivo: out.cpp Projeto: nealey/vera
//----------------------------------------------------------------------
static void outmem(op_t &x, ea_t ea)
{
  char buf[MAXSTR];
  if ( get_name_expr(cmd.ea+x.offb, x.n, ea, BADADDR, buf, sizeof(buf)) <= 0 )
  {
    const ioport_t *p = find_sym(x.addr);
    if ( p == NULL )
    {
      out_tagon(COLOR_ERROR);
      OutLong(x.addr, 16);
      out_tagoff(COLOR_ERROR);
      QueueMark(Q_noName,cmd.ea);
    }
    else
    {
      out_line(p->name, COLOR_IMPNAME);
    }
  }
  else
  {
    bool complex = strchr(buf, '+') || strchr(buf, '-');
    if ( complex ) out_symbol(ash.lbrace);
    OutLine(buf);
    if ( complex ) out_symbol(ash.rbrace);
  }
}
Exemplo n.º 4
0
//----------------------------------------------------------------------
static void out_bad_address(ea_t addr)
{
  out_tagon(COLOR_ERROR);
  OutLong(addr, 16);
  out_tagoff(COLOR_ERROR);
  QueueMark(Q_noName, cmd.ea);
}
Exemplo n.º 5
0
//----------------------------------------------------------------------
static void out_bad_address(ea_t addr)
{
  if ( !out_port_address(addr) )
  {
    out_tagon(COLOR_ERROR);
    OutLong(addr, 16);
    out_tagoff(COLOR_ERROR);
    QueueSet(Q_noName, cmd.ea);
  }
}
Exemplo n.º 6
0
//----------------------------------------------------------------------
static void out_bad_address(ea_t addr)
{
  const char *name = find_sym((int)addr);
  if ( name != NULL )
  {
    out_line(name, COLOR_IMPNAME);
  }
  else
  {
    out_tagon(COLOR_ERROR);
    OutLong(addr, 16);
    out_tagoff(COLOR_ERROR);
    QueueMark(Q_noName, cmd.ea);
  }
}
Exemplo n.º 7
0
//===========================================================================
// WritePatchNames
//	Creates PNAMES.LMP.
//===========================================================================
void WritePatchNames(void)
{
	char fn[256];
	FILE *file;
	int count;
	patch_t *it;

	if(plist.next == &plist) return;

	strcpy(fn, "PNAMES.LMP");
	if((file = fopen(fn, "wb")) == NULL)
	{
		perror(fn);
		return;
	}
	OutLong(file, 0); // Number of patches, update later.
	for(count = 0, it = plist.next; it != &plist; it = it->next, count++)
		Out(file, it->name, 8);
	rewind(file);
	OutLong(file, count);
	fclose(file);
	// We're done.
	printf("%i patch name%s written to %s.\n", count, PLURAL_S(count), fn);
}
Exemplo n.º 8
0
//----------------------------------------------------------------------
uchar putShort(ushort value, uchar wsym)
{
  char *p = get_output_ptr();

  out_tagon(COLOR_ERROR);
  if ( wsym )
    OutChar(wsym);
  OutLong(value,
#ifdef __debug__
                debugmode ? 16 :
#endif
                10);
  out_tagoff(COLOR_ERROR);

  char tmpstr[32];
  char *end = set_output_ptr(p);
  size_t len = end - p;
  qstrncpy(tmpstr, p, qmin(len+1, sizeof(tmpstr)));
  return chkOutLine(tmpstr, tag_strlen(tmpstr));
}
Exemplo n.º 9
0
//----------------------------------------------------------------------
uchar putShort(ushort value, uchar wsym)
{
  char  tmpstr[32];

  register char *p = get_output_ptr();

  out_tagon(COLOR_ERROR);
  if ( wsym) OutChar(wsym );
  OutLong(value,
#ifdef __debug__
                debugmode ? 16 :
#endif
                10);
  out_tagoff(COLOR_ERROR);

  register size_t len = get_output_ptr() - p;
  memcpy(tmpstr, p, len);
  tmpstr[len] ='\0';
  *p = '\0';
  set_output_ptr(p);
  return(chkOutLine(tmpstr, tag_strlen(tmpstr)));
}
Exemplo n.º 10
0
//----------------------------------------------------------------------
static void out_address(op_t &op)
{
  ea_t ea;
  if (op.type == o_near)
    ea = calc_code_mem(op.addr);
  else if (op.type == o_mem)
    ea = calc_data_mem(op);
  else if (op.type == o_io)
   ea = calc_io_mem(op);

  int reg = -1;
  if (op.type == o_mem) reg = get_mapped_register(ea);

  // print begin of the modifier
  switch(op.tms_modifier)
  {
    case TMS_MODIFIER_NULL:
      break;
    case TMS_MODIFIER_DMA:
      if ((int)reg == -1) out_symbol('@');
      break;
    case TMS_MODIFIER_ABS16:
    case TMS_MODIFIER_PTR:
      out_symbol('*');
      if (op.tms_modifier == TMS_MODIFIER_ABS16) out_line("abs16", COLOR_SYMBOL);
      out_line("(#", COLOR_SYMBOL);
      break;
    case TMS_MODIFIER_MMAP:
      out_line("mmap(@", COLOR_SYMBOL);
      break;
    case TMS_MODIFIER_PORT:
      out_line("port(#", COLOR_SYMBOL);
      break;
    case TMS_MODIFIER_PORT_AT:
      out_line("port(@", COLOR_SYMBOL);
      break;
    default:
      error("interr: out: o_address: modifier_begin");
  }


  if (op.type != o_io)
  {
    if (int(reg) != -1) // memory mapped register
      out_register(ph.regNames[reg]);
    else
    {
#ifndef TMS320C55_NO_NAME_NO_REF
      if ( !out_name_expr(op, ea, ea) )
#endif
      {
        out_tagon(COLOR_ERROR);
        if (op.type != o_mem)
          OutLong(op.addr, 16);
        else
          OutLong(op.addr, 16);
        out_tagoff(COLOR_ERROR);
        QueueMark(Q_noName, cmd.ea);
      }
    }
  }
  else // IO address
  {
    if (ea != BADADDR)
    {
      const char *name = NULL;
      if (idpflags & TMS320C55_IO) name = find_sym(ea);
      if (name)
        out_line(name, COLOR_IMPNAME);
      else
        OutLong(ea, 16);
    }
    else
    {
      out_tagon(COLOR_ERROR);
      OutLong(op.addr, 16);
      out_tagoff(COLOR_ERROR);
    }
  }

  // print end of the modifier
  switch(op.tms_modifier)
  {
    case TMS_MODIFIER_NULL:
    case TMS_MODIFIER_DMA:
      break;
    case TMS_MODIFIER_ABS16:
    case TMS_MODIFIER_PTR:
    case TMS_MODIFIER_MMAP:
    case TMS_MODIFIER_PORT:
    case TMS_MODIFIER_PORT_AT:
      out_symbol(')'); break;
    default:
      error("interr: out: o_address: modifier_begin");
  }
}
Exemplo n.º 11
0
static void OutShit(TCP_SOCKET socket, BYTE ch) {
	BYTE end = ch+8;
	WORD *ww = (WORD*)&httpData[0];
	TCPPutROMString(socket,(ROM BYTE*)saci[ch/8]);
	for(;ch<end;ch++) { TCPPut(socket,' '); OutLong(socket,(DWORD)ww[ch],3); }
} 
Exemplo n.º 12
0
Arquivo: v86.c Projeto: cod5/kielder
int V86HandleOpcode (struct ContextState *state)
{
	bool is_operand32 = FALSE;
	bool is_address32 = FALSE;
	uint32 *sp32;
	uint16 *sp16;
	uint32 eflags;
	uint8 *ip;
		
	uint32 new_ip;
	uint32 new_cs;
	uint8 *vector;

	
	
	
	while (1)
	{
		ip = V86GetAddress (state->return_eip, state->return_cs);
		
		switch (*ip)
		{
			case PREFIX_O32:
				is_operand32 = TRUE;
				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				continue;
				
			case PREFIX_A32:
				is_address32 = TRUE;
				ip++;
				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				continue;
			
				
			case OPCODE_PUSHF:
				if (is_operand32 == TRUE)
				{
					state->return_esp = ((state->return_esp & 0x0000ffff) - 4) & 0x0000ffff;
					sp32 = V86GetAddress (state->return_esp, state->return_ss);
					eflags = state->return_eflags & V86_EFLAG_MASK;

					*sp32 = (v86_if == TRUE)
							? eflags | EFLAG_IF
							: eflags & ~EFLAG_IF;
				}
				else
				{
					state->return_esp = ((state->return_esp & 0x0000ffff) - 2) & 0x0000ffff; 
					sp16 = V86GetAddress (state->return_esp, state->return_ss);
					eflags = state->return_eflags & V86_EFLAG_MASK;

					*sp16 = (uint16) (v86_if == TRUE)
							? eflags | EFLAG_IF
							: eflags & ~EFLAG_IF;					
					
				}
			
				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				return 0;
				
			case OPCODE_POPF:
				if (is_operand32 == TRUE)
				{
					sp32 = V86GetAddress (state->return_esp, state->return_ss);
					eflags = *sp32;
					state->return_eflags = (eflags & V86_EFLAG_MASK) | EFLAG_IF | EFLAG_VM;
					v86_if = (eflags & EFLAG_IF) ? TRUE : FALSE;
					state->return_esp = ((state->return_esp & 0x0000ffff) + 4) & 0x0000ffff;
				}
				else
				{
					sp16 = V86GetAddress (state->return_esp, state->return_ss);
					eflags = *sp16;
					state->return_eflags = (eflags & V86_EFLAG_MASK) | EFLAG_IF | EFLAG_VM;
					v86_if = (eflags & EFLAG_IF) ? TRUE : FALSE;
					state->return_esp = ((state->return_esp & 0x0000ffff) + 2) & 0x0000ffff;
				}

				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				return 0;

			
			case OPCODE_INT:
			{
				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				vector = V86GetAddress (state->return_eip, state->return_cs);
				V86GetInterruptVector (*vector, &new_ip, &new_cs);
				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				
				state->return_esp = ((state->return_esp & 0x0000ffff) - 2) & 0x0000ffff;
				sp16 = V86GetAddress (state->return_esp, state->return_ss);
				*sp16 = (uint16) state->return_eip;
				
				state->return_esp = ((state->return_esp & 0x0000ffff) - 2) & 0x0000ffff;
				sp16 = V86GetAddress (state->return_esp, state->return_ss);
				*sp16 = (uint16) state->return_cs;
				
				state->return_esp = ((state->return_esp & 0x0000ffff) - 2) & 0x0000ffff;
				sp16 = V86GetAddress (state->return_esp, state->return_ss);
				
				eflags = (v86_if == TRUE)
						? (state->return_eflags & V86_EFLAG_MASK) | EFLAG_IF
						: (state->return_eflags & V86_EFLAG_MASK) & ~EFLAG_IF;
				
				*sp16 = (uint16) eflags;
				
				state->return_eflags = (state->return_eflags & ~(EFLAG_IF | EFLAG_TF | EFLAG_AC)) | EFLAG_VM;
				v86_if = FALSE;
				
				state->return_eip = new_ip & 0x0000ffff;
				state->return_cs = new_cs & 0x0000ffff;
				
				return 0;
			}
			
			case OPCODE_IRET:
				if (state->return_eip == 0x0002 && state->return_cs == 0x1000)
				{
					return 1;
				}
				else
				{
					sp16 = V86GetAddress (state->return_esp, state->return_ss);
					eflags = *sp16;
					
					eflags = (eflags & 0x257fd5) | (state->return_eflags & 0x1a0000);
					
					state->return_eflags = eflags | EFLAG_IF | EFLAG_VM;
					v86_if = (eflags & EFLAG_IF) ? TRUE : FALSE;
							
					state->return_esp = ((state->return_esp & 0x0000ffff) + 2) & 0x0000ffff;
					
					sp16 = V86GetAddress (state->return_esp, state->return_ss);
					state->return_cs = *sp16;
					state->return_esp = ((state->return_esp & 0x0000ffff) + 2) & 0x0000ffff;
					
					sp16 = V86GetAddress (state->return_esp, state->return_ss);
					state->return_eip = *sp16;
					state->return_esp = ((state->return_esp & 0x0000ffff) + 2) & 0x0000ffff;

					return 0;
				}
							
				
			case OPCODE_CLI:
				v86_if = FALSE;
				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				return 0;
							
			case OPCODE_STI:
				v86_if = TRUE;
				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				return 0;
					
		
			case OPCODE_OUTB:
				OutByte (state->edx, state->eax);
				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				return 0;
			
			case OPCODE_INB:
				state->eax = InByte (state->edx);
				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				return 0;
			
			case OPCODE_OUTWL:
				if(is_operand32 == FALSE)
					OutWord (state->edx, state->eax);
				else
					OutLong (state->edx, state->eax);
				
				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				return 0;
			
			case OPCODE_INWL:
				if(is_operand32 == FALSE)
					state->eax = InWord (state->edx);
				else
					state->eax = InLong (state->edx);

				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				return 0;

			case OPCODE_OUTB_AL_NN:
				OutByte (*(ip+1), state->eax);
				state->return_eip = (state->return_eip + 2) & 0x0000ffff;
				return 0;

			case OPCODE_INB_NN_AL:
				state->eax = InByte (*(ip+1));
				state->return_eip = (state->return_eip + 2) & 0x0000ffff;
				return 0;
			
			case OPCODE_OUTWL_EAX_NN:
				if (is_operand32 == FALSE)
					OutWord (*(ip+1), state->eax);
				else
					OutLong (*(ip+1), state->eax);

				state->return_eip = (state->return_eip + 2) & 0x0000ffff;
				return 0;
			
			case OPCODE_INWL_NN_EAX:
				if(is_operand32 == FALSE)
					state->eax = InWord (*(ip+1));
				else
					state->eax = InLong (*(ip+1));
				
				state->return_eip = (state->return_eip + 2) & 0x0000ffff;
				return 0;
			
			
			case OPCODE_HLT:
			{
				KPANIC ("Halt in V86");
			}
			
			default:
			{
				KPRINTF ("opcode = %#010x", *ip);
				KPANIC ("#GP Unknown V86 opcode");
			}
		}
	}
}