*************************************************************** * * * Module Name: WAITBUSY.LIB Rev. 1.00 * * Function: Wait until the busy Last rev. 06 May 85 * * flag is lowered. By: glh/w6bsk * * * *************************************************************** cmdreg equ 0e3fch ; 1791 command port notbsy: mvi c,10 ; Preset counter wait1: lxi h,cmdreg ; Point to command port of mov a,m ; 1791 and get a status byte. rar ; Test busy flag - if not up, jnc timeot ; wait for it to come up for ; short period. wait2: mov a,m ; Get status byte and test for rar ; busy flag up. Loop until it jc wait2 ; comes down again. ret ; 1791 idle, go home. timeot: dcr c ; Don't look for flag to come up jnz wait1 ; forever. If no busy flag by ret ; ten tries, is not coming up.