home *** CD-ROM | disk | FTP | other *** search
- ;
- ; Z3LIB Module Name: Z3GIOX (general IOP support)
- ; Author: Richard Conn
- ; Z3LIB Version Number: 1.3
- ; Module Version Number: 1.1
- ;
- public putiod,getion,getios
-
- ext envptr,getiop
-
- ;
- ; PUTIOD selects the device indicated by logical id in B and physical
- ; selection in C. B is the number of the logical device, where CON: = 0,
- ; RDR: = 1, PUN: = 2, and LST: = 3. Return with A=0 and Zero Flag Set if
- ; error.
- ;
- ; Only PSW is affected.
- ;
- putiod:
- push hl ; save regs
- push de
- push bc
- call getioc ; get IOP address and check
- jp z,iodret
- ld de,iodret ; set return address
- push de ; ... on stack
- inc hl ; pt to routine
- inc hl
- inc hl
- jp (hl) ; "call" SELECT routine
- iodret:
- pop bc ; restore regs
- pop de
- pop hl
- ret ; error flags set by NAMER in IOP
-
- ;
- ; GETION returns a pointer to the string describing the device
- ; whose logical number is in B and physical selection in C. This pointer
- ; is in HL. If no error, return with HL pointing to the string (terminated
- ; by a null) and A=0FFH with NZ. If error (such as no IOP), A=0 and Z
- ; on return.
- ;
- getion:
- call getioc ; get IOP address and check
- ret z
- push de ; save regs
- push bc
- ld de,ionret ; set return address
- push de ; ... on stack
- ld de,6 ; pt to routine
- add hl,de
- jp (hl) ; "call" NAMER routine
- ionret:
- pop bc ; restore regs
- pop de
- ret ; error flags set by NAMER in IOP
-
- ;
- ; GETIOS returns a pointer to the I/O Package status table
- ; in HL. This table is structured as follows:
- ;
- ; Number of Current
- ; Bytes Device Devices Assignment
- ; ----- ------ --------- ----------
- ; 0-1 CON: Byte 0 Byte 1
- ; 2-3 RDR: Byte 2 Byte 3
- ; 4-5 PUN: Byte 4 Byte 5
- ; 6-7 LST: Byte 6 Byte 7
- ;
- ; GETIOS returns A=0 and Zero Flag Set if no IOP loaded.
- ; If loaded, A=0FFH and NZ and HL = address of table
- ;
- getios:
- call getioc ; check for I/O
- ret z
- jp (hl) ; run routine
-
- ;
- ; Return the address of the IOP in HL if exists and is loaded; return
- ; A=0 and Z if error, A<>0 and NZ if OK
- ;
- getioc:
- call getiop ; get I/O Package address
- ret z
- ld a,(hl) ; check for loaded I/O Package
- or a
- ret z
- ld a,0ffh ; OK
- ret
-
- end