• Domingo 6 de Julio de 2025, 12:10

Mostrar Mensajes

Esta sección te permite ver todos los posts escritos por este usuario. Ten en cuenta que sólo puedes ver los posts escritos en zonas a las que tienes acceso en este momento.


Temas - Ares

Páginas: [1]
1
ASM (Ensamblador) / Dir En Nasm, Pero Lo Necesito En Masm :s
« en: Domingo 25 de Noviembre de 2007, 01:00 »
Hola, soy nuevo aqui, mi problemita es el siguiente tengo este código en NASM y lo necesito en MASM el código es el siguiente

org 100h

start:

mov ah, 0x1A   ; Set DTA table adress
mov dx, DTA
int 21h

;call clean_name

mov ah, 0x4E
xor cx, cx      ; no attributes
mov dx, squery
int 21h
jc theend       ; no files matching query found

mov ah, 9
mov dx, fname
int 21h

find_next:

mov ah, 0x4F
mov dx, squery
int 21h      ; find next matching file
jc theend    ; no more files found

mov ah, 9
mov dx, fname
int 21h

jmp find_next


theend:

mov ah, 0x4C
int 21h


clean_name:
mov cx, 13
mov di, fname
xor ax, ax
repe stosb ; fill name with zeros incase memory has some ugly stuff or smth left from last search
ret


squery db "*.*", 0x0 ; search query, must end with zero

DTA resb 0x15 ; ignore useless DOS data
fattr db 0x0  ; file attribute
ftime dw 0x0  ; file creation/modification time
fdate dw 0x0  ; file creation/modification date
fsize dw 0x0  ; file size
fsmth dw 0x0
fname resb 14 ; file name terminated with zero
      db 0xD, 0xA ; New line
      db "$" ; 0xD - tells DOS to go to new line.

eh estado trabajando... según yo, para pasarlo a MASM y me quedo lo siguiente con el MASM611 que me lo compila ya sin errores pero tambien sin resultados:


.MODEL TINY
.STACK 100H
.186
.DATA
        squery   DB      '*.*'    ; search query, must end with zero
   DTA    dw   0    ; ignore useless DOS data
   FATTR    DB    0    ; file attribute
   ftime    DW    0     ; file creation/modification time
   fdate    DW    0     ; file creation/modification date
   fsize    DW    0    ; file size
   fsmth    DW    0
   fname    DW    0       ; file name terminated with zero
         DB 13, 10 ; New line
          DB '$' ; 0xD - tells DOS to go to new line.

.CODE
.STARTUP

start:

   mov ah, 26   ; Set DTA table adress
   mov dx, DTA
   int 21h

   ;call clean_name

   mov ah, 78
   xor cx, cx      ; no attributes
   mov dx, 'NOSE'
   int 21h
   jc theend       ; no files matching query found

   mov ah, 9
   mov dx, fname
   int 21h

find_next:

   mov ah, 79
   mov dx, 'NOSE'
   int 21h      ; find next matching file
   jc theend    ; no more files found

   mov ah, 9
   mov dx, fname
   int 21h

   jmp find_next


theend:

   mov ah, 76
   int 21h


clean_name:
   mov cx, 13
   mov di, fname
   xor ax, ax
   rep stosb ; fill name with zeros incase memory has some ugly stuff or smth left from last search
   ret

.EXIT
END

cualquier ayuda o tutorial o referencia de donde puedo encontrar solución es bienvenida, mi intención es hacer una emulación en MASM del comando dir, de antemano gracias.

Páginas: [1]