home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / pascal / 8441 < prev    next >
Encoding:
Text File  |  1993-01-22  |  1.4 KB  |  39 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!usc!cs.utexas.edu!torn!news.ccs.queensu.ca!mast.queensu.ca!dmurdoch
  3. From: dmurdoch@mast.queensu.ca (Duncan Murdoch)
  4. Subject: Re: Strange behavior?
  5. Message-ID: <dmurdoch.424.727716812@mast.queensu.ca>
  6. Lines: 27
  7. Sender: news@knot.ccs.queensu.ca (Netnews control)
  8. Organization: Queen's University
  9. References: <727662763.AA01194@contrast.wlink.nl>
  10. Date: Fri, 22 Jan 1993 15:33:32 GMT
  11.  
  12. In article <727662763.AA01194@contrast.wlink.nl> berend@contrast.wlink.nl (Berend de Boer) writes:
  13. >procedure T;
  14. >var
  15. >  s : string;
  16. >begin
  17. >  asm
  18. >    mov  ax,OFFSET s        {* line 1 *}
  19. >    lea  ax,s               {* line 2 *}
  20. >    mov  ax,SEG s           {* line 3 *}
  21. >  end;
  22. >end;
  23.  
  24. >If you look at the compiled code you will see that line 1 and line 3 are
  25. >compiled strange (in my honest opinion). Register ax is loaded with
  26. >$FFCE ($FF00 in real mode) and $FFFF respectively, while line 2 is OK.
  27.  
  28. The problem is the strange way BASM handles symbols.  To BASM, "s" means
  29. the BP relative offset of the local variable "s".  Neither "OFFSET s" nor
  30. "SEG s" are meaningful.  The bug is that neither your first line nor your 
  31. last line are signalled as syntax errors, as they should be.  
  32.  
  33. A more forgiving implementation would translate line 1 into line 2, and line 
  34. 3 into "mov ax,ss", but BASM is not forgiving.
  35.  
  36.  
  37. Duncan Murdoch
  38. dmurdoch@mast.queensu.ca
  39.