Metropoli BBS
VIEWER: example1.asm MODE: TEXT (CP437)
; This program merely lists all the files in the current directory along with
; their sizes (in hex).
;
; Enable the FINDFILE, OPENFILE, and FILESIZE functions in FILE32 for this.
; Link this file with FILE32.

        .386p
        jumps
code32  segment para public use32
        assume cs:code32, ds:code32, ss:code32

include start32.inc
include file32.inc

public  _main

;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
; DATA
;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
filemask        db      '*.*',0
filebuffer      db      21 dup(?), 0dh,0ah,'$'

;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
; CODE
;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒

include pdosstr.rt
include putnumtm.rt

;═════════════════════════════════════════════════════════════════════════════
_main:
        mov al,4eh
mainloop:
        mov edx,offset filebuffer       ; search for first/next file
        mov edi,offset filemask
        call _findfile
        jc _exit

        mov edi,edx
        call _openfile                  ; get size of file and put to buffer
        call _filesize
        call _closefile
        add edx,13
        mov cl,7
        call _putnumtomem

        mov edx,edi                     ; filename is zero terminated, fill
        mov ecx,14                      ;  in blanks.
        xor al,al
        repnz scasb
        dec edi
        mov al,' '
        rep stosb

        call _putdosstr                 ; put to screen

        mov al,4fh
        jmp mainloop


code32  ends
        end

[ RETURN TO DIRECTORY ]