Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 9971 → Rev 9972

/programs/other/outdated/cdp/trunk/cdp.asm
0,0 → 1,1329
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; Audio CD player; code by Dmitry Yushko - dma@bn.by ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
include "..\..\..\..\macros.inc"
include "lang.inc"
 
FALSE equ 0
TRUE equ 1
 
ESC_KEY equ 27
LEFT_KEY equ 176
RIGHT_KEY equ 179
 
NORMAL_PLAY equ 0
REPEAT_TRACK equ 1
REPEAT_DISK equ 2
SHUFFLE_DISK equ 3
 
COLOR_FUNC_BUTS equ 0x00dddddd
 
use32
 
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; required os
dd START ; program start
dd I_END ; program image size
dd 0x2000 ; required amount of memory
dd 0x2000 ; esp = 0x7fff0
dd 0x0, 0x0 ; reserved=no extended header
 
START:
call chk_cdrom ; start of execution
call read_cd
 
red: ; redraw
call draw_window ; at first, draw the window
still:
 
mov eax,23
mov ebx,10 ; wait here for event
mcall
 
cmp eax,1 ; redraw request ?
jz red
cmp eax,2 ; key in buffer ?
jz key
cmp eax,3 ; button in buffer ?
jz button
 
call draw_info
cmp [curr_trk],0
je @f
call current_trk_time
@@:
jmp still
 
 
key: ; key
mov eax,2 ; just read it and ignore
mcall
 
;====== hotkeys:
cmp ah,0x61
jb @f
cmp ah,0x7a
ja @f
and ah,11011111b
@@:
 
cmp ah,'P' ;PLAY
jne no_key_play
call play_acd
jmp still
no_key_play:
 
cmp ah,'S' ;STOP
jne no_key_stop
mov [if_paused],FALSE
call stop_playing
jmp still
no_key_stop:
 
cmp ah,'N' ;NEXT
jne no_key_next
call play_next_trk
jmp still
no_key_next:
 
cmp ah,'B' ;BACK
jne no_key_back
call play_back_trk
jmp still
no_key_back:
 
cmp ah,'F' ;FORWARD
jne no_key_fwd
call fast_forward
jmp still
no_key_fwd:
 
cmp ah,'R' ;REWIND
jne no_key_rewind
call fast_rewind
jmp still
no_key_rewind:
 
cmp ah,'M' ;MODE
jne no_key_mode
call change_mode
jmp still
no_key_mode:
 
 
cmp ah,'L' ;READ PLAYLIST
jne no_key_list
mov [if_paused],FALSE
mov [curr_trk],0
call stop_playing
call chk_cdrom
call read_cd
jmp still
no_key_list:
 
cmp ah,50 ;F1 key
jz itsahelpkey
 
cmp ah,'H' ;HELP
jne no_key_help
itsahelpkey:
cmp [flag],4
je still
cmp [flag],1
jne was_it_ok_false
mov [was_it_ok],TRUE
jmp flag4_done
was_it_ok_false:
mov [was_it_ok],FALSE
flag4_done:
mov [flag],4
mov [help_screen],1
call draw_window
jmp still
no_key_help:
 
 
cmp ah,ESC_KEY
jne no_esc_key
cmp [flag],4
jne still
cmp [was_it_ok],FALSE
jne was_it_ok_true
mov [flag],0
jmp end_esc_key
was_it_ok_true:
mov [flag],1
end_esc_key:
call draw_window
no_esc_key:
 
cmp ah,LEFT_KEY
jne no_left_key
cmp [flag],4
jne still
cmp [help_screen],1
jz still
dec [help_screen]
call draw_window
no_left_key:
 
cmp ah,RIGHT_KEY
jne no_right_key
cmp [flag],4
jne still
cmp [help_screen],3
jz still
inc [help_screen]
call draw_window
no_right_key:
 
 
jmp still
 
 
button: ; button
mov eax,17
mcall
 
cmp ah,1 ; button id=1 ?
jnz no_but_close
mov eax,24
mov ebx,3
mcall
mov eax,0xffffffff ; close this program
mcall
no_but_close:
 
cmp ah,2
jne no_but_play
call play_acd
jmp still
no_but_play:
 
cmp ah,3
jne no_but_stop
mov [if_paused],FALSE
call stop_playing
jmp still
no_but_stop:
 
cmp ah,4
jne no_but_reread
mov [curr_trk],0
call chk_cdrom
call read_cd
mov [if_paused],FALSE
call stop_playing
jmp still
no_but_reread:
 
cmp ah,5
jne no_but_next
call play_next_trk
jmp still
no_but_next:
 
cmp ah,6
jne no_but_back
call play_back_trk
jmp still
no_but_back:
 
cmp ah,7
jne no_but_mode
call change_mode
jmp still
no_but_mode:
 
cmp ah,8
jne no_but_frew
call fast_rewind
jmp still
no_but_frew:
 
cmp ah,9
jne no_but_ffwd
call fast_forward
jmp still
no_but_ffwd:
 
cmp ah,10
jb no_but_track
cmp ah,40
ja no_but_track
call read_cd
cmp [flag],1
jne no_but_track
mov cl,ah
sub cl,10
mov [curr_trk],cl
mov cl,[max_trk]
mov [shuftab],cl
call stop_playing
call renew_shuftab
call play_n_track
call rem_time_trk
jmp still
no_but_track:
 
jmp still
 
 
change_mode:
cmp [mode],3
jne inc_mode
mov [mode],0
jmp end_but_mode
inc_mode:
inc [mode]
end_but_mode:
call draw_info
ret
 
play_next_trk:
cmp [curr_trk],0
je @play_next_trk
cmp [if_paused],TRUE
je @play_next_trk
cmp [mode],NORMAL_PLAY
jne play_next_mode1
xor eax,eax
mov al,[curr_trk]
cmp [max_trk],al
je @play_next_trk
inc [curr_trk]
cmp [if_stopped],TRUE
je @play_next_trk
call play_n_track
jmp @play_next_trk
play_next_mode1:
cmp [mode],REPEAT_TRACK
jne play_next_mode2
cmp [if_stopped],TRUE
je @play_next_trk
call play_n_track
jmp @play_next_trk
play_next_mode2:
cmp [mode],REPEAT_DISK
jne play_next_mode3
xor eax,eax
mov al,[curr_trk]
cmp [max_trk],al
jne play_next_mode2_go
mov [curr_trk],1
cmp [if_stopped],TRUE
je @play_next_trk
call play_n_track
jmp @play_next_trk
play_next_mode2_go:
inc [curr_trk]
cmp [if_stopped],TRUE
je @play_next_trk
call play_n_track
jmp @play_next_trk
play_next_mode3:
cmp [mode],SHUFFLE_DISK
jne @play_next_trk
call shuffle_track
@play_next_trk:
ret
 
play_back_trk:
cmp [curr_trk],0
je @play_back_trk
cmp [if_paused],TRUE
je @play_back_trk
cmp [mode],NORMAL_PLAY
jne play_back_mode1
xor eax,eax
mov al,[curr_trk]
cmp al,1
je @play_back_trk
dec [curr_trk]
cmp [if_stopped],TRUE
je @play_next_trk
call play_n_track
jmp @play_back_trk
play_back_mode1:
cmp [mode],REPEAT_TRACK
jne play_back_mode2
cmp [if_stopped],TRUE
je @play_next_trk
call play_n_track
jmp @play_back_trk
play_back_mode2:
cmp [mode],REPEAT_DISK
jne play_back_mode3
xor eax,eax
mov al,[curr_trk]
cmp al,1
jne play_back_mode2_go
mov al,[max_trk]
mov [curr_trk],al
cmp [if_stopped],TRUE
je @play_next_trk
call play_n_track
jmp @play_back_trk
play_back_mode2_go:
dec [curr_trk]
cmp [if_stopped],TRUE
je @play_next_trk
call play_n_track
jmp @play_back_trk
play_back_mode3: ;(shuffle)
; call shuffle_track
@play_back_trk:
ret
 
 
current_trk_time:
cmp [if_stopped],TRUE
je menshe
call get_uptime
mov ebx,[stimtrk]
sub eax,ebx
; eax now is seconds from track start * 100
xor edx,edx
mov ecx,100
div ecx
mov [curr_trk_pg_time],eax
mov ebx,[curr_trk_length]
; add eax,1 ;{inc curr time on 1 sec)
cmp eax,ebx
jb menshe
call stop_playing
cmp [mode],SHUFFLE_DISK
jne @f
call shuffle_track
@@:
cmp [mode],REPEAT_TRACK
je @@mode_repeat_1
mov al,[max_trk]
cmp [curr_trk],al
jb @@next_trk_ok
cmp [mode],REPEAT_DISK
jne menshe
mov [curr_trk],0
@@next_trk_ok:
inc [curr_trk]
@@mode_repeat_1:
call play_n_track
menshe:
ret
 
 
rem_time_trk:
call get_uptime
mov [stimtrk],eax
ret
 
fast_forward:
cmp [if_stopped],TRUE
je end_ffwd
mov eax,[curr_trk_pg_time]
add eax,5
cmp eax,[curr_trk_length]
jae end_ffwd
cmp [stimtrk],500
jbe end_ffwd
sub [stimtrk],500
call current_trk_time
call play_from_x_time
end_ffwd:
ret
 
fast_rewind:
cmp [if_stopped],TRUE
je end_frew
cmp [curr_trk_pg_time],5
jbe end_frew
add [stimtrk],500
call current_trk_time
call play_from_x_time
end_frew:
ret
 
