Browse Source

* take into account the address size in lnfodwrf.ReadAddress on i8086; support
2-byte and 4-byte addresses

git-svn-id: trunk@39060 -

nickysn 7 years ago
parent
commit
3989e57fed
1 changed files with 16 additions and 4 deletions
  1. 16 4
      rtl/inc/lnfodwrf.pp

+ 16 - 4
rtl/inc/lnfodwrf.pp

@@ -470,19 +470,31 @@ begin
 end;
 end;
 
 
 
 
+{$ifdef CPUI8086}
 { Reads an address from the current input stream }
 { Reads an address from the current input stream }
-function ReadAddress(addr_size: smallint) : PtrUInt;
+function ReadAddress(addr_size: smallint) : LongWord;
 begin
 begin
-  ReadNext(ReadAddress, sizeof(ReadAddress));
+  if addr_size = 4 then
+    ReadNext(ReadAddress, 4)
+  else if addr_size = 2 then begin
+    ReadAddress := 0;
+    ReadNext(ReadAddress, 2);
+  end
+  else
+    ReadAddress := 0;
 end;
 end;
 
 
-
-{$ifdef CPUI8086}
 { Reads a segment from the current input stream }
 { Reads a segment from the current input stream }
 function ReadSegment() : Word;
 function ReadSegment() : Word;
 begin
 begin
   ReadNext(ReadSegment, sizeof(ReadSegment));
   ReadNext(ReadSegment, sizeof(ReadSegment));
 end;
 end;
+{$else CPUI8086}
+{ Reads an address from the current input stream }
+function ReadAddress(addr_size: smallint) : PtrUInt;
+begin
+  ReadNext(ReadAddress, sizeof(ReadAddress));
+end;
 {$endif CPUI8086}
 {$endif CPUI8086}