Esempio n. 1
0
void AXUCode::ProcessPBList(u32 pb_addr)
{
  // Samples per millisecond. In theory DSP sampling rate can be changed from
  // 32KHz to 48KHz, but AX always process at 32KHz.
  const u32 spms = 32;

  AXPB pb;

  while (pb_addr)
  {
    AXBuffers buffers = {{m_samples_left, m_samples_right, m_samples_surround, m_samples_auxA_left,
                          m_samples_auxA_right, m_samples_auxA_surround, m_samples_auxB_left,
                          m_samples_auxB_right, m_samples_auxB_surround}};

    ReadPB(pb_addr, pb);

    u32 updates_addr = HILO_TO_32(pb.updates.data);
    u16* updates = (u16*)HLEMemory_Get_Pointer(updates_addr);

    for (int curr_ms = 0; curr_ms < 5; ++curr_ms)
    {
      ApplyUpdatesForMs(curr_ms, (u16*)&pb, pb.updates.num_updates, updates);

      ProcessVoice(pb, buffers, spms, ConvertMixerControl(pb.mixer_control),
                   m_coeffs_available ? m_coeffs : nullptr);

      // Forward the buffers
      for (size_t i = 0; i < ArraySize(buffers.ptrs); ++i)
        buffers.ptrs[i] += spms;
    }

    WritePB(pb_addr, pb);
    pb_addr = HILO_TO_32(pb.next_pb);
  }
}
Esempio n. 2
0
void AXWiiUCode::ProcessPBList(u32 pb_addr)
{
	AXPBWii pb;

	while (pb_addr)
	{
		AXBuffers buffers = {{
			m_samples_left,
			m_samples_right,
			m_samples_surround,
			m_samples_auxA_left,
			m_samples_auxA_right,
			m_samples_auxA_surround,
			m_samples_auxB_left,
			m_samples_auxB_right,
			m_samples_auxB_surround,
			m_samples_auxC_left,
			m_samples_auxC_right,
			m_samples_auxC_surround,
			m_samples_wm0,
			m_samples_aux0,
			m_samples_wm1,
			m_samples_aux1,
			m_samples_wm2,
			m_samples_aux2,
			m_samples_wm3,
			m_samples_aux3
		}};

		ReadPB(pb_addr, pb);

		u16 num_updates[3];
		u16 updates[1024];
		u32 updates_addr;
		if (ExtractUpdatesFields(pb, num_updates, updates, &updates_addr))
		{
			for (int curr_ms = 0; curr_ms < 3; ++curr_ms)
			{
				ApplyUpdatesForMs(curr_ms, (u16*)&pb, num_updates, updates);
				ProcessVoice(pb, buffers, 32,
				             ConvertMixerControl(HILO_TO_32(pb.mixer_control)),
				             m_coeffs_available ? m_coeffs : nullptr);

				// Forward the buffers
				for (size_t i = 0; i < ArraySize(buffers.ptrs); ++i)
					buffers.ptrs[i] += 32;
			}
			ReinjectUpdatesFields(pb, num_updates, updates_addr);
		}
		else
		{
			ProcessVoice(pb, buffers, 96,
			             ConvertMixerControl(HILO_TO_32(pb.mixer_control)),
			             m_coeffs_available ? m_coeffs : nullptr);
		}

		WritePB(pb_addr, pb);
		pb_addr = HILO_TO_32(pb.next_pb);
	}
}
Esempio n. 3
0
void WriteB (t_uint64 va, t_uint64 dat)
{
t_uint64 pa;

if (dmapen) pa = trans_d (va, cm_wacc);                 /* mapping on? */
else pa = va;
WritePB (pa, dat);
return;
}
Esempio n. 4
0
t_stat WriteVB(t_addr a, uint32 val)
{
    t_addr addr;
    IOHANDLER* ioh;
    t_stat rc = TranslateAddr(a,&addr,&ioh,MEM_WRITE,m68k_fcode,m68k_dma);
    switch (rc) {
    case SIM_NOMEM:
        /* part 2 of hack for less strict memory handling: ignore anything written
         * to a nonexisting address
         */
        return SCPE_OK;
    case SIM_ISIO:
        return ioh->io(ioh,&val,IO_WRITE,BMASK);
    case SCPE_OK:
        return WritePB(addr,val);
    default:
        return rc;
    }
}
Esempio n. 5
0
void CUCode_AX::ProcessPBList(u32 pb_addr)
{
	// Samples per millisecond. In theory DSP sampling rate can be changed from
	// 32KHz to 48KHz, but AX always process at 32KHz.
	const u32 spms = 32;

	AXPB pb;

	while (pb_addr)
	{
		AXBuffers buffers = {{
			m_samples_left,
			m_samples_right,
			m_samples_surround,
			m_samples_auxA_left,
			m_samples_auxA_right,
			m_samples_auxA_surround,
			m_samples_auxB_left,
			m_samples_auxB_right,
			m_samples_auxB_surround
		}};

		if (!ReadPB(pb_addr, pb))
			break;

		for (int curr_ms = 0; curr_ms < 5; ++curr_ms)
		{
			ApplyUpdatesForMs(pb, curr_ms);

			Process1ms(pb, buffers, ConvertMixerControl(pb.mixer_control));

			// Forward the buffers
			for (u32 i = 0; i < sizeof (buffers.ptrs) / sizeof (buffers.ptrs[0]); ++i)
				buffers.ptrs[i] += spms;
		}

		WritePB(pb_addr, pb);
		pb_addr = HILO_TO_32(pb.next_pb);
	}
}
Esempio n. 6
0
/* Motorola S-Record reader
 * Format:
 *  type        2 Bytes     (S0, S1, S2, S3, S5, S7, S8, S9)
 *  reclength   2 Bytes
 *  address     4,6,8 Bytes
 *  data        0...2n
 *  checksum    2 Bytes     (lsb of 1'comp of fields reclength-data
 */
