home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / p / pps110.zip / PPSSRC.ZIP / PPSCMD.ASM < prev    next >
Assembly Source File  |  1992-07-27  |  3KB  |  179 lines

  1. ;   FILENAME: PPSCMD.ASM
  2. ;
  3. ;   Last updated : July 27, 1992
  4.  
  5. jumps      ; Have TASM automatically resolve out of range jumps
  6.  
  7. %tabsize 4
  8.  
  9. ifndef  MDL
  10.     display "Error: This module requires that you provide a memory model"
  11.     display "    definition on the command line. I.E. /dMDL=SMALL."
  12.     err ; Force a fatal error
  13. else
  14.  
  15. model    MDL,pascal           ; Define the memory model
  16. P286
  17.  
  18. Version EQU "1.00"
  19.  
  20. ideal
  21.  
  22. stack    1024           ; Allocate 4K stack
  23.  
  24. codeseg
  25.  
  26. SizeOfProg    dw    0
  27.  
  28. include "globals.inc"
  29. include "pps.inc"
  30.  
  31. codeseg
  32.  
  33. ;──────────────────────────────────────────────────────────────────────────────┐
  34. ;┌─────────────────────────────────────────────────────────────────────────────┘
  35. ;└─────────────────────────────────────────────────────────────────────────────┐
  36. ;──────────────────────────────────────────────────────────────────────────────┘
  37.  
  38. codeseg
  39. SavedDS     dw    ?    ; For the control-break handler to find the path
  40.             ; variables for restoring the original path and
  41.             ; drive.
  42.  
  43.  
  44. dataseg
  45.  
  46. PspAddress      dw      ?       ; Segment address of Program Segment Prefix(PSP)
  47.  
  48. codeseg
  49.  
  50. proc Main
  51.  
  52. ;************************* Program Entry Point ***************************
  53. ; Execution of the program begins here.
  54.  
  55. EntryPoint:
  56.     mov    ax, @data    ; Initialize ds by moving segment address
  57.     mov    ds, ax        ; of data segment into ds register
  58.  
  59.     call    DoAll
  60. endp    main
  61.  
  62. proc    DoAll
  63.  
  64.     ; Store the PSP address by storing es in the variable PspAddress.
  65.     ; Note that we do it this way instead of using DOS function 62h because
  66.     ; the function is only available on DOS 3.0 or later.
  67.  
  68.     mov    [PspAddress], es
  69.     push    es
  70.     mov    ax, seg PSPAddress
  71.     mov    es, ax
  72.     mov    bx, [es:PSPAddress]
  73.     mov    es, bx
  74.     mov    ax, zzzzzseg
  75.     sub    ax, bx
  76.     mov    bx,ax
  77.     inc    bx            ;Safety margin
  78.     inc    bx
  79.     mov    [cs:SizeOfProg],bx
  80.     mov    ah, 4ah         ;Memory block resize opcode
  81.     int    21h
  82.     pop    es
  83.  
  84.     mov    ax,ds
  85.     mov    [SavedDS],ax
  86.  
  87. @@1:
  88. ifdef OSC
  89.     mov    ax,13h
  90.     int    10h
  91. endif OSC
  92.     mov    bx,255
  93.     call    sd_InitSound
  94.  
  95.         mov     ds, [PspAddress]    ; Load the segment address of the Psp
  96.     mov    si, offset (Psp).CommandTail
  97.     lodsb
  98.     cmp    al,0
  99.     jz    @@Terminate
  100.  
  101. @@MoreThanOne:
  102.     mov    bx,si
  103.     xor    ah,ah
  104.     add    bx,ax
  105. @@TopLoop:
  106.     cmp    bx,si
  107.     jz    @@Terminate
  108.     lodsb
  109.         cmp     al,32
  110.         jz      @@TopLoop
  111. @@GetFilename:
  112.     xor    ah,ah
  113.     dec    si
  114.     mov    cx,80
  115. @@TopGet:
  116.     cmp    bx,si
  117.     jz    @@StoreFilename
  118.     lodsb
  119.     cmp    al,'.'
  120.     jnz    @@NotPeriod
  121.     mov    ah,1
  122. @@NotPeriod:
  123.     cmp    al,13
  124.     jz    @@StoreFilename
  125.     loop    @@TopGet
  126. @@StoreFilename:
  127.     or    ah,ah
  128.     jnz    @@JustZero
  129.     mov    [Byte si],'.'
  130.     mov    [Byte si+1],'M'
  131.     mov    [Byte si+2],'O'
  132.     mov    [Byte si+3],'D'
  133.     add    si,4
  134. @@JustZero:
  135.     mov    [Byte si],0
  136.     mov    dx, offset (Psp).CommandTail + 2
  137.         call    sd_LoadModule
  138.         jnb     @@ModuleLoadedOK
  139. ifdef OSC
  140.     mov    ax,3
  141.     int    10h
  142. endif OSC
  143.         mov     ax,4C00h
  144.         int     21h
  145. @@ModuleLoadedOK:
  146.     mov    ax,@data
  147.     mov    ds,ax
  148.     call    sd_PlayMusic
  149. @@MStat:
  150.     mov    ah,1
  151.     int    16h
  152.     jnz    @@Done
  153.     cmp    [MStatus],0
  154.     jz    @@MStat
  155. @@Done:
  156.     call    sd_CloseAllMusic
  157. @@Terminate:
  158. ;     mov     dx,[cs:SizeOfProg]
  159. ;     mov     ah,31h
  160. ;     int     21h
  161. ifdef OSC
  162.     mov    ax,3
  163.     int    10h
  164. endif OSC
  165.         mov     ax, 4C00h
  166.         int     21h
  167.     ret
  168. endp    DoAll
  169.  
  170. segment zzzzzseg   ; Dummy final segment for calculating program size
  171.                    ; to release memory back to DOS.
  172. LastBytes    db    16 dup (?)
  173. ends    zzzzzseg
  174.  
  175. endif   ; ifndef MDL
  176.  
  177. end EntryPoint
  178.  
  179.