ext z3env public pkgoff ; Calculate address of a package from Z3ENV. On entry, E ; contains the offset to the address of the package in the environment. On ; exit, DE points to the beginning of the package and HL points to the fifth ; byte (where the command table starts in the RCP and FCP modules). The zero ; flag is set on return if the package is not supported. pkgoff: ld hl,(z3env) ; Point to beginning of ENV descriptor ld a,l or h ;test for no z3env ret z ld d,0 ; Make DE have offset add hl,de ; ..and add it ld e,(hl) ; Get low byte of package address inc hl ; Point to high byte ld d,(hl) ; ..and get it ld a,d ; Move full address into HL or e ; Set zero flag if no package ret ; Return with zero flag set appropriately end