The Tic-Tac-Toe debugging thread

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
CartCollector
Posts: 122
Joined: Mon Oct 30, 2006 8:32 pm

The Tic-Tac-Toe debugging thread

Post by CartCollector »

I'm starting new project (Tic-Tac-Toe) and it gives me a flash of grey for one frame and then nothing when I load it into an emulator (Nestopia even says "CPU jam!"). Why won't it load? Download the file here.
Last edited by CartCollector on Sat Jun 09, 2007 9:32 pm, edited 2 times in total.
User avatar
Memblers
Site Admin
Posts: 3902
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Post by Memblers »

The vectors are all $FFFF, FCEUltra's debugger and memory viewer showed me that pretty quickly. I see you're using nesasm, it's just not working as one would expect. I think you only need to put another .bank command before you do the .org $FFFA.
CartCollector
Posts: 122
Joined: Mon Oct 30, 2006 8:32 pm

Post by CartCollector »

Thanks Memblers, that worked. Now to finish the game...
CartCollector
Posts: 122
Joined: Mon Oct 30, 2006 8:32 pm

Post by CartCollector »

I now have a new problem. For some reason, my joypad-reading routine always shows that A is pressed (#%10000000). Why? Newest build available here.
albailey
Posts: 177
Joined: Thu Jul 13, 2006 3:15 pm

Post by albailey »

I dont have nesasm but I was able to mostly convert it to CA65 and could reproduce the problem.

I believe this is because of the ROL call later in the PadLoop

From the 6502 simulator docs.
ROL shifts all bits left one position. The Carry is put in bit 0, and bit 7 becomes the carry.

Looks like you had a carry flag set when entering the subroutine so the next call to ORA P1Pad always sets the bit.


I was able to fix it by adding "CLC" right after entering the subroutine(right after the "ReadPad:" line)


Al
Post Reply