Вы находитесь на странице: 1из 11

td_win32asm_210.asm

;==============================================================================

; Test Department's WINDOWS 32 BIT x86 ASSEMBLY TUTORIAL'S

;==============================================================================

;==============================================================================

; ==> Part 210 : simple audio cd player

;------------------------------------------------------------------------------

; Hello again,

; Today we program a simple Audio CD Player. You need the multimedia reference.

; On my homepage you can find a link to this reference ( Mmedia.hlp ).

; Load the multimedia reference & search for "Classifications of MCI Commands".

; This seems to be a good starting point.

; There are two ways to work with multimedia devices:

; 1. API "mciSendCommand" most times uses a structure.

; 2. API "mciSendString" works with strings.

; However here I use API "mciSendCommand". You must also include winmm.lib.

; All "buttons" are menu bar items defined in the resource file ( rsrc.rc ) !!!

; Any question ? Refere to the tutorials before or email me

; "lpfnWndProc" is a pointer to the subroutine label "WindowProc" ( WP1 ) where

; all the action code for this main window resist.

; "lpfnWndProc" is part of WndClassEx structure used by API RegisterClassEx.

;==============================================================================

; Assembler directives

;------------------------------------------------------------------------------

.386

210

; specifies the processor our program want run on ; always the same for Win95 (32 Bit) ; case sensitive !!!

.Model Flat ,StdCall option casemap:none

;==============================================================================

; Include all files where API functions resist you want use

; You must set the correct path to the include and library files

;------------------------------------------------------------------------------

include D:\Masm32\include\windows.inc includelib kernel32.lib includelib user32.lib includelib winmm.lib

;==============================================================================

; Declaration of used API functions,take a look into WIN32.HLP and *.inc files

;------------------------------------------------------------------------------

GetModuleHandleA

PROTO :DWORD

LoadIconA

PROTO :DWORD,:DWORD

LoadCursorA

PROTO :DWORD,:DWORD

RegisterClassExA

PROTO :DWORD

CreateWindowExA

PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,

ShowWindow

:DWORD,:DWORD,:DWORD,:DWORD,:DWORD PROTO :DWORD,:DWORD

UpdateWindow

PROTO :DWORD

GetMessageA

PROTO :DWORD,:DWORD,:DWORD,:DWORD

TranslateMessage

PROTO :DWORD

DispatchMessageA

PROTO :DWORD

PostQuitMessage

PROTO :DWORD

Page 1

td_win32asm_210.asm

DefWindowProcA

PROTO :DWORD,:DWORD,:DWORD,:DWORD

ExitProcess

PROTO :DWORD

MessageBoxA

PROTO :DWORD,:DWORD,:DWORD,:DWORD

DestroyWindow

PROTO :DWORD

SendMessageA

PROTO :DWORD,:DWORD,:DWORD,:DWORD

mciSendCommandA

PROTO :DWORD,:DWORD,:DWORD,:DWORD

mciGetErrorStringA

PROTO :DWORD,:DWORD,:DWORD

;==============================================================================

; .const

;------------------------------------------------------------------------------

.const

; - Parameter MAIN WINDOW CallBack Procedure ( API=RegisterClassExA ) -

= the constants area starts here, constants are defined and fixed

WP1_CallBack

equ [ebp+4]

;return address

WP1_hWnd

equ [ebp+8]

;handle of window who receives message

WP1_uMsg

equ [ebp+12]

;the message number

WP1_wParam

equ [ebp+16]

;extra info about the message

WP1_lParam

equ [ebp+20]

;extra info about the message

;==============================================================================

; .Data = the data area starts here, datas are defined but not fixed

;------------------------------------------------------------------------------

.Data IconName MenuName ClassName

db "TDIcon",0 db "TDMenu",0 db "TDWinClass",0

;icon name in rc file ;menu name in rc file ;name of windows class

WindowName

db "Test Department",0 ;window name titel bar

MB1Titel

db "Realy Exit ?",0

;message box name

MB1Text

db "Your choice

",0

;message box text

MB2Titel

db "MCI_ErrorString",0 ;message box name

MB2Text

db 104h dup(0)

;message box text

mci_pause_flag

dd 0h

;

;==============================================================================

; .Data? = the data? area starts here, not defined and not fixed

;------------------------------------------------------------------------------

.data?

align 4

; - MCI_OPEN_PARMS Structure ( API=mciSendCommand ) -

open_dwCallback

