Beispiel #1
0
int 
tlv_unpack(tlv_t *tlv, uint8_t *packed,  uint32_t sz) {
  if (NULL == tlv || NULL == packed || 0 == sz) {
    return -1;
  }

  uint8_t *p = packed;
  uint16_t id = 0, type = 0, length = 0;
  int b = 0;

  id = ntohs(GET16(p));
  ADVANCE16P(p);
  type = ntohs(GET16(p));
  ADVANCE16P(p);
  length = ntohs(GET16(p));
  ADVANCE16P(p);

  if (length > sz) {
    ph_debug("not enough packed buf, length:%d sz:%d",
      length, sz);
    return -1;
  }

  b = unpack_value(type, id, p, length, tlv);

  return b;
}
Beispiel #2
0
//------------------------------------------------------------------------
static unsigned int uart_recv ( void )
{
    while(1)
    {
        if(GET16(UCA0IFG)&1) break;
    }
    return(GET16(UCA0RXBUF));
}
Beispiel #3
0
void JERRYDone(void)
{
   WriteLog("JERRY: M68K Interrupt control ($F10020) = %04X\n", GET16(jerry_ram_8, 0x20));
   JoystickDone();
   DACDone();
   EepromDone();
}
Beispiel #4
0
boolean_t
get_current_profile(int fd, int *profile)
{
	size_t i;
	uchar_t smallbuf[8];
	size_t buflen;
	uchar_t *bufp;
	int ret = B_FALSE;

	/*
	 * first determine amount of memory needed to hold all profiles.
	 * The first four bytes of smallbuf concatenated tell us the
	 * number of bytes of memory we need but do not take themselves
	 * into account. Therefore, add four to allocate that number
	 * of bytes.
	 */
	if (get_configuration(fd, 0, 8, &smallbuf[0])) {
		buflen = GET32(smallbuf) + 4;
		bufp = (uchar_t *)malloc(buflen);

	 	/* now get all profiles */
		if (get_configuration(fd, 0, buflen, bufp)) {
			*profile = GET16(&bufp[6]);
			ret = B_TRUE;
		}
		free(bufp);
	}

	return (ret);
}
Beispiel #5
0
/*
 * will get the mode page only i.e. will strip off the header.
 */
int
get_mode_page(int fd, int page_no, int pc, int buf_len, uchar_t *buffer, int *plen)
{
	int ret;
	uchar_t byte2;
	uchar_t buf[256];
	uint_t header_len, page_len, copy_cnt;

	byte2 = (uchar_t)(((pc << 6) & 0xC0) | (page_no & 0x3f));

	/* Ask 254 bytes only to make our IDE driver happy */
	if ((ret = mode_sense(fd, byte2, 1, 254, buf)) == 0) {
		return (0);
	}

	header_len = 8 + GET16(&buf[6]);
	page_len = buf[header_len + 1] + 2;

	copy_cnt = (page_len > buf_len) ? buf_len : page_len;
	(void) memcpy(buffer, &buf[header_len], copy_cnt);

	if (plen) {
		*plen = page_len;
	}

	return (1);
}
Beispiel #6
0
//------------------------------------------------------------------------
static void uart_send ( unsigned int x )
{
    while(1)
    {
        if(GET16(UCA0IFG)&2) break;
    }
    PUT16(UCA0TXBUF,x);
}
Beispiel #7
0
void changedepth(TAG*tag, int add)
{
    if(tag->id == ST_PLACEOBJECT)
	PUT16(&tag->data[2],GET16(&tag->data[2])+add);
    if(tag->id == ST_PLACEOBJECT2)
	PUT16(&tag->data[1],GET16(&tag->data[1])+add);
    if(tag->id == ST_REMOVEOBJECT)
	PUT16(&tag->data[2],GET16(&tag->data[2])+add);
    if(tag->id == ST_REMOVEOBJECT2)
	PUT16(&tag->data[0],GET16(&tag->data[0])+add);
    if(tag->id == ST_PLACEOBJECT2) {
	SWFPLACEOBJECT obj;
	U8 flags;
	swf_SetTagPos(tag, 0);
	flags = swf_GetU8(tag);
	if(flags&2) swf_GetU16(tag); //id
	if(flags&4) swf_GetMatrix(tag, 0);
	if(flags&8) swf_GetCXForm(tag, 0,1);
	if(flags&16) swf_GetU16(tag); //ratio
	if(flags&64) {
	    swf_ResetReadBits(tag);
	    printf("%d->%d\n", GET16(&tag->data[tag->pos]),
		               GET16(&tag->data[tag->pos])+add);
	    PUT16(&tag->data[tag->pos],GET16(&tag->data[tag->pos])+add);
	}
	msg("<warning> Depth relocation not fully working yet with clipdepths", tag->id);
    }
}
Beispiel #8
0
static int
dns_parse_packet(struct dns_state *s, byte *p, unsigned int plen)
{
  byte *end = p + plen;
  unsigned int i, j, len;
  unsigned int UNUSED x;

#if 0
  /* Dump the packet */
  for (i=0; i<plen; i++)
    {
      if (!(i%16)) printf("%04x:", i);
      printf(" %02x", p[i]);
      if ((i%16)==15 || i==plen-1) putchar('\n');
    }
#endif

  GET32(x);				/* ID and flags are ignored */
  for (i=0; i<DNS_NUM_SECTIONS; i++)
    GET16(s->counts[i]);
  for (i=0; i<DNS_NUM_SECTIONS; i++)
    {
      s->sections[i] = p;
      for (j=0; j < s->counts[i]; j++)
	{
	  p = dns_skip_name(p, end);	/* Name */
	  if (!p)
	    goto err;
	  GET32(x);			/* Type and class */
	  if (i != DNS_SEC_QUESTION)
	    {
	      GET32(x);			/* TTL */
	      GET16(len);		/* Length of data */
	      p += len;
	      if (p > end)
		goto err;
	    }
	}
    }
  s->sections[i] = p;
  return 0;

err:
  return -1;
}
Beispiel #9
0
void
get_read_write_speeds(int fd, int *read_speed, int *write_speed,
    intlist_t **speeds, int *n_speeds, intlist_t **speeds_mem)
{
	int page_len;
	uchar_t	p[254];
	int n; /* number of write speed performance descriptor blocks */

	*read_speed = *write_speed = 0;
	*speeds = *speeds_mem = NULL;

	if (!get_mode_page(fd, 0x2A, 0, sizeof (p), p, &page_len)) {
		return;
	}

	if (page_len > 8) {
		*read_speed = GET16(&p[8]);
	}
	if (page_len > 18) {
		*write_speed = GET16(&p[18]);
	}
	if (page_len < 28) {
		printf("MMC-2\n");
		return;
	} else {
		printf("MMC-3\n");
	}

	*write_speed = GET16(&p[28]);

	if (page_len < 30) {
		return;
	}

	/* retrieve speed list */
	n = GET16(&p[30]);
	n = min(n, (sizeof (p) - 32) / 4);

	get_write_speeds(&p[32], n, speeds, n_speeds, speeds_mem);

	if (*speeds != NULL) {
		*write_speed = max(*write_speed, (*speeds)[0].val);
	}
}
Beispiel #10
0
void
dbau1550_init(void)
{
	uint16_t		whoami;
	uint32_t		sysclk;
	uint32_t		pinfunc;

	if (MIPS_PRID_COPTS(mips_options.mips_cpu_id) != MIPS_AU1550)
		panic("dbau1550: CPU not Au1550");

	/* check the whoami register for a match */
	whoami = GET16(DBAU1550_WHOAMI);

	if (DBAU1550_WHOAMI_BOARD(whoami) != DBAU1550_WHOAMI_DBAU1550_REV1)
		panic("dbau1550: WHOAMI (%x) not DBAu1550!", whoami);

	printf("DBAu1550 (cabernet), CPLDv%d, ",
	    DBAU1550_WHOAMI_CPLD(whoami));

	if (DBAU1550_WHOAMI_DAUGHTER(whoami) != 0xf)
		printf("daughtercard 0x%x\n",
		    DBAU1550_WHOAMI_DAUGHTER(whoami));
	else
		printf("no daughtercard\n");

	/* leave console and clocks alone -- YAMON should have got it right! */

	/*
	 * Initialize PSC clocks.
	 *
	 * PSC0 is SPI.   Use 48MHz FREQ1.
	 * PSC1 is AC97.
	 * PSC2 is SMBus, and must be 48MHz.  (Configured by YAMON)
	 * PSC3 is I2S.
	 *
	 * FREQ2 is 48MHz for USBH/USBD.
	 */
	sysclk = GET32(SYS_CLKSRC);
	sysclk &= ~(SCS_MP0(7) | SCS_DP0 | SCS_CP0);
	sysclk |= SCS_MP0(3);
	PUT32(SYS_CLKSRC, sysclk);

	/*
	 * Configure pin function for PSC devices.
	 */
	pinfunc = GET32(SYS_PINFUNC);
	/* configure PSC0 SYNC1 */
	pinfunc |= SPF_S0;
	/* configure PSC2 for SMBus (YAMON default) */
	pinfunc &= ~SPF_PSC2_MASK;
	pinfunc |= SPF_PSC2_SMBUS;
	/* configure PSC3 for I2S (YAMON default) */
	pinfunc &= ~SPF_PSC3_MASK;
	pinfunc |= SPF_PSC3_I2S;
	PUT32(SYS_PINFUNC, pinfunc);
}
Beispiel #11
0
/*
 * audio1575_read_ac97()
 *
 * Description:
 *	Get the specific AC97 Codec register. It also updates codec_shadow[]
 *	with the register value.
 *
 * Arguments:
 *	void		*arg		The device's state structure
 *	uint8_t		reg		AC97 register number
 *
 * Returns:
 *	Value of AC97 register.  (0xffff in failure situations).
 */
