home *** CD-ROM | disk | FTP | other *** search
/ Large Pack of OldSkool DOS MOD Trackers / hsc14ecr.zip / EQUALIZE.ASM < prev    next >
Assembly Source File  |  1994-03-20  |  11KB  |  368 lines

  1. ;----------------------------------------------------
  2. ;routines for equalizers and trace in hsctrack.
  3. ;----------------------------------------------------
  4.  
  5. ;---------------------------------------
  6. ;installs user-charset (ASCII 0-2)
  7. ;---------------------------------------
  8.  
  9. InstallChar     PROC
  10.  
  11.                 pusha
  12.                 push es
  13.  
  14.                 mov  ax,1110h                   ;load chars with BIOS
  15.                 mov  bx,0800h                   ;(who cares about speed)
  16.                 mov  cx,0003h
  17.                 mov  dx,0000h
  18.                 push cs
  19.                 pop  es
  20.                 mov  bp,OFFSET xxCharSet
  21.                 int  10h
  22.  
  23.                 pop  es
  24.                 popa
  25.                 ret
  26.  
  27. xxCharSet:                                      ;definition of the characters
  28.                 db 00000000b
  29.                 db 00000000b
  30.                 db 00000000b
  31.                 db 00000000b
  32.                 db 00000000b
  33.                 db 00000000b
  34.                 db 00000000b
  35.                 db 00000000b
  36.  
  37.                 db 00000000b
  38.                 db 11100000b
  39.                 db 11100000b
  40.                 db 11100000b
  41.                 db 11100000b
  42.                 db 11100000b
  43.                 db 00000000b
  44.                 db 00000000b
  45.  
  46.                 db 00000000b
  47.                 db 11101110b
  48.                 db 11101110b
  49.                 db 11101110b
  50.                 db 11101110b
  51.                 db 11101110b
  52.                 db 00000000b
  53.                 db 00000000b
  54.  
  55. InstallChar     ENDP
  56.  
  57. ;---------------------------------------
  58. ;link equalizer routines into music irq
  59. ;---------------------------------------
  60.  
  61. StartEqual      PROC
  62.  
  63.                 pusha
  64.                 push ds
  65.  
  66.                 mov  ah,6                       ;_HscPlayer function 6, bl=1
  67.                 mov  bl,1                       ; -> install user irq
  68.                 mov  dx,OFFSET Equalizer
  69.                 push cs
  70.                 pop  ds
  71.                 call far ptr _HscPlayer
  72.                 call ClearEqual
  73.  
  74.                 pop  ds
  75.                 popa
  76.                 ret
  77.  
  78. StartEqual      ENDP
  79.  
  80. ;---------------------------------------
  81. ;take equalizer out of the  irq
  82. ;---------------------------------------
  83.  
  84. StopEqual       PROC
  85.  
  86.                 pusha
  87.  
  88.                 mov  ah,6                       ;_HscPlayer funtion 6, bl=0
  89.                 mov  bl,0                       ; -> remove user irq
  90.                 call far ptr _HscPlayer
  91.                 call ClearEqual                 ;and delete screen
  92.  
  93.                 popa
  94.                 ret
  95.  
  96. StopEqual       ENDP
  97.  
  98. ;---------------------------------------
  99. ;clear equalizer area
  100. ;---------------------------------------
  101.  
  102. ClearEqual      PROC
  103.  
  104.                 pusha                           ;blah, blah, nothing important
  105.                 push es
  106.  
  107.                 mov  di,VRAM
  108.                 mov  es,di
  109.  
  110.                 mov  si,00h
  111.  
  112. xx_equ_loop:    mov  di,cs:xx_equ_base+si
  113.                 mov  ax,1200h
  114.                 stosw
  115.                 stosw
  116.                 stosw
  117.  
  118.                 add  di,2
  119.                 mov  ax,1300h
  120.                 stosw
  121.                 stosw
  122.  
  123.                 add  di,2
  124.                 mov  cx,08h
  125.                 mov  ax,1a00h
  126.                 rep  stosw
  127.  
  128.                 add  si,2
  129.                 cmp  si,18
  130.                 jne  xx_equ_loop
  131.  
  132.                 mov  di,14ach
  133.                 mov  ax,1e20h
  134.                 mov  es:di,ax
  135.                 mov  es:di+2,ax
  136.                 mov  es:di+10,ax
  137.                 mov  es:di+12,ax
  138.                 mov  es:di+20,ax
  139.                 mov  es:di+22,ax
  140.  
  141.                 pop  es
  142.                 popa
  143.                 ret
  144.  
  145. xx_equ_base     dw   0e66h,0f06h,0fa6h
  146.                 dw   1046h,10e6h,1186h
  147.                 dw   1226h,12c6h,1366h
  148.  
  149. ClearEqual      ENDP
  150.  
  151. ;---------------------------------------
  152. ;the real equalizer routines
  153. ;---------------------------------------
  154.  
  155. Equalizer       PROC
  156.  
  157.                 pusha
  158.                 push ds
  159.                 push es
  160.  
  161.                 push cs
  162.                 pop  es
  163.                 mov  si,OFFSET xx_hsc_note
  164.                 mov  ah,07h                     ;_HscPlayer function 7
  165.                 call far ptr _HscPlayer         ; -> get player state
  166.  
  167.                 mov  si,VRAM
  168.                 mov  es,si
  169.  
  170.                 push cs
  171.                 pop  ds
  172.                 mov  cx,00h
  173.  
  174. xx_equ_loop:    mov  si,cx                      ;put equalizer values to bars
  175.                 add  si,OFFSET xx_hsc_equalizer
  176.                 mov  bl,ds:si
  177.                 inc  bl
  178.                 and  bx,1fh
  179.                 shl  bx,4
  180.                 add  bx,OFFSET xx_equ_string
  181.  
  182.                 mov  si,cx
  183.                 shl  si,1
  184.                 mov  di,cs:xx_equ_base+si
  185.                 mov  dl,02h
  186.  
  187.                 cmp  es:di,dl
  188.                 ja   xx_equ_j1
  189.                 mov  ax,cs:bx
  190.                 mov  es:di,ax
  191.  
  192. xx_equ_j1:      cmp  es:di+2,dl                 ;ignore this check
  193.                 ja   xx_equ_j2                  ;it's a dirty way for clipping
  194.                 mov  ax,cs:bx+2                 ;windows
  195.                 mov  es:di+2,ax
  196.  
  197. xx_equ_j2:      cmp  es:di+4,dl
  198.                 ja   xx_equ_j3
  199.                 mov  ax,cs:bx+4
  200.                 mov  es:di+4,ax
  201.  
  202. xx_equ_j3:      cmp  es:di+6,dl
  203.                 ja   xx_equ_j4
  204.                 mov  ax,cs:bx+6
  205.                 mov  es:di+6,ax
  206.  
  207. xx_equ_j4:      cmp  es:di+8,dl
  208.                 ja   xx_equ_j5
  209.                 mov  ax,cs:bx+8
  210.                 mov  es:di+8,ax
  211.  
  212. xx_equ_j5:      cmp  es:di+10,dl
  213.                 ja   xx_equ_j6
  214.                 mov  ax,cs:bx+10
  215.                 mov  es:di+10,ax
  216.  
  217. xx_equ_j6:      cmp  es:di+12,dl
  218.                 ja   xx_equ_j7
  219.                 mov  ax,cs:bx+12
  220.                 mov  es:di+12,ax
  221.  
  222. xx_equ_j7:      cmp  es:di+14,dl
  223.                 ja   xx_equ_j8
  224.                 mov  ax,cs:bx+14
  225.                 mov  es:di+14,ax
  226.  
  227. xx_equ_j8:      mov  si,cx                      ;flash note on equalizer peaks
  228.                 add  si,OFFSET xx_hsc_playing
  229.                 mov  ax,1312h
  230.                 cmp  ds:si,BYTE PTR 0ffh
  231.                 jne  xx_equ_j9
  232.                 mov  ax,1b1ah
  233. xx_equ_j9:      mov  bx,cx
  234.                 shl  bx,1
  235.                 mov  di,cs:xx_equ_base+bx
  236.                 sub  di,0dh
  237.                 mov  es:di,al
  238.                 mov  es:di+2,al
  239.                 mov  es:di+4,al
  240.                 mov  es:di+8,ah
  241.                 mov  es:di+10,ah
  242.                 mov  ds:si,BYTE PTR 00h
  243.  
  244.                 mov  si,cx                      ;put actual note to screen
  245.                 add  si,OFFSET xx_hsc_note
  246.                 mov  al,ds:si
  247.                 sub  al,1
  248.                 jc   xx_equ_no_note
  249.                 xor  ah,ah
  250.                 mov  bl,12
  251.                 div  bl
  252.                 mov  dl,al
  253.                 mov  al,ah
  254.                 mov  bl,3
  255.                 mul  bl                 ;note*3 = offset string in cs:Noten
  256.                 mov  si,ax
  257.                 add  si,offset cs:Noten
  258.  
  259.                 mov  bx,cx
  260.                 shl  bx,1
  261.                 mov  ax,cs:xx_instr_pos+bx
  262.                 sub  ax,0400h
  263.  
  264.                 push ds
  265.                 push cs
  266.                 pop  ds
  267.                 call PutString
  268.                 pop  ds
  269.  
  270.                 push es
  271.                 mov  bx,cx
  272.                 shl  bx,1
  273.                 mov  di,cs:xx_equ_base+bx
  274.                 sub  di,10
  275.                 add  dl,49
  276.                 mov  ax,VRAM
  277.                 mov  es,ax
  278.                 mov  BYTE PTR es:[di],dl
  279.                 pop  es
  280.  
  281. xx_equ_no_note: mov  si,cx                      ;put actual instrument to screen
  282.                 add  si,OFFSET xx_hsc_instr
  283.                 mov  bl,ds:si
  284.                 mov  di,cx
  285.                 shl  di,1
  286.                 mov  ax,cs:xx_instr_pos+di
  287.                 call PrintByte
  288.  
  289.                 inc  cx
  290.                 cmp  cx,09h
  291.                 je   xx_equ_no_loop
  292.                 jmp  xx_equ_loop
  293.  
  294. xx_equ_no_loop: mov  si,OFFSET xx_hsc_pattern   ;and actual pattern
  295.                 mov  bl,ds:si
  296.                 mov  ax,0621h
  297.                 call PrintByte
  298.                 cmp  cs:HelpAktiv,BYTE PTR 00h
  299.                 jne  xx_equ_no_flw
  300.                 mov  si,OFFSET xx_hsc_track     ;and track
  301.                 mov  bl,ds:si
  302.                 add  ah,5
  303.                 call PrintByte
  304.                 mov  si,OFFSET xx_hsc_position  ;and position
  305.                 mov  bl,ds:si
  306.                 add  ah,5
  307.                 call PrintByte
  308.                 cmp  cs:TLine,bl
  309.                 je   xx_equ_no_flw
  310.  
  311.                 cmp  cs:FollowPlay,BYTE PTR 00h ;and here the trace, who cares
  312.                 je   xx_equ_no_flw
  313.                 mov  si,OFFSET xx_hsc_track
  314.                 mov  bl,ds:si
  315.                 mov  cs:Track,bl
  316.                 mov  si,OFFSET xx_hsc_position
  317.                 mov  bl,ds:si
  318.                 mov  cs:TLine,bl
  319.                 call PutTrackLine
  320.                 mov  si,OFFSET xx_hsc_pattern
  321.                 mov  bl,ds:si
  322.                 mov  cs:PattLine,bl
  323.                 call PutPTable
  324.                 
  325. xx_equ_no_flw:  pop  es
  326.                 pop  ds
  327.                 popa
  328.                 retf
  329.  
  330. xx_instr_pos    dw   0717h,0718h,0719h          ;the string offsets on screen
  331.                 dw   071ah,071bh,071ch
  332.                 dw   071dh,071eh,071fh
  333.  
  334. xx_equ_base     dw   0e74h,0f14h,0fb4h
  335.                 dw   1054h,10f4h,1194h
  336.                 dw   1234h,12d4h,1374h
  337.  
  338.                 ;the equalizer bars .. i was so lazy and this looks so lame
  339.  
  340. xx_equ_string   db   0,1ah,0,1ah,0,1ah,0,1ah,0,1ah,0,1eh,0,1eh,0,1ch ;0
  341.                 db   1,1ah,0,1ah,0,1ah,0,1ah,0,1ah,0,1eh,0,1eh,0,1ch ;1
  342.                 db   2,1ah,0,1ah,0,1ah,0,1ah,0,1ah,0,1eh,0,1eh,0,1ch ;2
  343.                 db   2,1ah,1,1ah,0,1ah,0,1ah,0,1ah,0,1eh,0,1eh,0,1ch ;3
  344.                 db   2,1ah,2,1ah,0,1ah,0,1ah,0,1ah,0,1eh,0,1eh,0,1ch ;4
  345.                 db   2,1ah,2,1ah,1,1ah,0,1ah,0,1ah,0,1eh,0,1eh,0,1ch ;5
  346.                 db   2,1ah,2,1ah,2,1ah,0,1ah,0,1ah,0,1eh,0,1eh,0,1ch ;6
  347.                 db   2,1ah,2,1ah,2,1ah,1,1ah,0,1ah,0,1eh,0,1eh,0,1ch ;7
  348.                 db   2,1ah,2,1ah,2,1ah,2,1ah,0,1ah,0,1eh,0,1eh,0,1ch ;8
  349.                 db   2,1ah,2,1ah,2,1ah,2,1ah,1,1ah,0,1eh,0,1eh,0,1ch ;9
  350.                 db   2,1ah,2,1ah,2,1ah,2,1ah,2,1ah,0,1eh,0,1eh,0,1ch ;a
  351.                 db   2,1ah,2,1ah,2,1ah,2,1ah,2,1ah,1,1eh,0,1eh,0,1ch ;b
  352.                 db   2,1ah,2,1ah,2,1ah,2,1ah,2,1ah,2,1eh,0,1eh,0,1ch ;c
  353.                 db   2,1ah,2,1ah,2,1ah,2,1ah,2,1ah,2,1eh,1,1eh,0,1ch ;d
  354.                 db   2,1ah,2,1ah,2,1ah,2,1ah,2,1ah,2,1eh,2,1eh,0,1ch ;e
  355.                 db   2,1ah,2,1ah,2,1ah,2,1ah,2,1ah,2,1eh,2,1eh,1,1ch ;f
  356.                 db   2,1ah,2,1ah,2,1ah,2,1ah,2,1ah,2,1eh,2,1eh,2,1ch ;10
  357.  
  358. xx_hsc_note      db  9 dup (0)  ;the array for the function 07h
  359. xx_hsc_instr     db  9 dup (0)
  360. xx_hsc_equalizer db  9 dup (0)
  361. xx_hsc_playing   db  9 dup (0)
  362. xx_hsc_pattern   db  0
  363. xx_hsc_track     db  0
  364. xx_hsc_position  db  0
  365. xx_hsc_on_off    db  0
  366.  
  367. Equalizer       ENDP
  368.