Reading bytes?

Hi, I’m hoping someone can help me read some bytes from files. See i’m kind of making/porting a Chip-8 emulator and I need to read the roms, I thought that I could just take my rom and name it "romname.bytes"but this is not working? I’m reading the bytes but it just is not giving me the results I need, I have tried multiple roms, the results are numbers like “238”, “0”, “106” just to name a few but there are many numbers, this is a snippet of the code:
This is used to load the TextAsset:

public bool LoadProgram(TextAsset rom)
		{
			//load file
			byte[] loadedProgramBytes = rom.bytes;
			for(int x = 0; x < loadedProgramBytes.Length; x++)
		    {
			 Debug.Log (""+ loadedProgramBytes[x]);
		    }
}

And this is the code I use to initiate that function:

	public CHIPP8 chip82;
	public TextAsset game;

	void Start () 
	{
	chip82.LoadProgram(game);
	}

Any help would be greatly appreciated :slight_smile:

This is a download link to the rom: HERE

It could be that the TextAsset is treating it as ASCII and so cutting the data when it hits a 0 byte.

Trys something like this:

string file = AssetDatabase.GetAssetPath( rom );
byte[] data = File.ReadAllBytes( file );

I tried that but alas no good results :frowning:

What results do you expect? Do you know the file structure of these roms?

K

OMG, I AM SO STUPID I CANT BELIEVE I REMEMBER TO BREATHE… My original code worked fine, I just only did one CPU cycle, I’m so sorry for wasting your time :smile: