Need help with my source code 
Author Message
 Need help with my source code

   I'm making a disk cleaning utility (format a:).  Well, it compiles
fine.  It links fine.  One problem.  When I run it, it freezes my computer
and beeps like no one's business.  Here is the source.  If you can help
please post or email me.  Thank you.

title 'Clean that A drive'

.model small

.data
String          db 'Thank you for using me', 13, 10
StringLen       EQU $ - string

.code

Start:

mov     bx, 1           ; 0 = default, 1 = a:, 2 = b:, etc
mov     ch, 08h

mov     cl, 42h         ; Format track on logical drive

mov     dx, seg FvBlock
mov     ds, dx
mov     dx, offset FvBlock

mov     ax, 440Dh
int     21h

FVBLOCK STRUC
        fvSpecFunc      db 2
        fvHead          dw 1
        fvCylinder      dw 1
        fvTracks        dw 1
FVBLOCK ENDS

.stack 256

END START



Sat, 26 Sep 1998 03:00:00 GMT  
 Need help with my source code
   I'm making a disk cleaning utility (format a:).  Well, it compiles
fine.  It links fine.  One problem.  When I run it, it freezes my computer
and beeps like no one's business.  Here is the source.  If you can help
please post or email me.  Thank you.

title 'Clean that A drive'

.model small

.data
String          db 'Thank you for using me', 13, 10
StringLen       EQU $ - string

.code

Start:

mov     bx, 1           ; 0 = default, 1 = a:, 2 = b:, etc
mov     ch, 08h

mov     cl, 42h         ; Format track on logical drive

mov     dx, seg FvBlock
mov     ds, dx
mov     dx, offset FvBlock

mov     ax, 440Dh
int     21h

FVBLOCK STRUC
        fvSpecFunc      db 2
        fvHead          dw 1
        fvCylinder      dw 1
        fvTracks        dw 1
FVBLOCK ENDS

.stack 256

END START



Sat, 26 Sep 1998 03:00:00 GMT  
 Need help with my source code


Quote:
>   I'm making a disk cleaning utility (format

a:).  Well, it compiles
Quote:
>fine.  It links fine.  One problem.  When I run

it, it freezes my computer
Quote:
>and beeps like no one's business.  Here is the

source.  If you can help

Quote:
>please post or email me.  Thank you.

>title 'Clean that A drive'

>..model small

>..data
>String              db 'Thank you for using me', 13,
10
>StringLen   EQU $ - string

>..code

>Start:

>mov bx, 1           ; 0 = default, 1 = a:, 2 =
b:, etc
>mov ch, 08h

>mov         cl, 42h         ; Format track on logical
drive

>mov dx, seg FvBlock
>mov ds, dx
>mov dx, offset FvBlock

>mov ax, 440Dh
>int 21h

>FVBLOCK STRUC
>    fvSpecFunc      db 2
>    fvHead          dw 1
>    fvCylinder      dw 1
>    fvTracks        dw 1
>FVBLOCK ENDS

>..stack 256

>END START

Here is a program that should do it... I haven't
tested it, so...  BTW, I'm using A86, the compiler
from hell, so it doesn't have all that extra stuff
that yours had... add it yourself.

JMP START

FormatBuffer:
        db 00h  ;track 0
        db 00h  ;head 0
        db 00h  ;sector 0
        db 02h  ;I'm assuming a 1.44M floppy
                ;00h = 128 byte sectors,
                ;01h = 256, 02h = 512, 03h = 1024

Message db 'Format the A: drive?$'
EndMess db 'Thank you for using me!$'
Counter dw 1024h        ;how many tracks are    
                        ;there??  I really
                        ;need to study my disks
Start:
        mov ah,09h
        lea dx,OFFSET Message
        int 21h

        xor ah,ah
        int 16h
        cmp al,'y'      ;make sure to ask first!
        je Format       ;unless you're trying to
        cmp al,'Y'      ;write a stupid trojan,
        je Format       ;in which case I'm sorry
        jmp Error       ;to tell you... 05h only
                        ;works on floppies!
Format:
        mov al,0FFh     ;change this to # of    
                ;sectors per track
        mov ah,05h
        mov ch,00h
        mov dh,00h
        mov dl,00h      ;drive A: with int 13
        lea es:[bx],OFFSET FormatBuffer
        int 13h
        dec BYTE PTR Counter
        inc ch
        inc BYTE PTR FormatBuffer
        inc BYTE PTR[FormatBuffer+2]
        cmp WORD PTR Counter, 0000h
        ja Format

Success:
        mov al,00h
        jmp Quit

Error:
        mov al,01h      ;returns 01 on error

Quit:
        mov ah,09h
        lea dx,OFFSET EndMess
        int 21h
        mov ah,4Ch
        int 21h

Like I said before... did I?  This program has not
been tested, but it SHOULD work.  If it doesn't
work, I do not want corrections to it, as I do
not really care about learning to format disks...

                        --KALi{*filter*}iA
------------------------------------------------------
I am the eggman...
They are the eggmen...
I am the Walrus!
Goo goo ga chu!
------------------------------------------------------



Sun, 27 Sep 1998 03:00:00 GMT  
 Need help with my source code

Quote:
>  I'm making a disk cleaning utility (format a:).
> Well, it compiles
>fine.  It links fine.  One problem.  When I run
>it, it freezes my computer
>and beeps like no one's business.  Here is the
>source.  If you can help
>please post or email me.  Thank you.

Suddenly realizing something important and looking
at the source code instead of just blindly
replying, I realized that this program appears to
NEVER terminate, NEVER print out the string, NEVER
loop enough to actually format the drive... etc..
Exactly WHAT IS this program?

                        --KALi{*filter*}iA
------------------------------------------------------
I am the eggman...
They are the eggmen...
I am the Walrus!
Goo goo ga chu!
------------------------------------------------------



Sun, 27 Sep 1998 03:00:00 GMT  
 Need help with my source code

Quote:

>I'm making a disk cleaning utility (format a:).  Well, it compiles
> fine. It links fine. One problem. When I run it, it freezes my computer
> and beeps like no one's business.
> ..data
> String          db 'Thank you for using me', 13, 10
> StringLen       EQU $ - string

> ..codeEton,

just a question.
Did you use int 21h, function 9 to write that string to the screen ?
If you did, remember that the string should be terminated with a $-sign.
The rest of your code looks pretty OK to me, although I never used this
function myself before..:)
Danny


Mon, 28 Sep 1998 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. We need your help to find some links, documents, sources codes and with the EMAg

2. Help needed: program that prints out its source code when RUN

3. Help needed: looking for source code of CA...

4. HELP: Need Mastermind source code

5. File transfer source code needed urgently. Please help

6. Help needed with MARS source code

7. NEED HELP: ASM Floating Point Math Source Code

8. Need help with source code lost

9. Find Forth source (was: 8031 Forth Source Code Needed)

10. LOST SOURCE CODE IN CLIPPER : HELP HELP HELP !!!!!

11. Data Recovery SOURCE CODE ( SOURCE CODES of Professional Data Recovery Software )

12. Converting FORTRAN source code to C source code

 

 
Powered by phpBB® Forum Software