static uint16_t
audio1575_read_ac97(void *arg, uint8_t reg)
{
	audio1575_state_t	*statep = arg;
	uint16_t		addr = 0;
	uint16_t		data = 0xffff;
	int			i;

	if ((audio1575_codec_sync(statep)) != DDI_SUCCESS) {
		return (data);
	}

	/*
	 * at this point we have the CASR semaphore
	 * and the codec is r/w ready
	 * OR in the READ opcode into the address field
	 */

	addr = (reg | M1575_CPR_READ);

	/* write the address to READ to the hi word of the CPR register */
	PUT16(M1575_CPR_REG+2, addr);

	/* wait until command is completed sucessfully */
	for (i = 0; i < M1575_LOOP_CTR; i++) {
		/* Wait for Read Ready	0x02 */
		if (GET32(M1575_CSPSR_REG) & M1575_CSPSR_RDRDY) {
			break;
		}
		drv_usecwait(1);
	}

	if (i < M1575_LOOP_CTR) {
		/* read back the data and address */
		data = GET16(M1575_SPR_REG);
		addr = GET16(M1575_SPR_REG+2);
		if (addr != reg) {
			data = 0xffff;
		}
	}

	return (data);
}
Beispiel #12
0
message_t * msg_unpack(uint8_t * packed, uint32_t size)
{
	uint32_t i = 0;
	uint8_t * pos = packed;
	message_t * newmsg = NULL;
	tlv_t * cur = NULL;
	uint16_t id = 0, length = 0, type = 0;
	int ret = 0;

	if ((NULL == packed) || (0 == size)) {
		return NULL;
	}

	if (MSG_MAGIC != ntohl(GET32(pos))) {
		return NULL;
	}
	ADVANCE32(pos);
	
	newmsg = msg_init(ntohl(GET32(pos)));
	if (NULL == newmsg) {
		return NULL;
	}
	ADVANCE32(pos);

	for (i = 0; i < (newmsg->capacity) && (pos - packed < size); i++) {
		id = ntohs(GET16(pos)); ADVANCE16(pos);
		type = ntohs(GET16(pos)); ADVANCE16(pos);
		length = ntohs(GET16(pos)); ADVANCE16(pos);
		cur = MSG_TLV(newmsg, i);
		ret = unpack_item(type, id, pos, length, cur);
		if (0 != ret) {
			msg_free(newmsg);
			return NULL;
		}

		pos += length;
	}
	newmsg->nitems = newmsg->capacity;

	return newmsg;
}
Beispiel #13
0
FILE *t16_open(char *fname, int *hs, int *vs, int *csize, U8 *cp)
{
    char filename[64];
    U8 header[HEADERSIZE];
    FILE *fp;

    strcpy(filename, fname);
    if (strchr(filename, '.') == NULL) strcat(filename, ".TGA");
    if ((fp = fopen(filename, READMODE)) == NULL) return NULL;

    fread(header, HEADERSIZE, 1, fp);
    if ((header[O_FILETYPE] != T_RLERGB) || (header[O_ESIZE] != 16)) {
	fclose(fp);
	return NULL;
    }
    GET16(header[O_HSIZE], *hs);
    GET16(header[O_VSIZE], *vs);
    if (*csize = header[O_COMMENTLEN]) fread(cp, *csize, 1, fp);

    state = count = bufp = 0;
    return fp;
}
Beispiel #14
0
static int
dns_parse_rr(struct dns_state *s)
{
  byte *p = s->sec_ptr;
  byte *end = s->sec_end;

  if (p == end)
    return 0;
  p = dns_skip_name(p, end);
  if (!p)
    goto err;
  GET16(s->rr_type);
  GET16(s->rr_class);
  GET32(s->rr_ttl);
  GET16(s->rr_len);
  s->rr_data = p;
  s->sec_ptr = p + s->rr_len;
  return 1;

err:
  return -1;
}
Beispiel #15
0
void
walk_profiles(int fd, int (*f)(void *, int, boolean_t), void *arg)
{
	size_t i;
	uint16_t profile, current_profile;
	uchar_t smallbuf[8];
	size_t buflen;
	uchar_t *bufp;
	int ret;

	/*
	 * first determine amount of memory needed to hold all profiles.
	 * The first four bytes of smallbuf concatenated tell us the
	 * number of bytes of memory we need but do not take themselves
	 * into account. Therefore, add four to allocate that number
	 * of bytes.
	 */
	if (get_configuration(fd, 0, 8, &smallbuf[0])) {
		buflen = GET32(smallbuf) + 4;
		bufp = (uchar_t *)malloc(buflen);

	 	/* now get all profiles */
		if (get_configuration(fd, 0, buflen, bufp)) {
			current_profile = GET16(&bufp[6]);
			for (i = 8 + 4;  i < buflen; i += 4) {
				profile = GET16(&bufp[i]);
				ret = f(arg, profile, (profile == current_profile));
				if (ret == CDUTIL_WALK_STOP) {
					break;
				}
			}
		}

		free(bufp);
	}
}
Beispiel #16
0
static int
dbau1550_spi_select(void *arg, int slave)
{
	uint16_t	status;
	if ((slave < 0) || (slave > 1))
		return EINVAL;
	status = GET16(DBAU1550_BOARD_SPECIFIC);

	if (slave) {
		status |= DBAU1550_SPI_DEV_SEL;
	} else {
		status &= ~DBAU1550_SPI_DEV_SEL;
	}
	PUT16(DBAU1550_BOARD_SPECIFIC, status);
	return 0;
}
Beispiel #17
0
/*
 * audio1575_count()
 *
 * Description:
 *	This is called by the framework to get the engine's frame counter
 *
 * Arguments:
 *	void	*arg		The DMA engine to query
 *
 * Returns:
 *	frame count for current engine
 */
