Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/26/07 16:13
Read: times


 
#139875 - weekend-end quiz
What is the function of the following (deliberately uncommented) code?
Quiz:
   mov   b,#16
   mul   ab
   rlc   a
   jb    p,Quiz1
   jz    Quiz2
   mov   a,#2
   sjmp  Quiz2
Quiz1:
   addc  a,#22h
   jc    Quiz2
   anl   a,#03h
   dec   a
Quiz2:
   addc  a,#0
   xch   a,b
   rlc   a
   jb    p,Quiz3
   jz    Quiz4
   mov   a,#2
   sjmp  Quiz4
Quiz3:
   addc  a,#22h
   jc    Quiz4
   anl   a,#03h
   dec   a
Quiz4:
   addc  a,b
   ret


Yes, code, no program. Nobody in his right state of mind would implement this function in such way. There are at least two different and in all respects superior solutions.

Discuss, in which ways is this one broken.

Enjoy!

JW


List of 16 messages in thread
TopicAuthorDate
weekend-end quiz            01/01/70 00:00      
   How about this?            01/01/70 00:00      
      @#$%^&            01/01/70 00:00      
   Two equivalent functions            01/01/70 00:00      
      OK, I admit, 2:1            01/01/70 00:00      
         Nice variation!            01/01/70 00:00      
            shortest?            01/01/70 00:00      
               Eleven bytes. No tricks.            01/01/70 00:00      
                  The wayward path followed...            01/01/70 00:00      
   Deterministic Way            01/01/70 00:00      
      Yet another tweak            01/01/70 00:00      
         OMG....            01/01/70 00:00      
            You are forgiven            01/01/70 00:00      
   commented            01/01/70 00:00      
      Nastiness density increased            01/01/70 00:00      
   That looks like my assembly code.            01/01/70 00:00      

Back to Subject List