home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / ENTERPRS / CPM / UTILS / S / ZCNFG21.LZH / CFGLIB.LZH / PKGOFF.Z80 < prev    next >
Text File  |  1992-11-03  |  896b  |  25 lines

  1.     ext    z3env
  2.     public    pkgoff
  3.  
  4. ; Calculate address of a package from Z3ENV.  On entry, E
  5. ; contains the offset to the address of the package in the environment.  On
  6. ; exit, DE points to the beginning of the package and HL points to the fifth
  7. ; byte (where the command table starts in the RCP and FCP modules).  The zero
  8. ; flag is set on return if the package is not supported.
  9.  
  10. pkgoff:
  11.     ld    hl,(z3env)    ; Point to beginning of ENV descriptor
  12.     ld    a,l
  13.     or    h        ;test for no z3env
  14.     ret    z
  15.     ld    d,0        ; Make DE have offset
  16.     add    hl,de        ; ..and add it
  17.     ld    e,(hl)        ; Get low byte of package address
  18.     inc    hl        ; Point to high byte
  19.     ld    d,(hl)        ; ..and get it
  20.     ld    a,d        ; Move full address into HL
  21.     or    e        ; Set zero flag if no package
  22.     ret            ; Return with zero flag set appropriately
  23.  
  24.     end
  25.