30 lines
539 B
ArmAsm
30 lines
539 B
ArmAsm
|
.define .csa
|
||
|
|
||
|
.text
|
||
|
.csa:
|
||
|
movem.l d0/a0/a1/a2,.savreg
|
||
|
move.l (sp)+,a0 ! case descriptor
|
||
|
move.l (sp)+,d0 ! index
|
||
|
move.l (a0)+,a1 ! default address
|
||
|
sub.l (a0)+,d0 ! index - lower bound
|
||
|
blt 1f
|
||
|
cmp.l (a0)+,d0 ! rel. index <-> upper - lower bound
|
||
|
bgt 1f
|
||
|
asl.l #2,d0
|
||
|
add.l d0,a0
|
||
|
move.l (a0),d0 ! test jump address
|
||
|
beq 1f
|
||
|
move.l d0,-(sp)
|
||
|
bra 3f
|
||
|
1:
|
||
|
move.l a1,d0 ! test default jump address
|
||
|
beq 2f
|
||
|
move.l a1,-(sp) ! jump address
|
||
|
3:
|
||
|
movem.l .savreg,d0/a0/a1/a2
|
||
|
rts ! not a real rts
|
||
|
2:
|
||
|
move.w #ECASE,-(sp)
|
||
|
jmp .fat
|
||
|
.align 2
|