Jump to content
devwebcl

Colossus Chess 4.1

Recommended Posts

6 hours ago, zbyti said:

Colossus Chess 4.1 is only hack.

 

Col4-Elo.pngC64REV_R5.thumb.png.8660766c6685971bfe31e3fcce219535.png

is patch not hack

1 minute ago, devwebcl said:

 

2 minutes ago, devwebcl said:

rave.N - 06/12/2015

 

Colossus v4.0 has a catastrophic bug, in which it can lock up endlessly (most likely while the computer AI is thinking to move), v4.1 fixes this by changing just 2 bytes, the only instance of $D0 $FE changed into $EA $EA to make v4.1 which was patched, not recompiled. And, the text for "4.0" changed into "4.1", text is only seen by pressing the Spacebar (plus, seen on a loading screen for this cassette version).

+1 :)

Share this post


Link to post
Share on other sites
2 minutes ago, _The Doctor__ said:

is patch not hack

 

+1 :)

Funny... I played many times tournament games, CC4 never hangs on atari800 emulator, maybe it is real machine issue? I don't need this patch.

Edited by zbyti

Share this post


Link to post
Share on other sites

  

6 hours ago, devwebcl said:

Colossus v4.0 has a catastrophic bug, in which it can lock up endlessly (most likely while the computer AI is thinking to move), v4.1 fixes this by changing just 2 bytes, the only instance of $D0 $FE changed into $EA $EA to make v4.1 which was patched, not recompiled.

That instruction ($d0 $fe) is "BNE *" which, indeed, is an infinite loop and causes the program to hang whenever it enters it with the condition not met (Z=0). I would however refrain from calling this a "catastrophic bug". I would also refrain from applying that patch relying on the current information.

 

First of all, it is not a bug, it looks intended. Before trying out that branch instruction the program calculates a checksum (out of its own memory), and then, if this checksum's value is anything but the expected value, it enters that loop and indeed hangs. So it is rather some sort of protection against unauthorized modifications and such, and should not influence the program if it is not internally modified.

 

Second, that code cannot influence the program's execution, because it is executed only shortly after program's start, and when the chessboard gets drawn, that area of memory is zeroed out.

 

So any possible hangs during the match cannot be directly related to that loop. I would rather suspect that whoever experiences them, has a hardware problem with his Atari (failing RAM, most probably).

 

In any case, the patch does really nothing, it just cancels that integrity check (or its first stage).

 

I guess that if I am correct that comment on Atarimania should get deleted, because it is misleading (and even blames the author of major failure in programming). @www.atarimania.com

 

Edited by drac030
  • Like 4

Share this post


Link to post
Share on other sites

@drac030 CC4 its one of the best chess on A8 but CC4 is only one strong engine not working correctly with Rapidus and more MHz. Can you possibly patch this in any future?

 

On Rapidus CC4 starts making illegal moves, spotted on Alitrra 3.90.

Edited by zbyti

Share this post


Link to post
Share on other sites

Altirra's Rapidus emulation (System->Configure System->Peripherals->Devices->Add->Internal Devices->Rapidus Accelerator) is not very compatible, e.g. SysInfo did not work on it last time I checked, but in this case I do not think it is a real problem.

 

Even with the generic turbo mode Altirra offers (System->Configure System->CPU->65816), Colossus Chess 4.0 indeed tends to do illegal moves or plainly hang. The problems seems to occur even at 10 MHz or 7 MHz. So I guess that the program has a race condition, that by accident does not occur at 1.77 MHz.

 

I guess that would not be very easy to fix.

  • Thanks 1

Share this post


Link to post
Share on other sites

Having delved into the code in trying to port this CC4 to the 5200 I would say a Rapidus patch would probably be tricky due to the code using some very odd use of indexing into the zeropage by exploiting wraparounds.

  • Thanks 1

Share this post


Link to post
Share on other sites
17 minutes ago, Wrathchild said:

Having delved into the code in trying to port this CC4 to the 5200 I would say a Rapidus patch would probably be tricky due to the code using some very odd use of indexing into the zeropage by exploiting wraparounds.

Ah, so. Having just casually looking into the code I did not see that, but that is possible. In that case, however, the real Rapidus Accelerator has some provision to fix that: you can enable mirroring of the zero-page at $010000-$0100FF. And indeed, with this enabled, the situation seems to be improved even at 40 MHz. So my guess about the race condition seems to be wrong.

Edited by drac030
  • Like 3

Share this post


Link to post
Share on other sites
9 hours ago, drac030 said:

And indeed, with this enabled, the situation seems to be improved even at 40 MHz.

In old times programmers thinks that each doubling of the clock speed adds 50 ELO ;)

 

If CC4 have ~1650 ELO points on stock A8 then on your machine will be quite strong for amateur :]

Edited by zbyti

Share this post


Link to post
Share on other sites
16 hours ago, Wrathchild said:

the code using some very odd use of indexing into the zeropage by exploiting wraparounds

Could you post an example? I seem to not be able to spot any, but perhaps I am looking at the wrong place.

Share this post


Link to post
Share on other sites

858E B9 F5 FF                LDA    unk_0_FFF5,Y

903A B9 F5 FF                LDA    unk_0_FFF5,Y

 

7E28 99 F6 FF                STA    unk_0_FFF6,Y

8543 B9 F6 FF                LDA    unk_0_FFF6,Y

8FC7 B9 F6 FF                LDA    unk_0_FFF6,Y

 

85B0 B9 F7 FF                LDA    unk_0_FFF7,Y

905E B9 F7 FF                LDA    unk_0_FFF7,Y

 

