eject cd ??? open & close cd door... (ASM) 
Author Message
 eject cd ??? open & close cd door... (ASM)

how to ... ???


Thu, 25 Jul 2002 03:00:00 GMT  
 eject cd ??? open & close cd door... (ASM)

wrote in alt.lang.asm:

Quote:
> how to ... ???

On a Macintosh?  A Cray?  8051 assembly language? 6502 assembly
language?

Jack Klein
--
Home: http://jackklein.home.att.net



Thu, 25 Jul 2002 03:00:00 GMT  
 eject cd ??? open & close cd door... (ASM)


   >how to ... ???

;
; CDROM   ??   Copyright (c)  Jannes Faber 1995
;

;           My www-page :   http://www.fys.ruu.nl/~faber
;
; This little program Opens & Closes your CD-ROM drive at the DOS-prompt.
;
; Syntax:       CDROM O         or      CDROM C
;
; I tried to make this COM-file as small as possible, so don't expect all
; that pretty on-line hyperhelptext in full color.
; It just opens or closes your drawer, or, if something isn't right, it
; prints 'Err' on your screen.
;

        .MODEL TINY
        .CODE

        Org     5Dh
Params  LABEL   BYTE

        .STARTUP

        mov     cl, Params
        or      cl, 00100000y                   ; Convert to lowercase
        cmp     cl, 'o'

        mov     cl, 0                           ; Open CD-rom

        jne     Err
        mov     cl, 5                           ; Close CD-rom

OpenDev:
        ; Open Device using handle:
        mov     ax, 3D21h
        mov     dx, offset FileName
        int     21h
        jc      Err

        mov     ControlBlock, cl        ; Parameter Open or Close !

        mov     bx, ax                  ; file handle into bx
        mov     ax, 4403h               ; IOCTL function
        mov     cx, 1                   ; number of bytes to write
        ;mov     dx, offset ControlBlock ; 1 byte only to Open of Close
                                ; dx is already set: FileName == ControlBlock
        int     21h
        jnc     Einde

Err:    mov     dx, offset ShowErr      ; display error
        mov     ah, 9
        int     21h

Einde:  mov     ah, 4Ch                 ; exit program
        int     21h

ShowErr         BYTE    'Err$'
ControlBlock    LABEL   BYTE      ; offset ControlBlock == offset FileName
FileName        BYTE    'MSCD000', 0, 0

                END



Thu, 25 Jul 2002 03:00:00 GMT  
 eject cd ??? open & close cd door... (ASM)
How can I assemble this ?

What number is this :
    or      cl, 00100000y              
??
Should it be 0010h ?


Quote:
>; CDROM   ??   Copyright (c)  Jannes Faber 1995
>;

>;           My www-page :   http://www.fys.ruu.nl/~faber
>;
>; This little program Opens & Closes your CD-ROM drive at the DOS-prompt.
>;
>; Syntax:       CDROM O         or      CDROM C
>;
>; I tried to make this COM-file as small as possible, so don't expect all
>; that pretty on-line hyperhelptext in full color.
>; It just opens or closes your drawer, or, if something isn't right, it
>; prints 'Err' on your screen.
>;

>        .MODEL TINY
>        .CODE

>        Org     5Dh
>Params  LABEL   BYTE

>        .STARTUP

>        mov     cl, Params
>        or      cl, 00100000y                   ; Convert to lowercase
>        cmp     cl, 'o'

>        mov     cl, 0                           ; Open CD-rom
>        jmp     OpenDev

>        jne     Err
>        mov     cl, 5                           ; Close CD-rom

>OpenDev:
>        ; Open Device using handle:
>        mov     ax, 3D21h
>        mov     dx, offset FileName
>        int     21h
>        jc      Err

>        mov     ControlBlock, cl        ; Parameter Open or Close !

>        mov     bx, ax                  ; file handle into bx
>        mov     ax, 4403h               ; IOCTL function
>        mov     cx, 1                   ; number of bytes to write
>        ;mov     dx, offset ControlBlock ; 1 byte only to Open of Close
>                                ; dx is already set: FileName == ControlBlock
>        int     21h
>        jnc     Einde

>Err:    mov     dx, offset ShowErr      ; display error
>        mov     ah, 9
>        int     21h

>Einde:  mov     ah, 4Ch                 ; exit program
>        int     21h

>ShowErr         BYTE    'Err$'
>ControlBlock    LABEL   BYTE      ; offset ControlBlock == offset FileName
>FileName        BYTE    'MSCD000', 0, 0

>                END



Tue, 30 Jul 2002 03:00:00 GMT  
 eject cd ??? open & close cd door... (ASM)
I used the orginal source that I pulled from Simtel and compiled as follows:

For Tasm:
tasm cdrom3.asm
tlink /t cdrom

For Masm:
ml /c cdrom3.asm
link /t cdrom3,cdrom3,,,,

Josiah Standing

Here is the original source (with the binary suffix):
; CDROM   AA   Copyright (c)  Jannes Faber 1995
;

;           My www-page :   http://www.fys.ruu.nl/~faber
;
; Improved by: edward beroset
;
; This little program Opens & Closes your CD-ROM drive at the DOS-prompt.
;
; Syntax:       CDROM O         or      CDROM C
;
; I tried to make this COM-file as small as possible, so don't expect all
; that pretty on-line hyperhelptext in full color.
; It just opens or closes your drawer, or, if something isn't right, it
; prints 'Err' on your screen. See the CDROM.TXT file for more info if things
; do go wrong !
;
; If anyone could tell me how to detect whether the drive is currently open
; or closed, i'd really appreciate it if you'd tell me ! I also would like
; to hear from you if you succeeded in making the COM-file significantly
; smaller than 73 bytes (not by changing the error-message into 'E' !).

        .MODEL TINY
        .CODE
