home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / CTECHAPP.ZIP / WINDOWS.ZIP / PEEKPOKE.ASM next >
Assembly Source File  |  1990-02-26  |  1KB  |  70 lines

  1. ;   Module:     PeekPoke
  2. ;   Version:    1.01
  3. ;
  4. ;   Language:   Intel 80x86 Macro Assembler
  5. ;   Environ:    IBM-PC compatible
  6. ;
  7. ;   Purpose:    Provides functions to peek and poke values into specific
  8. ;               memory locations.
  9. ;
  10. ;   Written by: Scott Robert Ladd
  11.  
  12. .8086
  13.  
  14. IFDEF MML
  15.     .MODEL LARGE,C
  16.     %OUT "Large Model"
  17. ELSE
  18.     .MODEL SMALL,C
  19.     %OUT "Small Model"
  20. ENDIF
  21.  
  22. .CODE
  23.  
  24. PUBLIC Peek
  25. PUBLIC Poke
  26.  
  27. Peek        PROC    segm:WORD, offs:WORD
  28.  
  29.             push    es
  30.             push    si
  31.  
  32.             mov     ax,segm
  33.             mov     es,ax
  34.  
  35.             mov     si,offs
  36.  
  37.             mov     ax, es:[si]
  38.  
  39.             pop     si
  40.             pop     es
  41.  
  42.             ret
  43.  
  44. Peek        ENDP
  45.  
  46.  
  47. Poke        PROC    segm:WORD, offs:WORD, value:WORD
  48.  
  49.             push    es
  50.             push    di
  51.  
  52.             mov     ax,segm
  53.             mov     es,ax
  54.  
  55.             mov     di,offs
  56.  
  57.             mov     cx,value
  58.  
  59.             mov     es:[di], cx
  60.  
  61.             pop     di
  62.             pop     es
  63.  
  64.             ret
  65.  
  66. Poke        ENDP
  67.  
  68.  
  69. END
  70.