flat assembler
Message board for the users of flat assembler.
Index
> DOS > 400 Bytes SFN directory lister :-D |
The "Hidden" attribute of files & dirs is: | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
Total Votes : 4 |
Author |
|
DOS386 28 Jun 2007, 00:54
Code: ; ; DIR BUG test - (CL) Copyleft 2007 Public domain - ABUSE at YOUR own risk !!! ; Compile with FASM ; format binary ; .COM org $0100 use16 mov al,0 mov [llend2],al mov dx,tx1 call ssprint jmp @f ;--------- tx1: db 'DIR BUG test - (CL) Copyleft 2007 Public domain - ABUSE at YOUR own risk !!!' db 13,10,13,10 db 'ADVSHR',13,10 db '543210 A:2^5=32=$20 V:8 (HOT !!) R:2^0=1',13,10,13,10 db 'Search attrib mask: ',0 @@: mov ah,[$80] cmp ah,3 ; !!! jnz qq8 ; Default to $3F mov ax,[$82] ; AL:HI - AH:LO | reversed !!! cmp ah,$40 jb @f ; No letter sub ah,7 @@: cmp al,$40 jb @f sub al,7 @@: and ax,$0F0F shl al,4 ; AL has 4 UPPER bits !!! or al,ah ; Result in AL and al,$3F ; Cut off potential f**king top bits jmp short qq7 ;----------------- qq8: mov al,$3F qq7: push ax ; "mask" mov ah,al and ah,$0F ; & Low 4 bits // reversed shr al,4 ; & High 4 bits add ax,$3030 ; Convert 0 -> ASCII "0" cmp al,$3A jb @f ; "b":below // OK, a number add al, 7 @@: cmp ah, $3A jb @f ; "b":below // OK, a number add ah, 7 @@: mov dl,al call ssputchar ; HI 4 bits || AX preserved mov dl,ah ; LO 4 bits in AH call ssputchar call ssdeol pop ax ; "mask" mov cl,al mov ch,0 mov ax,$4E00 mov dx,tx2 int $21 ; FindFirst jc llend qq3: mov al,[$95] ; RHSVDA mov cx,6 shl al,2 ; Pushing out on the top !!! qq2: shl al,1 jc @f ; Attr present !!! mov dl,'-' ; NOT present jmp short qq1 ;----------------- @@: mov bl,cl mov bh,0 mov dl,[tx3-1+bx] qq1: call ssputchar loop qq2 mov dl,$20 call ssputchar mov dx,$9E call ssprint call sseol mov ax,$4F00 ; Findnext int $21 jnc qq3 llend: call ssdeol ret ;--------- tx2: db '*.*',0 tx3: db 'RHSVDA' ssdeol: call sseol ; pass sseol: mov dl,13 call ssputchar mov dl,10 ; pass ssputchar: push ax push cx push es mov ah,2 ; In: DL int $21 inc byte [llend2] mov al,[llend2] cmp al,7 jnz qq5 mov al,0 mov [llend2],al pushw 0 pop es mov ax,[es:$046C] @@: mov cx,[es:$046C] cmp ax,cx jz @b qq5: pop es pop cx pop ax ret ;------------- ssprint: push bx ; IN: DX ||| ASCIIZ: 0 instead of "$" !!! push ax push dx mov bx,dx llprlop: mov dl,[bx] test dl,dl jz @f call ssputchar inc bx jmp short llprlop ;-------------------------- @@: pop dx pop ax pop bx ret ;----------- llend2: ;END. Download now (1'724 bytes .ZIP) : http://board.flatassembler.net/download.php?id=3914 Short ^^^ filenames only LFN lister: http://board.flatassembler.net/topic.php?t=6010 (by Rugxulo) Well, the reason why I coded it is a BUG in Enhanced DR-DOS in directory handling, it is mainly for testing the bug Syntax: Code: DIRBUG xy xy is optional, it is the attribute mask in HEX, always 2 chars, no $ , defaults to (suboptimal) value of $3F Last edited by DOS386 on 26 Aug 2008, 04:18; edited 2 times in total |
|||
28 Jun 2007, 00:54 |
|
Japheth 29 Jun 2007, 17:23
I run it under FreeDOS and MS-DOS and only SFN entries are returned - as expected.
But I won't touch the "Evil Doctor" anymore, sorry. I appreciate my health too much. |
|||
29 Jun 2007, 17:23 |
|
rugxulo 12 Jul 2007, 19:29
Yeah, DR-DOS returns bogus junk because it's finding the volume label from VFAT entries. Just don't use $3F, use $37 instead. (I mean, if you aren't looking for the volume label, don't tell it you are!)
P.S. I still say you should use a .ZIP (stored) within a .ZIP (deflated) if you want to compress like solid method (instead of .TAR in .ZIP). But whatever. |
|||
12 Jul 2007, 19:29 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.