dd ?

open_wDeviceID

dd ?

open_lpstrDeviceType

dd ?

open_lpstrElementName

dd ?

open_lpstrAlias

dd ?

align 4

; - MCI_SET_PARMS Structure ( API=mciSendCommand ) -

set_dwCallback

dd ?

set_dwTimeFormat

dd ?

set_dwAudio

dd ?

align 4

; - MCI_PLAY_PARMS Structure ( API=mciSendCommand ) -

Page 2

play_dwCallback

dd ?

play_dwFrom

dd ?

play_dwTo

dd ?

align 4

td_win32asm_210.asm

; - MCI_GENERIC_PARMS Structure ( API=mciSendCommand ) -

generic_dwCallback

align 4

dd ?

; - WndClassEx Structure ( API=RegisterClassExA ) -

cbSize

dd ?

;size in bytes of this structure

style

dd ?

;window style

lpfnWndProc

dd ?

;address of user proc function

cbclsExtra

dd ?

;extra bytes to allocate set to 0

cbWndExtra

dd ?

;extra bytes class directive, rc file

hInstance

dd ?

;program handle(API=GetModuleHandleA)

hIcon

dd ?

;handle of icon (API=LoadIconA)

hcursor

dd ?

;handle of cursor (API=LoadCursor)

hbrBackground

dd ?

;background color, 0=transparent

lpszMenuName

dd ?

;name of menu class in resource file

lpszClassName

dd ?

;name of windows this window class

hIconSm

dd ?

;iconhandle 0=search in resource file

align 4

; - Msg Structure ( API=GetMessageA ) - member POINT = POINT structure

hWnd

dd ?

;handle of window who receives message

message

dd ?

;the message number

wParam

dd ?

;extra info about the message

lParam

dd ?

;extra info about the message

time

dd ?

;time the message was posted

xpt

dd ?

;cursor x-position, POINT struc

ypt

dd ?

;cursor x-position, POINT struc

;==============================================================================

; .CODE = our code area starts here

;------------------------------------------------------------------------------

.Code

Main = label of our program code

Main:

;==============================================================================

; Always get your program ID first (API=GetModuleHandleA)

;------------------------------------------------------------------------------

push

0h

;lpModuleHandle, 0=get program handle

call

GetModuleHandleA

;- API Function -

mov

hInstance,eax

;return value in eax=handle of program

;==============================================================================

; The API function "RegisterClassExA" registers a window class

; This API needs a "WNDCLASSEX" structure so we fill it with correct values

;------------------------------------------------------------------------------

mov

cbSize,30h

;size in bytes of WNDCLASSEX structure

mov

style,3h

;window style

mov

lpfnWndProc,OFFSET WP1

;address of user lpfnWndProc function Page 3

td_win32asm_210.asm

mov

cbclsExtra,0h

;extra bytes to allocate set to 0

mov

cbWndExtra,0h

;class directive in rc file

mov

hbrBackground,16

;background, COLOR_BTNFACE(parameter+1)

mov

lpszMenuName,OFFSET MenuName

;menu name in resource file

mov

lpszClassName,OFFSET ClassName ;name of windows class

mov

hIconSm,0h

;iconhandle 0=search in rc file

;------------------------------------------------------------------------------

; API "LoadIconA" loads an icon defined in the resource file and store the

; handle in the "WNDCLASSEX" structure

;------------------------------------------------------------------------------

push

OFFSET IconName

;icon-string or icon resource id

push

hInstance

;our program handle

call

LoadIconA

;- API Function -

mov

hIcon,eax

;handle of newly loaded icon

;------------------------------------------------------------------------------

; API "LoadCursorA" loads a default system cursor, in this case we must set

; hInstance to 0 and lpCursorName to a default system cursor value, here 32512

; Then we store the cursor handle in the "WNDCLASSEX" structure

;------------------------------------------------------------------------------

push

32512

;lpCursorName,default value in dezimal

push

0h

;hInstance, 0=default system cursor

call

LoadCursorA

;- API Function -

mov

hcursor,eax

;handle of the cursor

;------------------------------------------------------------------------------

; Now, after filled the "WNDCLASSEX" structure we call API "RegisterClassEx"

;------------------------------------------------------------------------------

push

OFFSET cbSize

;pointer to WNDCLASSEX structure

call

RegisterClassExA

;- API Function -

;==============================================================================

; API "CreateWindowExA" creates an overlapped, pop-up, or child window with an

