-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmusic.asm
66 lines (52 loc) · 1.54 KB
/
music.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
; ***************************************************************************************
; ***************************************************************************************
; ** Music - basic interface to call modplay.lib
; ** Require ...
.DATA
PSP_ES dw 0
ERROR_SOUNDDRIVE1 db "Cannot initialize sound driver...", 13, 10, "$"
ERROR_SOUNDDRIVE2 db "Unable to load module file...", 13, 10, "$"
.CODE
START_MUSICDRIVER:
mov ax, @DATA
mov ds, ax
mov [PSP_ES], es
xor bx, bx
xor ax, ax
call far ptr Mod_Driver ; Detection & Initialization
or ax, ax
jnz @@found_modfile
; error if can't initialize music
mov dx, OFFSET ERROR_SOUNDDRIVE1
mov ah, 9
int 21h
jmp @@end_music_init
@@found_modfile:
call far ptr [Mod_End_Seg] ; returns: ax=end segment
mov bx, ax
mov ax, [PSP_ES]
mov es, ax
sub bx, ax ; bx=prog length in paragraphs
mov ah, 4Ah
int 21h ; set memory control block
mov bx, 2
mov dx, OFFSET MOD_FILE
call far ptr Mod_Driver ; load module in ds:dx
or ax, ax
jnz @@end_music_init
; error if mod file not found
mov dx,OFFSET ERROR_SOUNDDRIVE2
mov ah, 9
int 21h
jmp END_MUSICDRIVER
@@end_music_init:
ret
START_MUSIC:
mov bx, 3
mov ax, 1
call far ptr Mod_Driver ; start playing, looping is on
ret
END_MUSICDRIVER:
mov bx, 1
call far ptr Mod_Driver
ret