🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: rec.games.corewar
Article #331

my error or MARS bug?

#331
From: Ingo Wilken
Date: Mon, 11 Jan 1993 00:47
66 lines
2476 bytes
Hi,

I'm new to this game, and I'm wondering if I found a bug in the MARS
program (Amiga, MADgic Core 4.1 by Mark A. Durham) or am I just 
misinterpreting something.

This piece of code should bomb an area "just in front" of itself, and
selects its targets with a Fibonacci series:

firewall    DAT #0 #0
bombing     MOV bomb @fib1
            MOV fib1 ftmp
            ADD fib0 fib1
            MOV ftmp fib0
            CMP #-233 fib1
            JMZ bombing firewall
            MOV fcp1 fib1
            MOV fcp0 fib0
            JMZ bombing firewall
fib1        DAT #0 #-5
fib0        DAT #0 #-3
ftmp        DAT #0 #0
fcp1        DAT #0 #-5
fcp0        DAT #0 #-3
bomb        DAT #0 #0
            END bombing

Coresize is 8000, and my program gets loaded to address 4000.
This is a coredump ;-) of the area:

4000: DAT #0000, #0000
4001: MOV  0014, @0009
4002: MOV  0008,  0010
4003: ADD  0008,  0007
4004: MOV  0008,  0007
4005: CMP #7767,  0005
4006: JMZ  7995,  7994
4007: MOV  0006,  0003
4008: MOV  0006,  0003
4009: JMZ  7992,  7991
4010: DAT #0000, #7995
4011: DAT #0000, #7997
4012: DAT #0000, #0000
4013: DAT #0000, #7995
4014: DAT #0000, #7997
4015: DAT #0000, #0000

Seems ok so far.  Now, from my interpretation of the ICWS-88 text 
("redcode-icws-88" from soda.berkeley.edu), the B-field of the first MOV 
should be processed like this:
Read the b-field of 4010 (=> 7995), add the PC (=> 11996), then modulo
coresize (=> 3996).  Result: Copy the bomb from 4015 to 3996.

But the simulator does something else, it copies the bomb to 4005!
It seems that instead of adding the address of the current instruction (4001)
it adds the address of the DAT (4010).

Now who's wrong?

Ingo
-- 
Ingo Wilken, CS Student, Univ.of Oldenburg, FRG | You mean I really did all of
wilken@uniol.uucp (..!uunet!unido!uniol!wilken) | dat stuff? Now dat explains
Ingo.Wilken@arbi.informatik.uni-oldenburg.de    | why my head hurts an' why I
wilken@uniol.zer   IRC:Nobody   OL:ingo@faramir | feel so bad!  -Snarf
Technical Details
Message-ID: <1993Jan11.011528.17746@arbi.Informatik.Uni-Oldenburg.DE>
Path: arc1-ca.pugleaf.net!sparky!uunet!math.fu-berlin.de!uniol!Ingo.Wilken

Show Full Headers
Complete Article Headers
Newsgroups: rec.games.corewar
Path: arc1-ca.pugleaf.net!sparky!uunet!math.fu-berlin.de!uniol!Ingo.Wilken
From: Ingo.Wilken@arbi.informatik.uni-oldenburg.de (Ingo Wilken)
Subject: my error or MARS bug?
Organization: University of Oldenburg, Germany
Date: Mon, 11 Jan 1993 00:47:19 GMT
Message-ID: <1993Jan11.011528.17746@arbi.Informatik.Uni-Oldenburg.DE>
Sender: news@arbi.Informatik.Uni-Oldenburg.DE
Lines: 66