Esempio n. 1
0
    public static void memcpy(int addr, byte[] bytes, int off, int size)
    {
        while (((addr & 0x3) != 0) && (size > 0))
        {
            byte b = bytes[off++];
            CRunTime.memoryWriteByte(addr, b);
            addr++;
            size--;
            if (size == 0)
            {
                return;
            }
        }

        while (size > 3)
        {
            int i = 0;
            for (int j = 0; j < 4; j++)
            {
                i = i << 8;
                int b = bytes[off++] & 0xff;
                i |= b;
            }

            CRunTime.memoryWriteWord(addr, i);
            addr += 4;
            size -= 4;
        }

        while (size > 0)
        {
            byte b = bytes[off++];
            CRunTime.memoryWriteByte(addr, b);
            addr++;
            size--;
        }
    }
Esempio n. 2
0
    public int findTile(int fips, int tile_index, int size_addr)
    {
        for (int i = 1; i < numRecords; i++)
        {
            if (ids[i] == tile_index)
            {
                if (size_addr != 0)
                {
                    try
                    {
                        CRunTime.memoryWriteWord(size_addr, recordstore[getStoreID(i)].getRecordSize(getRecordID(i)) - 4);
                    }
                    catch (RecordStoreException e)
                    {
                        Logger.log(e.ToString());
                        return(-1);
                    }
                }
                return(i);
            }
        }

        return(-1);
    }
Esempio n. 3
0
 public static void memoryWriteWordPc(int pc, int address, int ins)
 {
     CRunTime.assertMemoryWrite("4-byte", pc, address, ins);
     CRunTime.memoryWriteWord(address, ins);
 }