static uint64_t
audio1575_count(void *arg)
{
	audio1575_port_t	*port = arg;
	audio1575_state_t	*statep = port->statep;
	uint64_t		val;
	uint8_t			civ;
	unsigned		n;
	int			civoff;
	int			lvioff;
	int			picoff;

	mutex_enter(&statep->lock);

	if (port->num == M1575_REC) {
		civoff = M1575_PCMICIV_REG;
		lvioff = M1575_PCMILVIV_REG;
		picoff = M1575_PCMIPICB_REG;
	} else {
		civoff = M1575_PCMOCIV_REG;
		lvioff = M1575_PCMOLVIV_REG;
		picoff = M1575_PCMOPICB_REG;
	}

	/*
	 * Read the position counters.  We also take this opportunity
	 * to update the last valid index to the one just previous to
	 * the one we're working on (so we'll fully loop.)
	 */
	n = GET16(picoff);
	civ = GET8(civoff);
	PUT8(lvioff, (civ - 1) % M1575_BD_NUMS);

	n = port->samp_size - (n * sizeof (int16_t));
	if (n < port->offset) {
		val = (port->samp_size - port->offset) + n;
	} else {
		val = n - port->offset;
	}
	port->offset = n;
	port->count += (val / (port->nchan * sizeof (int16_t)));
	val = port->count;
	mutex_exit(&statep->lock);

	return (val);
}
Beispiel #18
0
int
dbau1550_slot_status(int slot)
{
	uint16_t	status, mask;
	status = GET16(DBAU1550_STATUS);
	switch (slot) {
	case 0:
		mask = DBAU1550_STATUS_PCMCIA0_INSERTED;
		break;
	case 1:
		mask = DBAU1550_STATUS_PCMCIA1_INSERTED;
		break;

	default:
		return 0;
	}

	return ((mask & status) ? 0 : 1);
}
Beispiel #19
0
boolean_t
get_disc_info(int fd, disc_info_t *di)
{
	struct uscsi_cmd scmd;
	char cdb[16];
	uint8_t	buf[32];
	int bufsize = sizeof (buf);

	bzero(buf, bufsize);
	uscsi_cmd_init(&scmd, cdb, sizeof (cdb));
	scmd.uscsi_flags = USCSI_READ|USCSI_SILENT;
	scmd.uscsi_timeout = CD_USCSI_TIMEOUT;
	scmd.uscsi_cdb[0] = 0x51; /* READ DISC INFORMATION */
	scmd.uscsi_cdb[7] = (bufsize >> 8) & 0xff; /* allocation length */
	scmd.uscsi_cdb[8] = bufsize & 0xff;
	scmd.uscsi_cdblen = 10;
	scmd.uscsi_bufaddr = (char *)buf;
	scmd.uscsi_buflen = bufsize;

	if ((uscsi(fd, &scmd)) != 0) {
		return (B_FALSE);
	}

	/*
	 * According to MMC-5 6.22.3.2, the Disc Information Length should be
	 * 32+8*(Number of OPC Tables). Some devices, like U3 sticks, return 0.
	 * Yet some drives can return less than 32. We only need the first 22.
	 */
	if (GET16(&buf[0]) < 22) {
		return (B_FALSE);
	}

	di->disc_status = buf[2] & 0x03;
	di->erasable = buf[2] & 0x10;
	if ((buf[21] != 0) && (buf[21] != 0xff)) {
		di->capacity = ((buf[21] * 60) + buf[22]) * 75;
	} else {
		di->capacity = 0;
	}

	return (B_TRUE);
}
Beispiel #20
0
static int
skippacket(struct sockbuf *sb) {
	unsigned long packlen;
	struct packet q, *p = &q;

	if (sb->sb_cc < 2)
		return DNS_WAIT;

	q.m = sb->sb_mb;
	q.n = q.m->m_nextpkt;
	q.moff = 0;
	q.offset = 0;
	q.len = sb->sb_cc;

	GET16(p, packlen);
	if (packlen + 2 > q.len)
		return DNS_WAIT;

	return DNS_OK;
}
Beispiel #21
0
void
dbau1550_slot_disable(int slot)
{
	int		shift;
	uint16_t	status;

	switch (slot) {
	case 0:
		shift = DBAU1550_PCMCIA_PC0_SHIFT;
		break;
	case 1:
		shift = DBAU1550_PCMCIA_PC1_SHIFT;
		break;
	}

	status = GET16(DBAU1550_PCMCIA);
	status &= ~(DBAU1550_PCMCIA_MASK);
	PUT16(DBAU1550_PCMCIA, status);
	wbflush();
}
Beispiel #22
0
int t16_getline(FILE *fp, int hs, U16 *data)
{
    int i;

    for (i=0; i<hs; ++i) {
	if (state == 0) {
	    bufp = 0;
	    if ((count = getc(fp)) > 127) {
		state = 1;
		count -= 127;
		fread(rlebuf, 2, 1, fp);
	    } else {
		state = 2;
		++count;
		fread(rlebuf, 2, count, fp);
	    }
	}
	GET16(rlebuf[bufp], data[i]);
	if (--count == 0) state = 0;
	if (state == 2) bufp += 2;
    }
    return 0;
}
Beispiel #23
0
/* retrieve speed list from the Write Speed Performance Descriptor Blocks
 */
