; 8086 C Runtime Li b r a r y

; W. Duvall, Jun 1, 1981 12:37 PM
; L. Stewart, December 17, 1981  2:21 PM

C←CODE SEGMENT

ASSUME CS:C←CODE

DEFINE JR = JMP#
DEFINE JRC = JC#
DEFINE JRZ = JE#
DEFINE JRNC = JNC#

; SWITCH STATEMENT SUPPORT

; DISPATCHW
; BX = TEST WORD
; BYTES FOLLOWING CALL ARE FOURS: WORD, ADDRESS 
; TERMINATED BY XWORD 0 IN LIST


DISPATCHW:  PUBLIC DISPATCHW 

MOV DX,BX; VALUE
POP BX; GET RETURN LOC (ADDRESS OF TABLE) INTO BC

DISWLOOP: 
; START OF LOOP
MOV AX,[BX]; TEST WORD

; SEE IF 0
OR AX,AX
JRZ DISWGO

CMP AX,DX; SEE IF EQUAL
JRZ DISWGO
ADD BX,4
JR DISWLOOP

DISWGO:
ADD BX,2
MOV BX,[BX]; ADDRESS
JMP BX; GO TO IT

C←CODE ENDS