Recent

Author Topic: [solved] [msdos] Pointer operations  (Read 3496 times)

piola

  • Full Member
  • ***
  • Posts: 124
  • Lazarus 2.2, 64bit on Windows 8.1 x64
[solved] [msdos] Pointer operations
« on: August 30, 2021, 09:32:21 pm »
Hello,

I'm targeting the msdos/i8086 platform and am working on a function which will be called from a QuickBasic tool. The memory model is "compact". I have spent the whole weekend to find out what's going wrong and narrowed it down to the following problem:

Code: Pascal  [Select][+][-]
  1. var
  2.   wp: ^word;
  3.   c2: integer; // == smallint in msdos-mode
  4. begin
  5. wp:=ptr(3828,62); // returns 6 which is correct
  6. move(ptr(3828,62)^,c2,2); // c2 = 6663, but could also be some other value
  7. end;
  8.  

I surely can use the first alternative, but I wonder what could go wrong with the second one?  %)

Edit: In addition to that, compiling the same code in large memory model causes a hang in the "move" line -- which is also very strange (especially being "large" one of the memory models Microsoft recommends when using external code with QB).
« Last Edit: August 31, 2021, 12:56:30 am by piola »

piola

  • Full Member
  • ***
  • Posts: 124
  • Lazarus 2.2, 64bit on Windows 8.1 x64
Re: [solved] [msdos] Pointer operations
« Reply #1 on: August 31, 2021, 12:57:46 am »
Solved: it turned out I accidentally mixed system.a and prt0?.o files from different memory models

 

TinyPortal © 2005-2018