6EF8 BD FC FF                LDA    unk_0_FFFC,X
6F00 9D FC FF                STA    unk_0_FFFC,X
6F30 9D FC FF                STA    unk_0_FFFC,X

 

6EF5 9D FE FF                STA    unk_0_FFFE,X
6F28 BD FE FF                LDA    unk_0_FFFE,X
6F38 9D FE FF                STA    unk_0_FFFE,X

 

6EFB 9D FF FF                STA    unk_0_FFFF,X
6F2D BD FF FF                LDA    unk_0_FFFF,X
6F35 9D FF FF                STA    unk_0_FFFF,X
84FF B9 FF FF                LDA    unk_0_FFFF,Y
8F79 B9 FF FF                LDA    unk_0_FFFF,Y

 

Share this post


Link to post
Share on other sites
38 minutes ago, Wrathchild said:

858E B9 F5 FF                LDA    unk_0_FFF5,Y

903A B9 F5 FF                LDA    unk_0_FFF5,Y

 

7E28 99 F6 FF                STA    unk_0_FFF6,Y

8543 B9 F6 FF                LDA    unk_0_FFF6,Y

8FC7 B9 F6 FF                LDA    unk_0_FFF6,Y

 

85B0 B9 F7 FF                LDA    unk_0_FFF7,Y

905E B9 F7 FF                LDA    unk_0_FFF7,Y

 

6EF8 BD FC FF                LDA    unk_0_FFFC,X
6F00 9D FC FF                STA    unk_0_FFFC,X
6F30 9D FC FF                STA    unk_0_FFFC,X

 

6EF5 9D FE FF                STA    unk_0_FFFE,X
6F28 BD FE FF                LDA    unk_0_FFFE,X
6F38 9D FE FF                STA    unk_0_FFFE,X

 

6EFB 9D FF FF                STA    unk_0_FFFF,X
6F2D BD FF FF                LDA    unk_0_FFFF,X
6F35 9D FF FF                STA    unk_0_FFFF,X
84FF B9 FF FF                LDA    unk_0_FFFF,Y
8F79 B9 FF FF                LDA    unk_0_FFFF,Y

 

Looks more like internal board representation or something :] I bet above is rather data then code.

Edited by zbyti

Share this post


Link to post
Share on other sites
1 hour ago, zbyti said:

I bet above is rather data then code.

"858E B9 F5 FF  LDA unk_0_FFF5,Y" = "<Address> <Bytes at that address> <Equivalent instruction>" so that's code, but I suspect you're referring to the data stored in the zero-page that this accesses?

 

@drac030 will know what he's looking at

 

Edited by Wrathchild
  • Like 1

Share this post


Link to post
Share on other sites
23 minutes ago, Wrathchild said:

"858E B9 F5 FF  LDA unk_0_FFF5,Y" = "<Address> <Bytes at that address> <Equivalent instruction>" so that's code, but I suspect you're referring to the data stored in the zero-page that this accesses?

accidentally maybe this looks like a code ;) or maybe some kind internal chess board representation in memory. https://www.chessprogramming.org/Board_Representation

 

most popular at that time was: https://www.chessprogramming.org/10x12_Board

Edited by zbyti

Share this post


Link to post
Share on other sites
3 hours ago, Wrathchild said:

858E B9 F5 FF                LDA    unk_0_FFF5,Y

903A B9 F5 FF                LDA    unk_0_FFF5,Y

...

This gave me right direction, thanks, there are indeed wrap-arounds at $6ec4-$6edc and $6ef9-$6f0e (both places being undoubtedly code).

 

But, what is baffling me: my binary file generally does not match your list. I have loaded the program without execution, but e.g. code at $903A is SBC #$09 and not what you listed above.

Share this post


Link to post
Share on other sites

Yep, I've got routines at $6EF3, $6F28 plus a number of individual references further on that index reference $FFFx addresses.

 

loc_0_6EF3:                ; CODE XREF: sub_0_6ED6+6�j
        LDA    unk_0_0,X
        STA    unk_0_FFFE,X
        LDA    unk_0_FFFC,X
        STA    unk_0_FFFF,X
        LDA    #0
        STA    unk_0_FFFC,X
        STA    unk_0_0,X
        STA    byte_0_C0
        STA    byte_0_C1
        LDA    #4
        RTS    
; End of function sub_0_6ED6

 

loc_0_6F28:                ; CODE XREF: sub_0_6F0C+9�j
        LDA    unk_0_FFFE,X
        STA    unk_0_0,X
        LDA    unk_0_FFFF,X
        STA    unk_0_FFFC,X
        LDA    #0
        STA    unk_0_FFFF,X
        STA    unk_0_FFFE,X
        LDA    #1
        RTS    
; End of function sub_0_6F0C

 

  • Like 1

Share this post


Link to post
Share on other sites

Replacing the absolute,X mode with zp,x (i.e. e.g. STA $FFFE,X with STA $FE,X) should fix the wrap-around problem. Or rather replace it with another wrap-around, but not so problematic this time.

Share this post


Link to post
Share on other sites
47 minutes ago, drac030 said:

Replacing the absolute,X mode with zp,x (i.e. e.g. STA $FFFE,X with STA $FE,X) should fix the wrap-around problem. Or rather replace it with another wrap-around, but not so problematic this time.

`STA $FFFE,X` why on Earth someone wants to lose cycle this way?

Share this post


Link to post
Share on other sites

Noone. That is the decision of the assembler ($xx-constant, where constant>$xx) without the coder knowing. Sadly, same with STA $FFFE,Y which is much harder to avoid.

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...