renew_shuftab:
mov ecx,40
@rn:
mov [shuftab+ecx],cl
loop @rn
mov cl,[max_trk]
mov [shuftab],cl
ret
 
 
shuffle_track:
call get_uptime
ror eax,16
cmp eax,0
je shuffle_track
xor ecx,ecx
mov cl,[shuftab]
cmp ecx,1
je @enddsk
xor edx,edx
div ecx
cmp edx,0
je shuffle_track
xor ecx,ecx
mov cl,[max_trk]
@main_loop:
xor eax,eax
mov al,[shuftab+ecx]
cmp al,0
je @f
dec edx
cmp edx,0
jne @f
mov cl,[shuftab]
dec cl
mov [shuftab],cl
mov [shuftab+eax],0
mov [curr_trk],al
call play_n_track
jmp @endofshuffle
@@:
loop @main_loop
jmp @endofshuffle
@enddsk:
call stop_playing
@endofshuffle:
 
ret
 
 
 
 
play_from_x_time:
xor ecx,ecx
mov cl,[curr_trk]
shl cl,3
add cl,1
add ecx,cdp
mov ebx,[ecx]
mov ecx,ebx
and ecx,0x00ffffff
 
mov eax,[curr_trk_pg_time]
xor edx,edx
mov ebx,60
div ebx
add cl,al ;mins
add dl,ch
xor eax,eax
mov al,dl
xor edx,edx
div ebx
add cl,al ;real min
mov ch,dl ;real sec
 
mov eax,24
mov ebx,1
mcall
ret
 
play_n_track:
mov [if_paused],FALSE
mov [if_stopped],FALSE
mov [curr_trk_pg_time],0
call draw_window
; mov eax,26
; mov ebx,9
; mcall
call get_uptime
mov [stimtrk],eax
xor ebx,ebx
xor ecx,ecx
mov cl,[curr_trk]
inc cl
shl cl,3
add cl,1
add ecx,cdp
mov ebx,[ecx]
and ecx,0x00ffffff
mov ecx,ebx
;get_minutes:
and ecx,0x000000ff
mov eax,ecx
imul eax,60
;get_seconds:
mov ecx,ebx
and ecx,0x0000ff00
shr ecx,8
add eax,ecx
;eax now is next pos in secs
mov [next_pos_sec],eax
;eax now is current pos in secs
xor ebx,ebx
xor ecx,ecx
mov cl,[curr_trk]
shl cl,3
add cl,1
add ecx,cdp
mov ebx,[ecx]
and ecx,0x00ffffff
mov ecx,ebx
;get_minutes:
and ecx,0x000000ff
mov eax,ecx
imul eax,60
;get_seconds:
mov ecx,ebx
and ecx,0x0000ff00
shr ecx,8
add eax,ecx
;eax now is current pos in secs
mov ecx,[next_pos_sec]
sub ecx,eax
;eax now is length of trk in sec
mov [curr_trk_length],ecx
;now play that!
mov ecx,ebx
mov eax,24
mov ebx,1
mcall
ret
 
 
play_acd:
call chk_cdrom
call read_cd
call draw_window
call renew_shuftab
mov cl,[curr_trk]
cmp cl,0
jnz play_acd_trk_ok
mov cl,[max_trk]
mov [shuftab],cl
mov [curr_trk],1
jmp playing_no_pause
play_acd_trk_ok:
; start_chk_on_pause:
cmp [if_paused],TRUE
jne pause_playing
mov [if_stopped],FALSE
mov [if_paused],FALSE
call current_trk_time
mov eax,[curr_trk_pg_time]
mov ebx,[paused_time]
sub eax,ebx
imul eax,100
add [stimtrk],eax
call current_trk_time
call play_from_x_time
call draw_window
jmp end_play_acd
pause_playing:
cmp [curr_trk_pg_time],0
je playing_no_pause
mov eax,[curr_trk_pg_time]
mov [paused_time],eax
mov [if_paused],TRUE
call stop_playing
call draw_window
jmp end_play_acd
playing_no_pause:
mov [if_paused],FALSE
call rem_time_trk
call play_n_track
call draw_window
end_play_acd:
ret
 
stop_playing:
mov eax, 24
mov ebx,3
mcall
mov cl,[max_trk]
mov [shuftab],cl
mov [if_stopped],TRUE
cmp [if_paused],TRUE
je end_stop_playing
mov [curr_trk_pg_time],0
end_stop_playing:
call draw_window
ret
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
draw_info:
;bar->
mov eax,13
mov ebx, 10 shl 16 + 41
mov ecx,120 shl 16 + 9
mov edx,0x00ffffff
mcall
mov ebx, 96 shl 16 + 11
mcall
mov ebx, 185 shl 16 + 11
mcall
mov ebx, 200 shl 16 + 11
mcall
mov ebx, 150 shl 16 + 11
mcall
mov ebx, 165 shl 16 + 11
mcall
;bar<-
 
mov eax,4
mov ebx,10 shl 16 +120
mov ecx,0x00111111
cmp [mode],NORMAL_PLAY
jne info_mode_1
mov edx,mode_normal
jmp info_mode_end
info_mode_1:
cmp [mode],REPEAT_TRACK
jne info_mode_2
mov edx,mode_repeat_1
jmp info_mode_end
info_mode_2:
cmp [mode],REPEAT_DISK
jne info_mode_3
mov edx,mode_repeat_all
jmp info_mode_end
info_mode_3:
cmp [mode],SHUFFLE_DISK
jne info_mode_end
mov edx,mode_shuffle
; mov ecx,0x00aaaaaa
; mov cl,[max_trk]
; mov [shuftab],cl
jmp info_mode_end
info_mode_end:
mov esi,7
mcall
 
;num info ->
mov eax,47
xor ebx,ebx
mov bl,0
mov bh,0
or ebx,0x20000 ;X0000 - number of digits to draw
xor ecx,ecx
mov cl, [curr_trk] ;number to draw
mov edx,96 shl 16 + 120
mov esi,0x111111
mcall
mov eax,[curr_trk_pg_time]
xor edx,edx
mov ecx,60
div ecx
push edx
mov ecx,eax
mov eax,47
mov edx,150 shl 16 + 120
mcall
pop ecx
mov edx,165 shl 16 + 120
mcall
mov eax,[curr_trk_length]
xor edx,edx
mov ecx,60
div ecx
push edx
mov ecx,eax
mov eax,47
mov edx,185 shl 16 + 120
mcall
pop ecx
mov edx,200 shl 16 + 120
mcall
;num info <-
ret
 
 
draw_window:
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
mcall
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx, 50*65536+219 ; [x start] *65536 + [x size]
mov ecx,100*65536+168 ; [y start] *65536 + [y size]
mov edx,0x04ffffff ; color of work area RRGGBB
mov esi,0x8099bbff ; color of grab bar RRGGBB,8->color glide
mov edi,0x0099bbee ; color of frames RRGGBB
mcall
; WINDOW TITLE
mcall
mov eax,71
mov ebx,1
mov ecx,labelt
int 40h
 
mov eax,13 ;bar
mov ebx,8 shl 16 + 204
mov ecx,28 shl 16 + 84
mov edx,0x000fe6f5
mcall
 
;info ->
mov eax,4
mov ebx,63 shl 16 + 120
mov ecx,0x00111111
mov edx,playing_trk_info
mov esi,6
mcall
mov ebx,120 shl 16 + 120
mov edx,playing_time_info
; mov esi,5
dec esi
mcall
mov ebx,178 shl 16 + 120
mov edx,slash
mov esi,1
mcall
mov ebx,196 shl 16 + 120
mov edx,column
; mov esi,1
mcall
mov ebx,161 shl 16 + 120
mov edx,column
; mov esi,1
mcall
;info <-
 
; button MODE
mov eax,8
mov ebx,12*65536+20
mov ecx,135*65536+20
mov edx,7
mov esi,COLOR_FUNC_BUTS
mcall
; text
mov eax,4
mov ebx,19*65536+142
mov ecx,0x100f73f5;ffff0f
mov edx,but_mode_lab
mov esi,1
mcall
 
; button BACK
mov eax,8
mov ebx,37*65536+20
mov ecx,135*65536+20
mov edx,6
mov esi,COLOR_FUNC_BUTS
mcall
mov [coord_x],51
mov [coord_y],141
call draw_left_triangle
mov [coord_x],44
call draw_vertical_line
 
; button NEXT
mov eax,8
mov ebx,62*65536+20
mov ecx,135*65536+20
mov edx,5
mov esi,COLOR_FUNC_BUTS
mcall
mov [coord_x],68
mov [coord_y],141
call draw_right_triangle
mov [coord_x],74
call draw_vertical_line
 
; button REWIND
mov eax,8
mov ebx,87*65536+20
mov ecx,135*65536+20
mov edx,8
mov esi,COLOR_FUNC_BUTS
mcall
mov [coord_x],102
mov [coord_y],141
call draw_left_triangle
mov [coord_x],97
call draw_left_triangle
 
; button STOP
mov eax,8
mov ebx,112*65536+20
mov ecx,135*65536+20
mov edx,3
mov esi,COLOR_FUNC_BUTS
mcall
mov [coord_x],118
mov [coord_y],142
call draw_square
 
 
; button PLAY
mov eax,8
mov ebx,137*65536+20
mov ecx,135*65536+20
mov edx,2
mov esi,COLOR_FUNC_BUTS
mcall
cmp [if_stopped],TRUE
je playing_paused
cmp [if_paused],TRUE
je playing_paused
mov [coord_x],144
mov [coord_y],141
call draw_vertical_line
mov [coord_x],149
call draw_vertical_line
jmp end_draw_play
playing_paused:
mov [coord_x],144
mov [coord_y],141
call draw_right_triangle
end_draw_play:
 
 
; button FORWARD
mov eax,8
mov ebx,162*65536+20
mov ecx,135*65536+20
mov edx,9
mov esi,COLOR_FUNC_BUTS
mcall
mov [coord_x],167
mov [coord_y],141
call draw_right_triangle
mov [coord_x],172
call draw_right_triangle
 
