sb.asm

来自「Application sources:A084.ZIP」· 汇编 代码 · 共 1,006 行 · 第 1/2 页

ASM
1,006
字号
    imul edi,[bmul]
    add  edi,[buffer]
    mov  ecx,512
   
  movedata:
   
    mov  al,[esi+1]
   
    cmp  [bytes_per_sample],4 ; for 16 bit stereo
    jne  no_16_stereo
    mov  al,[esi+1]
    add  al,128
  no_16_stereo:
   
    cmp  [bytes_per_sample],1 ; for 16 bit mono
    je   no_16_mono
    cmp  [channels],2
    je   no_16_mono
    mov  al,[esi+1]
    add  al,128
  no_16_mono:
   
    mov  [edi],al
    mov  eax,[bytes_per_sample]
    cmp  [mono_stereo],1
    je   bps1
    mov  eax,[bytes_per_sample]
    push ecx
    mov  ecx,[mono_stereo]
    dec  ecx
    shr  eax,cl
    pop  ecx
  bps1:
    add  esi,eax ; 2;[bytes_per_sample] ; / mono_stereo
    add  edi,1
    loop movedata
   
    add  edx,1
    mov  ecx,[block]
    add  ecx,[addb]
    cmp  edx,ecx
    jbe  newread
   
    mov  ecx,[addb]
    add  [block],ecx
   
    call display_progress
   
  rewr:
   
    popa
   
    call set_vol_data
   
    ret
   
   
set_vol_data:
   
;    ret
   
    pusha
   
    mov  eax,65536
    xor  edx,edx
    mov  ebx,[delay]
    div  ebx
    push eax
   
    mov  esi,[playposition]
    mov  edi,[vol_data]
    mov  ecx,[delay]
   
  svd:
   
    mov   eax,0
    mov   edx,100
  svd3:
    movzx ebx,byte [esi]
    cmp   ebx,128
    jge   svd2
    mov   ebx,0
   svd2:
    sub   ebx,128
    shl   ebx,1
   
    cmp   ebx,ebp
    jbe   svd4
    mov   edx,ebx
   svd4:
   
    inc   esi
    inc   eax
    cmp   eax,[esp]
    jb    svd3
   
    mov  [edi],dl
    inc  edi
    loop svd
   
    pop  eax
    popa
   
    ret
   
   
addr  dd   0x0
ya    dd   0x0
   
   
read_string:
   
     mov  [onoff],0
   
    mov  [addr],wavfile
    mov  [ya],30
   
    mov  edi,[addr]
    mov  al,'_'
    mov  ecx,32
    rep  stosb
   
    call print_text
   
    mov  edi,[addr]
   
  f11:
    mov  eax,10
    int  0x40
    cmp  eax,2
    jne  read_done
    mov  eax,2
    int  0x40
    shr  eax,8
    cmp  eax,13
    je   read_done
    cmp  eax,8
    jnz  nobsl
    cmp  edi,[addr]
    jz   f11
    sub  edi,1
    mov  [edi],byte '_'
    call print_text
    jmp  f11
  nobsl:
    cmp  eax,dword 31
    jbe  f11
    cmp  eax,dword 95
    jb   keyok
    sub  eax,32
  keyok:
    mov  [edi],al
   
    call print_text
   
    add  edi,1
    mov  esi,[addr]
    add  esi,32
    cmp  esi,edi
    jnz  f11
   
  read_done:
   
    mov  ecx,[addr]
    add  ecx,38
    sub  ecx,edi
    mov  eax,0
    cld
    rep  stosb
   
    call print_text
   
    ret
   
   
print_text:
   
display_progress:
   
    pusha
   
    mov  eax,13                ; gray progress bar
    mov  ebx,25*65536+215
    mov  ecx,61*65536+8
    mov  edx,[border]
    int  0x40
   
    cmp  [onoff],1
    je   yes_playing
    mov  [block],0
    mov  [file_size],100*512
  yes_playing:
    mov  eax,[block]           ; yellow progress bar
    imul eax,214
    xor  edx,edx
    mov  ebx,[file_size]
    shr  ebx,9
    or   ebx,1
    div  ebx
    mov  ebx,eax
    and  ebx,0xff
    mov  eax,13
    add  ebx,25*65536
    mov  ecx,61*65536+1
    mov  edx,[drawp]
   newbar:
    int  0x40
    add  edx,0x101010
    add  ecx,1*65536
    cmp  ecx,65*65536
    jb   newbar
   newbar2:
    int  0x40
    sub  edx,0x101010
    add  ecx,1*65536
    cmp  ecx,69*65536
    jb   newbar2
   
   
    mov   eax,[block]
    imul  eax,214-30
    xor   edx,edx
    mov   ebx,[file_size]
    shr   ebx,9
    or    ebx,1
    div   ebx
    mov   ebx,eax
    shl   ebx,16
    add   ebx,25*65536+30
    mov   ecx,61*65536+9
    mov   edx,0xeeeeff
    mov   eax,13
    mov   edi,5
  newb:
