TITLE "Z3W3 - Z3lib 4.0" ;================================================================ ; The Libraries, Version 4, (C) 1989 by Alpha Systems Corp. ;---------------------------------------------------------------- ; Author : Harold F. Bower ; Derived from Z3W3.Z80 Ver 1.1 by Richard Conn ; Date : 15 Mar 87 ; Version : 1.2 ; Module : Z3W3 ; Abstract: This module contains the routine WAITP1S which ; delays processing by approximately 0.1 seconds ; Revision: ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; Module Entry Points PUBLIC WAITP1S ; External References EXT GETSPEED .Z80 CSEG ;=============================================================== ; NAME - WAITP1S ; Entry: - None ; Exit : - Nothing returned. Processing suspended approx 0.1 sec ; Uses : - None ; Special Requirements: None ;=============================================================== WAITP1S: PUSH AF ;affect no regs PUSH DE PUSH BC CALL GETSPEED ;get processor speed JR NZ,W1 LD A,4 ;assume 4MHz if none given W1: LD B,A ;speed in B LOOP0: LD D,5 ;Outer loop = 5*19,995 = 99,975 cycles LOOP1: LD E,217 ;Inner loop = 217*92+31 = 19,995 cycles LOOP2: EX (SP),HL ;19 cycles EX (SP),HL ;+19 = 38 cycles EX (SP),HL ;+19 = 57 cycles EX (SP),HL ;+19 = 76 cycles DEC E ;+ 4 = 80 cycles JR NZ,LOOP2 ;+12 = 92 cycles DEC D ;outer loop JR NZ,LOOP1 DJNZ LOOP0 ;speed loop POP BC ;restore regs POP DE POP AF RET END