Electronics > Beginners
Assembly code Help! PIC16F57
<< < (5/32) > >>
jpanhalt:

--- Quote from: KL27x on September 29, 2018, 09:46:48 pm ---Why on god's earth would you disassemble assembly when you are looking at the source code?

--- End quote ---

In my experience, it can be quite quite useful to see how the assembler assembled the code, particularly when there are questions about memory usage and duplicate equates.  That original code is a mess, disassembly may help sort it out.  I am assuming he is using MPLAB SIM to know where the code fails. 

We each have our own way to troubleshoot unusual problems, assuming you write Assembly often, that is one way.  Please define your use of "source code."  Isn't C or any other high-level language also source code?
KL27x:
Yeah, but C gets compiled. Disassembly shows you what the compiler wrote in assembly.
If you disassemble assembly source code, you get assembly but without headers and tabbing/spacing and variable/constant names that was present in the source code!
In this case "source code" means having the assembly in human form, rather than dissembled from reverse from just the hex file.

You can view the list file if you want to see how the assembly code is placed in sequence by the assembler, rather than disassembling. This would be useful if you are afraid your addPCL instruction might be rolling over past a byte boundary, for instance. But in this case, the coder has org 200 before and  org 300 after those pcl instructions. So this is already proofed in in the source code, which is preferable.
KL27x:
OP: scrolling further, counter_hi is also used in other areas: auto1/2/3 and win2

So I can write you a foolproof solution, if this doesn't work, by utilizing an additional bit of general memory that is only used by feature/pattern. It is often easier to do it this way and potentially use up more memory and code than to reverse engineer existing code.
Electrofinn:
I love how you encapsulated that so I can see what was changed and what to put back if it doesn't work. brilliant.

just testing now, so far so good. will report back.
rstofer:
And yet, sometimes, it is helpful to have a core dump whether a disassembly or actual dump.  That way you are forced to think about every instruction.  There is no slipping past something because the 'name' seems right.  You are dealing only with actual hardware addresses.

No, it wasn't fun on the 8080s and Z80s back in the day.  Digital Research's Dynamic Debugging Tool (DDT) was my best friend.  Such as it was...

And, no, I don't want to go back to those days but on the mid-range PICs you are almost there anyway.  What an ugly architecture!

Navigation
Message Index
Next page
Previous page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod