home *** CD-ROM | disk | FTP | other *** search
- ;[]------------------------------------------------------------------------[]
- ;| |
- ;| (c) 1993,1994 by Marc van Shaney , aka Kaya Memisoglu |
- ;| |
- ;| Dieser Assembler-Source-Code unterliegt dem Urheberrecht von Kaya |
- ;| Memisoglu und darf auch nur mit seiner schriftlichen Genehmigung |
- ;| in kommerziellen Programmen verwendet werden. |
- ;| Ich übernehme keinerlei Verantwortung für eventuelle Schäden,die dieses |
- ;| Programm verursacht. |
- ;| |
- ;| |
- ;| 18.12.1994 Kaya Memisoglu |
- ;| |
- ;[]------------------------------------------------------------------------[]
- ;
- ;[]------------------------------------------------------------------------[]
- ;|
- ;| This is the ASM-example for CDMI. It simply loads DEMO.MOD and starts
- ;| to play this module through the PC-Loudspeaker.
- ;|
- ;| You must link this module with CDMI.OBJ, EXT386.OBJ and SPEAKER.ASM
- ;|
-
-
- P386
- LOCALS
- JUMPS
- .MODEL USE16 LARGE
- STACK 200h ;512 bytes stack shopuld be enough
-
-
- include ext386.inc
- include cdmi.inc
- include devices.inc
- include keys.inc
-
- ;This macro shrinks the allocated memory to the size really needed by the
- ;program, because DOS allocates the WHOLE memory when loading an EXE prog.
- ;This naturally is not usable if you want to allocate some DOS-Heap.
- ;(This macro is from EXEPROG.ASM by Borland Inc.)
- SHRINK_MEM MACRO
- MOV BX,SP
- ADD BX,15 ;convert SP into paragraphs
- SHR BX,4
- MOV AX,SS ;calculate size of program using ES PSP address
- ADD BX,AX
- MOV AX,ES
- SUB BX,AX
- MOV AH,4AH ;resize memory block with PSP
- INT 21H ;address in ES
- ENDM
-
-
-
- .Code
- Device_Ptr dd ?
- FName db "DEMO.MOD",0
-
-
- main PROC FAR
- .STARTUP
- SHRINK_MEM
- mov eax,DISPLAY_INFO or EXIT_ON_LOWMEM or EXIT_ON_RESET or VERBOSE_PAUSE
- call Init_EXT386 C,4096,eax
- mov bx,SEG SPEAKER_Driver
- mov es,bx
- mov ebx,es:[OFFSET SPEAKER_Driver] ;Get PC-Speaker device
- mov cs:[Device_Ptr],ebx ;Ptr to device-header
- mov ax,SEG CDMI_DMA_Address
- mov ds,ax
- les di,cs:[Device_Ptr]
- call dword ptr es:[di+DRV_INIT] ;Init device (IMPORTANT !)
- call CDMI_Load_MOD C,OFFSET FName,cs
- call CDMI_Play_Song C,22000,LOOP_FLAG,dword ptr cs:[Device_Ptr]
-
- @@1: GETKEY
- test ax,ax
- jz @@1
-
- call CDMI_Stop_Song
- call CDMI_Free_Song
- les di,cs:[Device_Ptr]
- call dword ptr es:[di+DRV_EXIT] ;DeInit device (IMPORTANT !)
- call Exit_EXT386
- .EXIT
- main ENDP
- END