14474RE: Re: [cosmacelf] RE: Chess Program Bug
- Oct 5, 2013
Yeah, the FF command was processed in this code:
xri $CF ; Computer move First?
lbz L0827 ; If so, go to COMPUTER MOVES FIRST
xri $03 ; Clear Code?
bz L007F ; If so, clear current input codes
xri $33 ; Master clear ( hex FF ) ?
bz L0000 ; If so, branch to initialize
Which branches to address 0000 here:
L0000: sex r0 ; x = r0; p = r0
plo r3 ; r3 = 0008; Jump to L0008 after dis
dis ; Interrupt disable
db $23 ; x = r2; p = r3
L0008: ldi $0F ; Jump here to start new game
When the program starts r0 is the PC. After the dis instruction r3 is the PC. Later in the program r0 is used for the subroutine pointer and r0.1 = 0B. After a FF command there was a branch to L0000 and the PC high byte is loaded with 0B and it crashes. The bz L0000 should be bz L0008.
There's other bugs too that I haven't fixed yet. When the program see a stalemate it'll always take it even thou it has a huge advantage and the CA command to change the search depth limit doesn't work. I think this program was never published because it has a lot problems.
---In firstname.lastname@example.org, <email@example.com> wrote:That's A Good Place, I Guess It Time To Start Documenting Bug Fixesyou mentioned, a problem with the FF command, What was that one?----- Original Message -----From: system3025Sent: Saturday, October 05, 2013 8:45 PMSubject: [cosmacelf] RE: Chess Program Bug
You're right. Only register E low byte is initialize to 0 at the start at address 0029. There should be a PHI RE with it too. I do see a quick fix though. Register D high byte is initialize to 0 at 0027. That register is used as a random number variable by increment it while waiting for the IN button to be depressed in the ACCEPT INPUT routine. So it doesn't need to be initialized. You can change the byte BD to BE at address 0027. That'd initialize E high byte to 0. I just tried it and it works.
---In firstname.lastname@example.org, <email@example.com> wrote:I ran across another bug,
here's the situation,
I was running my elfexe. stepping through program,
got up to point for first move , entered 10 20, so I hit C (continue) after
a spell its first move is 00 00.
so i tried it in mike rileys emulator, works fine , with first move 63 43
so i have been working on finding a bug in my exe.
but that is not what i found, on my emulator all registers except 0 start
out at FFFF.
Register E High byte is used as a flag holder, and is not set up properly.
- << Previous post in topic Next post in topic >>