; extended style. The return value in EAX is the handle of the new window.

; This API sends a WM_CREATE message to the window procedure (WP1).

;------------------------------------------------------------------------------

push

0h

;lpParam, extra pointer data 0=no data

push

hInstance

;hInstance, handle of our program

push

0h

;hMenu, handle window menu 0=class menu

push

0h

;hWndParent, handle parent window 0=no

push

00000082h

;intnHeight, window height pixel

push

0100h

;intnWidth, window width pixel

push

00000040h

;inty, vertical position window

push

00000140h

;intx, horizontal position window

push

04CA0000h

;dwStyle, 0=no sysmenu/close buttons

push

OFFSET WindowName

;lpWindowName, pointer to window name

push

OFFSET ClassName

;lpClassName, pointer to class name

push

0300h

;dwExStyle, extra window style 0=no

call

CreateWindowExA

;- API Function -

mov

hWnd,eax

;hwnd,return value=handle of window

;==============================================================================

; API "ShowWindow" function sets the specified window's show state.

;------------------------------------------------------------------------------

td_win32asm_210.asm

push

hWnd

;hwnd, handle of window

call

ShowWindow

;- API Function -

;==============================================================================

; API "UpdateWindow" updates the area of the specified window by sending a

; WM_PAINT message to the window if the window's update region is not empty.

;------------------------------------------------------------------------------

push

hWnd

;hwnd, handle of window

call

UpdateWindow

;- API Function -

;==============================================================================

; API "GetMessageA" retrieves a message & places it in the specified structure.

;------------------------------------------------------------------------------

LoopGetMessage:

push

0h

;wMsgFilterMax, highest message value

push

0h

;wMsgFilterMin, lowest message value

push

0h

;hWnd, handle of window who gets msg.

push

OFFSET hWnd

;lpMsg, pointer to MSG structure

call

GetMessageA

;- API Function -

cmp

eax,0h

;check if return value=0 (exit)

je

ExitPrg

;if return value is 0 goto LABEL

;==============================================================================

; API "TranslateMessage" translates key code into ASCII character messages

;------------------------------------------------------------------------------

push

OFFSET hWnd

;lpMSG, pointer to msg structure

call

TranslateMessage

;- API Function - keyboard code

;==============================================================================

; API "DispatchMessageA" function dispatches a message to a window procedure.

;------------------------------------------------------------------------------

push

OFFSET hWnd

;lpMSG, pointer to msg structure

call

DispatchMessageA

;- API Function -

jmp

LoopGetMessage

;check for message again, goto LABEL

;==============================================================================

; Next we terminate our program (API=ExitProcess)

;------------------------------------------------------------------------------

ExitPrg:

push

hInstance

;push our programm handle to exit

call

ExitProcess

;- API Function -

;##############################################################################

; The Window Procedure (API=RegisterClassExA) for this registered window.

;------------------------------------------------------------------------------

WP1:

push

ebp

;create stack frame

mov

ebp,esp

;

pushad

;push all register to the stack

mov

eax,WP1_uMsg

;move the message number to eax

;==============================================================================

; WM_CREATE (value=01h) message received ?

Page 5

td_win32asm_210.asm

; Here we open the device and set the audio and time format.

;------------------------------------------------------------------------------

WP1_uMsg_01h:

cmp

eax,1h

;check if WM_CREATE message recieved

jne

WP1_uMsg_02h

;if not goto label

;------------------------------------------------------------------------------

; API "mciSendCommandA" here opens the device

;------------------------------------------------------------------------------

mov

open_lpstrDeviceType,516

;fill MCI_OPEN_PARMS structure ;MCI_DEVTYPE_CD_AUDIO = 516

push

OFFSET open_dwCallback

;dwParam, address MCI_OPEN_PARMS struc.

push

3100h

;fdwCommand,

;MCI_OPEN_TYPE

= 2000h

;MCI_OPEN_TYPE_ID

= 1000h

push

0803h

;MCI_OPEN_SHAREABLE = 100h ;uMsg, command message, MCI_OPEN

push

0h

;IDDevice, not used with MCI_OPEN

call

mciSendCommandA

;- API Function -

call

My_mciErrorString

;- SUBROUTINE -

;------------------------------------------------------------------------------

; API "mciSendCommandA" here sets the time format and audio format.

; TMSF = track, minute, second, frame.

;------------------------------------------------------------------------------

mov

