LOCC

VAX11

 

LOCC SKPC     LOCATE CHARACTER, SKIP CHARACTER

 

Purpose

to find or skip character in character string

Format

opcode char.rb, len.rw, addr.ab

Operation

Compare each character until equal (LOCC) or not equal (SKPC).

Z set if condition not satisified.

Condition codes

N ß 0;

Z ßR0 EQL 0;

V ß 0;

C ß 0;

Exceptions

None

Opcodes

3A       LOCC             Locate Character

3B        SKPC              Skip Character

Description

The character operand is compared with the bytes of the string specified by the length and address operands. Comparison continues until equality is detected for the Locate Character instruction or inequality for the Skip Character instruction or until all bytes of the string have been compared. If equality is detected for the Locate Character instruction, the condition code Z bit is cleared; otherwise the Z bit is set. If inequality is detected for the Skip Character instruction, the condition code Z bit is cleared: otherwise the Z bit is set.

Notes

1. After execution:

R0 = number of bytes remaining in the string (including located one) if byte located; otherwise R0 = 0.

R1 = address of the byte located if byte located; other R1 = address of one byte beyond the string.

2. It the string has zero length, condition code Z is set just as though each byte of the entire string were equal (unequal) to the character.

 

 

Example 1

 

.text

main: .word 0

      locc $32, $len, str

      pushl r0

      pushal format

      calls $2, .printf

 

      pushl $0

      calls $1, .exit

.data

.set len, 11

str:  .asciz "abc def ghi"

format: .asciz "Characters left: %d\n"