home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
CPROG
/
CEXPRESS.ZIP
/
SCREEN.ASM
/
DISPLAY.ASM
< prev
next >
Wrap
Assembly Source File
|
1989-05-03
|
2KB
|
86 lines
;void display(strg,col,row,color);
; unsigned char *strg,col,row,color;
EXTRN _memory_model:byte
EXTRN _video_buffer:word
EXTRN _video_page:byte
EXTRN _snow_protect:byte
_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT
PUBLIC _display
_display proc near
push bp ;
mov bp,sp ;set stack frame
push di ;
push si ;
cld ;direction flag forward
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 Turbo's DS
mov ax,_video_buffer ;fetch _video_buffer
mov es,ax ;place in ES
mov bl,_snow_protect ;fetch _snow_protect
mov bh,_video_page ;fetch _video_page
cmp _memory_model,2 ;data near or far?
jb L0 ;jump if near
lds si,dword ptr[bp+4] ;DS:SI pts to Strg
inc bp ;add 2 to bp since dword ptr
inc bp ;
jmp short L00 ;
L0: mov si,[bp+4] ;
L00: mov [bp+4],bx ;save _video_page and _snow_protect
sub ax,ax ;
mov al,[bp+6] ;get Col value
mov di,ax ;
mov al,[bp+8] ;get Row value
dec ax ;count from 0
mov dl,160 ;bytes per row
mul dl ;times rows
dec di ;count cols from 0
shl di,1 ;double for attributes
add di,ax ;ES:DI pts to lst pos
cmp byte ptr[si],0 ;null string?
je L5 ;if null, set cursor and quit
mov ah,[bp+10] ;get attribute
L1: lodsb ;get a character
cmp al,0 ;end of string?
je L5 ;
cmp byte ptr[bp+4],0 ;protect against snow?
je L4 ;jump ahead if not
mov dx,3dah ;status byte address
mov bx,ax ;save AH contents
L2: in al,dx ;get status byte
test al,1 ;test bit
jnz L2 ;loop till 0
cli ;disable interrupts
L3: in al,dx ;get status byte
test al,1 ;test bit
jz L3 ;loop till 1
mov ax,bx ;restore AH contents
L4: stosw ;write it with attribute
jmp short L1 ;loop
L5: sti ;reenable interrupts
mov bh,[bp+5] ;video page to BH
mov ax,di ;screen pointer
shr ax,1 ;div by 2 for attributes
mov cl,80 ;div by number cols
div cl ;make the division
mov dh,al ;row number
mov dl,ah ;col number
mov ah,2 ;function to set cursor
int 10h ;set curs to final pos
L6: pop ds ;
pop si ;
pop di ;
pop bp ;
cmp _memory_model,0 ;quit
jle quit ;
db 0CBh ;RET far
quit: ret ;RET near
_display endp
_TEXT ENDS
END