Browse Source

* only save BP and DS when calling int 10h; mark the other registers as volatile in the asm blocks
- removed the 'ifdef FPC' around the register saving code around the int 10h calls

git-svn-id: trunk@40890 -

nickysn 6 years ago
parent
commit
6066eb07b4
2 changed files with 17 additions and 55 deletions
  1. 11 33
      packages/graph/src/msdos/graph.pp
  2. 6 22
      packages/graph/src/msdos/vesa.inc

+ 11 - 33
packages/graph/src/msdos/graph.pp

@@ -164,9 +164,11 @@ const
  Procedure CallInt10(val_ax : word); assembler;
    asm
      mov ax,val_ax
+     push ds
      push bp
      int 10h
      pop bp
+     pop ds
    end;
 
 {************************************************************************}
@@ -2282,19 +2284,11 @@ End;
     asm
       mov ax,[page]    { only lower byte is supPorted. }
       mov ah,05h
-{$ifdef fpc}
+      push ds
       push bp
-      push si
-      push di
-      push bx
-{$endif fpc}
       int 10h
-{$ifdef fpc}
-      pop bx
-      pop di
-      pop si
       pop bp
-{$endif fpc}
+      pop ds
 
       { read start address }
       mov dx,3d4h
@@ -2307,7 +2301,7 @@ End;
       mov al,0dh
       out dx,al
       in  al,dx
-    end ['DX','AX'];
+    end ['DX','CX','BX','AX','SI','DI'];
   end;
 
  procedure SetActive200(page: word); {$ifndef fpc}far;{$endif fpc}
@@ -2330,20 +2324,12 @@ End;
     asm
       mov ax,[page]    { only lower byte is supPorted. }
       mov ah,05h
-{$ifdef fpc}
+      push ds
       push bp
-      push si
-      push di
-      push bx
-{$endif fpc}
       int 10h
-{$ifdef fpc}
-      pop bx
-      pop di
-      pop si
       pop bp
-{$endif fpc}
-    end ['AX'];
+      pop ds
+    end ['DX','CX','BX','AX','SI','DI'];
   end;
 
  procedure SetActive350(page: word); {$ifndef fpc}far;{$endif fpc}
@@ -2526,19 +2512,11 @@ const CrtAddress: word = 0;
      JZ   @L2
      OR   AX, 080h
   @L2:
-{$ifdef fpc}
+     push ds
      push bp
-     push si
-     push di
-     push bx
-{$EndIf fpc}
      INT  10h
-{$ifdef fpc}
-     pop bx
-     pop di
-     pop si
      pop bp
-{$EndIf fpc}
+     pop ds
      MOV DX,03C4h   {select memory-mode-register at sequencer Port    }
      MOV AL,04
      OUT DX,AL
@@ -2574,7 +2552,7 @@ const CrtAddress: word = 0;
      IN  AL,DX
      OR  AL,40h     {bit 6 := 1: memory access scheme=linear bit array      }
      OUT DX,AL
-  end ['DX','BX','CX','AX','DI'];
+  end ['DX','BX','CX','AX','SI','DI'];
  end;
 
 

+ 6 - 22
packages/graph/src/msdos/vesa.inc

@@ -1933,24 +1933,16 @@ end;
    asm
     mov ax,4F02h
     mov bx,mode
-{$ifdef fpc}
+    push ds
     push bp
-    push si
-    push di
-    push bx
-{$endif fpc}
     int 10h
-{$ifdef fpc}
-    pop bx
-    pop di
-    pop si
     pop bp
-{$endif fpc}
+    pop ds
     sub ax,004Fh
     cmp ax,1
     sbb al,al
     mov res,al
-   end ['BX','AX'];
+   end ['DX','CX','BX','AX','SI','DI'];
    if not res then
      _GraphResult := GrNotDetected
    else _GraphResult := grOk;
@@ -2222,20 +2214,12 @@ end;
       mov bx, 0000h   { set display start }
       mov cx, 0000h   { pixel zero !      }
       mov dx, [NewStartVisible]  { new scanline }
-{$ifdef fpc}
+      push    ds
       push    bp
-      push    si
-      push    di
-      push    bx
-{$endif}
       int     10h
-{$ifdef fpc}
-      pop     bx
-      pop     di
-      pop     si
       pop     bp
-{$endif}
-    end ['DX','CX','BX','AX'];
+      pop     ds
+    end ['DX','CX','BX','AX','SI','DI'];
   end;
 
  procedure SetActiveVESA(page: word); {$ifndef fpc}far;{$endif fpc}