BSD 3 development
[unix-history] / usr / src / cmd / px / 24case.s
CommitLineData
89e1db16
CH
1#\f
2# 24case.s
3#
4# CASE OPERATORS
5#
6_CASE1OP:
7 cvtbw (r10)+,r0
8 bneq l2401
9 cvtwl (r10)+,r0 #r0 has length of case table
10l2401:
11 movaw (r10)[r0],r2 #r2 has pointer to cases
12 cvtwb (sp)+,r3 #r3 has case element to find
13 locc r3,r0,(r2) #find case element
14 beql caserr #case not found
15offset:
16 mnegl r0,r0 #calc new lc
17 cvtwl (r2)[r0],r1
18 addl2 r1,r10
19 jmp (r8)
20_CASE2OP:
21 cvtbl (r10)+,r0
22 bneq l2402
23 cvtwl (r10)+,r0 #r0 has length of case table
24l2402:
25 movaw (r10)[r0],r1 #r1 has pointer to cases
26 movl r1,r2 #save base pointer
27 movw (sp)+,r3 #r3 has case element to find
28l2403:
29 cmpw r3,(r1)+ #search for case
30 beqlu offset
31 sobgtr r0,l2403
32 brb caserr #not found
33_CASE4OP:
34 cvtbl (r10)+,r0
35 bneq l2404
36 cvtwl (r10)+,r0 #r0 has length of case table
37l2404:
38 movaw (r10)[r0],r1 #r1 has pointer to cases
39 movl r1,r2 #save base pointer
40 movl (sp)+,r3 #r3 has case element to find
41l2405:
42 cmpl r3,(r1)+ #search for case
43 beqlu offset
44 sobgtr r0,l2405
45caserr:
46 movw $ECASE,_perrno
47 jbr error