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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/27/07 13:05
Modified:
  05/27/07 13:25

Read: times


 
#139897 - Two equivalent functions
Responding to: ???'s previous message
Jan said:
Nobody in his right state of mind would implement this function in such way.

Indeed! So how did you get in such a crazy mood to create this thing? Too much sugar? Caffeine? (c:

Following are a couple more subroutines that do the same thing as the (corrected) original. Neither of them is as wild and crazy as Jan's routine, but it's not completely obvious what they do, either. I have a third solution that is smaller than the one at Quiz6, but it is straightforward, so I won't spoil the fun by posting it just yet.

-- Russ
Quiz5:  mov     b,a
        anl     a,#85
        xch     a,b
        rrc     a
        anl     a,#85
        add     a,b
        mov     b,a
        anl     a,#51
        xch     a,b
        rr      a
        rrc     a
        anl     a,#51
        add     a,b
        mov     b,a
        anl     a,#7
        xch     a,b
        swap    a
        anl     a,#7
        add     a,b
        ret

; --------------------------

Quiz6:  mov     b,#0
        jz      Quiz8
Quiz7:  mov     r0,a
        dec     r0
        anl     a,r0
        inc     b
        jnz     Quiz7
Quiz8:  mov     a,b
        ret



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