;
;----- CALL: Small-C arithmetic and logical library
;
; Modified for 8088/8086....
; which is why there's not much in it.
; --RG
;
; EXECUTE "SWITCH" STATEMENT
;
;  BX  =  SWITCH VALUE
; (SP) -> SWITCH TABLE
;         DW ADDR1, VALUE1
;         DW ADDR2, VALUE2
;         ...
;         DW 0
;        [JMP default]
;         continuation
;
 INCLUDE PROLOG.H
 PUBLIC _CCSWITCH
_CCSWITCH:
  POP SI	;Pointer to switch table
  CLD           ;INCREMENT
SWLOOP:
  LODSW		;Get address
  MOV DX,AX
  OR DX,DX	;Zero? (i.e., end of table?)
  JZ SWEND
  LODSW		;Get value
  CMP AX,BX	;See if match
  JNE SWLOOP
  JMP DX
SWEND:
  JMP SI
  PUBLIC _CCARGC
_CCARGC:
   CBW
   MOV BX,AX
   RET
;
 INCLUDE EPILOG.H
      END
