TITLE "Z3W2 - Z3lib 4.0" ;================================================================ ; The Libraries, Version 4, (C) 1989 by Alpha Systems Corp. ;---------------------------------------------------------------- ; Author : Harold F. Bower ; Derived from Z3W2.Z80 Ver 1.1 by Richard Conn ; Date : 15 Mar 87 ; Version : 1.2 ; Module : Z3W2 ; Abstract: This module contains the routine WAIT1MS which ; Pauses for approximately 1 millisecond ; Revision: ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; Module Entry Points PUBLIC WAIT1MS ; External References EXT GETSPEED .Z80 CSEG ;=============================================================== ; NAME - WAIT1MS ; Entry: - None ; Exit : - Nothing Returned, the Processor pauses approx 1 mS ; Uses : - None ; Special Requirements: None ;=============================================================== WAIT1MS: 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 E,19 ;Inner loop = 19*54 = 1026 cycles LOOP1: EX (SP),HL ;19 cycles EX (SP),HL ;+19 = 38 cycles DEC E ;+ 4 = 42 cycles JR NZ,LOOP1 ;+12 = 54 cycles DJNZ LOOP0 ;speed loop POP BC ;restore regs POP DE POP AF RET END