home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / pascal / 8439 < prev    next >
Encoding:
Internet Message Format  |  1993-01-22  |  1.4 KB

  1. Path: sparky!uunet!mcsun!sun4nl!wtrlnd!contrast!postmaster
  2. From: berend@contrast.wlink.nl (Berend de Boer)
  3. Newsgroups: comp.lang.pascal
  4. Subject: Strange behavior?
  5. Message-ID: <727662763.AA01194@contrast.wlink.nl>
  6. Date: Thu, 21 Jan 1993 21:51:26
  7. Sender: postmaster@contrast.wlink.nl
  8. Lines: 56
  9.  
  10. Hello All!
  11.  
  12. Can anyone explain the following behavior to me?
  13.  
  14. Sorry, I wrote the above sentence and the test programs below before
  15. looking in Duncan's buglist. The SEG bug is document (number 16), but
  16. the OFFSET bug is not, at least I could not find it.
  17.  
  18. Well than, for your information:
  19.  
  20. ====test program====
  21. program Test;
  22.  
  23. procedure T;
  24. var
  25.   s : string;
  26. begin
  27.   asm
  28.     mov  ax,OFFSET s        {* line 1 *}
  29.     lea  ax,s               {* line 2 *}
  30.     mov  ax,SEG s           {* line 3 *}
  31.   end;
  32. end;
  33.  
  34. begin
  35.   T;
  36. end.
  37. =========
  38.  
  39. If you look at the compiled code you will see that line 1 and line 3 are
  40. compiled strange (in my honest opinion). Register ax is loaded with
  41. $FFCE ($FF00 in real mode) and $FFFF respectively, while line 2 is OK.
  42.  
  43. This bug does not show up when you do it like the following program:
  44.  
  45. ====test program====
  46. program Test;
  47.  
  48. var
  49.   s : string;
  50. begin
  51.   asm
  52.     mov  ax,OFFSET s        {* line 1 *}
  53.     lea  ax,s               {* line 2 *}
  54.     mov  ax,SEG s           {* line 3 *}
  55.   end;
  56. end.
  57. =========
  58.  
  59.  
  60. Groetjes,
  61.  
  62. Berend. (-:
  63. fido: 2:281/527.23
  64. email: berend@contrast.wlink.nl
  65.  
  66.