Transforms DH1080 global state into context.

DH1080 functions now receive a context variable,
instead of relying on static variables to store state.