home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
xbase
/
library
/
clipper
/
rettig
/
source
/
pokeint.asm
< prev
next >
Wrap
Assembly Source File
|
1990-10-21
|
3KB
|
109 lines
; POKEINT.ASM
;
; by Ralph Davis
; modified by Leonard Zerman
;
; Placed in the public domain by Tom Rettig Associates, 10/22/1990.
;
PUBLIC POKEINT
INCLUDE EXTENDA.MAC
EXTRN _TR_POKE_PARMS:FAR
EXTRN __TR_HTOI:FAR
DGROUP GROUP _DATA
;*****************************************************
_DATA SEGMENT WORD PUBLIC 'DATA'
;
; Saves input segment and offset
;
SEG_ADDR DW ?
OFF_ADDR DW ?
;
_DATA ENDS
;*****************************************************
;*****************************************************
POKEINT_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:POKEINT_TEXT, DS:_DATA
;-----------------------------------------------------
;
; POKEINT(segment, offset, value)
;
; pokes value as 2-byte integer
;
; segment = SPACE(4) && hexadecimal string
; offset = number < 65536 or hexadecimal string
; value = number or hexadecimal string
;
; Returns: .F. if less than three parameters passed
; .T. otherwise
;
;--------------
POKEINT PROC FAR
PUSH BP
MOV BP,SP
PUSH DS
PUSH ES
PUSH BX
PUSH DX
PUSH SI
CALL _TR_POKE_PARMS ; returns segment in DX,
; offset in AX
JL POKEINT_ERR ; Sign flag set means less than 2 parms
PUSH DS ; Save caller's DS
MOV BX,_DATA ; Point DS to our data segment
MOV DS,BX
MOV SEG_ADDR,DX
MOV OFF_ADDR,AX
POP DS ; Restore caller's DS
GET_PTYPE 3 ; find out if parameter is numeric
; or character
AND AX,CHARACTER ; Is it a hexadecimal string?
JNZ POKEINT_HEX
GET_INT 3 ; Get parameter as integer in AX
MOV BX,AX ; Save it in BX
JMP SHORT POKE_INT_4
POKEINT_HEX:
GET_CHAR 3 ; Get parameter as pointer to
; hexadecimal string
PUSH DX ; Call _TR_HTOI
PUSH AX
CALL __TR_HTOI ; AX now contains parameter as integer
MOV BX,AX ; save parameter in BX
ADD SP,4
POKE_INT_4:
MOV AX,_DATA ; Point to our data segment
MOV DS,AX
MOV AX,OFF_ADDR ; restore offset address
MOV SI,SEG_ADDR ; restore segment
MOV DS,SI
MOV SI,AX ; DS:SI now points to requested word
MOV [SI],BX ; poke it
MOV AX,1 ; Return .T. for successful poke
JMP SHORT POKEINT_EXIT ; and we're done
POKEINT_ERR:
MOV AX,0 ; return .F. for error condition
POKEINT_EXIT:
POP SI
POP DX
POP BX
POP ES
POP DS
POP BP
RET_LOGICAL AX ; return .T. or .F. to caller
RET
POKEINT ENDP
;------------------------------------------------
POKEINT_TEXT ENDS
;************************************************
END