home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
CPROG
/
CEXPRESS.ZIP
/
BITS.ASM
/
PEEKB.ASM
< prev
next >
Wrap
Assembly Source File
|
1989-05-03
|
581b
|
27 lines
;unsigned char peekb(segment,offset);
; unsigned short segment,offset;
EXTRN _memory_model:byte
_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT
PUBLIC _peekb
_peekb proc near
mov bx,sp ;set stack frame
cmp _memory_model,0 ;near or far?
jle begin ;jump if near
inc bx ;else add 2 to BX
inc bx ;
begin: mov ax,ss:[bx+2] ;get segment
mov es,ax ;
mov di,ss:[bx+4] ;get offset
sub ah,ah ;
mov al,es:[di] ;
cmp _memory_model,0 ;quit
jle quit ;
db 0CBh ;RET far
quit: ret ;RET near
_peekb endp
_TEXT ENDS
END