From: Ethan Price Date: 2006-07-29T08:26:15+09:00 Subject: Re: [QUIZ] Chip-8 (#88) ------=_Part_16653_22893143.1154129171135 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, Ethan Price wrote: > > On 7/28/06, Jacob Fugal wrote: > > > On 7/28/06, Daniel Martin wrote: > > > > 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. > > > > > > 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... > > > > 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. > > Ah, gotcha. I was thinking in instruction addressing, rather than > memory addressing. That probably reflects the fact that I read and > decompile all the instructions before beginning execution. This makes > sense now. So, regarding the initial quiz description, 100F would send > us F (15) bytes forward from the start of the file, or only 7.5 > instructions, and you'd have your instruction pointer in the middle of > an instruction. Is that valid? Or was it indeed a typo as Daniel > suggested? > > Jacob Fugal Well it would be vaild, but indeed you would end up right in the middle of an opcode (probably not where one wants to be), so it was a typo on my part. 100F would send you 15 bytes forward, not 16. So it probably should have read something to the effect of "Say we had the opcode 100F, that means we would jump to after byte 15, and the next instruction read would be bytes 16 and 17". My apologies for that. Ethan Price ------=_Part_16653_22893143.1154129171135--