Category : C Source Code
Archive   : CEXPRESS.ZIP
Filename : STRLINEB.ASM

 
Output of file : STRLINEB.ASM contained in archive : CEXPRESS.ZIP
;void string_line_b(strg,dir,col,row,length,color);
; unsigned char *strg,dir,col,row,length,color;

EXTRN _memory_model:byte
EXTRN _video_page:byte

_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT
PUBLIC _string_line_b
_string_line_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 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],si ;move Strg ptr in FAR case
mov dl,[bp+8] ;Col in DL
dec dl ;count from 0
mov dh,[bp+10] ;Row in DH
dec dh ;count from 0
mov ah,2 ;function to set cursor
int 10h ;set cursor to line
sub cx,cx ;
mov cl,[bp+12] ;string length in DI
mov di,cx ;

or di,di ;test for zero
jz L6 ;quit if zero
mov bl,[bp+14] ;attribute in BL
cmp byte ptr[si],0 ;test for null string
je L6 ;
mov cx,1 ;number chars to write in function
L1: mov al,[si] ;get char from Strg
inc si ;forward Strg ptr for next time
cmp al,0 ;end of Strg?
jne L2 ;jump if not
mov si,[bp+4] ;set ptr back to start
jmp short L1 ;restart
L2: mov ah,9 ;function to write char
int 10h ;write it
dec di ;dec length counter
or di,di ;zero yet?
jz L6 ;quit if zero
L3: mov ah,[bp+6] ;get direction param
cmp ah,'V' ;write vertically?
je L4 ;jump ahead if so
cmp ah,'v' ;test for small 'v'
je L4 ;jump if small 'v'
inc dl ;inc col number
jmp short L5 ;jump ahead
L4: inc dh ;inc row number
L5: mov ah,2 ;function to set cursor
int 10h ;reset cursor
jmp short L1 ;go write next
L6: pop ds ;
pop si ;
pop di ;
pop bp ;
cmp _memory_model,0 ;quit
jle quit ;
db 0CBh ;RET far
quit: ret ;RET near
_string_line_b endp
_TEXT ENDS
END


  3 Responses to “Category : C Source Code
Archive   : CEXPRESS.ZIP
Filename : STRLINEB.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/