DOS_TTY_WRITE           equ     009h    ; TTY style write of '$' term string
DOS_OPEN_HANDLE         equ     03dh    ; open file with handle
DOS_IOCTL               equ     044h    ; write to handle
DOS_TERMINATE           equ     04ch    ; terminate with error code

DOSINT macro function, subfunction
        IFB <subfunction>
                mov     ah,(function AND 0ffh)
        ELSE
                mov     ax,(function SHL 8) OR (subfunction AND 0ffh)
        ENDIF
        int     21h                     ; invoke DOS function
endm

        Org     5Dh
Params  LABEL   BYTE

        .STARTUP

        mov     al, [Params]
        or      al, 00100000b           ; Convert to lowercase
        cmp     al, 'o'
        je      OpenDev
        cmp     al, 'c'
        jne     ErrorHandler
        mov     [ControlBlock],5        ; Close CD-rom

OpenDev:
        ; Open Device using handle:
        mov     dx, offset FileName
        DOSINT  DOS_OPEN_HANDLE, 021h
        jc      ErrorHandler

        mov     bx, ax                  ; file handle into bx
        mov     cx, 1                   ; number of bytes to write
        dec     dx                      ; point to control block

        DOSINT  DOS_IOCTL, 3            ; issue IOCTL request
        jnc     Einde

ErrorHandler:
        mov     dx, offset ShowErr      ; display error
        DOSINT  DOS_TTY_WRITE

Einde:
        DOSINT  DOS_TERMINATE           ; exit program

ShowErr         DB      'Err$'
ControlBlock    DB      0               ; preload with open command
FileName        DB      'MSCD000 ', 0

                END



Quote:

>How can I assemble this ?

>What number is this :
>    or      cl, 00100000y              
>??
>Should it be 0010h ?


>>; CDROM   ??   Copyright (c)  Jannes Faber 1995
>>;

>>;           My www-page :   http://www.fys.ruu.nl/~faber
>>;
>>; This little program Opens & Closes your CD-ROM drive at the DOS-prompt.
>>;
>>; Syntax:       CDROM O         or      CDROM C
>>;
>>; I tried to make this COM-file as small as possible, so don't expect all
>>; that pretty on-line hyperhelptext in full color.
>>; It just opens or closes your drawer, or, if something isn't right, it
>>; prints 'Err' on your screen.
>>;

>>        .MODEL TINY
>>        .CODE

>>        Org     5Dh
>>Params  LABEL   BYTE

>>        .STARTUP

>>        mov     cl, Params
>>        or      cl, 00100000y                   ; Convert to lowercase
>>        cmp     cl, 'o'

>>        mov     cl, 0                           ; Open CD-rom
>>        jmp     OpenDev

>>        jne     Err
>>        mov     cl, 5                           ; Close CD-rom

>>OpenDev:
>>        ; Open Device using handle:
>>        mov     ax, 3D21h
>>        mov     dx, offset FileName
>>        int     21h
>>        jc      Err

>>        mov     ControlBlock, cl        ; Parameter Open or Close !

>>        mov     bx, ax                  ; file handle into bx
>>        mov     ax, 4403h               ; IOCTL function
>>        mov     cx, 1                   ; number of bytes to write
>>        ;mov     dx, offset ControlBlock ; 1 byte only to Open of Close
>>                                ; dx is already set: FileName == ControlBlock
>>        int     21h
>>        jnc     Einde

>>Err:    mov     dx, offset ShowErr      ; display error
>>        mov     ah, 9
>>        int     21h

>>Einde:  mov     ah, 4Ch                 ; exit program
>>        int     21h

>>ShowErr         BYTE    'Err$'
>>ControlBlock    LABEL   BYTE      ; offset ControlBlock == offset FileName
>>FileName        BYTE    'MSCD000', 0, 0

>>                END



Tue, 30 Jul 2002 03:00:00 GMT  
 eject cd ??? open & close cd door... (ASM)

Quote:

> Here is the original source (with the binary suffix):
...
> ; I also would like
> ; to hear from you if you succeeded in making the COM-file significantly
> ; smaller than 73 bytes (not by changing the error-message into 'E' !).
...
>         Org     5Dh
> Params  LABEL   BYTE

>         .STARTUP

>         mov     al, [Params]
>         or      al, 00100000b           ; Convert to lowercase
>         cmp     al, 'o'

Hmmm, since we're getting the "Params" from the FCB, where it's *known*
to be uppercase, why force it to lower? Just a thought...

Best,
Frank



Tue, 30 Jul 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Programming CD-ROM/CD-R/CD-RW

2. Programming CD-ROM/CD-R/CD-RW

3. Opening/Closing CD-ROM drive

4. open and closing the cd drive program

5. How to eject CD?

6. ejecting a CD programmatically?

7. CD-ROM Eject

8. Cross-Platform CD Publishing - best CD-R drive/sw

9. want code/info for playing audio cd's in CD-ROM

10. CD, CD-RomRepair

11. Distinguishing CD-ROM from CD/RW drives?

12. CD-Rom: Direct Read from Music-CD ???

 

 
Powered by phpBB® Forum Software