;==============================================================================
; :
; This program is available from: :
; :
; Rho Enterprises :
; 4100 W. Colfax Ave. :
; Box 33 :
; Denver, CO 80204 :
; :
; Phone: 720-359-1467 Email: info@rhoent.com :
; :
; http://www.rhoent.com/ :
; :
;==============================================================================
;
;DELM.isx by Eric Smith and Richard Ottosen 14-FEB-2000
;
;
;This routine is for the SX parts in Turbo mode only. It does not matter if the
; Carry fuse is set or clear.
;
;Macro to delay for M number of cycles from 0 through 65535.
; The macro includes paging for long calls.
;
;Uses the routine "DelW" to do the short delays and uses the variable "DelMCnt"
; as well for long delays.
;The constants 5 and 15 must be loaded into variables "Five" and "Fifteen"
; before DelM is used.
;
;
DelM MACRO _MM
;*** LOCAL _MM
IF LOW(_MM) ==0 ;No delay at all
ENDIF
IF LOW(_MM) ==1
NOP ;Delay 1 cycle inline
ENDIF
IF LOW(_MM) ==2
NOP ;Delay 2 cycles inline
NOP
ENDIF
IF LOW(_MM) ==3
GOTO $+1 ;Delay 3 cycles inline
ENDIF
IF LOW(_MM) ==4
GOTO $+1 ;Delay 4 cycles inline
NOP
ENDIF
IF LOW(_MM) ==5
GOTO $+1 ;Delay 5 cycles inline
NOP
NOP
ENDIF
IF LOW(_MM) ==6
GOTO $+1 ;Delay 6 cycles inline
GOTO $+1
ENDIF
IF LOW(_MM) ==7
ERRORLEVEL -306
PAGEX Delay6>>9
CALL Delay6 ;Delay 7 cycles
ERRORLEVEL +306
ENDIF
IF LOW(_MM) ==8
ERRORLEVEL -306
PAGEX Delay7>>9
CALL Delay7 ;Delay 8 cycles
ERRORLEVEL +306
ENDIF
IF LOW(_MM) ==9
ERRORLEVEL -306
PAGEX Delay8>>9
CALL Delay8 ;Delay 9 cycles
ERRORLEVEL +306
ENDIF
IF LOW(_MM) ==10
ERRORLEVEL -306
PAGEX Delay9>>9
CALL Delay9 ;Delay 10 cycles
ERRORLEVEL +306
ENDIF
IF LOW(_MM) ==11
ERRORLEVEL -306
PAGEX Delay10>>9
CALL Delay10 ;Delay 11 cycles
ERRORLEVEL +306
ENDIF
IF LOW(_MM) ==12
ERRORLEVEL -306
PAGEX Delay11>>9
CALL Delay11 ;Delay 12 cycles
ERRORLEVEL +306
ENDIF
IF LOW(_MM) ==13
ERRORLEVEL -306
PAGEX Delay12>>9
CALL Delay12 ;Delay 13 cycles
ERRORLEVEL +306
ENDIF
IF LOW(_MM) ==14
ERRORLEVEL -306
PAGEX Delay13>>9
CALL Delay13 ;Delay 14 cycles
ERRORLEVEL +306
ENDIF
IF LOW(_MM) ==15
ERRORLEVEL -306
PAGEX Delay14>>9
CALL Delay14 ;Delay 15 cycles
ERRORLEVEL +306
ENDIF
IF LOW(_MM) ==16
ERRORLEVEL -306
PAGEX Delay15>>9
CALL Delay15 ;Delay 16 cycles
ERRORLEVEL +306
ENDIF
IF LOW(_MM) >16
MOVLW LOW(_MM-1)
ERRORLEVEL -306
PAGEX DelW>>9
CALL DelW ;Delay for 17 thru 255 cycles
ERRORLEVEL +306
ENDIF
IF HIGH(_MM) !=0
LOCAL _DelMLoop
MOVLW HIGH(_MM) ;Delay more for greater than 255 cycles
MOVWF DelMCnt
_DelMLoop MOVLW 251
ERRORLEVEL -306
PAGEX DelW>>9
CALL DelW
ERRORLEVEL +306
DECFSZ DelMCnt
GOTO _DelMLoop
ENDIF
ENDM
;-----------------------------------------------------------------------------
;This version of DelW is for the Scenix parts in Turbo mode. It does not matter
;if the Carry fuse is set or clear.
; DelW delays W cycles, including call, return, and one cycle for the
; MOVLW instruction to set up the count in W
; range is 16..255
;
; For example, the sequence:
; MOVLW 17
; CALL DelW
; will take 17 cycles to execute
;-----------------------------------------------------------------------------
; W value on entry: 16 17 18 19 20 21 22 23
; Caller's instructions: --- --- --- --- --- ----- ----- -----
; MOVLW n 0 0 0 0 0 0 0 0
; CALL DelW 1 1 1 1 1 1 1 1
DelW BSF CF ; 4 4 4 4 4 4 4 4
SUBWF Fifteen,W ; 5 5 5 5 5 5 5 5
_DelWLp ADDWF Five,W ; 6 6 6 6 6 6 11 7 11 7 11
BTFSS CF ; 7 7 7 7 7 7 12 12 12
GOTO _DelWLp ; 8 8 8
BCF CF ; 9 9 9 9 9 14 14 14
ADDWF PC ; 10 10 10 10 10 15 15 15
Delay10 NOP ; 13
Delay9 NOP ; 13 14
Delay8 NOP ; 13 14 15 18
Delay7 NOP ; 13 14 15 16 18 19
Delay6 RETP ; 13 14 15 16 17 18 19 20
; 16 17 18 19 20 21 22 23
Delay15 NOP
Delay14 NOP
Delay13 NOP
Delay12 NOP
Delay11 GOTO Delay8
file: /Techref/scenix/contest/humid/DELM.ISX, 5KB, , updated: 2000/2/14 11:54, local time: 2025/5/6 02:04,
|
| ©2025 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://www.linistepper.com/Techref/scenix/contest/humid/DELM.ISX"> scenix contest humid DELM</A> |
Did you find what you needed?
|