Search code examples
8051

Self Modifying Code 8051


Let p0.0 be set to receive inputs and that it switches ON only once with an initial value 0f 0. Assuming that 8051 follows a regular Von Neumann Architecture , how can the number of cycles can be reduced? The code is:

BACK :JNB P0.0,SKIP
DO_SOMETHING: CALL FIRST
SKIP: CALL SECOND                
SJMP BACK

I just know that Self Modifying Code is to be used but don't know how to implement it.


Solution

  • I found the solution to it:

    JNB P0.0,SKIP
    DO_SOMETHING: CALL FIRST
    SKIP: CALL SECOND                
    NOP