string-proc-eg - LDMFD SP{r1-r4 lr Restore Registers MOV pc...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 380 String Processing Example Memory Map strng = 0xA0B4 char_cnt = 0xA0C0 Notice need for alignment Pad byte at 0xA0BF String: “Password: “ Task Write a subroutine which returns the number of occurrences of the letter ‘s’ Code strng = "Password: ",0 ; NULL terminated string char_cnt STMFD SP!, {r1-r4, lr} ; Spill Registers MOV r4, #0 LDR r2, =strng LOOP LDRB r3, [r2] ADD r2, r2, #1 CMP r3, #0x73 ; Character to be counted BNE NEXT ADD r4, r4, #1 ; Char found-increment count NEXT CMP r3, #0 ; Null termination BNE LOOP MOV r0, r4
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: LDMFD SP!, {r1-r4, lr} ; Restore Registers MOV pc, lr References ARM Developer Suite Version 1.0 Getting Started , ARM Limited, 1999 Steve Furber, ARM System-on-chip Architecture , 2 nd Edition, Addison-Wesley, 2000 David Seal, editor, ARM Architecture Reference Manual , 2 nd Edition, Addison-Wesley, 1996-2000 Address 0x0A0BA 0x0A0B4 0x0A0BC 0x0A0B6 0x0A0BE 0x0A0B8 0x0A0C0 0x0A0C2 Contents 0x5061 0x7373 0x776F 0x7264 0x3A20 0x0000 0x1E40 0x2DE9...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online