set_dwTimeFormat,0Ah

;fill MCI_SET_PARMS structure

 

;MCI_FORMAT_TMSF

= 0Ah

mov

set_dwAudio,6401h

;fill MCI_SET_PARMS structure ;MCI_SET_AUDIO_ALL = 4001h

 

= 2000h

;MCI_SET_TIME_FORMAT= 400h

;MCI_SET_ON

push

OFFSET set_dwCallback

;dwParam, address MCI_SET_PARMS struc.

push

6401h

;fdwCommand, same as above

push

080Dh

;uMsg, command message, MCI_SET

push

open_wDeviceID

;IDDevice, given from MCI_OPEN above

call

mciSendCommandA

;- API Function -

call

My_mciErrorString

;- SUBROUTINE -

jmp

WP1_return

;

;==============================================================================

; WM_DESTROY (value=02h) message received ?

;------------------------------------------------------------------------------

WP1_uMsg_02h:

cmp

eax,2h

;check if value=2h (WM_DESTROY)

jne

WP1_uMsg_111h

;if not 2h go to LABEL

call

My_CleanSystem

;- SubRoutine -

;------------------------------------------------------------------------------

; API "PostQuitMessage" indicates to Windows a request to terminate

;------------------------------------------------------------------------------

push

0h

;nExitCode, exit code=wParam

call

PostQuitMessage

;- API Function -

popad

;pop all register back from stack

xor

eax,eax

;set eax to 0 to exit our program

mov

esp,ebp

;delete stack frame

pop

ebp

;

Page 6

td_win32asm_210.asm

ret

;==============================================================================

; WM_COMMAND (value=111h) message recieved ?

;------------------------------------------------------------------------------

10h

;return and clear stack

WP1_uMsg_111h:

cmp

jne

eax,111h

WP1_uMsg_112h

;check if WM_COMMAND message recieved ;if not goto label

;------------------------------------------------------------------------------

; Check extra message info menu control, "01"-"30" item in menu bar clicked

;------------------------------------------------------------------------------

WP1_wParam_01h:

mov

eax,WP1_wParam

;extra info about the message in ax

cmp

ax,1Eh

;max. (30) ID of item in rc file

ja

WP1_wParam_0032h

;if above 1Eh (30 dezimal) goto LABEL

cwde

;convert word ax into doubleword eax

mov

play_dwFrom,eax

;store starting track in structure

call

My_mciSendCommandClose

;- SUBROUTINE -

call

My_mciErrorString

;- SUBROUTINE -

;------------------------------------------------------------------------------

; API "mciSendCommandA" here plays from the choosen track to the end of media

; The resource ID is here also used for the starting track number !

;------------------------------------------------------------------------------

mov

mci_pause_flag,0h

;set pause flag to 0h

push

OFFSET play_dwCallback

;dwParam, address MCI_PLAY_PARMS struc.

push

04h

;fdwCommand, MCI_FROM

push

0806h

;uMsg, command message, MCI_PLAY

push

open_wDeviceID

;IDDevice, given from MCI_OPEN

call

mciSendCommandA

;- API Function -

call

My_mciErrorString

;- SUBROUTINE -

jmp

WP1_return

;------------------------------------------------------------------------------

; Extra message menu control, "MCI_ErrorString" item in menu bar,ID=32h clicked

;------------------------------------------------------------------------------

WP1_wParam_0032h:

cmp

ax,0032h

;ID of menu control in rc file

jne

WP1_wParam_0033h

;if not 0032h goto LABEL

call

My_mciErrorTextbox

;- SUBROUTINE -

jmp

WP1_return

;------------------------------------------------------------------------------

; Check extra message info menu control, "Exit" item in menu bar,ID=33h clicked

;------------------------------------------------------------------------------

WP1_wParam_0033h:

cmp

ax,0033h

;ID of menu control in rc file

jne

WP1_wParam_0051h

;if not 0033h goto LABEL

;------------------------------------------------------------------------------

; API "MessageBoxA" creates a message box, we can choose if we want exit

;------------------------------------------------------------------------------

push

4h

;uType, style, 4=MB_YESNO Button

push

OFFSET MB1Titel

;lpCaption,pointer to title text

push

OFFSET MB1Text

;lpText,pointer to text message box

push

WP1_hWnd

;handle of owner window 0=no owner

call

MessageBoxA

;- API Function -

Page 7

td_win32asm_210.asm

cmp