static t_stat m68k_sread(FILE* fptr)
{
    int typ;
    t_addr addr=0, a;
    int d, len, chksum, i;
    int end = FALSE;
    int line = 0;
    
    fseek(fptr,0l,SEEK_SET);
    for(;;) {
        while ((i = fgetc(fptr)) == '\r' || i == '\n');
        line++;
        if (end && i == EOF) return SCPE_OK;
        if (i != 'S') { printf("Line %d: expected S but did not find one (found %x)\n",line,i); return SCPE_FMT; }

        typ = fgetc(fptr);
        chksum = 0;
        len = getHex(fptr,&chksum);
        addr = getHex(fptr,&chksum);
        a = getHex(fptr,&chksum);
        if (len==EOF || addr==EOF || a==EOF) { typ = 'X'; goto error; }
        addr = (addr << 8) | a;
        i = 3;
        
        switch (typ) {
        case '0':
            for (i=2; i<len; i++) (void)getHex(fptr,&chksum);
            break;
        case '1':
            i = 2;
            goto dread;
        case '3':
            if ((a = getHex(fptr,&chksum))==EOF) goto error;
            addr = (addr << 8) | a;
            i = 4;
            /*fallthru*/
        case '2':
            if ((a = getHex(fptr,&chksum))==EOF) goto error;
            addr = (addr << 8) | a;
dread:
            for (; i<len; i++) { d = getHex(fptr,&chksum); WritePB(addr,d); addr++; }
            break;
        case '7':
            if ((a = getHex(fptr,&chksum))==EOF) goto error;
            addr = (addr << 8) | a;
            /*fallthru*/
        case '8':
            if ((a = getHex(fptr,&chksum))==EOF) goto error;
            addr = (addr << 8) | a;
            /*fallthru*/
        case '9':
            end = TRUE;
            /*fallthru*/
        case '5':
            if((d = getHex(fptr,&chksum))==EOF) goto error;
            break;
        }
        if ((chksum & 0xff) != 0) return SCPE_CSUM;
        saved_PC = addr;
    }

error:
    printf("S%c at line %d: Unexpected EOF/Invalid character\n",typ,line);
    return SCPE_FMT;
}