home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / pascal / 6856 < prev    next >
Encoding:
Internet Message Format  |  1992-11-24  |  2.7 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!news2me.EBay.Sun.COM!west.West.Sun.COM!cronkite.Central.Sun.COM!texsun!exucom.exu.ericsson.se!pc254101.exu.ericsson.se!exuptr
  2. From: exuptr@exu.ericsson.se (Patrick Taylor)
  3. Newsgroups: comp.lang.pascal
  4. Subject: Re: Turbo Pascal mem[a: b] question
  5. Message-ID: <exuptr.258.722564133@exu.ericsson.se>
  6. Date: 24 Nov 92 00:15:33 GMT
  7. References: <zlsiida.414@fs1.mcc.ac.uk> <1992Nov16.050457.26839@qiclab.scn.rain.com>
  8. Sender: news@exu.ericsson.se
  9. Organization: Ericsson Network Systems, Inc.
  10. Lines: 50
  11. Nntp-Posting-Host: pc254101.exu.ericsson.se
  12. X-Disclaimer: This article was posted by a user at Ericsson.
  13.               Any opinions expressed are strictly those of the
  14.               user and not necessarily those of Ericsson.
  15.  
  16. In article <1992Nov16.050457.26839@qiclab.scn.rain.com> leonard@qiclab.scn.rain.com (Leonard Erickson) writes:
  17. >From: leonard@qiclab.scn.rain.com (Leonard Erickson)
  18. >Subject: Re: Turbo Pascal mem[a:b] question
  19. >Date: 16 Nov 92 05:04:57 GMT
  20.  
  21. >zlsiida@fs1.mcc.ac.uk (dave budd) writes:
  22.  
  23. >>One of our users claims he can increase a in mem[a:b]:=value; until it MUST 
  24. >>be off the end of his machine.  This is the kind of user who always forgets 
  25. >>to bring a disk with the program on it.  I've had a brief scan of the manual 
  26. >>and it's not clear to me just exactly which bits of memory get addressed - 
  27. >>eg I don't believe they'd let you write into a program segment.
  28. >>Are all the addresses relative to the start of the data segment (or 
  29. >>something along those lines)?
  30. >>If the address is off the end of the machine or just bigger than the largest 
  31. >>allowable, does it get truncated in some way?
  32. >>Anybody want to give me a nice simple explanation of how mem[a:b] works?
  33.  
  34. >Sure. A is the segment, B is the offset. These are *absolute* addresses,
  35. >not relative to anything. 
  36.  
  37. >You can specify *any* address. If it's not present in the machine what
  38. >happens is probably hardware/BIOS dependent. 
  39.  
  40. One thing's for sure, if A or B are larger than WORDS, they are truncated.
  41.  
  42. >mem[a:b] := x is a *very* low level instruction. It's compiled as a 
  43. >direct write to RAM. probably a LOAD X,[a:b] (if I remember the assembler
  44. >mnemonics correctly).
  45.  
  46. Close enough.  I think it is more like
  47.  
  48.    MOV AX,[x]
  49.    MOV DX,[a]
  50.    MOV ES,DX
  51.    MOV DX,[b]
  52.    MOV [ES:DX],AX
  53.  
  54. using TASM syntax, of course.
  55.  
  56. Bottom line is, probably *no checking at all* is done on the address and if 
  57. you address something that is not there, there is *no telling* what your 
  58. machine might do.
  59.  
  60.  ----------------------------------------------------------------------------
  61.  PEROT IN '96!
  62.  
  63.   - Patrick Taylor, Ericsson Network Systems
  64.     exuptr@exu.ericsson.se                    "Don't let the .se fool you"
  65.     exuptr@ZGNews.Lonestar.Org  <SLOW!>
  66.