home *** CD-ROM | disk | FTP | other *** search
/ Sound, Music & MIDI Collection 2 / SMMVOL2.bin / DOS / SS_PLAY / FUNK106.ZIP / FUNK_S.ZIP / EXAMPLE.ASM < prev    next >
Encoding:
Assembly Source File  |  1995-05-01  |  9.5 KB  |  199 lines

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;                                                                          ;
  3. ; Example Demo                                                             ;
  4. ;                                                                          ;
  5. ; A very small demo-like program to show you how to use the "funklite.asm" ;
  6. ;  attachment.                                                             ;
  7. ;                                                                          ;
  8. ; The organisation of your application programs in relation to the playback;
  9. ; code is as follows:                                                      ;
  10. ;                                                                          ;
  11. ;   ┌─────────────────────┐                                                ;
  12. ;   │ Your Program:       │                                                ;
  13. ;   │                     │                                                ;
  14. ;   │include "funklite.asm│                                                ;
  15. ;   └───┬───┬────────┬────┘                                                ;
  16. ;       │   │        └─────────────┐       playback code                   ;
  17. ;   ┌───┘  ┌┘            +---------------------------------+               ;
  18. ;┌──┴──┐┌──┴──┐          | ┌───────┴───────┐               |               ;
  19. ;                        | │               │               |               ;
  20. ;                        | │ FUNKLITE.ASM  │               |               ;
  21. ;                        | │               │               |               ;
  22. ;                        | └───────────────┘               |               ;
  23. ;                        +---------------------------------+               ;
  24. ;                                                                          ;
  25. ; ■ To compile this program, you need the following essential files:       ;
  26. ;                                                                          ;
  27. ;  EXAMPLE.ASM                                                             ;
  28. ;  FUNKLITE.ASM                                                            ;
  29. ;  DOS32.EXE      \                                                        ;
  30. ;  DOS32.INC       - from DOS32                                            ;
  31. ;  DOS32.OBJ      /                                                        ;
  32. ;  DEBUG.OBJ (if applicatable)  -\ from DOS32                              ;
  33. ;  V24.OBJ                      -/                                         ;
  34. ;                                                                          ;
  35. ;  TASM.EXE or TASMX.EXE                      (put these in your path)     ;
  36. ;  adams DLINK.EXE              -> from DOS32                              ;
  37. ;                                                                          ;
  38. ; (please note that i have setup Adam Seychells routines to work with my   ;
  39. ; TASM IDEAL mode references. If you are a MASM freak, then you had better ;
  40. ; refer to Adam's actual documentation of DOS32)                           ;
  41. ;                                                                          ;
  42. ; ■ To compile in DEBUG mode, type in:                                     ;
  43. ;                                                                          ;
  44. ;  tasmx example >e.pas                                                    ;
  45. ;  dlink debug v24 example, example                                        ;
  46. ;                                                                          ;
  47. ; (NB/ You must include the line "call debug" at the very start of the     ;
  48. ; program).                                                                ;
  49. ;                                                                          ;
  50. ; ■ To compile in RELEASEABLE mode, type in:                               ;
  51. ;                                                                          ;
  52. ;  tasmx example >e.pas                                                    ;
  53. ;  dlink -Sdos32 v24 example, example                                      ;
  54. ;                                                                          ;
  55. ; (NB/ don't forget to remove the "call debug" at the very start of the    ;
  56. ; program).                                                                ;
  57. ;                                                                          ;
  58. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  59. ideal
  60. p386
  61. model small
  62.  
  63. segment code32 public 'code' use32
  64. assume cs:code32,ds:code32,fs:code32,gs:code32,ss:code32
  65. include "dos32.inc"
  66.  
  67. include "funklite.asm"     ;<<<<---- here we must include the "attachment" thingy
  68.  
  69. our_songname          db "songs\disco70.fnk",0   ;<<- DON'T FORGET TO CHANGE THE BLOODY PATH
  70.                                                  ;    WHEN YOU COMPILE IT IN YOUR OWN DIRECTORY
  71.  
  72. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  73. ;                                                                         ;
  74. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  75. ;@STDIO MACRO: Modified By Adam Seychell 14/03/94 in V1.02
  76. macro @stdio string
  77. local @@tttext, @@skip
  78.   jmp    @@skip
  79.   ifb    <string>
  80. @@tttext:
  81.   db     "$"
  82.   else
  83. @@tttext:
  84.   db     string, "$"
  85.   endif
  86. @@skip:
  87.   push   eax edx
  88.   lea    edx,[@@tttext]
  89.   mov    ah,9
  90.   int    21h
  91.   pop    edx eax
  92. endm
  93.  
  94. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  95. ;                                                                         ;
  96. ; read the "funk.cfg" to determine settings.                              ;
  97. ;                                                                         ;
  98. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  99. proc read_cfg
  100.   mov    eax,3d00h                                      ;open file
  101.   lea    edx,[@@config_file]
  102.   int    21h
  103.   jnc    @@file_opened
  104.   stc
  105.   ret
  106. @@file_opened:
  107.   mov    ebx,eax
  108.   mov    ah,3fh                                 ;read config
  109. @@do_stuff:
  110.   lea    edx,[init_settings]
  111.   mov    ecx,size init_settings
  112.   int    21h
  113.   mov    ah,3eh                                 ;close file
  114.   int    21h
  115.   clc
  116.   ret
  117. @@config_file:
  118.   db     "funk~.cfg",0
  119. endp
  120.  
  121. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  122. ;                                                                         ;
  123. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  124. start32:
  125.   call   debug
  126.   cld
  127.  
  128.   call   read_cfg                                       ;read the "funk.cfg" config 
  129.   jc     @@no_cfg                                       ;if there sin't one, then
  130.                                                         ;abend
  131.  
  132.   call   scard_detect                                   ;with the config
  133.   jc     @@card_not_found                               ;setting, we see
  134.                                                         ;if the given card
  135.                                                         ;is there. If not
  136.                                                         ;then we abend..
  137.  
  138.   call   scard_init                                     ;once done, we
  139.                                                         ;then fireup the
  140.                                                         ;backround tracker
  141.                                                         ;routines for the
  142.                                                         ;given card. this
  143.                                                         ;runs continuously
  144.                                                         ;and responds to
  145.                                                         ;flags set by the
  146.                                                         ;foreground program.
  147.  
  148.   @stdio "loading fucking song...."
  149.  
  150.   lea    edx,[our_songname]                             ;we load song here
  151.   call   load_funk_module
  152.   or     al,al
  153.   jnz    @@error_loadingfile
  154.  
  155.   call   init_for_play                                  ;just reset all the
  156.                                                         ;tracker variables etc
  157.  
  158.   mov    [byte funk_info.trek_status],PLAY              ;we use this flag
  159.                                                         ;to communicate with
  160.                                                         ;the tracker code. at
  161.                                                         ;this stage, the tracker
  162.                                                         ;code will start to playback
  163.                                                         ;the music.
  164.  
  165.  
  166.   mov    eax,10h
  167.   int    16h                                            ;run demo
  168.  
  169.   mov    [byte funk_info.trek_status],STOP              ;tell the tracker to
  170.                                                         ;stop playing back the music
  171.  
  172.   call   stop_all_voices                                ;silence the channels
  173.  
  174. @@error_loadingfile:
  175.   call   scard_deinit                                   ;blow the tracker
  176.                                                         ;out of the water
  177.  
  178.   mov    eax,03h                                        ;usual winddown shit..
  179.   int    10h                                            ;
  180.  
  181.   @stdio "An Example for how to use the 'Funklite.asm' attachment."
  182.   mov    eax,4c00h
  183.   int    21h
  184. @@no_cfg:
  185.   mov    eax,3h
  186.   int    10h
  187.   @stdio "Can't find 'funk.cfg'. Please create one...",13,10
  188.   mov    eax,4c00h
  189.   int    21h
  190. @@card_not_found:
  191.   mov    eax,3h
  192.   int    10h
  193.   @stdio "Soundcard not Detected.",13,10
  194.   mov    eax,4c00h
  195.   int    21h
  196. ends
  197.  
  198. end
  199.