View previous topic :: View next topic
|
Author |
Message |
satish.ms10
Active User
Joined: 10 Aug 2009 Posts: 184 Location: India
|
|
|
|
Hi All,
I am analysing an Assembler program and I am not able to understand the below code.
Code: |
CLI RPPTR(R14),X'FE'
NC RPEX(,R14),RPEX(R14)
BNZ RTRNLD
RPPTR EQU X'08',04,C'F'
RPEX EQU X'0C',04,C'F' |
Could someone explain me the functionality and the relationship between CLI and NC statements.
Thanks in advance. |
|
Back to top |
|
|
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
Read the discussion of the two operations in Principles of Operation. If there is something you do not understand, ask here.
Another important difference is the NC instruction operates on 4 bytes of data since you defined the length of RPEX as 4. The CLI instruction operates on one byte of data.
Both instructions set the condition code. Since you do not provide a conditional branch instruction after the CLI instruction, it effectively does nothing since the NC instruction resets the condition code.
To me, neither instruction, as coded, makes any sense at all. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Code: |
Set thing to test by Method 1
Set thing to test by Method 2
Test thing to test |
Method 1 is superfluous. Perhaps someone inserted the Method 2 without realising its effects, and perhaps it looked like it was working, but was not well tested. Or put the CLI in without a clue of what they were doing. Or deleted something interpreting the first condition code setting. Or something else.
The code at RTRNLD may give you some clues as which was there first, so which the BNZ was originally intended for.
Also, look to your Source Management system and see the change, what it was connected to, who did it, and go at it that way. |
|
Back to top |
|
|
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
Bill - BNZ is not commonly used after a CLI, though it is the same as BNE. Condition code 00 will not be set by the NC unless all the bits are 0; I can only conclude the NC is what I would regard as a confusing way to test if the 4 bytes are binary 0s.
Since all we have are the confused EQU statements and instructions that specify the symbols used in the EQU statements, it is difficult to make any conclusion about the intent of the code. Worse, the EQU for RBPTR identifies the presumed data area as 4 bytes, but the CLI just tests 1 byte. |
|
Back to top |
|
|
|