;------------------------------------------------ ; Scientific interface driver routine. ; ; This routine AD.ASM in 8080 source code for CP/M ; ; B.J.Frost, July 1986, V1.1 ;------------------------------------------------ ; ; This program is in 8080 source and performs one- ; -read of the dual-slope A/D converter placing- ; -the result into memory as read. ; ; Note that the MS digit is coded as from the- ; -MC14433 as shown in Fig 9. ; ; To modify or expand this program, use an editor,- ; -assemble with 'MAC.COM' and debug under 'SID' or- ; -convert to AD.COM with 'HEXCOM'. ; ; Use DRV.GEN for examples of converting the A/D- ; -output to ASCII. ; ; ; equates: dsadad equ 0a0h ; a/d port ref warms equ 0 ; cp/m warms start org 100h ; program commences with jump table dsad jmp xdsad ; go to read routine ; stored result: adval ds 4 ; stored result as read ; Read the A/D data. Four words of raw A/D output ; are stored in memory. xdsad di ; interrupts off please! ad11 in dsadad ; get port byte ani 80H ; EOC high? jz ad11 ; no, loop. ad2 in dsadad ; read port again ani 80H ; EOC low? jnz ad2 ; no, loop. ; fetch first BCD digit by DS0=1. ad3 in dsadad ; get port again mov b,a ; saved ani 10H ; digit select 0 is =1 ? jz ad3 ; no, loop. ad4 mov a,b ; restore reading ani 0fH ; keep BCD sta adval ; and save to mem ; fetch digit 1 by DS1,3=0. ad5 in dsadad ; get port mov b,a ; save reading ani 20H ; next digit? jnz ad5 ;no. mov a,b ; yes. restore reading ani 0fH ; keep BCD sta adval+1 ; save to mem ; fetch digit 2 by DS2=1. ad6 in dsadad ; get port mov b,a ; saved ani 40H ; next digit? jz ad6 ; no. mov a,b ; yes. restore. ani 0fH ; keep BCD sta adval+2 ; save to mem ; fetch digit 3 by DS1,3=0. ad7 in dsadad ; get port mov b,a ; saved ani 20H ; next digit? jnz ad7 ; no mov a,b ; yes. restore ani 0fH ; keep BCD sta adval+3 ; save to mem. jp warms ; return to CP/M end