PDA

View Full Version : Help with understand assembly - LAB_ vs. LBL_ sections



turbo_bu
04-12-2017, 05:40 PM
I am trying to work my way through the 12202088 OS which someone very generously put up here as a disassembly. They were even so kind as to lay out what most of the code does. This has helped tremendously in my very limited understanding of what's going on. So much that I now have more questions :).


What the difference is between LBL_ and LAB_ commands. I am pretty sure that the LAB_ signifies a routine (or segment) for the code to jump to. There are several spots with branch commands that list LAB_xxx as the next step to go to in the code. Many times there are a bunch of them in a row with the code jumping to the next steps. I just started to notice that sometimes, segments of the code show a LBL_xxxx. In these segments, there are some memory steps / checks going on, and then there could be more branch or jump commands (JSR). Is there an inherent differnce between these two types of segments of code?

1project2many
04-13-2017, 04:56 AM
The disassembly you're working on is "relocatable." Variables, code sections, and tables are identified by names, or labels. If you modify or change the code, it can be fed to an assembler and the assembler will replace the names with actual line numbers.

LBL is used to indicate the start of a subroutine. The JSR instruction will have an EXT_#### with it. A lookup table in the beginning of the code translates The EXT_#### label to an address. EXT_0072 is an example that translates to location $01FE4.

LAB is used to indicate a location for a conditional branch. LAB addresses in code are generally translated by the assembler during the assembly process.

JSR will store values on the stack for the processor to use upon return. A subroutine is a small section of code which must be run to get a temporary or single stage result. When the processor is sent to complete a task in a subroutine it is expected that code will return. Then the processor will need to pick up where it left off. A branch OTOH is a one-way ticket to some other piece of code.

turbo_bu
04-13-2017, 04:26 PM
Thank you for the quick response. As I was reading more of the code, that was what I was thinking but didn't quite have the logic all figured out.

I do have another question, regarding when / how the outputs are triggered. After reading through where the status flags are changed, I am not sure that in effect does the actual changing of a given output (example being electric fan relays). At some point, aren't the DTC's checked to see if that output should be working or not? The code that I read goes through checking the qualifiers to turn something on .... then it goes through the checks to change the status flags. But does that really do it? I thought that at some point in the code it would need to check to see if the DTC for that output was turned on or not? I found the DTC's in the memory locations, but did not see where / how they got loaded or if they are being used during the status flag sections of the code.