home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
CPROG
/
CEXPRESS.ZIP
/
SCREEN.ASM
/
DISPMEMB.ASM
< prev
next >
Wrap
Assembly Source File
|
1989-05-03
|
2KB
|
60 lines
;void display_mem_b(segment,offset,num_chars,col,row,color);
; unsigned short segment,offset,num_chars;
; unsigned char col,row,color;
EXTRN _memory_model:byte
EXTRN _video_page:byte
_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT
PUBLIC _display_mem_b
_display_mem_b proc near
push bp ;
mov bp,sp ;set stack frame
push di ;
push si ;
cmp _memory_model,0 ;near or far?
jle begin ;jump if near
inc bp ;else add 2 to BP
inc bp ;
begin: push ds ;save DS
mov bh,_video_page ;set the video page
mov ax,[bp+4] ;get segment
mov ds,ax ;
mov si,[bp+6] ;offset
mov bl,[bp+14] ;attribute in BL
mov dh,[bp+12] ;Row
dec dh ;count from zero
mov dl,[bp+10] ;Col
dec dl ;count from zero
mov cx,[bp+8] ;NumChars
jcxz L3 ;quit if null
mov di,cx ;keep Strg ctr in DI
mov cx,1 ;write 1 char each time
L1: mov ah,2 ;function to set cursor
int 10h ;set the cursor
mov ah,9 ;function to write char
mov al,[si] ;get a character
int 10h ;write it
inc si ;forward string ptr
inc dl ;inc column position
cmp dl,80 ;beyond edge of screen?
jne L2 ;jump ahead if not
mov dl,0 ;back to left
cmp dh,24 ;bottom row?
je L2 ;jump if so
inc dh ;else forward row
L2: dec di ;dec Strg length counter
jnz L1 ;loop till finished
L3: pop ds ;
pop si ;
pop di ;
pop bp ;
cmp _memory_model,0 ;quit
jle quit ;
db 0CBh ;RET far
quit: ret ;RET near
_display_mem_b endp
_TEXT ENDS
END