>
> Date: Fri, 2 Oct 2015 13:57:34 -0400
> From: Scott Ford <[email protected]>
> Subject: Branch table
>
> All:
>
> I am building a branch table like this:
>
BTAB DSECT
BADD DS A Routine address
BFUN DS CL10 Function code
DS 0A Align to next item
BLEN EQU *-BADD One item length
PROG CSECT , (or LOCTR)
* ---------------------------------------------------
FUNC DS CL(L'BFUN) Input
FUNCTBL DS 0A Table
DC A(INIT_DSP),CL(L'BFUN)'INIT'
DC A(KILL_DSP),CL(L'BFUN)'KILL'
DS 0A Align end
TBLENT EQU (*-FUNCTBL)/BLEN
* ---------------------------------------------------
LA R4,FUNCTBL Start of table
USING BTAB,R4
LHI R5,TBLENT Item count
LOOPTBL DS 0H
CLC FUNC,BFUN This one?
JE FOUND_IT Yes - handle
JCT R5,LOOPTBL No - try next
J ENDOFDAYS Not found
FOUND_IT DS 0H
L R15,BADD Routine address
DROP R4
BASR R14,R15 Execute routine
* etc...
* ---------------------------------------------------