The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: crazyhorse on December 12, 2011, 07:59:12 AM

Title: Hey everyone I need help with my code to run
Post by: crazyhorse on December 12, 2011, 07:59:12 AM
jj
Title: Re: Hey everyone I need help with my code to run
Post by: jj2007 on December 12, 2011, 08:13:29 AM
Quote from: crazyhorse on December 12, 2011, 07:59:12 AM
The following is a 16-bit code i'm trying to run on masm32.

I can't find the error, mind helping me out please :)


I get "There was an Error in Creating." when it runs. What is InputOutputCommand supposed to return in dx?
Title: Re: Hey everyone I need help with my code to run
Post by: sinsi on December 12, 2011, 08:37:22 AM

InputOutputCommand PROC
      ;;;;;;;;;;;;;;;;;;;;;;;;For the Input File Name;;;;;;;;;;;;;;;;;;;;
      mov di, 81h   
      mov si, OFFSET InputFileName   
           
      mov al, 20h
      repz scasb

To use a rep prefix you need to init CX, probably when the file is loaded CX=0 so no rep happens.
Title: Re: Hey everyone I need help with my code to run
Post by: jj2007 on December 12, 2011, 09:26:47 AM
Try to check your filenames before using them.
InputOutputCommand PROC
;;;;;;;;;;;;;;;;;;;;;;;;For the Input File Name;;;;;;;;;;;;;;;;;;;;
mov di, 81h
mov si, OFFSET InputFileName
mov al, 20h
mov cx, 128 ; see Sinsi's post
push di  ; you need that one, right?
repz scasb
pop di
jz FileMissing
...
FileMissing: stc
check=1
if check
mov dx, OFFSET InputFileName
mov ah, 9 ; display message the
int 21h ; traditional way
mov ax, 4c00h
int 21h
endif
ret
InputOutputCommand ENDP
Title: Re: Hey everyone I need help with my code to run
Post by: qWord on December 12, 2011, 06:15:34 PM
Quote from: crazyhorse on December 12, 2011, 07:59:12 AM
jj
Where is the question, which has been answered by jj and sinsi?