; button RE-READ PLAYLIST
mov eax,8
mov ebx,187*65536+20
mov ecx,135*65536+20
mov edx,4
mov esi,COLOR_FUNC_BUTS
mcall
mov [coord_x],192
mov [coord_y],140
call draw_vert_list_line
dec [coord_y]
call draw_hor_list_line
mov [coord_y], 151
call draw_hor_list_line
mov [coord_x],202
mov [coord_y],140
call draw_vert_list_line
mov [coord_x],195
mov [coord_y], 142
call draw_str_list_line
mov [coord_y],145
call draw_str_list_line
mov [coord_y],148
call draw_str_list_line
 
cmp [flag],1
jne flag2
;Draw tracs buttons
xor eax,eax
xor ebx,ebx
mov ecx,10
mov al,[cdp+3]
mov [max_trk],al
xor edi,edi
mov di,ax
mov [posx],12
mov [posy],32
mov [tracs],1
draw_tracs_buttons:
mov eax,8
xor ebx,ebx
mov bl,[posx]
shl ebx,16
add ebx,15
xor ecx,ecx
mov cl,[posy]
shl ecx,16
add ecx,15
xor edx,edx
mov dx,[tracs]
add edx,10
mov esi,0xaaaaaa
add esi,edi
mcall
;---draw tracs numbers
mov eax,47
xor ebx,ebx
mov bl,0
or ebx,0x20000 ;number of digits to draw
xor ecx,ecx
mov cx, [tracs] ;number to draw
xor edx,edx
mov dl,[posx]
add dl,3
shl edx,16
add dl,[posy]
add dl,5
mov esi,0xffffff
mcall
;---
mov al,[posx]
add al,20
mov [posx],al
xor eax,eax
mov ax,[tracs]
mov bl,10
div bl
cmp ah,0
jnz no_new_str
mov al,[posxstart]
mov [posx], al
mov al,[posy]
add al,20
mov [posy],al
no_new_str:
inc [tracs]
cmp [tracs],41
je flag2
dec edi
cmp edi,0
jnz draw_tracs_buttons
 
flag2:
cmp [flag],2
jne flag3
mov eax,4
mov ebx, 20 shl 16 +67
mov ecx,0x10ffff00
mov edx,define_cdrom
mov esi,define_cdrom_len-define_cdrom
mcall
flag3:
cmp [flag],3
jne flag4
mov eax,4
mov ebx, 47 shl 16 +67
mov ecx,0x10ffff00
mov edx,no_cda
mov esi,no_cda_len-no_cda
mcall
flag4:
cmp [flag],4
jne flag5
;help screen
cmp [help_screen],1
jnz @hs2
mov edx,help1
jmp @ehs
@hs2:
cmp [help_screen],2
jnz @hs3
mov edx,help2
jmp @ehs
@hs3:
mov edx,help3
@ehs:
xor edi,edi
mov ebx,25*65536+30
new_line:
mov eax,4
mov ecx,0x111111
mov esi,31
mcall
noline:
add ebx,10
add edx,31
inc edi
cmp [edx],byte 'x'
jnz new_line
flag5:
call draw_info
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
mcall
 
ret
 
draw_right_triangle:
mov ebx,[coord_x]
mov ecx,[coord_y]
mov edx,0x00111111
mov esi,5
mov eax,9
start_draw_pixel:
push ebx
cmp eax,5
jb y_menshe_5
mov esi,10
sub esi,eax
jmp draw_pixel
y_menshe_5:
mov esi,eax
draw_pixel:
dec esi
inc ebx
push eax
mov eax,1
mcall
pop eax
cmp esi,0
jne draw_pixel
pop ebx
dec eax
inc ecx
cmp eax,0
jne start_draw_pixel
ret
 
draw_square:
mov ebx,[coord_x]
mov ecx,[coord_y]
mov edx,0x00111111
mov eax,7
q_start_draw_pixel:
push ebx
mov esi,7
q_draw_pixel:
dec esi
inc ebx
push eax
mov eax,1
mcall
pop eax
cmp esi,0
jne q_draw_pixel
pop ebx
dec eax
inc ecx
cmp eax,0
jne q_start_draw_pixel
ret
 
draw_left_triangle:
mov ebx,[coord_x]
mov ecx,[coord_y]
mov edx,0x00111111
mov esi,5
mov eax,9
l_start_draw_pixel:
push ebx
cmp eax,5
jb l_y_menshe_5
mov esi,10
sub esi,eax
jmp l_draw_pixel
l_y_menshe_5:
mov esi,eax
l_draw_pixel:
dec esi
dec ebx
push eax
mov eax,1
mcall
pop eax
cmp esi,0
jne l_draw_pixel
pop ebx
dec eax
inc ecx
cmp eax,0
jne l_start_draw_pixel
ret
 
draw_vertical_line:
mov eax,2
mov ebx,[coord_x]
mov edx,0x00111111
@@draw_2_line:
mov ecx,[coord_y]
dec ecx
mov esi,9
start_draw_vline:
inc ecx
push eax
mov eax,1
mcall
pop eax
dec esi
cmp esi,0
jne start_draw_vline
dec eax
inc ebx
cmp eax,0
jne @@draw_2_line
ret
 
draw_vert_list_line:
mov eax,1
mov ebx,[coord_x]
mov edx,0x00111111
mov ecx,[coord_y]
dec ecx
mov esi,11
vlstart_draw_vline:
inc ecx
mcall
dec esi
cmp esi,0
jne vlstart_draw_vline
dec eax
inc ebx
ret
 
draw_hor_list_line:
mov eax,1
mov ebx,[coord_x]
mov edx,0x00111111
mov ecx,[coord_y]
dec ebx
mov esi,11
hlstart_draw_vline:
inc ebx
mcall
dec esi
cmp esi,0
jne hlstart_draw_vline
dec eax
inc ebx
ret
 
draw_str_list_line:
mov eax,1
mov ebx,[coord_x]
mov edx,0x00111111
mov ecx,[coord_y]
dec ebx
mov esi,5
slstart_draw_vline:
inc ebx
mcall
dec esi
cmp esi,0
jne slstart_draw_vline
dec eax
inc ebx
ret
 
 
chk_cdrom:
mov eax,24
mov ebx,1
mcall
cmp eax,0
je chk_cdrom_ok
mov [flag],2
call draw_window
jmp chk_cdrom_end
chk_cdrom_ok:
mov [flag],0
chk_cdrom_end:
ret
 
read_cd:
mov [if_stopped],TRUE
push ax
cmp [flag],2
je read_cd_end
mov al,101
mov [cdp+3],al
mov eax,24
mov ebx,2
mov ecx, cdp
mov edx,321
mcall
mov [flag],1
mov al,100
cmp [cdp+3],al
jb read_cd_end
mov [flag],3
call draw_window
read_cd_end:
pop ax
ret
 
get_uptime:
push ebx
mov eax,26
mov ebx,9
mcall
pop ebx
ret
 
; DATA AREA
 
paused_time dd 0
if_paused db FALSE
coord_x dd 0
coord_y dd 0
flag db 0
tracs dw 1
posx db 12
posy db 32
posxstart db 12
curr_trk db 0
max_trk db 0
stimtrk dd 0
help_screen db 0
next_pos_sec dd 0
curr_trk_length dd 0
curr_trk_pg_time dd 0
was_it_ok db FALSE
if_stopped db FALSE
mode db NORMAL_PLAY
 
shuftab db 00,01,02,03,04,05,06,07,08,09
db 10,11,12,13,14,15,16,17,18,19
db 20,21,22,23,24,25,26,27,28,29
db 30,31,32,33,34,35,36,37,38,39
db 40
 
but_mode_lab: db 'M'
 
playing_time_info: db 'Time '
slash db '/'
column db ':'
mode_normal db 'Normal '
mode_repeat_1 db 'Rep trk'
mode_repeat_all db 'Rep all'
mode_shuffle db 'Shuffle'
playing_trk_info: db 'Track '
 
define_cdrom: db 'Please, define your CD-ROM'
define_cdrom_len:
 
no_cda: db 'Audio CD not found'
no_cda_len:
 
labelt:
db 'CD player',0
labellen:
 
