Ðề tài: help me!code??
View Single Post
Old 03-01-2011, 05:07 AM   #2
KVLV
Đệ tử 2 túi
 
Tham gia ngày: Aug 2010
Bài gửi: 42
:
tôi chưa thử nên không biết, cái code này tôi copy từ 1 program khác.
Code:
;****************************************************************
;* RANDOM     : Generate random number                          *
;*                                                              *
;* Input      : R0 = seed                                       *
;* Output     : R0 = result                                     *
;*                                                              *
;* Notes      : 24 cycles including call and DONE.              *
;****************************************************************

;    ifdef RANDOM_USED
;  LIST
RANDOM  movf    R0 + 1, W       ; 1     Assure Seed <> 0
        iorwf   R0, W           ; 1
        btfsc   STATUS, Z       ; 1 / 2 Nudge Seed to 1
        incf    R0, F           ; 1 / 0
        movlw   80h             ; 1     Tap Bit 15
        btfsc   R0, 4           ; 1 / 2 Tap Bit 4
        xorwf   R0 + 1, F       ; 1 / 0
        btfsc   R0, 2           ; 1 / 2 Tap Bit 2
        xorwf   R0 + 1, F       ; 1 / 0
        btfsc   R0, 1           ; 1 / 2 Tap Bit 1
        xorwf   R0 + 1, F       ; 1
        rlf     R0 + 1, W       ; 1     C = New Bit
        rlf     R0, F           ; 1     Rotate Left
        rlf     R0 + 1, F       ; 1
;	return

;        goto    DONE            ; 8 + 2 Done
;  NOLIST
;DONE_USED = 1
;    endif
KVLV vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn