	TITLE    DEMO MOSTEK MAC-70
	NAME     DEMO
*
*
* MAIN PROGRAM BLOCK.
*
         ORG     H'100'
* INITIALIZE CONSTANTS
RLCNT    EQU     5             TIMER ROLLOVER COUNT.
TCNT     EQU     125           TIMER MOD-N VALUE.
*
* CLEAR TEMPERATURE Ie, R6,R7.
STRT     CLR
         LR      6,A
         LR      7,A
*
* LOAD TIMER ROLLOVER COUNT IN R0.
         LIS     RLCNT
         LR      0,A
* LOAD TIMER
         LI      TCNT
         OUTS    7
*
* BEGIN TIMING WHEN EXT INT HIGH.FOR UNIFORM TIMING.
         INS     6
         BZ      *-1
*
* LOAD ICP, BITS DEFINED AS FOLLOWS:
* BIT 0 - ALLOW EXTERNAL INTERRUPTS
* BIT 1 - ALLOW TIMER INTERRUPTS.
* BIT 2 - EXT INT ACTIVE LEVEL.
* BIT 3 - START/STOP TIMER (1/0).
* BIT 4 - PULSE WIDTH/INTERVAL TIMER (1/0)
* BIT 5 - DIVIDE CLOCK BY 2.
* BIT 6 - DIVIDE CLOCK BY 5.
* BIT 7 - DIVIDE CLOCK BY 20.
*
         LI      B'11101111'  START TIMER.
         OUTS    6
* NOTE INTERRUPTS CAN BE MASKED BY ICP BITS 0 AND 1
* OR BY CLEARING INTERRUPT CONTROL BIT (STATIC REG, BIT 4
* ENABLE INTERRUPTS BY SETTING ICB.
         EI
*
* MAY DELAY OR CONTINUE PROCESSING.
* CONVERSION COMPLETE WHEN R9 = H'ff.
LOOP     LR      A,9
         CI      H'FF'
         BNZ     LOOP
*
* CONTINUE HERE WHEN CONVERSION DONE.
*
         END
