ECE 353 Introduction to Microprocessor Systems. Michael J. Schulte. Week 5. Flags Register Bit manipulation Logical Instructions Shift/Rotate Instructions Branching Conditional Unconditional Looping Structured Programming Stack Allocation and Operation. Topics. FLAGS Register.
Michael J. Schulte
Write a code fragment that implements the C function strchr, which finds a given character in an ASCIIZ string.
strchr scans the string in the forward direction, looking for the specified character and finds the first occurrence of the character in the string. The null-terminator is considered to be part of the string.
Assume the following initial conditions:
AL - character to search for
DS:DI - address of null-terminated string to search
(string must not start at offset of zero!)
If found, set AX = equal offset of first occurrence, otherwise set AX = 0.