home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / jËzyki_programowania / oberon / loader / peeknpoke.def < prev    next >
Text File  |  1977-12-31  |  2KB  |  70 lines

  1. DEFINITION MODULE PeekNPoke;
  2. (*
  3.  The routines of this module allow to read/build a data structure in a  machine
  4.  independent way. Instead of aliasing datatypes to memory areas, the structure
  5.  is read/built by copying individual bytes from/to the correct place.
  6.  
  7.  In all routines, base is a pointer (anchor) to the memory block you want to
  8.  manipulate and offset an address relativ to this base.
  9.  
  10.  Word is used to denominate a 2 byte entity, long to denominate a 4 byte entity.
  11. *)
  12.  
  13. FROM SYSTEM IMPORT ADDRESS;
  14.  
  15. PROCEDURE PutByte(base:ADDRESS; offset:LONGINT; value:SHORTCARD);
  16. (* Write a single byte *)
  17.  
  18. PROCEDURE PutWordB(base:ADDRESS; offset:LONGINT; value:CARDINAL);
  19. (*
  20.  Write a word in big endian fashion, i.e. most significant byte
  21.  at lowest memory address.
  22. *)
  23.  
  24. PROCEDURE PutWordL(base:ADDRESS; offset:LONGINT; value:CARDINAL);
  25. (*
  26.  Write a word in little endian fashion, i.e. most significant byte
  27.  at highest memory address.
  28. *)
  29.  
  30. PROCEDURE PutLongB(base:ADDRESS; offset:LONGINT; value:LONGCARD);
  31. (*
  32.  Write a long word in big endian fashion, i.e. most significant byte
  33.  at lowest memory address.
  34. *)
  35.  
  36. PROCEDURE PutLongL(base:ADDRESS; offset:LONGINT; value:LONGCARD);
  37. (*
  38.  Write a long word in little endian fashion, i.e. most significant byte
  39.  at highest memory address.
  40. *)
  41.  
  42. PROCEDURE GetByte(base:ADDRESS; offset:LONGINT):SHORTCARD;
  43. (* Read a byte *)
  44.  
  45. PROCEDURE GetWordB(base:ADDRESS; offset:LONGINT):CARDINAL;
  46. (*
  47.  Read a word in big endian fashion, i.e. the most significant
  48.  byte from the lowest memory address.
  49. *)
  50.  
  51. PROCEDURE GetWordL(base:ADDRESS; offset:LONGINT):CARDINAL;
  52. (*
  53.  Read a word in little endian fashion, i.e. the most significant
  54.  byte from the highest memory address.
  55. *)
  56.  
  57. PROCEDURE GetLongB(base:ADDRESS; offset:LONGINT):LONGCARD;
  58. (*
  59.  Read a long word in big endian fashion, i.e. the most significant
  60.  byte from the lowest memory address.
  61. *)
  62.  
  63. PROCEDURE GetLongL(base:ADDRESS; offset:LONGINT):LONGCARD;
  64. (*
  65.  Read a long word in little endian fashion, i.e. the most significant
  66.  byte from the highest memory address.
  67. *)
  68.  
  69. END PeekNPoke.
  70.