.386
.model flat
locals

.stack 1000h

.data?
mxmdata db 4000h dup (?)

.data

copyright db "mxmplay asm example  (c) '95/96 Niklas Beisert / pascal",10,10,13,'$'
playing db 'playing "at0mic playboys" by Screamager... press any key to stop.$'
byebye db 13,10,'thanks for listening',13,10,'$'
__psp dw 0

module label byte
include atomic.inc

.code

include mxmplay.inc

start:
  jmp cmain
  db 'WATCOM'
cmain:
  mov __psp,es
  sti
  cld
  push ds
  pop es

  mov ah,9
  lea edx,copyright
  int 21h

  movzx eax,__psp
  call xmpGetEnvPtrDPMI_
  call xmpGetGUSPort_
  lea ebx,mxmdata
  mov ecx,65536
  lea esi,module
  mov dl,MXMINTMODEDOS
  call xmpInit_

  xor eax,eax
  call xmpPlay_

  mov ah,9
  lea edx,playing
  int 21h

  mov ah,7
  int 21h

@@flush:
    mov ah,11
    int 21h
    cmp al,0
    je @@bye
    mov ah,7
    int 21h
  jmp @@flush

@@bye:
  mov ah,9
  lea edx,byebye
  int 21h

  call xmpStop_

  mov ax,4c00h
  int 21h

end start
