title 'WILDXPND expands wild card referances' ; extrn .dos; preserve regs, set flgs on a ; srch1st equ 011h srchnxt equ 012h setdma equ 01ah ; ; Fill buffer hl^ up with wild card expansions of fcb de^ ; Returned entries are the 1st 16 bytes of the dir entry. ; Return count of files in bc, pointer to unused buff in hl. ; CAUTION - modifies defdma setting. Buffer must provide at ; least 128 bytes more than space required for storage. ; Zero flag if no matching files found. ; Carry if no memory, based on stack pointer to top of memory. ; a,f,b,c,h,l .wildx:: lxi b,0; clear count mvi a,srch1st wex1: push psw; save command (srch1st/nxt) xchg mvi a,setdma; to current buffer top call .dos xchg pop psw call .dos; srch1st/srchnxt inr a jz wex4; no more found dcr a add a; * 32, size of dir entry add a add a add a add a push b; save file found count push d; save ^fcb add l mov c,a adc h sub c mov b,a; point to dma entry mvi d,16; for 16 bytes wex2: ldax b mov m,a inx h inx b dcr d jnz wex2; copy more of entry xchg lxi h,-160; stack margin reqd dad sp mov a,l sub e mov a,h sbb d; carry (borrow) if no memory xchg pop d pop b rc; out of memory inx b; advance file found count mvi a,srchnxt jmp wex1; continue wex4: mov a,b ora c ret; with z flag if none found ; end