home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
xbase
/
library
/
clipper
/
rettig
/
source
/
pokelong.asm
< prev
next >
Wrap
Assembly Source File
|
1990-10-21
|
3KB
|
109 lines
; POKELONG.ASM
;
; by Ralph Davis
; modified by Leonard Zerman
;
; Placed in the public domain by Tom Rettig Associates, 10/22/1990.
;
PUBLIC POKELONG
INCLUDE EXTENDA.MAC
EXTRN _TR_POKE_PARMS:FAR
EXTRN __TR_HTOL:FAR
DGROUP GROUP _DATA
;*****************************************************
_DATA SEGMENT WORD PUBLIC 'DATA'
;
; Saves input segment and offset
;
SEG_ADDR DW ?
OFF_ADDR DW ?
;
_DATA ENDS
;*****************************************************
;*****************************************************
POKELONG_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:POKELONG_TEXT, DS:_DATA
;-----------------------------------------------------
;
; POKELONG(segment, offset, value)
;
; pokes value as 4-byte long 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
;
;--------------
POKELONG PROC FAR
PUSH BP
MOV BP,SP
PUSH DS
PUSH ES
PUSH BX
PUSH CX
PUSH DX
PUSH SI
CALL _TR_POKE_PARMS ; Returns segment in DX,
; offset in AX
JL POKELONG_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 POKELONG_HEX ; yes
GET_LONG 3 ; No, get parm as long int
JMP SHORT POKE_LONG_4
POKELONG_HEX:
GET_CHAR 3 ; get parm as char *
PUSH DX ; Call _TR_HTOL
PUSH AX
CALL __TR_HTOL ; AX:BX now contains parameter as long int
ADD SP,4
POKE_LONG_4:
MOV DX,BX ; save parameter in CX:DX
MOV CX,AX
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 dword
MOV [SI],DX ; poke low byte
MOV [SI+2],CX ; poke high byte
MOV AX,1 ; Return .T. for successful poke
JMP SHORT POKELONG_EXIT ; and we're done
POKELONG_ERR:
MOV AX,0 ; return .F. for error condition
POKELONG_EXIT:
POP SI
POP DX
POP CX
POP BX
POP ES
POP DS
POP BP
RET_LOGICAL AX ; Return .T. or .F. to caller
RET
POKELONG ENDP
;------------------------------------------------
POKELONG_TEXT ENDS
;************************************************
END