Category : C Source Code
Archive   : CEXPRESS.ZIP
Filename : COPYRGHT.ASM
; char *strg,*return_strg;
; unsigned short number_chars;
EXTRN _memory_model:byte
EXTRN _error_code:byte
_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT
PUBLIC _copy_right
_copy_right proc near
push bp ;
mov bp,sp ;set up stack frame
push di ;
push si ;
push ds ;
cmp _memory_model,0 ;near or far?
jle begin ;jump if near
inc bp ;else add 2 to BP
inc bp ;
begin: cmp _memory_model,2 ;data near or far?
jb L0 ;jump if near
lds si,dword ptr[bp+8] ;DS:SI pts to return strg
les di,dword ptr[bp+4] ;ES:DI pts to source strg
mov bx,[bp+12] ;number chars
jmp short L1 ;
L0: mov si,[bp+6] ;NEAR case
mov di,[bp+4] ;
mov bx,[bp+8] ;
mov ax,ds ;ES = DS
mov es,ax ;
L1: mov bp,1 ;errorcode 1 = strg is null
mov byte ptr [si],0 ;return null string if error
cmp byte ptr es:[di],0 ;null?
je L2 ;quit if so
or bx,bx ;number_chars zero?
jz L2 ;quit if so
inc bp ;errorcode 2 = number_chars too large
mov cx,0ffffh ;counter
mov dx,di ;copy strg start position
cld ;will search for end of string
mov al,0 ;seek null
repne scasb ;go find end
dec di ;point back to terminator
sub dx,di ;figure string length
neg dx ;
cmp dx,bx ;number_chars within string length?
jb L2 ;
mov bp,0 ;errorcode 0 = no error
add si,bx ;point SI to end of return string
inc bx ;number chars, plus 1 for null
xchg di,si ;exchange ptrs
mov ax,ds ;
push es ;
mov es,ax ;
pop ds ;
mov cx,bx ;counter
std ;reverse direction
rep movsb ;
cld ;reset direction
L2: pop ds ;restore DS
mov ax,bp ;fetch errorcode
mov _error_code,al ;set it
pop si ;
pop di ;
pop bp ;
cmp _memory_model,0 ;quit
jle quit ;
db 0CBh ;RET far
quit: ret ;RET near
_copy_right ENDP
_TEXT ENDS
END
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
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/