;    int   0x40
    add   ebx,1*65536-2
    add   ecx,1*65536-2
    sub   edx,0x332211;3366aa
    dec   edi
    jnz   newb
   
   
  noyellow:
   
    mov  esi,[current_play]
    mov  edi,now_playing
    mov  ecx,40
    cld
    rep  movsb
   
    mov  eax,13
    mov  ebx,42*65536+33*6
    mov  ecx,114*65536+11
    mov  edx,0x000000
    int  0x40
   
    mov  eax,4
    mov  ebx,42*65536+117
    mov  ecx,[textc]
    mov  edx,now_playing
    mov  esi,38
    int  0x40
   
    popa
   
    ret
   
   
shape_window:
   
    ret
   
    pusha
   
    mov  eax,50
    mov  ebx,0
    mov  ecx,shape_reference
    int  0x40
   
    mov  eax,50
    mov  ebx,1
    mov  ecx,4
    int  0x40
   
    popa
   
    ret
   
   
shape_reference:
   
times 1  db  1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0
times 9  db  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
   
infrared_enabled db 0x0
   
   
enable_ir:
   
    pusha
   
    mov  eax,46
    mov  ebx,0
    mov  ecx,0x3f0
    mov  edx,0x3ff
    int  0x40
   
    mov  eax,45
    mov  ebx,0
    mov  ecx,4
    int  0x40
   
    mov  eax,40
    mov  ebx,10000b shl 16 + 111b
    int  0x40
   
    mov  [infrared_enabled],1
   
    popa
   
    ret
   
   
   
;   *********************************************
;   *******  WINDOW DEFINITIONS AND DRAW ********
;   *********************************************
   
   
draw_window:
   
    pusha
   
    inc  [next_tic]
   
    mov  eax,12                    ; function 12:tell os about windowdraw
    mov  ebx,1                     ; 1, start of draw
    int  0x40
                                   ; DRAW WINDOW
    mov  eax,0                     ; function 0 : define and draw window
    mov  ebx,100*65536+320         ; [x start] *65536 + [x size]
    mov  ecx,100*65536+140         ; [y start] *65536 + [y size]
    mov  edx,[bgr]
    add  edx,0x04000000            ; color of work area RRGGBB,8->color gl
    mov  esi,window_label
    mov  edi,0                     ; color of frames    RRGGBB
    int  0x40
   
    mov  eax,8                     ; START/STOP  - id 2
    mov  ebx,24*65536+77
    mov  ecx,80*65536+16
    mov  edx,2
    mov  esi,[border]
    int  0x40
   
    inc  edx                       ; << / >>     - id 3 , 4
    add  ebx,86*65536-57
    mov  eax,8
    int  0x40
    inc  edx
    add  ebx,24*65536
    mov  eax,8
    int  0x40
   
    mov  eax,8                      ; REPEAT
    add  ebx,29*65536+54
    inc  edx
    int  0x40
   
    mov  eax,8                      ; enable infrared
    add  ebx,98*65536-33
    add  ecx,10*65536+10
    inc  edx
    int  0x40
   
    pusha
    mov  eax,8
    mov  ebx,25*65536+9
    mov  ecx,115*65536+9
    inc  edx
    int  0x40
    popa
   
    mov  eax,4
    shr  ecx,16
    mov  bx,cx
    add  ebx,2*65536+4
    mov  ecx,0xffffff
    mov  edx,infrared_text
    mov  esi,10
    int  0x40
    add  ebx,11
    add  edx,10
    mov  eax,4
    int  0x40
   
    mov  ebx,25*65536+35           ; draw info text with function 4
    mov  ecx,[textc]
    mov  edx,text
    mov  esi,40
  newline:
    mov  eax,4
    int  0x40
    add  ebx,10
    add  edx,40
    cmp  [edx],byte 'x'
    jne  newline
   
    call display_progress
   
    call draw_wave
   
    mov  eax,12
    mov  ebx,2
    int  0x40
   
    popa
    ret
   
   
   
   
draw_wave:
   
;    ret
   
    pusha
   
    mov   eax,13
    mov   ebx,260*65536+43
    mov   ecx,42*65536+32
    mov   edx,[border]
    int   0x40
   
    mov   esi,[playposition]
    mov   ebx,260
   npix:
    mov   eax,1
    inc   ebx
    movzx ecx,byte [esi]
    shr   ecx,3
    add   ecx,42
    mov   edx,[drawc];0x2255aa
    int   0x40
   
    add   esi,2
   
    cmp   ebx,300
    jbe   npix
   
    popa
   
    ret
   
   
; DATA AREA
   
infrared_text: db  'IRMAN     INFRAR      '
   
   
textc   dd  0xffffff
bgr     dd  0x00000000
drawc   dd  0x2255aa
drawp   dd  0x8011aa
border  dd  0x5577aa
   
text:
    db 'Define SB, HD and partition in setup.   '
    db '                                        '
    db '                                        '
    db '                                        '
    db '                                        '
    db ' START/STOP    <<  >>   REPEAT:OFF      '
    db 'x <- END MARKER, DONT DELETE            '
now_playing:
    db '                                        '
    db 'xx                                      '
   
file_info:
   
    dd  0   ; read
    dd  0
    dd  0
    dd  0
    dd  0
   
wavfile:
    db '/HD/1/FILE.WAV',0                
    db '                                        '
    db '                                        '
   

window_label:

     db   ' WAVE PLAYER',0
   
I_END:
   
   
   
   
   

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?