home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Press 1997 July
/
Sezamfile97_1.iso
/
msdos
/
utility
/
sdf105.arj
/
STRING.ASM
< prev
Wrap
Assembly Source File
|
1993-08-27
|
3KB
|
169 lines
;; ╔════════════════════════╗
;; ║ 25/08/1993 - mjova ║
;; ╚════════════════════════╝
locals
.model large
.code
; --------------------------------------------------------------------
StrCat proc c returns len: far ptr byte
public c StrCat
uses ds
arg dest: far ptr byte
arg src: far ptr byte
cld
les di, dest
mov dx, es
mov ax, di
push ax
lds si, src
mov cx, 0ffffh
mov ax, 0
repne scasb
dec di
@@loop: lodsb
and al, al
stosb
jnz @@loop
pop ax
ret
StrCat endp
;; byte PrintFileStdout(DirEntry *Entry, char far *Path);
DirEntry struc
FileName db 8 dup (?)
Ext db 3 dup (?)
Attr db ?
Reserved db 10 dup (?)
Time dw ?
Date dw ?
Cluster dw ?
Len dd ?
DirEntry ends
.data
OneLineBuffer db 132 dup (0)
extrn _Drive:byte
.code
; --------------------------------------------------------------------
PrepareEntry proc c
lea di, OneLineBuffer
xor bx, bx
mov cx, 8
@@Loop: mov al, es:[si+bx]
mov ds:[di+bx], al
inc bx
loop @@Loop
mov ds:[di+bx], byte ptr '.'
inc di
mov cx, 3
@@Loop1: mov al, es:[si+bx]
mov ds:[di+bx], al
inc bx
loop @@Loop1
mov ds:[di+bx], byte ptr ' '
inc bx
mov al, _Drive
add al, 'A'
mov ds:[di+bx], al
inc bx
mov ds:[di+bx], byte ptr ':'
inc bx
mov ds:[di+bx], byte ptr '\'
inc bx
mov ds:[di+bx], byte ptr 0
ret
PrepareEntry endp
; --------------------------------------------------------------------
PrintFileStdout proc c returns len: far ptr byte
public c PrintFileStdout
arg Entry: far ptr DirEntry
arg Path: far ptr byte
les si, Entry
call PrepareEntry
les bx, Path
push es
push bx
lea bx, OneLineBuffer
push ds
push bx
call StrCat
pop bx
add sp, 6
mov es:[di-1], byte ptr 0dh
mov es:[di+0], byte ptr 0ah
inc di
mov dx, bx
sub di, bx
mov cx, di
mov bx, 1
mov ax, 4000h
int 21h
ret
PrintFileStdout endp
; --------------------------------------------------------------------
PrintFileVideo proc c returns len: far ptr byte
public c PrintFileVideo
arg Entry: far ptr DirEntry
arg Path: far ptr byte
les si, Entry
call PrepareEntry
les bx, Path
push es
push bx
lea bx, OneLineBuffer
push ds
push bx
call StrCat
pop bx
add sp, 6
mov es:[di-1], byte ptr 0dh
mov es:[di+0], byte ptr 0ah
inc di
mov dx, bx
sub di, bx
mov cx, di
mov bx, 1
mov ax, 4000h
int 21h
ret
PrintFileVideo endp
end