void
get_write_speeds(uchar_t *page, int n, intlist_t **speeds, int *n_speeds, intlist_t **speeds_mem)
{
	uchar_t	*p = page + 2;
	int	i;
	intlist_t **nextp;
	intlist_t *current;
	boolean_t skip;

	*n_speeds = 0;
	*speeds = NULL;
	*speeds_mem = (intlist_t *)calloc(n, sizeof (intlist_t));
	if (*speeds_mem == NULL) {
		return;
	}

	for (i = 0; i < n; i++, p += 4) {
		current = &(*speeds_mem)[i];
		current->val = GET16(p);

		/* keep the list sorted */
		skip = B_FALSE;
		for (nextp = speeds; *nextp != NULL; nextp = &((*nextp)->next)) {
			if (current->val == (*nextp)->val) {
				skip = B_TRUE; /* skip duplicates */
				break;
			} else if (current->val > (*nextp)->val) {
				break;
			}
		}
		if (!skip) {
			current->next = *nextp;
			*nextp = current;
			*n_speeds++;
		}
	}
}
Beispiel #24
0
void
dbau1550_slot_enable(int slot)
{
	uint16_t	status;
	uint16_t	vcc, vpp;
	int		shift;

	status = GET16(DBAU1550_STATUS);
	switch (slot) {
	case 0:
		status >>= DBAU1550_STATUS_PCMCIA0_VS_SHIFT;
		shift = DBAU1550_PCMCIA_PC0_SHIFT;
		break;
	case 1:
		status >>= DBAU1550_STATUS_PCMCIA1_VS_SHIFT;
		shift = DBAU1550_PCMCIA_PC1_SHIFT;
		break;
	default:
		return;
	}

	status &= DBAU1550_STATUS_PCMCIA_VS_MASK;
	switch (status) {
	case DBAU1550_STATUS_PCMCIA_VS_GND:
		vcc = DBAU1550_PCMCIA_VCC_GND;
		vpp = DBAU1550_PCMCIA_VPP_GND;
		break;
	case DBAU1550_STATUS_PCMCIA_VS_5V:
		vcc = DBAU1550_PCMCIA_VCC_5V;
		vpp = DBAU1550_PCMCIA_VPP_VCC;
		break;
	default:	/* covers both 3.3v cases */
		vcc = DBAU1550_PCMCIA_VCC_3V;
		vpp = DBAU1550_PCMCIA_VPP_VCC;
		break;
	}

	status = GET16(DBAU1550_PCMCIA);

	/* this clears all bits for this slot */
	status &= ~(DBAU1550_PCMCIA_MASK << shift);

	status |= vcc << shift;
	status |= vpp << shift;

	PUT16(DBAU1550_PCMCIA, status);
	wbflush();
	tsleep(&status, PWAIT, "pcmcia_reset_0", mstohz(100));

	status |= (DBAU1550_PCMCIA_DRV_EN << shift);
	PUT16(DBAU1550_PCMCIA, status);
	wbflush();
	tsleep(&status, PWAIT, "pcmcia_reset_start", mstohz(300));

	/* take it out of reset */
	status |= (DBAU1550_PCMCIA_RST << shift);
	PUT16(DBAU1550_PCMCIA, status);
	wbflush();

	/* spec says 20 msec, but experience shows even 200 is not enough */
	tsleep(&status, PWAIT, "pcmcia_reset_finish", mstohz(1000));

	/* NOTE: WE DO NOT SUPPORT DIFFERENT VCC/VPP LEVELS! */
	/* This means that 12V cards are not supported! */
}
Beispiel #25
0
/*
 * Perform a DNS update for Name.Domain.
 *
 * A non NULL value for AAAA indicates the addition of a AAAA record
 * with value AAAA.
 *
 * A NULL value indicated the deletion of all Ressource Records associated
 * with Name.Domain.
 */
