Figure 9-50 defines two macros for executing the read data command.It is assumed that a sequence such as

 
                   IDLE:   IN    AL,2AH
                           TEST  AL,12H
                           JNZ   IDLE  
would appear just prior to a READ_COM macro call to make certain that the desired drive (which in this example is drive 1) is available.

Also, the associated DMA must be initialized before the READ_COM macro call is made so that DMA transfers may begin as soon as the read operation is performed.It is assumed that a call to the READ_STAT macro would be made only after the execution phase and the read is known to be complete (e.g., after an interrupt on completion interrupt has occured).
            %DEFINE (READ_COM(ADDR,HDSDS,C,H,R,N,DTL))
                (             PUSH  AX             ;SAVE REGISTERS  
                    %CHECK (2AH,80H)
                              MOV   AL,46H         ;OUTPUT COMMAND 
                              OUT   %ADDR,AL       ;CODE
                    %CHECK (2AH,80H)
                              MOV   AL,HDSDS       ;OUTPUT HEAD AND 
                              OUT   %ADDR,AL       ;DRIVE NOS. 
                    %CHECK (2AH,80H)
                              MOV   AL,%C          ;OUTPUT CHANNEL NO., 
                              OUT   %ADDR,AL        
                    %CHECK (2AH,80H)
                              MOV   AL,%H          ;HEAD NO., 
                              OUT   %ADDR,AL            
                    %CHECK (2AH,80H)
                              MOV   AL,%R          ;SECTOR NO., 
                              OUT   %ADDR,AL              
                    %CHECK (2AH,80H)
                              MOV   AL,%N          ;NO. OF DATA BYTES, 
                              OUT   %ADDR,AL             
                    %CHECK (2AH,80H)
                              MOV   AL,26          ;NO. OF SECTORS, 
                              OUT   %ADDR,AL   
                    %CHECK (2AH,80H)
                              MOV   AL,17          ;GAP LENGTH AND 
                              OUT   %ADDR,AL   
                    %CHECK (2AH,80H)
                              MOV   AL,%DTL        ;DATA LENGTH 
                              OUT   %ADDR,AL
                              POP   AX    
                )
                %DEFINE (READ_STAT(ADDR,RDSTAT)) LOCAL LP
                (             PUSH  AX              ;SAVE REGISTERS
                              PUSH  CX
                              PUSH  SI
                              MOV   SI,0            ;INPUT STATUS TO
                              MOV   CX,7            ;ARRAY RDSTAT
                      %LP:    NOP 
                      %CHECK (2AH,0C0H)
                              IN    AL,%ADDR
                              MOV   %RDSTAT[SI],AL
                              INC   SI
                              LOOP  %LP
                              POP   SI              ;RESTORE REGISTERS
                              POP   CX               
                              POP   AX
                )   


               Figure 9-50  Macros for executing read data commands 

PRETHODNA FOLIJA SADRZAJ SLEDECA FOLIJA