eax,6h

;if return value=6h (IDYES) then exit

jne

WP1_return

;if return value=7h (IDNO) goto LABEL

;------------------------------------------------------------------------------

; API "DestroyWindow" function destroys the given window if we want exit prg.

;------------------------------------------------------------------------------

push

WP1_hWnd

;hwnd, handle of window to destroy

call

DestroyWindow

;- API Function -

jmp

WP1_return

;------------------------------------------------------------------------------

; Check extra message info menu control, "Play" item in menu bar,ID=51h clicked

;------------------------------------------------------------------------------

WP1_wParam_0051h:

cmp

ax,51h

;ID of item in rc file

jne

WP1_wParam_0052h

;if not 51h goto LABEL

continue_play:

call

My_mciSendCommandClose

;- SUBROUTINE -

call

My_mciErrorString

;- SUBROUTINE -

;------------------------------------------------------------------------------

; API "mciSendCommandA" here plays from track 1 to the end of media

; If "Pause" was clicked before it plays from current position to end of media

;------------------------------------------------------------------------------

mov

play_dwFrom,1h

;fill MCI_PLAY_PARMS struc., starttrack

push

OFFSET play_dwCallback

;dwParam, address MCI_PLAY_PARMS struc.

push

04h

;fdwCommand, MCI_FROM

cmp

mci_pause_flag,0h

;check pause flag

je

play_fromstart

;if pause flag=0h play from track 1

pop

eax

;pop MCI_FROM from the stack

push

0h

;if pause flag=1 play from current pos.

play_fromstart:

mov

mci_pause_flag,0h

;set pause flag to 0h

push

0806h

;uMsg, command message, MCI_PLAY

push

open_wDeviceID

;IDDevice, given from MCI_OPEN

call

mciSendCommandA

;- API Function -

call

My_mciErrorString

;- SUBROUTINE -

jmp

WP1_return

;------------------------------------------------------------------------------

; Check extra message info menu control,"Pause" item in menu bar,ID=52h clicked

; If the "Pause Flag" is 1 we jump direct to the Play function and continue

;------------------------------------------------------------------------------

WP1_wParam_0052h:

cmp

ax,52h

;ID of item in rc file

jne

WP1_wParam_0053h

;if not 52h goto LABEL

cmp

mci_pause_flag,1h

;test pause flag

je

continue_play

;if pause flag=1 then continue playing

mov

mci_pause_flag,1h

;set pause flag to 1h

;------------------------------------------------------------------------------

; API "mciSendCommandA" here pauses playing the current track

;------------------------------------------------------------------------------

push

OFFSET generic_dwCallback

;dwParam, MCI_GENERIC_PARMS structure

push

0h

;fdwCommand, 0h=no command

push

0809h

;uMsg, command message, MCI_PAUSE

push

open_wDeviceID

;IDDevice, given from MCI_OPEN

call

mciSendCommandA

;- API Function -

Page 8

td_win32asm_210.asm

call

My_mciErrorString

;- SUBROUTINE -

jmp

WP1_return

;------------------------------------------------------------------------------

; Check extra message info menu control,"Stop" item in menu bar,ID=53h clicked

;------------------------------------------------------------------------------

WP1_wParam_0053h:

cmp

ax,53h

;ID of item in rc file

jne

WP1_wParam_0054h

;if not 53h goto LABEL

mov

mci_pause_flag,0h

;set pause flag to 0h

call

My_mciSendCommandStop

;- SUBROUTINE -

call

My_mciErrorString

;- SUBROUTINE -

jmp

WP1_return

;------------------------------------------------------------------------------

; Check extra message info menu control, "Open" item in menu bar,ID=54h clicked

;------------------------------------------------------------------------------

WP1_wParam_0054h:

cmp

ax,0054h

;ID of menu control in rc file

jne

WP1_wParam_0055h

;if not 0054h goto LABEL

;------------------------------------------------------------------------------

; API "mciSendCommandA" here opens the cdrom door

;------------------------------------------------------------------------------

push

OFFSET set_dwCallback

;dwParam, address MCI_SET_PARMS struc.

push

0100h

;fdwCommand, MCI_SET_DOOR_OPEN

push

080Dh

;uMsg, command message, MCI_SET

push

open_wDeviceID

;IDDevice, given from MCI_OPEN

call

mciSendCommandA

;- API Function -

call

My_mciErrorString

;- SUBROUTINE -

jmp

