Welcome to GameHourz.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log in/Register/PasswordLog in/Register/Password

CoreWin Bug?

 
   Game Forums (Home) -> Core War RSS
Related Topics:
Score Surface for 94nop - Hi, some anonymous person (still called for ;-) is so kind to provide access to a pile of I have suggested to calculate one score surface for standard settings. It takes roughly 1000 times the time of one surface to..

Bug in pMARS - Hi, either I don't know how EQUs work or I have found a bug in the parser of pMARS. So far I cound pin it down to: ;name test ;assert CORESIZE == 800 v3 EQU 3 * (3 / 2 + 1) + 3 v4 EQU (CORESIZE - v3) dat.f v3, v4 With the..

KOTH.ORG: Status - ICWS Experimental 94 03/06/06 - Weekly Status on 03/06/06 -=- is up! Meetings held in #corewars -=- Tons of new features on pages -=- *FAQ* page located at: Current Status of the KOTH.ORG ICWS 94..

KOTH.ORG: Status - MultiWarrior 94 03/06/06 - Weekly Status on 03/06/06 -=- is up! Meetings held in #corewars -=- Tons of new features on pages -=- *FAQ* page located at: Current Status of the KOTH.ORG 94 CoreWar..

KOTH.ORG: Status - 94 No Pspace 03/06/06 - Weekly Status on 03/06/06 -=- is up! Meetings held in #corewars -=- Tons of new features on pages -=- *FAQ* page located at: Current Status of the KOTH.ORG 94 No Pspace CoreWar Hill:..
Next:  Core War: Skybuck's Warrior: CloackedImpV3  
Author Message
pauldkline

External


Since: Dec 01, 2007
Posts: 19



(Msg. 1) Posted: Sun Jan 27, 2008 2:07 pm
Post subject: CoreWin Bug?
Archived from groups: rec>games>corewar (more info?)

I've been pushing CoreWin to the limit and found what I think is a
bug. If you step this program:

qA equ 2001
qB equ 2002
qC equ 2003
tA dat 0 ,(qA*qB*qC)
begin mov.a #qB ,tA
mul.a #qA ,tA
mul.a #qC ,tA
sne.ab tA ,tA
jmp #0
end begin

you will see that tA.a <> tA.b

I tried to contact Chip Wendell, but the email was bounced.

P. Kline

 >> Stay informed about: CoreWin Bug? 
Back to top
Login to vote
Skybuck Flying

External


Since: May 25, 2006
Posts: 295



(Msg. 2) Posted: Mon Jan 28, 2008 4:49 am
Post subject: Re: CoreWin Bug? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

CoreWin is probably 32 bit software.

The calculation you try to do does not fit in 32 bits.

That could be the problem.

Bye,
Skybuck.

 >> Stay informed about: CoreWin Bug? 
Back to top
Login to vote
Ilmari Karonen

External


Since: Sep 15, 2006
Posts: 40



(Msg. 3) Posted: Thu Jan 31, 2008 9:57 pm
Post subject: Re: CoreWin Bug? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

pauldkline.TakeThisOut@aol.com <pauldkline.TakeThisOut@aol.com> kirjoitti 27.01.2008:
> I've been pushing CoreWin to the limit and found what I think is a
> bug. If you step this program:
>
> qA equ 2001
> qB equ 2002
> qC equ 2003
> tA dat 0 ,(qA*qB*qC)
> begin mov.a #qB ,tA
> mul.a #qA ,tA
> mul.a #qC ,tA
> sne.ab tA ,tA
> jmp #0
> end begin
>
> you will see that tA.a <> tA.b

So which one is wrong? In a 8000-instruction core, the result
*should* be 6006 (or -1994).

--
Ilmari Karonen
To reply by e-mail, please replace ".invalid" with ".net" in address.
 >> Stay informed about: CoreWin Bug? 
Back to top
Login to vote
pauldkline

External


Since: Dec 01, 2007
Posts: 19



(Msg. 4) Posted: Fri Feb 01, 2008 2:43 pm
Post subject: Re: CoreWin Bug? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

David M provided the solution to force mod8000:

> > tA dat 0 ,(((qA*qB)%CORESIZE)*qC)

P. Kline
 >> Stay informed about: CoreWin Bug? 
Back to top
Login to vote
Ilmari Karonen

External


Since: Sep 15, 2006
Posts: 40



(Msg. 5) Posted: Mon Feb 04, 2008 1:02 am
Post subject: Re: CoreWin Bug? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

pauldkline DeleteThis @aol.com <pauldkline DeleteThis @aol.com> kirjoitti 01.02.2008:
> David M provided the solution to force mod8000:
>
>> > tA dat 0 ,(((qA*qB)%CORESIZE)*qC)

