home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
CPROG
/
CEXPRESS.ZIP
/
SCREEN.ASM
/
WRTVERT.ASM
< prev
next >
Wrap
Assembly Source File
|
1989-05-03
|
2KB
|
79 lines
;void write_vertical(strg,col,row,color);
; unsigned char *strg,col,row,color;
EXTRN _memory_model:byte
EXTRN _video_buffer:word
EXTRN _snow_protect:byte
_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT
PUBLIC _write_vertical
_write_vertical proc near
cld ;direction flag forward
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 ;
mov ax,_video_buffer ;fetch _video_buffer
mov es,ax ;ES points to buffer
mov bl,_snow_protect ;fetch _snow_protect before DS change
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] ;near case
L00: mov [bp+4],bl ;save _snow_protect
sub ax,ax ;
mov al,[bp+8] ;row to AX
dec ax ;count from 0
mov dl,160 ;bytes per row
mul dl ;times rows
sub dx,dx ;
mov dl,[bp+6] ;column to DX
dec dx ;count from 0
shl dx,1 ;double for attributes
add ax,dx ;add to row offset
mov di,ax ;ES:DI pts to screen
mov ah,[bp+10] ;attribute to AH
sub cx,cx ;clear CX
cmp byte ptr[si],0 ;test for null string
je L5 ;
L1: mov al,[si] ;char to AL
inc si ;inc string pointer for next time
cmp al,0 ;test for 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 char-attri in BX
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 ;return char-attri to AX
L4: stosw ;write the char & attri
add di,158 ;ptr to next row
jmp short L1 ;loop
L5: sti ;reenable interrupts
pop ds ;
pop si ;
pop di ;
pop bp ;
cmp _memory_model,0 ;quit
jle quit ;
db 0CBh ;RET far
quit: ret ;RET near
_write_vertical endp
_TEXT ENDS
END