What the hell is happening here?

Anything QL Software or Programming Related.
Post Reply
User avatar
NormanDunbar
Forum Moderator
Posts: 2470
Joined: Tue Dec 14, 2010 9:04 am
Location: Buckie, Scotland
Contact:

What the hell is happening here?

Post by NormanDunbar »

Here's a nice one to try and help me solve! You wonlt like it.

I'm running QPC2 v5.01 and I'n using QMON to trace a problem in some code I've written. The gist of which is:

Code: Select all

start movem.l d6/a3,-(a7)
      ...
      movem.l (a7)+,d6/a3
      rts
When I disassemble this code in DISA v3, I see the same as the above.

When I EXEC the code, it's part of a job, I see this in QMON:

Code: Select all

start movem.l d6/a3,-(a7)
      ...
      movem.l (a7)+,D5/a3  <<<<<<<<<<<<<<<
      rts
WTAF?

And, what's worse, it is actually restoring D5 rather than D6 and borking my program. The original source code uses D6/A3 in both locations, DISA sees the correct disassembly on disc, but for some reason, when it executes, it's stacking D6/A3 and restoring D5/A3. It's driving me bonkers!

I have been executing this from ram1_. In order to be sure, I've deleted everything from ram1_ and reassembled the code, still the same problem.

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
pjw
QL Wafer Drive
Posts: 1610
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: What the hell is happening here?

Post by pjw »

Norm, it probably depends on what else is going on in your code. Looks like something is overwriting something else..
ACDF0840 -> 4CDF0820. That 0820 looks suspiciously like a float exponent..
Just my $0.01 worth


Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
User avatar
NormanDunbar
Forum Moderator
Posts: 2470
Joined: Tue Dec 14, 2010 9:04 am
Location: Buckie, Scotland
Contact:

Re: What the hell is happening here?

Post by NormanDunbar »

Thanks Per, but it's not that, I'm not using any self modifying code, I have nothing in the job's data space that I'm writing back to, so I'm thinking it's not that. The code that's wrong is close to the start of the job itself, and at that point nothing is doing any writing to the job's own code, other than a bsr or two, and the usual movem.l onto and off of the stack. Another section of the cod does stack D5 and A3, but also, and correctly, unstacks the correct registers. It's just this one sub routine that's seemingly borked.

I'm going to use qmon to grab the actual job address in RAM and disassemble with DISA at that address, just to see what's happening. I'm seriously confused at this point!

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
pjw
QL Wafer Drive
Posts: 1610
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: What the hell is happening here?

Post by pjw »

Grrr, dont you just hate it! Bugs drive me nuts! Good luck with that. You WILL conquer this! :)
PS I was thinking typo rather than deliberately self-modifying.


Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
User avatar
NormanDunbar
Forum Moderator
Posts: 2470
Joined: Tue Dec 14, 2010 9:04 am
Location: Buckie, Scotland
Contact:

Re: What the hell is happening here?

Post by NormanDunbar »

Found it!!!!! :D

It was a PICNIC. :(

Problem in chair, not in computer!

I have two subroutines with a dbeq loop in both. The first saves D5 and the second, the troublesome one, D6. In the first loop, I dbeq d0,irCheckCell and in the second, it's dbeq d0,irCheckCell when it should be dbeq d0,icCheckCell. I copied and pasted, changed the label names but didn't change the dbeq so it's skipping back to the wrong looping bit, running out of D0 and then restoring the registers used in the other subroutine!

I'm a dork!

Thanks anyway.


Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
NormanDunbar
Forum Moderator
Posts: 2470
Joined: Tue Dec 14, 2010 9:04 am
Location: Buckie, Scotland
Contact:

Re: What the hell is happening here?

Post by NormanDunbar »

pjw wrote:PS I was thinking typo rather than deliberately self-modifying.
You know me too well! It was indeed a typo.

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Post Reply