Knight game: update by lev

Palitra: save noisy state
Game_center: use tricky binnary to save 4.5 Kb
Mp3Info: upload version 0.7



git-svn-id: svn://kolibrios.org@7423 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2018-10-01 18:19:57 +00:00
parent 2ec87d22f7
commit fc5e7644b9
10 changed files with 1357 additions and 55 deletions

View File

@ -16,6 +16,7 @@ img_files = {
{"CONFIG.INC", PROGS .. "/config.inc"}, {"CONFIG.INC", PROGS .. "/config.inc"},
{"STRUCT.INC", PROGS .. "/struct.inc"}, {"STRUCT.INC", PROGS .. "/struct.inc"},
{"FB2READ", "common/fb2read"}, {"FB2READ", "common/fb2read"},
{"game_center", "common/game_center"},
{"ICONS32.PNG", "common/icons32.png"}, {"ICONS32.PNG", "common/icons32.png"},
{"ICONS16.PNG", "common/icons16.png"}, {"ICONS16.PNG", "common/icons16.png"},
{"INDEX.HTM", "common/index_htm"}, {"INDEX.HTM", "common/index_htm"},
@ -576,7 +577,6 @@ if tup.getconfig('NO_CMM') ~= 'full' then
tup.append_table(img_files, { tup.append_table(img_files, {
{"APP_PLUS", PROGS .. "/cmm/app_plus/app_plus.com"}, {"APP_PLUS", PROGS .. "/cmm/app_plus/app_plus.com"},
{"EASYSHOT", PROGS .. "/cmm/easyshot/easyshot.com"}, {"EASYSHOT", PROGS .. "/cmm/easyshot/easyshot.com"},
{"GAME_CENTER", PROGS .. "/cmm/software_widget/software_widget.com"},
{"MOUSECFG", PROGS .. "/cmm/mousecfg/mousecfg.com"}, {"MOUSECFG", PROGS .. "/cmm/mousecfg/mousecfg.com"},
{"PANELS_CFG", PROGS .. "/cmm/panels_cfg/panels_cfg.com"}, {"PANELS_CFG", PROGS .. "/cmm/panels_cfg/panels_cfg.com"},
{"SYSPANEL", PROGS .. "/cmm/software_widget/software_widget.com"}, {"SYSPANEL", PROGS .. "/cmm/software_widget/software_widget.com"},

BIN
data/common/game_center Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 507 B

After

Width:  |  Height:  |  Size: 495 B

View File

@ -70,7 +70,7 @@ align 16
still: still:
call draw_3d call draw_3d
stdcall Fps, 330,4 stdcall Fps, 365,4
mov dword[esp-4],eax mov dword[esp-4],eax
fild dword[esp-4] fild dword[esp-4]
fmul dword[a2] fmul dword[a2]
@ -130,11 +130,11 @@ draw_window:
pushad pushad
mcall SF_REDRAW,SSF_BEGIN_DRAW mcall SF_REDRAW,SSF_BEGIN_DRAW
mcall SF_CREATE_WINDOW,(50 shl 16)+410,(30 shl 16)+425,0x33404040,,title1 mcall SF_CREATE_WINDOW,(50 shl 16)+409,(30 shl 16)+425,0x33404040,,title1
stdcall [kosglSwapBuffers] stdcall [kosglSwapBuffers]
;Title ;Title
mcall SF_DRAW_TEXT,(300 shl 16)+4,0xc0c0c0,fps, fps.end-fps mcall SF_DRAW_TEXT,(338 shl 16)+4,0xc0c0c0,fps, fps.end-fps
mcall SF_DRAW_TEXT,(8 shl 16)+4,0xc0c0c0,title3,title3.end-title3 mcall SF_DRAW_TEXT,(8 shl 16)+4,0xc0c0c0,title3,title3.end-title3
;mcall SF_DRAW_TEXT,(180 shl 16)+4,0xc0c0c0,title2,title2.end-title2 ;mcall SF_DRAW_TEXT,(180 shl 16)+4,0xc0c0c0,title2,title2.end-title2

View File

@ -0,0 +1,2 @@
@fasm -m 16384 mp3info.asm mp3info
@pause

View File

@ -0,0 +1,494 @@
;--------------------;
; MACROS.INC ;
;--------------------;
macro __mov reg,a { ; mike.dld
if ~a eq
mov reg,a
end if
}
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
;--------------------;
; ASCL.INC ;
;--------------------;
macro words2reg reg,hiword,lowword
{
if hiword eq
if lowword eq
; not changes
else
if lowword eqtype 12
and reg,dword 0xffff0000
add reg,dword lowword
else
and reg,dword 0xffff0000
add reg,dword lowword
end if
end if
else
if lowword eq
if hiword eqtype 12
and reg,dword 0x0000ffff
add reg,dword hiword*65536
else
shl reg,16
add reg,dword hiword
ror reg,16
end if
else
if lowword eqtype 12 & hiword eqtype 12
if lowword eq 0 & hiword eq 0
xor reg,reg
else
mov reg,dword hiword*65536+lowword
end if
else
mov reg,dword hiword
shl reg,16
add reg,dword lowword
end if
end if
end if
}
;--------------------;
; MOSUZIT.INC ;
;--------------------;
;WriteTextToWindow
macro Text xStart,yStart,rgbColor,pText,nTextLen
{
words2reg ebx, xStart, yStart
mov ecx, rgbColor
mov edx, pText
mov esi, nTextLen
mov eax, 4
int 0x40
}
;DisplayNumber
macro Number xStart,yStart,nPrintType,noOfDigits,Data,rgbColor
{
words2reg edx,xStart,yStart
words2reg ebx,noOfDigits,nPrintType
mov ecx,Data
mov esi,rgbColor
mov eax,47
int 0x40
}
macro DrawLine xStart,xEnd,yStart,yEnd,rgbColor
{
words2reg ebx,xStart,xEnd
words2reg ecx,yStart,yEnd
mov edx,rgbColor
mov eax,38
int 0x40
}
;********************************************************
macro Extracteax temp,fromBit,bitCount,dest
{
mov temp, eax
shr temp, fromBit
and temp, (1 shl bitCount - 1)
mov dest, temp
}
;********************************************************
;********* AAAAAAAA AAABBCCD EEEEFFGH IIJJKLMM *********
;********************************************************
extract_bits: ;11xA is sync
;Defined as the following:
; b1s ; standard
; b1l ; layer
; crc ; CRC protection
; Bita ; Bitrate
; sam ; Sampling rate
; pad ; Padding
; priv ; Private bit
; shan ; Channel mode
; modx ; Mode extention
; copy ; Copyright
; orig ; Original
; emph ; Emphasis
;--------------------- Standard (BB)
Extracteax ebx, 11, 2, [b1s]
;--------------------- Layer (CC)
Extracteax ebx, 9, 2, [b1l]
;--------------------- CRC (D)
Extracteax ebx, 8, 1, [crc]
;--------------------- Bitrate (EEEE)
Extracteax ebx, 20, 4, [Bita]
;--------------------- Sample Rate (FF)
Extracteax ebx, 18, 2, [sam]
;--------------------- padding (G)
Extracteax ebx, 17, 1, [pad]
;--------------------- Private bit (H)
Extracteax ebx, 16, 1, [priv]
;--------------------- Channels (II)
Extracteax ebx, 30, 2, [shan]
;--------------------- Mode ext (JJ)
Extracteax ebx, 28, 2, [modx]
;--------------------- Copyright (K)
Extracteax ebx, 27, 1, [copy]
;--------------------- Original (L)
Extracteax ebx, 26, 1, [orig]
;--------------------- Emphasis (MM)
Extracteax ebx, 24, 2, [emph]
ret
;********************************************************
decode_standard:
comp0:
cmp [b1s], 00b
je S25
comp1:
cmp [b1s], 01b ; unknown
je S25
comp2:
cmp [b1s], 10b
je S20
comp3:
cmp [b1s], 11b
je S10
jmp S000
;-----
S25:
mov [S1], 2
mov [S2], 5
mov [id], 3 ;lowest freq
jmp S000
S20:
mov [S1], 2
mov [S2], 0
mov [id], 2 ;low freq
jmp S000
S10:
mov [S1], 1
mov [S2], 0
mov [id], 1 ;hi freq
jmp S000
S000:
ret
;********************************************************
decode_layer:
com0:
cmp [b1l], 00b
je L3 ; unknown
com1:
cmp [b1l], 01b
je L3
com2:
cmp [b1l], 10b
je L2
com3:
cmp [b1l], 11b
je L1
jmp L000
;-----
L3:
mov [La], 3
jmp L000
L2:
mov [La], 2
jmp L000
L1:
mov [La], 1
jmp L000
L000:
ret
;********************************************************
decode_channels:
co0:
cmp [shan], 00b
je C4
co1:
cmp [shan], 01b
je C3
co2:
cmp [shan], 10b
je C2
co3:
cmp [shan], 11b
je C1
jmp C000
;-----
C4:
mov [K], 4 ;00=Stereo
jmp C000
C3:
mov [K], 3 ;01=Joint stereo
jmp C000
C2:
mov [K], 2 ;10=Dual Channel
jmp C000
C1:
mov [K], 1 ;11=Single Channel (Mono)
jmp C000
C000:
ret
;********************************************************
;--------------------------
; decode_samplerate
;--------------------------
decode_samplerate:
push eax
push ecx
mov eax, [sam]
mov eax, [freq + eax*4]
mov ecx, [b1s]
cmp cl, 01 ; bad frequency
jnz ok
ok:
cmp cl, 0
jz @f
dec cl
@@:
shl eax, cl
mov [SR], eax
pop ecx
pop eax
ret
;********************************************************
;--------------------------
; decode_bitrate
;--------------------------
decode_bitrate:
push eax
push ebx
mov eax,[b1s]
and eax,1
shl eax,4
lea eax,[eax*3]
mov ebx,[b1l]
dec ebx
shl ebx, 4
add eax, ebx
add eax,[Bita]
movzx eax,byte[Bitrate+eax]
shl eax,3
mov [BR],eax
pop ebx
pop eax
ret
;********************************************************
calculate_time_frame_count:
;----------------------------duration
xor eax, eax
xor ebx, ebx
xor ecx, ecx
xor edx, edx
mov ebx, dword[BR]
imul ebx, 125
; result in ebx
mov eax, dword[size]
div ebx
mov dword[time], eax
;---------------------------frame size
xor eax, eax
xor ebx, ebx
xor ecx, ecx
xor edx, edx
cmp [S1], 1
je MP1
cmp [S1], 2
je MP2
MP1:
mov eax, dword [BR]
imul eax, 144000
; result in eax
mov ebx, dword[SR]
div ebx
add eax, dword [pad]
mov dword[frames], eax
jmp exx
MP2:
mov eax, dword [BR]
imul eax, 72000
; result in eax
mov ebx, dword[SR]
div ebx
add eax, dword [pad]
mov dword[frames], eax
exx:
;--------------------------quantity of frames
xor eax, eax
xor ebx, ebx
xor ecx, ecx
xor edx, edx
mov eax, dword[size]
mov ebx, dword[frames]
div ebx
mov dword[framecount], eax
ret
;--------------------------
; header_check
; eax = ïðîâåðÿåìûé çàãîëîâîê
;--------------------------
Header_Check:
push ebx
mov ebx, eax
; Ïðîâåðÿåì 11 áèò â íà÷àëå ôðåéìà
and eax, 0E0FFh
cmp eax, 0E0FFh
jnz bad
; Ïðîâåðÿåì âåðñèþ MPEG
mov eax, ebx
and eax, 1800h
cmp eax, 0800h
jz bad
; Ïðîâåðÿåì layer
mov eax, ebx
test eax, 0600h
jz bad
; Ïðîâåðÿåì áèòðåéò
mov eax, ebx
and eax, 0F00000h
cmp eax, 0F00000h
jz bad
test eax, eax
jz bad
; Ïðîâåðÿåì ÷àñòîòó
mov eax, ebx
and eax, 0C0000h
cmp eax, 0C0000h
jz bad
.end_test:
xor eax, eax
pop ebx
ret
bad:
mov eax, 1
pop ebx
ret
;===========================
Win2Dos:
;===========================
jcxz .no_chars
push esi
push edi
push ecx
mov edi, esi
cld
.next_char:
lodsb
cmp al, 0xC0
jae .rus
cmp al, 0xA8
jnz @f
mov al, 0xF0
@@:
cmp al, 0xB8
jnz @f
mov al, 0xF1
@@:
jmp .char_ready
.rus:
cmp al, 0xF0
jae @f
sub al, 48
@@:
sub al, 16
.char_ready:
stosb
dec ecx
jnz .next_char
pop ecx
pop edi
pop esi
.no_chars:
ret

View File

@ -0,0 +1,701 @@
; AUTHORS:
; S. Kuzmin, A. Ershov, Madis Kalme 2005
; Sergey Efremenkov, Leency 2018
; CHECK OUT README.TXT!
format binary as ""
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x9000 ; memory for app
dd 0x9000 ; esp
dd fileinfo2.path ; I_Param , I_Icon
dd 0x0
include "mos_uzit.inc"
TAG1_X = 250 ; coordinates of ID3v1 block
TAG1_Y = 40
BLOCKS_TO_READ equ 2 ; must be greater than 1
BLOCK_SIZE equ 512 ;ñêîëüêî áàéò â áëîêå
START:
xor eax, eax
mov [last_err], eax
mov [fileinfo2+4], eax ; start block = 0
mov dword [fileinfo2+12], BLOCKS_TO_READ*BLOCK_SIZE
mcall 70, fileinfo2
result:
push eax ebx ;ïîëó÷àåì ðàçìåð ôàéëà â áàéòàõ
mcall 70, fileSizeInfo
cmp eax, 0
je @f
mov dword[size], 16384; ebx
jmp result.sizeEnd
@@:
mov eax, dword[fileBuf+32] ; íà ñàìîì äåëå òàì ðàçìåð 8 áàéò, à íå 4
mov dword[size], eax
.sizeEnd:
pop ebx eax
;mov dword [size], 16384; ebx
; checking ID3v2 tag
xor eax, eax
mov [tagv2], eax
mov eax, [mp3_file]
and eax, 0x00ffffff
cmp eax, 'ID3'
jnz .no_id3v2
mov eax, [mp3_file+3]
mov [tagv2], eax
mov ecx, 4
mov esi, mp3_file+6
xor eax, eax
xor ebx, ebx
cld
.size_read:
lodsb
shl ebx, 7
or ebx, eax
loop .size_read
add ebx, 10
mov eax, ebx
shr eax, 9
push eax edx
mov edx, BLOCK_SIZE
mul edx
mov dword[fileinfo2+4], eax ; start block
pop edx eax
shl eax, 9
mov ecx, ebx
add ecx, 3
sub ebx, eax
mov edi, ebx
add edi, mp3_file
dec edi
mcall 70, fileinfo2
jmp .loop
.no_id3v2:
mov ecx, 3
mov edi, mp3_file-1
.loop:
inc edi
inc ecx
cmp ecx, dword[size]
ja .no_frames
mov eax, [edi]
call Header_Check
test eax, eax
jz .header_found
cmp edi, mp3_file+BLOCKS_TO_READ*512-4
jb .loop
add dword [fileinfo2+4], (BLOCKS_TO_READ-1)*BLOCK_SIZE
mcall 70, fileinfo2
sub edi, (BLOCKS_TO_READ-1)*512
jmp .loop
.no_frames:
mov [last_err], err_bad_file
mov [last_err_l], err_bad_file_e - err_bad_file
jmp reading_end
.header_found:
mov eax, dword [edi]
sub ecx, 4
mov [header_at], ecx
call extract_bits
call decode_standard
call decode_layer
call decode_channels
call decode_samplerate
call decode_bitrate
call calculate_time_frame_count
;--------------------------------------------
mov eax, [b1s]
and eax, 1
shl eax, 1 ; eax = eax * 2
cmp byte [shan], 11b ; if mono
jz @f
inc eax
@@:
mov ebx, xing_offset
xlatb
add edi, eax
mov eax, [edi]
xor ebx, ebx
mov [xing_tag], ebx
cmp eax, 'Xing'
jnz .no_xing_tag
mov esi, edi
add esi, 15
std
mov edi, xing_bytes
mov ecx, 3*4
xor eax, eax
.xing_read:
lodsb
mov [edi], al
inc edi
loop .xing_read
cld
mov ebx, [xing_tag]
test ebx, 1
jz .frames_end
mov eax, [xing_frames]
mov [framecount], eax
test [b1s], 1 ; if MPEG 1 eax = eax*2
jz @f
shl eax, 1
@@:
mov ebx, 575
mul ebx ; edx:eax = eax*575
mov ebx, [SR]
div ebx ; eax = edx:eax / sample rate
mov [time], eax
; calculating bitrate
xor edx, edx
mov ebx, 1000 / 8
mul ebx ; edx:eax = time * 1000
mov ebx, eax
mov eax, [xing_bytes]
div ebx ; eax = size / time*1000
mov [BR], eax
.frames_end:
.no_xing_tag:
xor eax, eax
xor ebx, ebx
xor ecx, ecx
xor edx, edx
; ID3v1 tag reading
mov eax, [size] ; reading 2 last 512-byte blocks where our
mov ebx, eax ; tag may be
shr eax, 9 ; eax = size of file in full 512-byte blocks
test eax, eax ; if file's length is less then 512 we'll
jz @f ; read the whole file
dec eax
@@:
push eax edx
mov edx, BLOCK_SIZE
mul edx
mov dword [fileinfo2+4], eax ; start block
pop edx eax
mov dword [fileinfo2+12], 2*BLOCK_SIZE ; blocks to read
shl eax, 9
sub ebx, eax
add ebx, mp3_file - 128 ; if tag is present, ebx points to it
mov esi, ebx
xor eax, eax
mov [tag], eax
mcall 70, fileinfo2
mov eax, [esi] ; checking if tag is present
and eax, 0x00ffffff
cmp eax, 'TAG'
jnz @f
inc [tag]
cld
mov ecx, 128 / 4
mov edi, tag.data
rep movsd
mov esi, tag.data
mov ecx, 126
call Win2Dos
@@:
reading_end:
call draw_window ; 14.08.05 [
; Öèêë ïîëó÷åíèÿ è îáðàáîòêè ñîîáùåíèé
get_event:
mov eax,10
int 0x40
dec eax
jnz @f
call draw_window
jmp get_event
@@:
dec eax
jz key_on_keyboard
dec eax
jz click_on_button
jmp get_event
key_on_keyboard:
mcall 2
jmp get_event
click_on_button:
exit:
mcall 17
;cmp ah, 10
;jz other_file
mov eax,-1
int 0x40
jmp get_event ; ] 14.08.05
; Ðèñîâàíèå îêíà
draw_window:
mcall 12,1
mov eax,0 ; function 0 : define and draw window
mov ebx,250 shl 16 + 500
mov ecx,250 shl 16 + 300
mov edx,0x34aabbcc ; color of work area RRGGBB,8->color gl
mov edi, header
int 0x40
Text 20,12,0x00000000,choice, choicelen-choice
Text 110,12,0x00000000,fileinfo2.path, 60
mov edx, dword [last_err]
test edx, edx
jz .no_err
mov eax, 4
mov ebx, 50*65536+50
xor ecx, ecx
mov esi, [last_err_l]
int 0x40
jmp draw_end
.no_err:
Text 20,40,0x00000000,S, Slen-S
Number 110,40,1*256,1,dword [S1],0x000000;
Number 122,40,1*256,1,dword [S2],0x000000;
Text 20,60,0x00000000,L, Llen-L
Number 110,60,1*256,1,dword [La],0x000000
Text 20,100,0x00000000,SamR, SamRlen-SamR
Number 110,100,0*256,5,dword [SR],0x000000
Text 20,120,0x00000000,BitR, BitRlen-BitR
Number 110,120,0*256,3,dword [BR],0x000000
mov eax, [xing_tag]
test eax, eax
jz @f
Text 170,120,0x00000000,vbr, vbr_e - vbr
@@:
Text 20,140,0x00000000,Sizebyte, Sizebytelen-Sizebyte
Number 110,140,0*256,8,dword [size],0x000000
Text 20,160,0x00000000,Timese, Timeselen-Timese
Number 110,160,0*256,4,dword [time],0x000000
Text 20,180,0x00000000,frame, framelen-frame
Number 110,180,0*256,4,dword [frames],0x000000
Text 20,200,0x00000000,framcount, framcountlen-framcount
Text 20,220,0x00000000,padding, paddinglen-padding
cmp [pad], 1
je res1
jne res2
res1:
Text 75,220,0x00000000,da, dalen-da
jmp nex
res2:
Text 75,220,0x00000000,net, netlen-net
jmp nex
nex:
; ------------------
Text 110,220,0x00000000,crci, crcilen-crci
cmp [crc], 0
je res3
jne res4
res3:
Text 160,220,0x00000000,da, dalen-da
jmp ne
res4:
Text 160,220,0x00000000,net, netlen-net
jmp ne
ne:
;--------------------------
Number 110,200,0*256,6,dword [framecount],0x000000
Text 20,80,0x00000000,Ka, Kalen-Ka
cmp [K], 1
je rez1
cmp [K], 2
je rez2
cmp [K], 3
je rez3
cmp [K], 4
je rez4
rez1:
Text 110,80,0x00000000,SC, SClen-SC
jmp next
rez2:
Text 110,80,0x00000000,DC, DClen-DC
jmp next
rez3:
Text 110,80,0x00000000,JOS, JOSlen-JOS
jmp next
rez4:
Text 110,80,0x00000000,Su, Sulen-Su
next:
Text 20,240,0,header_found, header_found_e - header_found
Number 160,240,0*256,6,dword [header_at],0x000000 ;;;;;;; HEADER AT
; ID3v2
mcall 4, 250*65536+220, 0,id3v2, id3v2_e - id3v2
mov edi, tagv2
mov eax, [edi]
test eax, eax
jz .no_v2
mcall 4, 281*65536+220, ,dots, dots_e - dots
xor ecx, ecx
mov cl, byte [edi]
mcall 47, 65536*2, , 286*65536+220, 0
mov cl, byte [edi+1]
mcall , , , 304*65536+220,
jmp .v2_end
.no_v2:
Text 300,220,0,net, netlen- net
.v2_end:
; ID3v1 info
; Writing all field names
mov eax, 4 ; function 4
words2reg ebx, TAG1_X, TAG1_Y
xor ecx, ecx ; color
mov edx, id3v1
mov esi, id3v1_e - id3v1
int 0x40
add ebx, 40
mov edx, title ; length is the same, so we don't write it in esi
int 0x40
add ebx, 20
mov edx, artist
inc esi
int 0x40
add ebx, 20
mov edx, album
dec esi
int 0x40
add ebx, 20
mov edx, year
dec esi
int 0x40
add ebx, 20
mov edx, genre
inc esi
int 0x40
add ebx, 20
mov edx, comment
inc esi
inc esi
int 0x40
sub ebx, 120
mov edx, track
int 0x40
; checking if tag is
mov eax, dword [tag]
test eax, eax
jz .no_tag1
mov edi, tag.data
; writing walues
words2reg edx, (TAG1_X+50), (TAG1_Y+20)
; track number uses the 30-th byte of comment field
; it may be the last char in comment field
; so we check if this byte presents a track number
mov eax, [edi+125]
test al, al
jnz .no_track
test ah, ah
jz .no_track
mov ebx, 3*65536
xor ecx, ecx
mov cl, ah
xor esi, esi
mov eax, 47
int 0x40
.no_track:
mov ebx, edx
mov edx, edi
mov eax, 4 ; function 4
xor ecx, ecx ; color
add ebx, 20
add edx, 3
mov esi, 30
int 0x40 ; title
add ebx, 20
add edx, esi
int 0x40 ; artist
add ebx, 20
add edx, esi
int 0x40 ; album
add ebx, 60
add edx, 34
dec esi
int 0x40 ; comment
sub ebx, 40
mov esi, 4
sub edx, esi
int 0x40 ; year
.no_tag1:
draw_end:
mcall 12, 2
ret ; (!) 14.08.05
freq dd 11025, 12000, 8000
Bitrate db 0,1,2, 3, 4, 5, 6, 7, 8,10,12,14,16,18,20,0,\ ; v2 l2 l3
0,1,2, 3, 4, 5, 6, 7, 8,10,12,14,16,18,20,0,\ ; v2 l2 l3
0,4,6, 7, 8,10,12,14,16,18,20,22,24,28,32,0,\ ; v2 l1
0,4,5, 6, 7, 8,10,12,14,16,20,24,28,32,40,0,\ ; v1 l3
0,4,6, 7, 8,10,12,14,16,20,24,28,32,40,48,0,\ ; v1 l2
0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,0 ; v1 l1
xing_offset db 13, 21, 21, 36
header:
db 'MP3 Info 0.7',0
S:
db 'MPEG Version: . '
Slen:
L:
db 'Layer: '
Llen:
Ka:
db 'Channels Mode: '
Kalen:
Su:
db 'Stereo'
Sulen:
JOS:
db 'Joint stereo '
JOSlen:
DC:
db 'Dual channel'
DClen:
SC:
db 'Single Channel (Mono)'
SClen:
SamR:
db 'Sample Rate: Hz'
SamRlen:
BitR:
db 'BitRate: Kbps'
BitRlen:
Sizebyte:
db 'Size: bytes'
Sizebytelen:
Timese:
db 'Time: seconds'
Timeselen:
frame:
db 'Frame size: bytes'
framelen:
framcount:
db 'Quantity: frames'
framcountlen:
padding:
db 'Padding:'
paddinglen:
crci:
db 'CRC:'
crcilen:
da:
db 'yes'
dalen:
net:
db 'no'
netlen:
dots db '. .'
dots_e:
header_found db 'Header found at:'
header_found_e:
choice:
db 'File path: '
choicelen:
id3v2 db 'ID3v2'
id3v2_e:
vbr db '(VBR)'
vbr_e:
id3v1 db 'ID3v1'
id3v1_e:
track db 'Track #'
track_e:
title db 'Title'
title_e:
artist db 'Artist'
artist_e:
album db 'Album'
album_e:
year db 'Year'
year_e:
genre db 'Genre'
genre_e:
comment db 'Comment'
comment_e:
err_bad_file db 'Bad file'
err_bad_file_e:
fileinfo2:
.func dd 0 ;íîìåð ïîäôóíêöèè
.start dd 0*BLOCK_SIZE ;ïîçèöèÿ â ôàéëå (â áàéòàõ) *512
dd 0 ;(çàðåçåðâèðîâàíî ïîä ñòàðøèé dword ïîçèöèè)
.size dd 1*BLOCK_SIZE ;ñêîëüêî áàéò ÷èòàòü
.buf dd mp3_file ;óêàçàòåëü íà áóôåð, êóäà áóäóò çàïèñàíû äàííûå
.path:
db "TEST.MP3",0 ;"/RD/1/TEST.MP3",0
rb 256-($-.path)
;äëÿ ïîëó÷åíèÿ êîððåêòíîãî ðàçìåðà ôàéëà
fileSizeInfo:
dd 5 ; íîìåð ïîäôóíêöèè
dd 0,0,0 ;(çàðåçåðâèðîâàíî)
dd fileBuf ;óêàçàòåëü íà áóôåð, êóäà áóäóò çàïèñàíû äàííûå(40 áàéò)
db 0
dd fileinfo2.path
fileBuf: db 40 dup(0)
;=================================================
b1s dd ? ; standard
b1l dd ? ; layer
S1 dd ?
S2 dd ?
La dd ?
shan dd ?
K dd ?
sam dd ?
id dd ?
SR dd ?
Bita dd ?
BR dd ?
size dd ?
time dd ?
frames dd ?
xing_bytes dd ?
xing_frames dd ?
xing_tag dd ?
tagv2 dd ?
tag dd ?
.data rb 128
framecount dd ?
pad dd ?
priv dd ?
modx dd ?
copy dd ?
orig dd ?
emph dd ?
crc dd ?
header_at dd ?
last_err dd ?
last_err_l dd ?
I_END:
;label pre_file dword at 0x3000-4
label mp3_file dword at 0x3000

View File

@ -0,0 +1,97 @@
;******************************************************************************
; project name: SuperMP3
; target platform: MenuetOS, x86 (IA-32), x86-64 achitectures
; compiler: flat assembler 1.64
; version: 0.65
; last update: 5th September 2005
; maintained by: Sergey Kuzmin aka Wildwest
; e-mail: kuzmin_serg@list.ru
;******************************************************************************
; Summary:
; initial reader for mp3's headers
; can read mostly needed parts from headers of almost all mp3 files
; can be used in tag editor, mp3 player or converter later
; License: GPL & LGPL
;******************************************************************************
;--------------------------------------------------------------------------------------
;HISTORY:
;0.7: MP3INFO 23/09/2018
Sergey Efremenkov aka theonlymirage
adopted app to use system f70 instead of old f58
Kiril Lipatov aka Leency make app to open with param, small UI update
;0.65: SuperMP3
Madis Kalme rewrited extract_bits (he used his Extracteax macro)
and decode_bitrate functions
;0.64: Xing header reading: correct time, bitrate and number of
frames for VBR files
;0.62: ID3v2 detecting and writing its version
;0.61: Header search
; Added 'Header found at' field
; If file has no frames, error message is shown
; Russian tag support (in windows-1251 encoding)
;
;0.6: SuperMP3 (not finished and its future in the dark) 19/08/2005
;Author: Sergey Kuzmin aka Wildwest <kuzmin_serg@list.ru>
;Additions: Alexei Ershov aka ealex <e-al@yandex.ru>
;Features: added checking of CRC bit;
; improved frame_size calculation (thanks to Alexei Ershov for the formula)
; added ID3v1 tag reading (except Genre field) by Alexei Ershov
;--------------------------------------------------------------------------------------
;0.5: SuperMP3 17/08/2005
;Author: Sergey Kuzmin aka Wildwest <kuzmin_serg@list.ru>
;Additions: Alexei Ershov aka ealex <e-al@yandex.ru>
;Features: added checking of Padding bit;
; Added open dialog and optimized macroses Text, Number, DrawLine by Alexei Ershov
;--------------------------------------------------------------------------------------
;0.4: SuperMP3 05/08/2005
;Author: Sergey Kuzmin aka Wildwest <kuzmin_serg@list.ru>
;Additions: Alexei Ershov aka ealex <e-al@yandex.ru>
;Features: added Frame_size and Quantity_of_Frames;
; optimized decode_samplerate and decode_bitrate routines by Alexei Ershov
;--------------------------------------------------------------------------------------
;0.3: SuperMP3 25/04/2005
;Author: Sergey Kuzmin aka Wildwest <kuzmin_serg@list.ru>
;Features: added File_size and Duration (rough estimation), improved SampleRate, fixed BitRate
;--------------------------------------------------------------------------------------
;0.2: SuperMP3 21/04/2005
;Author: Sergey Kuzmin aka Wildwest <kuzmin_serg@list.ru>
;Features: added SampleRate and BitRate
;--------------------------------------------------------------------------------------
;0.1: SuperMP3 20/04/2005
;Author: Sergey Kuzmin aka Wildwest <kuzmin_serg@list.ru>
;Features: able to detect MPEG Version, Layer, Channels
;----------------------------------------------------------------------------------------
;Issues:
; MP3 player needs work of several men during several months(approx. 10 men and 2-4 months, because it is ASM OS).
; If you want to listen a lot of mp3 in MenuetOS - make a bit of asm!
;-----------------------------------------------------------------------------
;CLEAN mp3 - is mp3 file without any info before header. Open mp3 in HEX EDITOR and check it out.
;Usually normal header's start looks like FFF3 or FFFB.
;If you see TAG (4944 3303 = ID3.) or RIFF (5249 4646 = RIFF)
;or (0000 0000 - encoded by Lame codec or another shitty program) - it is bad,
;you must delete this piece until FFFx before testing. Happy testing!
;Note - I test it only on several files (test.mp3
;included in this package) in Bochs and Qemu.
;For testing change name if the end of "supermp3.asm" - section
fileinfo:
dd 0, 0, 1, mp3_file, 0x1000
db "/RD/1/TEST.MP3",0
Package content:
readme.txt - this file
supermp3 - compiled exacutable file
supermp3.asm - main file - build program's GUI
MACROS.INC - standard file with macroses
MOS_UZIT.INC - macroses for interface, routines for extracting bits and decoding extracted bits
ASCL.INC - macroses for interface and useful stuff
test.mp3 - test file
Any comments by e-mail or on forums (http://meos.sysbin.com, http://forum.meos.ru, http://menuetos.fastbb.ru,
http://menuet.2.forumer.com, http://board.flatassembler.net/forum.php?f=12) are appreciated.

View File

@ -452,57 +452,7 @@ set_background:
; <20>®¤äã­ªæ¨ï 3 - ¯¥à¥à¨á®¢ âì ä®­. ; <20>®¤äã­ªæ¨ï 3 - ¯¥à¥à¨á®¢ âì ä®­.
mcall SF_BACKGROUND_SET,SSF_REDRAW_BG mcall SF_BACKGROUND_SET,SSF_REDRAW_BG
;save to file eskin.ini stdcall save_eskin_ini, 'H '
xor al,al
mov ecx,1024
mov edi,sys_path+2
repne scasb
sub edi,sys_path+3
invoke ini_set_str, inifileeskin, amain, aprogram, sys_path+2, edi
;add param 'H '
mov word[params],'H '
mov eax,[color]
or eax,0xf ;¤«ï ¨§¡¥¦ ­¨ï ¢¥ç­®£® 横«  ¥á«¨ eax=0
mov edi,params+2
@@:
rol eax,8
or al,al
jnz @f
mov word[edi],'00' ;­ã«¨ ¯¥à¥¤ ç¨á«®¬
add edi,2
jmp @b
@@:
and al,0xf0
jnz @f
mov byte[edi],'0'
inc edi
@@:
mov eax,[color]
mov ebx,16
call int2ascii
mov byte[params+10],' '
;add color2
mov eax,[color2]
or eax,0xf ;¤«ï ¨§¡¥¦ ­¨ï ¢¥ç­®£® 横«  ¥á«¨ eax=0
mov edi,params+11
@@:
rol eax,8
or al,al
jnz @f
mov word[edi],'00' ;­ã«¨ ¯¥à¥¤ ç¨á«®¬
add edi,2
jmp @b
@@:
and al,0xf0
jnz @f
mov byte[edi],'0'
inc edi
@@:
mov eax,[color2]
mov ebx,16
call int2ascii
invoke ini_set_str, inifileeskin, amain, aparam, params, 19
ret ret
;end_set_background ;end_set_background
@ -1225,8 +1175,66 @@ set_background2:
mcall SF_BACKGROUND_SET, SSF_REDRAW_BG mcall SF_BACKGROUND_SET, SSF_REDRAW_BG
mcall SF_SYS_MISC, SSF_MEM_FREE, [image] mcall SF_SYS_MISC, SSF_MEM_FREE, [image]
stdcall save_eskin_ini, 'B '
ret ret
align 4
proc save_eskin_ini, opt_HB:dword
;save to file eskin.ini
xor al,al
mov ecx,1024
mov edi,sys_path+2
repne scasb
sub edi,sys_path+3
invoke ini_set_str, inifileeskin, amain, aprogram, sys_path+2, edi
;add param 'H '
mov eax,[opt_HB]
mov word[params],ax
mov eax,[color]
or eax,0xf ;¤«ï ¨§¡¥¦ ­¨ï ¢¥ç­®£® 横«  ¥á«¨ eax=0
mov edi,params+2
@@:
rol eax,8
or al,al
jnz @f
mov word[edi],'00' ;­ã«¨ ¯¥à¥¤ ç¨á«®¬
add edi,2
jmp @b
@@:
and al,0xf0
jnz @f
mov byte[edi],'0'
inc edi
@@:
mov eax,[color]
mov ebx,16
call int2ascii
mov byte[params+10],' '
;add color2
mov eax,[color2]
or eax,0xf ;¤«ï ¨§¡¥¦ ­¨ï ¢¥ç­®£® 横«  ¥á«¨ eax=0
mov edi,params+11
@@:
rol eax,8
or al,al
jnz @f
mov word[edi],'00' ;­ã«¨ ¯¥à¥¤ ç¨á«®¬
add edi,2
jmp @b
@@:
and al,0xf0
jnz @f
mov byte[edi],'0'
inc edi
@@:
mov eax,[color2]
mov ebx,16
call int2ascii
invoke ini_set_str, inifileeskin, amain, aparam, params, 19
ret
endp
;#___________________________________________________________________________________________________ ;#___________________________________________________________________________________________________
;****************************************************************************************************| ;****************************************************************************************************|
; <20>ŽŠ <20><EFBFBD>…Œ…<C592><E280A6>ˆ ŠŽ<C5A0><E28099> | ; <20>ŽŠ <20><EFBFBD>…Œ…<C592><E280A6>ˆ ŠŽ<C5A0><E28099> |