static tDNSRCode
DNSUpdate(pal_socket_t Socket, char *Name, char *Domain, char *AAAA)
{
    uint16_t DNSid;
    uint16_t DNSidReply;
    uint16_t Header;
    uint16_t QR;
    uint16_t OPCode;
    uint16_t RCode;
    tDNSRCode ret;
    char Buffer[DNS_BUFFER_SIZE];
    size_t Len;
    char *p;

    /* Create DNS id */
    DNSid = DNSGenerateID();

    /* Create DNS Update message */
    if (DNS_RCODE_NOERROR != (ret = DNSMessageCreate(Buffer, DNSid,
                                    Domain, Name,
                                    DNS_DEFAULT_TTL,
                                    AAAA, &Len)))
        return ret;

    /* Send request to server */
    if (NetTCP6Write(Socket, Buffer, Len) != Len)
        return DNS_RCODE_SERVFAIL;

    /* Read response */
    Len = NetTCP6Read(Socket, Buffer, sizeof(Buffer));

    /*
     * We expect the response to be sent in one packet.
     * To be forward compatible, only the following is validated:
     *  - response must be at least the size of the TCPMSGLENGTH field
     *    plus the DNS header.
     *  - DNSid must match.
     *  - QR field must be set to 1.
     *  - Opcode must be UPDATE (5).
     */
    if (Len < DNS16SZ + DNS_HEADER_SIZE)
        return DNS_RCODE_SERVFAIL;

    /*
     * Skip TCPMSGLENGTH, in the future we might have answer larger than
     *  the buffer size.
     */
    p = Buffer + DNS16SZ;

    /* Extract DNSid */
    GET16(p, DNSidReply);

    /* Extract QR, Opcode, and Return Code */
    GET16(p, Header);
    QR = (Header & 0x8000) >> 15;
    OPCode = (Header & 0x7800) >> 11;
    RCode = Header & 0x000f;

    /* Validation */
    if (DNSid != DNSidReply ||
            QR != 1 ||
            OPCode != DNS_OPCODE_UPDATE)
        return DNS_RCODE_SERVFAIL;

    /* Return Return Code */
    return (tDNSRCode) RCode;
}
void swf_AddButtonLinks(SWF*swf, char stop_each_frame, char events)
{
    int num_frames = 0;
    int has_buttons = 0;
    TAG*tag=swf->firstTag;

    unsigned int checksum = 0;
    while(tag) {
        if(tag->id == ST_SHOWFRAME)
            num_frames++;
        if(tag->id == ST_DEFINEBUTTON || tag->id == ST_DEFINEBUTTON2)
            has_buttons = 1;
	crc32_add_bytes(checksum, tag->data, tag->len);
        tag = tag->next;
    }
    int t = time(0);
    checksum = crc32_add_bytes(checksum, &t, sizeof(t));

    unsigned char h[16];
    unsigned char file_signature[33];
    sprintf((char*)file_signature, "%x", checksum);

    char scenename1[80], scenename2[80];
    sprintf(scenename1, "rfx.MainTimeline_%s", file_signature);
    sprintf(scenename2, "rfx::MainTimeline_%s", file_signature);

    abc_file_t*file = abc_file_new();
    abc_method_body_t*c = 0;
   
    abc_class_t*cls = abc_class_new2(file, scenename2, "flash.display::MovieClip");
  
    TAG*abctag = swf_InsertTagBefore(swf, swf->firstTag, ST_DOABC);
    
    tag = swf_InsertTag(abctag, ST_SYMBOLCLASS);
    swf_SetU16(tag, 1);
    swf_SetU16(tag, 0);
    swf_SetString(tag, scenename1);

    c = abc_class_getstaticconstructor(cls, 0)->body;
    c->old.max_stack = 1;
    c->old.local_count = 1;
    c->old.init_scope_depth = 9;
    c->old.max_scope_depth = 10;

    __ getlocal_0(c);
    __ pushscope(c);
    __ returnvoid(c);

    c = abc_class_getconstructor(cls, 0)->body;
    c->old.max_stack = 3;
    c->old.local_count = 1;
    c->old.init_scope_depth = 10;
    c->old.max_scope_depth = 11;
    
    debugfile(c, "constructor.as");

    __ getlocal_0(c);
    __ pushscope(c);

    __ getlocal_0(c);
    __ constructsuper(c,0);

    if(stop_each_frame || has_buttons) {
        int frame = 0;
        tag = swf->firstTag;
        abc_method_body_t*f = 0; //frame script
        while(tag && tag->id!=ST_END) {
            char framename[80];
            char needs_framescript=0;
            char buttonname[80];
            char functionname[80];
            sprintf(framename, "[packageinternal]rfx::frame%d_%s", frame, file_signature);
            
            if(!f && (tag->id == ST_DEFINEBUTTON || tag->id == ST_DEFINEBUTTON2 || stop_each_frame)) {
                /* make the contructor add a frame script */
                __ findpropstrict(c,"[package]::addFrameScript");
                __ pushuint(c,frame);
                __ getlex(c,framename);
                __ callpropvoid(c,"[package]::addFrameScript",2);

                f = abc_class_method(cls, 0, multiname_fromstring(framename))->body;
                f->old.max_stack = 3;
                f->old.local_count = 1;
                f->old.init_scope_depth = 10;
                f->old.max_scope_depth = 11;
                __ debugfile(f, "framescript.as");
                __ debugline(f, 1);
                __ getlocal_0(f);
                __ pushscope(f);
                if(stop_each_frame) {
                    __ findpropstrict(f, "[package]::stop");
                    __ callpropvoid(f, "[package]::stop", 0);
                }
            }

            if(tag->id == ST_DEFINEBUTTON || tag->id == ST_DEFINEBUTTON2) {
                U16 id = swf_GetDefineID(tag);
                sprintf(buttonname, "::button%d", swf_GetDefineID(tag));
                __ getlex(f,buttonname);
                __ getlex(f,"flash.events::MouseEvent");
                __ getproperty(f, "::CLICK");
                sprintf(functionname, "::clickbutton%d_%s", swf_GetDefineID(tag), file_signature);
                __ getlex(f,functionname);
                __ callpropvoid(f, "::addEventListener" ,2);

                needs_framescript = 1;

                abc_method_body_t*h =
                    abc_class_method(cls, 0, multiname_fromstring(functionname))->body;
                list_append(h->method->parameters, multiname_fromstring("flash.events::MouseEvent"));

                h->old.max_stack = 6;
                h->old.local_count = 2;
                h->old.init_scope_depth = 10;
                h->old.max_scope_depth = 11;
                __ getlocal_0(h);
                __ pushscope(h);

                ActionTAG*oldaction = swf_ButtonGetAction(tag);
                if(oldaction && oldaction->op == ACTION__GOTOFRAME) {
                    int framenr = GET16(oldaction->data);
                    if(!events) {
                        __ findpropstrict(h,"[package]::gotoAndStop");
                        __ pushuint(h,framenr+1);
                        __ callpropvoid(h,"[package]::gotoAndStop", 1);
                    } else {
                        char framename[80];
                        sprintf(framename, "frame%d_%s", framenr, file_signature);
                        __ getlocal_0(h); //this
                        __ findpropstrict(h, "[package]flash.events::TextEvent");
                        __ pushstring(h, "link");
                        __ pushtrue(h);
                        __ pushtrue(h);
                        __ pushstring(h, framename);
                        __ constructprop(h,"[package]flash.events::TextEvent", 4);
                        __ callpropvoid(h,"[package]::dispatchEvent", 1);
                    }
                } else if(oldaction && oldaction->op == ACTION__GETURL) {
                    if(!events) {
                        __ findpropstrict(h,"flash.net::navigateToURL");
                        __ findpropstrict(h,"flash.net::URLRequest");
                        // TODO: target _blank
                        __ pushstring(h,(char*)oldaction->data); //url
                        __ constructprop(h,"flash.net::URLRequest", 1);
                        __ callpropvoid(h,"flash.net::navigateToURL", 1);
                    } else {
                        __ getlocal_0(h); //this
                        __ findpropstrict(h, "[package]flash.events::TextEvent");
                        __ pushstring(h, "link");
                        __ pushtrue(h);
                        __ pushtrue(h);
                        __ pushstring(h,(char*)oldaction->data); //url
                        __ constructprop(h,"[package]flash.events::TextEvent", 4);
                        __ callpropvoid(h,"[package]::dispatchEvent", 1);
                    }
                } else if(oldaction) {
                    fprintf(stderr, "Warning: Couldn't translate button code of button %d to flash 9 abc action\n", id);
                }
                __ returnvoid(h);
                swf_ActionFree(oldaction);
            }
            if(tag->id == ST_SHOWFRAME) {
                if(f) {
                    __ returnvoid(f);
                    f = 0;
                }
                frame++;
            }
            tag = tag->next;
        }
        if(f) {
            __ returnvoid(f);
        }
    }
    __ returnvoid(c);

    tag = swf->firstTag;
    while(tag) {
        if(tag->id == ST_DEFINEBUTTON || tag->id == ST_DEFINEBUTTON2) {
            char buttonname[80];
            sprintf(buttonname, "::button%d", swf_GetDefineID(tag));
            multiname_t*s = multiname_fromstring(buttonname);
            //abc_class_slot(cls, multiname_fromstring(buttonname), s);
            abc_class_slot(cls, multiname_fromstring(buttonname), 
                                multiname_fromstring("flash.display::SimpleButton"));
        }
        tag = tag->next;
    }


    abc_script_t*s = abc_initscript(file);
    c = s->method->body;
    c->old.max_stack = 2;
    c->old.local_count = 1;
    c->old.init_scope_depth = 1;
    c->old.max_scope_depth = 9;

    __ getlocal_0(c);
    __ pushscope(c);
    __ getscopeobject(c, 0);
    __ getlex(c,"::Object");
    __ pushscope(c);
    __ getlex(c,"flash.events::EventDispatcher");
    __ pushscope(c);
    __ getlex(c,"flash.display::DisplayObject");
    __ pushscope(c);
    __ getlex(c,"flash.display::InteractiveObject");
    __ pushscope(c);
    __ getlex(c,"flash.display::DisplayObjectContainer");
    __ pushscope(c);
    __ getlex(c,"flash.display::Sprite");
    __ pushscope(c);
    __ getlex(c,"flash.display::MovieClip");
    __ pushscope(c);
    __ getlex(c,"flash.display::MovieClip");
    __ newclass(c,cls);
    __ popscope(c);
    __ popscope(c);
    __ popscope(c);
    __ popscope(c);
    __ popscope(c);
    __ popscope(c);
    __ popscope(c);
    __ initproperty(c,scenename2);
    __ returnvoid(c);

    //abc_method_body_addClassTrait(c, "rfx:MainTimeline", 1, cls);
    multiname_t*classname = multiname_fromstring(scenename2);
    abc_initscript_addClassTrait(s, classname, cls);
    multiname_destroy(classname);

    swf_WriteABC(abctag, file);
}
Beispiel #27
0
u8 FAT_Init(u8* buf, ReadProc readProc)
{
	_fat.buffer = buf;
	_fat.readProc = readProc;

	if (_fat.readProc(buf, 0) != 0)
		return 0;

	if (buf[510] != 0x55 || buf[511] != 0xAA)
	{
		// USB drives don't have partitions
	}

	u8 partitionType = buf[450];
	u32 bootSector = GET32(buf + 454);
	bool valid = false;
	switch (partitionType)
	{
		case 0x00:
			break;

		case 0x0B:	// FAT 32
		case 0x0C:	// FAT 32
		case 0x0E:
		case 0x0F:
			valid = true;
			break;

		default:
			valid = partitionType < 7;
	}

	if (!valid)
		bootSector = 0;	// might not have a partition at start of disk (USB drives etc)

	if (_fat.readProc(_fat.buffer, bootSector) != 0)
		return 0;

	if (GET16(buf + 11) != 512)	// bytes per sector
		return 0;

	_fat.sectorsPerCluster = buf[13];
	u16 reservedSectors = GET16(buf + 14);
	u16 numFats = buf[16];
	u16 rootDirectectoryCount = GET16(buf+17);
	_fat.fatCount = GET16(buf+22);

	if (_fat.fatCount == 0)
	{
		_fat.fatCount = GET32(buf+36);	// is FAT32
		_fat.rootCluster = GET32(buf+44);
	} else
		_fat.rootCluster = 0;	// Indicates FAT16

	_fat.fatStart = bootSector + reservedSectors;
	_fat.rootStart = _fat.fatStart + _fat.fatCount*numFats;
	_fat.rootCount = rootDirectectoryCount >> 4;
	_fat.clusterStart = _fat.rootStart + _fat.rootCount;

	//	Calculate root count for FAT32 
	if (_fat.rootCluster)
	{
		Extent extents[1];
		extents[0].start = 2;
		extents[0].count = 1;
		LoadExtents(extents,1);
		_fat.rootCount = extents[0].count * _fat.sectorsPerCluster; // # of sectors in first cluster of root
	}
	return _fat.rootCluster ? FAT_32 : FAT_16;
}
Beispiel #28
0
void
playdata(u_char *buf, u_int tot, char *name)
{
	long long delta_nsec = 0;
	u_int delta_ticks;
	int format, ntrks, divfmt, ticks, t, besttrk = 0;
	u_int len, mlen;
	u_char *p, *end, byte, meta;
	struct track *tracks;
	u_long bestcur, now;
	struct track *tp;

	end = buf + tot;
	if (verbose)
		printf("Playing %s (%d bytes) ... \n", name, tot);

	if (memcmp(buf, MARK_HEADER, MARK_LEN) != 0) {
		warnx("Not a MIDI file, missing header");
		return;
	}
	if (GET32(buf + MARK_LEN) != HEADER_LEN) {
		warnx("Not a MIDI file, bad header");
		return;
	}
	format = GET16(buf + MARK_LEN + SIZE_LEN);
	ntrks = GET16(buf + MARK_LEN + SIZE_LEN + 2);
	divfmt = GET8(buf + MARK_LEN + SIZE_LEN + 4);
	ticks = GET8(buf + MARK_LEN + SIZE_LEN + 5);
	p = buf + MARK_LEN + SIZE_LEN + HEADER_LEN;
	if ((divfmt & 0x80) == 0)
		ticks |= divfmt << 8;
	else
		errx(1, "Absolute time codes not implemented yet");
	if (verbose > 1)
		printf("format=%d ntrks=%d divfmt=%x ticks=%d\n",
		       format, ntrks, divfmt, ticks);
	if (format != 0 && format != 1) {
		warnx("Cannnot play MIDI file of type %d", format);
		return;
	}
	if (ntrks == 0)
		return;
	tracks = calloc(ntrks, sizeof(struct track));
	if (tracks == NULL)
		err(1, "malloc() tracks failed");
	for (t = 0; t < ntrks; ) {
		if (p >= end - MARK_LEN - SIZE_LEN) {
			warnx("Cannot find track %d", t);
			goto ret;
		}
		len = GET32(p + MARK_LEN);
		if (len > end - (p + MARK_LEN + SIZE_LEN)) {
			warnx("Crazy track length");
			goto ret;
		}
		if (memcmp(p, MARK_TRACK, MARK_LEN) == 0) {
			tracks[t].start = p + MARK_LEN + SIZE_LEN;
			tracks[t].end = tracks[t].start + len;
			tracks[t].curtime = getvar(&tracks[t]);
			t++;
		}
		p += MARK_LEN + SIZE_LEN + len;
	}

	/* 
	 * Play MIDI events by selecting the track with the lowest
	 * curtime.  Execute the event, update the curtime and repeat.
	 */

	now = 0;
	delta_nsec = 0;
	if (clock_gettime(CLOCK_MONOTONIC, &ts_last) < 0)
		err(1, "clock_gettime");
	for (;;) {
		/* Locate lowest curtime */
		bestcur = ULONG_MAX;
		for (t = 0; t < ntrks; t++) {
			if (tracks[t].curtime < bestcur) {
				bestcur = tracks[t].curtime;
				besttrk = t;
			}
		}
		if (bestcur == ULONG_MAX)
			break;
		if (verbose > 1) {
			printf("DELAY %4ld TRACK %2d ", bestcur-now, besttrk);
			fflush(stdout);
		}
		while (now < bestcur) {
			pause();
			if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0)
				err(1, "clock_gettime");
			delta_nsec += 1000000000L * (ts.tv_sec - ts_last.tv_sec);
			delta_nsec += ts.tv_nsec - ts_last.tv_nsec;
			ts_last = ts;
			if (delta_nsec <= 0)
				continue;
			delta_ticks = delta_nsec * ticks / (1000LL * tempo);
			delta_nsec -= 1000LL * delta_ticks * tempo / ticks;
			now += delta_ticks;
		}
		tp = &tracks[besttrk];
		byte = *tp->start++;
		if (byte == MIDI_META) {
			meta = *tp->start++;
			mlen = getvar(tp);
			if (verbose > 1)
				printf("META %02x (%d)\n", meta, mlen);
			dometa(meta, tp->start, mlen);
			tp->start += mlen;
		} else {
			if (MIDI_IS_STATUS(byte))
				tp->status = byte;
			else
				tp->start--;
			if (MIDI_IS_COMMON(tp->status)) {
				mlen = MIDI_LENGTH(tp->status);
				send_event(tp->status, tp->start, mlen);
			} else if (tp->status == MIDI_SYSEX_START) {
				mlen = getvar(tp);
				send_event(MIDI_SYSEX_START, tp->start, mlen);
			} else if (tp->status == MIDI_SYSEX_STOP) {
				mlen = getvar(tp);
				/* Sorry, can't do this yet */;
			} else {
				if (verbose)
					printf("MIDI event 0x%02x ignored\n",
					       tp->status);
			}
			tp->start += mlen;
		}
		if (tp->start >= tp->end)
			tp->curtime = ULONG_MAX;
		else
			tp->curtime += getvar(tp);
	}
 ret:
	free(tracks);
}
Beispiel #29
0
char *p0f_parse(const uint8_t* packet, uint16_t pklen) {
    const struct ip_header *iph;
    const struct tcp_header *tcph;
    const uint8_t*   end_ptr;
    const uint8_t*   opt_ptr;
    const uint8_t*   pay = 0;
    int32_t   ilen,olen;

    uint8_t    op[MAXOPT];
    uint8_t    ocnt = 0;
    uint16_t   mss_val = 0, wsc_val = 0;
    uint32_t   tstamp = 0;
    uint32_t   quirks = 0;

    pkcnt++;

    outbuf_reset();

    /* Paranoia! */
    end_ptr = packet + pklen;

    iph = (const struct ip_header*)(packet);

    /* Whoops, IP header ends past end_ptr */
    if ((const uint8_t*)(iph + 1) > end_ptr) return NULL;

    if ( ((iph->ihl & 0x40) != 0x40) || iph->proto != IPPROTO_TCP) {
        return NULL;
    }

    /* If the declared length is shorter than the snapshot (etherleak
       or such), truncate this bad boy. */

    opt_ptr = (const uint8_t*)iph + htons(iph->tot_len);
    if (end_ptr > opt_ptr) end_ptr = opt_ptr;

    ilen = iph->ihl & 15;

    /* Borken packet */
    if (ilen < 5) return NULL;

    if (ilen > 5) {

        quirks |= QUIRK_IPOPT;
    }

    tcph = (const struct tcp_header*)(packet + (ilen << 2));
    opt_ptr = (const uint8_t*)(tcph + 1);

    if (ack_mode && (tcph->flags & (TH_ACK|TH_SYN)) != (TH_ACK|TH_SYN)) return NULL;
    if (rst_mode && (tcph->flags & TH_RST) != TH_RST) return NULL;

    /* Whoops, TCP header would end past end_ptr */
    if (opt_ptr > end_ptr) return NULL;

    if (rst_mode && (tcph->flags & TH_ACK)) quirks |= QUIRK_RSTACK;

    if (tcph->seq == tcph->ack) quirks |= QUIRK_SEQEQ;
    if (!tcph->seq) quirks |= QUIRK_SEQ0;

    if (tcph->flags & ~(TH_SYN|TH_ACK|TH_RST|TH_ECE|TH_CWR))
        quirks |= QUIRK_FLAGS;

    ilen=((tcph->doff) << 2) - sizeof(struct tcp_header);

    if ( (const uint8_t*)opt_ptr + ilen < end_ptr) {

#ifdef DEBUG_EXTRAS
        uint32_t i;

        outbuf_add("  -- EXTRA PAYLOAD (packet below): ");

        for (i=0; i< (uint32_t)end_ptr - ilen - (uint32_t)opt_ptr; i++)
            outbuf_add("%02x ",*(opt_ptr + ilen + i));

        outbuf_add("%c",'\n');
        fflush(0);
#endif /* DEBUG_EXTRAS */

        quirks |= QUIRK_DATA;
        pay = opt_ptr + ilen;

    }

    while (ilen > 0) {

        ilen--;

        switch (*(opt_ptr++)) {
        case TCPOPT_EOL:
            /* EOL */
            op[ocnt] = TCPOPT_EOL;
            ocnt++;

            if (ilen) {

                quirks |= QUIRK_PAST;

            }

            /* This goto will be probably removed at some point. */
            goto end_parsing;

        case TCPOPT_NOP:
            /* NOP */
            op[ocnt] = TCPOPT_NOP;
            ocnt++;
            break;

        case TCPOPT_SACKOK:
            /* SACKOK LEN */
            op[ocnt] = TCPOPT_SACKOK;
            ocnt++;
            ilen--;
            opt_ptr++;
            break;

        case TCPOPT_MAXSEG:
            /* MSS LEN D0 D1 */
            if (opt_ptr + 3 > end_ptr) {
borken:
                quirks |= QUIRK_BROKEN;
                goto end_parsing;
            }
            op[ocnt] = TCPOPT_MAXSEG;
            mss_val = GET16(opt_ptr+1);
            ocnt++;
            ilen -= 3;
            opt_ptr += 3;
            break;

        case TCPOPT_WSCALE:
            /* WSCALE LEN D0 */
            if (opt_ptr + 2 > end_ptr) goto borken;
            op[ocnt] = TCPOPT_WSCALE;
            wsc_val = *(uint8_t *)(opt_ptr + 1);
            ocnt++;
            ilen -= 2;
            opt_ptr += 2;
            break;

        case TCPOPT_TIMESTAMP:
            /* TSTAMP LEN T0 T1 T2 T3 A0 A1 A2 A3 */
            if (opt_ptr + 9 > end_ptr) goto borken;
            op[ocnt] = TCPOPT_TIMESTAMP;

            memcpy(&tstamp, opt_ptr+5, 4);
            if (tstamp) quirks |= QUIRK_T2;

            memcpy(&tstamp, opt_ptr+1, 4);
            tstamp = ntohl(tstamp);

            ocnt++;
            ilen -= 9;
            opt_ptr += 9;
            break;

        default:

            /* Hrmpf... */
            if (opt_ptr + 1 > end_ptr) goto borken;

            op[ocnt] = *(opt_ptr-1);
            olen = *(uint8_t*)(opt_ptr)-1;
            if (olen > 32 || (olen < 0)) goto borken;

            ocnt++;
            ilen -= olen;
            opt_ptr += olen;
            break;

        }

        if (ocnt >= MAXOPT-1) goto borken;

        /* Whoops, we're past end_ptr */
        if (ilen > 0)
            if (opt_ptr >= end_ptr) goto borken;

    }

end_parsing:

    if (tcph->ack) quirks |= QUIRK_ACK;
    if (tcph->urg) quirks |= QUIRK_URG;
    if (tcph->_x2) quirks |= QUIRK_X2;
    if (!iph->id)  quirks |= QUIRK_ZEROID;

    find_match(
        /* total */ ntohs(iph->tot_len),
        /* DF */    (ntohs(iph->off) & IP_DF) != 0,
        /* TTL */   iph->ttl,
        /* WSS */   ntohs(tcph->win),
        /* src */   iph->saddr,
        /* dst */   iph->daddr,
        /* sp */    ntohs(tcph->sport),
        /* dp */    ntohs(tcph->dport),
        /* ocnt */  ocnt,
        /* op */    op,
        /* mss */   mss_val,
        /* wsc */   wsc_val,
        /* tst */   tstamp,
        /* TOS */   iph->tos,
        /* Q? */    quirks,
        /* ECN */   tcph->flags & (TH_ECE|TH_CWR),
        /* pkt */   (uint8_t*)iph,
        /* len */   end_ptr - (uint8_t*)iph,
        /* pay */   pay
    );

    return outbuf_return();
}
Beispiel #30
0
//
// Dump all JERRY register values to the log
//
void JERRYDumpIORegistersToLog(void)
{
	WriteLog("\n\n---------------------------------------------------------------------\n");
	WriteLog("JERRY I/O Registers\n");
	WriteLog("---------------------------------------------------------------------\n");
	WriteLog("F1%04X    (JPIT1): $%04X\n", JPIT1,    GET16(jerry_ram_8, JPIT1));
	WriteLog("F1%04X    (JPIT2): $%04X\n", JPIT2,    GET16(jerry_ram_8, JPIT2));
	WriteLog("F1%04X    (JPIT3): $%04X\n", JPIT3,    GET16(jerry_ram_8, JPIT3));
	WriteLog("F1%04X    (JPIT4): $%04X\n", JPIT4,    GET16(jerry_ram_8, JPIT4));
	WriteLog("F1%04X     (CLK1): $%04X\n", CLK1,     GET16(jerry_ram_8, CLK1));
	WriteLog("F1%04X     (CLK2): $%04X\n", CLK2,     GET16(jerry_ram_8, CLK2));
	WriteLog("F1%04X     (CLK3): $%04X\n", CLK3,     GET16(jerry_ram_8, CLK3));
	WriteLog("F1%04X (JINTCTRL): $%04X\n", JINTCTRL, GET16(jerry_ram_8, JINTCTRL));
	WriteLog("F1%04X  (ASIDATA): $%04X\n", ASIDATA,  GET16(jerry_ram_8, ASIDATA));
	WriteLog("F1%04X  (ASICTRL): $%04X\n", ASICTRL,  GET16(jerry_ram_8, ASICTRL));
	WriteLog("F1%04X   (ASICLK): $%04X\n", ASICLK,   GET16(jerry_ram_8, ASICLK));
	WriteLog("F1%04X     (SCLK): $%04X\n", SCLK,     GET16(jerry_ram_8, SCLK));
	WriteLog("F1%04X    (SMODE): $%04X\n", SMODE,    GET16(jerry_ram_8, SMODE));
	WriteLog("---------------------------------------------------------------------\n\n\n");
}