Ah, yes, of course: 32-bit integer overflow. I suspect pMARS has the
same bug. Indeed, it's not really fixable entirely without switching
to unlimited-precision integer arithmetic (a.k.a. bignums), since we
*do* want expressions such as CORESIZE/2 to produce the expected
(i.e. non-zero) result, which precludes doing the math entirely modulo
CORESIZE.

--
Ilmari Karonen
To reply by e-mail, please replace ".invalid" with ".net" in address.
 >> Stay informed about: CoreWin Bug? 
Back to top
Login to vote
digital.wilderness

External


Since: Mar 04, 2006
Posts: 6



(Msg. 6) Posted: Mon Feb 04, 2008 8:09 am
Post subject: Re: CoreWin Bug? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

pMARS has the same problem.

Multiplication could be calculated modulo the highest multiple of
CORESIZE below sqrt(maxint).

Addition and subtraction could be done modulo the highest multiple of
CORESIZE below maxint/2.

This should fix overflow and expressions like CORESIZE/2 or even
(3*CORESIZE)/7 will still work.

Regards,

John

On Feb 3, 11:02 pm, Ilmari Karonen <usen....RemoveThis@vyznev.invalid> wrote:
> pauldkl....RemoveThis@aol.com <pauldkl....RemoveThis@aol.com> kirjoitti 01.02.2008:
>
> > David M provided the solution to force mod8000:
>
> >> > tA dat 0 ,(((qA*qB)%CORESIZE)*qC)
>
> Ah, yes, of course: 32-bit integer overflow. I suspect pMARS has the
> same bug. Indeed, it's not really fixable entirely without switching
> to unlimited-precision integer arithmetic (a.k.a. bignums), since we
> *do* want expressions such as CORESIZE/2 to produce the expected
> (i.e. non-zero) result, which precludes doing the math entirely modulo
> CORESIZE.
>
> --
> Ilmari Karonen
> To reply by e-mail, please replace ".invalid" with ".net" in address.
 >> Stay informed about: CoreWin Bug? 
Back to top
Login to vote
Chip

External


Since: Feb 05, 2008
Posts: 1



(Msg. 7) Posted: Tue Feb 05, 2008 8:04 am
Post subject: Re: CoreWin Bug? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Feb 4, 11:09 am, digital.wildern... RemoveThis @googlemail.com wrote:
>
> Multiplication could be calculated modulo the highest multiple of
> CORESIZE below sqrt(maxint).
>
> Addition and subtraction could be done modulo the highest multiple of
> CORESIZE below maxint/2.
>
> This should fix overflow and expressions like CORESIZE/2 or even
> (3*CORESIZE)/7 will still work.

Thanks, John! I had been ignoring the 32-bit overflow problem as being
too difficult to fix, but your proposal is a fairly easy workaround.
I'll build that into the next CoreWin release.

My apologies to all for any bounced emails you may have gotten; I've
recently changed both my job and my home ISP. You can get my new email
address from my profile.

Regards,

- Chip
 >> Stay informed about: CoreWin Bug? 
Back to top
Login to vote
Ilmari Karonen

External


Since: Sep 15, 2006
Posts: 40



(Msg. 8) Posted: Tue Feb 05, 2008 11:09 pm
Post subject: Re: CoreWin Bug? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

digital.wilderness.RemoveThis@googlemail.com <digital.wilderness.RemoveThis@googlemail.com> kirjoitti 04.02.2008:
>
> Multiplication could be calculated modulo the highest multiple of
> CORESIZE below sqrt(maxint).
>
> Addition and subtraction could be done modulo the highest multiple of
> CORESIZE below maxint/2.
>
> This should fix overflow and expressions like CORESIZE/2 or even
> (3*CORESIZE)/7 will still work.

Note that, on a 32-bit system with signed integers, sqrt(MAXINT) is
only (slightly less than) 46341. (With unsigned integers it's of
course just under 65536.) The largest multiple of 8000 which is less
than 46341 is only 5*8000 = 40000. For larger coresizes the margin
gets even narrower.

Of course, the larger the coresize is, the more likely one is to bump
into integer size limits in the compiler anyway. Having thought about
this a bit more, I actually feel that doing all math with bignums in
the compiler might be the best solution. Or, if not that, at least
switch to 64-bit integers to get a bit more headroom.

--
Ilmari Karonen
To reply by e-mail, please replace ".invalid" with ".net" in address.
 >> Stay informed about: CoreWin Bug? 
Back to top
Login to vote
Display posts from previous:   
   Game Forums (Home) -> Core War All times are: Ekaterinburg, Islamabad, Karachi, Tashkent (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]