func_adjustfilename:

push hl

ld hl,$c801
ld de,$c802
ld bc,10
ld a,32
ld (hl),a
ldir

pop hl

ld de,$c801

func_adjustfilename_1:

ld a,(hl)
cp 46
inc hl
jr z,func_adjustfilename_2

or a
jr z,func_adjustfilename_exit

ld (de),a

inc de
ld a,e
cp 9

jr nz,func_adjustfilename_1

func_adjustfilename_2:
ld de,$c809
ld a,(hl)
cp 46
jr nz,func_adjustfilename_3
inc hl

func_adjustfilename_3:
ld a,(hl)
or a
jr z,func_adjustfilename_exit

ld (de),a
inc hl
inc de
ld a,e
cp 12

jr nz,func_adjustfilename_3

func_adjustfilename_exit:

ret