DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Assembly (http://www.daniweb.com/forums/forum125.html)
-   -   Correct me if i'm wrong pls..... (http://www.daniweb.com/forums/thread191009.html)

j_cart007 May 7th, 2009 6:12 pm
Correct me if i'm wrong pls.....
 
here is my Caesar cipher code, can u pls have a look at it and correct me if i'm wrong.

                AREA    text, CODE      

SWI_Exit        EQU        &11
SWI_WriteC        EQU        &0

                ENTRY                 

                ADR        r4, hello     
                ADR        r3, alpha
                ADR        r2, key
loop           
             
                LDRB    r0, [r4], #1   
                STRB        r0, [r4], #1
                CMP    r0, #0         
                BNE        check
                SWI_Exit 0x11
check         
                LDRB        r1, [r3], #1
                STRB        r1, [r3], #1
                CMP        r0, r1
                BNE        encrypt
                      B        loop       
encrypt
                LDRB        r5, [r2], #1
                STRB        r5,[r2], #1
                MOV        r0, r5
                STRB        r0,[r4], #1
                SWINE        SWI_WriteC               
                BEQ        endP
                B        loop       

hello        DCB    "THIS MESSEGE IS GOING TO BE ENCRYPTED ",0
alpha        DCB        "ABCDEFGHIJKLMNOPQRSTUVWXYZ",0
key        DCB        "XZYCJBTEKMGHONPEDCBAVWQLRU",0


endP

        MOV        pc, lr                        ; return
        END


All times are GMT -4. The time now is 4:05 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC