News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Average line length of sources

Started by jj2007, September 09, 2023, 01:03:25 AM

Previous topic - Next topic

jj2007

include \masm32\MasmBasic\MasmBasic.inc
  Init
  GetFiles C:\Masm32\Examples\*.asm|*.inc
  Print Str$("There are %i *.asm and *.inc files in the examples folder\n", eax)
  xor ebx, ebx
  For_ each esi in Files$()
    void Exist(esi)
    push GfSize(-1)
    Recall esi, L$()
    xchg eax, ecx
    pop eax
    cdq
    div ecx
    add ebx, eax
  Next
  mov ecx, Files$(?)
  mov eax, ebx
  cdq
  div ecx
  Inkey Str$("Average line length of *.asm and *.inc sources is %i bytes", eax)
EndOfCode

Output:
There are 416 *.asm and *.inc files in the examples folder
Average line length of *.asm and *.inc sources is 28 bytes