WP1_return

;------------------------------------------------------------------------------

; Check extra message info menu control,"Close" item in menu bar,ID=55h clicked

;------------------------------------------------------------------------------

WP1_wParam_0055h:

cmp

ax,0055h

;ID of menu control in rc file

jne

WP1_return

;if not 0055h goto LABEL

call

My_mciSendCommandClose

;- SUBROUTINE -

call

My_mciErrorString

;- SUBROUTINE -

jmp

WP1_return

;==============================================================================

; WM_SYSCOMMAND (value=112h) message recieved ?

;------------------------------------------------------------------------------

WP1_uMsg_112h:

cmp

eax,112h

;check if WM_COMMAND message recieved

jne

WP1_return

;if not goto label

mov

eax,WP1_wParam

;extra info about the message

cmp

eax,0F060h

;SC_CLOSE=0F060h received ?

jne

WP1_return

;

call

My_CleanSystem

;- SubRoutine -

jmp

WP1_return

;==============================================================================

; API "DefWindowProcA" calls the window procedure to provide default processing

; for any window messages that an application does not process. Page 9

td_win32asm_210.asm

; This function ensures that every message is processed.

; It is called with the same parameters received by the window procedure.

;------------------------------------------------------------------------------

WP1_return:

 

popad

;pop all register from stack

push

WP1_lParam

;extra info about the message

push

WP1_wParam

;extra info about the message

push

WP1_uMsg

;the message number

push

WP1_hWnd

;handle of window who receives message

call

DefWindowProcA

;- API Function -

mov

esp,ebp

;delete stack frame

pop

ebp

;

ret

10h

;return and clear stack

;##############################################################################

;******************************************************************************

; My own subroutine(s) for a compacter code resist here

;------------------------------------------------------------------------------

My_CleanSystem:

call

My_mciSendCommandStop

;- SUBROUTINE -

call

My_mciErrorString

;- SUBROUTINE -

ret

My_mciErrorString:

;------------------------------------------------------------------------------

; API "mciGetErrorString" retrieves the last status message

;------------------------------------------------------------------------------

push

255

;cchErrorText, length of textbuffer

push

OFFSET MB2Text

;lpszErrorText, address of textbuffer

push

eax

;fdwError, error code returned by API

call

mciGetErrorStringA

;- API Function -

ret

My_mciErrorTextbox:

;------------------------------------------------------------------------------

; API "MessageBoxA" creates a message box, we can only click OK

;------------------------------------------------------------------------------

push

0h

;uType, style, 0=MB_OK Button

push

OFFSET MB2Titel

;lpCaption,pointer to title text

push

OFFSET MB2Text

;lpText,pointer to text message box

push

WP1_hWnd

;handle of owner window 0=no owner

call

MessageBoxA

;- API Function -

ret

My_mciSendCommandClose:

;------------------------------------------------------------------------------

; API "mciSendCommandA" here closes the cdrom door

;------------------------------------------------------------------------------

push

OFFSET set_dwCallback

;dwParam, address MCI_SET_PARMS struc.

push

0200h

;fdwCommand, MCI_SET_DOOR_CLOSED

push

080Dh

;uMsg, command message, MCI_SET

push

open_wDeviceID

;IDDevice, given from MCI_OPEN

call

mciSendCommandA

;- API Function -

Page 10

ret

My_mciSendCommandStop:

td_win32asm_210.asm

;------------------------------------------------------------------------------

; API "mciSendCommandA" here stops playing the current track

;------------------------------------------------------------------------------

push

OFFSET generic_dwCallback

;dwParam, MCI_GENERIC_PARMS structure

push

0h

;fdwCommand, 0h=no command

push

0808h

;uMsg, command message, MCI_STOP

push

open_wDeviceID

;IDDevice, given from MCI_OPEN

call

mciSendCommandA

;- API Function -

ret

;******************************************************************************

;==============================================================================

; end Main = end of our program code

;------------------------------------------------------------------------------

end Main

;end of our program code, entry point

;==============================================================================

; To create the exe file use this commands with your Microsoft Assembler/Linker

;------------------------------------------------------------------------------

; ml.exe /c /coff td_win32asm_210.asm

;asm command

; rc.exe /v rsrc.rc

;rc command

; cvtres.exe /machine:ix86 rsrc.res

; link.exe /subsystem:windows td_win32asm_210.obj rsrc.obj

;link command

;==============================================================================

Page 11