Kasumi wrote:unregistered wrote:In nintendulator it pops up a small box that says "Bad opcode, CPU locked". So that is different...

Just for the record, this specifically means your program has hit an invalid instruction. It usually happens when your program counter runs through data instead of code.

This should be a fairly easy one to debug by logging, because it's pretty likely the program halts very soon after the issue, instead of a wild goose chase when it could be anything like before.

Debug by logging! Thank you Kasumi! Thanks also Dwedit and smkd... yall's suggestions will help me too.

Ok, well I found something happened here's the code

Code: Select all

`0C23C 68 pla ;<---------------------------------------------------------0`

0C23D ;now our attributetable is ready to be written

0C23D ;SO WE WRITE!!

0C23D

0C23D C9 14 cmp #20

0C23F F0 0D beq +

0C241

0C241 A9 23 lda #$23

0C243 8D 06 20 sta $2006 ;Sets the high byte of the address $2007 will write to.

0C246 A9 C0 lda #$C0

0C248 8D 06 20 sta $2006 ;Sets the low byte of the address $2007 will write to.

0C24B 4C 58 C2 jmp +write

0C24E

0C24E A9 27 + lda #$27

0C250 8D 06 20 sta $2006 ;Sets the high byte of the address $2007 will write to.

0C253 A9 C0 lda #$C0

0C255 8D 06 20 sta $2006 ;Sets the low byte of the address $2007 will write to.

0C258

0C258 +write:

0C258 BD F0 04 - lda attributes, x

0C25B 8D 07 20 sta $2007

0C25E E8 inx

0C25F E0 3F cpx #63

0C261 ; ; dex

0C261 D0 F5 bne -

0C263

0C263 60 rts ;end of attributetable ********************************************************

and here is the end-part of my logging...

Code: Select all

`C25E:E8 INX A:55 X:3C Y:00 P:nvUbdizc`

$C25F:E0 3F CPX #$3F A:55 X:3D Y:00 P:nvUbdizc

$C261:D0 F5 BNE $C258 A:55 X:3D Y:00 P:NvUbdizc

$C258:BD F0 04 LDA $04F0,X @ $052D = #$55 A:55 X:3D Y:00 P:NvUbdizc

$C25B:8D 07 20 STA $2007 = #$00 A:55 X:3D Y:00 P:nvUbdizc

$C25E:E8 INX A:55 X:3D Y:00 P:nvUbdizc

$C25F:E0 3F CPX #$3F A:55 X:3E Y:00 P:nvUbdizc

$C261:D0 F5 BNE $C258 A:55 X:3E Y:00 P:NvUbdizc

$C258:BD F0 04 LDA $04F0,X @ $052E = #$55 A:55 X:3E Y:00 P:NvUbdizc

$C25B:8D 07 20 STA $2007 = #$00 A:55 X:3E Y:00 P:nvUbdizc

$C25E:E8 INX A:55 X:3E Y:00 P:nvUbdizc

$C25F:E0 3F CPX #$3F A:55 X:3F Y:00 P:nvUbdizc

$C261:D0 F5 BNE $C258 A:55 X:3F Y:00 P:nvUbdiZC

$C263:60 RTS A:55 X:3F Y:00 P:nvUbdiZC

$0001:00 BRK A:55 X:3F Y:00 P:nvUbdiZC

$C3DB:40 RTI A:55 X:3F Y:00 P:nvUbdIZC

$0003:00 BRK A:55 X:3F Y:00 P:nvUBdiZC

$C3DB:40 RTI A:55 X:3F Y:00 P:nvUBdIZC

$0005:8B UNDEFINED A:55 X:3F Y:00 P:nvUBdiZC

$0007:00 BRK A:00 X:3F Y:00 P:nvUBdiZC

$C3DB:40 RTI A:00 X:3F Y:00 P:nvUBdIZC

$0009:00 BRK A:00 X:3F Y:00 P:nvUBdiZC

$C3DB:40 RTI A:00 X:3F Y:00 P:nvUBdIZC

$000B:00 BRK A:00 X:3F Y:00 P:nvUBdiZC

$C3DB:40 RTI A:00 X:3F Y:00 P:nvUBdIZC

$000D:C7 UNDEFINED A:00 X:3F Y:00 P:nvUBdiZC

$000F:00 BRK A:00 X:3F Y:00 P:nvUBdizc

$C3DB:40 RTI A:00 X:3F Y:00 P:nvUBdIzc

$0011:CC 00 00 CPY $0000 = #$FF A:00 X:3F Y:00 P:nvUBdizc

$0014:00 BRK A:00 X:3F Y:00 P:nvUBdizc

$C3DB:40 RTI A:00 X:3F Y:00 P:nvUBdIzc

$0016:00 BRK A:00 X:3F Y:00 P:nvUBdizc

$C3DB:40 RTI A:00 X:3F Y:00 P:nvUBdIzc

$0018:00 BRK A:00 X:3F Y:00 P:nvUBdizc

$C3DB:40 RTI A:00 X:3F Y:00 P:nvUBdIzc

$001A:00 BRK A:00 X:3F Y:00 P:nvUBdizc

$C3DB:40 RTI A:00 X:3F Y:00 P:nvUBdIzc

$001C:02 UNDEFINED A:00 X:3F Y:00 P:nvUBdizc

$001C:02 UNDEFINED A:00 X:3F Y:00 P:nvUBdizc

$001C:02 UNDEFINED A:00 X:3F Y:00 P:nvUBdizc

$001C:02 UNDEFINED A:00 X:3F Y:00 P:nvUBdizc

A:00 X:3F Y:00

until I stopped the logging.

It hits the rts and then it runs memory location $0001 and then it runs the RTI at $C3DB... over and over... Im confused!