From: Ethan Price Date: 2006-07-29T07:11:22+09:00 Subject: Re: [QUIZ] Chip-8 (#88) ------=_Part_15797_29165991.1154124678976 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 7/28/06, Jacob Fugal wrote: > > On 7/28/06, Daniel Martin wrote: > > I'm not sure you mean this. I think you mean either "jump to before > > the 16th byte" or meant to use opcode 1010. > > > > Looking at your program, I see an easy way to make this explanation > > easier: > > > > Opcode 0100 will send you back to the beginning, so that the next > > instruction read and executed is the first instruction of the file. > > Opcode 0102 will send you back to the second instruction in the file > > (remember that instructions are four hex digits - or two bytes - > > long). Other addresses follow. > > I think you mean 1000 and 1002 in the description above. :) > > So, should an absolute jump to N make it so that the Nth (0-based > index) instruction is the next executed, or the (N+1)th? You're > example above seems to put it both ways. 1000 sends you back to the > beginning, so the "0th" instruction (first instruction in the file) is > the next executed. But then 1002 should make it so that the "2nd" > instruction (third instruction in the file) is the next executed, > right? Maybe this is what you meant by "second" anyways... > > Jacob Fugal > > Here is how it is supposed to work. Say we have a file that reads in hex: 1234ABCD5678 Opcode 1000 would send us to before 1234, so after jumping the first instruction we would read is 1234. Opcode 1002 would send us to after 1234 and before ABCD (were moving forward 2 bytes, which equals 4 hex digits worth of data). 1004 would send us to after ABCD and before 5678, and so on. From Daniel's message "I'll note that the spec. nowhere tells us what the initial, power-on values of the registers are. My personal recommendation is that people intialize the registers with random values, so that bad chip-8 programs would be caught." Initial power on values for all registers should be zero. Initializing with random numbers sounds like a good idea, but I imagine it might cause the Chip-8 program to output different numbers, so I would cautious in doing so. Hope that helps, Ethan Price ------=_Part_15797_29165991.1154124678976--