Hi,
I am trying to play a MIDI file through the PC speaker on my XT with an NEC V20 running at 12MHz. I am using the MIDIPLAY utility written by James Allwright from here http://www.bttr-software.de/freesoft/sound.htm. The actual download link has long gone, but I managed to download the ZIP file via archive.org and attached it to this post.
This tool actually plays various MIDI file nicely through the PC speaker on my 286/386. However, on my XT, after loading the file for a few seconds, it simply plays a short beep and quits. I compiled the code using Personal C Compiler (http://vetusware.com/download/Personal C Compiler 1.2d/?id=4526), which was originally used by the author, and suspected that the problem lies within the assembly code in NOTE.A that is responsible for playing sound. This code is called from MIDIPLAY.C in a while loop to play the MIDI note by note:
This is the actual code to play a note:
Basically on my XT, the program parses the MIDI file and reads the list of notes into memory properly. However, when it comes to playback, each note will only be played for maybe a few milliseconds at most, instead of the specified pitch and duration, so every MIDI file will sound like a single 'beep' when played. There is no problem with the PC speaker on my XT, as games with PC speaker sounds work just fine.
Any ideas what may cause the code to fail to work on an XT?
I am trying to play a MIDI file through the PC speaker on my XT with an NEC V20 running at 12MHz. I am using the MIDIPLAY utility written by James Allwright from here http://www.bttr-software.de/freesoft/sound.htm. The actual download link has long gone, but I managed to download the ZIP file via archive.org and attached it to this post.
This tool actually plays various MIDI file nicely through the PC speaker on my 286/386. However, on my XT, after loading the file for a few seconds, it simply plays a short beep and quits. I compiled the code using Personal C Compiler (http://vetusware.com/download/Personal C Compiler 1.2d/?id=4526), which was originally used by the author, and suspected that the problem lies within the assembly code in NOTE.A that is responsible for playing sound. This code is called from MIDIPLAY.C in a while loop to play the MIDI note by note:
Code:
while (place != NULL) {
note(place->pitch, place->start);
place = place->next;
};
This is the actual code to play a note:
Code:
dosound:
in al, 61h
push ax
or al, 03h
out 61h, al ; turn speaker on
xor si, si
mov ax, [bp+4] ; timer interval
push ax
mov al, 0B6h
out 43h, al
pop ax
out 42h, al
mov al, ah
out 42h, al ; set up interval
call delay
pop ax
out 61h, al ; turn speaker off
endtune:
mov sp, bp ; restore stack pointer
pop bp
ret
delay:
mov cx, word [bp+8] ; high word
mov dx, word [bp+6] ; low word
mov ah, 86h
int 15h
ret
Basically on my XT, the program parses the MIDI file and reads the list of notes into memory properly. However, when it comes to playback, each note will only be played for maybe a few milliseconds at most, instead of the specified pitch and duration, so every MIDI file will sound like a single 'beep' when played. There is no problem with the PC speaker on my XT, as games with PC speaker sounds work just fine.
Any ideas what may cause the code to fail to work on an XT?
Attachments
Last edited: