🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: rec.games.corewar
Article #228

Re: SLT

#228
From: Jeff Raven
Date: Thu, 12 Nov 1992 23:31
33 lines
1540 bytes
>Well that isn't exactly what my problem is... Take the following code for
>instance :
>        JMP     lbl,    #-1
>        DAT     #0,     #0
>        SLT     -1,     -2
>Now, the SLT compares  #0  to  #-1, but is #0 less than or greater than #-1
>???
>Is #-1 converted to CORESIZE-1 ??? Or does the comparison evaluate as true
>(i.e. #-1 is less than #0) ?

In corewars, there is no such thing as a negative value - all arithmetic
is done modulo CORESIZE. When the above commands are assembled, the lines
will become (assuming CORESIZE = 8000) :
     JMP   lbl,   #7999
     DAT   #0,    #0
     SLT   7999,  7998
Therefore, the comparison will be between 0 and 7999. Then the SLT
will evaluate as true since 0 < 7999. The modulo arithmetic applies
to every command - so
one  DAT #2
two  DAT #1
     SUB one, two

will change things to

one  DAT #2
two  DAT #7999
     SUB one, two

Answer your question?

Jeff Raven
jar129@psuvm.psu.edu
Technical Details
Message-ID: <92317.183133JAR129@psuvm.psu.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!gossip.pyramid.com!decwrl!netsys!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!zaphod.mps.ohio-state.edu!rpi!usc!sol.ctr.columbia.edu!eff!news.byu.edu!yvax.byu.edu!cunyvm!psuvm!jar129
References: <1992Nov8.195147.29858@cs.kuleuven.ac.be><9231710.16573@mulga.cs.mu.OZ.AU> <1992Nov12.163801.29914@cs.kuleuven.ac.be>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!gossip.pyramid.com!decwrl!netsys!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!zaphod.mps.ohio-state.edu!rpi!usc!sol.ctr.columbia.edu!eff!news.byu.edu!yvax.byu.edu!cunyvm!psuvm!jar129
Newsgroups: rec.games.corewar
Subject: Re: SLT
Message-ID: <92317.183133JAR129@psuvm.psu.edu>
From: Jeff Raven <JAR129@psuvm.psu.edu>
Date: Thu, 12 Nov 1992 18:31:33 EST
References: <1992Nov8.195147.29858@cs.kuleuven.ac.be><9231710.16573@mulga.cs.mu.OZ.AU> <1992Nov12.163801.29914@cs.kuleuven.ac.be>
Organization: Penn State University
Lines: 33