G
Guest
Guest
Archived from groups: rec.games.corewar (More info?)
As you know, I'm working on my Corewars interpreter. ICWS88 for the
beginning. I have had the standard paper in front of me for the whole
weekend and still I'm confused.
Predecrement in particular. As far as I get it, it works like this:
I read the value of the operand, add it with the programmcounter, read
the resulting memory location, take the value of the B operand of this
memory location and store this value. Then I decrement this value and
write it back to the memory location where I took it from. Now I
calculate the memory loaction where this offset is pointing at. Do I
now add the programmcounter or the adress of the memory location where
I got it from to this offset?
Example: I want to execute L1
L1 mov 0 <1
L2 DAT 0 2
L3 DAT 0 0
L4 DAT 0 0
First I evaluate the A operand of L1, which brings me mov L1 <1. I note
this down (because of In-Register evaluation).
Second I evaluate the B operand of L1, which makes me read the B
operand of L2. I do note 2 for further use and store DAT 0 1 at L2.
Now the question. Do I add the 2 to L1 or L2?
If to L1 I'll get
L1 mov 0 <1
L2 DAT 0 1
L3 mov 0 <1
L4 DAT 0 0
or if to L2 I'll get
L1 mov 0 <1
L2 DAT 0 1
L3 DAT 0 0
L4 mov 0 <1
>From the description of predecrement in the standard paper I would
think L2.
As of the "Effective Address Calculations" in the same paper, L1 would
be right.
As of the FAQ Chapter 17, L1 should be the right thing to do.
As of the ICWS94 paper chapter 5.3.4 Predecrement Indirect, L2 is
choosen.
As of "The beginners guide to Redcode v1.21", L2 is choosen BUT here
the decrementation is done BEFORE the note down of the value and so I
would add a 0 to the L2
(http://vyznev.net/corewar/guide.html#start_modes).
As a democrat I guess L2 is right because it stands 4:2, but as a
comupter scientist I can't stand democratic decisions as a base of
logic branches.
Hope you can help me, because even the search in the Usegroup archives
didn't give me a clue.
As you know, I'm working on my Corewars interpreter. ICWS88 for the
beginning. I have had the standard paper in front of me for the whole
weekend and still I'm confused.
Predecrement in particular. As far as I get it, it works like this:
I read the value of the operand, add it with the programmcounter, read
the resulting memory location, take the value of the B operand of this
memory location and store this value. Then I decrement this value and
write it back to the memory location where I took it from. Now I
calculate the memory loaction where this offset is pointing at. Do I
now add the programmcounter or the adress of the memory location where
I got it from to this offset?
Example: I want to execute L1
L1 mov 0 <1
L2 DAT 0 2
L3 DAT 0 0
L4 DAT 0 0
First I evaluate the A operand of L1, which brings me mov L1 <1. I note
this down (because of In-Register evaluation).
Second I evaluate the B operand of L1, which makes me read the B
operand of L2. I do note 2 for further use and store DAT 0 1 at L2.
Now the question. Do I add the 2 to L1 or L2?
If to L1 I'll get
L1 mov 0 <1
L2 DAT 0 1
L3 mov 0 <1
L4 DAT 0 0
or if to L2 I'll get
L1 mov 0 <1
L2 DAT 0 1
L3 DAT 0 0
L4 mov 0 <1
>From the description of predecrement in the standard paper I would
think L2.
As of the "Effective Address Calculations" in the same paper, L1 would
be right.
As of the FAQ Chapter 17, L1 should be the right thing to do.
As of the ICWS94 paper chapter 5.3.4 Predecrement Indirect, L2 is
choosen.
As of "The beginners guide to Redcode v1.21", L2 is choosen BUT here
the decrementation is done BEFORE the note down of the value and so I
would add a 0 to the L2
(http://vyznev.net/corewar/guide.html#start_modes).
As a democrat I guess L2 is right because it stands 4:2, but as a
comupter scientist I can't stand democratic decisions as a base of
logic branches.
Hope you can help me, because even the search in the Usegroup archives
didn't give me a clue.