Category : Utilities for DOS and Windows Machines
Archive   : DUMP.ZIP
Filename : STRFILL.S

 
Output of file : STRFILL.S contained in archive : DUMP.ZIP
TITLE strfill: Fill a string with a single character for 8088/86.
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
; pid=strfill version = 1.1 November 4, 1985
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
; language: Xenix 8088/8086 assembly (DOS cross development system)
; sccs keywords - - @(#)8088/8086 C subroutine strfl86.s 1.1@(#)
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
; change history
; 04 November 1985 - Initial release of strfill for 8088/8086 machines
;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
; strfill version 1.1; Copyright (c) 1985, by Eric Erickson
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
;
; strfl86: fill a string for a specified length with a single padding character
;
; syntax:
; strfill(string, length, pad);
;
; char *string;
; int length;
; char pad;
;
; Memory Model: small, medium
;
; Stack offsets for parameters
;
; string=4 address of string
; length=6 length of string to fill
; pad=8 padding character to fill with
;
; Register usage
; bp: pointer to current top of stack (standard C linkage)
; sp: stack pointer
; al: byte character to fill string with
; si: counter for number of bytes filled
; di: number of bytes to fill in string
; bx: address of byte being filled
;
;
ASSUME CS:_TEXT
PUBLIC _strfill
_TEXT SEGMENT WORD PUBLIC 'CODE'
PUBLIC _strfill
_strfill PROC NEAR
push bp ; save current bp register
mov bp,sp ; set new bp register for stack access
push di ; save register about to be trashed
push si ; ditto for this one
push bx ; and this one also
;
; Do all variable initialization
;
mov si,1 ; initialize bytes filled counter
;
; Get all the initial values needed to do the work. The values retrieved are:
; length to fill
; character to fill with
; starting address of string to fill
;
mov di,[bp+6] ; get the length to fill
mov al,[bp+8] ; get the fill character
mov bx,[bp+4] ; get the starting address of the string
jmp check_limit ; check for zero length fill (why anyone would
; do this I don't know but lets check it anyway)
fill_loop:
mov [bx],al ; insert the fill character
inc si ; increment the count of bytes filled
inc bx ; increment the target pointer
check_limit:
cmp si,di ; check to see if we are done filling
jl fill_loop ; sorry, we're not; go back and continue
;
; All done filling string. Set EOS marker and leave
;
mov BYTE PTR [bx],0 ; set the end of string marker
xor ax,ax ; zero out return code parameter
pop bx ; restore all
pop si ; the registers
pop di ; we trashed doing work
mov sp,bp ; restore the stack pointer
pop bp ; get bp back also
ret
_strfill ENDP

_TEXT ENDS
END


  3 Responses to “Category : Utilities for DOS and Windows Machines
Archive   : DUMP.ZIP
Filename : STRFILL.S

  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/