; ROUTINE: ZSYSCHK ; AUTHOR: Jay Sage ; DATE: April 15, 1988 ; This routine tries to assure that the program is running in a Z System ; environment. It takes the value passed in the HL registers and checks ; that it is pointing to a Z3ENV. It does this by checking for consistency ; with the ENV address stored at offset 1Bh. It also checks for the 'Z3' ; at offset 3. If the test passes, it will return with A=0 and the zero flag ; set. If it fails, it will display the message ; 'Program Requires Z System',bell ; ; This routine will provide the most secure test if the value passed to it ; is the one passed to the program in the HL register on load. Of course, ; this will excluded ZCPR30 systems, which do not pass the ENV address in HL. ; It will detect BGii and all versions of ZCPR3 since 3.3. public zsyschk extrn print bell equ 07h zsyschk: push hl push de ex de,hl ; Test ENV address into HL ld hl,3 ; Offset to 'Z3ENV' add hl,de ld a,(hl) cp 'Z' jr nz,notzsys inc hl ld a,(hl) cp '3' jr nz,notzsys ld hl,1bh ; Offset to ENV address in ENV add hl,de ld a,(hl) ; Check low byte cp e jr nz,notzsys inc hl ld a,(hl) ; Check high byte sub d jr z,zsyschk1 ; Return with A=0 and Z flag set if OK notzsys: call print defb 'Program Requires Z System',bell,0 xor a dec a zsyschk1: pop de pop hl ret end