; clock module 4/5/83 goodall ; this module contains routines which know about the counter ; timer hardware in the system cgroup group code,data public clock_init ; used by init: public clock_baudset ; used by serial_init: ;************************************************************************ ;* * ;* 8253 COUNTER TIMER PORT AND DATA EQUATES * ;* 4/7/83 dwg * ;************************************************************************ timer_0_reg equ 48h ; keyboard 1200 baud timer_1_reg equ 4ah ; rs232-baud timer_2_reg equ 4ch ; tick timer_cmd_reg equ 4eh ; " timer_60_hz equ 19886 ;constant for 60.001 hz tick timer_1000_hz equ 533h ;constant for 1000 hz tone sel_ctr_0 equ 0 ; select counter 0 sel_ctr_1 equ 1 ; select counter 1 sel_ctr_2 equ 2 ; select counter 2 ctr_latch equ 0 ; counter latching rl_msb_only equ 2 ; read/load msb only rl_lsb_only equ 1 ; read/load lsb only rl_lsb_msb equ 3 ; read/load lsb, msb mode_0 equ 0 ; int on term count mode_1 equ 2 ; pgmable one shot mode_2 equ 4 ; rate generator mode_3 equ 6 ; square wave generator mode_4 equ 8 ; software triggered strobe mode_5 equ 9 ; hardware triggered strobe binary equ 0 ; binary counter 16 bits bcd equ 1 ; bcd counter ( 4 decades ) ; CLOCK SPEED DEFINITIONS FOR OLYMPIA PEOPLE BAUD_RATE EQU 1200*16 CLOCK EQU 49152 ; 4915.2 KHz BAUD EQU CLOCK/2/(BAUD_RATE/100) RTCLK EQU BAUD_RATE/20 eject cseg ; initialize tick period from factor in ram location clock_init: mov al,sel_ctr_2 + rl_lsb_msb + mode_3 + binary out timer_cmd_reg,al; select appropriate counter mov ax,rtclk ; get interval init (16 bits) out timer_2_reg,al mov al,ah ; al = high byte of init value out timer_2_reg,al ret ; set serial baud rate per caller's ax clock_baudset: push ax ; save caller's baud rate mov al,76h ! out timer_cmd_reg,al pop ax ; restore caller's baud rate out timer_1_reg,al ; set low order baud factor mov al,ah out timer_1_reg,al ; set high order baud factor ret ; return to caller dseg db 0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;