home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programming
/
powerprogramming1994.iso
/
progtool
/
c
/
jazlib.arc
/
POKEW.ASM
< prev
next >
Wrap
Assembly Source File
|
1986-07-08
|
1KB
|
58 lines
Comment *
┌────────────────────────────────────────────────────────────────────────────┐
│pokew │
│Poke a word into memory │
│ │
│Synopsis │
│ int seg = 0xb800,ofs = 0; │
│ │
│ pokew(seg,ofs,0x1f41); (write the letter "A" to the first byte │
│ of screen memory in white/blue color) │
└────────────────────────────────────────────────────────────────────────────┘
*
;=============================================================================
; Data
;=============================================================================
DGROUP group _DATA
_DATA segment word public 'DATA'
assume ds:DGROUP
; Your Data goes here . . .
_DATA ends
;=============================================================================
; Code
;=============================================================================
assume cs:_text
_text segment public byte 'code'
PUBLIC _pokew
_pokew proc near
push bp ; save base of stack
mov bp,sp ; establish stack frame
push di ; save MS-C's Register vars
push es
mov ax,[bp].8 ; get value to poke
mov di,[bp].6 ; get offset
push [bp].4 ; segment
pop es
stosw
pop es ; restore data and extra segs
pop di ; Restore MS-C's Register vars
mov sp,bp ; restore stack pointer
pop bp ; and base of stack
ret ; return to caller
_pokew endp
_text ends
end