-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathimfplay.asm
66 lines (49 loc) · 1.39 KB
/
imfplay.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
66
; getthem.imf - https://modland.ziphoid.com/pub/modules/Ad%20Lib/Apogee/Bobby%20Prince/Wolfenstein%203D/
bits 16
org 100h
start:
; 2) now let's just read "getthem.imf" file content
; every 4 bytes. I'll use SI register as index.
mov si, 0 ; current index for music_data
.next_note:
; 3) the first byte is the opl2 register
; that is selected through port 388h
mov dx, 388h
mov al, [si + music_data + 0]
out dx, al
; 4) the second byte is the data need to
; be sent through the port 389h
mov dx, 389h
mov al, [si + music_data + 1]
out dx, al
; 5) the last 2 bytes form a word
; and indicate the number of waits (delay)
mov bx, [si + music_data + 2]
; 6) then we can move to next 4 bytes
add si, 4
; 7) now let's implement the delay
.repeat_delay:
mov cx, 12000 ; <- change this value according to the speed
; of your computer / emulator
.delay:
; if keypress then exit
mov ah, 1
int 16h
jnz .exit
loop .delay
dec bx
jg .repeat_delay
; 8) let's send all content of music_data
cmp si, [music_length]
jb .next_note
.exit:
; return to DOS
mov ax, 4c00h
int 21h
; 1) let's include the file "getthem.imf"
; and inform the file size
music_length dw 18644
music_data incbin "getthem.imf"
; and that's all ! let's see if it works...
; yes, it works :) !
; thanks for watching :)