2 years ago
#25329
Fract
Is it possible to play PCM sound (.WAV) using 'Direct Mode' in DOS and display animation simultaneously?
I have this working code in order to play PCM sound (.WAV) using 'Direct Mode' in DOS: ASM code plays .WAV in DOS
It works perfectly (including timing, etc.).
However I'd like to improve this code so meanwhile I play the .WAV file, I'd like to display an animation in 320*200 video mode. I'd like to change memory pages as well, something like this:
mov al,0x13
int 0x10
MAIN:
mov ax,08000h
mov es,ax
push cs
pop ds
;[put animation code here: e.g. one frame of a rotating cube at a time]
push es ; then change the video memory page and clear the screen
pop ds
mov ax, 0a000h
mov es,ax
mov cx,32001
xor si,si
mov di,si
rep movsw
mov ah,0x11
int 0x16
jz near MAIN ; and jump back to MAIN
So how to merge the two codes? How to play a .WAV file in DOS and display an animation simultaneously? It would be also cool, if displayed frames and played 'music chunks' could be synchronized in a way that if you have a slower machine and if you can display e.g. just 5 frames/second then you should hear 5 'chunks of music'/second. In other words: less frames/second -> sloooower music. Or vica versa: skipping frames if the animation is too slow. The above mentioned code that plays the .WAV file has a waiting loop, probably we could put the animation code here, but both codes use ES register and stuff, so they cannot be easily merged. How to solve the register collision?
assembly
nasm
masm
tasm
retro-computing
0 Answers
Your Answer