72
K
A
DAK
AMX Timing Control
Clock ISP ImplementationAMX can provide timing facilities only if a hardware clock interrupt is available. Forefficiency, it is recommended that the clock ISP be coded in assembly language asillustrated below. Note that the clock ISP root and Interrupt Handler have been merged,making the clock ISP a single body of code. It is assumed in this example that interruptnumber 33 has been allocated for clock use.
EXTRN AACLK:FAR ;AMX Clock Handler
EXTRN AAIVTW:FAR ;AMX install ISP pointer
;
;
; Assume clock interrupt vector is located in Interrupt Vector Table
; for interrupt number 33
;
CLK_CODE SEGMENT BYTE 'CODE'
;
; The device ISP is located in user program memory
;ASSUME CS:CLK_CODE
;
CLKISP PROC FAR
PUSH DX ;save some registers
:
:
Code, if required, to
keep the hardware clock running.
Use only those registers saved.
Do not enable interrupts.
:
:
POP DX ;restore registers
CALL AACLK ;AMX Clock Handler
IRET ;return from interrupt
;
CLKISP ENDP
;
;
; Clock Restart Procedure
;PUBLIC RRCLK
;
RRCLK PROC FAR
MOV AX,SEG CLKISP
MOV ES,AX
MOV BX,OFFSET CLKISP ;ES:BX = A(Clock ISP)
MOV DX,33 ;clock interrupt number
CALL AAIVTW ;install clock ISP
RET
;
RRCLK ENDP
;
CLK_CODE ENDS