La détection de materiel

 
VIII- Page Mémoire
 
La mémoire XMS (eXtended Memory Specification) sur un PC sera la plupart du temps (99%) initialisée par Himem.sys. Je passe donc le test s'il n'existe pas d'XMS disponible par ce biais. Le problème mageur rencontré ici est du au compilateur: TASM ne sait pas traduire convenablement un 'CALL FAR', se qui oblige à coder directement l'instruction machine : 'db 0ffh,01h'. Une fois la présence détectée, le programme n'a plus qu'à afficher la version du driver qui est, attention, codé en BCD. Par ailleurs, cette procédure renseigne sur la quantitée de mémoire étendue disponible et sur l'état de la mémoire HMA.
 
 
PageMemoire: 
         call ModeTexte 
         mov ax,4300h 
         int 2fh 
         cmp al,80h 
         je PXMS_Dispo 
PXMS_PasDispo: 
         mov dx,offset XMS_PasDispo 
         call PutString 
         jmp EndPageMemoire 
PXMS_Dispo: 
         mov dx,offset XMS_Dispo 
         call PutString 
         mov dx,offset XMS_VerDriver 
         call PutString 

         mov ax,4310h 
         int 2fh 
         mov word ptr XMS_Adresse+2,es 
         mov word ptr XMS_Adresse,bx 
         mov ax,0000h 
         mov si,offset XMS_Adresse 
         db 0ffh,01ch 
         pusha 
         mov bx,ax 
         xor ax,ax 
         mov al,bh 
         call BCDHEXA 
         call PutWord 
         mov dl,'.' 
         call Putch 
         xor ax,ax 
         mov al,bl 
         call BCDHEXA 
         call PutWord 
         popa 
         push dx 
         mov dx,offset XMS_MemDispo 
         call PutString 
         mov ax,0800h 
         mov si,offset XMS_Adresse 
         db 0ffh,01ch 
         mov ax,dx 
         call PutWord 
         pop dx 

         mov ax,dx 
         mov dx,offset XMS_EtatHMA 
         call PutString 
         mov dx,offset DEable 
         shl ax,4 
         add dx,ax 
         call PutString 

EndPageMemoire: 
         call Page_HitAnyKey 
         ret