help1: db 'HotKeys: '
db 'H - this screen (Help) '
db 'P - Play/Pause current track '
db 'S - Stop playing '
db 'L - re-read playList '
db 'N - play Next track '
db 'B - play previous track (Back) '
db ' next ->'
db 'x'
help2: db 'HotKeys: '
db 'F - fast Forward track '
db 'R - fast Rewind track '
db 'M - change Mode '
db ' '
db ' '
db ' '
db '<- prev next ->'
db 'x'
help3: db 'About: '
db 'Audio CD Player ver 1.1beta-2 '
db 'All questions, wishes and '
db 'advices please send to: '
db ' E-mail: dma@bn.by '
db ' FidoNet: 2:450/258.75 '
db ' '
db '<- prev '
db 'x'
cdp:
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/other/outdated/cdp/trunk/Tupfile.lua
0,0 → 1,3
if tup.getconfig("NO_FASM") ~= "" then return end
tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"})
tup.rule({"cdp.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "cdp")
/programs/other/outdated/cdp/trunk/build_en.bat
0,0 → 1,5
@erase lang.inc
@echo lang fix en >lang.inc
@fasm cdp.asm cdp
@erase lang.inc
@pause
/programs/other/outdated/cdp/trunk/build_ru.bat
0,0 → 1,5
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm cdp.asm cdp
@erase lang.inc
@pause
/programs/other/outdated/iconedit/trunk/iconedit.asm
0,0 → 1,983
;
; Modified from original icon editor
;
; Compile with FASM for Menuet
;
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x100000 ; memory for app
dd 0x7fff0 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
include 'lang.inc'
include '..\..\..\..\macros.inc'
 
window_x_size equ 346
window_y_size equ 312
 
START: ; start of execution
 
call draw_window ; at first, draw the window
call get_screen_size ; get screen x and y size
 
check_mouse:
 
call draw_mouse ; are we editing the icon
call check_colour ; are we selecting a colour
 
still:
 
mov eax,23 ; wait here for event
mov ebx,1 ; for 1ms
mcall
 
cmp eax,1 ; redraw request ?
je red
cmp eax,2 ; key in buffer ?
je key
cmp eax,3 ; button in buffer ?
je button
 
jmp check_mouse ; start loop again
 
red: ; redraw
call draw_window ; draw our window
jmp check_mouse ; start the loop again
key:
 
mov eax,2 ; get a key
mcall ; do it
shr eax,8 ; move it to al
cmp byte [editstate],0 ; are we in edit mode
je check_mouse ; if not start loop again
cmp al,8 ; is it a backspace
jne no_bksp ; if no jump over backspace code
cmp byte [editpos],0 ; is it the first character
je no_del_last ; if yes jump over backspace code
dec byte [editpos] ; decrement our position
xor ebx,ebx ; clear pointer
mov bl,byte [editpos] ; get our position
add ebx,icon ; add our offset
mov byte [ebx],0 ; delete character
no_del_last:
call draw_filename ; update filename
jmp check_mouse ; start loop again
no_bksp:
cmp al,13 ; is it the enter key
jne no_enter ; no then jump over enter code
mov byte [editstate],0 ; get out of edit mode
call draw_filename ; update filename
jmp check_mouse ; start loop again
no_enter:
cmp al,31 ; are we below character 31
jbe no_lit ; then must be illegal
cmp al,97 ; are we below character 97
jb capital ; then must be ok
sub eax,32 ; else subtract 32 from it to make it legal
capital:
xor ebx,ebx ; clear our pointer
mov bl,byte [editpos] ; get our position
add ebx,icon ; add our offset
mov byte [ebx],al ; move our character into buffer
inc byte [editpos] ; increment our edit position
cmp byte [editpos],12 ; are we at our last position
jne no_null_state ; no then jump over last position code
mov byte [editstate],0 ; get out of edit mode
no_null_state:
call draw_filename ; update filename
no_lit:
jmp check_mouse ; start loop again
 
button: ; button
mov eax,17 ; get id
mcall
 
cmp ah,1 ; button id=1 ?
jne button_3
mov eax,-1 ; close this program
mcall
button_3:
cmp ah,3 ; was it button 3 - FILENAME
jne button_4 ; no then try button 4
cld ;
mov byte [editstate],1 ; enter edit mode
mov edi,icon ; point to our buffer
mov eax,0x20202020 ; file reg with 4 spaces
mov ecx,3 ; going to write it 3 times
rep stosd ; repeat giving 12 spaces
mov byte [editpos],0 ; zero our edit position
call draw_filename ; update filename
jmp check_mouse ; start loop again
button_4:
cmp ah,4 ; was it button 4 - LOAD
jne button_5 ; no then try button 5
mov byte [editstate],0 ; dont want to be in edit mode
call draw_filename ; update filename
call load_file ; load the file
call draw_icon ; update icon screen
call draw_graph ; update edit screen
jmp check_mouse ; start loop again
button_5:
cmp ah,5 ; was it button 5 - SAVE
jne button_6 ; no then try button 6
mov byte [editstate],0 ; dont want to be in edit mode
call draw_filename ; update filename
call save_file ; save the file
jmp check_mouse ; start loop again
button_6:
cmp ah,6 ; was it button 6 - CLEAR ICON
jne button_7 ; no then try button 7
mov byte [editstate],0 ; dont want to be in edit mode
call draw_filename ; update filename
call clear_graph_icon ; clear the icon and edit screens
jmp check_mouse
 
button_7:
cmp ah,7 ; was it button 7 - FLIP ICON
jne button_8 ; no then try button 8
call flip_icon ; flip
jmp check_mouse
 
button_8:
cmp ah,8 ; was it button 8 - MIRROR ICON
jne button_9 ; no then try button 9
call flip_diag ; flip L/R and U/D
call flip_icon ; cheated now have to flip it
jmp check_mouse
 
button_9:
cmp ah,9 ; was it button 9 - FLIP L/R and U/D
jne button_10 ; no then try button 10
call flip_diag ; flip L/R and U/D
call draw_icon ; update icon
call draw_graph ; update graph
jmp check_mouse
 
button_10:
cmp ah,10 ; was it button 9 - SET AS BGR
jne check_mouse ; no then exit
call set_background ; set as background
 
jmp check_mouse ; start loop again
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
draw_window:
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
mcall
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+window_x_size ; [x start] *65536 + [x size]
mov ecx,100*65536+window_y_size ; [y start] *65536 + [y size]
mov edx,0x14ffffff ; color of work area 0x00RRGGBB
mov edi,title ; WINDOW LABEL
mcall
mov eax,13 ; function 13 : draw bar
mov ebx,5*65536+window_x_size-9 ; [x start] *65536 + [x size]
mov ecx,(window_y_size-20)*65536+16 ; [y start] *65536 + [y size]
mov edx,0x7799bb ; colour 0x00RRGGBB
mcall
; DEFINE BUTTON 3 : FILENAME
mov eax,8 ; function 8 : define button
mov ebx,5*65536+62 ; [x start] *65536 + [x size]
mov ecx,(window_y_size-19)*65536+14 ; [y start] *65536 + [y size]
mov edx,3 ; button id number
mov esi,0x7799bb ; button color 0x00RRGGBB
mcall
; BUTTON 3 TEXT
mov eax,4 ; function 4 : write text to window
mov ebx,13*65536+window_y_size-15 ; [x start] *65536 + [y start]
mov ecx,0xddeeff ; text color 0x00RRGGBB
mov edx,button_text_3 ; pointer to text beginning
mov esi,8 ; text length
mcall
 
call draw_filename ; update filename
 
; DEFINE BUTTON 4 : LOAD
mov eax,8 ; function 8 : define button
mov ebx,(window_x_size-87)*65536+38 ; [x start] *65536 + [x size]
mov ecx,(window_y_size-19)*65536+14 ; [y start] *65536 + [y size]
mov edx,4 ; button id number
mov esi,0x7799bb ; button color 0x00RRGGBB
mcall
; DEFINE BUTTON 5 : SAVE
mov ebx,(window_x_size-43)*65536+38 ; [x start] *65536 + [x size]
mov edx,5 ; button id number
mcall
; DEFINE BUTTON 6 : CLEAR ICON
mov ebx,268*65536+72 ; [x start] *65536 + [x size]
mov ecx,65*65536+14 ; [y start] *65536 + [y size]
mov edx,6 ; button id number
mcall
; DEFINE BUTTON 7 : FLIP VERTICAL
mov ecx,85*65536+14 ; [y start] *65536 + [y size]
mov edx,7 ; button id number
mcall
; DEFINE BUTTON 8 : FLIP HORIZONTAL
mov ecx,105*65536+14 ; [y start] *65536 + [y size]
mov edx,8 ; button id number
mcall
; DEFINE BUTTON 9 : SET AS BACKGROUND
mov ecx,125*65536+14 ; [y start] *65536 + [y size]
mov edx,9 ; button id number
mcall
; DEFINE BUTTON 10 : SET AS BACKGROUND
mov ecx,145*65536+14 ; [y start] *65536 + [y size]
mov edx,10 ; button id number
mcall
; BUTTON 4 TEXT
mov eax,4 ; function 4 : write text to window
mov ebx,267*65536+window_y_size-15 ; [x start] *65536 + [y start]
mov ecx,0xddeeff ; text color 0x00RRGGBB
mov edx,button_text_4 ; pointer to text beginning
mov esi,4 ; text length
mcall
; BUTTON 5 TEXT
mov ebx,311*65536+window_y_size-15 ; [x start] *65536 + [y start]
mov edx,button_text_5 ; pointer to text beginning
mcall
; BUTTON 6 TEXT
mov ebx,275*65536+69 ; [x start] *65536 + [y start]
mov edx,button_text_6 ; pointer to text beginning
mov esi,10 ; text length
mcall
; BUTTON 7 TEXT
mov ebx,275*65536+89 ; [x start] *65536 + [y start]
mov edx,button_text_7 ; pointer to text beginning
mcall
; BUTTON 8 TEXT
mov ebx,275*65536+109 ; [x start] *65536 + [y start]
mov edx,button_text_8 ; pointer to text beginning
mcall
; BUTTON 9 TEXT
mov ebx,275*65536+129 ; [x start] *65536 + [y start]
mov edx,button_text_9 ; pointer to text beginning
mcall
; BUTTON 10 TEXT
mov ebx,275*65536+149 ; [x start] *65536 + [y start]
mov edx,button_text_10 ; pointer to text beginning
mcall
; DRAW GRAPH BACKGROUND
mov eax,13 ; function 13 : draw bar
mov ebx,6*65536+257 ; [x start] *65536 + [x size]
mov ecx,26*65536+257 ; [y start] *65536 + [y size]
mov edx,0x7799bb ; colour 0x00RRGGBB
mcall
; DRAW ICON BACKGROUND
mov ebx,268*65536+34 ; [x start] *65536 + [x size]
mov ecx,26*65536+34 ; [y start] *65536 + [y size]
mcall
; DRAW PALETTE BACKGROUND
mov ebx,268*65536+34 ; [x start] *65536 + [x size]
mov ecx,217*65536+33 ; [y start] *65536 + [y size]
mcall
; DRAW PALETTE BACKGROUND
mov ebx,268*65536+33 ; [x start] *65536 + [x size]
mov ecx,250*65536+33 ; [y start] *65536 + [y size]
mcall
; DRAW PALETTE BACKGROUND
mov ebx,301*65536+33 ; [x start] *65536 + [x size]
mov ecx,249*65536+34 ; [y start] *65536 + [y size]
mcall
; DRAW GREYSCALE BACKGROUND
mov ebx,307*65536+34 ; [x start] *65536 + [x size]
mov ecx,210*65536+34 ; [y start] *65536 + [y size]
mcall
; DRAW SELECTED COLOUR BACKGROUND
mov ebx,268*65536+73 ; [x start] *65536 + [x size]
mov ecx,171*65536+34 ; [y start] *65536 + [y size]
mcall
; DRAW WHITE TO START
mov ebx,269*65536+71 ; [x start] *65536 + [x size]
mov ecx,172*65536+32 ; [y start] *65536 + [y size]
mov edx,0xffffff ; colour 0x00RRGGBB
mcall
; DRAW PALETTE RED + GREEN SECTION
xor edi,edi ; clear column loop count
next_r_g_outer:
xor esi,esi ; clear line loop count
next_r_g_inner:
mov eax,1 ; function 1 : putpixel
mov ebx,edi ; get column count
shr ebx,3 ; divide by 8
add ebx,269 ; add our x offset
mov ecx,esi ; get our line count
shr ecx,3 ; divide by 8
add ecx,218 ; add our y offset
mov edx,255 ; maximum red
sub edx,edi ; minus column count
shl edx,8 ; into position 0x0000RR00
add edx,255 ; maximum green
sub edx,esi ; minus line count
shl edx,8 ; into position 0x00RRGG00
mcall
add esi,5 ; colour in steps of 5 to keep small
cmp esi,255 ; have we done a line
jne next_r_g_inner ; nop then do next pixel
add edi,5 ; colour in steps of 5 to keep small
cmp edi,255 ; have we done all columns
jne next_r_g_outer ; no then start the next one
 
; DRAW PALETTE GREEN + BLUE SECTION
mov edi,0 ; as above
next_g_b_outer:
mov esi,0
next_g_b_inner:
mov eax,1
mov ebx,edi
shr ebx,3
add ebx,269
mov ecx,esi
shr ecx,3
add ecx,250
mov edx,255
sub edx,edi
shl edx,16
add edx,esi
mcall
add esi,5
cmp esi,255
jne next_g_b_inner
add edi,5
cmp edi,255
jne next_g_b_outer
 
; DRAW PALETTE BLUE + RED SECTION
mov edi,0 ; as above
next_b_r_outer:
mov esi,0
next_b_r_inner:
mov eax,1
mov ebx,edi
shr ebx,3
add ebx,301
mov ecx,esi
shr ecx,3
add ecx,250
mov edx,edi
shl edx,8
add edx,esi
mcall
add esi,5
cmp esi,255
jne next_b_r_inner
add edi,5
cmp edi,255
jne next_b_r_outer
 
; DRAW GREYSCALE
mov edi,0
next_b_w_outer:
mov esi,0
next_b_w_inner:
mov eax,1
mov ebx,edi
shr ebx,3
add ebx,308
mov ecx,esi
shr ecx,3
add ecx,211
mov edx,esi
shl edx,8
add edx,esi
shl edx,8
add edx,esi
mcall
add esi,5
cmp esi,255
jne next_b_w_inner
add edi,5
cmp edi,255
jne next_b_w_outer
 
cmp [first_run],0 ; is it the first window draw
jne dont_load ; no then dont reload the file
call load_file ; load initial file
mov [first_run],1 ; first window draw done
dont_load:
call draw_icon ; draw icon area
call draw_graph ; draw edit area
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
mcall
 
ret ; return
 
; *********************************************
; ******* SET BACKGROUND ********
; *********************************************
set_background:
 
mov ecx,image+3600 ; point to our decode buffer
mov edx,image+54+32*32*3-96 ; point to last line of bmp
 
mov edi,0 ; zero line count
decode_line:
mov esi,0 ; zero column count
decode_column:
mov ebx,[edx] ; get our data
mov [ecx],ebx ; store our data
add ecx,4 ; add 4 bytes to pointer as using double word
add edx,4 ; add 4 bytes to pointer
inc esi ; increment column count
cmp esi,24 ; have we done all columns
jne decode_column ; no then do some more
sub edx,192 ; move back 2 lines of bmp data
inc edi ; increment line count
cmp edi,33 ; have we done all lines
jne decode_line ; no then do another one
 
mov eax,15 ; background
mov ebx,1 ; set background size
mov ecx,32 ; x size
mov edx,32 ; y size
mcall ; do it
mov ebx,4 ; type of background draw
mov ecx,1 ; tile
mcall ; do it
mov ebx,5 ; blockmove image to os bgr memory
mov ecx,image+3600 ; point to image
mov edx,0 ; start of bgr memory
mov esi,32*32*3 ; byte count
mcall ; do it
mov ebx,3 ; draw background
mcall ; do it
 
ret ; return
 
; *********************************************
; ******* GET SCREEN X and Y SIZE ********
; *********************************************
get_screen_size:
 
mov eax,14 ; function 14 : get screen max
mcall ; returns eax : 0xXXXXYYYY
push eax ; save reg
and eax,0x0000ffff ; split out y size
add eax,1 ; add 1 to remove zero base
mov [y_size],eax ; store for later
pop eax ; restore reg
shr eax,16 ; move x size down the reg
add eax,1 ; add 1 to remove zero base
mov [x_size],eax ; store for later
 
ret
 
; *********************************************
; ******* LOAD FILE ********
; *********************************************
load_file:
 
mov eax,6 ; function 6 : load file
mov ebx,icon ; point to the name
mov ecx,0 ; reserved
mov edx,200000 ; reserved
mov esi,image ; point to image buffer
mcall ; do it
 
ret ; return
 
; *********************************************
; ******* SAVE FILE ********
; *********************************************
save_file:
 
mov eax,33 ; function 33 : save file
mov ebx,icon ; point to name
mov ecx,image ; point to our data
mov edx,54+32*32*3 ; how much data to transfer
xor esi,esi ; 0 - create a new file
mcall ; do it
 
ret ; return
 
; *********************************************
; ******* DRAW FILENAME TO SCREEN ********
; *********************************************
draw_filename:
; DRAW COLOUR BACKGROUND
pusha ; save all registers on stack
mov eax,13 ; function 13 : draw bar
mov ebx,73*65536+81 ; [x start] *65536 + [x size]
mov ecx,(window_y_size-19)*65536+15 ; [y start] *65536 + [y size]
mov edx,0x557799 ; colour 0x00RRGGBB
mcall
 
mov eax,4 ; function 4 : write text to window
mov ebx,78*65536+(window_y_size-15) ; [y start] *65536 + [y size]
xor ecx,ecx ; colour 0x00RRGGBB = black
mov edx,icon ; point to text
mov esi,12 ; number of characters to write
cmp byte [editstate],1 ; are we in edit mode
jne no_active_1 ; no then jump over change colour
mov ecx,0x00112299 ; else change colour
no_active_1:
mcall ; do it
popa ; return all registers to original
ret ; return
 
; *********************************************
; ******* DRAW ICON FROM LOADED FILE ********
; *********************************************
draw_icon:
 
mov ecx,27 ; y start position
mov eax,image+51+32*32*3 ; point to our bmp data
mov edi,0 ; line count
line:
mov esi,0 ; column count
mov ebx,269+31 ; x start position
pixel:
mov edx,[eax] ; colour 0x00RRGGBB from image data
push eax ; save our position
mov eax,1 ; function 1 : put pixel
mcall ; do it
pop eax ; restore our position
sub eax,3 ; point to next pixel colour
dec ebx ; move our x position
inc esi ; increment our column count
cmp esi,32 ; have we done all columns
jne pixel ; no then do next pixel
inc ecx ; move our y position
inc edi ; increment line count
cmp edi,32 ; have we done all lines
jne line ; no then do next line
 
ret ; return
 
; *********************************************
; ******* DRAW GRAPH FROM LOADED FILE *******
; *********************************************
draw_graph:
 
mov edi,0 ; line count
mov eax,image+51+32*32*3 ; point to our bmp data
next_lin:
mov ecx,edi ; use our line count for position
shl ecx,3 ; multiply by eight
add ecx,27 ; add y start position
shl ecx,16 ; move into top eight bytes [y start]
add ecx,7 ; add box height [y size]
mov esi,32 ; column count
next_bo:
mov ebx,esi ; use our column count for position
shl ebx,3 ; multiply by eight
add ebx,-1 ; add a correction
shl ebx,16 ; and move into top eight bytes [x start]
add ebx,7 ; add box width [x size]
mov edx,[eax] ; point to bmp data
push eax ; save our position
mov eax,13 ; function 13 : draw bar
mcall ; do it
pop eax ; restore our position
sub eax,3 ; point to next pixel colour
dec esi ; increment column count
cmp esi,0 ; have we done all columns
jne next_bo ; no then do the next column
inc edi ; increment line count
cmp edi,32 ; have we done all lines
jne next_lin ; no then do the next line
 
ret ; return
 
; *********************************************
; ******* CLEAR GRAPH and ICON AREA ********
; *********************************************
clear_graph_icon:
 
; CLEAR IMAGE DATA
mov edi,image+54 ; point to our data
mov eax,0x00000000 ; data to write
mov ecx,(32*32*3)/4 ; how much data
rep stosd ; repeat until all data transfered
call draw_icon ; draw a blank icon
call draw_graph ; draw a blank graph
 
ret ; return
 
; *********************************************
; ******* FLIP ICON TOP to BOTTOM ********
; *********************************************
flip_icon:
 
mov ecx,image+54 ; point at first line
mov edx,image+54+32*32*3+96 ; point 1 line past end
 
mov edi,0 ; zero line count
lines:
mov esi,0 ; zero column count
sub edx,192 ; move back 2 lines
columns:
mov eax,[ecx] ; get bytes
mov ebx,[edx] ; get bytes
mov [ecx],ebx ; swap bytes
mov [edx],eax ; swap bytes
add ecx,4 ; move pointer
add edx,4 ; move pointer
inc esi ; increment column count
cmp esi,24 ; have we done all columns
jne columns ; no then do next column
inc edi ; increment line count
cmp edi,16 ; have we done all lines
jne lines ; no then do next line
call draw_icon ; update icon
call draw_graph ; update graph
 
ret ; return
 
; *********************************************
; ******* FLIP ICON DIAGONAL ********
; *********************************************
flip_diag:
 
mov ecx,image+54 ; point line 1 first bytes
mov edx,image+3600 ; point to buffer
xor esi,esi ; zero byte count
 
pusha ; save all registers
copy_out:
mov eax,[ecx] ; get bytes
mov [edx],eax ; copy bytes
add ecx,4 ; move pointer
add edx,4 ; move pointer
inc esi ; increment byte count
cmp esi,24*32 ; have we done all bytes
jne copy_out ; no then do the next
popa ; restore all registers
 
mov edx,image+3600+32*32*3-3 ; point to last bytes
copy_in:
mov eax,[edx] ; get bytes
mov [ecx],eax ; copy to image first bytes
add ecx,3 ; move pointer 3 bytes
sub edx,3 ; move pointer 3 bytes
inc esi ; increment byte count
cmp esi,32*32 ; have we done all bytes
jne copy_in ; no then do next
 
ret ; return
 
; *********************************************
; ******* DRAW MOUSE ON GRAPH / ICON ********
; *********************************************
draw_mouse:
 
mov eax,37 ; function 37
mov ebx,2 ; sub function 2 : check for mouse button
mcall ; do it
cmp eax,0 ; was a button pressed
je exit_mouse ; no then jump to exit
cmp eax,1 ; left hand button
je colour_mouse ; we are using selected colour
mov [draw_colour],0x000000 ; else draw with black
jmp blank ; jmp over colour select
colour_mouse:
mov eax,[sel_colour] ; get our selected colour
mov [draw_colour],eax ; save our selected colour
blank:
mov eax,37 ; function 37
mov ebx,1 ; sub function 1 : get mouse position
mcall ; do it
push eax ; save our x/y position for later
and eax,0x0000ffff ; y is in lower bytes
add eax,1 ; add 1 because we are zero based
mov [my_pos],eax ; save y position
pop eax ; restore our x/y position
shr eax,16 ; shift x into lower bytes
add eax,1 ; add 1 because we are zero based
mov [mx_pos],eax ; save x position
cmp [mx_pos],7 ; check we are within x/y limits
jle exit_mouse
cmp [mx_pos],263
jge exit_mouse
cmp [my_pos],27
jle exit_mouse
cmp [my_pos],283
jge exit_mouse
mov eax,[mx_pos] ; calculate nearest square and save
sub eax,7 ; subtract 7 graph zero offset
shr eax,3 ; divide by 8 (box size) loose remainder
mov [icon_x],eax ; save for use later in icon
shl eax,3 ; multiply by 8 to get box position
add eax,7 ; add 7 graph zero offset
mov [gx_pos],eax ; save graph x position
mov eax,[my_pos] ; repeat for y
sub eax,27 ;
shr eax,3 ;
mov [icon_y],eax ;
shl eax,3 ;
add eax,27 ;
mov [gy_pos],eax ;
mov eax,13 ; function 13 : draw bar
mov ebx,[gx_pos] ; load graph x position
shl ebx,16 ; shift into high bytes
add ebx,7 ; add box size
mov ecx,[gy_pos] ; repeat for y
shl ecx,16 ;
add ecx,7 ;
mov edx,[draw_colour] ; give it a colour
mcall ; do it
mov eax,1 ; function 1 : put pixel
mov ebx,[icon_x] ; icon x from above
add ebx,269 ; add icon x offset
mov ecx,[icon_y] ; icon y from above
add ecx,27 ; add icon y offset
mov edx,[draw_colour] ; give it a colour
mcall ; do it
mov ecx,image+54 ; point to our data
mov ebx,31 ; 32 lines in image zero based
sub ebx,[icon_y] ; get the correct line
mov eax,96 ; 96 or 3 bytes per colour * 32 columns
mul ebx ; multiply by 96 result in eax
add ecx,eax ; add to our position
mov ebx,[icon_x] ; get the correct column
mov eax,3 ; 3 bytes per colour
mul ebx ; multiply by 3 result in eax
add ecx,eax ; add to our position
mov ebx,[draw_colour] ; get our colour
mov [ecx],bl ; move blue into image data
mov [ecx+1],bh ; move green into image data
shr ebx,16 ; shift red down
mov [ecx+2],bl ; move red into image data
exit_mouse:
 
ret ; return
 
; *********************************************
; ******* GET COLOUR TO DRAW WITH ********
; *********************************************
check_colour:
 
mov eax,37 ; function 37
mov ebx,2 ; sub function 2 : check for mouse button
mcall ; do it
cmp eax,0 ; was a button pressed
je exit_draw ; no then jump to exit
mov eax,37 ; function 37
mov ebx,1 ; sub function 1 : get mouse position
mcall ; do it
push eax ; save our x/y position for later
and eax,0x0000ffff ; y is in lower bytes
add eax,1 ; add 1 because we are zero based
mov [my_pos],eax ; save y position
pop eax ; restore our x/y position
shr eax,16 ; shift x into lower bytes
add eax,1 ; add 1 because we are zero based
mov [mx_pos],eax ; save x position
cmp [mx_pos],270 ; check we are within x/y limits
jl check_rb
cmp [mx_pos],301
jg check_rb
cmp [my_pos],219
jl check_rb
cmp [my_pos],250
jg check_rb
 
call decode_mouse
 
mov edi,0
next_sel_rg_outer:
mov esi,0
next_sel_rg_inner:
mov eax,1
mov ebx,edi
shr ebx,3
add ebx,308
mov ecx,esi
shr ecx,3
add ecx,211
mov edx,[sel_colour]
add edx,esi
mcall
add esi,5
cmp esi,255
jne next_sel_rg_inner
add edi,5
cmp edi,255
jne next_sel_rg_outer
 
 
check_rb:
 
cmp [mx_pos],270 ; check we are within x/y limits
jl check_bg
cmp [mx_pos],301
jg check_bg
cmp [my_pos],251
jle check_bg
cmp [my_pos],282
jg check_bg
 
call decode_mouse
 
mov edi,0
next_sel_rb_outer:
mov esi,0
next_sel_rb_inner:
mov ebx,edi
shr ebx,3
add ebx,308
mov ecx,esi
shr ecx,3
add ecx,211
mov edx,[sel_colour]
mov eax,esi
shl eax,8
add edx,eax
mov eax,1
mcall
add esi,5
cmp esi,255
jne next_sel_rb_inner
add edi,5
cmp edi,255
jne next_sel_rb_outer
 
 
check_bg:
 
cmp [mx_pos],301 ; check we are within x/y limits
jl get_colour
cmp [mx_pos],333
jg get_colour
cmp [my_pos],251
jl get_colour
cmp [my_pos],282
jg get_colour
 
call decode_mouse
 
mov edi,0
next_sel_bg_outer:
mov esi,0
next_sel_bg_inner:
mov ebx,edi
shr ebx,3
add ebx,308
mov ecx,esi
shr ecx,3
add ecx,211
mov edx,[sel_colour]
mov eax,esi
shl eax,16
add edx,eax
mov eax,1
mcall
add esi,5
cmp esi,255
jne next_sel_bg_inner
add edi,5
cmp edi,255
jne next_sel_bg_outer
 
get_colour:
 
cmp [mx_pos],309 ; check we are within x/y limits
jl exit_draw
cmp [mx_pos],340
jg exit_draw
cmp [my_pos],212
jl exit_draw
cmp [my_pos],243
jg exit_draw
 
call decode_mouse
 
mov eax,13
mov ebx,269*65536+71
mov ecx,172*65536+32
mov edx,[sel_colour]
mcall
 
mov eax,[sel_colour]
mov [draw_colour],eax
 
mov eax,47
xor ebx,ebx
mov ebx,6
shl ebx,16
mov bh,1
mov ecx,[sel_colour]
mov edx,273*65536+176
mov esi,0x000000
mcall
 
exit_draw:
 
ret
 
; *********************************************
; ******* DECODE MOUSE POSITION GET PIX *****
; *********************************************
 
decode_mouse:
 
mov eax,37
xor ebx,ebx
mcall
mov ebx,eax
mov ecx,eax
and ebx,0xffff0000
shr ebx,16
and ecx,0x0000ffff
mov eax,[x_size]
imul ecx,eax
add ebx,ecx
mov eax,35
dec ebx
mcall
 
mov [sel_colour],eax
 
ret
 
; *********************************************
; ******* DATA AREA *****
; *********************************************
 
mx_pos dd 0x0
my_pos dd 0x0
 
gx_pos dd 0x0
gy_pos dd 0x0
 
icon_x dd 0x0
icon_y dd 0x0
 
x_size dd 0x0
y_size dd 0x0
 
sel_colour dd 0x00ffffff
draw_colour dd 0x00ffffff
 
button_text_3 db 'FILENAME'
button_text_4 db 'LOAD'
button_text_5 db 'SAVE'
button_text_6 db 'CLEAR ICON'
button_text_7 db 'FLIP VERT '
button_text_8 db 'FLIP HORIZ'
button_text_9 db 'FLIP DIAG '
button_text_10 db 'SET AS BGR'
 
title db 'ICON EDITOR',0
 
icon: db 'WRITE.BMP '
 
editpos db 0
editstate db 0
 
first_run db 0
 
image:
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/other/outdated/iconedit/trunk/Tupfile.lua
0,0 → 1,3
if tup.getconfig("NO_FASM") ~= "" then return end
tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"})
tup.rule({"iconedit.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "iconedit")
/programs/other/outdated/iconedit/trunk/build_en.bat
0,0 → 1,5
@erase lang.inc
@echo lang fix en >lang.inc
@fasm iconedit.asm iconedit
@erase lang.inc
@pause
/programs/other/outdated/iconedit/trunk/build_ru.bat
0,0 → 1,5
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm iconedit.asm iconedit
@erase lang.inc
@pause
/programs/other/outdated/mixer/trunk/mixer.asm
0,0 → 1,340
 
;
; MIXER
;
; Compile with FASM
;
 
include 'lang.inc'
include '..\..\..\..\macros.inc'
 
 
use32
org 0x0
db 'MENUET01' ; header
dd 0x01 ; header version
dd START ; entry point
dd I_END ; image size
dd 0x1000 ; required memory
dd 0x1000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Path
 
 
 
START: ; start of execution
 
red: ; redraw
call draw_window ; at first, draw the window
 
 
still:
 
mov eax,10 ; wait here for event
mcall
 
cmp eax,1 ; redraw request ?
jz red
cmp eax,2 ; key in buffer ?
jz key
cmp eax,3 ; button in buffer ?
jz button
 
jmp still
 
key: ; key
mov eax,2 ; just read it and ignore
mcall
 
jmp still
 
button: ; button
mov eax,17
mcall
 
cmp ah,1 ; button id=1 ?
jnz noclose
or eax,-1 ; close this program
mcall
noclose:
 
cmp ah,101
jnz nochange
xor byte [usecard], 3 ; 1 <-> 2
 
call drawusedcard
 
nochange:
 
cmp byte [usecard],byte 1
jnz usesb16II
 
; SOUND BLASTER 16
 
 
usesb16:
 
mov al,20
cmp ah,al
jge nomain
 
mov ecx,0
cmp ah,12
jnz nomain12
mov ecx,3*16+3
nomain12:
cmp ah,13
jnz nomain13
mov ecx,7*16+7
nomain13:
cmp ah,14
jnz nomain14
mov ecx,11*16+11
nomain14:
cmp ah,15
jnz nomain15
mov ecx,15*16+15
nomain15:
 
mov eax,25
mov ebx,1
mcall
 
jmp still
 
nomain:
 
mov al,30
cmp ah,al
jge nocd
 
mov ecx,0
 
cmp ah,22
jnz nocd12
mov ecx,3*16+3
nocd12:
cmp ah,23
jnz nocd13
mov ecx,7*16+7
nocd13:
cmp ah,24
jnz nocd14
mov ecx,11*16+11
nocd14:
cmp ah,25
jnz nocd15
mov ecx,15*16+15
nocd15:
 
mov eax,25
mov ebx,2
mcall
 
jmp still
 
nocd:
 
 
jmp still
 
 
 
 
; SOUND BLASTER 16 II
 
usesb16II:
 
cld
 
mov al,20
cmp ah,al
jge IIwnomain
 
mov ecx,0
cmp ah,12
jnz IIwnomain12
mov ecx,50
IIwnomain12:
cmp ah,13
jnz IIwnomain13
mov ecx,150
IIwnomain13:
cmp ah,14
jnz IIwnomain14
mov ecx,200
IIwnomain14:
cmp ah,15
jnz IIwnomain15
mov ecx,255
IIwnomain15:
 
mov eax,28
mov ebx,1
mcall
 
jmp still
 
IIwnomain:
 
mov al,30
cmp ah,al
jge IIwnocd
 
mov ecx,0
 
cmp ah,22
jnz IIwnocd12
mov ecx,50
IIwnocd12:
cmp ah,23
jnz IIwnocd13
mov ecx,150
IIwnocd13:
cmp ah,24
jnz IIwnocd14
mov ecx,200
IIwnocd14:
cmp ah,25
jnz IIwnocd15
mov ecx,255
IIwnocd15:
 
mov eax,28
mov ebx,2
mcall
 
jmp still
 
IIwnocd:
 
 
jmp still
 
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window:
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
mcall
 
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+195 ; [x start] *65536 + [x size]
mov ecx,100*65536+140 ; [y start] *65536 + [y size]
mov edx,[wcolor] ; color of work area RRGGBB
mov edi,title ; WINDOW LABEL
mcall
 
 
mov edx,16 ; button id
mov ebx,10*65536+22
 
newbut:
 
push edx
 
mov esi,[bcolor]
 
mov eax,8 ; function 8 : define and draw button
mov ecx,35*65536+8 ; [y start] *65536 + [y size]
dec edx
mcall
mov ecx,45*65536+8 ; [y start] *65536 + [y size]
dec edx
mcall
mov ecx,55*65536+8 ; [y start] *65536 + [y size]
dec edx
mcall
mov ecx,65*65536+8 ; [y start] *65536 + [y size]
dec edx
mcall
mov ecx,75*65536+8 ; [y start] *65536 + [y size]
dec edx
mcall
 
pop edx
 
add ebx,30*65536
add edx,10
 
cmp edx,16+6*10
jnz newbut
 
 
mov eax,4 ; function 4 : write text to window
mov ebx,10*65536+104 ; [x start] *65536 + [y start]
mov ecx,0x00ffffff ; color of text RRGGBB
mov edx,text ; pointer to text beginning
mov esi,29
mcall
 
mov eax,8 ; function 8 : define and draw button
mov ebx,(5)*65536+185 ; [x start] *65536 + [x size]
mov ecx,120*65536+14 ; [y start] *65536 + [y size]
mov edx,101 ; button id
mov esi,[bcolor] ; button color RRGGBB
mcall
 
call drawusedcard
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
mcall
 
ret
 
 
drawusedcard:
 
pusha
 
mov eax,13
mov ebx,14*65536+160
mov ecx,123*65536+10
mov edx,[bcolor]
mcall
 
mov edx,c1
 
cmp [usecard],2
jnz nosbcII
mov edx,c2
nosbcII:
 
mov eax,4
mov ebx,14*65536+123
mov ecx,0x00ffffff
mov esi,30
mcall
 
popa
 
ret
 
 
 
; DATA AREA
 
bcolor dd 0x5577c8
 
wcolor dd 0x14000000
 
 
text:
db 'MAIN CD WAVE MPU4 AUX1 AUX2'
 
c1 db 'SOUND BLASTER 16 - MIXER I '
c2 db 'SOUND BLASTER 16 - MIXER II '
 
 
usecard db 0x1
 
title db 'MIXER',0
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/other/outdated/mixer/trunk/Tupfile.lua
0,0 → 1,3
if tup.getconfig("NO_FASM") ~= "" then return end
tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"})
tup.rule({"mixer.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "mixer")
/programs/other/outdated/mixer/trunk/build_en.bat
0,0 → 1,5
@erase lang.inc
@echo lang fix en >lang.inc
@fasm mixer.asm mixer
@erase lang.inc
@pause
/programs/other/outdated/mixer/trunk/build_ru.bat
0,0 → 1,5
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm mixer.asm mixer
@erase lang.inc
@pause
/programs/other/outdated/sb/trunk/sb.asm
0,0 → 1,1000
;
; SOUND BLASTER
;
; Compile with FASM for Menuet
;
 
include 'lang.inc'
include '..\..\..\..\macros.inc'
 
use32
 
org 0x0
 
db 'MENUET01' ; 8 byte id
dd 0x01
dd START ; program start
dd I_END ; program image size
dd 0x80000 ; required amount of memory
dd 0xfff0 ; stack position
dd 0,0
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
vol_data dd 0x40000
playposition dd 0x20000
next_tic dd 0x0
onoff dd 0x0
pause_between_songs dd 100
delay dd 100
repeat_song db 0
mono_stereo dd 1
 
 
; 0x10000 data from hd
; 0x20000 play position for sb
; 0x40000 volume indicator data
 
 
START: ; start of execution
 
call draw_window ; at first, draw the window
 
mov eax,26
mov ebx,9
mcall
mov [next_tic],eax
 
still:
 
mov [delay],145
cmp [mono_stereo],2
jne no_stereo
mov [delay],73
no_stereo:
 
mov eax,55
mov ebx,2
mov ecx,0
mov edx,[mono_stereo]
mcall
 
mov eax,23 ; wait here for event
mov ebx,1
mcall
 
cmp eax,0
jne do_task
 
still2:
 
cmp [onoff],0
je still
 
mov eax,26
mov ebx,9
mcall
mov ebx,[next_tic]
cmp eax,ebx
jge play_wave_block
 
mov edi,[next_tic]
sub edi,eax
mov eax,[delay]
sub eax,edi
mov edi,eax
call draw_volume
 
jmp still
 
do_task:
 
cmp eax,1 ; redraw request ?
je red
cmp eax,2 ; key in buffer ?
je key
cmp eax,3 ; button in buffer ?
je button
 
cmp eax,16+4
jne no_irman
mov eax,42
mov ebx,4
mcall
dec [ir_count]
cmp bl,140
jne no_first
mov [ir_count],3
no_first:
cmp [ir_count],0
jne no_irman
call give_wav
cmp bl,215
je play
mov ah,4
;; cmp bl,55
;; je rev
mov ah,3
;;; cmp bl,183
;;; je rev
cmp bl,127
jne no_block_dec
add [block],65536/512*10
no_block_dec:
cmp bl,191
jne no_block_inc
sub [block],65536/512*10
no_block_inc:
jmp still
no_irman:
 
jmp still
 
play_wave_block:
 
mov eax,55 ; load wave
mov ebx,0
mov ecx,[playposition]
mcall
 
mov eax,55 ; play wave
mov ebx,1
mcall
 
mov eax,26
mov ebx,9
mcall
add eax,[delay]
mov [next_tic],eax
 
call draw_wave
call read_wav
 
jmp still
 
red: ; redraw
call draw_window
jmp still
 
key: ; key
mov eax,2 ; just read it and ignore
mcall
jmp still2
 
button: ; button
mov eax,17 ; get id
mcall
 
cmp ah,6
jne no_ir
call enable_ir
jmp still
no_ir:
 
cmp ah,7
jne no_file_name
call read_string
jmp still
no_file_name:
 
cmp ah,2 ; button id=2
jne noplay
play:
mov eax,[onoff]
not eax
and eax,1
mov [onoff],eax
mov [playposition],0x20000
mov [block],2
call read_header
call read_wav
; mov [next_tic],0
jmp still
 
noplay:
 
cmp ah,3
jb no_rev
cmp ah,4
jg no_rev
sub ah,3
shr eax,8
imul eax,4000
sub eax,2000
add [block],eax
cmp [block],0x0f000000
jb block_ok
mov [block],2
block_ok:
call display_progress
jmp still2
no_rev:
 
cmp ah,5 ; repeat song ?
jne no_repeat
mov al,[repeat_song]
inc al
and eax,1
mov [repeat_song],al
shl eax,2
mov eax,[repeat_text+eax]
mov [text+40*5+31],eax
call draw_window
jmp still
repeat_text: db 'OFF ON '
no_repeat:
 
 
cmp ah,1
jne noclose
cmp [infrared_enabled],1
jne no_dis
mov eax,45
mov ebx,1
mov ecx,4
mcall
mov eax,46
mov ebx,1
mov ecx,0x3f0
mov edx,0x3ff
mcall
no_dis:
mov eax,-1 ; close this program
mcall
noclose:
 
jmp still2
 
 
give_wav:
 
pusha
 
mov eax,55
mov ebx,0
mov ecx,0x20000
mcall
 
popa
ret
 
ir_count db 0x0
 
 
drop_rate dd 100
 
draw_volume:
 
; edi = tic to show
 
ret
 
pusha
 
add edi,[vol_data]
 
mov eax,[drop_rate]
cmp eax,2
jb no_drop
sub eax,2
no_drop:
mov [drop_rate],eax
 
movzx eax,byte [edi]
cmp eax,[drop_rate]
jge drop_ok
mov eax,[drop_rate]
mov [edi],al
jmp fixed_drop
drop_ok:
mov [drop_rate],eax
fixed_drop:
 
mov eax,13
mov ebx,320*65536+20
mov ecx,50*65536+1
movzx edx,byte [edi]
shr edx,1
mov esi,128
sub esi,edx
add ecx,esi
mov edx,0x00ff00
mcall
 
mov eax,13
mov ebx,320*65536+20
movzx edx,byte [edi]
shr edx,1
mov ecx,edx
add ecx,(50+128)*65536+1
shl edx,16
sub ecx,edx
mov edx,0xff0000
mcall
 
popa
 
ret
 
 
read_header:
 
pusha
 
mov dword [file_info+4],0 ; block to read
mov dword [file_info+8],1 ; blocks to read
mov dword [file_info+12],0x10000+1024 ; return data pointer
mov dword [file_info+16],0x60000 ; work area for os
 
mov eax,58
mov ebx,file_info
mcall
 
movzx eax,byte [0x10000+1024+12+10]
mov [channels],eax
movzx eax,byte [0x10000+1024+12+20]
mov [bytes_per_sample],eax
 
cmp [0x10000+1024],dword 'RIFF'
jne unknownformat
cmp [0x10000+1024+8],dword 'WAVE'
jne unknownformat
 
mov [addb],128
cmp [channels],1
je addb_ok
mov [addb],256
addb_ok:
cmp [bytes_per_sample],1
je addb_ok2
mov [addb],256
addb_ok2:
 
mov [bmul],256
cmp [addb],256
je bmok
mov [bmul],512
bmok:
 
cmp [bytes_per_sample],4
jne no16s
mov [addb],512 ;mono_stereo
mov ecx,[mono_stereo]
shr ecx,1
shr [addb],cl
mov [bmul],128 ;mono_stereo
shl [bmul],cl
no16s:
 
popa
 
ret
 
unknownformat:
 
mov [onoff],0
 
call display_progress
 
mov eax,13
mov ebx,190*65536+10
mov ecx,104*65536+10
mov edx,0xff0000
mcall
pusha
 
mov eax,5
mov ebx,[pause_between_songs]
mcall
 
popa
mov eax,13
mov edx,0x000000
mcall
 
popa
 
ret
 
 
 
channels dd 0x0 ; 1=mono, 2 stereo
bytes_per_sample dd 0x0 ; 1=8 2=2*8/16 4=16
 
buffer dd 0x20000
 
block dd 0x2
addb dd 256 ; 128 = mono 8 bit , 256 = stereo 8 bit/16 bit mono
bmul dd 0x0 ; 512 = mono 8 bit , 256 = stereo 8 bit/16 bit mono
 
file_size dd 100
 
current_play dd wavfile+40*0
 
 
read_wav:
 
pusha
 
new_file:
 
mov edx,[block]
 
newread:
 
mov dword [file_info+4],edx ; block to read
mov dword [file_info+8],1 ; blocks to read
mov dword [file_info+12],0x10000+1024 ; return data pointer
mov dword [file_info+16],0x60000 ; work area for os
 
mov eax,58
mov ebx,file_info
mcall
 
 
pusha
mov eax,11
mcall
cmp eax,1
jne no_wd
call draw_window
no_wd:
popa
 
pusha
mov eax,38
mov ebx,1*65536+128
mov ecx,71*65536+71
add ebx,25*65536+25
mov edx,0x555555
; mcall
mov eax,38
mov ebx,[esp+32-12]
and ebx,65536/512 -1
or ebx,1*65536
add ebx,25*65536+25
mov ecx,71*65536+71
mov edx,0x999999
; mcall
popa
 
cmp eax,0
je conp
 
movzx eax,byte [repeat_song]
inc eax
and eax,1
imul eax,40
mov [current_play],wavfile
play_ok:
 
mov [onoff],1
mov [playposition],0x20000
mov [block],20
 
mov eax,5
mov ebx,[pause_between_songs]
add ebx,[delay]
mcall
 
call read_header
 
cmp [onoff],0
je noplay2
cmp [repeat_song],0
je noplay2
 
call display_progress
 
jmp new_file
 
noplay2:
 
mov [onoff],0
mov [block],2
call display_progress
 
popa
ret
conp:
 
mov [file_size],ebx
 
mov esi,0x10000+1024 ; 8 bit stereo & 16 bit mono
mov edi,edx
sub edi,[block]
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
mcall
cmp eax,2
jne read_done
mov eax,2
mcall
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]
mcall
 
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:
mcall
add edx,0x101010
add ecx,1*65536
cmp ecx,65*65536
jb newbar
newbar2:
mcall
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:
; mcall
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
mcall
 
mov eax,4
mov ebx,42*65536+117
mov ecx,[textc]
mov edx,now_playing
mov esi,38
mcall
 
popa
 
ret
 
 
shape_window:
 
ret
 
pusha
 
mov eax,50
mov ebx,0
mov ecx,shape_reference
mcall
 
mov eax,50
mov ebx,1
mov ecx,4
mcall
 
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
mcall
 
mov eax,45
mov ebx,0
mov ecx,4
mcall
 
mov eax,40
mov ebx,10000b shl 16 + 111b
mcall
 
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
mcall
; 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]
or edx,0x14000000 ; color of work area RRGGBB,8->color gl
mov edi,title ; WINDOW LABEL
mcall
 
mov eax,8 ; START/STOP - id 2
mov ebx,24*65536+77
mov ecx,80*65536+16
mov edx,2
mov esi,[border]
mcall
 
inc edx ; << / >> - id 3 , 4
add ebx,86*65536-57
mov eax,8
mcall
inc edx
add ebx,24*65536
mov eax,8
mcall
 
mov eax,8 ; REPEAT
add ebx,29*65536+54
inc edx
mcall
 
mov eax,8 ; enable infrared
add ebx,98*65536-33
add ecx,10*65536+10
inc edx
mcall
 
pusha
mov eax,8
mov ebx,25*65536+9
mov ecx,115*65536+9
inc edx
mcall
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
mcall
add ebx,11
add edx,10
mov eax,4
mcall
 
mov ebx,25*65536+35 ; draw info text with function 4
mov ecx,[textc]
mov edx,text
mov esi,40
newline:
mov eax,4
mcall
add ebx,10
add edx,40
cmp [edx],byte 'x'
jne newline
 
call display_progress
 
call draw_wave
 
mov eax,12
mov ebx,2
mcall
 
popa
ret
 
 
 
 
draw_wave:
 
; ret
 
pusha
 
mov eax,13
mov ebx,260*65536+43
mov ecx,42*65536+32
mov edx,[border]
mcall
 
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
mcall
 
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 & partition with setup '
db 'If clipping change "delay" in source '
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/MENUET/MUSIC/FILE7.WAV',0
db ' '
 
 
title db ' WAVE PLAYER : 8b Mono - 16b Stereo',0
 
I_END:
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property
/programs/other/outdated/sb/trunk/Tupfile.lua
0,0 → 1,3
if tup.getconfig("NO_FASM") ~= "" then return end
tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"})
tup.rule({"sb.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "sb")
/programs/other/outdated/sb/trunk/build_en.bat
0,0 → 1,5
@erase lang.inc
@echo lang fix en >lang.inc
@fasm sb.asm sb
@erase lang.inc
@pause
/programs/other/outdated/sb/trunk/build_ru.bat
0,0 → 1,5
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm sb.asm sb
@erase lang.inc
@pause