/programs/demos/colors/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/demos/colors/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/demos/colors/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/demos/colors/trunk/colors.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/demos/3dcube2/trunk/macros.inc |
---|
123,8 → 123,10 |
end if |
} |
macro __mov reg,a { ; mike.dld |
if ~a eq |
macro __mov reg,a,b { ; mike.dld |
if (~a eq)&(~b eq) |
mpack reg,a,b |
else if (~a eq)&(b eq) |
mov reg,a |
end if |
} |
141,11 → 143,6 |
; language for programs |
lang fix ru ; ru en fr ge fi |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
177,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
221,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
/programs/demos/bgitest/trunk/bgifont.inc |
---|
4,7 → 4,7 |
; |
; Created: December 16, 2004 |
; |
; Last changed: February 2, 2005 |
; Last changed: August 27, 2006 |
; |
; Compile with FASM |
237,18 → 237,16 |
mov esi,edi ; esi->FontName |
mov [.dest],edi ; ptr to load font |
if ~ BGI_LEVEL eq KERNEL |
mov [.fsize],1 |
mov eax,58 |
mov ebx,.fontinfo |
mov eax, 70 |
mov ebx, .fontattr |
int 0x40 |
test eax,eax |
jnz .fail |
dps2 '1' |
shr ebx,9 |
inc ebx |
mov [.fsize],ebx |
mov eax, [.fileattr+32] |
mov [.fsize], eax |
mov ebx,.fontinfo |
mov eax,58 |
mov eax,70 |
int 0x40 ; ebx - file size |
else |
push edi esi edx |
340,11 → 338,22 |
.fontinfo: |
dd 0 |
dd 0 |
dd 0 |
.fsize dd 0 |
.dest dd 0 |
dd 0x10000 |
.fontfullname: |
db BGIFONT_PATH |
.font db 'FONT.CHR',0 |
.fontattr: |
dd 5 |
dd 0 |
dd 0 |
dd 0 |
dd .fileattr |
db 0 |
dd .fontfullname |
.fileattr rd 40/4 |
else |
.dest dd 0 |
.font db 'FONT CHR' |
479,6 → 488,7 |
loop .next |
mov ecx,edx ; ecx - x size |
movzx dx,byte[edi+6] |
mov [BGIheight],dx |
mov ebx,[esp+36] |
and ebx,BGI_HAMASK |
cmp ebx,BGI_HARIGHT |
690,7 → 700,7 |
.color dd ? |
.vec_end dd ? |
BGIfont_Ptr dd 0 |
width dd ? |
BGIheight dw ? |
deform dd ? |
BGIangle dd ? |
Xscale dd ? |
/programs/demos/bgitest/trunk/bgitest.asm |
---|
7,7 → 7,7 |
; Last changed: February 2, 2005 |
; |
BGIFONT_PATH equ '/RD/1/' |
BGIFONT_PATH equ '/RD/1/FONTS/' |
_X equ 340 |
_Y equ 240 |
35,8 → 35,8 |
mcall 47,0x80100,,,0x10ffffff |
jecxz .nofont |
lea ebx,[edx+80 shl 16+12] |
mov edx,_BGIfont_Prepare.dest+8 |
mov esi,BGIfont_Coo-1 |
mov edx,_BGIfont_Prepare.fontfullname |
mov esi,_BGIfont_Prepare.fontattr-1 |
sub esi,edx |
add ecx,0x3b800b8 |
BGIfont_Outtext |
/programs/demos/bgitest/trunk/macros.inc |
---|
143,10 → 143,6 |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
178,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
222,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
/programs/demos/eyes/trunk/eyes.asm |
---|
20,7 → 20,7 |
db "MENUET01" |
dd 0x01 |
dd ENTRANCE |
dd I_END |
dd EYES_END |
dd 0x3000 |
dd 0x3000 |
dd 0x0 |
30,93 → 30,61 |
ENTRANCE: ; start of code |
; ==== main ==== |
prepare_eyes: |
mov esi,imagedata ; transform grayscale to putimage format |
mov edi,skindata |
mov ecx,30 |
transform_loop: |
push ecx |
mov ecx,30 |
lp1: |
lodsb |
stosb |
stosb |
stosb |
loop lp1 |
sub esi,30 |
mov ecx,30 |
lp2: |
lodsb |
stosb |
stosb |
stosb |
loop lp2 |
pop ecx |
loop transform_loop |
call prepare_eyes |
mov eax,14 ; calculating screen position |
call shape_window |
still: |
call draw_eyes ; draw those funny "eyes" |
mov eax,23 ; wait for event with timeout |
mov ebx,TIMEOUT |
int 0x40 |
shr eax,1 |
mov ax,59 |
sub eax,30*65536 |
mov [win_ebx],eax |
mov [win_ecx],dword 10*65536+44 |
mov esi,imagedata ; calculate shape reference area |
mov edi,winref |
mov ecx,900 ; disable drag bar |
mov al,0 |
rep stosb |
cmp eax,1 ; redraw ? |
jnz no_draw |
call redraw_overlap |
no_draw: |
mov ecx,30 ; calculate circles for eyes |
shape_loop: |
push ecx |
cmp eax,2 ; key ? |
jz key |
call copy_line ; duplicate (we have two eyes :) |
sub esi,30 |
call copy_line |
cmp eax,3 ; button ? |
jz button |
pop ecx |
loop shape_loop |
jmp still ; loop |
; EVENTS |
key: |
mov eax,2 ; just read and ignore |
int 0x40 |
jmp still |
button: ; analyze button |
mov eax,-1 ; this is button 1 - we have only one button :-) |
int 0x40 |
jmp still |
; -====- declarations -====- |
imagedata equ EYES_END |
skindata equ EYES_END+925 |
winref equ EYES_END+6325 |
; -====- shape -====- |
shape_window: |
mov eax,50 ; set up shape reference area |
xor ebx,ebx |
mov ebx,0 |
mov ecx,winref |
int 0x40 |
call draw_window |
ret |
still: |
call draw_eyes ; draw those funny "eyes" |
_wait: |
mov eax,23 ; wait for event with timeout |
mov ebx,TIMEOUT |
int 0x40 |
dec eax |
jz redraw |
dec eax |
jz key |
dec eax |
jnz still |
button: |
or eax, -1 |
int 0x40 |
key: |
mov al, 2 |
int 0x40 |
jmp still |
redraw: |
call draw_window |
call redraw_eyes |
jmp _wait |
; -====- redrawing -====- |
draw_eyes: ; check mousepos to disable blinking |
130,22 → 98,8 |
redraw_ok: |
mov [mouse],eax |
redraw_eyes: |
mov eax,7 |
mov ebx,skindata |
mov ecx,60*65536+30 |
mov edx,15 |
int 0x40 |
redraw_overlap: ; label for redraw event (without checkmouse) |
mov eax,15 |
mov ebx,30 |
call draw_eye_point |
add eax,30 |
call draw_eye_point |
ret |
draw_window: |
mov eax,12 |
mov ebx,1 |
int 0x40 |
164,6 → 118,18 |
mov edx,1 |
int 0x40 |
mov eax,7 |
mov ebx,skindata |
mov ecx,60*65536+30 |
mov edx,15 |
int 0x40 |
mov eax,15 |
mov ebx,30 |
call draw_eye_point |
add eax,30 |
call draw_eye_point |
mov eax,12 |
mov ebx,2 |
int 0x40 |
173,8 → 139,10 |
draw_eye_point: ; draw eye point (EAX=X, EBX=Y) |
pusha |
movzx ecx, word [mouse+2] ; ecx = mousex, esi = mousey |
movzx esi, word [mouse] |
mov ecx, [mouse] ; ecx = mousex, edx = mousey |
mov edx,ecx |
shr ecx,16 |
and edx,0xFFFF |
; ===> calculate position |
181,82 → 149,132 |
push eax |
push ebx |
mov byte [sign1],0 |
mov edx, [win_ebx] |
shr edx,16 |
add eax,edx |
mov esi, [win_ebx] |
shr esi,16 |
add eax,esi |
sub ecx,eax ; ECX=ECX-EAX (signed) , ECX=|ECX| |
jnc abs_ok_1 |
neg ecx |
mov byte [sign1],1 |
abs_ok_1: |
push ecx ; save x distance |
mov [temp1],ecx |
mov byte [sign2],0 |
mov edx,[win_ecx] |
shr edx,16 |
add ebx,edx |
sub esi,ebx ; EDX=EDX-EBX (signed) , EDX=|EDX| |
mov esi,[win_ecx] |
shr esi,16 |
add ebx,esi |
sub edx,ebx ; EDX=EDX-EBX (signed) , EDX=|EDX| |
jnc abs_ok_2 |
neg esi |
neg edx |
mov byte [sign2],1 |
abs_ok_2: |
mov [temp2],esi |
mov [temp2],edx |
pop ebx |
pop eax |
; ESI = ECX*ECX+ESI*ESI |
imul ecx, ecx |
imul esi, esi |
add esi, ecx |
push eax ; ECX*=ECX |
push edx |
xor eax,eax |
xor edx,edx |
mov ax,cx |
mul cx |
shl edx,16 |
or eax,edx |
mov ecx,eax |
pop edx |
pop eax |
xor ecx,ecx ; EDX=SQRT(EBX) |
push eax ; EDX*=EDX |
push ecx |
mov ecx,edx |
xor eax,eax |
xor edx,edx |
mov eax,1 |
mov ax,cx |
mul cx |
shl edx,16 |
or eax,edx |
mov edx,eax |
pop ecx |
pop eax |
push ebx |
push ecx |
push edx |
push eax |
mov ebx,ecx ; EBX=ECX+EDX |
add ebx,edx |
xor edi,edi ; ESI=SQRT(EBX) |
mov ecx,edi |
mov edx,edi |
inc edi |
mov eax,edi |
inc edi |
sqrt_loop: |
; in this moment ecx=edx*edx, eax=1+2*edx |
add ecx,eax |
inc eax |
inc eax |
add eax,edi |
inc edx |
cmp ecx,esi |
cmp ecx,ebx |
jbe sqrt_loop |
dec edx |
mov eax,edx ; EDX=EDX/7 |
mov esi,edx |
mov ax,si ; ESI=ESI/7 |
mov dl,7 |
div dl |
and eax,0xFF |
mov edx,eax ; EDX ? 0 : EDX=1 |
and ax,0xFF |
mov si,ax ; ESI ? 0 : ESI=1 |
jnz nozeroflag1 |
inc edx |
mov si,1 |
nozeroflag1: |
pop eax ; EAX = x distance |
; ECX=EAX/EDX |
pop eax |
pop edx |
pop ecx |
pop ebx |
push eax ; ECX=[temp1]/ESI |
push edx |
mov eax,[temp1] |
mov dx,si |
div dl |
movzx ecx,al |
pop ebx |
mov cl,al |
and ecx,0xFF |
pop edx |
pop eax |
cmp byte [sign1], 0 |
jz @f |
neg ecx |
@@: |
add eax, ecx |
cmp byte [sign1],1 |
je subtract_1 |
add eax,ecx ; EAX=EAX+ECX |
jmp calc_ok_1 |
subtract_1: |
sub eax,ecx ; EAX=EAX-ECX |
calc_ok_1: |
push eax ; ESI=[temp2]/EDX |
push eax ; EDX=[temp2]/ESI |
push ecx |
mov eax,[temp2] |
mov dx,si |
div dl |
movzx esi,al |
mov dl,al |
and dx,0xFF |
pop ecx |
pop eax |
cmp byte [sign2], 0 |
jz @f |
neg esi |
@@: |
add ebx, esi |
cmp byte [sign2],1 |
je subtract_2 |
add ebx,edx ; EBX=EBX+EDX |
jmp calc_ok_2 |
subtract_2: |
sub ebx,edx ; EBX=EBX-EDX |
calc_ok_2: |
; <=== |
; draw point |
lea ecx, [ebx-2] |
lea ebx, [eax-2] |
mov ecx,ebx ; draw point |
mov ebx,eax |
mov eax,13 |
dec ecx |
dec ecx |
dec ebx |
dec ebx |
shl ecx,16 |
add ecx,4 |
shl ebx,16 |
270,13 → 288,82 |
; -====- working on images and window -====- |
prepare_eyes: |
;mov eax,6 ; load EYES.RAW |
;mov ebx,graphix |
;mov ecx,0x00000000 |
;mov edx,0xFFFFFFFF |
;mov esi,imagedata |
;int 0x40 |
;cmp eax,0xFFFFFFFF |
;jnz filefound |
;mov eax,-1 ; file not exists... |
;int 0x40 |
;filefound: |
mov esi,imagedata+25 ; transform grayscale to putimage format |
mov edi,skindata |
mov ecx,30 |
transform_loop: |
push ecx |
mov ecx,30 |
lp1: |
lodsb |
stosb |
stosb |
stosb |
loop lp1 |
sub esi,30 |
mov ecx,30 |
lp2: |
lodsb |
stosb |
stosb |
stosb |
loop lp2 |
pop ecx |
loop transform_loop |
mov eax,14 ; calculating screen position |
int 0x40 |
shr eax,1 |
mov ax,59 |
sub eax,30*65536 |
mov [win_ebx],eax |
mov [win_ecx],dword 10*65536+44 |
mov esi,imagedata+25 ; calculate shape reference area |
mov edi,winref |
mov ecx,900 ; disable drag bar |
mov al,0 |
rep stosb |
mov ecx,30 ; calculate circles for eyes |
shape_loop: |
push ecx |
call copy_line ; duplicate (we have two eyes :) |
sub esi,30 |
call copy_line |
pop ecx |
loop shape_loop |
ret |
copy_line: ; copy single line to shape reference area |
mov ecx,30 |
cpl_loop: |
lodsb |
; input is image: 0xFF = white pixel, 0 = black pixel |
; output is membership boolean: 0 = pixel no, 1 = pixel ok |
inc eax |
cmp al,0xFF |
jnz set_one |
mov al,0 |
jmp cpl_ok |
set_one: |
mov al,1 |
cpl_ok: |
stosb |
loop cpl_loop |
ret |
288,19 → 375,14 |
win_ebx dd 0x0 |
win_ecx dd 0x0 |
mouse dd 0xFFFFFFFF |
;graphix db "EYES.RAW " |
EYES_END: ; end of code |
imagedata: |
; texture is 900 bytes starting from 25th |
file "eyes.raw":25,900 |
I_END: |
; temporary storage for math routines |
sign1 db ? |
sign2 db ? |
align 4 |
temp2 dd ? |
temp1 dd 0 |
temp2 dd 0 |
sign1 db 0 |
sign2 db 0 |
skindata rb 60*30*3 |
winref rb 45*60 |
EYES_END: ; end of code |
file "EYES.RAW" |
/programs/demos/eyes/trunk/macros.inc |
---|
143,10 → 143,6 |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
178,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
222,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
/programs/demos/fire/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/demos/fire/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/demos/fire/trunk/build.bat |
---|
0,0 → 1,2 |
@fasm fire.asm fire |
@pause |
/programs/demos/fire/trunk/fire.asm |
---|
13,7 → 13,6 |
dd mem_end |
dd 0,0 ; no parameters, no path |
;include 'lang.inc' |
include 'macros.inc' |
START: |
/programs/demos/fire/trunk/macros.inc |
---|
143,10 → 143,6 |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
178,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
222,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
/programs/demos/fire2/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/demos/fire2/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/demos/fire2/trunk/build.bat |
---|
0,0 → 1,2 |
@fasm fire2.asm fire2 |
@pause |
/programs/demos/fire2/trunk/fire2.asm |
---|
9,7 → 9,6 |
dd mem_end |
dd 0x0, 0x0 |
;include 'lang.inc' |
START: |
mov edi, my_img |
/programs/develop/mview/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/develop/mview/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/develop/mview/trunk/mview.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/develop/mview/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/develop/cmd/trunk/macros.inc |
---|
143,9 → 143,6 |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
177,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
221,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
/programs/develop/examples/cpuspeed/trunk/build_en.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm cpuspeed.asm cpuspeed |
@pause |
/programs/develop/examples/cpuspeed/trunk/build_ru.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm cpuspeed.asm cpuspeed |
@pause |
/programs/develop/examples/cpuspeed/trunk/cpuspeed.asm |
---|
0,0 → 1,153 |
; |
; CPU SPEED INDICATIOR |
; |
; Compile with FASM for Menuet |
; |
use32 |
org 0x0 |
db 'MENUET00' ; 8 byte id |
dd 38 ; required os |
dd START ; program start |
dd I_END ; program image size |
dd 0x1000 ; required amount of memory |
dd 0x1000 ; esp |
dd 0x00000000 ; reserved=no extended header |
include 'lang.inc' |
include 'macros.inc' |
START: ; start of execution |
mov eax,18 |
mov ebx,5 |
int 0x40 |
xor edx,edx |
mov ebx,1000000 |
div ebx |
mov ebx,10 |
mov edi,text+19 |
mov ecx,5 |
newnum: |
xor edx,edx |
mov ebx,10 |
div ebx |
add dl,48 |
mov [edi],dl |
sub edi,1 |
loop newnum |
call draw_window ; at first, draw the window |
still: |
mov eax,10 ; wait here for event |
int 0x40 |
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 |
red: ; redraw |
call draw_window |
jmp still |
key: ; key |
mov eax,2 ; just read it and ignore |
int 0x40 |
jmp still |
button: ; button |
mov eax,17 ; get id |
int 0x40 |
cmp ah,1 ; button id=1 ? |
jnz still |
mov eax,-1 ; close this program |
int 0x40 |
; ********************************************* |
; ******* WINDOW DEFINITIONS AND DRAW ******** |
; ********************************************* |
draw_window: |
mov eax,12 ; function 12:tell os about windowdraw |
mov ebx,1 ; 1, start of draw |
int 0x40 |
mov eax,48 |
mov ebx,3 |
mov ecx,sc |
mov edx,sizeof.system_colors |
int 0x40 |
; DRAW WINDOW |
mov eax,0 ; function 0 : define and draw window |
mov ebx,100*65536+200 ; [x start] *65536 + [x size] |
mov ecx,100*65536+65 ; [y start] *65536 + [y size] |
mov edx,[sc.work] ; color of work area RRGGBB,8->color glide |
mov esi,[sc.grab] ; color of grab bar RRGGBB,8->color |
or esi,0x80000000 |
mov edi,[sc.frame] ; color of frames RRGGBB |
int 0x40 |
; WINDOW LABEL |
mov eax,4 ; function 4 : write text to window |
mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
mov ecx,[sc.grab_text] ; color of text RRGGBB |
or ecx,0x10000000 |
mov edx,labelt ; pointer to text beginning |
mov esi,labellen-labelt ; text length |
int 0x40 |
; CLOSE BUTTON |
mov eax,8 ; function 8 : define and draw button |
mov ebx,(200-17)*65536+12 ; [x start] *65536 + [x size] |
mov ecx,5*65536+12 ; [y start] *65536 + [y size] |
mov edx,1 ; button id |
mov esi,[sc.grab_button] ; button color RRGGBB |
int 0x40 |
mov ebx,25*65536+35 ; draw info text with function 4 |
mov ecx,[sc.work_text] |
mov edx,text |
mov esi,40 |
newline: |
mov eax,4 |
int 0x40 |
add ebx,10 |
add edx,40 |
cmp [edx],byte 'x' |
jnz newline |
mov eax,12 ; function 12:tell os about windowdraw |
mov ebx,2 ; 2, end of draw |
int 0x40 |
ret |
; DATA AREA |
text: |
db 'CPU RUNNING AT MHZ ' |
db 'x' ; <- END MARKER, DONT DELETE |
labelt: |
db 'CPU SPEED' |
labellen: |
I_END: |
sc system_colors |
/programs/develop/examples/cpuspeed/trunk/macros.inc |
---|
0,0 → 1,266 |
; new application structure |
macro meos_app_start |
{ |
use32 |
org 0x0 |
db 'MENUET01' |
dd 0x01 |
dd __start |
dd __end |
dd __memory |
dd __stack |
if used __params & ~defined __params |
dd __params |
else |
dd 0x0 |
end if |
dd 0x0 |
} |
MEOS_APP_START fix meos_app_start |
macro code |
{ |
__start: |
} |
CODE fix code |
macro data |
{ |
__data: |
} |
DATA fix data |
macro udata |
{ |
if used __params & ~defined __params |
__params: |
db 0 |
__end: |
rb 255 |
else |
__end: |
end if |
__udata: |
} |
UDATA fix udata |
macro meos_app_end |
{ |
align 32 |
rb 2048 |
__stack: |
__memory: |
} |
MEOS_APP_END fix meos_app_end |
; macro for defining multiline text data |
struc mstr [sstring] |
{ |
forward |
local ssize |
virtual at 0 |
db sstring |
ssize = $ |
end virtual |
dd ssize |
db sstring |
common |
dd -1 |
} |
; strings |
macro sz name,[data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if used name |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
macro lsz name,[lng,data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if (used name)&(lang eq lng) |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
; easy system call macro |
macro mpack dest, hsrc, lsrc |
{ |
if (hsrc eqtype 0) & (lsrc eqtype 0) |
mov dest, (hsrc) shl 16 + lsrc |
else |
if (hsrc eqtype 0) & (~lsrc eqtype 0) |
mov dest, (hsrc) shl 16 |
add dest, lsrc |
else |
mov dest, hsrc |
shl dest, 16 |
add dest, lsrc |
end if |
end if |
} |
macro __mov reg,a,b { ; mike.dld |
if (~a eq)&(~b eq) |
mpack reg,a,b |
else if (~a eq)&(b 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 |
} |
; optimize the code for size |
__regs equ <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
macro add arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
inc arg1 |
else |
add arg1,arg2 |
end if |
else |
add arg1,arg2 |
end if |
} |
macro sub arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
dec arg1 |
else |
sub arg1,arg2 |
end if |
else |
sub arg1,arg2 |
end if |
} |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
xor arg1,arg1 |
inc arg1 |
else if (arg2) = -1 |
or arg1,-1 |
else if (arg2) > -128 & (arg2) < 128 |
push arg2 |
pop arg1 |
else |
mov arg1,arg2 |
end if |
else |
mov arg1,arg2 |
end if |
} |
macro struct name |
{ |
virtual at 0 |
name name |
sizeof.#name = $ - name |
end virtual |
} |
; structures used in MeOS |
struc process_information |
{ |
.cpu_usage dd ? ; +0 |
.window_stack_position dw ? ; +4 |
.window_stack_value dw ? ; +6 |
.not_used1 dw ? ; +8 |
.process_name rb 12 ; +10 |
.memory_start dd ? ; +22 |
.used_memory dd ? ; +26 |
.PID dd ? ; +30 |
.x_start dd ? ; +34 |
.y_start dd ? ; +38 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
} |
struct process_information |
struc system_colors |
{ |
.frame dd ? |
.grab dd ? |
.grab_button dd ? |
.grab_button_text dd ? |
.grab_text dd ? |
.work dd ? |
.work_button dd ? |
.work_button_text dd ? |
.work_text dd ? |
.work_graph dd ? |
} |
struct system_colors |
; constants |
; events |
EV_IDLE = 0 |
EV_TIMER = 0 |
EV_REDRAW = 1 |
EV_KEY = 2 |
EV_BUTTON = 3 |
EV_EXIT = 4 |
EV_BACKGROUND = 5 |
EV_MOUSE = 6 |
EV_IPC = 7 |
EV_STACK = 8 |
; event mask bits for function 40 |
EVM_REDRAW = 1b |
EVM_KEY = 10b |
EVM_BUTTON = 100b |
EVM_EXIT = 1000b |
EVM_BACKGROUND = 10000b |
EVM_MOUSE = 100000b |
EVM_IPC = 1000000b |
EVM_STACK = 10000000b |
/programs/develop/examples/ir/trunk/build_en.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm ir.asm ir |
@pause |
/programs/develop/examples/ir/trunk/build_ru.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm ir.asm ir |
@pause |
/programs/develop/examples/ir/trunk/ir.asm |
---|
0,0 → 1,268 |
; |
; INFRARED |
; |
; Compile with FASM for Menuet |
; |
use32 |
org 0x0 |
db 'MENUET01' ; 8 byte id |
dd 1 ; required os |
dd START ; program start |
dd I_END ; program image size |
dd 0x1000 ; required amount of memory |
dd 0x1000 ; esp = 0x7FFF0 |
dd 0, 0 |
include 'macros.inc' |
START: ; start of execution |
set_variables: |
mov eax,46 ; reserve ports 0x3f0 - 0x3ff |
mov ebx,0 |
mov ecx,0x3f0 |
mov edx,0x3ff |
int 0x40 |
mov eax,45 ; reserve irq 4 |
mov ebx,0 |
mov ecx,4 |
int 0x40 |
mov eax,44 ; set read ports for irq 4 |
mov ebx,irqtable |
; mov ecx,4 |
int 0x40 |
mov dh, 3 ; all ports have number 3xx hex |
mov dl, 0xf3+8 |
mov al, 0x80 |
out dx, al |
mov dl, 0xf1+8 |
mov al, 0 |
out dx, al |
mov dl, 0xf0+8 |
mov al, 0x30 / 4 |
out dx, al |
mov dl, 0xf3+8 |
mov al, 3 |
out dx, al |
mov dl, 0xf4+8 |
mov al, 0xB |
out dx, al |
mov dl, 0xf1+8 |
mov al, 1 |
out dx, al |
mov eax,5 |
mov ebx,100 |
int 0x40 |
mov dl, 0xf8 |
mov al, 'I' |
out dx, al |
mov eax,5 |
mov ebx,10 |
int 0x40 |
mov al, 'R' |
out dx, al |
mov eax,40 ; get com 1 data with irq 4 |
mov ebx,0000000000010000b shl 16 + 101b |
int 0x40 |
red: |
call draw_window |
still: |
mov eax,10 ; wait here for event |
int 0x40 |
dec eax |
jz red |
dec eax |
dec eax |
jnz readir |
button: ; button |
mov al,17 ; get id |
int 0x40 |
; we have only one button, close |
mov eax,45 ; free irq |
mov ebx,1 |
mov ecx,4 |
int 0x40 |
mov eax,46 ; free ports 0x3f0-0x3ff |
mov ebx,1 |
mov ecx,0x3f0 |
mov edx,0x3ff |
int 0x40 |
or eax,-1 ; close this program |
int 0x40 |
pos dd 0x0 |
cdplayer: |
dd 7 |
dd 0 |
dd 0 |
dd 0 |
dd 0 |
db '/RD/1/CDP',0 |
readir: |
mov eax,42 |
mov ebx,4 |
int 0x40 |
cmp ebx,80 |
jne nocd |
mov eax,70 |
mov ebx,cdplayer |
int 0x40 |
nocd: |
push ebx |
mov eax,[pos] |
add eax,1 |
cmp eax,10*20+1 |
jb noeaxz |
mov esi,text+10*4 |
mov edi,text |
mov ecx,10*21*4 |
cld |
rep movsb |
mov eax,13 |
mov ebx,20*65536+260 |
mov ecx,22*65536+220 |
mov edx,[wcolor] |
int 0x40 |
mov eax,10*19+1 |
noeaxz: |
mov [pos],eax |
pop ebx |
and ebx,0xff |
call draw_data |
jmp still |
draw_data: |
pusha |
xchg eax,ebx |
mov ecx,10 |
shl ebx,2 |
mov esi,3 |
newnum: |
xor edx,edx |
div ecx |
add edx,48 |
mov [ebx+text-1],dl |
dec ebx |
dec esi |
jnz newnum |
call draw_text |
popa |
ret |
irqtable: |
dd 0x3f8+0x01000000 ; + 01 = read byte, 02 read word |
dd 0 |
; ********************************************* |
; ******* WINDOW DEFINITIONS AND DRAW ******** |
; ********************************************* |
draw_window: |
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+300 ; [x start] *65536 + [x size] |
mov ecx,100*65536+250 ; [y start] *65536 + [y size] |
mov edx,[wcolor] ; color of work area RRGGBB,8->color |
mov edi,labelt ; caption string |
int 0x40 |
; ; WINDOW LABEL |
; mov eax,4 ; function 4 : write text to window |
; mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
; mov ecx,0x00ffffff ; color of text RRGGBB |
; mov edx,labelt ; pointer to text beginning |
; mov esi,labellen-labelt ; text length |
; int 0x40 |
; CLOSE BUTTON |
; mov eax,8 ; function 8 : define and draw button |
; mov ebx,(300-19)*65536+12 ; [x start] *65536 + [x size] |
; mov ecx,5*65536+12 ; [y start] *65536 + [y size] |
; mov edx,1 ; button id |
; mov esi,0x5599cc ; button color RRGGBB |
; int 0x40 |
draw_text: |
mov ebx,25*65536+35 ; draw info text with function 4 |
mov ecx,0xffffff |
mov edx,text |
mov esi,40 |
mov edi,20 |
newline: |
mov eax,4 |
int 0x40 |
add ebx,10 |
add edx,esi |
dec edi |
jne newline |
mov eax,12 |
mov ebx,2 |
int 0x40 |
ret |
; DATA AREA |
wcolor dd 0x13000000 |
labelt db 'INFRARED RECEIVER FOR IRMAN IN COM 1',0 |
text: |
I_END: |
/programs/develop/examples/ir/trunk/macros.inc |
---|
0,0 → 1,267 |
; new application structure |
macro meos_app_start |
{ |
use32 |
org 0x0 |
db 'MENUET01' |
dd 0x01 |
dd __start |
dd __end |
dd __memory |
dd __stack |
if used __params & ~defined __params |
dd __params |
else |
dd 0x0 |
end if |
dd 0x0 |
} |
MEOS_APP_START fix meos_app_start |
macro code |
{ |
__start: |
} |
CODE fix code |
macro data |
{ |
__data: |
} |
DATA fix data |
macro udata |
{ |
if used __params & ~defined __params |
__params: |
db 0 |
__end: |
rb 255 |
else |
__end: |
end if |
__udata: |
} |
UDATA fix udata |
macro meos_app_end |
{ |
align 32 |
rb 2048 |
__stack: |
__memory: |
} |
MEOS_APP_END fix meos_app_end |
; macro for defining multiline text data |
struc mstr [sstring] |
{ |
forward |
local ssize |
virtual at 0 |
db sstring |
ssize = $ |
end virtual |
dd ssize |
db sstring |
common |
dd -1 |
} |
; strings |
macro sz name,[data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if used name |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
macro lsz name,[lng,data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if (used name)&(lang eq lng) |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
; easy system call macro |
macro mpack dest, hsrc, lsrc |
{ |
if (hsrc eqtype 0) & (lsrc eqtype 0) |
mov dest, (hsrc) shl 16 + lsrc |
else |
if (hsrc eqtype 0) & (~lsrc eqtype 0) |
mov dest, (hsrc) shl 16 |
add dest, lsrc |
else |
mov dest, hsrc |
shl dest, 16 |
add dest, lsrc |
end if |
end if |
} |
macro __mov reg,a,b { ; mike.dld |
if (~a eq)&(~b eq) |
mpack reg,a,b |
else if (~a eq)&(b 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 |
} |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
macro add arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
inc arg1 |
else |
add arg1,arg2 |
end if |
else |
add arg1,arg2 |
end if |
} |
macro sub arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
dec arg1 |
else |
sub arg1,arg2 |
end if |
else |
sub arg1,arg2 |
end if |
} |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
xor arg1,arg1 |
inc arg1 |
else if (arg2) = -1 |
or arg1,-1 |
else if (arg2) > -128 & (arg2) < 128 |
push arg2 |
pop arg1 |
else |
mov arg1,arg2 |
end if |
else |
mov arg1,arg2 |
end if |
} |
macro struct name |
{ |
virtual at 0 |
name name |
sizeof.#name = $ - name |
end virtual |
} |
; structures used in MeOS |
struc process_information |
{ |
.cpu_usage dd ? ; +0 |
.window_stack_position dw ? ; +4 |
.window_stack_value dw ? ; +6 |
.not_used1 dw ? ; +8 |
.process_name rb 12 ; +10 |
.memory_start dd ? ; +22 |
.used_memory dd ? ; +26 |
.PID dd ? ; +30 |
.x_start dd ? ; +34 |
.y_start dd ? ; +38 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
} |
struct process_information |
struc system_colors |
{ |
.frame dd ? |
.grab dd ? |
.grab_button dd ? |
.grab_button_text dd ? |
.grab_text dd ? |
.work dd ? |
.work_button dd ? |
.work_button_text dd ? |
.work_text dd ? |
.work_graph dd ? |
} |
struct system_colors |
; constants |
; events |
EV_IDLE = 0 |
EV_TIMER = 0 |
EV_REDRAW = 1 |
EV_KEY = 2 |
EV_BUTTON = 3 |
EV_EXIT = 4 |
EV_BACKGROUND = 5 |
EV_MOUSE = 6 |
EV_IPC = 7 |
EV_STACK = 8 |
; event mask bits for function 40 |
EVM_REDRAW = 1b |
EVM_KEY = 10b |
EVM_BUTTON = 100b |
EVM_EXIT = 1000b |
EVM_BACKGROUND = 10000b |
EVM_MOUSE = 100000b |
EVM_IPC = 1000000b |
EVM_STACK = 10000000b |
/programs/develop/examples/md5/trunk/build_en.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm md5.asm md5 |
@pause |
/programs/develop/examples/md5/trunk/build_ru.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm md5.asm md5 |
@pause |
/programs/develop/examples/md5/trunk/md5.asm |
---|
0,0 → 1,445 |
; ਬ¥à ॠ«¨§ 樨 £¥¥à â®à MD5 - å¥è |
; |
; MD5 Generator |
; |
; ¢â®à: Hex |
; ©â: www.mestack.narod.ru |
; ¤¥ï, ॠ«¨§ æ¨ï ¨ ®â« ¤ª . |
; |
; ¢â®à: Halyavin |
; ©â: www.shade.msu.ru/~msu-se/home.html |
; ®à ¡®âª , ®â« ¤ª ¨ ®¯â¨¬¨§ æ¨ï. |
; |
; ®¬¯¨«¨àã¥âìáï Fasm'®¬ ¤«ï ¥ãíâ |
include 'lang.inc' |
macro diff16 title,l2 |
{ |
local s,d,l1 |
s = l2 |
display title,': 0x' |
repeat 8 |
d = 48 + s shr ((8-%) shl 2) and $0F |
if d > 57 |
d = d + 65-57-1 |
end if |
display d |
end repeat |
display 13,10 |
} |
use32 |
org 0x0 |
db 'MENUET01' ; 8-¡ ©âë© ¨¤¥â¨ä¨ª â®à MenuetOS |
dd 0x01 ; ¢¥àá¨ï § £®«®¢ª (¢á¥£¤ 1) |
dd START ; ¤à¥á ¯¥à¢®© ª®¬ ¤ë |
dd I_END ; à §¬¥à ¯à®£à ¬¬ë |
dd 0x100000 ; ª®«¨ç¥á⢮ ¯ ¬ï⨠|
dd 0x100000 ; ¤à¥á ¢¥àè¨ë áâíª |
dd 0x0 ; ¤à¥á ¡ãä¥à ¤«ï ¯ à ¬¥â஢ (¥ ¨á¯®«ì§ã¥âáï) |
dd 0x0 ; § १¥à¢¨à®¢ ® |
START: ; ç «® ¢ë¯®«¥¨ï ¯à®£à ¬¬ë |
call draw_window ; ¯¥à¢ ¯¥à¥à¨á㥬 ®ª® |
still: |
mov eax,23 ; ¦¨¤ ¥¬ ᮡë⨩ |
mov ebx,1 |
int 0x40 |
cmp eax,1 ; ¯à®á ¯¥à¥à¨á®¢ªã ? |
jz red |
cmp eax,2 ; ¦ â ª« ¢¨è¨ ? |
jz key |
cmp eax,3 ; ¦ â ª®¯ª ? |
jz button |
jmp still |
red: |
call draw_window |
jmp still |
key: |
mov eax,2 |
int 0x40 |
jmp still |
button: |
mov eax,17 |
int 0x40 |
cmp ah,1 ; id ª®¯ª¨ = 1 ? |
jnz noclose |
mov eax,-1 |
int 0x40 |
noclose: |
cmp ah,2 ; ¥¥à¨à®¢ âì? |
je procMD5hash |
jmp still |
procMD5hash: |
; phase I - padding |
mov edi,ptBuffer |
mov eax,[dtBufferLength] |
inc eax |
add edi,eax |
mov byte [edi-1],0x80 |
xor edx,edx |
mov ebx,64 |
div ebx |
neg edx |
add edx,64 |
cmp edx,8 |
jae @f |
add edx,64 |
@@: mov ecx,edx |
xor al,al |
rep stosb |
mov eax,[dtBufferLength] |
inc edx |
add [dtBufferLength],edx |
xor edx,edx |
mov ebx,8 |
mul ebx |
mov [edi-8],eax |
mov [edi-4],edx |
mov edx,[dtBufferLength] |
mov edi,ptBuffer |
; phase II - chaining variables initialization |
mov dword [dtA],067452301h |
mov dword [dtB],0efcdab89h |
mov dword [dtC],098badcfeh |
mov dword [dtD],010325476h |
mov esi,ptMD5Result |
hashloop: |
;diff16 "hashloop",hashloop |
mov eax,[dtA] |
mov [dta],eax |
mov eax,[dtB] |
mov [dtb],eax |
mov eax,[dtC] |
mov [dtc],eax |
mov eax,[dtD] |
mov [dtd],eax |
macro ff dta,dtb,dtc,dtd,data,shift,cc |
{ |
mov eax,dtb |
mov ebx,dtc |
mov ecx,dtd |
and ebx,eax |
not eax |
and eax,ecx |
or eax,ebx |
add eax,dta |
add eax,data |
add eax,cc |
rol eax,shift |
add eax,dtb |
mov dta,eax |
} |
macro gg dta,dtb,dtc,dtd,data,shift,cc |
{ |
mov eax,dtb |
mov ebx,dtc |
mov ecx,dtd |
and eax,ecx |
not ecx |
and ecx,ebx |
or eax,ecx |
add eax,dta |
add eax,data |
add eax,cc |
rol eax,shift |
add eax,dtb |
mov dta,eax |
} |
macro hh dta,dtb,dtc,dtd,data,shift,cc |
{ |
mov eax,dtb |
mov ebx,dtc |
mov ecx,dtd |
xor eax,ebx |
xor eax,ecx |
add eax,dta |
add eax,data |
add eax,cc |
rol eax,shift |
add eax,dtb |
mov dta,eax |
} |
macro ii dta,dtb,dtc,dtd,data,shift,cc |
{ |
mov eax,dtb |
mov ebx,dtc |
mov ecx,dtd |
not ecx |
or eax,ecx |
xor eax,ebx |
add eax,dta |
add eax,data |
add eax,cc |
rol eax,shift |
add eax,dtb |
mov dta,eax |
} |
; round 1 |
ff [dta],[dtb],[dtc],[dtd],dword [edi+00*4],07,0xd76aa478 |
ff [dtd],[dta],[dtb],[dtc],dword [edi+01*4],12,0xe8c7b756 |
ff [dtc],[dtd],[dta],[dtb],dword [edi+02*4],17,0x242070db |
ff [dtb],[dtc],[dtd],[dta],dword [edi+03*4],22,0xc1bdceee |
ff [dta],[dtb],[dtc],[dtd],dword [edi+04*4],07,0xf57c0faf |
ff [dtd],[dta],[dtb],[dtc],dword [edi+05*4],12,0x4787c62a |
ff [dtc],[dtd],[dta],[dtb],dword [edi+06*4],17,0xa8304613 |
ff [dtb],[dtc],[dtd],[dta],dword [edi+07*4],22,0xfd469501 |
ff [dta],[dtb],[dtc],[dtd],dword [edi+08*4],07,0x698098d8 |
ff [dtd],[dta],[dtb],[dtc],dword [edi+09*4],12,0x8b44f7af |
ff [dtc],[dtd],[dta],[dtb],dword [edi+10*4],17,0xffff5bb1 |
ff [dtb],[dtc],[dtd],[dta],dword [edi+11*4],22,0x895cd7be |
ff [dta],[dtb],[dtc],[dtd],dword [edi+12*4],07,0x6b901122 |
ff [dtd],[dta],[dtb],[dtc],dword [edi+13*4],12,0xfd987193 |
ff [dtc],[dtd],[dta],[dtb],dword [edi+14*4],17,0xa679438e |
ff [dtb],[dtc],[dtd],[dta],dword [edi+15*4],22,0x49b40821 |
; round 2 |
gg [dta],[dtb],[dtc],[dtd],dword [edi+01*4],05,0xf61e2562 |
gg [dtd],[dta],[dtb],[dtc],dword [edi+06*4],09,0xc040b340 |
gg [dtc],[dtd],[dta],[dtb],dword [edi+11*4],14,0x265e5a51 |
gg [dtb],[dtc],[dtd],[dta],dword [edi+00*4],20,0xe9b6c7aa |
gg [dta],[dtb],[dtc],[dtd],dword [edi+05*4],05,0xd62f105d |
gg [dtd],[dta],[dtb],[dtc],dword [edi+10*4],09,0x02441453 |
gg [dtc],[dtd],[dta],[dtb],dword [edi+15*4],14,0xd8a1e681 |
gg [dtb],[dtc],[dtd],[dta],dword [edi+04*4],20,0xe7d3fbc8 |
gg [dta],[dtb],[dtc],[dtd],dword [edi+09*4],05,0x21e1cde6 |
gg [dtd],[dta],[dtb],[dtc],dword [edi+14*4],09,0xc33707d6 |
gg [dtc],[dtd],[dta],[dtb],dword [edi+03*4],14,0xf4d50d87 |
gg [dtb],[dtc],[dtd],[dta],dword [edi+08*4],20,0x455a14ed |
gg [dta],[dtb],[dtc],[dtd],dword [edi+13*4],05,0xa9e3e905 |
gg [dtd],[dta],[dtb],[dtc],dword [edi+02*4],09,0xfcefa3f8 |
gg [dtc],[dtd],[dta],[dtb],dword [edi+07*4],14,0x676f02d9 |
gg [dtb],[dtc],[dtd],[dta],dword [edi+12*4],20,0x8d2a4c8a |
; round 3 |
hh [dta],[dtb],[dtc],[dtd],dword [edi+05*4],04,0xfffa3942 |
hh [dtd],[dta],[dtb],[dtc],dword [edi+08*4],11,0x8771f681 |
hh [dtc],[dtd],[dta],[dtb],dword [edi+11*4],16,0x6d9d6122 |
hh [dtb],[dtc],[dtd],[dta],dword [edi+14*4],23,0xfde5380c |
hh [dta],[dtb],[dtc],[dtd],dword [edi+01*4],04,0xa4beea44 |
hh [dtd],[dta],[dtb],[dtc],dword [edi+04*4],11,0x4bdecfa9 |
hh [dtc],[dtd],[dta],[dtb],dword [edi+07*4],16,0xf6bb4b60 |
hh [dtb],[dtc],[dtd],[dta],dword [edi+10*4],23,0xbebfbc70 |
hh [dta],[dtb],[dtc],[dtd],dword [edi+13*4],04,0x289b7ec6 |
hh [dtd],[dta],[dtb],[dtc],dword [edi+00*4],11,0xeaa127fa |
hh [dtc],[dtd],[dta],[dtb],dword [edi+03*4],16,0xd4ef3085 |
hh [dtb],[dtc],[dtd],[dta],dword [edi+06*4],23,0x04881d05 |
hh [dta],[dtb],[dtc],[dtd],dword [edi+09*4],04,0xd9d4d039 |
hh [dtd],[dta],[dtb],[dtc],dword [edi+12*4],11,0xe6db99e5 |
hh [dtc],[dtd],[dta],[dtb],dword [edi+15*4],16,0x1fa27cf8 |
hh [dtb],[dtc],[dtd],[dta],dword [edi+02*4],23,0xc4ac5665 |
; round 4 |
ii [dta],[dtb],[dtc],[dtd],dword [edi+00*4],06,0xf4292244 |
ii [dtd],[dta],[dtb],[dtc],dword [edi+07*4],10,0x432aff97 |
ii [dtc],[dtd],[dta],[dtb],dword [edi+14*4],15,0xab9423a7 |
ii [dtb],[dtc],[dtd],[dta],dword [edi+05*4],21,0xfc93a039 |
ii [dta],[dtb],[dtc],[dtd],dword [edi+12*4],06,0x655b59c3 |
ii [dtd],[dta],[dtb],[dtc],dword [edi+03*4],10,0x8f0ccc92 |
ii [dtc],[dtd],[dta],[dtb],dword [edi+10*4],15,0xffeff47d |
ii [dtb],[dtc],[dtd],[dta],dword [edi+01*4],21,0x85845dd1 |
ii [dta],[dtb],[dtc],[dtd],dword [edi+08*4],06,0x6fa87e4f |
ii [dtd],[dta],[dtb],[dtc],dword [edi+15*4],10,0xfe2ce6e0 |
ii [dtc],[dtd],[dta],[dtb],dword [edi+06*4],15,0xa3014314 |
ii [dtb],[dtc],[dtd],[dta],dword [edi+13*4],21,0x4e0811a1 |
ii [dta],[dtb],[dtc],[dtd],dword [edi+04*4],06,0xf7537e82 |
ii [dtd],[dta],[dtb],[dtc],dword [edi+11*4],10,0xbd3af235 |
ii [dtc],[dtd],[dta],[dtb],dword [edi+02*4],15,0x2ad7d2bb |
ii [dtb],[dtc],[dtd],[dta],dword [edi+09*4],21,0xeb86d391 |
mov eax,[dta] |
add [dtA],eax |
mov eax,[dtb] |
add [dtB],eax |
mov eax,[dtc] |
add [dtC],eax |
mov eax,[dtd] |
add [dtD],eax |
add edi,64 |
sub edx,64 |
jnz hashloop |
; phase IV - results |
mov ecx,4 |
mov esi,ptMD5Result |
@@: mov eax,[esi] |
xchg al,ah |
rol eax,16 |
xchg al,ah |
mov [esi],eax |
add esi,4 |
loop @b |
translate: |
;diff16 "translate",translate |
mov esi,ptMD5Result-5 |
mov edi,hexresult |
mov ecx,16 |
@@: |
test ecx,3 |
jnz .nojmp |
add esi,8 |
.nojmp: |
xor eax,eax |
mov al,byte [esi] |
mov edx,eax |
shr eax,4 |
mov bl,byte [table+eax] |
mov [edi],bl |
inc edi |
and edx,15 |
mov bl,byte [table+edx] |
mov [edi],bl |
dec esi |
inc edi |
loop @b |
mov esi,hexresult |
mov [text], esi |
mov eax,32 |
mov [textlen], eax |
call draw_window |
jmp still |
; ********************************************* |
; ******* WINDOW DEFINITIONS AND DRAW ******** |
; ********************************************* |
draw_window: |
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+230 ; [x start] *65536 + [x size] |
mov ecx,60*65536+100 ; [y start] *65536 + [y size] |
mov edx,0x03ffffff ; color of work area RRGGBB |
mov esi,0x80aabbcc ; color of grab bar RRGGBB,8->color gl |
mov edi,0x00aabbcc ; color of frames RRGGBB |
int 0x40 |
; WINDOW LABEL |
mov eax,4 ; function 4 : write text to window |
mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
mov ecx,0x00ffffff ; color of text RRGGBB |
mov edx,labeltext ; pointer to text beginning |
mov esi,lte-labeltext ; text length |
int 0x40 |
; ¨á㥬 ª®¯ªã ¤«ï £¥¥à 樨 |
mov eax,8 ; function 8 : define and draw button |
mov ebx,20*65536+80 ; [x start] *65536 + [x size] |
mov ecx,34*65536+14 ; [y start] *65536 + [y size] |
mov edx,2 ; button id |
mov esi,0x5588dd ; button color RRGGBB |
int 0x40 |
; §¢ ¨¥ ª®¯ªã |
mov eax,4 ; function 4 : write text to window |
mov ebx,23*65536+38 ; [x start] *65536 + [y start] |
mov ecx,0x000000 ; color of text RRGGBB |
mov edx,gen_txt ; pointer to text beginning |
mov esi,gen_len-gen_txt ; text length |
int 0x40 |
mov eax,4 ; draw info text with function 4 |
mov ebx,20*65536+70 |
mov ecx,0x000000 |
mov edx,[text] |
xor eax,eax |
mov al, [textlen] |
mov esi,eax |
mov eax,4 |
int 0x40 |
mov eax,12 ; function 12:tell os about windowdraw |
mov ebx,2 ; 2, end of draw |
int 0x40 |
ret |
;¡« áâì ¤ ëå |
labeltext: db 'MD5 Generator' |
lte: |
text: dd 0 |
textlen: dd 0 |
gen_txt: db '£¥¥à¨à®¢ âì' |
gen_len: |
InputMD5Rez: dd 0 |
InputMD5Rezlen: |
ptBuffer: db '123' ; ¬¥¨âì £¥¥à¨à㥬®¥ á«®¢® |
rb 61 |
dtBufferLength: dd 3 ; §¬¥à ptBuffer |
ptMD5Result: |
dtA: dd 0 |
dtB: dd 0 |
dtC: dd 0 |
dtD: dd 0 |
dta: dd 0 |
dtb: dd 0 |
dtc: dd 0 |
dtd: dd 0 |
x: dd 0 |
s: dd 0 |
t: dd 0 |
table: db '0123456789abcdef' |
hexresult db 32 |
I_END: |
/programs/develop/examples/rtdata/trunk/build_en.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm rtdata.asm rtdata |
@pause |
/programs/develop/examples/rtdata/trunk/build_ru.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm rtdata.asm rtdata |
@pause |
/programs/develop/examples/rtdata/trunk/macros.inc |
---|
0,0 → 1,266 |
; new application structure |
macro meos_app_start |
{ |
use32 |
org 0x0 |
db 'MENUET01' |
dd 0x01 |
dd __start |
dd __end |
dd __memory |
dd __stack |
if used __params & ~defined __params |
dd __params |
else |
dd 0x0 |
end if |
dd 0x0 |
} |
MEOS_APP_START fix meos_app_start |
macro code |
{ |
__start: |
} |
CODE fix code |
macro data |
{ |
__data: |
} |
DATA fix data |
macro udata |
{ |
if used __params & ~defined __params |
__params: |
db 0 |
__end: |
rb 255 |
else |
__end: |
end if |
__udata: |
} |
UDATA fix udata |
macro meos_app_end |
{ |
align 32 |
rb 2048 |
__stack: |
__memory: |
} |
MEOS_APP_END fix meos_app_end |
; macro for defining multiline text data |
struc mstr [sstring] |
{ |
forward |
local ssize |
virtual at 0 |
db sstring |
ssize = $ |
end virtual |
dd ssize |
db sstring |
common |
dd -1 |
} |
; strings |
macro sz name,[data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if used name |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
macro lsz name,[lng,data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if (used name)&(lang eq lng) |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
; easy system call macro |
macro mpack dest, hsrc, lsrc |
{ |
if (hsrc eqtype 0) & (lsrc eqtype 0) |
mov dest, (hsrc) shl 16 + lsrc |
else |
if (hsrc eqtype 0) & (~lsrc eqtype 0) |
mov dest, (hsrc) shl 16 |
add dest, lsrc |
else |
mov dest, hsrc |
shl dest, 16 |
add dest, lsrc |
end if |
end if |
} |
macro __mov reg,a,b { ; mike.dld |
if (~a eq)&(~b eq) |
mpack reg,a,b |
else if (~a eq)&(b 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 |
} |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
macro add arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
inc arg1 |
else |
add arg1,arg2 |
end if |
else |
add arg1,arg2 |
end if |
} |
macro sub arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
dec arg1 |
else |
sub arg1,arg2 |
end if |
else |
sub arg1,arg2 |
end if |
} |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
xor arg1,arg1 |
inc arg1 |
else if (arg2) = -1 |
or arg1,-1 |
else if (arg2) > -128 & (arg2) < 128 |
push arg2 |
pop arg1 |
else |
mov arg1,arg2 |
end if |
else |
mov arg1,arg2 |
end if |
} |
macro struct name |
{ |
virtual at 0 |
name name |
sizeof.#name = $ - name |
end virtual |
} |
; structures used in MeOS |
struc process_information |
{ |
.cpu_usage dd ? ; +0 |
.window_stack_position dw ? ; +4 |
.window_stack_value dw ? ; +6 |
.not_used1 dw ? ; +8 |
.process_name rb 12 ; +10 |
.memory_start dd ? ; +22 |
.used_memory dd ? ; +26 |
.PID dd ? ; +30 |
.x_start dd ? ; +34 |
.y_start dd ? ; +38 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
} |
struct process_information |
struc system_colors |
{ |
.frame dd ? |
.grab dd ? |
.grab_button dd ? |
.grab_button_text dd ? |
.grab_text dd ? |
.work dd ? |
.work_button dd ? |
.work_button_text dd ? |
.work_text dd ? |
.work_graph dd ? |
} |
struct system_colors |
; constants |
; events |
EV_IDLE = 0 |
EV_TIMER = 0 |
EV_REDRAW = 1 |
EV_KEY = 2 |
EV_BUTTON = 3 |
EV_EXIT = 4 |
EV_BACKGROUND = 5 |
EV_MOUSE = 6 |
EV_IPC = 7 |
EV_STACK = 8 |
; event mask bits for function 40 |
EVM_REDRAW = 1b |
EVM_KEY = 10b |
EVM_BUTTON = 100b |
EVM_EXIT = 1000b |
EVM_BACKGROUND = 10000b |
EVM_MOUSE = 100000b |
EVM_IPC = 1000000b |
EVM_STACK = 10000000b |
/programs/develop/examples/rtdata/trunk/rtdata.asm |
---|
0,0 → 1,235 |
; |
; COMMUNICATING WITH MODEM: PORTS & IRQ |
; |
; Compile with FASM for Menuet |
; |
include "lang.inc" |
include "macros.inc" |
use32 |
org 0x0 |
db 'MENUET01' ; 8 byte id |
dd 0x01 ; header version |
dd START ; start of code |
dd I_END ; size of image |
dd 0x1000 ; memory for app |
dd 0x1000 ; esp |
dd 0x0 , 0x0 ; I_Param , I_Icon |
START: ; start of execution |
mov eax,45 ; reserve irq 4 |
mov ebx,0 |
mov ecx,4 |
int 0x40 |
mov eax,46 ; reserve ports 0x3f8-0x3ff |
mov ebx,0 |
mov ecx,0x3f8 |
mov edx,0x3ff |
int 0x40 |
mov eax,44 ; read these ports at interrupt/irq 4 |
mov ebx,irqtable |
mov ecx,4 |
int 0x40 |
mov eax,40 ; enable event for interrupt/irq 4 |
mov ebx,10000b shl 16 + 111b |
int 0x40 |
call program_com1 |
call draw_window |
still: |
mov eax,10 ; wait here for event |
int 0x40 |
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 ; data read by interrupt ? |
je irq4 |
jmp still |
red: ; redraw |
call draw_window |
jmp still |
key: ; key |
mov eax,2 ; just read it and ignore |
int 0x40 |
mov al,ah |
mov dx,0x3f8 |
out dx,al |
jmp still |
button: ; button |
or eax,-1 ; close this program |
int 0x40 |
irq4: |
mov eax,42 |
mov ebx,4 |
int 0x40 |
; eax = number of bytes left |
; ecx = 0 success, =1 fail |
; bl = byte |
inc [pos] |
and [pos],31 |
mov eax,[pos] |
mov [string+eax], bl |
call draw_string |
jmp still |
baudrate_9600 equ 12 |
baudrate_57600 equ 2 |
program_com1: |
mov dx,0x3f8+3 |
mov al,0x80 |
out dx,al |
mov dx,0x3f8+1 |
mov al,0x00 |
out dx,al |
mov dx,0x3f8+0 |
mov al,baudrate_9600 |
out dx,al |
mov dx,0x3f8+3 |
mov al,0x3 |
out dx,al |
mov dx,0x3f8+4 |
mov al,0xb |
out dx,al |
mov dx,0x3f8+1 |
mov al,0x1 |
out dx,al |
ret |
; ********************************************* |
; ******* WINDOW DEFINITIONS AND DRAW ******** |
; ********************************************* |
draw_window: |
mov eax, 48 |
mov ebx, 3 |
mov ecx, sc |
mov edx, sizeof.system_colors |
int 0x40 |
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+250 ; [x start] *65536 + [x size] |
mov ecx, 100*65536+85 ; [y start] *65536 + [y size] |
mov edx, [sc.work] |
or edx, 0x03000000 ; color of work area RRGGBB,8->color gl |
int 0x40 |
; WINDOW LABEL |
mov eax, 4 ; function 4 : write text to window |
mov ebx, 8*65536+8 ; [x start] *65536 + [y start] |
mov ecx, [sc.grab_text] |
or ecx, 0x10000000 ; font 1 & color ( 0xF0RRGGBB ) |
mov edx, header ; pointer to text beginning |
mov esi, header.len ; text length |
int 0x40 |
mov eax, 4 ; draw text |
mov ebx, 20*65536+33 |
mov ecx, [sc.work_text] |
mov edx, text+4 |
.nextstr: |
mov esi, [edx-4] |
test esi, 0xFF000000 |
jnz .finstr |
int 0x40 |
add edx, esi |
add edx, 4 |
add ebx, 10 |
jmp .nextstr |
.finstr: |
call draw_string |
mov eax,12 ; function 12:tell os about windowdraw |
mov ebx,2 ; 2, end of draw |
int 0x40 |
ret |
draw_string: |
mov eax, 4 |
mov ebx, 20*65536+65 |
mov ecx, [sc.work_text] |
mov edx, string |
mov esi, 32 |
int 0x40 |
ret |
; DATA AREA |
if lang eq ru |
text mstr " .",\ |
" ",\ |
" IRQ4 ." |
header: |
db ' COM1' |
.len = $ - header |
else |
text mstr "TYPED CHARACTERS ARE SENT TO MODEM.",\ |
"DATA FROM MODEM IS READ BY IRQ4",\ |
"INTERRUPT AND DISPLAYED BELOW." |
header: |
db 'MODEM AT COM1' |
.len = $ - header |
end if |
pos dd 0x0 |
irqtable: |
; port ; 1=byte, 2=word |
dd 0x3f8 +0x01000000 ; read byte from port 0x3f8 at interrupt/irq 4 |
dd 0x0 ; no more ports ( max 15 ) to read |
I_END: |
string rb 32 |
sc system_colors |
/programs/develop/fasm/trunk/fasm.asm |
---|
22,7 → 22,7 |
;; Menuet header |
appname equ "FASM " |
appname equ "flat assembler " |
use32 |
392,11 → 392,11 |
s_compile db 'COMPILE' |
s_run db ' RUN ' |
infile db 'EXAMPLE.ASM' |
infile db 'example.asm' |
times MAX_PATH+$-infile db 0 |
outfile db 'EXAMPLE' |
outfile db 'example' |
times MAX_PATH+$-outfile db 0 |
path db '/RD/1/' |
path db '/rd/1/' |
times MAX_PATH+$-path db 0 |
lf db 13,10,0 |
/programs/develop/fasm/trunk/version.inc |
---|
33,7 → 33,7 |
; cannot simply be copied and put under another distribution licence |
; (including the GNU Public Licence). |
VERSION_STRING equ "1.67.13" |
VERSION_STRING equ "1.67.14" |
VERSION_MAJOR = 1 |
VERSION_MINOR = 67 |
/programs/develop/fasm/trunk/x86_64.inc |
---|
223,6 → 223,10 |
cdq |
cmp ecx,edx |
jne value_out_of_range |
cmp [value_type],4 |
jne get_simm32_ok |
mov [value_type],2 |
get_simm32_ok: |
ret |
basic_reg: |
lods byte [esi] |
6019,6 → 6023,9 |
mov edx,[symbol_identifier] |
mov [address_symbol],edx |
mov edx,eax |
ror ecx,16 |
mov cl,[value_type] |
rol ecx,16 |
mov bx,0FF00h |
address_ok: |
ret |
/programs/develop/mtdbg/build.bat |
---|
0,0 → 1,2 |
@fasm mtdbg.asm mtdbg |
@pause |
/programs/develop/mtdbg/mtdbg.asm |
---|
0,0 → 1,4825 |
format binary |
use32 |
db 'MENUET01' |
dd 1 |
dd start |
dd i_end |
dd used_mem |
dd used_mem |
dd i_param |
dd 0 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GUI ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
data_width equ 80 |
data_x_pos equ 12 |
data_x_size equ data_width*6 |
title_x_pos equ 30 |
title_y_pos equ 32 |
title_y_size equ 10 |
registers_x_pos equ data_x_pos |
registers_y_pos equ (title_y_pos + title_y_size) |
registers_y_size equ 30 |
dump_y_pos equ (registers_y_pos + registers_y_size + 5) |
dump_height equ 4 |
dump_y_size equ (dump_height*10) |
disasm_y_pos equ (dump_y_pos + dump_y_size + 4) |
disasm_height equ 16 |
disasm_y_size equ (disasm_height*10) |
messages_width equ data_width |
messages_height equ 12 |
messages_x_pos equ data_x_pos |
messages_y_pos equ (disasm_y_pos + disasm_y_size + 4) |
messages_x_size equ messages_width*6 |
messages_y_size equ messages_height*10 |
cmdline_width equ data_width |
cmdline_x_pos equ data_x_pos |
cmdline_y_pos equ (messages_y_pos + messages_y_size + 10) |
cmdline_x_size equ messages_x_size |
cmdline_y_size equ 10 |
wnd_x_size equ (data_x_pos + messages_x_size + data_x_pos) |
wnd_y_size equ (cmdline_y_pos + cmdline_y_size + data_x_pos) |
start: |
mov edi, messages |
mov ecx, messages_width*messages_height |
mov al, ' ' |
rep stosb |
xor eax, eax |
mov [messages_pos], eax |
mov [cmdline_len], eax |
mov [cmdline_pos], eax |
mov edi, needzerostart |
mov ecx, (needzeroend-needzerostart+3)/4 |
rep stosd |
mov esi, begin_str |
call put_message_nodraw |
; set event mask - default events and debugging events |
push 40 |
pop eax |
mov ebx, 0x107 |
int 40h |
; set debug messages buffer |
mov ecx, dbgbufsize |
mov dword [ecx], 256 |
xor ebx, ebx |
mov [ecx+4], ebx |
mov al, 69 |
int 40h |
mov esi, i_param |
call skip_spaces |
test al, al |
jz dodraw |
push esi |
call draw_window |
pop esi |
call OnLoadInit |
jmp waitevent |
dodraw: |
call draw_window |
waitevent: |
push 10 |
pop eax |
int 40h |
cmp al, 9 |
jz debugmsg |
dec eax |
jz dodraw |
dec eax |
jz keypressed |
dec eax |
jnz waitevent |
; button pressed - we have only one button (close) |
push -1 |
pop eax |
int 40h |
keypressed: |
mov al, 2 |
int 40h |
shr eax, 8 |
cmp al, 8 |
jz .backspace |
cmp al, 0xB0 |
jz .left |
cmp al, 0xB3 |
jz .right |
cmp al, 0x0D |
jz .enter |
cmp al, 0xB6 |
jz .del |
cmp al, 0xB4 |
jz .home |
cmp al, 0xB5 |
jz .end |
cmp al, 0xB1 |
jz .down |
cmp al, 0xB2 |
jz .up |
cmp al, 0xD8 |
jz CtrlF7 |
cmp al, 0xD9 |
jz CtrlF8 |
cmp [cmdline_len], cmdline_width |
jae waitevent |
push eax |
call clear_cmdline_end |
pop eax |
mov edi, cmdline |
mov ecx, [cmdline_len] |
add edi, ecx |
lea esi, [edi-1] |
sub ecx, [cmdline_pos] |
std |
rep movsb |
cld |
stosb |
inc [cmdline_len] |
call draw_cmdline_end |
inc [cmdline_pos] |
call draw_cursor |
jmp waitevent |
.backspace: |
cmp [cmdline_pos], 0 |
jz waitevent |
dec [cmdline_pos] |
.delchar: |
call clear_cmdline_end |
mov edi, [cmdline_pos] |
dec [cmdline_len] |
mov ecx, [cmdline_len] |
sub ecx, edi |
add edi, cmdline |
lea esi, [edi+1] |
rep movsb |
call draw_cmdline_end |
call draw_cursor |
jmp waitevent |
.del: |
mov eax, [cmdline_pos] |
cmp eax, [cmdline_len] |
jae waitevent |
jmp .delchar |
.left: |
cmp [cmdline_pos], 0 |
jz waitevent |
call hide_cursor |
dec [cmdline_pos] |
call draw_cursor |
jmp waitevent |
.right: |
mov eax, [cmdline_pos] |
cmp eax, [cmdline_len] |
jae waitevent |
call hide_cursor |
inc [cmdline_pos] |
call draw_cursor |
jmp waitevent |
.home: |
call hide_cursor |
and [cmdline_pos], 0 |
call draw_cursor |
jmp waitevent |
.end: |
call hide_cursor |
mov eax, [cmdline_len] |
mov [cmdline_pos], eax |
call draw_cursor |
.up: |
.down: |
jmp waitevent |
.enter: |
mov ecx, [cmdline_len] |
test ecx, ecx |
jz waitevent |
mov esi, cmdline |
mov byte [esi+ecx], 0 |
and [cmdline_pos], 0 |
push esi |
call clear_cmdline_end |
call draw_cursor |
pop esi |
and [cmdline_len], 0 |
; skip leading spaces |
call skip_spaces |
cmp al, 0 |
jz waitevent |
; now esi points to command |
push esi |
mov esi, prompt |
call put_message_nodraw |
pop esi |
push esi |
call put_message_nodraw |
z1: mov esi, newline |
call put_message |
pop esi |
push esi |
call get_arg |
mov [curarg], esi |
pop edi |
mov esi, commands |
call find_cmd |
mov eax, aUnknownCommand |
jc .x11 |
; check command requirements |
; flags field: |
; &1: command may be called without parameters |
; &2: command may be called with parameters |
; &4: command may be called without loaded program |
; &8: command may be called with loaded program |
mov eax, [esi+8] |
mov ecx, [curarg] |
cmp byte [ecx], 0 |
jz .noargs |
test byte [esi+16], 2 |
jz .x11 |
jmp @f |
.noargs: |
test byte [esi+16], 1 |
jz .x11 |
@@: |
cmp [debuggee_pid], 0 |
jz .nodebuggee |
mov eax, aAlreadyLoaded |
test byte [esi+16], 8 |
jz .x11 |
jmp .x9 |
.nodebuggee: |
mov eax, need_debuggee |
test byte [esi+16], 4 |
jnz .x9 |
.x11: |
xchg esi, eax |
call put_message |
.x10: |
jmp waitevent |
.x9: |
call dword [esi+4] |
jmp .x10 |
find_cmd: |
; all commands are case-insensitive |
push edi |
.x4: |
mov al, [edi] |
cmp al, 0 |
jz .x5 |
cmp al, 'A' |
jb @f |
cmp al, 'Z' |
ja @f |
or al, 20h |
@@: |
stosb |
jmp .x4 |
.x5: |
; find command |
pop edi |
.x6: |
cmp dword [esi], 0 |
jz .x7 |
push esi |
mov esi, [esi] |
lodsb |
movzx ecx, al |
push edi |
repz cmpsb |
pop edi |
pop esi |
jz .x8 |
add esi, 17 |
jmp .x6 |
.x7: |
stc |
.x8: |
ret |
get_arg: |
lodsb |
cmp al, ' ' |
ja get_arg |
mov byte [esi-1], 0 |
cmp al, 0 |
jnz skip_spaces |
dec esi |
skip_spaces: |
lodsb |
cmp al, 0 |
jz @f |
cmp al, ' ' |
jbe skip_spaces |
@@: dec esi |
ret |
clear_cmdline_end: |
mov ebx, [cmdline_pos] |
mov ecx, [cmdline_len] |
sub ecx, ebx |
push 13 |
pop eax |
imul ebx, 6 |
imul ecx, 6 |
inc ecx |
add ebx, cmdline_x_pos |
shl ebx, 16 |
or ebx, ecx |
mov ecx, cmdline_y_pos*10000h + cmdline_y_size |
mov edx, 0xFFFFFF |
int 40h |
ret |
draw_cmdline: |
xor ebx, ebx |
jmp @f |
draw_cmdline_end: |
mov ebx, [cmdline_pos] |
@@: |
mov esi, [cmdline_len] |
sub esi, ebx |
push 4 |
pop eax |
xor ecx, ecx |
lea edx, [cmdline+ebx] |
imul ebx, 6 |
add ebx, cmdline_x_pos |
shl ebx, 16 |
or ebx, cmdline_y_pos+1 |
int 40h |
ret |
put_message_nodraw: |
; in: esi->ASCIZ message |
mov edx, [messages_pos] |
.m: |
lea edi, [messages+edx] |
.l: |
lodsb |
cmp al, 0 |
jz .done |
call test_scroll |
cmp al, 10 |
jz .newline |
cmp al, '%' |
jnz @f |
cmp dword [esp], z1 |
jnz .format |
@@: |
stosb |
inc edx |
jmp .l |
.newline: |
push edx |
mov ecx, messages_width |
xor eax, eax |
xchg eax, edx |
div ecx |
xchg eax, edx |
pop edx |
test eax, eax |
jz .m |
sub edx, eax |
add edx, ecx |
jmp .m |
.done: |
mov [messages_pos], edx |
ret |
.format: |
; at moment all format specs must be %<digit>X |
lodsb ; get <digit> |
sub al, '0' |
movzx ecx, al |
lodsb |
pop eax |
pop ebp |
push eax |
; write number in ebp with ecx digits |
dec ecx |
shl ecx, 2 |
.writenibble: |
push ecx |
call test_scroll |
pop ecx |
mov eax, ebp |
shr eax, cl |
and al, 0xF |
cmp al, 10 |
sbb al, 69h |
das |
stosb |
inc edx |
sub ecx, 4 |
jns .writenibble |
jmp .l |
test_scroll: |
cmp edx, messages_width*messages_height |
jnz .ret |
push esi |
mov edi, messages |
lea esi, [edi+messages_width] |
mov ecx, (messages_height-1)*messages_width/4 |
rep movsd |
push eax |
mov al, ' ' |
push edi |
push messages_width |
pop ecx |
sub edx, ecx |
rep stosb |
pop edi |
pop eax |
pop esi |
.ret: ret |
put_message: |
call put_message_nodraw |
draw_messages: |
push 13 |
pop eax |
mov edx, 0xFFFFFF |
mov ebx, messages_x_pos*10000h+messages_x_size |
mov ecx, messages_y_pos*10000h+messages_y_size |
int 40h |
mov edx, messages |
push messages_width |
pop esi |
xor ecx, ecx |
mov al, 4 |
mov ebx, messages_x_pos*10000h+messages_y_pos |
@@: |
int 40h |
add edx, esi |
add ebx, 10 |
cmp edx, messages+messages_width*messages_height |
jb @b |
ret |
draw_cursor: |
push 38 |
pop eax |
mov ecx, cmdline_y_pos*10001h+cmdline_y_size-1 |
mov ebx, [cmdline_pos] |
imul ebx, 6 |
add ebx, cmdline_x_pos |
mov edx, ebx |
shl ebx, 16 |
or ebx, edx |
xor edx, edx |
int 40h |
ret |
hide_cursor: |
mov ebx, [cmdline_pos] |
push 13 |
pop eax |
imul ebx, 6 |
add ebx, cmdline_x_pos |
shl ebx, 16 |
inc ebx |
mov ecx, cmdline_y_pos*10000h + cmdline_y_size |
mov edx, 0xFFFFFF |
int 40h |
mov ebx, [cmdline_pos] |
cmp ebx, [cmdline_len] |
jae .ret |
mov al, 4 |
xor ecx, ecx |
lea edx, [cmdline+ebx] |
imul ebx, 6 |
add ebx, cmdline_x_pos |
shl ebx, 16 |
or ebx, cmdline_y_pos+1 |
push 1 |
pop esi |
int 40h |
.ret: |
ret |
redraw_title: |
push 13 |
pop eax |
mov edx, 0xFFFFFF |
mov ebx, title_x_pos*10000h + data_x_pos+data_x_size-title_x_pos |
mov ecx, title_y_pos*10000h + title_y_size |
int 40h |
draw_title: |
mov al, 38 |
mov ebx, (data_x_pos-2)*10000h + title_x_pos-5 |
mov ecx, (title_y_pos+5)*10001h |
xor edx, edx |
int 40h |
push NoPrgLoaded_len |
pop esi |
cmp [debuggee_pid], 0 |
jz @f |
mov esi, [prgname_len] |
@@: imul ebx, esi, 6 |
add ebx, title_x_pos+4 |
shl ebx, 16 |
mov bx, data_x_pos+data_x_size-10-5-6*7 |
cmp [bSuspended], 0 |
jz @f |
add ebx, 6 |
@@: |
int 40h |
mov ebx, (data_x_pos+data_x_size-10+4)*0x10000 + data_x_pos+data_x_size+2 |
int 40h |
mov al, 4 |
mov ebx, title_x_pos*10000h+title_y_pos |
xor ecx, ecx |
mov edx, NoPrgLoaded_str |
cmp [debuggee_pid], 0 |
jz @f |
mov edx, [prgname_ptr] |
@@: |
int 40h |
cmp [debuggee_pid], 0 |
jz .nodebuggee |
mov ebx, (data_x_pos+data_x_size-10-6*7)*10000h + title_y_pos |
mov edx, aRunning |
push 7 |
pop esi |
cmp [bSuspended], 0 |
jz @f |
add ebx, 6*10000h |
mov edx, aPaused |
dec esi |
@@: |
int 40h |
ret |
.nodebuggee: |
mov al, 38 |
mov ebx, (data_x_pos+data_x_size-10-6*7-5)*0x10000 + data_x_pos+data_x_size+2 |
mov ecx, (title_y_pos+5)*10001h |
xor edx, edx |
jmp @b |
draw_register: |
; in: esi->value, edx->string, ecx=string len, ebx=coord |
push edx |
push ecx |
push esi |
mov eax, esi |
mov esi, ecx |
; color |
mov ecx, 808080h |
cmp [debuggee_pid], 0 |
jz .cd |
cmp [bSuspended], 0 |
jz .cd |
xor ecx, ecx |
mov edi, [eax] |
cmp dword [eax+oldcontext-context], edi |
jz .cd |
mov ecx, 0x00AA00 |
.cd: |
push 4 |
pop eax |
int 40h |
imul esi, 60000h |
lea edx, [ebx+esi] |
mov al, 47 |
mov ebx, 80101h |
mov esi, ecx |
pop ecx |
int 40h |
lea ebx, [edx+60000h*18] |
mov esi, ecx |
pop ecx |
pop edx |
add edx, ecx |
ret |
draw_flag: |
movzx edi, byte [edx+7] |
bt [_eflags], edi |
jc .on |
or byte [edx], 20h |
jmp .onoff |
.on: |
and byte [edx], not 20h |
.onoff: |
mov ecx, 808080h |
cmp [debuggee_pid], 0 |
jz .doit |
cmp [bSuspended], 0 |
jz .doit |
xor ecx, ecx |
bt [_eflags], edi |
lahf |
bt dword [_eflags + oldcontext - context], edi |
rcl ah, 1 |
test ah, 3 |
jp .doit |
mov ecx, 0x00AA00 |
.doit: |
mov ah, 0 |
int 40h |
ret |
redraw_registers: |
push 13 |
pop eax |
mov edx, 0xFFFFFF |
mov ebx, data_x_pos*10000h + data_x_size |
mov ecx, registers_y_pos*10000h + registers_y_size |
int 40h |
draw_registers: |
mov esi, _eax |
push 4 |
pop ecx |
mov edx, regs_strs |
mov ebx, registers_x_pos*10000h+registers_y_pos |
call draw_register |
add esi, _ebx-_eax |
call draw_register |
add esi, _ecx-_ebx |
call draw_register |
add esi, _edx-_ecx |
call draw_register |
mov ebx, registers_x_pos*10000h+registers_y_pos+10 |
add esi, _esi-_edx |
call draw_register |
add esi, _edi-_esi |
call draw_register |
add esi, _ebp-_edi |
call draw_register |
add esi, _esp-_ebp |
call draw_register |
mov ebx, registers_x_pos*10000h+registers_y_pos+20 |
add esi, _eip-_esp |
call draw_register |
mov cl, 7 |
add esi, _eflags-_eip |
call draw_register |
mov al, 4 |
mov ecx, 808080h |
cmp [debuggee_pid], 0 |
jz @f |
cmp [bSuspended], 0 |
jz @f |
xor ecx, ecx |
@@: |
mov edx, aColon |
xor esi, esi |
inc esi |
mov ebx, (registers_x_pos+37*6)*10000h + registers_y_pos+20 |
int 40h |
mov edx, flags |
@@: |
add ebx, 2*6*10000h |
call draw_flag |
inc edx |
cmp dl, flags_bits and 0xFF |
jnz @b |
ret |
redraw_dump: |
push 13 |
pop eax |
mov edx, 0xFFFFFF |
mov ebx, data_x_pos*10000h + data_x_size |
mov ecx, dump_y_pos*10000h + dump_y_size |
int 40h |
draw_dump: |
; addresses |
mov al, 47 |
mov ebx, 80100h |
mov edx, data_x_pos*10000h + dump_y_pos |
mov ecx, [dumppos] |
mov esi, 808080h |
cmp [debuggee_pid], 0 |
jz @f |
cmp [bSuspended], 0 |
jz @f |
xor esi, esi |
@@: |
int 40h |
add ecx, 10h |
add edx, 10 |
cmp dl, dump_y_pos + dump_y_size |
jb @b |
; hex dump of data |
mov ebx, 20101h |
mov ecx, dumpdata |
push ecx |
xor edi, edi |
mov edx, (data_x_pos+12*6)*10000h + dump_y_pos |
cmp [dumpread], edi |
jz .hexdumpdone1 |
.hexdumploop1: |
int 40h |
add edx, 3*6*10000h |
inc ecx |
inc edi |
test edi, 15 |
jz .16 |
test edi, 7 |
jnz @f |
add edx, 2*6*10000h - 10 + 6*(3*10h+2)*10000h |
.16: |
add edx, 10 - 6*(3*10h+2)*10000h |
@@: |
cmp edi, [dumpread] |
jb .hexdumploop1 |
.hexdumpdone1: |
mov al, 4 |
mov ecx, esi |
mov ebx, edx |
push 2 |
pop esi |
mov edx, aQuests |
.hexdumploop2: |
cmp edi, dump_height*10h |
jae .hexdumpdone2 |
int 40h |
add ebx, 3*6*10000h |
inc edi |
test edi, 15 |
jz .16x |
test edi, 7 |
jnz .hexdumploop2 |
add ebx, 2*6*10000h - 10 + 6*(3*10h+2)*10000h |
.16x: |
add ebx, 10 - 6*(3*10h+2)*10000h |
jmp .hexdumploop2 |
.hexdumpdone2: |
dec esi |
; colon, minus signs |
mov ebx, (data_x_pos+8*6)*10000h + dump_y_pos |
mov edx, aColon |
@@: |
int 40h |
add ebx, 10 |
cmp bl, dump_y_pos+dump_height*10 |
jb @b |
mov ebx, (data_x_pos+(12+3*8)*6)*10000h + dump_y_pos |
mov edx, aMinus |
@@: |
int 40h |
add ebx, 10 |
cmp bl, dump_y_pos+dump_height*10 |
jb @b |
; ASCII data |
mov ebx, (data_x_pos+(12+3*10h+2+2)*6)*10000h + dump_y_pos |
mov edi, dump_height*10h |
pop edx |
.asciiloop: |
push edx |
cmp byte [edx], 20h |
jae @f |
mov edx, aPoint |
@@: |
int 40h |
pop edx |
inc edx |
add ebx, 6*10000h |
dec edi |
jz .asciidone |
test edi, 15 |
jnz .asciiloop |
add ebx, 10 - 6*10h*10000h |
jmp .asciiloop |
.asciidone: |
ret |
redraw_disasm: |
push 13 |
pop eax |
mov edx, 0xFFFFFF |
mov ebx, data_x_pos*10000h + data_x_size |
mov ecx, (disasm_y_pos-1)*10000h + (disasm_y_size+1) |
int 40h |
draw_disasm: |
mov eax, [disasm_start_pos] |
mov [disasm_cur_pos], eax |
and [disasm_cur_str], 0 |
.loop: |
push [disasm_cur_pos] |
call disasm_instr |
pop ebp |
jc .loopend |
xor esi, esi ; default color: black |
mov ebx, data_x_pos*10000h + data_x_size |
mov ecx, [disasm_cur_str] |
imul ecx, 10*10000h |
add ecx, (disasm_y_pos-1)*10000h + 10 |
mov eax, ebp |
pushad |
call find_enabled_breakpoint |
popad |
jnz .nored |
push 13 |
pop eax |
mov edx, 0xFF0000 |
int 40h |
.nored: |
mov eax, [_eip] |
cmp eax, ebp |
jnz .noblue |
push 13 |
pop eax |
mov edx, 0x0000FF |
int 40h |
mov esi, 0xFFFFFF ; on blue bgr, use white color |
.noblue: |
push 47 |
pop eax |
mov ebx, 80100h |
mov edx, [disasm_cur_str] |
imul edx, 10 |
add edx, data_x_pos*10000h + disasm_y_pos |
mov ecx, ebp |
int 40h |
mov al, 4 |
lea ebx, [edx+8*6*10000h] |
mov ecx, esi |
push 1 |
pop esi |
mov edx, aColon |
int 40h |
push 9 |
pop edi |
lea edx, [ebx+2*6*10000h] |
mov esi, ecx |
mov al, 47 |
mov ebx, 20101h |
mov ecx, ebp |
sub ecx, [disasm_start_pos] |
add ecx, disasm_buffer |
.drawhex: |
int 40h |
add edx, 6*3*10000h |
inc ecx |
inc ebp |
cmp ebp, [disasm_cur_pos] |
jae .hexdone |
dec edi |
jnz .drawhex |
push esi |
mov esi, [disasm_cur_pos] |
dec esi |
cmp esi, ebp |
pop esi |
jbe .drawhex |
mov al, 4 |
lea ebx, [edx-6*10000h] |
mov ecx, esi |
push 3 |
pop esi |
mov edx, aDots |
int 40h |
mov esi, ecx |
.hexdone: |
xor eax, eax |
mov edi, disasm_string |
mov edx, edi |
or ecx, -1 |
repnz scasb |
not ecx |
dec ecx |
xchg ecx, esi |
mov ebx, [disasm_cur_str] |
imul ebx, 10 |
add ebx, (data_x_pos+6*40)*10000h+disasm_y_pos |
mov al, 4 |
int 40h |
inc [disasm_cur_str] |
cmp [disasm_cur_str], disasm_height |
jb .loop |
.loopend: |
ret |
update_disasm_eip: |
; test if instruction at eip is showed |
mov ecx, disasm_height |
mov eax, [disasm_start_pos] |
mov [disasm_cur_pos], eax |
@@: |
mov eax, [_eip] |
cmp [disasm_cur_pos], eax |
jz redraw_disasm |
push ecx |
call disasm_instr |
pop ecx |
jc @f |
loop @b |
@@: |
update_disasm_eip_force: |
mov eax, [_eip] |
mov [disasm_start_pos], eax |
update_disasm: |
cmp [debuggee_pid], 0 |
jz .no |
push 69 |
pop eax |
push 6 |
pop ebx |
mov ecx, [debuggee_pid] |
mov edi, disasm_buffer |
mov edx, 256 |
mov esi, [disasm_start_pos] |
int 40h |
cmp eax, -1 |
jnz @f |
mov esi, read_mem_err |
call put_message |
.no: |
xor eax, eax |
@@: |
mov [disasm_buf_size], eax |
call restore_from_breaks |
jmp redraw_disasm |
draw_window: |
; start redraw |
push 12 |
pop eax |
push 1 |
pop ebx |
int 40h |
; define window |
xor eax, eax |
mov ebx, wnd_x_size |
mov ecx, wnd_y_size |
mov edx, 3FFFFFFh |
int 40h |
; caption |
mov al, 4 |
mov ecx, 0xFFFFFF |
mov ebx, 80008h |
mov edx, caption_str |
push caption_len |
pop esi |
int 40h |
; messages frame |
mov al, 38 |
mov ebx, (messages_x_pos-2)*10000h + (messages_x_pos+messages_x_size+2) |
push ebx |
mov ecx, (messages_y_pos-2)*10001h |
xor edx, edx |
int 40h |
mov ecx, (messages_y_pos+messages_y_size+2)*10001h |
int 40h |
mov ebx, (messages_x_pos-2)*10001h |
push ebx |
mov ecx, (messages_y_pos-2)*10000h + (messages_y_pos+messages_y_size+2) |
int 40h |
mov ebx, (messages_x_pos+messages_x_size+2)*10001h |
push ebx |
int 40h |
; command line frame |
mov ecx, (cmdline_y_pos-2)*10000h + (cmdline_y_pos+cmdline_y_size+2) |
pop ebx |
int 40h |
pop ebx |
int 40h |
pop ebx |
mov ecx, (cmdline_y_pos+cmdline_y_size+2)*10001h |
int 40h |
mov ecx, (cmdline_y_pos-2)*10001h |
int 40h |
; messages |
call draw_messages |
; command line & cursor |
call draw_cmdline |
call draw_cursor |
; title & registers & dump & disasm |
mov al, 38 |
mov ebx, (data_x_pos-2)*10001h |
mov ecx, (title_y_pos+5)*10000h + (messages_y_pos-2) |
int 40h |
mov ebx, (data_x_pos+data_x_size+2)*10001h |
int 40h |
mov ebx, (data_x_pos-2)*10000h + (data_x_pos+data_x_size+2) |
mov ecx, (dump_y_pos-3)*10001h |
int 40h |
mov ecx, (disasm_y_pos-4)*10001h |
int 40h |
call draw_title |
call draw_registers |
call draw_dump |
call draw_disasm |
; end redraw |
mov al, 12 |
push 2 |
pop ebx |
int 40h |
ret |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DEBUGGING ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
OnHelp: |
mov esi, help_msg |
mov edi, [curarg] |
cmp byte [edi], 0 |
jz .x |
mov esi, help_groups |
call find_cmd |
jc .nocmd |
mov esi, [esi+12] |
.x: |
jmp put_message |
.nocmd: |
mov esi, aUnknownCommand |
jmp .x |
OnQuit: |
xor eax, eax |
dec eax |
int 40h |
get_new_context: |
mov esi, context |
mov edi, oldcontext |
mov ecx, 10 |
rep movsd |
get_context: |
push 1 |
pop ebx |
push 69 |
pop eax |
mov ecx, [debuggee_pid] |
mov esi, context |
push 28h |
pop edx |
int 40h |
ret |
set_context: |
push 2 |
pop ebx |
push 69 |
pop eax |
mov ecx, [debuggee_pid] |
mov esi, context |
push 28h |
pop edx |
int 40h |
ret |
get_dump: |
mov edi, dumpdata |
mov esi, [edi-4] |
mov edx, dump_height*10h |
mov ecx, edx |
xor eax, eax |
push edi |
rep stosb |
pop edi |
mov ecx, [debuggee_pid] |
mov al, 69 |
push 6 |
pop ebx |
int 40h |
cmp eax, -1 |
jnz @f |
mov esi, read_mem_err |
call put_message |
xor eax, eax |
@@: |
mov [edi-8], eax |
; call restore_from_breaks |
; ret |
restore_from_breaks: |
; in: edi=buffer,eax=size,esi=address |
mov ebx, breakpoints |
@@: |
test byte [ebx+4], 1 |
jz .cont ; ignore invalid |
test byte [ebx+4], 2 or 8 |
jnz .cont ; ignore disabled and memory breaks |
mov ecx, [ebx] |
sub ecx, esi |
cmp ecx, eax |
jae .cont |
mov dl, [ebx+5] |
mov [edi+ecx], dl |
.cont: |
add ebx, 6 |
cmp ebx, breakpoints+breakpoints_n*6 |
jb @b |
ret |
OnLoad: |
mov esi, [curarg] |
OnLoadInit: |
mov edi, loadname |
or [prgname_len], -1 |
mov [prgname_ptr], edi |
.copyname: |
lodsb |
stosb |
inc [prgname_len] |
cmp al, '/' |
jnz @f |
or [prgname_len], -1 |
mov [prgname_ptr], edi |
@@: |
cmp al, ' ' |
ja .copyname |
mov byte [edi-1], 0 |
and [load_params], 0 |
dec esi |
call skip_spaces |
cmp al, 0 |
jz @f |
mov [load_params], esi |
@@: |
and [dumppos], 0 |
do_reload: |
push 18 |
pop eax |
push 7 |
pop ebx |
int 40h |
mov [dbgwnd], eax |
xchg ecx, eax |
push 70 |
pop eax |
mov ebx, fn70_load_block |
int 40h |
test eax, eax |
jns .load_ok |
.load_err: |
push eax |
mov esi, load_err_msg |
call put_message |
pop eax |
not eax |
cmp eax, 0x20 |
jae .unk_err |
mov esi, [load_err_msgs+eax*4] |
test esi, esi |
jnz put_message |
.unk_err: |
mov esi, unk_err_msg |
inc eax |
push eax |
call put_message_nodraw |
jmp draw_messages |
.load_ok: |
mov [debuggee_pid], eax |
mov [bSuspended], 1 |
push ecx |
call get_context |
mov edi, oldcontext |
mov ecx, 10 |
rep movsd |
; activate debugger window |
pop ecx |
mov bl, 3 |
push 18 |
pop eax |
int 40h |
call redraw_title |
call redraw_registers |
call get_dump |
call redraw_dump |
call update_disasm_eip_force |
mov esi, load_succ_msg |
push [debuggee_pid] |
call put_message_nodraw |
call draw_messages |
; now test for packed progs |
cmp [disasm_buf_size], 100h |
jz @f |
ret |
@@: |
mov esi, mxp_nrv_sig |
mov ebp, disasm_buffer |
mov edi, ebp |
push 3 |
pop ecx |
repz cmpsb |
jnz .not_mxp_nrv |
cmpsb |
mov cl, mxp_nrv_sig_size-4 |
repz cmpsb |
mov esi, mxp_nrv_name |
jz .packed |
.not_mxp_nrv: |
mov esi, mxp_sig |
mov edi, ebp |
mov cl, mxp_sig_size |
repz cmpsb |
mov esi, mxp_name |
jz .packed |
.not_mxp: |
mov esi, mxp_lzo_sig1 |
mov edi, ebp |
mov cl, mxp_lzo_sig1_size |
repz cmpsb |
mov esi, mxp_lzo_name |
jz .packed |
mov esi, mxp_lzo_sig2 |
mov edi, ebp |
mov cl, 8 |
repz cmpsb |
jnz .not_mxp_lzo |
cmpsb |
mov cl, mxp_lzo_sig2_size - 9 |
repz cmpsb |
mov esi, mxp_lzo_name |
jz .packed |
.not_mxp_lzo: |
mov esi, mtappack_name |
cmp dword [ebp], 0xBF5E246A |
jnz .not_mtappack |
cmp dword [ebp+8], 0xEC4E8B57 |
jnz .not_mtappack1 |
cmp dword [ebp+12], 0x8D5EA4F3 |
jnz .not_mtappack1 |
cmp byte [ebp+12h], 0xE9 |
jz .packed |
.not_mtappack1: |
cmp word [ebp+8], 0xB957 |
jnz .not_mtappack |
cmp dword [ebp+14], 0x575EA4F3 |
jnz .not_mtappack2 |
cmp byte [ebp+17h], 0xE9 |
jz .packed |
.not_mtappack2: |
cmp dword [ebp+14], 0x5F8DA4F3 |
jnz .not_mtappack3 |
cmp word [ebp+18], 0xE9FC |
jz .packed |
.not_mtappack3: |
cmp word [ebp+14], 0xA4F3 |
jnz .not_mtappack |
cmp byte [ebp+15h], 0xE9 |
jz .packed |
.not_mtappack: |
ret |
.packed: |
push esi |
mov esi, aPacked1 |
call put_message_nodraw |
pop esi |
call put_message_nodraw |
mov esi, aPacked2 |
call put_message |
call hide_cursor |
push 40 |
pop eax |
push 7 |
pop ebx |
int 40h |
.wait: |
push 10 |
pop eax |
int 40h |
dec eax |
jz .redraw |
dec eax |
jz .key |
or eax, -1 |
int 40h |
.redraw: |
call draw_window |
call hide_cursor |
jmp .wait |
.key: |
mov al, 2 |
int 40h |
cmp ah, 'y' |
jz .yes |
cmp ah, 'Y' |
jz .yes |
cmp ah, 0xD |
jz .yes |
cmp ah, 'n' |
jz .no |
cmp ah, 'N' |
jnz .wait |
.no: |
push 40 |
pop eax |
mov ebx, 0x107 |
int 40h |
call draw_cursor |
mov esi, aN_str |
jmp put_message |
.yes: |
push 40 |
pop eax |
mov ebx, 0x107 |
int 40h |
call draw_cursor |
mov esi, aY_str |
call put_message |
call OnUnpack |
ret |
mxp_nrv_sig: |
xor eax, eax |
mov ecx, 0x95 ; 0xA1 for programs with parameters |
mov [eax], ecx |
add ecx, [eax+24h] |
push 40h |
pop esi |
mov edi, [eax+20h] |
push edi |
rep movsb |
jmp dword [esp] |
pop esi |
add esi, [eax] |
xor edi, edi |
mxp_nrv_sig_size = $ - mxp_nrv_sig |
mxp_sig: |
mov ecx, 1CBh |
push 46h |
pop esi |
mov edi, [20h] |
rep movsb |
mov ecx, [24h] |
rep movsb |
jmp dword [20h] |
mov eax, [20h] |
add eax, 1CBh |
push eax |
push dword [24h] |
push 0 |
push 8 |
call $+0x25 |
mxp_sig_size = $ - mxp_sig |
mxp_lzo_sig1: |
xor eax, eax |
mov ebp, 0FFh |
mov ecx, 175h |
mov [eax], ecx |
add ecx, [eax+24h] |
push 45h |
pop esi |
mov edi, [eax+20h] |
push edi |
rep movsb |
jmp dword [esp] |
pop ebx |
add ebx, [eax] |
xor edi, edi |
cmp byte [ebx], 11h |
jbe $+0x1A |
mxp_lzo_sig1_size = $ - mxp_lzo_sig1 |
mxp_lzo_sig2: |
xor eax, eax |
mov ebp, 0FFh |
mov ecx, 188h ; or 177h |
mov [eax], ecx |
add ecx, [eax+24h] |
push 44h |
pop esi |
mov edi, [eax+20h] |
rep movsb |
jmp dword [eax+20h] |
mov ebx, [eax+20h] |
add ebx, [eax] |
mxp_lzo_sig2_size = $ - mxp_lzo_sig2 |
OnReload: |
cmp [debuggee_pid], 0 |
jnz terminate_reload |
mov esi, need_debuggee |
cmp byte [loadname], 0 |
jnz do_reload |
jz put_message |
terminate_reload: |
mov [bReload], 1 |
OnTerminate: |
mov ecx, [debuggee_pid] |
push 8 |
pop ebx |
push 69 |
pop eax |
int 40h |
ret |
AfterSuspend: |
mov [bSuspended], 1 |
call get_new_context |
call get_dump |
call redraw_title |
call redraw_registers |
call redraw_dump |
call update_disasm_eip |
ret |
OnSuspend: |
mov ecx, [debuggee_pid] |
push 4 |
pop ebx |
push 69 |
pop eax |
int 40h |
call AfterSuspend |
mov esi, aSuspended |
jmp put_message |
DoResume: |
mov ecx, [debuggee_pid] |
push 5 |
pop ebx |
push 69 |
pop eax |
int 40h |
mov [bSuspended], 0 |
ret |
OnResume: |
mov esi, [curarg] |
cmp byte [esi], 0 |
jz GoOn |
call calc_expression |
jc .ret |
mov eax, ebp |
push eax |
call find_enabled_breakpoint |
pop eax |
jz GoOn |
mov bl, 5 ; valid enabled one-shot |
call add_breakpoint |
jnc GoOn |
mov esi, aBreakpointLimitExceeded |
call put_message |
.ret: |
ret |
GoOn: |
; test for enabled breakpoint at eip |
mov eax, [_eip] |
call find_enabled_breakpoint |
jnz .nobreak |
; temporarily disable breakpoint, make step, enable breakpoint, continue |
inc eax |
mov [temp_break], eax |
mov [bAfterGo], 1 |
dec eax |
call disable_breakpoint |
call get_context |
or byte [_eflags+1], 1 ; set TF |
call set_context |
and byte [_eflags+1], not 1 |
call DoResume |
ret |
.nobreak: |
call DoResume |
call redraw_title |
call redraw_registers |
call redraw_dump |
ret |
OnDetach: |
mov ecx, [debuggee_pid] |
push 3 |
pop ebx |
push 69 |
pop eax |
int 40h |
and [debuggee_pid], 0 |
call redraw_title |
call redraw_registers |
call redraw_dump |
mov esi, aContinued |
jmp put_message |
after_go_exception: |
push eax |
mov eax, [temp_break] |
dec eax |
push esi |
call enable_breakpoint |
; in any case, clear TF and RF |
call get_new_context |
and [_eflags], not 10100h ; clear TF,RF |
call set_context |
xor edx, edx |
mov [temp_break], edx |
xchg dl, [bAfterGo] |
pop esi |
pop eax |
cmp dl, 2 |
jnz @f |
lodsd |
push esi |
call get_dump |
jmp exception.done |
@@: test eax, eax |
jz .notint1 |
; if exception is result of single step, simply ignore it and continue |
test dword [esi], 0xF |
jnz dbgmsgstart.5 |
lodsd |
push esi |
mov esi, oldcontext |
mov edi, context |
mov ecx, 28h/4 |
rep movsd |
call DoResume |
jmp dbgmsgend |
.notint1: |
; in other case, work as without temp_break |
lodsd |
push esi |
push eax |
jmp exception.4 |
.notour: |
debugmsg: |
neg [dbgbufsize] |
mov esi, dbgbuf |
dbgmsgstart: |
lodsd |
; push eax esi |
; push dword [esi] |
; mov esi, dbgmsg_str |
; call put_message_nodraw |
; pop esi eax |
add esi, 4 |
dec eax |
jz exception |
dec eax |
jz terminated |
mov [bSuspended], 1 |
cmp [bAfterGo], 0 |
jnz after_go_exception |
push esi |
call get_new_context |
and [_eflags], not 10100h ; clear TF,RF |
call set_context |
pop esi |
.5: |
push esi |
call get_dump |
pop esi |
lodsd |
xor ecx, ecx |
.6: |
bt eax, ecx |
jnc .7 |
mov ebx, [drx_break+ecx*4] |
test ebx, ebx |
jz .7 |
pushad |
dec ebx |
push ebx |
mov esi, aBreakStop |
call put_message_nodraw |
popad |
.7: |
inc ecx |
cmp cl, 4 |
jb .6 |
push esi |
jmp exception.done_draw |
terminated: |
push esi |
mov esi, terminated_msg |
call put_message |
and [debuggee_pid], 0 |
and [temp_break], 0 |
mov [bAfterGo], 0 |
xor eax, eax |
mov ecx, breakpoints_n*6/4+4 |
mov edi, breakpoints |
rep stosd |
cmp [bReload], 1 |
sbb [bReload], -1 |
jmp exception.done |
exception: |
mov [bSuspended], 1 |
cmp [bAfterGo], 0 |
jnz after_go_exception |
lodsd |
push esi |
push eax |
call get_new_context |
and [_eflags], not 10100h ; clear TF,RF |
call set_context |
.4: |
call get_dump |
pop eax |
; int3 command generates exception 0D, #GP |
push eax |
cmp al, 0Dh |
jnz .notdbg |
; check for 0xCC byte at eip |
push 0 |
push 69 |
pop eax |
push 6 |
pop ebx |
mov ecx, [debuggee_pid] |
mov edi, esp |
mov esi, [_eip] |
push 1 |
pop edx |
int 40h |
pop eax |
cmp al, 0xCC |
jnz .notdbg |
; this is either dbg breakpoint or int3 cmd in debuggee |
mov eax, [_eip] |
call find_enabled_breakpoint |
jnz .user_int3 |
; dbg breakpoint; clear if one-shot |
pop ecx |
push eax |
mov esi, aBreakStop |
test byte [edi+4], 4 |
jz .put_msg_eax |
pop ecx |
call clear_breakpoint |
jmp .done |
.user_int3: |
mov eax, [_eip] |
inc [_eip] |
pop ecx |
push eax |
call set_context |
mov esi, aUserBreak |
jmp .put_msg_eax |
.notdbg: |
mov esi, aException |
.put_msg_eax: |
call put_message_nodraw |
.done_draw: |
call draw_messages |
.done: |
push 18 |
pop eax |
push 3 |
pop ebx |
mov ecx, [dbgwnd] |
int 40h ; activate dbg window |
call redraw_title |
call redraw_registers |
call redraw_dump |
call update_disasm_eip |
dbgmsgend: |
pop esi |
mov ecx, [dbgbuflen] |
add ecx, dbgbuf |
cmp esi, ecx |
jnz dbgmsgstart |
and [dbgbuflen], 0 |
neg [dbgbufsize] |
cmp [bReload], 2 |
jnz @f |
mov [bReload], 0 |
call do_reload |
@@: |
jmp waitevent |
CtrlF7: |
cmp [debuggee_pid], 0 |
jz .no |
call OnStep |
.no: |
jmp waitevent |
CtrlF8: |
cmp [debuggee_pid], 0 |
jz CtrlF7.no |
call OnProceed |
jmp CtrlF7.no |
OnStep: |
cmp [bSuspended], 0 |
jz .running |
call get_context |
or byte [_eflags+1], 1 ; set TF |
call set_context |
and byte [_eflags+1], not 1 |
; if instruction at eip is "int xx", set one-shot breakpoint immediately after |
mov eax, [_eip] |
call find_enabled_breakpoint |
jnz @f |
cmp byte [edi+5], 0xCD |
jz .int |
@@: |
push 0 |
push 69 |
pop eax |
push 6 |
pop ebx |
mov ecx, [debuggee_pid] |
push 3 |
pop edx |
mov edi, esp |
mov esi, [_eip] |
int 40h |
cmp eax, edx |
pop eax |
jnz .doit |
cmp al, 0xCD |
jz .int |
; resume process |
.doit: |
call GoOn |
cmp [bAfterGo], 0 |
jz @f |
mov [bAfterGo], 2 |
@@: |
ret |
.int: |
mov eax, [_eip] |
inc eax |
inc eax |
push eax |
call find_enabled_breakpoint |
pop eax |
jz .doit |
; there is no enabled breakpoint yet; set temporary breakpoint |
mov bl, 5 |
call add_breakpoint |
jmp .doit |
.running: |
mov esi, aRunningErr |
jmp put_message |
OnProceed: |
cmp [bSuspended], 0 |
jz OnStep.running |
mov esi, [_eip] |
@@: |
call get_byte_nobreak |
jc OnStep |
inc esi |
; skip prefixes |
call is_prefix |
jz @b |
cmp al, 0xE8 ; call |
jnz @f |
add esi, 4 |
jmp .doit |
@@: ; A4,A5 = movs, A6,A7=cmps |
cmp al, 0xA4 |
jb @f |
cmp al, 0xA8 |
jb .doit |
@@: ; AA,AB=stos, AC,AD=lods, AE,AF=scas |
cmp al, 0xAA |
jb @f |
cmp al, 0xB0 |
jb .doit |
@@: ; E0=loopnz,E1=loopz,E2=loop |
cmp al, 0xE0 |
jb .noloop |
cmp al, 0xE2 |
ja .noloop |
inc esi |
jmp .doit |
.noloop: ; FF /2 = call |
cmp al, 0xFF |
jnz OnStep |
call get_byte_nobreak |
jc OnStep |
inc esi |
mov cl, al |
and al, 00111000b |
cmp al, 00010000b |
jnz OnStep |
; skip instruction |
mov al, cl |
and eax, 7 |
shr cl, 6 |
jz .mod0 |
jp .doit |
cmp al, 4 |
jnz @f |
inc esi |
@@: |
inc esi |
dec cl |
jz @f |
add esi, 3 |
@@: |
jmp .doit |
.mod0: |
cmp al, 4 |
jnz @f |
call get_byte_nobreak |
jc OnStep |
inc esi |
and al, 7 |
@@: |
cmp al, 5 |
jnz .doit |
add esi, 4 |
.doit: |
; insert one-shot breakpoint at esi and resume |
call get_byte_nobreak |
jc OnStep |
mov eax, esi |
call find_enabled_breakpoint |
jz .ret |
mov eax, esi |
mov bl, 5 |
call add_breakpoint |
jmp OnStep.doit |
.ret: |
ret |
get_byte_nobreak: |
mov eax, esi |
call find_enabled_breakpoint |
jnz .nobreak |
mov al, [edi+5] |
clc |
ret |
.nobreak: |
push 69 |
pop eax |
push 6 |
pop ebx |
mov ecx, [debuggee_pid] |
xor edx, edx |
push edx |
inc edx |
mov edi, esp |
int 40h |
dec eax |
clc |
jz @f |
stc |
@@: pop eax |
ret |
is_prefix: |
cmp al, 0x64 ; fs: |
jz .ret |
cmp al, 0x65 ; gs: |
jz .ret |
cmp al, 0x66 ; use16/32 |
jz .ret |
cmp al, 0x67 ; addr16/32 |
jz .ret |
cmp al, 0xF0 ; lock |
jz .ret |
cmp al, 0xF2 ; repnz |
jz .ret |
cmp al, 0xF3 ; rep(z) |
jz .ret |
cmp al, 0x2E ; cs: |
jz .ret |
cmp al, 0x36 ; ss: |
jz .ret |
cmp al, 0x3E ; ds: |
jz .ret |
cmp al, 0x26 ; es: |
.ret: ret |
token_end equ 1 |
token_reg equ 2 |
token_hex equ 3 |
token_add equ 4 |
token_sub equ 5 |
token_mul equ 6 |
token_div equ 7 |
token_lp equ 8 |
token_rp equ 9 |
token_err equ -1 |
is_hex_digit: |
cmp al, '0' |
jb .no |
cmp al, '9' |
jbe .09 |
cmp al, 'A' |
jb .no |
cmp al, 'F' |
jbe .AF |
cmp al, 'a' |
jb .no |
cmp al, 'f' |
jbe .af |
.no: |
stc |
ret |
.09: |
sub al, '0' |
; clc |
ret |
.AF: |
sub al, 'A'-10 |
; clc |
ret |
.af: |
sub al, 'a'-10 |
; clc |
ret |
find_reg: |
mov edi, reg_table |
.findreg: |
movzx ecx, byte [edi] |
stc |
jecxz .regnotfound |
inc edi |
push esi edi ecx |
@@: |
lodsb |
or al, 20h |
scasb |
loopz @b |
pop ecx edi esi |
lea edi, [edi+ecx+1] |
jnz .findreg |
movzx edi, byte [edi-1] |
add esi, ecx |
.regnotfound: |
ret |
expr_get_token: |
lodsb |
cmp al, 0 |
jz .end_token |
cmp al, ' ' |
jbe expr_get_token |
cmp al, '+' |
jz .add |
cmp al, '-' |
jz .sub |
cmp al, '*' |
jz .mul |
cmp al, '/' |
jz .div |
cmp al, '(' |
jz .lp |
cmp al, ')' |
jnz .notsign |
.rp: |
mov al, token_rp |
ret |
.div: |
mov al, token_div |
ret |
.end_token: |
mov al, token_end |
ret |
.add: |
mov al, token_add |
ret |
.sub: |
mov al, token_sub |
ret |
.mul: |
mov al, token_mul |
ret |
.lp: |
mov al, token_lp |
ret |
.notsign: |
dec esi |
call find_reg |
jc .regnotfound |
mov al, token_reg |
ret |
.regnotfound: |
; test for hex number |
xor ecx, ecx |
xor edi, edi |
xor eax, eax |
@@: |
lodsb |
call is_hex_digit |
jc @f |
shl edi, 4 |
or edi, eax |
inc ecx |
jmp @b |
@@: |
dec esi |
jecxz .err |
cmp ecx, 8 |
ja .err |
mov al, token_hex |
ret |
.err: |
mov al, token_err |
mov esi, aParseError |
ret |
expr_read2: |
cmp al, token_hex |
jz .hex |
cmp al, token_reg |
jz .reg |
cmp al, token_lp |
jz .lp |
mov al, token_err |
mov esi, aParseError |
ret |
.hex: |
mov ebp, edi |
.ret: |
jmp expr_get_token |
.reg: |
cmp edi, 24 |
jz .eip |
sub edi, 4 |
jb .8lo |
sub edi, 4 |
jb .8hi |
sub edi, 8 |
jb .16 |
mov ebp, [_eax+edi*4] |
jmp .ret |
.16: |
movzx ebp, word [_eax+(edi+8)*4] |
jmp .ret |
.8lo: |
movzx ebp, byte [_eax+(edi+4)*4] |
jmp .ret |
.8hi: |
movzx ebp, byte [_eax+(edi+4)*4+1] |
jmp .ret |
.eip: |
mov ebp, [_eip] |
jmp .ret |
.lp: |
call expr_get_token |
call expr_read0 |
cmp al, token_err |
jz @f |
cmp al, token_rp |
jz expr_get_token |
mov al, token_err |
mov esi, aParseError |
@@: ret |
expr_read1: |
call expr_read2 |
.1: |
cmp al, token_mul |
jz .mul |
cmp al, token_div |
jz .div |
ret |
.mul: |
push ebp |
call expr_get_token |
call expr_read2 |
pop edx |
; ebp := edx*ebp |
imul ebp, edx |
jmp .1 |
.div: |
push ebp |
call expr_get_token |
call expr_read2 |
pop edx |
; ebp := edx/ebp |
test ebp, ebp |
jz .div0 |
push eax |
xor eax, eax |
xchg eax, edx |
div ebp |
xchg eax, ebp |
pop eax |
jmp .1 |
.div0: |
mov al, token_err |
mov esi, aDivByZero |
ret |
expr_read0: |
xor ebp, ebp |
cmp al, token_add |
jz .add |
cmp al, token_sub |
jz .sub |
call expr_read1 |
.1: |
cmp al, token_add |
jz .add |
cmp al, token_sub |
jz .sub |
ret |
.add: |
push ebp |
call expr_get_token |
call expr_read1 |
pop edx |
; ebp := edx+ebp |
add ebp, edx |
jmp .1 |
.sub: |
push ebp |
call expr_get_token |
call expr_read1 |
pop edx |
; ebp := edx-ebp |
xchg edx, ebp |
sub ebp, edx |
jmp .1 |
calc_expression: |
; in: esi->expression |
; out: CF=1 if error |
; CF=0 and ebp=value if ok |
call expr_get_token |
call expr_read0 |
cmp al, token_end |
jz .end |
cmp al, token_err |
jz @f |
mov esi, aParseError |
@@: |
call put_message |
stc |
ret |
.end: |
clc |
ret |
OnCalc: |
mov esi, [curarg] |
call calc_expression |
jc .ret |
push ebp |
mov esi, calc_string |
call put_message_nodraw |
jmp draw_messages |
.ret: |
ret |
OnDump: |
mov esi, [curarg] |
cmp byte [esi], 0 |
jnz .param |
add [dumppos], dump_height*10h |
jmp .doit |
.param: |
call calc_expression |
jc .ret |
mov [dumppos], ebp |
.doit: |
call get_dump |
call redraw_dump |
.ret: |
ret |
OnUnassemble: |
mov esi, [curarg] |
cmp byte [esi], 0 |
jnz .param |
mov eax, [disasm_start_pos] |
mov ecx, disasm_height |
mov [disasm_cur_pos], eax |
@@: |
push ecx |
call disasm_instr |
pop ecx |
jc .err |
loop @b |
mov eax, [disasm_cur_pos] |
jmp .doit |
.param: |
call calc_expression |
jc .ret |
mov eax, ebp |
.doit: |
push eax |
push [disasm_start_pos] |
mov [disasm_start_pos], eax |
call update_disasm |
pop [disasm_start_pos] |
pop eax |
cmp [disasm_cur_str], 0 |
jz @f |
mov [disasm_start_pos], eax |
.ret: |
ret |
@@: |
call update_disasm |
.err: |
mov esi, aInvAddr |
jmp put_message |
OnReg: |
mov esi, [curarg] |
call skip_spaces |
call find_reg |
jnc @f |
.err: |
mov esi, RSyntax |
jmp put_message |
@@: |
call skip_spaces |
test al, al |
jz .err |
cmp al, '=' |
jnz @f |
inc esi |
call skip_spaces |
test al, al |
jz .err |
@@: |
push edi |
call calc_expression |
pop edi |
jc .ret |
; now edi=register id, ebp=value |
cmp [bSuspended], 0 |
mov esi, aRunningErr |
jz put_message |
xchg eax, ebp |
cmp edi, 24 |
jz .eip |
sub edi, 4 |
jb .8lo |
sub edi, 4 |
jb .8hi |
sub edi, 8 |
jb .16 |
mov [_eax+edi*4], eax |
jmp .ret |
.16: |
mov word [_eax+(edi+8)*4], ax |
jmp .ret |
.8lo: |
mov byte [_eax+(edi+4)*4], al |
jmp .ret |
.8hi: |
mov byte [_eax+(edi+4)*4+1], al |
jmp .ret |
.eip: |
mov [_eip], eax |
call update_disasm_eip |
.ret: |
call set_context |
jmp redraw_registers |
; Breakpoints manipulation |
OnBp: |
mov esi, [curarg] |
call calc_expression |
jc .ret |
xchg eax, ebp |
push eax |
call find_breakpoint |
inc eax |
pop eax |
jz .notfound |
mov esi, aDuplicateBreakpoint |
jmp .sayerr |
.notfound: |
mov bl, 1 |
call add_breakpoint |
jnc .ret |
mov esi, aBreakpointLimitExceeded |
.sayerr: |
call put_message |
.ret: |
jmp redraw_disasm |
OnBpmb: |
mov dh, 0011b |
jmp DoBpm |
OnBpmw: |
mov dh, 0111b |
jmp DoBpm |
OnBpmd: |
mov dh, 1111b |
DoBpm: |
mov esi, [curarg] |
cmp byte [esi], 'w' |
jnz @f |
and dh, not 2 |
inc esi |
@@: |
push edx |
call calc_expression |
pop edx |
jnc @f |
ret |
@@: |
; ebp=expression, dh=flags |
movzx eax, dh |
shr eax, 2 |
test ebp, eax |
jz @f |
mov esi, aUnaligned |
jmp put_message |
@@: |
mov eax, ebp |
mov bl, 0Bh |
call add_breakpoint |
jnc @f |
mov esi, aBreakpointLimitExceeded |
jmp put_message |
@@: |
; now find index |
push eax |
xor ecx, ecx |
.l1: |
cmp [drx_break+ecx*4], 0 |
jnz .l2 |
push 69 |
pop eax |
push ecx |
mov dl, cl |
mov ecx, [debuggee_pid] |
mov esi, ebp |
push 9 |
pop ebx |
int 40h |
test eax, eax |
jz .ok |
pop ecx |
.l2: |
inc ecx |
cmp ecx, 4 |
jb .l1 |
pop eax |
call clear_breakpoint |
mov esi, aBreakpointLimitExceeded |
jmp put_message |
.ok: |
pop ecx |
pop eax |
and byte [edi], not 2 ; breakpoint is enabled |
shl dl, 6 |
or dl, dh |
mov byte [edi+1], dl |
inc eax |
mov [drx_break+ecx*4], eax |
ret |
OnBc: |
mov esi, [curarg] |
@@: call get_hex_number |
jc OnBp.ret |
call clear_breakpoint |
jmp @b |
OnBd: |
mov esi, [curarg] |
@@: call get_hex_number |
jc OnBp.ret |
call disable_breakpoint |
jmp @b |
OnBe: |
mov esi, [curarg] |
@@: call get_hex_number |
jc OnBp.ret |
push eax |
call find_enabled_breakpoint |
pop eax |
jz .err |
call enable_breakpoint |
jmp @b |
.err: |
mov esi, OnBeErrMsg |
jmp put_message |
get_hex_number: |
call skip_spaces |
xor ecx, ecx |
xor edx, edx |
@@: |
lodsb |
call is_hex_digit |
jc .ret |
shl edx, 4 |
or dl, al |
inc ecx |
jmp @b |
.ret: |
dec esi |
cmp ecx, 1 |
xchg eax, edx |
ret |
OnBl: |
mov esi, [curarg] |
cmp byte [esi], 0 |
jz .listall |
call get_hex_number |
jc .ret |
cmp eax, breakpoints_n |
jae .err |
push eax |
add eax, eax |
lea edi, [breakpoints + eax + eax*2] |
pop eax |
test byte [edi+4], 1 |
jz .err |
call show_break_info |
.ret: |
ret |
.err: |
mov esi, aInvalidBreak |
jmp put_message |
.listall: |
mov edi, breakpoints |
xor eax, eax |
@@: |
test byte [edi+4], 1 |
jz .cont |
push edi eax |
call show_break_info |
pop eax edi |
.cont: |
add edi, 6 |
inc eax |
cmp eax, breakpoints_n |
jb @b |
ret |
show_break_info: |
push edi |
test byte [edi+4], 8 |
jnz .dr |
push dword [edi] |
push eax |
mov esi, aBreakNum |
call put_message_nodraw |
jmp .cmn |
.dr: |
push eax |
mov esi, aMemBreak1 |
call put_message_nodraw |
pop edi |
push edi |
mov esi, aMemBreak2 |
test byte [edi+5], 2 |
jz @f |
mov esi, aMemBreak3 |
@@: |
call put_message_nodraw |
pop edi |
push edi |
mov esi, aMemBreak6 |
test byte [edi+5], 8 |
jnz @f |
mov esi, aMemBreak5 |
test byte [edi+5], 4 |
jnz @f |
mov esi, aMemBreak4 |
@@: |
call put_message_nodraw |
pop edi |
push edi |
push dword [edi] |
mov esi, aMemBreak7 |
call put_message_nodraw |
.cmn: |
pop edi |
test byte [edi+4], 2 |
jz @f |
push edi |
mov esi, aDisabled |
call put_message_nodraw |
pop edi |
@@: |
test byte [edi+4], 4 |
jz @f |
mov esi, aOneShot |
call put_message_nodraw |
@@: |
mov esi, newline |
jmp put_message |
add_breakpoint: |
; in: eax=address, bl=flags |
; out: CF=1 => error, CF=0 => eax=breakpoint number |
xor ecx, ecx |
mov edi, breakpoints |
@@: |
test byte [edi+4], 1 |
jz .found |
add edi, 6 |
inc ecx |
cmp ecx, breakpoints_n |
jb @b |
stc |
ret |
.found: |
stosd |
xchg eax, ecx |
mov [edi], bl |
test bl, 2 |
jnz @f |
or byte [edi], 2 |
push eax |
call enable_breakpoint |
pop eax |
@@: |
clc |
ret |
clear_breakpoint: |
cmp eax, breakpoints_n |
jae .ret |
mov ecx, 4 |
inc eax |
.1: |
cmp [drx_break-4+ecx*4], eax |
jnz @f |
and [drx_break-4+ecx*4], 0 |
@@: loop .1 |
dec eax |
push eax |
add eax, eax |
lea edi, [breakpoints + eax + eax*2 + 4] |
test byte [edi], 1 |
pop eax |
jz .ret |
push edi |
call disable_breakpoint |
pop edi |
mov byte [edi], 0 |
.ret: |
ret |
disable_breakpoint: |
cmp eax, breakpoints_n |
jae .ret |
add eax, eax |
lea edi, [breakpoints + eax + eax*2 + 5] |
test byte [edi-1], 1 |
jz .ret |
test byte [edi-1], 2 |
jnz .ret |
or byte [edi-1], 2 |
test byte [edi-1], 8 |
jnz .dr |
push esi |
push 7 |
pop ebx |
push 69 |
pop eax |
mov ecx, [debuggee_pid] |
xor edx, edx |
inc edx |
mov esi, [edi-5] |
int 40h |
pop esi |
.ret: |
ret |
.dr: |
mov dl, [edi] |
shr dl, 6 |
mov dh, 80h |
push 69 |
pop eax |
push 9 |
pop ebx |
mov ecx, [debuggee_pid] |
int 40h |
ret |
enable_breakpoint: |
push esi |
cmp eax, breakpoints_n |
jae .ret |
add eax, eax |
lea edi, [breakpoints + eax + eax*2 + 5] |
test byte [edi-1], 1 |
jz .ret |
test byte [edi-1], 2 |
jz .ret |
and byte [edi-1], not 2 |
test byte [edi-1], 8 |
jnz .dr |
push 6 |
pop ebx |
push 69 |
pop eax |
mov esi, [edi-5] |
mov ecx, [debuggee_pid] |
xor edx, edx |
inc edx |
int 40h |
dec eax |
jnz .err |
mov al, 69 |
push 0xCC |
mov edi, esp |
inc ebx |
int 40h |
pop eax |
.ret: |
pop esi |
ret |
.err: |
or byte [edi-1], 2 |
mov esi, aBreakErr |
call put_message |
pop esi |
ret |
.dr: |
push 9 |
pop ebx |
push 69 |
pop eax |
mov esi, [edi-5] |
mov ecx, [debuggee_pid] |
mov dl, [edi] |
shr dl, 6 |
mov dh, [edi] |
and dh, 0xF |
int 40h |
test eax, eax |
jnz .err |
pop esi |
ret |
find_breakpoint: |
xor ecx, ecx |
xchg eax, ecx |
mov edi, breakpoints |
@@: |
test byte [edi+4], 1 |
jz .cont |
test byte [edi+4], 8 |
jnz .cont |
cmp [edi], ecx |
jz .found |
.cont: |
add edi, 6 |
inc eax |
cmp eax, breakpoints_n |
jb @b |
or eax, -1 |
.found: |
ret |
find_enabled_breakpoint: |
xor ecx, ecx |
xchg eax, ecx |
mov edi, breakpoints |
@@: |
test byte [edi+4], 1 |
jz .cont |
test byte [edi+4], 2 or 8 |
jnz .cont |
cmp [edi], ecx |
jz .found |
.cont: |
add edi, 6 |
inc eax |
cmp eax, breakpoints_n |
jb @b |
or eax, -1 |
.found: |
ret |
OnUnpack: |
; program must be loaded - checked when command was parsed |
; program must be stopped |
mov esi, aRunningErr |
cmp [bSuspended], 0 |
jz put_message |
; all breakpoints must be disabled |
mov edi, breakpoints |
@@: |
test byte [edi+4], 1 |
jz .cont |
test byte [edi+4], 2 |
jnz .cont |
mov esi, aEnabledBreakErr |
jmp put_message |
.cont: |
add edi, 6 |
cmp edi, breakpoints+breakpoints_n*6 |
jb @b |
; ok, now do it |
; set breakpoint on 0xC dword access |
push 9 |
pop ebx |
mov ecx, [debuggee_pid] |
mov dx, 1111b*256 |
push 0xC |
pop esi |
@@: |
push 69 |
pop eax |
int 40h |
test eax, eax |
jz .breakok |
inc edx |
cmp dl, 4 |
jb @b |
.breakok: |
call GoOn |
; now wait for event |
.wait: |
push 10 |
pop eax |
int 40h |
dec eax |
jz .redraw |
dec eax |
jz .key |
dec eax |
jnz .debug |
; button; we have only one button, close |
or eax, -1 |
int 40h |
.redraw: |
call draw_window |
jmp .wait |
.key: |
mov al, 2 |
int 40h |
cmp ah, 3 ; Ctrl+C |
jnz .wait |
.userbreak: |
mov esi, aInterrupted |
.x1: |
push edx esi |
call put_message |
pop esi edx |
or dh, 80h |
push 69 |
pop eax |
push 9 |
pop ebx |
mov ecx, [debuggee_pid] |
int 40h |
cmp esi, aUnpacked |
jnz OnSuspend |
jmp AfterSuspend |
.debug: |
cmp [dbgbuflen], 4*3 |
jnz .notour |
cmp dword [dbgbuf], 3 |
jnz .notour |
test byte [dbgbuf+8], 1 |
jnz .our |
.notour: |
mov esi, aInterrupted |
push edx |
call put_message |
pop edx |
or dh, 80h |
push 69 |
pop eax |
push 9 |
pop ebx |
mov ecx, [debuggee_pid] |
int 40h |
jmp debugmsg |
.our: |
and [dbgbuflen], 0 |
push edx |
call get_context |
push eax |
mov al, 69 |
mov bl, 6 |
mov ecx, [debuggee_pid] |
mov edi, esp |
push 4 |
pop edx |
push 0xC |
pop esi |
int 40h |
pop eax |
pop edx |
cmp eax, [_eip] |
jz .done |
call DoResume |
jmp .wait |
.done: |
mov esi, aUnpacked |
jmp .x1 |
disasm_get_byte: |
; out: al=byte |
push ecx |
mov ecx, [disasm_cur_pos] |
sub ecx, [disasm_start_pos] |
cmp ecx, [disasm_buf_size] |
jae disasm_err |
mov al, [disasm_buffer+ecx] |
pop ecx |
inc [disasm_cur_pos] |
ret |
disasm_get_word: |
push ecx |
mov ecx, [disasm_cur_pos] |
sub ecx, [disasm_start_pos] |
inc ecx |
cmp ecx, [disasm_buf_size] |
jae disasm_err |
mov ax, word [disasm_buffer-1+ecx] |
pop ecx |
add [disasm_cur_pos], 2 |
ret |
disasm_get_dword: |
push ecx |
mov ecx, [disasm_cur_pos] |
sub ecx, [disasm_start_pos] |
add ecx, 3 |
cmp ecx, [disasm_buf_size] |
jae disasm_err |
mov eax, dword [disasm_buffer-3+ecx] |
pop ecx |
add [disasm_cur_pos], 4 |
ret |
disasm_err: |
mov esp, ebp |
stc_ret: |
stc |
ret |
disasm_ret: |
mov esp, ebp |
and byte [edi], 0 |
ret |
disasm_instr: |
mov ebp, esp |
cmp [debuggee_pid], 0 |
jz stc_ret |
mov edi, disasm_string |
xor ecx, ecx |
; ecx=flags |
disasm_loop1: |
xor eax, eax |
call disasm_get_byte |
jmp dword [disasm_table_1 + eax*4] |
cop0: |
clock: |
crepnz: |
crep: |
csegcs: |
csegds: |
cseges: |
csegss: |
csegfs: |
cseggs: |
call @f |
db 0x2E,3,'cs:' |
db 0x36,3,'ss:' |
db 0x3E,3,'ds:' |
db 0x26,3,'es:' |
db 0x64,3,'fs:' |
db 0x65,3,'gs:' |
db 0x06,10,'push es' |
db 0x07,10,'pop es' |
db 0x0E,10,'push cs' |
db 0x16,10,'push ss' |
db 0x17,10,'pop ss' |
db 0x1E,10,'push ds' |
db 0x1F,10,'pop ds' |
db 0x27,3,'daa' |
db 0x2F,3,'das' |
db 0x37,3,'aaa' |
db 0x3F,3,'aas' |
db 0x60,6,0,'pusha' |
db 0x61,5,0,'popa' |
db 0x90,3,'nop' |
db 0x9B,5,'fwait' |
db 0x9C,6,0,'pushf' |
db 0x9D,5,0,'popf' |
db 0x9E,4,'sahf' |
db 0x9F,4,'lahf' |
db 0xA4,5,'movsb' |
db 0xA5,5,0,'movs' |
db 0xA6,5,'cmpsb' |
db 0xA7,5,0,'cmps' |
db 0xAA,5,'stosb' |
db 0xAB,5,0,'stos' |
db 0xAC,5,'lodsb' |
db 0xAD,5,0,'lods' |
db 0xAE,5,'scasb' |
db 0xAF,5,0,'scas' |
db 0xC3,3,'ret' |
db 0xC9,5,'leave' |
db 0xCC,4,'int3' |
db 0xF0,4,'lock' |
db 0xF2,5,'repnz' |
db 0xF3,6,'rep(z)' |
db 0xF5,3,'cmc' |
db 0xF8,3,'clc' |
db 0xF9,3,'stc' |
db 0xFA,3,'cli' |
db 0xFB,3,'sti' |
db 0xFC,3,'cld' |
db 0xFD,3,'std' |
@@: |
pop esi |
@@: |
cmp al, [esi] |
jz .found |
inc esi |
movzx edx, byte [esi] |
inc esi |
add esi, edx |
jmp @b |
.found: |
inc esi |
lodsb |
cmp byte [esi], 0 |
jz @f |
movzx ecx, al |
disasm_1: |
rep movsb |
and byte [edi], 0 |
ret |
@@: |
mov dl, ch |
movzx ecx, al |
dec ecx |
inc esi |
rep movsb |
test dl, 1 |
mov al, 'w' |
jnz @f |
mov al, 'd' |
@@: stosb |
and byte [edi], 0 |
ret |
c67: |
or ch, 2 |
jmp disasm_loop1 |
c66: |
or ch, 1 |
jmp disasm_loop1 |
center: |
caam: |
cxlat: |
crdtsc: |
csysenter: |
ccpuid: |
ccmpxchg: |
cbsf: |
cbsr: |
ccmpxchg8b: |
cunk: |
cerr: |
mov eax, '???' |
stosd |
clc |
ret |
cF: |
call disasm_get_byte |
jmp dword [disasm_table_2 + eax*4] |
macro disasm_set_modew |
{ |
test al, 1 |
jz @f |
or ch, 80h |
@@: |
} |
cmov2: |
disasm_set_modew |
; mov r/m,i |
call disasm_get_byte |
dec [disasm_cur_pos] |
test al, 00111000b |
jnz cunk |
mov eax, 'mov ' |
stosd |
mov eax, ' ' |
stosd |
call disasm_readrmop |
mov ax, ', ' |
stosw |
xor eax, eax |
test ch, 80h |
jnz .1 |
call disasm_get_byte |
jmp .3 |
.1: |
test ch, 1 |
jnz .2 |
call disasm_get_dword |
jmp .3 |
.2: |
call disasm_get_word |
.3: |
call disasm_write_num |
and byte [edi], 0 |
ret |
cret2: |
mov eax, 'ret ' |
stosd |
mov eax, ' ' |
stosd |
xor eax, eax |
jmp cmov2.2 |
disasm_write_num: |
push ecx eax |
inc edi |
@@: |
mov ecx, eax |
shr eax, 4 |
jz @f |
inc edi |
jmp @b |
@@: |
pop eax |
cmp ecx, 10 |
jb @f |
inc edi |
@@: |
push edi eax |
@@: |
mov ecx, eax |
and al, 0xF |
cmp al, 10 |
sbb al, 69h |
das |
dec edi |
mov [edi], al |
mov eax, ecx |
shr eax, 4 |
jnz @b |
cmp ecx, 10 |
jb @f |
mov byte [edi-1], '0' |
@@: |
pop eax edi ecx |
cmp eax, 10 |
jb @f |
mov byte [edi], 'h' |
inc edi |
@@: |
ret |
label disasm_regs32 dword |
label disasm_regs dword |
db 'eax',0 |
db 'ecx',0 |
db 'edx',0 |
db 'ebx',0 |
db 'esp',0 |
db 'ebp',0 |
db 'esi',0 |
db 'edi',0 |
disasm_regs16 dw 'ax','cx','dx','bx','sp','bp','si','di' |
disasm_regs8 dw 'al','cl','dl','bl','ah','ch','dh','bh' |
disasm_scale db '1248' |
disasm_readrmop: |
call disasm_get_byte |
test ch, 40h |
jnz .skip_size |
push eax |
and al, 0xC0 |
cmp al, 0xC0 |
pop eax |
jz .skip_size |
test ch, 80h |
jz .byte |
test ch, 1 |
jnz .word |
mov dword [edi], 'dwor' |
mov byte [edi+4], 'd' |
inc edi |
jmp @f |
.byte: |
test ch, 20h |
jz .qb |
mov byte [edi], 't' |
inc edi |
.qb: |
mov dword [edi], 'byte' |
jmp @f |
.word: |
test ch, 20h |
jz .qw |
mov byte [edi], 'q' |
inc edi |
.qw: |
mov dword [edi], 'word' |
@@: |
mov byte [edi+4], ' ' |
add edi, 5 |
.skip_size: |
test ch, 2 |
jnz disasm_readrmop16 |
push ecx |
movzx ecx, al |
and eax, 7 |
shr ecx, 6 |
jz .vmod0 |
jp .vmod3 |
mov byte [edi], '[' |
inc edi |
cmp al, 4 |
jz .sib1 |
mov eax, [disasm_regs+eax*4] |
stosd |
dec edi |
jmp @f |
.sib1: |
call .parse_sib |
@@: |
mov al, '+' |
stosb |
dec ecx |
jz .vmod1 |
call disasm_get_dword |
jmp @f |
.vmod1: |
call disasm_get_byte |
movsx eax, al |
@@: |
test eax, eax |
jns .2 |
neg eax |
mov byte [edi-1], '-' |
.2: |
call disasm_write_num |
mov al, ']' |
stosb |
pop ecx |
ret |
.vmod3: |
pop ecx |
test ch, 80h |
jz .vmod3_byte |
test ch, 1 |
jnz .vmod3_word |
test ch, 20h |
jnz .vmod3_sti |
mov eax, [disasm_regs32+eax*4] |
stosd |
dec edi |
ret |
.vmod3_byte: |
mov ax, [disasm_regs8+eax*2] |
@@: |
stosw |
ret |
.vmod3_word: |
mov ax, [disasm_regs16+eax*2] |
jmp @b |
.vmod3_sti: |
mov word [edi], 'st' |
add al, '0' |
mov byte [edi+2], al |
add edi, 3 |
ret |
.vmod0: |
mov byte [edi], '[' |
inc edi |
cmp al, 4 |
jz .sib2 |
cmp al, 5 |
jz .ofs32 |
mov eax, [disasm_regs+eax*4] |
stosd |
mov byte [edi-1], ']' |
pop ecx |
ret |
.ofs32: |
call disasm_get_dword |
jmp .2 |
.sib2: |
call .parse_sib |
mov al, ']' |
stosb |
pop ecx |
ret |
.parse_sib: |
call disasm_get_byte |
push edx |
mov dl, al |
mov dh, 0 |
and eax, 7 |
cmp al, 5 |
jnz @f |
jecxz .sib0 |
@@: |
mov eax, [disasm_regs+eax*4] |
stosd |
dec edi |
mov dh, 1 |
.sib0: |
mov al, dl |
shr eax, 3 |
and eax, 7 |
cmp al, 4 |
jz .sibret |
test dh, dh |
jz @f |
mov byte [edi], '+' |
inc edi |
@@: |
mov eax, [disasm_regs+eax*4] |
stosd |
dec edi |
shr dl, 6 |
jz @f |
mov al, '*' |
stosb |
movzx eax, dl |
mov al, [disasm_scale+eax] |
stosb |
@@: |
.sibret: |
test dh, dh |
jnz .sibret2 |
call disasm_get_dword |
cmp byte [edi-1], '[' |
jz @f |
mov byte [edi], '+' |
test eax, eax |
jns .sibns |
neg eax |
mov byte [edi], '-' |
.sibns: |
inc edi |
@@: |
call disasm_write_num |
.sibret2: |
pop edx |
ret |
disasm_rm16_1 dd 'bxsi','bxdi','bpsi','bpdi' |
disasm_rm16_2 dw 'si','di','bp','bx' |
disasm_readrmop16: |
push ecx |
movzx ecx, al |
and eax, 7 |
shr ecx, 6 |
jz .vmod0 |
jp disasm_readrmop.vmod3 ; mod=3 is the same in 16- and 32-bit code |
; 1 or 2 |
mov byte [edi], '[' |
inc edi |
cmp al, 4 |
jae @f |
mov eax, [disasm_rm16_1+eax*4] |
stosw |
mov al, '+' |
stosb |
shr eax, 16 |
jmp .1 |
@@: |
mov eax, dword [disasm_rm16_2+eax*2-4*2] |
.1: |
stosw |
mov al, '+' |
stosb |
xor eax, eax |
dec ecx |
jnz .2 |
call disasm_get_byte |
cbw |
jmp @f |
.2: |
call disasm_get_word |
@@: |
test ax, ax |
jns @f |
mov byte [edi-1], '-' |
neg ax |
@@: |
call disasm_write_num |
.done1: |
mov al, ']' |
stosb |
pop ecx |
ret |
.vmod0: |
mov byte [edi], '[' |
inc edi |
cmp al, 6 |
jz .ofs16 |
cmp al, 4 |
jae @f |
mov eax, [disasm_rm16_1+eax*4] |
stosw |
mov al, '+' |
stosb |
shr eax, 16 |
jmp .3 |
@@: |
mov eax, dword [disasm_rm16_2+eax*2-4*2] |
.3: |
stosw |
jmp .done1 |
.ofs16: |
xor eax, eax |
call disasm_get_word |
call disasm_write_num |
jmp .done1 |
cpush21: |
mov eax, 'push' |
stosd |
mov eax, ' ' |
stosd |
disasm_i32: |
call disasm_get_dword |
call disasm_write_num |
and byte [edi], 0 |
ret |
cpush22: |
mov eax, 'push' |
stosd |
mov eax, ' ' |
stosd |
call disasm_get_byte |
movsx eax, al |
call disasm_write_num |
and byte [edi], 0 |
ret |
cinc1: |
; inc reg32 |
cdec1: |
; dec reg32 |
cpush1: |
; push reg32 |
cpop1: |
; pop reg32 |
cbswap: |
; bswap reg32 |
mov edx, eax |
and edx, 7 |
shr eax, 3 |
sub al, 8 |
mov esi, 'inc ' |
jz @f |
mov esi, 'dec ' |
dec al |
jz @f |
mov esi, 'push' |
dec al |
jz @f |
mov esi, 'pop ' |
dec al |
jz @f |
mov esi, 'bswa' |
@@: |
xchg eax, esi |
stosd |
mov eax, ' ' |
jz @f |
mov al, 'p' |
@@: |
stosd |
xchg eax, edx |
call disasm_write_reg1632 |
and byte [edi], 0 |
ret |
cxchg1: |
; xchg eax,reg32 |
and eax, 7 |
xchg eax, edx |
mov eax, 'xchg' |
stosd |
mov eax, ' ' |
stosd |
xor eax, eax |
call disasm_write_reg1632 |
mov ax, ', ' |
stosw |
xchg eax, edx |
call disasm_write_reg1632 |
and byte [edi], 0 |
ret |
cint: |
mov eax, 'int ' |
stosd |
mov eax, ' ' |
stosd |
disasm_i8u: |
xor eax, eax |
call disasm_get_byte |
call disasm_write_num |
and byte [edi], 0 |
ret |
cmov11: |
; mov r8,i8 |
mov ecx, eax |
mov eax, 'mov ' |
stosd |
mov eax, ' ' |
stosd |
and ecx, 7 |
mov ax, [disasm_regs8+ecx*2] |
stosw |
mov ax, ', ' |
stosw |
jmp disasm_i8u |
cmov12: |
; mov r32,i32 |
xchg eax, edx |
mov eax, 'mov ' |
stosd |
mov eax, ' ' |
stosd |
xchg eax, edx |
and eax, 7 |
call disasm_write_reg1632 |
mov ax, ', ' |
stosw |
jmp cmov2.1 |
disasm_shifts dd 'rol ','ror ','rcl ','rcr ','shl ','shr ','sal ','sar ' |
cshift2: |
; shift r/m,1 = D0/D1 |
cshift3: |
; shift r/m,cl = D2/D3 |
disasm_set_modew |
mov dl, al |
call disasm_get_byte |
dec [disasm_cur_pos] |
shr al, 3 |
and eax, 7 |
mov eax, [disasm_shifts+eax*4] |
stosd |
mov eax, ' ' |
stosd |
call disasm_readrmop |
cmp dl, 0xD2 |
jb .s1 |
mov eax, ', cl' |
stosd |
and byte [edi], 0 |
ret |
.s1: |
mov eax, ', 1' |
stosd |
clc |
ret |
cshift1: |
; shift r/m,i8 = C0/C1 |
disasm_set_modew |
call disasm_get_byte |
dec [disasm_cur_pos] |
shr al, 3 |
and eax, 7 |
mov eax, [disasm_shifts+eax*4] |
stosd |
mov eax, ' ' |
stosd |
call disasm_readrmop |
mov ax, ', ' |
stosw |
jmp disasm_i8u |
cmov3: |
; A0: mov al,[ofs32] |
; A1: mov ax/eax,[ofs32] |
; A2: mov [ofs32],al |
; A3: mov [ofs32],ax/eax |
mov edx, 'mov ' |
xchg eax, edx |
stosd |
mov eax, ' ' |
stosd |
test dl, 2 |
jnz .1 |
call .write_acc |
mov ax, ', ' |
stosw |
call .write_ofs32 |
jmp .2 |
.1: |
call .write_ofs32 |
mov ax, ', ' |
stosw |
call .write_acc |
.2: and byte [edi], 0 |
ret |
.write_acc: |
test dl, 1 |
jz .8bit |
test ch, 1 |
jnz .16bit |
mov eax, 'eax' |
stosd |
dec edi |
ret |
.16bit: |
mov ax, 'ax' |
stosw |
ret |
.8bit: |
mov ax, 'al' |
stosw |
ret |
.write_ofs32: |
mov al, '[' |
stosb |
call disasm_get_dword |
call disasm_write_num |
mov al, ']' |
stosb |
ret |
disasm_write_reg: |
test ch, 80h |
jnz disasm_write_reg1632 |
mov ax, [disasm_regs8+eax*2] |
stosw |
ret |
disasm_write_reg1632: |
test ch, 1 |
jnz @f |
mov eax, [disasm_regs32+eax*4] |
stosd |
dec edi |
ret |
@@: |
mov ax, [disasm_regs16+eax*2] |
stosw |
ret |
cmovzx: ; 0F B6/B7 |
cmovsx: ; 0F BE/BF |
mov edx, eax |
disasm_set_modew |
mov eax, 'movz' |
cmp dl, 0xB8 |
jb @f |
mov eax, 'movs' |
@@: |
stosd |
mov eax, 'x ' |
stosd |
call disasm_get_byte |
dec [disasm_cur_pos] |
shr al, 3 |
and eax, 7 |
call disasm_write_reg1632 |
mov ax, ', ' |
stosw |
or ch, 1 ; 2nd operand - 8 or 16 bits |
call disasm_readrmop |
and byte [edi], 0 |
ret |
disasm_op2cmds dd 'add ','or ','adc ','sbb ','and ','sub ','xor ','cmp ' |
cop21: |
disasm_set_modew |
mov esi, 'test' |
cmp al, 0A8h |
jae @f |
shr al, 3 |
and eax, 7 |
mov esi, [disasm_op2cmds+eax*4] |
@@: |
xchg eax, esi |
stosd |
mov eax, ' ' |
stosd |
test ch, 80h |
jnz .1632 |
mov eax, 'al, ' |
stosd |
jmp disasm_i8u |
.1632: |
test ch, 1 |
jnz .16 |
mov eax, 'eax,' |
stosd |
mov al, ' ' |
stosb |
call disasm_get_dword |
jmp .x |
.16: |
mov eax, 'ax, ' |
stosd |
xor eax, eax |
call disasm_get_word |
.x: |
call disasm_write_num |
and byte [edi], 0 |
ret |
cop22: |
disasm_set_modew |
or ch, 40h |
mov edx, eax |
mov esi, 'lea ' |
cmp al, 8Dh |
jz @f |
mov esi, 'imul' |
cmp al, 0xAF |
jz @f |
mov esi, 'mov ' |
cmp al, 88h |
jae @f |
mov esi, 'xchg' |
cmp al, 86h |
jae @f |
mov esi, 'test' |
cmp al, 84h |
jae @f |
shr al, 3 |
and eax, 7 |
mov esi, [disasm_op2cmds+eax*4] |
@@: |
xchg eax, esi |
stosd |
mov eax, ' ' |
stosd |
call disasm_get_byte |
dec [disasm_cur_pos] |
shr al, 3 |
and eax, 7 |
cmp dl, 0x8D |
jz @f |
cmp dl, 0x86 |
jz @f |
cmp dl, 0x87 |
jz @f |
test dl, 2 |
jz .d0 |
@@: |
call disasm_write_reg |
mov ax, ', ' |
stosw |
call disasm_readrmop |
and byte [edi], 0 |
ret |
.d0: |
push eax |
call disasm_readrmop |
mov ax, ', ' |
stosw |
pop eax |
call disasm_write_reg |
and byte [edi], 0 |
ret |
cop23: |
disasm_set_modew |
xchg eax, edx |
call disasm_get_byte |
dec [disasm_cur_pos] |
shr eax, 3 |
and eax, 7 |
mov eax, [disasm_op2cmds+eax*4] |
ctest: |
stosd |
mov eax, ' ' |
stosd |
call disasm_readrmop |
mov ax, ', ' |
stosw |
test ch, 80h |
jz .i8 |
cmp dl, 83h |
jz .i8 |
test ch, 1 |
jnz .i16 |
call disasm_get_dword |
jmp .ic |
.i8: |
xor eax, eax |
call disasm_get_byte |
cmp dl, 83h |
jnz .ic |
movsx eax, al |
jmp .ic |
.i16: |
xor eax, eax |
call disasm_get_word |
.ic: |
call disasm_write_num |
and byte [edi], 0 |
ret |
cbtx1: |
; btx r/m,i8 = 0F BA |
or ch, 80h |
call disasm_get_byte |
dec [disasm_cur_pos] |
shr al, 3 |
and eax, 7 |
cmp al, 4 |
jb cunk |
mov eax, [btx1codes+eax*4-4*4] |
stosd |
mov eax, ' ' |
stosd |
call disasm_readrmop |
mov ax, ', ' |
stosw |
jmp disasm_i8u |
btx1codes dd 'bt ','bts ','btr ','btc ' |
cbtx2: |
; btx r/m,r = 0F 101xx011 (A3,AB,B3,BB) |
shr al, 3 |
and eax, 3 |
mov eax, [btx1codes+eax*4] |
stosd |
mov eax, ' ' |
stosd |
or ch, 0xC0 |
call disasm_get_byte |
dec [disasm_cur_pos] |
shr al, 3 |
and eax, 7 |
push eax |
call disasm_readrmop |
mov ax, ', ' |
stosw |
pop eax |
call disasm_write_reg1632 |
and byte [edi], 0 |
ret |
csetcc: |
and eax, 0xF |
mov ax, [disasm_jcc_codes + eax*2] |
mov dword [edi], 'setc' |
add edi, 3 |
stosw |
mov ax, ' ' |
stosw |
stosb |
call disasm_readrmop |
and byte [edi], 0 |
ret |
disasm_jcc_codes dw 'o ','no','b ','ae','z ','nz','be','a ','s ','ns','p ','np','l ','ge','le','g ' |
cjcc1: |
cjmp2: |
cmp al, 0xEB |
jz .1 |
and eax, 0xF |
mov ax, [disasm_jcc_codes + eax*2] |
jmp .2 |
.1: |
mov ax, 'mp' |
.2: |
mov byte [edi], 'j' |
inc edi |
stosw |
mov eax, ' ' |
stosb |
stosd |
call disasm_get_byte |
movsx eax, al |
disasm_rva: |
add eax, [disasm_cur_pos] |
call disasm_write_num |
and byte [edi], 0 |
ret |
ccall1: |
cjmp1: |
cjcc2: |
mov edx, 'call' |
cmp al, 0xE8 |
jz @f |
mov edx, 'jmp ' |
cmp al, 0xE9 |
jz @f |
mov edx, ' ' |
and eax, 0xF |
mov dx, [disasm_jcc_codes+eax*2] |
shl edx, 8 |
mov dl, 'j' |
@@: |
xchg eax, edx |
stosd |
mov eax, ' ' |
stosd |
call disasm_get_dword |
jmp disasm_rva |
op11codes dd 'test',0,'not ','neg ','mul ','imul','div ','idiv' |
op12codes dd 'inc ','dec ','call',0,'jmp ',0,'push',0 |
cop1: |
disasm_set_modew |
xchg eax, edx |
call disasm_get_byte |
dec [disasm_cur_pos] |
shr al, 3 |
and eax, 7 |
cmp dl, 0xFE |
jnz @f |
cmp al, 1 |
ja cunk |
@@: |
and edx, 8 |
add eax, edx |
mov eax, [op11codes+eax*4] |
test eax, eax |
jz cunk |
cmp eax, 'test' |
jz ctest |
@@: |
stosd |
mov eax, ' ' |
stosd |
call disasm_readrmop |
and byte [edi], 0 |
ret |
cpop2: |
or ch, 80h |
call disasm_get_byte |
dec [disasm_cur_pos] |
test al, 00111000b |
jnz cunk |
mov eax, 'pop ' |
jmp @b |
cloopnz: |
mov eax, 'loop' |
stosd |
mov eax, 'nz ' |
test ch, 2 |
jz @f |
mov ah, 'w' |
@@: jmp cloop.cmn |
cloopz: |
mov eax, 'loop' |
stosd |
mov eax, 'z ' |
test ch, 2 |
jz @f |
mov eax, 'zw ' |
@@: jmp cloop.cmn |
cjcxz: |
cloop: |
cmp al, 0xE2 |
jz .loop |
test ch, 2 |
jnz .jcxz |
mov eax, 'jecx' |
stosd |
mov eax, 'z ' |
jmp .cmn |
.jcxz: |
mov eax, 'jcxz' |
stosd |
mov eax, ' ' |
jmp .cmn |
.loop: |
mov eax, 'loop' |
stosd |
mov eax, ' ' |
test ch, 2 |
jz .cmn |
mov al, 'w' |
.cmn: |
stosd |
call disasm_get_byte |
movsx eax, al |
add eax, [disasm_cur_pos] |
test ch, 1 |
jz @f |
and eax, 0xFFFF |
@@: |
disasm_write_num_done: |
call disasm_write_num |
and byte [edi], 0 |
ret |
cimul1: |
; imul r,r/m,i |
or ch, 80h ; 32bit operation |
xchg eax, edx |
mov eax, 'imul' |
stosd |
mov eax, ' ' |
stosd |
call disasm_get_byte |
dec [disasm_cur_pos] |
shr al, 3 |
and eax, 7 |
call disasm_write_reg1632 |
mov ax, ', ' |
stosw |
call disasm_readrmop |
mov ax, ', ' |
stosw |
test ch, 1 |
jnz .16 |
cmp dl, 0x69 |
jz .op32 |
call disasm_get_byte |
movsx eax, al |
jmp disasm_write_num_done |
.op32: |
call disasm_get_dword |
jmp disasm_write_num_done |
.16: |
cmp dl, 0x69 |
jz .op16 |
call disasm_get_byte |
cbw |
jmp disasm_write_num_done |
.op16: |
xor eax, eax |
call disasm_get_word |
jmp disasm_write_num_done |
cshld: |
cshrd: |
mov edx, 'shld' |
test al, 8 |
jz @f |
mov edx, 'shrd' |
@@: |
xchg eax, edx |
stosd |
mov eax, ' ' |
stosd |
call disasm_get_byte |
dec [disasm_cur_pos] |
shr al, 3 |
and eax, 7 |
push eax |
or ch, 80h |
call disasm_readrmop |
mov ax, ', ' |
stosw |
pop eax |
call disasm_write_reg1632 |
mov ax, ', ' |
stosw |
test dl, 1 |
jz disasm_i8u |
mov ax, 'cl' |
stosw |
and byte [edi], 0 |
ret |
ccbw: |
mov eax, 'cbw ' |
test ch, 1 |
jnz @f |
mov eax, 'cwde' |
@@: stosd |
and byte [edi+1], 0 |
ret |
ccwd: |
mov eax, 'cwd ' |
test ch, 1 |
jnz @b |
mov eax, 'cdq ' |
jmp @b |
fpuD8 dd 'add ','mul ','com ','comp','sub ','subr','div ','divr' |
cD8: |
call disasm_get_byte |
dec [disasm_cur_pos] |
push eax |
shr al, 3 |
and eax, 7 |
mov byte [edi], 'f' |
inc edi |
xchg eax, edx |
mov eax, [fpuD8+edx*4] |
stosd |
mov ax, ' ' |
stosw |
stosb |
pop eax |
cmp dl, 2 |
jb .1 |
cmp dl, 3 |
jbe .2 |
.1: |
cmp al, 0xC0 |
jb .2 |
mov eax, 'st0,' |
stosd |
mov al, ' ' |
stosb |
.2: |
or ch, 80h or 20h |
and ch, not 1 |
call disasm_readrmop |
and byte [edi], 0 |
ret |
fpuD9_2: |
dq 'fchs ','fabs ',0,0,'ftst ','fxam ',0,0 |
db 'fld1 fldl2t fldl2e fldpi fldlg2 fldln2 fldz ' |
dq 0 |
db 'f2xm1 fyl2x fptan fpatan fxtract fprem1 fdecstp fincstp ' |
db 'fprem fyl2xp1 fsqrt fsincos frndint fscale fsin fcos ' |
fpuD9_fnop db 'fnop ' |
cD9: |
call disasm_get_byte |
sub al, 0xC0 |
jae .l1 |
dec [disasm_cur_pos] |
shr al, 3 |
and eax, 7 |
cmp al, 7 |
jnz @f |
mov eax, 'fnst' |
stosd |
mov eax, 'cw ' |
jmp .x1 |
@@: |
cmp al, 5 |
jnz @f |
mov eax, 'fldc' |
stosd |
mov eax, 'w ' |
.x1: |
stosd |
or ch, 0C1h |
jmp .cmn |
@@: |
mov edx, 'fld ' |
test al, al |
jz @f |
mov edx, 'fst ' |
cmp al, 2 |
jz @f |
mov edx, 'fstp' |
cmp al, 3 |
jnz cunk |
@@: |
xchg eax, edx |
stosd |
mov eax, ' ' |
stosd |
or ch, 80h |
and ch, not 1 |
.cmn: |
call disasm_readrmop |
and byte [edi], 0 |
ret |
.l1: |
cmp al, 10h |
jae .l2 |
mov edx, 'fld ' |
cmp al, 8 |
jb @f |
mov edx, 'fxch' |
@@: |
xchg eax, edx |
stosd |
mov eax, ' ' |
stosd |
xchg eax, edx |
and al, 7 |
add al, '0' |
shl eax, 16 |
mov ax, 'st' |
stosd |
clc |
ret |
.l2: |
cmp al, 0x10 |
jnz @f |
mov esi, fpuD9_fnop |
jmp .l3 |
@@: |
sub al, 0x20 |
jb cerr |
lea esi, [fpuD9_2+eax*8] |
cmp byte [esi], 0 |
jz cerr |
.l3: |
movsd |
movsd |
and byte [edi-1], 0 |
ret |
cDA: |
call disasm_get_byte |
cmp al, 0xC0 |
jae cunk |
dec [disasm_cur_pos] |
shr al, 3 |
and eax, 7 |
mov word [edi], 'fi' |
inc edi |
inc edi |
mov eax, [fpuD8+eax*4] |
stosd |
mov ax, ' ' |
stosw |
or ch, 80h |
and ch, not 1 ; 32-bit operand |
call disasm_readrmop |
and byte [edi], 0 |
ret |
fpuDB dd 'ild ',0,'ist ','istp',0,'ld ',0,'stp ' |
cDB: |
call disasm_get_byte |
cmp al, 0xC0 |
jae .1 |
dec [disasm_cur_pos] |
shr al, 3 |
and eax, 7 |
xchg eax, edx |
mov eax, [fpuDB+edx*4] |
test eax, eax |
jz cerr |
mov byte [edi], 'f' |
inc edi |
stosd |
mov ax, ' ' |
stosw |
stosb |
or ch, 80h |
and ch, not 1 ; 32-bit operand |
cmp dl, 4 |
jb @f |
or ch, 20h |
and ch, not 80h ; 80-bit operand |
@@: |
call disasm_readrmop |
and byte [edi], 0 |
ret |
.1: |
cmp al, 0xE3 |
jnz cunk |
mov eax, 'fnin' |
stosd |
mov eax, 'it' |
stosd |
dec edi |
ret ; CF cleared |
fpuDC dd 'add ','mul ',0,0,'subr','sub ','divr','div ' |
cDC: |
call disasm_get_byte |
cmp al, 0xC0 |
jae .1 |
dec [disasm_cur_pos] |
shr al, 3 |
and eax, 7 |
mov byte [edi], 'f' |
inc edi |
mov eax, [fpuD8+eax*4] |
stosd |
mov ax, ' ' |
stosw |
stosb |
or ch, 0A1h ; qword |
call disasm_readrmop |
and byte [edi], 0 |
ret |
.1: |
mov dl, al |
shr al, 3 |
and eax, 7 |
mov eax, [fpuDC+eax*4] |
test eax, eax |
jz cerr |
mov byte [edi], 'f' |
inc edi |
stosd |
mov eax, ' s' |
stosd |
mov al, 't' |
stosb |
and edx, 7 |
lea eax, [edx+'0'] |
stosb |
mov eax, ', st' |
stosd |
mov ax, '0' |
stosw |
ret ; CF cleared |
fpuDD dd 'fld ',0,'fst ','fstp',0,0,0,0 |
fpuDD_2 dq 'ffree ',0,'fst ','fstp ','fucom ','fucomp ',0,0 |
cDD: |
call disasm_get_byte |
cmp al, 0xC0 |
jae .1 |
dec [disasm_cur_pos] |
shr al, 3 |
and eax, 7 |
xchg eax, edx |
mov eax, [fpuDD+edx*4] |
test eax, eax |
jz cunk |
stosd |
mov eax, ' ' |
stosd |
or ch, 0A1h ; qword operand |
call disasm_readrmop |
and byte [edi], 0 |
ret |
.1: |
push eax |
shr al, 3 |
and eax, 7 |
xchg eax, edx |
mov eax, dword [fpuDD_2+edx*8] |
test eax, eax |
jz cerr |
stosd |
mov eax, dword [fpuDD_2+4+edx*8] |
stosd |
mov ax, 'st' |
stosw |
pop eax |
and al, 7 |
add al, '0' |
stosb |
and byte [edi], 0 |
ret |
fpuDE dd 'add ','mul ',0,0,'subr','sub ','divr','div ' |
cDE: |
call disasm_get_byte |
cmp al, 0xC0 |
jae .1 |
dec [disasm_cur_pos] |
mov word [edi], 'fi' |
inc edi |
inc edi |
shr al, 3 |
and eax, 7 |
mov eax, [fpuD8+eax*4] |
stosd |
mov ax, ' ' |
stosw |
or ch, 81h ; force 16-bit |
call disasm_readrmop |
and byte [edi], 0 |
ret |
.1: |
push eax |
shr al, 3 |
and eax, 7 |
xchg eax, edx |
mov eax, [fpuDE+edx*4] |
test eax, eax |
jz .fcompp |
mov byte [edi], 'f' |
inc edi |
stosd |
mov al, 'p' |
cmp byte [edi-1], ' ' |
jnz @f |
mov byte [edi-1], al |
mov al, ' ' |
@@: stosb |
mov eax, ' st' |
stosd |
pop eax |
and al, 7 |
add al, '0' |
stosb |
mov ax, ', ' |
stosw |
mov eax, 'st0' |
stosd |
ret ; CF cleared |
.fcompp: |
pop eax |
cmp al, 0xD9 |
jnz cerr |
mov eax, 'fcom' |
stosd |
mov ax, 'pp' |
stosw |
and byte [edi], 0 |
ret |
fpuDF dd 'ild ',0,'ist ','istp','bld ','ild ','bstp','istp' |
cDF: |
call disasm_get_byte |
cmp al, 0xC0 |
jae .1 |
dec [disasm_cur_pos] |
shr al, 3 |
and eax, 7 |
xchg eax, edx |
mov eax, [fpuDF+edx*4] |
test eax, eax |
jz cerr |
mov byte [edi], 'f' |
inc edi |
stosd |
mov ax, ' ' |
stosw |
stosb |
or ch, 81h ; force 16-bit operand |
cmp dl, 4 |
jb @f |
or ch, 20h |
test dl, 1 |
jnz @f |
or ch, 40h |
@@: |
call disasm_readrmop |
and byte [edi], 0 |
ret |
.1: |
cmp al, 0xE0 |
jnz cunk |
mov eax, 'fnst' |
stosd |
mov eax, 'sw ' |
stosd |
mov ax, 'ax' |
stosw |
and byte [edi], 0 |
ret |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DATA ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
caption_str db 'Kolibri Debugger',0 |
caption_len = $ - caption_str |
begin_str db 'Kolibri Debugger, version 0.2',10 |
db 'Hint: type "help" for help, "quit" for quit' |
newline db 10,0 |
prompt db '> ',0 |
help_groups: |
dd aControl, 0, 0, help_control_msg |
db 0 |
dd aData, 0, 0, help_data_msg |
db 0 |
dd aBreakpoints, 0, 0, help_breaks_msg |
db 0 |
; flags field: |
; &1: command may be called without parameters |
; &2: command may be called with parameters |
; &4: command may be called without loaded program |
; &8: command may be called with loaded program |
commands: |
dd _aH, OnHelp, HelpSyntax, HelpHelp |
db 0Fh |
dd aHelp, OnHelp, HelpSyntax, HelpHelp |
db 0Fh |
dd aQuit, OnQuit, QuitSyntax, QuitHelp |
db 0Dh |
dd aLoad, OnLoad, LoadSyntax, LoadHelp |
db 6 |
dd aReload, OnReload, ReloadSyntax, ReloadHelp |
db 0Dh |
dd aTerminate, OnTerminate, TerminateSyntax, TerminateHelp |
db 9 |
dd aDetach, OnDetach, DetachSyntax, DetachHelp |
db 9 |
dd aSuspend, OnSuspend, SuspendSyntax, SuspendHelp |
db 9 |
dd aResume, OnResume, ResumeSyntax, ResumeHelp |
db 0Bh |
dd aStep, OnStep, StepSyntax, StepHelp |
db 9 |
dd aProceed, OnProceed, ProceedSyntax, ProceedHelp |
db 9 |
dd aCalc, OnCalc, CalcSyntax, CalcHelp |
db 0Eh |
dd aDump, OnDump, DumpSyntax, DumpHelp |
db 0Bh |
dd aUnassemble, OnUnassemble, UnassembleSyntax, UnassembleHelp |
db 0Bh |
dd aBp, OnBp, BpSyntax, BpHelp |
db 0Ah |
dd aBpm, OnBpmb, BpmSyntax, BpmHelp |
db 0Ah |
dd aBpmb, OnBpmb, BpmSyntax, BpmHelp |
db 0Ah |
dd aBpmw, OnBpmw, BpmSyntax, BpmHelp |
db 0Ah |
dd aBpmd, OnBpmd, BpmSyntax, BpmHelp |
db 0Ah |
dd aBl, OnBl, BlSyntax, BlHelp |
db 0Bh |
dd aBc, OnBc, BcSyntax, BcHelp |
db 0Ah |
dd aBd, OnBd, BdSyntax, BdHelp |
db 0Ah |
dd aBe, OnBe, BeSyntax, BeHelp |
db 0Ah |
dd aReg, OnReg, RSyntax, RHelp |
db 0Ah |
dd aUnpack, OnUnpack, UnpackSyntax, UnpackHelp |
db 9 |
dd 0 |
aHelp db 5,'help',0 |
_aH db 2,'h',0 |
HelpHelp db 'Help on specified function',10 |
HelpSyntax db 'Usage: h or help [group | command]',10,0 |
help_msg db 'List of known command groups:',10 |
db '"help control" - display list of control commands',10 |
db '"help data" - display list of commands concerning data',10 |
db '"help breakpoints" - display list of commands concerning breakpoints',10,0 |
aControl db 8,'control',0 |
help_control_msg db 'List of control commands:',10 |
db 'h = help - help',10 |
db 'quit - exit from debugger',10 |
db 'load <name> [params] - load program for debugging',10 |
db 'reload - reload debugging program',10 |
db 'terminate - terminate loaded program',10 |
db 'detach - detach from debugging program',10 |
db 'stop - suspend execution of debugging program',10 |
db 'g [<expression>] - go on (resume execution of debugging program)',10 |
db 's = <Ctrl+F7> - program step',10 |
db 'p = <Ctrl+F8> - program wide step',10 |
db 'unpack - try to bypass unpacker code (heuristic)',10,0 |
aData db 5,'data',0 |
help_data_msg db 'List of data commands:',10 |
db '? <expression> - calculate value of expression',10 |
db 'd [<expression>] - dump data at given address',10 |
db 'u [<expression>] - unassemble instructions at given address',10 |
db 'r <register> <expression> or',10 |
db 'r <register>=<expression> - set register value',10,0 |
aBreakpoints db 12,'breakpoints',0 |
help_breaks_msg db 'List of breakpoints commands:',10 |
db 'bp <expression> - set breakpoint on execution',10 |
db 'bpm[b|w|d] <type> <expression> - set breakpoint on memory access',10 |
db 'bl [<number>] - breakpoint(s) info',10 |
db 'bc <number>... - clear breakpoint',10 |
db 'bd <number>... - disable breakpoint',10 |
db 'be <number>... - enable breakpoint',10,0 |
aQuit db 5,'quit',0 |
QuitHelp db 'Quit from debugger',10 |
QuitSyntax db 'Usage: quit',10,0 |
aLoad db 5,'load',0 |
LoadHelp db 'Load program for debugging',10 |
LoadSyntax db 'Usage: load <program-name> [parameters]',10,0 |
aReload db 7,'reload',0 |
ReloadHelp db 'Reload debugging program (restart debug session)',10 |
ReloadSyntax db 'Usage: reload',10,0 |
aTerminate db 10,'terminate',0 |
TerminateHelp db 'Terminate debugged program',10 |
TerminateSyntax db 'Usage: terminate',10,0 |
aDetach db 7,'detach',0 |
DetachHelp db 'Detach from debugged program',10 |
DetachSyntax db 'Usage: detach',10,0 |
aSuspend db 5,'stop',0 |
SuspendHelp db 'Suspend execution of debugged program',10 |
SuspendSyntax db 'Usage: stop',10,0 |
aResume db 2,'g',0 |
ResumeHelp db 'Go (resume execution of debugged program)',10 |
ResumeSyntax db 'Usage: g',10 |
db ' or: g <expression> - wait until specified address is reached',10,0 |
aStep db 2,'s',0 |
StepHelp db 'Make step in debugged program',10 |
StepSyntax db 'Usage: s',10,0 |
aProceed db 2,'p',0 |
ProceedHelp db 'Make wide step in debugged program (step over CALL, REPxx, LOOP)',10 |
ProceedSyntax db 'Usage: p',10,0 |
aDump db 2,'d',0 |
DumpHelp db 'Dump data of debugged program',10 |
DumpSyntax db 'Usage: d <expression> - dump data at specified address',10 |
db ' or: d - continue current dump',10,0 |
aCalc db 2,'?',0 |
CalcHelp db 'Calculate value of expression',10 |
CalcSyntax db 'Usage: ? <expression>',10,0 |
aUnassemble db 2,'u',0 |
UnassembleHelp db 'Unassemble',10 |
UnassembleSyntax: |
db 'Usage: u <expression> - unassemble instructions at specified address',10 |
db ' or: u - continue current unassemble screen',10,0 |
aReg db 2,'r',0 |
RHelp db 'Set register value',10 |
RSyntax: |
db 'Usage: r <register> <expression>',10 |
db ' or: r <register>=<expression> - set value of <register> to <expression>',10,0 |
aBp db 3,'bp',0 |
BpHelp db 'set BreakPoint on execution',10 |
BpSyntax db 'Usage: bp <expression>',10,0 |
aBpm db 4,'bpm',0 |
aBpmb db 5,'bpmb',0 |
aBpmw db 5,'bpmw',0 |
aBpmd db 5,'bpmd',0 |
BpmHelp db 'set BreakPoint on Memory access',10 |
db 'Maximum 4 breakpoints of this type are allowed',10 |
db 'Note that for this breaks debugger is activated after access',10 |
BpmSyntax db 'Usage: bpmb [w] <expression>',10 |
db ' bpmw [w] <expression>',10 |
db ' bpmd [w] <expression>',10 |
db ' bpm is synonym for bpmd',10 |
db '"w" means break only on writes (default is on read/write)',10,0 |
aBl db 3,'bl',0 |
BlHelp db 'Breakpoint List',10 |
BlSyntax db 'Usage: bl - list all breakpoints',10 |
db ' bl <number> - display info on particular breakpoint',10,0 |
aBc db 3,'bc',0 |
BcHelp db 'Breakpoint Clear',10 |
BcSyntax db 'Usage: bc <number-list>',10 |
db 'Examples: bc 2',10 |
db ' bc 1 3 4 A',10,0 |
aBd db 3,'bd',0 |
BdHelp db 'Breakpoint Disable',10 |
BdSyntax db 'Usage: bd <number-list>',10 |
db 'Examples: bd 2',10 |
db ' bd 1 3 4 A',10,0 |
aBe db 3,'be',0 |
BeHelp db 'Breakpoint Enable',10 |
BeSyntax db 'Usage: be <number-list>',10 |
db 'Examples: be 2',10 |
db ' be 1 3 4 A',10,0 |
aUnpack db 7,'unpack',0 |
UnpackHelp db 'Try to bypass unpacker code',10 |
UnpackSyntax db 'Usage: unpack',10,0 |
aUnknownCommand db 'Unknown command',10,0 |
load_err_msg db 'Cannot load program. ',0 |
unk_err_msg db 'Unknown error code -%4X',10,0 |
load_err_msgs: |
dd .1, 0, .3, 0, .5, .6, 0, 0, .9, .A, 0, 0, 0, 0, 0, 0 |
dd 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, .1E, .1F, .20 |
.1 db 'HD undefined.',10,0 |
.3 db 'Unknown FS.',10,0 |
.5 db 'File not found.',10,0 |
.6 db 'Unexpected EOF.',10,0 |
.9 db 'FAT table corrupted.',10,0 |
.A db 'Access denied.',10,0 |
.1E db 'No memory.',10,0 |
.1F db 'Not Menuet/Kolibri executable.',10,0 |
.20 db 'Too many processes.',10,0 |
load_succ_msg db 'Program loaded successfully! PID=%4X. Use "g" to run.',10,0 |
need_debuggee db 'No program loaded. Use "load" command.',10,0 |
aAlreadyLoaded db 'Program is already loaded. Use "terminate" or "detach" commands',10,0 |
terminated_msg db 'Program terminated.',10,0 |
aException db 'Debugged program caused an exception %2X. ' |
aSuspended db 'Suspended',10,0 |
aContinued db 'Continuing',10,0 |
aRunningErr db 'Program is running',10,0 |
read_mem_err db 'ERROR: cannot read process memory!!!',10,0 |
aBreakpointLimitExceeded db 'Breakpoint limit exceeded',10,0 |
aBreakErr db 'Cannot activate breakpoint, it will be disabled',10,0 |
aDuplicateBreakpoint db 'Duplicate breakpoint',10,0 |
aInvalidBreak db 'Invalid breakpoint number',10,0 |
OnBeErrMsg db 'There is already enabled breakpoint on this address',10,0 |
aBreakNum db '%2X: at %8X',0 |
aMemBreak1 db '%2X: on ',0 |
aMemBreak2 db 'read from ',0 |
aMemBreak3 db 'access of ',0 |
aMemBreak4 db 'byte',0 |
aMemBreak5 db 'word',0 |
aMemBreak6 db 'dword',0 |
aMemBreak7 db ' at %8X',0 |
aOneShot db ', one-shot',0 |
aDisabled db ', disabled',0 |
aBreakStop db 'Breakpoint #%2X',10,0 |
aUserBreak db 'int3 command at %8X',10,0 |
;dbgmsg_str db 'Debug message for process %4X.',10,0 |
aInvAddr db 'Invalid address',10,0 |
NoPrgLoaded_str db 'No program loaded' |
NoPrgLoaded_len = $ - NoPrgLoaded_str |
aRunning db 'Running' |
aPaused db 'Paused' |
aPoint db 0x1C |
aMinus db '-' |
aColon db ':' |
aQuests db '??' |
aDots db '...' |
aParseError db 'Parse error',10,0 |
aDivByZero db 'Division by 0',10,0 |
calc_string db '%8X',10,0 |
aUnaligned db 'Unaligned address',10,0 |
aEnabledBreakErr db 'Enabled breakpoints are not allowed',10,0 |
aInterrupted db 'Interrupted',10,0 |
aUnpacked db 'Unpacked successful!',10,0 |
aPacked1 db 'Program is probably packed with ',0 |
aPacked2 db '.',10,'Try to unpack automatically? [y/n]: ',0 |
aY_str db 'y',10,0 |
aN_str db 'n',10,0 |
mxp_nrv_name db 'mxp_nrv',0 |
mxp_name db 'mxp',0 |
mxp_lzo_name db 'mxp_lzo',0 |
mtappack_name db 'mtappack',0 |
flags db 'CPAZSDO' |
flags_bits db 0,2,4,6,7,10,11 |
regs_strs: |
db 'EAX=' |
db 'EBX=' |
db 'ECX=' |
db 'EDX=' |
db 'ESI=' |
db 'EDI=' |
db 'EBP=' |
db 'ESP=' |
db 'EIP=' |
db 'EFLAGS=' |
debuggee_pid dd 0 |
bSuspended db 0 |
bAfterGo db 0 |
temp_break dd 0 |
disasm_table_1: |
dd cop22, cop22, cop22, cop22, cop21, cop21, cop0, cop0 ; 0x |
dd cop22, cop22, cop22, cop22, cop21, cop21, cop0, cF |
dd cop22, cop22, cop22, cop22, cop21, cop21, cop0, cop0 ; 1x |
dd cop22, cop22, cop22, cop22, cop21, cop21, cop0, cop0 |
dd cop22, cop22, cop22, cop22, cop21, cop21, cseges,cop0 ; 2x |
dd cop22, cop22, cop22, cop22, cop21, cop21, csegcs,cop0 |
dd cop22, cop22, cop22, cop22, cop21, cop21, csegss,cop0 ; 3x |
dd cop22, cop22, cop22, cop22, cop21, cop21, csegds,cop0 |
dd cinc1, cinc1, cinc1, cinc1, cinc1, cinc1, cinc1, cinc1 ; 4x |
dd cdec1, cdec1, cdec1, cdec1, cdec1, cdec1, cdec1, cdec1 |
dd cpush1,cpush1,cpush1,cpush1,cpush1,cpush1,cpush1,cpush1 ; 5x |
dd cpop1, cpop1, cpop1, cpop1, cpop1, cpop1, cpop1, cpop1 |
dd cop0, cop0, cunk, cunk, csegfs,cseggs,c66, c67 ; 6x |
dd cpush21,cimul1,cpush22,cimul1,cunk,cunk, cunk, cunk |
dd cjcc1, cjcc1, cjcc1, cjcc1, cjcc1, cjcc1, cjcc1, cjcc1 ; 7x |
dd cjcc1, cjcc1, cjcc1, cjcc1, cjcc1, cjcc1, cjcc1, cjcc1 |
dd cop23, cop23, cop23, cop23, cop22, cop22, cop22, cop22 ; 8x |
dd cop22, cop22, cop22, cop22, cunk, cop22, cunk, cpop2 |
dd cop0, cxchg1,cxchg1,cxchg1,cxchg1,cxchg1,cxchg1,cxchg1 ; 9x |
dd ccbw, ccwd, cunk, cop0, cop0, cop0, cop0, cop0 |
dd cmov3, cmov3, cmov3, cmov3, cop0, cop0, cop0, cop0 ; Ax |
dd cop21, cop21, cop0, cop0, cop0, cop0, cop0, cop0 |
dd cmov11,cmov11,cmov11,cmov11,cmov11,cmov11,cmov11,cmov11 ; Bx |
dd cmov12,cmov12,cmov12,cmov12,cmov12,cmov12,cmov12,cmov12 |
dd cshift1,cshift1,cret2,cop0, cunk, cunk, cmov2, cmov2 ; Cx |
dd center,cop0, cunk, cunk, cop0, cint, cunk, cunk |
dd cshift2,cshift2,cshift3,cshift3,caam,cunk,cunk, cxlat ; Dx |
dd cD8, cD9, cDA, cDB, cDC, cDD, cDE, cDF |
dd cloopnz,cloopz,cloop,cjcxz, cunk, cunk, cunk, cunk ; Ex |
dd ccall1,cjmp1, cunk, cjmp2, cunk, cunk, cunk, cunk |
dd clock, cunk, crepnz,crep, cunk, cop0, cop1, cop1 ; Fx |
dd cop0, cop0, cop0, cop0, cop0, cop0, cop1, cop1 |
disasm_table_2: |
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk ; 0x |
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk |
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk ; 1x |
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk |
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk ; 2x |
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk |
dd cunk, crdtsc,cunk, cunk, csysenter,cunk,cunk, cunk ; 3x |
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk |
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk ; 4x |
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk |
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk ; 5x |
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk |
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk ; 6x |
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk |
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk ; 7x |
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk |
dd cjcc2, cjcc2, cjcc2, cjcc2, cjcc2, cjcc2, cjcc2, cjcc2 ; 8x |
dd cjcc2, cjcc2, cjcc2, cjcc2, cjcc2, cjcc2, cjcc2, cjcc2 |
dd csetcc,csetcc,csetcc,csetcc,csetcc,csetcc,csetcc,csetcc ; 9x |
dd csetcc,csetcc,csetcc,csetcc,csetcc,csetcc,csetcc,csetcc |
dd cunk, cunk, ccpuid,cbtx2, cshld, cshld, cunk, cunk ; Ax |
dd cunk, cunk, cunk, cbtx2, cshrd, cshrd, cunk, cop22 |
dd ccmpxchg,ccmpxchg,cunk,cbtx2,cunk, cunk, cmovzx,cmovzx ; Bx |
dd cunk, cunk, cbtx1, cbtx2, cbsf, cbsr, cmovsx,cmovsx |
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, ccmpxchg8b ; Cx |
dd cbswap,cbswap,cbswap,cbswap,cbswap,cbswap,cbswap,cbswap |
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk ; Dx |
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk |
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk ; Ex |
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk |
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk ; Fx |
dd cunk, cunk, cunk, cunk, cunk, cunk, cunk, cunk |
reg_table: |
db 2,'al',0 |
db 2,'cl',1 |
db 2,'dl',2 |
db 2,'bl',3 |
db 2,'ah',4 |
db 2,'ch',5 |
db 2,'dh',6 |
db 2,'bh',7 |
db 2,'ax',8 |
db 2,'cx',9 |
db 2,'dx',10 |
db 2,'bx',11 |
db 2,'sp',12 |
db 2,'bp',13 |
db 2,'si',14 |
db 2,'di',15 |
db 3,'eax',16 |
db 3,'ecx',17 |
db 3,'edx',18 |
db 3,'ebx',19 |
db 3,'esp',20 |
db 3,'ebp',21 |
db 3,'esi',22 |
db 3,'edi',23 |
db 3,'eip',24 |
db 0 |
fn70_load_block: |
dd 7 |
dd 1 |
load_params dd 0 |
dd 0 |
dd 0 |
i_end: |
loadname: |
db 0 |
rb 255 |
prgname_ptr dd ? |
prgname_len dd ? |
dbgwnd dd ? |
messages rb messages_height*messages_width |
messages_pos dd ? |
cmdline rb cmdline_width+1 |
cmdline_len dd ? |
cmdline_pos dd ? |
curarg dd ? |
was_temp_break db ? |
dbgbufsize dd ? |
dbgbuflen dd ? |
dbgbuf rb 256 |
needzerostart: |
context: |
_eip dd ? |
_eflags dd ? |
_eax dd ? |
_ecx dd ? |
_edx dd ? |
_ebx dd ? |
_esp dd ? |
_ebp dd ? |
_esi dd ? |
_edi dd ? |
oldcontext rb $-context |
dumpread dd ? |
dumppos dd ? |
dumpdata rb dump_height*10h |
; breakpoint structure: |
; dword +0: address |
; byte +4: flags |
; bit 0: 1 <=> breakpoint valid |
; bit 1: 1 <=> breakpoint disabled |
; bit 2: 1 <=> one-shot breakpoint |
; bit 3: 1 <=> DRx breakpoint |
; byte +5: overwritten byte |
; for DRx breaks: flags + (index shl 6) |
breakpoints_n = 256 |
breakpoints rb breakpoints_n*6 |
drx_break rd 4 |
disasm_buf_size dd ? |
bReload db ? |
needzeroend: |
disasm_buffer rb 256 |
disasm_start_pos dd ? |
disasm_cur_pos dd ? |
disasm_cur_str dd ? |
disasm_string rb 256 |
i_param rb 256 |
; stack |
align 400h |
rb 400h |
used_mem: |
/programs/develop/mtdbg/mtdbg.txt |
---|
0,0 → 1,203 |
Ââåäåíèå. |
mtdbg ïðåäñòàâëÿåò ñîáîé îòëàä÷èê äëÿ îïåðàöèîííîé ñèñòåìû Kolibri. Äàííàÿ |
äîêóìåíòàöèÿ îïèñûâàåò âîçìîæíîñòè îòëàä÷èêà è ðàáîòó ñ íèì. Åñëè íóæíû |
êàêèå-òî âîçìîæíîñòè îòëàä÷èêà, êîòîðûõ åù¸ íåò, ëèáî îáðàùàéòåñü íà ôîðóì |
meos.sysbin.com (ðàçäåë "Ïðîãðàììû"), ëèáî ìûëüòå ìíå íà àäðåñ, óêàçàííûé â |
êîíöå äàííîãî ôàéëà. |
Îáùåå îïèñàíèå. |
 êàæäûé ìîìåíò âðåìåíè mtdbg ìîæåò îòëàæèâàòü òîëüêî îäíó ïðîãðàììó. Íàçîâ¸ì |
òàêóþ ïðîãðàììó çàãðóæåííîé äëÿ îòëàäêè. Åñëè íèêàêàÿ ïðîãðàììà íå çàãðóæåíà, |
àáñîëþòíîå áîëüøèíñòâî äåéñòâèé ïî îòëàäêå íåäîñòóïíî. |
mtdbg óïðàâëÿåòñÿ êîìàíäíîé ñòðîêîé, ââîäèìîé ñ êëàâèàòóðû. Êîìàíäíàÿ ñòðîêà |
èçîáðàæàåòñÿ â íèæíåé ÷àñòè îêíà îòëàä÷èêà. Îáðàáàòûâàþòñÿ ñòàíäàðòíûå êëàâèøè |
ââîäà Backspace,Delete,Home,End,ñòðåëêè âëåâî/âïðàâî. |
Êîìàíäû íå÷óâñòâèòåëüíû ê ðåãèñòðó ñèìâîëîâ.  êà÷åñòâå ðàçäåëèòåëÿ |
èñïîëüçóåòñÿ ïðîèçâîëüíîå íåíóëåâîå ÷èñëî ïðîáåëîâ. |
 ëþáîé ìîìåíò îòëàä÷èê ìîæíî çàâåðøèòü êîìàíäîé "quit" (áåç àðãóìåíòîâ). |
Âïðî÷åì, ìîæíî è ïðîñòî íàæàòü íà êíîïêó çàêðûòèÿ â ëåâîì âåðõíåì óãëó îêíà. |
Çàïóñê îòëàä÷èêà áåç ïàðàìåòðîâ êîìàíäíîé ñòðîêè ïðèâîäèò ê òîìó, ÷òî |
íèêàêàÿ ïðîãðàììà íå çàãðóæåíà. Òàêæå mtdbg ìîæíî çàïóñêàòü ñ êîìàíäíîé |
ñòðîêîé, â ýòîì ñëó÷àå îí ïîïûòàåòñÿ çàãðóçèòü ïðîãðàììó ñ èìåíåì, óêàçàííûì |
êàê ïåðâûé àðãóìåíò êîìàíäíîé ñòðîêè, è ïàðàìåòðàìè, óêàçàííûìè êàê |
ïîñëåäóþùèå (åñëè îíè åñòü). |
Åñëè íèêàêàÿ ïðîãðàììà íå çàãðóæåíà, òî ìîæíî çàãðóçèòü ïðîãðàììó êîìàíäîé |
load <ïîëíîå èìÿ èñïîëíÿåìîãî ôàéëà> [<àðãóìåíòû>] |
Íàïðèìåð: |
load /rd/1/example |
LOAD /rd/1/aclock w200 h200 |
LoaD /hd0/1/menuetos/dosbox/dosbox |
Âñ¸, ÷òî ñòîèò ïîñëå ïåðâîãî ïðîáåëà ïîñëå èìåíè èñïîëíÿåìîãî ôàéëà, äîñëîâíî |
ïåðåäà¸òñÿ ïðîãðàììå â êà÷åñòâå êîìàíäíîé ñòðîêè. |
Êîìàíäà load ñîîáùàåò î ðåçóëüòàòå â îêíå ñîîáùåíèé (íåìíîãî âûøå îêíà |
êîìàíäíîé ñòðîêè). Åñëè ïðîãðàììó óäàëîñü çàãðóçèòü, òî îá ýòîì ïîÿâèòñÿ |
ñîîòâåòñòâóþùåå ñîîáùåíèå; åñëè íå óäàëîñü, òî â ñîîáùåíèè áóäåò óêàçàíà |
ïðè÷èíà îøèáêè. Íàèáîëåå âåðîÿòíàÿ - "file not found", åñëè íåïðàâèëüíî óêàçàíî |
èìÿ ôàéëà. |
Ìîæåò ñëó÷èòüñÿ òàê, ÷òî çàãðóæåííàÿ ïðîãðàììà óïàêîâàíà. Îáùèé ïðèíöèï |
óïàêîâêè ïðîãðàìì ñëåäóþùèé: ñíà÷àëà èñõîäíûé ôàéë ïàêóåòñÿ (êàêèì-íèáóäü |
àëãîðèòìîì ñæàòèÿ), ïîòîì ïðèïèñûâàåòñÿ íåáîëüøîé ïî ðàçìåðó êîä, êîòîðûé |
ïîëó÷àåò óïðàâëåíèå ïðè çàïóñêå ïðîãðàììû, ðàñïàêîâûâàåò â ïàìÿòè èñõîäíûé êîä, |
ïîñëå ÷åãî ïåðåäà¸ò åìó óïðàâëåíèå. Åñëè ïðîãðàììà óïàêîâàíà, òî å¸ "íàñòîÿùèé" |
êîä íå âèäåí è äëÿ îòëàäêè íóæíî ïðåäâàðèòåëüíî ïðîéòè êîä ðàñïàêîâùèêà. |
mtdbg îïðåäåëÿåò áîëüøèíñòâî ñóùåñòâóþùèõ óïàêîâùèêîâ (mxp,mxp_lzo,mxp_nrv, |
mtappack) è â ýòîì ñëó÷àå ïðåäëàãàåò àâòîìàòè÷åñêè ïðîéòè äî "íàñòîÿùåãî" êîäà. |
Ðåêîìåíäóåòñÿ ñîãëàñèòüñÿ (íàæàòü 'y' èëè <Enter>), íî ìîæíî è îòêàçàòüñÿ. |
Ïðè îòêàçå è â ñëó÷àå, êîãäà ïðîãðàììà óïàêîâàíà ÷åì-òî íåèçâåñòíûì, ìîæíî |
èñïîëüçîâàòü êîìàíäó "unpack" (áåç àðãóìåíòîâ). Âûçûâàéòå å¸ òîëüêî â ñëó÷àå, |
êîãäà âû óâåðåíû, ÷òî ïðîãðàììà óïàêîâàíà è ÷òî óïðàâëåíèå åù¸ íå äîøëî äî |
îñíîâíîãî êîäà! |
Çàãðóæåííóþ ïðîãðàììó ìîæíî ïðèáèòü êîìàíäîé "terminate" (áåç àðãóìåíòîâ). |
Êîìàíäà "detach" (áåç àðãóìåíòîâ) îòêëþ÷àåòñÿ îò ïðîãðàììû, ïîñëå ÷åãî |
ïðîãðàììà ïðîäîëæàåò âûïîëíÿòüñÿ íîðìàëüíî, êàê åñëè áû îòëàä÷èêà íå áûëî. |
Ïîñëå îáåèõ ýòèõ êîìàíä ïðîãðàììà ïåðåñòà¸ò áûòü îòëàæèâàåìîé. |
Ìîæíî çàíîâî çàãðóçèòü ïðîãðàììó äëÿ îòëàäêè êîìàíäîé "reload" (áåç |
àðãóìåíòîâ). Åñëè óæå åñòü çàãðóæåííàÿ ïðîãðàììà, òî îíà ïðèáèâàåòñÿ è |
çàïóñêàåòñÿ (ñ ñàìîãî íà÷àëà) íîâûé ýêçåìïëÿð (ñ òîé æå êîìàíäíîé ñòðîêîé), |
â ýòîì ñëó÷àå êîìàíäà àíàëîãè÷íà êîìàíäàì |
terminate |
load <last program name> <last program arguments> |
 ïðîòèâíîì ñëó÷àå çàíîâî çàãðóæàåòñÿ ïðîãðàììà, êîòîðóþ îòëàæèâàëè ïîñëåäíåé |
(â òåêóùåì ñåàíñå ðàáîòû ñ mtdbg) (ñ òîé æå êîìàíäíîé ñòðîêîé), ò.å. ïî÷òè òî |
æå ñàìîå, ÷òî è |
load <last program name> <last program arguments>, |
íî êîìàíäà reload â îáîèõ ñëó÷àÿõ êîðî÷å è óäîáíåå; êðîìå òîãî, load ñ÷èòàåò, |
÷òî çàãðóæàåòñÿ íîâàÿ ïðîãðàììà, è ïåðåâîäèò îêíî äàííûõ (ñì. íèæå) íà |
íóëåâîé àäðåñ, à reload ñîõðàíÿåò òåêóùèé àäðåñ. |
Âñåãäà äîñòóïíà êîìàíäà "help", êîòîðóþ ìîæíî ñîêðàùàòü äî "h". |
Âñå êîìàíäû ðàçáèòû íà ãðóïïû. |
help áåç àðãóìåíòîâ ïîêàçûâàåò ñïèñîê ãðóïï êîìàíä. |
help ñ óêàçàíèåì ãðóïïû âûâîäèò ñïèñîê êîìàíä ýòîé ãðóïïû ñ êðàòêèìè |
êîììåíòàðèÿìè. |
help ñ óêàçàíèåì êîìàíäû âûâîäèò èíôîðìàöèþ î çàäàííîé êîìàíäå. |
Íàïðèìåð: |
help |
help control |
h LoaD |
Îêíî îòëàä÷èêà ñîñòîèò èç ñëåäóþùèõ ýëåìåíòîâ, ïåðå÷èñëÿåìûõ ñâåðõó âíèç: |
- ñòðîêà ñîñòîÿíèÿ. Ïðè íàëè÷èè çàãðóæåííîé ïðîãðàììû ïîêàçûâàåò åå èìÿ è |
ñîñòîÿíèå ("Running"/"Paused"), ïðè îòñóòñòâèè ñîîáùàåò "No program loaded". |
- îêíî ðåãèñòðîâ - ïîêàçûâàåò çíà÷åíèÿ ðåãèñòðîâ îáùåãî íàçíà÷åíèÿ, ðåãèñòðà |
eip è ðåãèñòðà ôëàãîâ. Ïîñëåäíèé çàïèñàí äâóìÿ ñïîñîáàìè: ïîëíîå hex-çíà÷åíèå |
è ñîñòîÿíèÿ îòäåëüíûõ ôëàãîâ: CF,PF,AF,ZF,SF,DF,OF: åñëè ôëàã ñáðîøåí, òî |
èçîáðàæàåòñÿ ìàëåíüêàÿ áóêâà, åñëè óñòàíîâëåí, òî çàãëàâíàÿ. |
Ðåãèñòðû, èçìåíèâøèåñÿ ñ ïðåäûäóùåãî ìîìåíòà, ïîäñâå÷èâàþòñÿ çåëåíûì. |
- îêíî äàííûõ (îêíî äàìïà) - ïîêàçûâàåò ñîäåðæèìîå ïàìÿòè çàãðóæåííîé ïðîãðàììû |
- îêíî êîäà (îêíî äèçàññåìáëåðà) - ïîêàçûâàåò êîä ïðîãðàììû â âèäå |
äèçàññåìáëèðîâàííûõ èíñòðóêöèé |
- îêíî ñîîáùåíèé |
- îêíî êîìàíäíîé ñòðîêè |
 îêíå äàìïà ìîæíî ïðîñìàòðèâàòü äàííûå, íà÷èíàÿ ñ ëþáîãî àäðåñà, äëÿ ýòîãî |
åñòü êîìàíäà |
d <âûðàæåíèå> |
Êîìàíäà d áåç àðãóìåíòîâ ïðîëèñòûâàåò îêíî äàìïà âíèç. |
Òî æå ñàìîå îòíîñèòñÿ ê îêíó êîäà è êîìàíäå |
u <âûðàæåíèå> |
èëè ïðîñòî u. |
Íàïðèìåð: |
d esi - ïîêàçûâàåò äàííûå, íàõîäÿùèåñÿ ïî àäðåñó esi (íàïðèìåð, ïîëåçíà ïåðåä |
âûïîëíåíèåì èíñòðóêöèè rep movsb) |
d esp - ïîêàçûâàåò ñòåê |
u eip - äèçàññåìáëèðóåò èíñòðóêöèè, íà÷èíàÿ ñ òåêóùåé |
Âûðàæåíèÿ â mtdbg ìîãóò âêëþ÷àòü |
- øåñòíàäöàòåðè÷íûå êîíñòàíòû |
- èìåíà âñåõ ðåãèñòðîâ îáùåãî íàçíà÷åíèÿ (8 32-áèòíûõ, 8 16-áèòíûõ è |
8 8-áèòíûõ) è ðåãèñòðà eip; çíà÷åíèÿ 16- è 8-áèòíûõ ðåãèñòðîâ ðàñøèðÿþòñÿ |
íóëÿìè äî 32 áèò |
- ÷åòûðå àðèôìåòè÷åñêèå îïåðàöèè +,-,*,/ (ñî ñòàíäàðòíûìè ïðèîðèòåòàìè) è |
ñêîáêè. |
Âñå âû÷èñëåíèÿ ïðîèçâîäÿòñÿ ïî ìîäóëþ 2^32. |
Ïðèìåðû âûðàæåíèé: |
eax |
eip+2 |
ecx-esi-1F |
al+AH*bl |
ax + 2* bH*(eip+a73) |
3*esi*di/EAX |
Êîìàíäà |
? <âûðàæåíèå> |
âû÷èñëÿåò çíà÷åíèå óêàçàííîãî âûðàæåíèÿ. |
Çíà÷åíèÿ ðåãèñòðîâ çàãðóæåííîé ïðîãðàììû ìîæíî èçìåíÿòü êîìàíäîé r, èìåþùåé |
äâå àáñîëþòíî ýêâèâàëåíòíûå ôîðìû: |
r <ðåãèñòð> <âûðàæåíèå> |
r <ðåãèñòð>=<âûðàæåíèå> |
(â îáîèõ ñëó÷àÿõ ìîæíî ðàññòàâëÿòü ïðîáåëû ïî âêóñó).  êà÷åñòâå ðåãèñòðà ìîæíî |
óêàçûâàòü ëþáîé èç âûøåóïîìÿíóòûõ - 24 ðåãèñòðà îáùåãî íàçíà÷åíèÿ è eip. |
Äîïóñòèì, êîìàíäà load óñïåøíî çàãðóçèëà ïðîãðàììó äëÿ îòëàäêè. |
Ñðàçó ïîñëå çàãðóçêè ïðîãðàììà ïðèîñòàíîâëåíà è íå âûïîëíÿåòñÿ. |
Íàæàòèå Ctrl+F7 (àíàëîã êîìàíäíîé ñòðîêè - êîìàíäà "s") äåëàåò îäèí øàã â |
çàãðóæåííîé ïðîãðàììå, ïîñëå ÷åãî óïðàâëåíèå âîçâðàùàåòñÿ îòëàä÷èêó, êîòîðûé |
ïîêàçûâàåò íîâîå ñîäåðæèìîå ðåãèñòðîâ è ïàìÿòè. Ñèñòåìíûé âûçîâ int 40h ïðè |
ýòîì ñ÷èòàåòñÿ îäíèì øàãîì. |
Íàæàòèå Ctrl+F8 (àíàëîã êîìàíäíîé ñòðîêè - êîìàíäà "p") òàêæå äåëàåò øàã â |
çàãðóæåííîé ïðîãðàììå, íî ïðè ýòîì âûçîâû ïðîöåäóð, ñòðîêîâûå îïåðàöèè ñ |
ïðåôèêñîì rep/repz/repnz è öèêëû loop âûïîëíÿþòñÿ êàê îäèí øàã. |
Êîìàíäû ïîøàãîâîãî âûïîëíåíèÿ èñïîëüçóþòñÿ, êàê ïðàâèëî, íà îòäåëüíûõ ó÷àñòêàõ |
ïðîãðàììû, êîãäà íóæíî, íàïðèìåð, ðåãóëÿðíî îòñëåæèâàòü çíà÷åíèÿ ðåãèñòðîâ |
è/èëè êàêèõ-òî ïåðåìåííûõ â ïàìÿòè. |
Êîìàíäà |
g <âûðàæåíèå> |
âîçîáíîâëÿåò âûïîëíåíèå ïðîãðàììû è æä¸ò, ïîêà óïðàâëåíèå äîéä¸ò äî |
eip=ñîîòâåòñòâóþùåìó àäðåñó, à â ýòîò ìîìåíò ïðèîñòàíàâëèâàåò ïðîãðàììó. |
Êîìàíäà "g" áåç àðãóìåíòîâ ïðîñòî âîçîáíîâëÿåò âûïîëíåíèå ïðîãðàììû. |
Ïðèîñòàíîâèòü âûïîëíåíèå ïðîãðàììû ìîæíî êîìàíäîé "stop" (áåç àðãóìåíòîâ). |
Îáû÷íî òðåáóåòñÿ, ÷òîáû ïðîãðàììà íîðìàëüíî âûïîëíÿëàñü, íî ïðè íàñòóïëåíèè |
îïðåäåë¸ííûõ óñëîâèé ïðîãðàììà ïðèîñòàíàâàëàñü è óïðàâëåíèå ïîëó÷àë îòëàä÷èê. |
Ñîîòâåòñòâóþùèå óñëîâèÿ íàçûâàþòñÿ òî÷êàìè îñòàíîâà, breakpoint(s), â |
ïðîñòîðå÷èè - áðÿêàìè. Ïðîñòåéøèé òèï òî÷åê îñòàíîâà - íà êîíêðåòíûé àäðåñ, |
ò.å. ïðåðûâàòü âûïîëíåíèå ïðè eip=<çàäàííîå çíà÷åíèå>. Òàêèå òî÷êè îñòàíîâà |
óñòàíàâëèâàþòñÿ êîìàíäîé |
bp <âûðàæåíèå> |
Çàìå÷àíèå. Åñëè åñòü òîëüêî îäíà òàêàÿ òî÷êà îñòàíîâà, óäîáíåå âìåñòî íå¸ |
èñïîëüçîâàòü êîìàíäó "g" ñ àðãóìåíòîì. |
Äðóãîé òèï òî÷åê îñòàíîâà - ïî îáðàùåíèþ ê çàäàííîìó ó÷àñòêó ïàìÿòè. |
Òàêèõ òî÷åê îñòàíîâà ìîæåò áûòü íå áîëüøå ÷åòûð¸õ (ïîñêîëüêó èñïîëüçóþòñÿ |
àïïàðàòíûå âîçìîæíîñòè ïðîöåññîðîâ x86, ãäå äîïóñêàþòñÿ òîëüêî 4 òàêèõ òî÷êè). |
bpm <âûðàæåíèå> - áðÿêàåòñÿ íà ëþáîé äîñòóï ê áàéòó ïî óêàçàííîìó àäðåñó |
bpm w <âûðàæåíèå> - áðÿêàåòñÿ íà çàïèñü áàéòà ïî óêàçàííîìó àäðåñó |
bpmb,bpmw,bpmd <âûðàæåíèå> - áðÿêàþòñÿ íà äîñòóï ê ñîîòâåòñòâåííî áàéòó, ñëîâó |
è äâîéíîìó ñëîâó ïî óêàçàííîìó àäðåñó. bpm è bpmb - ñèíîíèìû. Ïðè èñïîëüçîâàíèè |
bpmw,bpmd àäðåñ äîëæåí áûòü âûðîâíåí ñîîòâåòñòâåííî íà ãðàíèöó ñëîâà (ò.å. áûòü |
÷¸òíûì) èëè íà ãðàíèöó äâîéíîãî ñëîâà (ò.å. äåëèòüñÿ íà 4). |
bpmb,bpmw,bpmd w <âûðàæåíèå> - àíàëîãè÷íî äëÿ áðÿêà íà çàïèñü. |
Ñïèñîê óñòàíîâëåííûõ òî÷åê îñòàíîâà ìîæíî ïðîñìîòðåòü êîìàíäîé "bl", èíôîðìàöèþ |
î êîíêðåòíîé òî÷êå îñòàíîâà ìîæíî ïîëó÷èòü ñ ïîìîùüþ "bl <íîìåð>". Íåíóæíûå |
òî÷êè îñòàíîâà óäàëÿþòñÿ êîìàíäîé "bc <íîìåð>", âðåìåííî íåíóæíûå ìîæíî |
çàïðåòèòü êîìàíäîé "bd <íîìåð>", êîãäà îíè ñòàíóò ñíîâà íóæíû, èñïîëüçóéòå |
êîìàíäó "be <íîìåð>". |
Çàìå÷àíèÿ. |
1. Ïðè îòëàäêå ñîáñòâåííûõ ïðîãðàìì ìîæíî âñòàâëÿòü â êîä èíñòðóêöèè |
int3 (îáðàòèòå âíèìàíèå íà îòñóòñòâèå ïðîáåëà!). Òàêàÿ èíñòðóêöèÿ âûçûâàåò |
èñêëþ÷åíèå ïðè íîðìàëüíîì çàïóñêå, ÷òî ïðèâåä¸ò ê çàâåðøåíèþ ïðîöåññà, |
íî ïðè ðàáîòå ïîä îòëàä÷èêîì ïðîñòî àêòèâèçèðóåòñÿ îòëàä÷èê (ñ ñîîáùåíèåì |
"int3 command at xxx"). Ýòî ïîçâîëÿåò íå äóìàòü î òîì, êàêèå àäðåñà |
èñïîëüçîâàòü â êîìàíäàõ g è/èëè bp. |
2. Âåñü âûâîä è âåñü ââîä îðèåíòèðîâàí íà 16-ðè÷íóþ ñèñòåìó ñ÷èñëåíèÿ. |
3. Êîãäà ïðîãðàììà âûïîëíÿåòñÿ, îêíà ðåãèñòðîâ è äàííûõ ïîêàçûâàþò èíôîðìàöèþ, |
îòíîñÿùóþñÿ ê ìîìåíòó äî âîçîáíîâëåíèÿ; óñòàíîâêà çíà÷åíèé ðåãèñòðîâ â |
ýòîì ðåæèìå íåâîçìîæíà. Âïðî÷åì, êîìàíäà "d" â ýòîì ðåæèìå ïîêàçûâàåò |
èíôîðìàöèþ, âåðíóþ â ìîìåíò âûäà÷è êîìàíäû. |
diamond |
mailto:diamondz@land.ru |
/programs/fs/rdfdel/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/fs/rdfdel/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/fs/rdfdel/trunk/rdfdel.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/fs/rdfdel/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/fs/hexhd/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/fs/hexhd/trunk/hexhd.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/fs/hexhd/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/fs/hexhd/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/fs/copyr/trunk/macros.inc |
---|
143,9 → 143,6 |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
177,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
221,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
/programs/fs/kfar/trunk/kfar.asm |
---|
3596,12 → 3596,14 |
dd aJpg, jpegview |
dd aJpeg, jpegview |
dd aGif, gifview |
dd aWav, ac97wav |
dd aMp3, ac97wav |
dd aWav, ac97 |
dd aMp3, ac97 |
dd aMid, midamp |
dd aBmp, mv |
dd aPng, archer |
dd aRtf, rtfread |
dd a3ds, view3ds |
dd aLif, life2 |
associations_end: |
aAsm db 'asm',0 |
3618,7 → 3620,7 |
aWav db 'wav',0 |
aMp3 db 'mp3',0 |
ac97wav db '/rd/1/AC97WAV',0 |
ac97 db '/rd/1/AC97SND',0 |
aMid db 'mid',0 |
midamp db '/rd/1/MIDAMP',0 |
3632,6 → 3634,12 |
aRtf db 'rtf',0 |
rtfread db '/rd/1/RtfRead',0 |
a3ds db '3ds',0 |
view3ds db '/rd/1/3d/view3ds',0 |
aLif db 'lif',0 |
life2 db '/rd/1/demos/life2',0 |
bConfirmDelete db 1 |
; ¤¥áì § ª 稢 îâáï ª®ä¨£ãà æ¨®ë¥ ¤ ë¥ |
/programs/fs/sysxtree/trunk/macros.inc |
---|
1,15 → 1,3 |
; language for programs |
lang fix en ; ru en fr ge fi |
@^ fix macro comment { |
^@ fix } |
macro m2m dest,src { |
push src |
pop dest |
} |
; new application structure |
macro meos_app_start |
{ |
89,72 → 77,35 |
macro sz name,[data] { ; from MFAR [mike.dld] |
common |
if used name |
name db data |
.size = $-name |
label name |
end if |
} |
macro lsz name,[lng,data] { ; from MFAR [mike.dld] |
common |
forward |
if used name |
label name |
forward |
if lang eq lng |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
macro szc name,elsz,[data] { ; from MFAR [mike.dld] |
macro lsz name,[lng,data] { ; from MFAR [mike.dld] |
common |
local s,m |
m = 0 |
if used name |
label name |
virtual at 0 |
db data |
s = $ |
end virtual |
d#elsz s |
if m < s |
m = s |
end if |
forward |
if (used name)&(lang eq lng) |
db data |
.size = $-name |
.maxl = m |
end if |
} |
macro lszc name,elsz,[lng,data] { ; from MFAR [mike.dld] |
common |
local s,m,c |
m = 0 |
c = 0 |
if used name |
label name |
forward |
if lang eq lng |
virtual at 0 |
db data |
s = $ |
end virtual |
d#elsz s |
if m < s |
m = s |
end if |
db data |
c = c+1 |
end if |
common |
.size = $-name |
.maxl = m |
.count = c |
end if |
} |
; easy system call macro |
macro mpack dest, hsrc, lsrc |
{ |
172,12 → 123,6 |
end if |
} |
;macro __mov reg,a { ; mike.dld |
; if ~a eq |
; mov reg,a |
; end if |
;} |
macro __mov reg,a,b { ; mike.dld |
if (~a eq)&(~b eq) |
mpack reg,a,b |
197,72 → 142,7 |
} |
; ------------------------- |
macro header a,[b] { |
common |
use32 |
org 0 |
db 'MENUET',a |
forward |
if b eq |
dd 0 |
else |
dd b |
end if } |
macro section name { align 16 |
label name } |
macro func name { |
if ~used name |
display 'FUNC NOT USED: ',`name,13,10 |
else |
align 4 |
name: |
;pushad |
;pushfd |
;dps `name |
;newline |
;mcall 5,1 |
;popfd |
;popad |
} |
macro endf { end if } |
macro diff16 title,l1,l2 |
{ |
local s,d |
s = l2-l1 |
display title,': 0x' |
repeat 8 |
d = '0' + s shr ((8-%) shl 2) and $0F |
if d > '9' |
d = d + 'A'-'9'-1 |
end if |
display d |
end repeat |
display 13,10 |
} |
macro diff10 title,l1,l2 |
{ |
local s,d,z,m |
s = l2-l1 |
z = 0 |
m = 1000000000 |
display title,': ' |
repeat 10 |
d = '0' + s / m |
s = s - (s/m)*m |
m = m / 10 |
if d <> '0' |
z = 1 |
end if |
if z <> 0 |
display d |
end if |
end repeat |
display 13,10 |
} |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
294,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
314,230 → 194,54 |
} |
macro RGB [a] { |
common |
match (r=,g=,b),a \{ |
\dd ((r) shl 16) or ((g) shl 8) or (b) |
\} |
} |
struc POINT _t,_dx,_dy { |
.x _t _dx |
.y _t _dy |
} |
; Macroinstructions for defining data structures |
macro struct name |
{ fields@struct equ name |
match child parent, name \{ fields@struct equ child,fields@\#parent \} |
sub@struct equ |
struc db [val] \{ \common fields@struct equ fields@struct,.,db,<val> \} |
struc dw [val] \{ \common fields@struct equ fields@struct,.,dw,<val> \} |
struc du [val] \{ \common fields@struct equ fields@struct,.,du,<val> \} |
struc dd [val] \{ \common fields@struct equ fields@struct,.,dd,<val> \} |
struc dp [val] \{ \common fields@struct equ fields@struct,.,dp,<val> \} |
struc dq [val] \{ \common fields@struct equ fields@struct,.,dq,<val> \} |
struc dt [val] \{ \common fields@struct equ fields@struct,.,dt,<val> \} |
struc rb count \{ fields@struct equ fields@struct,.,db,count dup (?) \} |
struc rw count \{ fields@struct equ fields@struct,.,dw,count dup (?) \} |
struc rd count \{ fields@struct equ fields@struct,.,dd,count dup (?) \} |
struc rp count \{ fields@struct equ fields@struct,.,dp,count dup (?) \} |
struc rq count \{ fields@struct equ fields@struct,.,dq,count dup (?) \} |
struc rt count \{ fields@struct equ fields@struct,.,dt,count dup (?) \} |
macro db [val] \{ \common \local anonymous |
fields@struct equ fields@struct,anonymous,db,<val> \} |
macro dw [val] \{ \common \local anonymous |
fields@struct equ fields@struct,anonymous,dw,<val> \} |
macro du [val] \{ \common \local anonymous |
fields@struct equ fields@struct,anonymous,du,<val> \} |
macro dd [val] \{ \common \local anonymous |
fields@struct equ fields@struct,anonymous,dd,<val> \} |
macro dp [val] \{ \common \local anonymous |
fields@struct equ fields@struct,anonymous,dp,<val> \} |
macro dq [val] \{ \common \local anonymous |
fields@struct equ fields@struct,anonymous,dq,<val> \} |
macro dt [val] \{ \common \local anonymous |
fields@struct equ fields@struct,anonymous,dt,<val> \} |
macro rb count \{ \local anonymous |
fields@struct equ fields@struct,anonymous,db,count dup (?) \} |
macro rw count \{ \local anonymous |
fields@struct equ fields@struct,anonymous,dw,count dup (?) \} |
macro rd count \{ \local anonymous |
fields@struct equ fields@struct,anonymous,dd,count dup (?) \} |
macro rp count \{ \local anonymous |
fields@struct equ fields@struct,anonymous,dp,count dup (?) \} |
macro rq count \{ \local anonymous |
fields@struct equ fields@struct,anonymous,dq,count dup (?) \} |
macro rt count \{ \local anonymous |
fields@struct equ fields@struct,anonymous,dt,count dup (?) \} |
macro union \{ fields@struct equ fields@struct,,union,< |
sub@struct equ union \} |
macro struct \{ fields@struct equ fields@struct,,substruct,< |
sub@struct equ substruct \} |
virtual at 0 } |
macro ends |
{ match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt |
restruc rb,rw,rd,rp,rq,rt |
purge db,dw,du,dd,dp,dq,dt |
purge rb,rw,rd,rp,rq,rt |
purge union,struct |
match name=,fields,fields@struct \\{ fields@struct equ |
make@struct name,fields |
fields@\\#name equ fields \\} |
end virtual \} |
match any, sub@struct \{ fields@struct equ fields@struct> \} |
restore sub@struct } |
macro make@struct name,[field,type,def] |
{ common |
if $ |
display 'Error: definition of ',`name,' contains illegal instructions.',0Dh,0Ah |
err |
end if |
local define |
define equ name |
forward |
local sub |
match , field \{ make@substruct type,name,sub def |
define equ define,.,sub, \} |
match any, field \{ define equ define,.#field,type,<def> \} |
common |
match fields, define \{ define@struct fields \} } |
macro define@struct name,[field,type,def] |
{ common |
local list |
list equ |
forward |
if ~ field eq . |
name#field type def |
sizeof.#name#field = $ - name#field |
else |
rb sizeof.#type |
end if |
local value |
match any, list \{ list equ list, \} |
list equ list <value> |
common |
sizeof.#name = $ |
restruc name |
match values, list \{ |
struc name value \\{ |
match any, fields@struct \\\{ fields@struct equ fields@struct,.,name,<values> \\\} |
match , fields@struct \\\{ label . |
forward |
match , value \\\\{ field type def \\\\} |
match any, value \\\\{ field type value |
if ~ field eq . |
rb sizeof.#name#field - ($-field) |
end if \\\\} |
common \\\} \\} \} } |
macro enable@substruct |
{ macro make@substruct substruct,parent,name,[field,type,def] |
\{ \common |
\local define |
define equ parent,name |
\forward |
\local sub |
match , field \\{ match any, type \\\{ enable@substruct |
make@substruct type,name,sub def |
purge make@substruct |
define equ define,.,sub, \\\} \\} |
match any, field \\{ define equ define,.\#field,type,<def> \\} |
\common |
match fields, define \\{ define@\#substruct fields \\} \} } |
enable@substruct |
macro define@union parent,name,[field,type,def] |
{ common |
{ |
virtual at 0 |
forward |
if ~ field eq . |
virtual at 0 |
parent#field type def |
sizeof.#parent#field = $ - parent#field |
name name |
sizeof.#name = $ - name |
end virtual |
if sizeof.#parent#field > $ |
rb sizeof.#parent#field - $ |
end if |
else if sizeof.#type > $ |
rb sizeof.#type - $ |
end if |
common |
sizeof.#name = $ |
end virtual |
struc name [value] \{ \common |
label .\#name |
last@union equ |
forward |
match any, last@union \\{ virtual at .\#name |
field type def |
end virtual \\} |
match , last@union \\{ match , value \\\{ field type def \\\} |
match any, value \\\{ field type value \\\} \\} |
last@union equ field |
common rb sizeof.#name - ($ - .\#name) \} } |
} |
macro define@substruct parent,name,[field,type,def] |
{ common |
virtual at 0 |
forward |
if ~ field eq . |
parent#field type def |
sizeof.#parent#field = $ - parent#field |
else |
rb sizeof.#type |
end if |
local value |
common |
sizeof.#name = $ |
end virtual |
struc name value \{ |
label .\#name |
forward |
match , value \\{ field type def \\} |
match any, value \\{ field type value |
if ~ field eq . |
rb sizeof.#parent#field - ($-field) |
end if \\} |
common \} } |
; structures used in MeOS |
struc process_information |
{ |
.cpu_usage dd ? ; +0 |
.window_stack_position dw ? ; +4 |
.window_stack_value dw ? ; +6 |
.not_used1 dw ? ; +8 |
.process_name rb 12 ; +10 |
.memory_start dd ? ; +22 |
.used_memory dd ? ; +26 |
.PID dd ? ; +30 |
.x_start dd ? ; +34 |
.y_start dd ? ; +38 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
cpu_usage dd ? ; +0 |
window_stack_position dw ? ; +4 |
window_stack_value dw ? ; +6 |
not_used1 dw ? ; +8 |
process_name rb 12 ; +10 |
memory_start dd ? ; +22 |
used_memory dd ? ; +26 |
PID dd ? ; +30 |
x_start dd ? ; +34 |
y_start dd ? ; +38 |
x_size dd ? ; +42 |
y_size dd ? ; +46 |
slot_state dw ? ; +50 |
rb (1024-52) |
ends |
struc system_colors |
{ |
.frame dd ? |
.grab dd ? |
.grab_button dd ? |
.grab_button_text dd ? |
.grab_text dd ? |
.work dd ? |
.work_button dd ? |
.work_button_text dd ? |
.work_text dd ? |
.work_graph dd ? |
} |
struct system_colors |
frame dd ? |
grab dd ? |
grab_button dd ? |
grab_button_text dd ? |
grab_text dd ? |
work dd ? |
work_button dd ? |
work_button_text dd ? |
work_text dd ? |
work_graph dd ? |
ends |
; constants |
/programs/fs/sysxtree/trunk/sysxtree.asm |
---|
607,9 → 607,11 |
mov ebx, gifview |
cmp ecx, 'GIF' |
jz run |
mov ebx, ac97wav |
mov ebx, ac97 |
cmp ecx, 'WAV' |
jz run |
cmp ecx, 'MP3' |
jz run |
mov ebx, midamp |
cmp ecx, 'MID' |
jz run |
631,6 → 633,12 |
jz run |
cmp ecx, 'INC' |
jz run |
mov ebx, life2 |
cmp ecx, 'LIF' |
jz run |
mov ebx, view3ds |
cmp ecx, '3DS' and not 0x20202020 |
jz run |
jmp still |
execute: |
2540,12 → 2548,14 |
bmpview db '/RD/1/MV',0 |
jpgview db '/RD/1/JPEGVIEW',0 |
gifview db '/RD/1/GIFVIEW',0 |
ac97wav db '/RD/1/AC97WAV',0 |
ac97 db '/RD/1/AC97SND',0 |
rtfread db '/RD/1/RTFREAD',0 |
; //// Willow |
pngview db '/RD/1/@RCHER',0 |
; //// Willow |
midamp db '/RD/1/MIDAMP',0 |
view3ds db '/RD/1/3D/VIEW3DS',0 |
life2 db '/RD/1/DEMOS/LIFE2',0 |
more_char db 10h |
/programs/games/life/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/games/life/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/games/life/trunk/ascl.inc |
---|
File deleted |
/programs/games/life/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/games/life/trunk/life.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/games/freecell/Buben.bmp |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/games/freecell/Club.bmp |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/games/freecell/ClubSml.bmp |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/games/freecell/ClubUD.bmp |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/games/freecell/Cross.bmp |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/games/freecell/Diam.bmp |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/games/freecell/DiamSml.bmp |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/games/freecell/DiamUD.bmp |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/games/freecell/Heart.bmp |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/games/freecell/HeartSml.bmp |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/games/freecell/HeartUD.bmp |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/games/freecell/MACROS.INC |
---|
0,0 → 1,269 |
; new application structure |
macro meos_app_start |
{ |
use32 |
org 0x0 |
db 'MENUET01' |
dd 0x01 |
dd __start |
dd __end |
dd __memory |
dd __stack |
if used __params & ~defined __params |
dd __params |
else |
dd 0x0 |
end if |
dd 0x0 |
} |
MEOS_APP_START fix meos_app_start |
macro code |
{ |
__start: |
} |
CODE fix code |
macro data |
{ |
__data: |
} |
DATA fix data |
macro udata |
{ |
if used __params & ~defined __params |
__params: |
db 0 |
__end: |
rb 255 |
else |
__end: |
end if |
__udata: |
} |
UDATA fix udata |
macro meos_app_end |
{ |
align 32 |
rb 2048 |
__stack: |
__memory: |
} |
MEOS_APP_END fix meos_app_end |
; macro for defining multiline text data |
struc mstr [sstring] |
{ |
forward |
local ssize |
virtual at 0 |
db sstring |
ssize = $ |
end virtual |
dd ssize |
db sstring |
common |
dd -1 |
} |
; strings |
macro sz name,[data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if used name |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
macro lsz name,[lng,data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if (used name)&(lang eq lng) |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
; easy system call macro |
macro mpack dest, hsrc, lsrc |
{ |
if (hsrc eqtype 0) & (lsrc eqtype 0) |
mov dest, (hsrc) shl 16 + lsrc |
else |
if (hsrc eqtype 0) & (~lsrc eqtype 0) |
mov dest, (hsrc) shl 16 |
add dest, lsrc |
else |
mov dest, hsrc |
shl dest, 16 |
add dest, lsrc |
end if |
end if |
} |
macro __mov reg,a,b { ; mike.dld |
if (~a eq)&(~b eq) |
mpack reg,a,b |
else if (~a eq)&(b 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 |
} |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
macro add arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
inc arg1 |
else |
add arg1,arg2 |
end if |
else |
add arg1,arg2 |
end if |
} |
macro sub arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
dec arg1 |
else |
sub arg1,arg2 |
end if |
else |
sub arg1,arg2 |
end if |
} |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
xor arg1,arg1 |
inc arg1 |
else if (arg2) = -1 |
or arg1,-1 |
else if (arg2) > -128 & (arg2) < 128 |
push arg2 |
pop arg1 |
else |
mov arg1,arg2 |
end if |
else |
mov arg1,arg2 |
end if |
} |
macro struct name |
{ |
virtual at 0 |
name name |
sizeof.#name = $ - name |
end virtual |
} |
; structures used in MeOS |
struc process_information |
{ |
.cpu_usage dd ? ; +0 |
.window_stack_position dw ? ; +4 |
.window_stack_value dw ? ; +6 |
.not_used1 dw ? ; +8 |
.process_name rb 12 ; +10 |
.memory_start dd ? ; +22 |
.used_memory dd ? ; +26 |
.PID dd ? ; +30 |
.x_start dd ? ; +34 |
.y_start dd ? ; +38 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
struc system_colors |
{ |
.frame dd ? |
.grab dd ? |
.grab_button dd ? |
.grab_button_text dd ? |
.grab_text dd ? |
.work dd ? |
.work_button dd ? |
.work_button_text dd ? |
.work_text dd ? |
.work_graph dd ? |
} |
struct system_colors |
; constants |
; events |
EV_IDLE = 0 |
EV_TIMER = 0 |
EV_REDRAW = 1 |
EV_KEY = 2 |
EV_BUTTON = 3 |
EV_EXIT = 4 |
EV_BACKGROUND = 5 |
EV_MOUSE = 6 |
EV_IPC = 7 |
EV_STACK = 8 |
; event mask bits for function 40 |
EVM_REDRAW = 1b |
EVM_KEY = 10b |
EVM_BUTTON = 100b |
EVM_EXIT = 1000b |
EVM_BACKGROUND = 10000b |
EVM_MOUSE = 100000b |
EVM_IPC = 1000000b |
EVM_STACK = 10000000b |
/programs/games/freecell/Pick.bmp |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/games/freecell/Spade.bmp |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/games/freecell/SpadeSml.bmp |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/games/freecell/SpadeUD.bmp |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/games/freecell/build.bat |
---|
0,0 → 1,2 |
@fasm freecell.asm freecell |
@pause |
/programs/games/freecell/freecell.ASM |
---|
0,0 → 1,2096 |
; <--- description ---> |
; compiler: FASM 1.50 |
; name: FreeCell for MeOS |
; version: 1.00 |
; last update: 21/07/2004 |
; written by: Alexandr Gorbovets |
; e-mail: gorsash@mail.ru |
include "macros.inc" |
meos_app_start |
code |
call randomize |
call draw_window |
wait_event: |
mov eax, 10 |
int 0x40 |
cmp eax, 1 ; if event == 1 |
je redraw ; jump to redraw handler |
cmp eax, 2 ; else if event == 2 |
je key ; jump to key handler |
cmp eax, 3 ; else if event == 3 |
je button ; jump to button handler |
jmp wait_event ;else return to the start of main cycle |
redraw: ; redraw event handler |
call draw_window |
jmp wait_event |
key: ; key event handler |
mov eax, 2 ; get key code |
int 0x40 |
jmp wait_event |
button: ; button event handler |
mov eax, 17 ; get button identifier |
int 0x40 |
cmp ah, 1 |
je exit_app ; return if button id != 1 |
cmp ah, 1 + 8 |
jbe common_card ; if 1 < ah <= 9 |
cmp ah, 1 + 8 + 4 ; if 9 < ah <= 13 |
jbe temp_cell |
cmp ah, 1 + 8 + 8 |
jbe home_cell |
cmp ah, 1 + 8 + 4 + 4 + 1 |
je new_game_button |
cmp ah, 1 + 8 + 4 + 4 + 2 |
je exit_app |
jmp wait_event |
exit_app: |
mov eax, -1 ; exit application |
int 0x40 |
common_card: |
sub ah, 2 ;going from number of card to number of column |
mov [columnclicked], 0 |
mov byte [columnclicked], ah |
call common_card_click |
jmp wait_event |
temp_cell: |
sub ah, 2 + 8 |
mov [columnclicked], 0 |
mov byte [columnclicked], ah |
call temp_cell_click |
jmp wait_event |
home_cell: |
sub ah, 2 + 8 + 4 |
mov [columnclicked], 0 |
mov byte [columnclicked], ah |
call home_cell_click |
jmp wait_event |
new_game_button: |
call new_game_click |
jmp wait_event |
;****************************************************************************** |
; common_card_click(columnclicked) |
common_card_click: |
; counting code of card, that has been clicked |
mov eax, [columnclicked] |
mov [ncolumn], eax |
call get_row_of_top_card_in_column |
mov eax, [topcardrow] ; eax = topcardrow * 8 + columnofselcard |
mov bl, 8 |
mul bl |
add eax, [columnclicked] |
add eax, cards |
mov ebx, 0 |
mov bl, byte [eax] |
mov [cardclicked], ebx |
call get_sel_card_code_and_addr |
cmp [selcardcode], 52 |
jb .something_selected |
cmp [cardclicked], 52 |
je .end |
mov [whereisselcard], scCommonCells |
mov eax, [columnclicked] |
mov [columnofselcard], eax |
call draw_window |
jmp .end |
.something_selected: |
; checking if selected and clicked cards are equivalent |
mov eax, [selcardcode] |
cmp [cardclicked], eax |
jne .not_same_card |
mov [whereisselcard], scNotSelected |
call draw_window |
jmp .end |
.not_same_card: |
cmp [cardclicked], 52 |
jae .put_in_blank_cell |
mov eax, [selcardcode] |
mov bl, 4 |
div bl |
mov ebx, 0 |
mov bl, ah |
mov [cardfamily], ebx |
mov ecx, 0 |
mov cl, al |
mov [cardrange], ecx |
mov eax, [cardclicked] |
mov bl, 4 |
div bl ; reminder in ah, quotient in al |
mov ebx, 0 |
mov bl, ah |
mov [clickedcardfamily], ebx |
mov ecx, 0 |
mov cl, al |
mov [clickedcardrange], ecx |
; clickedcardrange must be = cardrange + 1 |
mov eax, [cardrange] |
inc eax |
cmp [clickedcardrange], eax ; eax is such as needed |
jne .end |
cmp [cardfamily], 1 |
ja .black_card |
; if selected red card |
cmp [clickedcardfamily], 1 |
jbe .end ; if clicked red card (range <= 1) then exit |
jmp .valid_cards |
.black_card: |
; if selected black card |
cmp [clickedcardfamily], 1 |
ja .end ; if clicked black card then exit |
jmp .valid_cards |
.valid_cards: |
; moving card from its place on clicked card |
mov eax, [columnclicked] |
mov [ncolumn], eax |
call get_row_of_top_card_in_column |
mov eax, [topcardrow] |
inc eax |
mov bl, 8 |
mul bl |
and eax, $0000FFFF |
add eax, [columnclicked] |
add eax, cards |
mov bl, byte [selcardcode] |
mov byte [eax], bl |
mov eax, [selcardaddr] |
mov byte [eax], 52 |
mov [whereisselcard], scNotSelected |
call draw_window |
jmp .end |
.put_in_blank_cell: |
mov eax, cards |
add eax, [columnclicked] |
mov bl, byte [selcardcode] |
mov byte [eax], bl |
mov eax, [selcardaddr] |
mov byte [eax], 52 |
mov [whereisselcard], scNotSelected |
call draw_window |
.end: |
ret |
;****************************************************************************** |
; temp_cell_click(columnclicked) |
temp_cell_click: |
call get_sel_card_code_and_addr |
cmp [selcardcode], 52 |
jb .something_selected |
mov [whereisselcard], scTempCells |
mov eax, [columnclicked] |
mov [columnofselcard], eax |
call draw_window |
jmp .end |
.something_selected: |
; checking if selected and clicked cards equivalent |
mov eax, [columnclicked] |
add eax, tempcells |
mov ebx, 0 |
mov bl, byte [eax] |
mov [cardclicked], ebx |
mov eax, [selcardcode] |
cmp [cardclicked], eax |
jne .not_same_card |
mov [whereisselcard], scNotSelected |
call draw_window |
.not_same_card: |
;putting cards in temp cells |
mov eax, [columnclicked] |
add eax, tempcells |
mov ebx, 0 |
mov bl, byte [eax] |
mov [cardclicked], ebx |
cmp [cardclicked], 52 |
jb .end |
; if nothing lay in this cell |
; move selected card to temp cell |
mov eax, [columnclicked] |
add eax, tempcells |
mov bl, byte [selcardcode] |
mov byte [eax], bl |
mov eax, [selcardaddr] |
mov byte [eax], 52 |
mov [whereisselcard], scNotSelected |
call draw_window |
jmp .end |
.end: |
ret |
;****************************************************************************** |
; home_cell_click(column_clicked) |
home_cell_click: |
call get_sel_card_code_and_addr |
mov eax, [columnclicked] |
add eax, homecells |
mov ebx, 0 |
mov bl, byte [eax] |
mov [cardclicked], ebx |
mov eax, [selcardcode] |
mov bl, 4 |
div bl ; reminder in ah, quotient in al |
mov ebx, 0 |
mov bl, ah |
mov [cardfamily], ebx |
mov ecx, 0 |
mov cl, al |
mov [cardrange], ecx |
cmp [cardclicked], 52 |
jb .not_blank |
; if nothing lay in this cell |
cmp [cardrange], 0 |
jne .end |
; move ace to home |
mov eax, [columnclicked] |
add eax, homecells |
mov bl, byte [selcardcode] |
mov byte [eax], bl |
mov eax, [selcardaddr] |
mov byte [eax], 52 |
mov [whereisselcard], scNotSelected |
call draw_window |
jmp .end |
.not_blank: |
mov eax, [cardclicked] |
mov bl, 4 |
div bl ; reminder in ah, quotient in al |
mov ebx, 0 |
mov bl, ah |
mov [clickedcardfamily], ebx |
mov ecx, 0 |
mov cl, al |
mov [clickedcardrange], ecx |
cmp [cardfamily], ebx |
jne .end |
inc ecx |
cmp [cardrange], ecx |
jne .end |
; moving card from its place to home with replacing |
; of old card in home |
mov eax, [columnclicked] |
add eax, homecells |
mov bl, byte [selcardcode] |
mov byte [eax], bl |
mov eax, [selcardaddr] |
mov byte [eax], 52 |
mov [whereisselcard], scNotSelected |
call draw_window |
.end: |
ret |
;****************************************************************************** |
new_game_click: |
mov [i], 0 |
.deleting_cards_from_common_cells: |
mov eax, cards |
add eax, [i] |
mov byte [eax], 52 |
inc [i] |
cmp [i], 19*8 |
jb .deleting_cards_from_common_cells |
mov [i], 0 |
.filling_pack: |
mov eax, pack |
add eax, [i] |
mov bl, byte [i] |
mov byte [eax], bl |
inc [i] |
cmp [i], 52 |
jb .filling_pack |
mov [i], 0 |
.putting_cards: |
mov [range], 52 |
call random |
mov eax, [random_value] |
add eax, pack |
mov ebx, 0 |
mov bl, byte [eax] |
mov [randomcard], ebx |
mov eax, [random_value] |
mov [j], eax |
cmp [randomcard], 52 |
jb .found_card |
mov [range], 52 |
call random |
cmp [random_value], 26 |
jae .decreasing_j |
.increasing_j: |
inc [j] |
; j mod 52 |
mov eax, [j] |
mov edx, 0 |
mov ebx, 52 |
div ebx |
mov [j], edx |
mov eax, [j] |
add eax, pack |
mov ebx, 0 |
mov bl, byte [eax] |
mov [randomcard], ebx |
cmp [randomcard], 52 |
jb .found_card |
jmp .increasing_j |
.decreasing_j: |
dec [j] |
; i mod 32 |
mov eax, [j] |
mov edx, 0 |
mov ebx, 52 |
div ebx |
mov [j], edx |
mov eax, [j] |
add eax, pack |
mov ebx, 0 |
mov bl, byte [eax] |
mov [randomcard], ebx |
cmp [randomcard], 52 |
jb .found_card |
jmp .decreasing_j |
.found_card: |
; putting card from pack |
mov eax, cards |
add eax, [i] |
mov bl, byte [randomcard] |
mov byte [eax], bl |
; deleting card from pack |
mov eax, pack |
add eax, [j] |
mov byte [eax], 52 |
inc [i] |
cmp [i], 52 |
jb .putting_cards |
mov [i], 0 |
.deleting_cards_from_temp_cells: |
mov eax, tempcells |
add eax, [i] |
mov byte [eax], 52 |
inc [i] |
cmp [i], 4 |
jb .deleting_cards_from_temp_cells |
mov [i], 0 |
.deleting_cards_from_home_cells: |
mov eax, homecells |
add eax, [i] |
mov byte [eax], 52 |
inc [i] |
cmp [i], 4 |
jb .deleting_cards_from_home_cells |
mov [whereisselcard], scNotSelected |
call draw_window |
ret |
;****************************************************************************** |
; get_sel_card_code_and_addr(): selcardcode, selcardaddr |
; if nothing selected, then selcardcode is 52 |
get_sel_card_code_and_addr: |
cmp [whereisselcard], scNotSelected |
jne .something_selected |
mov [selcardcode], 52 |
jmp .end |
.something_selected: |
cmp [whereisselcard], scTempCells |
je .temp_cells_selected |
; common cells selected |
mov eax, [columnofselcard] |
mov [ncolumn], eax |
call get_row_of_top_card_in_column |
mov eax, [topcardrow]; eax = topcardrow * 8 + columnofselcard |
mov bl, 8 |
mul bl ; result of multiplication in ax |
add eax, [columnofselcard] |
add eax, cards |
mov [selcardaddr], eax |
xor ebx, ebx |
mov bl, byte [eax] |
mov [selcardcode], ebx |
jmp .end |
.temp_cells_selected: |
mov eax, tempcells |
add eax, [columnofselcard] |
mov [selcardaddr], eax |
mov ebx, 0 |
mov bl, byte [eax] |
mov [selcardcode], ebx |
.end: |
ret |
;****************************************************************************** |
; draw_window() |
draw_window: |
mov eax,48 ; get system colors |
mov ebx,3 |
mov ecx,syscolors |
mov edx,sizeof.system_colors |
int 0x40 |
mov eax, 12 ; start drawing |
mov ebx, 1 |
int 0x40 |
mov eax, 0 ; create and draw the window |
mov ebx, 100 * 65536 + 8 * cardwidth + 10 + 7 * columnspace |
mov ecx, 100 * 65536 + 500 |
mov edx, 0x13008000 |
mov edi, header |
int 0x40 |
mov eax, 9 ; getting window info |
mov ebx, process_info |
mov ecx, -1 ; we want to know info of our window |
int 0x40 |
mov eax, [process_info.y_size] |
mov [WindowHeight], ax |
mov eax, [process_info.x_size] |
mov [WindowWidth], ax |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
; draw top panel |
mov eax, 13 |
mov ebx, 5 |
shl ebx, 16 |
add bx, word [process_info.x_size] |
sub bx, 9 |
mov ecx, 22 shl 16 + topbuttonsbarheight - 1 |
mov edx, [syscolors.work_graph] |
int $40 |
; draw button "new game" |
mov eax, 8 |
mov ebx, 5 shl 16 + 80 |
mov ecx, 22 shl 16 + topbuttonsbarheight - 2 |
mov edx, 1 + 8 + 4 + 4 + 1 ;button id |
mov esi, [syscolors.work_button] |
int $40 |
mov eax, 4 |
mov ebx, 20 shl 16 + 22 + topbuttonsbarheight/2 - 4 |
mov ecx, [syscolors.work_button_text] |
mov edx, new_game |
mov esi, new_game_len |
int $40 |
; draw button "exit" |
mov eax, 8 |
mov ebx, (5 + 85) shl 16 + 80 + 5 |
mov ecx, 22 shl 16 + topbuttonsbarheight - 2 |
mov edx, 1 + 8 + 4 + 4 + 2 ;button id |
mov esi, [syscolors.work_button] |
int $40 |
mov eax, 4 |
mov ebx, (40 + 80) shl 16 + 22 + topbuttonsbarheight/2 - 4 |
mov ecx, [syscolors.work_button_text] |
mov edx, exit |
mov esi, exit_len |
int $40 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
; draw separators between home, temp and common cells |
mov eax, 13 |
; horizontal line |
mov ebx, 5 |
shl ebx, 16 |
add bx, word [process_info.x_size] |
sub bx, 9 |
mov ecx, (21 + topbuttonsbarheight + cardheight + columnspace) shl 16+1 |
mov edx, [syscolors.work_graph] |
int $40 |
; verical line |
mov eax, [process_info.x_size] |
mov edx, 0 |
mov ecx, 2 |
div ecx |
mov ebx, eax |
; |
shl ebx, 16 |
add bx, 1 |
mov ecx, (21 + topbuttonsbarheight) shl 16 + cardheight + columnspace |
mov edx, [syscolors.work_graph] |
mov eax, 13 |
int $40 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
; draw temp buttons |
mov [j], 0 ;counter that loops from 0 to 51 |
draw_a_temp_card: |
; code of card must be in ecx |
mov eax, tempcells |
add eax, [j] |
xor ecx, ecx |
mov cl, byte [eax] ; placing in cl value from memory |
; with address [tempcells + j] or |
; j-th element of array "tempcells" |
mov [cardcode], ecx |
mov eax, [j] |
xor edx, edx |
mov ebx, 8 |
div ebx ; divsion by 8 (8 columns), |
; so in eax quotient - number of row |
; and in edx remainder - |
; number of column where lay card |
mov [row], eax |
mov [column], edx |
mov eax, [process_info.x_size] ; width of window |
sub eax, 10 |
sub eax, cardwidth |
mov ebx, 7 |
mov edx, 0 |
div ebx |
mov ebx, [column] |
mul ebx |
add eax, 5 |
mov [xpos], eax |
mov eax, [row] |
mov bl, rowsize |
mul bl |
add eax, 24 + topbuttonsbarheight |
mov [ypos], eax |
; checking, if this card selected |
mov [negativedraw], 0 |
cmp [whereisselcard], scTempCells |
jne .this_temp_cell_isnt_selected |
mov eax, [column] |
cmp [columnofselcard], eax |
jne .this_temp_cell_isnt_selected |
mov [negativedraw], 1 |
.this_temp_cell_isnt_selected: |
call draw_card |
; define button on place of card |
mov eax, 8 |
mov ebx, [xpos] |
shl ebx, 16 |
add bx, cardwidth - 1 |
mov ecx, [ypos] |
shl ecx, 16 |
add cx, cardheight - 1 |
mov edx, [column] |
add edx, 01000000000000000000000000000000b + 2 + 8; button id = column |
; id = 1 reserved as close button |
int $40 |
inc [j] |
cmp [j], 4 |
jb draw_a_temp_card |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
; draw home buttons |
mov [j], 0 ;counter that loops from 0 to 51 |
draw_a_home_card: |
; code of card must be in ecx |
mov eax, homecells |
add eax, [j] |
xor ecx, ecx |
mov cl, byte [eax] ; placing in cl value from memory |
; with address [tempcells + j] or |
; j-th element of array "tempcells" |
mov [cardcode], ecx |
mov eax, [j] |
xor edx, edx |
mov ebx, 8 |
div ebx ; divsion by 8 (8 columns), |
; so in eax quotient - number of row |
; and in edx remainder - |
; number of column where lay card |
mov [row], eax |
mov [column], edx |
mov eax, [process_info.x_size] ; width of window |
sub eax, 10 |
sub eax, cardwidth |
mov ebx, 7 |
mov edx, 0 |
div ebx |
mov ebx, [column] |
add ebx, 4 |
mul ebx |
add eax, 5 |
mov [xpos], eax |
mov eax, [row] |
mov bl, rowsize |
mul bl |
add eax, 24 + topbuttonsbarheight |
mov [ypos], eax |
mov [negativedraw], 0 |
call draw_card |
; define button on place of card |
mov eax, 8 |
mov ebx, [xpos] |
shl ebx, 16 |
add bx, cardwidth - 1 |
mov ecx, [ypos] |
shl ecx, 16 |
add cx, cardheight - 1 |
mov edx, [column] |
add edx, 01000000000000000000000000000000b + 2 + 8 + 4 ; button id |
; id = 1 reserved as close button |
int $40 |
inc [j] |
cmp [j], 4 |
jb draw_a_home_card |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
; draw common cards |
mov [j], 0 ;counter that loops from 0 to 8 * 19 |
draw_a_card: |
; code of card must be in ecx |
mov eax, cards |
add eax, [j] |
xor ecx, ecx |
mov cl, byte [eax] ; placing in cl value from memory |
; with address [cards + j] or |
; j-th element of array "cards" |
; cmp ecx, 52 ; if code of card >= 52 then there is no card |
; jae no_draw |
; |
; cmp ecx, 0 ; if code of card < 0 then there is no card |
; jb no_draw |
mov [cardcode], ecx |
mov eax, [j] |
xor edx, edx |
mov ebx, 8 |
div ebx ; divsion by 8 (8 columns), |
; so in eax quotient - number of row |
; and in edx remainder - |
; number of column where lay card |
mov [row], eax |
mov [column], edx |
mov eax, [process_info.x_size] ; width of window |
sub eax, 10 |
sub eax, cardwidth |
mov ebx, 7 |
mov edx, 0 |
div ebx |
mov ebx, [column] |
mul ebx |
add eax, 5 |
mov [xpos], eax |
mov eax, [row] |
mov bl, rowsize |
mul bl |
add eax, cardheight + 24 + topbuttonsbarheight + columnspace |
mov [ypos], eax |
mov [negativedraw], 0 ;checking, if this is selected card |
cmp [whereisselcard], scCommonCells |
jne .this_card_isnt_selected |
mov eax, [column] |
cmp [columnofselcard], eax |
jne .this_card_isnt_selected |
mov eax, [column] |
mov [ncolumn], eax |
call get_row_of_top_card_in_column |
mov eax, [row] |
cmp [topcardrow], eax |
jne .this_card_isnt_selected |
mov [negativedraw], 1 |
.this_card_isnt_selected: |
call draw_card |
; now checking if it is top card in its column |
; if it does, we'll define button on its place |
mov eax, [column] |
mov [ncolumn], eax |
call get_row_of_top_card_in_column |
mov eax, [row] |
cmp [topcardrow], eax |
je .define_button |
cmp [topcardrow], 0 |
jne .no_define_button |
cmp [row], 0 |
jne .no_define_button |
.define_button: |
mov eax, 8 |
mov ebx, [xpos] |
shl ebx, 16 |
add bx, cardwidth - 1 |
mov ecx, [ypos] |
shl ecx, 16 |
add cx, cardheight - 1 |
mov edx, [column] |
add edx, 01000000000000000000000000000000b + 2; button id = column + 2, |
; id = 1 reserved as close button |
int $40 |
.no_define_button: |
inc [j] |
cmp [j], 8 * 19 |
jb draw_a_card |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
mov eax, 12 ; finish drawing |
mov ebx, 2 |
int $40 |
ret |
;****************************************************************************** |
; get_row_of_top_card_in_column(ncolumn): topcardrow |
get_row_of_top_card_in_column: |
; number of column in ncolumn |
; returns in topcardrow |
mov [i], 0 ; i loops from 0 to 1, ... while card i * 8 + ncolumn |
; is valid card (0 <= its code < 52) |
.cycle: |
xor eax, eax |
mov al, 8 |
mov ebx, [i] |
mul bl |
add eax, [ncolumn] |
add eax, cards |
xor ecx, ecx |
mov cl, byte [eax] |
cmp ecx, 52 |
jae .endcycle |
cmp [i], 18 |
ja .endcycle |
inc [i] |
jmp .cycle |
.endcycle: |
cmp [i], 0 |
je .dont_dec |
dec [i] |
.dont_dec: |
mov eax, [i] |
mov [topcardrow], eax |
ret |
;****************************************************************************** |
; invert_image_colors(imagetoinvert, sizeofimagetoinvert) |
invert_image_colors: |
mov [i], 0 |
.inverting: |
mov eax, [imagetoinvert] |
add eax, [i] |
mov bl, byte [eax] |
;xor ebx, ebx |
;add ebx, 10 |
not ebx |
mov byte [eax], bl |
inc [i] |
mov ecx, [sizeofimagetoinvert] |
cmp [i], ecx |
jb .inverting |
jmp .later |
.exit: |
mov eax, -1 |
int $40 |
.later: |
ret |
;****************************************************************************** |
; draw_card(xpos, ypos, cardcode, negativedraw) |
; if negativedraw = 1 then card drawn in inverted colors |
draw_card: ; draws card with left top corner |
; in point ([xpos],[ypos]), |
; type of card in [cardcode] |
cmp [cardcode], 52 ; if code of card >= 52 then there is no card |
jae .no_draw_card |
cmp [negativedraw], 1 |
jne .no_invert1 |
;doing if negativedraw |
mov [bgcolor], $00000000 |
mov [blackcolor], $00FFFFFF |
mov [redcolor], $0000FFFF |
;inverting all images |
call invert_all_images |
jmp .colors_selection_done |
.no_invert1: |
;doing if not negativedraw |
mov [bgcolor], $00FFFFFF |
mov [blackcolor], $00000000 |
mov [redcolor], $00FF0000 |
.colors_selection_done: |
mov eax, 13 |
mov ebx, [xpos] ; filling card with bgcolor |
; (big background rectangle) |
mov edx, [bgcolor] |
add ebx, 2 |
shl ebx, 16 |
mov bx, cardwidth - 4 |
mov ecx, [ypos] |
add ecx, 2 |
shl ecx, 16 |
mov cx, cardheight - 4 |
int $40 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
mov ebx, [xpos] ; left black line |
shl ebx, 16 |
mov bx, 1 |
mov ecx, [ypos] |
add ecx, 5 |
shl ecx, 16 |
xor cx, cx |
mov cx, cardheight - 2 * radius - 2 |
mov edx, [blackcolor] |
int $40 |
mov ebx, [xpos] ; left white line |
inc ebx |
shl ebx, 16 |
mov bx, 1 |
mov edx, [bgcolor] |
int $40 |
mov ebx, [xpos] ; right black line |
add ebx, cardwidth - 1 |
shl ebx, 16 |
mov bx, 1 |
mov edx, [blackcolor] |
int $40 |
mov ebx, [xpos] ; right white line |
add ebx, cardwidth - 2 |
shl ebx, 16 |
mov bx, 1 |
mov edx, [bgcolor] |
int $40 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
mov ecx, [ypos] ; top black line |
shl ecx, 16 |
mov cx, 1 |
mov ebx, [xpos] |
add ebx, 5 |
shl ebx, 16 |
mov bx, cardwidth - 2 * radius - 2 |
mov edx, [blackcolor] |
int $40 |
mov ecx, [ypos] ; top white line |
inc ecx |
shl ecx, 16 |
mov cx, 1 |
mov edx, [bgcolor] |
int $40 |
mov ecx, [ypos] ; bottom black line |
add ecx, cardheight - 1 |
shl ecx, 16 |
mov cx, 1 |
mov edx, [blackcolor] |
int $40 |
mov ecx, [ypos] ; bottom white line |
add ecx, cardheight - 2 |
shl ecx, 16 |
mov cx, 1 |
mov edx, [bgcolor] |
int $40 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
mov eax, 1 ; drawing points |
mov edx, [blackcolor] ; black color for all pixels |
mov ebx, [xpos] ; draw top left corner |
mov ecx, [ypos] |
inc ebx |
add ecx, 4 |
int $40 |
dec ecx |
int $40 |
dec ecx |
inc ebx |
int $40 |
dec ecx |
inc ebx |
int $40 |
inc ebx |
int $40 |
mov ebx, [xpos] ;drawing top right corner |
mov ecx, [ypos] |
add ebx, cardwidth - 2 |
add ecx, 4 |
int $40 |
dec ecx |
int $40 |
dec ebx |
dec ecx |
int $40 |
dec ebx |
dec ecx |
int $40 |
dec ebx |
int $40 |
;drawing bottom left corner |
mov ebx, [xpos] |
mov ecx, [ypos] |
inc ebx |
add ecx, cardheight - 5 |
int $40 |
inc ecx |
int $40 |
inc ebx |
inc ecx |
int $40 |
inc ebx |
inc ecx |
int $40 |
inc ebx |
int $40 |
;drawing bottom right corner |
mov ebx, [xpos] |
mov ecx, [ypos] |
add ebx, cardwidth - 2 |
add ecx, cardheight - 5 |
int $40 |
inc ecx |
int $40 |
dec ebx |
inc ecx |
int $40 |
dec ebx |
inc ecx |
int $40 |
dec ebx |
int $40 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
; drawing text and images |
mov eax, [cardcode] |
mov edx, 0 |
mov ebx, 4 |
div ebx |
mov [cardfamily], edx |
mov [cardrange], eax |
; counting position of small card image |
mov eax, 7 |
mov ecx, 8*65536+8 |
mov edx, [xpos] |
add edx, radius |
shl edx, 16 |
mov dx, word [ypos] |
add dx, radius + 8 |
cmp [cardfamily], 0 |
je .heart |
cmp [cardfamily], 1 |
je .diamond |
cmp [cardfamily], 2 |
je .club |
cmp [cardfamily], 3 |
je .spade |
.heart: |
mov esi, [redcolor] |
mov [color], esi |
mov [imageaddr], heart |
mov [imageflipaddr], heart_updown |
mov ebx, heart_small |
int $40 |
jmp .selnumber |
.diamond: |
mov esi, [redcolor] |
mov [color], esi |
mov [imageaddr], diamond |
mov [imageflipaddr], diamond_updown |
mov ebx, diamond_small |
int $40 |
jmp .selnumber |
.club: |
mov esi, [blackcolor] |
mov [color], esi |
mov [imageaddr], club |
mov [imageflipaddr], club_updown |
mov ebx, club_small |
int $40 |
jmp .selnumber |
.spade: |
mov esi, [blackcolor] |
mov [color], esi |
mov [imageaddr], spade |
mov [imageflipaddr], spade_updown |
mov ebx, spade_small |
int $40 |
.selnumber: |
mov ebx, [xpos] ; counting position of text |
; in ebx, same for all cards |
add ebx, radius |
shl ebx, 16 |
mov bx, word [ypos] |
add bx, radius |
mov ecx, [color] |
cmp [cardrange], 0 |
je .ace |
cmp [cardrange], 1 |
je .two |
cmp [cardrange], 2 |
je .three |
cmp [cardrange], 3 |
je .four |
cmp [cardrange], 4 |
je .five |
cmp [cardrange], 5 |
je .six |
cmp [cardrange], 6 |
je .seven |
cmp [cardrange], 7 |
je .eight |
cmp [cardrange], 8 |
je .nine |
cmp [cardrange], 9 |
je .ten |
cmp [cardrange], 10 |
je .jack |
cmp [cardrange], 11 |
je .queen |
cmp [cardrange], 12 |
je .king |
; +-------+-------+-------+ |
; | 3 | 2 | 3 | ace = 1 |
; +-------+-------+-------+ two = 2 |
; | | | | three = 2 + 1 |
; +-------+-------+-------+ four = 3 |
; | | 6 | | five = 3 + 1 |
; +-------+-------+-------+ six = 3 + 4 |
; | 5 | | 5 | seven = 3 + 4 + 6 |
; +-------+-------+-------+ eight = 3 + 5 |
; | 4 | 1 | 4 | nine = 3 + 5 |
; +-------+-------+-------+ ten = 3 + 5 + 6 + 7 |
; | 5 | | 5 | |
; +-------+-------+-------+ |
; | | 7 | | 1 means draw_1 |
; +-------+-------+-------+ |
; | | | | |
; +-------+-------+-------+ |
; | 3 | 2 | 3 | |
; +-------+-------+-------+ |
.ace: |
mov eax, 4 |
mov [s], byte 'A' |
mov edx, s |
mov esi, 1 |
int $40 |
call draw_1 |
jmp .end |
.two: |
mov eax, 4 |
mov [s], byte '2' |
mov edx, s |
mov esi, 1 |
int $40 |
call draw_2 |
jmp .end |
.three: |
mov eax, 4 |
mov [s], byte '3' |
mov edx, s |
mov esi, 1 |
int $40 |
call draw_1 |
call draw_2 |
jmp .end |
.four: |
mov eax, 4 |
mov [s], byte '4' |
mov edx, s |
mov esi, 1 |
int $40 |
call draw_3 |
jmp .end |
.five: |
mov eax, 4 |
mov [s], byte '5' |
mov edx, s |
mov esi, 1 |
int $40 |
call draw_1 |
call draw_3 |
jmp .end |
.six: |
mov eax, 4 |
mov [s], byte '6' |
mov edx, s |
mov esi, 1 |
int $40 |
call draw_3 |
call draw_4 |
jmp .end |
.seven: |
mov eax, 4 |
mov [s], byte '7' |
mov edx, s |
mov esi, 1 |
int $40 |
call draw_3 |
call draw_4 |
call draw_6 |
jmp .end |
.eight: |
mov eax, 4 |
mov [s], byte '8' |
mov edx, s |
mov esi, 1 |
int $40 |
call draw_3 |
call draw_5 |
jmp .end |
.nine: |
mov eax, 4 |
mov [s], byte '9' |
mov edx, s |
mov esi, 1 |
int $40 |
call draw_3 |
call draw_5 |
call draw_1 |
jmp .end |
.ten: |
mov eax, 4 |
mov [s], word '10' |
mov edx, s |
mov esi, 2 |
int $40 |
call draw_3 |
call draw_5 |
call draw_6 |
call draw_7 |
jmp .end |
.jack: |
mov eax, 4 |
mov [s], byte 'J' |
mov edx, s |
mov esi, 1 |
int $40 |
jmp .end |
.queen: |
mov eax, 4 |
mov [s], byte 'Q' |
mov edx, s |
mov esi, 1 |
int $40 |
jmp .end |
.king: |
mov eax, 4 |
mov [s], byte 'K' |
mov edx,s |
mov esi, 1 |
int $40 |
.end: |
cmp [negativedraw], 1 |
jne .no_invert2 |
call invert_all_images |
.no_invert2: |
.no_draw_card: |
ret |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
; invert_all_images() |
invert_all_images: |
mov [sizeofimagetoinvert], 16 * 16 * 3 |
mov [imagetoinvert], heart |
call invert_image_colors |
mov [sizeofimagetoinvert], 16 * 16 * 3 |
mov [imagetoinvert], diamond |
call invert_image_colors |
mov [sizeofimagetoinvert], 16 * 16 * 3 |
mov [imagetoinvert], spade |
call invert_image_colors |
mov [sizeofimagetoinvert], 16 * 16 * 3 |
mov [imagetoinvert], club |
call invert_image_colors |
mov [sizeofimagetoinvert], 16 * 16 * 3 |
mov [imagetoinvert], heart_updown |
call invert_image_colors |
mov [sizeofimagetoinvert], 16 * 16 * 3 |
mov [imagetoinvert], diamond_updown |
call invert_image_colors |
mov [sizeofimagetoinvert], 16 * 16 * 3 |
mov [imagetoinvert], spade_updown |
call invert_image_colors |
mov [sizeofimagetoinvert], 16 * 16 * 3 |
mov [imagetoinvert], club_updown |
call invert_image_colors |
mov [sizeofimagetoinvert], 8 * 8 * 3 |
mov [imagetoinvert], heart_small |
call invert_image_colors |
mov [sizeofimagetoinvert], 8 * 8 * 3 |
mov [imagetoinvert], diamond_small |
call invert_image_colors |
mov [sizeofimagetoinvert], 8 * 8 * 3 |
mov [imagetoinvert], spade_small |
call invert_image_colors |
mov [sizeofimagetoinvert], 8 * 8 * 3 |
mov [imagetoinvert], club_small |
call invert_image_colors |
ret |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
draw_1: |
;draw center image |
mov ebx, [imageaddr] |
mov ecx, 16 * 65536 + 16 |
mov edx, [xpos] |
add edx, cardwidth/2 - 8 |
shl edx, 16 |
mov dx, word [ypos] |
add dx, cardheight/2 - 8 |
mov eax, 7 |
int $40 |
ret |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
draw_2: |
;draw top image |
mov ebx, [imageaddr] |
mov ecx, 16 * 65536 + 16 |
mov edx, [xpos] |
add edx, 40 - 8 |
shl edx, 16 |
mov dx, word [ypos] |
add dx, margin |
mov eax, 7 |
int $40 |
;draw bottom image |
mov ebx, [imageflipaddr] |
mov edx, [xpos] |
add edx, cardwidth/2 - 8 |
shl edx, 16 |
mov dx, word [ypos] |
add dx, cardheight - 16 - margin |
mov eax, 7 |
int $40 |
ret |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
draw_3: |
;draw top left image |
mov ebx, [imageaddr] |
mov ecx, 16 * 65536 + 16 |
mov edx, [xpos] |
add edx, margin |
shl edx, 16 |
mov dx, word [ypos] |
add dx, margin |
mov eax, 7 |
int $40 |
;draw bottom left image |
mov ebx, [imageflipaddr] |
mov edx, [xpos] |
add edx, margin |
shl edx, 16 |
mov dx, word [ypos] |
add dx, cardheight - margin - 16 |
mov eax, 7 |
int $40 |
;draw top right image |
mov ebx, [imageaddr] |
mov edx, [xpos] |
add edx, cardwidth - margin - 16 |
shl edx, 16 |
mov dx, word [ypos] |
add dx, margin |
mov eax, 7 |
int $40 |
;draw bottom right image |
mov ebx, [imageflipaddr] |
mov edx, [xpos] |
add edx, cardwidth - margin - 16 |
shl edx, 16 |
mov dx, word [ypos] |
add dx, cardheight - margin - 16 |
mov eax, 7 |
int $40 |
ret |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
draw_4: |
;draw center left image |
mov ebx, [imageaddr] |
mov ecx, 16 * 65536 + 16 |
mov edx, [xpos] |
add edx, margin |
shl edx, 16 |
mov dx, word [ypos] |
add dx, cardheight/2 - 8 |
mov eax, 7 |
int $40 |
;draw center right image |
mov edx, [xpos] |
add edx, cardwidth - margin - 16 |
shl edx, 16 |
mov dx, word [ypos] |
add dx, cardheight/2 - 8 |
mov eax, 7 |
int $40 |
ret |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
draw_5: |
;draw top left image |
mov ebx, [imageaddr] |
mov ecx, 16 * 65536 + 16 |
mov edx, [xpos] |
add edx, margin |
shl edx, 16 |
mov dx, word [ypos] |
add dx, cardheight * 3 / 9 |
mov eax, 7 |
int $40 |
;draw bottom left image |
mov ebx, [imageflipaddr] |
mov edx, [xpos] |
add edx, 16 |
shl edx, 16 |
mov dx, word [ypos] |
add dx, cardheight * 5 / 9 |
mov eax, 7 |
int $40 |
;draw top right image |
mov ebx, [imageaddr] |
mov edx, [xpos] |
add edx, cardwidth - margin - 16 |
shl edx, 16 |
mov dx, word [ypos] |
add dx, cardheight * 3 / 9 |
mov eax, 7 |
int $40 |
;draw bottom right image |
mov ebx, [imageflipaddr] |
mov edx, [xpos] |
add edx, cardwidth - margin - 16 |
shl edx, 16 |
mov dx, word [ypos] |
add dx, cardheight * 5 / 9 |
mov eax, 7 |
int $40 |
ret |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
draw_6: |
mov ebx, [imageaddr] |
mov ecx, 16 * 65536 + 16 |
mov edx, [xpos] |
add edx, cardwidth/2 - 8 |
shl edx, 16 |
mov dx, word [ypos] |
add dx, cardheight * 2 / 9 |
mov eax, 7 |
int $40 |
ret |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
draw_7: |
mov ebx, [imageflipaddr] |
mov ecx, 16 * 65536 + 16 |
mov edx, [xpos] |
add edx, cardwidth/2 - 8 |
shl edx, 16 |
mov dx, word [ypos] |
add dx, cardheight * 6 / 9 |
mov eax, 7 |
int $40 |
ret |
;****************************************************************************** |
randomize: |
push eax |
mov eax, 3 |
int 0x40 |
mov ebx, $A59E3F1C |
mul ebx |
mov dword [randseed], eax |
pop eax |
ret |
;****************************************************************************** |
; function Random(Range): RandomValue |
random: |
push ebx |
mov eax, [randseed] |
mov edx, 0 |
mov ebx, 7 |
div ebx |
cmp edx, 0 |
je _0 |
cmp edx, 1 |
je _1 |
cmp edx, 2 |
je _2 |
cmp edx, 3 |
je _3 |
cmp edx, 4 |
je _4 |
cmp edx, 5 |
je _5 |
cmp edx, 6 |
je _6 |
jmp _end |
_0: |
;base := base + 58 + a[8]; |
mov eax, [randseed] |
add eax, 58 |
add eax, dword [a + 8 * 4] |
mov [randseed], eax |
jmp _end; |
_1: |
;base := base + 1 + a[9]; |
mov eax, [randseed] |
add eax, 1 |
add eax, dword [a + 9 * 4] |
mov [randseed], eax |
jmp _end; |
_2: |
;base := base + 4 + a[88]; |
mov eax, [randseed] |
add eax, 4 |
add eax, dword [a + 88 * 4] |
mov [randseed], eax |
jmp _end; |
_3: |
;randseed := randseed + 79 + a[43]; |
mov eax, [randseed] |
add eax, 79 |
add eax, dword [a + 43 * 4] |
mov [randseed], eax |
jmp _end; |
_4: |
;randseed := randseed + 3 + a[12]; |
mov eax, [randseed] |
add eax, 3 |
add eax, dword [a + 12 * 4] |
mov [randseed], eax |
jmp _end; |
_5: |
;randseed := randseed + 2 + a[63]; |
mov eax, [randseed] |
add eax, 2 |
add eax, dword [a + 63 * 4] |
mov [randseed], eax |
jmp _end; |
_6: |
;randseed := randseed + 151 + a[24]; |
mov eax, [randseed] |
add eax, 151 |
add eax, dword [a + 24 * 4] |
mov [randseed], eax |
_end: |
mov eax, [randseed] |
mov edx, eax |
shl edx, 16 |
mov bx, 100 |
div bx ; dx = randseed mod 100 |
mov ax, dx ; ax = randseed mod 100 |
mov bx, 4 |
mul bx ; dx:ax = (randseed mod 100) * 4 |
and eax, $0000FFFF |
shr edx, 16 |
and edx, $FFFF0000 |
or eax, edx |
mov eax, dword [a + eax] ; eax = dword[a + (randseed mod 100) * 4] |
; ~ a[randseed mod 100] |
mov ebx, dword [a + 47 * 4] |
mul ebx ; eax = low(a[randseed mod 100] * a[47]) |
add eax, [randseed] |
add eax, $4AE783A |
mov [randseed], eax |
mov eax, dword [a + 6 * 4] |
mov edx, 0 |
mov ebx, 100 |
div ebx |
mov eax, edx |
mov ebx, 4 |
mul ebx ; eax = (dword [a + 6 * 4] mod 100) * 4 ~ a[6] mod 100 |
mov eax, dword [a + eax] ; eax = dword [a + (dword [a + 6 * 4] mod 100) * 4 |
; ~ a[a[6] mod 100] |
add eax, [randseed] |
mov [random_value], eax |
mov edx, 0 |
mov ebx, [range] |
div ebx |
mov [random_value], edx |
mov al, [TimesCalled] |
xor ah, ah |
inc al |
mov bl, 100 |
div bl |
mov [TimesCalled], ah ; TimesCalled = (TimesCalled + 1 ) mod 100 |
mov al, ah |
mov bl, 4 |
mul bl |
and eax, $0000FFFF |
mov ebx, [randseed] |
mov dword [a + eax], ebx ; a[TimesCalled] = randseed |
pop ebx |
ret |
;****************************************************************************** |
; <--- initialised data ---> |
data |
header db 'Freecell',0 |
new_game: db "New game" |
new_game_len = $ - new_game |
exit: db "Exit" |
exit_len = $ - exit |
s: db "10" |
negativedraw db 0 ; for procedure draw_card |
spade file 'SPADE.BMP': 54 |
spade_updown file 'SPADEUD.BMP': 54 |
spade_small file 'SPADESML.BMP': 54 |
club file 'CLUB.BMP': 54 |
club_updown file 'CLUBUD.BMP': 54 |
club_small file 'CLUBSML.BMP': 54 |
diamond file 'DIAM.BMP': 54 |
diamond_updown file 'DIAMUD.BMP': 54 |
diamond_small file 'DIAMSML.BMP': 54 |
heart file 'HEART.BMP': 54 |
heart_updown file 'HEARTUD.BMP': 54 |
heart_small file 'HEARTSML.BMP': 54 |
scNotSelected = 0 |
scCommonCells = 1 |
scTempCells = 2 |
whereisselcard dd scNotSelected |
columnofselcard dd 0 ; if WhereIsSelCard = scGeneralCells |
; then this can be 0 .. 7, |
; if scTempCells then - 0 .. 3 |
; if scNotSelected - no matter |
tempcells: times 4 db 52; |
homecells: times 4 db 52 ; maximal card code is 51 |
cards: times 8 * 19 db 52; - % |
pack: times 52 db ? |
udata |
process_info process_information |
syscolors system_colors |
WindowHeight rw 1 |
WindowWidth rw 1 |
xpos rd 1 |
ypos rd 1 |
bgcolor rd 1 |
blackcolor rd 1 |
redcolor rd 1 |
lastparam rd 1 ; |
randomcard rd 1 ; for new_game_click |
columnclicked rd 1 ; used in common_card_click, temp_cell_click, |
cardclicked rd 1 ; home_cell_click |
clickedcardrange rd 1 ; |
clickedcardfamily rd 1 ; |
selcardcode rd 1 ; for procedure get_sel_card_code_and_addr |
selcardaddr rd 1 ; |
column rd 1 ; for procedure draw_window |
row rd 1 ; |
imagetoinvert rd 1 ; for procedure invert_image_colors |
sizeofimagetoinvert rd 1 ; |
ncolumn rd 1 ; for procedure get_row_of_top_card_in_column |
topcardrow rd 1 ; |
color rd 1 ; for procedue draw_card |
imageaddr rd 1 ; |
imageflipaddr rd 1 ; |
cardcode rd 1 ; used in differrent procedures |
cardrange rd 1 ; cardcode = cardrange * 4 + cardfamily |
cardfamily rd 1 ; |
a: times 100 rd 1 ; for function Random |
range rd 1 ; |
random_value rd 1 ; |
randseed rd 1 ; |
TimesCalled rb 1 ; |
j rd 1 ; number of card (in array cards) drawn now |
i rd 1 ; used in many procedures of 1-st level |
k rd 1 |
cardwidth = 80 |
cardheight = 120 |
radius = 4 ; not recommended to change |
rowsize = 30 ; distance between top poins |
;of cards in neighboring rows |
columnspace = 5 ; minimal space between cards |
margin = 14 ; margin of every card |
topbuttonsbarheight = 20 |
meos_app_end |
/programs/games/freecell/play.txt |
---|
0,0 → 1,26 |
FreeCell. |
You can find this games in Windows XP and Linux Mandrake 9.0 distributions. |
Rules to FreeCell can be found in help files for those games but I place here |
game rules from site www.freecell.org: |
4 cells (top left) - storage locations for cards. |
Only 1 card allowed in each cell. |
8 tableau piles (below foundations and cells) - build down by alternate color. |
Move groups of cards if they are in sequence down by alternate color and if |
there are enough free cells that the cards could be moved individually. |
Spaces can be filled by any card or legal group of cards (see KingOnly for |
option). At the start of the game 7 cards are dealt face up to the leftmost 4 |
piles, 6 cards are dealt face up to the remaining piles. |
Some features not implemented yet: moving groups of cards - you |
can move only one card at one time, no automatic moving of |
some cards in home. |
You only need to copy the file freecell to the floppy; The rest of the |
files are for assembling the code. |
Alexandr Gorbovets gorsash@mail.ru |
/programs/games/pipes/build.bat |
---|
0,0 → 1,2 |
@fasm pipes.asm pipes |
@pause |
/programs/games/pipes/pipes.asm |
---|
0,0 → 1,649 |
; |
; pipes for menuet {and now kolibri} |
; v1.2 |
; 2006 by Mario Birkner |
; |
; l.mod. 27.08.06/15:11 |
; |
; Compile with FASM |
; |
bgcolor equ 0x0074744A ;thx |
fgcolor equ 0x00E7C750 ;to |
fg2color equ 0x00E0B0A0 ;colorref |
fg3color equ 0x007F7F55 |
btcolor equ 0x005B6200 |
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 |
START: ; start of execution |
call draw_window |
call draw_board |
still: |
mov eax,10 ; wait here for event |
int 0x40 |
cmp eax,1 ; redraw request ? |
je red |
cmp eax,2 ; key in buffer ? |
je key |
cmp eax,3 ; button in buffer ? |
je button |
jmp still |
red: ; redraw |
call draw_window |
call draw_board |
call draw_message |
jmp still |
key: ; key |
mov eax,2 ; just read it and ignore |
int 0x40 |
jmp still |
button: ; button |
call get_input |
jmp still |
get_input: |
pusha |
mov eax,17 ; get id |
int 0x40 |
cmp ah,1 ; button id=1 ? |
jne .noclose |
mov eax,-1 ; close this program |
int 0x40 |
.noclose: |
cmp ah,4 |
jne .moderate |
mov [diffic],1 |
jmp .enddiffic |
.moderate: |
cmp ah,3 |
jne .easy |
mov [diffic],3 |
jmp .enddiffic |
.easy: |
cmp ah,2 |
jne .board |
mov [diffic],5 |
.enddiffic: |
mov [score],0 |
mov [speed],40 |
mov [level],1 |
mov [stat],0 |
mov [time],0 |
call draw_window |
call scramble_board |
call draw_board |
call countdown |
call wassermarsch |
jmp .getno |
.board: |
cmp [stat],2 |
jge .getno |
shr eax,8 ; -> 24bit id |
cmp eax,10 |
jle .getno |
cmp eax,150 |
jg .getno |
sub eax,10 |
mov edi,eax |
add edi,map |
cmp [edi], byte 1 |
jg .nogerade |
xor byte [edi], 1 |
call draw_board |
jmp .getno |
.nogerade: |
cmp [edi], byte 6 |
jge .getno |
cmp [edi], byte 5 |
jne .rota |
sub byte [edi],4 |
.rota: |
inc byte [edi] |
call draw_board |
.getno: |
popa |
ret |
;//// end of event detection |
get_direction: ;Setzt Richtungs-Konstanten |
pusha ;IN: |
mov eax,[esp+28] ;eax - Richtung IN |
mov ebx,[esp+16] ;ebx - Teilchen (Map-Wert) |
cmp ebx,0 ;OUT: |
jne .no0 ;eax - Richtung OUT |
cmp eax,14 |
jne .o0 |
jmp .setout |
.o0: |
cmp eax,-14 |
jne .col |
jmp .setout |
.no0: |
cmp ebx,1 |
jne .no1 |
cmp eax,1 |
jne .o1 |
jmp .setout |
.o1: |
cmp eax,-1 |
jne .col |
jmp .setout |
.no1: |
cmp ebx,2 |
jne .no2 |
cmp eax,14 |
jne .o2 |
sub eax,13 |
jmp .setout |
.o2: |
cmp eax,-1 |
jne .col |
sub eax,13 |
jmp .setout |
.no2: |
cmp ebx,3 |
jne .no3 |
cmp eax,-14 |
jne .o3 |
add eax,15 |
jmp .setout |
.o3: |
cmp eax,-1 |
jne .col |
add eax,15 |
jmp .setout |
.no3: |
cmp ebx,4 |
jne .no4 |
cmp eax,-14 |
jne .o4 |
add eax,13 |
jmp .setout |
.o4: |
cmp eax,1 |
jne .col |
add eax,13 |
jmp .setout |
.no4: |
cmp ebx,5 |
jne .no5 |
cmp eax,14 |
jne .o5 |
sub eax,15 |
jmp .setout |
.o5: |
cmp eax,1 |
jne .col |
sub eax,15 |
jmp .setout |
.no5: |
cmp ebx,6 |
jne .no6 |
jmp .setout |
.no6: |
cmp ebx,7 |
jne .no7 |
mov eax,14 |
jmp .setout |
.no7: |
cmp ebx,8 |
jne .no8 |
cmp eax,14 |
jne .col |
mov [stat],1 |
jmp .setout |
.no8: |
cmp ebx,16 ; cross 2x |
jne .col |
add [score],10 ; + 10 bonus points |
jmp .setout |
.col: |
xor eax,eax |
.setout: |
xor ebx,ebx |
mov [esp+28],eax |
mov [esp+16],ebx |
popa |
ret |
countdown: |
pusha |
xor eax,eax |
mov al,[diffic] |
imul eax,10 |
mov [time],eax |
.udown: |
call show_score |
mov ecx,10 |
.down: |
mov eax,5 |
mov ebx,10 |
int 0x40 |
mov eax,11 |
int 0x40 |
cmp eax,1 |
jne .nored |
call draw_window |
call draw_board |
jmp .nothing |
.nored: |
cmp eax,3 |
jne .nothing |
call get_input |
.nothing: |
cmp [stat],0 ;bugfix 210806 |
jnz .exitsub ;bugfix 210806 |
dec ecx |
jnz .down |
dec [time] |
jnz .udown |
.exitsub: ;bugfix 210806 |
popa |
ret |
wassermarsch: |
pusha |
.restart: |
mov esi,map+16 ;start position |
mov eax, 14 ;start-richtung |
.findway: |
movzx ebx, byte [esi] |
call get_direction |
test eax,eax |
jz .collision |
push eax |
xor eax,eax |
mov al,6 |
sub al,[diffic] |
add [score],eax ;points/item = 6 - difficulty |
mov ecx,dword [speed] |
add byte [esi],10 |
.down: |
mov eax,5 |
mov ebx,2 |
int 0x40 |
mov eax,11 |
int 0x40 |
cmp eax,1 |
jne .nored |
call draw_window |
.nored: |
cmp eax,3 |
jne .noevnt |
call get_input |
.noevnt: |
dec ecx |
jnz .down |
pop eax |
add esi,eax |
call draw_board |
call show_score |
jmp .findway |
.collision: |
cmp [stat],1 |
jne .loose |
call draw_message |
mov eax,5 |
mov ebx,500 |
int 0x40 |
mov [stat],0 |
inc [level] |
cmp [speed],6 ;waterflowdelay < 6 ? |
jle .skipsub |
sub [speed],2 |
.skipsub: |
call draw_window |
call scramble_board |
call draw_board |
call countdown |
jmp .restart |
.loose: |
mov [stat],2 |
call draw_message |
popa |
ret |
show_score: |
pusha |
mov eax,13 ;clear time and score area |
mov ebx,50 shl 16 +15 |
mov ecx,395 shl 16 +15 |
mov edx,bgcolor |
int 0x40 |
add ebx,60 shl 16 + 20 |
int 0x40 |
add ebx,80 shl 16 |
int 0x40 |
mov eax,47 |
mov ebx,0x20000 |
mov ecx,[time] |
mov edx,50*65536+398 |
mov esi,fg2color |
int 0x40 |
mov ebx,0x50000 |
mov ecx,[score] |
add edx,60 shl 16 |
int 0x40 |
mov ebx,0x20000 |
mov ecx,[level] |
add edx,80 shl 16 |
int 0x40 |
popa |
ret |
scramble_board: |
pusha |
mov edi,map+16 ;startpunkt |
mov eax,7 ;wieder- |
stosb ;herstellen |
mov ebx, 0x00000007 ;modul m max-wert |
.loop_through: |
mov esi,edi |
lodsb |
cmp eax, 9 |
je .skip |
inc eax |
xor edx, edx |
div ebx ;modulo -> edx |
mov eax, edx |
cmp eax,6 |
jne .skip |
dec [half] |
movzx eax, byte [half] |
jnz .skip |
mov [half], byte 7 |
.skip: |
stosb |
cmp edi,map+125 ;endpunkt erhalten |
jge .exit |
jmp .loop_through |
.exit: |
mov eax,8 |
stosb |
popa |
ret |
gen_image: |
pusha |
xor ebx,ebx ;default: kein wasser |
movzx eax,byte [map] ;erstes byte der map lesen (position) |
inc byte [map] ;position inkrementieren |
add eax,map ;zur position die map-adresse addieren |
movzx esi,byte [eax] |
cmp esi,10 |
jl .nowater |
sub esi,10 ;map-werte+10 sind mit wasser gefuellt |
mov ebx,1 |
cmp esi,16 |
jne .nowater |
sub esi,10 |
.nowater: |
imul esi,3072 ;mapwert * 32*32*3 = image-adresse |
add esi,images |
mov edi,0x10000 |
mov ecx,32*32*3 |
.gendd: ;RGB-Image im Speicher generieren |
mov eax,dword [esi] ;byte aus imagemap lesen |
shl eax,8 |
shr eax,8 |
cmp ebx,0 |
jz .nowcolor |
mov ebx,eax |
cmp ebx,0x00B0B5B0 |
jne .nog1 |
jmp .wcolor |
.nog1: |
cmp ebx,0x00A0A5A0 |
jne .nog2 |
jmp .wcolor |
.nog2: |
cmp ebx,0x00909590 |
jne .nog3 |
jmp .wcolor |
.nog3: |
cmp ebx,0x00808580 |
jne .nog4 |
jmp .wcolor |
.nog4: |
cmp ebx,0x00707570 |
jne .nowcolor |
jmp .wcolor |
.wcolor: |
add eax,0x40 |
.nowcolor: |
add esi,3 |
stosd |
dec edi |
loop .gendd |
popa |
ret |
; ********************************************* |
; ******* WINDOW DEFINITIONS AND DRAW ******** |
; ********************************************* |
draw_message: |
pusha |
cmp [stat],0 |
je .nomessage |
cmp [stat],3 |
je .nomessage |
mov eax,13 |
mov ebx,146 shl 16 + 200 |
mov ecx,190 shl 16 + 40 |
mov edx,0x0 |
int 0x40 |
add ebx,2 shl 16 - 4 |
add ecx,2 shl 16 - 4 |
mov edx,fgcolor |
int 0x40 |
cmp [stat],1 |
je .winmessage |
mov eax,4 |
mov ebx,186 shl 16 +200 |
mov edx,lbl_gameover+1 |
movzx esi,byte [lbl_gameover] |
mov ecx,btcolor |
add ecx,0x10000000 |
int 0x40 |
add ebx,8 shl 16 +17 |
mov edx,lbl_yscore+1 |
movzx esi,byte [lbl_yscore] |
mov ecx,btcolor |
int 0x40 |
mov esi,ecx ;color |
mov edx,ebx ;pos |
add edx,80 shl 16 |
mov ebx,0x50000 ;type |
mov ecx,[score] ;inp |
mov eax,47 |
int 0x40 |
jmp .nomessage |
.winmessage: |
mov eax,4 |
mov ebx,152 shl 16 +200 |
mov edx,lbl_win+1 |
movzx esi,byte [lbl_win] |
mov ecx,btcolor |
add ecx,0x10000000 |
int 0x40 |
mov ebx,152 shl 16 +217 |
add edx,esi |
mov ecx,btcolor |
int 0x40 |
.nomessage: |
popa |
ret |
draw_board: |
pusha |
mov ebx,15*65536+32 |
mov ecx,50*65536+32 |
mov edx,15*65536+50 ;Spielfeldposition |
mov esi,10 ;Spielfeldgroesse Y |
.vloop: |
mov edi,14 ;Spielfeldgroesse X |
.hloop: |
call gen_image |
push edx |
mov eax,8 |
movsx edx, byte [map] |
add edx,9 ;button-id = map-pos + 10;gen_image inkrements |
add edx,0x50000000 ;no button image - no esi need |
int 0x40 |
pop edx |
push ebx |
push ecx |
mov eax,7 |
mov ebx,0x10000 |
mov ecx,32 shl 16 +32 |
int 0x40 |
pop ecx |
pop ebx |
add edx,33 shl 16 |
add ebx,33 shl 16 |
dec edi |
jnz .hloop |
sub edx,14*(33 shl 16) ;Spielfeldgroesse X |
sub ebx,14*(33 shl 16) |
add edx,33 |
add ecx,33 shl 16 |
dec esi |
jnz .vloop |
mov [map], byte 1 ;Map-Position zuruecksetzen |
popa |
ret |
draw_window: |
pusha |
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+492 ; [x start] *65536 + [x size] |
mov ecx,100*65536+420 ; [y start] *65536 + [y size] |
mov edx,bgcolor ; color of work area RRGGBB,8->color gl |
or edx,0x13000000 |
mov edi,header |
int 0x40 |
mov eax,8 |
mov ebx,84*65536+72 |
mov ecx,28*65536+15 |
mov edx,2 |
mov esi,btcolor |
int 0x40 |
add ebx,76 shl 16 |
inc edx |
int 0x40 |
add ebx,76 shl 16 |
inc edx |
int 0x40 |
mov eax,4 |
mov ebx,26 shl 16 +32 |
mov ecx,fgcolor |
mov edx,lbl_toolbar+1 |
movsx esi, byte [lbl_toolbar] |
int 0x40 |
mov ebx,18 shl 16 +398 |
mov edx,lbl_score+1 |
movsx esi, byte [lbl_score] |
int 0x40 |
mov ebx,350 shl 16 +405 |
mov ecx,fg3color |
mov edx,lbl_copy+1 |
movsx esi,byte [lbl_copy] |
int 0x40 |
mov eax,12 ; function 12:tell os about windowdraw |
mov ebx,2 ; 2, end of draw |
int 0x40 |
popa |
ret |
; DATA AREA |
header db 'PIPES',0 |
lbl_gameover: |
db 19 |
db 'G a m e O v e r !' |
lbl_win: |
db 32 |
db ' G r e a t ! ' |
db " Let's goin'on! " |
lbl_yscore: |
db 11 |
db 'Your Score:' |
lbl_toolbar: |
db 43 |
db 'New Game: Easy Moderate Hard' |
lbl_copy: |
db 23 |
db 'v1.2 2006,Mario Birkner' |
lbl_score: |
db 28 |
db 'Time: Score: Level:' |
stat db 3 ;0=gameplay 1=won 2-lost 3=stopped |
speed db 0 |
time dd 0 |
diffic db 0 ;1=hard 3=moderate 5=easy 8=dedicated to Wildwest - try it out! |
score dd 0 |
level dd 1 |
half db 1 ;reduces the random-crosses |
map: ;14*10 blocks + position |
db 1 ;<- act. position |
db 9,9,9,9,9,9,9,9,9,9,9,9,9,9 |
db 9,7,1,3,2,0,1,1,0,3,4,4,3,9 |
db 9,5,0,2,2,1,3,0,3,1,1,6,4,9 |
db 9,4,0,4,6,0,3,3,2,6,0,1,2,9 |
db 9,3,0,1,2,4,6,4,5,1,2,4,1,9 |
db 9,5,3,2,6,3,2,1,2,1,2,6,0,9 |
db 9,4,0,2,3,0,4,1,2,3,2,3,4,9 |
db 9,2,0,4,5,6,3,1,3,0,4,1,0,9 |
db 9,1,0,3,5,4,2,2,4,1,6,0,8,9 |
db 9,9,9,9,9,9,9,9,9,9,9,9,9,9 |
images: |
file 'pipes.raw' |
I_END: |
/programs/games/pipes/pipes.raw |
---|
0,0 → 1,0 |
z£ÇsÀZ§g´r¿f³c°[¨@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@uÂq¾w Äa®mºq¾y¢Æ]ªy¢Æc°o¼{¤Èb¯Y¦mºd±@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@]ªvÃ[¨e²q¾hµf³`[¨i¶r¿g´k¸sÀq¾Y¦@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@sÀhµn»f³k¸y¢Æn»w Äo¼uÂvÃ^«p½x¡Åw ÄY¦@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@n»tÁsÀg´a®e²X¥`x¡Åy¢Æc°\ ©e²uÂf³hµ@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@^«l¹y¢Æx¡Åf³w ÄuÂz£Çz£ÇZ§d±c°w ÄY¦n»o¼@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@]ªz£Çf³r¿c°sÀf³tÁmºsÀl¹o¼a®j·k¸Y¦@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@x¡Ån»c°x¡Åi¶g´^«\ ©uÂhµy¢ÆvÃo¼W¤r¿d±@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@_¬r¿sÀ`_¬k¸W¤_¬_¬{¤Èc°c°Z§q¾]ªc°@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@g´k¸W¤_¬\ ©c°o¼k¸e²X¥tÁZ§tÁhµmº^«@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@f³]ªe²g´\ ©j·Z§Y¦b¯Z§mºw Äq¾c°i¶f³@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@x¡Åg´Y¦vÃr¿o¼k¸[¨Y¦f³q¾_¬r¿sÀ`_¬@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@j·]ªW¤w ÄsÀc°n»y¢Æf³Y¦l¹w ÄuÂtÁd±d±@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@p½n»p½Z§]ªz£ÇtÁe²y¢Æ\ ©j·vÃo¼uÂZ§p½@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@q¾^«o¼W¤n»x¡ÅZ§Y¦Z§`a®X¥n»Z§w Ä_¬@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@n»j·mº\ ©q¾{¤Èf³Z§j·]ªj·e²w ÄuÂq¾`@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@_¬w ÄtÁl¹X¥^«tÁc°b¯e²[¨[¨Z§j·k¸r¿@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@`c°q¾a®f³x¡Å`y¢Æj·uÂvÃx¡Å^«[¨d±q¾@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@e²uÂ[¨tÁ^«e²x¡Åhµn»j·\ ©g´n»k¸]ª\ ©@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@Y¦d±W¤]ªi¶l¹tÁ\ ©`^«o¼`o¼q¾e²W¤@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@r¿p½w Äp½`q¾b¯\ ©X¥sÀvÃZ§g´uÂf³hµ@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@vÃx¡ÅmºX¥Z§r¿x¡Åmºn»`X¥vÃz£Ç[¨g´\ ©@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@w ÄhµvÃf³^«tÁc°i¶f³x¡ÅZ§]ªp½tÁ_¬{¤È@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@{¤È^«tÁi¶hµk¸mº]ª_¬c°mºmºd±z£Çc°tÁ@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@b¯p½d±tÁw Äe²w ÄX¥j·p½Y¦q¾hµa®mºmº@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@f³{¤Èx¡ÅY¦a®hµl¹X¥\ ©l¹w Äj·_¬g´]ª_¬@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@W¤{¤ÈsÀ{¤ÈW¤j·r¿Z§n»`X¥vÃz£Ç[¨g´\ ©@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@w ÄhµvÃf³^«tÁc°i¶w Ämº_¬Z§mºsÀl¹o¼@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@Y¦x¡Å^«b¯x¡Ån»c°x¡ÅvÃg´vÃf³f³w Ämºe²@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@c°c°n»d±i¶d±_¬l¹p½uÂa®]ªp½j·X¥X¥@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@X¥vÃw Äa®a®W¤j·Z§d±mºZ§n»q¾vÃf³hµ@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@i¶k¸y¢Æw Än»b¯hµj·Z§W¤i¶z£ÇsÀZ§g´r¿@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@b¯r¿f³uÂq¾w Äa®mºe²Z§`a®X¥n»Z§w Ä_¬vÃe²p½f³n»i¶o¼y¢Æp½o¼{¤Èz£Çi¶e²X¥^«n»j·mº\ ©q¾{¤Èf³n»n»g´X¥uÂg´y¢Æc°hµ{¤Èl¹j·{¤ÈX¥^«z£ÇY¦uÂg´sÀi¶mºd±w Äc°{¤Èq¾{¤Èy¢ÆY¦r¿f³hµY¦`sÀw ÄsÀx¡ÅY¦[¨mºg´[¨x¡Åa®uÂc°e²Y¦_¬sÀ]ªj·_¬p½X¥b¯[¨j·j·n»f³w ÄmºX¥Z§r¿x¡ÅmºtÁg´X¥l¹j·j·W¤q¾^«o¼W¤n»x¡ÅZ§Y¦l¹e²]ªe²a®i¶k¸r¿i¶Z§uÂn»uÂk¸{¤ÈX¥c°uÂn»l¹e²j·n»_¬b¯a®k¸w Äz£Çg´l¹r¿f³vÃ_¬^«a®vÃl¹r¿vÃx¡ÅZ§^«e²hµq¾n»b¯hµy¢Æf³x¡Åj·\ ©z£Ç`x¡Åa®i¶hµb¯^«r¿i¶Z§k¸{¤ÈY¦\ ©i¶o¼g´e²x¡ÅY¦y¢Æd±sÀi¶l¹Z§c°^«uÂW¤w Ämº_¬Z§mºsÀl¹o¼a®j·k¸Y¦y¢Æ]ªmº^«j·mº[¨_¬o¼n»b¯hµj·X¥l¹y¢Æq¾uÂ_¬uÂp½vÃz£Çy¢Æn»Y¦tÁj·c°tÁ\ ©\ ©sÀi¶p½j·mºtÁq¾\ ©hµ@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@puppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppup ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ °µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ° ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ puppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppuppup@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Y¦sÀk¸c°Y¦n»]ªX¥y¢Æ[¨i¶tÁf³W¤z£ÇvÃe²c°n»_¬c°mºmºd±z£Çc°tÁW¤q¾Y¦l¹\ ©j·o¼tÁk¸i¶_¬`]ªx¡ÅvÃq¾b¯[¨z£Çb¯j·]ªp½y¢Æz£Ç]ªc°k¸_¬vÃhµX¥z£Ç]ªj·z£ÇuÂb¯vÃuÂ`a®hµl¹q¾Z§w ÄtÁ`x¡ÅZ§n»tÁx¡Åd±^«w Äe²i¶b¯sÀ^«^«l¹c°]ªvÃz£ÇtÁuÂo¼x¡Åq¾hµg´x¡Åf³[¨]ªtÁk¸hµx¡Åq¾[¨uÂr¿vÃq¾a®n»vÃ_¬vÃX¥g´e²mºhµp½l¹l¹d±tÁuÂZ§_¬w ÄtÁl¹X¥^«tÁc°^«z£Çq¾x¡ÅX¥W¤q¾[¨z£Çp½`p½Z§{¤Èf³[¨e²^«x¡Åi¶l¹tÁj·[¨[¨p½p½j·tÁa®mºf³\ ©tÁz£ÇW¤{¤ÈsÀ{¤ÈW¤j·r¿Z§g´k¸\ ©x¡Åb¯`q¾sÀk¸c°w Äi¶b¯i¶\ ©]ª\ ©i¶mºw Äc°c°a®d±w Äp½l¹j·p½uÂj·y¢Æ]ªp½]ª[¨j·vÃq¾k¸a®Y¦[¨hµn»a®e²q¾uÂj·]ªj·e²w ÄuÂq¾`y¢Æ[¨{¤È\ ©g´mºr¿X¥]ªg´i¶l¹d±tÁuÂhµ\ ©f³]ªz£Çf³r¿c°@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@W¤l¹n»w Äo¼mºsÀY¦k¸mº]ªo¼Y¦d±mº{¤È@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@p½w Äz£Ç^«d±^«hµf³[¨r¿Z§_¬tÁW¤j·vÃ@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@hµuÂ{¤Èy¢ÆX¥W¤g´_¬q¾c°q¾d±vÃg´Y¦mº@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@`a®hµl¹q¾Z§w ÄtÁl¹p½q¾Z§`d±_¬vÃ@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@{¤Èmºp½r¿hµmºc°a®sÀe²i¶vÃx¡Åj·X¥\ ©@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@^«k¸uÂ]ª{¤Èx¡Åj·X¥q¾y¢Æ[¨_¬uÂp½j·j·@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@tÁr¿x¡Å_¬o¼sÀc°mºX¥_¬a®y¢Æl¹o¼^«sÀ@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@@@@w ÄY¦n»o¼vÃq¾e²Z§j·c°sÀg´q¾]ªp½@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ puppup@@@@@@@@@@@@@@@@@@@@@@@@@@@{¤Èc°]ªb¯p½g´p½c°@@@@@@pup ¥ ¥ °µ°°µ°°µ° ¥ ¥ puppup@@@@@@@@@@@@@@@@@@@@@@@@d±^«Z§q¾_¬hµi¶Y¦@@@@@@puppup ¥ ¥ °µ°°µ°°µ° ¥ ¥ puppuppuppuppuppuppuppuppupZ§W¤j·Y¦\ ©hµy¢ÆtÁ@@@@@@@@@puppup ¥ ¥ °µ°°µ°°µ° ¥ ¥ W¤k¸i¶q¾\ ©k¸w Ä]ªj·@@@@@@@@@puppup ¥ ¥ °µ°°µ°°µ° ¥ ¥ hµf³n»mºo¼^«e²b¯i¶Z§@@@@@@@@@puppup ¥ ¥ °µ°°µ°°µ° ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ _¬k¸W¤_¬^«tÁ[¨mºq¾j·e²@@@@@@@@@puppup ¥ ¥ °µ°°µ°°µ° ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ n»z£Çc°p½q¾tÁ^«b¯mºi¶Z§l¹@@@@@@@@@puppup ¥ ¥ °µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°a®uÂY¦z£Çq¾vÃ`mºz£Çq¾f³e²Z§@@@@@@@@@puppup ¥ ¥ °µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°a®e²p½i¶e²p½k¸n»hµmºW¤p½l¹j·@@@@@@@@@puppup ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ]ªj·c°o¼{¤Èz£ÇZ§d±_¬z£Çe²y¢Æi¶Z§Z§@@@@@@@@@puppup ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ l¹tÁuÂ`Z§y¢ÆhµtÁ`hµr¿W¤q¾f³e²e²@@@@@@@@@puppup w Ä{¤Èp½d±`tÁk¸f³l¹_¬uÂg´mºW¤p½l¹l¹@@@@@@@@@puppup c°mºp½z£Ço¼c°uÂW¤i¶`\ ©Z§tÁb¯x¡Åj·b¯Z§@@@@@@@@@puppuppuppuppuppuppuppuppuppuppupn»{¤ÈX¥sÀuÂp½z£Ço¼q¾f³e²mºp½hµr¿W¤q¾f³e²@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Z§y¢ÆhµtÁz£Ç[¨l¹f³mºW¤p½l¹sÀ_¬uÂg´mºW¤p½l¹@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@q¾x¡Åo¼tÁb¯g´q¾_¬Z§n»c°w Äl¹]ªa®a®n»_¬hµW¤Z§d±{¤ÈZ§X¥q¾sÀl¹q¾[¨k¸hµw Ä\ ©w Ä`i¶uÂy¢Æl¹y¢Æ{¤Èmº{¤ÈtÁj·e²uÂz£Çk¸f³k¸W¤^«c°j·_¬y¢Æe²p½c°r¿mº\ ©a®Y¦w Äx¡Åy¢Æf³[¨[¨hµX¥p½p½uÂc°p½Y¦c°W¤n»i¶j·Z§]ªc°a®[¨i¶q¾q¾Z§]ªf³mºy¢Æn»Z§o¼hµ_¬e²tÁsÀz£Çd±`o¼i¶z£Çp½_¬mºq¾Y¦q¾b¯sÀy¢Æ_¬vÃZ§d±_¬o¼]ªq¾a®{¤Èn»x¡År¿uÂ^«z£ÇuÂo¼`Z§{¤Èe²q¾q¾^«o¼\ ©\ ©_¬p½g´l¹uÂx¡Å`vÃtÁY¦z£Çy¢Æk¸X¥tÁ[¨[¨p½`[¨p½c°tÁy¢Æz£Çp½vÃtÁtÁ^«k¸hµhµg´q¾o¼p½j·d±g´W¤d±f³]ªy¢ÆsÀx¡Ån»sÀj·\ ©l¹z£ÇuÂk¸hµZ§k¸`^«[¨e²w Äy¢Æi¶p½]ª^«j·X¥_¬Y¦j·mºr¿vÃd±uÂd±_¬z£Çj·Z§f³o¼W¤f³tÁd±n»mºb¯mºb¯]ªtÁY¦c°p½sÀj·\ ©vÃmºvÃ{¤Èc°q¾x¡Åo¼tÁb¯g´q¾_¬Z§n»c°w Äl¹]ªa®a®n»_¬hµW¤Z§d±{¤ÈZ§X¥q¾sÀl¹q¾[¨k¸hµw Ä\ ©w Ä`i¶uÂy¢Æl¹y¢Æ{¤Èmº{¤ÈtÁj·e²uÂz£Çk¸f³k¸W¤^«c°j·_¬y¢Æe²p½c°r¿mº\ ©a®Y¦w Äx¡Åy¢Æf³[¨[¨hµX¥p½p½uÂc°p½Y¦c°W¤n»i¶j·Z§]ªc°a®[¨i¶q¾q¾Z§]ªf³mºy¢Æn»Z§o¼hµ_¬e²tÁsÀz£Çd±`o¼i¶z£Çp½_¬mºq¾Y¦q¾b¯sÀy¢Æ_¬vÃZ§d±_¬o¼]ªq¾a®{¤Èn»x¡År¿uÂ^«z£ÇuÂo¼`Z§{¤Èe²q¾q¾^«o¼\ ©\ ©_¬p½g´l¹uÂx¡Å`vÃtÁY¦z£Çy¢Æk¸X¥tÁ[¨[¨p½`[¨p½c°tÁy¢Æz£Çp½vÃtÁtÁ^«k¸hµhµg´q¾o¼p½j·d±g´W¤d±f³]ªy¢ÆsÀx¡Ån»sÀj·\ ©l¹z£ÇuÂk¸hµZ§k¸`^«[¨e²w Äy¢Æi¶p½]ª^«j·X¥_¬Y¦j·mºr¿vÃd±uÂd±_¬z£Çj·Z§f³o¼W¤f³tÁd±n»mºb¯mºb¯]ªtÁY¦c°p½sÀj·\ ©vÃmºvÃ{¤Èc°g´y¢Æp½^«\ ©o¼l¹i¶mºq¾i¶l¹`_¬hµz£Çmºq¾i¶j·@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@tÁq¾z£Çw Ähµb¯p½Y¦W¤f³`_¬hµz£Çmºq¾i¶j·Z§@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@z£ÇvÃo¼e²g´e²q¾tÁp½e²\ ©uÂr¿e²W¤f³Z§e²@@@@@@@@@puppuppuppuppuppuppuppuppuppuppup]ªl¹vÃi¶l¹y¢ÆZ§f³l¹mºZ§g´W¤y¢Æp½e²l¹@@@@@@@@@puppup p½]ªg´b¯W¤\ ©`[¨sÀp½tÁmºq¾i¶l¹Z§@@@@@@@@@puppup p½c°vÃsÀa®j·d±X¥_¬hµb¯W¤f³Z§j·@@@@@@@@@puppup ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ mºa®f³^«k¸vÃ_¬i¶uÂr¿x¡Åp½e²Z§@@@@@@@@@puppup ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ f³o¼f³^«uÂo¼vÃi¶g´W¤j·l¹e²@@@@@@@@@puppup ¥ ¥ °µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°b¯p½w Äl¹w ÄuÂ\ ©a®mºq¾b¯l¹@@@@@@@@@puppup ¥ ¥ °µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°q¾\ ©mºc°j·Z§k¸uÂW¤f³Z§@@@@@@@@@puppup ¥ ¥ °µ°°µ°°µ° ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ x¡Åg´e²]ªsÀp½e²Y¦p½e²@@@@@@@@@puppup ¥ ¥ °µ°°µ°°µ° ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ g´q¾sÀvÃa®_¬x¡Åz£Çl¹@@@@@@@@@puppup ¥ ¥ °µ°°µ°°µ° ¥ ¥ z£Çx¡Åi¶z£Çg´vÃ^«q¾@@@@@@@@@puppup ¥ ¥ °µ°°µ°°µ° ¥ ¥ ]ªq¾j·tÁj·x¡Å^«vÃ@@@@@@puppup ¥ ¥ °µ°°µ°°µ° ¥ ¥ puppuppuppuppuppuppuppuppupz£Çz£Çmºr¿`mºk¸`@@@@@@pup ¥ ¥ °µ°°µ°°µ° ¥ ¥ puppup@@@@@@@@@@@@@@@@@@@@@@@@_¬hµz£ÇtÁ[¨X¥\ ©mº@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ puppup@@@@@@@@@@@@@@@@@@@@@@@@@@@uÂr¿e²b¯y¢ÆZ§tÁb¯@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@@@@tÁ^«{¤È`hµp½W¤g´W¤y¢Æx¡Åy¢Ær¿r¿Y¦@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@w Är¿k¸mºa®uÂw Äl¹mºq¾i¶j·X¥x¡Åx¡År¿@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@Y¦x¡ÅuÂp½hµ{¤Èz£Çn»W¤f³Z§b¯Z§mº_¬vÃ@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@n»_¬]ªr¿l¹y¢Æ^«w Äp½e²]ªsÀuÂtÁo¼uÂ@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@o¼o¼{¤Èhµq¾X¥d±o¼l¹mºmº]ªg´g´sÀ^«@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@vÃsÀx¡ÅmºZ§W¤^«mºsÀp½Y¦tÁuÂX¥c°{¤È@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@q¾c°j·c°w Äg´hµsÀk¸k¸y¢ÆtÁw Äl¹mºf³@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@e²mºX¥a®tÁ_¬f³Y¦k¸sÀl¹p½W¤mºg´uÂ_¬z£Ç]ªz£Çg´x¡Åq¾b¯f³mºp½p½]ªz£ÇtÁg´vÃ]ªy¢Æq¾mºa®w Äq¾k¸p½mºe²f³q¾W¤r¿hµz£Çq¾x¡Åq¾g´\ ©p½o¼a®c°]ªl¹vÃq¾y¢Æd±y¢Æk¸a®y¢ÆY¦\ ©x¡Åy¢ÆY¦mº]ªZ§i¶y¢Æe²z£Çmºj·i¶sÀe²mºw Äf³f³vÃg´vÃo¼z£Çp½uÂsÀX¥{¤Èn»w Äw Äo¼tÁtÁ]ªsÀb¯j·x¡Åb¯tÁr¿tÁz£ÇvÃ]ªc°l¹^«^«sÀb¯i¶e²w Ä^«d±x¡ÅtÁn»Z§x¡Å`tÁw ÄuÂg´uÂZ§X¥y¢Æy¢Æ[¨`j·g´a®sÀj·w ÄuÂk¸a®W¤l¹g´hµ\ ©_¬n»[¨x¡Åo¼y¢Æi¶b¯l¹X¥g´tÁmºx¡År¿Z§X¥mºx¡ÅvÃ_¬p½Z§uÂo¼vÃj·\ ©y¢Æe²b¯o¼z£ÇsÀ[¨r¿hµf³uÂg´mºc°sÀo¼_¬x¡År¿tÁ\ ©k¸^«^«x¡Åe²k¸\ ©vÃ_¬d±`Z§q¾p½l¹j·j·p½uÂ_¬[¨y¢Æq¾f³{¤È^«uÂvÃr¿Y¦b¯mº`vÃq¾z£ÇY¦uÂa®i¶i¶X¥[¨f³tÁY¦i¶Z§\ ©`^«e²[¨l¹_¬@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@l¹p½W¤mºg´uÂ_¬sÀl¹p½W¤mºf³l¹[¨z£ÇtÁhµy¢ÆZ§@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@e²f³q¾W¤r¿hµp½mºe²f³q¾o¼z£Çp½uÂsÀX¥{¤Èn»puppuppuppuppuppuppuppuppuppuppup@@@@@@@@@Z§b¯j·x¡Åb¯tÁZ§\ ©`i¶W¤uÂc°o¼z£Çp½mºc° puppup@@@@@@@@@l¹l¹p½W¤mºg´uÂ_¬l¹f³k¸tÁ`d±p½{¤Èw Ä puppup@@@@@@@@@e²e²f³q¾W¤r¿hµ`tÁhµy¢ÆZ§`uÂtÁl¹ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ puppup@@@@@@@@@Z§Z§i¶y¢Æe²z£Ç_¬d±Z§z£Ç{¤Èo¼c°j·]ª ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ puppup@@@@@@@@@j·l¹p½W¤mºhµn»k¸p½e²i¶p½e²a®°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ° ¥ ¥ puppup@@@@@@@@@Z§e²f³q¾z£Çmº`vÃq¾z£ÇY¦uÂa®°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ° ¥ ¥ puppup@@@@@@@@@l¹Z§i¶mºb¯^«tÁq¾p½c°z£Çn» ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ °µ°°µ°°µ° ¥ ¥ puppup@@@@@@@@@e²j·q¾mº[¨tÁ^«_¬W¤k¸_¬ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ °µ°°µ°°µ° ¥ ¥ puppup@@@@@@@@@Z§i¶b¯e²^«o¼mºn»f³hµ ¥ ¥ °µ°°µ°°µ° ¥ ¥ puppup@@@@@@@@@j·]ªw Äk¸\ ©q¾i¶k¸W¤ ¥ ¥ °µ°°µ°°µ° ¥ ¥ puppup@@@@@@@@@tÁy¢Æhµ\ ©Y¦j·W¤Z§puppuppuppuppuppuppuppuppup ¥ ¥ °µ°°µ°°µ° ¥ ¥ puppup@@@@@@Y¦i¶hµ_¬q¾Z§^«d±@@@@@@@@@@@@@@@@@@@@@@@@puppup ¥ ¥ °µ°°µ°°µ° ¥ ¥ pup@@@@@@c°p½g´p½b¯]ªc°{¤È@@@@@@@@@@@@@@@@@@@@@@@@@@@puppup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@p½]ªq¾g´sÀc°j·Z§e²q¾vÃo¼n»Y¦w Ä@@@@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@sÀ^«o¼l¹y¢Æa®_¬X¥mºc°sÀo¼_¬x¡År¿tÁ@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@j·j·p½uÂ_¬[¨y¢Æq¾X¥j·x¡Å{¤È]ªuÂk¸^«@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@\ ©X¥j·x¡ÅvÃi¶e²sÀa®c°mºhµr¿p½mº{¤È@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@vÃ_¬d±`Z§q¾p½l¹tÁw ÄZ§q¾l¹hµa®`@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@mºY¦g´vÃd±q¾c°q¾_¬g´W¤X¥y¢Æ{¤ÈuÂhµ@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@vÃj·W¤tÁ_¬Z§r¿[¨f³hµ^«d±^«z£Çw Äp½@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@{¤Èmºd±Y¦o¼]ªmºk¸Y¦sÀmºo¼w Än»l¹W¤@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@c°r¿f³z£Ç]ªf³\ ©hµY¦f³_¬tÁa®X¥mºe²@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@f³mºl¹w ÄtÁy¢Æk¸k¸sÀhµg´w Äc°j·c°q¾@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@{¤Èc°X¥uÂtÁY¦p½sÀmº^«W¤Z§mºx¡ÅsÀvÃ@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@^«sÀg´g´]ªmºmºl¹o¼d±X¥q¾hµ{¤Èo¼o¼@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@uÂo¼tÁuÂsÀ]ªe²p½w Ä^«y¢Æl¹r¿]ª_¬n»@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@vÃ_¬mºZ§b¯Z§f³W¤n»z£Ç{¤Èhµp½uÂx¡ÅY¦@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@r¿x¡Åx¡ÅX¥j·i¶q¾mºl¹w ÄuÂa®mºk¸r¿w Ä@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@Y¦r¿r¿y¢Æx¡Åy¢ÆW¤g´W¤p½hµ`{¤È^«tÁ@@@@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@b¯tÁZ§y¢Æb¯e²r¿uÂ@@@@@@@@@@@@@@@@@@@@@@@@@@@puppup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@mº\ ©X¥[¨tÁz£Çhµ_¬@@@@@@@@@@@@@@@@@@@@@@@@puppup ¥ ¥ °µ°°µ°°µ° ¥ ¥ pup@@@@@@`k¸mº`r¿mºz£Çz£Çpuppuppuppuppuppuppuppuppup ¥ ¥ °µ°°µ°°µ° ¥ ¥ puppup@@@@@@vÃ^«x¡Åj·tÁj·q¾]ª ¥ ¥ °µ°°µ°°µ° ¥ ¥ puppup@@@@@@@@@b¯^«vÃg´z£Çi¶x¡Åz£Ç ¥ ¥ °µ°°µ°°µ° ¥ ¥ puppup@@@@@@@@@l¹j·x¡Å_¬a®vÃsÀq¾g´ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ °µ°°µ°°µ° ¥ ¥ puppup@@@@@@@@@e²p½x¡Åe²p½sÀ]ªe²g´x¡Å ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ °µ°°µ°°µ° ¥ ¥ puppup@@@@@@@@@Z§f³W¤b¯k¸Z§j·c°mº\ ©q¾°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ° ¥ ¥ puppup@@@@@@@@@l¹b¯q¾mºtÁy¢Æk¸k¸l¹w Äp½b¯°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ° ¥ ¥ puppup@@@@@@@@@e²l¹j·W¤g´Z§Y¦p½sÀ^«f³o¼f³ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ puppup@@@@@@@@@Z§e²p½x¡År¿uÂ\ ©mºmºl¹^«f³a®mº ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ puppup@@@@@@@@@j·Z§f³W¤b¯hµ_¬`]ªe²p½sÀvÃc°p½ puppup@@@@@@@@@Z§l¹i¶q¾mºtÁp½sÀb¯Z§f³W¤b¯g´]ªp½ puppup@@@@@@@@@l¹e²p½y¢ÆW¤g´Z§mºl¹j·i¶q¾mºi¶vÃl¹]ªpuppuppuppuppuppuppuppuppuppuppup@@@@@@@@@e²Z§f³W¤e²r¿uÂ\ ©e²p½x¡Åy¢ÆW¤g´e²o¼vÃz£Ç@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Z§j·i¶q¾mºz£Çhµ_¬`f³W¤b¯e²r¿uÂw Äz£Çq¾tÁ@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@j·i¶q¾mºz£Çhµ_¬`l¹i¶q¾mºtÁz£Çhµ_¬^«p½y¢Æg´c°{¤ÈvÃmºvÃ\ ©j·sÀp½c°Y¦tÁ]ªb¯o¼tÁuÂsÀ]ªe²p½y¢ÆW¤g´Z§j·z£Ç_¬d±uÂd±vÃr¿mºj·Y¦_¬X¥j·^«]ªp½i¶y¢Æw Äe²_¬mºZ§b¯Z§f³W¤e²r¿uÂ\ ©j·sÀn»x¡ÅsÀy¢Æ]ªf³d±W¤g´d±j·p½o¼q¾g´hµhµk¸^«x¡Åx¡ÅX¥j·i¶q¾mºz£Çhµ_¬`p½[¨[¨tÁX¥k¸y¢Æz£ÇY¦tÁvÃ`x¡ÅuÂl¹g´p½_¬\ ©\ ©o¼r¿r¿y¢Æx¡Åy¢ÆW¤g´o¼uÂz£Ç^«uÂr¿x¡Ån»{¤Èa®q¾]ªo¼_¬d±Z§vÃ_¬y¢ÆsÀb¯q¾Y¦q¾mºtÁZ§y¢Æb¯e²r¿uÂz£ÇsÀtÁe²_¬hµo¼Z§n»y¢Æmºf³]ªZ§q¾q¾i¶[¨a®c°]ªZ§j·i¶n»\ ©X¥[¨tÁz£Çhµ_¬p½X¥hµ[¨[¨f³y¢Æx¡Åw ÄY¦a®\ ©mºr¿c°p½e²y¢Æ_¬j·c°^«W¤k¸f³k¸z£ÇuÂe²j·tÁ{¤Èmº{¤Èy¢Æl¹y¢ÆuÂi¶`w Ä\ ©w Ähµk¸[¨q¾l¹sÀq¾X¥Z§{¤Èd±Z§W¤hµ_¬n»a®a®]ªl¹w Äc°n»Z§_¬q¾g´b¯tÁo¼x¡Åq¾hµ\ ©f³]ªz£Çf³r¿c°@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@W¤l¹n»w Äo¼mºsÀY¦k¸mº]ªo¼Y¦d±mº{¤È@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@p½w Äz£Ç^«d±^«hµf³[¨r¿Z§_¬tÁW¤j·vÃ@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@hµuÂ{¤Èy¢ÆX¥W¤g´_¬q¾c°q¾d±vÃg´Y¦mº@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@`a®hµl¹q¾Z§w ÄtÁl¹p½q¾Z§`d±_¬vÃ@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@{¤Èmºp½r¿hµmºc°a®sÀe²i¶vÃx¡Åj·X¥\ ©@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@^«k¸uÂ]ª{¤Èx¡Åj·X¥q¾y¢Æ[¨_¬uÂp½j·j·@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@tÁr¿x¡Å_¬o¼sÀc°mºX¥_¬a®y¢Æl¹o¼^«@@@@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@@@@w ÄY¦n»o¼vÃq¾e²@@@@@@@@@@@@@@@@@@@@@@@@@@@puppup ¥ ¥ °µ°°µ° ¥ ¥ puppup@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@puppup ¥ ¥ ¥ °µ°°µ° ¥ ¥ ¥ puppup@@@@@@@@@@@@@@@@@@@@@@@@puppuppuppuppuppuppuppuppup ¥ ¥ ¥ ¥ °µ°°µ° ¥ ¥ ¥ ¥ puppuppuppuppuppuppuppuppup ¥ ¥ ¥ ¥ ¥ °µ°°µ° ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ °µ°°µ° ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ °µ°°µ° ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ °µ°°µ° ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ °µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ° ¥ °µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ° ¥ °µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ°°µ° ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ °µ°°µ° ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ °µ°°µ° ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ °µ°°µ° ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ ¥ °µ°°µ° ¥ ¥ ¥ ¥ ¥ puppuppuppuppuppuppuppuppup ¥ ¥ ¥ ¥ °µ°°µ° ¥ ¥ ¥ ¥ puppuppuppuppuppuppuppuppup@@@@@@@@@@@@@@@@@@@@@@@@puppup ¥ ¥ ¥ °µ°°µ° ¥ ¥ ¥ puppup@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@puppup ¥ ¥ °µ°°µ° ¥ ¥ puppup@@@@@@@@@@@@@@@@@@@@@@@@@@@_¬l¹[¨e²^«`\ ©@@@@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@@@@Y¦r¿vÃuÂ^«{¤Èf³q¾y¢Æ[¨_¬uÂp½j·j·@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@tÁr¿x¡Å_¬o¼sÀc°mºg´uÂf³hµr¿[¨sÀz£Ç@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@Z§r¿x¡ÅmºtÁg´X¥l¹b¯i¶y¢Æo¼x¡Å[¨n»_¬@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@y¢Æy¢ÆX¥Z§uÂg´uÂw ÄtÁ`x¡ÅZ§n»tÁx¡Åd±@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@b¯x¡Åj·b¯sÀ]ªtÁtÁo¼w Äw Än»{¤ÈX¥sÀuÂ@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@e²y¢Æi¶Z§]ªmºY¦y¢Æx¡Å\ ©Y¦y¢Æa®k¸y¢Æd±@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@r¿W¤q¾f³e²mºp½k¸q¾w Äa®mºq¾y¢Æ]ªvÃ@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@uÂg´mºW¤p½l¹sÀk¸_¬vÃ\ ©k¸e²x¡Å^«^«k¸\ ©tÁr¿x¡Å_¬o¼sÀc°mº{¤Èmºp½r¿hµmºc°a®c°Z§l¹W¤c°c°i¶d±uÂvÃ^«`k¸y¢Æw Ä[¨p½d±z£ÇZ§z£Ç\ ©mºY¦o¼w Äb¯c°d±vÃw Än»Y¦l¹p½_¬[¨g´sÀb¯tÁ[¨j·r¿[¨r¿y¢Ær¿vÃsÀe²i¶vÃx¡ÅX¥\ ©q¾]ª[¨i¶r¿g´k¸sÀq¾q¾Y¦{¤Èk¸w Äb¯_¬`X¥c°hµhµl¹i¶ vÃBAADCDDEEFFFFFFEEECDDAAA^« c°g´hµW¤W¤q¾l¹r¿g´k¸\ ©c°W¤X¥z£Çg´p½ HGHJKKMMMOOONNOMMMKJJGHH p½l¹x¡Åx¡Å^«[¨d±q¾mº_¬a®n»j·c°c° @@@@@@ STSWWVYYYYYXWVWTSS @@@@@@ i¶X¥X¥vÃe²w Ä\ ©y¢Æ]ª{¤ÈvÃg´q¾ @@@```@@@@@@ ^^^bbbdeeedeabb^^] @@@@@@```@@@ b¯b¯x¡Åe²c°tÁtÁ_¬{¤Èr¿W¤i¶ @@@@@@```@@@ mmnqpqqqqmmn @@@```@@@@@@ o¼o¼Y¦d±mº{¤Èw ÄuÂo¼X¥\ ©{¤È^« @@@@@@@@@@@@ yyz}}}}}}zyz @@@@@@@@@@@@ vÃuÂuÂY¦j·sÀi¶r¿o¼k¸[¨p½a®AABHHH @@@@@@ @@@@@@ HHGAAAsÀsÀhµy¢Æx¡Åz£Çg´vÃf³f³w ÄmºDCCKJKSTT^^^ ^^^STTJKKCDDi¶i¶d±_¬l¹[¨uÂvÃ^«p½x¡Åw ÄEEEMMMVVVbbammmyyz yyynnnbbbWWWMMMEEEa®a®e²X¥`l¹l¹j·r¿r¿k¸r¿FFFOOOYYYdedqpp}}} }}~qqpeddYYYONNFFFtÁtÁhµuÂd±e²f³q¾[¨n»W¤uÂFFFNOOYYYdeeqqp~}} }}}qpqeddXXYNOOFFFk¸j·]ªmº`sÀ`l¹b¯y¢ÆsÀl¹EDEMMMVWVbabmmmzzy yzznnmbbbWWWMMMEEEl¹k¸_¬_¬g´z£Ç]ªk¸`i¶vÃg´CCCJJKTTS^]^ ^^^SSSKKJDDCW¤l¹Y¦tÁi¶q¾W¤\ ©f³e²uÂf³ABAGGG @@@@@@ @@@@@@ GHHAABf³W¤o¼b¯hµ]ªy¢Æc°\ ©e²`y¢Ævà @@@@@@@@@@@@ zyz}}}}}}yyy @@@@@@@@@@@@ ^«mºf³w ÄuÂz£Çx¡Åj·f³g´y¢Æq¾và @@@@@@```@@@ nmmqqqqqqnmn @@@```@@@@@@ b¯mºj·n»p½i¶d±mº{¤Èa®k¸r¿ @@@```@@@@@@ ^]^abbdeedddbbb^^^ @@@@@@```@@@ o¼b¯Y¦p½[¨^«]ªe²a®i¶Z§y¢Æi¶ @@@@@@ TTSVWVYYYYXYVWWTSS @@@@@@ c°n»o¼a®j·k¸Y¦r¿[¨vÃw Ä[¨r¿l¹p½ HHGJJKMMMNNOONNMMMJKKGHG p½g´mºn»q¾vÃf³hµZ§\ ©sÀa®f³e²hµg´@@@ @@@ABBCCCEEEFFFFFFEEECCCBBA@@@ @@@l¹hµo¼mºr¿`{¤ÈsÀvÃX¥W¤\ ©a®[¨sÀi¶@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Y¦{¤Èi¶o¼z£ÇW¤o¼b¯vÃtÁp½^«a®[¨sÀi¶@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Y¦{¤Èi¶r¿k¸Y¦o¼y¢Æk¸\ ©a®^«b¯vÃuÂ`@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@e²i¶b¯sÀ^«^«l¹c°p½k¸w Äq¾e²Z§_¬X¥@@@@@@@@@@@@@@@@@@@@@°µ°°µ°@@@@@@@@@@@@@@@@@@@@@q¾c°z£Çj·W¤q¾f³^«b¯hµ]ª\ ©W¤e²mºd±@@@@@@@@@@@@ ¥ ¥ °µ°°µ° ¥ ¥ @@@@@@@@@@@@l¹j·\ ©mºuÂf³vÃj·l¹f³p½j·n»uÂk¸{¤È@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@r¿f³vÃ_¬^«a®vÃl¹_¬{¤Èr¿W¤i¶n»_¬f³@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@mº]ªo¼Y¦d±mº{¤Èa®p½X¥f³r¿x¡Ån»w Äd±@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@q¾vÃc°`p½o¼]ª[¨^«]ªmº^«q¾uÂ^«k¸@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@l¹]ªc°a®o¼p½\ ©g´_¬vÃ\ ©k¸e²uÂ^«k¸@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@l¹]ªc°a®l¹W¤c°c°^«c°{¤Èc°a®x¡Å^«k¸@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@l¹a®c°Z§z£Çn»w Äe²^«k¸uÂ]ª{¤È]ªj·b¯@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@]ªhµf³mºsÀmºhµuÂ]ªg´{¤Èj·uÂx¡Åj·X¥@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@\ ©W¤g´]ªl¹_¬k¸uÂa®vÃY¦uÂmº\ ©e²f³@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@d±Z§e²^«hµsÀY¦]ª`z£Ç[¨sÀd±j·p½w Ä@@@@@@@@@@@@ ¥ ¥ °µ°°µ° ¥ ¥ @@@@@@@@@@@@{¤ÈY¦b¯d±vÃl¹W¤x¡Ån»g´r¿\ ©e²Z§e²^«@@@@@@@@@@@@@@@@@@@@@°µ°°µ°@@@@@@@@@@@@@@@@@@@@@tÁj·Z§vÃr¿\ ©g´c°r¿p½w Äp½`z£Ç]ªj·@@@@@@@@@@@@@@@@@@@@@@@@@@@===@@@@@@@@@@@@@@@@@@q¾\ ©g´\ ©\ ©p½w Äk¸sÀuÂx¡Åhµhµq¾b¯\ ©@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@o¼k¸q¾j·p½Z§e²tÁa®l¹b¯r¿f³j·a®r¿@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a®hµZ§sÀz£Ç_¬uÂg´]ªj·p½[¨y¢Æe²hµg´AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAg´hµz£Ç]ª[¨^«_¬a®{¤Èd±r¿{¤È`r¿l¹p½AAAAAAAAAAAACCCFFFHGGIHHIHHHGGFFFCCCAAAAAAAAAAAAp½l¹d±^«g´x¡ÅY¦mºZ§p½vÃ]ªg´y¢Æi¶^«AAAAAACBCHHHLLMPPPSSRSSTSSTSSRPPPLLMHHHCBCAAAAAA^«i¶vÃuÂ\ ©_¬hµg´k¸l¹uÂhµy¢Ær¿]ª`AAADDDJJJQQQXWW\]]```aaaaaa```\]]XWWQQQJJJDDDAAA`]ªz£Çn»sÀ`_¬k¸Y¦tÁj·c°tÁvÃhµAAABBCJJJRSS\[[ddcjjkooopqppqpooojjkddc\[[RSSJJJBBCAAAhµ_¬r¿l¹W¤a®k¸^«e²x¡ÅhµW¤y¢ÆpµAAAGHHQQQ[\\ffgqppyyy~~~~~~yyyqppffg[\\QQQGHHAAApµhµg´Z§mºj·^«g´q¾c°z£Çj·f³AAACCDLLMXWWdddppp||||||pppdddXWWLLMCCDAAAhµ^«f³Z§a®k¸c°{¤Èq¾{¤Èy¢Æg´AAAFFEPPP]]\jjjxxxxxxjjj]]\PPPFFEAAA]ªe²{¤Èi¶a®W¤c°p½q¾tÁ^«l¹AAAHHGSRR```ono}~~¤£¤¨¨¨¨¨¨¤£¤}~~ono```SRRHHGAAAx¡Åk¸f³\ ©tÁz£Ç[¨^«g´Z§\ ©uÂ@@@IIHTSSbaappp¨§¨°°°°°°¨§¨pppbaaTSSIIH@@@a®mºb¯r¿mºr¿p½Y¦q¾hµa®r¿@@@IIHTSSbaappp¨§¨°°°°°°¨§¨pppbaaTSSIIH@@@W¤Z§hµl¹X¥^«sÀsÀe²c°uÂw ÄAAAHHGSRR```ono}~~¤£¤¨¨¨¨¨¨¤£¤}~~ono```SRRHHGAAAY¦a®{¤Èhµw ÄZ§n»q¾a®{¤Èq¾mºAAAFFEPPP]]\jjjxxxxxxjjj]]\PPPFFEAAAi¶q¾`y¢Æb¯uÂl¹mºX¥p½[¨a®AAACCDLLMXWWdddppp||||||pppdddXWWLLMCCDAAA{¤È^«W¤j·vÃZ§hµ`X¥f³^«{¤ÈpµAAAGHHQQQ[\\ffgqppyyy~~~~~~yyyqppffg[\\QQQGHHAAApµ_¬l¹W¤X¥z£Çg´sÀ{¤È]ª_¬`i¶hµAAABBCJJJRSS\[[ddcjjkooopqppqpooojjkddc\[[RSSJJJBBCAAAhµ^«c°X¥^«n»j·[¨e²^«x¡Ål¹q¾]ª`AAADDDJJJQQQXWW\]]```aaaaaa```\]]XWWQQQJJJDDDAAA`]ªi¶e²o¼e²`{¤Èo¼f³p½d±X¥c°i¶^«l¹AAACBCHHHLLMPPPSSRSSTSSTSSRPPPLLMHHHCBCAAAl¹^«i¶W¤\ ©l¹tÁX¥o¼_¬{¤Èd±^«\ ©z£Çl¹p½]ª^«AAAAAACCCFFFHGGIHHIHHHGGFFFCCCAAAAAA^«]ªp½l¹mºY¦]ªx¡ÅvÃq¾uÂg´^«x¡Åy¢Æhµhµg´c°]ª]ª[AAAAAAAAA@@@@@@AAAAAAAAA[]ª]ªc°g´hµ_¬`l¹y¢Æx¡Åf³^«hµf³b¯Y¦p½[¨^«e²f³sÀZ§d±d±x¡ÅZ§_¬l¹]ªn»k¸a®\ ©]ªX¥]ª]ªi¶j·p½d±g´tÁY¦vÃz£Çx¡ÅtÁmº_¬a®n»j·c°c°vÃ[¨e²o¼j·r¿Z§e²[¨e²b¯g´tÁW¤a®hµb¯Y¦c°{¤ÈX¥y¢Æd±q¾uÂg´l¹f³tÁmºY¦d±]ª`g´Z§k¸r¿{¤Èl¹d±w ÄW¤e²r¿hµg´r¿z£Çmºk¸hµw Äz£ÇuÂi¶sÀ`e²d±a®\ ©a®^«^«q¾[¨y¢ÆY¦vÃmºq¾^«\ ©w Äp½z£Çk¸tÁsÀk¸{¤Èc°k¸p½j·l¹X¥e²w Äg´]ªx¡Åk¸r¿j·e²`{¤Èa®p½w ÄW¤Y¦k¸l¹\ ©l¹`^«y¢Æ\ ©W¤k¸hµb¯d±]ªZ§z£Çd±c°hµw Äp½]ªo¼vÃe²Z§X¥g´z£Ç_¬w Äc°{¤Èhµj·d±Z§y¢Æe²Z§c°`e²^«y¢Æ{¤ÈZ§c°p½^«[¨l¹uÂsÀp½z£Çg´_¬p½y¢Æw Ä_¬e²q¾tÁ{¤È^«e²{¤ÈX¥y¢Æd±q¾uÂg´Y¦g´q¾f³y¢Æz£ÇuÂZ§p½W¤z£Çq¾k¸e²i¶vÃn»k¸r¿W¤Y¦uÂ_¬Z§sÀW¤p½n»{¤Èb¯w Äd±{¤Èx¡Åy¢Æ_¬w Äx¡Åb¯\ ©W¤x¡ÅY¦i¶k¸d±_¬f³f³`sÀo¼tÁi¶^«]ªa®{¤ÈmºY¦q¾mºl¹hµx¡Åk¸r¿j·e²`{¤Èa®p½w ÄW¤Y¦k¸l¹\ ©l¹`^«y¢Æ\ ©W¤k¸hµf³tÁq¾tÁ^«X¥uÂvÃc°z£Çi¶uÂk¸a®vÃz£Çr¿l¹a®q¾uÂp½i¶q¾q¾tÁz£Çf³r¿i¶X¥c°sÀW¤mºz£Ç`y¢Æa®x¡ÅvÃz£Çq¾hµg´uÂi¶b¯^«[¨q¾{¤ÈtÁr¿Y¦uÂc°e²c°e²W¤`Y¦sÀw ÄW¤y¢Æmºg´tÁy¢Æz£Çmº{¤ÈtÁuÂk¸b¯`Y¦Y¦q¾W¤d±e²Z§\ ©X¥_¬f³l¹tÁ]ª_¬a®z£Çp½x¡Å`tÁn»k¸r¿mºw Ämºo¼{¤Èc°y¢ÆvÃz£Ç{¤Èc°e²f³vÃhµ_¬k¸p½a®[¨sÀf³uÂ_¬`n»sÀ`sÀuÂr¿W¤d±e²vÃl¹\ ©z£Çx¡Åz£Çmº{¤È`i¶r¿vÃmºuÂa®mºc°k¸f³tÁ^«[¨r¿sÀhµw ÄW¤y¢ÆY¦r¿j·e²q¾{¤ÈtÁr¿Y¦uÂc°e²c°e²W¤`Y¦sÀw ÄW¤y¢Æmºg´tÁy¢Æz£ÇmºZ§Z§Z§[¨x¡Åy¢Æj·Z§_¬Z§j·i¶[¨Z§y¢Æhµ^«l¹{¤Èj·\ ©Z§tÁZ§f³{¤Èn»\ ©o¼q¾x¡Åj·hµi¶o¼x¡Åi¶f³b¯x¡ÅsÀo¼c°e²sÀW¤^«sÀ\ ©_¬[¨j·q¾p½w Ä^«^«p½o¼z£Çf³]ªj·Z§X¥z£ÇvÃi¶]ªf³uÂd±c°vÃi¶k¸n»f³[¨j·{¤Èf³d±W¤b¯W¤Z§\ ©z£Çe²sÀ`c°vÃj·`_¬z£Çj·]ªe²x¡ÅvÃz£Çe²n»e²n»\ ©^«[¨q¾f³j·b¯\ ©p½mºj·k¸r¿l¹a®\ ©g´hµf³x¡Åp½_¬r¿e²c°k¸sÀc°n»tÁ^«[¨r¿sÀhµw ÄW¤y¢ÆY¦r¿j·e²r¿g´hµx¡Åj·b¯g´b¯z£ÇuÂ]ªa®Y¦^«p½a®i¶`q¾o¼e²q¾\ ©g´b¯Z§g´o¼b¯d±]ªZ§z£Çd±c°hµw Äp½]ªo¼vÃe²Z§X¥g´z£Ç_¬w Äc°{¤Èhµz£Çk¸j·o¼sÀ_¬y¢Æg´w Äz£ÇhµtÁmºp½l¹q¾i¶p½mºa®tÁ{¤ÈW¤uÂb¯k¸sÀsÀsÀb¯f³j·k¸p½]ªtÁ{¤ÈtÁ_¬z£ÇY¦`l¹[¨q¾Z§w Ä]ªd±[¨j·Z§vÃtÁc°l¹sÀg´\ ©r¿f³o¼i¶_¬uÂvÃb¯\ ©g´e²tÁY¦g´a®z£ÇmºtÁd±f³y¢Æo¼``l¹z£Ç{¤Èy¢Æ\ ©r¿Y¦{¤Èa®q¾z£ÇX¥]ªf³\ ©p½p½p½w ÄZ§w Ähµc°r¿mºvÃb¯a®z£Çr¿_¬k¸j·j·mºn»e²c°i¶Z§y¢Æx¡ÅtÁw Äl¹g´o¼l¹a®tÁ\ ©\ ©hµp½]ªz£ÇuÂvÃb¯\ ©g´e²tÁY¦g´a®z£ÇmºtÁd±f³y¢Æo¼``l¹z£Çk¸w Äp½k¸p½uÂy¢Æc°z£Çf³n»q¾p½mºq¾{¤È`_¬p½^«\ ©hµe²e²Z§p½d±f³]ªw ÄsÀo¼c°p½^«[¨l¹uÂsÀp½z£Çg´_¬p½y¢Æw Ä_¬e²q¾tÁ{¤È^«e²{¤ÈX¥y¢Æd±q¾uÂg´l¹f³tÁmºvÃy¢Æhµhµ{¤Èk¸z£Çi¶uÂk¸a®vÃz£Çr¿l¹a®q¾uÂp½i¶q¾q¾tÁz£Çf³r¿i¶X¥c°sÀW¤mºZ§p½X¥i¶_¬n»vÃa®k¸c°Y¦q¾y¢Æd±\ ©_¬[¨z£Çj·tÁo¼w Ämºo¼{¤Èc°y¢ÆvÃz£Ç{¤Èc°e²W¤y¢Æmºg´tÁy¢Æz£ÇmºZ§Z§Z§[¨x¡Åy¢Æj·Z§_¬tÁw Äp½p½e²b¯r¿l¹`b¯^«_¬i¶sÀhµmºg´_¬e²{¤ÈX¥uÂvÃj·a®X¥]ªuÂmºg´r¿e²e²_¬\ ©z£Çn»Y¦f³tÁl¹n»q¾]ªq¾X¥j·hµmºc°c°x¡Å`g´c°Z§w Äg´sÀb¯hµz£ÇW¤tÁb¯d±r¿a®i¶o¼_¬[¨tÁz£Çc°i¶Y¦d±i¶mºz£Çl¹`y¢ÆY¦vÃe²Z§x¡Ål¹k¸f³e²tÁ{¤Èf³_¬e²n»vÃw Äa®]ª^«x¡Åg´hµg´]ªy¢Æe²_¬vÃ\ ©k¸e²x¡Å^«^«k¸\ ©tÁr¿x¡Å_¬o»sÀc°mº{¤Èmºp½r¿hµmºc°a®c°Z§l¹W¤c°c°i¶d±uÂvÃ^«`k¸y¢Æw Ä[¨k³d±\x<O`Pfz(-2b¥Y¦o¼w Äb¯c°d±vÃw Än»Y¦l¹p½_¬[¨g´sÀb¯tÁ[¨j·r¿[¨r¿y¢Æ^«CZm1<E###"%''''4CP\ ©q¾]ª[¨i¶r¿g´k¸sÀq¾q¾Y¦{¤Èk¸w Äb¯_¬`X¥c°hµhµl¹[¨j·(-0 333HHHFFF(((!!!EEECDDAAAn»W¤X¥[¨g´hµW¤W¤q¾l¹r¿g´k¸\ ©c°W¤X¥z£Çg´^«X¥c°DXjBBB]]]AAA999IIIKJJGHHMMMX¥c°j·^«l¹x¡Åx¡Å^«[¨d±q¾mº_¬a®n»j·c°[¨j·W¤X¥III>>>GGGUUU999(((POPTSSSTSSTSMMMhµr¿`i¶X¥X¥vÃe²w Ä\ ©y¢Æ]ª{¤ÈvÃg´q¾X¥c°n»MMMSTS'''&&&===GGG***!!!abb^^]^^^STTSTSMMMnºW¤Ps[¨b¯x¡Åe²c°tÁtÁ_¬{¤Èr¿W¤i¶W¤X¥MMMSTSSTT^^^///DDD:::///kklmmm^^^^^^STTEEEFFF9L\$&(CWh^«Y¦d±mº{¤Èw ÄuÂo¼X¥\ ©{¤Èn»MMMSTSSTT^^^^^^AAA!!!777'''222zyzzzymmmVVV^^^)))*** `Y¦j·sÀi¶r¿o¼k¸[¨p½a®AABHHHSTT^^^^^^mmmzzy555 --- zzy<<<'''(((888GGG777c§hµy¢Æx¡Åz£Çg´vÃf³f³w ÄmºDCCKJKSTT^^^mmmzzyrrr))) ]]]feeEEE"""555888[[[RRROOONdwd±_¬l¹[¨uÂvÃ^«p½x¡Åw ÄEEE@@@VVV\\[mmmyyzkkk ZZZ000333KKK@@@XXX???JJJ%%%%'*e²X¥`l¹l¹j·r¿r¿[{Tn ###(((###9:9'''WWW+++kjk+++ """888%%%333///...).2hµuÂd±e²f³q¾[¨n»*29---***999&&&999&&& +++zyz888UUU-,-333***$$$&&&TqPj]ªmº`sÀ`l¹b¯y¢Æ7BL!!!DDDBBB[[[BBBIII:::%%%ggg''' RRRvwwnnmVVVWWW>>>EEEl¹k¸_¬_¬g´z£Ç]ªk¸`i¶cFFFYYYWWW>>>222&&&NNNVVVvvv !!!```zzymmm^^^SSSKKJDDCW¤l¹Y¦tÁi¶q¾W¤\ ©f³e²uÂ000GGG222---+++444zzy444zzymmm^^^^^^STSGHHAABf³W¤o¼b¯hµ]ªy¢Æc°\ ©e²`%'(((("""$%%ZZZTTTmmmzzyzyzKKK###999$$$777^^^^^^STTSTSMMMn»mºf³w ÄuÂz£Çx¡Åj·f³g´y¢Æq¾Zu%'(@Xl@@@BCBSTT^^^^^^mmmnmm333333CCC888[[[STTSTSMMMX¥n»b¯mºj·n»p½i¶d±mº{¤Èa®k¸r¿g°[¨@@@MMMSTSSTT^^^^]^abb)))$$$HHH???+++###QRQMMM@@@X¥W¤o¼b¯Y¦p½[¨^«]ªe²a®i¶Z§y¢Æ`r¿@@@@@@MMMSTSSTSTTSVWV111666LLLPPPDDD>>>@@@@@@c°X¥n»o¼a®j·k¸Y¦r¿[¨vÃw Ä[¨r¿^«j·@@@@@@@@@MMMHHGJJKMMM 000>>>ccc@@@$$$5?G@@@@@@j·[¨mºn»q¾vÃf³hµZ§\ ©sÀa®f³e²hµ[¨@@@@@@@@@@@@ABBCCCEEE)))###EEEFFF777!!! !!@@@@@@^«hµo¼mºr¿`{¤ÈsÀvÃX¥W¤\ ©a®[¨sÀi¶@@@@@@@@@@@@@@@@@@@@@555###"""!!!***...@@@@@@Y¦{¤Èi¶o¼z£ÇW¤o¼b¯vÃtÁp½^«a®[¨sÀi¶@@@@@@@@@@@@@@@@@@@@@>>>'''...+++888@@@===@@@@@@Y¦{¤Èi¶r¿k¸Y¦o¼y¢Æk¸\ ©a®^«b¯vÃuÂ`@@@@@@@@@@@@@@@@@@@@@@@@@@@===@@@@@@@@@@@@@@@@@@e²i¶b¯sÀ^«^«l¹c°p½k¸w Äq¾e²Z§_¬X¥@@@@@@@@@@@@@@@@@@@@@°µ°°µ°@@@@@@@@@@@@@@@@@@@@@q¾c°z£Çj·W¤q¾f³^«b¯hµ]ª\ ©W¤e²mºd±@@@@@@@@@@@@ ¥ ¥ °µ°°µ° ¥ ¥ @@@@@@@@@@@@l¹j·\ ©mºuÂf³vÃj·l¹f³p½j·n»uÂk¸{¤È@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@r¿f³vÃ_¬^«a®vÃl¹_¬{¤Èr¿W¤i¶n»_¬f³@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@mº]ªo¼Y¦d±mº{¤Èa®p½X¥f³r¿x¡Ån»w Äd±@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@q¾vÃc°`p½o¼]ª[¨^«]ªmº^«q¾uÂ^«k¸@@@@@@pup ¥ ¥ °µ°°µ° ¥ ¥ pup@@@@@@l¹]ªc°a®o¼p½\ ©g´`sÀo¼tÁi¶^«]ªa®{¤ÈmºY¦q¾mºl¹hµk¸Z§\ ©hµn»b¯b¯y¢ÆY¦i¶]ªo¼tÁx¡Åk¸`r¿w ÄuÂW¤n»]ªw Ähµd±i¶o¼n»a®n»y¢Æy¢Æx¡Åf³uÂl¹]ªY¦p½_¬k¸p½j·l¹X¥e²w Äg´]ªp½c°W¤i¶d±f³n»W¤y¢Æb¯Z§n»r¿X¥tÁg´{¤Èb¯\ ©l¹r¿\ ©b¯\ ©w ÄZ§mºo¼tÁo¼^«w Äc°w Ä{¤Èi¶Z§o¼z£Çc°q¾hµd±tÁk¸`d±w Äg´y¢Æ{¤Èw Äo¼l¹z£ÇY¦tÁo¼W¤n»vÃX¥z£ÇvÃuÂq¾y¢Æ_¬j·W¤k¸Y¦mºvÃj·d±n»e²W¤q¾n»x¡Åq¾d±p½c°W¤i¶d±f³n»W¤y¢Æb¯Z§n»Z§tÁ^«W¤hµ^«k¸n»l¹]ª{¤Èl¹z£ÇtÁy¢Æc°{¤È``j·g´j·`k¸vÃ[¨Y¦x¡Åb¯hµX¥q¾_¬c°_¬f³sÀuÂj·^«[¨]ªo¼y¢Æf³i¶r¿_¬q¾Y¦l¹p½tÁvÃhµn»{¤Èx¡Åg´y¢ÆmºX¥W¤c°k¸Y¦e²y¢Æd±c°Y¦q¾]ªg´]ªZ§i¶b¯q¾Y¦c°k¸Z§^«l¹sÀz£Çmºc°j·`\ ©y¢Æ^«o¼X¥y¢Æ^«_¬hµy¢Æi¶o¼e²\ ©l¹^«sÀhµsÀa®sÀe²b¯mºd±n»Y¦n»o¼`i¶c°\ ©w ÄuÂW¤n»z£Çr¿_¬k¸j·j·mºn»e²c°i¶Z§y¢Æx¡ÅtÁw Äl¹d±]ª`W¤]ª`d±e²w Äi¶o¼]ªc°Y¦a®Y¦X¥l¹mº^«uÂk¸sÀg´g´hµ[¨f³i¶l¹w Ä{¤Èa®e²hµz£Çx¡Åc°f³sÀX¥uÂq¾y¢Æ_¬j·W¤a®mºc°k¸f³tÁ^«[¨r¿sÀhµw ÄW¤y¢ÆY¦r¿j·e²r¿g´hµx¡Åj·b¯g´b¯z£ÇuÂ]ªa®Y¦^«]ªb¯l¹{¤ÈX¥\ ©vÃp½p½_¬`X¥k¸tÁz£Ço¼vÃmºg´_¬z£Çhµq¾g´n»k¸Y¦^«o¼^«Y¦sÀl¹sÀk¸\ ©i¶_¬z£Çj·vÃw Ämºw ÄvÃw Ä\ ©[¨W¤e²sÀX¥uÂZ§d±q¾w ÄW¤z£ÇW¤k¸f³`z£ÇW¤j·g´d±hµtÁuÂg´Z§uÂk¸i¶d±hµr¿{¤Èx¡Åhµa®_¬k¸y¢Æ]ªn»tÁc°a®e²n»Y¦q¾{¤È`i¶[¨q¾a®r¿d±Z§o¼q¾n»tÁZ§n»f³f³tÁw ÄY¦uÂz£Ça®x¡Åf³hµhµg´]ªk¸hµtÁhµ_¬W¤b¯hµhµY¦c°d±i¶^«]ªn»o¼p½z£Ç`Y¦z£ÇsÀl¹vÃb¯n»X¥l¹sÀW¤k¸sÀZ§z£Çb¯n»W¤e²r¿tÁ]ªZ§z£Çq¾hµg´uÂi¶b¯^«[¨q¾{¤ÈtÁr¿Y¦uÂc°e²c°e²W¤`Y¦sÀw ÄW¤y¢Æi¶[¨^«vÃ\ ©W¤Y¦i¶Z§]ªuÂq¾a®p½b¯X¥mºuÂZ§{¤ÈtÁn»d±c°j·[¨vÃx¡Åa®r¿r¿W¤o¼w Äk¸uÂe²r¿[¨tÁ]ªZ§r¿z£Çi¶z£Ço¼`[¨d±b¯p½l¹j·]ª]ªx¡Åx¡Åp½vÃo¼`n»uÂb¯k¸sÀsÀsÀb¯f³j·f³a®g´i¶r¿b¯tÁj·b¯z£ÇW¤vÃg´c°sÀ^«c°Y¦mºe²]ªe²z£ÇmºY¦uÂW¤Y¦Y¦b¯b¯n»Z§c°sÀx¡ÅtÁz£Çj·\ ©_¬Y¦n»n»mºvÃy¢Æhµhµ{¤Èk¸z£Çi¶uÂk¸[¨Y¦x¡Åb¯hµX¥q¾mºd±\ ©[¨\ ©x¡ÅtÁZ§vÃk¸sÀf³mº[¨r¿^«e²Z§f³x¡Åb¯[¨z£Çhµo¼i¶w Äi¶vÃn»c°p½X¥W¤c°k¸Y¦e²y¢Æd±c°Y¦q¾]ªg´]ªZ§i¶b¯q¾Y¦c°k¸Z§^«l¹sÀd±x¡Å^«y¢Æ{¤ÈZ§c°p½^«[¨l¹uÂsÀp½z£Çg´_¬p½y¢Æw Ä_¬e²q¾tÁ{¤È^«e²{¤ÈX¥y¢Æd±q¾`\ ©Y¦b¯g´W¤p½g´X¥b¯uÂd±]ªY¦^«mºuÂa®uÂf³o¼W¤Z§j·i¶[¨Z§y¢Æhµ^«l¹{¤È`e²j·_¬^«x¡Å[¨uÂn»w Ä]ªr¿Z§`z£ÇvÃj·`z£Çd±tÁ]ªd±x¡ÅZ§g´j·q¾`_¬i¶r¿x¡Åk¸r¿j·e²`{¤Èa®p½w ÄW¤Y¦k¸l¹\ ©l¹`^«y¢Æ\ ©W¤k¸hµf³tÁq¾tÁ^«X¥uÂvÃc°x¡Åw ÄhµW¤x¡Åo¼p½{¤È\ ©tÁvÃl¹\ ©z£Çx¡Åz£Çmº{¤È`i¶r¿vÃmºuÂa®mºc°k¸f³tÁ^«[¨tÁn»z£ÇY¦q¾g´{¤Èa®[¨uÂX¥Z§g´]ªuÂc°Y¦g´f³k¸i¶f³b¯b¯{¤È{¤Èi¶i¶p½n»`X¥i¶b¯\ ©n»{¤Èb¯w Äa®c°n»mº[¨j·uÂmºW¤x¡Åx¡Åy¢Æd±o¼tÁb¯j·hµy¢ÆuÂ]ªn»x¡ÅtÁy¢Æhµw Äz£ÇuÂi¶sÀ`e²d±a®\ ©a®^«^«q¾[¨y¢ÆY¦vÃmºq¾^«\ ©w Äp½z£Çk¸tÁsÀk¸{¤Èc°k¸p½j·l¹X¥e²w Äg´]ªx¡Åk¸r¿j·e²`{¤Èa®p½w ÄW¤Y¦k¸l¹\ ©l¹`^«y¢Æ\ ©W¤k¸hµb¯d±]ªZ§z£Çd±c°hµw Äp½]ªo¼vÃe²Z§X¥g´z£Ç_¬w Äc°{¤Èhµj·d±Z§y¢Æe²Z§c°`e²^«y¢Æ{¤ÈZ§c°p½^«[¨l¹uÂsÀp½z£Çg´_¬p½y¢Æw Ä_¬e²q¾tÁ{¤È^«e²{¤ÈX¥y¢Æd±q¾uÂg´Y¦g´q¾f³y¢Æz£ÇuÂZ§p½W¤z£Çq¾k¸e²i¶vÃn»k¸r¿W¤Y¦uÂ_¬Z§sÀW¤p½n»{¤Èb¯w Äd±{¤Èx¡Åy¢Æ_¬w Äx¡Åb¯\ ©W¤x¡ÅY¦i¶k¸d±_¬f³f³`sÀo¼tÁi¶^«]ªa®{¤ÈmºY¦q¾mºl¹hµx¡Åk¸r¿j·e²`{¤Èa®p½w ÄW¤Y¦k¸l¹\ ©l¹`^«y¢Æ\ ©W¤k¸hµf³tÁq¾tÁ^«X¥uÂvÃc°z£Çi¶uÂk¸a®vÃz£Çr¿l¹a®q¾uÂp½i¶q¾q¾tÁz£Çf³r¿i¶X¥c°sÀW¤mºz£Ç`y¢Æa®x¡ÅvÃz£Çq¾hµg´uÂi¶b¯^«[¨q¾{¤ÈtÁr¿Y¦uÂc°e²c°e²W¤`Y¦sÀw ÄW¤y¢Æmºg´tÁy¢Æz£Çmº{¤ÈtÁuÂk¸b¯`Y¦Y¦q¾W¤d±e²Z§\ ©X¥_¬f³l¹tÁ]ª_¬a®z£Çp½x¡Å`tÁn»k¸r¿mºw Ämºo¼{¤Èc°y¢ÆvÃz£Ç{¤Èc°e²f³vÃhµ_¬k¸p½a®[¨sÀf³uÂ_¬`n»sÀ`sÀuÂr¿W¤d±e²vÃl¹\ ©z£Çx¡Åz£Çmº{¤È`i¶r¿vÃmºuÂa®mºc°k¸f³tÁ^«[¨r¿sÀhµw ÄW¤y¢ÆY¦r¿j·e²q¾{¤ÈtÁr¿Y¦uÂc°e²c°e²W¤`Y¦sÀw ÄW¤y¢Æmºg´tÁy¢Æz£ÇmºZ§Z§Z§[¨x¡Åy¢Æj·Z§_¬Z§j·i¶[¨Z§y¢Æhµ^«l¹{¤Èj·\ ©Z§tÁZ§f³{¤Èn»\ ©o¼q¾x¡Åj·hµi¶o¼x¡Åi¶f³b¯x¡ÅsÀo¼c°e²sÀW¤^«sÀ\ ©_¬[¨j·q¾p½w Ä^«^«p½o¼z£Çf³]ªj·Z§X¥z£ÇvÃi¶]ªf³uÂd±c°vÃi¶k¸n»f³[¨j·{¤Èf³d±W¤b¯W¤Z§\ ©z£Çe²sÀ`c°vÃj·`_¬z£Çj·]ªe²x¡ÅvÃz£Çe²n»e²n»\ ©^«[¨q¾f³j·b¯\ ©p½mºj·k¸r¿l¹a®\ ©g´hµf³x¡Åp½_¬r¿e²c°k¸sÀc°n»tÁ^«[¨r¿sÀhµw ÄW¤y¢ÆY¦r¿j·e²r¿g´hµx¡Åj·b¯g´b¯z£ÇuÂ]ªa®Y¦^«p½a®i¶`q¾o¼e²q¾\ ©g´b¯Z§g´o¼b¯d±]ªZ§z£Çd±c°hµw Äp½]ªo¼vÃe²Z§X¥g´z£Ç_¬w Äc°{¤Èhµz£Çk¸j·o¼sÀ_¬y¢Æg´w Äz£ÇhµtÁmºp½l¹q¾i¶p½mºa®tÁ{¤ÈW¤uÂb¯k¸sÀsÀsÀb¯f³j·k¸p½]ªtÁ{¤ÈtÁ_¬z£ÇY¦`l¹[¨q¾Z§w Ä]ªd±[¨j·Z§vÃtÁc°l¹sÀg´\ ©r¿f³o¼i¶_¬uÂvÃb¯\ ©g´e²tÁY¦g´a®z£ÇmºtÁd±f³y¢Æo¼``l¹z£Ç{¤Èy¢Æ\ ©r¿Y¦{¤Èa®q¾z£ÇX¥]ªf³\ ©p½p½p½w ÄZ§w Ähµc°r¿mºvÃb¯a®z£Çr¿_¬k¸j·j·mºn»e²c°i¶Z§y¢Æx¡ÅtÁw Äl¹g´o¼l¹a®tÁ\ ©\ ©hµp½]ªz£ÇuÂvÃb¯\ ©g´e²tÁY¦g´a®z£ÇmºtÁd±f³y¢Æo¼``l¹z£Çk¸w Äp½k¸p½uÂy¢Æc°z£Çf³n»q¾p½mºq¾{¤È`_¬p½^«\ ©hµe²e²Z§p½d±f³]ªw ÄsÀo¼c°p½^«[¨l¹uÂsÀp½z£Çg´_¬p½y¢Æw Ä_¬e²q¾tÁ{¤È^«e²{¤ÈX¥y¢Æd±q¾uÂg´l¹f³tÁmºvÃy¢Æhµhµ{¤Èk¸z£Çi¶uÂk¸a®vÃz£Çr¿l¹a®q¾uÂp½i¶q¾q¾tÁz£Çf³r¿i¶X¥c°sÀW¤mºZ§p½X¥i¶_¬n»vÃa®k¸c°Y¦q¾y¢Æd±\ ©_¬[¨z£Çj·tÁo¼w Ämºo¼{¤Èc°y¢ÆvÃz£Ç{¤Èc°e²W¤y¢Æmºg´tÁy¢Æz£ÇmºZ§Z§Z§[¨x¡Åy¢Æj·Z§_¬tÁw Äp½p½e²b¯r¿l¹`b¯^«_¬i¶sÀhµmºg´_¬e²{¤ÈX¥uÂvÃj·a®X¥]ªuÂmºg´r¿e²e²_¬\ ©z£Çn»Y¦f³tÁl¹n»q¾]ªq¾X¥j·hµmºc°c°x¡Å`g´c°Z§w Äg´sÀb¯hµz£ÇW¤tÁb¯d±r¿a®i¶o¼_¬[¨tÁz£Çc°i¶Y¦d±i¶mºz£Çl¹`y¢ÆY¦vÃe²Z§x¡Ål¹k¸f³e²tÁ{¤Èf³_¬e²n»vÃw Äa®]ª^«x¡Åg´hµg´]ªy¢Æe² |
/programs/games/tetris/trunk/tetris.asm |
---|
220,7 → 220,7 |
jmp still |
end_program: |
mov eax,-1 ; close this program |
or eax,-1 ; close this program |
int 0x40 |
go_new_game: |
/programs/media/xpaint/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/media/xpaint/trunk/ascml.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/xpaint/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/media/xpaint/trunk/ascl.inc |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/xpaint/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/xpaint/trunk/ascgml.inc |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/xpaint/trunk/ascgl.inc |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/xpaint/trunk/xpaint.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/ac97wav/trunk/ac97wav.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/ac97wav/trunk/constant.inc |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/ac97wav/trunk/pci.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/ac97wav/trunk/codec.inc |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/ac97wav/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/media/ac97wav/trunk/meosfunc.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/ac97wav/trunk/frontend.inc |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/ac97wav/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/media/ac97wav/trunk/ac97.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/ac97wav/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/ac97wav/trunk/debug.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/ac97wav/trunk/includes.inc |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/cdplay/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/media/cdplay/trunk/cdplay.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/cdplay/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/cdplay/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/media/ac97 mp3/trunk/mp3dec/l3side.c |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/l3quant.c |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/l3huff.c |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/math_private.h |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/l3alias.c |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/sbt.c |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/l1dec.c |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/l2dec.c |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/l3dec.c |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/sbtb.c |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/mp3dec.vcproj |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/l3huff.h |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/bstream.c |
---|
File deleted |
\ No newline at end of file |
/programs/media/ac97 mp3/trunk/mp3dec/PROC32.INC |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/imdct.c |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/l1init.c |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/l2init.c |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/l3init.c |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/bstream.h |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/pow.asm |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/layer3.h |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/window.c |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/l3sf.c |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/e_pow.c |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/windowb.c |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/l3msis.c |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/mp3dec.c |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/fdct.c |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/l3hybrid.c |
---|
File deleted |
/programs/media/ac97 mp3/trunk/mp3dec/mp3dec.h |
---|
File deleted |
/programs/media/ac97 mp3/trunk/ac97.sln |
---|
File deleted |
/programs/media/ac97 mp3/trunk/crt.h |
---|
File deleted |
/programs/media/ac97 mp3/trunk/k_lib.asm |
---|
File deleted |
/programs/media/ac97 mp3/trunk/PROC32.INC |
---|
File deleted |
/programs/media/ac97 mp3/trunk/kolibri.h |
---|
File deleted |
/programs/media/ac97 mp3/trunk/ac97wav.c |
---|
File deleted |
/programs/media/ac97 mp3/trunk/ac97wav.h |
---|
File deleted |
/programs/media/ac97 mp3/trunk/crt.c |
---|
File deleted |
/programs/media/scrshot/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/media/scrshot/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/media/scrshot/trunk/ascl.inc |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/scrshot/trunk/readme.txt |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/scrshot/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/scrshot/trunk/scrshot.asm |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/bmpview/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/media/bmpview/trunk/bmpview.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/bmpview/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/media/bmpview/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/vscreen/trunk/vscreen.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/vscreen/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/media/vscreen/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/media/vscreen/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/media/ac97snd/trunk/PROC32.INC |
---|
0,0 → 1,268 |
; Macroinstructions for defining and calling procedures |
macro stdcall proc,[arg] ; directly call STDCALL procedure |
{ common |
if ~ arg eq |
reverse |
pushd arg |
common |
end if |
call proc } |
macro invoke proc,[arg] ; indirectly call STDCALL procedure |
{ common |
if ~ arg eq |
reverse |
pushd arg |
common |
end if |
call [proc] } |
macro ccall proc,[arg] ; directly call CDECL procedure |
{ common |
size@ccall = 0 |
if ~ arg eq |
reverse |
pushd arg |
size@ccall = size@ccall+4 |
common |
end if |
call proc |
if size@ccall |
add esp,size@ccall |
end if } |
macro cinvoke proc,[arg] ; indirectly call CDECL procedure |
{ common |
size@ccall = 0 |
if ~ arg eq |
reverse |
pushd arg |
size@ccall = size@ccall+4 |
common |
end if |
call [proc] |
if size@ccall |
add esp,size@ccall |
end if } |
macro proc [args] ; define procedure |
{ common |
match name params, args> |
\{ define@proc name,<params \} } |
prologue@proc equ prologuedef |
macro prologuedef procname,flag,parmbytes,localbytes,reglist |
{ if parmbytes | localbytes |
push ebp |
mov ebp,esp |
if localbytes |
sub esp,localbytes |
end if |
end if |
irps reg, reglist \{ push reg \} } |
epilogue@proc equ epiloguedef |
macro epiloguedef procname,flag,parmbytes,localbytes,reglist |
{ irps reg, reglist \{ reverse pop reg \} |
if parmbytes | localbytes |
leave |
end if |
if flag and 10000b |
retn |
else |
retn parmbytes |
end if } |
macro define@proc name,statement |
{ local params,flag,regs,parmbytes,localbytes,current |
if used name |
name: |
match =stdcall args, statement \{ params equ args |
flag = 11b \} |
match =stdcall, statement \{ params equ |
flag = 11b \} |
match =c args, statement \{ params equ args |
flag = 10001b \} |
match =c, statement \{ params equ |
flag = 10001b \} |
match =params, params \{ params equ statement |
flag = 0 \} |
virtual at ebp+8 |
match =uses reglist=,args, params \{ regs equ reglist |
params equ args \} |
match =regs =uses reglist, regs params \{ regs equ reglist |
params equ \} |
match =regs, regs \{ regs equ \} |
match =,args, params \{ defargs@proc args \} |
match =args@proc args, args@proc params \{ defargs@proc args \} |
parmbytes = $ - (ebp+8) |
end virtual |
name # % = parmbytes/4 |
all@vars equ |
current = 0 |
match prologue:reglist, prologue@proc:<regs> \{ prologue name,flag,parmbytes,localbytes,reglist \} |
macro locals |
\{ virtual at ebp-localbytes+current |
macro label . \\{ deflocal@proc .,:, \\} |
struc db [val] \\{ \common deflocal@proc .,db,val \\} |
struc dw [val] \\{ \common deflocal@proc .,dw,val \\} |
struc dp [val] \\{ \common deflocal@proc .,dp,val \\} |
struc dd [val] \\{ \common deflocal@proc .,dd,val \\} |
struc dt [val] \\{ \common deflocal@proc .,dt,val \\} |
struc dq [val] \\{ \common deflocal@proc .,dq,val \\} |
struc rb cnt \\{ deflocal@proc .,rb cnt, \\} |
struc rw cnt \\{ deflocal@proc .,rw cnt, \\} |
struc rp cnt \\{ deflocal@proc .,rp cnt, \\} |
struc rd cnt \\{ deflocal@proc .,rd cnt, \\} |
struc rt cnt \\{ deflocal@proc .,rt cnt, \\} |
struc rq cnt \\{ deflocal@proc .,rq cnt, \\} \} |
macro endl |
\{ purge label |
restruc db,dw,dp,dd,dt,dq |
restruc rb,rw,rp,rd,rt,rq |
restruc byte,word,dword,pword,tword,qword |
current = $-(ebp-localbytes) |
end virtual \} |
macro ret operand |
\{ match any, operand \\{ retn operand \\} |
match , operand \\{ match epilogue:reglist, epilogue@proc:<regs> |
\\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \} |
macro finish@proc \{ localbytes = (((current-1) shr 2)+1) shl 2 |
end if \} } |
macro defargs@proc [arg] |
{ common |
if ~ arg eq |
forward |
local ..arg,current@arg |
match argname:type, arg |
\{ current@arg equ argname |
label ..arg type |
argname equ ..arg |
if dqword eq type |
dd ?,?,?,? |
else if tbyte eq type |
dd ?,?,? |
else if qword eq type | pword eq type |
dd ?,? |
else |
dd ? |
end if \} |
match =current@arg,current@arg |
\{ current@arg equ arg |
arg equ ..arg |
..arg dd ? \} |
common |
args@proc equ current@arg |
forward |
restore current@arg |
common |
end if } |
macro deflocal@proc name,def,[val] |
{ common |
match vars, all@vars \{ all@vars equ all@vars, \} |
all@vars equ all@vars name |
forward |
local ..var,..tmp |
..var def val |
match =?, val \{ ..tmp equ \} |
match any =dup (=?), val \{ ..tmp equ \} |
match tmp : value, ..tmp : val |
\{ tmp: end virtual |
initlocal@proc ..var,def value |
virtual at tmp\} |
common |
match first rest, ..var, \{ name equ first \} } |
macro initlocal@proc name,def |
{ virtual at name |
def |
size@initlocal = $ - name |
end virtual |
position@initlocal = 0 |
while size@initlocal > position@initlocal |
virtual at name |
def |
if size@initlocal - position@initlocal < 2 |
current@initlocal = 1 |
load byte@initlocal byte from name+position@initlocal |
else if size@initlocal - position@initlocal < 4 |
current@initlocal = 2 |
load word@initlocal word from name+position@initlocal |
else |
current@initlocal = 4 |
load dword@initlocal dword from name+position@initlocal |
end if |
end virtual |
if current@initlocal = 1 |
mov byte [name+position@initlocal],byte@initlocal |
else if current@initlocal = 2 |
mov word [name+position@initlocal],word@initlocal |
else |
mov dword [name+position@initlocal],dword@initlocal |
end if |
position@initlocal = position@initlocal + current@initlocal |
end while } |
macro endp |
{ purge ret,locals,endl |
finish@proc |
purge finish@proc |
restore regs@proc |
match all,args@proc \{ restore all \} |
restore args@proc |
match all,all@vars \{ restore all \} } |
macro local [var] |
{ common |
locals |
forward done@local equ |
match varname[count]:vartype, var |
\{ match =BYTE, vartype \\{ varname rb count |
restore done@local \\} |
match =WORD, vartype \\{ varname rw count |
restore done@local \\} |
match =DWORD, vartype \\{ varname rd count |
restore done@local \\} |
match =PWORD, vartype \\{ varname rp count |
restore done@local \\} |
match =QWORD, vartype \\{ varname rq count |
restore done@local \\} |
match =TBYTE, vartype \\{ varname rt count |
restore done@local \\} |
match =DQWORD, vartype \\{ label varname dqword |
rq count+count |
restore done@local \\} |
match , done@local \\{ virtual |
varname vartype |
end virtual |
rb count*sizeof.\#vartype |
restore done@local \\} \} |
match :varname:vartype, done@local:var |
\{ match =BYTE, vartype \\{ varname db ? |
restore done@local \\} |
match =WORD, vartype \\{ varname dw ? |
restore done@local \\} |
match =DWORD, vartype \\{ varname dd ? |
restore done@local \\} |
match =PWORD, vartype \\{ varname dp ? |
restore done@local \\} |
match =QWORD, vartype \\{ varname dq ? |
restore done@local \\} |
match =TBYTE, vartype \\{ varname dt ? |
restore done@local \\} |
match =DQWORD, vartype \\{ label varname dqword |
dq ?,? |
restore done@local \\} |
match , done@local \\{ varname vartype |
restore done@local \\} \} |
match ,done@local |
\{ var |
restore done@local \} |
common |
endl } |
/programs/media/ac97snd/trunk/ac97.sln |
---|
0,0 → 1,38 |
|
Microsoft Visual Studio Solution File, Format Version 9.00 |
# Visual Studio 2005 |
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pe2kos", "pe2kos\pe2kos.vcproj", "{50E3FB09-4E3A-4998-A824-6830405193AE}" |
EndProject |
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mp3dec", "mp3dec\mp3dec.vcproj", "{97BF69A3-826A-47D6-94E4-05FDD8CFF1FC}" |
EndProject |
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pow_test", "pow_test\pow_test.vcproj", "{9FE40739-2ADC-4241-8182-20E1B3C661A7}" |
EndProject |
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ac97", "ac97\ac97.vcproj", "{1C94A897-DA4F-45B2-B8A6-B97AD837828E}" |
EndProject |
Global |
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
Debug|Win32 = Debug|Win32 |
Release|Win32 = Release|Win32 |
EndGlobalSection |
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
{50E3FB09-4E3A-4998-A824-6830405193AE}.Debug|Win32.ActiveCfg = Debug|Win32 |
{50E3FB09-4E3A-4998-A824-6830405193AE}.Debug|Win32.Build.0 = Debug|Win32 |
{50E3FB09-4E3A-4998-A824-6830405193AE}.Release|Win32.ActiveCfg = Release|Win32 |
{50E3FB09-4E3A-4998-A824-6830405193AE}.Release|Win32.Build.0 = Release|Win32 |
{97BF69A3-826A-47D6-94E4-05FDD8CFF1FC}.Debug|Win32.ActiveCfg = Debug|Win32 |
{97BF69A3-826A-47D6-94E4-05FDD8CFF1FC}.Debug|Win32.Build.0 = Debug|Win32 |
{97BF69A3-826A-47D6-94E4-05FDD8CFF1FC}.Release|Win32.ActiveCfg = Release|Win32 |
{97BF69A3-826A-47D6-94E4-05FDD8CFF1FC}.Release|Win32.Build.0 = Release|Win32 |
{9FE40739-2ADC-4241-8182-20E1B3C661A7}.Debug|Win32.ActiveCfg = Debug|Win32 |
{9FE40739-2ADC-4241-8182-20E1B3C661A7}.Debug|Win32.Build.0 = Debug|Win32 |
{9FE40739-2ADC-4241-8182-20E1B3C661A7}.Release|Win32.ActiveCfg = Release|Win32 |
{9FE40739-2ADC-4241-8182-20E1B3C661A7}.Release|Win32.Build.0 = Release|Win32 |
{1C94A897-DA4F-45B2-B8A6-B97AD837828E}.Debug|Win32.ActiveCfg = Debug|Win32 |
{1C94A897-DA4F-45B2-B8A6-B97AD837828E}.Debug|Win32.Build.0 = Debug|Win32 |
{1C94A897-DA4F-45B2-B8A6-B97AD837828E}.Release|Win32.ActiveCfg = Release|Win32 |
{1C94A897-DA4F-45B2-B8A6-B97AD837828E}.Release|Win32.Build.0 = Release|Win32 |
EndGlobalSection |
GlobalSection(SolutionProperties) = preSolution |
HideSolutionNode = FALSE |
EndGlobalSection |
EndGlobal |
/programs/media/ac97snd/trunk/ac97wav.c |
---|
0,0 → 1,718 |
// |
// This file is part of the AC97 mp3 player. |
// (C) copyright Serge 2006 |
// email: infinity_sound@mail.ru |
// |
// This program is free software; you can redistribute it and/or modify |
// it under the terms of the GNU General Public License as published by |
// the Free Software Foundation; either version 2 of the License, or |
// (at your option) any later version. |
// |
// This program is distributed in the hope that it will be useful, |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// GNU General Public License for more details. |
#include "kolibri.h" |
#include "stdio.h" |
#include "string.h" |
#include "ac97wav.h" |
#include "mp3dec/mp3dec.h" |
void thread_proc(); |
void touch(char *buf, int size); |
extern char *__argv; |
//extern char __path; |
/***** for debug output only |
char formats[37][12] = |
{ "PCM_ALL", |
"PCM_2_16_48","PCM_1_16_48","PCM_2_16_44","PCM_1_16_44", |
"PCM_2_16_32","PCM_1_16_32","PCM_2_16_24","PCM_1_16_24", |
"PCM_2_16_22","PCM_1_16_22","PCM_2_16_16","PCM_1_16_16", |
"PCM_2_16_12","PCM_1_16_12","PCM_2_16_11","PCM_1_16_11", |
"PCM_2_16_8","PCM_1_16_8","PCM_2_8_48","PCM_1_8_48", |
"PCM_2_8_44","PCM_1_8_44","PCM_2_8_32","PCM_1_8_32", |
"PCM_2_8_24","PCM_1_8_24","PCM_2_8_22","PCM_1_8_22", |
"PCM_2_8_16","PCM_1_8_16","PCM_2_8_12","PCM_1_8_12", |
"PCM_2_8_11","PCM_1_8_11","PCM_2_8_8","PCM_1_8_8" |
}; |
*******/ |
DWORD hDrv; |
DWORD hSound; |
DWORD hBuff; |
DWORD event[2]; |
CTRL_INFO info; |
FILEINFO fileinfo; |
int m_vol; |
DWORD status; |
DWORD offset; |
DWORD first_sync; |
char *testbuff; |
char *outbuf; |
char *inpbuf; |
int inpsize; |
int outsize; |
char srv_name[] = "INFINITY"; |
char srv_intel[] = "SOUND"; |
char header[] = "AC97 MP3 player"; |
char buttons_text[]=" Play Stop << >> Vol- Vol+"; |
MPEG_DECODE_INFO mpginfo; |
MPEG_DECODE_PARAM param; |
void (*snd_play)(); |
void draw_window() |
{ |
BeginDraw(); |
DrawWindow(100,100,299,72,0x404040,3,0,0,0); |
make_button(7,24,45,13, 0x10|BT_NORMAL,0x808080); |
make_button(56,24,45,13, 0x11|BT_NORMAL,0x808080); |
make_button(104,24,45,13, 0x12|BT_NORMAL,0x808080); |
make_button(152,24,45,13, 0x13|BT_NORMAL,0x808080); |
make_button(200,24,45,13, 0x14|BT_NORMAL,0x808080); |
make_button(248,24,45,13, 0x15|BT_NORMAL,0x808080); |
make_button(7,41,286,11, 0x30|BT_HIDE|BT_NOFRAME,0x404040); |
draw_bar(7,41,286,11,0x404040); |
draw_bar(7,55,286,11,0x404040); |
write_text(12,58,0x004000|FONT0, __argv, strlen(__argv)); |
write_text(11,57,0x00FF20|FONT0, __argv, strlen(__argv)); |
write_text(8,8,0xFFFFFF|FONT0, header, strlen(header)); |
write_text(12,28,0x404040|FONT0,buttons_text,strlen(buttons_text)); |
write_text(11,27,0xA0FFA0|FONT0,buttons_text,strlen(buttons_text)); |
EndDraw(); |
}; |
void draw_progress_bar() |
{ DWORD x; |
x = 286.0f * (float)offset/(float)fileinfo.size; |
if(x==0) return; |
draw_bar(7,41,x,11,0xA0A0A0); |
draw_bar(x+7,41,286-x,11,0x404040); |
}; |
void debug_out_str(char* str) |
{ |
while (*str != 0) |
{ |
debug_out(*str); |
str++; |
} |
} |
int main() //int argc, char *argv[]) |
{ DWORD fmt; |
char *thread_stack; |
DWORD r_bytes; |
int retval; |
InitHeap(1024*1024); |
if(get_fileinfo(__argv, &fileinfo)==FILE_NOT_FOUND) |
return 0; |
if((hDrv=GetService(srv_intel))==0) |
return 0; |
if ((hSound=GetService(srv_name))==0) |
return 0; |
GetDevInfo(hDrv, &info); |
m_vol = GetMasterVol(hDrv,&m_vol); |
if (m_vol > 85) |
{ m_vol = 85; |
SetMasterVol(hDrv,m_vol); |
}; |
_asm {fninit}; |
mp3DecodeInit(); |
testbuff = UserAlloc(4096); |
get_fileinfo(__argv, &fileinfo); |
offset = 0; |
retval=read_file (__argv,testbuff,0,2048,&r_bytes); |
if (retval) return 0; |
fmt = test_wav((WAVEHEADER*)testbuff); |
if (fmt != 0) |
{ |
snd_play = &play_wave; |
outbuf = UserAlloc(32*1024); |
touch(outbuf, 32768); |
offset = 44; |
} |
else |
{ fmt = test_mp3(testbuff); |
if(fmt ==0) return 0; |
snd_play = &play_mp3; |
inpsize = mpginfo.maxInputSize*30; |
inpbuf = UserAlloc(inpsize); |
touch(inpbuf, inpsize); |
outsize = mpginfo.outputSize*30+0x10000; |
outbuf = UserAlloc(outsize); |
touch(outbuf, outsize); |
first_sync = offset; |
}; |
status = ST_PLAY; |
hBuff = CreateBuffer(hSound,fmt); |
if (hBuff == 0) return 0; |
thread_stack = UserAlloc(4096); |
thread_stack+=4092; |
CreateThread(thread_proc, thread_stack); |
while(1) |
{ delay(10); |
switch(status) |
{ case ST_PLAY: |
snd_play(); |
continue; |
case ST_STOP: |
StopBuffer(hSound, hBuff); |
status = ST_DONE; |
continue; |
case ST_EXIT: |
StopBuffer(hSound, hBuff); |
DestroyBuffer(hSound, hBuff); |
return 0; |
}; |
}; |
return 0; |
}; |
void touch(char *buf, int size) |
{ int i; |
for ( i = 0;i < size; i+=4096) |
buf[i] = 0; |
}; |
DWORD test_mp3(char *buf) |
{ int retval; |
int sync; |
WAVEHEADER whdr; |
DWORD r_bytes=2048; |
for (;;) |
{ |
if (!mp3FindSync(buf, 2048, &sync)) |
offset+= 2048; |
else break; |
if (offset >= fileinfo.size || offset >= 102400) |
return 0; |
retval = read_file (__argv,buf,offset,2048,&r_bytes); |
if(retval != 0) return 0; |
}; |
offset+=sync; |
retval = read_file (__argv,buf,offset,2048,&r_bytes); |
if(retval != 0) return 0; |
mp3GetDecodeInfo(buf, r_bytes, &mpginfo, 1); |
whdr.riff_id = 0x46464952; |
whdr.riff_format = 0x45564157; |
whdr.wFormatTag = 0x01; |
whdr.nSamplesPerSec = mpginfo.frequency; |
whdr.nChannels = mpginfo.channels; |
whdr.wBitsPerSample = mpginfo.bitsPerSample; |
return test_wav(&whdr); |
}; |
void wave_out(char* buff) |
{ DWORD ev[2]; |
GetNotify(&ev[0]); |
SetBuffer(hSound,hBuff,buff,ev[1],0x8000); |
} |
void play_mp3() |
{ int retval; |
DWORD r_bytes; |
char *inpPtr; |
char *outPtr; |
int inpBytes; |
int totalout; |
offset = first_sync; |
retval = read_file (__argv,inpbuf,offset,inpsize,&r_bytes); |
if(retval != 0) |
{ status = ST_STOP; |
return ; |
}; |
offset+=inpsize; |
mp3DecodeStart(inpbuf, inpsize); |
inpPtr = inpbuf+mpginfo.skipSize; |
inpBytes = inpsize-mpginfo.skipSize; |
outPtr = outbuf; |
totalout=0; |
memset(outbuf,0,0x10000); |
SetBuffer(hSound,hBuff,outbuf,0,0x10000); |
PlayBuffer(hSound, hBuff); |
_asm { fninit } |
while(1) |
{ if(status!=ST_PLAY) |
break; |
for(;;) |
{ param.inputBuf = inpPtr; |
param.inputSize = inpBytes; |
param.outputBuf = outPtr; |
if(!mp3DecodeFrame(¶m)) |
if( mp3GetLastError()== MP3_ERROR_OUT_OF_BUFFER) |
break; |
inpPtr += param.inputSize; |
inpBytes -= param.inputSize; |
outPtr+=param.outputSize; |
totalout+=param.outputSize; |
}; |
memmove(inpbuf, inpPtr, inpBytes); |
retval = read_file(__argv, &inpbuf[inpBytes],offset, inpsize-inpBytes, &r_bytes); |
offset+=r_bytes; |
if (r_bytes== 0) break; |
inpPtr = inpbuf; |
inpBytes += r_bytes; |
if(totalout < 32768) continue; |
outPtr = outbuf; |
while (totalout > 32768) |
{ wave_out(outPtr); |
totalout-=0x8000; |
outPtr+=0x8000; |
}; |
memmove(outbuf,outPtr, totalout); |
outPtr = outbuf+totalout; |
}; |
if(status != ST_EXIT) |
status = ST_STOP; |
}; |
void play_wave() |
{ |
int retval; |
int remain; |
int i; |
offset = 44; |
read_file (__argv,outbuf,offset,32*1024,0); |
offset+=32*1024; |
SetBuffer(hSound,hBuff,outbuf,0,0x8000); |
read_file (__argv,outbuf,offset,32*1024,0); |
offset+=32*1024; |
SetBuffer(hSound,hBuff,outbuf,0x8000,0x8000); |
PlayBuffer(hSound, hBuff); |
retval = 0; |
while(1) |
{ |
if(status!=ST_PLAY) |
break; |
GetNotify(&event[0]); |
if(retval == FILE_EOF) |
break; |
remain = fileinfo.size-offset; |
if(remain >=32768) |
{ retval = read_file (__argv,outbuf,offset,32*1024,0); |
offset+=32*1024; |
SetBuffer(hSound,hBuff,outbuf,event[1],0x8000); |
continue; |
}; |
if(remain == 0) |
{ retval = FILE_EOF; |
continue; |
}; |
read_file (__argv,outbuf,offset,remain,0); |
for(i=remain;i<32768;i++) |
outbuf[i] = 0; |
SetBuffer(hSound,hBuff,outbuf,event[1],0x8000); |
retval= FILE_EOF; |
}; |
if(status != ST_EXIT) |
status = ST_STOP; |
}; |
void snd_stop() |
{ |
StopBuffer(hSound, hBuff); |
}; |
void thread_proc() |
{ int evnt; |
int pos; |
int key; |
_asm { fninit }; |
draw_window(); |
while(1) |
{ if(status==ST_PLAY) |
{ draw_progress_bar(); |
evnt = wait_for_event(80); |
// debug_out_str("BIG ERROR...\x0D\x0A\x00"); |
} |
else |
evnt = wait_for_event_infinite(); |
switch(evnt) |
{ |
case EV_REDRAW: |
draw_window(); |
break; |
case EV_KEY: |
key = get_key(); |
if(key==27) |
{ status = ST_EXIT; |
exit(); |
}; |
if((key==45)||key==54) |
{ if(m_vol > 0) |
{ m_vol--; |
SetMasterVol(hDrv,m_vol); |
}; |
break; |
}; |
if((key==61)||key==56) |
{ if(m_vol < 90) |
{ m_vol++; |
SetMasterVol(hDrv,m_vol); |
}; |
}; |
break; |
case EV_BUTTON: |
switch(get_button_id()) |
{ case 1: |
status = ST_EXIT; |
exit(); |
break; |
case 0x10: |
status = ST_PLAY; |
continue; |
case 0x11: |
status = ST_STOP; |
break; |
// case 0x12: |
// case 0x13: |
case 0x14: |
if(m_vol > 0) |
{ m_vol--; |
SetMasterVol(hDrv,m_vol); |
}; |
break; |
case 0x15: |
if(m_vol < 90) |
{ m_vol++; |
SetMasterVol(hDrv,m_vol); |
}; |
break; |
case 0x30: |
if(status==ST_DONE) |
break; |
if(snd_play == play_mp3) |
continue; |
pos = (GetMousePos(REL_WINDOW)>>16)-7; |
offset = ((fileinfo.size-44)/286*pos+44)&0xFFFFFFFC; |
draw_progress_bar(); |
break; |
}; |
}; |
}; |
}; |
DWORD test_wav(WAVEHEADER *hdr) |
{ |
if(hdr->riff_id != 0x46464952) |
return 0; |
if(hdr->riff_format != 0x45564157) |
return 0; |
if (hdr->wFormatTag != 0x01) |
return 0; |
switch(hdr->nSamplesPerSec) |
{ case 48000: |
switch (hdr->nChannels) |
{ case 1: |
if(hdr->wBitsPerSample == 16) |
return PCM_1_16_48; |
else |
return PCM_1_8_48; |
case 2: |
if(hdr->wBitsPerSample == 16) |
return PCM_2_16_48; |
else |
return PCM_2_8_48; |
}; |
case 44100: |
switch (hdr->nChannels) |
{ case 1: |
if(hdr->wBitsPerSample == 16) |
return PCM_1_16_44; |
else |
return PCM_1_8_44; |
case 2: |
if(hdr->wBitsPerSample == 16) |
return PCM_2_16_44; |
else |
return PCM_2_8_44; |
}; |
case 32000: |
switch (hdr->nChannels) |
{ case 1: |
if(hdr->wBitsPerSample == 16) |
return PCM_1_16_32; |
else |
return PCM_1_8_32; |
case 2: |
if(hdr->wBitsPerSample == 16) |
return PCM_2_16_32; |
else |
return PCM_2_8_32; |
}; |
case 24000: |
switch (hdr->nChannels) |
{ case 1: |
if(hdr->wBitsPerSample == 16) |
return PCM_1_16_24; |
else |
return PCM_1_8_24; |
case 2: |
if(hdr->wBitsPerSample == 16) |
return PCM_2_16_24; |
else |
return PCM_2_8_24; |
}; |
case 22050: |
switch (hdr->nChannels) |
{ case 1: |
if(hdr->wBitsPerSample == 16) |
return PCM_1_16_22; |
else |
return PCM_1_8_22; |
case 2: |
if(hdr->wBitsPerSample == 16) |
return PCM_2_16_22; |
else |
return PCM_2_8_22; |
}; |
case 16000: |
switch (hdr->nChannels) |
{ case 1: |
if(hdr->wBitsPerSample == 16) |
return PCM_1_16_16; |
else |
return PCM_1_8_16; |
case 2: |
if(hdr->wBitsPerSample == 16) |
return PCM_2_16_16; |
else |
return PCM_2_8_16; |
}; |
case 12000: |
switch (hdr->nChannels) |
{ case 1: |
if(hdr->wBitsPerSample == 16) |
return PCM_1_16_12; |
else |
return PCM_1_8_12; |
case 2: |
if(hdr->wBitsPerSample == 16) |
return PCM_2_16_12; |
else |
return PCM_2_8_12; |
}; |
case 11025: |
switch (hdr->nChannels) |
{ case 1: |
if(hdr->wBitsPerSample == 16) |
return PCM_1_16_11; |
else |
return PCM_1_8_11; |
case 2: |
if(hdr->wBitsPerSample == 16) |
return PCM_2_16_11; |
else |
return PCM_2_8_11; |
}; |
case 8000: |
switch (hdr->nChannels) |
{ case 1: |
if(hdr->wBitsPerSample == 16) |
return PCM_1_16_8; |
else |
return PCM_1_8_8; |
case 2: |
if(hdr->wBitsPerSample == 16) |
return PCM_2_16_8; |
else |
return PCM_2_8_8; |
}; |
default: |
return 0; |
}; |
}; |
void delay (int val) |
{ |
_asm |
{ mov eax,5 |
mov ebx, [val] |
int 0x40 |
}; |
} |
int wait_for_event(int time) |
{ int retval; |
_asm |
{ mov eax,23 |
mov ebx,[time] |
int 0x40 |
mov [retval], eax |
}; |
return retval; |
}; |
int wait_for_event_infinite() |
{ int retval; |
_asm |
{ mov eax,10 |
int 0x40 |
mov [retval], eax |
}; |
return retval; |
}; |
void BeginDraw() |
{_asm |
{ mov eax,12 |
mov ebx, 1 |
int 0x40 |
}; |
}; |
void EndDraw() |
{ _asm |
{ mov eax,12 |
mov ebx, 2 |
int 0x40 |
}; |
}; |
void * __cdecl memmove ( void * dst, const void * src, size_t count) |
{ void * ret = dst; |
if (dst <= src || (char *)dst >= ((char *)src + count)) |
{ |
while (count--) |
{ *(char *)dst = *(char *)src; |
dst = (char *)dst + 1; |
src = (char *)src + 1; |
} |
} |
else |
{ |
dst = (char *)dst + count - 1; |
src = (char *)src + count - 1; |
while (count--) |
{ *(char *)dst = *(char *)src; |
dst = (char *)dst - 1; |
src = (char *)src - 1; |
} |
} |
return(ret); |
}; |
// debug_out_str(formats[fmt]); |
// debug_out_str("\x0D\x0A\x00"); |
// debug_out_str("pci cmd: "); |
// debug_out_hex(info.pci_cmd); |
// debug_out_str("\x0D\x0A\x00"); |
// debug_out_str("irq line: "); |
// debug_out_hex(info.irq); |
// debug_out_str("\x0D\x0A\x00"); |
// debug_out_str("global control: "); |
// debug_out_hex(info.glob_cntrl); |
// debug_out_str("\x0D\x0A\x00"); |
// debug_out_str("global status: "); |
// debug_out_hex(info.glob_sta); |
// debug_out_str("\x0D\x0A\x00"); |
// call _print_volume |
// debug_out_hex(whdr.nChannels); |
// debug_out_str("\x0D\x0A\x00"); |
// debug_out_hex(whdr.nSamplesPerSec); |
// debug_out_str("\x0D\x0A\x00"); |
// debug_out_hex(fmt); |
// debug_out_str("\x0D\x0A\x00"); |
/programs/media/ac97snd/trunk/ac97wav.h |
---|
0,0 → 1,86 |
// |
// This file is part of the AC97 mp3 player. |
// (C) copyright Serge 2006 |
// email: infinity_sound@mail.ru |
// |
// This program is free software; you can redistribute it and/or modify |
// it under the terms of the GNU General Public License as published by |
// the Free Software Foundation; either version 2 of the License, or |
// (at your option) any later version. |
// |
// This program is distributed in the hope that it will be useful, |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// GNU General Public License for more details. |
#define PCM_2_16_48 1 |
#define PCM_1_16_48 2 |
#define PCM_2_16_44 3 |
#define PCM_1_16_44 4 |
#define PCM_2_16_32 5 |
#define PCM_1_16_32 6 |
#define PCM_2_16_24 7 |
#define PCM_1_16_24 8 |
#define PCM_2_16_22 9 |
#define PCM_1_16_22 10 |
#define PCM_2_16_16 11 |
#define PCM_1_16_16 12 |
#define PCM_2_16_12 13 |
#define PCM_1_16_12 14 |
#define PCM_2_16_11 15 |
#define PCM_1_16_11 16 |
#define PCM_2_16_8 17 |
#define PCM_1_16_8 18 |
#define PCM_2_8_48 19 |
#define PCM_1_8_48 20 |
#define PCM_2_8_44 21 |
#define PCM_1_8_44 22 |
#define PCM_2_8_32 23 |
#define PCM_1_8_32 24 |
#define PCM_2_8_24 25 |
#define PCM_1_8_24 26 |
#define PCM_2_8_22 27 |
#define PCM_1_8_22 28 |
#define PCM_2_8_16 29 |
#define PCM_1_8_16 30 |
#define PCM_2_8_12 31 |
#define PCM_1_8_12 32 |
#define PCM_2_8_11 33 |
#define PCM_1_8_11 34 |
#define PCM_2_8_8 35 |
#define PCM_1_8_8 36 |
#define ST_DONE 0x0 |
#define ST_PLAY 0x1 |
#define ST_EXIT 0x2 |
#define ST_STOP 0x4 |
typedef struct |
{ DWORD riff_id; |
DWORD riff_size; |
DWORD riff_format; |
DWORD fmt_id; |
DWORD fmt_size; |
WORD wFormatTag; |
WORD nChannels; |
DWORD nSamplesPerSec; |
DWORD nAvgBytesPerSec; |
WORD nBlockAlign; |
WORD wBitsPerSample; |
DWORD data_id; |
DWORD data_size; |
} WAVEHEADER; |
DWORD test_wav(WAVEHEADER *hdr); |
DWORD test_mp3(char *buf); |
//void (*snd_play)(); |
void wave_out(char* buff); |
void play_wave(); |
void play_mp3(); |
void snd_stop(); |
/programs/media/ac97snd/trunk/crt.c |
---|
0,0 → 1,70 |
#include "crt.h" |
#define atexitBufferSize 32 |
char pureCallMessage[] = "PURE function call!"; |
char *__argv = 0; |
void (__cdecl *atExitList[atexitBufferSize])(); |
int atExitFnNum = 0; |
void exit() |
{ int i; |
for ( i = atExitFnNum - 1; i >= 0; i-- ) |
atExitList[i](); |
__asm |
{ |
mov eax, -1 |
int 0x40 |
}; |
}; |
int __cdecl atexit( void (__cdecl *func )( void )) |
{ |
// |
if ( atExitFnNum < atexitBufferSize ) |
{ |
// |
atExitList[atExitFnNum++] = func; |
return 0; |
} |
else |
{ |
return 1; |
} |
} |
int __cdecl _purecall() |
{ |
exit(); |
return 0; |
} |
#pragma section(".CRT$XCA",long,read,write) |
#pragma section(".CRT$XCZ",long,read,write) |
typedef void (__cdecl *_PVFV)(void); |
__declspec(allocate(".CRT$XCA")) _PVFV __xc_a[1] = { 0 }; |
__declspec(allocate(".CRT$XCZ")) _PVFV __xc_z[1] = { 0 }; |
// |
#pragma comment(linker, "/merge:.CRT=.rdata") |
// |
void crtStartUp() |
{_PVFV *pbegin; |
_asm {fninit}; |
for ( pbegin = __xc_a; pbegin < __xc_z; pbegin++ ) |
{ |
// |
if ( *pbegin != 0 ) |
(**pbegin)(); |
} |
__argv = *((char **)0x1C); |
main(); |
exit(); |
} |
/programs/media/ac97snd/trunk/crt.h |
---|
0,0 → 1,13 |
typedef unsigned __int32 Dword; |
typedef unsigned __int16 Word; |
typedef unsigned __int8 Byte; |
typedef unsigned __int32 size_t; |
extern char *__argv; |
void crtStartUp(); |
int __cdecl _purecall(); |
int __cdecl atexit( void (__cdecl *func )( void )); |
void exit(); |
int main(); |
/programs/media/ac97snd/trunk/k_lib.asm |
---|
0,0 → 1,714 |
; |
; This file is part of the AC97 mp3 player. |
; (C) copyright Serge 2006 |
; email: infinity_sound@mail.ru |
; |
; This program is free software; you can redistribute it and/or modify |
; it under the terms of the GNU General Public License as published by |
; the Free Software Foundation; either version 2 of the License, or |
; (at your option) any later version. |
; |
; This program is distributed in the hope that it will be useful, |
; but WITHOUT ANY WARRANTY; without even the implied warranty of |
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
; GNU General Public License for more details. |
format MS COFF |
include "proc32.inc" |
section '.text' code readable executable |
public _GetService@4 |
public _GetDevInfo@8 |
public _GetMasterVol@8 |
public _SetMasterVol@8 |
public _CreateBuffer@8 |
public _DestroyBuffer@8 |
public _SetBuffer@20 |
public _PlayBuffer@8 |
public _StopBuffer@8 |
public _InitHeap@4 |
public _UserAlloc@4 |
public _GetNotify@4 |
public _CreateThread@8 |
public _GetMousePos@4 |
public _get_fileinfo@8 |
public _read_file@20 |
public _get_key |
public _get_button_id |
public _DrawWindow@36 |
public _make_button@24 |
public _draw_bar@20 |
public _write_text@20 |
public _debug_out@4 |
public _debug_out_hex@4 |
public _memset |
struc FILEIO |
{ .cmd dd ? |
.offset dd ? |
dd ? |
.count dd ? |
.buff dd ? |
db ? |
.name dd ? |
}; |
struc CTRL_INFO |
{ .pci_cmd dd ? |
.irq dd ? |
.glob_cntrl dd ? |
.glob_sta dd ? |
.codec_io_base dd ? |
.ctrl_io_base dd ? |
.codec_mem_base dd ? |
.ctrl_mem_base dd ? |
.codec_id dd ? |
} |
CTRL_INFO_SIZE equ 9*4 |
SND_CREATE_DEV equ 1 |
SND_CREATE_BUFF equ 2 |
SND_PLAY equ 3 |
SND_STOP equ 4 |
SND_SETBUFF equ 5 |
SND_DESTROY_BUFF equ 6 |
DEV_SET_BUFF equ 4 |
DEV_NOTIFY equ 5 |
DEV_SET_MASTERVOL equ 6 |
DEV_GET_MASTERVOL equ 7 |
DEV_GET_INFO equ 8 |
align 4 |
proc _get_button_id |
mov eax,17 |
int 0x40 |
test al,al |
jnz @F |
shr eax,8 |
ret |
@@: |
xor eax,eax |
dec eax |
ret |
endp |
align 4 |
proc _get_fileinfo@8 stdcall, name:dword, info:dword |
push ebx |
push esi |
push edi |
xor eax, eax |
mov ebx, [name] |
mov ecx, [info] |
mov [fileio.cmd], 5 |
mov [fileio.offset], eax |
mov [fileio.offset+4], eax |
mov [fileio.count], eax |
mov [fileio.buff], ecx |
mov byte [fileio.buff+4], al |
mov [fileio.name], ebx |
mov eax, 70 |
lea ebx, [fileio] |
int 0x40 |
pop edi |
pop esi |
pop ebx |
ret |
endp |
align 4 |
proc _read_file@20 stdcall,name:dword, buff:dword, offset:dword,\ |
count:dword,reads:dword |
push ebx |
push esi |
push edi |
xor eax, eax |
mov ebx, [name] |
mov edx, [offset] |
mov esi, [buff] |
mov edi, [count] |
mov [fileio.cmd], eax |
mov [fileio.offset], edx |
mov [fileio.offset+4], eax |
mov [fileio.count], edi |
mov [fileio.buff], esi |
mov byte [fileio.buff+4], al |
mov [fileio.name], ebx |
mov eax, 70 |
lea ebx, [fileio] |
int 0x40 |
mov esi, [reads] |
test esi, esi |
jz @f |
mov [esi], ebx |
@@: |
pop edi |
pop esi |
pop ebx |
ret |
endp |
align 4 |
proc _get_key |
mov eax, 2 |
int 0x40 |
shr eax, 8 |
ret |
endp |
align 4 |
proc _InitHeap@4 stdcall, heap_size:dword |
push ebx |
mov eax, 68 |
mov ebx, 11 |
mov ecx, [heap_size] |
int 0x40 |
pop ebx |
ret |
endp |
align 4 |
proc _UserAlloc@4 stdcall, alloc_size:dword |
push ebx |
mov eax, 68 |
mov ebx, 12 |
mov ecx, [alloc_size] |
int 0x40 |
pop ebx |
ret |
endp |
align 4 |
proc _GetNotify@4 stdcall, p_ev:dword |
push ebx |
mov eax, 68 |
mov ebx, 14 |
mov ecx, [p_ev] |
int 0x40 |
pop ebx |
ret |
endp |
align 4 |
proc _CreateThread@8 stdcall, fn:dword, p_stack:dword |
push ebx |
mov eax, 51 |
mov ebx, 1 |
mov ecx, [fn] |
mov edx,[p_stack] |
int 0x40 |
pop ebx |
ret |
endp |
align 4 |
proc _GetMousePos@4 stdcall,rel_type:dword |
push ebx |
mov eax, 37 |
mov ebx, [rel_type] |
int 0x40 |
pop ebx |
ret |
endp |
align 4 |
proc CallServiceEx stdcall, ioctl:dword |
push ebx |
mov eax, 68 |
mov ebx, 17 |
mov ecx, [ioctl] |
int 0x40 |
pop ebx |
ret |
endp |
align 4 |
proc _GetService@4 stdcall, name:dword |
push ebx |
mov eax, 68 |
mov ebx, 16 |
mov ecx, [name] |
int 0x40 |
pop ebx |
ret |
endp |
align 4 |
proc _GetDevInfo@8 stdcall, hSrv:dword, p_info:dword |
locals |
handle dd ? |
io_code dd ? |
input dd ? |
inp_size dd ? |
output dd ? |
out_size dd ? |
endl |
push ebx |
mov eax, [hSrv] |
xor ebx, ebx |
mov ecx, [p_info] |
mov [handle], eax |
mov [io_code], DEV_GET_INFO |
mov [input], ebx |
mov [inp_size], ebx |
mov [output], ecx |
mov [out_size], CTRL_INFO_SIZE |
lea eax, [handle] |
stdcall CallServiceEx, eax |
pop ebx |
ret |
endp |
align 4 |
proc _GetMasterVol@8 stdcall, hSrv:dword,pvol:dword |
locals |
handle dd ? |
io_code dd ? |
input dd ? |
inp_size dd ? |
output dd ? |
out_size dd ? |
endl |
push ebx |
mov eax, [hSrv] |
mov ecx, [pvol] |
xor ebx, ebx |
mov [handle], eax |
mov [io_code], DEV_GET_MASTERVOL |
mov [input], ebx |
mov [inp_size], ebx |
mov [output], ecx |
mov [out_size], 4 |
lea eax, [handle] |
stdcall CallServiceEx, eax |
pop ebx |
ret |
endp |
align 4 |
proc _SetMasterVol@8 stdcall,hSrv:dword,vol:dword |
locals |
handle dd ? |
io_code dd ? |
input dd ? |
inp_size dd ? |
output dd ? |
out_size dd ? |
endl |
push ebx |
mov eax, [hSrv] |
lea ecx, [vol] |
xor ebx, ebx |
mov [handle], eax |
mov [io_code], DEV_SET_MASTERVOL |
mov [input], ecx |
mov [inp_size], 4 |
mov [output], ebx |
mov [out_size], 0 |
lea eax, [handle] |
stdcall CallServiceEx, eax |
pop ebx |
ret |
endp |
align 4 |
proc _CreateBuffer@8 stdcall, hSound:dword,format:dword |
locals |
handle dd ? |
io_code dd ? |
input dd ? |
inp_size dd ? |
output dd ? |
out_size dd ? |
endl |
push ebx |
mov eax, [hSound] |
lea ecx, [format] |
xor ebx, ebx |
mov [handle], eax |
mov [io_code], SND_CREATE_BUFF |
mov [input], ecx |
mov [inp_size], 4 |
mov [output], ebx |
mov [out_size], 0 |
lea eax, [handle] |
stdcall CallServiceEx, eax |
pop ebx |
ret |
endp |
align 4 |
proc _DestroyBuffer@8 stdcall, hSound:dword, str:dword |
locals |
handle dd ? |
io_code dd ? |
input dd ? |
inp_size dd ? |
output dd ? |
out_size dd ? |
endl |
push ebx |
mov eax, [hSound] |
lea ecx, [str] |
xor ebx, ebx |
mov [handle], eax |
mov [io_code], SND_DESTROY_BUFF |
mov [input], ecx |
mov [inp_size], 4 |
mov [output], ebx |
mov [out_size], 0 |
lea eax, [handle] |
stdcall CallServiceEx, eax |
pop ebx |
ret |
endp |
align 4 |
proc _SetBuffer@20 stdcall,hSound:dword, str:dword, src:dword, offs:dword, size:dword |
locals |
handle dd ? |
io_code dd ? |
input dd ? |
inp_size dd ? |
output dd ? |
out_size dd ? |
endl |
push ebx |
mov eax, [hSound] |
lea ecx, [str] |
xor ebx, ebx |
mov [handle], eax |
mov [io_code], SND_SETBUFF |
mov [input], ecx |
mov [inp_size], 16 |
mov [output], ebx |
mov [out_size], 0 |
lea eax, [handle] |
stdcall CallServiceEx, eax |
pop ebx |
ret |
endp |
align 4 |
proc _PlayBuffer@8 stdcall, hSound:dword, str:dword |
locals |
handle dd ? |
io_code dd ? |
input dd ? |
inp_size dd ? |
output dd ? |
out_size dd ? |
endl |
push ebx |
mov eax, [hSound] |
lea ecx, [str] |
xor ebx, ebx |
mov [handle], eax |
mov [io_code], SND_PLAY |
mov [input], ecx |
mov [inp_size], 4 |
mov [output], ebx |
mov [out_size], 0 |
lea eax, [handle] |
stdcall CallServiceEx, eax |
pop ebx |
ret |
endp |
align 4 |
proc _StopBuffer@8 stdcall, hSound:dword, str:dword |
locals |
handle dd ? |
io_code dd ? |
input dd ? |
inp_size dd ? |
output dd ? |
out_size dd ? |
endl |
push ebx |
mov eax, [hSound] |
lea ecx, [str] |
xor ebx, ebx |
mov [handle], eax |
mov [io_code], SND_STOP |
mov [input], ecx |
mov [inp_size], 4 |
mov [output], ebx |
mov [out_size], 0 |
lea eax, [handle] |
stdcall CallServiceEx, eax |
pop ebx |
ret |
endp |
align 4 |
proc _DrawWindow@36 stdcall, x:dword, y:dword, sx:dword, sy:dword,\ |
workcolor:dword, style:dword, captioncolor:dword,\ |
windowtype:dword, bordercolor:dword |
push ebx edi esi |
mov ebx, [x] |
mov ecx, [y] |
shl ebx, 16 |
shl ecx, 16 |
mov bx, word [sx] |
mov cx, word [sy] |
mov edx,[style] |
shl edx,24 |
add edx,[workcolor] |
mov esi,[windowtype] |
shl esi,24 |
add esi,[captioncolor] |
mov edi,[bordercolor] |
xor eax,eax |
int 0x40 |
pop esi edi ebx |
ret |
endp |
align 4 |
_make_button@24: |
;arg1 - x |
;arg2 - y |
;arg3 - xsize |
;arg4 - ysize |
;arg5 - id |
;arg6 - color |
push ebx esi |
mov ebx,[esp+12] |
shl ebx,16 |
mov bx,[esp+20] |
mov ecx,[esp+16] |
shl ecx,16 |
mov cx,[esp+24] |
mov edx,[esp+28] |
mov esi,[esp+32] |
mov eax,8 |
int 0x40 |
pop esi ebx |
ret 24 |
align 4 |
_draw_bar@20: |
;arg1 - x |
;arg2 - y |
;arg3 - xsize |
;arg4 - ysize |
;arg5 - color |
push ebx |
mov eax,13 |
mov ebx,[esp+8] |
shl ebx,16 |
mov bx,[esp+16] |
mov ecx,[esp+12] |
shl ecx,16 |
mov cx,[esp+20] |
mov edx,[esp+24] |
int 0x40 |
pop ebx |
ret 20 |
_write_text@20: |
;arg1 - x |
;arg2 - y |
;arg3 - color |
;arg4 - text |
;arg5 - len |
push ebx esi |
mov eax,4 |
mov ebx,[esp+12] |
shl ebx,16 |
mov bx,[esp+16] |
mov ecx,[esp+20] |
mov edx,[esp+24] |
mov esi,[esp+28] |
int 0x40 |
pop esi ebx |
ret 20 |
align 4 |
proc _debug_out@4 stdcall, val:dword |
push ebx |
mov ecx,[val] |
mov ebx,1 |
mov eax,63 |
int 0x40 |
pop ebx |
ret |
endp |
align 4 |
proc _debug_out_hex@4 stdcall val:dword |
locals |
count dd ? |
endl |
mov [count], 8 |
.new_char: |
rol [val], 4 |
mov ecx, [val] |
and ecx, 0x0f |
mov cl,byte [__hexdigits+ecx] |
mov eax, 63 |
mov ebx, 1 |
int 0x40 |
dec [count] |
jnz .new_char |
ret |
endp |
align 4 |
_memset: |
mov edx,[esp + 0ch] |
mov ecx,[esp + 4] |
test edx,edx |
jz short toend |
xor eax,eax |
mov al,[esp + 8] |
push edi |
mov edi,ecx |
cmp edx,4 |
jb tail |
neg ecx |
and ecx,3 |
jz short dwords |
sub edx,ecx |
adjust_loop: |
mov [edi],al |
add edi,1 |
sub ecx,1 |
jnz adjust_loop |
dwords: |
mov ecx,eax |
shl eax,8 |
add eax,ecx |
mov ecx,eax |
shl eax,10h |
add eax,ecx |
mov ecx,edx |
and edx,3 |
shr ecx,2 |
jz tail |
cld |
rep stosd |
main_loop_tail: |
test edx,edx |
jz finish |
tail: |
mov [edi],al |
add edi,1 |
sub edx,1 |
jnz tail |
finish: |
mov eax,[esp + 8] |
pop edi |
ret |
toend: |
mov eax,[esp + 4] |
ret |
public __ftol2_sse |
align 4 |
__ftol2_sse: |
push ebp |
mov ebp, esp |
sub esp, 20 |
and esp, 0xFFFFFFF0 |
fld st0 |
fst dword [esp+18] |
fistp qword [esp+10] |
fild qword [esp+10] |
mov edx, [esp+18] |
mov eax, [esp+10] |
test eax, eax |
jz .QnaNZ |
.not_QnaNZ: |
fsubp st1, st0 |
test edx, edx |
jns .pos |
fstp dword [esp] |
mov ecx, [esp] |
xor ecx, 0x80000000 |
add ecx, 0x7FFFFFFF |
adc eax, 0 |
mov edx, [esp+14] |
adc edx, 0 |
jmp .exit |
.pos: |
fstp dword [esp] |
mov ecx, [esp] |
add ecx, 0x7FFFFFFF |
sbb eax, 0 |
jmp .exit |
.QnaNZ: |
mov edx, [esp+14] |
test edx, 0x7FFFFFFF |
jne .not_QnaNZ |
fstp dword [esp+18] |
fstp dword [esp+18] |
.exit: |
leave |
ret |
public __fltused |
__fltused dd 0 |
align 4 |
__hexdigits db '0123456789ABCDEF' |
align 4 |
fileio FILEIO |
/programs/media/ac97snd/trunk/kolibri.h |
---|
0,0 → 1,109 |
// |
// This file is part of the AC97 mp3 player. |
// (C) copyright Serge 2006 |
// email: infinity_sound@mail.ru |
// |
// This program is free software; you can redistribute it and/or modify |
// it under the terms of the GNU General Public License as published by |
// the Free Software Foundation; either version 2 of the License, or |
// (at your option) any later version. |
// |
// This program is distributed in the hope that it will be useful, |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// GNU General Public License for more details. |
#define FONT0 0x00000000 |
#define FONT1 0x10000000 |
#define BT_NORMAL 0x00000000 |
#define BT_NOFRAME 0x20000000 |
#define BT_HIDE 0x40000000 |
#define BT_DEL 0x80000000 |
#define EV_REDRAW 1 |
#define EV_KEY 2 |
#define EV_BUTTON 3 |
#define REL_SCREEN 0 |
#define REL_WINDOW 1 |
#define FILE_NOT_FOUND 5 |
#define FILE_EOF 6 |
typedef unsigned int DWORD; |
typedef unsigned short int WORD; |
typedef struct |
{ DWORD pci_cmd; |
DWORD irq; |
DWORD glob_cntrl; |
DWORD glob_sta; |
DWORD codec_io_base; |
DWORD ctrl_io_base; |
DWORD codec_mem_base; |
DWORD ctrl_mem_base; |
DWORD codec_id; |
} CTRL_INFO; |
typedef struct |
{ DWORD cmd; |
DWORD offset; |
DWORD r1; |
DWORD count; |
DWORD buff; |
char r2; |
char *name; |
} FILEIO; |
typedef struct |
{ DWORD attr; |
DWORD flags; |
DWORD cr_time; |
DWORD cr_date; |
DWORD acc_time; |
DWORD acc_date; |
DWORD mod_time; |
DWORD mod_date; |
DWORD size; |
} FILEINFO; |
void _stdcall InitHeap(int heap_size); |
void* _stdcall UserAlloc(int size); |
void _stdcall GetNotify(DWORD *event); |
void _stdcall CreateThread(void *fn, char *p_stack); |
DWORD _stdcall GetMousePos(DWORD rel_type); |
int _stdcall GetService(char *srv_name); |
void _stdcall GetDevInfo(DWORD hSrv,CTRL_INFO *pInfo); |
int _stdcall GetMasterVol(DWORD hSrv,int* vol); |
int _stdcall SetMasterVol(DWORD hSrv, int vol); |
DWORD _stdcall CreateBuffer(DWORD hSrv, DWORD format); |
int _stdcall DestroyBuffer(DWORD hSrv, DWORD hBuff); |
int _stdcall SetBuffer(DWORD hSrv, DWORD hBuff,char* buff, |
DWORD offs, int size); |
int _stdcall PlayBuffer(DWORD hSrv, DWORD hBuff); |
int _stdcall StopBuffer(DWORD hSrv, DWORD hBuff); |
void _stdcall debug_out_hex(DWORD val); |
void debug_out_str(char* str); |
int _stdcall get_fileinfo(char *name,FILEINFO* pinfo); |
int _stdcall read_file (char *name,char*buff,int offset,int count,int *reads); |
void exit(); |
int get_key(void); |
int get_button_id(); |
void delay(int val); |
int wait_for_event(int time); |
int wait_for_event_infinite(); |
void BeginDraw(void); |
void EndDraw(void); |
void _stdcall DrawWindow(int x,int y, int sx, int sy,int workcolor,int style, |
int captioncolor,int windowtype,int bordercolor); |
void _stdcall debug_out(int ch); |
void _stdcall make_button(int x, int y, int xsize, int ysize, int id, int color); |
void _stdcall draw_bar(int x, int y, int xsize, int ysize, int color); |
void _stdcall write_text(int x,int y,int color,char* text,int len); |
/programs/media/ac97snd/trunk/mp3dec/PROC32.INC |
---|
0,0 → 1,268 |
; Macroinstructions for defining and calling procedures |
macro stdcall proc,[arg] ; directly call STDCALL procedure |
{ common |
if ~ arg eq |
reverse |
pushd arg |
common |
end if |
call proc } |
macro invoke proc,[arg] ; indirectly call STDCALL procedure |
{ common |
if ~ arg eq |
reverse |
pushd arg |
common |
end if |
call [proc] } |
macro ccall proc,[arg] ; directly call CDECL procedure |
{ common |
size@ccall = 0 |
if ~ arg eq |
reverse |
pushd arg |
size@ccall = size@ccall+4 |
common |
end if |
call proc |
if size@ccall |
add esp,size@ccall |
end if } |
macro cinvoke proc,[arg] ; indirectly call CDECL procedure |
{ common |
size@ccall = 0 |
if ~ arg eq |
reverse |
pushd arg |
size@ccall = size@ccall+4 |
common |
end if |
call [proc] |
if size@ccall |
add esp,size@ccall |
end if } |
macro proc [args] ; define procedure |
{ common |
match name params, args> |
\{ define@proc name,<params \} } |
prologue@proc equ prologuedef |
macro prologuedef procname,flag,parmbytes,localbytes,reglist |
{ if parmbytes | localbytes |
push ebp |
mov ebp,esp |
if localbytes |
sub esp,localbytes |
end if |
end if |
irps reg, reglist \{ push reg \} } |
epilogue@proc equ epiloguedef |
macro epiloguedef procname,flag,parmbytes,localbytes,reglist |
{ irps reg, reglist \{ reverse pop reg \} |
if parmbytes | localbytes |
leave |
end if |
if flag and 10000b |
retn |
else |
retn parmbytes |
end if } |
macro define@proc name,statement |
{ local params,flag,regs,parmbytes,localbytes,current |
if used name |
name: |
match =stdcall args, statement \{ params equ args |
flag = 11b \} |
match =stdcall, statement \{ params equ |
flag = 11b \} |
match =c args, statement \{ params equ args |
flag = 10001b \} |
match =c, statement \{ params equ |
flag = 10001b \} |
match =params, params \{ params equ statement |
flag = 0 \} |
virtual at ebp+8 |
match =uses reglist=,args, params \{ regs equ reglist |
params equ args \} |
match =regs =uses reglist, regs params \{ regs equ reglist |
params equ \} |
match =regs, regs \{ regs equ \} |
match =,args, params \{ defargs@proc args \} |
match =args@proc args, args@proc params \{ defargs@proc args \} |
parmbytes = $ - (ebp+8) |
end virtual |
name # % = parmbytes/4 |
all@vars equ |
current = 0 |
match prologue:reglist, prologue@proc:<regs> \{ prologue name,flag,parmbytes,localbytes,reglist \} |
macro locals |
\{ virtual at ebp-localbytes+current |
macro label . \\{ deflocal@proc .,:, \\} |
struc db [val] \\{ \common deflocal@proc .,db,val \\} |
struc dw [val] \\{ \common deflocal@proc .,dw,val \\} |
struc dp [val] \\{ \common deflocal@proc .,dp,val \\} |
struc dd [val] \\{ \common deflocal@proc .,dd,val \\} |
struc dt [val] \\{ \common deflocal@proc .,dt,val \\} |
struc dq [val] \\{ \common deflocal@proc .,dq,val \\} |
struc rb cnt \\{ deflocal@proc .,rb cnt, \\} |
struc rw cnt \\{ deflocal@proc .,rw cnt, \\} |
struc rp cnt \\{ deflocal@proc .,rp cnt, \\} |
struc rd cnt \\{ deflocal@proc .,rd cnt, \\} |
struc rt cnt \\{ deflocal@proc .,rt cnt, \\} |
struc rq cnt \\{ deflocal@proc .,rq cnt, \\} \} |
macro endl |
\{ purge label |
restruc db,dw,dp,dd,dt,dq |
restruc rb,rw,rp,rd,rt,rq |
restruc byte,word,dword,pword,tword,qword |
current = $-(ebp-localbytes) |
end virtual \} |
macro ret operand |
\{ match any, operand \\{ retn operand \\} |
match , operand \\{ match epilogue:reglist, epilogue@proc:<regs> |
\\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \} |
macro finish@proc \{ localbytes = (((current-1) shr 2)+1) shl 2 |
end if \} } |
macro defargs@proc [arg] |
{ common |
if ~ arg eq |
forward |
local ..arg,current@arg |
match argname:type, arg |
\{ current@arg equ argname |
label ..arg type |
argname equ ..arg |
if dqword eq type |
dd ?,?,?,? |
else if tbyte eq type |
dd ?,?,? |
else if qword eq type | pword eq type |
dd ?,? |
else |
dd ? |
end if \} |
match =current@arg,current@arg |
\{ current@arg equ arg |
arg equ ..arg |
..arg dd ? \} |
common |
args@proc equ current@arg |
forward |
restore current@arg |
common |
end if } |
macro deflocal@proc name,def,[val] |
{ common |
match vars, all@vars \{ all@vars equ all@vars, \} |
all@vars equ all@vars name |
forward |
local ..var,..tmp |
..var def val |
match =?, val \{ ..tmp equ \} |
match any =dup (=?), val \{ ..tmp equ \} |
match tmp : value, ..tmp : val |
\{ tmp: end virtual |
initlocal@proc ..var,def value |
virtual at tmp\} |
common |
match first rest, ..var, \{ name equ first \} } |
macro initlocal@proc name,def |
{ virtual at name |
def |
size@initlocal = $ - name |
end virtual |
position@initlocal = 0 |
while size@initlocal > position@initlocal |
virtual at name |
def |
if size@initlocal - position@initlocal < 2 |
current@initlocal = 1 |
load byte@initlocal byte from name+position@initlocal |
else if size@initlocal - position@initlocal < 4 |
current@initlocal = 2 |
load word@initlocal word from name+position@initlocal |
else |
current@initlocal = 4 |
load dword@initlocal dword from name+position@initlocal |
end if |
end virtual |
if current@initlocal = 1 |
mov byte [name+position@initlocal],byte@initlocal |
else if current@initlocal = 2 |
mov word [name+position@initlocal],word@initlocal |
else |
mov dword [name+position@initlocal],dword@initlocal |
end if |
position@initlocal = position@initlocal + current@initlocal |
end while } |
macro endp |
{ purge ret,locals,endl |
finish@proc |
purge finish@proc |
restore regs@proc |
match all,args@proc \{ restore all \} |
restore args@proc |
match all,all@vars \{ restore all \} } |
macro local [var] |
{ common |
locals |
forward done@local equ |
match varname[count]:vartype, var |
\{ match =BYTE, vartype \\{ varname rb count |
restore done@local \\} |
match =WORD, vartype \\{ varname rw count |
restore done@local \\} |
match =DWORD, vartype \\{ varname rd count |
restore done@local \\} |
match =PWORD, vartype \\{ varname rp count |
restore done@local \\} |
match =QWORD, vartype \\{ varname rq count |
restore done@local \\} |
match =TBYTE, vartype \\{ varname rt count |
restore done@local \\} |
match =DQWORD, vartype \\{ label varname dqword |
rq count+count |
restore done@local \\} |
match , done@local \\{ virtual |
varname vartype |
end virtual |
rb count*sizeof.\#vartype |
restore done@local \\} \} |
match :varname:vartype, done@local:var |
\{ match =BYTE, vartype \\{ varname db ? |
restore done@local \\} |
match =WORD, vartype \\{ varname dw ? |
restore done@local \\} |
match =DWORD, vartype \\{ varname dd ? |
restore done@local \\} |
match =PWORD, vartype \\{ varname dp ? |
restore done@local \\} |
match =QWORD, vartype \\{ varname dq ? |
restore done@local \\} |
match =TBYTE, vartype \\{ varname dt ? |
restore done@local \\} |
match =DQWORD, vartype \\{ label varname dqword |
dq ?,? |
restore done@local \\} |
match , done@local \\{ varname vartype |
restore done@local \\} \} |
match ,done@local |
\{ var |
restore done@local \} |
common |
endl } |
/programs/media/ac97snd/trunk/mp3dec/bstream.c |
---|
0,0 → 1,212 |
/* max bits required for any lookup - change if htable changes */ |
/* quad required 10 bit w/signs must have (MAXBITS+2) >= 10 */ |
#define MAXBITS 9 |
static unsigned int bitbuf; |
static int bits; |
static unsigned char *bs_ptr; |
static unsigned char *bs_ptr0; |
static unsigned char *bs_ptr_end; // optional for overrun test |
void bitget_init(unsigned char *buf) |
{ |
bs_ptr0 = bs_ptr = buf; |
bits = 0; |
bitbuf = 0; |
} |
int bitget(int n) |
{ |
unsigned int x; |
if (bits < n) |
{ /* refill bit buf if necessary */ |
while (bits <= 24) |
{ |
bitbuf = (bitbuf << 8) | *bs_ptr++; |
bits += 8; |
} |
} |
bits -= n; |
x = bitbuf >> bits; |
bitbuf -= x << bits; |
return x; |
} |
void bitget_skip(int n) |
{ |
unsigned int k; |
if (bits < n) |
{ |
n -= bits; |
k = n >> 3; |
/*--- bytes = n/8 --*/ |
bs_ptr += k; |
n -= k << 3; |
bitbuf = *bs_ptr++; |
bits = 8; |
} |
bits -= n; |
bitbuf -= (bitbuf >> bits) << bits; |
} |
void bitget_init_end(unsigned char *buf_end) |
{ |
bs_ptr_end = buf_end; |
} |
/*------------- check overrun -------------*/ |
int bitget_overrun() |
{ |
return bs_ptr > bs_ptr_end; |
} |
/*------------- get n bits from bitstream -------------*/ |
int bitget_bits_used() |
{ |
unsigned int n; /* compute bits used from last init call */ |
n = ((bs_ptr - bs_ptr0) << 3) - bits; |
return n; |
} |
/*------------- check for n bits in bitbuf -------------*/ |
void bitget_check(int n) |
{ |
if (bits < n) |
{ |
while (bits <= 24) |
{ |
bitbuf = (bitbuf << 8) | *bs_ptr++; |
bits += 8; |
} |
} |
} |
#if 0 |
/*------------- get 1 bit from bitstream -------------*/ |
int bitget_1bit() |
{ |
unsigned int x; |
if (bits <= 0) |
{ /* refill bit buf if necessary */ |
while (bits <= 24) |
{ |
bitbuf = (bitbuf << 8) | *bs_ptr++; |
bits += 8; |
} |
} |
bits--; |
x = bitbuf >> bits; |
bitbuf -= x << bits; |
return x; |
} |
/*------------- get 1 bit from bitstream NO CHECK -------------*/ |
int bitget_1bit() |
{ |
unsigned int x; |
bits--; |
x = bitbuf >> bits; |
bitbuf -= x << bits; |
return x; |
} |
#endif |
/* only huffman */ |
/*----- get n bits - checks for n+2 avail bits (linbits+sign) -----*/ |
int bitget_lb(int n) |
{ |
unsigned int x; |
if (bits < (n + 2)) |
{ /* refill bit buf if necessary */ |
while (bits <= 24) |
{ |
bitbuf = (bitbuf << 8) | *bs_ptr++; |
bits += 8; |
} |
} |
bits -= n; |
x = bitbuf >> bits; |
bitbuf -= x << bits; |
return x; |
} |
/*------------- get n bits but DO NOT remove from bitstream --*/ |
int bitget2(int n) |
{ |
unsigned int x; |
if (bits < (MAXBITS + 2)) |
{ /* refill bit buf if necessary */ |
while (bits <= 24) |
{ |
bitbuf = (bitbuf << 8) | *bs_ptr++; |
bits += 8; |
} |
} |
x = bitbuf >> (bits - n); |
return x; |
} |
/*------------- remove n bits from bitstream ---------*/ |
void bitget_purge(int n) |
{ |
bits -= n; |
bitbuf -= (bitbuf >> bits) << bits; |
} |
void mac_bitget_check(int n) |
{ |
if( bits < n ) { |
while( bits <= 24 ) { |
bitbuf = (bitbuf << 8) | *bs_ptr++; |
bits += 8; |
} |
} |
} |
int mac_bitget(int n) |
{ |
unsigned int code; |
bits -= n; |
code = bitbuf >> bits; |
bitbuf -= code << bits; |
return code; |
} |
int mac_bitget2(int n) |
{ |
return (bitbuf >> (bits-n)); |
} |
int mac_bitget_1bit() |
{ |
unsigned int code; |
bits--; |
code = bitbuf >> bits; |
bitbuf -= code << bits; |
return code; |
} |
void mac_bitget_purge(int n) |
{ |
bits -= n; |
bitbuf -= (bitbuf >> bits) << bits; |
} |
/* |
#define mac_bitget(n) ( bits -= n, \ |
code = bitbuf >> bits, \ |
bitbuf -= code << bits, \ |
code ) |
#define mac_bitget_1bit() ( bits--, \ |
code = bitbuf >> bits, \ |
bitbuf -= code << bits, \ |
code ) |
*/ |
/programs/media/ac97snd/trunk/mp3dec/bstream.h |
---|
0,0 → 1,23 |
typedef unsigned char byte; |
typedef unsigned int uint; |
typedef void (*SBT_PROC) (float *sample, void *pcm, int n); |
typedef void (*XFORM_PROC) (void *pcm, int igr); |
void bitget_init(unsigned char *buf); |
void bitget_init_end(unsigned char *buf_end); |
int bitget_overrun(); |
int bitget_bits_used(); |
void bitget_check(int n); |
int bitget(int n); |
void bitget_skip(int n); |
//int bitget_1bit(); |
int bitget_lb(int n); |
int bitget2(int n); |
void bitget_purge(int n); |
void mac_bitget_check(int n); |
int mac_bitget(int n); |
int mac_bitget_1bit(); |
int mac_bitget2(int n); |
void mac_bitget_purge(int n); |
/programs/media/ac97snd/trunk/mp3dec/e_pow.c |
---|
0,0 → 1,358 |
/* @(#)e_pow.c 5.1 93/09/24 */ |
/* |
* ==================================================== |
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. |
* |
* Developed at SunPro, a Sun Microsystems, Inc. business. |
* Permission to use, copy, modify, and distribute this |
* software is freely granted, provided that this notice |
* is preserved. |
* ==================================================== |
*/ |
/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/25, |
for performance improvement on pipelined processors. |
*/ |
#if defined(LIBM_SCCS) && !defined(lint) |
static char rcsid[] = "$NetBSD: e_pow.c,v 1.9 1995/05/12 04:57:32 jtc Exp $"; |
#endif |
/* __ieee754_pow(x,y) return x**y |
* |
* n |
* Method: Let x = 2 * (1+f) |
* 1. Compute and return log2(x) in two pieces: |
* log2(x) = w1 + w2, |
* where w1 has 53-24 = 29 bit trailing zeros. |
* 2. Perform y*log2(x) = n+y' by simulating muti-precision |
* arithmetic, where |y'|<=0.5. |
* 3. Return x**y = 2**n*exp(y'*log2) |
* |
* Special cases: |
* 1. (anything) ** 0 is 1 |
* 2. (anything) ** 1 is itself |
* 3. (anything) ** NAN is NAN |
* 4. NAN ** (anything except 0) is NAN |
* 5. +-(|x| > 1) ** +INF is +INF |
* 6. +-(|x| > 1) ** -INF is +0 |
* 7. +-(|x| < 1) ** +INF is +0 |
* 8. +-(|x| < 1) ** -INF is +INF |
* 9. +-1 ** +-INF is NAN |
* 10. +0 ** (+anything except 0, NAN) is +0 |
* 11. -0 ** (+anything except 0, NAN, odd integer) is +0 |
* 12. +0 ** (-anything except 0, NAN) is +INF |
* 13. -0 ** (-anything except 0, NAN, odd integer) is +INF |
* 14. -0 ** (odd integer) = -( +0 ** (odd integer) ) |
* 15. +INF ** (+anything except 0,NAN) is +INF |
* 16. +INF ** (-anything except 0,NAN) is +0 |
* 17. -INF ** (anything) = -0 ** (-anything) |
* 18. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer) |
* 19. (-anything except 0 and inf) ** (non-integer) is NAN |
* |
* Accuracy: |
* pow(x,y) returns x**y nearly rounded. In particular |
* pow(integer,integer) |
* always returns the correct integer provided it is |
* representable. |
* |
* Constants : |
* The hexadecimal values are the intended ones for the following |
* constants. The decimal values may be used, provided that the |
* compiler will convert from decimal to binary accurately enough |
* to produce the hexadecimal values shown. |
*/ |
#include "math.h" |
#include "math_private.h" |
#define zero C[0] |
#define one C[1] |
#define two C[2] |
#define two53 C[3] |
#define huge C[4] |
#define tiny C[5] |
#define L1 C[6] |
#define L2 C[7] |
#define L3 C[8] |
#define L4 C[9] |
#define L5 C[10] |
#define L6 C[11] |
#define P1 C[12] |
#define P2 C[13] |
#define P3 C[14] |
#define P4 C[15] |
#define P5 C[16] |
#define lg2 C[17] |
#define lg2_h C[18] |
#define lg2_l C[19] |
#define ovt C[20] |
#define cp C[21] |
#define cp_h C[22] |
#define cp_l C[23] |
#define ivln2 C[24] |
#define ivln2_h C[25] |
#define ivln2_l C[26] |
double scalbn(double,int); |
#define EXTRACT_WORDS(ix0,ix1,d) \ |
do { \ |
ieee_double_shape_type ew_u; \ |
ew_u.value = (d); \ |
(ix0) = ew_u.parts.msw; \ |
(ix1) = ew_u.parts.lsw; \ |
} while (0) |
#ifdef __STDC__ |
static const double |
#else |
static double |
#endif |
bp[] = {1.0, 1.5,}, |
dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */ |
dp_l[] = { 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */ |
C[] = { |
0.0, |
1.0, |
2.0, |
9007199254740992.0 , |
1.0e300, |
1.0e-300, |
5.99999999999994648725e-01 , |
4.28571428578550184252e-01 , |
3.33333329818377432918e-01 , |
2.72728123808534006489e-01 , |
2.30660745775561754067e-01 , |
2.06975017800338417784e-01 , |
1.66666666666666019037e-01 , |
-2.77777777770155933842e-03 , |
6.61375632143793436117e-05 , |
-1.65339022054652515390e-06 , |
4.13813679705723846039e-08 , |
6.93147180559945286227e-01 , |
6.93147182464599609375e-01 , |
-1.90465429995776804525e-09 , |
8.0085662595372944372e-0017 , |
9.61796693925975554329e-01 , |
9.61796700954437255859e-01 , |
-7.02846165095275826516e-09 , |
1.44269504088896338700e+00 , |
1.44269502162933349609e+00 , |
1.92596299112661746887e-08 }; |
double pow_test(x,y) |
double x, y; |
{ |
double z,ax,z_h,z_l,p_h,p_l; |
double y1,t1,t2,r,s,t,u,v,w, t12,t14,r_1,r_2,r_3; |
int32_t i,j,k,yisint,n; |
int32_t hx,hy,ix,iy; |
u_int32_t lx,ly; |
EXTRACT_WORDS(hx,lx,x); |
EXTRACT_WORDS(hy,ly,y); |
ix = hx&0x7fffffff; iy = hy&0x7fffffff; |
/* y==zero: x**0 = 1 */ |
if((iy|ly)==0) return C[1]; |
/* +-NaN return x+y */ |
if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) || |
iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) |
return x+y; |
/* determine if y is an odd int when x < 0 |
* yisint = 0 ... y is not an integer |
* yisint = 1 ... y is an odd int |
* yisint = 2 ... y is an even int |
*/ |
yisint = 0; |
if(hx<0) { |
if(iy>=0x43400000) yisint = 2; /* even integer y */ |
else if(iy>=0x3ff00000) { |
k = (iy>>20)-0x3ff; /* exponent */ |
if(k>20) { |
j = ly>>(52-k); |
if((u_int32_t)(j<<(52-k))==ly) yisint = 2-(j&1); |
} else if(ly==0) { |
j = iy>>(20-k); |
if((int32_t)(j<<(20-k))==iy) yisint = 2-(j&1); |
} |
} |
} |
/* special value of y */ |
if(ly==0) { |
if (iy==0x7ff00000) { /* y is +-inf */ |
if(((ix-0x3ff00000)|lx)==0) |
return y - y; /* inf**+-1 is NaN */ |
else if (ix >= 0x3ff00000)/* (|x|>1)**+-inf = inf,0 */ |
return (hy>=0)? y: C[0]; |
else /* (|x|<1)**-,+inf = inf,0 */ |
return (hy<0)?-y: C[0]; |
} |
if(iy==0x3ff00000) { /* y is +-1 */ |
if(hy<0) return C[1]/x; else return x; |
} |
if(hy==0x40000000) return x*x; /* y is 2 */ |
if(hy==0x3fe00000) { /* y is 0.5 */ |
if(hx>=0) /* x >= +0 */ |
return sqrt(x); |
} |
} |
ax = fabs(x); |
/* special value of x */ |
if(lx==0) { |
if(ix==0x7ff00000||ix==0||ix==0x3ff00000){ |
z = ax; /*x is +-0,+-inf,+-1*/ |
if(hy<0) z = C[1]/z; /* z = (1/|x|) */ |
if(hx<0) { |
if(((ix-0x3ff00000)|yisint)==0) { |
z = (z-z)/(z-z); /* (-1)**non-int is NaN */ |
} else if(yisint==1) |
z = -z; /* (x<0)**odd = -(|x|**odd) */ |
} |
return z; |
} |
} |
/* (x<0)**(non-int) is NaN */ |
if(((((u_int32_t)hx>>31)-1)|yisint)==0) return (x-x)/(x-x); |
/* |y| is huge */ |
if(iy>0x41e00000) { /* if |y| > 2**31 */ |
if(iy>0x43f00000){ /* if |y| > 2**64, must o/uflow */ |
if(ix<=0x3fefffff) return (hy<0)? C[4]*C[4]:C[5]*C[5]; |
if(ix>=0x3ff00000) return (hy>0)? C[4]*C[4]:C[5]*C[5]; |
} |
/* over/underflow if x is not close to one */ |
if(ix<0x3fefffff) return (hy<0)? C[4]*C[4]:C[5]*C[5]; |
if(ix>0x3ff00000) return (hy>0)? C[4]*C[4]:C[5]*C[5]; |
/* now |1-x| is tiny <= 2**-20, suffice to compute |
log(x) by x-x^2/2+x^3/3-x^4/4 */ |
t = x-1; /* t has 20 trailing zeros */ |
w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25)); |
u = C[25]*t; /* ivln2_h has 21 sig. bits */ |
v = t*C[26]-w*C[24]; |
t1 = u+v; |
SET_LOW_WORD(t1,0); |
t2 = v-(t1-u); |
} else { |
double s2,s_h,s_l,t_h,t_l,s22,s24,s26,r1,r2,r3; |
n = 0; |
/* take care subnormal number */ |
if(ix<0x00100000) |
{ax *= C[3]; n -= 53; GET_HIGH_WORD(ix,ax); } |
n += ((ix)>>20)-0x3ff; |
j = ix&0x000fffff; |
/* determine interval */ |
ix = j|0x3ff00000; /* normalize ix */ |
if(j<=0x3988E) k=0; /* |x|<sqrt(3/2) */ |
else if(j<0xBB67A) k=1; /* |x|<sqrt(3) */ |
else {k=0;n+=1;ix -= 0x00100000;} |
SET_HIGH_WORD(ax,ix); |
/* compute s = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5) */ |
u = ax-bp[k]; /* bp[0]=1.0, bp[1]=1.5 */ |
v = C[1]/(ax+bp[k]); |
s = u*v; |
s_h = s; |
SET_LOW_WORD(s_h,0); |
/* t_h=ax+bp[k] High */ |
t_h = C[0]; |
SET_HIGH_WORD(t_h,((ix>>1)|0x20000000)+0x00080000+(k<<18)); |
t_l = ax - (t_h-bp[k]); |
s_l = v*((u-s_h*t_h)-s_h*t_l); |
/* compute log(ax) */ |
s2 = s*s; |
#ifdef DO_NOT_USE_THIS |
r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6))))); |
#else |
r1 = C[10]+s2*C[11]; s22=s2*s2; |
r2 = C[8]+s2*C[9]; s24=s22*s22; |
r3 = C[6]+s2*C[7]; s26=s24*s22; |
r = r3*s22 + r2*s24 + r1*s26; |
#endif |
r += s_l*(s_h+s); |
s2 = s_h*s_h; |
t_h = 3.0+s2+r; |
SET_LOW_WORD(t_h,0); |
t_l = r-((t_h-3.0)-s2); |
/* u+v = s*(1+...) */ |
u = s_h*t_h; |
v = s_l*t_h+t_l*s; |
/* 2/(3log2)*(s+...) */ |
p_h = u+v; |
SET_LOW_WORD(p_h,0); |
p_l = v-(p_h-u); |
z_h = C[22]*p_h; /* cp_h+cp_l = 2/(3*log2) */ |
z_l = C[23]*p_h+p_l*C[21]+dp_l[k]; |
/* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */ |
t = (double)n; |
t1 = (((z_h+z_l)+dp_h[k])+t); |
SET_LOW_WORD(t1,0); |
t2 = z_l-(((t1-t)-dp_h[k])-z_h); |
} |
s = C[1]; /* s (sign of result -ve**odd) = -1 else = 1 */ |
if(((((u_int32_t)hx>>31)-1)|(yisint-1))==0) |
s = -C[1];/* (-ve)**(odd int) */ |
/* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */ |
y1 = y; |
SET_LOW_WORD(y1,0); |
p_l = (y-y1)*t1+y*t2; |
p_h = y1*t1; |
z = p_l+p_h; |
EXTRACT_WORDS(j,i,z); |
if (j>=0x40900000) { /* z >= 1024 */ |
if(((j-0x40900000)|i)!=0) /* if z > 1024 */ |
return s*C[4]*C[4]; /* overflow */ |
else { |
if(p_l+C[20]>z-p_h) return s*C[4]*C[4]; /* overflow */ |
} |
} else if((j&0x7fffffff)>=0x4090cc00 ) { /* z <= -1075 */ |
if(((j-0xc090cc00)|i)!=0) /* z < -1075 */ |
return s*C[5]*C[5]; /* underflow */ |
else { |
if(p_l<=z-p_h) return s*C[5]*C[5]; /* underflow */ |
} |
} |
/* |
* compute 2**(p_h+p_l) |
*/ |
i = j&0x7fffffff; |
k = (i>>20)-0x3ff; |
n = 0; |
if(i>0x3fe00000) { /* if |z| > 0.5, set n = [z+0.5] */ |
n = j+(0x00100000>>(k+1)); |
k = ((n&0x7fffffff)>>20)-0x3ff; /* new k for n */ |
t = C[0]; |
SET_HIGH_WORD(t,n&~(0x000fffff>>k)); |
n = ((n&0x000fffff)|0x00100000)>>(20-k); |
if(j<0) n = -n; |
p_h -= t; |
} |
t = p_l+p_h; |
SET_LOW_WORD(t,0); |
u = t*C[18]; |
v = (p_l-(t-p_h))*C[17]+t*C[19]; |
z = u+v; |
w = v-(z-u); |
t = z*z; |
#ifdef DO_NOT_USE_THIS |
t1 = z - t*(C[12]+t*(C[13]+t*(C[14]+t*(C[15]+t*C[16])))); |
#else |
r_1 = C[15]+t*C[16]; t12 = t*t; |
r_2 = C[13]+t*C[14]; t14 = t12*t12; |
r_3 = t*C[12]; |
t1 = z - r_3 - t12*r_2 - t14*r_1; |
#endif |
r = (z*t1)/(t1-C[2])-(w+z*w); |
z = C[1]-(r-z); |
GET_HIGH_WORD(j,z); |
j += (n<<20); |
if((j>>20)<=0) z = scalbn(z,n); /* subnormal output */ |
else SET_HIGH_WORD(z,j); |
return s*z; |
} |
/programs/media/ac97snd/trunk/mp3dec/fdct.c |
---|
0,0 → 1,290 |
#include <math.h> |
static float coef32[31]; /* 32 pt dct coefs */ |
void fdct_init() /* gen coef for N=32 (31 coefs) */ |
{ |
int p, n, i, k; |
double t, pi; |
pi = 4.0 * atan(1.0); |
n = 16; |
k = 0; |
for (i = 0; i < 5; i++, n = n / 2) { |
for (p = 0; p < n; p++, k++) { |
t = (pi / (4 * n)) * (2 * p + 1); |
coef32[k] = (float) (0.50 / cos(t)); |
} |
} |
} |
static void forward_bf(int m, int n, float x[], float f[], float coef[]) |
{ |
int i, j, n2; |
int p, q, p0, k; |
p0 = 0; |
n2 = n >> 1; |
for (i = 0; i < m; i++, p0 += n) { |
k = 0; |
p = p0; |
q = p + n - 1; |
for (j = 0; j < n2; j++, p++, q--, k++) { |
f[p] = x[p] + x[q]; |
f[n2 + p] = coef[k] * (x[p] - x[q]); |
} |
} |
} |
/*------------------------------------------------------------*/ |
static void back_bf(int m, int n, float x[], float f[]) |
{ |
int i, j, n2, n21; |
int p, q, p0; |
p0 = 0; |
n2 = n >> 1; |
n21 = n2 - 1; |
for (i = 0; i < m; i++, p0 += n) { |
p = p0; |
q = p0; |
for (j = 0; j < n2; j++, p += 2, q++) |
f[p] = x[q]; |
p = p0 + 1; |
for (j = 0; j < n21; j++, p += 2, q++) |
f[p] = x[q] + x[q + 1]; |
f[p] = x[q]; |
} |
} |
/*------------------------------------------------------------*/ |
extern int m_enableEQ; |
extern float m_equalizer[32]; |
void fdct32(float x[], float c[]) |
{ |
float a[32]; /* ping pong buffers */ |
float b[32]; |
int p, q; |
if (m_enableEQ) { |
for (p = 0; p < 32; p++) x[p] *= m_equalizer[p]; |
} |
/* special first stage */ |
for (p = 0, q = 31; p < 16; p++, q--) { |
a[p] = x[p] + x[q]; |
a[16 + p] = coef32[p] * (x[p] - x[q]); |
} |
forward_bf(2, 16, a, b, coef32 + 16); |
forward_bf(4, 8, b, a, coef32 + 16 + 8); |
forward_bf(8, 4, a, b, coef32 + 16 + 8 + 4); |
forward_bf(16, 2, b, a, coef32 + 16 + 8 + 4 + 2); |
back_bf(8, 4, a, b); |
back_bf(4, 8, b, a); |
back_bf(2, 16, a, b); |
back_bf(1, 32, b, c); |
} |
/*------------------------------------------------------------*/ |
void fdct32_dual(float x[], float c[]) |
{ |
float a[32]; /* ping pong buffers */ |
float b[32]; |
int p, pp, qq; |
if (m_enableEQ) { |
for (p = 0; p < 32; p++) x[p] *= m_equalizer[p]; |
} |
/* special first stage for dual chan (interleaved x) */ |
pp = 0; |
qq = 2 * 31; |
for (p = 0; p < 16; p++, pp += 2, qq -= 2) |
{ |
a[p] = x[pp] + x[qq]; |
a[16 + p] = coef32[p] * (x[pp] - x[qq]); |
} |
forward_bf(2, 16, a, b, coef32 + 16); |
forward_bf(4, 8, b, a, coef32 + 16 + 8); |
forward_bf(8, 4, a, b, coef32 + 16 + 8 + 4); |
forward_bf(16, 2, b, a, coef32 + 16 + 8 + 4 + 2); |
back_bf(8, 4, a, b); |
back_bf(4, 8, b, a); |
back_bf(2, 16, a, b); |
back_bf(1, 32, b, c); |
} |
/*---------------convert dual to mono------------------------------*/ |
void fdct32_dual_mono(float x[], float c[]) |
{ |
float a[32]; /* ping pong buffers */ |
float b[32]; |
float t1, t2; |
int p, pp, qq; |
/* special first stage */ |
pp = 0; |
qq = 2 * 31; |
for (p = 0; p < 16; p++, pp += 2, qq -= 2) |
{ |
t1 = 0.5F * (x[pp] + x[pp + 1]); |
t2 = 0.5F * (x[qq] + x[qq + 1]); |
a[p] = t1 + t2; |
a[16 + p] = coef32[p] * (t1 - t2); |
} |
forward_bf(2, 16, a, b, coef32 + 16); |
forward_bf(4, 8, b, a, coef32 + 16 + 8); |
forward_bf(8, 4, a, b, coef32 + 16 + 8 + 4); |
forward_bf(16, 2, b, a, coef32 + 16 + 8 + 4 + 2); |
back_bf(8, 4, a, b); |
back_bf(4, 8, b, a); |
back_bf(2, 16, a, b); |
back_bf(1, 32, b, c); |
} |
/*------------------------------------------------------------*/ |
/*---------------- 16 pt fdct -------------------------------*/ |
void fdct16(float x[], float c[]) |
{ |
float a[16]; /* ping pong buffers */ |
float b[16]; |
int p, q; |
/* special first stage (drop highest sb) */ |
a[0] = x[0]; |
a[8] = coef32[16] * x[0]; |
for (p = 1, q = 14; p < 8; p++, q--) |
{ |
a[p] = x[p] + x[q]; |
a[8 + p] = coef32[16 + p] * (x[p] - x[q]); |
} |
forward_bf(2, 8, a, b, coef32 + 16 + 8); |
forward_bf(4, 4, b, a, coef32 + 16 + 8 + 4); |
forward_bf(8, 2, a, b, coef32 + 16 + 8 + 4 + 2); |
back_bf(4, 4, b, a); |
back_bf(2, 8, a, b); |
back_bf(1, 16, b, c); |
} |
/*------------------------------------------------------------*/ |
/*---------------- 16 pt fdct dual chan---------------------*/ |
void fdct16_dual(float x[], float c[]) |
{ |
float a[16]; /* ping pong buffers */ |
float b[16]; |
int p, pp, qq; |
/* special first stage for interleaved input */ |
a[0] = x[0]; |
a[8] = coef32[16] * x[0]; |
pp = 2; |
qq = 2 * 14; |
for (p = 1; p < 8; p++, pp += 2, qq -= 2) |
{ |
a[p] = x[pp] + x[qq]; |
a[8 + p] = coef32[16 + p] * (x[pp] - x[qq]); |
} |
forward_bf(2, 8, a, b, coef32 + 16 + 8); |
forward_bf(4, 4, b, a, coef32 + 16 + 8 + 4); |
forward_bf(8, 2, a, b, coef32 + 16 + 8 + 4 + 2); |
back_bf(4, 4, b, a); |
back_bf(2, 8, a, b); |
back_bf(1, 16, b, c); |
} |
/*------------------------------------------------------------*/ |
/*---------------- 16 pt fdct dual to mono-------------------*/ |
void fdct16_dual_mono(float x[], float c[]) |
{ |
float a[16]; /* ping pong buffers */ |
float b[16]; |
float t1, t2; |
int p, pp, qq; |
/* special first stage */ |
a[0] = 0.5F * (x[0] + x[1]); |
a[8] = coef32[16] * a[0]; |
pp = 2; |
qq = 2 * 14; |
for (p = 1; p < 8; p++, pp += 2, qq -= 2) |
{ |
t1 = 0.5F * (x[pp] + x[pp + 1]); |
t2 = 0.5F * (x[qq] + x[qq + 1]); |
a[p] = t1 + t2; |
a[8 + p] = coef32[16 + p] * (t1 - t2); |
} |
forward_bf(2, 8, a, b, coef32 + 16 + 8); |
forward_bf(4, 4, b, a, coef32 + 16 + 8 + 4); |
forward_bf(8, 2, a, b, coef32 + 16 + 8 + 4 + 2); |
back_bf(4, 4, b, a); |
back_bf(2, 8, a, b); |
back_bf(1, 16, b, c); |
} |
/*------------------------------------------------------------*/ |
/*---------------- 8 pt fdct -------------------------------*/ |
void fdct8(float x[], float c[]) |
{ |
float a[8]; /* ping pong buffers */ |
float b[8]; |
int p, q; |
/* special first stage */ |
b[0] = x[0] + x[7]; |
b[4] = coef32[16 + 8] * (x[0] - x[7]); |
for (p = 1, q = 6; p < 4; p++, q--) |
{ |
b[p] = x[p] + x[q]; |
b[4 + p] = coef32[16 + 8 + p] * (x[p] - x[q]); |
} |
forward_bf(2, 4, b, a, coef32 + 16 + 8 + 4); |
forward_bf(4, 2, a, b, coef32 + 16 + 8 + 4 + 2); |
back_bf(2, 4, b, a); |
back_bf(1, 8, a, c); |
} |
/*---------------- 8 pt fdct dual chan---------------------*/ |
void fdct8_dual(float x[], float c[]) |
{ |
float a[8]; /* ping pong buffers */ |
float b[8]; |
int p, pp, qq; |
/* special first stage for interleaved input */ |
b[0] = x[0] + x[14]; |
b[4] = coef32[16 + 8] * (x[0] - x[14]); |
pp = 2; |
qq = 2 * 6; |
for (p = 1; p < 4; p++, pp += 2, qq -= 2) |
{ |
b[p] = x[pp] + x[qq]; |
b[4 + p] = coef32[16 + 8 + p] * (x[pp] - x[qq]); |
} |
forward_bf(2, 4, b, a, coef32 + 16 + 8 + 4); |
forward_bf(4, 2, a, b, coef32 + 16 + 8 + 4 + 2); |
back_bf(2, 4, b, a); |
back_bf(1, 8, a, c); |
} |
/*---------------- 8 pt fdct dual to mono---------------------*/ |
void fdct8_dual_mono(float x[], float c[]) |
{ |
float a[8]; /* ping pong buffers */ |
float b[8]; |
float t1, t2; |
int p, pp, qq; |
/* special first stage */ |
t1 = 0.5F * (x[0] + x[1]); |
t2 = 0.5F * (x[14] + x[15]); |
b[0] = t1 + t2; |
b[4] = coef32[16 + 8] * (t1 - t2); |
pp = 2; |
qq = 2 * 6; |
for (p = 1; p < 4; p++, pp += 2, qq -= 2) |
{ |
t1 = 0.5F * (x[pp] + x[pp + 1]); |
t2 = 0.5F * (x[qq] + x[qq + 1]); |
b[p] = t1 + t2; |
b[4 + p] = coef32[16 + 8 + p] * (t1 - t2); |
} |
forward_bf(2, 4, b, a, coef32 + 16 + 8 + 4); |
forward_bf(4, 2, a, b, coef32 + 16 + 8 + 4 + 2); |
back_bf(2, 4, b, a); |
back_bf(1, 8, a, c); |
} |
/programs/media/ac97snd/trunk/mp3dec/imdct.c |
---|
0,0 → 1,222 |
#include <math.h> |
/*------ 18 point xform -------*/ |
static float w[18]; |
static float w2[9]; |
static float coef[9][4]; |
static float v[6]; |
static float v2[3]; |
static float coef87; |
/* |
typedef struct |
{ |
float *w; |
float *w2; |
void *coef; |
} |
IMDCT_INIT_BLOCK; |
static IMDCT_INIT_BLOCK imdct_info_18 = |
{w, w2, coef}; |
static IMDCT_INIT_BLOCK imdct_info_6 = |
{v, v2, &coef87}; |
*/ |
/*=============================================================*/ |
void imdct_init() |
{ |
int k, p, n; |
double t, pi; |
// IMDCT_INIT_BLOCK *addr; |
// float *w, *w2; |
// float *v, *v2, *coef87; |
/*--- 18 point --*/ |
// addr = imdct_init_addr_18(); |
// w = addr->w; |
// w2 = addr->w2; |
// coef = addr->coef; |
/*----*/ |
n = 18; |
pi = 4.0 * atan(1.0); |
t = pi / (4 * n); |
for (p = 0; p < n; p++) |
w[p] = (float) (2.0 * cos(t * (2 * p + 1))); |
for (p = 0; p < 9; p++) |
w2[p] = (float) (2.0 *cos(2 * t * (2 * p + 1))); |
t = pi / (2 * n); |
for (k = 0; k < 9; k++) |
{ |
for (p = 0; p < 4; p++) |
coef[k][p] = (float) (cos(t * (2 * k) * (2 * p + 1))); |
} |
/*--- 6 point */ |
// addr = imdct_init_addr_6(); |
// v = addr->w; |
// v2 = addr->w2; |
// coef87 = addr->coef; |
/*----*/ |
n = 6; |
pi = 4.0 * atan(1.0); |
t = pi / (4 * n); |
for (p = 0; p < n; p++) |
v[p] = (float) (2.0 *cos(t * (2 * p + 1))); |
for (p = 0; p < 3; p++) |
v2[p] = (float) (2.0 *cos(2 * t * (2 * p + 1))); |
t = pi / (2 * n); |
k = 1; |
p = 0; |
coef87 = (float) (cos(t * (2 * k) * (2 * p + 1))); |
/* adjust scaling to save a few mults */ |
for (p = 0; p < 6; p++) |
v[p] = v[p] / 2.0f; |
coef87 = (float) (2.0 * coef87); |
} |
/*--------------------------------------------------------------------*/ |
void imdct18(float f[18]) /* 18 point */ |
{ |
int p; |
float a[9], b[9]; |
float ap, bp, a8p, b8p; |
float g1, g2; |
for (p = 0; p < 4; p++) |
{ |
g1 = w[p] * f[p]; |
g2 = w[17 - p] * f[17 - p]; |
ap = g1 + g2; // a[p] |
bp = w2[p] * (g1 - g2); // b[p] |
g1 = w[8 - p] * f[8 - p]; |
g2 = w[9 + p] * f[9 + p]; |
a8p = g1 + g2; // a[8-p] |
b8p = w2[8 - p] * (g1 - g2); // b[8-p] |
a[p] = ap + a8p; |
a[5 + p] = ap - a8p; |
b[p] = bp + b8p; |
b[5 + p] = bp - b8p; |
} |
g1 = w[p] * f[p]; |
g2 = w[17 - p] * f[17 - p]; |
a[p] = g1 + g2; |
b[p] = w2[p] * (g1 - g2); |
f[0] = 0.5f * (a[0] + a[1] + a[2] + a[3] + a[4]); |
f[1] = 0.5f * (b[0] + b[1] + b[2] + b[3] + b[4]); |
f[2] = coef[1][0] * a[5] + coef[1][1] * a[6] + coef[1][2] * a[7] |
+ coef[1][3] * a[8]; |
f[3] = coef[1][0] * b[5] + coef[1][1] * b[6] + coef[1][2] * b[7] |
+ coef[1][3] * b[8] - f[1]; |
f[1] = f[1] - f[0]; |
f[2] = f[2] - f[1]; |
f[4] = coef[2][0] * a[0] + coef[2][1] * a[1] + coef[2][2] * a[2] |
+ coef[2][3] * a[3] - a[4]; |
f[5] = coef[2][0] * b[0] + coef[2][1] * b[1] + coef[2][2] * b[2] |
+ coef[2][3] * b[3] - b[4] - f[3]; |
f[3] = f[3] - f[2]; |
f[4] = f[4] - f[3]; |
f[6] = coef[3][0] * (a[5] - a[7] - a[8]); |
f[7] = coef[3][0] * (b[5] - b[7] - b[8]) - f[5]; |
f[5] = f[5] - f[4]; |
f[6] = f[6] - f[5]; |
f[8] = coef[4][0] * a[0] + coef[4][1] * a[1] + coef[4][2] * a[2] |
+ coef[4][3] * a[3] + a[4]; |
f[9] = coef[4][0] * b[0] + coef[4][1] * b[1] + coef[4][2] * b[2] |
+ coef[4][3] * b[3] + b[4] - f[7]; |
f[7] = f[7] - f[6]; |
f[8] = f[8] - f[7]; |
f[10] = coef[5][0] * a[5] + coef[5][1] * a[6] + coef[5][2] * a[7] |
+ coef[5][3] * a[8]; |
f[11] = coef[5][0] * b[5] + coef[5][1] * b[6] + coef[5][2] * b[7] |
+ coef[5][3] * b[8] - f[9]; |
f[9] = f[9] - f[8]; |
f[10] = f[10] - f[9]; |
f[12] = 0.5f * (a[0] + a[2] + a[3]) - a[1] - a[4]; |
f[13] = 0.5f * (b[0] + b[2] + b[3]) - b[1] - b[4] - f[11]; |
f[11] = f[11] - f[10]; |
f[12] = f[12] - f[11]; |
f[14] = coef[7][0] * a[5] + coef[7][1] * a[6] + coef[7][2] * a[7] |
+ coef[7][3] * a[8]; |
f[15] = coef[7][0] * b[5] + coef[7][1] * b[6] + coef[7][2] * b[7] |
+ coef[7][3] * b[8] - f[13]; |
f[13] = f[13] - f[12]; |
f[14] = f[14] - f[13]; |
f[16] = coef[8][0] * a[0] + coef[8][1] * a[1] + coef[8][2] * a[2] |
+ coef[8][3] * a[3] + a[4]; |
f[17] = coef[8][0] * b[0] + coef[8][1] * b[1] + coef[8][2] * b[2] |
+ coef[8][3] * b[3] + b[4] - f[15]; |
f[15] = f[15] - f[14]; |
f[16] = f[16] - f[15]; |
f[17] = f[17] - f[16]; |
} |
/*--------------------------------------------------------------------*/ |
/* does 3, 6 pt dct. changes order from f[i][window] c[window][i] */ |
void imdct6_3(float f[]) /* 6 point */ |
{ |
int w; |
float buf[18]; |
float *a, *c; // b[i] = a[3+i] |
float g1, g2; |
float a02, b02; |
c = f; |
a = buf; |
for (w = 0; w < 3; w++) |
{ |
g1 = v[0] * f[3 * 0]; |
g2 = v[5] * f[3 * 5]; |
a[0] = g1 + g2; |
a[3 + 0] = v2[0] * (g1 - g2); |
g1 = v[1] * f[3 * 1]; |
g2 = v[4] * f[3 * 4]; |
a[1] = g1 + g2; |
a[3 + 1] = v2[1] * (g1 - g2); |
g1 = v[2] * f[3 * 2]; |
g2 = v[3] * f[3 * 3]; |
a[2] = g1 + g2; |
a[3 + 2] = v2[2] * (g1 - g2); |
a += 6; |
f++; |
} |
a = buf; |
for (w = 0; w < 3; w++) |
{ |
a02 = (a[0] + a[2]); |
b02 = (a[3 + 0] + a[3 + 2]); |
c[0] = a02 + a[1]; |
c[1] = b02 + a[3 + 1]; |
c[2] = coef87 * (a[0] - a[2]); |
c[3] = coef87 * (a[3 + 0] - a[3 + 2]) - c[1]; |
c[1] = c[1] - c[0]; |
c[2] = c[2] - c[1]; |
c[4] = a02 - a[1] - a[1]; |
c[5] = b02 - a[3 + 1] - a[3 + 1] - c[3]; |
c[3] = c[3] - c[2]; |
c[4] = c[4] - c[3]; |
c[5] = c[5] - c[4]; |
a += 6; |
c += 6; |
} |
} |
/programs/media/ac97snd/trunk/mp3dec/l1dec.c |
---|
0,0 → 1,202 |
#include "bstream.h" |
#include "mp3dec.h" |
extern MPEG_DECODE_OPTION m_option; |
extern float m_sample[2304]; |
extern int m_nsb_limit; |
extern SBT_PROC m_sbt_proc; |
extern int m_max_sb; |
extern int m_stereo_sb; |
extern int m_bat[4][16]; |
extern int m_ballo[64]; |
extern unsigned int m_samp_dispatch[66]; |
extern float m_c_value[64]; |
extern unsigned int m_sf_dispatch[66]; |
extern float m_sf_table[64]; |
extern float m_cs_factor[3][64]; |
float m_look_c_valueL1[18]; |
float *m_cs_factorL1 = m_cs_factor[0]; |
int m_nbatL1; |
int m_bit_skip; |
static const int look_joint[16] = |
{ /* lookup stereo sb's by mode+ext */ |
64, 64, 64, 64, /* stereo */ |
2 * 4, 2 * 8, 2 * 12, 2 * 16, /* joint */ |
64, 64, 64, 64, /* dual */ |
32, 32, 32, 32, /* mono */ |
}; |
static const int bat_bit_masterL1[] = |
{ |
0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 |
}; |
void unpack_baL1(); |
void unpack_sfL1(); |
void unpack_sampL1(); |
void L1decode_frame(MPEG_HEADER* h, byte* mpeg, byte* pcm) |
{ |
int crc_size; |
crc_size = (h->error_prot) ? 2 : 0; |
bitget_init(mpeg + 4 + crc_size); |
m_stereo_sb = look_joint[(h->mode << 2) + h->mode_ext]; |
unpack_baL1(); /* unpack bit allocation */ |
unpack_sfL1(); /* unpack scale factor */ |
unpack_sampL1(); /* unpack samples */ |
m_sbt_proc(m_sample, pcm, 12); |
} |
void unpack_baL1() |
{ |
int j; |
int nstereo; |
m_bit_skip = 0; |
nstereo = m_stereo_sb; |
for (j = 0; j < m_nbatL1; j++) |
{ |
bitget_check(4); |
m_ballo[j] = m_samp_dispatch[j] = mac_bitget(4); |
if (j >= m_nsb_limit) |
m_bit_skip += bat_bit_masterL1[m_samp_dispatch[j]]; |
m_c_value[j] = m_look_c_valueL1[m_samp_dispatch[j]]; |
if (--nstereo < 0) |
{ |
m_ballo[j + 1] = m_ballo[j]; |
// flag as joint |
m_samp_dispatch[j] += 15; |
// flag for sf |
m_samp_dispatch[j + 1] = m_samp_dispatch[j]; |
m_c_value[j + 1] = m_c_value[j]; |
j++; |
} |
} |
// terminate with bit skip and end |
m_samp_dispatch[m_nsb_limit] = 31; |
m_samp_dispatch[j] = 30; |
} |
// unpack scale factor |
// combine dequant and scale factors |
void unpack_sfL1() |
{ |
int i; |
for (i = 0; i < m_nbatL1; i++) |
{ |
if (m_ballo[i]) |
{ |
bitget_check(6); |
m_cs_factorL1[i] = m_c_value[i] * m_sf_table[mac_bitget(6)]; |
} |
} |
} |
// unpack samples |
#define UNPACKL1_N(n) \ |
s[k] = m_cs_factorL1[k]*(bitget(n)-((1 << n-1) -1)); \ |
goto dispatch; |
#define UNPACKL1J_N(n) \ |
tmp = (bitget(n)-((1 << n-1) -1)); \ |
s[k] = m_cs_factorL1[k]*tmp; \ |
s[k+1] = m_cs_factorL1[k+1]*tmp; \ |
k++; \ |
goto dispatch; |
void unpack_sampL1() |
{ |
int j, k; |
float *s; |
long tmp; |
s = m_sample; |
for (j = 0; j < 12; j++) |
{ |
k = -1; |
dispatch: |
switch (m_samp_dispatch[++k]) |
{ |
case 0: |
s[k] = 0.0F; |
goto dispatch; |
case 1: |
UNPACKL1_N(2) /* 3 levels */ |
case 2: |
UNPACKL1_N(3) /* 7 levels */ |
case 3: |
UNPACKL1_N(4) /* 15 levels */ |
case 4: |
UNPACKL1_N(5) /* 31 levels */ |
case 5: |
UNPACKL1_N(6) /* 63 levels */ |
case 6: |
UNPACKL1_N(7) /* 127 levels */ |
case 7: |
UNPACKL1_N(8) /* 255 levels */ |
case 8: |
UNPACKL1_N(9) /* 511 levels */ |
case 9: |
UNPACKL1_N(10) /* 1023 levels */ |
case 10: |
UNPACKL1_N(11) /* 2047 levels */ |
case 11: |
UNPACKL1_N(12) /* 4095 levels */ |
case 12: |
UNPACKL1_N(13) /* 8191 levels */ |
case 13: |
UNPACKL1_N(14) /* 16383 levels */ |
case 14: |
UNPACKL1_N(15) /* 32767 levels */ |
/* -- joint ---- */ |
case 15 + 0: |
s[k + 1] = s[k] = 0.0F; |
k++; /* skip right chan dispatch */ |
goto dispatch; |
/* -- joint ---- */ |
case 15 + 1: |
UNPACKL1J_N(2) /* 3 levels */ |
case 15 + 2: |
UNPACKL1J_N(3) /* 7 levels */ |
case 15 + 3: |
UNPACKL1J_N(4) /* 15 levels */ |
case 15 + 4: |
UNPACKL1J_N(5) /* 31 levels */ |
case 15 + 5: |
UNPACKL1J_N(6) /* 63 levels */ |
case 15 + 6: |
UNPACKL1J_N(7) /* 127 levels */ |
case 15 + 7: |
UNPACKL1J_N(8) /* 255 levels */ |
case 15 + 8: |
UNPACKL1J_N(9) /* 511 levels */ |
case 15 + 9: |
UNPACKL1J_N(10) /* 1023 levels */ |
case 15 + 10: |
UNPACKL1J_N(11) /* 2047 levels */ |
case 15 + 11: |
UNPACKL1J_N(12) /* 4095 levels */ |
case 15 + 12: |
UNPACKL1J_N(13) /* 8191 levels */ |
case 15 + 13: |
UNPACKL1J_N(14) /* 16383 levels */ |
case 15 + 14: |
UNPACKL1J_N(15) /* 32767 levels */ |
/* -- end of dispatch -- */ |
case 31: |
bitget_skip(m_bit_skip); |
case 30: |
s += 64; |
} /* end switch */ |
} /* end j loop */ |
} |
/programs/media/ac97snd/trunk/mp3dec/l1init.c |
---|
0,0 → 1,87 |
#include "bstream.h" |
#include "mp3dec.h" |
#include <math.h> |
extern MPEG_DECODE_OPTION m_option; |
extern int m_frequency; |
extern float m_sample[2304]; |
extern int m_nsb_limit; |
extern int m_max_sb; |
extern int m_stereo_sb; |
extern SBT_PROC m_sbt_proc; |
extern float m_look_c_valueL1[18]; |
extern int m_nbatL1; |
//extern "sbt.c" |
void sbt_mono(float *sample, signed short *pcm, int ch); |
void sbt_dual(float *sample, signed short *pcm, int ch); |
void sbt16_mono(float *sample, signed short *pcm, int ch); |
void sbt16_dual(float *sample, signed short *pcm, int ch); |
void sbt8_mono(float *sample, signed short *pcm, int ch); |
void sbt8_dual(float *sample, signed short *pcm, int ch); |
void sbtB_mono(float *sample, unsigned char *pcm, int ch); |
void sbtB_dual(float *sample, unsigned char *pcm, int ch); |
void sbtB16_mono(float *sample, unsigned char *pcm, int ch); |
void sbtB16_dual(float *sample, unsigned char *pcm, int ch); |
void sbtB8_mono(float *sample, unsigned char *pcm, int ch); |
void sbtB8_dual(float *sample, unsigned char *pcm, int ch); |
static const SBT_PROC sbt_table[2][3][2] = |
{ |
sbt_mono, |
sbt_dual, |
sbt16_mono, |
sbt16_dual, |
sbt8_mono, |
sbt8_dual, |
sbtB_mono, |
sbtB_dual, |
sbtB16_mono, |
sbtB16_dual, |
sbtB8_mono, |
sbtB8_dual, |
}; |
void L1table_init() |
{ |
int i, stepL1; |
for (stepL1 = 4, i = 1; i < 16; i++, stepL1 <<= 1) { |
m_look_c_valueL1[i] = (float) (2.0 / (stepL1 - 1)); |
} |
} |
int L1decode_start(MPEG_HEADER* h) |
{ |
int i, k, bit_code, limit; |
/*- caller limit -*/ |
m_nbatL1 = 32; |
m_max_sb = m_nbatL1; |
m_nsb_limit = (m_option.freqLimit * 64L + m_frequency / 2) / m_frequency; |
/*---- limit = 0.94*(32>>reduction_code); ----*/ |
limit = (32 >> m_option.reduction); |
if (limit > 8) |
limit--; |
if (m_nsb_limit > limit) |
m_nsb_limit = limit; |
if (m_nsb_limit > m_max_sb) |
m_nsb_limit = m_max_sb; |
if (h->mode != 3) { /* adjust for 2 channel modes */ |
m_nbatL1 *= 2; |
m_max_sb *= 2; |
m_nsb_limit *= 2; |
} |
/* set sbt function */ |
bit_code = (m_option.convert & 8) ? 1 : 0; |
k = (h->mode == 3) ? 0 : (1 + m_option.convert); |
m_sbt_proc = sbt_table[bit_code][m_option.reduction][k];//[2][3][2] |
for (i = 0; i < 768; i++) |
m_sample[i] = 0.0F; |
return 1; |
} |
/programs/media/ac97snd/trunk/mp3dec/l2dec.c |
---|
0,0 → 1,306 |
#include "bstream.h" |
#include "mp3dec.h" |
extern float m_sample[2304]; |
extern int m_nsb_limit; |
int m_stereo_sb; |
int m_max_sb; |
SBT_PROC m_sbt_proc; |
float m_sf_table[64]; |
float m_look_c_valueL2[18]; |
char m_group3_table[32][3]; |
char m_group5_table[128][3]; |
short m_group9_table[1024][3]; |
int m_nbat[4];// = {3, 8, 12, 7}; |
int m_bat[4][16]; |
int m_ballo[64]; |
uint m_samp_dispatch[66]; |
float m_c_value[64]; |
uint m_sf_dispatch[66]; |
float m_cs_factor[3][64]; |
int m_bit_skip; |
static const int look_joint[16] = |
{ /* lookup stereo sb's by mode+ext */ |
64, 64, 64, 64, /* stereo */ |
2 * 4, 2 * 8, 2 * 12, 2 * 16, /* joint */ |
64, 64, 64, 64, /* dual */ |
32, 32, 32, 32, /* mono */ |
}; |
static const int bat_bit_masterL2[] = |
{ |
0, 5, 7, 9, 10, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48 |
}; |
void unpack_ba(); |
void unpack_sfs(); |
void unpack_sf(); |
void unpack_samp(); |
void L2decode_frame(MPEG_HEADER* h, byte* mpeg, byte* pcm) |
{ |
int crc_size; |
crc_size = (h->error_prot) ? 2 : 0; |
bitget_init(mpeg + 4 + crc_size); |
m_stereo_sb = look_joint[(h->mode << 2) + h->mode_ext]; |
unpack_ba(); // unpack bit allocation |
unpack_sfs(); // unpack scale factor selectors |
unpack_sf(); // unpack scale factor |
unpack_samp(); // unpack samples |
m_sbt_proc(m_sample, pcm, 36); |
} |
void unpack_ba() |
{ |
int i, j, k; |
int nstereo; |
int nbit[4] = {4, 4, 3, 2}; |
m_bit_skip = 0; |
nstereo = m_stereo_sb; |
k = 0; |
for (i = 0; i < 4; i++) { |
for (j = 0; j < m_nbat[i]; j++, k++) { |
bitget_check(4); |
m_ballo[k] = m_samp_dispatch[k] = m_bat[i][mac_bitget(nbit[i])]; |
if (k >= m_nsb_limit) |
m_bit_skip += bat_bit_masterL2[m_samp_dispatch[k]]; |
m_c_value[k] = m_look_c_valueL2[m_samp_dispatch[k]]; |
if (--nstereo < 0) { |
m_ballo[k + 1] = m_ballo[k]; |
m_samp_dispatch[k] += 18; /* flag as joint */ |
m_samp_dispatch[k + 1] = m_samp_dispatch[k]; /* flag for sf */ |
m_c_value[k + 1] = m_c_value[k]; |
k++; |
j++; |
} |
} |
} |
m_samp_dispatch[m_nsb_limit] = 37; /* terminate the dispatcher with skip */ |
m_samp_dispatch[k] = 36; /* terminate the dispatcher */ |
} |
void unpack_sfs() /* unpack scale factor selectors */ |
{ |
int i; |
for (i = 0; i < m_max_sb; i++) { |
bitget_check(2); |
if (m_ballo[i]) |
m_sf_dispatch[i] = mac_bitget(2); |
else |
m_sf_dispatch[i] = 4; /* no allo */ |
} |
m_sf_dispatch[i] = 5; /* terminate dispatcher */ |
} |
void unpack_sf() /* unpack scale factor */ |
{ /* combine dequant and scale factors */ |
int i; |
i = -1; |
dispatch:switch (m_sf_dispatch[++i]) |
{ |
case 0: /* 3 factors 012 */ |
bitget_check(18); |
m_cs_factor[0][i] = m_c_value[i] * m_sf_table[mac_bitget(6)]; |
m_cs_factor[1][i] = m_c_value[i] * m_sf_table[mac_bitget(6)]; |
m_cs_factor[2][i] = m_c_value[i] * m_sf_table[mac_bitget(6)]; |
goto dispatch; |
case 1: /* 2 factors 002 */ |
bitget_check(12); |
m_cs_factor[1][i] = m_cs_factor[0][i] = m_c_value[i] * m_sf_table[mac_bitget(6)]; |
m_cs_factor[2][i] = m_c_value[i] * m_sf_table[mac_bitget(6)]; |
goto dispatch; |
case 2: /* 1 factor 000 */ |
bitget_check(6); |
m_cs_factor[2][i] = m_cs_factor[1][i] = m_cs_factor[0][i] = |
m_c_value[i] * m_sf_table[mac_bitget(6)]; |
goto dispatch; |
case 3: /* 2 factors 022 */ |
bitget_check(12); |
m_cs_factor[0][i] = m_c_value[i] * m_sf_table[mac_bitget(6)]; |
m_cs_factor[2][i] = m_cs_factor[1][i] = m_c_value[i] * m_sf_table[mac_bitget(6)]; |
goto dispatch; |
case 4: /* no allo */ |
/*-- m_cs_factor[2][i] = m_cs_factor[1][i] = m_cs_factor[0][i] = 0.0; --*/ |
goto dispatch; |
case 5: /* all done */ |
; |
} /* end switch */ |
} |
/*-------------------------------------------------------------------------*/ |
#define UNPACK_N(n) s[k] = m_cs_factor[i][k]*(bitget(n)-((1 << n-1) -1)); \ |
s[k+64] = m_cs_factor[i][k]*(bitget(n)-((1 << n-1) -1)); \ |
s[k+128] = m_cs_factor[i][k]*(bitget(n)-((1 << n-1) -1)); \ |
goto dispatch; |
#define UNPACK_N2(n) bitget_check(3*n); \ |
s[k] = m_cs_factor[i][k]*(mac_bitget(n)-((1 << n-1) -1)); \ |
s[k+64] = m_cs_factor[i][k]*(mac_bitget(n)-((1 << n-1) -1)); \ |
s[k+128] = m_cs_factor[i][k]*(mac_bitget(n)-((1 << n-1) -1)); \ |
goto dispatch; |
#define UNPACK_N3(n) bitget_check(2*n); \ |
s[k] = m_cs_factor[i][k]*(mac_bitget(n)-((1 << n-1) -1)); \ |
s[k+64] = m_cs_factor[i][k]*(mac_bitget(n)-((1 << n-1) -1)); \ |
bitget_check(n); \ |
s[k+128] = m_cs_factor[i][k]*(mac_bitget(n)-((1 << n-1) -1)); \ |
goto dispatch; |
#define UNPACKJ_N(n) tmp = (bitget(n)-((1 << n-1) -1)); \ |
s[k] = m_cs_factor[i][k]*tmp; \ |
s[k+1] = m_cs_factor[i][k+1]*tmp; \ |
tmp = (bitget(n)-((1 << n-1) -1)); \ |
s[k+64] = m_cs_factor[i][k]*tmp; \ |
s[k+64+1] = m_cs_factor[i][k+1]*tmp; \ |
tmp = (bitget(n)-((1 << n-1) -1)); \ |
s[k+128] = m_cs_factor[i][k]*tmp; \ |
s[k+128+1] = m_cs_factor[i][k+1]*tmp; \ |
k++; /* skip right chan dispatch */ \ |
goto dispatch; |
/*-------------------------------------------------------------------------*/ |
void unpack_samp() /* unpack samples */ |
{ |
int i, j, k; |
float *s; |
int n; |
long tmp; |
s = m_sample; |
for (i = 0; i < 3; i++) |
{ /* 3 groups of scale factors */ |
for (j = 0; j < 4; j++) |
{ |
k = -1; |
dispatch:switch (m_samp_dispatch[++k]) |
{ |
case 0: |
s[k + 128] = s[k + 64] = s[k] = 0.0F; |
goto dispatch; |
case 1: /* 3 levels grouped 5 bits */ |
bitget_check(5); |
n = mac_bitget(5); |
s[k] = m_cs_factor[i][k] * m_group3_table[n][0]; |
s[k + 64] = m_cs_factor[i][k] * m_group3_table[n][1]; |
s[k + 128] = m_cs_factor[i][k] * m_group3_table[n][2]; |
goto dispatch; |
case 2: /* 5 levels grouped 7 bits */ |
bitget_check(7); |
n = mac_bitget(7); |
s[k] = m_cs_factor[i][k] * m_group5_table[n][0]; |
s[k + 64] = m_cs_factor[i][k] * m_group5_table[n][1]; |
s[k + 128] = m_cs_factor[i][k] * m_group5_table[n][2]; |
goto dispatch; |
case 3: |
UNPACK_N2(3) /* 7 levels */ |
case 4: /* 9 levels grouped 10 bits */ |
bitget_check(10); |
n = mac_bitget(10); |
s[k] = m_cs_factor[i][k] * m_group9_table[n][0]; |
s[k + 64] = m_cs_factor[i][k] * m_group9_table[n][1]; |
s[k + 128] = m_cs_factor[i][k] * m_group9_table[n][2]; |
goto dispatch; |
case 5: |
UNPACK_N2(4) /* 15 levels */ |
case 6: |
UNPACK_N2(5) /* 31 levels */ |
case 7: |
UNPACK_N2(6) /* 63 levels */ |
case 8: |
UNPACK_N2(7) /* 127 levels */ |
case 9: |
UNPACK_N2(8) /* 255 levels */ |
case 10: |
UNPACK_N3(9) /* 511 levels */ |
case 11: |
UNPACK_N3(10) /* 1023 levels */ |
case 12: |
UNPACK_N3(11) /* 2047 levels */ |
case 13: |
UNPACK_N3(12) /* 4095 levels */ |
case 14: |
UNPACK_N(13) /* 8191 levels */ |
case 15: |
UNPACK_N(14) /* 16383 levels */ |
case 16: |
UNPACK_N(15) /* 32767 levels */ |
case 17: |
UNPACK_N(16) /* 65535 levels */ |
/* -- joint ---- */ |
case 18 + 0: |
s[k + 128 + 1] = s[k + 128] = s[k + 64 + 1] = s[k + 64] = s[k + 1] = s[k] = 0.0F; |
k++; /* skip right chan dispatch */ |
goto dispatch; |
case 18 + 1: /* 3 levels grouped 5 bits */ |
n = bitget(5); |
s[k] = m_cs_factor[i][k] * m_group3_table[n][0]; |
s[k + 1] = m_cs_factor[i][k + 1] * m_group3_table[n][0]; |
s[k + 64] = m_cs_factor[i][k] * m_group3_table[n][1]; |
s[k + 64 + 1] = m_cs_factor[i][k + 1] * m_group3_table[n][1]; |
s[k + 128] = m_cs_factor[i][k] * m_group3_table[n][2]; |
s[k + 128 + 1] = m_cs_factor[i][k + 1] * m_group3_table[n][2]; |
k++; /* skip right chan dispatch */ |
goto dispatch; |
case 18 + 2: /* 5 levels grouped 7 bits */ |
n = bitget(7); |
s[k] = m_cs_factor[i][k] * m_group5_table[n][0]; |
s[k + 1] = m_cs_factor[i][k + 1] * m_group5_table[n][0]; |
s[k + 64] = m_cs_factor[i][k] * m_group5_table[n][1]; |
s[k + 64 + 1] = m_cs_factor[i][k + 1] * m_group5_table[n][1]; |
s[k + 128] = m_cs_factor[i][k] * m_group5_table[n][2]; |
s[k + 128 + 1] = m_cs_factor[i][k + 1] * m_group5_table[n][2]; |
k++; /* skip right chan dispatch */ |
goto dispatch; |
case 18 + 3: |
UNPACKJ_N(3) /* 7 levels */ |
case 18 + 4: /* 9 levels grouped 10 bits */ |
n = bitget(10); |
s[k] = m_cs_factor[i][k] * m_group9_table[n][0]; |
s[k + 1] = m_cs_factor[i][k + 1] * m_group9_table[n][0]; |
s[k + 64] = m_cs_factor[i][k] * m_group9_table[n][1]; |
s[k + 64 + 1] = m_cs_factor[i][k + 1] * m_group9_table[n][1]; |
s[k + 128] = m_cs_factor[i][k] * m_group9_table[n][2]; |
s[k + 128 + 1] = m_cs_factor[i][k + 1] * m_group9_table[n][2]; |
k++; /* skip right chan dispatch */ |
goto dispatch; |
case 18 + 5: |
UNPACKJ_N(4) /* 15 levels */ |
case 18 + 6: |
UNPACKJ_N(5) /* 31 levels */ |
case 18 + 7: |
UNPACKJ_N(6) /* 63 levels */ |
case 18 + 8: |
UNPACKJ_N(7) /* 127 levels */ |
case 18 + 9: |
UNPACKJ_N(8) /* 255 levels */ |
case 18 + 10: |
UNPACKJ_N(9) /* 511 levels */ |
case 18 + 11: |
UNPACKJ_N(10) /* 1023 levels */ |
case 18 + 12: |
UNPACKJ_N(11) /* 2047 levels */ |
case 18 + 13: |
UNPACKJ_N(12) /* 4095 levels */ |
case 18 + 14: |
UNPACKJ_N(13) /* 8191 levels */ |
case 18 + 15: |
UNPACKJ_N(14) /* 16383 levels */ |
case 18 + 16: |
UNPACKJ_N(15) /* 32767 levels */ |
case 18 + 17: |
UNPACKJ_N(16) /* 65535 levels */ |
/* -- end of dispatch -- */ |
case 37: |
bitget_skip(m_bit_skip); |
case 36: |
s += 3 * 64; |
} /* end switch */ |
} /* end j loop */ |
} /* end i loop */ |
} |
/programs/media/ac97snd/trunk/mp3dec/l2init.c |
---|
0,0 → 1,205 |
#include "bstream.h" |
#include "mp3dec.h" |
#include <math.h> |
extern MPEG_DECODE_OPTION m_option; |
extern int m_frequency; |
extern float m_sample[2304]; |
extern int m_nsb_limit; |
extern int m_max_sb; |
extern SBT_PROC m_sbt_proc; |
extern float m_sf_table[64]; |
extern float m_look_c_valueL2[18]; |
extern char m_group3_table[32][3]; |
extern char m_group5_table[128][3]; |
extern short m_group9_table[1024][3]; |
extern int m_nbat[4];// = {3, 8, 12, 7}; |
extern int m_bat[4][16]; |
/* ABCD_INDEX = lookqt[mode][sr_index][br_index] */ |
/* -1 = invalid */ |
static const char lookqt[4][3][16] = |
{ |
1, -1, -1, -1, 2, -1, 2, 0, 0, 0, 1, 1, 1, 1, 1, -1, /* 44ks stereo */ |
0, -1, -1, -1, 2, -1, 2, 0, 0, 0, 0, 0, 0, 0, 0, -1, /* 48ks */ |
1, -1, -1, -1, 3, -1, 3, 0, 0, 0, 1, 1, 1, 1, 1, -1, /* 32ks */ |
1, -1, -1, -1, 2, -1, 2, 0, 0, 0, 1, 1, 1, 1, 1, -1, /* 44ks joint stereo */ |
0, -1, -1, -1, 2, -1, 2, 0, 0, 0, 0, 0, 0, 0, 0, -1, /* 48ks */ |
1, -1, -1, -1, 3, -1, 3, 0, 0, 0, 1, 1, 1, 1, 1, -1, /* 32ks */ |
1, -1, -1, -1, 2, -1, 2, 0, 0, 0, 1, 1, 1, 1, 1, -1, /* 44ks dual chan */ |
0, -1, -1, -1, 2, -1, 2, 0, 0, 0, 0, 0, 0, 0, 0, -1, /* 48ks */ |
1, -1, -1, -1, 3, -1, 3, 0, 0, 0, 1, 1, 1, 1, 1, -1, /* 32ks */ |
// mono extended beyond legal br index |
// 1,2,2,0,0,0,1,1,1,1,1,1,1,1,1,-1, /* 44ks single chan */ |
// 0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,-1, /* 48ks */ |
// 1,3,3,0,0,0,1,1,1,1,1,1,1,1,1,-1, /* 32ks */ |
// legal mono |
1, 2, 2, 0, 0, 0, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, /* 44ks single chan */ |
0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, /* 48ks */ |
1, 3, 3, 0, 0, 0, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, /* 32ks */ |
}; |
/* bit allocation table look up */ |
/* table per mpeg spec tables 3b2a/b/c/d /e is mpeg2 */ |
/* look_bat[abcd_index][4][16] */ |
static const unsigned char look_bat[5][4][16] = |
{ |
/* LOOK_BATA */ |
0, 1, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, |
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17, |
0, 1, 2, 3, 4, 5, 6, 17, 0, 0, 0, 0, 0, 0, 0, 0, |
0, 1, 2, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
/* LOOK_BATB */ |
0, 1, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, |
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17, |
0, 1, 2, 3, 4, 5, 6, 17, 0, 0, 0, 0, 0, 0, 0, 0, |
0, 1, 2, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
/* LOOK_BATC */ |
0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
0, 1, 2, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
/* LOOK_BATD */ |
0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
0, 1, 2, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
/* LOOK_BATE */ |
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
0, 1, 2, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, |
0, 1, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
}; |
/* look_nbat[abcd_index]][4] */ |
static const unsigned char look_nbat[5][4] = |
{ |
3, 8, 12, 4, |
3, 8, 12, 7, |
2, 0, 6, 0, |
2, 0, 10, 0, |
4, 0, 7, 19, |
}; |
//extern "sbt.c" |
void sbt_mono(float *sample, signed short *pcm, int ch); |
void sbt_dual(float *sample, signed short *pcm, int ch); |
void sbt16_mono(float *sample, signed short *pcm, int ch); |
void sbt16_dual(float *sample, signed short *pcm, int ch); |
void sbt8_mono(float *sample, signed short *pcm, int ch); |
void sbt8_dual(float *sample, signed short *pcm, int ch); |
void sbtB_mono(float *sample, unsigned char *pcm, int ch); |
void sbtB_dual(float *sample, unsigned char *pcm, int ch); |
void sbtB16_mono(float *sample, unsigned char *pcm, int ch); |
void sbtB16_dual(float *sample, unsigned char *pcm, int ch); |
void sbtB8_mono(float *sample, unsigned char *pcm, int ch); |
void sbtB8_dual(float *sample, unsigned char *pcm, int ch); |
static const SBT_PROC sbt_table[2][3][2] = |
{ |
sbt_mono, |
sbt_dual, |
sbt16_mono, |
sbt16_dual, |
sbt8_mono, |
sbt8_dual, |
sbtB_mono, |
sbtB_dual, |
sbtB16_mono, |
sbtB16_dual, |
sbtB8_mono, |
sbtB8_dual, |
}; |
void L2table_init() |
{ |
int i, j, code; |
long stepL2[18] = { |
0, 3, 5, 7, 9, 15, 31, 63, 127, |
255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535 |
}; |
//c_values (dequant) |
for (i = 1; i < 18; i++) { |
m_look_c_valueL2[i] = 2.0F / stepL2[i]; |
} |
//scale factor table, scale by 32768 for 16 pcm output |
for (i = 0; i < 64; i++) { |
m_sf_table[i] = (float) (32768.0 * 2.0 * pow_test(2.0, -i / 3.0)); |
} |
//grouped 3 level lookup table 5 bit token |
for (i = 0; i < 32; i++) { |
code = i; |
for (j = 0; j < 3; j++) { |
m_group3_table[i][j] = (char) ((code % 3) - 1); |
code /= 3; |
} |
} |
//grouped 5 level lookup table 7 bit token |
for (i = 0; i < 128; i++) { |
code = i; |
for (j = 0; j < 3; j++) { |
m_group5_table[i][j] = (char) ((code % 5) - 2); |
code /= 5; |
} |
} |
//grouped 9 level lookup table 10 bit token |
for (i = 0; i < 1024; i++) { |
code = i; |
for (j = 0; j < 3; j++) { |
m_group9_table[i][j] = (short) ((code % 9) - 4); |
code /= 9; |
} |
} |
} |
int L2decode_start(MPEG_HEADER* h) |
{ |
int i, j, k, bit_code, limit; |
int abcd_index; |
// compute abcd index for bit allo table selection |
if (h->version == 1) // MPEG-1 |
abcd_index = lookqt[h->mode][h->fr_index][h->br_index]; |
else |
abcd_index = 4; // MPEG-2, MPEG-2.5 |
if (abcd_index < 0) |
return 0; // fail invalid Layer II bit rate index |
for (i = 0; i < 4; i++) { |
m_nbat[i] = look_nbat[abcd_index][i]; |
for (j = 0; j < 16; j++) { |
m_bat[i][j] = look_bat[abcd_index][i][j]; |
} |
} |
m_max_sb = m_nbat[0] + m_nbat[1] + m_nbat[2] + m_nbat[3]; |
// compute nsb_limit |
m_nsb_limit = (m_option.freqLimit * 64L + m_frequency / 2) / m_frequency; |
// caller limit |
// limit = 0.94*(32>>reduction_code); |
limit = (32 >> m_option.reduction); |
if (limit > 8) |
limit--; |
if (m_nsb_limit > limit) |
m_nsb_limit = limit; |
if (m_nsb_limit > m_max_sb) |
m_nsb_limit = m_max_sb; |
if (h->mode != 3) { |
// adjust for 2 channel modes |
for (i = 0; i < 4; i++) |
m_nbat[i] *= 2; |
m_max_sb *= 2; |
m_nsb_limit *= 2; |
} |
// set sbt function |
bit_code = (m_option.convert & 8) ? 1 : 0; |
k = (h->mode == 3) ? 0 : (1 + m_option.convert); |
m_sbt_proc = sbt_table[bit_code][m_option.reduction][k];//[2][3][2] |
// clear sample buffer, unused sub bands must be 0 |
for (i = 0; i < 2304; i++) |
m_sample[i] = 0.0F; |
return 1; |
} |
/programs/media/ac97snd/trunk/mp3dec/l3alias.c |
---|
0,0 → 1,38 |
#include <math.h> //sqrt |
static float csa[8][2]; /* antialias */ |
void alias_init() |
{ |
float Ci[8] = |
{ |
-0.6f, -0.535f, -0.33f, -0.185f, -0.095f, -0.041f, -0.0142f, -0.0037f |
}; |
int i; |
for (i = 0; i < 8; i++) |
{ |
csa[i][0] = (float) (1.0 / sqrt(1.0 + Ci[i] * Ci[i])); |
csa[i][1] = (float) (Ci[i] / sqrt(1.0 + Ci[i] * Ci[i])); |
} |
} |
void antialias(float x[], int n) |
{ |
int i, k; |
float a, b; |
for (k = 0; k < n; k++) |
{ |
for (i = 0; i < 8; i++) |
{ |
a = x[17 - i]; |
b = x[18 + i]; |
x[17 - i] = a * csa[i][0] - b * csa[i][1]; |
x[18 + i] = b * csa[i][0] + a * csa[i][1]; |
} |
x += 18; |
} |
} |
/programs/media/ac97snd/trunk/mp3dec/l3dec.c |
---|
0,0 → 1,350 |
#include "layer3.h" |
#include <string.h> |
#include <math.h> |
#ifndef min |
#define max(a,b) (((a) > (b)) ? (a) : (b)) |
#define min(a,b) (((a) < (b)) ? (a) : (b)) |
#endif |
extern int m_frame_size, m_pcm_size; |
// shared |
SAMPLE m_sample[2][2][576];//- sample union of int/float sample[ch][gr][576] |
int m_nsb_limit; |
SBT_PROC m_sbt_proc; |
XFORM_PROC m_xform_proc; |
int m_channels; //(mode == 3) ? 1 : 2 |
int m_ms_mode, m_is_mode; |
int m_sfBandIndex[2][22];// [long/short][cb] |
int m_nBand[2][22]; |
int m_band_limit; |
int m_band_limit21; // limit for sf band 21 |
int m_band_limit12; // limit for sf band 12 short |
int m_band_limit_nsb; |
int m_ncbl_mixed; |
SIDE_INFO m_side_info; |
SCALE_FACTOR m_scale_fac[2][2]; // [gr][ch] |
CB_INFO m_cb_info[2][2]; // [gr][ch] |
IS_SF_INFO m_is_sf_info; |
#define NBUF (8*1024) |
#define BUF_TRIGGER (NBUF-1500) |
int m_gr; |
int m_main_pos_bit; |
byte m_buf[NBUF]; |
int m_buf_ptr0, m_buf_ptr1; |
int m_nsamp[2][2]; // must start = 0, for m_nsamp[igr_prev] |
float m_yout[576]; // hybrid out, sbt in |
//extern "l3side.c" |
int L3get_side_info1(); |
int L3get_side_info2(int gr); |
//extern "l3sf.c" |
void L3get_scale_factor1(int gr, int ch); |
void L3get_scale_factor2(int gr, int ch); |
void huffman(void *xy, int n, int ntable); |
int huffman_quad(void *vwxy, int n, int nbits, int ntable); |
void dequant(SAMPLE sample[], int gr, int ch); |
void antialias(void *x, int n); |
void ms_process(void *x, int n); |
void is_process1(void *x, SCALE_FACTOR* sf, |
CB_INFO cb_info[2], int nsamp); |
void is_process2(void *x, SCALE_FACTOR * sf, |
CB_INFO cb_info[2], int nsamp); |
//extern "l3hybrid.c" |
int hybrid(void *xin, void *xprev, float *y, |
int btype, int nlong, int ntot, int nprev); |
int hybrid_sum(void *xin, void *xin_left, float *y, |
int btype, int nlong, int ntot); |
void sum_f_bands(void *a, void *b, int n); |
void freq_invert(float *y, int n); /* xform, */ |
void L3decode_main(MPEG_HEADER* h, byte *pcm, int gr); |
void L3decode_reset() |
{ |
m_buf_ptr0 = m_buf_ptr1 = 0; |
} |
void L3decode_frame(MPEG_HEADER* h, byte* mpeg, byte* pcm) |
{ |
int crc_size, side_size; |
int copy_size; |
if (h->mode == 1) { |
m_ms_mode = h->mode_ext >> 1; |
m_is_mode = h->mode_ext & 1; |
} |
else { |
m_ms_mode = 0; |
m_is_mode = 0; |
} |
crc_size = (h->error_prot) ? 2 : 0; |
bitget_init(mpeg + 4 + crc_size); |
if (h->version == 1) |
side_size = L3get_side_info1(); |
else |
side_size = L3get_side_info2(m_gr); |
m_buf_ptr0 = m_buf_ptr1 - m_side_info.main_data_begin;/* decode start point */ |
if (m_buf_ptr1 > BUF_TRIGGER) { /* shift buffer */ |
memmove(m_buf, m_buf + m_buf_ptr0, m_side_info.main_data_begin); |
m_buf_ptr0 = 0; |
m_buf_ptr1 = m_side_info.main_data_begin; |
} |
copy_size = m_frame_size - (4 + crc_size + side_size); |
//24/02/02 X-MaD |
if (copy_size < 0) { copy_size = copy_size * -1; } |
//if (copy_size < 0) { copy_size = 0; } |
//__try { |
memmove(m_buf + m_buf_ptr1, mpeg + (4 + crc_size + side_size), copy_size); |
//} __except(0){ |
// m_buf_ptr1 = 0; |
//} |
m_buf_ptr1 += copy_size; |
//24/02/02 X-MaD |
if (m_buf_ptr0 >= 0) { |
m_main_pos_bit = m_buf_ptr0 << 3; |
if (h->version == 1) { |
L3decode_main(h, pcm, 0); |
L3decode_main(h, pcm + (m_pcm_size / 2), 1); |
} |
else { |
L3decode_main(h, pcm, m_gr); |
m_gr = m_gr ^ 1; |
} |
} |
} |
void L3decode_main(MPEG_HEADER* h, byte *pcm, int gr) |
{ |
int ch; |
int n1, n2, n3, n4, nn2, nn3, nn4; |
int bit0, qbits, m0; |
for (ch = 0; ch < m_channels; ch ++) { |
bitget_init(m_buf + (m_main_pos_bit >> 3)); |
bit0 = (m_main_pos_bit & 7); |
if (bit0) bitget(bit0); |
m_main_pos_bit += m_side_info.gr[gr][ch].part2_3_length; |
bitget_init_end(m_buf + ((m_main_pos_bit + 39) >> 3)); |
// scale factors |
if (h->version == 1) |
L3get_scale_factor1(gr, ch); |
else |
L3get_scale_factor2(gr, ch); |
// huff data |
n1 = m_sfBandIndex[0][m_side_info.gr[gr][ch].region0_count]; |
n2 = m_sfBandIndex[0][m_side_info.gr[gr][ch].region0_count |
+ m_side_info.gr[gr][ch].region1_count + 1]; |
n3 = m_side_info.gr[gr][ch].big_values; |
n3 = n3 + n3; |
if (n3 > m_band_limit) n3 = m_band_limit; |
if (n2 > n3) n2 = n3; |
if (n1 > n3) n1 = n3; |
nn3 = n3 - n2; |
nn2 = n2 - n1; |
huffman(m_sample[ch][gr], n1, m_side_info.gr[gr][ch].table_select[0]); |
huffman(m_sample[ch][gr] + n1, nn2, m_side_info.gr[gr][ch].table_select[1]); |
huffman(m_sample[ch][gr] + n2, nn3, m_side_info.gr[gr][ch].table_select[2]); |
qbits = m_side_info.gr[gr][ch].part2_3_length - (bitget_bits_used() - bit0); |
nn4 = huffman_quad(m_sample[ch][gr] + n3, m_band_limit - n3, qbits, |
m_side_info.gr[gr][ch].count1table_select); |
n4 = n3 + nn4; |
m_nsamp[gr][ch] = n4; |
// limit n4 or allow deqaunt to sf band 22 |
if (m_side_info.gr[gr][ch].block_type == 2) |
n4 = min(n4, m_band_limit12); |
else |
n4 = min(n4, m_band_limit21); |
if (n4 < 576) |
memset(m_sample[ch][gr] + n4, 0, sizeof(SAMPLE) * (576 - n4)); |
if (bitget_overrun()) |
memset(m_sample[ch][gr], 0, sizeof(SAMPLE) * (576)); |
} |
// dequant |
for (ch = 0; ch < m_channels; ch++) { |
dequant(m_sample[ch][gr], gr, ch); |
} |
// ms stereo processing |
if (m_ms_mode) { |
if (m_is_mode == 0) { |
m0 = m_nsamp[gr][0]; // process to longer of left/right |
if (m0 < m_nsamp[gr][1]) |
m0 = m_nsamp[gr][1]; |
} |
else {// process to last cb in right |
m0 = m_sfBandIndex[m_cb_info[gr][1].cbtype][m_cb_info[gr][1].cbmax]; |
} |
ms_process(m_sample[0][gr], m0); |
} |
// is stereo processing |
if (m_is_mode) { |
if (h->version == 1) |
is_process1(m_sample[0][gr], &m_scale_fac[gr][1], |
m_cb_info[gr], m_nsamp[gr][0]); |
else |
is_process2(m_sample[0][gr], &m_scale_fac[gr][1], |
m_cb_info[gr], m_nsamp[gr][0]); |
} |
// adjust ms and is modes to max of left/right |
if (m_ms_mode || m_is_mode) { |
if (m_nsamp[gr][0] < m_nsamp[gr][1]) |
m_nsamp[gr][0] = m_nsamp[gr][1]; |
else |
m_nsamp[gr][1] = m_nsamp[gr][0]; |
} |
// antialias |
for (ch = 0; ch < m_channels; ch ++) { |
if (m_cb_info[gr][ch].ncbl == 0) |
continue; // have no long blocks |
if (m_side_info.gr[gr][ch].mixed_block_flag) |
n1 = 1; // 1 -> 36 samples |
else |
n1 = (m_nsamp[gr][ch] + 7) / 18; |
if (n1 > 31) |
n1 = 31; |
antialias(m_sample[ch][gr], n1); |
n1 = 18 * n1 + 8; // update number of samples |
if (n1 > m_nsamp[gr][ch]) |
m_nsamp[gr][ch] = n1; |
} |
// hybrid + sbt |
m_xform_proc(pcm, gr); |
} |
void xform_mono(void *pcm, int igr) |
{ |
int igr_prev, n1, n2; |
// hybrid + sbt |
n1 = n2 = m_nsamp[igr][0]; // total number bands |
if (m_side_info.gr[igr][0].block_type == 2) { // long bands |
if (m_side_info.gr[igr][0].mixed_block_flag) |
n1 = m_sfBandIndex[0][m_ncbl_mixed - 1]; |
else |
n1 = 0; |
} |
if (n1 > m_band_limit) |
n1 = m_band_limit; |
if (n2 > m_band_limit) |
n2 = m_band_limit; |
igr_prev = igr ^ 1; |
m_nsamp[igr][0] = hybrid(m_sample[0][igr], m_sample[0][igr_prev], |
m_yout, m_side_info.gr[igr][0].block_type, n1, n2, m_nsamp[igr_prev][0]); |
freq_invert(m_yout, m_nsamp[igr][0]); |
m_sbt_proc(m_yout, pcm, 0); |
} |
void xform_dual_right(void *pcm, int igr) |
{ |
int igr_prev, n1, n2; |
// hybrid + sbt |
n1 = n2 = m_nsamp[igr][1]; // total number bands |
if (m_side_info.gr[igr][1].block_type == 2) { // long bands |
if (m_side_info.gr[igr][1].mixed_block_flag) |
n1 = m_sfBandIndex[0][m_ncbl_mixed - 1]; |
else |
n1 = 0; |
} |
if (n1 > m_band_limit) |
n1 = m_band_limit; |
if (n2 > m_band_limit) |
n2 = m_band_limit; |
igr_prev = igr ^ 1; |
m_nsamp[igr][1] = hybrid(m_sample[1][igr], m_sample[1][igr_prev], |
m_yout, m_side_info.gr[igr][1].block_type, n1, n2, m_nsamp[igr_prev][1]); |
freq_invert(m_yout, m_nsamp[igr][1]); |
m_sbt_proc(m_yout, pcm, 0); |
} |
void xform_dual(void *pcm, int igr) |
{ |
int ch; |
int igr_prev, n1, n2; |
// hybrid + sbt |
igr_prev = igr ^ 1; |
for (ch = 0; ch < m_channels; ch++) { |
n1 = n2 = m_nsamp[igr][ch]; // total number bands |
if (m_side_info.gr[igr][ch].block_type == 2) { // long bands |
if (m_side_info.gr[igr][ch].mixed_block_flag) |
n1 = m_sfBandIndex[0][m_ncbl_mixed - 1]; |
else |
n1 = 0; |
} |
if (n1 > m_band_limit) |
n1 = m_band_limit; |
if (n2 > m_band_limit) |
n2 = m_band_limit; |
m_nsamp[igr][ch] = hybrid(m_sample[ch][igr], m_sample[ch][igr_prev], |
m_yout, m_side_info.gr[igr][ch].block_type, n1, n2, m_nsamp[igr_prev][ch]); |
freq_invert(m_yout, m_nsamp[igr][ch]); |
m_sbt_proc(m_yout, pcm, ch); |
} |
} |
void xform_dual_mono(void *pcm, int igr) |
{ |
int igr_prev, n1, n2, n3; |
// hybrid + sbt |
igr_prev = igr ^ 1; |
if ((m_side_info.gr[igr][0].block_type == m_side_info.gr[igr][1].block_type) |
&& (m_side_info.gr[igr][0].mixed_block_flag == 0) |
&& (m_side_info.gr[igr][1].mixed_block_flag == 0)) { |
n2 = m_nsamp[igr][0]; // total number bands max of L R |
if (n2 < m_nsamp[igr][1]) |
n2 = m_nsamp[igr][1]; |
if (n2 > m_band_limit) |
n2 = m_band_limit; |
if (m_side_info.gr[igr][0].block_type == 2) |
n1 = 0; |
else |
n1 = n2; // n1 = number long bands |
sum_f_bands(m_sample[0][igr], m_sample[1][igr], n2); |
n3 = m_nsamp[igr][0] = hybrid(m_sample[0][igr], m_sample[0][igr_prev], |
m_yout, m_side_info.gr[igr][0].block_type, n1, n2, m_nsamp[igr_prev][0]); |
} |
else { // transform and then sum (not tested - never happens in test) |
// left chan |
n1 = n2 = m_nsamp[igr][0]; // total number bands |
if (m_side_info.gr[igr][0].block_type == 2) { // long bands |
if (m_side_info.gr[igr][0].mixed_block_flag) |
n1 = m_sfBandIndex[0][m_ncbl_mixed - 1]; |
else |
n1 = 0; |
} |
n3 = m_nsamp[igr][0] = hybrid(m_sample[0][igr], m_sample[0][igr_prev], |
m_yout, m_side_info.gr[igr][0].block_type, n1, n2, m_nsamp[igr_prev][0]); |
// right chan |
n1 = n2 = m_nsamp[igr][1]; // total number bands |
if (m_side_info.gr[igr][1].block_type == 2) { // long bands |
if (m_side_info.gr[igr][1].mixed_block_flag) |
n1 = m_sfBandIndex[0][m_ncbl_mixed - 1]; |
else |
n1 = 0; |
} |
m_nsamp[igr][1] = hybrid_sum(m_sample[1][igr], m_sample[0][igr], |
m_yout, m_side_info.gr[igr][1].block_type, n1, n2); |
if (n3 < m_nsamp[igr][1]) |
n1 = m_nsamp[igr][1]; |
} |
freq_invert(m_yout, n3); |
m_sbt_proc(m_yout, pcm, 0); |
} |
/programs/media/ac97snd/trunk/mp3dec/l3huff.c |
---|
0,0 → 1,359 |
#include "layer3.h" |
#include "l3huff.h" |
//#ifdef _MSC_VER |
//#pragma warning(disable: 4505) |
//#endif |
/*===============================================================*/ |
/* max bits required for any lookup - change if htable changes */ |
/* quad required 10 bit w/signs must have (MAXBITS+2) >= 10 */ |
#define MAXBITS 9 |
static HUFF_ELEMENT huff_table_0[] = |
{0, 0, 0, 64}; /* dummy must not use */ |
/*-- 6 bit lookup (purgebits, value) --*/ |
static unsigned char quad_table_a[][2] = |
{ |
6, 11, 6, 15, 6, 13, 6, 14, 6, 7, 6, 5, 5, 9, |
5, 9, 5, 6, 5, 6, 5, 3, 5, 3, 5, 10, 5, 10, |
5, 12, 5, 12, 4, 2, 4, 2, 4, 2, 4, 2, 4, 1, |
4, 1, 4, 1, 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, |
4, 8, 4, 8, 4, 8, 4, 8, 1, 0, 1, 0, 1, 0, |
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, |
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, |
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, |
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, |
1, 0, |
}; |
typedef struct |
{ |
HUFF_ELEMENT *table; |
int linbits; |
int ncase; |
} |
HUFF_SETUP; |
#define no_bits 0 |
#define one_shot 1 |
#define no_linbits 2 |
#define have_linbits 3 |
#define quad_a 4 |
#define quad_b 5 |
static HUFF_SETUP table_look[] = |
{ |
huff_table_0, 0, no_bits, |
huff_table_1, 0, one_shot, |
huff_table_2, 0, one_shot, |
huff_table_3, 0, one_shot, |
huff_table_0, 0, no_bits, |
huff_table_5, 0, one_shot, |
huff_table_6, 0, one_shot, |
huff_table_7, 0, no_linbits, |
huff_table_8, 0, no_linbits, |
huff_table_9, 0, no_linbits, |
huff_table_10, 0, no_linbits, |
huff_table_11, 0, no_linbits, |
huff_table_12, 0, no_linbits, |
huff_table_13, 0, no_linbits, |
huff_table_0, 0, no_bits, |
huff_table_15, 0, no_linbits, |
huff_table_16, 1, have_linbits, |
huff_table_16, 2, have_linbits, |
huff_table_16, 3, have_linbits, |
huff_table_16, 4, have_linbits, |
huff_table_16, 6, have_linbits, |
huff_table_16, 8, have_linbits, |
huff_table_16, 10, have_linbits, |
huff_table_16, 13, have_linbits, |
huff_table_24, 4, have_linbits, |
huff_table_24, 5, have_linbits, |
huff_table_24, 6, have_linbits, |
huff_table_24, 7, have_linbits, |
huff_table_24, 8, have_linbits, |
huff_table_24, 9, have_linbits, |
huff_table_24, 11, have_linbits, |
huff_table_24, 13, have_linbits, |
huff_table_0, 0, quad_a, |
huff_table_0, 0, quad_b, |
}; |
/*========================================================*/ |
void huffman(int xy[][2], int n, int ntable) |
{ |
int i; |
HUFF_ELEMENT *t; |
HUFF_ELEMENT *t0; |
int linbits; |
int bits; |
int code; |
int x, y; |
if (n <= 0) |
return; |
n = n >> 1; /* huff in pairs */ |
/*-------------*/ |
t0 = table_look[ntable].table; |
linbits = table_look[ntable].linbits; |
switch (table_look[ntable].ncase) |
{ |
default: |
/*------------------------------------------*/ |
case no_bits: |
/*- table 0, no data, x=y=0--*/ |
for (i = 0; i < n; i++) |
{ |
xy[i][0] = 0; |
xy[i][1] = 0; |
} |
return; |
/*------------------------------------------*/ |
case one_shot: |
/*- single lookup, no escapes -*/ |
for (i = 0; i < n; i++) |
{ |
mac_bitget_check((MAXBITS + 2)); |
bits = t0[0].b.signbits; |
code = mac_bitget2(bits); |
mac_bitget_purge(t0[1 + code].b.purgebits); |
x = t0[1 + code].b.x; |
y = t0[1 + code].b.y; |
if (x) |
if (mac_bitget_1bit()) |
x = -x; |
if (y) |
if (mac_bitget_1bit()) |
y = -y; |
xy[i][0] = x; |
xy[i][1] = y; |
if (bitget_overrun()) |
break; // bad data protect |
} |
return; |
/*------------------------------------------*/ |
case no_linbits: |
for (i = 0; i < n; i++) |
{ |
t = t0; |
for (;;) |
{ |
mac_bitget_check((MAXBITS + 2)); |
bits = t[0].b.signbits; |
code = mac_bitget2(bits); |
if (t[1 + code].b.purgebits) |
break; |
t += t[1 + code].ptr; /* ptr include 1+code */ |
mac_bitget_purge(bits); |
} |
mac_bitget_purge(t[1 + code].b.purgebits); |
x = t[1 + code].b.x; |
y = t[1 + code].b.y; |
if (x) |
if (mac_bitget_1bit()) |
x = -x; |
if (y) |
if (mac_bitget_1bit()) |
y = -y; |
xy[i][0] = x; |
xy[i][1] = y; |
if (bitget_overrun()) |
break; // bad data protect |
} |
return; |
/*------------------------------------------*/ |
case have_linbits: |
for (i = 0; i < n; i++) |
{ |
t = t0; |
for (;;) |
{ |
bits = t[0].b.signbits; |
code = bitget2(bits); |
if (t[1 + code].b.purgebits) |
break; |
t += t[1 + code].ptr; /* ptr includes 1+code */ |
mac_bitget_purge(bits); |
} |
mac_bitget_purge(t[1 + code].b.purgebits); |
x = t[1 + code].b.x; |
y = t[1 + code].b.y; |
if (x == 15) |
x += bitget_lb(linbits); |
if (x) |
if (mac_bitget_1bit()) |
x = -x; |
if (y == 15) |
y += bitget_lb(linbits); |
if (y) |
if (mac_bitget_1bit()) |
y = -y; |
xy[i][0] = x; |
xy[i][1] = y; |
if (bitget_overrun()) |
break; // bad data protect |
} |
return; |
} |
/*--- end switch ---*/ |
} |
int huffman_quad(int vwxy[][4], int n, int nbits, int ntable) |
{ |
int i; |
int code; |
int x, y, v, w; |
int tmp; |
int i_non_zero, tmp_nz; |
tmp_nz = 15; |
i_non_zero = -1; |
n = n >> 2; /* huff in quads */ |
if (ntable) |
goto case_quad_b; |
/* case_quad_a: */ |
for (i = 0; i < n; i++) |
{ |
if (nbits <= 0) |
break; |
mac_bitget_check(10); |
code = mac_bitget2(6); |
nbits -= quad_table_a[code][0]; |
mac_bitget_purge(quad_table_a[code][0]); |
tmp = quad_table_a[code][1]; |
if (tmp) |
{ |
i_non_zero = i; |
tmp_nz = tmp; |
} |
v = (tmp >> 3) & 1; |
w = (tmp >> 2) & 1; |
x = (tmp >> 1) & 1; |
y = tmp & 1; |
if (v) |
{ |
if (mac_bitget_1bit()) |
v = -v; |
nbits--; |
} |
if (w) |
{ |
if (mac_bitget_1bit()) |
w = -w; |
nbits--; |
} |
if (x) |
{ |
if (mac_bitget_1bit()) |
x = -x; |
nbits--; |
} |
if (y) |
{ |
if (mac_bitget_1bit()) |
y = -y; |
nbits--; |
} |
vwxy[i][0] = v; |
vwxy[i][1] = w; |
vwxy[i][2] = x; |
vwxy[i][3] = y; |
if (bitget_overrun()) |
break; // bad data protect |
} |
if (nbits < 0) |
{ |
i--; |
vwxy[i][0] = 0; |
vwxy[i][1] = 0; |
vwxy[i][2] = 0; |
vwxy[i][3] = 0; |
} |
i_non_zero = (i_non_zero + 1) << 2; |
if ((tmp_nz & 3) == 0) |
i_non_zero -= 2; |
return i_non_zero; |
/*--------------------*/ |
case_quad_b: |
for (i = 0; i < n; i++) |
{ |
if (nbits < 4) |
break; |
nbits -= 4; |
mac_bitget_check(8); |
tmp = mac_bitget(4) ^ 15; /* one's complement of bitstream */ |
if (tmp) |
{ |
i_non_zero = i; |
tmp_nz = tmp; |
} |
v = (tmp >> 3) & 1; |
w = (tmp >> 2) & 1; |
x = (tmp >> 1) & 1; |
y = tmp & 1; |
if (v) |
{ |
if (mac_bitget_1bit()) |
v = -v; |
nbits--; |
} |
if (w) |
{ |
if (mac_bitget_1bit()) |
w = -w; |
nbits--; |
} |
if (x) |
{ |
if (mac_bitget_1bit()) |
x = -x; |
nbits--; |
} |
if (y) |
{ |
if (mac_bitget_1bit()) |
y = -y; |
nbits--; |
} |
vwxy[i][0] = v; |
vwxy[i][1] = w; |
vwxy[i][2] = x; |
vwxy[i][3] = y; |
if (bitget_overrun()) |
break; // bad data protect |
} |
if (nbits < 0) |
{ |
i--; |
vwxy[i][0] = 0; |
vwxy[i][1] = 0; |
vwxy[i][2] = 0; |
vwxy[i][3] = 0; |
} |
i_non_zero = (i_non_zero + 1) << 2; |
if ((tmp_nz & 3) == 0) |
i_non_zero -= 2; |
return i_non_zero; /* return non-zero sample (to nearest pair) */ |
} |
/programs/media/ac97snd/trunk/mp3dec/l3huff.h |
---|
0,0 → 1,973 |
typedef union |
{ |
int ptr; |
struct |
{ |
unsigned char signbits; |
unsigned char x; |
unsigned char y; |
unsigned char purgebits; // 0 = esc |
} |
b; |
} |
HUFF_ELEMENT; |
/* TABLE 1 4 entries maxbits 3 linbits 0 */ |
static HUFF_ELEMENT huff_table_1[] = |
{ |
0xFF000003, 0x03010102, 0x03010001, 0x02000101, 0x02000101, /* 4 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000,}; |
/* max table bits 3 */ |
/* TABLE 2 9 entries maxbits 6 linbits 0 */ |
static HUFF_ELEMENT huff_table_2[] = |
{ |
0xFF000006, 0x06020202, 0x06020001, 0x05020102, 0x05020102, /* 4 */ |
0x05010202, 0x05010202, 0x05000201, 0x05000201, 0x03010102, /* 9 */ |
0x03010102, 0x03010102, 0x03010102, 0x03010102, 0x03010102, /* 14 */ |
0x03010102, 0x03010102, 0x03010001, 0x03010001, 0x03010001, /* 19 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 24 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 29 */ |
0x03000101, 0x03000101, 0x03000101, 0x01000000, 0x01000000, /* 34 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 39 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 44 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 49 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 54 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 59 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 64 */ }; |
/* max table bits 6 */ |
/* TABLE 3 9 entries maxbits 6 linbits 0 */ |
static HUFF_ELEMENT huff_table_3[] = |
{ |
0xFF000006, 0x06020202, 0x06020001, 0x05020102, 0x05020102, /* 4 */ |
0x05010202, 0x05010202, 0x05000201, 0x05000201, 0x03000101, /* 9 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 14 */ |
0x03000101, 0x03000101, 0x02010102, 0x02010102, 0x02010102, /* 19 */ |
0x02010102, 0x02010102, 0x02010102, 0x02010102, 0x02010102, /* 24 */ |
0x02010102, 0x02010102, 0x02010102, 0x02010102, 0x02010102, /* 29 */ |
0x02010102, 0x02010102, 0x02010102, 0x02010001, 0x02010001, /* 34 */ |
0x02010001, 0x02010001, 0x02010001, 0x02010001, 0x02010001, /* 39 */ |
0x02010001, 0x02010001, 0x02010001, 0x02010001, 0x02010001, /* 44 */ |
0x02010001, 0x02010001, 0x02010001, 0x02010001, 0x02000000, /* 49 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 54 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 59 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 64 */ }; |
/* max table bits 6 */ |
/* NO XING TABLE 4 */ |
/* TABLE 5 16 entries maxbits 8 linbits 0 */ |
static HUFF_ELEMENT huff_table_5[] = |
{ |
0xFF000008, 0x08030302, 0x08030202, 0x07020302, 0x07020302, /* 4 */ |
0x06010302, 0x06010302, 0x06010302, 0x06010302, 0x07030102, /* 9 */ |
0x07030102, 0x07030001, 0x07030001, 0x07000301, 0x07000301, /* 14 */ |
0x07020202, 0x07020202, 0x06020102, 0x06020102, 0x06020102, /* 19 */ |
0x06020102, 0x06010202, 0x06010202, 0x06010202, 0x06010202, /* 24 */ |
0x06020001, 0x06020001, 0x06020001, 0x06020001, 0x06000201, /* 29 */ |
0x06000201, 0x06000201, 0x06000201, 0x03010102, 0x03010102, /* 34 */ |
0x03010102, 0x03010102, 0x03010102, 0x03010102, 0x03010102, /* 39 */ |
0x03010102, 0x03010102, 0x03010102, 0x03010102, 0x03010102, /* 44 */ |
0x03010102, 0x03010102, 0x03010102, 0x03010102, 0x03010102, /* 49 */ |
0x03010102, 0x03010102, 0x03010102, 0x03010102, 0x03010102, /* 54 */ |
0x03010102, 0x03010102, 0x03010102, 0x03010102, 0x03010102, /* 59 */ |
0x03010102, 0x03010102, 0x03010102, 0x03010102, 0x03010102, /* 64 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 69 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 74 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 79 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 84 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 89 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 94 */ |
0x03010001, 0x03010001, 0x03000101, 0x03000101, 0x03000101, /* 99 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 104 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 109 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 114 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 119 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 124 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x01000000, /* 129 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 134 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 139 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 144 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 149 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 154 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 159 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 164 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 169 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 174 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 179 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 184 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 189 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 194 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 199 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 204 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 209 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 214 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 219 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 224 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 229 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 234 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 239 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 244 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 249 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 254 */ |
0x01000000, 0x01000000,}; |
/* max table bits 8 */ |
/* TABLE 6 16 entries maxbits 7 linbits 0 */ |
static HUFF_ELEMENT huff_table_6[] = |
{ |
0xFF000007, 0x07030302, 0x07030001, 0x06030202, 0x06030202, /* 4 */ |
0x06020302, 0x06020302, 0x06000301, 0x06000301, 0x05030102, /* 9 */ |
0x05030102, 0x05030102, 0x05030102, 0x05010302, 0x05010302, /* 14 */ |
0x05010302, 0x05010302, 0x05020202, 0x05020202, 0x05020202, /* 19 */ |
0x05020202, 0x05020001, 0x05020001, 0x05020001, 0x05020001, /* 24 */ |
0x04020102, 0x04020102, 0x04020102, 0x04020102, 0x04020102, /* 29 */ |
0x04020102, 0x04020102, 0x04020102, 0x04010202, 0x04010202, /* 34 */ |
0x04010202, 0x04010202, 0x04010202, 0x04010202, 0x04010202, /* 39 */ |
0x04010202, 0x04000201, 0x04000201, 0x04000201, 0x04000201, /* 44 */ |
0x04000201, 0x04000201, 0x04000201, 0x04000201, 0x03010001, /* 49 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 54 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 59 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 64 */ |
0x02010102, 0x02010102, 0x02010102, 0x02010102, 0x02010102, /* 69 */ |
0x02010102, 0x02010102, 0x02010102, 0x02010102, 0x02010102, /* 74 */ |
0x02010102, 0x02010102, 0x02010102, 0x02010102, 0x02010102, /* 79 */ |
0x02010102, 0x02010102, 0x02010102, 0x02010102, 0x02010102, /* 84 */ |
0x02010102, 0x02010102, 0x02010102, 0x02010102, 0x02010102, /* 89 */ |
0x02010102, 0x02010102, 0x02010102, 0x02010102, 0x02010102, /* 94 */ |
0x02010102, 0x02010102, 0x03000101, 0x03000101, 0x03000101, /* 99 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 104 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 109 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000000, 0x03000000, /* 114 */ |
0x03000000, 0x03000000, 0x03000000, 0x03000000, 0x03000000, /* 119 */ |
0x03000000, 0x03000000, 0x03000000, 0x03000000, 0x03000000, /* 124 */ |
0x03000000, 0x03000000, 0x03000000, 0x03000000,}; |
/* max table bits 7 */ |
/* TABLE 7 36 entries maxbits 10 linbits 0 */ |
static HUFF_ELEMENT huff_table_7[] = |
{ |
0xFF000006, 0x00000041, 0x00000052, 0x0000005B, 0x00000060, /* 4 */ |
0x00000063, 0x00000068, 0x0000006B, 0x06020102, 0x05010202, /* 9 */ |
0x05010202, 0x06020001, 0x06000201, 0x04010102, 0x04010102, /* 14 */ |
0x04010102, 0x04010102, 0x03010001, 0x03010001, 0x03010001, /* 19 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 24 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 29 */ |
0x03000101, 0x03000101, 0x03000101, 0x01000000, 0x01000000, /* 34 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 39 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 44 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 49 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 54 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 59 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 64 */ |
0xFF000004, 0x04050502, 0x04050402, 0x04040502, 0x04030502, /* 69 */ |
0x03050302, 0x03050302, 0x03040402, 0x03040402, 0x03050202, /* 74 */ |
0x03050202, 0x03020502, 0x03020502, 0x02050102, 0x02050102, /* 79 */ |
0x02050102, 0x02050102, 0xFF000003, 0x02010502, 0x02010502, /* 84 */ |
0x03050001, 0x03040302, 0x02000501, 0x02000501, 0x03030402, /* 89 */ |
0x03030302, 0xFF000002, 0x02040202, 0x02020402, 0x01040102, /* 94 */ |
0x01040102, 0xFF000001, 0x01010402, 0x01000401, 0xFF000002, /* 99 */ |
0x02040001, 0x02030202, 0x02020302, 0x02030001, 0xFF000001, /* 104 */ |
0x01030102, 0x01010302, 0xFF000001, 0x01000301, 0x01020202, /* 109 */ }; |
/* max table bits 6 */ |
/* TABLE 8 36 entries maxbits 11 linbits 0 */ |
static HUFF_ELEMENT huff_table_8[] = |
{ |
0xFF000008, 0x00000101, 0x0000010A, 0x0000010F, 0x08050102, /* 4 */ |
0x08010502, 0x00000112, 0x00000115, 0x08040202, 0x08020402, /* 9 */ |
0x08040102, 0x07010402, 0x07010402, 0x08040001, 0x08000401, /* 14 */ |
0x08030202, 0x08020302, 0x08030102, 0x08010302, 0x08030001, /* 19 */ |
0x08000301, 0x06020202, 0x06020202, 0x06020202, 0x06020202, /* 24 */ |
0x06020001, 0x06020001, 0x06020001, 0x06020001, 0x06000201, /* 29 */ |
0x06000201, 0x06000201, 0x06000201, 0x04020102, 0x04020102, /* 34 */ |
0x04020102, 0x04020102, 0x04020102, 0x04020102, 0x04020102, /* 39 */ |
0x04020102, 0x04020102, 0x04020102, 0x04020102, 0x04020102, /* 44 */ |
0x04020102, 0x04020102, 0x04020102, 0x04020102, 0x04010202, /* 49 */ |
0x04010202, 0x04010202, 0x04010202, 0x04010202, 0x04010202, /* 54 */ |
0x04010202, 0x04010202, 0x04010202, 0x04010202, 0x04010202, /* 59 */ |
0x04010202, 0x04010202, 0x04010202, 0x04010202, 0x04010202, /* 64 */ |
0x02010102, 0x02010102, 0x02010102, 0x02010102, 0x02010102, /* 69 */ |
0x02010102, 0x02010102, 0x02010102, 0x02010102, 0x02010102, /* 74 */ |
0x02010102, 0x02010102, 0x02010102, 0x02010102, 0x02010102, /* 79 */ |
0x02010102, 0x02010102, 0x02010102, 0x02010102, 0x02010102, /* 84 */ |
0x02010102, 0x02010102, 0x02010102, 0x02010102, 0x02010102, /* 89 */ |
0x02010102, 0x02010102, 0x02010102, 0x02010102, 0x02010102, /* 94 */ |
0x02010102, 0x02010102, 0x02010102, 0x02010102, 0x02010102, /* 99 */ |
0x02010102, 0x02010102, 0x02010102, 0x02010102, 0x02010102, /* 104 */ |
0x02010102, 0x02010102, 0x02010102, 0x02010102, 0x02010102, /* 109 */ |
0x02010102, 0x02010102, 0x02010102, 0x02010102, 0x02010102, /* 114 */ |
0x02010102, 0x02010102, 0x02010102, 0x02010102, 0x02010102, /* 119 */ |
0x02010102, 0x02010102, 0x02010102, 0x02010102, 0x02010102, /* 124 */ |
0x02010102, 0x02010102, 0x02010102, 0x02010102, 0x03010001, /* 129 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 134 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 139 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 144 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 149 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 154 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 159 */ |
0x03010001, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 164 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 169 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 174 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 179 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 184 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 189 */ |
0x03000101, 0x03000101, 0x03000101, 0x02000000, 0x02000000, /* 194 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 199 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 204 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 209 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 214 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 219 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 224 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 229 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 234 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 239 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 244 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 249 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 254 */ |
0x02000000, 0x02000000, 0xFF000003, 0x03050502, 0x03040502, /* 259 */ |
0x02050402, 0x02050402, 0x01030502, 0x01030502, 0x01030502, /* 264 */ |
0x01030502, 0xFF000002, 0x02050302, 0x02040402, 0x01050202, /* 269 */ |
0x01050202, 0xFF000001, 0x01020502, 0x01050001, 0xFF000001, /* 274 */ |
0x01040302, 0x01030402, 0xFF000001, 0x01000501, 0x01030302, /* 279 */ }; |
/* max table bits 8 */ |
/* TABLE 9 36 entries maxbits 9 linbits 0 */ |
static HUFF_ELEMENT huff_table_9[] = |
{ |
0xFF000006, 0x00000041, 0x0000004A, 0x0000004F, 0x00000052, /* 4 */ |
0x00000057, 0x0000005A, 0x06040102, 0x06010402, 0x06030202, /* 9 */ |
0x06020302, 0x05030102, 0x05030102, 0x05010302, 0x05010302, /* 14 */ |
0x06030001, 0x06000301, 0x05020202, 0x05020202, 0x05020001, /* 19 */ |
0x05020001, 0x04020102, 0x04020102, 0x04020102, 0x04020102, /* 24 */ |
0x04010202, 0x04010202, 0x04010202, 0x04010202, 0x04000201, /* 29 */ |
0x04000201, 0x04000201, 0x04000201, 0x03010102, 0x03010102, /* 34 */ |
0x03010102, 0x03010102, 0x03010102, 0x03010102, 0x03010102, /* 39 */ |
0x03010102, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 44 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03000101, /* 49 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 54 */ |
0x03000101, 0x03000101, 0x03000000, 0x03000000, 0x03000000, /* 59 */ |
0x03000000, 0x03000000, 0x03000000, 0x03000000, 0x03000000, /* 64 */ |
0xFF000003, 0x03050502, 0x03050402, 0x02050302, 0x02050302, /* 69 */ |
0x02030502, 0x02030502, 0x03040502, 0x03050001, 0xFF000002, /* 74 */ |
0x02040402, 0x02050202, 0x02020502, 0x02050102, 0xFF000001, /* 79 */ |
0x01010502, 0x01040302, 0xFF000002, 0x01030402, 0x01030402, /* 84 */ |
0x02000501, 0x02040001, 0xFF000001, 0x01040202, 0x01020402, /* 89 */ |
0xFF000001, 0x01030302, 0x01000401,}; |
/* max table bits 6 */ |
/* TABLE 10 64 entries maxbits 11 linbits 0 */ |
static HUFF_ELEMENT huff_table_10[] = |
{ |
0xFF000008, 0x00000101, 0x0000010A, 0x0000010F, 0x00000118, /* 4 */ |
0x0000011B, 0x00000120, 0x00000125, 0x08070102, 0x08010702, /* 9 */ |
0x0000012A, 0x0000012D, 0x00000132, 0x08060102, 0x08010602, /* 14 */ |
0x08000601, 0x00000137, 0x0000013A, 0x0000013D, 0x08040102, /* 19 */ |
0x08010402, 0x08000401, 0x08030202, 0x08020302, 0x08030001, /* 24 */ |
0x07030102, 0x07030102, 0x07010302, 0x07010302, 0x07000301, /* 29 */ |
0x07000301, 0x07020202, 0x07020202, 0x06020102, 0x06020102, /* 34 */ |
0x06020102, 0x06020102, 0x06010202, 0x06010202, 0x06010202, /* 39 */ |
0x06010202, 0x06020001, 0x06020001, 0x06020001, 0x06020001, /* 44 */ |
0x06000201, 0x06000201, 0x06000201, 0x06000201, 0x04010102, /* 49 */ |
0x04010102, 0x04010102, 0x04010102, 0x04010102, 0x04010102, /* 54 */ |
0x04010102, 0x04010102, 0x04010102, 0x04010102, 0x04010102, /* 59 */ |
0x04010102, 0x04010102, 0x04010102, 0x04010102, 0x04010102, /* 64 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 69 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 74 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 79 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 84 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 89 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 94 */ |
0x03010001, 0x03010001, 0x03000101, 0x03000101, 0x03000101, /* 99 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 104 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 109 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 114 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 119 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 124 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x01000000, /* 129 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 134 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 139 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 144 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 149 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 154 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 159 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 164 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 169 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 174 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 179 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 184 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 189 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 194 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 199 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 204 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 209 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 214 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 219 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 224 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 229 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 234 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 239 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 244 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 249 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 254 */ |
0x01000000, 0x01000000, 0xFF000003, 0x03070702, 0x03070602, /* 259 */ |
0x03060702, 0x03070502, 0x03050702, 0x03060602, 0x02070402, /* 264 */ |
0x02070402, 0xFF000002, 0x02040702, 0x02060502, 0x02050602, /* 269 */ |
0x02070302, 0xFF000003, 0x02030702, 0x02030702, 0x02060402, /* 274 */ |
0x02060402, 0x03050502, 0x03040502, 0x02030602, 0x02030602, /* 279 */ |
0xFF000001, 0x01070202, 0x01020702, 0xFF000002, 0x02040602, /* 284 */ |
0x02070001, 0x01000701, 0x01000701, 0xFF000002, 0x01020602, /* 289 */ |
0x01020602, 0x02050402, 0x02050302, 0xFF000002, 0x01060001, /* 294 */ |
0x01060001, 0x02030502, 0x02040402, 0xFF000001, 0x01060302, /* 299 */ |
0x01060202, 0xFF000002, 0x02050202, 0x02020502, 0x01050102, /* 304 */ |
0x01050102, 0xFF000002, 0x01010502, 0x01010502, 0x02040302, /* 309 */ |
0x02030402, 0xFF000001, 0x01050001, 0x01000501, 0xFF000001, /* 314 */ |
0x01040202, 0x01020402, 0xFF000001, 0x01030302, 0x01040001, /* 319 */ }; |
/* max table bits 8 */ |
/* TABLE 11 64 entries maxbits 11 linbits 0 */ |
static HUFF_ELEMENT huff_table_11[] = |
{ |
0xFF000008, 0x00000101, 0x00000106, 0x0000010F, 0x00000114, /* 4 */ |
0x00000117, 0x08070202, 0x08020702, 0x0000011C, 0x07010702, /* 9 */ |
0x07010702, 0x08070102, 0x08000701, 0x08060302, 0x08030602, /* 14 */ |
0x08000601, 0x0000011F, 0x00000122, 0x08050102, 0x07020602, /* 19 */ |
0x07020602, 0x08060202, 0x08060001, 0x07060102, 0x07060102, /* 24 */ |
0x07010602, 0x07010602, 0x08010502, 0x08040302, 0x08000501, /* 29 */ |
0x00000125, 0x08040202, 0x08020402, 0x08040102, 0x08010402, /* 34 */ |
0x08040001, 0x08000401, 0x07030202, 0x07030202, 0x07020302, /* 39 */ |
0x07020302, 0x06030102, 0x06030102, 0x06030102, 0x06030102, /* 44 */ |
0x06010302, 0x06010302, 0x06010302, 0x06010302, 0x07030001, /* 49 */ |
0x07030001, 0x07000301, 0x07000301, 0x06020202, 0x06020202, /* 54 */ |
0x06020202, 0x06020202, 0x05010202, 0x05010202, 0x05010202, /* 59 */ |
0x05010202, 0x05010202, 0x05010202, 0x05010202, 0x05010202, /* 64 */ |
0x04020102, 0x04020102, 0x04020102, 0x04020102, 0x04020102, /* 69 */ |
0x04020102, 0x04020102, 0x04020102, 0x04020102, 0x04020102, /* 74 */ |
0x04020102, 0x04020102, 0x04020102, 0x04020102, 0x04020102, /* 79 */ |
0x04020102, 0x05020001, 0x05020001, 0x05020001, 0x05020001, /* 84 */ |
0x05020001, 0x05020001, 0x05020001, 0x05020001, 0x05000201, /* 89 */ |
0x05000201, 0x05000201, 0x05000201, 0x05000201, 0x05000201, /* 94 */ |
0x05000201, 0x05000201, 0x03010102, 0x03010102, 0x03010102, /* 99 */ |
0x03010102, 0x03010102, 0x03010102, 0x03010102, 0x03010102, /* 104 */ |
0x03010102, 0x03010102, 0x03010102, 0x03010102, 0x03010102, /* 109 */ |
0x03010102, 0x03010102, 0x03010102, 0x03010102, 0x03010102, /* 114 */ |
0x03010102, 0x03010102, 0x03010102, 0x03010102, 0x03010102, /* 119 */ |
0x03010102, 0x03010102, 0x03010102, 0x03010102, 0x03010102, /* 124 */ |
0x03010102, 0x03010102, 0x03010102, 0x03010102, 0x03010001, /* 129 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 134 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 139 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 144 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 149 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 154 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 159 */ |
0x03010001, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 164 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 169 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 174 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 179 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 184 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 189 */ |
0x03000101, 0x03000101, 0x03000101, 0x02000000, 0x02000000, /* 194 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 199 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 204 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 209 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 214 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 219 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 224 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 229 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 234 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 239 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 244 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 249 */ |
0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000, /* 254 */ |
0x02000000, 0x02000000, 0xFF000002, 0x02070702, 0x02070602, /* 259 */ |
0x02060702, 0x02050702, 0xFF000003, 0x02060602, 0x02060602, /* 264 */ |
0x02070402, 0x02070402, 0x02040702, 0x02040702, 0x03070502, /* 269 */ |
0x03050502, 0xFF000002, 0x02060502, 0x02050602, 0x01070302, /* 274 */ |
0x01070302, 0xFF000001, 0x01030702, 0x01060402, 0xFF000002, /* 279 */ |
0x02050402, 0x02040502, 0x02050302, 0x02030502, 0xFF000001, /* 284 */ |
0x01040602, 0x01070001, 0xFF000001, 0x01040402, 0x01050202, /* 289 */ |
0xFF000001, 0x01020502, 0x01050001, 0xFF000001, 0x01030402, /* 294 */ |
0x01030302,}; |
/* max table bits 8 */ |
/* TABLE 12 64 entries maxbits 10 linbits 0 */ |
static HUFF_ELEMENT huff_table_12[] = |
{ |
0xFF000007, 0x00000081, 0x0000008A, 0x0000008F, 0x00000092, /* 4 */ |
0x00000097, 0x0000009A, 0x0000009D, 0x000000A2, 0x000000A5, /* 9 */ |
0x000000A8, 0x07060202, 0x07020602, 0x07010602, 0x000000AD, /* 14 */ |
0x000000B0, 0x000000B3, 0x07050102, 0x07010502, 0x07040302, /* 19 */ |
0x07030402, 0x000000B6, 0x07040202, 0x07020402, 0x07040102, /* 24 */ |
0x06030302, 0x06030302, 0x06010402, 0x06010402, 0x06030202, /* 29 */ |
0x06030202, 0x06020302, 0x06020302, 0x07000401, 0x07030001, /* 34 */ |
0x06000301, 0x06000301, 0x05030102, 0x05030102, 0x05030102, /* 39 */ |
0x05030102, 0x05010302, 0x05010302, 0x05010302, 0x05010302, /* 44 */ |
0x05020202, 0x05020202, 0x05020202, 0x05020202, 0x04020102, /* 49 */ |
0x04020102, 0x04020102, 0x04020102, 0x04020102, 0x04020102, /* 54 */ |
0x04020102, 0x04020102, 0x04010202, 0x04010202, 0x04010202, /* 59 */ |
0x04010202, 0x04010202, 0x04010202, 0x04010202, 0x04010202, /* 64 */ |
0x05020001, 0x05020001, 0x05020001, 0x05020001, 0x05000201, /* 69 */ |
0x05000201, 0x05000201, 0x05000201, 0x04000000, 0x04000000, /* 74 */ |
0x04000000, 0x04000000, 0x04000000, 0x04000000, 0x04000000, /* 79 */ |
0x04000000, 0x03010102, 0x03010102, 0x03010102, 0x03010102, /* 84 */ |
0x03010102, 0x03010102, 0x03010102, 0x03010102, 0x03010102, /* 89 */ |
0x03010102, 0x03010102, 0x03010102, 0x03010102, 0x03010102, /* 94 */ |
0x03010102, 0x03010102, 0x03010001, 0x03010001, 0x03010001, /* 99 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 104 */ |
0x03010001, 0x03010001, 0x03010001, 0x03010001, 0x03010001, /* 109 */ |
0x03010001, 0x03010001, 0x03010001, 0x03000101, 0x03000101, /* 114 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 119 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 124 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0xFF000003, /* 129 */ |
0x03070702, 0x03070602, 0x02060702, 0x02060702, 0x02070502, /* 134 */ |
0x02070502, 0x02050702, 0x02050702, 0xFF000002, 0x02060602, /* 139 */ |
0x02070402, 0x02040702, 0x02050602, 0xFF000001, 0x01060502, /* 144 */ |
0x01070302, 0xFF000002, 0x02030702, 0x02050502, 0x01070202, /* 149 */ |
0x01070202, 0xFF000001, 0x01020702, 0x01060402, 0xFF000001, /* 154 */ |
0x01040602, 0x01070102, 0xFF000002, 0x01010702, 0x01010702, /* 159 */ |
0x02070001, 0x02000701, 0xFF000001, 0x01060302, 0x01030602, /* 164 */ |
0xFF000001, 0x01050402, 0x01040502, 0xFF000002, 0x01040402, /* 169 */ |
0x01040402, 0x02060001, 0x02050001, 0xFF000001, 0x01060102, /* 174 */ |
0x01000601, 0xFF000001, 0x01050302, 0x01030502, 0xFF000001, /* 179 */ |
0x01050202, 0x01020502, 0xFF000001, 0x01000501, 0x01040001, /* 184 */ }; |
/* max table bits 7 */ |
/* TABLE 13 256 entries maxbits 19 linbits 0 */ |
static HUFF_ELEMENT huff_table_13[] = |
{ |
0xFF000006, 0x00000041, 0x00000082, 0x000000C3, 0x000000E4, /* 4 */ |
0x00000105, 0x00000116, 0x0000011F, 0x00000130, 0x00000139, /* 9 */ |
0x0000013E, 0x00000143, 0x00000146, 0x06020102, 0x06010202, /* 14 */ |
0x06020001, 0x06000201, 0x04010102, 0x04010102, 0x04010102, /* 19 */ |
0x04010102, 0x04010001, 0x04010001, 0x04010001, 0x04010001, /* 24 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 29 */ |
0x03000101, 0x03000101, 0x03000101, 0x01000000, 0x01000000, /* 34 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 39 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 44 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 49 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 54 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 59 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 64 */ |
0xFF000006, 0x00000108, 0x00000111, 0x0000011A, 0x00000123, /* 69 */ |
0x0000012C, 0x00000131, 0x00000136, 0x0000013F, 0x00000144, /* 74 */ |
0x00000147, 0x0000014C, 0x00000151, 0x00000156, 0x0000015B, /* 79 */ |
0x060F0102, 0x06010F02, 0x06000F01, 0x00000160, 0x00000163, /* 84 */ |
0x00000166, 0x06020E02, 0x00000169, 0x060E0102, 0x06010E02, /* 89 */ |
0x0000016C, 0x0000016F, 0x00000172, 0x00000175, 0x00000178, /* 94 */ |
0x0000017B, 0x06060C02, 0x060D0302, 0x0000017E, 0x060D0202, /* 99 */ |
0x06020D02, 0x060D0102, 0x06070B02, 0x00000181, 0x00000184, /* 104 */ |
0x06030C02, 0x00000187, 0x060B0402, 0x05010D02, 0x05010D02, /* 109 */ |
0x060D0001, 0x06000D01, 0x060A0802, 0x06080A02, 0x060C0402, /* 114 */ |
0x06040C02, 0x060B0602, 0x06060B02, 0x050C0302, 0x050C0302, /* 119 */ |
0x050C0202, 0x050C0202, 0x05020C02, 0x05020C02, 0x050B0502, /* 124 */ |
0x050B0502, 0x06050B02, 0x06090802, 0x050C0102, 0x050C0102, /* 129 */ |
0xFF000006, 0x05010C02, 0x05010C02, 0x06080902, 0x060C0001, /* 134 */ |
0x05000C01, 0x05000C01, 0x06040B02, 0x060A0602, 0x06060A02, /* 139 */ |
0x06090702, 0x050B0302, 0x050B0302, 0x05030B02, 0x05030B02, /* 144 */ |
0x06080802, 0x060A0502, 0x050B0202, 0x050B0202, 0x06050A02, /* 149 */ |
0x06090602, 0x05040A02, 0x05040A02, 0x06080702, 0x06070802, /* 154 */ |
0x05040902, 0x05040902, 0x06070702, 0x06060702, 0x04020B02, /* 159 */ |
0x04020B02, 0x04020B02, 0x04020B02, 0x040B0102, 0x040B0102, /* 164 */ |
0x040B0102, 0x040B0102, 0x04010B02, 0x04010B02, 0x04010B02, /* 169 */ |
0x04010B02, 0x050B0001, 0x050B0001, 0x05000B01, 0x05000B01, /* 174 */ |
0x05060902, 0x05060902, 0x050A0402, 0x050A0402, 0x050A0302, /* 179 */ |
0x050A0302, 0x05030A02, 0x05030A02, 0x05090502, 0x05090502, /* 184 */ |
0x05050902, 0x05050902, 0x040A0202, 0x040A0202, 0x040A0202, /* 189 */ |
0x040A0202, 0x04020A02, 0x04020A02, 0x04020A02, 0x04020A02, /* 194 */ |
0xFF000005, 0x040A0102, 0x040A0102, 0x04010A02, 0x04010A02, /* 199 */ |
0x050A0001, 0x05080602, 0x04000A01, 0x04000A01, 0x05060802, /* 204 */ |
0x05090402, 0x04030902, 0x04030902, 0x05090302, 0x05080502, /* 209 */ |
0x05050802, 0x05070602, 0x04090202, 0x04090202, 0x04020902, /* 214 */ |
0x04020902, 0x05070502, 0x05050702, 0x04080302, 0x04080302, /* 219 */ |
0x04030802, 0x04030802, 0x05060602, 0x05070402, 0x05040702, /* 224 */ |
0x05060502, 0x05050602, 0x05030702, 0xFF000005, 0x03090102, /* 229 */ |
0x03090102, 0x03090102, 0x03090102, 0x03010902, 0x03010902, /* 234 */ |
0x03010902, 0x03010902, 0x04090001, 0x04090001, 0x04000901, /* 239 */ |
0x04000901, 0x04080402, 0x04080402, 0x04040802, 0x04040802, /* 244 */ |
0x04020702, 0x04020702, 0x05060402, 0x05040602, 0x03080202, /* 249 */ |
0x03080202, 0x03080202, 0x03080202, 0x03020802, 0x03020802, /* 254 */ |
0x03020802, 0x03020802, 0x03080102, 0x03080102, 0x03080102, /* 259 */ |
0x03080102, 0xFF000004, 0x04070302, 0x04070202, 0x03070102, /* 264 */ |
0x03070102, 0x03010702, 0x03010702, 0x04050502, 0x04070001, /* 269 */ |
0x04000701, 0x04060302, 0x04030602, 0x04050402, 0x04040502, /* 274 */ |
0x04060202, 0x04020602, 0x04050302, 0xFF000003, 0x02010802, /* 279 */ |
0x02010802, 0x03080001, 0x03000801, 0x03060102, 0x03010602, /* 284 */ |
0x03060001, 0x03000601, 0xFF000004, 0x04030502, 0x04040402, /* 289 */ |
0x03050202, 0x03050202, 0x03020502, 0x03020502, 0x03050001, /* 294 */ |
0x03050001, 0x02050102, 0x02050102, 0x02050102, 0x02050102, /* 299 */ |
0x02010502, 0x02010502, 0x02010502, 0x02010502, 0xFF000003, /* 304 */ |
0x03040302, 0x03030402, 0x03000501, 0x03040202, 0x03020402, /* 309 */ |
0x03030302, 0x02040102, 0x02040102, 0xFF000002, 0x01010402, /* 314 */ |
0x01010402, 0x02040001, 0x02000401, 0xFF000002, 0x02030202, /* 319 */ |
0x02020302, 0x01030102, 0x01030102, 0xFF000001, 0x01010302, /* 324 */ |
0x01030001, 0xFF000001, 0x01000301, 0x01020202, 0xFF000003, /* 329 */ |
0x00000082, 0x0000008B, 0x0000008E, 0x00000091, 0x00000094, /* 334 */ |
0x00000097, 0x030C0E02, 0x030D0D02, 0xFF000003, 0x00000093, /* 339 */ |
0x030E0B02, 0x030B0E02, 0x030F0902, 0x03090F02, 0x030A0E02, /* 344 */ |
0x030D0B02, 0x030B0D02, 0xFF000003, 0x030F0802, 0x03080F02, /* 349 */ |
0x030C0C02, 0x0000008D, 0x030E0802, 0x00000090, 0x02070F02, /* 354 */ |
0x02070F02, 0xFF000003, 0x020A0D02, 0x020A0D02, 0x030D0A02, /* 359 */ |
0x030C0B02, 0x030B0C02, 0x03060F02, 0x020F0602, 0x020F0602, /* 364 */ |
0xFF000002, 0x02080E02, 0x020F0502, 0x020D0902, 0x02090D02, /* 369 */ |
0xFF000002, 0x02050F02, 0x02070E02, 0x020C0A02, 0x020B0B02, /* 374 */ |
0xFF000003, 0x020F0402, 0x020F0402, 0x02040F02, 0x02040F02, /* 379 */ |
0x030A0C02, 0x03060E02, 0x02030F02, 0x02030F02, 0xFF000002, /* 384 */ |
0x010F0302, 0x010F0302, 0x020D0802, 0x02080D02, 0xFF000001, /* 389 */ |
0x010F0202, 0x01020F02, 0xFF000002, 0x020E0602, 0x020C0902, /* 394 */ |
0x010F0001, 0x010F0001, 0xFF000002, 0x02090C02, 0x020E0502, /* 399 */ |
0x010B0A02, 0x010B0A02, 0xFF000002, 0x020D0702, 0x02070D02, /* 404 */ |
0x010E0402, 0x010E0402, 0xFF000002, 0x02080C02, 0x02060D02, /* 409 */ |
0x010E0302, 0x010E0302, 0xFF000002, 0x01090B02, 0x01090B02, /* 414 */ |
0x020B0902, 0x020A0A02, 0xFF000001, 0x010A0B02, 0x01050E02, /* 419 */ |
0xFF000001, 0x01040E02, 0x010C0802, 0xFF000001, 0x010D0602, /* 424 */ |
0x01030E02, 0xFF000001, 0x010E0202, 0x010E0001, 0xFF000001, /* 429 */ |
0x01000E01, 0x010D0502, 0xFF000001, 0x01050D02, 0x010C0702, /* 434 */ |
0xFF000001, 0x01070C02, 0x010D0402, 0xFF000001, 0x010B0802, /* 439 */ |
0x01080B02, 0xFF000001, 0x01040D02, 0x010A0902, 0xFF000001, /* 444 */ |
0x01090A02, 0x010C0602, 0xFF000001, 0x01030D02, 0x010B0702, /* 449 */ |
0xFF000001, 0x010C0502, 0x01050C02, 0xFF000001, 0x01090902, /* 454 */ |
0x010A0702, 0xFF000001, 0x01070A02, 0x01070902, 0xFF000003, /* 459 */ |
0x00000023, 0x030D0F02, 0x020D0E02, 0x020D0E02, 0x010F0F02, /* 464 */ |
0x010F0F02, 0x010F0F02, 0x010F0F02, 0xFF000001, 0x010F0E02, /* 469 */ |
0x010F0D02, 0xFF000001, 0x010E0E02, 0x010F0C02, 0xFF000001, /* 474 */ |
0x010E0D02, 0x010F0B02, 0xFF000001, 0x010B0F02, 0x010E0C02, /* 479 */ |
0xFF000002, 0x010C0D02, 0x010C0D02, 0x020F0A02, 0x02090E02, /* 484 */ |
0xFF000001, 0x010A0F02, 0x010D0C02, 0xFF000001, 0x010E0A02, /* 489 */ |
0x010E0902, 0xFF000001, 0x010F0702, 0x010E0702, 0xFF000001, /* 494 */ |
0x010E0F02, 0x010C0F02,}; |
/* max table bits 6 */ |
/* NO XING TABLE 14 */ |
/* TABLE 15 256 entries maxbits 13 linbits 0 */ |
static HUFF_ELEMENT huff_table_15[] = |
{ |
0xFF000008, 0x00000101, 0x00000122, 0x00000143, 0x00000154, /* 4 */ |
0x00000165, 0x00000176, 0x0000017F, 0x00000188, 0x00000199, /* 9 */ |
0x000001A2, 0x000001AB, 0x000001B4, 0x000001BD, 0x000001C2, /* 14 */ |
0x000001CB, 0x000001D4, 0x000001D9, 0x000001DE, 0x000001E3, /* 19 */ |
0x000001E8, 0x000001ED, 0x000001F2, 0x000001F7, 0x000001FC, /* 24 */ |
0x00000201, 0x00000204, 0x00000207, 0x0000020A, 0x0000020F, /* 29 */ |
0x00000212, 0x00000215, 0x0000021A, 0x0000021D, 0x00000220, /* 34 */ |
0x08010902, 0x00000223, 0x00000226, 0x00000229, 0x0000022C, /* 39 */ |
0x0000022F, 0x08080202, 0x08020802, 0x08080102, 0x08010802, /* 44 */ |
0x00000232, 0x00000235, 0x00000238, 0x0000023B, 0x08070202, /* 49 */ |
0x08020702, 0x08040602, 0x08070102, 0x08050502, 0x08010702, /* 54 */ |
0x0000023E, 0x08060302, 0x08030602, 0x08050402, 0x08040502, /* 59 */ |
0x08060202, 0x08020602, 0x08060102, 0x00000241, 0x08050302, /* 64 */ |
0x07010602, 0x07010602, 0x08030502, 0x08040402, 0x07050202, /* 69 */ |
0x07050202, 0x07020502, 0x07020502, 0x07050102, 0x07050102, /* 74 */ |
0x07010502, 0x07010502, 0x08050001, 0x08000501, 0x07040302, /* 79 */ |
0x07040302, 0x07030402, 0x07030402, 0x07040202, 0x07040202, /* 84 */ |
0x07020402, 0x07020402, 0x07030302, 0x07030302, 0x06010402, /* 89 */ |
0x06010402, 0x06010402, 0x06010402, 0x07040102, 0x07040102, /* 94 */ |
0x07040001, 0x07040001, 0x06030202, 0x06030202, 0x06030202, /* 99 */ |
0x06030202, 0x06020302, 0x06020302, 0x06020302, 0x06020302, /* 104 */ |
0x07000401, 0x07000401, 0x07030001, 0x07030001, 0x06030102, /* 109 */ |
0x06030102, 0x06030102, 0x06030102, 0x06010302, 0x06010302, /* 114 */ |
0x06010302, 0x06010302, 0x06000301, 0x06000301, 0x06000301, /* 119 */ |
0x06000301, 0x05020202, 0x05020202, 0x05020202, 0x05020202, /* 124 */ |
0x05020202, 0x05020202, 0x05020202, 0x05020202, 0x05020102, /* 129 */ |
0x05020102, 0x05020102, 0x05020102, 0x05020102, 0x05020102, /* 134 */ |
0x05020102, 0x05020102, 0x05010202, 0x05010202, 0x05010202, /* 139 */ |
0x05010202, 0x05010202, 0x05010202, 0x05010202, 0x05010202, /* 144 */ |
0x05020001, 0x05020001, 0x05020001, 0x05020001, 0x05020001, /* 149 */ |
0x05020001, 0x05020001, 0x05020001, 0x05000201, 0x05000201, /* 154 */ |
0x05000201, 0x05000201, 0x05000201, 0x05000201, 0x05000201, /* 159 */ |
0x05000201, 0x03010102, 0x03010102, 0x03010102, 0x03010102, /* 164 */ |
0x03010102, 0x03010102, 0x03010102, 0x03010102, 0x03010102, /* 169 */ |
0x03010102, 0x03010102, 0x03010102, 0x03010102, 0x03010102, /* 174 */ |
0x03010102, 0x03010102, 0x03010102, 0x03010102, 0x03010102, /* 179 */ |
0x03010102, 0x03010102, 0x03010102, 0x03010102, 0x03010102, /* 184 */ |
0x03010102, 0x03010102, 0x03010102, 0x03010102, 0x03010102, /* 189 */ |
0x03010102, 0x03010102, 0x03010102, 0x04010001, 0x04010001, /* 194 */ |
0x04010001, 0x04010001, 0x04010001, 0x04010001, 0x04010001, /* 199 */ |
0x04010001, 0x04010001, 0x04010001, 0x04010001, 0x04010001, /* 204 */ |
0x04010001, 0x04010001, 0x04010001, 0x04010001, 0x04000101, /* 209 */ |
0x04000101, 0x04000101, 0x04000101, 0x04000101, 0x04000101, /* 214 */ |
0x04000101, 0x04000101, 0x04000101, 0x04000101, 0x04000101, /* 219 */ |
0x04000101, 0x04000101, 0x04000101, 0x04000101, 0x04000101, /* 224 */ |
0x03000000, 0x03000000, 0x03000000, 0x03000000, 0x03000000, /* 229 */ |
0x03000000, 0x03000000, 0x03000000, 0x03000000, 0x03000000, /* 234 */ |
0x03000000, 0x03000000, 0x03000000, 0x03000000, 0x03000000, /* 239 */ |
0x03000000, 0x03000000, 0x03000000, 0x03000000, 0x03000000, /* 244 */ |
0x03000000, 0x03000000, 0x03000000, 0x03000000, 0x03000000, /* 249 */ |
0x03000000, 0x03000000, 0x03000000, 0x03000000, 0x03000000, /* 254 */ |
0x03000000, 0x03000000, 0xFF000005, 0x050F0F02, 0x050F0E02, /* 259 */ |
0x050E0F02, 0x050F0D02, 0x040E0E02, 0x040E0E02, 0x050D0F02, /* 264 */ |
0x050F0C02, 0x050C0F02, 0x050E0D02, 0x050D0E02, 0x050F0B02, /* 269 */ |
0x040B0F02, 0x040B0F02, 0x050E0C02, 0x050C0E02, 0x040D0D02, /* 274 */ |
0x040D0D02, 0x040F0A02, 0x040F0A02, 0x040A0F02, 0x040A0F02, /* 279 */ |
0x040E0B02, 0x040E0B02, 0x040B0E02, 0x040B0E02, 0x040D0C02, /* 284 */ |
0x040D0C02, 0x040C0D02, 0x040C0D02, 0x040F0902, 0x040F0902, /* 289 */ |
0xFF000005, 0x04090F02, 0x04090F02, 0x040A0E02, 0x040A0E02, /* 294 */ |
0x040D0B02, 0x040D0B02, 0x040B0D02, 0x040B0D02, 0x040F0802, /* 299 */ |
0x040F0802, 0x04080F02, 0x04080F02, 0x040C0C02, 0x040C0C02, /* 304 */ |
0x040E0902, 0x040E0902, 0x04090E02, 0x04090E02, 0x040F0702, /* 309 */ |
0x040F0702, 0x04070F02, 0x04070F02, 0x040D0A02, 0x040D0A02, /* 314 */ |
0x040A0D02, 0x040A0D02, 0x040C0B02, 0x040C0B02, 0x040F0602, /* 319 */ |
0x040F0602, 0x050E0A02, 0x050F0001, 0xFF000004, 0x030B0C02, /* 324 */ |
0x030B0C02, 0x03060F02, 0x03060F02, 0x040E0802, 0x04080E02, /* 329 */ |
0x040F0502, 0x040D0902, 0x03050F02, 0x03050F02, 0x030E0702, /* 334 */ |
0x030E0702, 0x03070E02, 0x03070E02, 0x030C0A02, 0x030C0A02, /* 339 */ |
0xFF000004, 0x030A0C02, 0x030A0C02, 0x030B0B02, 0x030B0B02, /* 344 */ |
0x04090D02, 0x040D0802, 0x030F0402, 0x030F0402, 0x03040F02, /* 349 */ |
0x03040F02, 0x030F0302, 0x030F0302, 0x03030F02, 0x03030F02, /* 354 */ |
0x03080D02, 0x03080D02, 0xFF000004, 0x03060E02, 0x03060E02, /* 359 */ |
0x030F0202, 0x030F0202, 0x03020F02, 0x03020F02, 0x040E0602, /* 364 */ |
0x04000F01, 0x030F0102, 0x030F0102, 0x03010F02, 0x03010F02, /* 369 */ |
0x030C0902, 0x030C0902, 0x03090C02, 0x03090C02, 0xFF000003, /* 374 */ |
0x030E0502, 0x030B0A02, 0x030A0B02, 0x03050E02, 0x030D0702, /* 379 */ |
0x03070D02, 0x030E0402, 0x03040E02, 0xFF000003, 0x030C0802, /* 384 */ |
0x03080C02, 0x030E0302, 0x030D0602, 0x03060D02, 0x03030E02, /* 389 */ |
0x030B0902, 0x03090B02, 0xFF000004, 0x030E0202, 0x030E0202, /* 394 */ |
0x030A0A02, 0x030A0A02, 0x03020E02, 0x03020E02, 0x030E0102, /* 399 */ |
0x030E0102, 0x03010E02, 0x03010E02, 0x040E0001, 0x04000E01, /* 404 */ |
0x030D0502, 0x030D0502, 0x03050D02, 0x03050D02, 0xFF000003, /* 409 */ |
0x030C0702, 0x03070C02, 0x030D0402, 0x030B0802, 0x02040D02, /* 414 */ |
0x02040D02, 0x03080B02, 0x030A0902, 0xFF000003, 0x03090A02, /* 419 */ |
0x030C0602, 0x03060C02, 0x030D0302, 0x02030D02, 0x02030D02, /* 424 */ |
0x02020D02, 0x02020D02, 0xFF000003, 0x030D0202, 0x030D0001, /* 429 */ |
0x020D0102, 0x020D0102, 0x020B0702, 0x020B0702, 0x02070B02, /* 434 */ |
0x02070B02, 0xFF000003, 0x02010D02, 0x02010D02, 0x030C0502, /* 439 */ |
0x03000D01, 0x02050C02, 0x02050C02, 0x020A0802, 0x020A0802, /* 444 */ |
0xFF000002, 0x02080A02, 0x020C0402, 0x02040C02, 0x020B0602, /* 449 */ |
0xFF000003, 0x02060B02, 0x02060B02, 0x03090902, 0x030C0001, /* 454 */ |
0x020C0302, 0x020C0302, 0x02030C02, 0x02030C02, 0xFF000003, /* 459 */ |
0x020A0702, 0x020A0702, 0x02070A02, 0x02070A02, 0x02060A02, /* 464 */ |
0x02060A02, 0x03000C01, 0x030B0001, 0xFF000002, 0x01020C02, /* 469 */ |
0x01020C02, 0x020C0202, 0x020B0502, 0xFF000002, 0x02050B02, /* 474 */ |
0x020C0102, 0x02090802, 0x02080902, 0xFF000002, 0x02010C02, /* 479 */ |
0x020B0402, 0x02040B02, 0x020A0602, 0xFF000002, 0x020B0302, /* 484 */ |
0x02090702, 0x01030B02, 0x01030B02, 0xFF000002, 0x02070902, /* 489 */ |
0x02080802, 0x020B0202, 0x020A0502, 0xFF000002, 0x01020B02, /* 494 */ |
0x01020B02, 0x02050A02, 0x020B0102, 0xFF000002, 0x01010B02, /* 499 */ |
0x01010B02, 0x02000B01, 0x02090602, 0xFF000002, 0x02060902, /* 504 */ |
0x020A0402, 0x02040A02, 0x02080702, 0xFF000002, 0x02070802, /* 509 */ |
0x020A0302, 0x01030A02, 0x01030A02, 0xFF000001, 0x01090502, /* 514 */ |
0x01050902, 0xFF000001, 0x010A0202, 0x01020A02, 0xFF000001, /* 519 */ |
0x010A0102, 0x01010A02, 0xFF000002, 0x020A0001, 0x02000A01, /* 524 */ |
0x01080602, 0x01080602, 0xFF000001, 0x01060802, 0x01090402, /* 529 */ |
0xFF000001, 0x01040902, 0x01090302, 0xFF000002, 0x01030902, /* 534 */ |
0x01030902, 0x02070702, 0x02090001, 0xFF000001, 0x01080502, /* 539 */ |
0x01050802, 0xFF000001, 0x01090202, 0x01070602, 0xFF000001, /* 544 */ |
0x01060702, 0x01020902, 0xFF000001, 0x01090102, 0x01000901, /* 549 */ |
0xFF000001, 0x01080402, 0x01040802, 0xFF000001, 0x01070502, /* 554 */ |
0x01050702, 0xFF000001, 0x01080302, 0x01030802, 0xFF000001, /* 559 */ |
0x01060602, 0x01070402, 0xFF000001, 0x01040702, 0x01080001, /* 564 */ |
0xFF000001, 0x01000801, 0x01060502, 0xFF000001, 0x01050602, /* 569 */ |
0x01070302, 0xFF000001, 0x01030702, 0x01060402, 0xFF000001, /* 574 */ |
0x01070001, 0x01000701, 0xFF000001, 0x01060001, 0x01000601, /* 579 */ }; |
/* max table bits 8 */ |
/* TABLE 16 256 entries maxbits 17 linbits 0 */ |
static HUFF_ELEMENT huff_table_16[] = |
{ |
0xFF000008, 0x00000101, 0x0000010A, 0x00000113, 0x080F0F02, /* 4 */ |
0x00000118, 0x0000011D, 0x00000120, 0x08020F02, 0x00000131, /* 9 */ |
0x080F0102, 0x08010F02, 0x00000134, 0x00000145, 0x00000156, /* 14 */ |
0x00000167, 0x00000178, 0x00000189, 0x0000019A, 0x000001A3, /* 19 */ |
0x000001AC, 0x000001B5, 0x000001BE, 0x000001C7, 0x000001D0, /* 24 */ |
0x000001D9, 0x000001DE, 0x000001E3, 0x000001E6, 0x000001EB, /* 29 */ |
0x000001F0, 0x08010502, 0x000001F3, 0x000001F6, 0x000001F9, /* 34 */ |
0x000001FC, 0x08040102, 0x08010402, 0x000001FF, 0x08030202, /* 39 */ |
0x08020302, 0x07030102, 0x07030102, 0x07010302, 0x07010302, /* 44 */ |
0x08030001, 0x08000301, 0x07020202, 0x07020202, 0x06020102, /* 49 */ |
0x06020102, 0x06020102, 0x06020102, 0x06010202, 0x06010202, /* 54 */ |
0x06010202, 0x06010202, 0x06020001, 0x06020001, 0x06020001, /* 59 */ |
0x06020001, 0x06000201, 0x06000201, 0x06000201, 0x06000201, /* 64 */ |
0x04010102, 0x04010102, 0x04010102, 0x04010102, 0x04010102, /* 69 */ |
0x04010102, 0x04010102, 0x04010102, 0x04010102, 0x04010102, /* 74 */ |
0x04010102, 0x04010102, 0x04010102, 0x04010102, 0x04010102, /* 79 */ |
0x04010102, 0x04010001, 0x04010001, 0x04010001, 0x04010001, /* 84 */ |
0x04010001, 0x04010001, 0x04010001, 0x04010001, 0x04010001, /* 89 */ |
0x04010001, 0x04010001, 0x04010001, 0x04010001, 0x04010001, /* 94 */ |
0x04010001, 0x04010001, 0x03000101, 0x03000101, 0x03000101, /* 99 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 104 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 109 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 114 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 119 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x03000101, /* 124 */ |
0x03000101, 0x03000101, 0x03000101, 0x03000101, 0x01000000, /* 129 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 134 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 139 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 144 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 149 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 154 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 159 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 164 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 169 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 174 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 179 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 184 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 189 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 194 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 199 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 204 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 209 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 214 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 219 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 224 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 229 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 234 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 239 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 244 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 249 */ |
0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000, /* 254 */ |
0x01000000, 0x01000000, 0xFF000003, 0x030F0E02, 0x030E0F02, /* 259 */ |
0x030F0D02, 0x030D0F02, 0x030F0C02, 0x030C0F02, 0x030F0B02, /* 264 */ |
0x030B0F02, 0xFF000003, 0x020F0A02, 0x020F0A02, 0x030A0F02, /* 269 */ |
0x030F0902, 0x03090F02, 0x03080F02, 0x020F0802, 0x020F0802, /* 274 */ |
0xFF000002, 0x020F0702, 0x02070F02, 0x020F0602, 0x02060F02, /* 279 */ |
0xFF000002, 0x020F0502, 0x02050F02, 0x010F0402, 0x010F0402, /* 284 */ |
0xFF000001, 0x01040F02, 0x01030F02, 0xFF000004, 0x01000F01, /* 289 */ |
0x01000F01, 0x01000F01, 0x01000F01, 0x01000F01, 0x01000F01, /* 294 */ |
0x01000F01, 0x01000F01, 0x020F0302, 0x020F0302, 0x020F0302, /* 299 */ |
0x020F0302, 0x000000E2, 0x000000F3, 0x000000FC, 0x00000105, /* 304 */ |
0xFF000001, 0x010F0202, 0x010F0001, 0xFF000004, 0x000000FA, /* 309 */ |
0x000000FF, 0x00000104, 0x00000109, 0x0000010C, 0x00000111, /* 314 */ |
0x00000116, 0x00000119, 0x0000011E, 0x00000123, 0x00000128, /* 319 */ |
0x04030E02, 0x0000012D, 0x00000130, 0x00000133, 0x00000136, /* 324 */ |
0xFF000004, 0x00000128, 0x0000012B, 0x0000012E, 0x040D0001, /* 329 */ |
0x00000131, 0x00000134, 0x00000137, 0x040C0302, 0x0000013A, /* 334 */ |
0x040C0102, 0x04000C01, 0x0000013D, 0x03020E02, 0x03020E02, /* 339 */ |
0x040E0202, 0x040E0102, 0xFF000004, 0x04030D02, 0x040D0202, /* 344 */ |
0x04020D02, 0x04010D02, 0x040B0302, 0x0000012F, 0x030D0102, /* 349 */ |
0x030D0102, 0x04040C02, 0x040B0602, 0x04030C02, 0x04070A02, /* 354 */ |
0x030C0202, 0x030C0202, 0x04020C02, 0x04050B02, 0xFF000004, /* 359 */ |
0x04010C02, 0x040C0001, 0x040B0402, 0x04040B02, 0x040A0602, /* 364 */ |
0x04060A02, 0x03030B02, 0x03030B02, 0x040A0502, 0x04050A02, /* 369 */ |
0x030B0202, 0x030B0202, 0x03020B02, 0x03020B02, 0x030B0102, /* 374 */ |
0x030B0102, 0xFF000004, 0x03010B02, 0x03010B02, 0x040B0001, /* 379 */ |
0x04000B01, 0x04090602, 0x04060902, 0x040A0402, 0x04040A02, /* 384 */ |
0x04080702, 0x04070802, 0x03030A02, 0x03030A02, 0x040A0302, /* 389 */ |
0x04090502, 0x030A0202, 0x030A0202, 0xFF000004, 0x04050902, /* 394 */ |
0x04080602, 0x03010A02, 0x03010A02, 0x04060802, 0x04070702, /* 399 */ |
0x03040902, 0x03040902, 0x04090402, 0x04070502, 0x03070602, /* 404 */ |
0x03070602, 0x02020A02, 0x02020A02, 0x02020A02, 0x02020A02, /* 409 */ |
0xFF000003, 0x020A0102, 0x020A0102, 0x030A0001, 0x03000A01, /* 414 */ |
0x03090302, 0x03030902, 0x03080502, 0x03050802, 0xFF000003, /* 419 */ |
0x02090202, 0x02090202, 0x02020902, 0x02020902, 0x03060702, /* 424 */ |
0x03090001, 0x02090102, 0x02090102, 0xFF000003, 0x02010902, /* 429 */ |
0x02010902, 0x03000901, 0x03080402, 0x03040802, 0x03050702, /* 434 */ |
0x03080302, 0x03030802, 0xFF000003, 0x03060602, 0x03080202, /* 439 */ |
0x02020802, 0x02020802, 0x03070402, 0x03040702, 0x02080102, /* 444 */ |
0x02080102, 0xFF000003, 0x02010802, 0x02010802, 0x02000801, /* 449 */ |
0x02000801, 0x03080001, 0x03060502, 0x02070302, 0x02070302, /* 454 */ |
0xFF000003, 0x02030702, 0x02030702, 0x03050602, 0x03060402, /* 459 */ |
0x02070202, 0x02070202, 0x02020702, 0x02020702, 0xFF000003, /* 464 */ |
0x03040602, 0x03050502, 0x02070001, 0x02070001, 0x01070102, /* 469 */ |
0x01070102, 0x01070102, 0x01070102, 0xFF000002, 0x01010702, /* 474 */ |
0x01010702, 0x02000701, 0x02060302, 0xFF000002, 0x02030602, /* 479 */ |
0x02050402, 0x02040502, 0x02060202, 0xFF000001, 0x01020602, /* 484 */ |
0x01060102, 0xFF000002, 0x01010602, 0x01010602, 0x02060001, /* 489 */ |
0x02000601, 0xFF000002, 0x01030502, 0x01030502, 0x02050302, /* 494 */ |
0x02040402, 0xFF000001, 0x01050202, 0x01020502, 0xFF000001, /* 499 */ |
0x01050102, 0x01050001, 0xFF000001, 0x01040302, 0x01030402, /* 504 */ |
0xFF000001, 0x01000501, 0x01040202, 0xFF000001, 0x01020402, /* 509 */ |
0x01030302, 0xFF000001, 0x01040001, 0x01000401, 0xFF000004, /* 514 */ |
0x040E0C02, 0x00000086, 0x030E0D02, 0x030E0D02, 0x03090E02, /* 519 */ |
0x03090E02, 0x040A0E02, 0x04090D02, 0x020E0E02, 0x020E0E02, /* 524 */ |
0x020E0E02, 0x020E0E02, 0x030D0E02, 0x030D0E02, 0x030B0E02, /* 529 */ |
0x030B0E02, 0xFF000003, 0x020E0B02, 0x020E0B02, 0x020D0C02, /* 534 */ |
0x020D0C02, 0x030C0D02, 0x030B0D02, 0x020E0A02, 0x020E0A02, /* 539 */ |
0xFF000003, 0x020C0C02, 0x020C0C02, 0x030D0A02, 0x030A0D02, /* 544 */ |
0x030E0702, 0x030C0A02, 0x020A0C02, 0x020A0C02, 0xFF000003, /* 549 */ |
0x03090C02, 0x030D0702, 0x020E0502, 0x020E0502, 0x010D0B02, /* 554 */ |
0x010D0B02, 0x010D0B02, 0x010D0B02, 0xFF000002, 0x010E0902, /* 559 */ |
0x010E0902, 0x020C0B02, 0x020B0C02, 0xFF000002, 0x020E0802, /* 564 */ |
0x02080E02, 0x020D0902, 0x02070E02, 0xFF000002, 0x020B0B02, /* 569 */ |
0x020D0802, 0x02080D02, 0x020E0602, 0xFF000001, 0x01060E02, /* 574 */ |
0x010C0902, 0xFF000002, 0x020B0A02, 0x020A0B02, 0x02050E02, /* 579 */ |
0x02070D02, 0xFF000002, 0x010E0402, 0x010E0402, 0x02040E02, /* 584 */ |
0x020C0802, 0xFF000001, 0x01080C02, 0x010E0302, 0xFF000002, /* 589 */ |
0x010D0602, 0x010D0602, 0x02060D02, 0x020B0902, 0xFF000002, /* 594 */ |
0x02090B02, 0x020A0A02, 0x01010E02, 0x01010E02, 0xFF000002, /* 599 */ |
0x01040D02, 0x01040D02, 0x02080B02, 0x02090A02, 0xFF000002, /* 604 */ |
0x010B0702, 0x010B0702, 0x02070B02, 0x02000D01, 0xFF000001, /* 609 */ |
0x010E0001, 0x01000E01, 0xFF000001, 0x010D0502, 0x01050D02, /* 614 */ |
0xFF000001, 0x010C0702, 0x01070C02, 0xFF000001, 0x010D0402, /* 619 */ |
0x010B0802, 0xFF000001, 0x010A0902, 0x010C0602, 0xFF000001, /* 624 */ |
0x01060C02, 0x010D0302, 0xFF000001, 0x010C0502, 0x01050C02, /* 629 */ |
0xFF000001, 0x010A0802, 0x01080A02, 0xFF000001, 0x01090902, /* 634 */ |
0x010C0402, 0xFF000001, 0x01060B02, 0x010A0702, 0xFF000001, /* 639 */ |
0x010B0502, 0x01090802, 0xFF000001, 0x01080902, 0x01090702, /* 644 */ |
0xFF000001, 0x01070902, 0x01080802, 0xFF000001, 0x010C0E02, /* 649 */ |
0x010D0D02,}; |
/* max table bits 8 */ |
/* NO XING TABLE 17 */ |
/* NO XING TABLE 18 */ |
/* NO XING TABLE 19 */ |
/* NO XING TABLE 20 */ |
/* NO XING TABLE 21 */ |
/* NO XING TABLE 22 */ |
/* NO XING TABLE 23 */ |
/* TABLE 24 256 entries maxbits 12 linbits 0 */ |
static HUFF_ELEMENT huff_table_24[] = |
{ |
0xFF000009, 0x080F0E02, 0x080F0E02, 0x080E0F02, 0x080E0F02, /* 4 */ |
0x080F0D02, 0x080F0D02, 0x080D0F02, 0x080D0F02, 0x080F0C02, /* 9 */ |
0x080F0C02, 0x080C0F02, 0x080C0F02, 0x080F0B02, 0x080F0B02, /* 14 */ |
0x080B0F02, 0x080B0F02, 0x070A0F02, 0x070A0F02, 0x070A0F02, /* 19 */ |
0x070A0F02, 0x080F0A02, 0x080F0A02, 0x080F0902, 0x080F0902, /* 24 */ |
0x07090F02, 0x07090F02, 0x07090F02, 0x07090F02, 0x07080F02, /* 29 */ |
0x07080F02, 0x07080F02, 0x07080F02, 0x080F0802, 0x080F0802, /* 34 */ |
0x080F0702, 0x080F0702, 0x07070F02, 0x07070F02, 0x07070F02, /* 39 */ |
0x07070F02, 0x070F0602, 0x070F0602, 0x070F0602, 0x070F0602, /* 44 */ |
0x07060F02, 0x07060F02, 0x07060F02, 0x07060F02, 0x070F0502, /* 49 */ |
0x070F0502, 0x070F0502, 0x070F0502, 0x07050F02, 0x07050F02, /* 54 */ |
0x07050F02, 0x07050F02, 0x070F0402, 0x070F0402, 0x070F0402, /* 59 */ |
0x070F0402, 0x07040F02, 0x07040F02, 0x07040F02, 0x07040F02, /* 64 */ |
0x070F0302, 0x070F0302, 0x070F0302, 0x070F0302, 0x07030F02, /* 69 */ |
0x07030F02, 0x07030F02, 0x07030F02, 0x070F0202, 0x070F0202, /* 74 */ |
0x070F0202, 0x070F0202, 0x07020F02, 0x07020F02, 0x07020F02, /* 79 */ |
0x07020F02, 0x07010F02, 0x07010F02, 0x07010F02, 0x07010F02, /* 84 */ |
0x080F0102, 0x080F0102, 0x08000F01, 0x08000F01, 0x090F0001, /* 89 */ |
0x00000201, 0x00000206, 0x0000020B, 0x00000210, 0x00000215, /* 94 */ |
0x0000021A, 0x0000021F, 0x040F0F02, 0x040F0F02, 0x040F0F02, /* 99 */ |
0x040F0F02, 0x040F0F02, 0x040F0F02, 0x040F0F02, 0x040F0F02, /* 104 */ |
0x040F0F02, 0x040F0F02, 0x040F0F02, 0x040F0F02, 0x040F0F02, /* 109 */ |
0x040F0F02, 0x040F0F02, 0x040F0F02, 0x040F0F02, 0x040F0F02, /* 114 */ |
0x040F0F02, 0x040F0F02, 0x040F0F02, 0x040F0F02, 0x040F0F02, /* 119 */ |
0x040F0F02, 0x040F0F02, 0x040F0F02, 0x040F0F02, 0x040F0F02, /* 124 */ |
0x040F0F02, 0x040F0F02, 0x040F0F02, 0x040F0F02, 0x00000224, /* 129 */ |
0x00000229, 0x00000232, 0x00000237, 0x0000023A, 0x0000023F, /* 134 */ |
0x00000242, 0x00000245, 0x0000024A, 0x0000024D, 0x00000250, /* 139 */ |
0x00000253, 0x00000256, 0x00000259, 0x0000025C, 0x0000025F, /* 144 */ |
0x00000262, 0x00000265, 0x00000268, 0x0000026B, 0x0000026E, /* 149 */ |
0x00000271, 0x00000274, 0x00000277, 0x0000027A, 0x0000027D, /* 154 */ |
0x00000280, 0x00000283, 0x00000288, 0x0000028B, 0x0000028E, /* 159 */ |
0x00000291, 0x00000294, 0x00000297, 0x0000029A, 0x0000029F, /* 164 */ |
0x09040B02, 0x000002A4, 0x000002A7, 0x000002AA, 0x09030B02, /* 169 */ |
0x09080802, 0x000002AF, 0x09020B02, 0x000002B2, 0x000002B5, /* 174 */ |
0x09060902, 0x09040A02, 0x000002B8, 0x09070802, 0x090A0302, /* 179 */ |
0x09030A02, 0x09090502, 0x09050902, 0x090A0202, 0x09020A02, /* 184 */ |
0x09010A02, 0x09080602, 0x09060802, 0x09070702, 0x09090402, /* 189 */ |
0x09040902, 0x09090302, 0x09030902, 0x09080502, 0x09050802, /* 194 */ |
0x09090202, 0x09070602, 0x09060702, 0x09020902, 0x09090102, /* 199 */ |
0x09010902, 0x09080402, 0x09040802, 0x09070502, 0x09050702, /* 204 */ |
0x09080302, 0x09030802, 0x09060602, 0x09080202, 0x09020802, /* 209 */ |
0x09080102, 0x09070402, 0x09040702, 0x09010802, 0x000002BB, /* 214 */ |
0x09060502, 0x09050602, 0x09070102, 0x000002BE, 0x08030702, /* 219 */ |
0x08030702, 0x09070302, 0x09070202, 0x08020702, 0x08020702, /* 224 */ |
0x08060402, 0x08060402, 0x08040602, 0x08040602, 0x08050502, /* 229 */ |
0x08050502, 0x08010702, 0x08010702, 0x08060302, 0x08060302, /* 234 */ |
0x08030602, 0x08030602, 0x08050402, 0x08050402, 0x08040502, /* 239 */ |
0x08040502, 0x08060202, 0x08060202, 0x08020602, 0x08020602, /* 244 */ |
0x08060102, 0x08060102, 0x08010602, 0x08010602, 0x09060001, /* 249 */ |
0x09000601, 0x08050302, 0x08050302, 0x08030502, 0x08030502, /* 254 */ |
0x08040402, 0x08040402, 0x08050202, 0x08050202, 0x08020502, /* 259 */ |
0x08020502, 0x08050102, 0x08050102, 0x09050001, 0x09000501, /* 264 */ |
0x07010502, 0x07010502, 0x07010502, 0x07010502, 0x08040302, /* 269 */ |
0x08040302, 0x08030402, 0x08030402, 0x07040202, 0x07040202, /* 274 */ |
0x07040202, 0x07040202, 0x07020402, 0x07020402, 0x07020402, /* 279 */ |
0x07020402, 0x07030302, 0x07030302, 0x07030302, 0x07030302, /* 284 */ |
0x07040102, 0x07040102, 0x07040102, 0x07040102, 0x07010402, /* 289 */ |
0x07010402, 0x07010402, 0x07010402, 0x08040001, 0x08040001, /* 294 */ |
0x08000401, 0x08000401, 0x07030202, 0x07030202, 0x07030202, /* 299 */ |
0x07030202, 0x07020302, 0x07020302, 0x07020302, 0x07020302, /* 304 */ |
0x06030102, 0x06030102, 0x06030102, 0x06030102, 0x06030102, /* 309 */ |
0x06030102, 0x06030102, 0x06030102, 0x06010302, 0x06010302, /* 314 */ |
0x06010302, 0x06010302, 0x06010302, 0x06010302, 0x06010302, /* 319 */ |
0x06010302, 0x07030001, 0x07030001, 0x07030001, 0x07030001, /* 324 */ |
0x07000301, 0x07000301, 0x07000301, 0x07000301, 0x06020202, /* 329 */ |
0x06020202, 0x06020202, 0x06020202, 0x06020202, 0x06020202, /* 334 */ |
0x06020202, 0x06020202, 0x05020102, 0x05020102, 0x05020102, /* 339 */ |
0x05020102, 0x05020102, 0x05020102, 0x05020102, 0x05020102, /* 344 */ |
0x05020102, 0x05020102, 0x05020102, 0x05020102, 0x05020102, /* 349 */ |
0x05020102, 0x05020102, 0x05020102, 0x05010202, 0x05010202, /* 354 */ |
0x05010202, 0x05010202, 0x05010202, 0x05010202, 0x05010202, /* 359 */ |
0x05010202, 0x05010202, 0x05010202, 0x05010202, 0x05010202, /* 364 */ |
0x05010202, 0x05010202, 0x05010202, 0x05010202, 0x06020001, /* 369 */ |
0x06020001, 0x06020001, 0x06020001, 0x06020001, 0x06020001, /* 374 */ |
0x06020001, 0x06020001, 0x06000201, 0x06000201, 0x06000201, /* 379 */ |
0x06000201, 0x06000201, 0x06000201, 0x06000201, 0x06000201, /* 384 */ |
0x04010102, 0x04010102, 0x04010102, 0x04010102, 0x04010102, /* 389 */ |
0x04010102, 0x04010102, 0x04010102, 0x04010102, 0x04010102, /* 394 */ |
0x04010102, 0x04010102, 0x04010102, 0x04010102, 0x04010102, /* 399 */ |
0x04010102, 0x04010102, 0x04010102, 0x04010102, 0x04010102, /* 404 */ |
0x04010102, 0x04010102, 0x04010102, 0x04010102, 0x04010102, /* 409 */ |
0x04010102, 0x04010102, 0x04010102, 0x04010102, 0x04010102, /* 414 */ |
0x04010102, 0x04010102, 0x04010001, 0x04010001, 0x04010001, /* 419 */ |
0x04010001, 0x04010001, 0x04010001, 0x04010001, 0x04010001, /* 424 */ |
0x04010001, 0x04010001, 0x04010001, 0x04010001, 0x04010001, /* 429 */ |
0x04010001, 0x04010001, 0x04010001, 0x04010001, 0x04010001, /* 434 */ |
0x04010001, 0x04010001, 0x04010001, 0x04010001, 0x04010001, /* 439 */ |
0x04010001, 0x04010001, 0x04010001, 0x04010001, 0x04010001, /* 444 */ |
0x04010001, 0x04010001, 0x04010001, 0x04010001, 0x04000101, /* 449 */ |
0x04000101, 0x04000101, 0x04000101, 0x04000101, 0x04000101, /* 454 */ |
0x04000101, 0x04000101, 0x04000101, 0x04000101, 0x04000101, /* 459 */ |
0x04000101, 0x04000101, 0x04000101, 0x04000101, 0x04000101, /* 464 */ |
0x04000101, 0x04000101, 0x04000101, 0x04000101, 0x04000101, /* 469 */ |
0x04000101, 0x04000101, 0x04000101, 0x04000101, 0x04000101, /* 474 */ |
0x04000101, 0x04000101, 0x04000101, 0x04000101, 0x04000101, /* 479 */ |
0x04000101, 0x04000000, 0x04000000, 0x04000000, 0x04000000, /* 484 */ |
0x04000000, 0x04000000, 0x04000000, 0x04000000, 0x04000000, /* 489 */ |
0x04000000, 0x04000000, 0x04000000, 0x04000000, 0x04000000, /* 494 */ |
0x04000000, 0x04000000, 0x04000000, 0x04000000, 0x04000000, /* 499 */ |
0x04000000, 0x04000000, 0x04000000, 0x04000000, 0x04000000, /* 504 */ |
0x04000000, 0x04000000, 0x04000000, 0x04000000, 0x04000000, /* 509 */ |
0x04000000, 0x04000000, 0x04000000, 0xFF000002, 0x020E0E02, /* 514 */ |
0x020E0D02, 0x020D0E02, 0x020E0C02, 0xFF000002, 0x020C0E02, /* 519 */ |
0x020D0D02, 0x020E0B02, 0x020B0E02, 0xFF000002, 0x020D0C02, /* 524 */ |
0x020C0D02, 0x020E0A02, 0x020A0E02, 0xFF000002, 0x020D0B02, /* 529 */ |
0x020B0D02, 0x020C0C02, 0x020E0902, 0xFF000002, 0x02090E02, /* 534 */ |
0x020D0A02, 0x020A0D02, 0x020C0B02, 0xFF000002, 0x020B0C02, /* 539 */ |
0x020E0802, 0x02080E02, 0x020D0902, 0xFF000002, 0x02090D02, /* 544 */ |
0x020E0702, 0x02070E02, 0x020C0A02, 0xFF000002, 0x020A0C02, /* 549 */ |
0x020B0B02, 0x020D0802, 0x02080D02, 0xFF000003, 0x030E0001, /* 554 */ |
0x03000E01, 0x020D0001, 0x020D0001, 0x01060E02, 0x01060E02, /* 559 */ |
0x01060E02, 0x01060E02, 0xFF000002, 0x020E0602, 0x020C0902, /* 564 */ |
0x01090C02, 0x01090C02, 0xFF000001, 0x010E0502, 0x010A0B02, /* 569 */ |
0xFF000002, 0x01050E02, 0x01050E02, 0x020B0A02, 0x020D0702, /* 574 */ |
0xFF000001, 0x01070D02, 0x01040E02, 0xFF000001, 0x010C0802, /* 579 */ |
0x01080C02, 0xFF000002, 0x020E0402, 0x020E0202, 0x010E0302, /* 584 */ |
0x010E0302, 0xFF000001, 0x010D0602, 0x01060D02, 0xFF000001, /* 589 */ |
0x01030E02, 0x010B0902, 0xFF000001, 0x01090B02, 0x010A0A02, /* 594 */ |
0xFF000001, 0x01020E02, 0x010E0102, 0xFF000001, 0x01010E02, /* 599 */ |
0x010D0502, 0xFF000001, 0x01050D02, 0x010C0702, 0xFF000001, /* 604 */ |
0x01070C02, 0x010D0402, 0xFF000001, 0x010B0802, 0x01080B02, /* 609 */ |
0xFF000001, 0x01040D02, 0x010A0902, 0xFF000001, 0x01090A02, /* 614 */ |
0x010C0602, 0xFF000001, 0x01060C02, 0x010D0302, 0xFF000001, /* 619 */ |
0x01030D02, 0x010D0202, 0xFF000001, 0x01020D02, 0x010D0102, /* 624 */ |
0xFF000001, 0x010B0702, 0x01070B02, 0xFF000001, 0x01010D02, /* 629 */ |
0x010C0502, 0xFF000001, 0x01050C02, 0x010A0802, 0xFF000001, /* 634 */ |
0x01080A02, 0x01090902, 0xFF000001, 0x010C0402, 0x01040C02, /* 639 */ |
0xFF000001, 0x010B0602, 0x01060B02, 0xFF000002, 0x02000D01, /* 644 */ |
0x020C0001, 0x010C0302, 0x010C0302, 0xFF000001, 0x01030C02, /* 649 */ |
0x010A0702, 0xFF000001, 0x01070A02, 0x010C0202, 0xFF000001, /* 654 */ |
0x01020C02, 0x010B0502, 0xFF000001, 0x01050B02, 0x010C0102, /* 659 */ |
0xFF000001, 0x01090802, 0x01080902, 0xFF000001, 0x01010C02, /* 664 */ |
0x010B0402, 0xFF000002, 0x02000C01, 0x020B0001, 0x010B0302, /* 669 */ |
0x010B0302, 0xFF000002, 0x02000B01, 0x020A0001, 0x010A0102, /* 674 */ |
0x010A0102, 0xFF000001, 0x010A0602, 0x01060A02, 0xFF000001, /* 679 */ |
0x01090702, 0x01070902, 0xFF000002, 0x02000A01, 0x02090001, /* 684 */ |
0x01000901, 0x01000901, 0xFF000001, 0x010B0202, 0x010A0502, /* 689 */ |
0xFF000001, 0x01050A02, 0x010B0102, 0xFF000001, 0x01010B02, /* 694 */ |
0x01090602, 0xFF000001, 0x010A0402, 0x01080702, 0xFF000001, /* 699 */ |
0x01080001, 0x01000801, 0xFF000001, 0x01070001, 0x01000701, /* 704 */ }; |
/* max table bits 9 */ |
/* NO XING TABLE 25 */ |
/* NO XING TABLE 26 */ |
/* NO XING TABLE 27 */ |
/* NO XING TABLE 28 */ |
/* NO XING TABLE 29 */ |
/* NO XING TABLE 30 */ |
/* NO XING TABLE 31 */ |
/* done */ |
/programs/media/ac97snd/trunk/mp3dec/l3hybrid.c |
---|
0,0 → 1,265 |
#include <math.h> |
extern int m_band_limit; |
/* "imdct.c" */ |
void imdct18(float f[]); /* 18 point */ |
void imdct6_3(float f[]); /* 6 point */ |
/*-- windows by block type --*/ |
static float win[4][36]; |
void hwin_init() |
{ |
int i, j; |
double pi; |
pi = 4.0 * atan(1.0); |
/* type 0 */ |
for (i = 0; i < 36; i++) |
win[0][i] = (float) sin(pi / 36 * (i + 0.5)); |
/* type 1 */ |
for (i = 0; i < 18; i++) |
win[1][i] = (float) sin(pi / 36 * (i + 0.5)); |
for (i = 18; i < 24; i++) |
win[1][i] = 1.0F; |
for (i = 24; i < 30; i++) |
win[1][i] = (float) sin(pi / 12 * (i + 0.5 - 18)); |
for (i = 30; i < 36; i++) |
win[1][i] = 0.0F; |
/* type 3 */ |
for (i = 0; i < 6; i++) |
win[3][i] = 0.0F; |
for (i = 6; i < 12; i++) |
win[3][i] = (float) sin(pi / 12 * (i + 0.5 - 6)); |
for (i = 12; i < 18; i++) |
win[3][i] = 1.0F; |
for (i = 18; i < 36; i++) |
win[3][i] = (float) sin(pi / 36 * (i + 0.5)); |
/* type 2 */ |
for (i = 0; i < 12; i++) |
win[2][i] = (float) sin(pi / 12 * (i + 0.5)); |
for (i = 12; i < 36; i++) |
win[2][i] = 0.0F; |
/*--- invert signs by region to match mdct 18pt --> 36pt mapping */ |
for (j = 0; j < 4; j++) |
{ |
if (j == 2) |
continue; |
for (i = 9; i < 36; i++) |
win[j][i] = -win[j][i]; |
} |
/*-- invert signs for short blocks --*/ |
for (i = 3; i < 12; i++) |
win[2][i] = -win[2][i]; |
return; |
} |
/*====================================================================*/ |
int hybrid(float xin[], float xprev[], float y[18][32], |
int btype, int nlong, int ntot, int nprev) |
{ |
int i, j; |
float *x, *x0; |
float xa, xb; |
int n; |
int nout; |
int band_limit_nsb; |
if (btype == 2) |
btype = 0; |
x = xin; |
x0 = xprev; |
/*-- do long blocks (if any) --*/ |
n = (nlong + 17) / 18; /* number of dct's to do */ |
for (i = 0; i < n; i++) |
{ |
imdct18(x); |
for (j = 0; j < 9; j++) |
{ |
y[j][i] = x0[j] + win[btype][j] * x[9 + j]; |
y[9 + j][i] = x0[9 + j] + win[btype][9 + j] * x[17 - j]; |
} |
/* window x for next time x0 */ |
for (j = 0; j < 4; j++) |
{ |
xa = x[j]; |
xb = x[8 - j]; |
x[j] = win[btype][18 + j] * xb; |
x[8 - j] = win[btype][(18 + 8) - j] * xa; |
x[9 + j] = win[btype][(18 + 9) + j] * xa; |
x[17 - j] = win[btype][(18 + 17) - j] * xb; |
} |
xa = x[j]; |
x[j] = win[btype][18 + j] * xa; |
x[9 + j] = win[btype][(18 + 9) + j] * xa; |
x += 18; |
x0 += 18; |
} |
/*-- do short blocks (if any) --*/ |
n = (ntot + 17) / 18; /* number of 6 pt dct's triples to do */ |
for (; i < n; i++) |
{ |
imdct6_3(x); |
for (j = 0; j < 3; j++) |
{ |
y[j][i] = x0[j]; |
y[3 + j][i] = x0[3 + j]; |
y[6 + j][i] = x0[6 + j] + win[2][j] * x[3 + j]; |
y[9 + j][i] = x0[9 + j] + win[2][3 + j] * x[5 - j]; |
y[12 + j][i] = x0[12 + j] + win[2][6 + j] * x[2 - j] + win[2][j] * x[(6 + 3) + j]; |
y[15 + j][i] = x0[15 + j] + win[2][9 + j] * x[j] + win[2][3 + j] * x[(6 + 5) - j]; |
} |
/* window x for next time x0 */ |
for (j = 0; j < 3; j++) |
{ |
x[j] = win[2][6 + j] * x[(6 + 2) - j] + win[2][j] * x[(12 + 3) + j]; |
x[3 + j] = win[2][9 + j] * x[6 + j] + win[2][3 + j] * x[(12 + 5) - j]; |
} |
for (j = 0; j < 3; j++) |
{ |
x[6 + j] = win[2][6 + j] * x[(12 + 2) - j]; |
x[9 + j] = win[2][9 + j] * x[12 + j]; |
} |
for (j = 0; j < 3; j++) |
{ |
x[12 + j] = 0.0f; |
x[15 + j] = 0.0f; |
} |
x += 18; |
x0 += 18; |
} |
/*--- overlap prev if prev longer that current --*/ |
n = (nprev + 17) / 18; |
for (; i < n; i++) |
{ |
for (j = 0; j < 18; j++) |
y[j][i] = x0[j]; |
x0 += 18; |
} |
nout = 18 * i; |
/*--- clear remaining only to band limit --*/ |
band_limit_nsb = (m_band_limit + 17) / 18; /* limit nsb's rounded up */ |
for (; i < band_limit_nsb; i++) |
{ |
for (j = 0; j < 18; j++) |
y[j][i] = 0.0f; |
} |
return nout; |
} |
/*--------------------------------------------------------------------*/ |
/*--------------------------------------------------------------------*/ |
/*-- convert to mono, add curr result to y, |
window and add next time to current left */ |
int hybrid_sum(float xin[], float xin_left[], float y[18][32], |
int btype, int nlong, int ntot) |
{ |
int i, j; |
float *x, *x0; |
float xa, xb; |
int n; |
int nout; |
if (btype == 2) |
btype = 0; |
x = xin; |
x0 = xin_left; |
/*-- do long blocks (if any) --*/ |
n = (nlong + 17) / 18; /* number of dct's to do */ |
for (i = 0; i < n; i++) |
{ |
imdct18(x); |
for (j = 0; j < 9; j++) |
{ |
y[j][i] += win[btype][j] * x[9 + j]; |
y[9 + j][i] += win[btype][9 + j] * x[17 - j]; |
} |
/* window x for next time x0 */ |
for (j = 0; j < 4; j++) |
{ |
xa = x[j]; |
xb = x[8 - j]; |
x0[j] += win[btype][18 + j] * xb; |
x0[8 - j] += win[btype][(18 + 8) - j] * xa; |
x0[9 + j] += win[btype][(18 + 9) + j] * xa; |
x0[17 - j] += win[btype][(18 + 17) - j] * xb; |
} |
xa = x[j]; |
x0[j] += win[btype][18 + j] * xa; |
x0[9 + j] += win[btype][(18 + 9) + j] * xa; |
x += 18; |
x0 += 18; |
} |
/*-- do short blocks (if any) --*/ |
n = (ntot + 17) / 18; /* number of 6 pt dct's triples to do */ |
for (; i < n; i++) |
{ |
imdct6_3(x); |
for (j = 0; j < 3; j++) |
{ |
y[6 + j][i] += win[2][j] * x[3 + j]; |
y[9 + j][i] += win[2][3 + j] * x[5 - j]; |
y[12 + j][i] += win[2][6 + j] * x[2 - j] + win[2][j] * x[(6 + 3) + j]; |
y[15 + j][i] += win[2][9 + j] * x[j] + win[2][3 + j] * x[(6 + 5) - j]; |
} |
/* window x for next time */ |
for (j = 0; j < 3; j++) |
{ |
x0[j] += win[2][6 + j] * x[(6 + 2) - j] + win[2][j] * x[(12 + 3) + j]; |
x0[3 + j] += win[2][9 + j] * x[6 + j] + win[2][3 + j] * x[(12 + 5) - j]; |
} |
for (j = 0; j < 3; j++) |
{ |
x0[6 + j] += win[2][6 + j] * x[(12 + 2) - j]; |
x0[9 + j] += win[2][9 + j] * x[12 + j]; |
} |
x += 18; |
x0 += 18; |
} |
nout = 18 * i; |
return nout; |
} |
/*--------------------------------------------------------------------*/ |
void sum_f_bands(float a[], float b[], int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
a[i] += b[i]; |
} |
/*--------------------------------------------------------------------*/ |
void freq_invert(float y[18][32], int n) |
{ |
int i, j; |
n = (n + 17) / 18; |
for (j = 0; j < 18; j += 2) |
{ |
for (i = 0; i < n; i += 2) |
{ |
y[1 + j][1 + i] = -y[1 + j][1 + i]; |
} |
} |
} |
/*--------------------------------------------------------------------*/ |
/programs/media/ac97snd/trunk/mp3dec/l3init.c |
---|
0,0 → 1,212 |
#include "layer3.h" |
extern MPEG_DECODE_OPTION m_option; |
extern SAMPLE m_sample[2][2][576]; |
extern int m_frequency; |
extern SBT_PROC m_sbt_proc; |
extern XFORM_PROC m_xform_proc; |
extern int m_channels; |
extern int m_sfBandIndex[2][22];// [long/short][cb] |
extern int m_nBand[2][22]; |
extern int m_band_limit; |
extern int m_band_limit21; // limit for sf band 21 |
extern int m_band_limit12; // limit for sf band 12 short |
extern int m_band_limit_nsb; |
extern int m_ncbl_mixed; |
extern int m_nsb_limit; |
extern int m_gr; |
extern int m_buf_ptr0, m_buf_ptr1; |
extern float m_yout[576]; |
//extern "l3sbt.c" |
void sbt_mono_L3(float *sample, signed short *pcm, int ch); |
void sbt_dual_L3(float *sample, signed short *pcm, int ch); |
void sbt16_mono_L3(float *sample, signed short *pcm, int ch); |
void sbt16_dual_L3(float *sample, signed short *pcm, int ch); |
void sbt8_mono_L3(float *sample, signed short *pcm, int ch); |
void sbt8_dual_L3(float *sample, signed short *pcm, int ch); |
void sbtB_mono_L3(float *sample, unsigned char *pcm, int ch); |
void sbtB_dual_L3(float *sample, unsigned char *pcm, int ch); |
void sbtB16_mono_L3(float *sample, unsigned char *pcm, int ch); |
void sbtB16_dual_L3(float *sample, unsigned char *pcm, int ch); |
void sbtB8_mono_L3(float *sample, unsigned char *pcm, int ch); |
void sbtB8_dual_L3(float *sample, unsigned char *pcm, int ch); |
//extern "l3dec.c" |
void xform_mono(void *pcm, int igr); |
void xform_dual(void *pcm, int igr); |
void xform_dual_mono(void *pcm, int igr); |
void xform_dual_right(void *pcm, int igr); |
static const SBT_PROC sbt_table[2][3][2] = |
{ |
sbt_mono_L3, |
sbt_dual_L3, |
sbt16_mono_L3, |
sbt16_dual_L3, |
sbt8_mono_L3, |
sbt8_dual_L3, |
// 8 bit output |
sbtB_mono_L3, |
sbtB_dual_L3, |
sbtB16_mono_L3, |
sbtB16_dual_L3, |
sbtB8_mono_L3, |
sbtB8_dual_L3, |
}; |
static const XFORM_PROC xform_table[5] = |
{ |
xform_mono, |
xform_dual, |
xform_dual_mono, |
xform_mono, /* left */ |
xform_dual_right, |
}; |
static const struct { |
int l[23]; |
int s[14]; |
} sfBandTable[3][3] = { |
// MPEG-1 |
{{ |
{0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 52, 62, 74, 90, 110, 134, 162, 196, 238, 288, 342, 418, 576}, |
{0, 4, 8, 12, 16, 22, 30, 40, 52, 66, 84, 106, 136, 192} |
},{ |
{0, 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 60, 72, 88, 106, 128, 156, 190, 230, 276, 330, 384, 576}, |
{0, 4, 8, 12, 16, 22, 28, 38, 50, 64, 80, 100, 126, 192} |
},{ |
{0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 54, 66, 82, 102, 126, 156, 194, 240, 296, 364, 448, 550, 576}, |
{0, 4, 8, 12, 16, 22, 30, 42, 58, 78, 104, 138, 180, 192} |
}}, |
// MPEG-2 |
{{ |
{0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, 522, 576}, |
{0, 4, 8, 12, 18, 24, 32, 42, 56, 74, 100, 132, 174, 192} |
},{ |
{0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 114, 136, 162, 194, 232, 278, 332, 394, 464, 540, 576}, |
{0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 136, 180, 192} |
},{ |
{0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, 522, 576}, |
{0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192} |
}}, |
// MPEG-2.5, 11 & 12 KHz seem ok, 8 ok |
{{ |
{0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, 522, 576}, |
{0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192} |
},{ |
{0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, 522, 576}, |
{0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192} |
},{ |
// this 8khz table, and only 8khz, from mpeg123) |
{0, 12, 24, 36, 48, 60, 72, 88, 108, 132, 160, 192, 232, 280, 336, 400, 476, 566, 568, 570, 572, 574, 576}, |
{0, 8, 16, 24, 36, 52, 72, 96, 124, 160, 162, 164, 166, 192} |
}}, |
}; |
void quant_init(); |
void alias_init(); |
void msis_init(); |
void fdct_init(); |
void imdct_init(); |
void hwin_init(); |
void L3table_init() |
{ |
quant_init(); |
alias_init(); |
msis_init(); |
fdct_init(); |
imdct_init(); |
hwin_init(); |
} |
int L3decode_start(MPEG_HEADER* h) |
{ |
int i, j, k, v; |
int channels, limit; |
int bit_code; |
m_buf_ptr0 = 0; |
m_buf_ptr1 = 0; |
m_gr = 0; |
v = h->version - 1; |
if (h->version == 1) //MPEG-1 |
m_ncbl_mixed = 8; |
else //MPEG-2, MPEG-2.5 |
m_ncbl_mixed = 6; |
// compute nsb_limit |
m_nsb_limit = (m_option.freqLimit * 64L + m_frequency / 2) / m_frequency; |
// caller limit |
limit = (32 >> m_option.reduction); |
if (limit > 8) |
limit--; |
if (m_nsb_limit > limit) |
m_nsb_limit = limit; |
limit = 18 * m_nsb_limit; |
if (h->version == 1) { |
//MPEG-1 |
m_band_limit12 = 3 * sfBandTable[v][h->fr_index].s[13]; |
m_band_limit = m_band_limit21 = sfBandTable[v][h->fr_index].l[22]; |
} |
else { |
//MPEG-2, MPEG-2.5 |
m_band_limit12 = 3 * sfBandTable[v][h->fr_index].s[12]; |
m_band_limit = m_band_limit21 = sfBandTable[v][h->fr_index].l[21]; |
} |
m_band_limit += 8; // allow for antialias |
if (m_band_limit > limit) |
m_band_limit = limit; |
if (m_band_limit21 > m_band_limit) |
m_band_limit21 = m_band_limit; |
if (m_band_limit12 > m_band_limit) |
m_band_limit12 = m_band_limit; |
m_band_limit_nsb = (m_band_limit + 17) / 18; // limit nsb's rounded up |
/* |
gain_adjust = 0; // adjust gain e.g. cvt to mono sum channel |
if ((h->mode != 3) && (m_option.convert == 1)) |
gain_adjust = -4; |
*/ |
m_channels = (h->mode == 3) ? 1 : 2; |
if (m_option.convert) channels = 1; |
else channels = m_channels; |
bit_code = (m_option.convert & 8) ? 1 : 0; |
m_sbt_proc = sbt_table[bit_code][m_option.reduction][channels - 1];//[2][3][2] |
k = (h->mode != 3) ? (1 + m_option.convert) : 0; |
m_xform_proc = xform_table[k];//[5] |
/* |
if (bit_code) |
zero_level_pcm = 128;// 8 bit output |
else |
zero_level_pcm = 0; |
*/ |
// init band tables |
for (i = 0; i < 22; i ++) |
m_sfBandIndex[0][i] = sfBandTable[v][h->fr_index].l[i + 1]; |
for (i = 0; i < 13; i ++) |
m_sfBandIndex[1][i] = 3 * sfBandTable[v][h->fr_index].s[i + 1]; |
for (i = 0; i < 22; i ++) |
m_nBand[0][i] = sfBandTable[v][h->fr_index].l[i + 1] |
- sfBandTable[v][h->fr_index].l[i]; |
for (i = 0; i < 13; i ++) |
m_nBand[1][i] = sfBandTable[v][h->fr_index].s[i + 1] |
- sfBandTable[v][h->fr_index].s[i]; |
// clear buffers |
for (i = 0; i < 576; i++) |
m_yout[i] = 0.0f; |
for (i = 0; i < 2; i ++) |
{ for (j = 0; j < 2; j ++) |
{ for (k = 0; k < 576; k++) |
{ m_sample[i][j][k].x = 0.0f; |
m_sample[i][j][k].s = 0; |
} |
} |
} |
return 1; |
} |
/programs/media/ac97snd/trunk/mp3dec/l3msis.c |
---|
0,0 → 1,332 |
#include "layer3.h" |
#include <math.h> |
//#include <windows.h> |
extern IS_SF_INFO m_is_sf_info; |
extern int m_ms_mode, m_is_mode; |
extern int m_sfBandIndex[2][22];// [long/short][cb] |
extern int m_nBand[2][22]; |
/* intensity stereo */ |
/* if ms mode quant pre-scales all values by 1.0/sqrt(2.0) ms_mode in table |
compensates */ |
/* [ms_mode 0/1][sf][left/right] */ |
static float lr[2][8][2]; |
/* lr2[intensity_scale][ms_mode][sflen_offset+sf][left/right] */ |
static float lr2[2][2][64][2]; |
/*-------*msis_init_addr() |
pi = 4.0*atan(1.0); |
t = pi/12.0; |
for(i=0;i<7;i++) { |
s = sin(i*t); |
c = cos(i*t); |
// ms_mode = 0 |
lr[0][i][0] = (float)(s/(s+c)); |
lr[0][i][1] = (float)(c/(s+c)); |
// ms_mode = 1 |
lr[1][i][0] = (float)(sqrt(2.0)*(s/(s+c))); |
lr[1][i][1] = (float)(sqrt(2.0)*(c/(s+c))); |
} |
//sf = 7 |
//ms_mode = 0 |
lr[0][i][0] = 1.0f; |
lr[0][i][1] = 0.0f; |
// ms_mode = 1, in is bands is routine does ms processing |
lr[1][i][0] = 1.0f; |
lr[1][i][1] = 1.0f; |
------------*/ |
/*===============================================================*/ |
void msis_init1() |
{ |
int i; |
double s, c; |
double pi; |
double t; |
pi = 4.0 * atan(1.0); |
t = pi / 12.0; |
for (i = 0; i < 7; i++) |
{ |
s = sin(i * t); |
c = cos(i * t); |
/* ms_mode = 0 */ |
lr[0][i][0] = (float) (s / (s + c)); |
lr[0][i][1] = (float) (c / (s + c)); |
/* ms_mode = 1 */ |
lr[1][i][0] = (float) (sqrt(2.0) * (s / (s + c))); |
lr[1][i][1] = (float) (sqrt(2.0) * (c / (s + c))); |
} |
/* sf = 7 */ |
/* ms_mode = 0 */ |
lr[0][i][0] = 1.0f; |
lr[0][i][1] = 0.0f; |
/* ms_mode = 1, in is bands is routine does ms processing */ |
lr[1][i][0] = 1.0f; |
lr[1][i][1] = 1.0f; |
/*------- |
for(i=0;i<21;i++) m_nBand[0][i] = |
sfBandTable[sr_index].l[i+1] - sfBandTable[sr_index].l[i]; |
for(i=0;i<12;i++) m_nBand[1][i] = |
sfBandTable[sr_index].s[i+1] - sfBandTable[sr_index].s[i]; |
-------------*/ |
} |
/*===============================================================*/ |
void msis_init2() |
{ |
int k, n; |
double t; |
int intensity_scale, ms_mode, sf, sflen; |
float ms_factor[2]; |
ms_factor[0] = 1.0; |
ms_factor[1] = (float) sqrt(2.0); |
/* intensity stereo MPEG2 */ |
/* lr2[intensity_scale][ms_mode][sflen_offset+sf][left/right] */ |
for (intensity_scale = 0; intensity_scale < 2; intensity_scale++) |
{ |
t = pow_test(2.0, -0.25 * (1 + intensity_scale)); |
for (ms_mode = 0; ms_mode < 2; ms_mode++) |
{ |
n = 1; |
k = 0; |
for (sflen = 0; sflen < 6; sflen++) |
{ |
for (sf = 0; sf < (n - 1); sf++, k++) |
{ |
if (sf == 0) |
{ |
lr2[intensity_scale][ms_mode][k][0] = ms_factor[ms_mode] * 1.0f; |
lr2[intensity_scale][ms_mode][k][1] = ms_factor[ms_mode] * 1.0f; |
} |
else if ((sf & 1)) |
{ |
lr2[intensity_scale][ms_mode][k][0] = |
(float) (ms_factor[ms_mode] * pow_test(t, (sf + 1) / 2)); |
lr2[intensity_scale][ms_mode][k][1] = ms_factor[ms_mode] * 1.0f; |
} |
else |
{ |
lr2[intensity_scale][ms_mode][k][0] = ms_factor[ms_mode] * 1.0f; |
lr2[intensity_scale][ms_mode][k][1] = |
(float) (ms_factor[ms_mode] * pow_test(t, sf / 2)); |
} |
} |
/* illegal is_pos used to do ms processing */ |
if (ms_mode == 0) |
{ /* ms_mode = 0 */ |
lr2[intensity_scale][ms_mode][k][0] = 1.0f; |
lr2[intensity_scale][ms_mode][k][1] = 0.0f; |
} |
else |
{ |
/* ms_mode = 1, in is bands is routine does ms processing */ |
lr2[intensity_scale][ms_mode][k][0] = 1.0f; |
lr2[intensity_scale][ms_mode][k][1] = 1.0f; |
} |
k++; |
n = n + n; |
} |
} |
} |
} |
void msis_init() |
{ |
msis_init1(); |
msis_init2(); |
} |
/*===============================================================*/ |
void ms_process(float x[][1152], int n) /* sum-difference stereo */ |
{ |
int i; |
float xl, xr; |
/*-- note: sqrt(2) done scaling by dequant ---*/ |
for (i = 0; i < n; i++) |
{ |
xl = x[0][i] + x[1][i]; |
xr = x[0][i] - x[1][i]; |
x[0][i] = xl; |
x[1][i] = xr; |
} |
return; |
} |
void is_process1(float x[][1152], /* intensity stereo */ |
SCALE_FACTOR* sf, |
CB_INFO cb_info[2], /* [ch] */ |
int nsamp) |
{ |
int i, j, n, cb, w; |
float fl, fr; |
int m; |
int isf; |
float fls[3], frs[3]; |
int cb0; |
cb0 = cb_info[1].cbmax; /* start at end of right */ |
i = m_sfBandIndex[cb_info[1].cbtype][cb0]; |
cb0++; |
m = nsamp - i; /* process to len of left */ |
if (cb_info[1].cbtype) |
goto short_blocks; |
/*------------------------*/ |
/* long_blocks: */ |
for (cb = cb0; cb < 21; cb++) |
{ |
isf = sf->l[cb]; |
n = m_nBand[0][cb]; |
fl = lr[m_ms_mode][isf][0]; |
fr = lr[m_ms_mode][isf][1]; |
for (j = 0; j < n; j++, i++) |
{ |
if (--m < 0) |
goto exit; |
x[1][i] = fr * x[0][i]; |
x[0][i] = fl * x[0][i]; |
} |
} |
return; |
/*------------------------*/ |
short_blocks: |
for (cb = cb0; cb < 12; cb++) |
{ |
for (w = 0; w < 3; w++) |
{ |
isf = sf->s[w][cb]; |
fls[w] = lr[m_ms_mode][isf][0]; |
frs[w] = lr[m_ms_mode][isf][1]; |
} |
n = m_nBand[1][cb]; |
for (j = 0; j < n; j++) |
{ |
m -= 3; |
if (m < 0) |
goto exit; |
x[1][i] = frs[0] * x[0][i]; |
x[0][i] = fls[0] * x[0][i]; |
x[1][1 + i] = frs[1] * x[0][1 + i]; |
x[0][1 + i] = fls[1] * x[0][1 + i]; |
x[1][2 + i] = frs[2] * x[0][2 + i]; |
x[0][2 + i] = fls[2] * x[0][2 + i]; |
i += 3; |
} |
} |
exit: |
return; |
} |
typedef float ARRAY2[2]; |
void is_process2(float x[][1152], /* intensity stereo */ |
SCALE_FACTOR* sf, |
CB_INFO cb_info[2], /* [ch] */ |
int nsamp) |
{ |
int i, j, k, n, cb, w; |
float fl, fr; |
int m; |
int isf; |
int il[21]; |
int tmp; |
int r; |
ARRAY2 *lr; |
int cb0, cb1; |
lr = lr2[m_is_sf_info.intensity_scale][m_ms_mode]; |
if (cb_info[1].cbtype) |
goto short_blocks; |
/*------------------------*/ |
/* long_blocks: */ |
cb0 = cb_info[1].cbmax; /* start at end of right */ |
i = m_sfBandIndex[0][cb0]; |
m = nsamp - i; /* process to len of left */ |
/* gen sf info */ |
for (k = r = 0; r < 3; r++) |
{ |
tmp = (1 << m_is_sf_info.slen[r]) - 1; |
for (j = 0; j < m_is_sf_info.nr[r]; j++, k++) |
il[k] = tmp; |
} |
for (cb = cb0 + 1; cb < 21; cb++) |
{ |
isf = il[cb] + sf->l[cb]; |
// X-MaD 27-02-02 |
if (isf < 0) { isf = 0; } |
fl = 0; |
fr = 0; |
//try |
//{ |
fl = lr[isf][0]; |
fr = lr[isf][1]; |
n = m_nBand[0][cb]; |
//} |
//catch(...) |
//{ |
// isf = 0; |
//} |
// X-MaD 27-02-02 |
for (j = 0; j < n; j++, i++) |
{ |
if (--m < 0) |
{ |
goto exit; |
} |
x[1][i] = fr * x[0][i]; |
x[0][i] = fl * x[0][i]; |
} |
} |
return; |
/*------------------------*/ |
short_blocks: |
for (k = r = 0; r < 3; r++) |
{ |
tmp = (1 << m_is_sf_info.slen[r]) - 1; |
for (j = 0; j < m_is_sf_info.nr[r]; j++, k++) |
il[k] = tmp; |
} |
for (w = 0; w < 3; w++) |
{ |
cb0 = cb_info[1].cbmax_s[w]; /* start at end of right */ |
i = m_sfBandIndex[1][cb0] + w; |
cb1 = cb_info[0].cbmax_s[w]; /* process to end of left */ |
for (cb = cb0 + 1; cb <= cb1; cb++) |
{ |
isf = il[cb] + sf->s[w][cb]; |
fl = lr[isf][0]; |
fr = lr[isf][1]; |
n = m_nBand[1][cb]; |
for (j = 0; j < n; j++) |
{ |
x[1][i] = fr * x[0][i]; |
x[0][i] = fl * x[0][i]; |
i += 3; |
} |
} |
} |
exit: |
return; |
} |
/programs/media/ac97snd/trunk/mp3dec/l3quant.c |
---|
0,0 → 1,217 |
#include "layer3.h" |
#include <math.h> |
#include <string.h> //memmove |
extern SIDE_INFO m_side_info; |
extern SCALE_FACTOR m_scale_fac[2][2]; // [gr][ch] |
extern CB_INFO m_cb_info[2][2]; // [gr][ch] |
extern int m_nsamp[2][2]; |
extern int m_nBand[2][22]; |
extern int m_ncbl_mixed; |
#define GLOBAL_GAIN_SCALE (4*15) |
static const int pretab[2][22] = |
{ |
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, |
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 2, 0}, |
}; |
/* 8 bit plus 2 lookup x = pow(2.0, 0.25*(global_gain-210)) */ |
/* two extra slots to do 1/sqrt(2) scaling for ms */ |
/* 4 extra slots to do 1/2 scaling for cvt to mono */ |
static float look_global[256 + 2 + 4]; |
/*-------- scaling lookup |
x = pow(2.0, -0.5*(1+scalefact_scale)*scalefac + preemp) |
look_scale[scalefact_scale][preemp][scalefac] |
-----------------------*/ |
static float look_scale[2][4][32]; |
/*--- iSample**(4/3) lookup, -32<=i<=31 ---*/ |
#define ISMAX 32 |
static float look_pow[2 * ISMAX]; |
/*-- pow(2.0, -0.25*8.0*subblock_gain) --*/ |
static float look_subblock[8]; |
/*-- reorder buffer ---*/ |
static float re_buf[192][3]; |
typedef float ARRAY3[3]; |
void quant_init() |
{ |
int i; |
int scalefact_scale, preemp, scalefac; |
double tmp; |
/* 8 bit plus 2 lookup x = pow(2.0, 0.25*(global_gain-210)) */ |
/* extra 2 for ms scaling by 1/sqrt(2) */ |
/* extra 4 for cvt to mono scaling by 1/2 */ |
for (i = 0; i < 256 + 2 + 4; i++) |
look_global[i] = (float) pow_test(2.0, 0.25 * ((i - (2 + 4)) - 210 + GLOBAL_GAIN_SCALE)); |
/* x = pow(2.0, -0.5*(1+scalefact_scale)*scalefac + preemp) */ |
for (scalefact_scale = 0; scalefact_scale < 2; scalefact_scale++) |
{ |
for (preemp = 0; preemp < 4; preemp++) |
{ |
for (scalefac = 0; scalefac < 32; scalefac++) |
{ |
look_scale[scalefact_scale][preemp][scalefac] = |
(float) pow_test(2.0, -0.5 * (1 + scalefact_scale) * (scalefac + preemp)); |
} |
} |
} |
/*--- iSample**(4/3) lookup, -32<=i<=31 ---*/ |
for (i = 0; i < 64; i++) |
{ |
tmp = i - 32; |
look_pow[i] = (float) (tmp * pow_test(fabs(tmp), (1.0 / 3.0))); |
} |
/*-- pow(2.0, -0.25*8.0*subblock_gain) 3 bits --*/ |
for (i = 0; i < 8; i++) |
{ |
look_subblock[i] = (float) pow_test(2.0, 0.25 * -8.0 * i); |
} |
// quant_init_sf_band(sr_index); replaced by code in sup.c |
} |
void dequant(SAMPLE Sample[], int gr, int ch) |
{ |
SCALE_FACTOR* sf = &m_scale_fac[gr][ch]; |
GR_INFO* gr_info = &m_side_info.gr[gr][ch]; |
CB_INFO* cb_info = &m_cb_info[gr][ch]; |
int* nsamp = &m_nsamp[gr][ch]; |
int i, j; |
int cb, n, w; |
float x0, xs; |
float xsb[3]; |
double tmp; |
int ncbl; |
int cbs0; |
ARRAY3 *buf; /* short block reorder */ |
int nbands; |
int i0; |
int non_zero; |
int cbmax[3]; |
nbands = *nsamp; |
ncbl = 22; /* long block cb end */ |
cbs0 = 12; /* short block cb start */ |
/* ncbl_mixed = 8 or 6 mpeg1 or 2 */ |
if (gr_info->block_type == 2) |
{ |
ncbl = 0; |
cbs0 = 0; |
if (gr_info->mixed_block_flag) |
{ |
ncbl = m_ncbl_mixed; |
cbs0 = 3; |
} |
} |
/* fill in cb_info -- */ |
cb_info->lb_type = gr_info->block_type; |
if (gr_info->block_type == 2) |
cb_info->lb_type; |
cb_info->cbs0 = cbs0; |
cb_info->ncbl = ncbl; |
cbmax[2] = cbmax[1] = cbmax[0] = 0; |
/* global gain pre-adjusted by 2 if ms_mode, 0 otherwise */ |
x0 = look_global[(2 + 4) + gr_info->global_gain]; |
i = 0; |
/*----- long blocks ---*/ |
for (cb = 0; cb < ncbl; cb++) |
{ |
non_zero = 0; |
xs = x0 * look_scale[gr_info->scalefac_scale][pretab[gr_info->preflag][cb]][sf->l[cb]]; |
n = m_nBand[0][cb]; |
for (j = 0; j < n; j++, i++) |
{ |
if (Sample[i].s == 0) |
Sample[i].x = 0.0F; |
else |
{ |
non_zero = 1; |
if ((Sample[i].s >= (-ISMAX)) && (Sample[i].s < ISMAX)) |
Sample[i].x = xs * look_pow[ISMAX + Sample[i].s]; |
else |
{ |
tmp = (double) Sample[i].s; |
Sample[i].x = (float) (xs * tmp * pow_test(fabs(tmp), (1.0 / 3.0))); |
} |
} |
} |
if (non_zero) |
cbmax[0] = cb; |
if (i >= nbands) |
break; |
} |
cb_info->cbmax = cbmax[0]; |
cb_info->cbtype = 0; // type = long |
if (cbs0 >= 12) |
return; |
/*--------------------------- |
block type = 2 short blocks |
----------------------------*/ |
cbmax[2] = cbmax[1] = cbmax[0] = cbs0; |
i0 = i; /* save for reorder */ |
buf = re_buf; |
for (w = 0; w < 3; w++) |
xsb[w] = x0 * look_subblock[gr_info->subblock_gain[w]]; |
for (cb = cbs0; cb < 13; cb++) |
{ |
n = m_nBand[1][cb]; |
for (w = 0; w < 3; w++) |
{ |
non_zero = 0; |
xs = xsb[w] * look_scale[gr_info->scalefac_scale][0][sf->s[w][cb]]; |
for (j = 0; j < n; j++, i++) |
{ |
if (Sample[i].s == 0) |
buf[j][w] = 0.0F; |
else |
{ |
non_zero = 1; |
if ((Sample[i].s >= (-ISMAX)) && (Sample[i].s < ISMAX)) |
buf[j][w] = xs * look_pow[ISMAX + Sample[i].s]; |
else |
{ |
tmp = (double) Sample[i].s; |
buf[j][w] = (float) (xs * tmp * pow_test(fabs(tmp), (1.0 / 3.0))); |
} |
} |
} |
if (non_zero) |
cbmax[w] = cb; |
} |
if (i >= nbands) |
break; |
buf += n; |
} |
memmove(&Sample[i0].x, &re_buf[0][0], sizeof(float) * (i - i0)); |
*nsamp = i; /* update nsamp */ |
cb_info->cbmax_s[0] = cbmax[0]; |
cb_info->cbmax_s[1] = cbmax[1]; |
cb_info->cbmax_s[2] = cbmax[2]; |
if (cbmax[1] > cbmax[0]) |
cbmax[0] = cbmax[1]; |
if (cbmax[2] > cbmax[0]) |
cbmax[0] = cbmax[2]; |
cb_info->cbmax = cbmax[0]; |
cb_info->cbtype = 1; /* type = short */ |
} |
/programs/media/ac97snd/trunk/mp3dec/l3sf.c |
---|
0,0 → 1,353 |
#include "layer3.h" |
extern SIDE_INFO m_side_info; |
extern SCALE_FACTOR m_scale_fac[2][2]; // [gr][ch] |
extern IS_SF_INFO m_is_sf_info; |
extern int m_is_mode; |
static const int slen_table[16][2] = |
{ |
0, 0, 0, 1, |
0, 2, 0, 3, |
3, 0, 1, 1, |
1, 2, 1, 3, |
2, 1, 2, 2, |
2, 3, 3, 1, |
3, 2, 3, 3, |
4, 2, 4, 3, |
}; |
/* nr_table[size+3*is_right][block type 0,1,3 2, 2+mixed][4] */ |
/* for bt=2 nr is count for group of 3 */ |
static const int nr_table[6][3][4] = |
{ |
6, 5, 5, 5, |
3, 3, 3, 3, |
6, 3, 3, 3, |
6, 5, 7, 3, |
3, 3, 4, 2, |
6, 3, 4, 2, |
11, 10, 0, 0, |
6, 6, 0, 0, |
6, 3, 6, 0, /* adjusted *//* 15, 18, 0, 0, */ |
/*-intensity stereo right chan--*/ |
7, 7, 7, 0, |
4, 4, 4, 0, |
6, 5, 4, 0, |
6, 6, 6, 3, |
4, 3, 3, 2, |
6, 4, 3, 2, |
8, 8, 5, 0, |
5, 4, 3, 0, |
6, 6, 3, 0, |
}; |
void L3get_scale_factor1(int gr, int ch) |
{ |
SCALE_FACTOR* sf = &m_scale_fac[gr][ch]; |
GR_INFO* grdat = &m_side_info.gr[gr][ch]; |
int scfsi = m_side_info.scfsi[ch]; |
int sfb; |
int slen0, slen1; |
int block_type, mixed_block_flag, scalefac_compress; |
block_type = grdat->block_type; |
mixed_block_flag = grdat->mixed_block_flag; |
scalefac_compress = grdat->scalefac_compress; |
slen0 = slen_table[scalefac_compress][0]; |
slen1 = slen_table[scalefac_compress][1]; |
if (block_type == 2) { |
if (mixed_block_flag) { /* mixed */ |
for (sfb = 0; sfb < 8; sfb++) |
sf[0].l[sfb] = bitget(slen0); |
for (sfb = 3; sfb < 6; sfb++) { |
sf[0].s[0][sfb] = bitget(slen0); |
sf[0].s[1][sfb] = bitget(slen0); |
sf[0].s[2][sfb] = bitget(slen0); |
} |
for (sfb = 6; sfb < 12; sfb++) { |
sf[0].s[0][sfb] = bitget(slen1); |
sf[0].s[1][sfb] = bitget(slen1); |
sf[0].s[2][sfb] = bitget(slen1); |
} |
return; |
} |
for (sfb = 0; sfb < 6; sfb++) { |
sf[0].s[0][sfb] = bitget(slen0); |
sf[0].s[1][sfb] = bitget(slen0); |
sf[0].s[2][sfb] = bitget(slen0); |
} |
for (; sfb < 12; sfb++) { |
sf[0].s[0][sfb] = bitget(slen1); |
sf[0].s[1][sfb] = bitget(slen1); |
sf[0].s[2][sfb] = bitget(slen1); |
} |
return; |
} |
/* long blocks types 0 1 3, first granule */ |
if (gr == 0) |
{ |
for (sfb = 0; sfb < 11; sfb++) |
sf[0].l[sfb] = bitget(slen0); |
for (; sfb < 21; sfb++) |
sf[0].l[sfb] = bitget(slen1); |
return; |
} |
/* long blocks 0, 1, 3, second granule */ |
sfb = 0; |
if (scfsi & 8) |
for (; sfb < 6; sfb++) |
sf[0].l[sfb] = sf[-2].l[sfb]; |
else |
for (; sfb < 6; sfb++) |
sf[0].l[sfb] = bitget(slen0); |
if (scfsi & 4) |
for (; sfb < 11; sfb++) |
sf[0].l[sfb] = sf[-2].l[sfb]; |
else |
for (; sfb < 11; sfb++) |
sf[0].l[sfb] = bitget(slen0); |
if (scfsi & 2) |
for (; sfb < 16; sfb++) |
sf[0].l[sfb] = sf[-2].l[sfb]; |
else |
for (; sfb < 16; sfb++) |
sf[0].l[sfb] = bitget(slen1); |
if (scfsi & 1) |
for (; sfb < 21; sfb++) |
sf[0].l[sfb] = sf[-2].l[sfb]; |
else |
for (; sfb < 21; sfb++) |
sf[0].l[sfb] = bitget(slen1); |
} |
void L3get_scale_factor2(int gr, int ch) |
{ |
SCALE_FACTOR* sf = &m_scale_fac[gr][ch]; |
GR_INFO* grdat = &m_side_info.gr[gr][ch]; |
int is_and_ch = m_is_mode & ch; |
int sfb; |
int slen1, slen2, slen3, slen4; |
int nr1, nr2, nr3, nr4; |
int i, k; |
int preflag, intensity_scale; |
int block_type, mixed_block_flag, scalefac_compress; |
block_type = grdat->block_type; |
mixed_block_flag = grdat->mixed_block_flag; |
scalefac_compress = grdat->scalefac_compress; |
preflag = 0; |
intensity_scale = 0; /* to avoid compiler warning */ |
if (is_and_ch == 0) |
{ |
if (scalefac_compress < 400) |
{ |
slen2 = scalefac_compress >> 4; |
slen1 = slen2 / 5; |
slen2 = slen2 % 5; |
slen4 = scalefac_compress & 15; |
slen3 = slen4 >> 2; |
slen4 = slen4 & 3; |
k = 0; |
} |
else if (scalefac_compress < 500) |
{ |
scalefac_compress -= 400; |
slen2 = scalefac_compress >> 2; |
slen1 = slen2 / 5; |
slen2 = slen2 % 5; |
slen3 = scalefac_compress & 3; |
slen4 = 0; |
k = 1; |
} |
else |
{ |
scalefac_compress -= 500; |
slen1 = scalefac_compress / 3; |
slen2 = scalefac_compress % 3; |
slen3 = slen4 = 0; |
if (mixed_block_flag) |
{ |
slen3 = slen2; /* adjust for long/short mix logic */ |
slen2 = slen1; |
} |
preflag = 1; |
k = 2; |
} |
} |
else |
{ /* intensity stereo ch = 1 (right) */ |
intensity_scale = scalefac_compress & 1; |
scalefac_compress >>= 1; |
if (scalefac_compress < 180) |
{ |
slen1 = scalefac_compress / 36; |
slen2 = scalefac_compress % 36; |
slen3 = slen2 % 6; |
slen2 = slen2 / 6; |
slen4 = 0; |
k = 3 + 0; |
} |
else if (scalefac_compress < 244) |
{ |
scalefac_compress -= 180; |
slen3 = scalefac_compress & 3; |
scalefac_compress >>= 2; |
slen2 = scalefac_compress & 3; |
slen1 = scalefac_compress >> 2; |
slen4 = 0; |
k = 3 + 1; |
} |
else |
{ |
scalefac_compress -= 244; |
slen1 = scalefac_compress / 3; |
slen2 = scalefac_compress % 3; |
slen3 = slen4 = 0; |
k = 3 + 2; |
} |
} |
i = 0; |
if (block_type == 2) |
i = (mixed_block_flag & 1) + 1; |
nr1 = nr_table[k][i][0]; |
nr2 = nr_table[k][i][1]; |
nr3 = nr_table[k][i][2]; |
nr4 = nr_table[k][i][3]; |
/* return is scale factor info (for right chan is mode) */ |
if (is_and_ch) |
{ |
m_is_sf_info.nr[0] = nr1; |
m_is_sf_info.nr[1] = nr2; |
m_is_sf_info.nr[2] = nr3; |
m_is_sf_info.slen[0] = slen1; |
m_is_sf_info.slen[1] = slen2; |
m_is_sf_info.slen[2] = slen3; |
m_is_sf_info.intensity_scale = intensity_scale; |
} |
grdat->preflag = preflag; /* return preflag */ |
/*--------------------------------------*/ |
if (block_type == 2) |
{ |
if (mixed_block_flag) |
{ /* mixed */ |
if (slen1 != 0) /* long block portion */ |
for (sfb = 0; sfb < 6; sfb++) |
sf[0].l[sfb] = bitget(slen1); |
else |
for (sfb = 0; sfb < 6; sfb++) |
sf[0].l[sfb] = 0; |
sfb = 3; /* start sfb for short */ |
} |
else |
{ /* all short, initial short blocks */ |
sfb = 0; |
if (slen1 != 0) |
for (i = 0; i < nr1; i++, sfb++) |
{ |
sf[0].s[0][sfb] = bitget(slen1); |
sf[0].s[1][sfb] = bitget(slen1); |
sf[0].s[2][sfb] = bitget(slen1); |
} |
else |
for (i = 0; i < nr1; i++, sfb++) |
{ |
sf[0].s[0][sfb] = 0; |
sf[0].s[1][sfb] = 0; |
sf[0].s[2][sfb] = 0; |
} |
} |
/* remaining short blocks */ |
if (slen2 != 0) |
for (i = 0; i < nr2; i++, sfb++) |
{ |
sf[0].s[0][sfb] = bitget(slen2); |
sf[0].s[1][sfb] = bitget(slen2); |
sf[0].s[2][sfb] = bitget(slen2); |
} |
else |
for (i = 0; i < nr2; i++, sfb++) |
{ |
sf[0].s[0][sfb] = 0; |
sf[0].s[1][sfb] = 0; |
sf[0].s[2][sfb] = 0; |
} |
if (slen3 != 0) |
for (i = 0; i < nr3; i++, sfb++) |
{ |
sf[0].s[0][sfb] = bitget(slen3); |
sf[0].s[1][sfb] = bitget(slen3); |
sf[0].s[2][sfb] = bitget(slen3); |
} |
else |
for (i = 0; i < nr3; i++, sfb++) |
{ |
sf[0].s[0][sfb] = 0; |
sf[0].s[1][sfb] = 0; |
sf[0].s[2][sfb] = 0; |
} |
if (slen4 != 0) |
for (i = 0; i < nr4; i++, sfb++) |
{ |
sf[0].s[0][sfb] = bitget(slen4); |
sf[0].s[1][sfb] = bitget(slen4); |
sf[0].s[2][sfb] = bitget(slen4); |
} |
else |
for (i = 0; i < nr4; i++, sfb++) |
{ |
sf[0].s[0][sfb] = 0; |
sf[0].s[1][sfb] = 0; |
sf[0].s[2][sfb] = 0; |
} |
return; |
} |
/* long blocks types 0 1 3 */ |
sfb = 0; |
if (slen1 != 0) |
for (i = 0; i < nr1; i++, sfb++) |
sf[0].l[sfb] = bitget(slen1); |
else |
for (i = 0; i < nr1; i++, sfb++) |
sf[0].l[sfb] = 0; |
if (slen2 != 0) |
for (i = 0; i < nr2; i++, sfb++) |
sf[0].l[sfb] = bitget(slen2); |
else |
for (i = 0; i < nr2; i++, sfb++) |
sf[0].l[sfb] = 0; |
if (slen3 != 0) |
for (i = 0; i < nr3; i++, sfb++) |
sf[0].l[sfb] = bitget(slen3); |
else |
for (i = 0; i < nr3; i++, sfb++) |
sf[0].l[sfb] = 0; |
if (slen4 != 0) |
for (i = 0; i < nr4; i++, sfb++) |
sf[0].l[sfb] = bitget(slen4); |
else |
for (i = 0; i < nr4; i++, sfb++) |
sf[0].l[sfb] = 0; |
} |
/programs/media/ac97snd/trunk/mp3dec/l3side.c |
---|
0,0 → 1,127 |
#include "layer3.h" |
extern int m_channels; |
extern int m_ms_mode, m_is_mode; |
extern SIDE_INFO m_side_info; |
int L3get_side_info1() |
{ |
int gr, ch, size; |
m_side_info.main_data_begin = bitget(9); |
if (m_channels == 1) { |
m_side_info.private_bits = bitget(5); |
size = 17; |
} |
else { |
m_side_info.private_bits = bitget(3); |
size = 32; |
} |
for (ch = 0; ch < m_channels; ch ++) |
m_side_info.scfsi[ch] = bitget(4); |
for (gr = 0; gr < 2; gr ++) { |
for (ch = 0; ch < m_channels; ch ++) { |
GR_INFO* gr_info = &m_side_info.gr[gr][ch]; |
gr_info->part2_3_length = bitget(12); |
gr_info->big_values = bitget(9); |
gr_info->global_gain = bitget(8); |
//gr_info->global_gain += gain_adjust; |
if (m_ms_mode) gr_info->global_gain -= 2; |
gr_info->scalefac_compress = bitget(4); |
gr_info->window_switching_flag = bitget(1); |
if (gr_info->window_switching_flag) { |
gr_info->block_type = bitget(2); |
gr_info->mixed_block_flag = bitget(1); |
gr_info->table_select[0] = bitget(5); |
gr_info->table_select[1] = bitget(5); |
gr_info->subblock_gain[0] = bitget(3); |
gr_info->subblock_gain[1] = bitget(3); |
gr_info->subblock_gain[2] = bitget(3); |
/* region count set in terms of long block cb's/bands */ |
/* r1 set so r0+r1+1 = 21 (lookup produces 576 bands ) */ |
/* if(window_switching_flag) always 36 samples in region0 */ |
gr_info->region0_count = (8 - 1); /* 36 samples */ |
gr_info->region1_count = 20 - (8 - 1); |
} |
else { |
gr_info->mixed_block_flag = 0; |
gr_info->block_type = 0; |
gr_info->table_select[0] = bitget(5); |
gr_info->table_select[1] = bitget(5); |
gr_info->table_select[2] = bitget(5); |
gr_info->region0_count = bitget(4); |
gr_info->region1_count = bitget(3); |
} |
gr_info->preflag = bitget(1); |
gr_info->scalefac_scale = bitget(1); |
gr_info->count1table_select = bitget(1); |
} |
} |
return size; |
} |
int L3get_side_info2(int gr) |
{ |
int ch, size; |
m_side_info.main_data_begin = bitget(8); |
if (m_channels == 1) { |
m_side_info.private_bits = bitget(1); |
size = 9; |
} |
else { |
m_side_info.private_bits = bitget(2); |
size = 17; |
} |
m_side_info.scfsi[0] = 0; |
m_side_info.scfsi[1] = 0; |
for (ch = 0; ch < m_channels; ch ++) { |
m_side_info.gr[gr][ch].part2_3_length = bitget(12); |
m_side_info.gr[gr][ch].big_values = bitget(9); |
m_side_info.gr[gr][ch].global_gain = bitget(8);// + gain_adjust; |
if (m_ms_mode) m_side_info.gr[gr][ch].global_gain -= 2; |
m_side_info.gr[gr][ch].scalefac_compress = bitget(9); |
m_side_info.gr[gr][ch].window_switching_flag = bitget(1); |
if (m_side_info.gr[gr][ch].window_switching_flag) { |
m_side_info.gr[gr][ch].block_type = bitget(2); |
m_side_info.gr[gr][ch].mixed_block_flag = bitget(1); |
m_side_info.gr[gr][ch].table_select[0] = bitget(5); |
m_side_info.gr[gr][ch].table_select[1] = bitget(5); |
m_side_info.gr[gr][ch].subblock_gain[0] = bitget(3); |
m_side_info.gr[gr][ch].subblock_gain[1] = bitget(3); |
m_side_info.gr[gr][ch].subblock_gain[2] = bitget(3); |
/* region count set in terms of long block cb's/bands */ |
/* r1 set so r0+r1+1 = 21 (lookup produces 576 bands ) */ |
/* bt=1 or 3 54 samples */ |
/* bt=2 mixed=0 36 samples */ |
/* bt=2 mixed=1 54 (8 long sf) samples? or maybe 36 */ |
/* region0 discussion says 54 but this would mix long */ |
/* and short in region0 if scale factors switch */ |
/* at band 36 (6 long scale factors) */ |
if ((m_side_info.gr[gr][ch].block_type == 2)) { |
m_side_info.gr[gr][ch].region0_count = (6 - 1); /* 36 samples */ |
m_side_info.gr[gr][ch].region1_count = 20 - (6 - 1); |
} |
else {/* long block type 1 or 3 */ |
m_side_info.gr[gr][ch].region0_count = (8 - 1); /* 54 samples */ |
m_side_info.gr[gr][ch].region1_count = 20 - (8 - 1); |
} |
} |
else { |
m_side_info.gr[gr][ch].mixed_block_flag = 0; |
m_side_info.gr[gr][ch].block_type = 0; |
m_side_info.gr[gr][ch].table_select[0] = bitget(5); |
m_side_info.gr[gr][ch].table_select[1] = bitget(5); |
m_side_info.gr[gr][ch].table_select[2] = bitget(5); |
m_side_info.gr[gr][ch].region0_count = bitget(4); |
m_side_info.gr[gr][ch].region1_count = bitget(3); |
} |
m_side_info.gr[gr][ch].preflag = 0; |
m_side_info.gr[gr][ch].scalefac_scale = bitget(1); |
m_side_info.gr[gr][ch].count1table_select = bitget(1); |
} |
return size; |
} |
/programs/media/ac97snd/trunk/mp3dec/layer3.h |
---|
0,0 → 1,52 |
#include "bstream.h" |
#include "mp3dec.h" |
typedef struct { |
uint part2_3_length; |
uint big_values; |
uint global_gain; |
uint scalefac_compress; |
uint window_switching_flag; |
uint block_type; |
uint mixed_block_flag; |
uint table_select[3]; |
uint subblock_gain[3]; |
uint region0_count; |
uint region1_count; |
uint preflag; |
uint scalefac_scale; |
uint count1table_select; |
} GR_INFO; |
typedef struct { |
uint main_data_begin; |
uint private_bits; |
uint scfsi[2]; /* 4 bit flags [ch] */ |
GR_INFO gr[2][2]; /* [gr][ch] */ |
} SIDE_INFO; |
typedef struct { |
int l[23]; /* [cb] */ |
int s[3][13]; /* [window][cb] */ |
} SCALE_FACTOR; |
typedef struct { |
int cbtype; /* long=0 short=1 */ |
int cbmax; /* max crit band */ |
int lb_type; /* long block type 0 1 3 */ |
int cbs0; /* short band start index 0 3 12 (12=no shorts */ |
int ncbl; /* number long cb's 0 8 21 */ |
int cbmax_s[3]; /* cbmax by individual short blocks */ |
} CB_INFO; |
typedef struct { |
int nr[3]; |
int slen[3]; |
int intensity_scale; |
} IS_SF_INFO; |
typedef union { |
int s; |
float x; |
} SAMPLE; |
/programs/media/ac97snd/trunk/mp3dec/math_private.h |
---|
0,0 → 1,209 |
/* |
* ==================================================== |
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. |
* |
* Developed at SunPro, a Sun Microsystems, Inc. business. |
* Permission to use, copy, modify, and distribute this |
* software is freely granted, provided that this notice |
* is preserved. |
* ==================================================== |
*/ |
/* |
* from: @(#)fdlibm.h 5.1 93/09/24 |
* $Id: math_private.h,v 1.8 1998/11/27 11:33:46 drepper Exp $ |
*/ |
#ifndef _MATH_PRIVATE_H_ |
#define _MATH_PRIVATE_H_ |
/* The original fdlibm code used statements like: |
n0 = ((*(int*)&one)>>29)^1; * index of high word * |
ix0 = *(n0+(int*)&x); * high word of x * |
ix1 = *((1-n0)+(int*)&x); * low word of x * |
to dig two 32 bit words out of the 64 bit IEEE floating point |
value. That is non-ANSI, and, moreover, the gcc instruction |
scheduler gets it wrong. We instead use the following macros. |
Unlike the original code, we determine the endianness at compile |
time, not at run time; I don't see much benefit to selecting |
endianness at run time. */ |
/* A union which permits us to convert between a double and two 32 bit |
ints. */ |
typedef int int32_t; |
typedef unsigned int u_int32_t; |
typedef union |
{ |
double value; |
struct |
{ |
u_int32_t lsw; |
u_int32_t msw; |
} parts; |
} ieee_double_shape_type; |
/* Get two 32 bit ints from a double. */ |
#define EXTRACT_WORDS(ix0,ix1,d) \ |
do { \ |
ieee_double_shape_type ew_u; \ |
ew_u.value = (d); \ |
(ix0) = ew_u.parts.msw; \ |
(ix1) = ew_u.parts.lsw; \ |
} while (0) |
/* Get the more significant 32 bit int from a double. */ |
#define GET_HIGH_WORD(i,d) \ |
do { \ |
ieee_double_shape_type gh_u; \ |
gh_u.value = (d); \ |
(i) = gh_u.parts.msw; \ |
} while (0) |
/* Get the less significant 32 bit int from a double. */ |
#define GET_LOW_WORD(i,d) \ |
do { \ |
ieee_double_shape_type gl_u; \ |
gl_u.value = (d); \ |
(i) = gl_u.parts.lsw; \ |
} while (0) |
/* Set a double from two 32 bit ints. */ |
#define INSERT_WORDS(d,ix0,ix1) \ |
do { \ |
ieee_double_shape_type iw_u; \ |
iw_u.parts.msw = (ix0); \ |
iw_u.parts.lsw = (ix1); \ |
(d) = iw_u.value; \ |
} while (0) |
/* Set the more significant 32 bits of a double from an int. */ |
#define SET_HIGH_WORD(d,v) \ |
do { \ |
ieee_double_shape_type sh_u; \ |
sh_u.value = (d); \ |
sh_u.parts.msw = (v); \ |
(d) = sh_u.value; \ |
} while (0) |
/* Set the less significant 32 bits of a double from an int. */ |
#define SET_LOW_WORD(d,v) \ |
do { \ |
ieee_double_shape_type sl_u; \ |
sl_u.value = (d); \ |
sl_u.parts.lsw = (v); \ |
(d) = sl_u.value; \ |
} while (0) |
/* A union which permits us to convert between a float and a 32 bit |
int. */ |
typedef union |
{ |
float value; |
u_int32_t word; |
} ieee_float_shape_type; |
/* Get a 32 bit int from a float. */ |
#define GET_FLOAT_WORD(i,d) \ |
do { \ |
ieee_float_shape_type gf_u; \ |
gf_u.value = (d); \ |
(i) = gf_u.word; \ |
} while (0) |
/* Set a float from a 32 bit int. */ |
#define SET_FLOAT_WORD(d,i) \ |
do { \ |
ieee_float_shape_type sf_u; \ |
sf_u.word = (i); \ |
(d) = sf_u.value; \ |
} while (0) |
/* A union which permits us to convert between a long double and |
three 32 bit ints. */ |
typedef union |
{ |
long double value; |
struct |
{ |
u_int32_t lsw; |
u_int32_t msw; |
unsigned int sign_exponent:16; |
unsigned int empty:16; |
} parts; |
} ieee_long_double_shape_type; |
/* Get three 32 bit ints from a double. */ |
#define GET_LDOUBLE_WORDS(exp,ix0,ix1,d) \ |
do { \ |
ieee_long_double_shape_type ew_u; \ |
ew_u.value = (d); \ |
(exp) = ew_u.parts.sign_exponent; \ |
(ix0) = ew_u.parts.msw; \ |
(ix1) = ew_u.parts.lsw; \ |
} while (0) |
/* Set a double from two 32 bit ints. */ |
#define SET_LDOUBLE_WORDS(d,exp,ix0,ix1) \ |
do { \ |
ieee_long_double_shape_type iw_u; \ |
iw_u.parts.sign_exponent = (exp); \ |
iw_u.parts.msw = (ix0); \ |
iw_u.parts.lsw = (ix1); \ |
(d) = iw_u.value; \ |
} while (0) |
/* Get the more significant 32 bits of a long double mantissa. */ |
#define GET_LDOUBLE_MSW(v,d) \ |
do { \ |
ieee_long_double_shape_type sh_u; \ |
sh_u.value = (d); \ |
(v) = sh_u.parts.msw; \ |
} while (0) |
/* Set the more significant 32 bits of a long double mantissa from an int. */ |
#define SET_LDOUBLE_MSW(d,v) \ |
do { \ |
ieee_long_double_shape_type sh_u; \ |
sh_u.value = (d); \ |
sh_u.parts.msw = (v); \ |
(d) = sh_u.value; \ |
} while (0) |
/* Get int from the exponent of a long double. */ |
#define GET_LDOUBLE_EXP(exp,d) \ |
do { \ |
ieee_long_double_shape_type ge_u; \ |
ge_u.value = (d); \ |
(exp) = ge_u.parts.sign_exponent; \ |
} while (0) |
/* Set exponent of a long double from an int. */ |
#define SET_LDOUBLE_EXP(d,exp) \ |
do { \ |
ieee_long_double_shape_type se_u; \ |
se_u.value = (d); \ |
se_u.parts.sign_exponent = (exp); \ |
(d) = se_u.value; \ |
} while (0) |
#endif /* _MATH_PRIVATE_H_ */ |
/programs/media/ac97snd/trunk/mp3dec/mp3dec.c |
---|
0,0 → 1,513 |
#include "mp3dec.h" |
#include <string.h> |
#include <math.h> |
typedef unsigned char byte; |
typedef unsigned int uint; |
typedef unsigned short ushort; |
static const int br_tbl[3][3][16] = { |
{// MPEG-1 |
// Layer1 |
{ 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 0 }, |
// Layer2 |
{ 0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 0 }, |
// Layer3 |
{ 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 0 }, |
}, |
{// MPEG-2 |
// Layer1 |
{ 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 0 }, |
// Layer2 |
{ 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 }, |
// Layer3 |
{ 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 }, |
}, |
{// MPEG-2.5 |
// Layer1 (not available) |
{ 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 0 }, |
// Layer2 (not available) |
{ 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 }, |
// Layer3 |
{ 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 }, |
}, |
}; |
static const int fr_tbl[3][4] = { |
// MPEG-1 |
{ 44100, 48000, 32000, 0/*reserved*/ }, |
// MPEG-2 |
{ 22050, 24000, 16000, 0/*reserved*/ }, |
// MPEG-2.5 |
{ 11025, 12000, 8000, 0/*reserved*/ }, |
}; |
/* 1999/11/01í |
static const double ms_p_f_table[3][3] = |
{ |
// Layer1 |
{8.707483f, 8.0f, 12.0f}, |
// Layer2 |
{26.12245f, 24.0f, 36.0f}, |
// Layer3 |
{26.12245f, 24.0f, 36.0f}, |
}; |
*/ |
typedef void (*FRAME_PROC) (MPEG_HEADER* h, byte* mpeg, byte* pcm); |
MPEG_DECODE_OPTION m_option; |
FRAME_PROC m_frame_proc; |
int m_last_error; |
int m_frequency; |
int m_frame_size, m_pcm_size; |
int m_enableEQ; |
float m_equalizer[32]; |
//float m_band_tbl[2][32]; |
void L1table_init(); |
void L2table_init(); |
void L3table_init(); |
void L1decode_start(MPEG_HEADER* h); |
void L2decode_start(MPEG_HEADER* h); |
void L3decode_start(MPEG_HEADER* h); |
void L1decode_frame(MPEG_HEADER* h, byte* mpeg, byte* pcm); |
void L2decode_frame(MPEG_HEADER* h, byte* mpeg, byte* pcm); |
void L3decode_frame(MPEG_HEADER* h, byte* mpeg, byte* pcm); |
void _stdcall debug_out_hex(unsigned int val); |
void debug_out_str(char* str); |
void mp3DecodeInit() |
{ |
// _set_SSE2_enable(0); |
m_option.reduction = 0; |
m_option.convert = 0; |
m_option.freqLimit = 24000; |
L1table_init(); |
L2table_init(); |
L3table_init(); |
} |
int mp3GetHeader(byte* buf, MPEG_HEADER* h) |
{ |
h->version = (buf[1] & 0x08) >> 3; |
h->layer = (buf[1] & 0x06) >> 1; |
h->error_prot = (buf[1] & 0x01); |
h->br_index = (buf[2] & 0xf0) >> 4; |
h->fr_index = (buf[2] & 0x0c) >> 2; |
h->padding = (buf[2] & 0x02) >> 1; |
h->extension = (buf[2] & 0x01); |
h->mode = (buf[3] & 0xc0) >> 6; |
h->mode_ext = (buf[3] & 0x30) >> 4; |
h->copyright = (buf[3] & 0x08) >> 3; |
h->original = (buf[3] & 0x04) >> 2; |
h->emphasis = (buf[3] & 0x03); |
if (buf[0] != 0xFF) {//sync error |
m_last_error = MP3_ERROR_INVALID_SYNC; |
return 0; |
} |
if ((buf[1] & 0xF0) == 0xF0) //MPEG-1, MPEG-2 |
h->version = (h->version) ? 1 : 2; |
else if ((buf[1] & 0xF0) == 0xE0) //MPEG-2.5 |
h->version = 3; |
else { |
m_last_error = MP3_ERROR_INVALID_SYNC; |
return 0; |
} |
if (h->fr_index >= 3 || |
h->br_index == 0 || h->br_index >= 15 || |
h->layer == 0 || h->layer >= 4) { |
m_last_error = MP3_ERROR_INVALID_HEADER; |
return 0; |
} |
h->layer = 4 - h->layer; |
h->error_prot = (h->error_prot) ? 0 : 1; |
return 1; |
} |
int mp3GetLastError() |
{ |
return m_last_error; |
} |
int mp3FindSync(byte* buf, int size, int* sync) |
{ |
int i; |
*sync = 0; |
size -= 3; |
if (size <= 0) { |
m_last_error = MP3_ERROR_OUT_OF_BUFFER; |
return 0; |
} |
for (i = 0; i < size; i ++) { |
if (buf[i] == 0xFF) { |
if ((buf[i + 1] & 0xF0) == 0xF0) { |
break; |
} |
else if ((buf[i + 1] & 0xF0) == 0xE0) { |
break; |
} |
} |
} |
if (i == size) { |
m_last_error = MP3_ERROR_OUT_OF_BUFFER; |
return 0; |
} |
*sync = i; |
return 1; |
} |
void mp3GetDecodeOption(MPEG_DECODE_OPTION* option) |
{ |
*option = m_option; |
} |
int mp3SetDecodeOption(MPEG_DECODE_OPTION* option) |
{ |
m_option = *option; |
return 1; |
} |
int mp3SetEqualizer(int* value) |
{ |
int i; |
if (value == (void*)0) { |
m_enableEQ = 0; |
return 1; |
} |
m_enableEQ = 1; |
//60, 170, 310, 600, 1K, 3K |
for (i = 0; i < 6; i ++) { |
m_equalizer[i] = (float)pow_test(10,(double)value[i]/200); |
} |
//6K |
m_equalizer[6] = (float)pow_test(10,(double)value[6]/200); |
m_equalizer[7] = m_equalizer[6]; |
//12K |
m_equalizer[8] = (float)pow_test(10,(double)value[7]/200); |
m_equalizer[9] = m_equalizer[8]; |
m_equalizer[10] = m_equalizer[8]; |
m_equalizer[11] = m_equalizer[8]; |
//14K |
m_equalizer[12] = (float)pow_test(10,(double)value[8]/200); |
m_equalizer[13] = m_equalizer[12]; |
m_equalizer[14] = m_equalizer[12]; |
m_equalizer[15] = m_equalizer[12]; |
m_equalizer[16] = m_equalizer[12]; |
m_equalizer[17] = m_equalizer[12]; |
m_equalizer[18] = m_equalizer[12]; |
m_equalizer[19] = m_equalizer[12]; |
//16K |
m_equalizer[20] = (float)pow_test(10,(double)value[9]/200); |
m_equalizer[21] = m_equalizer[20]; |
m_equalizer[22] = m_equalizer[20]; |
m_equalizer[23] = m_equalizer[20]; |
m_equalizer[24] = m_equalizer[20]; |
m_equalizer[25] = m_equalizer[20]; |
m_equalizer[26] = m_equalizer[20]; |
m_equalizer[27] = m_equalizer[20]; |
m_equalizer[28] = m_equalizer[20]; |
m_equalizer[29] = m_equalizer[20]; |
m_equalizer[30] = m_equalizer[20]; |
m_equalizer[31] = m_equalizer[20]; |
return 1; |
} |
#define VBR_FRAMES_FLAG 0x0001 |
#define VBR_BYTES_FLAG 0x0002 |
#define VBR_TOC_FLAG 0x0004 |
#define VBR_SCALE_FLAG 0x0008 |
static int extractInt4(byte* buf) |
{// big endian extract |
return buf[3] | (buf[2] << 8) | |
(buf[1] << 16) | (buf[0] << 24); |
} |
int mp3GetDecodeInfo(byte* mpeg, int size, MPEG_DECODE_INFO* info, int decFlag) |
{ |
MPEG_HEADER* h = &info->header; |
byte* p = mpeg; |
int vbr; |
uint minBitRate, maxBitRate; |
uint i, j, flags; |
//int bitRate; |
//int frame_size; |
if (size < 156) {//max vbr header size |
m_last_error = MP3_ERROR_OUT_OF_BUFFER; |
return 0; |
} |
if (!mp3GetHeader(p, h)) { |
return 0; |
} |
//check VBR Header |
p += 4;//skip mpeg header |
if (h->error_prot) p += 2;//skip crc |
if (h->layer == 3) {//skip side info |
if (h->version == 1) {//MPEG-1 |
if (h->mode != 3) p += 32; |
else p += 17; |
} |
else {//MPEG-2, MPEG-2.5 |
if (h->mode != 3) p += 17; |
else p += 9; |
} |
} |
info->bitRate = br_tbl[h->version-1][h->layer-1][h->br_index] * 1000; |
info->frequency = fr_tbl[h->version-1][h->fr_index]; |
if (memcmp(p, "Xing", 4) == 0) {//VBR |
p += 4; |
flags = extractInt4(p); |
p += 4; |
if (!(flags & (VBR_FRAMES_FLAG | VBR_BYTES_FLAG))) { |
m_last_error = MP3_ERROR_INVALID_HEADER; |
return 0; |
} |
info->frames = extractInt4(p); |
p += 4; |
info->dataSize = extractInt4(p); |
p += 4; |
if (flags & VBR_TOC_FLAG) p += 100; |
if (flags & VBR_SCALE_FLAG) p += 4; |
/*///////////////////////////////// |
//WVBRÎ |
if ( p[0] == mpeg[0] && p[1] == mpeg[1] ) { |
info->skipSize = (int)(p - mpeg); |
} else { |
info->bitRate = br_tbl[h->version-1][h->layer-1][h->br_index] * 1000; |
switch (h->layer) { |
case 1://layer1 |
m_frame_size = (12 * info->bitRate / fr_tbl[h->version-1][h->fr_index]) * 4;//one slot is 4 bytes long |
if (h->padding) m_frame_size += 4; |
break; |
case 2://layer2 |
m_frame_size = 144 * info->bitRate / fr_tbl[h->version-1][h->fr_index]; |
if (h->padding) m_frame_size ++; |
break; |
case 3://layer3 |
m_frame_size = 144 * info->bitRate / fr_tbl[h->version-1][h->fr_index]; |
if (h->version != 1) //MPEG-2, MPEG-2.5 |
m_frame_size /= 2; |
if (h->padding) m_frame_size; |
break; |
} |
info->skipSize = (int)(m_frame_size); |
} |
info->bitRate = 0; |
/////////////////////////////////*/ |
vbr = 1; |
minBitRate = 0xffffffff; |
maxBitRate = 0; |
for (i = 1; i < 15; i ++) { |
j = br_tbl[h->version-1][h->layer-1][i] * 1000; |
if (j < minBitRate) minBitRate = j; |
if (j > maxBitRate) maxBitRate = j; |
} |
} |
else if (memcmp(p, "VBRI", 4) == 0) {//VBRI |
p += 10; |
info->dataSize = extractInt4(p); |
p += 4; |
info->frames = extractInt4(p); |
p += 4; |
vbr = 1; |
minBitRate = 0xffffffff; |
maxBitRate = 0; |
for (i = 1; i < 15; i ++) { |
j = br_tbl[h->version-1][h->layer-1][i] * 1000; |
if (j < minBitRate) minBitRate = j; |
if (j > maxBitRate) maxBitRate = j; |
} |
} |
else {//not VBR |
vbr = 0; |
info->frames = 0; |
//info->skipSize = 0; |
info->dataSize = 0; |
//info->bitRate = br_tbl[h->version-1][h->layer-1][h->br_index] * 1000; |
} |
// info->frequency = fr_tbl[h->version-1][h->fr_index]; |
// info->msPerFrame = ms_p_f_table[h->layer-1][h->fr_index]; |
// if (h->version == 3) info->msPerFrame *= 2; |
switch (h->layer) { |
case 1://layer1 |
info->outputSize = 384 >> m_option.reduction; |
//if (info->bitRate) { |
if (!vbr) { |
info->skipSize = 0; |
info->minInputSize = (12 * info->bitRate / info->frequency) * 4;//one slot is 4 bytes long |
info->maxInputSize = info->minInputSize + 4; |
} |
else { |
info->skipSize = (12 * info->bitRate / info->frequency + h->padding) * 4; |
info->minInputSize = (12 * minBitRate / info->frequency) * 4; |
info->maxInputSize = (12 * maxBitRate / info->frequency) * 4 + 4; |
} |
break; |
case 2://layer2 |
info->outputSize = 1152 >> m_option.reduction; |
//if (info->bitRate) { |
if (!vbr) { |
info->skipSize = 0; |
info->minInputSize = 144 * info->bitRate / info->frequency; |
info->maxInputSize = info->minInputSize + 1; |
} |
else { |
info->skipSize = 144 * info->bitRate / info->frequency + h->padding; |
info->minInputSize = 144 * minBitRate / info->frequency; |
info->maxInputSize = 144 * maxBitRate / info->frequency + 1; |
} |
break; |
case 3://layer3 |
i = (h->version == 1) ? 1 : 2; |
//info->outputSize = 1152 >> m_option.reduction; |
info->outputSize = (1152 >> m_option.reduction) / i; |
//if (info->bitRate) { |
if (!vbr) { |
info->skipSize = 0; |
info->minInputSize = 144 * info->bitRate / info->frequency / i; |
info->maxInputSize = info->minInputSize + 1; |
} |
else { |
info->skipSize = 144 * info->bitRate / info->frequency / i + h->padding; |
info->minInputSize = 144 * minBitRate / info->frequency / i; |
info->maxInputSize = 144 * maxBitRate / info->frequency / i + 1; |
} |
break; |
/* |
if (h->version != 1) { |
//MPEG-2, MPEG-2.5 |
info->outputSize /= 2; |
info->minInputSize /= 2; |
info->maxInputSize /= 2; |
} |
info->maxInputSize ++; |
break; */ |
} |
if ((h->mode == 3) || (m_option.convert & 3)) |
info->channels = 1; |
else |
info->channels = 2; |
if (m_option.convert & 8) { |
//not available |
info->bitsPerSample = 8; |
info->outputSize *= info->channels; |
} |
else { |
info->bitsPerSample = 16; |
info->outputSize *= info->channels * 2; |
} |
if ( decFlag == 1 ) { |
m_frequency = info->frequency; |
m_pcm_size = info->outputSize; |
} |
info->frequency >>= m_option.reduction; |
if (vbr) info->bitRate = 0; |
return 1; |
} |
void sbt_init(); |
int mp3DecodeStart(byte* mpeg, int size) |
{ |
MPEG_DECODE_INFO info; |
MPEG_HEADER* h = &info.header; |
if (!mp3GetDecodeInfo(mpeg, size, &info, 1)) { |
return 0; |
} |
sbt_init(); |
switch (h->layer) { |
case 1: |
L1decode_start(h); |
m_frame_proc = L1decode_frame; |
break; |
case 2: |
L2decode_start(h); |
m_frame_proc = L2decode_frame; |
break; |
case 3: |
L3decode_start(h); |
m_frame_proc = L3decode_frame; |
break; |
} |
return 1; |
} |
int mp3DecodeFrame(MPEG_DECODE_PARAM* param) |
{ |
MPEG_HEADER* h = ¶m->header; |
if (param->inputSize <= 4) { |
m_last_error = MP3_ERROR_OUT_OF_BUFFER; |
return 0; |
} |
if (!mp3GetHeader(param->inputBuf, h)) { |
return 0; |
} |
param->bitRate = br_tbl[h->version-1][h->layer-1][h->br_index] * 1000; |
switch (h->layer) { |
case 1://layer1 |
m_frame_size = (12 * param->bitRate / m_frequency + h->padding) * 4; |
break; |
case 2://layer2 |
m_frame_size = 144 * param->bitRate / m_frequency + h->padding; |
break; |
case 3://layer3 |
if (h->version == 1) m_frame_size = 144 * param->bitRate / m_frequency + h->padding; |
else m_frame_size = (144 * param->bitRate / m_frequency) / 2 + h->padding; |
break; |
} |
if (param->inputSize < m_frame_size) { |
m_last_error = MP3_ERROR_OUT_OF_BUFFER; |
return 0; |
} |
m_frame_proc(h, param->inputBuf, param->outputBuf); |
param->inputSize = m_frame_size; |
param->outputSize = m_pcm_size; |
return 1; |
} |
void null_frame_proc(MPEG_HEADER* h, byte* mpeg, byte* pcm) {} |
void L3decode_reset(); |
void mp3MuteStart(MPEG_DECODE_PARAM* param) |
{ |
m_frame_proc = null_frame_proc; |
} |
void mp3MuteEnd(MPEG_DECODE_PARAM* param) |
{ |
MPEG_HEADER* h = ¶m->header; |
switch (h->layer) { |
case 1: |
m_frame_proc = L1decode_frame; |
break; |
case 2: |
m_frame_proc = L2decode_frame; |
break; |
case 3: |
L3decode_reset(); |
m_frame_proc = L3decode_frame; |
break; |
} |
} |
/programs/media/ac97snd/trunk/mp3dec/mp3dec.h |
---|
0,0 → 1,76 |
#ifdef __cplusplus |
extern "C" { |
#endif |
#define MP3_ERROR_UNKNOWN 1 |
#define MP3_ERROR_INVALID_PARAMETER 2 |
#define MP3_ERROR_INVALID_SYNC 3 |
#define MP3_ERROR_INVALID_HEADER 4 |
#define MP3_ERROR_OUT_OF_BUFFER 5 |
typedef struct { |
int version; //1:MPEG-1, 2:MPEG-2, 3:MPEG-2.5 |
int layer; //1:Layer1, 2:Layer2, 3:Layer3 |
int error_prot; //1:CRC on, 0:CRC off |
int br_index; |
int fr_index; |
int padding; |
int extension; |
int mode; |
int mode_ext; |
int copyright; |
int original; |
int emphasis; |
} MPEG_HEADER; |
typedef struct { |
int reduction; |
int convert; |
int freqLimit; |
} MPEG_DECODE_OPTION; |
typedef struct { |
MPEG_HEADER header; |
int channels; //oÍ`l |
int bitsPerSample; // |
int frequency; //TvO[giHzj |
int bitRate; //rbg[gibpsj |
int frames; //t[iVBR onlyj |
int skipSize; //iVBR onlyj |
int dataSize; //f[^TCYiVBR onlyj |
int minInputSize; //1t[ÌŬüÍTCY |
int maxInputSize; //1t[ÌÅåüÍTCY |
int outputSize; //1t[ÌoÍTCY |
} MPEG_DECODE_INFO; |
typedef struct { |
MPEG_HEADER header; |
int bitRate; //rbg[gibpsj |
void* inputBuf; |
int inputSize; |
void* outputBuf; |
int outputSize; |
} MPEG_DECODE_PARAM; |
void mp3DecodeInit(); |
int mp3GetLastError(); |
int mp3SetDecodeOption(MPEG_DECODE_OPTION* option); |
void mp3GetDecodeOption(MPEG_DECODE_OPTION* option); |
int mp3SetEqualizer(int* value); |
int mp3FindSync(void* buf, int size, int* sync); |
int mp3GetDecodeInfo(void* mpeg, int size, MPEG_DECODE_INFO* info, int decFlag); |
int mp3DecodeStart(void* buf, int size); |
int mp3DecodeFrame(MPEG_DECODE_PARAM* param); |
void mp3MuteStart(MPEG_DECODE_PARAM* param); |
void mp3MuteEnd(MPEG_DECODE_PARAM* param); |
double pow_test(double, double); |
#ifdef __cplusplus |
} |
#endif |
/programs/media/ac97snd/trunk/mp3dec/mp3dec.vcproj |
---|
0,0 → 1,280 |
<?xml version="1.0" encoding="windows-1251"?> |
<VisualStudioProject |
ProjectType="Visual C++" |
Version="8,00" |
Name="mp3dec" |
ProjectGUID="{97BF69A3-826A-47D6-94E4-05FDD8CFF1FC}" |
RootNamespace="mp3dec" |
Keyword="Win32Proj" |
> |
<Platforms> |
<Platform |
Name="Win32" |
/> |
</Platforms> |
<ToolFiles> |
</ToolFiles> |
<Configurations> |
<Configuration |
Name="Debug|Win32" |
OutputDirectory="$(SolutionDir)$(ConfigurationName)" |
IntermediateDirectory="$(ConfigurationName)" |
ConfigurationType="4" |
CharacterSet="1" |
> |
<Tool |
Name="VCPreBuildEventTool" |
/> |
<Tool |
Name="VCCustomBuildTool" |
/> |
<Tool |
Name="VCXMLDataGeneratorTool" |
/> |
<Tool |
Name="VCWebServiceProxyGeneratorTool" |
/> |
<Tool |
Name="VCMIDLTool" |
/> |
<Tool |
Name="VCCLCompilerTool" |
Optimization="0" |
PreprocessorDefinitions="WIN32;_DEBUG;_LIB" |
MinimalRebuild="true" |
BasicRuntimeChecks="3" |
RuntimeLibrary="3" |
UsePrecompiledHeader="0" |
WarningLevel="3" |
Detect64BitPortabilityProblems="true" |
DebugInformationFormat="4" |
/> |
<Tool |
Name="VCManagedResourceCompilerTool" |
/> |
<Tool |
Name="VCResourceCompilerTool" |
/> |
<Tool |
Name="VCPreLinkEventTool" |
/> |
<Tool |
Name="VCLibrarianTool" |
/> |
<Tool |
Name="VCALinkTool" |
/> |
<Tool |
Name="VCXDCMakeTool" |
/> |
<Tool |
Name="VCBscMakeTool" |
/> |
<Tool |
Name="VCFxCopTool" |
/> |
<Tool |
Name="VCPostBuildEventTool" |
/> |
</Configuration> |
<Configuration |
Name="Release|Win32" |
OutputDirectory="$(SolutionDir)$(ConfigurationName)" |
IntermediateDirectory="$(ConfigurationName)" |
ConfigurationType="4" |
CharacterSet="1" |
WholeProgramOptimization="1" |
> |
<Tool |
Name="VCPreBuildEventTool" |
/> |
<Tool |
Name="VCCustomBuildTool" |
/> |
<Tool |
Name="VCXMLDataGeneratorTool" |
/> |
<Tool |
Name="VCWebServiceProxyGeneratorTool" |
/> |
<Tool |
Name="VCMIDLTool" |
/> |
<Tool |
Name="VCCLCompilerTool" |
Optimization="2" |
InlineFunctionExpansion="2" |
EnableIntrinsicFunctions="true" |
FavorSizeOrSpeed="1" |
OmitFramePointers="true" |
PreprocessorDefinitions="WIN32;NDEBUG;_LIB" |
ExceptionHandling="0" |
RuntimeLibrary="0" |
StructMemberAlignment="1" |
BufferSecurityCheck="false" |
FloatingPointModel="2" |
UsePrecompiledHeader="0" |
WarningLevel="3" |
Detect64BitPortabilityProblems="true" |
DebugInformationFormat="3" |
CompileAs="1" |
/> |
<Tool |
Name="VCManagedResourceCompilerTool" |
/> |
<Tool |
Name="VCResourceCompilerTool" |
/> |
<Tool |
Name="VCPreLinkEventTool" |
/> |
<Tool |
Name="VCLibrarianTool" |
/> |
<Tool |
Name="VCALinkTool" |
/> |
<Tool |
Name="VCXDCMakeTool" |
/> |
<Tool |
Name="VCBscMakeTool" |
/> |
<Tool |
Name="VCFxCopTool" |
/> |
<Tool |
Name="VCPostBuildEventTool" |
/> |
</Configuration> |
</Configurations> |
<References> |
</References> |
<Files> |
<Filter |
Name="Source Files" |
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" |
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" |
> |
<File |
RelativePath=".\bstream.c" |
> |
</File> |
<File |
RelativePath=".\e_pow.c" |
> |
</File> |
<File |
RelativePath=".\fdct.c" |
> |
</File> |
<File |
RelativePath=".\imdct.c" |
> |
</File> |
<File |
RelativePath=".\l1dec.c" |
> |
</File> |
<File |
RelativePath=".\l1init.c" |
> |
</File> |
<File |
RelativePath=".\l2dec.c" |
> |
</File> |
<File |
RelativePath=".\l2init.c" |
> |
</File> |
<File |
RelativePath=".\l3alias.c" |
> |
</File> |
<File |
RelativePath=".\l3dec.c" |
> |
</File> |
<File |
RelativePath=".\l3huff.c" |
> |
</File> |
<File |
RelativePath=".\l3hybrid.c" |
> |
</File> |
<File |
RelativePath=".\l3init.c" |
> |
</File> |
<File |
RelativePath=".\l3msis.c" |
> |
</File> |
<File |
RelativePath=".\l3quant.c" |
> |
</File> |
<File |
RelativePath=".\l3sf.c" |
> |
</File> |
<File |
RelativePath=".\l3side.c" |
> |
</File> |
<File |
RelativePath=".\mp3dec.c" |
> |
</File> |
<File |
RelativePath=".\pow.asm" |
> |
<FileConfiguration |
Name="Release|Win32" |
> |
<Tool |
Name="VCCustomBuildTool" |
CommandLine="e:\fasm\fasm.exe $(InputPath) $(TargetDir)\$(InputName).obj
" |
Outputs="$(OutDir)\$(InputName).obj" |
/> |
</FileConfiguration> |
</File> |
<File |
RelativePath=".\sbt.c" |
> |
</File> |
<File |
RelativePath=".\sbtb.c" |
> |
</File> |
<File |
RelativePath=".\window.c" |
> |
</File> |
<File |
RelativePath=".\windowb.c" |
> |
</File> |
</Filter> |
<Filter |
Name="Header Files" |
Filter="h;hpp;hxx;hm;inl;inc;xsd" |
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" |
> |
</Filter> |
<Filter |
Name="Resource Files" |
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" |
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" |
> |
</Filter> |
<File |
RelativePath=".\ReadMe.txt" |
> |
</File> |
</Files> |
<Globals> |
</Globals> |
</VisualStudioProject> |
/programs/media/ac97snd/trunk/mp3dec/pow.asm |
---|
0,0 → 1,355 |
; ix87 specific implementation of pow function. |
; Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. |
; This file is part of the GNU C Library. |
; Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. |
; The GNU C Library is free software; you can redistribute it and/or |
; modify it under the terms of the GNU Library General Public License as |
; published by the Free Software Foundation; either version 2 of the |
; License, or (at your option) any later version. |
; The GNU C Library is distributed in the hope that it will be useful, |
; but WITHOUT ANY WARRANTY; without even the implied warranty of |
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
; Library General Public License for more details. |
; You should have received a copy of the GNU Library General Public |
; License along with the GNU C Library; see the file COPYING.LIB. If not, |
; write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
; Boston, MA 02111-1307, USA. */ |
format MS COFF |
include 'proc32.inc' |
section '.text' code readable executable |
;public _pow_test@8 |
public _scalbn |
align 4 |
proc _scalbn |
fild dword [esp+12] |
fld qword [esp+4] |
fscale |
fstp st1 |
ret |
endp |
proc _pow_test@8 stdcall x:dword, y:dword |
fld [x] |
fld [y] |
jmp __CIpow |
__CIpow: |
; fldl 12(%esp) // y |
fxam |
fnstsw ax |
mov dl,ah |
and ah, 0x45 |
cmp ah, 0x40 ; is y == 0 ? |
je .L_11 |
cmp ah, 0x05 ; is y == ±inf ? |
je .L_12 |
cmp ah, 0x01 ; is y == NaN ? |
je .L_30 |
fxch |
sub esp, 8 |
fxam |
fnstsw ax |
mov dh, ah |
and ah, 0x45 |
cmp ah, 0x40 |
je .L_20 ; x is ±0 |
cmp ah, 0x05 |
je .L_15 ; x is ±inf |
fxch ; y : x |
; First see whether `y' is a natural number. In this case we |
; can use a more precise algorithm. */ |
fld st ; y : y : x |
fistp qword [esp] ; y : x |
fild qword [esp] ; int(y) : y : x |
fucomp st1 ; y : x |
fnstsw ax |
sahf |
jne .L_2 |
; OK, we have an integer value for y. */ |
pop eax |
pop edx |
or edx,0 |
fstp st0 ; x |
jns .L_4 ; y >= 0, jump |
fidiv dword [one] ; 1/x (now referred to as x) |
neg eax |
adc edx,0 |
neg edx |
.L_4: |
fld1 ; 1 : x |
fxch |
.L_6: |
shrd edx, eax,1 |
jnc .L_5 |
fxch |
fmul st1,st0 ; x : ST*x |
fxch |
.L_5: |
fmul st0, st0 ; x*x : ST*x |
shr edx,1 |
mov ecx, eax |
or ecx, edx |
jnz .L_6 |
fstp st0 ; ST*x |
.L_30: |
ret |
align 4 |
; y is a real number. */ |
.L_2: |
fxch ; x : y |
fld1 ; 1.0 : x : y |
fld st1 ; x : 1.0 : x : y |
fsub st0,st1 ; x-1 : 1.0 : x : y |
fabs ; |x-1| : 1.0 : x : y |
fcomp qword [limit] ; 1.0 : x : y |
fnstsw ax |
fxch ; x : 1.0 : y |
sahf |
ja .L_7 |
fsub st0, st1 ; x-1 : 1.0 : y |
fyl2xp1 ; log2(x) : y |
jmp .L_8 |
.L_7: |
fyl2x ; log2(x) : y |
.L_8: |
fmul st0,st1 ; y*log2(x) : y |
fst st1 ; y*log2(x) : y*log2(x) |
frndint ; int(y*log2(x)) : y*log2(x) |
fsubr st1, st0 ; int(y*log2(x)) : fract(y*log2(x)) |
fxch ; fract(y*log2(x)) : int(y*log2(x)) |
f2xm1 ; 2^fract(y*log2(x))-1 : int(y*log2(x)) |
fld1 |
faddp ; 2^fract(y*log2(x)) : int(y*log2(x)) |
fscale ; 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x)) |
add esp,8 |
fstp st1 ; 2^fract(y*log2(x))*2^int(y*log2(x)) |
ret |
align 4 |
; // pow(x,±0) = 1 |
.L_11: |
fstp st0 ; pop y |
fld1 |
ret |
align 4 |
; y == ±inf |
.L_12: |
fstp st0 ; pop y |
; fld 4(%esp) ; x |
fabs |
fcomp qword [one] ; < 1, == 1, or > 1 |
fnstsw ax |
and ah,0x45 |
cmp ah,0x45 |
je .L_13 ; jump if x is NaN |
cmp ah,0x40 |
je .L_14 ; jump if |x| == 1 |
shl ah, 1 |
xor ah, dl |
and edx, 2 |
fld qword [inf_zero+edx+4] |
ret |
align 4 |
.L_14: |
fld qword [infinity] |
fmul qword [zero] ; raise invalid exception |
ret |
align 4 |
.L_13: |
; //fld 4(%esp) // load x == NaN |
ret |
align 4 |
; // x is ±inf |
.L_15: |
fstp st0 ; y |
test dh, 2 |
jz .L_16 ; jump if x == +inf |
; We must find out whether y is an odd integer. |
fld st ; y : y |
fistp qword [esp] ; y |
fild qword [esp] ; int(y) : y |
fucompp ; <empty> |
fnstsw ax |
sahf |
jne .L_17 |
; OK, the value is an integer, but is the number of bits small |
; enough so that all are coming from the mantissa? |
pop eax |
pop edx |
and al, 1 |
jz .L_18 ;// jump if not odd |
mov eax, edx |
or edx, eax |
jns .L_155 |
neg eax |
.L_155: |
cmp eax, 0x00200000 |
ja .L_18 ;// does not fit in mantissa bits |
; It's an odd integer. |
shr edx, 31 |
fld qword [minf_mzero+edx+8] |
ret |
align 4 |
.L_16: |
fcomp qword [zero] |
add esp, 8 |
fnstsw ax |
shr eax, 5 |
and eax, 8 |
fld qword [inf_zero+eax+1] |
ret |
align 4 |
.L_17: |
shl edx, 30 ;// sign bit for y in right position |
add esp ,8 |
.L_18: |
shr edx, 31 |
fld qword [inf_zero+edx+8] |
ret |
align 4 |
; x is ±0 |
.L_20: |
fstp st0 ; y |
test dl,2 |
jz .L_21 ; y > 0 |
;x is ±0 and y is < 0. We must find out whether y is an odd integer. |
test dh, 2 |
jz .L_25 |
fld st ; y : y |
fistp qword [esp] ; y |
fild qword [esp] ; int(y) : y |
fucompp ; <empty> |
fnstsw ax |
sahf |
jne .L_26 |
;OK, the value is an integer, but is the number of bits small |
;enough so that all are coming from the mantissa? |
pop eax |
pop edx |
and al, 1 |
jz .L_27 ; jump if not odd |
cmp edx,0xffe00000 |
jbe .L_27 ; does not fit in mantissa bits |
; It's an odd integer. |
; Raise divide-by-zero exception and get minus infinity value. |
fld1 |
fdiv qword [zero] |
fchs |
ret |
.L_25: |
fstp st0 |
.L_26: |
add esp,8 |
.L_27: |
;Raise divide-by-zero exception and get infinity value. |
fld1 |
fdiv qword [zero] |
ret |
align 4 |
; x is ±0 and y is > 0. We must find out whether y is an odd integer. |
.L_21: |
test dh,2 |
jz .L_22 |
fld st ; y : y |
fistp qword [esp] ; y |
fild qword [esp] ; int(y) : y |
fucompp ; <empty> |
fnstsw ax |
sahf |
jne .L_23 |
; OK, the value is an integer, but is the number of bits small |
; enough so that all are coming from the mantissa? |
pop eax |
pop edx |
and al,1 |
jz .L_24 ; jump if not odd |
cmp edx,0xffe00000 |
jae .L_24 ; does not fit in mantissa bits |
; It's an odd integer. |
fld qword [mzero] |
ret |
.L_22: |
fstp st0 |
.L_23: |
add esp,8 ; Don't use 2 x pop |
.L_24: |
fldz |
ret |
endp |
align 4 |
inf_zero: |
infinity: |
db 0,0,0,0,0,0,0xf0,0x7f |
zero: dq 0.0 |
minf_mzero: |
minfinity: |
db 0,0,0,0,0,0,0xf0,0xff |
mzero: |
db 0,0,0,0,0,0,0,0x80 |
one: |
dq 1.0 |
limit: |
dq 0.29 |
/programs/media/ac97snd/trunk/mp3dec/sbt.c |
---|
0,0 → 1,394 |
#include <math.h> |
/* "fdct.c" */ |
void fdct32(float *, float *); |
void fdct32_dual(float *, float *); |
void fdct32_dual_mono(float *, float *); |
void fdct16(float *, float *); |
void fdct16_dual(float *, float *); |
void fdct16_dual_mono(float *, float *); |
void fdct8(float *, float *); |
void fdct8_dual(float *, float *); |
void fdct8_dual_mono(float *, float *); |
/* "window.c" */ |
void window(float *vbuf, int vb_ptr, short *pcm); |
void window_dual(float *vbuf, int vb_ptr, short *pcm); |
void window16(float *vbuf, int vb_ptr, short *pcm); |
void window16_dual(float *vbuf, int vb_ptr, short *pcm); |
void window8(float *vbuf, int vb_ptr, short *pcm); |
void window8_dual(float *vbuf, int vb_ptr, short *pcm); |
/* circular window buffers */ |
int vb_ptr; |
int vb2_ptr; |
float vbuf[512]; |
float vbuf2[512]; |
void sbt_init() |
{ |
int i; |
/* clear window vbuf */ |
for (i = 0; i < 512; i++) |
{ |
vbuf[i] = 0.0F; |
vbuf2[i] = 0.0F; |
} |
vb2_ptr = vb_ptr = 0; |
} |
void sbt_mono(float *sample, short *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct32(sample, vbuf + vb_ptr); |
window(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 32) & 511; |
pcm += 32; |
} |
} |
void sbt_dual(float *sample, short *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct32_dual(sample, vbuf + vb_ptr); |
fdct32_dual(sample + 1, vbuf2 + vb_ptr); |
window_dual(vbuf, vb_ptr, pcm); |
window_dual(vbuf2, vb_ptr, pcm + 1); |
sample += 64; |
vb_ptr = (vb_ptr - 32) & 511; |
pcm += 64; |
} |
} |
void sbt_dual_mono(float *sample, short *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct32_dual_mono(sample, vbuf + vb_ptr); |
window(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 32) & 511; |
pcm += 32; |
} |
} |
void sbt_dual_left(float *sample, short *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct32_dual(sample, vbuf + vb_ptr); |
window(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 32) & 511; |
pcm += 32; |
} |
} |
void sbt_dual_right(float *sample, short *pcm, int n) |
{ |
int i; |
sample++; /* point to right chan */ |
for (i = 0; i < n; i++) |
{ |
fdct32_dual(sample, vbuf + vb_ptr); |
window(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 32) & 511; |
pcm += 32; |
} |
} |
void sbt16_mono(float *sample, short *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct16(sample, vbuf + vb_ptr); |
window16(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 16) & 255; |
pcm += 16; |
} |
} |
void sbt16_dual(float *sample, short *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct16_dual(sample, vbuf + vb_ptr); |
fdct16_dual(sample + 1, vbuf2 + vb_ptr); |
window16_dual(vbuf, vb_ptr, pcm); |
window16_dual(vbuf2, vb_ptr, pcm + 1); |
sample += 64; |
vb_ptr = (vb_ptr - 16) & 255; |
pcm += 32; |
} |
} |
void sbt16_dual_mono(float *sample, short *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct16_dual_mono(sample, vbuf + vb_ptr); |
window16(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 16) & 255; |
pcm += 16; |
} |
} |
void sbt16_dual_left(float *sample, short *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct16_dual(sample, vbuf + vb_ptr); |
window16(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 16) & 255; |
pcm += 16; |
} |
} |
void sbt16_dual_right(float *sample, short *pcm, int n) |
{ |
int i; |
sample++; |
for (i = 0; i < n; i++) |
{ |
fdct16_dual(sample, vbuf + vb_ptr); |
window16(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 16) & 255; |
pcm += 16; |
} |
} |
void sbt8_mono(float *sample, short *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct8(sample, vbuf + vb_ptr); |
window8(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 8) & 127; |
pcm += 8; |
} |
} |
void sbt8_dual(float *sample, short *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct8_dual(sample, vbuf + vb_ptr); |
fdct8_dual(sample + 1, vbuf2 + vb_ptr); |
window8_dual(vbuf, vb_ptr, pcm); |
window8_dual(vbuf2, vb_ptr, pcm + 1); |
sample += 64; |
vb_ptr = (vb_ptr - 8) & 127; |
pcm += 16; |
} |
} |
void sbt8_dual_mono(float *sample, short *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct8_dual_mono(sample, vbuf + vb_ptr); |
window8(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 8) & 127; |
pcm += 8; |
} |
} |
void sbt8_dual_left(float *sample, short *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct8_dual(sample, vbuf + vb_ptr); |
window8(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 8) & 127; |
pcm += 8; |
} |
} |
void sbt8_dual_right(float *sample, short *pcm, int n) |
{ |
int i; |
sample++; |
for (i = 0; i < n; i++) |
{ |
fdct8_dual(sample, vbuf + vb_ptr); |
window8(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 8) & 127; |
pcm += 8; |
} |
} |
void sbt_mono_L3(float *sample, short *pcm, int ch) |
{ |
int i; |
ch = 0; |
for (i = 0; i < 18; i++) |
{ |
fdct32(sample, vbuf + vb_ptr); |
window(vbuf, vb_ptr, pcm); |
sample += 32; |
vb_ptr = (vb_ptr - 32) & 511; |
pcm += 32; |
} |
} |
void sbt_dual_L3(float *sample, short *pcm, int ch) |
{ |
int i; |
if (ch == 0) |
for (i = 0; i < 18; i++) { |
fdct32(sample, vbuf + vb_ptr); |
window_dual(vbuf, vb_ptr, pcm); |
sample += 32; |
vb_ptr = (vb_ptr - 32) & 511; |
pcm += 64; |
} |
else |
for (i = 0; i < 18; i++) { |
fdct32(sample, vbuf2 + vb2_ptr); |
window_dual(vbuf2, vb2_ptr, pcm + 1); |
sample += 32; |
vb2_ptr = (vb2_ptr - 32) & 511; |
pcm += 64; |
} |
} |
void sbt16_mono_L3(float *sample, short *pcm, int ch) |
{ |
int i; |
ch = 0; |
for (i = 0; i < 18; i++) |
{ |
fdct16(sample, vbuf + vb_ptr); |
window16(vbuf, vb_ptr, pcm); |
sample += 32; |
vb_ptr = (vb_ptr - 16) & 255; |
pcm += 16; |
} |
} |
void sbt16_dual_L3(float *sample, short *pcm, int ch) |
{ |
int i; |
if (ch == 0) |
{ |
for (i = 0; i < 18; i++) |
{ |
fdct16(sample, vbuf + vb_ptr); |
window16_dual(vbuf, vb_ptr, pcm); |
sample += 32; |
vb_ptr = (vb_ptr - 16) & 255; |
pcm += 32; |
} |
} |
else |
{ |
for (i = 0; i < 18; i++) |
{ |
fdct16(sample, vbuf2 + vb2_ptr); |
window16_dual(vbuf2, vb2_ptr, pcm + 1); |
sample += 32; |
vb2_ptr = (vb2_ptr - 16) & 255; |
pcm += 32; |
} |
} |
} |
void sbt8_mono_L3(float *sample, short *pcm, int ch) |
{ |
int i; |
ch = 0; |
for (i = 0; i < 18; i++) |
{ |
fdct8(sample, vbuf + vb_ptr); |
window8(vbuf, vb_ptr, pcm); |
sample += 32; |
vb_ptr = (vb_ptr - 8) & 127; |
pcm += 8; |
} |
} |
void sbt8_dual_L3(float *sample, short *pcm, int ch) |
{ |
int i; |
if (ch == 0) |
{ |
for (i = 0; i < 18; i++) |
{ |
fdct8(sample, vbuf + vb_ptr); |
window8_dual(vbuf, vb_ptr, pcm); |
sample += 32; |
vb_ptr = (vb_ptr - 8) & 127; |
pcm += 16; |
} |
} |
else |
{ |
for (i = 0; i < 18; i++) |
{ |
fdct8(sample, vbuf2 + vb2_ptr); |
window8_dual(vbuf2, vb2_ptr, pcm + 1); |
sample += 32; |
vb2_ptr = (vb2_ptr - 8) & 127; |
pcm += 16; |
} |
} |
} |
/programs/media/ac97snd/trunk/mp3dec/sbtb.c |
---|
0,0 → 1,382 |
#include <math.h> |
/* "fdct.c" */ |
void fdct32(float *, float *); |
void fdct32_dual(float *, float *); |
void fdct32_dual_mono(float *, float *); |
void fdct16(float *, float *); |
void fdct16_dual(float *, float *); |
void fdct16_dual_mono(float *, float *); |
void fdct8(float *, float *); |
void fdct8_dual(float *, float *); |
void fdct8_dual_mono(float *, float *); |
/* "windowb.c" */ |
void windowB(float *vbuf, int vb_ptr, unsigned char *pcm); |
void windowB_dual(float *vbuf, int vb_ptr, unsigned char *pcm); |
void windowB16(float *vbuf, int vb_ptr, unsigned char *pcm); |
void windowB16_dual(float *vbuf, int vb_ptr, unsigned char *pcm); |
void windowB8(float *vbuf, int vb_ptr, unsigned char *pcm); |
void windowB8_dual(float *vbuf, int vb_ptr, unsigned char *pcm); |
extern int vb_ptr; |
extern int vb2_ptr; |
extern float vbuf[512]; |
extern float vbuf2[512]; |
void sbtB_mono(float *sample, unsigned char *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct32(sample, vbuf + vb_ptr); |
windowB(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 32) & 511; |
pcm += 32; |
} |
} |
void sbtB_dual(float *sample, unsigned char *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct32_dual(sample, vbuf + vb_ptr); |
fdct32_dual(sample + 1, vbuf2 + vb_ptr); |
windowB_dual(vbuf, vb_ptr, pcm); |
windowB_dual(vbuf2, vb_ptr, pcm + 1); |
sample += 64; |
vb_ptr = (vb_ptr - 32) & 511; |
pcm += 64; |
} |
} |
void sbtB_dual_mono(float *sample, unsigned char *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct32_dual_mono(sample, vbuf + vb_ptr); |
windowB(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 32) & 511; |
pcm += 32; |
} |
} |
void sbtB_dual_left(float *sample, unsigned char *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct32_dual(sample, vbuf + vb_ptr); |
windowB(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 32) & 511; |
pcm += 32; |
} |
} |
void sbtB_dual_right(float *sample, unsigned char *pcm, int n) |
{ |
int i; |
sample++; /* point to right chan */ |
for (i = 0; i < n; i++) |
{ |
fdct32_dual(sample, vbuf + vb_ptr); |
windowB(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 32) & 511; |
pcm += 32; |
} |
} |
void sbtB16_mono(float *sample, unsigned char *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct16(sample, vbuf + vb_ptr); |
windowB16(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 16) & 255; |
pcm += 16; |
} |
} |
void sbtB16_dual(float *sample, unsigned char *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct16_dual(sample, vbuf + vb_ptr); |
fdct16_dual(sample + 1, vbuf2 + vb_ptr); |
windowB16_dual(vbuf, vb_ptr, pcm); |
windowB16_dual(vbuf2, vb_ptr, pcm + 1); |
sample += 64; |
vb_ptr = (vb_ptr - 16) & 255; |
pcm += 32; |
} |
} |
void sbtB16_dual_mono(float *sample, unsigned char *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct16_dual_mono(sample, vbuf + vb_ptr); |
windowB16(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 16) & 255; |
pcm += 16; |
} |
} |
void sbtB16_dual_left(float *sample, unsigned char *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct16_dual(sample, vbuf + vb_ptr); |
windowB16(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 16) & 255; |
pcm += 16; |
} |
} |
void sbtB16_dual_right(float *sample, unsigned char *pcm, int n) |
{ |
int i; |
sample++; |
for (i = 0; i < n; i++) |
{ |
fdct16_dual(sample, vbuf + vb_ptr); |
windowB16(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 16) & 255; |
pcm += 16; |
} |
} |
void sbtB8_mono(float *sample, unsigned char *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct8(sample, vbuf + vb_ptr); |
windowB8(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 8) & 127; |
pcm += 8; |
} |
} |
void sbtB8_dual(float *sample, unsigned char *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct8_dual(sample, vbuf + vb_ptr); |
fdct8_dual(sample + 1, vbuf2 + vb_ptr); |
windowB8_dual(vbuf, vb_ptr, pcm); |
windowB8_dual(vbuf2, vb_ptr, pcm + 1); |
sample += 64; |
vb_ptr = (vb_ptr - 8) & 127; |
pcm += 16; |
} |
} |
void sbtB8_dual_mono(float *sample, unsigned char *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct8_dual_mono(sample, vbuf + vb_ptr); |
windowB8(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 8) & 127; |
pcm += 8; |
} |
} |
void sbtB8_dual_left(float *sample, unsigned char *pcm, int n) |
{ |
int i; |
for (i = 0; i < n; i++) |
{ |
fdct8_dual(sample, vbuf + vb_ptr); |
windowB8(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 8) & 127; |
pcm += 8; |
} |
} |
void sbtB8_dual_right(float *sample, unsigned char *pcm, int n) |
{ |
int i; |
sample++; |
for (i = 0; i < n; i++) |
{ |
fdct8_dual(sample, vbuf + vb_ptr); |
windowB8(vbuf, vb_ptr, pcm); |
sample += 64; |
vb_ptr = (vb_ptr - 8) & 127; |
pcm += 8; |
} |
} |
void sbtB_mono_L3(float *sample, unsigned char *pcm, int ch) |
{ |
int i; |
ch = 0; |
for (i = 0; i < 18; i++) |
{ |
fdct32(sample, vbuf + vb_ptr); |
windowB(vbuf, vb_ptr, pcm); |
sample += 32; |
vb_ptr = (vb_ptr - 32) & 511; |
pcm += 32; |
} |
} |
void sbtB_dual_L3(float *sample, unsigned char *pcm, int ch) |
{ |
int i; |
if (ch == 0) |
for (i = 0; i < 18; i++) |
{ |
fdct32(sample, vbuf + vb_ptr); |
windowB_dual(vbuf, vb_ptr, pcm); |
sample += 32; |
vb_ptr = (vb_ptr - 32) & 511; |
pcm += 64; |
} |
else |
for (i = 0; i < 18; i++) |
{ |
fdct32(sample, vbuf2 + vb2_ptr); |
windowB_dual(vbuf2, vb2_ptr, pcm + 1); |
sample += 32; |
vb2_ptr = (vb2_ptr - 32) & 511; |
pcm += 64; |
} |
} |
void sbtB16_mono_L3(float *sample, unsigned char *pcm, int ch) |
{ |
int i; |
ch = 0; |
for (i = 0; i < 18; i++) |
{ |
fdct16(sample, vbuf + vb_ptr); |
windowB16(vbuf, vb_ptr, pcm); |
sample += 32; |
vb_ptr = (vb_ptr - 16) & 255; |
pcm += 16; |
} |
} |
void sbtB16_dual_L3(float *sample, unsigned char *pcm, int ch) |
{ |
int i; |
if (ch == 0) |
{ |
for (i = 0; i < 18; i++) |
{ |
fdct16(sample, vbuf + vb_ptr); |
windowB16_dual(vbuf, vb_ptr, pcm); |
sample += 32; |
vb_ptr = (vb_ptr - 16) & 255; |
pcm += 32; |
} |
} |
else |
{ |
for (i = 0; i < 18; i++) |
{ |
fdct16(sample, vbuf2 + vb2_ptr); |
windowB16_dual(vbuf2, vb2_ptr, pcm + 1); |
sample += 32; |
vb2_ptr = (vb2_ptr - 16) & 255; |
pcm += 32; |
} |
} |
} |
void sbtB8_mono_L3(float *sample, unsigned char *pcm, int ch) |
{ |
int i; |
ch = 0; |
for (i = 0; i < 18; i++) |
{ |
fdct8(sample, vbuf + vb_ptr); |
windowB8(vbuf, vb_ptr, pcm); |
sample += 32; |
vb_ptr = (vb_ptr - 8) & 127; |
pcm += 8; |
} |
} |
void sbtB8_dual_L3(float *sample, unsigned char *pcm, int ch) |
{ |
int i; |
if (ch == 0) |
{ |
for (i = 0; i < 18; i++) |
{ |
fdct8(sample, vbuf + vb_ptr); |
windowB8_dual(vbuf, vb_ptr, pcm); |
sample += 32; |
vb_ptr = (vb_ptr - 8) & 127; |
pcm += 16; |
} |
} |
else |
{ |
for (i = 0; i < 18; i++) |
{ |
fdct8(sample, vbuf2 + vb2_ptr); |
windowB8_dual(vbuf2, vb2_ptr, pcm + 1); |
sample += 32; |
vb2_ptr = (vb2_ptr - 8) & 127; |
pcm += 16; |
} |
} |
} |
/programs/media/ac97snd/trunk/mp3dec/window.c |
---|
0,0 → 1,503 |
// disable precision loss warning on type conversion |
#ifdef _MSC_VER |
#pragma warning(disable:4244 4056) |
#endif |
float wincoef[264] = |
{ // window coefs |
0.000000000f, 0.000442505f, -0.003250122f, 0.007003784f, |
-0.031082151f, 0.078628540f, -0.100311279f, 0.572036743f, |
-1.144989014f, -0.572036743f, -0.100311279f, -0.078628540f, |
-0.031082151f, -0.007003784f, -0.003250122f, -0.000442505f, |
0.000015259f, 0.000473022f, -0.003326416f, 0.007919312f, |
-0.030517576f, 0.084182739f, -0.090927124f, 0.600219727f, |
-1.144287109f, -0.543823242f, -0.108856201f, -0.073059082f, |
-0.031478882f, -0.006118774f, -0.003173828f, -0.000396729f, |
0.000015259f, 0.000534058f, -0.003387451f, 0.008865356f, |
-0.029785154f, 0.089706421f, -0.080688477f, 0.628295898f, |
-1.142211914f, -0.515609741f, -0.116577141f, -0.067520142f, |
-0.031738281f, -0.005294800f, -0.003082275f, -0.000366211f, |
0.000015259f, 0.000579834f, -0.003433228f, 0.009841919f, |
-0.028884888f, 0.095169067f, -0.069595337f, 0.656219482f, |
-1.138763428f, -0.487472534f, -0.123474121f, -0.061996460f, |
-0.031845093f, -0.004486084f, -0.002990723f, -0.000320435f, |
0.000015259f, 0.000625610f, -0.003463745f, 0.010848999f, |
-0.027801514f, 0.100540161f, -0.057617184f, 0.683914185f, |
-1.133926392f, -0.459472656f, -0.129577637f, -0.056533810f, |
-0.031814575f, -0.003723145f, -0.002899170f, -0.000289917f, |
0.000015259f, 0.000686646f, -0.003479004f, 0.011886597f, |
-0.026535034f, 0.105819702f, -0.044784546f, 0.711318970f, |
-1.127746582f, -0.431655884f, -0.134887695f, -0.051132202f, |
-0.031661987f, -0.003005981f, -0.002792358f, -0.000259399f, |
0.000015259f, 0.000747681f, -0.003479004f, 0.012939452f, |
-0.025085449f, 0.110946655f, -0.031082151f, 0.738372803f, |
-1.120223999f, -0.404083252f, -0.139450073f, -0.045837402f, |
-0.031387329f, -0.002334595f, -0.002685547f, -0.000244141f, |
0.000030518f, 0.000808716f, -0.003463745f, 0.014022826f, |
-0.023422241f, 0.115921021f, -0.016510010f, 0.765029907f, |
-1.111373901f, -0.376800537f, -0.143264771f, -0.040634155f, |
-0.031005858f, -0.001693726f, -0.002578735f, -0.000213623f, |
0.000030518f, 0.000885010f, -0.003417969f, 0.015121460f, |
-0.021575928f, 0.120697014f, -0.001068115f, 0.791213989f, |
-1.101211548f, -0.349868774f, -0.146362305f, -0.035552979f, |
-0.030532837f, -0.001098633f, -0.002456665f, -0.000198364f, |
0.000030518f, 0.000961304f, -0.003372192f, 0.016235352f, |
-0.019531250f, 0.125259399f, 0.015228271f, 0.816864014f, |
-1.089782715f, -0.323318481f, -0.148773193f, -0.030609131f, |
-0.029937742f, -0.000549316f, -0.002349854f, -0.000167847f, |
0.000030518f, 0.001037598f, -0.003280640f, 0.017349243f, |
-0.017257690f, 0.129562378f, 0.032379150f, 0.841949463f, |
-1.077117920f, -0.297210693f, -0.150497437f, -0.025817871f, |
-0.029281614f, -0.000030518f, -0.002243042f, -0.000152588f, |
0.000045776f, 0.001113892f, -0.003173828f, 0.018463135f, |
-0.014801024f, 0.133590698f, 0.050354004f, 0.866363525f, |
-1.063217163f, -0.271591187f, -0.151596069f, -0.021179199f, |
-0.028533936f, 0.000442505f, -0.002120972f, -0.000137329f, |
0.000045776f, 0.001205444f, -0.003051758f, 0.019577026f, |
-0.012115479f, 0.137298584f, 0.069168091f, 0.890090942f, |
-1.048156738f, -0.246505737f, -0.152069092f, -0.016708374f, |
-0.027725220f, 0.000869751f, -0.002014160f, -0.000122070f, |
0.000061035f, 0.001296997f, -0.002883911f, 0.020690918f, |
-0.009231566f, 0.140670776f, 0.088775635f, 0.913055420f, |
-1.031936646f, -0.221984863f, -0.151962280f, -0.012420653f, |
-0.026840210f, 0.001266479f, -0.001907349f, -0.000106812f, |
0.000061035f, 0.001388550f, -0.002700806f, 0.021789551f, |
-0.006134033f, 0.143676758f, 0.109161377f, 0.935195923f, |
-1.014617920f, -0.198059082f, -0.151306152f, -0.008316040f, |
-0.025909424f, 0.001617432f, -0.001785278f, -0.000106812f, |
0.000076294f, 0.001480103f, -0.002487183f, 0.022857666f, |
-0.002822876f, 0.146255493f, 0.130310059f, 0.956481934f, |
-0.996246338f, -0.174789429f, -0.150115967f, -0.004394531f, |
-0.024932859f, 0.001937866f, -0.001693726f, -0.000091553f, |
-0.001586914f, -0.023910521f, -0.148422241f, -0.976852417f, |
0.152206421f, 0.000686646f, -0.002227783f, 0.000076294f, |
}; |
void window(float *vbuf, int vb_ptr, short *pcm) |
{ |
int i, j; |
int si, bx; |
float *coef; |
float sum; |
long tmp; |
si = vb_ptr + 16; |
bx = (si + 32) & 511; |
coef = wincoef; |
/*-- first 16 --*/ |
for (i = 0; i < 16; i++) |
{ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[si]; |
si = (si + 64) & 511; |
sum -= (*coef++) * vbuf[bx]; |
bx = (bx + 64) & 511; |
} |
si++; |
bx--; |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm++ = tmp; |
} |
/*-- special case --*/ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[bx]; |
bx = (bx + 64) & 511; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm++ = tmp; |
/*-- last 15 --*/ |
coef = wincoef + 255; /* back pass through coefs */ |
for (i = 0; i < 15; i++) |
{ |
si--; |
bx++; |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef--) * vbuf[si]; |
si = (si + 64) & 511; |
sum += (*coef--) * vbuf[bx]; |
bx = (bx + 64) & 511; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm++ = tmp; |
} |
} |
/*------------------------------------------------------------*/ |
void window_dual(float *vbuf, int vb_ptr, short *pcm) |
{ |
int i, j; /* dual window interleaves output */ |
int si, bx; |
float *coef; |
float sum; |
long tmp; |
si = vb_ptr + 16; |
bx = (si + 32) & 511; |
coef = wincoef; |
/*-- first 16 --*/ |
for (i = 0; i < 16; i++) |
{ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[si]; |
si = (si + 64) & 511; |
sum -= (*coef++) * vbuf[bx]; |
bx = (bx + 64) & 511; |
} |
si++; |
bx--; |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm = tmp; |
pcm += 2; |
} |
/*-- special case --*/ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[bx]; |
bx = (bx + 64) & 511; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm = tmp; |
pcm += 2; |
/*-- last 15 --*/ |
coef = wincoef + 255; /* back pass through coefs */ |
for (i = 0; i < 15; i++) |
{ |
si--; |
bx++; |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef--) * vbuf[si]; |
si = (si + 64) & 511; |
sum += (*coef--) * vbuf[bx]; |
bx = (bx + 64) & 511; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm = tmp; |
pcm += 2; |
} |
} |
/*------------------------------------------------------------*/ |
/*------------------- 16 pt window ------------------------------*/ |
void window16(float *vbuf, int vb_ptr, short *pcm) |
{ |
int i, j; |
unsigned char si, bx; |
float *coef; |
float sum; |
long tmp; |
si = vb_ptr + 8; |
bx = si + 16; |
coef = wincoef; |
/*-- first 8 --*/ |
for (i = 0; i < 8; i++) |
{ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[si]; |
si += 32; |
sum -= (*coef++) * vbuf[bx]; |
bx += 32; |
} |
si++; |
bx--; |
coef += 16; |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm++ = tmp; |
} |
/*-- special case --*/ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[bx]; |
bx += 32; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm++ = tmp; |
/*-- last 7 --*/ |
coef = wincoef + 255; /* back pass through coefs */ |
for (i = 0; i < 7; i++) |
{ |
coef -= 16; |
si--; |
bx++; |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef--) * vbuf[si]; |
si += 32; |
sum += (*coef--) * vbuf[bx]; |
bx += 32; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm++ = tmp; |
} |
} |
/*--------------- 16 pt dual window (interleaved output) -----------------*/ |
void window16_dual(float *vbuf, int vb_ptr, short *pcm) |
{ |
int i, j; |
unsigned char si, bx; |
float *coef; |
float sum; |
long tmp; |
si = vb_ptr + 8; |
bx = si + 16; |
coef = wincoef; |
/*-- first 8 --*/ |
for (i = 0; i < 8; i++) |
{ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[si]; |
si += 32; |
sum -= (*coef++) * vbuf[bx]; |
bx += 32; |
} |
si++; |
bx--; |
coef += 16; |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm = tmp; |
pcm += 2; |
} |
/*-- special case --*/ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[bx]; |
bx += 32; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm = tmp; |
pcm += 2; |
/*-- last 7 --*/ |
coef = wincoef + 255; /* back pass through coefs */ |
for (i = 0; i < 7; i++) |
{ |
coef -= 16; |
si--; |
bx++; |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef--) * vbuf[si]; |
si += 32; |
sum += (*coef--) * vbuf[bx]; |
bx += 32; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm = tmp; |
pcm += 2; |
} |
} |
/*------------------- 8 pt window ------------------------------*/ |
void window8(float *vbuf, int vb_ptr, short *pcm) |
{ |
int i, j; |
int si, bx; |
float *coef; |
float sum; |
long tmp; |
si = vb_ptr + 4; |
bx = (si + 8) & 127; |
coef = wincoef; |
/*-- first 4 --*/ |
for (i = 0; i < 4; i++) |
{ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[si]; |
si = (si + 16) & 127; |
sum -= (*coef++) * vbuf[bx]; |
bx = (bx + 16) & 127; |
} |
si++; |
bx--; |
coef += 48; |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm++ = tmp; |
} |
/*-- special case --*/ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[bx]; |
bx = (bx + 16) & 127; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm++ = tmp; |
/*-- last 3 --*/ |
coef = wincoef + 255; /* back pass through coefs */ |
for (i = 0; i < 3; i++) |
{ |
coef -= 48; |
si--; |
bx++; |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef--) * vbuf[si]; |
si = (si + 16) & 127; |
sum += (*coef--) * vbuf[bx]; |
bx = (bx + 16) & 127; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm++ = tmp; |
} |
} |
/*--------------- 8 pt dual window (interleaved output) -----------------*/ |
void window8_dual(float *vbuf, int vb_ptr, short *pcm) |
{ |
int i, j; |
int si, bx; |
float *coef; |
float sum; |
long tmp; |
si = vb_ptr + 4; |
bx = (si + 8) & 127; |
coef = wincoef; |
/*-- first 4 --*/ |
for (i = 0; i < 4; i++) |
{ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[si]; |
si = (si + 16) & 127; |
sum -= (*coef++) * vbuf[bx]; |
bx = (bx + 16) & 127; |
} |
si++; |
bx--; |
coef += 48; |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm = tmp; |
pcm += 2; |
} |
/*-- special case --*/ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[bx]; |
bx = (bx + 16) & 127; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm = tmp; |
pcm += 2; |
/*-- last 3 --*/ |
coef = wincoef + 255; /* back pass through coefs */ |
for (i = 0; i < 3; i++) |
{ |
coef -= 48; |
si--; |
bx++; |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef--) * vbuf[si]; |
si = (si + 16) & 127; |
sum += (*coef--) * vbuf[bx]; |
bx = (bx + 16) & 127; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm = tmp; |
pcm += 2; |
} |
} |
/programs/media/ac97snd/trunk/mp3dec/windowb.c |
---|
0,0 → 1,427 |
extern float wincoef[264]; |
void windowB(float *vbuf, int vb_ptr, unsigned char *pcm) |
{ |
int i, j; |
int si, bx; |
float *coef; |
float sum; |
long tmp; |
si = vb_ptr + 16; |
bx = (si + 32) & 511; |
coef = wincoef; |
/*-- first 16 --*/ |
for (i = 0; i < 16; i++) |
{ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[si]; |
si = (si + 64) & 511; |
sum -= (*coef++) * vbuf[bx]; |
bx = (bx + 64) & 511; |
} |
si++; |
bx--; |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm++ = ((unsigned char) (tmp >> 8)) ^ 0x80; |
} |
/*-- special case --*/ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[bx]; |
bx = (bx + 64) & 511; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm++ = ((unsigned char) (tmp >> 8)) ^ 0x80; |
/*-- last 15 --*/ |
coef = wincoef + 255; /* back pass through coefs */ |
for (i = 0; i < 15; i++) |
{ |
si--; |
bx++; |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef--) * vbuf[si]; |
si = (si + 64) & 511; |
sum += (*coef--) * vbuf[bx]; |
bx = (bx + 64) & 511; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm++ = ((unsigned char) (tmp >> 8)) ^ 0x80; |
} |
} |
/*------------------------------------------------------------*/ |
void windowB_dual(float *vbuf, int vb_ptr, unsigned char *pcm) |
{ |
int i, j; /* dual window interleaves output */ |
int si, bx; |
float *coef; |
float sum; |
long tmp; |
si = vb_ptr + 16; |
bx = (si + 32) & 511; |
coef = wincoef; |
/*-- first 16 --*/ |
for (i = 0; i < 16; i++) |
{ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[si]; |
si = (si + 64) & 511; |
sum -= (*coef++) * vbuf[bx]; |
bx = (bx + 64) & 511; |
} |
si++; |
bx--; |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm = ((unsigned char) (tmp >> 8)) ^ 0x80; |
pcm += 2; |
} |
/*-- special case --*/ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[bx]; |
bx = (bx + 64) & 511; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm = ((unsigned char) (tmp >> 8)) ^ 0x80; |
pcm += 2; |
/*-- last 15 --*/ |
coef = wincoef + 255; /* back pass through coefs */ |
for (i = 0; i < 15; i++) |
{ |
si--; |
bx++; |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef--) * vbuf[si]; |
si = (si + 64) & 511; |
sum += (*coef--) * vbuf[bx]; |
bx = (bx + 64) & 511; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm = ((unsigned char) (tmp >> 8)) ^ 0x80; |
pcm += 2; |
} |
} |
/*------------------------------------------------------------*/ |
/*------------------- 16 pt window ------------------------------*/ |
void windowB16(float *vbuf, int vb_ptr, unsigned char *pcm) |
{ |
int i, j; |
unsigned char si, bx; |
float *coef; |
float sum; |
long tmp; |
si = vb_ptr + 8; |
bx = si + 16; |
coef = wincoef; |
/*-- first 8 --*/ |
for (i = 0; i < 8; i++) |
{ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[si]; |
si += 32; |
sum -= (*coef++) * vbuf[bx]; |
bx += 32; |
} |
si++; |
bx--; |
coef += 16; |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm++ = ((unsigned char) (tmp >> 8)) ^ 0x80; |
} |
/*-- special case --*/ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[bx]; |
bx += 32; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm++ = ((unsigned char) (tmp >> 8)) ^ 0x80; |
/*-- last 7 --*/ |
coef = wincoef + 255; /* back pass through coefs */ |
for (i = 0; i < 7; i++) |
{ |
coef -= 16; |
si--; |
bx++; |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef--) * vbuf[si]; |
si += 32; |
sum += (*coef--) * vbuf[bx]; |
bx += 32; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm++ = ((unsigned char) (tmp >> 8)) ^ 0x80; |
} |
} |
/*--------------- 16 pt dual window (interleaved output) -----------------*/ |
void windowB16_dual(float *vbuf, int vb_ptr, unsigned char *pcm) |
{ |
int i, j; |
unsigned char si, bx; |
float *coef; |
float sum; |
long tmp; |
si = vb_ptr + 8; |
bx = si + 16; |
coef = wincoef; |
/*-- first 8 --*/ |
for (i = 0; i < 8; i++) |
{ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[si]; |
si += 32; |
sum -= (*coef++) * vbuf[bx]; |
bx += 32; |
} |
si++; |
bx--; |
coef += 16; |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm = ((unsigned char) (tmp >> 8)) ^ 0x80; |
pcm += 2; |
} |
/*-- special case --*/ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[bx]; |
bx += 32; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm = ((unsigned char) (tmp >> 8)) ^ 0x80; |
pcm += 2; |
/*-- last 7 --*/ |
coef = wincoef + 255; /* back pass through coefs */ |
for (i = 0; i < 7; i++) |
{ |
coef -= 16; |
si--; |
bx++; |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef--) * vbuf[si]; |
si += 32; |
sum += (*coef--) * vbuf[bx]; |
bx += 32; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm = ((unsigned char) (tmp >> 8)) ^ 0x80; |
pcm += 2; |
} |
} |
/*------------------- 8 pt window ------------------------------*/ |
void windowB8(float *vbuf, int vb_ptr, unsigned char *pcm) |
{ |
int i, j; |
int si, bx; |
float *coef; |
float sum; |
long tmp; |
si = vb_ptr + 4; |
bx = (si + 8) & 127; |
coef = wincoef; |
/*-- first 4 --*/ |
for (i = 0; i < 4; i++) |
{ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[si]; |
si = (si + 16) & 127; |
sum -= (*coef++) * vbuf[bx]; |
bx = (bx + 16) & 127; |
} |
si++; |
bx--; |
coef += 48; |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm++ = ((unsigned char) (tmp >> 8)) ^ 0x80; |
} |
/*-- special case --*/ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[bx]; |
bx = (bx + 16) & 127; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm++ = ((unsigned char) (tmp >> 8)) ^ 0x80; |
/*-- last 3 --*/ |
coef = wincoef + 255; /* back pass through coefs */ |
for (i = 0; i < 3; i++) |
{ |
coef -= 48; |
si--; |
bx++; |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef--) * vbuf[si]; |
si = (si + 16) & 127; |
sum += (*coef--) * vbuf[bx]; |
bx = (bx + 16) & 127; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm++ = ((unsigned char) (tmp >> 8)) ^ 0x80; |
} |
} |
/*--------------- 8 pt dual window (interleaved output) -----------------*/ |
void windowB8_dual(float *vbuf, int vb_ptr, unsigned char *pcm) |
{ |
int i, j; |
int si, bx; |
float *coef; |
float sum; |
long tmp; |
si = vb_ptr + 4; |
bx = (si + 8) & 127; |
coef = wincoef; |
/*-- first 4 --*/ |
for (i = 0; i < 4; i++) |
{ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[si]; |
si = (si + 16) & 127; |
sum -= (*coef++) * vbuf[bx]; |
bx = (bx + 16) & 127; |
} |
si++; |
bx--; |
coef += 48; |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm = ((unsigned char) (tmp >> 8)) ^ 0x80; |
pcm += 2; |
} |
/*-- special case --*/ |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef++) * vbuf[bx]; |
bx = (bx + 16) & 127; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm = ((unsigned char) (tmp >> 8)) ^ 0x80; |
pcm += 2; |
/*-- last 3 --*/ |
coef = wincoef + 255; /* back pass through coefs */ |
for (i = 0; i < 3; i++) |
{ |
coef -= 48; |
si--; |
bx++; |
sum = 0.0F; |
for (j = 0; j < 8; j++) |
{ |
sum += (*coef--) * vbuf[si]; |
si = (si + 16) & 127; |
sum += (*coef--) * vbuf[bx]; |
bx = (bx + 16) & 127; |
} |
tmp = (long) sum; |
if (tmp > 32767) |
tmp = 32767; |
else if (tmp < -32768) |
tmp = -32768; |
*pcm = ((unsigned char) (tmp >> 8)) ^ 0x80; |
pcm += 2; |
} |
} |
/programs/media/midamp/trunk/MIDAMP.ASM |
---|
58,7 → 58,7 |
dd START |
dd I_END |
dd APP_MEM |
dd APP_MEM ;stack size=1024 |
dd APP_MEM - 1024 |
dd I_PARAM |
listsel dd 0 |
channel dd 0 |
357,7 → 357,7 |
dd 0 |
dd 0 |
dd 0 |
fsize dd APP_MEM-1024-workarea ; max size |
fsize dd APP_MEM-2048-workarea ; max size |
dd workarea |
I_END: ; ª®¥æ ¯à®£à ¬¬ë |
filename: |
/programs/media/midamp/trunk/macros.inc |
---|
143,10 → 143,6 |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
178,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
222,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
/programs/media/pic4/trunk/build_en.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm pic4.asm pic4 |
@pause |
/programs/media/pic4/trunk/build_ru.bat |
---|
0,0 → 1,4 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm pic4.asm pic4 |
@pause |
/programs/media/pic4/trunk/macros.inc |
---|
0,0 → 1,269 |
; new application structure |
macro meos_app_start |
{ |
use32 |
org 0x0 |
db 'MENUET01' |
dd 0x01 |
dd __start |
dd __end |
dd __memory |
dd __stack |
if used __params & ~defined __params |
dd __params |
else |
dd 0x0 |
end if |
dd 0x0 |
} |
MEOS_APP_START fix meos_app_start |
macro code |
{ |
__start: |
} |
CODE fix code |
macro data |
{ |
__data: |
} |
DATA fix data |
macro udata |
{ |
if used __params & ~defined __params |
__params: |
db 0 |
__end: |
rb 255 |
else |
__end: |
end if |
__udata: |
} |
UDATA fix udata |
macro meos_app_end |
{ |
align 32 |
rb 2048 |
__stack: |
__memory: |
} |
MEOS_APP_END fix meos_app_end |
; macro for defining multiline text data |
struc mstr [sstring] |
{ |
forward |
local ssize |
virtual at 0 |
db sstring |
ssize = $ |
end virtual |
dd ssize |
db sstring |
common |
dd -1 |
} |
; strings |
macro sz name,[data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if used name |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
macro lsz name,[lng,data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if (used name)&(lang eq lng) |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
; easy system call macro |
macro mpack dest, hsrc, lsrc |
{ |
if (hsrc eqtype 0) & (lsrc eqtype 0) |
mov dest, (hsrc) shl 16 + lsrc |
else |
if (hsrc eqtype 0) & (~lsrc eqtype 0) |
mov dest, (hsrc) shl 16 |
add dest, lsrc |
else |
mov dest, hsrc |
shl dest, 16 |
add dest, lsrc |
end if |
end if |
} |
macro __mov reg,a,b { ; mike.dld |
if (~a eq)&(~b eq) |
mpack reg,a,b |
else if (~a eq)&(b 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 |
} |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
macro add arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
inc arg1 |
else |
add arg1,arg2 |
end if |
else |
add arg1,arg2 |
end if |
} |
macro sub arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
dec arg1 |
else |
sub arg1,arg2 |
end if |
else |
sub arg1,arg2 |
end if |
} |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
xor arg1,arg1 |
inc arg1 |
else if (arg2) = -1 |
or arg1,-1 |
else if (arg2) > -128 & (arg2) < 128 |
push arg2 |
pop arg1 |
else |
mov arg1,arg2 |
end if |
else |
mov arg1,arg2 |
end if |
} |
macro struct name |
{ |
virtual at 0 |
name name |
sizeof.#name = $ - name |
end virtual |
} |
; structures used in MeOS |
struc process_information |
{ |
.cpu_usage dd ? ; +0 |
.window_stack_position dw ? ; +4 |
.window_stack_value dw ? ; +6 |
.not_used1 dw ? ; +8 |
.process_name rb 12 ; +10 |
.memory_start dd ? ; +22 |
.used_memory dd ? ; +26 |
.PID dd ? ; +30 |
.x_start dd ? ; +34 |
.y_start dd ? ; +38 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
struc system_colors |
{ |
.frame dd ? |
.grab dd ? |
.grab_button dd ? |
.grab_button_text dd ? |
.grab_text dd ? |
.work dd ? |
.work_button dd ? |
.work_button_text dd ? |
.work_text dd ? |
.work_graph dd ? |
} |
struct system_colors |
; constants |
; events |
EV_IDLE = 0 |
EV_TIMER = 0 |
EV_REDRAW = 1 |
EV_KEY = 2 |
EV_BUTTON = 3 |
EV_EXIT = 4 |
EV_BACKGROUND = 5 |
EV_MOUSE = 6 |
EV_IPC = 7 |
EV_STACK = 8 |
; event mask bits for function 40 |
EVM_REDRAW = 1b |
EVM_KEY = 10b |
EVM_BUTTON = 100b |
EVM_EXIT = 1000b |
EVM_BACKGROUND = 10000b |
EVM_MOUSE = 100000b |
EVM_IPC = 1000000b |
EVM_STACK = 10000000b |
/programs/media/pic4/trunk/pic4.asm |
---|
0,0 → 1,679 |
; |
; BACKGROUND SET - Compile with fasm |
; |
use32 |
org 0x0 |
db 'MENUET01' ; 8 byte id |
dd 0x01 ; version |
dd START ; program start |
dd I_END ; image size |
dd 0x80000 ; reguired amount of memory |
dd 0x80000 ; stack pointer |
dd I_Param,0 |
include 'lang.inc' |
include 'macros.inc' |
START: |
call check_parameters |
call draw_window |
call load_texture |
call draw_image |
still: |
mov eax,10 ; wait here for event |
int 0x40 |
cmp eax,1 |
jz red |
cmp eax,2 |
jz key |
cmp eax,3 |
jz button |
jmp still |
key: |
mov eax,2 |
int 0x40 |
jmp still |
red: |
call draw_window |
jmp still |
button: |
mov eax,17 |
int 0x40 |
shr eax,8 |
and eax,255 |
cmp eax,101 ; tiled |
jne no101 |
mov eax,15 |
mov ebx,4 |
mov ecx,1 |
int 0x40 |
mov eax,15 |
mov ebx,3 |
int 0x40 |
jmp still |
no101: |
cmp eax,102 ; stretch |
jne no102 |
mov eax,15 |
mov ebx,4 |
mov ecx,2 |
int 0x40 |
mov eax,15 |
mov ebx,3 |
int 0x40 |
jmp still |
no102: |
cmp eax,1 ; end program |
jnz noproend |
or eax,-1 |
int 0x40 |
noproend: |
cmp eax,11 |
jz bg |
cmp eax,12 |
jz bg |
cmp eax,13 |
jz bg |
cmp eax,121 |
jb no_bg_select |
cmp eax,133 |
jg no_bg_select |
sub eax,121 |
shl eax,2 |
add eax,arrays |
mov eax,[eax] |
mov [usearray],eax |
call load_texture |
call draw_image |
jmp still |
no_bg_select: |
cmp eax,14+20 |
jge bg4 |
jmp bg2 |
check_parameters: |
cmp [I_Param],dword 'BOOT' |
je @f |
ret |
@@: |
call load_texture |
mov eax,15 |
mov ebx,1 |
mov ecx,256 |
mov edx,256 |
int 0x40 |
mov eax,15 |
mov ebx,5 |
mov ecx,0x40000 ; <<< 0x40000 for blue, 0x40000+1 for red, |
; <<< 0x40000+2 for green background at boot |
mov edx,0 |
mov esi,256*3*256 |
int 0x40 |
mov eax,15 |
mov ebx,4 |
mov ecx,2 |
int 0x40 |
mov eax,15 |
mov ebx,3 |
int 0x40 |
mov eax,-1 |
int 0x40 |
set_picture: |
mov eax,image+99-3*16 |
mov ebx,0x40000+255*3+255*3*256 |
newpix: |
mov ecx,[eax] |
mov [ebx],cx |
shr ecx,16 |
mov [ebx+2],cl |
add eax,3 |
sub ebx,3 |
cmp ebx,0x40002 |
jge newpix |
ret |
load_texture: |
call gentexture |
call set_picture |
ret |
; set background |
bg: |
mov edi,0x40000 |
cmp eax,12 |
jnz bb1 |
mov edi,0x40000+1 |
bb1: |
cmp eax,13 |
jnz bb2 |
mov edi,0x40000+2 |
bb2: |
mov eax,15 |
mov ebx,1 |
mov ecx,256 |
mov edx,256 |
int 0x40 |
mov eax,15 |
mov ebx,5 |
mov ecx,edi |
mov edx,0 |
mov esi,256*256*3 |
int 0x40 |
mov eax,15 |
mov ebx,3 |
int 0x40 |
jmp still |
; colored background |
bg2: |
push eax |
mov eax,15 |
mov ebx,1 |
mov ecx,8 |
mov edx,8 |
int 0x40 |
mov eax,[esp] |
sub eax,14 |
shl eax,2 |
mov edx,[colors+eax] |
mov esi,32*32*4 |
mov edi,0 |
mov ecx,0 |
dbl2: |
mov eax,15 |
mov ebx,2 |
int 0x40 |
add ecx,3 |
inc edi |
cmp edi,esi |
jb dbl2 |
mov eax,15 |
mov ebx,3 |
int 0x40 |
jmp still |
; shaped background |
bg4: |
sub eax,14+20 |
shl eax,3 |
add eax,shape |
mov ecx,[eax+0] |
mov edx,[eax+4] |
mov eax,15 |
mov ebx,1 |
int 0x40 |
mov eax,15 |
mov ebx,3 |
int 0x40 |
jmp still |
; ********************************************* |
; ******* CELLULAR TEXTURE GENERATION ********* |
; **** by Cesare Castiglia (dixan/sk/mfx) ***** |
; ********* dixan@spinningkids.org ********** |
; ********************************************* |
; * the algorythm is kinda simple. the color * |
; * component for every pixel is evaluated * |
; * according to the squared distance from * |
; * the closest point in 'ptarray'. * |
; ********************************************* |
gentexture: |
mov ecx,0 ; ycounter |
mov edi,0 ; pixel counter |
mov ebp,[usearray] |
ylup: |
mov ebx,0 |
; call precalcbar |
xlup: |
push edi |
mov edi, 0 |
mov esi, 512000000 ; abnormous initial value :) |
pixlup: |
push esi |
; add edi,4 |
mov eax,ebx ; evaluate first distance |
sub eax, [ebp+edi] ; x-x1 |
call wrappit |
imul eax |
mov esi, eax ; (x-x1)^2 |
mov eax, ecx |
add edi,4 |
sub eax, [ebp+edi] ; y-y1 |
call wrappit |
imul eax ; (y-y1)^2 |
add eax,esi ; (x-x1)^2+(y-y1)^2 |
pop esi |
cmp esi,eax |
jb ok ; compare and take the smaller one |
mov esi,eax |
ok: |
add edi,4 |
cmp [ebp+edi],dword 777 |
jne pixlup |
mov eax,esi ; now evaluate color... |
; cmp eax,255*24 |
; jbe ok2 |
; imul eax,12 |
; ok2: |
mov edi,24 ; 50 = max shaded distance |
idiv edi |
pop edi |
mov [image+51+edi],eax |
add edi,3 |
add ebx,1 ; bounce x loop |
cmp ebx,256 ; xsize |
jne xlup |
add ecx,1 |
cmp ecx,256 ; ysize |
jne ylup |
ret |
wrappit: |
cmp eax,0 ; this makes the texture wrap |
jg noabs |
neg eax |
noabs: |
cmp eax,128 |
jb nowrap |
neg eax |
add eax,256 |
nowrap: |
ret |
;precalcbar: |
; pusha |
; mov eax,1 |
; mov ebx,ecx |
; add ebx,18 |
; mov ecx,44 |
; mov edx,0x00000060 |
; bar: |
; add ecx,2 |
; add edx,0x00020100 |
; int 0x40 |
; cmp ecx,298 |
; jb bar |
; popa |
; ret |
; ********************************************* |
; ******* WINDOW DEFINITIONS AND DRAW ********* |
; ********************************************* |
draw_image: |
mov eax,7 |
mov ebx,0x40000 |
mov ecx,256*65536+255 |
mov edx,19*65536+65;55 |
int 0x40 |
ret |
y_add equ 44 ; 30 |
y_s equ 13 |
y_add2 equ 340 ;325 |
set equ 0 ;15 |
button_color equ 0A0A0A0h ; 207090 306090h |
wnd_color equ 3B0B0B0h ; 34090B0h |
draw_window: |
mov eax, 12 ; tell os about draw |
mov ebx, 1 |
int 0x40 |
mov eax, 0 ; define and draw window |
mov ebx, 220*65536+293 |
mov ecx, 50*65536+408 |
mov edx, wnd_color |
int 0x40 |
call draw_image |
mov eax,8 ; Blue button |
mov ebx,(set+195+27)*65536+17 |
mov ecx,y_add*65536+y_s |
mov edx,11 |
mov esi,0x004444cc |
int 0x40 |
mov eax,8 ; Red button |
mov ebx,(set+213+27)*65536+17 |
mov edx,12 |
mov esi,0x00cc4444 |
int 0x40 |
mov eax,8 ; Green button |
mov ebx,(set+258)*65536+17 |
mov edx,13 |
mov esi,0x0044cc44 |
int 0x40 |
mov eax, 8 ; tiled |
mov ebx, 96*65536+63 |
mov ecx, y_add*65536+y_s |
mov edx, 101 |
mov esi, button_color |
int 0x40 |
mov eax, 8 ; stretch |
mov ebx, 160*65536+61 |
mov edx, 102 |
int 0x40 |
mov eax, 4 ; window header |
mov ebx, 8*65536+8 |
mov ecx, 0x10ffffff |
mov edx, header |
mov esi, header.size |
int 0x40 |
mov ebx, 220*65536+30 |
mov ecx, 0 |
mov edx, apply_text |
mov esi, apply_text.size |
int 0x40 |
mov ebx, 19*65536+326 |
mov edx, image_buttons_text |
mov esi, image_buttons_text.size |
int 0x40 |
mov ebx, 19*65536+(y_add2+27) |
mov edx, simple_text |
mov esi, simple_text.size |
int 0x40 |
mov ecx, (y_add2)*65536+20 |
mov ebx, (18)*65536+25 |
mov edx, 121 |
mov esi, button_color |
mov edi, 9 |
mov eax, 8 |
@@: |
int 0x40 |
add ebx, 29*65536 |
inc edx |
dec edi |
jnz @b |
mov edx, 34+4 |
mov edi, 4 |
mov eax, 8 |
mov ebx, 18*65536+18 |
mov ecx, y_add*65536+y_s |
@@: |
int 0x40 |
inc edx |
add ebx, 19*65536 |
dec edi |
jnz @b |
;----------------------- |
mov edx,14 ; button number |
mov ebx,(18)*65536+17 ; button start x & size |
mov ecx,(y_add2+40)*65536+14 ; button start y & size |
newcb: |
mov esi,[(edx-14)*4+colors] |
mov eax,8 |
int 0x40 |
inc edx |
add ebx,20*65536 |
add esi,5*256*256 |
cmp edx,27 |
jnz newcb |
;----------------------- |
mov eax, 4 |
mov ebx, 8*65536+4+y_add |
mov ecx, 0 |
mov edx, la2 |
mov esi, la2.size |
int 0x40 |
mov eax,12 |
mov ebx,2 |
int 0x40 |
ret |
; DATA SECTION |
lsz header,\ |
ru, "¥¥à â®à ä® à ¡®ç¥£® á⮫ ",\ |
en, "BACKGROUND" |
lsz apply_text,\ |
ru, "ਬ¥¨âì:",\ |
en, "Apply:" |
lsz image_buttons_text,\ |
ru, "ë¡¥à¨â¥ ®¡à §¥æ:",\ |
en, "Select pattern:" |
lsz simple_text,\ |
ru, "¤®æ¢¥âë© ä®:",\ |
en, "Single-color background:" |
lsz la2,\ |
ru, " ",\ |
en, " TILED STRETCH" |
xx db 'x' |
colors: |
dd 0x770000 |
dd 0x007700 |
dd 0x000077 |
dd 0x777700 |
dd 0x770077 |
dd 0x007777 |
dd 0x777777 |
dd 0x335577 |
dd 0x775533 |
dd 0x773355 |
dd 0x553377 |
dd 0x000000 |
dd 0xcccccc |
shape: |
dd 1024,64 |
dd 1024,32 |
dd 2048,32 |
dd 4096,32 |
dd 512,16 |
dd 1024,16 |
dd 2048,16 |
dd 4096,16 |
dd 64,32 |
dd 64,16 |
dd 32,32 |
dd 8,8 |
dd 16,16 |
dd 64,64 |
usearray dd ptarray |
arrays dd ptarray,ptarray2,ptarray3,ptarray4,ptarray5,ptarray6 |
dd ptarray7,ptarray8,ptarray9 |
ptarray: |
dd 150,50 |
dd 120,30 |
dd 44,180 |
dd 50,66 |
dd 27,6 |
dd 95,212 |
dd 128,177 |
dd 201,212 |
dd 172,201 |
dd 250,100 |
dd 24,221 |
dd 11,123 |
dd 248,32 |
dd 34,21 |
dd 777 ; <- end of array |
ptarray2: |
dd 0,0,50,50,100,100,150,150,200,200,250,250 |
dd 50,150,150,50,200,100,100,200 |
dd 777 |
ptarray3: |
dd 55,150,150,55,200,105,105,200 |
dd 30,30,220,220 |
dd 777 |
ptarray4: |
dd 196,0,196,64,196,128,196,196 |
dd 64,32,64,96,64,150,64,228 |
dd 777 |
ptarray5: |
dd 196,0,196,64,196,128,196,196 |
dd 64,0,64,64,64,128,64,196 |
dd 777 |
ptarray6: |
dd 49,49,128,50,210,50 |
dd 50,128,128,128,210,128 |
dd 50,210,128,210,210,210 |
dd 777 |
ptarray7: |
dd 0,0 |
dd 196,196,64,64 |
dd 128,0 |
dd 0,128 |
dd 64,64,196,64 |
dd 196,196,64,196 |
dd 128,128 |
dd 777 |
ptarray8: |
dd 0, 128 |
dd 0, 128 |
dd 128, 0 |
dd 0, 128 |
dd 128, 0 |
dd 0, 128 |
dd 128, 0 |
dd 0, 128 |
dd 128, 0 |
dd 128, 128 |
dd 777 |
ptarray9: |
dd 0,248,64,128,128,64,196,48,160,160,94,224,240,96,5,5,777 |
I_Param: |
image: |
I_END: |
/programs/media/scrshoot/build_en.bat |
---|
0,0 → 1,5 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm scrshot.asm scrshot |
@erase lang.inc |
@pause |
/programs/media/scrshoot/build_ru.bat |
---|
0,0 → 1,5 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm scrshoot.asm scrshoot |
@erase lang.inc |
@pause |
/programs/media/scrshoot/check.inc |
---|
0,0 → 1,217 |
;ä䥪⨢®¥ ¯à®£à ¬¬¨à®¢ ¨¥ ¢ KOLIBRI |
;¯â¨¬¨§¨à®¢ ë© ª®¬¯®¥â CheckBox (áå®¤ë© ¢ ਠ⠮â Maxxxx32) |
;¯â¨¬¨§¨à®¢ ¢ë¢®¤ áâப¨ ¤¯¨á¨ ¤«ï CheckBox'a + ⥯¥àì, ¯à¨ ¯à®¢¥àª¥ ¥ ¯à®¨á室¨â ¯®¤áç¥â ª®«-¢ ᨬ¢®«®¢ ¢ áâப¥ |
;¯â¨¬¨§ æ¨ï ª®¬ ¤ - ®âª § «áï ®â á®åà ¥¨ï ॣ¨áâ஢ ¢ á⥪¥. |
;17.07.2006 ¯à®¨§¢¥¤¥ ®¯â¨¬¨§ æ¨ï, ¯à¨ ãáâ ®¢ª¥ 祪 ¡®ªá ¢ ¯®«®¦¥¨¥ ¢ª«î祮 ¯®á«¥¤ãî騥 祪 ¡®ªáë ¢ â®â ¦¥ ¯à®¬¥¦ã⮪ ¢à¥¬¥¨ ¥ ¯à®¢¥àïîâáï |
;<Lrz> - ¥¯«®¢ «¥ªá¥© www.test-kolibri.narod.ru |
macro use_check_box |
{ |
ch_text_margin=4 ;à ááâ®ï¨¥ ®â ¯àאַ㣮«ì¨ª 祪 ¡®ªá ¤® ¤¯¨á¨ |
ch_size=10 ;à §¬¥à ª¢ ¤à â 祪 ¡®ªá |
ch_left equ [edi] ;ª®®à¤¨ â ç « à¨á®¢ ¨ï ¯® å |
ch_top equ [edi+2] ;ª®®à¤¨ â ç « à¨á®¢ ¨ï ¯® ã |
ch_color equ [edi+4] ;梥⠢ãâਠcheckbox |
ch_border_color equ [edi+8] ;梥â à ¬ª¨ checkbox |
ch_text_color equ [edi+12] ;梥â ⥪áâ |
ch_text_ptr equ [edi+16] ;㪠§ ⥫ì ç «® ⥪á⮢®© áâப¨ |
ch_text_length equ [edi+20] ;¤«¨ ¤¯¨á¨ (2^64 â ª®© ¤«¨ë ¬®¦¥â ¡ëâì ⥪áâ) |
ch_flags equ [edi+24] ;ä« £¨ |
check_box: |
.draw: |
pusha ;á®åà ¨¬ ¢á¥ ॣ¨áâàë |
mov eax,38 ;à¨á®¢ ¨¥ «¨¨¨ |
mov bx,ch_left ;¯®«®¦¥¨¥ ¯® å |
;mov cx,bx ;á®åà ¨¬ ¢ ॣ¨áâॠcx § 票¥ bx |
push bx ;3 - ¬¨ªà®®¯¥à 樨 ¨á¯®«ì§ãï á⥪ ¬®¦® ¢ë¨£à âì ¢ à §¬¥à¥, ¨á¯®«ì§ãï ॣ¨áâàë - ¢ ᪮à®á⨠|
shl ebx,16 ;ᤢ¨¥¬ 16 à §à冷¢ ¢ «¥¢® (㬮¦¨¬ 65536) |
pop bx ;2 - ¬¨ªà®®¯¥à 樨 ¤ ë© ¬®¬¥â áä®à¬¨à®¢ [ª®®à¤¨ â ç « ¯® ®á¨ x]*65536 + [ª®®à¤¨ â ç « ¯® ®á¨ x] |
;mov bx,cx ;¢®ááâ ®¢¨¬ § 票¥ bx |
mov cx,ch_top ;§ £à㧨¬ ¢ cx § 票¥ y |
mov si,cx ;á®åà ¨¬ § 票¥ ॣ¨áâà cx ¢ ॣ¨áâà 㪠§ ⥫ì si |
;push cx |
shl ecx,16 ; ᤢ¨¥¬ 16 à §à冷¢ ¢ «¥¢® (㬮¦¨¬ 65536) mov cx,si ;¢®ááâ ®¢¨¬ § 票¥ ॣ¨áâà cx |
mov cx,si ;¢®ááâ ®¢¨¬ § 票¥ ॣ¨áâà cx |
;pop cx ;[ª®®à¤¨ â ç « ¯® ®á¨ y]*65536 + [ª®®à¤¨ â ç « ¯® ®á¨ y] |
;push cx |
add cx,ch_size ;[ª®®à¤¨ â ç « ¯® ®á¨ y]*65536 + [ª®®à¤¨ â ª®æ ¯® ®á¨ y] |
mov edx,ch_border_color ;¢¥â «¨¨¨ |
int 0x40 ;à¨á®¢ ¨¥ ¢¥à⨪ «ì®© «¥¢®© «¨¨¨ ª¢ ¤à â (¯àאַ㣮«ì¨ª ) |
; |
mov bp,bx ;á®åà ¨¬ ॣ¨áâà bx ¢ ॣ¨áâॠ㪠§ â¥«ï ¡ §ë |
;push bx ;¢â®«ªãâì ¢ bx [ª®®à¤¨ â ç « ¯® ®á¨ å]*65536 + [ª®®à¤¨ â ç « ¯® ®á¨ x] |
add bx,ch_size ;[ª®®à¤¨ â ç « + ¤«¨ áâ®à®ë ¯® ®á¨ å] |
ror ebx,16 ;[ª®®à¤¨ â ç « + ¤¨ áâ®à®ë ¯® ®á¨ å]*65536 |
add bx,ch_size ;[ª®®à¤¨ â ç « +¤«¨ áâ®à®ë ¯® ®á¨ å]*65536 + [ª®®à¤¨ â ç « +¤«¨ áâ®à®ë ¯® ®á¨ x] |
int 0x40 |
mov bx,bp ;¢®ááâ ®¢¨¬ § 票¥ ॣ¨áâà bx |
;pop bx |
mov cx,si ;á®åà ¨¬ § 票¥ ॣ¨áâà cx ¢ ॣ¨áâà 㪠§ ⥫ì |
;pop cx |
int 0x40 |
add cx,ch_size ;¤®¡ ¢¨¬ à §¬¥à áâ®à®ë |
mov si,cx ;á®åà ¨¬ § 票¥ ॣ¨áâà cx ¢ ॣ¨áâà 㪠§ ⥫ì si |
;push cx |
shl ecx,16 |
mov cx,si |
;pop cx |
int 0x40 ; à¨á®¢ «¨ ¯àאַ㣮«ì¨ª |
mov eax,13 ;§ ªà 訢 ¥¬ ¥£®. ãªæ¨ï 13 - à¨á®¢ âì ¯®«®áã |
mov bx,ch_left ;§ £à㧨âì ¢ bx, ¯®«®¦¥¨¥ ¯® å |
add bx,1 ;ᤢ¨¥¬ 1 â.¥. ¯à¨¡ ¢¨¬ 1 ¨ ç¥ § âà¥âáï à ¬ª |
shl ebx,16 ;ᤢ¨¥¬ 16 à §à冷¢ ¢ «¥¢® (㬮¦¨¬ 65536) |
mov bx,ch_size ;¯à¨¡ ¢¨¬ ¤«¨ã áâ®à®ë ¯àאַ㣮«ì¨ª |
sub bx,1 ;¢ëç⥬ 1 â.ª. ¨ ç¥ § âà¥âáï à ¬ª |
mov bp,bx ; á®åà ¨¬ ॣ¨áâà bx ¢ ॣ¨áâॠ㪠§ â¥«ï ¡ §ë |
;push bx |
mov cx,ch_top ;§ £à㧨¬ ª®®à¤¨ âë ¯® y |
add cx,1 ;ᤢ¨¥¬ 1 â.¥. ¯à¨¡ ¢¨¬ 1 ¨ ç¥ § âà¥âáï à ¬ª |
shl ecx,16 ;ᤢ¨¥¬ 16 à §à冷¢ ¢ «¥¢® (㬮¦¨¬ 65536) |
mov cx,bp ;¢®ááâ ®¢¨¬ § 票¥ ॣ¨áâà cx |
;pop cx |
mov edx,ch_color ;§ £à㧨¬ 梥⠯®«®áë |
int 0x40 ;§ ªà ᨫ¨ |
bt dword ch_flags,1 ;¤®áâ âì § 票¥ ¡¨â ¨§ ¯¥à¥¬¥®© ¨ ¯®¬¥áâ¨âì ¢ ä« £ CF |
jnc @f ;¢ ¥á«¨ CF=1, â® ¢ë¯®«¨¬ á«¥¤ãîéãî ¯à®æ¥¤ãàã ¨ ç¥ ¯¥à¥©â¨ ¨¦îî @@ |
call .draw_ch ; à¨á®¢ âì ¢ª«îç¥ë© 祪 ¡®ªá |
@@: |
;---------------------------- |
;à áç¥â ªã¤ ¡ã¤¥â ¯à®¨§¢¥¤¥ ¢ë¢®¤ ⥪áâ |
;---------------------------- |
mov bx,ch_left ;§ £à㧨âì § 票¥ å ¤«ï 祪 ¡®ªá |
add bx,(ch_size+ch_text_margin) ;¤®¡ ¢¨âì à §¬¥à áâ®à®ë ¨ à ááâ®ï¨¥ ª®â®à®¬ ç¥âáï ¢ë¢®¤ ⥪áâ |
shl ebx,16 ;ᤢ¨¥¬ 16 à §à冷¢ ¢ «¥¢® (㬮¦¨¬ 65536) |
mov bx,ch_top ;§ £à㧨¬ § 票¥ ¯® y |
add bx,(ch_size-9+2) ;¤®¡ ¢¨¬ § 票¥ ¤«¨ë áâ®à®ë -9+2 |
mov ecx,ch_text_color ;§ £à㧨¬ 梥⠤¯¨á¨ |
mov edx,ch_text_ptr ;㪠¦¥¬ ¤à¥á ®â ªã¤ 㦮 ¢ë¢®¤¨âì áâபã |
mov esi,ch_text_length ; £à㧨¬ ¤«¨ã ¤¯¨á¨ ¢ esi |
xor eax,eax ;¢¥á¥¬ ¢ eax § 票¥ ¢ë¢®¤ ¤¯¨á¨ ª ¢ã |
add eax,4 |
int 0x40 ;뢮¤ |
popa ;¢®ááâ ®¢¨âì § 票ï ॣ¨áâ஢ ¨§ á⥪ |
ret ;¢ë©¤¥¬ ¨§ ¯à®æ¥¤ãàë |
.clear_ch: ;®ç¨á⪠祪 ¡®ªá |
mov edx,ch_color ;梥⠢ãâਠ祪 ¡®ªá |
jmp @f ;¡¥§ãá«®¢ë© ¯à릮ª ¨¦îî ¬¥âªã @@ |
.draw_ch: ; à¨á®¢ âì ¢ª«îç¥ë© 祪 ¡®ªá |
mov edx,ch_border_color ;§ £à㧨âì 梥â |
@@: |
mov bx,ch_left ;§ £à㧨âì ª®®à¤¨ âã ¯® å |
add bx,(ch_size/3) ;¤®¡ ¢¨âì (áâ®à® ¯àאַ㣮«ì¨ª /3) |
shl ebx,16 ;ᤢ¨¥¬ 16 à §à冷¢ ¢ «¥¢® (㬮¦¨¬ 65536) |
mov bx,(ch_size/2) ;§ £à㧨âì (áâ®à® ¯àאַ㣮«ì¨ª /2) |
mov bp,bx ;á®åà ¨¬ ॣ¨áâà bx ¢ ॣ¨áâॠ㪠§ â¥«ï ¡ §ë |
;push bx |
mov cx,ch_top ;§ £à㧨âì ª®®à¤¨ âã ¯® ã |
add cx,(ch_size/3) ;¤®¡ ¢¨âì (áâ®à® ¯àאַ㣮«ì¨ª /3) |
shl ecx,16 ;ᤢ¨¥¬ 16 à §à冷¢ ¢ «¥¢® (㬮¦¨¬ 65536) |
mov cx,bp ;§ £à㧨¬ § 票ï ॣ¨áâà 㪠§ â¥«ï ¡ §ë ¢ cx |
;pop cx |
mov eax,13 ;¢ eax - § 票ï äãªæ¨¨ ¤«ï ¢ë¢®¤ ¯®«®áë â.¥. ¯® áã⨠¯àאַ㣮«ì¨ª , ª®â®àë© ®â®¡à ¦ ¥â ¢ª«îç¥ë© ª®¬¯®¥â 祪 ¡®ªá |
int 0x40 ;¢ë¢®¤ |
ret ;¢ë©â¨ ¨§ ¯à®æ¥¤ãàë |
.mouse: ;®¡à ¡®âª ¬ëè¨ |
pusha |
mov eax,37 ;¡ã¤¥¬ çâ® â® ¤¥« âì ¥á«¨ ã á çâ® - ¨âì ¦ â® |
xor ebx,ebx ;®¡ã«¨âì ॣ¨áâà ebx (¨§¬¥ï¥â ä« £¨) |
add ebx,2 ;¢¥á⨠¢ ॣ¨áâà § 票¥ 2 |
int 0x40 ;¯à®¢¥àª ¥ ¦ « «¨ ¯®«ì§®¢ â¥«ì ª®¯ªã ¬ë誨 |
test eax,eax ;¯à®¢¥àª ¥á«¨ ã á ¢ eax=0, â® ãáâ ®¢¨¬ ä« £ ¨ ¢ë©¤¥¬ |
jnz @f ;¯¥à¥©â¨ ¨¦îî ¬¥âªã @@ |
btr dword ch_flags,2 ;¨§¢«¥ç¥¨¥ § ç¥¨ï § ¤ ®£® ¡¨â ¢ ä« £ cf ¨ ¨§¬¥¥¨¥ ¥£® § 票ï ã«¥¢®¥. |
popa ;¥á«¨ ¨ç¥£® ¥ ¯à®¨§®è«®, â® ¢®ááâ ®¢¨¬ § 票ï ॣ¨áâ஢ ¨§ á⥪ |
ret ;¢ë室 |
@@: |
bts dword ch_flags,2 ;¯à®¢¥àª ä« £ â.¥. ¯¥à¥®á ¢ cf § 票¥ ¡¨â ¨ ãáâ ®¢ª ¡¨â ¢ á®áâ®ï¨¥ ¢ª«î祮 |
jc .mouse_end ;¥á«¨ CF=1 â® ¯¥à¥©â¨ ¢ ª®¥æ â.¥. íâ® ¢ë室 |
mov esi,ch_text_length ;§ £à㧨âì ª®«-¢® ᨬ¢®«®¢ ¢ ⥪á⮢®© áâப¥ |
;¬®¦¥¨¥ 6 ëáâ஥ 㬮¦¥¨¥ ¬®¦® ¢®á¯®«ì§®¢ âìáï «î¡ë¬ ¬§ ¬¥â®¤®¢, ® áâ àëå à®æ¥áá®à å (386,486,P1)¡ëáâ॥ ¡ã¤¥â á ¨áâàãªæ¨¥© Lea |
;lea esi,[eax*2+eax] |
;shl eax,1 |
imul esi,6 ; ¨«¨ ¬®¦® ¨ â ª 㬮¦¨âì 6 |
add esi,ch_text_margin ;¤®¡ ¢¨âì 3 - à ááâ®ï¨¥ ®â 祪 ¡®ªá ¤® ¤¯¨á¨ |
mov eax,37 ;¯®«ã稬 ª®®à¤¨ âë ¬ë誨 |
xor ebx,ebx ;®¡ã«¨âì ॣ¨áâà |
add ebx,1 ;¤®¡ ¢¨âì 1 |
int 0x40 ;¯®«ãç¨âì ª®®à¤¨ âë ªãàá®à ®â®á¨â¥«ì® ®ª |
mov bx,ch_top ;§ £à㧨âì ¢ bx § 票¥ ª®®à¤¨ âë ã |
cmp ax,bx ;áà ¢¨âì á á ª®®à¤¨ ⮩ ªãàá®à |
jl .mouse_end ;SF <> OF ¥á«¨ ¬¥ìè¥ |
add bx,ch_size ;¤®¡ ¢¨âì à §¬¥à |
cmp ax,bx ;áà ¢¨âì |
jg .mouse_end ;ZF = 0 ¨ SF = OF ¥á«¨ ¡®«ìè¥ |
shr eax,16 ;à §¤¥«¨¬ 65536 ¨«¨ ¯à®á⮠ᤢ¨¥¬ ¡¨âë 16 § 票© |
mov bx,ch_left ;¯à®¨§¢¥¤¥¬ «®£¨ç®¥ áà ¢¥¨¥ |
cmp ax,bx ;áà ¢¨âì ॣ¨áâàë |
jl .mouse_end ;¥á«¨ ¬¥ìè¥ |
add bx,ch_size ;¤®¡ ¢¨âì ¤«¨ã áâ®à®ë ¯àאַ㣮«ì¨ª |
add bx,si ;ç¥áâì ¢ § 票¨ ¯® å ¥é¥ ¨ ¤«¨ã ¤¯¨á¨ ª 祪¡®ªáã |
cmp ax,bx ;áâà ¢¨âì ॣ¨áâàë |
jg .mouse_end ;¥á«¨ ¡®«ìè¥ |
bts dword ch_flags,1 ;¨§¢«¥ç¥¨¥ § ç¥¨ï § ¤ ®£® ¡¨â ¢ ä« £ cf ¨ ¨§¬¥¥¨¥ ¥£® § 票ï 1. |
jc @f ;CF=1 â® ¯¥à¥©â¨ ¨¦îî @@ |
call .draw_ch ;®â®¡à §¨âì ¢ª«îç¥ë© 祪 ¡®ªá |
mov dword [esp+24],1 ;¤ «ì¥©è ï ¯à®¢¥àª 祪 ¡®ªá®¢ ¡¥á¬ëá«¥ , ¯® í⮬㠢 á⥪, £¤¥ à ᯮ« £ ¥âáï ecx ¯®¬¥áâ¨â¬ 0 |
jmp .mouse_end ;¢ë©â¨ |
@@: |
btr dword ch_flags,1 ;¨§¢«¥ç¥¨¥ § ç¥¨ï § ¤ ®£® ¡¨â ¢ ä« £ cf ¨ ¨§¬¥¥¨¥ ¥£® § 票ï ã«¥¢®¥. |
call .clear_ch ;¢ëª«îç¨âì 祪 ¡®ªá â.¥. ¬¥á⥠§ ªà 襮£® ¯àאַ㣮«ì¨ª ®â®¡à §¨âì 梥â ä® . |
.mouse_end: |
popa ;¢®ááâ ®¢¨âì ॣ¨áâàë ¨§ á⥪ |
ret ;¢ë©â¨ |
} |
struc check_box left,top,color,border_color,text_color,text,text_length,flags |
{ ;áâàãªâãà ¯ à ¬¥â஢ ¤«ï 祪 ¡®ªá |
.left: dw left ;+0 ;¯®«®¦¥¨¥ ¯® å |
.top: dw top ;+2 ;¯®«®¦¥¨¥ ¯® ã |
.color: dd color ;+4 ;梥⠢ãâਠ祪 ¡®ªá |
.border_color: dd border_color ;+8 梥â à ¬ª¨ |
.text_color: dd text_color ;+12 梥â ⥪áâ ¤¯¨á¨ |
.text: dd text ;+16 ¤à¥á ¢ ª®¤¥ ¯à®£à ¬¬ë £¤¥ à ᯮ«®¦¥ ⥪áâà |
.text_length: dd text_length ; +20 ¤«¨ ⥪áâ |
.flags: dd flags+0 ;+24 ä« £¨ |
} |
ch_struc_size=28 ;®¡é ï áâàãªâãà 28 ¡ ©â |
macro draw_check_boxes start,end ;à¨á®¢ âì 祪 ¡®ªáë |
{ |
mov edi,start ;ª § ⥫ì ç «® ¤ ëå 祪 ¡®ªá®¢ â.¥. ç «® ¤ ëå ¯¥à¢®£® 祪¡®ªá |
mov ecx,((end-start)/ch_struc_size) ;®«¨ç¥á⢮ 祪 ¡®ªá®¢ |
@@: |
call check_box.draw ;â®¡à §¨âì 祪 ¡®ªá |
add edi,ch_struc_size ;ª § â¥«ì ¯®á«¥¤ãî騥 祪 ¡®ªáë â.¥. +28 |
loop @b ;¯àë£ãâì ¥á«¨ ¢ ecx/cx § 票¥ ¥ 0 ¢¥àåîî @@ |
} |
macro mouse_check_boxes start,end ;ãáâ ®¢ª 祪 ¡®ªá®¢, ¢ § ¢¨á¨¬®á⨠®â ᮡëâ¨ï |
{ |
mov edi,start ; ª § ⥫ì ç «® ¤ ëå 祪 ¡®ªá®¢ â.¥. ç «® ¤ ëå ¯¥à¢®£® 祪¡®ªá |
mov ecx,((end-start)/ch_struc_size) ;®«¨ç¥á⢮ 祪 ¡®ªá®¢ |
@@: |
call check_box.mouse ;¯à®¢¥àª ¬ë誨 ¨ ®¡à ¡®âª ᮡë⨩ |
add edi,ch_struc_size ;ª § â¥«ì ¯®á«¥¤ãî騥 祪 ¡®ªáë |
loop @b ;¯àë£ãâì ¥á«¨ ¢ ecx/cx § 票¥ ¥ 0 ¢¥àåîî @@ |
} |
macro check_boxes_set_sys_color start,end,color_table |
{ |
mov edi,start |
mov ecx,((end-start)/ch_struc_size) |
mov esi,color_table |
@@: |
push dword [esi+32] |
pop dword ch_text_color |
push dword [esi+36] |
pop dword ch_border_color |
add edi,ch_struc_size |
loop @b |
} |
/programs/media/scrshoot/checkbox.inc |
---|
0,0 → 1,196 |
macro use_check_box |
{ |
ch_text_margin=3 |
ch_size=10 |
ch_left equ [edi] |
ch_top equ [edi+2] |
ch_color equ [edi+4] |
ch_border_color equ [edi+8] |
ch_text_color equ [edi+12] |
ch_text_ptr equ [edi+16] |
ch_flags equ [edi+20] |
check_box: |
.draw: |
pusha |
mov eax,38 |
mov bx,ch_left |
push bx |
shl ebx,16 |
pop bx |
mov cx,ch_top |
push cx |
shl ecx,16 |
pop cx |
push cx |
add cx,ch_size |
mov edx,ch_border_color |
int 0x40 |
push bx |
add bx,ch_size |
ror ebx,16 |
add bx,ch_size |
int 0x40 |
pop bx |
pop cx |
int 0x40 |
add cx,ch_size |
push cx |
shl ecx,16 |
pop cx |
int 0x40 |
mov eax,13 |
mov bx,ch_left |
inc bx |
shl ebx,16 |
mov bx,ch_size |
dec bx |
push bx |
mov cx,ch_top |
inc cx |
shl ecx,16 |
pop cx |
mov edx,ch_color |
int 0x40 |
bt dword ch_flags,1 |
jnc @f |
call .draw_ch |
@@: |
call .get_text_n |
mov bx,ch_left |
add bx,(ch_size+ch_text_margin) |
shl ebx,16 |
mov bx,ch_top |
add bx,(ch_size-9+2) |
mov ecx,ch_text_color |
mov eax,4 |
int 0x40 |
popa |
ret |
.get_text_n: |
push eax |
xor esi,esi |
mov edx,ch_text_ptr |
@@: |
mov ah,[edx+esi] |
inc esi |
test ah,ah |
jnz @b |
dec esi |
pop eax |
ret |
.clear_ch: |
mov edx,ch_color |
jmp @f |
.draw_ch: |
mov edx,ch_border_color |
@@: |
mov bx,ch_left |
add bx,(ch_size/3) |
shl ebx,16 |
mov bx,(ch_size/2) |
push bx |
mov cx,ch_top |
add cx,(ch_size/3) |
shl ecx,16 |
pop cx |
mov eax,13 |
int 0x40 |
ret |
.mouse: |
pusha |
mov eax,37 |
mov ebx,2 |
int 0x40 |
bt eax,0 |
jc @f |
btr dword ch_flags,2 |
popa |
ret |
@@: |
bts dword ch_flags,2 |
jc .mouse_end |
call .get_text_n |
imul esi,6 |
add si,ch_text_margin |
mov eax,37 |
xor ebx,ebx |
inc ebx |
int 0x40 |
mov bx,ch_top |
cmp ax,bx |
jl .mouse_end |
add bx,ch_size |
cmp ax,bx |
jg .mouse_end |
shr eax,16 |
mov bx,ch_left |
cmp ax,bx |
jl .mouse_end |
add bx,ch_size |
add bx,si |
cmp ax,bx |
jg .mouse_end |
bts dword ch_flags,1 |
jc @f |
call .draw_ch |
jmp .mouse_end |
@@: |
btr dword ch_flags,1 |
call .clear_ch |
.mouse_end: |
popa |
ret |
} |
struc check_box left,top,color,border_color,text_color,text,flags |
{ |
.left: dw left ;+0 |
.top: dw top ;+2 |
.color: dd color ;+4 |
.border_color: dd border_color ;+8 |
.text_color: dd text_color ;+12 |
.text: dd text ;+16 |
.flags: dd flags+0 ;+20 |
} |
ch_struc_size=24 |
macro draw_check_boxes start,end |
{ |
mov edi,start |
mov ecx,((end-start)/ch_struc_size) |
@@: |
call check_box.draw |
add edi,ch_struc_size |
loop @b |
} |
macro mouse_check_boxes start,end |
{ |
mov edi,start |
mov ecx,((end-start)/ch_struc_size) |
@@: |
call check_box.mouse |
add edi,ch_struc_size |
loop @b |
} |
macro check_boxes_set_sys_color start,end,color_table |
{ |
mov edi,start |
mov ecx,((end-start)/ch_struc_size) |
mov esi,color_table |
@@: |
push dword [esi+32] |
pop dword ch_text_color |
push dword [esi+36] |
pop dword ch_border_color |
add edi,ch_struc_size |
loop @b |
} |
/programs/media/scrshoot/editbox.inc |
---|
0,0 → 1,755 |
; <Lrz> 21.07.2006 ¤®¡ ¢«¥ äãªæ¨ï ª®¯ª¨ Del, ⥯¥àì ¬®¦® 㤠«ïâì ᨬ¢®«ë ¯à¨ ¯®¬®é¨ ¤ ®© ª®« ¢¨è¨ |
; ¢â®à: ¢â¨å®¢ ªá¨¬ (Maxxxx32) email: maxxxxm@mail.ru |
; â ¯®á«¥¤¨å ¨§¬¥¥¨©: 13.07.06 10:40 |
; ¯¨è¨â¥ ¢ ¨á室®¬ ª®¤¥ ᢮¥© ¯à®£à ¬¬ë use_edit_box, |
; íâ® ¢áâ ¢¨â ¥®¡å®¤¨¬ë¥ ¯à®æ¥¤ãàë ¢ ª®¤ ¢ 襩 ¯à®£à ¬¬ë. |
; à®æ¥¤ãàë: |
; edit_box.draw - ¯®« ï ¯¥à¥à¨á®¢ª ; |
; edit_box.key - ®¡à ¡®âª ª« ¢¨ âãàë; |
; edit_box.mouse - ®¡à ¡®âª ¬ëè¨; |
; edit_box.focus - ãáâ ®¢ª 䮪ãá ; |
; edit_box.blur - ¥£® à §¬ë¢ ¨¥; |
; edit_box.get_n - ¯®«ãç¨âì ª®«¨ç¥á⢮ ¯à®à¨á®¢ë¢ ¥¬ëå ᨬ¢®«®¢. |
; ਠ¢ë§®¢¥ «î¡ëå ¨§ íâ¨å ¯à®æ¥¤ãà ¢ ॣ¨áâॠedi á«¥¤ã¥â |
; ®áâ ¢¨âì 㪠§ ⥫ì áâàãªâãàã. |
; ਬ¥à áâàãªâãàë: |
; some_edit edit_box 100,10,30,0x00ffffff,0,0x00aaaaaa,0,255,some_edit_text |
; ¤«¨ , «¥¢®, ¢¥àå, 梥â ä® , 梥â à ¬ª¨, ¥á«¨ ¢ë¡à , |
; 梥â à ¬ª¨, ¥á«¨ ¥ ¢ë¡à , ¬ ªá¨¬ «ì®¥ ª®«¨ç¥á⢮ ᨬ¢®«®¢, |
; 㪠§ â¥«ì ¡ãä¥à, £¤¥ ¡ã¤ãâ åà ¨âáï ᨬ¢®«ë. ãä¥à ¤®«¦¥ |
; ®ª 稢 âìáï ã«¥¬, ¯à¨¬¥à ¥á«¨ ¬ ªá¨¬ «ì®¥ ª®«¨ç¥á⢮ 255: |
; some_edit_text: |
; rb 256 ;255+1 |
; ਬ¥à ¢ë§®¢ ¯à®æ¥¤ãàë: |
; mov edi,some_edit |
; call edit_box.draw |
; ਠ¢ë§®¢¥ ¯à®æ¥¤ãàë edit_box.key ª®¤ ª« ¢¨è¨ ¤®«¦¥ |
; 室¨âáï ¢ ah, â® ¥áâì ¯¥à¥¤ ¢ë§®¢®¬ í⮩ ¯à®æ¥¤ãàë ¤® ¢ë§¢ âì |
; 2-ãî á¨á¥¬ãî äãªæ¨î, ¯à¨¬¥à: |
; mov eax,2 |
; int 0x40 |
; mov edi,some_edit1 |
; call edit_box.key |
; mov edi,some_edit2 |
; call edit_box.key |
; ¥à¥¤ ¢ë§®¢®¬ ®¡à ¡®â稪 ¬ëè¨ á«¥¤ã¥â ¯à®¢¥à¨âì, ï¥âáï «¨ ®ª® |
; ªâ¨¢ë¬. |
; ᫨ 饫箪 ¬ëè¨ ¡ë« ¯à®©§¢¥¤¥ § ¯à¥¤¥« ¬¨ edit box |
; 䮪ãá â¥àï¥âáï. |
macro use_edit_box |
{ |
edit_box: |
ed_width equ [edi] |
ed_left equ [edi+2] |
ed_top equ [edi+4] |
ed_color equ [edi+6] |
ed_focus_border_color equ [edi+10] |
ed_blur_border_color equ [edi+14] |
ed_text_color equ [edi+18] |
ed_flags equ [edi+22] |
ed_max equ [edi+24] |
ed_size equ [edi+26] |
ed_pos equ [edi+28] |
ed_offset equ [edi+30] |
ed_text equ [edi+32] |
ed_height=14 ; ¢ëá®â |
;========================================================== |
;=== ¯à®æ¥¤ãà ¯à®à¨á®¢ª¨ ================================= |
;========================================================== |
.draw: |
pusha |
;--- à¨á㥬 à ¬ªã --- |
call .draw_border |
.draw_bg_cursor_text: |
;--- ¨§¬¥ï¥¬ ᬥ饨¥, ¥á«¨ ¤® --- |
call .check_offset |
;--- à¨á㥬 ¢ãâà¥îî ®¡« áâì --- |
call .draw_bg |
.draw_cursor_text: |
;--- à¨á㥬 ªãàá®à --- |
;--- ¬®¦¥â ¥£® ¥ ¤® à¨á®¢ âì ---- |
bt word ed_flags,1 |
jnc @f |
call .draw_cursor |
@@: |
call .draw_text |
popa |
ret |
;---------------------------------------------------------- |
;--- ¯à®æ¥¤ãà ¯à®à¨á®¢ª¨ ⥪áâ -------------------------- |
;---------------------------------------------------------- |
.draw_text: |
;--- ¢ëç¨á«ï¥¬, ᪮«ìª® ¯®¬¥é ¥âáï ᨬ¢®«®¢ --- |
call .get_n |
;--- çâ®¡ë ¬ãá®à ¥ à¨á®¢ âì --- |
movsx esi,word ed_size |
sub si,ed_offset |
cmp ax,si |
ja @f |
mov si,ax |
@@: |
;--- à¨á㥬 ⥪áâ --- |
mov eax,4 |
mov bx,ed_left |
add bx,2 |
shl ebx,16 |
mov bx,ed_top |
add bx,4 |
mov ecx,ed_text_color |
movsx edx,word ed_offset |
add edx,ed_text |
int 0x40 |
ret |
;---------------------------------------------------------- |
;--- ¯à®æ¥¤ãà ¯à®à¨á®¢ª¨ ä® ---------------------------- |
;---------------------------------------------------------- |
.draw_bg_eax: |
pusha |
movsx ebx,ax |
lea ebx,[ebx*2+ebx] |
shl bx,1 |
shl ebx,16 |
shr eax,16 |
lea eax,[eax*2+eax] |
shl ax,1 |
add ax,ed_left |
add ax,2 |
mov bx,ax |
ror ebx,16 |
jmp @f |
.draw_bg: |
pusha |
mov bx,ed_left |
inc bx |
shl ebx,16 |
mov bx,ed_width |
dec bx |
@@: |
mov cx,ed_top |
inc cx |
shl ecx,16 |
mov cx,ed_height |
dec cx |
mov edx,ed_color |
mov eax,13 |
int 0x40 |
popa |
ret |
;---------------------------------------------------------- |
;--- ¯à®æ¥¤ãà ¯®«ãç¥¨ï ª®«¨ç¥á⢠ᨬ¢®«®¢ -------------- |
;---------------------------------------------------------- |
.get_n: |
xor edx,edx |
movsx eax,word ed_width |
sub ax,4 |
mov bx,6 |
div bx |
ret |
;---------------------------------------------------------- |
;--- ¯à®æ¥¤ãà à¨á®¢ ¨ï ªãàá®à -------------------------- |
;---------------------------------------------------------- |
.clear_cursor: |
mov edx,ed_color |
jmp @f |
.draw_cursor: |
mov edx,ed_text_color |
@@: |
movsx ebx,word ed_pos |
sub bx,ed_offset |
;lea ebx,[ebx*2+ebx] |
;shl ebx,1 |
imul ebx,6 |
add bx,ed_left |
inc bx |
push bx |
shl ebx,16 |
pop bx |
mov cx,ed_top |
add cx,2 |
push cx |
shl ecx,16 |
pop cx |
add cx,ed_height-4 |
mov eax,38 |
int 0x40 |
ret |
;---------------------------------------------------------- |
;--- ¯à®æ¥¤ãà à¨á®¢ ¨ï à ¬ª¨ ---------------------------- |
;---------------------------------------------------------- |
.draw_border: |
;--- 梥â à ¬ª¨ --- |
bt word ed_flags,1 |
mov edx,ed_focus_border_color |
jc @f |
mov edx,ed_blur_border_color |
@@: |
;--- ᢥàåã --- |
mov bx,ed_left |
push bx |
shl ebx,16 |
pop bx |
add bx,ed_width |
mov cx,ed_top |
push cx |
shl ecx,16 |
pop cx |
mov eax,38 |
int 0x40 |
;--- ᨧã --- |
push cx |
add cx,ed_height |
push cx |
shl ecx,16 |
pop cx |
int 0x40 |
;--- á«¥¢ --- |
pop cx |
push bx |
sub bx,ed_width |
int 0x40 |
;--- á¯à ¢ --- |
pop bx |
push bx |
shl ebx,16 |
pop bx |
int 0x40 |
ret |
;---------------------------------------------------------- |
;--- ¯à®¢¥àª , § 襫 «¨ ªãàá®à § £à ¨æë ¨, ¥á«¨ ¤®, --- |
;--- ¨§¬¥ï¥¬ ᬥ饨¥ ------------------------------------ |
;--- eax = 1, ¥á«¨ ¥ ¨§¬¥¨«®áì ¨«¨ eax = 0, ¥á«¨ |
; ¨§¬¥¨«®áì |
;---------------------------------------------------------- |
.check_offset: |
push word ed_offset |
call .get_n |
;--- ¯à ¢¥¥ --- |
mov bx,ed_offset |
add bx,ax |
cmp bx,ed_pos |
ja @f |
mov bx,ed_pos |
mov cx,ax |
shr cx,2 |
sub bx,cx |
mov cx,ax |
shr cx,1 |
sub bx,cx |
mov ed_offset,bx |
@@: |
;--- «¥¢¥¥ --- |
mov bx,ed_offset |
cmp bx,ed_pos |
jb @f |
mov bx,ed_pos |
mov cx,ax |
shr cx,2 |
sub bx,cx |
jnc $+5 |
xor bx,bx |
mov ed_offset,bx |
@@: |
xor eax,eax |
pop bx |
cmp bx,ed_offset |
jne @f |
inc eax |
@@: |
ret |
;========================================================== |
;=== ®¡à ¡®âª ª« ¢¨ âãàë ================================= |
;========================================================== |
.key: |
pusha |
bt word ed_flags,1 ; ¥á«¨ ¥ ¢ 䮪ãá¥, ¢ë室¨¬ |
jc @f |
popa |
ret |
@@: |
;---------------------------------------------------------- |
;--- ¯à®¢¥à塞, çâ® ¦ â® -------------------------------- |
;---------------------------------------------------------- |
cmp ah,8 |
je .backspace |
cmp ah,0xb6 |
je .delete |
cmp ah,176 |
je .left |
cmp ah,179 |
je .right |
cmp ah,180 |
je .home |
cmp ah,181 |
je .end |
;--- ¦ â ¤àã£ ï ª« ¢¨è --- |
bt word ed_flags,15 ; ⮫쪮 æ¨äàë ? |
jnc @f |
cmp ah,'0' |
jb .no_figure |
cmp ah,'9' |
ja .no_figure |
jmp @f |
.no_figure: |
popa |
ret |
@@: |
; ¯à®¢¥à塞, 室¨âáï «¨ ªãàá®à ¢ ª®æ¥ |
mov bx,ed_max |
cmp bx,ed_pos |
jne @f ; ¥á«¨ ¤ , ¢ ª®¥æ ¯à®æ¥¤ãàë |
popa |
ret |
@@: |
; ᤢ¨£ ¥¬ ᨬ¢®«ë ¯®á«¥ ªãàá®à ¢¯à ¢® |
mov edx,ed_text |
dec edx |
xor ecx,ecx |
mov cx,ed_size |
cmp cx,ed_pos |
je @f |
.mov_right_next: |
mov bh,[edx+ecx] |
mov [edx+ecx+1],bh |
dec cx |
cmp cx,ed_pos |
jne .mov_right_next |
@@: |
; ¢áâ ¢«ï¥¬ ª®¤ ª« ¢¨è¨ â㤠, £¤¥ ªãàá®à |
mov edx,ed_text |
movsx ebx,word ed_pos |
mov [ebx+edx],ah |
call .clear_cursor |
; 㢥«¨ç¨¢ ¥¬ § 票¥ à §¬¥à ¨ ¯®§¨æ¨¨ |
inc word ed_pos |
mov bx,ed_size |
cmp bx,ed_max |
je .draw_bg_cursor_text;.key_end_draw |
inc word ed_size |
;push word ed_offset |
call .check_offset |
;pop ax |
;cmp ax,ed_offset |
;jne .draw_bg_cursor_text |
test eax,eax |
jz .draw_bg_cursor_text |
call .get_n |
sub ax,ed_pos |
add ax,ed_offset |
inc ax |
shl eax,16 |
mov ax,ed_pos |
sub ax,ed_offset |
dec ax |
ror eax,16 |
call .draw_bg_eax |
jmp .draw_cursor_text |
;jmp .draw_cursor_text;.key_end_draw |
.delete: |
mov dx,ed_size |
mov cx,ed_pos |
;inc edx |
;add ecx,900 |
;sub ecx,1 |
cmp dx,cx |
jg @f |
popa |
ret |
@@: |
mov edx,ed_text |
;dec edx |
.mov_stop_next: |
mov bh,[edx+ecx+1] |
mov [edx+ecx],bh |
inc cx |
mov bx,ed_size |
;dec bx |
;dec bx |
cmp cx,bx |
jne .mov_stop_next |
; 㬥ìè ¥¬ § 票¥ ¯®§¨æ¨¨ ¨ à §¬¥à |
;dec word ed_pos |
dec word ed_size |
;push word ed_offset |
call .check_offset |
;pop ax |
;cmp ax,ed_offset |
;jne .draw_bg_cursor_text |
test eax,eax |
jz .draw_bg_cursor_text |
call .get_n |
sub ax,ed_pos |
add ax,ed_offset |
shl eax,16 |
mov ax,ed_pos |
sub ax,ed_offset |
ror eax,16 |
call .draw_bg_eax |
jmp .draw_cursor_text |
popa |
ret |
;--- ¦ â ª« ¢¨è backspace --- |
.backspace: |
; ¯à®¢¥à塞, ªãàá®à ã «¥¢®£® ªà ï ? |
mov bx,ed_pos |
;cmp bx,0 |
;jne @f; .key_end ; ¥á«¨ ¤ , ¢ ª®¥æ |
test bx,bx |
jnz @f |
popa |
ret |
@@: |
; ᤢ¨£ ¥¬ ᨬ¢®«ë ¯®á«¥ ªãàá®à ¢«¥¢® |
mov edx,ed_text |
dec edx |
movsx ecx,word ed_pos |
.mov_left_next: |
mov bh,[edx+ecx+1] |
mov [edx+ecx],bh |
inc cx |
mov bx,ed_size |
inc bx |
cmp cx,bx |
jne .mov_left_next |
; 㬥ìè ¥¬ § 票¥ ¯®§¨æ¨¨ ¨ à §¬¥à |
dec word ed_pos |
dec word ed_size |
;push word ed_offset |
call .check_offset |
;pop ax |
;cmp ax,ed_offset |
;jne .draw_bg_cursor_text |
test eax,eax |
jz .draw_bg_cursor_text |
call .get_n |
sub ax,ed_pos |
add ax,ed_offset |
shl eax,16 |
mov ax,ed_pos |
sub ax,ed_offset |
ror eax,16 |
call .draw_bg_eax |
jmp .draw_cursor_text |
popa |
ret |
;--- ¦ â ª« ¢¨è left --- |
.left: |
mov bx,ed_pos |
;cmp bx,0 |
;je @f |
test bx,bx |
jz @f |
call .clear_cursor |
dec word ed_pos |
call .check_offset |
test eax,eax |
jz .draw_bg_cursor_text |
call .draw_cursor |
@@: |
popa |
ret |
;--- ¦ â ª« ¢¨è right --- |
.right: |
mov bx,ed_pos |
cmp bx,ed_size |
je @f |
call .clear_cursor |
inc word ed_pos |
call .check_offset |
test eax,eax |
jz .draw_bg_cursor_text |
call .draw_cursor |
@@: |
popa |
ret |
.home: |
mov bx,ed_pos |
test bx,bx |
jz @f |
call .clear_cursor |
xor eax,eax |
mov ed_pos,ax |
call .check_offset |
test eax,eax |
jz .draw_bg_cursor_text |
call .draw_cursor |
@@: |
popa |
ret |
.end: |
mov bx,ed_pos |
cmp bx,ed_size |
je @f |
call .clear_cursor |
mov ax,ed_size |
mov ed_pos,ax |
call .check_offset |
test eax,eax |
jz .draw_bg_cursor_text |
call .draw_cursor |
@@: |
popa |
ret |
;========================================================== |
;=== ®¡à ¡®âª ¬ëè¨ ======================================= |
;========================================================== |
.mouse: |
pusha |
;---------------------------------------------------------- |
;--- ¯®«ãç ¥¬ á®áâ®ï¨¥ ª®¯®ª ¬ëè¨ ----------------------- |
;---------------------------------------------------------- |
mov eax,37 |
mov ebx,2 |
int 0x40 |
;---------------------------------------------------------- |
;--- ¯à®¢¥à塞 á®áâ®ï¨¥ ---------------------------------- |
;---------------------------------------------------------- |
bt eax,0 |
jc .mouse_left_button |
bt eax,1 |
jc @f |
btr word ed_flags,2 |
@@: |
popa |
ret |
.mouse_left_button: |
;---------------------------------------------------------- |
;--- ¯®«ãç ¥¬ ª®®à¤¨ âë ¬ëè¨ ----------------------------- |
;---------------------------------------------------------- |
bts word ed_flags,2 |
jc .mouse_pressed |
mov eax,37 |
;mov ebx,1 |
xor ebx,ebx |
inc ebx |
int 0x40 |
;---------------------------------------------------------- |
;--- ¯à®¢¥à塞, ¯®¯ ¤ ¥â «¨ ªãàá®à ¢ edit box ------------- |
;---------------------------------------------------------- |
mov bx,ed_top |
cmp ax,bx |
jl ._blur;.mouse_end_no_focus |
add bx,ed_height |
cmp ax,bx |
jg ._blur;.mouse_end_no_focus |
shr eax,16 |
mov bx,ed_left |
cmp ax,bx |
jl ._blur;.mouse_end_no_focus |
add bx,ed_width |
cmp ax,bx |
jg ._blur;.mouse_end_no_focus |
;--- ¨§¬¥ï¥¬ ¯®§¨æ¨î ªãàá®à --- |
push eax |
call .clear_cursor |
pop eax |
xor dx,dx |
sub ax,ed_left |
add ax,2 |
mov bx,6 |
div bx |
add ax,ed_offset |
cmp ax,ed_size |
jna @f |
mov ax,ed_size |
@@: |
mov ed_pos,ax |
call .check_offset |
test eax,eax |
jz .draw_bg_cursor_text |
call .draw_cursor |
call .focus |
.mouse_pressed: |
popa |
ret |
;.mouse_end_no_focus: |
; call .blur |
;popa |
;ret |
;---------------------------------------------------------- |
;--- ¯à®æ¥¤ãà ãáâ ®¢ª¨ 䮪ãá --------------------------- |
;---------------------------------------------------------- |
.blur: |
pusha |
._blur: |
bt word ed_flags,14 |
jc @f |
btr word ed_flags,1 |
jnc @f |
call .clear_cursor |
jmp .blur_end |
.focus: |
pusha |
bts word ed_flags,1 |
jc @f |
call .draw_cursor |
.blur_end: |
call .draw_border |
@@: |
popa |
ret |
;---------------------------------------------------------- |
;--- ¯à®æ¥¤ãà à §¬ë¢ ¨ï 䮪ãá -------------------------- |
;---------------------------------------------------------- |
;.blur: |
;pusha |
;._blur: |
;btr word ed_flags,1 |
;jnc @f |
;call .draw_border |
;call .clear_cursor |
;@@: |
;popa |
;ret |
} |
ed_figure_only=1000000000000000b |
ed_always_focus=100000000000000b |
ed_focus=10b |
ed_struc_size=36 |
macro draw_edit_boxes start,end |
{ |
mov edi,start |
mov ecx,((end-start)/ed_struc_size) |
@@: |
call edit_box.draw |
add edi,ed_struc_size |
loop @b |
} |
macro mouse_edit_boxes start,end |
{ |
mov edi,start |
mov ecx,((end-start)/ed_struc_size) |
@@: |
call edit_box.mouse |
add edi,ed_struc_size |
loop @b |
} |
macro key_edit_boxes start,end |
{ |
mov edi,start |
mov ecx,((end-start)/ed_struc_size) |
@@: |
call edit_box.key |
add edi,ed_struc_size |
loop @b |
} |
struc edit_box width,left,top,color,focus_border_color,\ |
blur_border_color,text_color,max,text,flags,size |
{ |
.width dw width |
.left dw left |
.top dw top |
.color dd color |
.focus_border_color dd focus_border_color |
.blur_border_color dd blur_border_color |
.text_color dd text_color |
.flags dw flags+0 |
.max dw max |
.size dw size+0 |
.pos dw 0 |
.offset dw 0 |
.text dd text |
} |
macro edit_boxes_set_sys_color start,end,color_table |
{ |
mov edi,start |
mov ecx,((end-start)/ed_struc_size) |
mov esi,color_table |
@@: |
mov eax,[esi+36] |
mov ebx,[esi+20] |
mov ed_focus_border_color,eax |
shr bh,1 |
shr bl,1 |
shr ah,1 |
shr al,1 |
add ah,bh |
add al,bl |
ror eax,16 |
ror ebx,16 |
shr bl,1 |
shr al,1 |
add al,bl |
ror eax,16 |
mov ed_blur_border_color,eax |
add edi,ed_struc_size |
loop @b |
} |
macro draw_edit_box ed_ptr |
{ |
mov edi,ed_ptr |
call edit_box.draw |
} |
macro mouse_edit_box ed_ptr |
{ |
mov edi,ed_ptr |
call edit_box.mouse |
} |
macro key_edit_box ed_ptr |
{ |
mov edi,ed_ptr |
call edit_box.key |
} |
/programs/media/scrshoot/file_sys.inc |
---|
0,0 → 1,41 |
macro file_sys struc_ptr |
{ |
mov eax,58 |
mov ebx,struc_ptr |
int 0x40 |
} |
struc fs_struc function_number,block_number,size,data_ptr,mem_for_sys_ptr |
{ |
.function_number: dd function_number+0 ;+0 |
.block_number: dd block_number+0 ;+4 |
.size: dd size+0 ;+8 |
.data_ptr: dd data_ptr+0 ;+12 |
.mem_for_sys_ptr: dd mem_for_sys_ptr+0 ;+16 |
} |
fs_struc_size=20 |
fs_read_file=0 |
fs_rewrite_file=1 |
fs_delete_file=2 |
fs_write_to_file=3 |
fs_create_dir=4 |
fs_rename_file=5 |
fs_lba_read=9 |
fs_get_file_size=12 |
fs_get_file_atr=13 |
fs_get_file_date_time=14 |
fs_get_fs_info=15 |
fs_run_app=16 |
fse_successful=0 |
fse_not_def_base=1 |
fse_bad_fs=2 |
fse_bad_fs=3 |
fse_part_not_def=4 |
fse_file_not_found=5 |
fse_end_of_file=6 |
fse_bad_ptr=7 |
fse_disk_filled=8 |
fse_bad_fat_table=9 |
fse_acces_denied=10 |
/programs/media/scrshoot/gp.inc |
---|
0,0 → 1,63 |
macro use_gp |
{ |
;esi - screen size |
;edi - pointer to image |
csi_width equ [esi+2] |
csi_height equ [esi] |
csi_bitspp equ [esi+4] |
csi_bytesps equ [esi+6] |
copy_screen_to_image: |
pusha |
xor edx,edx |
xor ecx,ecx |
xor ebx,ebx |
cmp csi_bitspp,word 24 |
je .next_str_24 |
.next_str_32: |
push edx ebx |
xor ebx,ebx |
@@: |
;push eax |
mov eax,[gs:edx] |
mov [edi+ecx],ax |
shr eax,8 |
mov [edi+ecx+2],ah |
;pop eax |
add ecx,3 |
add edx,4;eax |
inc bx |
cmp bx,csi_width |
jl @b |
pop ebx edx |
add edx,csi_bytesps |
inc bx |
cmp bx,csi_height |
jl .next_str_32 |
popa |
ret |
.next_str_24: |
push edx ebx |
xor ebx,ebx |
@@: |
;push eax |
mov eax,[gs:edx] |
mov [edi+ecx],ax |
shr eax,8 |
mov [edi+ecx+2],ah |
;pop eax |
add ecx,3 |
add edx,3;eax |
inc bx |
cmp bx,csi_width |
jl @b |
pop ebx edx |
add edx,csi_bytesps |
inc bx |
cmp bx,csi_height |
jl .next_str_24 |
popa |
ret |
} |
/programs/media/scrshoot/label.inc |
---|
0,0 → 1,51 |
macro use_label |
{ |
draw_label: |
pusha |
xor esi,esi |
mov edx,[edi+8] |
.check_next: |
mov ah,[edx+esi] |
inc esi |
test ah,ah |
jz @f |
jmp .check_next |
@@: |
mov eax,4 |
mov ebx,[edi] |
mov ecx,[edi+4] |
int 0x40 |
popa |
ret |
} |
struc label left,top,color,text |
{ |
.top: dw top ; +0 |
.left: dw left ; +2 |
.color: dd color; +4 |
.text: dd text ; +8 |
} |
l_struc_size=12 |
macro draw_labels start,end |
{ |
mov edi,start |
mov ecx,((end-start)/l_struc_size) |
@@: |
call draw_label |
add edi,l_struc_size |
loop @r |
} |
macro labels_set_sys_color start,end,color_table |
{ |
mov edi,start |
mov ecx,((end-start)/l_struc_size) |
mov esi,color_table |
@@: |
push dword [esi+32] |
pop dword [edi+4] |
add edi,l_struc_size |
loop @r |
} |
/programs/media/scrshoot/macros.inc |
---|
0,0 → 1,350 |
;--- ¤à㣨¥ ¬ ªà®áë --- |
include 'editbox.inc' |
include 'txtbut.inc' |
include 'gp.inc' |
include 'label.inc' |
;include 'checkbox.inc' |
include 'check.inc' |
include 'file_sys.inc' |
include 'textwork.inc' |
;include 'ini.inc' |
lang fix ru;en |
macro movr reg,val |
{ |
if val < 65536 |
push val |
pop reg |
else |
mov reg,val |
end if |
} |
;--- § £®«®¢®ª --- |
macro meos_header par_buf,cur_dir_buf |
{ |
use32 |
org 0x0 |
db 'MENUET01' |
dd 0x01 |
dd __app_start |
dd __app_end |
dd __app_end |
dd __app_end |
if <par_buf> eq <> |
dd 0x0 |
else |
dd par_buf |
end if |
if <cur_dir_buf> eq <> |
dd 0x0 |
else |
dd cur_dir_buf |
end if |
} |
;--- ®¯à¥¤¥«¨âì â®çªã ¢å®¤ --- |
macro app_start |
{ |
__app_start: |
} |
;--- ®¯à¥¤¥«¨âì ª®¥æ ¯à¨«®¦¥¨ï ¨ à §¬¥à á⥪ --- |
macro app_end stack_size |
{ |
if <stack_size> eq <> |
rb 1024 |
else |
rb stack_size |
end if |
__app_end: |
} |
;--- § ¢¥àè¨âì ⥪ã騩 ¯®â®ª --- |
macro app_close |
{ |
xor eax,eax |
dec eax |
int 0x40 |
} |
;--- ¯®«ãç¨âì ª®¤ ¦ ⮩ ª« ¢¨è¨ --- |
macro get_key |
{ |
;mov eax,2 |
push 2 |
pop eax |
int 0x40 |
} |
;--- ¯®«ãç¨âì ª®¤ ¦ ⮩ ª®¯ª¨ --- |
macro get_pressed_button |
{ |
;mov eax,17 |
push 17 |
pop eax |
int 0x40 |
} |
;--- á®®¡é¨âì á¨á⥬¥ ® ç «¥ ¯¥à¥à¨á®¢ª¨ ®ª --- |
macro start_draw_window |
{ |
;mov eax,12 |
push 12 |
pop eax |
xor ebx,ebx |
inc ebx |
int 0x40 |
} |
;--- á®®¡é¨âì á¨á⥬¥ ® § ¢¥à襨¨ ¯¥à¥à¨á®¢ª¨ ®ª --- |
macro stop_draw_window |
{ |
;mov eax,12 |
push 12 |
pop eax |
;mov ebx,2 |
push 2 |
pop ebx |
int 0x40 |
} |
;--- ãáâ ®¢¨âì ¬ áªã ®¦¨¤ ¥¬ëå ᮡë⨩ --- |
macro set_events_mask mask |
{ |
;mov eax,40 |
push 40 |
pop eax |
;mov ebx,mask |
push mask |
pop ebx |
int 0x40 |
} |
;--- ¯®«ãç¨âì ¨ä®à¬ æ¨î ® ¯à®æ¥áᥠ--- |
macro get_procinfo proc_inf_buf,slot_num |
{ |
;mov eax,9 |
push 9 |
pop eax |
;mov ebx,proc_inf_buf |
push proc_inf_buf |
pop ebx |
if <slot_num> eq <> |
xor ecx,ecx |
dec ecx |
else |
;mov ecx,slot_num |
push slot_num |
pop ecx |
end if |
int 0x40 |
} |
macro get_sys_colors col_buf |
{ |
;mov eax,48 |
push 48 |
pop eax |
;mov ebx,3 |
push 3 |
pop ebx |
;mov ecx,col_buf |
push col_buf |
pop ecx |
;mov edx,40 |
push 40 |
pop edx |
int 0x40 |
} |
macro get_grab_area |
{ |
movr eax,48 |
movr ebx,7 |
int 0x40 |
} |
macro get_scin_height |
{ |
movr eax,48 |
movr ebx,4 |
int 0x40 |
} |
macro min_window |
{ |
movr eax,18 |
movr ebx,10 |
int 0x40 |
} |
macro activ_window slot_n |
{ |
movr eax,18 |
movr ebx,3 |
if <slot_n> eq <> |
else |
movr ecx,slot_n |
end if |
int 0x40 |
} |
macro get_active_window |
{ |
movr eax,18 |
movr ebx,7 |
int 0x40 |
} |
macro delay time |
{ |
movr eax,5 |
if <time> eq <> |
else |
movr ebx,time |
end if |
int 0x40 |
} |
;--- ®¦¨¤ âì ᮡëâ¨ï --- |
macro wait_event redraw,key,button,mouse,ipc,other |
{ |
movr eax,10 |
int 0x40 |
dec ax |
if <redraw> eq <> |
else |
jz redraw |
end if |
dec ax |
if <key> eq <> |
else |
jz key |
end if |
dec ax |
if <button> eq <> |
else |
jz button |
end if |
dec ax |
dec ax |
dec ax |
if <mouse> eq <> |
else |
jz mouse |
end if |
if <ipc> eq <> |
else |
dec ax |
jz ipc |
end if |
if <other> eq <> |
jmp still |
else |
jmp other |
end if |
} |
;--- ¯®«ãç¨âì à §¬¥àë íªà --- |
macro get_screen_size |
{ |
movr eax,14 |
int 0x40 |
} |
macro get_screen_prop struc_ptr |
{ |
movr eax,61 |
push eax eax |
xor ebx,ebx |
inc ebx |
int 0x40 |
mov [struc_ptr],eax |
pop eax |
inc ebx |
int 0x40 |
mov [struc_ptr+4],ax |
pop eax |
inc ebx |
int 0x40 |
mov [struc_ptr+6],eax |
} |
macro resize_mem mem_size |
{ |
movr eax,64 |
xor ebx,ebx |
inc ebx |
if <mem_size> eq <> |
else |
movr ecx,mem_size |
end if |
int 0x40 |
} |
evm_redraw equ 1 |
evm_key equ 10b |
evm_button equ 100b |
evm_mouse equ 100000b |
evm_ipc equ 1000000b |
struc procinfo |
{ |
.takts_per_second: dd ? |
.window_stack_pos: dw ? |
.slot_number: dw ? |
dw ? |
.name: rb 11 |
.align: db ? |
.addres: dd ? |
.use_mem: dd ? |
.pid: dd ? |
.left: dd ? |
.top: dd ? |
.width: dd ? |
.height: dd ? |
.slot_state: dw ? |
rb (1024-56) |
} |
struc sys_color_table |
{ |
.frames: dd ? ;+0 |
.grab: dd ? ;+4 |
.grab_button: dd ? ;+8 |
.grab_button_text: dd ? ;+12 |
.grab_text: dd ? ;+16 |
.work: dd ? ;+20 |
.work_button: dd ?;+24 |
.work_button_text: dd ? ;+28 |
.work_text: dd ? ;+32 |
.work_graph: dd ? ;+36 |
} |
struc screen_size |
{ |
.height: dw ? |
.width: dw ? |
} |
struc screen_prop |
{ |
.height: dw ? ;+0 |
.width: dw ? ;+2 |
.bitspp: dw ? ;+4 |
.bytesps: dd ?;+6 |
} |
struc ipc_buffer size |
{ |
.block: dd ? |
.in_use: dd ? |
.messages: rb size |
} |
;--- 梥â --- |
cl_white=0xffffff |
cl_black=0x000000 |
/programs/media/scrshoot/readme.txt |
---|
0,0 → 1,64 |
¢â®à ¤®ªã¬¥â ¨ ¯à®£à ¬¬ë: ¢â¨å®¢ ªá¨¬ (Maxxxx32) |
« £®¤ à®áâ¨: |
à âã ª¨ï®¢ã (Mario79) § ¯®¬®éì, ᮢ¥âë, ªà¨â¨ªã; |
¢á¥¬ ãç á⨪ ¬ ¯à®¥ªâ . |
Screenshooter - ¯à®£à ¬¬ , ¯à¥¤ § ç¥ ï ¤«ï ä®â®£à ä¨à®¢ ¨ï íªà ¨ |
á®åà ¥¨ï ä®â®£à 䨨 ¢¢¨¤¥ ä ©« BMP. |
®§¬®¦®á⨠¯à®£à ¬¬ë: |
* ¯®¤¤¥à¦¨¢ îâáï ¤«¨ë¥ ¨¬¥ ä ©«®¢; |
* ¢â®¬ â¨ç¥áª®¥ ᢮à 稢 ¨¥ ®ª ¯¥à¥¤ áꥬª®©; |
* ¬®¦® ¯®á¬®âà¥âì ᨬ®ª ¯¥à¥¤ á®åà ¥¨¥¬; |
* § ¤¥à¦ª ¯¥à¥¤ áꥬª®©; |
* ¢â®¬ â¨ç¥áª®¥ á®åà ¥¨¥ ä ©« ¯®á«¥ áꥬª¨; |
* ¢â®¬ â¨ç¥áª ï 㬥à æ¨ï ä ©«®¢; |
* ¢â®áꥬª . |
«¨ë¥ ¨¬¥ ä ©«®¢. |
ਠá®åà ¥¨¨ ä ©«®¢ ¯à®£à ¬¬ ¨á¯®«ì§ã¥â 70-î äãªæ¨î, á«¥¤®¢ â¥«ì® |
¨¬¥ ä ©«®¢ ¬®£ãâ ᮤ¥à¦ âì ¤® 260 ᨬ¢®«®¢. |
¢â®¬ â¨ç¥áª®¥ ᢮à 稢 ¨¥ ®ª ¯¥à¥¤ áꥬª®©. |
᫨ ¢ª«îç¨âì äãªæ¨î "¢¥àãâì ®ª®", ¯®á«¥ ¦ â¨ï ª®¯ªã |
"¤¥« âì ᨬ®ª íªà " á ç « ᢥà¥âáï ®ª®, ¯®â®¬ ¡ã¤¥â ᤥ« ᨬ®ª. |
à®á¬®âà ᨬª . |
᫨ ¢ª«îç¨âì äãªæ¨î "®ª § âì ᨬ®ª", ¯®á«¥ áꥬª¨ ¡ã¤¥â ¯®ª § |
⥪ã騩 ᨬ®ª. ᫨ ¦ âì ª®¯ªã "®ª § âì ᨬ®ª ᥩç á", ¡ã¤¥â |
¯®ª § ¯®á«¥¤¨© ᤥ« ë© á¨¬®ª. â®¡ë § ªàëâì ¯à®á¬®âà, ¤® |
¦ âì «î¡ãî ª« ¢¨èã. |
¤¥à¦ª . |
᫨ ¢ª«îç¨âì äãªæ¨î " ¤¥à¦ª ", ¯¥à¥¤ áꥬª®© ¡ã¤¥â § ¤¥à¦ª , à ¢ ï |
¢¢¥¤¥®¬ã ç¨á«ã. ᫨ ç¨á«® ¥ ¢¢¥¤¥®, § ¤¥à¦ª ¡ã¤¥â áç¨â âìáï à ¢®© |
ã«î. 1 = 1/100 ᥪã¤ë, 100 = 1 ᥪ㤠, 1000 = 10 ᥪã¤. |
¢â®á®åà ¥¨¥. |
᫨ ¢ª«îç¨âì äãªæ¨î ¢â®á®åà ¥¨¥, áà §ã ¯®á«¥ áꥬª¨ ä ©« á®åà ¨âáï |
¦¥á⪨© ¤¨áª. |
¢â®ã¬¥à æ¨ï. |
᫨ ¢ª«îç¨âì äãªæ¨î "¢â®ã¬¥à æ¨ï" ¢¬¥áâ® "*" ¢ ¨¬¥¨ ä ©« ¡ã¤¥â |
¢áâ ¢«¥ ⥪ã騩 ®¬¥à ᨬª , ¯à¨ í⮬ ¥®¡å®¤¨¬® § ¤ âì ª®«¨ç¥á⢮ |
§ ª®¢ ¢ ®¬¥à¥. ᫨ ¥ § ¤ âì ç «ìë© ®¬¥à, ® ¡ã¤¥â áç¨â âìáï |
à ¢ë¬ ã«î. ¨è¨¥ § ª¨ ¡ã¤ãâ § ¬¥¥ë ã«ï¬¨. |
¯à¨¬¥à, ¥á«¨ ç «ìë© ®¬¥à - 1, ª®«¨ç¥á⢮ § ª®¢ - 3, |
¨¬ï ä ©« "/hd0/1/menutos/screenshoot number *.bmp", |
ᣥ¥à¨àã¥âáï ¨¬ï ä ©« "/hd0/1/menutos/screenshoot number 001.bmp". |
᫨ äãªæ¨ï "¢â®ã¬¥à æ¨ï ¥ ¡ã¤¥â ¢ª«îç¥ , § 箪 "*" |
¨£®à¨àã¥âáï. |
¢â®áꥬª . |
⮡ë ç âì ¢â®áꥬªã, ¥®¡å®¤¨¬®: |
1) ¢¢¥á⨠¯®«ë© ¯ãâì ª ä ©«ã, £¤¥ ¢¬¥áâ® "*" ¡ã¤¥â ¢áâ ¢«ïâìáï ®¬¥à |
ª ¤à ; |
2) ¢ª«îç¨âì ¢â®ã¬¥à æ¨î; |
3) ¢ª«îç¨âì ¢â®á®åà ¥¨¥; |
4) ãáâ ®¢¨âì ¥®¡å®¤¨¬ãî § ¤¥à¦ªã (¥á«¨ ® 㦠); |
5) ®âª«îç¨âì ¢â®á¢®à 稢 ¨¥ ¨ ¢â®¢®ááâ ®¢«¥¨¥; |
6) ¦ âì ª®¯ªã " ç âì ¢â®áꥬªã". |
«ï ®áâ ®¢ª¨ ¢â®áꥬª¨ ¥®¡å®¤¨¬® ¦ âì ª®¯ªã "áâ ®¢¨âì ¢â®áꥬªã". |
®àï稥 ª« ¢¨è¨: |
PrintScrn - ᤥ« âì ᨬ®ª íªà (£«®¡ «ì ï). |
/programs/media/scrshoot/scrsavef.inc |
---|
0,0 → 1,168 |
save_file: |
pusha |
bt dword [flags],0 |
jnc .not_shooted |
cmp byte [ed_buffer.1],0 |
je .no_file_name |
mov edi,sign_n_input |
call zstr_to_int |
mov [sign_n],al |
; £¥¥à¨à㥬 ¨¬ï ä ©« |
xor eax,eax |
mov ecx,1056 |
mov edi,file_name |
rep stosb ; § ¯®«ï¥¬ ã«ï¬¨ |
mov esi,ed_buffer.1 |
mov edi,file_name |
.next: |
mov ah,[esi] |
test ah,ah |
jz .str_end |
cmp ah,'*' |
jne .no_insert_number |
jmp .insert_number |
.no_insert_number: |
mov [edi],ah |
inc edi |
inc esi |
jmp .next |
.insert_number: |
bt word [ch6.flags],1 |
jnc @f |
mov eax,[cur_number] |
;mov ebx,4 |
movsx ebx,byte [sign_n] |
push ebx |
call int_to_str |
pop ebx |
add edi,ebx |
@@: |
inc esi |
jmp .next |
.str_end: |
; ¢ë¤¥«ï¥¬ ¯ ¬ïâì |
mov ecx,[scr_buf.end_ptr] |
mov [sf_buf.bmp_header],ecx |
add ecx,0x36 |
mov [sf_buf.bmp_area],ecx |
movsx ebx,word [scr_buf.width] |
movsx edx,word [scr_buf.height] |
imul ebx,edx |
lea ebx,[ebx*3] |
add ecx,ebx |
mov [sf_buf.end],ecx |
add ecx,4096 |
xor ebx,ebx |
inc ebx |
movr eax,64 |
int 0x40 |
; § ¯®«ï¥¬ áâàãªâãàã ¤«ï á®åà ¥¨ï ä ©« |
mov edi,fs_struc |
mov [edi],dword 2 |
mov eax,[sf_buf.bmp_header] |
mov ebx,[sf_buf.end] |
sub ebx,eax |
mov [edi+12],ebx |
mov [edi+16],eax |
mov [edi+21],dword file_name |
; § ¯®«ï¥¬ § £®«®¢®ª bmp |
mov edi,[sf_buf.bmp_header] |
mov [edi],word 'BM' |
mov ebx,[sf_buf.end] |
sub ebx,[sf_buf.bmp_area] |
mov [edi+34],ebx ; à §¬¥à ª à⨪¨ |
mov [edi+10],dword 0x36 ; à §¬¥à § £®«®¢ª |
add ebx,0x36 |
mov [edi+2],ebx ; à §¬¥à ä ©« |
mov [edi+14],dword 0x28 |
movsx eax,word [scr_buf.width] |
mov [edi+18],eax ; £®à¨§®â «ìë© à §¬¥à |
movsx eax,word [scr_buf.height] |
mov [edi+22],eax ; ¢¥à⨪«ìë© à §¬¥à |
mov [edi+26],word 1 |
mov [edi+28],word 24 |
; ª®¯¨à㥬 ¨ ¯¥à¥¢®à 稢 ¥¬ |
mov esi,[scr_buf.ptr] |
mov edi,[sf_buf.bmp_area] |
mov edx,[sf_buf.end] |
sub edx,edi |
movsx ecx,word [scr_buf.height] |
.next_str: |
push ecx |
movsx ecx,word [scr_buf.width] |
lea ecx,[ecx*3] |
mov ebx,ecx |
.next_byte: |
mov ah,[esi+ebx] |
mov [edi+edx],ah |
dec ebx |
dec edx |
loop .next_byte |
movsx ecx,word [scr_buf.width] |
lea ecx,[ecx*3] |
add esi,ecx |
pop ecx |
loop .next_str |
; á®åà 塞 |
draw_status saving |
mov eax,70 |
mov ebx,fs_struc |
int 0x40 |
test eax,eax |
jne save_error |
inc dword [cur_number] |
call draw_number |
draw_status saved_ok |
popa |
ret |
.no_file_name: |
draw_status no_file_name |
popa |
ret |
.not_shooted: |
draw_status not_shooted |
popa |
ret |
save_error: |
cmp al,5 |
jne @f |
mov [status.text],dword bad_file_name |
@@: |
cmp al,8 |
jne @f |
mov [status.text],dword disk_filled |
@@: |
cmp al,9 |
jne @f |
mov [status.text],dword bad_fat_table |
@@: |
cmp al,10 |
jne @f |
mov [status.text],dword ac_den |
@@: |
cmp al,11 |
jne @f |
mov [status.text],dword device_er |
@@: |
call send_draw_status |
popa |
ret |
/programs/media/scrshoot/scrshoot.asm |
---|
0,0 → 1,555 |
; ¢â®à ¯à®£à ¬¬ë ¢â¨å®¢ ªá¨¬ (Maxxxx32) |
; â ¯®á«¥¤¥£® ¨§¬¥¥¨ï: 20.07.06 18:05 |
macro draw_status text_ptr |
{ |
mov [status.text],dword text_ptr |
call send_draw_status |
} |
title equ 'Maxxxx32 Screenshooter v 0.78' ; £®«®¢®ª ®ª |
include 'lang.inc' |
include 'macros.inc' ; ¢áâ ¢«ï¥¬ ¬ ªà®áë |
meos_header cmdstr ; ¢áâ ¢«ï¥¬ § £®«®¢®ª ¯à®£à ¬¬ë |
include 'scrwin.inc' ; ¢áâ ¢«ï¥¬ ª®¤ ®ª ¯à¤¯à®á¬®âà |
include 'scrsavef.inc'; ¢áâ ¢«ï¥¬ ¯à®æ¥¤ãàã á®åà ¥¨ï ä ©« |
use_edit_box ; \ |
use_txt_button ; | |
use_label ; | |
use_gp ; |-- GUI ª®¬¯®¥âë ¨ ¥ª®â®àë¥ ¯à®æ¥¤ãàë |
use_check_box ; | |
use_text_work ; / |
;--- ç «® ¯à®£à ¬¬ë --- |
app_start |
; ãáâ ¢«¨¢ ¥¬ ipc ¡ãää¥à |
push 60 |
pop eax |
;mov ebx,1 |
xor ebx,ebx |
inc ebx |
mov ecx,app_ipc |
mov edx,32 |
int 0x40 |
push 66 ; ãáâ ¢«¨¢ ¥¬ £«®¡ «ìãî £®àïçãî ª« ¢¨èã |
pop eax |
push eax |
mov ebx,4 |
mov cl,55 ; 55 - PrintScrn |
xor edx,edx |
int 0x40 |
mov ebx,app |
call get_slot_n |
mov [slot_n],ecx |
; ãáâ ¢«¨¢ ¥¬ ¬ áªã ᮡë⨩ |
set_events_mask (evm_redraw+evm_key+evm_button+evm_mouse+evm_ipc) |
; áî¤ ¯àë£ ¥¬ ¯à¨ ª ¦¤®© ¯¥à¥à¨á®¢ª¥ |
red: |
get_procinfo app ; ¯®«ãç ¥¬ ¨ä®à¬ æ¨î ® ¯à®æ¥áᥠ|
get_sys_colors sc ; ¯®«ãç ¥¬ á¨áâ¥¬ë¥ æ¢¥â |
; ãáâ ¢«¨¢ ¥¬ á¨áâ¥¬ë¥ æ¢¥â ã GUI ª®¬¯®¥â®¢ |
txt_but_set_sys_color buttons,buttons_end,sc ; \ |
labels_set_sys_color labels,labels_end,sc ; | |
check_boxes_set_sys_color check_boxes,check_boxes_end,sc ; | |
edit_boxes_set_sys_color editboxes,editboxes_end,sc ; / |
get_screen_prop scr ; ¯®«ãç ¥¬ ¨ä®à¬ æ¨î ®¡ íªà ¥ |
call draw_window ; ¯¥à¥à¨á®¢ë¢ ¥¬ ®ª® |
still: |
wait_event red,key,button,mouse,ipc,still ; ¦¤¥¬ ᮡë⨩ |
key: |
get_key |
cmp al,2 |
jne @f |
cmp ah,55 |
jne @f |
call shoot |
jmp still |
@@: |
key_edit_boxes editboxes,editboxes_end |
jmp still |
button: |
get_pressed_button |
cmp ah,1 |
je p_close |
txt_but_ev buttons,buttons_end |
jmp still |
mouse: |
get_active_window |
cmp eax,[slot_n] |
jne still |
mouse_check_boxes check_boxes,check_boxes_end |
mouse_edit_boxes editboxes,editboxes_end |
jmp still |
ipc: |
cmp word [app_ipc+8],2 |
jne @f |
min_window |
jmp .clear_ipc |
@@: |
call draw_number |
call dr_st |
.clear_ipc: |
cld |
xor eax,eax |
movr ecx,32 |
mov edi,app_ipc |
rep stosb |
jmp still |
p_close: |
btr dword [flags],1 |
close: |
app_close |
;-------------------------------------------------------------------- |
;--- ¯à®®æ¥¤ãà ¯¥à¥à¨á®¢ª¨ £« ¢®£® ®ª --------------------------- |
;-------------------------------------------------------------------- |
draw_window: |
start_draw_window ; ç «® ¯¥à¥à¨á®¢ª¨ |
xor eax,eax ; ®¯à¥¤¥«ï¥¬ ®ª® |
mov ebx,100*65536+320 |
mov ecx,100*65536+240 |
mov edx,[sc.work] |
add edx,0x03000000 |
xor esi,esi |
xor edi,edi |
int 0x40 |
get_scin_height ; ¯®«ãç ¥¬ ¢ëá®âã § £®«®¢ª ®ª ¨ à áç¨âë¢ ¥¬ |
sub ax,4 ; ¯®«®¦¥¨¥ ⥪áâ § £®«®¢ª |
shr ax,1 |
mov bx,10 |
shl ebx,16 |
mov bx,ax |
mov eax,4 ; à¨á㥬 ⥪áâ § £®®«®¢ª |
mov ecx,[sc.grab_text] |
bts ecx,28 |
mov edx,grab_text |
mov esi,grab_text_end-grab_text |
int 0x40 |
movr eax,47 ; ¢ë¢®¤¨¬ ç¨á« ¢ ®ª® |
mov bx,4 |
shl ebx,16 |
movsx ecx,word [scr.width] ; è¨à¨ íªà |
mov dx,95 |
shl edx,16 |
mov dx,[label1.top] |
push dx |
mov esi,[sc.work_text] |
int 0x40 |
movsx ecx,word [scr.height] ; ¢ëá®â íªà |
mov dx,[label2.top] |
int 0x40 |
mov bx,2 |
shl ebx,16 |
movsx ecx,word [scr.bitspp] ; ¡¨â ¯¨ªá¥«ì |
mov dx,240 |
shl edx,16 |
pop dx |
int 0x40 |
mov bx,6 |
shl ebx,16 |
mov ecx,[scr.bytesps] ; ¡ ©â áâபã |
mov dx,[label2.top] |
int 0x40 |
call draw_number ; ¯à®à¨á®¢ë¢ ¥¬ ®¬¥à ᨬª |
call dr_st |
draw_labels labels,labels_end ; ¬¥âª¨ |
draw_edit_boxes editboxes,editboxes_end ; edit_box |
draw_txt_buttons buttons,buttons_end ; ª®¯ª¨ |
draw_check_boxes check_boxes,check_boxes_end ; ä« ¦ª¨ |
stop_draw_window ; ª®¥æ ¯¥à¥à¨á®¢ª¨ |
ret |
shoot: |
bt dword [ch4.flags],1 ; ¢ª«îç¥ «¨ § ¤¥à¦ª ? |
jnc @f |
draw_status delay_now |
mov edi,ed_buffer.2 |
call zstr_to_int |
mov ebx,eax |
delay |
@@: |
call get_mem_for_shoot; ¯®«ãç ¥¬ ¯ ¬ïâì ¤«ï ᨬª |
bts dword [flags],0 ; ã«¥¢®© ä« £ - ᨬ®ª ¥áâì ¢ ¯ ¬ï⨠|
; ¤¥« ¥¬ ᨬ®ª |
draw_status shooting |
mov esi,scr |
mov edi,[scr_buf.ptr] |
call copy_screen_to_image |
push dword [scr] |
pop dword [scr_buf.size] |
bt dword [ch5.flags],1 ; ¢ª«î祮 «¨ ¢â®á®åà ¥¨¥ ? |
jnc @f |
call save_file |
@@: |
draw_status shooted_ok |
bt dword [flags],1 |
jnc @f |
ret |
@@: |
bt dword [ch2.flags],1 ; ¯®ª § âì ®ª® ¯à¥¤¯à®á¬®âà ? |
jnc @f |
call show_scr_window |
@@: |
bt word [ch3.flags],1 ; ¢®ááâ ®¢¨âì ®ª® ? |
jnc @f |
delay 100 |
mov ecx,[slot_n] |
activ_window |
@@: |
ret |
get_mem_for_shoot: |
mov [scr_buf.ptr],dword __app_end |
movsx ecx, word [scr.width] |
movsx ebx, word [scr.height] |
imul ecx,ebx |
lea ecx,[ecx*3] |
add ecx,__app_end |
mov [scr_buf.end_ptr],ecx |
xor ebx,ebx |
inc ebx |
mov eax,64 |
int 0x40 |
ret |
;--- ᮤ âì ®ª® ¯à®¥¤¯à®á¬®âà --- |
show_scr_window: |
pusha |
bt dword [flags],0 |
jnc @f |
mov eax,51 |
xor ebx,ebx |
inc ebx |
movr ecx,scr_window |
mov edx,__app_end-1000 |
int 0x40 |
@@: |
popa |
ret |
;--- ¯à®ç¨â âì ¨ à¨á®¢ âì ⥪ã騩 ®¬¥à --- |
apply_number: |
mov edi,ed_buffer.3 |
call zstr_to_int |
mov [cur_number],eax |
call draw_number |
ret |
;--- ¯à®æ¥¤ãà ¯à®à¨á®¢ª¨ ⥪ã饣® ®¬¥à --- |
draw_number: |
mov edi,sign_n_input |
call zstr_to_int |
mov [sign_n],al |
movr eax,13 |
mov ebx,140*65536+96 |
mov cx,[label9.top] |
shl ecx,16 |
mov cx,10 |
mov edx,[sc.work] |
int 0x40 |
movr eax,47 |
movsx bx,byte [sign_n] |
shl ebx,16 |
mov ecx,[cur_number] |
mov dx,140 |
shl edx,16 |
mov dx,[label9.top] |
mov esi,[sc.work_text] |
int 0x40 |
ret |
;--- ¯à®æ¥¤ãà , § ¯ã᪠îé ï ¯®â®ª ¢â®áꥬª¨ --- |
start_autoshoot: |
bts dword [flags],1 |
jc @f |
movr eax,51 |
;mov ebx,1 |
xor ebx,ebx |
inc ebx |
mov ecx,autoshoot |
mov edx,__app_end-512 |
int 0x40 |
@@: |
ret |
;--- ®áâ ¢«¨¢ ¥â íâ®â ¯®â®ª --- |
stop_autoshoot: |
btr dword [flags],1 |
ret |
;--- 横« ¯®â®ª ¢â®áꥬª¨ --- |
autoshoot: |
mov ecx,[slot_n] |
activ_window |
.next: |
bt dword [flags],1 |
jnc close |
movr eax,60 |
movr ebx,2 |
mov ecx,[app.pid] |
mov edx,messages.draw_number |
mov esi,2 |
int 0x40 |
call shoot |
jmp autoshoot.next |
;--- ¯à®æ¥¤ãà ¯à®à¨á®¢ª¨ áâப¨ á®áâ®ï¨ï --- |
; (¤®«¦ ¢ë§ë¢ âìáï ¯®â®ª®¬ £« ¢®£® ®ª ) |
dr_st: |
movr eax,38 ; ®â१®ª |
mov ebx,5*65536+315 |
mov ecx,222*65536+222 |
mov edx,[sc.work_graph] |
int 0x40 |
movr eax,13 ; ¯®«®áª |
mov bx,310 |
mov ecx,223*65536+12 |
mov edx,[sc.work] |
int 0x40 |
mov edi,status |
call draw_label |
ret |
;--- ¯à®æ¥¤ãà ¯®«ãç¥¨ï ®¬¥à ᫮⠯®â®ª --- |
; ¢å®¤ ebx - ¡ãää¥à 1024 ¡ ©â |
; ¢ë室 ecx - ®¬¥à á«®â |
get_slot_n: |
movr eax,9 |
xor ecx,ecx |
dec ecx |
int 0x40 |
mov edx,[app.pid] |
xor ecx,ecx |
@@: |
movr eax,9 |
inc ecx |
int 0x40 |
cmp [app.pid],edx |
je @f |
jmp @b |
@@: |
ret |
one_shoot: |
mov ecx,one_shoot_thread |
mov edx,shoot_esp |
jmp @f |
save_shoot: |
mov ecx,save_shoot_thread |
mov edx,shoot_esp |
@@: |
bts dword [flags],2 |
jc .running |
bt dword [flags],1 |
jc .running |
movr eax,51 |
;mov ebx,1 |
xor ebx,ebx |
inc ebx |
int 0x40 |
.running: |
ret |
one_shoot_thread: |
mov ecx,[slot_n] |
activ_window |
bt dword [ch1.flags],1 ; ¬¨¨¬¨§¨à®¢ âì ®ª® ? |
jnc @f |
movr eax,60 |
movr ebx,2 |
mov ecx,[app.pid] |
mov edx,messages.min_window |
mov esi,2 |
int 0x40 |
@@: |
call shoot |
btr dword [flags],2 |
jmp close |
send_draw_status: |
movr eax,60 |
movr ebx,2 |
mov ecx,[app.pid] |
mov edx,messages.draw_status |
mov esi,2 |
int 0x40 |
ret |
save_shoot_thread: |
mov ecx,[slot_n] |
activ_window |
call save_file |
btr dword [flags],2 |
jmp close |
;==================================================================== |
;=== ¤ ë¥ ¯à®£à ¬¬ë =============================================== |
;==================================================================== |
messages: |
.draw_number dw 0 |
.draw_status dw 1 |
.min_window dw 2 |
grab_text: |
db title |
grab_text_end: |
labels: |
label1 label 10,30,0,text.1 ; ¢ëá®â íªà |
label2 label 10,40,0,text.2 ; è¨à¨ íªà |
label3 label 10,50,0,text.3 ; ¢¢¥¤¨â¥ ¨¬ï ä ©« |
label4 label 150,30,0,text.4 ; ¡¨â ¯¨ªá¥«ì |
label5 label 150,40,0,text.5 ; ¡ ©â áâபã |
label6 label 120,163,0,text.6 |
;label7 label 10,190,0,text.7 |
;label8 label 10,225,0,text.8 |
label9 label 10,78,0,text.9 ; ⥪ã騩 |
label10 label 10,210,0,text.10 |
status label 10,226,0,no_shoot |
labels_end: |
editboxes: |
edit1 edit_box 300,10,60,cl_white,0,0,0,1024,ed_buffer.1,ed_focus |
edit2 edit_box 35,80,159,cl_white,0,0,0,9,ed_buffer.2,ed_figure_only |
edit3 edit_box 35,170,189,cl_white,0,0,0,9,ed_buffer.3,ed_figure_only |
edit4 edit_box 16,170,206,cl_white,0,0,0,1,sign_n_input,ed_figure_only,1 |
editboxes_end: |
buttons: |
but1 txt_button 150,10,15,90,2,0,0,but_text.1,one_shoot |
but2 txt_button 145,165,15,90,3,0,0,but_text.2,save_shoot |
but3 txt_button 140,120,12,145,4,0,0,but_text.3,show_scr_window |
but4 txt_button 80,210,15,188,5,0,0,but_text.4,apply_number |
but5 txt_button 150,10,15,110,6,0,0,but_text.5,start_autoshoot |
but6 txt_button 145,165,15,110,7,0,0,but_text.6,stop_autoshoot |
buttons_end: |
check_boxes: |
ch1 check_box 10,130,cl_white,0,0,ch_text.1,(ch_text.2-ch_text.1) |
ch2 check_box 10,145,cl_white,0,0,ch_text.2,(ch_text.3-ch_text.2) |
ch3 check_box 150,130,cl_white,0,0,ch_text.3,(ch_text.4-ch_text.3) |
ch4 check_box 10,160,cl_white,0,0,ch_text.4,(ch_text.5-ch_text.4) |
ch5 check_box 10,175,cl_white,0,0,ch_text.5,(ch_text.6-ch_text.5) |
ch6 check_box 10,190,cl_white,0,0,ch_text.6,(ch_text.7-ch_text.6) |
; ¢â®ã¬¥à æ¨ï |
check_boxes_end: |
if lang eq ru |
text: |
.2: db 'ëá®â íªà :',0 |
.1: db '¨à¨ íªà :',0 |
.3: db '¢¥¤¨â¥ ¯®«ë© ¯ãâì ª ä ©«ã:',0 |
.4: db '¨â ¯¨ªá¥«ì:',0 |
.5: db ' ©â áâபã:',0 |
.6: db '100 = 1 ᥪ㤠',0 |
;.7: db '¢¥¤¨â¥ ¨¬ï ä ©« :',0 |
;.8: db '¬¥áâ® "*" ¢ ¨¬¥¨ ä ©« ¡ã¤¥â ¢áâ ¢«ïâìáï ®¬¥à.',0 |
.9: db '¥ªã騩 ®¬¥à ᨬª :',0 |
.10: db '®«¨ç¥á⢮ § ª®¢ ¢ ®¬¥à¥:',0 |
but_text: |
.1: db '¤¥« âì ᨬ®ª íªà ',0 |
.2: db '®åà ¨âì ᨬ®ª íªà ',0 |
.3: db '®ª § âì ᨬ®ª ᥩç á',0 |
.4: db 'ਬ¥¨âì',0 |
.5: db ' ç âì ¢â®áꥬªã',0 |
.6: db 'áâ ®¢¨âì ¢â®áꥬªã',0 |
ch_text: |
.1 db '¢¥àãâì ®ª®';,0 |
.2 db '®ª § âì ᨬ®ª';,0 |
.3 db '§ ⥬ ᤥ« âì ªâ¨¢ë¬';,0 |
.4: db ' ¤¥à¦ª :';,0 |
.5: db '¢â®á®åà ¥¨¥';,0 |
.6: db '¢â®ã¬¥à æ¨ï, ç¨ ï á';,0 |
.7: |
no_shoot db '¨¬®ª ¥ ᤥ« ',0 |
shooting db '®â®£à ä¨à®¢ ¨¥...',0 |
shooted_ok db '¨¬®ª ᤥ« ',0 |
saving db '®åà ¥¨¥...',0 |
saved_ok db '¨¬®ª á®åà ¥',0 |
delay_now db ' ¤¥à¦ª ...',0 |
bad_file_name db '¬ï ä ©« ¢¢¥¤¥® ¥¢¥à®',0 |
disk_filled db '¨áª § ¯®«¥',0 |
bad_fat_table db ' ¡«¨æ FAT à §àãè¥ ',0 |
ac_den db '®áâ㯠§ ¯à¥é¥',0 |
device_er db '訡ª ãáâனá⢠',0 |
not_shooted db '¤¥« ©â¥ ᨬ®ª !!!',0 |
no_file_name db '¢¥¤¨â¥ ¨¬ï ä ©« !!!',0 |
end if |
sign_n_input: |
db '2',0 |
app_ipc ipc_buffer 32 |
cur_number dd ? |
sign_n db ? |
slot_n dd ? |
flags dd ? |
scr_buf: |
.ptr dd ? |
.end_ptr dd ? |
.size: |
.height dw ? |
.width dw ? |
fs_struc: |
.funk_n dd ? |
dd ? |
dd ? |
.bytes_to_write dd ? |
.data_ptr dd ?,? |
.fn_ptr dd ? |
sf_buf: |
.bmp_header dd ? |
.bmp_area dd ? |
.end dd ? |
cmdstr rb 257 |
ed_buffer: |
.1: rb 1025 |
.2: rb 10 |
.3: rb 10 |
file_name: |
rb 1058 |
scr screen_prop |
sc sys_color_table |
app procinfo |
shoot_esp rb 512 |
app_end ; ª®¥æ ¯à®£à ¬¬ë |
/programs/media/scrshoot/scrshoot.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/programs/media/scrshoot/scrwin.inc |
---|
0,0 → 1,38 |
scr_window: |
.start: |
.red: |
call .draw_window |
.still: |
wait_event .red,close |
jmp .still |
.draw_window: |
start_draw_window |
xor eax,eax |
movsx ebx,word [scr.width] |
movsx ecx,word [scr.height] |
;xor edx,edx |
mov edx,0x01000000 |
xor esi,esi |
xor edi,edi |
int 0x40 |
movr eax,7 |
mov ebx,[scr_buf.ptr] |
mov ecx,[scr_buf.size] |
xor edx,edx |
int 0x40 |
movr eax,13 |
mov ebx,19*65536+231 |
mov ecx,19*65536+10 |
mov edx,0x00FF00 |
int 0x40 |
mov edi,.label |
call draw_label |
stop_draw_window |
ret |
.label label 20,20,0x80000000,$+4 |
db 'â® ¢ è ᨬ®ª. ë室 - «î¡ ï ª« ¢¨è .',0 |
/programs/media/scrshoot/textwork.inc |
---|
0,0 → 1,41 |
macro use_text_work |
{ |
;edi - 㪠§ ⥫ì áâபã, ®£à ¨ç¥ãî ã«¥¬ |
;ç¨á«® ¢®§¢à é ¥âáï ¢ eax |
zstr_to_int: |
xor eax,eax |
mov ecx,10 |
.next: |
movsx ebx,byte [edi] |
inc edi |
test ebx,ebx |
jz .end_str |
cmp bl,'9' |
jg .no_figure |
cmp bl,'0' |
jl .no_figure |
sub ebx,'0' |
mul ecx |
add eax,ebx |
.no_figure: |
jmp .next |
.end_str: |
ret |
;edi - 㪠§ ⥫ì áâபã |
;eax - ç¨á«® |
;ebx - ª®«¨ç¥á¢® § ª®¢ |
int_to_str: |
mov ecx,10 |
.next: |
test ebx,ebx |
jz .end |
xor edx,edx |
div ecx |
add dl,'0' |
dec ebx |
mov [edi+ebx],dl |
jmp .next |
.end: |
ret |
} |
/programs/media/scrshoot/txtbut.inc |
---|
0,0 → 1,106 |
;-------------------------------------------------------------------- |
;--- à¨á®¢ ¨¥ ª®¯ª¨ á ⥪á⮬ ¢ á¥à¥¤¨¥ -------------------------- |
;-------------------------------------------------------------------- |
macro use_txt_button |
{ |
txt_button: |
.draw: |
pusha |
;--- ¯à®à¨á®¢ª á ¬®© ª®¯ª¨ --- |
mov eax,8 |
mov ebx,[edi] ; [but.width] |
mov ecx,[edi+4] ;[but.height] |
mov edx,[edi+8];[but.id] |
mov esi,[edi+12];[but.color] |
int 0x40 |
;--- ⥪áâ ¥© --- |
; áç¨â ¥¬ ª®«¨ç¥á⢮ ᨬ¢®«®¢ |
mov edx,[edi+20] |
xor esi,esi |
.check_next_symbol: |
cmp [edx+esi],byte 0 |
je .str_end |
inc esi ; ¢ esi ¤«¨ áâப¨ ¢ ᨬ¢®« å |
jmp .check_next_symbol |
.str_end: |
; ¢ëç¨á«ï¥¬ ª®®à¤¨ âë |
lea ebx,[esi*2+esi] |
lea ebx,[ebx*2] ; ¢ ebx ¤«¨ áâப¨ ¢ ¯¨ªá¥«ïå |
;not ebx |
neg ebx |
add bx,[edi] ; [but.width] |
sar bx,1 |
inc bx |
add bx,[edi+2];[but.left] ; ¢ bx ¯®§¨æ¨ï á«¥¢ |
shl ebx,16 |
mov bx,[edi+4];[but.height] |
sub bx,8 |
sar bx,1 |
add bx,[edi+6];[but.top] ; ¢ bx ¯®§¨æ¨ï ᢥàåã |
; à¨á㥬 áâபã ⥪áâ |
mov ecx,[edi+16] ;[but.text_color] |
shr eax,1 |
int 0x40 |
popa |
ret |
} |
struc txt_button width,left,height,top,id,color,text_color,text_ptr,\ |
proc_addres |
{ |
.width dw width ;+0 |
.left dw left ;+2 |
.height dw height ;+4 |
.top dw top ;+6 |
.id dd id ;+8 |
.color dd color ;+12 |
.text_color dd text_color ;+16 |
.text_ptr dd text_ptr ;+20 |
.proc_addres dd proc_addres+0 ;+24 |
} |
but_struc_size=24+4 |
macro draw_txt_buttons start,end |
{ |
mov edi,start |
mov ecx,((end-start)/but_struc_size) |
@@: |
call txt_button.draw |
add edi,but_struc_size |
loop @b |
} |
macro txt_but_set_sys_color start,end,color_table |
{ |
mov edi,start |
mov esi,color_table |
mov ecx,((end-start)/but_struc_size) |
@@: |
push dword [esi+24] |
pop dword [edi+12] |
push dword [esi+28] |
pop dword [edi+16] |
add edi,but_struc_size |
loop @b |
} |
macro txt_but_ev start,end |
{ |
mov edi,start |
mov ecx,((end-start)/but_struc_size) |
.txt_but_next: |
cmp ah,[edi+8] |
jne @f |
cmp dword [edi+24],0 |
je @f |
pusha |
call dword [edi+24] |
popa |
@@: |
add edi,but_struc_size |
loop .txt_but_next |
} |
/programs/network/stackinf/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/stackinf/trunk/stackinf.asm |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/stackinf/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/stackinf/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/md5/trunk/md5.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/md5/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/md5/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/rtdata/trunk/rtdata.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/rtdata/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/rtdata/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/network/rtdata/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/network/stackcfg/trunk/stackcfg.asm |
---|
715,11 → 715,15 |
header db 'STACK CONFIGURATION',0 |
;ENTER YOUR SETTINGS HERE: |
ip_address db 010,005,004,175 |
gateway_ip db 010,005,000,001 |
subnet_mask db 255,255,000,000 |
dns_ip db 213,184,238,006 |
com_irq dd 0 ; irq for slip/ppp |
com_add dd 0 ; com port address for slip/ppp |
interface dd 3 ; not active,slip,ppp,packet driver |
/programs/other/tinypad2/trunk/archive.txt |
---|
File deleted |
\ No newline at end of file |
/programs/other/tinypad2/trunk/scroll.inc |
---|
File deleted |
/programs/other/tinypad2/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/other/tinypad2/trunk/tinypad2.asm |
---|
File deleted |
/programs/other/tinypad2/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/other/tinypad2/trunk/ascl.inc |
---|
File deleted |
/programs/other/tinypad2/trunk/dialogs1.inc |
---|
File deleted |
/programs/other/tinypad2/trunk/ReadMe.txt |
---|
File deleted |
\ No newline at end of file |
/programs/other/tinypad2/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
/programs/other/archer/trunk/build_en.bat |
---|
1,4 → 1,5 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm @rcher.asm @rcher |
@erase lang.inc |
@pause |
/programs/other/archer/trunk/build_ru.bat |
---|
1,4 → 1,5 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm @rcher.asm @rcher |
@erase lang.inc |
@pause |
/programs/other/archer/trunk/macros.inc |
---|
218,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
/programs/other/calc/trunk/calc.asm |
---|
87,6 → 87,7 |
mov esi,18 |
call atof |
fst [trans2] |
cmp eax,33 |
jne no_sign |
cmp [dsign],byte '-' |
/programs/other/calc/trunk/macros.inc |
---|
143,10 → 143,6 |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
178,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
222,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
/programs/other/mhc/trunk/build_en.bat |
---|
1,4 → 1,5 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm mhc.asm mhc |
@erase lang.inc |
@pause |
/programs/other/mhc/trunk/build_ge.bat |
---|
1,4 → 1,5 |
@erase lang.inc |
@echo lang fix ge >lang.inc |
@fasm mhc.asm mhc |
@erase lang.inc |
@pause |
/programs/other/mhc/trunk/macros.inc |
---|
143,10 → 143,6 |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
178,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
222,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
/programs/other/rtfread/trunk/build_en.bat |
---|
1,4 → 1,5 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm rtfread.asm rtfread |
@erase lang.inc |
@pause |
/programs/other/rtfread/trunk/build_ru.bat |
---|
1,4 → 1,5 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm rtfread.asm rtfread |
@erase lang.inc |
@pause |
/programs/other/rtfread/trunk/macros.inc |
---|
143,11 → 143,6 |
; language for programs |
lang fix ru ; ru en fr ge fi |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
179,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
223,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
/programs/other/rtfread/trunk/rtfread.asm |
---|
19,7 → 19,7 |
;RENDER equ BGI |
RENDER equ FREE |
BGIFONT_PATH equ '/rd/1/' |
BGIFONT_PATH equ '/rd/1/fonts/' |
FONT_NAME equ 'LITT' |
TOP =35 |
MODE equ RTF |
/programs/system/pic4/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/system/pic4/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/system/pic4/trunk/pic4.asm |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/system/pic4/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/system/sysmeter/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/system/sysmeter/trunk/sysmeter.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/system/sysmeter/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/system/sysmeter/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/system/systrace/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/system/systrace/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/system/systrace/trunk/systrace.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/system/systrace/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/system/ir/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/system/ir/trunk/ir.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/system/ir/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/system/ir/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/system/cpuspeed/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/system/cpuspeed/trunk/cpuspeed.asm |
---|
File deleted |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/system/cpuspeed/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/system/cpuspeed/trunk/macros.inc |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:eol-style |
-native |
\ No newline at end of property |
/programs/system/board/trunk/board.asm |
---|
290,18 → 290,10 |
mov ebx,[xstart] |
mov ecx,MAXSTRINGS*10+45 ; [y start] *65536 + [y size] |
mov edx,[sc.work] ; color of work area RRGGBB,8->color gl |
or edx,0x03000000 |
or edx,0x13000000 |
mov edi,header ; WINDOW LABEL |
int 0x40 |
; WINDOW LABEL |
mov eax,4 ; function 4 : write text to window |
mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
mov ecx,[sc.grab_text] ; color of text RRGGBB |
or ecx,0x10000000 |
mov edx,header ; pointer to text beginning |
mov esi,header.len ; text length |
int 0x40 |
mov ecx,4 |
mov esi,[sc.work] |
mov ebx,316 shl 16+5*6 |
522,17 → 514,11 |
; 11,11 > 0,-1 |
; 5,11 > 0,-1 |
if lang eq ru |
header: |
db ' ' |
.len = $ - header |
header db ' ',0 |
else if lang eq en |
header: |
db 'GENERAL DEBUG & MESSAGE BOARD' |
.len = $ - header |
header db 'GENERAL DEBUG & MESSAGE BOARD',0 |
else |
header: |
db 'ALLGEMEINES DEBUG- & NACHRICHTENBOARD' |
.len = $ - header |
header db 'ALLGEMEINES DEBUG- & NACHRICHTENBOARD',0 |
end if |
krnl_cnt dd 0 |
vmode dd 0 |
/programs/system/board/trunk/build_en.bat |
---|
1,4 → 1,5 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm board.asm board |
@erase lang.inc |
@pause |
/programs/system/board/trunk/build_ge.bat |
---|
1,4 → 1,5 |
@erase lang.inc |
@echo lang fix ge >lang.inc |
@fasm board.asm board |
@erase lang.inc |
@pause |
/programs/system/board/trunk/build_ru.bat |
---|
1,4 → 1,5 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm board.asm board |
@erase lang.inc |
@pause |
/programs/system/board/trunk/debug.inc |
---|
0,0 → 1,131 |
macro debug_print str |
{ |
local ..string, ..label |
jmp ..label |
..string db str,0 |
..label: |
pushf |
pushad |
mov edx,..string |
call debug_outstr |
popad |
popf |
} |
dps fix debug_print |
macro debug_print_dec arg |
{ |
pushf |
pushad |
if ~arg eq eax |
mov eax,arg |
end if |
call debug_outdec |
popad |
popf |
} |
dpd fix debug_print_dec |
;--------------------------------- |
debug_outdec: ;(eax - num, edi-str) |
push 10 ;2 |
pop ecx ;1 |
push -'0' ;2 |
.l0: |
xor edx,edx ;2 |
div ecx ;2 |
push edx ;1 |
test eax,eax ;2 |
jnz .l0 ;2 |
.l1: |
pop eax ;1 |
add al,'0' ;2 |
call debug_outchar ; stosb |
jnz .l1 ;2 |
ret ;1 |
;--------------------------------- |
debug_outchar: ; al - char |
pushf |
pushad |
mov cl,al |
mov eax,63 |
mov ebx,1 |
int 0x40 |
popad |
popf |
ret |
debug_outstr: |
mov eax,63 |
mov ebx,1 |
@@: |
mov cl,[edx] |
test cl,cl |
jz @f |
int 40h |
inc edx |
jmp @b |
@@: |
ret |
macro newline |
{ |
dps <13,10> |
} |
macro print message |
{ |
dps message |
newline |
} |
macro pregs |
{ |
dps "EAX: " |
dpd eax |
dps " EBX: " |
dpd ebx |
newline |
dps "ECX: " |
dpd ecx |
dps " EDX: " |
dpd edx |
newline |
} |
macro debug_print_hex arg |
{ |
pushf |
pushad |
if ~arg eq eax |
mov eax, arg |
end if |
call debug_outhex |
popad |
popf |
} |
dph fix debug_print_hex |
debug_outhex: |
; eax - number |
mov edx, 8 |
.new_char: |
rol eax, 4 |
movzx ecx, al |
and cl, 0x0f |
mov cl, [__hexdigits + ecx] |
pushad |
mcall 63, 1 |
popad |
dec edx |
jnz .new_char |
ret |
__hexdigits: |
db '0123456789ABCDEF' |
/programs/system/board/trunk/macros.inc |
---|
143,10 → 143,6 |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
178,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
222,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
/programs/system/calendar/trunk/build_en.bat |
---|
1,4 → 1,5 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm calendar.asm calendar |
@erase lang.inc |
@pause |
/programs/system/calendar/trunk/build_ge.bat |
---|
1,4 → 1,5 |
@erase lang.inc |
@echo lang fix de >lang.inc |
@fasm calendar.asm calendar |
@erase lang.inc |
@pause |
/programs/system/calendar/trunk/build_ru.bat |
---|
1,4 → 1,5 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm calendar.asm calendar |
@erase lang.inc |
@pause |
/programs/system/calendar/trunk/macros.inc |
---|
143,9 → 143,6 |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
177,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
221,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
/programs/system/cpu/trunk/build_en.bat |
---|
1,4 → 1,5 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm cpu.asm cpu |
@erase lang.inc |
@pause |
/programs/system/cpu/trunk/build_ge.bat |
---|
1,4 → 1,5 |
@erase lang.inc |
@echo lang fix de >lang.inc |
@fasm cpu.asm cpu |
@erase lang.inc |
@pause |
/programs/system/cpu/trunk/cpu.asm |
---|
103,7 → 103,7 |
;buttons handlers |
pgdn: |
sub [list_start],display_processes |
cmp [list_start],0 |
; cmp [list_start],0 |
jge still_end |
mov [list_start],0 |
jmp still_end |
114,7 → 114,7 |
jmp still_end |
program_start: |
mov eax,58 |
mov eax,70 |
mov ebx,file_start |
int 0x40 |
jmp still_end |
495,7 → 495,7 |
mov ebx,22*65536+35 ; draw info text with function 4 |
xor ecx,ecx |
mov edx,text |
mov esi,79 |
mov esi,text_len |
mov eax,4 |
int 0x40 |
583,8 → 583,8 |
; DATA AREA |
list_start dd 0 |
file_start: dd 16 |
dd 0,0,0,run_process_buffer |
file_start: dd 7 |
dd 0,0,0,0 |
start_application: db '/RD/1/LAUNCHER',0 |
times 60 db 32 |
593,6 → 593,7 |
text: |
db ' NAME/TERMINATE PID CPU-USAGE % ' |
db 'MEMORY START/USAGE W-STACK W-SIZE' |
text_len = $-text |
tbts: db 'PREV PAGE NEXT PAGE REBOOT SYSTEM' |
tbte: |
607,6 → 608,7 |
text: |
db ' NAME/BEENDEN PID CPU-LAST % ' |
db 'SPEICHER START/NUTZUNG W-STACK W-SIZE' |
text_len = $-text |
tbts: db 'SEITE ZURUECK SEITE VOR REBOOT SYSTEM' |
tbte: |
630,7 → 632,5 |
curposy rd 1 |
index rd 1 |
tasklist rd display_processes |
run_process_buffer: |
process_info_buffer process_information |
rb 4096-($-run_process_buffer) ;rest of run_process_buffer |
U_END: |
/programs/system/cpu/trunk/macros.inc |
---|
141,6 → 141,8 |
int 0x40 |
} |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
172,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
216,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
/programs/system/desktop/trunk/desktop.asm |
---|
15,7 → 15,7 |
dd START ; start address |
dd I_END ; file size |
dd 28000h ; memory |
dd 10000h ; stack pointer (0x10000+ - work area for os) |
dd 28000h ; stack pointer (0x10000+ - work area for os) |
dd 0,0 ; parameters, reserved |
include 'lang.inc' |
108,12 → 108,12 |
key: ; key |
mov eax,2 ; just read it and ignore |
mov al,2 ; just read it and ignore |
int 0x40 |
jmp still |
button: ; button |
mov eax,17 ; get id |
mov al,17 ; get id |
int 0x40 |
cmp ah,11 ; read string |
205,7 → 205,7 |
cmp ah,1 ; terminate |
jnz noid1 |
mov eax,-1 |
or eax,-1 |
int 0x40 |
noid1: |
547,7 → 547,7 |
end virtual |
draw_skin: |
mcall 13,<area.x,area.width>,<area.y,area.height>,0x00FFFFFF |
mcall 13,<area.x,area.width>,<area.y+2,area.height-2>,0x00FFFFFF |
mov ebp,0x18000 |
mov edi,[ebp+SKIN_HEADER.params] |
/programs/system/docpack/trunk/macros.inc |
---|
143,11 → 143,6 |
; language for programs |
lang fix ru ; ru en fr ge fi |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
179,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
223,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
/programs/system/end/trunk/build_en.bat |
---|
1,4 → 1,5 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm end.asm end |
@erase lang.inc |
@pause |
/programs/system/end/trunk/build_ge.bat |
---|
1,4 → 1,5 |
@erase lang.inc |
@echo lang fix ge >lang.inc |
@fasm end.asm end |
@erase lang.inc |
@pause |
/programs/system/end/trunk/build_ru.bat |
---|
1,4 → 1,5 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm end.asm end |
@erase lang.inc |
@pause |
/programs/system/end/trunk/macros.inc |
---|
143,10 → 143,6 |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
178,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
222,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
/programs/system/gmon/abou_tab.inc |
---|
0,0 → 1,21 |
mov edx, msg_about |
mov ebx, 17 * 65536 + 265 |
call show_text |
jmp end_drow_tab |
msg_about mls \ ; äîëæíà áûòü õîòÿáû îäíà ñòðîêà |
' Ghost Monitor',\ |
'',\ |
' tool for testing and monitoring hardware',\ |
'',\ |
'Supported SuperIO : W83627HF,W83697HF',\ |
' W83627THF,W83627THF-A,W83627EHF-A,',\ |
' W83637THF,IT8705F,IT8712F,SiS950',\ |
'',\ |
'Tests based on R.J.Redelmeier CPUBurn',\ |
'',\ |
'Mailto : ghost.nsk@mail.ru',\ |
'',\ |
'',\ |
' *** Use at YOUR own RISK ***' |
/programs/system/gmon/build.bat |
---|
0,0 → 1,2 |
@fasm gmon.asm gmon |
@pause |
/programs/system/gmon/conf_tab.inc |
---|
0,0 → 1,49 |
; |
; |
; Âêëàäêà íàñòðîåê |
; |
; Âðåìÿ îáíîâëåíèÿ |
mov eax, 8 |
mov ebx, 200 * 65536 + 15 |
mov ecx, 260 * 65536 + 15 |
mov edx, 11 |
mov esi, tcol |
int 0x40 |
mov ebx, 217 * 65536 + 15 |
inc edx |
int 0x40 |
mov eax, 4 |
mov ebx, 17 * 65536 + 265 |
mov edx, msg_cf_utime |
mov ecx, 0x10000000 |
mov esi, 11 |
int 0x40 |
mov ebx, 205 * 65536 + 265 |
mov edx, msg_cf_pm |
xor ecx, ecx |
mov esi, 4 |
int 0x40 |
mov ecx, [update_time] |
call digit_len |
mov edx, 160 * 65536 + 265 |
xor esi, esi |
mov eax, 47 |
int 0x40 |
; Ðàññòàâëÿåì äâîåòî÷èÿ |
mov eax, 4 |
mov ebx, 152 * 65536 + 265 |
mov edx, dub_p |
mov esi, 1 |
mov ecx, 0x10000000 |
int 0x40 |
jmp end_drow_tab |
msg_cf_utime db 'Update time' ; 11 |
msg_cf_pm db '+ -' ; 4 |
/programs/system/gmon/config.inc |
---|
0,0 → 1,8 |
nl equ 0x0d, 0x0a |
; 0x00xx - Menuet 0.xx |
; 0x0400 - Kolibi 4 (íîâîå çàâåðøåíèå ïðîöåññà) |
; 0x0510 - MSR -> ìíîæèòåëü |
; 0x0530 - âñåãî/ñâîáîäíî ïàìÿòè |
; 0x0580 - íîâîå çàâåðøåíèå ïðîöåññà |
OS_version equ 0x0580 |
/programs/system/gmon/diag.inc |
---|
0,0 → 1,58 |
; struc DiagramData size,color |
; { |
; .color dd color |
; times size db 0 ;;change to value > 100 |
; } |
;------------------------------------------------------ |
d_show: |
; esi - pointer to struct |
; åñëè öâåò ôîíà, òî íå ðèñóåì |
cmp dword[esi], tcol |
jne @f |
ret |
@@: pusha |
mov edx, [esi] |
add esi, 4 |
mov edi, esi |
add edi, 285 |
mov ebx, 12 * 65536 + 13 |
xor eax, eax |
lodsb |
mov cx, 220 |
sub ecx, eax |
@@: shl ecx, 16 |
mov cx, 220 |
lodsb |
sub ecx, eax |
mov eax, 38 |
int 0x40 |
add ebx, 0x10001 |
cmp esi, edi |
jle @b |
popa |
ret |
;------------------------------------------------------ |
d_add: |
; esi - pointer to struct |
; al - value |
pusha |
cmp byte [diag_add_v], 0 ; äîáàâëÿåì òîëüêî ïî òàéìåðó |
je d_add_end |
cld |
mov ecx, 285 |
add esi, 4 |
mov edi, esi |
inc esi |
rep movsb |
cmp al, 100 |
jbe @f |
mov al, 100 |
@@: mov [edi], al |
d_add_end: |
popa |
ret |
/programs/system/gmon/gmon.asm |
---|
0,0 → 1,583 |
; |
; Ghost Monitor - óòèëèòà (ñòðåññ) òåñòèðîâàíèÿ è ìîíèòîðèíãà ñèñòåìû |
; ÂÎÇÌÎÆÍÀ ÏÎÐ×À ÎÁÎÐÓÄÎÂÀÍÈß! |
; ÈÑÏÎËÜÇÓÉÒÅ ÍÀ ÑÂÎÉ ÑÒÐÀÕ È ÐÈÑÊ! |
; |
; Çàìåòêè : |
; Äîïèñàòü çàïóñê òåñòîâ (rtst) (íåò ðåàêöèè íà îøèáêó çàïóñêà) |
; Ïåðåäåëàòü îáíîâëåíèå ãðàôèêà (ñäåëàòü îòäåëüíûì ïðîöåññîì) |
; Äîáàâèòü ðåàêöèþ íà ïàðàìåòðû äàò÷èêîâ |
; |
; Èñòîðèÿ : |
; 09/2005 - íà÷àëî |
; 04/10/2005 - îòêîììåíòèðîâàë êîä |
; 09/11/2005 - äîïèñàíû òåñòû (ïîêà íåò òåñòà ïàìÿòè) |
; 30/01/2006 - äîáàâëåííû ãðàôèêè |
; 02/02/2006 - Äîáàâëåíà íàñòðîéêà âðåìåíè îáíîâëåíèÿ |
; 10/02/2006 - äîáàâëåííà åùå èíôîðìàöèÿ ñ äàò÷èêîâ, îïò. wb_get_chip_name |
; 01/03/2006 - äîáàâëåííà åùå èíôîðìàöèÿ ñ äàò÷èêîâ |
; 16/03/2006 - îïòèìèçèðîâàíà ïî ðàçìåðó |
; 17/03/2006 - ïîäñâåòêà èçìåí¸ííûõ ïàðàìåòðîâ, îïòèìèçàöèÿ, about |
; 20/03/2006 - Ïóáëèêàöèÿ |
; --- v 0.2 --- |
; 24/03/2006 - Äîáàâëåííà ïîääåðæêà IT8705F, IT8712F è SIS950 |
; 25/03/2006 - Âûâîä òð¸õ òåìïåðàòóð è òð¸õ âåíòèëåé |
; 28/03/2006 - Ãðàôèê temp3 è èçìåíåíèå öâåòà ãðàôèêîâ, îáðàáîòêà îòðèöàòåëüíûõ çíà÷åíèé ãðàôèêà |
; 30/03/2006 - Îïòèìèçàöèÿ ïî ðàçìåðó âåðñèè îò 28/03/2006, ïåðåïèñàë ðèñîâàíèå ãðàôèêà |
; 14/04/2006 - Èñïðàâèë ãðàôèê (jle -> jbe), äîáàâèë mem usage, âû÷èñëåíèå äëèííû ÷èñåë, çàêðûòèå ïî Esc |
; 19/04/2006 - Î÷èñòêà íåèíèöèàëèçèðîâàííûõ äàííûõ |
; --- v 0.3 --- |
; 01/07/2006 - Ðàçëè÷èå ITE 8705F, ITE 8712F è IT8716F |
; 04/07/2006 - Äîáàâëåííû íàïðóãè äëÿ ÷èïîâ Winbond |
; 10/07/2006 - äîáàâëåííû íàïðóãè äëÿ ÷èïîâ ITE, ìíîæèòåëè äëÿ AMD K6, Intel P6, P7, îïòèìèçàöèÿ ïî ðàçìåðó |
; 11/07/2006 - Ðåàêöèÿ íà èçìåíåíèå íàïðóãè, îïòèìèçàöèÿ ïî ðàçìåðó |
; 12/07/2006 - it87_get_fan_speed bug fix, çàâåðøåíèå òåñòà ïî 18/18 |
; 13/07/2006 - it87_get_fan_speed bug fix, èñïðàâëåí âûâîä ÷èñåë ñ ïëàâàþùåé òî÷êîé |
; 14/07/2006 - èñïðàâëåííû ïîêàçàíèÿ -12V äëÿ Winbond, îñòàëàñü ïðîáëåíìà ñ -5V |
; 17/07/2006 - èñïðàâëåííà îøèáêà îïðåäåëåíèÿ ìíîæèòåëÿ äëÿ P6, äîáàâëåííû ìíîæèòåëè |
; 18/07/2006 - Óëè÷øèë âûâîä ìíîæèòåëÿ, èñïðàâëåííû ìíîæèòåëè äëÿ P6 Tualatin, config.inc |
; 22/07/2006 - P6 multiplier bugfix |
; 30/07/2006 - P6 multiplier bugfix |
; |
; Ýé! Ó ìåíÿ íåò ìíîãî âðåìåíè. |
; Âíåøíèå ôàéëû : |
; hwm*.inc - ïðîöåäóðû ðàáîòû ñ äàò÷èêàìè ìîíèòîðèíãà |
; system.inc - âû÷èñëåíèå çàãðóçêè ïðîöåññîðà, çàâåðøåíèå òåñòà, etc... |
; tests.inc - òåñòû ;-) |
; diag.inc - ïîääåðæêà äèàãðàì |
; *_tab.inc - ïðîöåäóðû îòðèñîâêè ñîîòâåòñòâóþøèõ âêëàäîê |
; Èäåíòèôèêàòîðû êíîïîê : |
; 01 - Exit |
; 02 - Info tab |
; 03 - Tests tab |
; 04 - Config tab |
; 05 - About tab |
; 06 - P5 test |
; 07 - P6 test |
; 08 - K6 test |
; 09 - K7 test |
; 10 - MMX test - not used |
; 11 - Update time increment |
; 12 - Update time decriment |
; 13..17 - Èçìåíåíèå öâåòà CPU_load, Mem_usage, Temp1, Temp2, Temp3 |
include 'config.inc' |
include 'macros.inc' |
tcol equ 0x5080d0 |
atcol equ 0x4070c0 |
val_mod equ 0x3090 |
MEOS_APP_START |
include "tests.inc" ; <-- Ìíîãî âûðàâíèâàíèé, ëó÷øå çäåñü |
CODE |
;--- Init ------------------------------------------------------------ |
; Î÷èùàåì íåèíèöèàëèçèðîâàííûå äàííûå |
mov ecx, __memory - __udata |
mov edi, __udata |
xor eax, eax |
rep stosb |
xor eax, eax |
cpuid ; Óçíà¸ì ïðîèçâîäèòåëÿ ïðîöà |
mov [Vendor + 0], ebx |
mov [Vendor + 4], edx |
mov [Vendor + 8], ecx |
mov eax, 1 |
cpuid ; Åñòü ëè MMX ? |
mov ecx, eax |
shr al, 4 |
and ax, 0x0F0F |
mov [CPU_fam], ah |
mov [CPU_mod], al |
shr edx, 23 |
and dl, 1 |
mov [CPU_mmx], dl |
shr ecx, 12 |
and cl, 11b |
mov [CPU_type], cl |
; ! Öâåòà èç ìàññèâà colors |
mov dword[d_cpu_load], 0xFF00 ; èíèöèàëèçèðóåì ãðàôèê çàãðóçêè ÀËÓ |
mov dword[d_mem_usage], 0x8BA169 ; -- mem usega |
mov dword[d_temp1], 0xFF0000 ; -- ãðàôèê òåìïåðàòóðû ÖÏÓ |
mov dword[d_temp2], 0xFF ; -- ãðàôèê òåìïåðàòóðû ÌÏ |
mov dword[d_temp3], 0xFF7E23 |
call hwm_init ; Èíèöèàëèçèðóåì ÷èï ìîíèòîðèíãà |
jmp draw_window |
;--- Wait & translate event ------------------------------------------ |
wait_for_event: |
mov byte[diag_add_v], 0 ; äîáàâëÿåì äàííûå ê ãðàôèêó òîëüêî ïî òàéìåðó |
mov ebx, [update_time] |
mov eax, 23 |
int 0x40 |
test eax, eax |
jnz @f |
inc byte [diag_add_v] |
inc eax ; ïåðåðèñóåì îêíî (eax := 1) |
@@: dec eax ; redraw request ? |
jz draw_window |
dec eax ; key in buffer ? |
jz key |
dec eax ; button in buffer ? |
jz button |
jmp wait_for_event |
;--- Key pressed ----------------------------------------------------- |
key: |
mov eax, 2 |
int 0x40 |
cmp ah, 27 ; Esc - çàâåðøåíèå ðàáîòû |
je exit |
jmp wait_for_event |
;--- Button down ----------------------------------------------------- |
button: |
mov eax, 17 ; get id |
int 0x40 |
cmp ah, 1 ; button id == 1 ? |
jne noexit |
exit: cmp byte[test_id], 0 |
je @f |
call stop_test |
@@: mov eax, -1 ; close this program |
int 0x40 |
noexit: |
; êíîïêè âêëàäîê (2 .. 5) |
cmp ah, 5 |
jg no_tabs |
mov byte[act_tab], ah |
jmp draw_window |
no_tabs: |
; êíîïêè çàïóñêà òåñòâî (6 .. 10) |
cmp ah, 10 |
jg no_test_bt |
; åñëè íåò çàïóùåíûõ òåñòîâ - çàïóñêàåì âûáðàííûé |
cmp byte[test_id], 0 |
je run_test |
; åñëè êíîïêà àêòèâíîãî òåñòà - îñòàíàâëèâàåì òåñò, èíà÷å íè÷åãî íå äåëàåì |
cmp [test_id], ah |
jne wait_for_event |
call stop_test |
jmp draw_window |
tsts: dd p5, p6, k6, k7 |
run_test: |
push eax |
movzx ecx, ah |
mov ecx, [tsts + (ecx * 4) - (6 * 4)] |
rtst: mov eax, 51 |
mov edx, stp |
mov ebx, 1 |
int 0x40 |
cmp eax, 0xFFFFFFF0 ; -16 |
je wait_for_event ; <-- îøèáêà çàïóñêà òåñòà, ÏÅÐÅÏÈÑÀÒÜ |
mov [test_pid], eax |
pop eax |
mov byte [test_id], ah |
jmp draw_window |
;------------------------- |
; êíîïêè èçìåíåíèÿ âðåìåíè îáíîâëåíèÿ |
no_test_bt: |
cmp ah, 11 |
jne no_ut_inc |
add dword[update_time], 10 |
jmp draw_window |
no_ut_inc: |
cmp ah, 12 |
jne no_ut_dec |
cmp dword[update_time], 10 |
jng wait_for_event |
sub dword[update_time], 10 |
jmp draw_window |
no_ut_dec: |
;------------------------- |
; êíîïêè èçìåíåíèÿ öâåòà ãðàôèêîâ (13..17) |
cmp ah, 17 |
jg no_change_color |
sub ah, 13 |
movzx ecx, ah |
mov esi, [d_colors + ecx * 4] |
mov eax, [esi] |
call next_color |
mov [esi], ebx |
jmp draw_window |
no_change_color: |
jmp wait_for_event |
;--------------------------------------------------------------------- |
; Öâåòà ãðàôèêîâ |
colors: dd 0xff0000, 0xff00, 0xff, 0xffffff, tcol, 0xFF7E23, 0x8BA169, 0xff0000 ; ïåðâûé è ïîñëåäíèé ðàâíû |
next_color: |
mov ecx, (next_color - colors) / 4 ; êîëè÷åñòâî öâåòîâ |
@@: dec ecx |
cmp eax, [colors + ecx * 4] |
jne @b |
mov ebx, [colors + ecx * 4 - 4] |
ret |
;--------------------------------------------------------------------- |
draw_window: |
mov eax,12 |
mov ebx,1 |
int 0x40 |
; Ñîçäà¸ì îêíî |
xor eax, eax |
mov ebx, 300 * 65536 + 309 |
mov ecx, 150 * 65536 + 430 |
mov edx, tcol + 0x3000000 ; color of work area RRGGBB,8->color |
mov esi, 0x805080d0 ; color of grab bar RRGGBB,8->color |
mov edi, 0x005080d0 ; color of frames RRGGBB |
int 0x40 |
; Ñîçäà¸ì ðàìêó ãðàôèêà |
mov eax, 13 |
mov ebx, 10 * 65536 + 290 |
mov ecx, 118 * 65536 + 105 |
mov edx, atcol |
int 0x40 |
mov ebx, 12 * 65536 + 286 |
mov ecx, 120 * 65536 + 101 |
mov edx, tcol |
int 0x40 |
mov eax, 38 |
mov edx, atcol |
mov ebx, 12 * 65536 + 286 + 12 |
mov ecx, 120 * 65536 + 120 |
@@: add ecx, 10 * 65536 + 10 |
int 0x40 |
cmp cx, 210 ; ïðèâÿçàíî ê êîîðäèíàòàì îêíà |
jl @b |
; Ïèøèì çàãîëîâîê |
mov eax, 4 |
mov ebx, 8 * 65536 + 8 |
mov edx, title |
mov ecx, 0x10FFFFFF |
mov esi, 29 |
int 0x40 |
; Ïèøèì íàçâàíèÿ ïàðàìåòðîâ (Cpu load, temper, etc...) |
mov edx, msgs_mon |
mov ebx, 17 * 65536 + 30 |
call show_text |
mov edx, msgs_mon2 |
mov ebx, 156 * 65536 + 30 |
call show_text |
; Ðèñóåì êíîïêè ñìåíû öâåòà |
mov eax, 8 |
mov ebx, 112 * 65536 + 5 |
mov ecx, 30 * 65536 + 6 |
mov edx, 13 |
@@: mov esi, [d_colors - 13 * 4 + edx * 4] |
mov esi, [esi] |
int 0x40 |
add ecx, 10 * 65536 |
inc edx |
cmp edx, 13 + 5 ; 5 êíîïîê |
jne @b |
; Ïèøèì çàãðóçêó ïðîöåññîðà |
call cpu_usage |
;--- äîáàâëÿåì íà ãðàôèê --- |
mov esi, d_cpu_load |
call d_add |
call d_show |
;--------------------------- |
movzx ecx, al |
mov eax, 47 |
mov edx, 121 * 65536 + 30 |
xor esi, esi |
call digit_len |
int 0x40 |
; Ïèøèì èñïîëüçóåìóþ ïàìÿòü |
call mem_usage |
;--- äîáàâëÿåì íà ãðàôèê --- |
mov esi, d_mem_usage |
call d_add |
call d_show |
;--------------------------- |
movzx ecx, al |
mov eax, 47 |
mov edx, 121 * 65536 + 40 |
xor esi, esi |
call digit_len |
int 0x40 |
cmp byte[hwm_enable], 0 |
jne show_mon |
; Íåò äàò÷èêîâ - ïèøåì NO |
mov ecx, 6 ;<- êîëè÷åñòâî ïàðàìåòðîâ |
mov eax, 4 |
mov ebx, 121 * 65536 + 50 |
mov edx, msg_no |
mov esi, 3 |
@@: int 0x40 |
add ebx, 10 |
loop @b |
mov ecx, 7 ;<- êîëè÷åñòâî ïàðàìåòðîâ |
mov ebx, 260 * 65536 + 30 |
@@: int 0x40 |
add ebx, 10 |
loop @b |
jmp no_monitor |
show_mon: |
;Åñòü äàò÷èêè ïèøèì èíôó |
call hwm_get_params |
;--------------------------- |
; Òåìïåðàòóðó |
mov ecx, 3 |
mov esi, temps |
mov edx, 121 * 65536 + 50 |
xor eax, eax |
sh_temp:push ecx |
lodsw |
push esi |
; ðåàêöèÿ íà èçìåíåíèÿ |
xor esi, esi |
cmp [old_t1 + ecx * 4 - 4], eax |
je @f |
mov [old_t1 + ecx * 4 - 4], eax |
mov esi, val_mod |
@@: movzx ecx, al |
push eax |
mov eax, 47 |
mov ebx, 0x20000 |
int 0x40 |
pop eax |
mov cl, ah |
mov eax, 47 |
mov ebx, 0x10000 |
add edx, 15 * 65536 |
int 0x40 |
sub edx, 15 * 65536 - 10 |
pop esi |
pop ecx |
loop sh_temp |
;;--- äîáàâëÿåì íà ãðàôèê temp1 --- |
movzx eax, word[temps] |
mov esi, d_temp1 |
call d_add |
call d_show |
;;--- äîáàâëÿåì íà ãðàôèê temp2 --- |
movzx eax, word[temps + 2] |
mov esi, d_temp2 |
call d_add |
call d_show |
;;--- äîáàâëÿåì íà ãðàôèê temp3 --- |
movzx eax, word[temps + 4] |
mov esi, d_temp3 |
call d_add |
call d_show |
;--------------------------- |
; Ñêîðîñòè âðàøåíèÿ âåíòèëåé |
mov ecx, 3 |
mov esi, rpms |
mov edx, 121 * 65536 + 80 |
sh_fan: push ecx |
lodsd |
push esi |
;ðåàêöèÿ íà èçìåíåíèÿ |
xor esi, esi |
cmp [old_f1 + ecx * 4 - 4], eax |
je @f |
mov [old_f1 + ecx * 4 - 4], eax |
mov esi, val_mod |
@@: mov ecx, eax |
call digit_len |
mov eax, 47 |
int 0x40 |
add edx, 10 |
pop esi |
pop ecx |
loop sh_fan |
;--------------------------- |
; Íàïðóãè |
mov esi, Vcore |
mov edi, old_volts |
mov ecx, 7 |
mov ebx, 260 * 65536 + 30 |
mov edx, Data_String |
volt_nxt: |
push ecx |
push esi |
call ftoa |
;ðåàêöèÿ íà èçìåíåíèÿ |
xor ecx, ecx |
fld dword [esi] |
fsub dword [edi] |
fabs |
; fcomp dword [c_eps] ; bug in MeOsEmul |
; fstsw ax |
fcom dword [c_eps] ; 0xBADCODE |
fstsw ax |
finit |
sahf |
jc @f |
mov ecx, val_mod |
@@: mov esi, Data_String ; ñ÷èòàåì êîë-âî ñèìâîëîâ |
@@: lodsb |
test al, al |
jnz @b |
sub esi, Data_String |
mov eax, 4 |
int 0x40 |
add ebx, 10 |
pop esi |
pop ecx |
movsd |
loop volt_nxt |
no_monitor: |
;--------------------------- |
; Ñîçäà¸ì êíîïêè âêëàäîê |
mov edi, 230 * 65536 + 25 |
mov ecx, 4 |
mov eax, 8 |
mov ebx, 10 * 65536 + 70 |
mov edx, 2 |
n_bt: push ecx |
mov ecx, edi |
mov esi, tcol |
cmp byte [act_tab], dl |
jne na1 |
mov esi, atcol |
na1: int 0x40 |
inc edx |
add ebx, 73 * 65536 |
pop ecx |
loop n_bt |
; Ïèøèì íàçâàíèÿ âêëàäîê |
mov eax, 4 |
mov ebx, 35 * 65536 + 240 |
mov edx, tab_lab |
mov ecx, 0x10000000 |
mov esi, 39 |
int 0x40 |
; ñîçäà¸ì ðàìêó âíèçó ýêðàíà |
mov eax, 13 |
mov ebx, 10 * 65536 + 290 |
mov ecx, 255 * 65536 + 160 |
mov edx, atcol |
int 0x40 |
mov ebx, 12 * 65536 + 286 |
mov ecx, 257 * 65536 + 156 |
mov edx, tcol |
int 0x40 |
; ðèñóåì âûáðàííóþ âêëàäêó |
mov al, [act_tab] |
cmp al, 2 |
je info_tab |
cmp al, 3 |
je test_tab |
cmp al, 4 |
je config_tab |
jmp about_tab |
end_drow_tab: |
mov eax, 12 |
mov ebx, 2 |
int 0x40 |
jmp wait_for_event |
;--- Drow Info tab --------------- |
info_tab: |
include "info_tab.inc" |
;--- Drow test tab --------------- |
test_tab: |
include "test_tab.inc" |
;--- Drow Config tab ------------- |
config_tab: |
include "conf_tab.inc" |
;--- Drow About tab -------------- |
about_tab: |
include "abou_tab.inc" |
;--------------------------------------------------------------------- |
include "system.inc" |
include "hwm.inc" |
include "diag.inc" |
DATA |
act_tab db 2 ; Íîìåð àêòèâíîé âêëàäêè |
tab_lab db 'Info Tests Configs About' |
title db 'Ghost Monitor v0.3 [30/07/06]' |
msgs_mon mls \ |
'CPU Load (%)',\ |
'Mem Usage(%)',\ |
'Temp1',\ |
'Temp2',\ |
'Temp3',\ |
'Fan1',\ |
'Fan2',\ |
'Fan3' |
msgs_mon2 mls \ |
'Vcore',\ |
'AGP',\ |
'+3.3V',\ |
'AVcc (+5V)',\ |
'+12V',\ |
'-12V',\ |
'-5V' |
msg_yes db 'Yes' |
msg_no db 'N/A' |
update_time dd 300 ; ïåðèîä îáíîâëåíèÿ â ñîòûõ äîëÿõ ñåêóíäû |
d_colors dd d_cpu_load, d_mem_usage, d_temp1, d_temp2, d_temp3 |
c_eps dd 0.01 |
;--------------------------------------------------------------------- |
UDATA |
test_pid dd ? ; åñëè test_id == 0 - íå èìååò ñìûñëà |
test_id db ? ; 0 - òåñò íå çàïóøåí (ñîîòâåòñòâóåò ¹ êíîïêè 6..10) |
diag_add_v db ? ; 0 - íå äîáàâëÿòü äàííûå íà ãðàôèê, !0 - äîáàâëÿòü |
Vendor: times 12 db ? |
CPU_fam: db ? |
CPU_mod: db ? |
CPU_type: db ? |
CPU_mmx: db ? |
; Äëÿ ðåàêöèè íà èçìåíåíèÿ |
old_t1: dd ? ; ïîñëåäíåå çíà÷åíèå temp1 |
old_t2: dd ? ; ... |
old_t3: dd ? |
old_f1: dd ? |
old_f2: dd ? |
old_f3: dd ? |
old_volts: times 7 dd ? |
; Ãðôèêè |
diag_beg: |
d_cpu_load: dd ? |
times 286 db ? |
d_mem_usage: dd ? |
times 286 db ? |
d_temp1: dd ? |
times 286 db ? |
d_temp2: dd ? |
times 286 db ? |
d_temp3: dd ? |
times 286 db ? |
diag_end: |
; --- ñòåê òåñòà, âîèçáåæàíèå ãëþêîâ íå ïåðåíîñèòü â äðóãîå ìåñòî ---- |
th_stack: times 1024 db ? |
stp: |
;--------------------------------------------------------------------- |
MEOS_APP_END |
/programs/system/gmon/hwm.inc |
---|
0,0 → 1,80 |
include 'hwm_wb.inc' |
include 'hwm_it87.inc' |
uglobal |
hwm_enable:db 0 ; 0 - no, 1 - Winbond, 2 - ITE |
temps db 0,0, 0,0, 0,0 ; ãðàäóñ, äåñÿòûå, ãðàäóñ, ... |
rpms dd 0, 0, 0 ; fan1, fan2, fan3 |
Vcore dd 0.0 |
Vin0 dd 0.0 |
Vin1 dd 0.0 |
AVcc dd 0.0 |
Vin2 dd 0.0 |
V12 dd 0.0 |
V5 dd 0.0 |
endg |
hwm_unk db 9, 'Not found' |
hwm_chip_name dd hwm_unk |
hwm_init: |
; Ïðîâåðêà íàëè÷èÿ è èíèöèàëèçàöèÿ |
pusha |
mov eax, 46 ; ðåçåðâèðóåì 0x295 è 0x296 ïîðòû |
xor ebx, ebx |
mov ecx, 0x295 |
mov edx, 0x296 |
int 0x40 |
test eax, eax |
jz hwm_ports_ok |
hwm_no: |
mov eax, 46 ; îñâîáîæäàåì 0x295 è 0x296 ïîðòû |
xor ebx, ebx |
inc ebx |
mov ecx, 0x295 |
mov edx, 0x296 |
int 0x40 |
popa |
ret |
hwm_ports_ok: |
call wb_init |
jc not_wb |
mov byte [hwm_enable], 1 |
call wb_get_name |
jmp hwm_ok |
not_wb: call it87_init |
jc hwm_no |
mov byte [hwm_enable], 2 |
call it87_get_name |
hwm_ok: mov [hwm_chip_name], edx |
popa |
ret |
;---------------------------------------------------- |
hwm_get_params: |
; Âûçûâàòü òîëüêî åñëè íàéäåí |
pusha |
mov al, [hwm_enable] |
dec al |
jnz @f |
call wb_get_temp |
call wb_get_fan_speed |
mov edi, wb_coeff |
call wb_get_volt |
fld dword[V12] |
fld dword[wb_n12v_const] |
faddp st1, st0 |
fstp dword[V12] |
popa |
ret |
@@: call it87_get_temp |
call it87_get_fan_speed |
mov edi, ite_coeff |
call wb_get_volt |
popa |
ret |
;---------------------------------------------------- |
/programs/system/gmon/hwm_it87.inc |
---|
0,0 → 1,117 |
; Integrated Technology Express |
; Chip Temp Volt Fan |
; it8705 3 8 3 |
; it8712 3 8 3 |
; SiS |
; Chip Temp Volt Fan |
; sis950 3 8 3 |
IT87_REGCHIP equ 0x58 |
IT87_CHIPID equ 0x90 |
IT87_FANDIV equ 0x0B |
uglobal |
it_chip_id db 0 |
endg |
it8705 db 15, 'IT8705F/SiS 950' |
it8712 db 7, 'IT8712F' |
it8716 db 7, 'IT8716F' |
ite_unk db 11, 'Unknown ITE' |
ite_coeff: dd 0.016 ; Vcore |
dd 0.016 ; Vin0 |
dd 0.016 ; Vin1 (+3.3V) |
dd 0.02688 ; AVcc (+5V) |
dd 0.0608 ; Vin2 (+12V) |
dd -0.055632 ; -12V |
dd -0.02408 ; -5V |
;----------------------------------- |
it87_init: |
; Ïðîâåðêà íàëè÷èÿ è èíèöèàëèçàöèÿ |
; OUT - CF = 1 - error |
;--- Ïðîâåðÿåì IT87* -------- |
mov dx, 0x295 |
mov al, IT87_REGCHIP |
out dx, al |
inc edx |
in al, dx |
cmp al, IT87_CHIPID |
jne it87_no ; ýòî íå it87 !!! |
; -~- not tested ~-~- |
dec edx ; --- óçíà¸ì èäåíòèôèêàòîð ÷èïà -- |
mov al, 0x21 |
out dx, al |
inc edx |
in al, dx |
mov byte[it_chip_id], al |
; -~-~-~-~-~-~-~-~-~- |
clc |
ret |
it87_no:stc |
ret |
;----------------------------------- |
it87_get_temp: |
mov dx, 0x296 |
xor ecx, ecx |
mov esi, temps |
@@: dec edx |
mov eax, ecx |
add al, 0x29 |
out dx, al |
inc edx |
in al, dx |
mov [esi + ecx * 2], al |
inc ecx |
cmp ecx, 3 |
jb @b |
ret |
;----------------------------------- |
it87_fan_div db 1, 1, 1 |
it87_get_fan_speed: |
; ÷èòàåì äåëèòåëè |
mov dx, 0x295 |
mov al, IT87_FANDIV |
out dx, al |
inc dx |
in al, dx |
mov ah, al |
and al, 0x07 |
mov [it87_fan_div], al |
shr ah, 3 |
and ah, 0x07 |
mov [it87_fan_div + 1], ah |
xor ecx, ecx |
@@: mov dx, 0x295 |
mov al, 0x0D |
add al, cl |
out dx, al |
inc edx |
in al, dx |
movzx ebx, al |
push ecx |
mov cl, [it87_fan_div + ecx] |
shl ebx, cl |
pop ecx |
mov eax, 1350000 |
xor edx, edx |
div ebx |
mov [rpms + 4 * ecx], eax |
inc ecx |
cmp ecx, 3 |
jb @b |
ret |
;-------------------------------------------------------------------------- |
it87_get_name: |
mov edx, it8705 |
cmp byte[it_chip_id], 0x05 |
je @f |
mov edx, it8712 |
cmp byte[it_chip_id], 0x12 |
je @f |
mov edx, it8716 |
cmp byte[it_chip_id], 0x16 |
je @f |
mov edx, ite_unk |
@@: ret |
/programs/system/gmon/hwm_wb.inc |
---|
0,0 → 1,254 |
; |
; Áèáëèîòåêà äëÿ ÷èïîâ WinBond |
; |
; |
; Äîïèñàòü ïîëó÷åíèå èíôû ñ äðóãèõ äàò÷èêîâ |
; + 16.03.06 Èñïðàâëåíà îøèáêà â wb_get_cpu_temper ñ äåñÿòûõ ãðàäóñà (áûëî 30.5 30.0 31.5 ...) |
; |
; |
uglobal |
wb_chip_id: db 0 ; Èäåíòèôèêàòîð ÷èïà (åñëè íàøëè) |
endg |
; | Chip name | ID Vin Fanin PWM Temp |
msg_wb27HF: db 8, 'W83627HF' ; 0x20|0x21 9 3 2 3 |
msg_wb27THF: db 9, 'W83627THF' ; 0x90|0x91 7 3 3 3 |
msg_wb37THF: db 9, 'W83637THF' ; 0x80 7 3 3 3 |
msg_wb97HF: db 8, 'W83697HF' ; 0x60|0x61 8 2 2 2 |
msg_wb27EHF: db 11,'W83627EHF-A' ; 0x88 |
msg_wb27THFA: db 11,'W83627THF-A' ; 0x1A |
; db 7, 'W83781D' ; 0x10|0x11 7 3 3 |
; db 7, 'W83782D' ; 0x30 9 3 3 |
; db 8, 'AS99127F' ; 0x31 |
; db 7, 'W83783S' ; 0x40|0x41 5-6 3 1-2 |
; db 7, 'W83791D' ; 0x70|0x71 10 5 3 |
msg_wbunk: db 15,'Unknown Winbond' ; other, non zero ;-) |
;----------------------------------- |
wb_init: |
; Ïðîâåðêà íàëè÷èÿ è èíèöèàëèçàöèÿ |
; OUT - CF = 1 - error |
mov dx, 0x295 |
mov al, 0x4e |
out dx, al |
inc edx |
xor al, al |
out dx, al |
dec edx |
mov al, 0x4f |
out dx, al |
inc edx |
in al, dx |
mov ah, al ;! |
dec edx |
mov al, 0x4e |
out dx, al |
inc edx |
mov al, 0x80 |
out dx, al |
dec edx |
mov al, 0x4f |
out dx, al |
inc edx |
in al, dx |
cmp ax, 0xa35c |
jne wb_no ; ýòî íå Winbond !!! |
dec edx ; --- óçíà¸ì èäåíòèôèêàòîð ÷èïà -- |
mov al, 0x58 |
out dx, al |
inc edx |
in al, dx |
mov byte[wb_chip_id], al |
clc |
ret |
wb_no: stc |
ret |
;----------------------------------- |
wb_get_temp: |
; temp 1 |
mov dx, 0x295 ; Âûáèðàåì bank 1 |
mov al, 0x4e |
out dx, al |
inc edx |
mov al, 1 |
out dx, al |
dec edx ; Ïîëó÷àåì ñòàðøèé áàéò òåìïåðàòóðû (ãðàäóñû) |
mov al, 0x50 |
out dx, al |
inc edx |
in al, dx |
mov [temps], al |
dec edx ; Ïîëó÷àåì ìëàäøèé áàéò òåìïåðàòóðû (0.5`C) |
mov al, 0x51 |
out dx, al |
inc edx |
in al, dx ; if al == 0 then 0.0, else 0.5 |
cmp al, 0 |
je @f |
mov al, 5 |
@@: mov [temps + 1], al |
; temp 2 (3 SYSTIN) |
dec edx ; Âûáèðàåì bank 0 |
mov al, 0x4e |
out dx, al |
inc edx |
mov al, 0 |
out dx, al |
dec edx ; Ïîëó÷àåì ñòàðøèé áàéò òåìïåðàòóðû (ãðàäóñû) |
mov al, 0x27 |
out dx, al |
inc edx |
in al, dx |
mov [temps + 2], al |
; temp 3 (VTIN) |
dec edx ; Âûáèðàåì bank 2 |
mov al, 0x4e |
out dx, al |
inc edx |
mov al, 2 |
out dx, al |
dec edx ; Ïîëó÷àåì ñòàðøèé áàéò òåìïåðàòóðû (ãðàäóñû) |
mov al, 0x50 |
out dx, al |
inc edx |
in al, dx |
mov [temps + 4], al |
dec edx ; Ïîëó÷àåì ìëàäøèé áàéò òåìïåðàòóðû (0.5`C) |
mov al, 0x51 |
out dx, al |
inc edx |
in al, dx ; if al == 0 then 0.0, else 0.5 |
cmp al, 0 |
je @f |
mov al, 5 |
@@: mov [temps + 5], al |
; Ïðîâåðêà òåìïåðàòóðû, äàò÷èêè ñ 127.5`C íå èñïîëüçóþòñÿ |
mov ecx, 3 |
mov esi, temps |
wb_check_temp: |
cmp word[esi + ecx * 2 - 2], 0x057F |
jne wb_temp_ok |
mov word[esi + ecx * 2 - 2], 0 |
wb_temp_ok: |
loop wb_check_temp |
ret |
;----------------------------------- |
wb_get_fan_speed: |
; fan1 |
mov al, 0x47 |
mov dx, 0x295 |
out dx, al |
inc edx |
in al, dx |
and al, 0x30 |
shr al, 4 |
mov ebx, 1 |
mov cl, al |
shl ebx, cl ; <- div1 |
dec edx |
mov al, 0x28 |
out dx, al |
inc edx |
xor eax, eax |
in al, dx |
cmp al, 255 |
jne @f |
xor eax, eax |
ret |
@@: mul ebx |
mov ebx, eax |
mov eax, 1350000 |
xor edx, edx |
div ebx |
mov [rpms], eax |
mov al, 0x47 |
mov dx, 0x295 |
out dx, al |
inc edx |
in al, dx |
shr al, 6 |
mov ebx, 1 |
mov cl, al |
shl ebx, cl ; <- div2 |
dec edx |
mov al, 0x29 |
out dx, al |
inc edx |
xor eax, eax |
in al, dx |
cmp al, 255 |
jne @f |
xor eax, eax |
ret |
@@: mul ebx |
mov ebx, eax |
mov eax, 1350000 |
xor edx, edx |
div ebx |
mov [rpms + 4], eax |
ret |
;----------------------------------- |
wb_get_volt: |
mov dx, 0x295 |
;mov edi, vcoeff ; <-- possible differences for miscellaneous chip |
mov esi, Vcore |
xor ecx, ecx |
@@: mov eax, ecx |
add al, 0x20 |
out dx, al |
inc edx |
in al, dx |
fld dword [edi + ecx * 4] |
push eax |
fild dword [esp] |
fmulp st1, st0 |
fstp dword [esi + ecx * 4] |
pop eax |
inc ecx |
dec edx |
cmp ecx, 7 |
jb @b |
ret |
wb_coeff: dd 0.016 ; Vcore |
dd 0.016 ; Vin0 |
dd 0.016 ; Vin1 (+3.3V) |
dd 0.02688 ; AVcc (+5V) |
dd 0.0608 ; Vin2 (+12V) |
dd 0.0822857142857145 ; -12V |
dd -0.02408 ; -5V ; false |
wb_n12v_const dd -14.9142857142857 |
;----------------------------------- |
wb_get_name: |
; Âîçâðàùàåò èìÿ ÷èïà |
; Out : EDX - pointer to string (size:string - Pascal style) |
mov al, [wb_chip_id] |
and al, 0xFE ; 0x20 = 0x21, 0x60 = 0x61, etc |
mov edx, msg_wb27HF |
cmp al, 0x20 |
je @f |
mov edx, msg_wb27THF |
cmp al, 0x90 |
je @f |
mov edx, msg_wb37THF |
cmp al, 0x80 |
je @f |
mov edx, msg_wb97HF |
cmp al, 0x60 |
je @f |
mov edx, msg_wb27EHF |
cmp al, 0x88 |
je @f |
mov edx, msg_wb27THFA |
cmp al, 0x1A |
je @f |
mov edx, msg_wbunk |
@@: ret |
/programs/system/gmon/info_tab.inc |
---|
0,0 → 1,103 |
; |
; |
; Âêëàäêà èíôîðìàöèè î ñèñòåìå |
; |
; Äîïèñàòü åù¸ ÷òîèòü (ìàëîâàòî áóäåò) |
; |
; |
; Ïèøåì ïàðàìåòðû |
mov edx, lab_info_tab |
mov ebx, 17 * 65536 + 265 |
call show_text |
; Ïèøåì ïðîèçâîäèòåëÿ ïðîöåññîðà |
mov edx, Vendor |
mov esi, 12 |
mov ebx, 160 * 65536 + 265 |
int 0x40 |
; Ïîääåðæêà MMX |
mov ebx, 160 * 65536 + 275 |
mov esi, 3 |
mov edx, msg_yes |
cmp byte[CPU_mmx], 1 |
je mmx_en |
mov edx, msg_no |
mmx_en: int 0x40 |
; ×èï ìîíèòîðèíãà |
int 0x40 |
mov edx, [hwm_chip_name] |
mov al, byte[edx] |
movzx esi, al |
inc edx |
mov ebx, 160 * 65536 + 285 |
mov al, 4 |
int 0x40 |
; Ñåìåéñòâî è ìîäåëü ïðîöåññîðà |
mov eax, 47 |
mov ebx, 0x10100 |
xor ecx, ecx |
mov cl, [CPU_fam] |
mov edx, 250 * 65536 + 265 |
xor esi, esi |
int 0x40 |
mov cl, [CPU_mod] |
add edx, 10 * 65536 |
int 0x40 |
; êîýôôèöèåíò óìíîæåíèÿ |
call multiplier |
test ecx, ecx |
jz @f |
movzx ecx, cl |
push ecx |
fild dword[esp] |
push 10 |
fidiv dword[esp] |
fstp dword[esp] |
mov esi, esp |
call ftoa |
mov ebx, 160 * 65536 + 295 |
mov edx, Data_String |
mov eax, 4 |
mov esi, eax |
xor ecx, ecx |
int 0x40 |
pop eax |
pop eax |
@@: |
; Ñâîáîäíàÿ ïàìÿòü |
if (OS_version >= 0x0530) |
mov eax, 18 |
mov ebx, 16 |
int 0x40 |
mov ecx, eax |
call digit_len |
mov eax, 47 |
mov edx, 160 * 65536 + 305 |
xor esi, esi |
int 0x40 |
end if |
; Ðàññòàâëÿåì äâîåòî÷èÿ |
mov eax, 4 |
mov ebx, 152 * 65536 + 265 |
mov edx, dub_p |
mov esi, 1 |
mov ecx, 5 ; <- êîëè÷åñòâî ñòðîê |
nxt_dp: push ecx |
mov ecx, 0x10000000 |
int 0x40 |
add ebx, 10 |
pop ecx |
loop nxt_dp |
;--------------------------------------------------------------------- |
jmp end_drow_tab |
dub_p db ':' |
lab_info_tab mls \ |
'CPU Vendor',\ |
'MMX tehnology',\ |
'Monitoring chip',\ |
'Multiplier',\ |
'Free memory (Kb)' |
/programs/system/gmon/macros.inc |
---|
0,0 → 1,365 |
; language for programs |
lang fix en ; ru en fr ge fi |
@^ fix macro comment { |
^@ fix } |
;~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- |
macro uglobal { |
UGlobals equ UGlobals, |
macro __UGlobalBlock { } |
endg fix } ; Use endg for ending iglobal and uglobal blocks. |
macro IncludeUGlobals{ |
macro UGlobals dummy,[n] \{ |
\common |
\local begin, size |
begin = $ |
virtual at $ |
\forward |
__UGlobalBlock |
purge __UGlobalBlock |
\common |
size = $ - begin |
end virtual |
rb size |
\} |
match U, UGlobals \{ U \} } |
uglobal |
endg |
;~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- |
; new application structure |
macro meos_app_start |
{ |
use32 |
org 0x0 |
db 'MENUET01' |
dd 0x01 |
dd __start |
dd __end |
dd __memory |
dd __stack |
if used __params & ~defined __params |
dd __params |
else |
dd 0x0 |
end if |
dd 0x0 |
} |
MEOS_APP_START fix meos_app_start |
macro code |
{ |
__start: |
} |
CODE fix code |
macro data |
{ |
__data: |
} |
DATA fix data |
macro udata |
{ |
if used __params & ~defined __params |
__params: |
db 0 |
__end: |
rb 255 |
else |
__end: |
end if |
__udata: |
IncludeUGlobals |
} |
UDATA fix udata |
macro meos_app_end |
{ |
align 32 |
rb 2048 |
__stack: |
__memory: |
display nl, ' ' |
} |
MEOS_APP_END fix meos_app_end |
; macro for defining multiline text data |
struc mls [sstring] { |
forward |
local ssize |
virtual at 0 |
db sstring ; mod |
ssize = $ |
end virtual |
db ssize |
db sstring |
common |
db -1 ; mod |
} |
; strings |
macro sz name,[data] { ; from MFAR [mike.dld] |
common |
if used name |
name db data |
.size = $-name |
end if |
} |
macro lsz name,[lng,data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
forward |
if lang eq lng |
db data |
end if |
common |
.size = $-name |
end if |
} |
macro szc name,elsz,[data] { ; from MFAR [mike.dld] |
common |
local s,m |
m = 0 |
if used name |
label name |
virtual at 0 |
db data |
s = $ |
end virtual |
d#elsz s |
if m < s |
m = s |
end if |
db data |
.size = $-name |
.maxl = m |
end if |
} |
macro lszc name,elsz,[lng,data] { ; from MFAR [mike.dld] |
common |
local s,m |
m = 0 |
if used name |
label name |
forward |
if lang eq lng |
virtual at 0 |
db data |
s = $ |
end virtual |
d#elsz s |
if m < s |
m = s |
end if |
db data |
end if |
common |
.size = $-name |
.maxl = m |
end if |
} |
; easy system call macro |
macro mpack dest, hsrc, lsrc |
{ |
if (hsrc eqtype 0) & (lsrc eqtype 0) |
mov dest, (hsrc) shl 16 + lsrc |
else |
if (hsrc eqtype 0) & (~lsrc eqtype 0) |
mov dest, (hsrc) shl 16 |
add dest, lsrc |
else |
mov dest, hsrc |
shl dest, 16 |
add dest, lsrc |
end if |
end if |
} |
;macro __mov reg,a { ; mike.dld |
; if ~a eq |
; mov reg,a |
; end if |
;} |
macro __mov reg,a,b { ; mike.dld |
if (~a eq)&(~b eq) |
mpack reg,a,b |
else if (~a eq)&(b 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 |
} |
; ------------------------- |
macro header a,[b] { |
common |
use32 |
org 0 |
db 'MENUET',a |
forward |
if b eq |
dd 0 |
else |
dd b |
end if } |
macro section name { align 16 |
label name } |
macro func name { |
if ~used name |
display 'FUNC NOT USED: ',`name,13,10 |
else |
align 4 |
name: |
;pushad |
;pushfd |
;dps `name |
;newline |
;mcall 5,1 |
;popfd |
;popad |
} |
macro endf { end if } |
macro diff16 title,l1,l2 |
{ |
local s,d |
s = l2-l1 |
display title,': 0x' |
repeat 8 |
d = '0' + s shr ((8-%) shl 2) and $0F |
if d > '9' |
d = d + 'A'-'9'-1 |
end if |
display d |
end repeat |
display 13,10 |
} |
macro diff10 title,l1,l2 |
{ |
local s,d,z,m |
s = l2-l1 |
z = 0 |
m = 1000000000 |
display title,': ' |
repeat 10 |
d = '0' + s / m |
s = s - (s/m)*m |
m = m / 10 |
if d <> '0' |
z = 1 |
end if |
if z <> 0 |
display d |
end if |
end repeat |
display 13,10 |
} |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
macro add arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
inc arg1 |
else |
add arg1,arg2 |
end if |
else |
add arg1,arg2 |
end if |
} |
macro sub arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
dec arg1 |
else |
sub arg1,arg2 |
end if |
else |
sub arg1,arg2 |
end if |
} |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
xor arg1,arg1 |
inc arg1 |
else if (arg2) = -1 |
or arg1,-1 |
else if (arg2) > -128 & (arg2) < 128 |
push arg2 |
pop arg1 |
else |
mov arg1,arg2 |
end if |
else |
mov arg1,arg2 |
end if |
} |
struc POINT _t,_dx,_dy { |
.x _t _dx |
.y _t _dy |
} |
; constants |
; events |
EV_IDLE = 0 |
EV_TIMER = 0 |
EV_REDRAW = 1 |
EV_KEY = 2 |
EV_BUTTON = 3 |
EV_EXIT = 4 |
EV_BACKGROUND = 5 |
EV_MOUSE = 6 |
EV_IPC = 7 |
EV_STACK = 8 |
; event mask bits for function 40 |
EVM_REDRAW = 1b |
EVM_KEY = 10b |
EVM_BUTTON = 100b |
EVM_EXIT = 1000b |
EVM_BACKGROUND = 10000b |
EVM_MOUSE = 100000b |
EVM_IPC = 1000000b |
EVM_STACK = 10000000b |
/programs/system/gmon/readme.txt |
---|
0,0 → 1,99 |
==[CP1251]======================================== |
Ghost Monitor |
Àâòîð : Ìèõàéëîâ Èëüÿ Àíäðååâè÷ aka Ghost |
Âåðñèÿ : 0.3 îò 30/07/06 |
ÎÑ : äëÿ ïîëíîãî ôóíêöèîíèðîâàíèÿ Kolibri 0.5.8.0 è ñòàðøå |
forum : meos.sysbin.com -> Ïðîãðàììû -> GMon |
file : http://iam.gorodok.net/Gmon.zip |
mailto : ghost.nsk@mail.ru |
Íàçíà÷åíèå : |
Ìîíèòîðèíã òåìïåðàòóðû è ñêîðîñòè âðàøåíèÿ âåíòèëÿòîðîâ ïðîöåññîðà è |
ìàòåðèíñêîé ïëàòû, ñòðåññ òåñòèðîâàíèå íàä¸æíîñòè ñèñòåìû îõëàæäåíèÿ è áëîêà |
ïèòàíèÿ êîìïüþòåðà. |
Ìîíèòîðèíã : |
 íàñòîÿùåå âðåìÿ îòîáðàæàþòñÿ çàãðóçêà ïðîöåññîðà, çàãðóçêà ïàìÿòè, òåìïåðàòóðà, ñêîðîñòè |
âðàøåíèÿ âåíòèëÿòîðîâ è íàïðÿæåíèå. Ïîääåðæèâàåìûå ÷èïû ìîíèòîðèíãà : |
WinBond chip : W83627HF/THF/THF-A/EHF-A, W83637THF, W83697HF, è àíàëîãè. |
Integrated Technology Express : IT8705F, IT8712F, IT8716F, è àíàëîãè. |
SiS : sis950 (àíàëîã IT8705F) |
Ôóíêöèè ìîíèòîðèíãà òåìïåðàòóðû ìîæíî ïðîâåðèòü â Windows íà ýìóëÿòîðå KlbrInWin, äëÿ ýòîãî |
íåîáõîäèìî â ôàéëå íàñòðîåê íàïèñàòü EnablePorts 295 296 |
Òåñòû : |
Òåñòû îðèåíòèðîâàíû íà ïðîöåññîðû P5, P6, K6 è K7, îñíîâàíû íà Robert Redelmeier's CPUburn |
[http://pages.sbcglobal.net/redelm/]. Öëÿ òåñòèðîâàíèÿ Pentium 4, ðåêîìåíäóþ òåñò äëÿ K7, äëÿ |
îñòàëüíûõ ïðîöåññîðîâ ïîäáåðèòå ïî ìàêñèìàëüíîé òåìïåðàòóðå (íàïèøèòå ìíå îá ýòîì). |
Âíèìàíèå! Ïðîãðàììà íå ðåàãèðóåò íà êðèòè÷åñêèé ïîðîã òåìïåðàòóðû, ïîýòîìó äëÿ èçáåæàíèÿ |
ïîð÷è îáîðóäîâàíèÿ íå îñòàâëÿéòå çàïóøåííûé òåñò áåç ïðèñìîòðà!  ñâÿçè ñ ðàçëè÷èåì â |
ðåàëèçàöèè ôóíêöèè 18-2, äëÿ Menuet è Kolibri íåîáõîäèìû ðàçëè÷íûå ðåàëèçàöèè ïðîãðàììû, ïî |
óìîë÷àíèþ êîìïèëèðóåòñÿ äëÿ Kolibri 0.5.8.0, ïðè íåîáõîäèìîñòè èçìåíèòå ïðîöåäóðó stop_test â |
system.inc. Òåñòû ðàáîòàþò îäèíàêîâî ýôôåêòèâíî êàê íà ðåàëüíîì îáîðóäîâàíèè, òàê è íà |
âèðòóàëüíûõ ìàøèíàõ. |
Íà áóäóùåå : |
Íîâûå ÷èïû |
Ðåàêöèÿ íà êðèòè÷åñêèé ïîðîã òåìïåðàòóðû |
Ïðîâåêà íàä¸æíîñòè ñõåì ïèòàíèÿ |
Îñîáàÿ áëàãîäàðíîñòü âñåì ó÷àñòíèêàì ôîðóìà. |
Íàéäåííûå îøèáêè è ïðåäëîæåíèÿ ïèøèòå â ôîðóì èëè íà ïî÷òó. |
ÂÍÈÌÀÍÈÅ !!! ÂÎÇÌÎÆÍÀ ÏÎÐ×À ÎÁÎÐÓÖÎÂÀÍÈß! |
ÈÑÏÎËÜÇÓÉÒÅ ÍÀ ÑÂÎÉ ÑÒÐÀÕ È ÐÈÑÊ! |
Ïðîãðàììà ðàñïîñòðàíÿåòñÿ "as is", è àâòîð íå íåñåò îòâåòñòâåííîñòè çà âîçìîæíûé óùåðá, ïðè÷èíåííûé |
ïðîãðàììîé. |
==[CP866]========================================= |
Ghost Monitor |
¢â®à : ¨å ©«®¢ «ìï ¤à¥¥¢¨ç aka Ghost |
¥àá¨ï : 0.3 ®â 30/07/06 |
: ¤«ï ¯®«®£® äãªæ¨®¨à®¢ ¨ï Kolibri 0.5.8.0 ¨ áâ àè¥ |
forum : meos.sysbin.com -> à®£à ¬¬ë -> GMon |
file : http://iam.gorodok.net/Gmon.zip |
mailto : ghost.nsk@mail.ru |
§ 票¥ : |
®¨â®à¨£ ⥬¯¥à âãàë ¨ ᪮à®á⨠¢à è¥¨ï ¢¥â¨«ïâ®à®¢ ¯à®æ¥áá®à ¨ |
¬ â¥à¨áª®© ¯« âë, áâà¥áá â¥áâ¨à®¢ ¨¥ ¤ñ¦®á⨠á¨áâ¥¬ë ®å« ¦¤¥¨ï ¨ ¡«®ª |
¯¨â ¨ï ª®¬¯ìîâ¥à . |
®¨â®à¨£ : |
áâ®ï饥 ¢à¥¬ï ®â®¡à ¦ îâáï § £à㧪 ¯à®æ¥áá®à , § £à㧪 ¯ ¬ïâ¨, ⥬¯¥à âãà , ᪮à®á⨠|
¢à è¥¨ï ¢¥â¨«ïâ®à®¢ ¨ ¯à殮¨¥. ®¤¤¥à¦¨¢ ¥¬ë¥ ç¨¯ë ¬®¨â®à¨£ : |
WinBond chip : W83627HF/THF/THF-A/EHF-A, W83637THF, W83697HF, ¨ «®£¨. |
Integrated Technology Express : IT8705F, IT8712F, IT8716F, ¨ «®£¨. |
SiS : sis950 ( «®£ IT8705F) |
ãªæ¨¨ ¬®¨â®à¨£ ⥬¯¥à âãàë ¬®¦® ¯à®¢¥à¨âì ¢ Windows í¬ã«ïâ®à¥ KlbrInWin, ¤«ï í⮣® |
¥®¡å®¤¨¬® ¢ ä ©«¥ áâ஥ª ¯¨á âì EnablePorts 295 296 |
¥áâë : |
¥áâë ®à¨¥â¨à®¢ ë ¯à®æ¥áá®àë P5, P6, K6 ¨ K7, ®á®¢ ë Robert Redelmeier's CPUburn |
[http://pages.sbcglobal.net/redelm/]. «ï â¥áâ¨à®¢ ¨ï Pentium 4, ४®¬¥¤ãî â¥áâ ¤«ï K7, ¤«ï |
®áâ «ìëå ¯à®æ¥áá®à®¢ ¯®¤¡¥à¨â¥ ¯® ¬ ªá¨¬ «ì®© ⥬¯¥à âãॠ( ¯¨è¨â¥ ¬¥ ®¡ í⮬). |
¨¬ ¨¥! à®£à ¬¬ ¥ ॠ£¨àã¥â ªà¨â¨ç¥áª¨© ¯®à®£ ⥬¯¥à âãàë, ¯®í⮬㠤«ï ¨§¡¥¦ ¨ï |
¯®àç¨ ®¡®à㤮¢ ¨ï ¥ ®áâ ¢«ï©â¥ § ¯ãè¥ë© â¥áâ ¡¥§ ¯à¨á¬®âà ! á¢ï§¨ á à §«¨ç¨¥¬ ¢ |
ॠ«¨§ 樨 äãªæ¨¨ 18-2, ¤«ï Menuet ¨ Kolibri ¥®¡å®¤¨¬ë à §«¨çë¥ à¥ «¨§ 樨 ¯à®£à ¬¬ë, ¯® |
㬮«ç ¨î ª®¬¯¨«¨àã¥âáï ¤«ï Kolibri 0.5.8.0, ¯à¨ ¥®¡å®¤¨¬®á⨠¨§¬¥¨â¥ ¯à®æ¥¤ãàã stop_test ¢ |
system.inc. ¥áâë à ¡®â îâ ®¤¨ ª®¢® íä䥪⨢® ª ª ॠ«ì®¬ ®¡®à㤮¢ ¨¨, â ª ¨ |
¢¨àâã «ìëå ¬ è¨ å. |
¡ã¤ã饥 : |
®¢ë¥ 稯ë |
¥ ªæ¨ï ªà¨â¨ç¥áª¨© ¯®à®£ ⥬¯¥à âãàë |
஢¥ª ¤ñ¦®á⨠á奬 ¯¨â ¨ï |
ᮡ ï ¡« £®¤ à®áâì ¢á¥¬ ãç á⨪ ¬ ä®à㬠. |
©¤¥ë¥ ®è¨¡ª¨ ¨ ¯à¥¤«®¦¥¨ï ¯¨è¨â¥ ¢ ä®à㬠¨«¨ ¯®çâã. |
!!! ! |
! |
à®£à ¬¬ à ᯮáâà ï¥âáï "as is", ¨ ¢â®à ¥ ¥á¥â ®â¢¥âá⢥®á⨠§ ¢®§¬®¦ë© ãé¥à¡, ¯à¨ç¨¥ë© |
¯à®£à ¬¬®©. |
/programs/system/gmon/system.inc |
---|
0,0 → 1,371 |
;-------------------------------------------------------------------- |
; Çàãðóçêà ïðîöåññîðà |
; OUT : AL - çàãðóçêà â ïðîöåíòàõ |
cpu_usage: |
pusha |
mov byte [c_u_t], 0 |
mov eax, 18 ; TSC / SEC |
mov ebx, 5 |
int 0x40 |
shr eax, 20 |
push eax |
mov eax, 18 ; IDLE / SEC |
mov ebx, 4 |
int 0x40 ; eax - ïóñòûõ öèêëîâ â ñåêóíäó |
shr eax, 20 ; eax = IDLE / 1048576 |
pop ebx |
cmp eax, ebx ; BUG : time to time ICPS > TSCPS |
jnl c_u_o |
push ebx |
xor edx, edx |
mov ebx, 100 |
mul ebx ; eax =(IDLE / 1048576) * 100 |
xor edx, edx |
pop ebx ; ebx = (TSC/1048576)+1 |
inc ebx |
div ebx ; eax = ((IDLE / 1048576) * 100) / ((TSC/1048576)+1) |
mov bl, 100 |
sub bl, al |
cmp bl, 101 |
jnl c_u_o |
mov [c_u_t], bl |
c_u_o: popa |
mov al, [c_u_t] |
ret |
uglobal |
c_u_t: db 0 |
endg |
;-------------------------------------------------------------------- |
mem_usage: |
; Èñïðîëüçîâàíèå ïàìÿòè |
; OUT : al - ïðîöåòí èñïðîëüçóåìîé ïàìÿòè |
display nl, 'Memory usage : ' |
if (OS_version >= 0x0530) |
display 'yes' |
pusha |
mov byte [m_u_t], 0 |
mov eax, 18 ; full mem |
mov ebx, 17 |
int 0x40 |
shr eax, 10 |
push eax |
mov eax, 18 ; free mem |
mov ebx, 16 |
int 0x40 ; eax - free mem |
shr eax, 10 ; eax = fmem / 1024 |
xor edx, edx |
mov ebx, 100 |
mul ebx ; eax =(free mem / 1024) * 100 |
xor edx, edx |
pop ebx ; ebx = (full mem/1024)+1 |
inc ebx |
div ebx ; eax = ((free mem / 1024) * 100) / ((full mem/1024)+1) |
mov bl, 100 |
sub bl, al |
cmp bl, 101 |
jnb m_u_o |
mov [m_u_t], bl |
m_u_o: popa |
mov al, [m_u_t] |
ret |
uglobal |
m_u_t: db 0 |
endg |
else |
display 'no' |
xor eax, eax |
ret |
end if |
;####################################################################### |
stop_test: |
; ïîðòÿòñÿ ðåãèñòðû |
display nl, 'Kill process type : ' |
if (OS_version < 0x0400) |
; êîä äëÿ Menuet |
display 'Menuet' |
mov eax, 18 |
mov ebx, 2 |
mov ecx, [test_pid] |
int 0x40 |
mov byte[test_id], 0 |
ret |
; ------------------------------- |
else if (OS_version >= 0x0400) |
if (OS_version < 0x0580) |
display 'old Kolibri' |
; -- ñëåäóéøèé êîä óáèâàåò ïðîöåññ â Kolibri 4 è ñòàðøå |
mov ebx, Buf |
xor ecx, ecx |
find_th:mov eax, 9 |
int 0x40 |
mov edx, dword [Buf + 30] |
cmp edx, dword [test_pid] |
je kill_t |
inc ecx |
cmp ecx, eax ; eax - êîëè÷åñòâî ïðîöåññîâ |
jle find_th |
jmp cl_tinf ; ÎØÈÁÊÀ !!!! ïîòîê íå íàéäåí !!!! |
kill_t: mov ebx, 2 ; óáèâàåì òåñòîâûé ïîòîê |
mov eax, 18 |
int 0x40 |
cl_tinf: |
mov byte[test_id], 0 |
ret |
uglobal |
Buf: times 1024 db ? ; Áóôåð äëÿ íàõîæäåíèÿ PID`à çàïóùåííîãî òåñòà |
endg |
else |
; ------------------------------- |
; êîä äëÿ Kolibri 0.5.8.0 è ñòàðøå |
display 'Kolibri 0.5.8.0' |
mov eax, 18 |
mov ebx, 18 |
mov ecx, [test_pid] |
int 0x40 |
mov byte [test_id], 0 |
ret |
; ------------------------------- |
end if |
end if |
;####################################################################### |
; Âûâîäèò ñòðîêè òåêñòà |
; in : edx - óêàçàòåëü íà mls |
; ebx - êîîðäèíàòû : X << 16 + Y |
show_text: |
mov eax, 4 |
mov ecx, 0x10000000 |
@@: |
movzx esi, byte[edx] |
inc edx |
int 0x40 |
add ebx, 10 |
add edx, esi |
cmp byte[edx], -1 |
jne @b |
ret |
;--------------------------------------------------------------------- |
multiplier: |
;--- âû÷èñëåíèå êîýôôèöèåíòà óìíîæåíèÿ - |
; ïîðòèò ðåãèñòðû |
; out : CL = êîýôô.óìíîæåíèÿ * 10, èëè 0 |
xor ecx, ecx |
if (OS_version >= 0x0510) |
display nl, 'Multiplier : yes' |
cmp dword [Vendor + 8], 'cAMD' ; Check for Advanced Micro Devices CPU |
jne noAMD |
cmp byte [CPU_fam], 5 |
jne noAMDK6 |
mov eax, 68 ; AMD-K6 (p.30) |
mov ebx, 3 |
mov edx, 0x0C0000087 |
int 0x40 ; eax - low dword |
and eax, 111b |
mov cl, [athloncoef3 + eax] |
cmp eax, 6 |
jne @f |
cmp byte[CPU_mod], 8 |
jae @f |
mov cl, 20 |
@@: ret |
noAMDK6:cmp byte [CPU_fam], 6 |
jne noAMDK7 |
mov eax, 68 ; Athlon/AthlonXP |
mov ebx, 3 |
mov edx, 0x0C0010015 |
int 0x40 |
mov ebx, eax |
shr ebx, 24 |
and ebx, 0x0F |
shr eax, 20 |
jc @f |
mov cl, [athloncoef + ebx] |
ret |
@@: mov cl, [athloncoef2 + ebx] |
ret |
noAMD: cmp dword [Vendor + 8], 'ntel' ; Check for International Electronics CPU |
jne noIntel |
cmp byte[CPU_fam], 0x0F |
jne noIntelP4 |
cmp byte [CPU_type], 6 |
jne @f |
mov eax, 68 ; Pentium M |
mov ebx, 3 |
mov edx, 0x2A |
int 0x40 |
shr eax, 22 |
and eax, 0x1F |
mov dl, 10 |
mul dl |
mov cl, al |
ret |
@@: cmp byte [CPU_mod], 2 |
jae @f |
mov eax, 68 ; Pentium 4 / Xeon (model < 2) |
mov ebx, 3 |
mov edx, 0x2A |
int 0x40 |
shr eax, 8 |
and eax, 0x0F |
mov cl, [p4coef + eax] |
ret |
@@: mov eax, 68 ; Pentium 4 / Xeon (model >= 2) |
mov ebx, 3 |
mov edx, 0x2C |
int 0x40 |
; shr eax, 24 |
; and eax, 0x1F |
shr eax, 27 |
and al, 0Fh |
add al, 8 |
mov dl, 10 |
mul dl |
mov cl, al |
ret |
noIntelP4: |
cmp byte[CPU_fam], 6 |
jne noIntelP6 |
mov eax, 68 ; Pentium Pro / Pentium II / Pentium III |
mov ebx, 3 |
mov edx, 0x2A |
int 0x40 |
shr eax, 22 |
test al, 0x20 |
jz @f |
or al, 0x10 |
@@: and eax, 0x1f |
cmp byte[CPU_mod], 0x06 ; ? 7 |
ja @f |
and al, 0x0f |
@@: |
mov cl, [coppercoeff + eax] |
cmp byte[CPU_mod], 0x0B |
jb @f |
mov cl, [tualatcoeff + eax] |
@@: ret |
noIntel: |
noIntelP6: |
noAMDK7: |
ret |
athloncoef db 110, 115, 120, 125, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105 |
athloncoef2 db 120, 190, 120, 200, 130, 135, 140, 210, 150, 220, 160, 165, 170, 180, 230, 240 |
athloncoef3 db 45, 50, 40, 55, 25, 30, 60, 35 |
p4coef db 160, 170, 180, 190, 200, 210, 220, 230, 80, 90, 100, 110, 120, 130, 140, 150 ; Pentium 4 |
coppercoeff db 50, 30, 40, 20, 55, 35, 45, 25, 35, 70, 80, 60, 20, 75, 15, 65, 90, 110, 120, 20, 95, 115, 85, 25, 35, 70, 80, 100, 20, 75, 15, 105 |
tualatcoeff db 120, 35, 35, 40, 55, 35, 115, 35, 160, 70, 80, 60, 40, 75, 35, 65, 90, 110, 35, 35, 95, 35, 85, 35, 35, 35, 130, 100, 140, 35, 150, 105 |
else |
display nl, 'Multiplier : no' |
ret |
end if |
;--------------------------------------------------------------------- |
digit_len: |
; Âû÷èñëåíèå äëèííû ÷èñëà äëÿ ôóíê. 47 |
; ecx - ÷èñëî |
; ebx - äëèííà * 65536 |
pusha |
xor ebx, ebx |
mov eax, ecx |
mov esi, 10 |
@@: xor edx, edx |
inc ebx |
div esi |
test eax, eax |
jnz @b |
mov [tdl], ebx |
popa |
mov ebx, [tdl] |
shl ebx, 16 |
ret |
uglobal |
tdl dd 0 |
endg |
;-------------------------------------------------------------------- |
ftoa: |
; esi - ïðåîáðàçóåìîå ÷èñëî; |
; Data_String - ñòðîêà-ðåçóëüòàò. |
pusha |
mov edi, Data_String |
fninit |
fld dword [esi] |
fmul dword [MConst] |
fbstp [Data_BCD] |
mov ax, word[Data_BCD + 8] |
cmp ax, 0xFFFF |
je @@Overflow |
mov al, byte[Data_BCD + 9] |
and al, al |
jz @@NoSign |
mov AL,'-' |
stosb |
@@NoSign: |
mov ebx, 8 |
mov ecx, 9 |
mov edx, 18 - 2 ; 2 çíàêà ïîñëå çàïÿòîé |
@@NextPair: |
mov al, byte[Data_BCD + ebx] |
mov AH,AL |
shr AL,4 |
add AL,'0' |
stosb |
dec edx |
jnz @@N0 |
mov AL,'.' |
stosb |
@@N0: mov AL,AH |
and AL,0Fh |
add AL,'0' |
stosb |
dec edx |
jnz @@N1 |
mov AL,'.' |
stosb |
@@N1: dec ebx |
loop @@NextPair |
xor al, al |
stosb |
mov edi, Data_String |
mov esi, Data_String |
cmp byte[esi], '-' |
jne @@N2 |
inc esi |
inc edi |
@@N2: mov ecx, 18+1+1 |
@@N3: cmp byte[esi], '0' |
jne @@N4 |
inc esi |
loop @@N3 |
jmp @@Error |
@@N4: rep movsb |
jmp @@End |
@@Overflow: |
@@Error:mov eax, 'ERR' |
stosd |
@@End: popa |
ret |
MConst: dd 1.0E2 ; 2 çíàêà ïîñëå çàïÿòîé |
uglobal |
Data_BCD: DT ? |
Data_String: times 20 db 0 ; ASCIIZ ñòîðêà ñ ïðåîáðàçîâàííûì ÷èñëîì |
endg |
;-------------------------------------------------------------------- |
/programs/system/gmon/test_tab.inc |
---|
0,0 → 1,139 |
; |
; |
; |
; Âêëàäêà òåñòîâ |
; |
; |
; |
; |
; "GenuineIntel" - International Electronics |
; "GenuineTMx86" - Transmeta Processor |
; "AuthenticAMD" - Advanced Micro Devices |
; "AMD ISBETTER" - Advanced Micro Devices |
; "UMC UMC UMC " - United Microelectronics Corporation |
; "CyrixInstead" - Cyrix Processor |
; "Geode by NSC" - National Semiconductor Processor |
; "SiS SiS SiS " - SiS Processor |
; "RiseRiseRise" - Rise Processor |
; "NexGenDriven" - NexGen Processor (acquired by AMD) |
; "CentaurHauls" - IDT/Centaur, now VIA Processor |
; Pentium (P5) button |
mov eax, 8 |
mov ebx, 17 * 65536 + 145 |
mov ecx, 277 * 65536 + 25 |
mov edx, 6 |
mov esi, tcol |
cmp byte[Vendor + 11], 'l' |
jne p5n |
cmp byte[CPU_fam], 5 |
jne p5n |
mov esi, atcol |
p5n: int 0x40 |
; Pentium Pro / II / III (P6) button |
add ecx, 27 * 65536 |
inc edx |
mov esi, tcol |
cmp byte[Vendor + 11], 'l' |
jne p6n |
cmp byte[CPU_fam], 6 |
jne p6n |
mov esi, atcol |
p6n: int 0x40 |
; AMD K6 button |
add ecx, 27 * 65536 |
inc edx |
mov esi, tcol |
cmp byte[Vendor], 'A' |
jne k6n |
cmp byte[CPU_fam], 5 |
jne k6n |
mov esi, atcol |
k6n: int 0x40 |
; AMD K7 (Athlon / Duron) |
add ecx, 27 * 65536 |
inc edx |
mov esi, tcol |
cmp byte[Vendor], 'A' |
jne k7n |
cmp byte[CPU_fam], 6 |
jne k7n |
mov esi, atcol |
k7n: int 0x40 |
; MMX òåñò |
; add ecx, 27 * 65536 |
; inc edx |
; mov esi, tcol |
; cmp byte[CPU_mmx], 1 |
; jne mmxn |
; mov esi, atcol |
; mmxn: int 0x40 |
; Ïèøåì íàçâàíèÿ êíîïîê |
mov eax, 4 |
mov ebx, 30 * 65536 + 287 |
mov esi, 7 |
mov edx, tmsg_p ; P5 |
mov ecx, 0x10000000 |
cmp byte[test_id], 6 |
jne nr1 |
mov ecx, 0x10FF0000 |
nr1: int 0x40 |
mov ebx, 30 * 65536 + 287 + 27 |
mov esi, 20 ; P6 |
mov ecx, 0x10000000 |
cmp byte[test_id], 7 |
jne nr2 |
mov ecx, 0x10FF0000 |
nr2: int 0x40 |
mov ebx, 30 * 65536 + 287 + 27 + 27 |
mov edx, tmsg_k6 ; K6 |
mov esi, 13 |
mov ecx, 0x10000000 |
cmp byte[test_id], 8 |
jne nr3 |
mov ecx, 0x10FF0000 |
nr3: int 0x40 |
mov ebx, 30 * 65536 + 287 + 27 + 27 + 27 |
mov edx, tmsg_k7 ; K7 |
mov esi, 15 |
mov ecx, 0x10000000 |
cmp byte[test_id], 9 |
jne nr4 |
mov ecx, 0x10FF0000 |
nr4: int 0x40 |
; mov ebx, 30 * 65536 + 287 + 27 + 27 + 27 + 27 |
; mov edx, tmsg_mmx ; MMX |
; mov esi, 12 |
; mov ecx, 0x10000000 |
; cmp byte[test_id], 10 |
; jne nr5 |
; mov ecx, 0x10FF0000 |
; nr5: int 0x40 |
; recommendate |
mov ecx, 0x10000000 |
mov ebx, 190 * 65536 + 400 |
mov edx, tmsg_rec |
mov esi, 14 |
int 0x40 |
; read about |
mov ebx, 30 * 65536 + 262 |
mov edx, tmsg_war |
mov esi, 34 |
mov ecx, 0x10FF0000 |
int 0x40 |
; recommendate color |
mov eax, 13 |
mov ebx, 170 * 65536 + 10 |
mov ecx, 398 * 65536 + 10 |
mov edx, atcol |
int 0x40 |
jmp end_drow_tab |
tmsg_p db 'Pentium (Pro/II/III)' ; 7/20 |
tmsg_k6 db 'K6 (I/II/III)' ; 13 |
tmsg_k7 db 'K7/Athlon/Duron' ; 15 |
;tmsg_mmx db 'MMX (memory)' ; 12 |
tmsg_rec db '- recommendate' ; 14 |
tmsg_war db 'May permanent damage to electronic' ; 34 |
/programs/system/gmon/tests.inc |
---|
0,0 → 1,236 |
; |
; |
; k6, k7, p5 & p6 based on Robert Redelmeier's burnCPU tests |
; ported by Ghost |
; |
; Çàìåòêè : |
; ïåðåïèñòü ðåàêöèþ íà îøèáêè |
k6: |
finit |
push ebp |
mov ebp, esp |
and ebp, -32 |
sub esp, 96 |
fldpi |
fld qword [rtt] |
fstp qword [ebp - 24] |
fld qword [e] |
fstp qword [ebp - 32] |
mov edx, [half] |
mov [ebp - 8], edx |
k6_after_check: |
xor eax, eax |
mov ebx, eax |
lea esi, [eax - 1] |
mov ecx, 400000000 |
mov [ebp - 4], ecx |
align 32 |
;rev. eng. win. ver. (lea esi, [esi]) ; Ghost |
k6_crunch: |
fld qword [ebp+esi*8-16] ; CALC BLOCK |
fmul qword [ebp+esi*8-24] |
add edx, [half + 9 + esi + esi * 8] ;!!! |
jnz $ + 2 |
faddp |
fld qword [ebp+esi*8-16] |
dec ebx |
sub edx, [half + 9 + esi + esi * 8] ;!!! |
jmp $ + 2 |
fmul qword [ebp+esi*8-24] |
inc ebx |
dec dword [ebp+esi*8+4] |
fsubp |
jnz k6_crunch ; time for testing ? |
test ebx, ebx ; TEST BLOCK |
jnz k6_int_exit |
cmp edx, [half] |
jnz k6_int_exit |
fldpi |
fcomp st1 |
fstsw ax |
sahf |
jz k6_after_check |
dec ebx |
k6_int_exit: |
dec ebx |
add esp, 96 |
pop ebp |
mov eax, -1 |
int 0x40 |
;####################################################################### |
;####################################################################### |
k7: finit |
mov ebp, esp |
and ebp,-32 |
sub esp,96 |
fld qword [rtt] |
fstp qword [ebp-40] |
fld qword [e] |
fstp qword [ebp-32] |
fldpi |
fldpi |
xor eax, eax |
xor ebx, ebx |
xor ecx, ecx |
mov edx, half |
lea esi,[eax-1] |
mov [ebp-12], eax |
mov [ebp-8], edx |
k7_after_check: |
mov dword[ebp-4], 0x32A9F880;0x850000000 ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
ALIGN 16 |
k7_crunch: |
fxch ; CALC BLOCK |
fld qword [ebp+esi*8-24] ; 17 instr / 6.0 cycles |
fmul qword [ebp+esi*8-32] |
faddp |
dec ecx |
fld qword [ebp+esi*8-24] |
dec ebx |
inc dword [ebp+esi*8-12] |
inc ecx |
fmul qword [ebp+esi*8-32] |
inc ebx |
dec dword [ebp+esi*8-4] |
jmp $+2 |
fsubp st2, st0 |
jnz k7_crunch ; time for testing ? |
test ebx, ebx ; TEST BLOCK |
jnz k7_int_exit |
test ecx, ecx |
jnz k7_int_exit |
cmp edx, half |
jnz k7_int_exit |
fcom st1 |
fstsw ax |
sahf |
jz k7_after_check |
dec ebx |
k7_int_exit: |
dec ebx |
add esp,96 |
mov eax, -1 |
int 0x40 |
;####################################################################### |
;####################################################################### |
p5: finit |
push ebp |
mov ebp, esp |
and ebp, -32 |
sub esp, 96 |
fld qword [half] |
fstp qword [ebp - 24] |
fld qword [rtt] |
fst qword [ebp - 16] |
fld st |
fld st |
p5_after_check: |
xor eax, eax |
mov eax, ebx |
mov ecx, 200000000 |
align 32 |
;# MAIN LOOP 16 flops / 18 cycles |
p5_crunch: |
fmul qword [ebp - 24] |
fxch st1 |
fadd qword [ebp - 16] |
fxch st2 |
fmul qword [ebp - 24] |
fxch st1 |
fadd qword [ebp - 16] |
fxch st2 |
fmul qword [ebp - 24] |
fxch st1 |
fadd qword [ebp - 16] |
fxch st2 |
fmul qword [ebp - 24] |
fxch st1 |
fadd qword [ebp - 16] |
fxch st2 |
fmul qword [ebp - 24] |
fxch st1 |
fadd qword [ebp - 16] |
fxch st2 |
fmul qword [ebp - 24] |
fxch st1 |
fadd qword [ebp - 16] |
fxch st2 |
fmul qword [ebp - 24] |
fxch st1 |
fadd qword [ebp - 16] |
fxch st2 |
fmul qword [ebp - 24] |
fxch st1 |
fadd qword [ebp - 16] |
fxch st2 |
dec ecx |
jnz p5_crunch |
jmp p5_after_check |
;####################################################################### |
;####################################################################### |
p6: finit |
push ebp |
mov ebp, esp |
and ebp, -32 |
sub esp, 96 |
fldpi |
fld qword [rtt] |
fstp qword [ebp - 24] |
fld qword [e] |
fstp qword [ebp - 32] |
mov edx, [half] |
mov [ebp - 8], edx |
p6_after_check: |
xor eax, eax |
mov ebx, eax |
lea esi, [eax - 1] |
mov ecx, 539000000 ;# check after this count |
mov [ebp - 4], ecx |
align 32 |
p6_crunch: ;# MAIN LOOP 21uops / 8.0 clocks |
fld qword [ebp+esi*8-16] |
fmul qword [ebp+esi*8-24] |
add edx, [half] |
jnz $ + 2 |
faddp |
fld qword [ebp - 24] |
dec ebx |
sub edx, [half + 9 + esi + esi*8] |
jmp $ + 2 |
fmul qword [ebp+esi*8-24] |
inc ebx |
dec dword [ebp+esi*8+4] |
fsubp |
jnz p6_crunch |
test ebx, ebx ;# Testing block |
mov ebx, 0 |
jnz p6_int_exit |
cmp edx, [half] |
jnz p6_int_exit |
fldpi |
fcomp st1 |
fstsw ax |
sahf |
jz p6_after_check ;# fp result = pi ? |
dec ebx |
p6_int_exit: ;# error abort |
dec ebx |
add esp, 96 |
pop ebp |
mov eax, -1 |
int 0x40 |
;--------------------------------------------- |
align 32 |
half dd 0x7fffffff, 0 |
e dd 0xffffffff, 0x3fdfffff |
rtt dd 0xffffffff, 0x3fefffff |
/programs/system/icon/trunk/macros.inc |
---|
218,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
/programs/system/kbd/trunk/macros.inc |
---|
123,8 → 123,10 |
end if |
} |
macro __mov reg,a { ; mike.dld |
if ~a eq |
macro __mov reg,a,b { ; mike.dld |
if (~a eq)&(~b eq) |
mpack reg,a,b |
else if (~a eq)&(b eq) |
mov reg,a |
end if |
} |
141,11 → 143,6 |
; language for programs |
lang fix ru ; ru en fr ge fi |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
177,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
221,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
/programs/system/launcher/trunk/macros.inc |
---|
143,10 → 143,6 |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
178,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
222,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
/programs/system/menu/trunk/macros.inc |
---|
143,10 → 143,6 |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
178,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
222,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
/programs/system/panel/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/system/panel/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/system/panel/trunk/build.bat |
---|
0,0 → 1,2 |
@fasm @panel.asm @panel |
@pause |
/programs/system/pcidev/trunk/PCIDEV.ASM |
---|
1,12 → 1,12 |
;*************************************************************** |
; project name: PCI Device Enumeration |
; target platform: KolibriOS and MenuetOS |
; compiler: flat assmebler 1.63.2 |
; version: 1.31 |
; last update: 13(th) May 2006 |
; maintained by: Jason Delozier (cordata51) |
; e-mail: cordata51@hotmail.com |
; project site: http://www.asmfreaks.com/menuetos |
; compiler: flat assmebler 1.66 |
; version: 2.0 |
; last update: 30(th) August 2006 |
; maintained by: Jason Delozier and Sergey Kuzmin |
; e-mail: cordata51@hotmail.com and kuzmin_serg@list.ru |
; project site: http://www.coolthemes.narod.ru/pcidev.html |
;*************************************************************** |
;Summary: This program will attempt to scan the PCI Bus |
; and display basic information about each device |
15,9 → 15,27 |
;HISTORY: |
;keep dates in european format (dd/mm/yyyy), please |
; '!' means big changes |
; |
; to-do: |
;PCI version should be normalized (0210->02.10) |
; PCI version should be normalized 0210 -> 02.10 (it is BCD number) |
; vendor's website |
; more vendors |
; device IRQ |
; Subsystem id and Subsystem vendor id detection |
; Full device detection (like "ATI Radeon 9200") will increase app |
; size a lot and probably it is function of particular drivers |
;---------------------------------------------------------------- |
;2.0: PCIDEV 30/08/2006 |
;(it differs a lot from the version 1.0, which was introduced 19 months ago) |
;Author: Marat Zakiyanov aka Mario79 <mario79@bk.ru> |
; Sergey Kuzmin aka Wildwest <kuzmin_serg@list.ru> |
;Features: |
; added |
; * Detection of Interface by Mario79 |
; * 122 vendor id's by Wildwest |
; * Description is based on Class, SubClass and Interface now (PCI 3.0) by Wildwest |
;---------------------------------------------------------------- |
;1.31: PCIDEV 13/05/2006 |
;Author: Jason Delozier <cordata51@hotmail.com> |
;Features: |
117,8 → 135,7 |
include 'macros.inc' |
include 'vendors.inc' |
include 'lang.inc' |
include 'VENDORS.INC' |
START: ; start of execution |
call draw_window |
209,7 → 226,7 |
mov ebx, 20*65536+25 ;x start, ystart of text |
mov ecx, 0x224466 ;color of text |
mov edx, dword PCIWin ;start of text buffer |
mov esi, 106 ;lenght of line |
mov esi, 106 ;lenght of line 106 |
newline: ; |
mov eax, 4 ;draw text system function |
int 0x40 ;draw the text |
224,8 → 241,8 |
shl ebx, 16 ; |
mov bx,word [Form] ;get width of window |
sub bx, 32 ;bar is 32 pixels shorter then window width |
mov ecx, 109*65536+10 ;set Ystart(109) and Height(10) of bar |
mov edx, 0xb6b6b6 ;set color of bar |
mov ecx, 119*65536+10 ;set Ystart(109) and Height(10) of bar 109 |
mov edx, 0xC0C0C0 ;set color of bar |
again: ;begin draw bar loop |
int 0x40 ;draw bar to window area |
shr ecx, 16 ;move the Ystart position to working area |
271,7 → 288,7 |
;****************************************************** |
;* Gets the PCI Versioin and Last Bus |
;* Gets the PCI Version and Last Bus |
Get_PCI_Info: |
mov eax, 62 |
xor ebx, ebx |
326,6 → 343,12 |
mov cl, 0x0a ;Register to read (Get Subclass) |
int 0x40 ;Read it |
mov byte [PCI_SubClass], al ;Save it |
; from Mario79 august 2006 |
mov eax, 62 ;PCI Sys Function |
mov cl, 0x09 ;Register to read (Get Interface) |
int 0x40 ;Read it |
mov [PCI_Interface], al ;Save it |
; |
inc byte [total] ;one more device found |
call Print_New_Device ;print device info to screen |
nextDev: |
378,9 → 401,15 |
movzx ecx,byte [PCI_Class] ;get PCI_Class |
int 0x40 ;Draw Class to screen |
and edx, 0xFFFF ;***************************************** |
or edx, 266*65536 ;X start becomes 266 |
or edx, 250*65536 ;X start becomes 250 |
movzx ecx,byte [PCI_SubClass];get sub class |
int 0x40 ;Draw Sub Class to screen |
; from Mario79 august 2006 |
and edx, 0xFFFF ;***************************************** |
or edx, 280*65536 ;X start becomes 280 |
movzx ecx, [PCI_Interface] ;get Interface |
int 0x40 |
; |
;Write Names |
movzx ebx, dx ;Set y position |
or ebx, 310*65536 ;set Xposition to 310 |
396,22 → 425,22 |
;first determine which list to find the vendor in |
mov ax, word [PCI_Vendor] |
mov ecx, 255 ;# vendors in most lists |
cmp ax,4800 ;Check if Vendor's value is less than this number |
cmp ax,4540 ;Check if Vendor's value is less than this number (the start of next part) |
jae next1 ;if it is less, let's continue, or jump to next1 |
mov edx, _FIRSTPART ;select this list |
jmp rep1 ;start searching list |
next1: ; |
cmp ax,5314 ;same thing happening here as above^ |
cmp ax,5120 ;same thing happening here as above^ |
jae next2 ; |
mov edx, _SECONDPART ; |
jmp rep1 ; |
next2: ; |
cmp ax,5574 ; |
cmp ax,5459 ; |
jae next3 ; |
mov edx, _THIRDPART ; |
jmp rep1 ; |
next3: ; |
mov ecx, 110 ;only 110 vendors in this list |
mov ecx, 222 ;only 222 vendors in this list |
mov edx, _FOURTHPART ; |
rep1: |
428,7 → 457,6 |
mov eax,4 ;OS CMD |
mov esi,50 ;Length of text |
int 0x40 ;Print the text |
;------------------------------------------------------------------ |
;------------------------------------------------------------------ |
;Get description based on Class/Subclass |
438,14 → 466,556 |
shl eax, 3 ;multiply for jump table |
mov ecx, [ClassList+eax+4] ;number of descriptions for this class |
mov edx, [ClassList+eax] ;start of description list for class |
movzx eax, byte [PCI_SubClass] ;get subclass |
mov al, byte [PCI_SubClass] ;get subclass |
; mov ah, byte [PCI_Interface] ;get subclass |
repu1: |
cmp al,byte[edx+32] ;are subclasses the same? |
je endd ;if so jump to print the description to screen |
je interface_check ;if so jump to print the description to screen |
add edx, 33 ;if not put us at start of next description |
dec ecx ;one less description in list |
jnz repu1 ;was it our last? |
mov edx,_UNKNOWND ;if so its unknown device |
jmp endd |
interface_check: |
cmp [PCI_Class], 00h |
je endd |
;//////////////////////////// |
cmp [PCI_Class], 01h |
je check01 |
jmp nextclass02 |
check01: |
cmp [PCI_SubClass], 05h |
je sc01_05 |
jmp endd |
sc01_05: |
cmp [PCI_Interface], 20h |
je sc01_05_20 |
cmp [PCI_Interface], 30h |
je sc01_05_30 |
jmp endd |
sc01_05_20: |
mov edx,ata1 ; pointer to text beginning |
jmp endd |
sc01_05_30: |
mov edx,ata2 ; pointer to text beginning |
jmp endd |
;//////////////////////////// |
nextclass02: |
cmp [PCI_Class], 02h |
je endd |
;//////////////////////////////// |
cmp [PCI_Class], 03h |
je check03 |
jmp nextclass04 |
check03: |
cmp [PCI_SubClass], 00h |
je sc03_00 |
jmp endd |
sc03_00: |
cmp [PCI_Interface], 00000000b |
je sc03_00_00000000 |
cmp [PCI_Interface], 00000001b |
je sc03_00_00000001 |
;jmp endd |
sc03_00_00000000: |
mov edx,display1 ; pointer to text beginning |
jmp endd |
sc03_00_00000001: |
mov edx,display2 ; pointer to text beginning |
jmp endd |
;/////////////////////////////// |
nextclass04: |
cmp [PCI_Class], 04h |
je endd |
cmp [PCI_Class], 05h |
je endd |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
cmp [PCI_Class], 06h |
je check06 |
jmp nextclass07 |
check06: |
cmp [PCI_SubClass], 04h |
je sc06_04 |
cmp [PCI_SubClass], 09h |
je sc06_09 |
jmp endd |
sc06_04: |
cmp [PCI_Interface], 00h |
je sc06_04_00 |
cmp [PCI_Interface], 01h |
je sc06_04_01 |
jmp endd |
sc06_04_00: |
mov edx,bridge1 ; pointer to text beginning |
jmp endd |
sc06_04_01: |
mov edx,bridge2 ; pointer to text beginning |
jmp endd |
;====================================== |
sc06_09: |
cmp [PCI_Interface], 40h |
je sc06_09_40 |
cmp [PCI_Interface], 80h |
je sc06_09_80 |
jmp endd |
sc06_09_40: |
mov edx,bridge3 ; pointer to text beginning |
jmp endd |
sc06_09_80: |
mov edx,bridge4 ; pointer to text beginning |
jmp endd |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
nextclass07: |
cmp [PCI_Class], 07h |
je check07 |
jmp nextclass08 |
check07: |
cmp [PCI_SubClass], 00h |
je sc07_00 |
cmp [PCI_SubClass], 01h |
je sc07_01 |
cmp [PCI_SubClass], 03h |
je sc07_03 |
jmp endd |
;= |
sc07_00: |
cmp [PCI_Interface], 00h |
je sc07_00_00 |
cmp [PCI_Interface], 01h |
je sc07_00_01 |
cmp [PCI_Interface], 02h |
je sc07_00_02 |
cmp [PCI_Interface], 03h |
je sc07_00_03 |
cmp [PCI_Interface], 04h |
je sc07_00_04 |
cmp [PCI_Interface], 05h |
je sc07_00_05 |
cmp [PCI_Interface], 06h |
je sc07_00_06 |
sc07_00_00: |
mov edx,communication0 ; pointer to text beginning |
jmp endd |
sc07_00_01: |
mov edx,communication1 ; pointer to text beginning |
jmp endd |
sc07_00_02: |
mov edx,communication2 ; pointer to text beginning |
jmp endd |
sc07_00_03: |
mov edx,communication3 ; pointer to text beginning |
jmp endd |
sc07_00_04: |
mov edx,communication4 ; pointer to text beginning |
jmp endd |
sc07_00_05: |
mov edx,communication5 ; pointer to text beginning |
jmp endd |
sc07_00_06: |
mov edx,communication6 ; pointer to text beginning |
jmp endd |
;= |
sc07_01: |
cmp [PCI_Interface], 00h |
je sc07_01_00 |
cmp [PCI_Interface], 01h |
je sc07_01_01 |
cmp [PCI_Interface], 02h |
je sc07_01_02 |
cmp [PCI_Interface], 03h |
je sc07_01_03 |
cmp [PCI_Interface], $FE |
je sc07_01_FE |
sc07_01_00: |
mov edx,communication7 ; pointer to text beginning |
jmp endd |
sc07_01_01: |
mov edx,communication8 ; pointer to text beginning |
jmp endd |
sc07_01_02: |
mov edx,communication9 ; pointer to text beginning |
jmp endd |
sc07_01_03: |
mov edx,communication10 ; pointer to text beginning |
jmp endd |
sc07_01_FE: |
mov edx,communication11 ; pointer to text beginning |
jmp endd |
;= |
sc07_03: |
cmp [PCI_Interface], 00h |
je sc07_03_00 |
cmp [PCI_Interface], 01h |
je sc07_03_01 |
cmp [PCI_Interface], 02h |
je sc07_03_02 |
cmp [PCI_Interface], 03h |
je sc07_03_03 |
cmp [PCI_Interface], 04h |
je sc07_03_04 |
sc07_03_00: |
mov edx,communication12 ; pointer to text beginning |
jmp endd |
sc07_03_01: |
mov edx,communication13 ; pointer to text beginning |
jmp endd |
sc07_03_02: |
mov edx,communication14 ; pointer to text beginning |
jmp endd |
sc07_03_03: |
mov edx,communication15 ; pointer to text beginning |
jmp endd |
sc07_03_04: |
mov edx,communication16 ; pointer to text beginning |
jmp endd |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
nextclass08: |
cmp [PCI_Class], 08h |
je check08 |
jmp nextclass09 |
check08: |
cmp [PCI_SubClass], 00h |
je sc08_00 |
cmp [PCI_SubClass], 01h |
je sc08_01 |
cmp [PCI_SubClass], 02h |
je sc08_02 |
cmp [PCI_SubClass], 03h |
je sc08_03 |
jmp endd |
;-- |
sc08_00: |
cmp [PCI_Interface], 00h |
je sc08_00_00 |
cmp [PCI_Interface], 01h |
je sc08_00_01 |
cmp [PCI_Interface], 02h |
je sc08_00_02 |
cmp [PCI_Interface], 10h |
je sc08_00_10 |
cmp [PCI_Interface], 20h |
je sc08_00_20 |
jmp endd |
sc08_00_00: |
mov edx,system0 ; pointer to text beginning |
jmp endd |
sc08_00_01: |
mov edx,system1 ; pointer to text beginning |
jmp endd |
sc08_00_02: |
mov edx,system2 ; pointer to text beginning |
jmp endd |
sc08_00_10: |
mov edx,system3 ; pointer to text beginning |
jmp endd |
sc08_00_20: |
mov edx,system4 ; pointer to text beginning |
jmp endd |
;-- |
sc08_01: |
cmp [PCI_Interface], 00h |
je sc08_01_00 |
cmp [PCI_Interface], 01h |
je sc08_01_01 |
cmp [PCI_Interface], 02h |
je sc08_01_02 |
jmp endd |
sc08_01_00: |
mov edx,system5 ; pointer to text beginning |
jmp endd |
sc08_01_01: |
mov edx,system6 ; pointer to text beginning |
jmp endd |
sc08_01_02: |
mov edx,system7 ; pointer to text beginning |
jmp endd |
;-- |
sc08_02: |
cmp [PCI_Interface], 00h |
je sc08_02_00 |
cmp [PCI_Interface], 01h |
je sc08_02_01 |
cmp [PCI_Interface], 02h |
je sc08_02_02 |
jmp endd |
sc08_02_00: |
mov edx,system8 ; pointer to text beginning |
jmp endd |
sc08_02_01: |
mov edx,system9 ; pointer to text beginning |
jmp endd |
sc08_02_02: |
mov edx,system10 ; pointer to text beginning |
jmp endd |
;-- |
sc08_03: |
cmp [PCI_Interface], 00h |
je sc08_03_00 |
cmp [PCI_Interface], 01h |
je sc08_03_01 |
jmp endd |
sc08_03_00: |
mov edx,system11 ; pointer to text beginning |
jmp endd |
sc08_03_01: |
mov edx,system12 ; pointer to text beginning |
jmp endd |
;-- |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
nextclass09: |
cmp [PCI_Class], 09h |
je check09 |
jmp nextclass0A |
check09: |
cmp [PCI_SubClass], 04h |
je sc09_04 |
jmp endd |
sc09_04: |
cmp [PCI_Interface], 00h |
je sc09_04_00 |
cmp [PCI_Interface], 10h |
je sc09_04_10 |
jmp endd |
sc09_04_00: |
mov edx,gameport1 ; pointer to text beginning |
jmp endd |
sc09_04_10: |
mov edx,gameport2 ; pointer to text beginning |
jmp endd |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
nextclass0A: |
cmp [PCI_Class], 0Ah |
je endd |
cmp [PCI_Class], 0Bh |
je endd |
;============================================ |
cmp [PCI_Class], 0Ch |
je check0C |
jmp nextclass0D |
check0C: |
cmp [PCI_SubClass], 00h |
je sc0C_00 |
cmp [PCI_SubClass], 03h |
je sc0C_03 |
cmp [PCI_SubClass], 07h |
je sc0C_07 |
jmp endd |
;;;;;;;;;;; |
sc0C_00: |
cmp [PCI_Interface], 00h |
je sc0C_00_00 |
cmp [PCI_Interface], 10h |
je sc0C_00_10 |
sc0C_00_00: |
mov edx,serialbus6 ; pointer to text beginning |
jmp endd |
sc0C_00_10: |
mov edx,serialbus7 ; pointer to text beginning |
jmp endd |
;;;;;;;;;;;;;;;;;;; |
sc0C_03: |
cmp [PCI_Interface], 00h |
je sc0C_03_00 |
cmp [PCI_Interface], 10h |
je sc0C_03_10 |
cmp [PCI_Interface], 20h |
je sc0C_03_20 |
cmp [PCI_Interface], 80h |
je sc0C_03_80 |
cmp [PCI_Interface], $FE |
je sc0C_03_FE |
;jmp endd |
sc0C_03_00: |
mov edx,serialbus1 ; pointer to text beginning |
jmp endd |
sc0C_03_10: |
mov edx,serialbus2 ; pointer to text beginning |
jmp endd |
sc0C_03_20: |
mov edx,serialbus3 ; pointer to text beginning |
jmp endd |
sc0C_03_80: |
mov edx,serialbus4 ; pointer to text beginning |
jmp endd |
sc0C_03_FE: |
mov edx,serialbus5 ; pointer to text beginning |
jmp endd |
;;;;;;;;;;; |
sc0C_07: |
cmp [PCI_Interface], 00h |
je sc0C_07_00 |
cmp [PCI_Interface], 01h |
je sc0C_07_01 |
cmp [PCI_Interface], 02h |
je sc0C_07_02 |
sc0C_07_00: |
mov edx,serialbus8 ; pointer to text beginning |
jmp endd |
sc0C_07_01: |
mov edx,serialbus9 ; pointer to text beginning |
jmp endd |
sc0C_07_02: |
mov edx,serialbus10 ; pointer to text beginning |
jmp endd |
;;;;;;;;;;;;;;;;;;; |
;============================================== |
nextclass0D: |
cmp [PCI_Class], 0Dh |
je endd |
;;;;;;;;;;;;;;;;;;;;;;;;;; |
cmp [PCI_Class], 0Eh |
je check0E |
jmp nextclass0F |
check0E: |
cmp [PCI_SubClass], 00h |
je sc0E_00 |
jmp endd |
sc0E_00: |
cmp [PCI_Interface], 00h |
je sc0E_00_00 |
cmp [PCI_Interface], 00h ;!!! |
ja sc0E_00_xx |
jmp endd |
sc0E_00_00: |
mov edx,i2o1 ; pointer to text beginning |
jmp endd |
sc0E_00_xx: |
mov edx,i2o2 ; pointer to text beginning |
jmp endd |
;//////////////////////////// |
nextclass0F: |
cmp [PCI_Class], 0Fh |
je endd |
cmp [PCI_Class], 10h |
je endd |
cmp [PCI_Class], 11h |
je endd |
endd: |
and ebx, 0x0000FFFF ;clear X position |
or ebx, 0x02300000 ;set X position to 560 pixels |
471,30 → 1041,226 |
; DATA AREA |
labelt: |
db 'PCI Device Enumeration v 1.31 by J. Delozier, S. Kuzmin and V. Hanla' |
db 'PCI Device Enumeration v 2.0 by J. Delozier, S. Kuzmin, V. Hanla, M. Zakiyanov' |
labellen: |
if lang eq de |
ata1: |
db 'Storage - ATA c. w/ single DMA ' |
ata1len: |
ata2: |
db 'Storage - ATA c. w/ chained DMA ' |
ata2len: |
display1: |
db 'Display - VGA-compatible c. ' |
display1len: |
display2: |
db 'Display - 8514-compatible c. ' |
display2len: |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
serialbus1: |
db 'Serial Bus - USB Universal HC ' |
serialbus1len: |
serialbus2: |
db 'Serial Bus - USB Open HC ' |
serialbus2len: |
serialbus3: |
db 'Serial Bus - USB2 Enhanced HC ' |
serialbus3len: |
serialbus4: |
db 'Serial Bus - USB w/o specific PI' |
serialbus4len: |
serialbus5: |
db 'Serial Bus - USB device (not HC)' |
serialbus5len: |
serialbus6: |
db 'Serial Bus - IEEE 1394(FireWire)' |
serialbus6len: |
serialbus7: |
db 'Serial Bus- IEEE 1394(Open HCI) ' |
serialbus7len: |
serialbus8: |
db 'Serial Bus - IPMI SMIC I. ' |
serialbus8len: |
serialbus9: |
db 'Serial Bus - IPMI Kybd CSI ' |
serialbus9len: |
serialbus10: |
db 'Serial Bus - IPMI BTI ' |
serialbus10len: |
;;;;;;;;;;;;;;;;;;;;;;; |
bridge1: |
db 'Bridge - PCI/PCI ' |
bridge1len: |
bridge2: |
db 'Bridge - Subtract.Decode PCI/PCI' |
bridge2len: |
bridge3: |
db 'Bridge - Semi-transp. PCI/PCI 1 ' |
bridge3len: |
bridge4: |
db 'Bridge - Semi-transp. PCI/PCI 2 ' |
bridge4len: |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
gameport1: |
db 'Input - Gameport c. (generic) ' |
gameport1len: |
gameport2: |
db 'Input - Gameport c. (legacy) ' |
gameport2len: |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
i2o1: |
db 'Intelligent I/O - I/O c. (I2O 1)' |
i2o1len: |
i2o2: |
db 'Intelligent I/O - c.(FIFO @ 40h)' |
i2o2len: |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
communication0: |
db 'Communication - Serial (XT) ' |
communication0len: |
communication1: |
db 'Communication - Serial c.(16450)' |
communication1len: |
communication2: |
db 'Communication - Serial c.(16550)' |
communication2len: |
communication3: |
db 'Communication - Serial c.(16650)' |
communication3len: |
communication4: |
db 'Communication - Serial c.(16750)' |
communication4len: |
communication5: |
db 'Communication - Serial c.(16850)' |
communication5len: |
communication6: |
db 'Communication - Serial c.(16950)' |
communication6len: |
;------------------------------- |
communication7: |
db 'Communication - Parallel port ' |
communication7len: |
communication8: |
db 'Communication - Bi-dir. par.port' |
communication8len: |
communication9: |
db 'Communication - ECP 1.X par.port' |
communication9len: |
communication10: |
db 'Communication - IEEE1284 c. ' |
communication10len: |
communication11: |
db 'Communication - IEEE1284 device ' |
communication11len: |
;------------------------------- |
communication12: |
db 'Communication - Generic modem ' |
communication12len: |
communication13: |
db 'Communication -Hayes modem 16450' |
communication13len: |
communication14: |
db 'Communication -Hayes modem 16550' |
communication14len: |
communication15: |
db 'Communication -Hayes modem 16650' |
communication15len: |
communication16: |
db 'Communication -Hayes modem 16750' |
communication16len: |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
system0: |
db 'System - Generic 8259 PIC ' |
system0len: |
system1: |
db 'System - ISA PIC ' |
system1len: |
system2: |
db 'System - EISA PIC ' |
system2len: |
system3: |
db 'System - I/O APIC interrupt c. ' |
system3len: |
system4: |
db 'System - I/O(x) APIC interrupt c' |
system4len: |
;- |
system5: |
db 'System - Generic 8237 DMA c. ' |
system5len: |
system6: |
db 'System - ISA DMA c. ' |
system6len: |
system7: |
db 'System - EISA DMA c. ' |
system7len: |
;-- |
system8: |
db 'System - 8254 system timer ' |
system8len: |
system9: |
db 'System - ISA system timer ' |
system9len: |
system10: |
db 'System - EISA (2 system timers) ' |
system10len: |
;-- |
system11: |
db 'System - Generic RTC c. ' |
system11len: |
system12: |
db 'System - ISA RTC c. ' |
system12len: |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
PCIWin: |
db 'Im Einstellungsmenue muss der PCI Zugriff eingeschaltet sein. ' |
db ' ' |
db ' ' |
db ' ' |
db 'PCI Version = ' |
db ' ' |
db 'Letzter PCI Bus = ' |
db ' ' |
db 'Anzahl von Geraeten = ' |
db ' ' |
db ' ' |
db ' ' |
db 'VenID DevID Bus# Dev# Fnc Rev Class Subclass Herste' |
db 'ller Beschreibung ' |
db '----- ----- ---- ---- --- --- ----- -------- --------------------' |
db '---------------------- ----------------' |
db 'x' |
else |
PCIWin: |
db 'Please remember to enable PCI Access to Applications in Setup Menu.' |
db ' ' |
db ' ' |
503,17 → 1269,19 |
db ' ' |
db 'Last PCI Bus = ' |
db ' ' |
db 'Number of devices = ' |
db 'Quantity of devices = ' |
db ' ' |
db ' ' |
db ' ' |
db 'VenID DevID Bus# Dev# Fnc Rev Class Subclass Comp' |
db 'VenID DevID Bus# Dev# Fnc Rev Class Subclass/ Comp' |
db 'any Description ' |
db ' Interface ' |
db ' ' |
db '----- ----- ---- ---- --- --- ----- -------- --------------------' |
db '---------------------- ----------------' |
db 'x' |
end if |
; |
total db 0 |
V_Bus db 0 |
527,8 → 1295,8 |
PCI_Rev db 0 |
PCI_Class db 0 |
PCI_SubClass db 0 |
PCI_Interface db 0 |
Proc_Info: |
times 1024 db 0 |
/programs/system/pcidev/trunk/macros.inc |
---|
123,8 → 123,10 |
end if |
} |
macro __mov reg,a { ; mike.dld |
if ~a eq |
macro __mov reg,a,b { ; mike.dld |
if (~a eq)&(~b eq) |
mpack reg,a,b |
else if (~a eq)&(b eq) |
mov reg,a |
end if |
} |
141,11 → 143,6 |
; language for programs |
lang fix ru ; ru en fr ge fi |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
177,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
221,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
/programs/system/pcidev/trunk/vendors.inc |
---|
1,3 → 1,17 |
;WriteTextToWindow |
macro Text xStart,yStart,rgbColor,pText,nTextLen |
{ |
mov ebx,xStart |
shl ebx,16 |
add ebx,yStart |
mov ecx,rgbColor |
mov edx,pText |
mov esi,nTextLen |
mov eax,4 |
int 0x40 |
} |
; AUTHOR: Victor Alberto Gil Hancco Laquita <vhanla@gmail.com> |
; This list might content mistakes, plz report it |
; There are 865 Lists of Vendors' Names |
9,10 → 23,13 |
; changed 11/05/2006: + 3 vendors and no more label 'PREVIOUSVERSIONLIST' |
; so the total quantity of vendors is 875 now (changes by Sergey Kuzmin) |
; changed 16/08/2006: + 122 vendors |
; so the total quantity of vendors is 987 now (changes by Sergey Kuzmin) |
_FIRSTPART: ;lists the 255 Vendor IDs |
db 'PARADYNE CORP. ' |
dw 51 ; 0x0033 |
db 'REAL 3D ' |
db 'Lockheed Martin Corp ' |
dw 61 ; 0x003D |
db 'NCIPHER CORP. LTD ' |
dw 256 ; 0x0100 |
26,19 → 43,31 |
dw 4097 ; 0x1001 |
db 'ATI TECHNOLOGIES INC ' |
dw 4098 ; 0x1002 |
db 'ULSI ' |
dw 4099 ; 0x1003 |
db 'VLSI TECHNOLOGY INC ' |
dw 4100 ; 0x1004 |
db 'NATIONAL SEMICONDUCTOR CORPORATION ' |
dw 4107 ; 0x100B |
db 'Tseng Labs ' |
dw 4108 ; 0x100C |
db 'Weitek ' |
dw 4110 ; 0x100E |
db 'VIDEO LOGIC LTD ' |
dw 4112 ; 0x1010 |
db 'Digital Equipment Corporation ' |
dw 4113 ; 0x1011 |
db 'Cirrus Logic ' |
dw 4115 ; 0x1013 |
db 'IBM ' |
dw 4116 ; 0x1014 |
db 'Spea Software AG ' |
dw 4119 ; 0x1017 |
db 'UNISYS CORPORATION ' |
dw 4120 ; 0x1018 |
db 'ELITEGROUP COMPUTER SYS ' |
dw 4121 ; 0x1019 |
db 'NCR ' |
db 'NCR Corporation ' |
dw 4122 ; 0x101A |
db 'AMERICAN MEGATRENDS ' |
dw 4126 ; 0x101E |
50,6 → 79,8 |
dw 4130 ; 0x1022 |
db 'TRIDENT MICROSYSTEMS ' |
dw 4131 ; 0x1023 |
db 'Acer Incorporated ' |
dw 4133 ; 0x1025 |
db 'DELL COMPUTER CORPORATION ' |
dw 4136 ; 0x1028 |
db 'LSI LOGIC CORPORATION ' |
56,14 → 87,24 |
dw 4138 ; 0x102A |
db 'MATROX GRAPHICS ' |
dw 4139 ; 0x102B |
db 'Asiliant (Chips And Technologies) ' |
dw 4140 ; 0x102C |
db 'Wyse Technologies ' |
dw 4141 ; 0x102D |
db 'TOSHIBA AMERICA ' |
dw 4143 ; 0x102F |
db 'miro Computer Products AG ' |
dw 4145 ; 0x1031 |
db 'NEC CORPORATION ' |
dw 4147 ; 0x1033 |
db 'Future Domain ' |
dw 4150 ; 0x1036 |
db 'AMP ' |
dw 4152 ; 0x1038 |
db 'SILICON INTEGRATED SYSTEMS ' |
dw 4153 ; 0x1039 |
db 'Hewlett-Packard Company ' |
dw 4156 ; 0x103C |
db 'SYNOPSYS/LOGIC MODELING GROUP ' |
dw 4159 ; 0x103F |
db 'Micron Electronics ' |
78,21 → 119,31 |
dw 4168 ; 0x1048 |
db 'FOUNTAIN TECHNOLOGIES ' |
dw 4169 ; 0x1049 |
db 'STMicroelectronics ' |
dw 4170 ; 0x104A |
db 'TEXAS INSTRUMENTS ' |
dw 4172 ; 0x104C |
db 'SONY CORPORATION ' |
dw 4173 ; 0x104D |
db 'Oak Technology ' |
dw 4174 ; 0x104E |
db 'Co-Time Computer Ltd. ' |
dw 4175 ; 0x104F |
db 'WINBOND ELECTRONICS CORP ' |
dw 4176 ; 0x1050 |
db 'Anigma Corp. ' |
dw 4177 ; 0x1051 |
db 'HITACHI ' |
dw 4180 ; 0x1054 |
db 'Standard Microsystems Corp. ' |
dw 4181 ; 0x1055 |
db 'Motorola ' |
dw 4183 ; 0x1057 |
db 'ETRI ' |
dw 4184 ; 0x1058 |
db 'TEKNOR INDUSTRIAL COMPUTERS INC ' |
dw 4185 ; 0x1059 |
db 'PROMISE TECHNOLOGY. ' |
db 'PROMISE TECHNOLOGY ' |
dw 4186 ; 0x105A |
db 'FOXCONN INTERNATIONAL INC ' |
dw 4187 ; 0x105B |
100,10 → 151,18 |
dw 4189 ; 0x105D |
db 'INFOTRONIC AMERICA INC ' |
dw 4191 ; 0x105F |
db 'United Microelectronics ' |
dw 4192 ; 0x1060 |
db '8x8 Inc. ' |
dw 4193 ; 0x1061 |
db 'OCEAN MANUFACTURING LTD ' |
dw 4195 ; 0x1063 |
db 'ALCATEL ' |
dw 4196 ; 0x1064 |
db 'Texas Microsystems ' |
dw 4197 ; 0x1065 |
db 'Picopower Technology ' |
dw 4198 ; 0x1066 |
db 'MITSUBISHI ELECTRIC AMERICA ' |
dw 4199 ; 0x1067 |
db 'DIVERSIFIED TECHNOLOGY ' |
112,6 → 171,8 |
dw 4201 ; 0x1069 |
db 'APPLE COMPUTER INC. ' |
dw 4203 ; 0x106B |
db 'Hyundai Electronics America ' |
dw 4204 ; 0x106C |
db 'SEQUENT COMPUTER SYSTEMS ' |
dw 4205 ; 0x106D |
db 'DAEWOO TELECOM LTD ' |
120,24 → 181,54 |
dw 4209 ; 0x1071 |
db 'YAMAHA CORPORATION ' |
dw 4211 ; 0x1073 |
db 'Nexgen Microsystems ' |
dw 4212 ; 0x1074 |
db 'Chaintech Comp. ' |
dw 4214 ; 0x1076 |
db 'QLOGIC ' |
db 'QLOGIC Corporation ' |
dw 4215 ; 0x1077 |
db 'Cyrix Corporation ' |
dw 4216 ; 0x1078 |
db 'I-BUS ' |
dw 4217 ; 0x1079 |
db 'GATEWAY 2000 ' |
dw 4219 ; 0x107B |
db 'Leadtek Research ' |
dw 4221 ; 0x107D |
db 'INTERPHASE CORPORATION ' |
dw 4222 ; 0x107E |
db 'Data Technology Corporation ' |
dw 4223 ; 0x107F |
db 'Cypress Semiconductor ' |
dw 4224 ; 0x1080 |
db 'Radius Inc. ' |
dw 4225 ; 0x1081 |
db 'Forex Computer Corporation ' |
dw 4227 ; 0x1083 |
db 'Tulip Computers International BV ' |
dw 4229 ; 0x1085 |
db 'Cache Computer ' |
dw 4231 ; 0x1087 |
db 'SBS Operations ' |
dw 4234 ; 0x108A |
db 'OLICOM ' |
dw 4237 ; 0x108D |
db 'Sun Microsystems ' |
dw 4238 ; 0x108E |
db 'Intergraph Corporation ' |
dw 4241 ; 0x1091 |
db 'Diamond Computer Systems ' |
dw 4242 ; 0x1092 |
db 'National Instruments ' |
dw 4243 ; 0x1093 |
db 'SILICON IMAGE (WAS CMD TECHNOLOGY INC) ' |
dw 4245 ; 0x1095 |
db 'ALACRON ' |
dw 4246 ; 0x1096 |
db 'APPIAN/ETMA ' |
db 'APPIAN Graphics/ETMA ' |
dw 4247 ; 0x1097 |
db 'Quantum Designs Ltd. ' |
dw 4248 ; 0x1098 |
db 'PACKARD BELL NEC ' |
dw 4250 ; 0x109A |
db 'BROOKTREE CORPORATION ' |
148,10 → 239,16 |
dw 4256 ; 0x10A0 |
db 'QUANTUM EFFECT DESIGN ' |
dw 4258 ; 0x10A2 |
db 'Globe Manufacturing Sales ' |
dw 4260 ; 0x10A4 |
db 'Sierra Semiconductor ' |
dw 4264 ; 0x10A8 |
db 'SILICON GRAPHICS ' |
dw 4265 ; 0x10A9 |
db 'HONEYWELL IAC ' |
dw 4268 ; 0x10AC |
db 'Winbond Systems Labs ' |
dw 4269 ; 0x10AD |
db 'MICRO COMPUTER SYSTEMS INC ' |
dw 4271 ; 0x10AF |
db 'PLX TECHNOLOGY. ' |
160,12 → 257,20 |
dw 4278 ; 0x10B6 |
db '3COM Corp, Networking Division ' |
dw 4279 ; 0x10B7 |
db 'Standard Microsystems Corporation ' |
dw 4280 ; 0x10B8 |
db 'ACER LABS Incorp. ' |
dw 4281 ; 0x10B9 |
db 'MITSUBISHI ELECTRIC CORP. ' |
dw 4282 ; 0x10BA |
db 'Surecom Technology ' |
dw 4285 ; 0x10BD |
db 'AUSPEX SYSTEMS INC. ' |
dw 4290 ; 0x10C2 |
db 'Samsung Semiconductors ' |
dw 4291 ; 0x10C3 |
db 'Award Software International Inc. ' |
dw 4292 ; 0x10C4 |
db 'NEOMAGIC CORPORATION ' |
dw 4296 ; 0x10C8 |
db 'FUJITSU MICROELECTRONIC ' |
180,8 → 285,12 |
dw 4305 ; 0x10D1 |
db 'MOLEX INCORPORATED ' |
dw 4306 ; 0x10D2 |
db 'Macronix International Co. Ltd. ' |
dw 4313 ; 0x10D9 |
db 'ROHM LSI SYSTEMS ' |
dw 4315 ; 0x10DB |
db 'CERN-European Lab. for Particle Physics ' |
dw 4316 ; 0x10DC |
db 'EVANS & SUTHERLAND ' |
dw 4317 ; 0x10DD |
db 'NVIDIA CORPORATION ' |
194,17 → 303,35 |
dw 4323 ; 0x10E3 |
db 'MICRO INDUSTRIES CORPORATION ' |
dw 4325 ; 0x10E5 |
db 'Applied Micro Circuits Corp. ' |
dw 4328 ; 0x10E8 |
db 'Tvia, Inc. ' |
dw 4330 ; 0x10EA |
db 'Artist Graphics ' |
dw 4331 ; 0x10EB |
db 'REALTEK SEMICONDUCTOR CORP. ' |
dw 4332 ; 0x10EC |
db 'XILINX. ' |
db 'Ascii Corporation ' |
dw 4333 ; 0x10ED |
db 'XILINX ' |
dw 4334 ; 0x10EE |
db 'Racore Computer Products ' |
dw 4335 ; 0x10EF |
db 'Curtiss-Wright Controls Embedded Computing ' |
dw 4336 ; 0x10F0 |
db 'TYAN COMPUTER ' |
dw 4337 ; 0x10F1 |
db 'S-Mos Systems ' |
dw 4340 ; 0x10F4 |
db 'NKK CORPORATION ' |
dw 4341 ; 0x10F5 |
db 'CREATIVE ELECTRONIC SYSTEMS SA ' |
dw 4342 ; 0x10F6 |
db 'I-O DATA DEVICE. ' |
db 'Truevision ' |
dw 4346 ; 0x10FA |
db 'Thesys Microelectronics ' |
dw 4347 ; 0x10FB |
db 'I-O DATA DEVICE ' |
dw 4348 ; 0x10FC |
db 'FAST MULTIMEDIA AG ' |
dw 4350 ; 0x10FE |
216,19 → 343,27 |
dw 4357 ; 0x1105 |
db 'VIA TECHNOLOGIES ' |
dw 4358 ; 0x1106 |
db 'ASCEND COMMUNICATIONS ' |
db 'ASCEND COMMUNICATIONS/Stratus Computer ' |
dw 4359 ; 0x1107 |
db 'Proteon Inc. ' |
dw 4360 ; 0x1108 |
db 'Adaptec/Cogent Data Technologies Inc ' |
dw 4361 ; 0x1109 |
db 'SIEMENS PC SYSTEME GMBH ' |
dw 4362 ; 0x110A |
db 'Chromatic Research Inc ' |
dw 4363 ; 0x110B |
db 'SANTA CRUZ OPERATION ' |
dw 4369 ; 0x1111 |
db 'Osicom Technologies Inc. ' |
dw 4370 ; 0x1112 |
db 'ACCTON TECHNOLOGY ' |
dw 4371 ; 0x1113 |
db 'MEDIA 100 ' |
db 'Atmel Corp. ' |
dw 4372 ; 0x1114 |
db 'Media 100, Inc. ' |
dw 4374 ; 0x1116 |
db 'DATACUBE ' |
db 'Datacube Inc. ' |
dw 4375 ; 0x1117 |
db 'FCI ELECTRONICS ' |
dw 4376 ; 0x1118 |
236,8 → 371,12 |
dw 4377 ; 0x1119 |
db 'EFFICIENT NETWORKS ' |
dw 4378 ; 0x111A |
db 'Tricord Systems Inc. ' |
dw 4380 ; 0x111C |
db 'INTEGRATED DEVICE TECH ' |
dw 4381 ; 0x111D |
db 'Precision Digital Images ' |
dw 4383 ; 0x111F |
db 'EMC CORPORATION ' |
dw 4384 ; 0x1120 |
db 'FORE SYSTEMS INC ' |
244,6 → 383,8 |
dw 4391 ; 0x1127 |
db 'HERMES ELECTRONICS COMPANY ' |
dw 4394 ; 0x112A |
db 'Infomedia ' |
dw 4398 ; 0x112E |
db 'IMAGING TECHNOLOGY ' |
dw 4399 ; 0x112F |
db 'PHILIPS SEMICONDUCTORS ' |
250,7 → 391,7 |
dw 4401 ; 0x1131 |
db 'MITEL CORP ' |
dw 4402 ; 0x1132 |
db 'EICON TECHNOLOGY CORPORATION ' |
db 'Eicon Networks Corporation ' |
dw 4403 ; 0x1133 |
db 'MERCURY COMPUTER SYSTEMS ' |
dw 4404 ; 0x1134 |
266,14 → 407,24 |
dw 4412 ; 0x113C |
db 'SANYO ELECTRIC CO-Information Systems Division ' |
dw 4414 ; 0x113E |
db 'Equinox Systems ' |
dw 4415 ; 0x113F |
db 'CREST MICROSYSTEM INC. ' |
dw 4417 ; 0x1141 |
db 'Alliance Semiconductor CA - USA ' |
dw 4418 ; 0x1142 |
db 'Cincinnati Milacron ' |
dw 4420 ; 0x1144 |
db 'WORKBIT CORPORATION ' |
dw 4421 ; 0x1145 |
db 'FORCE COMPUTERS GMBH ' |
dw 4422 ; 0x1146 |
db 'SYSKONNECT ' |
db 'Interface Corp ' |
dw 4423 ; 0x1147 |
db 'SYSKONNECT/Marvell ' |
dw 4424 ; 0x1148 |
db 'VMIC ' |
dw 4426 ; 0x114A |
db 'ANNABOOKS ' |
dw 4428 ; 0x114C |
db 'DIGI INTERNATIONAL ' |
280,6 → 431,12 |
dw 4431 ; 0x114F |
db 'MELCO INC ' |
dw 4436 ; 0x1154 |
db 'Pine Technology Ltd ' |
dw 4437 ; 0x1155 |
db 'Voarx R&D Inc ' |
dw 4440 ; 0x1158 |
db 'Mutech ' |
dw 4441 ; 0x1159 |
db 'PHOTRON LTD. ' |
dw 4444 ; 0x115C |
db 'XIRCOM ' |
288,8 → 445,14 |
dw 4449 ; 0x1161 |
db 'RENDITION ' |
dw 4451 ; 0x1163 |
db 'Reliance Computer ' |
db 'Imagraph Corporation ' |
dw 4453 ; 0x1165 |
db 'Reliance Computer Corp./ServerWorks ' |
dw 4454 ; 0x1166 |
db 'Centre f/Dev. of Adv. Computing ' |
dw 4457 ; 0x1169 |
db 'Polaris Communications ' |
dw 4458 ; 0x116A |
db 'ELECTRONICS FOR IMAGING ' |
dw 4462 ; 0x116E |
db 'INVENTEC CORPORATION ' |
298,10 → 461,20 |
dw 4465 ; 0x1171 |
db 'ALTERA CORPORATION ' |
dw 4466 ; 0x1172 |
db 'SBE ' |
dw 4470 ; 0x1176 |
db 'Alfa Inc ' |
dw 4472 ; 0x1178 |
db 'TOSHIBA AMERICA INFO SYSTEMS ' |
dw 4473 ; 0x1179 |
db 'GCE-8320B ' |
dw 4475 ; 0x117B |
db 'T/R Systems ' |
dw 4478 ; 0x117E |
db 'RICOH CO LTD ' |
dw 4480 ; 0x1180 |
db 'Dataworld ' |
dw 4485 ; 0x1185 |
db 'D-LINK SYSTEM INC ' |
dw 4486 ; 0x1186 |
db 'ADVANCED TECHNOLOGY LABORATORIES ' |
310,14 → 483,26 |
dw 4489 ; 0x1189 |
db 'PLATYPUS TECHNOLOGY PTY LTD ' |
dw 4491 ; 0x118B |
db 'COROLLARY ' |
db 'Corollary Inc ' |
dw 4492 ; 0x118C |
db 'BitFlow Inc ' |
dw 4493 ; 0x118D |
db 'Hermstedt AG ' |
dw 4494 ; 0x118E |
db 'Tripace ' |
dw 4496 ; 0x1190 |
db 'ACARD TECHNOLOGY ' |
dw 4497 ; 0x1191 |
db 'RATOC SYSTEMS INC ' |
dw 4501 ; 0x1195 |
db 'Gage Applied Technologies ' |
dw 4503 ; 0x1197 |
db 'Attachmate Corp. ' |
dw 4505 ; 0x1199 |
db 'MINDSHARE. ' |
dw 4506 ; 0x119A |
db 'Omega Micro Inc. ' |
dw 4507 ; 0x119B |
db 'BUG. ' |
dw 4509 ; 0x119D |
db 'FUJITSU MICROELECTRONICS LTD. ' |
326,11 → 511,13 |
dw 4511 ; 0x119F |
db 'HAMAMATSU PHOTONICS K.K. ' |
dw 4513 ; 0x11A1 |
db 'INNOSYS ' |
db 'Systech Corp. ' |
dw 4520 ; 0x11A8 |
db 'InnoSys Inc. ' |
dw 4521 ; 0x11A9 |
db 'ACTEL ' |
dw 4522 ; 0x11AA |
db 'GALILEO TECHNOLOGY LTD. ' |
db 'GALILEO TECHNOLOGY LTD/Marvell Semiconductor, Inc.' |
dw 4523 ; 0x11AB |
db 'LITE-ON COMMUNICATIONS INC ' |
dw 4525 ; 0x11AD |
338,12 → 525,23 |
dw 4526 ; 0x11AE |
db 'AVID TECHNOLOGY INC ' |
dw 4527 ; 0x11AF |
db 'V3 SEMICONDUCTOR INC. ' |
db 'V3 SEMICONDUCTOR INC./Quicklogic Corp ' |
dw 4528 ; 0x11B0 |
db 'EASTMAN KODAK ' |
dw 4530 ; 0x11B2 |
db 'BARR SYSTEMS INC. ' |
dw 4531 ; 0x11B3 |
db 'Radstone Technology Ltd. ' |
dw 4533 ; 0x11B5 |
db 'Xpoint Technologies Inc ' |
dw 4536 ; 0x11B8 |
db 'Pathlight Technology Inc. ' |
dw 4537 ; 0x11B9 |
_SECONDPART: ;lists 255 Vendors |
db 'Network Peripherals Inc ' |
dw 4540 ; 0x11BC |
db 'Pinnacle Systems Inc. ' |
dw 4541 ; 0x11BD |
db 'ASTRODESIGN ' |
dw 4543 ; 0x11BF |
db 'AGERE/LUCENT ' |
358,22 → 556,26 |
dw 4554 ; 0x11CA |
db 'SPECIALIX INTERNATIONAL LTD ' |
dw 4555 ; 0x11CB |
db 'NETACCESS ' |
db 'NETACCESS/Primary Rate Inc ' |
dw 4558 ; 0x11CE |
db 'LOCKHEED MARTIN-Electronics & Communications ' |
dw 4560 ; 0x11D0 |
db 'AURAVISION ' |
db 'AuraVision Corporation ' |
dw 4561 ; 0x11D1 |
db 'INTERCOM INC. ' |
dw 4562 ; 0x11D2 |
db 'ANALOG DEVICES ' |
db 'Analog Devices, Inc. ' |
dw 4564 ; 0x11D4 |
db 'IKON CORPORATION ' |
db 'IKON CORPORATION/Tahoma Technology ' |
dw 4565 ; 0x11D5 |
db 'TOSHIBA TEC CORPORATION ' |
dw 4569 ; 0x11D9 |
db 'NOVELL ' |
dw 4570 ; 0x11DA |
db 'Sega Enterprises Ltd ' |
dw 4571 ; 0x11DB |
db 'Zoran Corporation ' |
dw 4574 ; 0x11DE |
db 'NEW WAVE PDG ' |
dw 4575 ; 0x11DF |
db 'QUICKLOGIC CORPORATION ' |
382,12 → 584,28 |
dw 4588 ; 0x11EC |
db 'DOME IMAGING SYSTEMS INC ' |
dw 4590 ; 0x11EE |
db 'Compu-Shack GmbH ' |
dw 4592 ; 0x11F0 |
db 'Kinetic Systems Corporation ' |
dw 4596 ; 0x11F4 |
db 'Powermatic Data Systems Ltd ' |
dw 4598 ; 0x11F6 |
db 'PMC-SIERRA INC ' |
dw 4600 ; 0x11F8 |
db 'Comtrol Corp ' |
dw 4606 ; 0x11FE |
db 'Network General Corp ' |
dw 4610 ; 0x1202 |
db 'AGFA CORPORATION ' |
dw 4611 ; 0x1203 |
db 'AMDAHL CORPORATION ' |
dw 4614 ; 0x1206 |
db 'Parsytec GmbH ' |
dw 4616 ; 0x1208 |
db 'Sci Systems Inc ' |
dw 4617 ; 0x1209 |
db 'Cyclades Corporation ' |
dw 4622 ; 0x120E |
db 'ESSENTIAL COMMUNICATIONS ' |
dw 4623 ; 0x120F |
db 'PERFORMANCE TECHNOLOGIES. ' |
400,31 → 618,55 |
dw 4634 ; 0x121A |
db 'VIRATA LTD ' |
dw 4635 ; 0x121B |
db 'Ariel Corporation ' |
dw 4640 ; 0x1220 |
db 'CONTEC CO. LTD ' |
dw 4641 ; 0x1221 |
db 'ARTESYN COMMUNICATIONS PRODUCTS INC ' |
dw 4643 ; 0x1223 |
db 'Interactive Images ' |
dw 4644 ; 0x1224 |
db 'TECH-SOURCE ' |
dw 4647 ; 0x1227 |
db 'SICAN GMBH ' |
dw 4652 ; 0x122C |
db 'Aztech System Ltd ' |
dw 4653 ; 0x122D |
db 'MARCONI COMMUNICATIONS LTD ' |
dw 4658 ; 0x1232 |
db 'Sigma Designs, Inc ' |
dw 4662 ; 0x1236 |
db 'Solitron Technologies Inc. ' |
dw 4684 ; 0x124C |
db 'Stallion Technologies ' |
dw 4665 ; 0x124D |
db 'Infortrend Technology Inc ' |
dw 4667 ; 0x124F |
db 'Perceptive Solutions Inc. ' |
dw 4694 ; 0x1256 |
db 'Gilbarco Inc. ' |
dw 4696 ; 0x1258 |
db 'Asix Electronics Corp. ' |
dw 4699 ; 0x125B |
db 'Microdyne Corp. ' |
dw 4710 ; 0x1266 |
db 'S.A. Telecommunications ' |
dw 4711 ; 0x1267 |
db 'SOLITON SYSTEMS K.K. ' |
dw 4961 ; 0x1361 |
db 'CENTURY SYSTEMS. ' |
dw 4668 ; 0x123C |
db 'ENGINEERING DESIGN TEAM. ' |
db 'Engineering Design Team Inc. ' |
dw 4669 ; 0x123D |
db 'C-CUBE MICROSYSTEMS ' |
dw 4671 ; 0x123F |
db 'JAYCOR NETWORKS INC. ' |
db 'JAYCOR NETWORKS INC./JNI Corporation ' |
dw 4674 ; 0x1242 |
db 'AVM AUDIOVISUELLES MKTG & COMPUTER SYSTEM GMBH ' |
dw 4676 ; 0x1244 |
db 'SBS TECHNOLOGIES ' |
dw 4683 ; 0x124B |
db 'HITACHI ULSI SYSTEMS CO LTD ' |
db 'Hitachi Microcomputer System Ltd. ' |
dw 4688 ; 0x1250 |
db 'GUZIK TECHNICAL ENTERPRISES ' |
dw 4691 ; 0x1253 |
434,7 → 676,7 |
dw 4697 ; 0x1259 |
db 'AURORA TECHNOLOGIES. ' |
dw 4700 ; 0x125C |
db 'ESS ' |
db 'ESS TECHNOLOGY, INC. ' |
dw 4701 ; 0x125D |
db 'CONCURRENT TECHNOLOGIES ' |
dw 4703 ; 0x125F |
446,7 → 688,7 |
dw 4708 ; 0x1264 |
db 'TEKTRONIX ' |
dw 4712 ; 0x1268 |
db 'NORTEL NETWORKS ' |
db 'Nortel Networks Corp. ' |
dw 4716 ; 0x126C |
db 'SPLASH TECHNOLOGY. ' |
dw 4717 ; 0x126D |
460,7 → 702,7 |
dw 4724 ; 0x1274 |
db 'NETWORK APPLIANCE CORPORATION ' |
dw 4725 ; 0x1275 |
db 'TRANSTECH DSP LTD ' |
db 'Transtech Parallel Systems ' |
dw 4728 ; 0x1278 |
db 'TRANSMETA CORPORATION ' |
dw 4729 ; 0x1279 |
472,13 → 714,13 |
dw 4735 ; 0x127F |
db 'YOKOGAWA ELECTRIC CORPORATION ' |
dw 4737 ; 0x1281 |
db 'INTEGRATED TECHNOLOGY EXPRESS. ' |
db 'Integrated Technology Express Inc. ' |
dw 4739 ; 0x1283 |
db 'MAZET GMBH ' |
dw 4742 ; 0x1286 |
db 'TRANSWITCH CORPORATION ' |
dw 4747 ; 0x128B |
db 'G2 NETWORKS. ' |
db 'G2 Networks Inc. ' |
dw 4749 ; 0x128D |
db 'TATENO DENNOU. ' |
dw 4751 ; 0x128F |
492,13 → 734,13 |
dw 4759 ; 0x1297 |
db 'KNOWLEDGE TECHNOLOGY LAB. ' |
dw 4761 ; 0x1299 |
db 'VMETRO. ' |
db 'VMETRO Inc. ' |
dw 4762 ; 0x129A |
db 'VICTOR COMPANY OF JAPAN ' |
dw 4766 ; 0x129E |
db 'ALLEN- BRADLEY COMPANY ' |
dw 4768 ; 0x12A0 |
db 'LUCENT TECHNOLOGIES ' |
db 'Lucent Technologies AMR ' |
dw 4771 ; 0x12A3 |
db 'AMO GMBH ' |
dw 4775 ; 0x12A7 |
506,7 → 748,7 |
dw 4777 ; 0x12A9 |
db 'YUAN YUAN ENTERPRISE CO. LTD. ' |
dw 4779 ; 0x12AB |
db 'ALTEON WEBSYSTEMS INC ' |
db 'Alteon Networks Inc. ' |
dw 4782 ; 0x12AE |
db 'NATURAL MICROSYSTEMS ' |
dw 4790 ; 0x12B6 |
520,10 → 762,9 |
dw 4798 ; 0x12BE |
db 'Fujifilm Microdevices ' |
dw 4799 ; 0x12BF |
_SECONDPART: ;lists 255 Vendors |
db 'INFIMED ' |
dw 4800 ; 0x12C0 |
db 'HOLTEK SEMICONDUCTOR INC ' |
db 'Holtek Microelectronics Inc. ' |
dw 4803 ; 0x12C3 |
db 'Connect Tech Inc ' |
dw 4804 ; 0x12C4 |
539,7 → 780,7 |
dw 4818 ; 0x12D2 |
db 'GE VINGMED ULTRASOUND AS ' |
dw 4819 ; 0x12D3 |
db 'COMVERSE NETWORKS SYSTEM & Ulticom. ' |
db 'COMVERSE NETWORKS SYSTEM & Ulticom, Inc. ' |
dw 4820 ; 0x12D4 |
db 'Equator Technologies ' |
dw 4821 ; 0x12D5 |
555,7 → 796,7 |
dw 4830 ; 0x12DE |
db 'SBS Technologies Inc ' |
dw 4831 ; 0x12DF |
db 'Chase Research ' |
db 'Chase Research PLC ' |
dw 4832 ; 0x12E0 |
db 'Datum Inc. Bancomm-Timing Division ' |
dw 4834 ; 0x12E2 |
565,7 → 806,7 |
dw 4839 ; 0x12E7 |
db 'Real Vision ' |
dw 4842 ; 0x12EA |
db 'AUREAL INC. ' |
db 'Aureal Semiconductor ' |
dw 4843 ; 0x12EB |
db '3A ' |
dw 4844 ; 0x12EC |
583,7 → 824,7 |
dw 4868 ; 0x1304 |
db 'Computer Boards ' |
dw 4871 ; 0x1307 |
db 'LEVEL ONE COMMUNICATIONS ' |
db 'LEVEL ONE COMMUNICATIONS/Jato Technologies Inc. ' |
dw 4872 ; 0x1308 |
db 'Mitsubishi Electric MicroComputer ' |
dw 4874 ; 0x130A |
739,7 → 980,7 |
dw 5053 ; 0x13BD |
db 'SHAREWAVE INC ' |
dw 5055 ; 0x13BF |
db '3WARE ' |
db '3ware Inc. ' |
dw 5057 ; 0x13C1 |
db 'TECHNOTREND SYSTEMTECHNIK GMBH ' |
dw 5058 ; 0x13C2 |
807,9 → 1048,10 |
dw 5115 ; 0x13FB |
db 'MICRO SCIENCE INC ' |
dw 5117 ; 0x13FD |
_THIRDPART: ;lists 255 vendors |
db 'ARTX INC ' |
dw 5120 ; 0x1400 |
db 'MEILHAUS ELECTRONIC GmbH ' |
db 'Meilhaus Electronic GmbH Germany ' |
dw 5122 ; 0x1402 |
db 'FUNDAMENTAL SOFTWARE INC ' |
dw 5124 ; 0x1404 |
871,7 → 1113,7 |
dw 5190 ; 0x1446 |
db 'AIM GMBH ' |
dw 5191 ; 0x1447 |
db 'ADLINK TECHNOLOGY ' |
db 'ADLINK Technology Inc ' |
dw 5194 ; 0x144A |
db 'LORONIX INFORMATION SYSTEMS INC ' |
dw 5195 ; 0x144B |
1031,7 → 1273,6 |
dw 5312 ; 0x14C0 |
db 'MYRICOM INC. ' |
dw 5313 ; 0x14C1 |
_THIRDPART: ;lists 255 vendors |
db 'DTK COMPUTER ' |
dw 5314 ; 0x14C2 |
db 'MEDIATEK CORP. ' |
1124,9 → 1365,9 |
dw 5359 ; 0x14EF |
db 'CANON RESEACH CENTRE FRANCE ' |
dw 5360 ; 0x14F0 |
db 'CONEXANT ' |
db 'Conexant Systems, Inc ' |
dw 5361 ; 0x14F1 |
db 'MOBILITY ELECTRONICS ' |
db 'Mobility Electronics, Inc. ' |
dw 5362 ; 0x14F2 |
db 'BROADLOGIC ' |
dw 5363 ; 0x14F3 |
1318,6 → 1559,7 |
dw 5457 ; 0x1551 |
db 'RACAL AIRTECH LTD ' |
dw 5458 ; 0x1552 |
_FOURTHPART: ;lists 222 vendors |
db 'CHICONY ELECTRONICS CO LTD ' |
dw 5459 ; 0x1553 |
db 'PROLINK MICROSYSTEMS CORP. ' |
1340,7 → 1582,7 |
dw 5468 ; 0x155C |
db 'MAC SYSTEM CO LTD ' |
dw 5469 ; 0x155D |
db 'LP ELEKTRONIK GMBH ' |
db 'LP ELEKTRONIK GMBH/KUKA Controls GmbH ' |
dw 5470 ; 0x155E |
db 'PERLE SYSTEMS LIMITED ' |
dw 5471 ; 0x155F |
1348,7 → 1590,7 |
dw 5472 ; 0x1560 |
db 'VIEWGRAPHICS INC ' |
dw 5473 ; 0x1561 |
db 'SYMBOL TECHNOLOGIES ' |
db 'Symbol Technologies, Inc. ' |
dw 5474 ; 0x1562 |
db 'A-TREND ' |
dw 5475 ; 0x1563 |
1494,7 → 1736,7 |
dw 5547 ; 0x15AB |
db 'NORTH ATLANTIC INSTRUMENTS ' |
dw 5548 ; 0x15AC |
db 'VMWARE ' |
db 'VMware Inc. ' |
dw 5549 ; 0x15AD |
db 'AMERSHAM PHARMACIA BIOTECH ' |
dw 5550 ; 0x15AE |
1542,7 → 1784,6 |
dw 5572 ; 0x15C4 |
db 'PROCOMP INFORMATICS LTD ' |
dw 5573 ; 0x15C5 |
_FOURTHPART: ;lists 110 vendors |
db 'TECHNICAL UNIVERSITY OF BUDAPEST ' |
dw 5574 ; 0x15C6 |
db 'TATEYAMA SYSTEM LABORATORY CO LTD ' |
1575,7 → 1816,7 |
dw 5589 ; 0x15D5 |
db 'ENTRIDIA CORPORATION ' |
dw 5590 ; 0x15D6 |
db 'ROCKWELL-COLLINS ' |
db 'Rockwell-Collins Inc ' |
dw 5591 ; 0x15D7 |
db 'CYBERNETICS TECHNOLOGY CO LTD ' |
dw 5592 ; 0x15D8 |
1678,7 → 1919,7 |
db 'SCIEMETRIC INSTRUMENTS INC ' |
dw 5641 ; 0x1609 |
db 'Broadcom -SiByte ' |
dw 5741 ; 0x127A |
dw 5741 ; 0x166D |
db 'EPOX Computer Co ' |
dw 5781 ; 0x1695 |
db 'ALBATRON Corp. ' |
1715,7 → 1956,7 |
dw 19796 ; 0x4D54 |
db 'S S TECHNOLOGIES ' |
dw 20790 ; 0x5136 |
db 'S3 INC. ' |
db 'S3 Graphics Co., Ltd. ' |
dw 21299 ; 0x5333 |
db 'TERALOGIC INC ' |
dw 21580 ; 0x544C |
1731,7 → 1972,7 |
dw 34952 ; 0x8888 |
db 'COMPUTONE CORPORATION ' |
dw 36366 ; 0x8E0E |
db 'ADAPTEC ' |
db 'Adaptec Inc ' |
dw 36868 ; 0x9004 |
db 'GIGAPIXEL CORP ' |
dw 37274 ; 0x919A |
1753,7 → 1994,7 |
dw 51966 ; 0xCAFE |
db 'CATAPULT COMMUNICATIONS ' |
dw 52428 ; 0xCCCC |
db 'DY4 Systems Inc ' |
db 'DY4 Systems Inc/Curtiss-Wright Controls Embed. Com' |
dw 54484 ; 0xD4D4 |
db 'EKF ELEKTRONIK GMBH ' |
dw 58559 ; 0xE4BF |
1764,10 → 2005,10 |
db 'EPIGRAM INC ' |
dw 65242 ; 0xFEDA |
;---------------------------------------------------------------------- |
_UNKNOWN: db 'UNKOWN VENDOR ' |
_UNKNOWN: db 'UNKNOWN VENDOR ' |
_UNKNOWND: |
db 'UNKOWN DEVICE ' |
db 'UNKNOWN DEVICE ' |
Class0: |
db 'Prehistoric - misc ' |
1786,7 → 2027,7 |
db 03 ; 0x03 |
db 'Storage - RAID ' |
db 04 ; 0x04 |
db 'Storage - ATA with DMA ' |
db ' ' ;Storage - ATA with DMA |
db 05 ; 0x05 |
db 'Storage - Serial ATA ' |
db 06 ; 0x06 |
1812,7 → 2053,7 |
db 128 ; 0x80 |
Class3: |
db 'Display - VGA controller ' |
db ' ' ;Display - VGA controller |
db 00 ; 0x0 |
db 'Display - XGA controller ' |
db 01 ; 0x1 |
1848,7 → 2089,7 |
db 02 ; 0x02 |
db 'Bridge - PCI/MCA ' |
db 03 ; 0x03 |
db 'Bridge - PCI/PCI ' |
db ' ';Bridge - PCI/PCI |
db 04 ; 0x04 |
db 'Bridge - PCMCIA ' |
db 05 ; 0x05 |
1858,7 → 2099,7 |
db 07 ; 0x07 |
db 'Bridge - RACEway ' |
db 08 ; 0x08 |
db 'Bridge - Semi-transpar. PCI/PCI ' |
db ' '; Bridge - Semi-transpar. PCI/PCI |
db 09 ; 0x09 |
db 'Bridge - InfiniBand/PCI ' |
db 10 ; 0x0A |
1866,13 → 2107,13 |
db 128 ; 0x80 |
Class7: |
db 'Communication - Serial ' |
db ' ';Communication - Serial |
db 00 ; 0x0 |
db 'Communication - Parallel ' |
db ' ';Communication - Parallel |
db 01 ; 0x1 |
db 'Communication - Multiport Serial' |
db 02 ; 0x2 |
db 'Communication - Modem ' |
db ' ';Communication - Modem |
db 03 ; 0x3 |
db 'Communication - GPIB ' |
db 04 ; 0x4 |
1882,13 → 2123,13 |
db 128 ; 0x80 |
Class8: |
db 'System - PIC ' |
db ' ' ;System - PIC |
db 00 ; 0x0 |
db 'System - DMAC ' |
db ' ' ;System - DMAC |
db 01 ; 0x1 |
db 'System - Timer ' |
db ' ' ;System - Timer |
db 02 ; 0x2 |
db 'System - RTC ' |
db ' ' ;System - RTC |
db 03 ; 0x3 |
db 'System - PCI Hot-Plug ' |
db 04 ; 0x4 |
1904,7 → 2145,7 |
db 02 ; 0x2 |
db 'Input - Scanner ' |
db 03 ; 0x3 |
db 'Input - Gameport ' |
db ' ' ; Input - Gameport |
db 04 ; 0x4 |
db 'Input - misc ' |
db 128 ; 0x80 |
1933,13 → 2174,13 |
db 64 ; 0x40 |
ClassC: |
db 'Serial Bus - FireWire ' |
db ' ' ;Serial Bus - FireWire |
db 00 ; 0x0 |
db 'Serial Bus - ACCESS.bus ' |
db 01 ; 0x1 |
db 'Serial Bus - SSA ' |
db 02 ; 0x2 |
db 'Serial Bus - USB/USB2 ' |
db ' ' ;Serial Bus - USB/USB2 |
db 03 ; 0x3 |
db 'Serial Bus - Fibre Channel ' |
db 04 ; 0x4 |
1947,7 → 2188,7 |
db 05 ; 0x5 |
db 'Serial Bus - InfiniBand ' |
db 06 ; 0x6 |
db 'Serial Bus - IPMI ' |
db ' ' ;Serial Bus - IPMI |
db 07 ; 0x7 |
db 'Serial Bus - SERCOS ' |
db 08 ; 0x8 |
1973,7 → 2214,7 |
db 128 ; 0x80 |
ClassE: |
db 'Intelligent I/O - I/O contr. ' |
db ' ' ;Intelligent I/O - I/O contr. |
db 00 ; 0x0 |
ClassF: |
2004,4 → 2245,4 |
db 'DSP - Managamant card ' |
db 32 ; 0x20 |
db 'DSP - misc ' |
db 128 ; 0x80 |
db 128 ; 0x80 |
/programs/system/rb/trunk/@RB.ASM |
---|
350,7 → 350,7 |
<"/RD/1/JPEGVIEW",0> ,\ |
<"/RD/1/CPU",0> ,\ |
<"/RD/1/SPANEL",0> ,\ |
<"/RD/1/ICON2",0> ,\ |
<"/RD/1/ICON",0> ,\ |
<"/RD/1/VRR",0> |
; header: ; § £®«®¢®ª |
/programs/system/rb/trunk/build_en.bat |
---|
1,4 → 1,5 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm @rb.asm @rb |
@erase lang.inc |
@pause |
/programs/system/rb/trunk/build_ru.bat |
---|
1,4 → 1,5 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm @rb.asm @rb |
@erase lang.inc |
@pause |
/programs/system/rb/trunk/macros.inc |
---|
143,10 → 143,6 |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
178,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
/programs/system/rdsave/trunk/build_en.bat |
---|
0,0 → 1,5 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm rdsave.asm rdsave |
@erase lang.inc |
@pause |
/programs/system/rdsave/trunk/build_ru.bat |
---|
0,0 → 1,5 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm rdsave.asm rdsave |
@erase lang.inc |
@pause |
/programs/system/rdsave/trunk/macros.inc |
---|
0,0 → 1,269 |
; new application structure |
macro meos_app_start |
{ |
use32 |
org 0x0 |
db 'MENUET01' |
dd 0x01 |
dd __start |
dd __end |
dd __memory |
dd __stack |
if used __params & ~defined __params |
dd __params |
else |
dd 0x0 |
end if |
dd 0x0 |
} |
MEOS_APP_START fix meos_app_start |
macro code |
{ |
__start: |
} |
CODE fix code |
macro data |
{ |
__data: |
} |
DATA fix data |
macro udata |
{ |
if used __params & ~defined __params |
__params: |
db 0 |
__end: |
rb 255 |
else |
__end: |
end if |
__udata: |
} |
UDATA fix udata |
macro meos_app_end |
{ |
align 32 |
rb 2048 |
__stack: |
__memory: |
} |
MEOS_APP_END fix meos_app_end |
; macro for defining multiline text data |
struc mstr [sstring] |
{ |
forward |
local ssize |
virtual at 0 |
db sstring |
ssize = $ |
end virtual |
dd ssize |
db sstring |
common |
dd -1 |
} |
; strings |
macro sz name,[data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if used name |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
macro lsz name,[lng,data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if (used name)&(lang eq lng) |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
} |
; easy system call macro |
macro mpack dest, hsrc, lsrc |
{ |
if (hsrc eqtype 0) & (lsrc eqtype 0) |
mov dest, (hsrc) shl 16 + lsrc |
else |
if (hsrc eqtype 0) & (~lsrc eqtype 0) |
mov dest, (hsrc) shl 16 |
add dest, lsrc |
else |
mov dest, hsrc |
shl dest, 16 |
add dest, lsrc |
end if |
end if |
} |
macro __mov reg,a,b { ; mike.dld |
if (~a eq)&(~b eq) |
mpack reg,a,b |
else if (~a eq)&(b 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 |
} |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
macro add arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
inc arg1 |
else |
add arg1,arg2 |
end if |
else |
add arg1,arg2 |
end if |
} |
macro sub arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
dec arg1 |
else |
sub arg1,arg2 |
end if |
else |
sub arg1,arg2 |
end if |
} |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
xor arg1,arg1 |
inc arg1 |
else if (arg2) = -1 |
or arg1,-1 |
else if (arg2) > -128 & (arg2) < 128 |
push arg2 |
pop arg1 |
else |
mov arg1,arg2 |
end if |
else |
mov arg1,arg2 |
end if |
} |
macro struct name |
{ |
virtual at 0 |
name name |
sizeof.#name = $ - name |
end virtual |
} |
; structures used in MeOS |
struc process_information |
{ |
.cpu_usage dd ? ; +0 |
.window_stack_position dw ? ; +4 |
.window_stack_value dw ? ; +6 |
.not_used1 dw ? ; +8 |
.process_name rb 12 ; +10 |
.memory_start dd ? ; +22 |
.used_memory dd ? ; +26 |
.PID dd ? ; +30 |
.x_start dd ? ; +34 |
.y_start dd ? ; +38 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
struc system_colors |
{ |
.frame dd ? |
.grab dd ? |
.grab_button dd ? |
.grab_button_text dd ? |
.grab_text dd ? |
.work dd ? |
.work_button dd ? |
.work_button_text dd ? |
.work_text dd ? |
.work_graph dd ? |
} |
struct system_colors |
; constants |
; events |
EV_IDLE = 0 |
EV_TIMER = 0 |
EV_REDRAW = 1 |
EV_KEY = 2 |
EV_BUTTON = 3 |
EV_EXIT = 4 |
EV_BACKGROUND = 5 |
EV_MOUSE = 6 |
EV_IPC = 7 |
EV_STACK = 8 |
; event mask bits for function 40 |
EVM_REDRAW = 1b |
EVM_KEY = 10b |
EVM_BUTTON = 100b |
EVM_EXIT = 1000b |
EVM_BACKGROUND = 10000b |
EVM_MOUSE = 100000b |
EVM_IPC = 1000000b |
EVM_STACK = 10000000b |
/programs/system/rdsave/trunk/rdsave.asm |
---|
0,0 → 1,212 |
; |
; Save Ramdisk to HD and FD |
; Mario79 2005 |
; Compile with FASM for Menuet |
; |
include 'lang.inc' |
include 'macros.inc' |
appname equ 'RDsave ' |
version equ '1.1' |
use32 |
org 0x0 |
db 'MENUET01' ; 8 byte id |
dd 0x01 ; header version |
dd START ; start of code |
dd I_END ; size of image |
dd 0x1000 ; memory for app |
dd 0x1000 ; esp |
dd 0x0 , 0x0 ; I_Param , I_Icon |
;****************************************************************************** |
START: ; start of execution |
xor eax,eax |
mov edi,bootpath |
mov ecx,128 |
rep stosd |
mcall 6,filename,0,-1,bootpath |
mov esi,bootpath+1 |
mov cx,512 |
start_search: |
lodsb |
cmp al,"'" |
jz set_end_path |
dec cx |
cmp cx,0 |
ja start_search |
set_end_path: |
mov [esi-1],byte 0 |
mov eax,40 |
mov ebx,101b |
int 0x40 |
red: |
call draw_window |
still: |
mov eax, 10 ; wait here for event |
int 0x40 |
dec eax ; redraw request ? |
je red |
; dec eax |
; dec eax ; button in buffer ? |
; je button |
button: ; button |
mov eax,17 ; get id |
int 0x40 |
cmp ah,2 |
jne ah_3 |
mcall 18,6,1 |
jmp red |
ah_3: |
cmp ah,3 |
jne ah_4 |
mcall 18,6,2 |
jmp red |
ah_4: |
cmp ah,4 |
jne ah_5 |
mcall 18,6,3,bootpath+1 |
jmp red |
ah_5: |
cmp ah,5 |
jne ah_6 |
mcall 16,1 |
jmp red |
ah_6: |
cmp ah,6 |
jne ah_1 |
mcall 16,2 |
jmp red |
ah_1: |
cmp ah,1 |
je exit |
jmp still |
exit: |
or eax,-1 ; close this program |
int 0x40 |
; ********************************************* |
; ******* WINDOW DEFINITIONS AND DRAW ******** |
; ********************************************* |
draw_window: |
mov eax,48 |
mov ebx,3 |
mov ecx,sc |
mov edx,sizeof.system_colors |
int 0x40 |
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, 200*65536+230 ; [x start] *65536 + [x size] |
mov ecx, 200*65536+260 ; [y start] *65536 + [y size] |
mov edx, [sc.work] ; color of work area RRGGBB,8->color gl |
or edx,0x33000000 |
mov edi,header ; WINDOW LABEL |
int 0x40 |
mcall 8,<11,17>,<26,17>,2,[sc.work_button] |
inc edx |
mcall , ,<56,17>, , |
inc edx |
mcall , ,<86,17>, , |
inc edx |
mcall , ,<166,17>, , |
inc edx |
mcall , ,<196,17>, , |
mov ecx,[sc.work_button_text] |
or ecx,0x10000000 |
mcall 4,<17,31>, ,text_123,1 |
add ebx,30 |
add edx,1 |
mcall |
add ebx,30 |
add edx,1 |
mcall |
add ebx,80 |
add edx,1 |
mcall |
add ebx,30 |
add edx,1 |
mcall |
mov ecx,[sc.work_text] |
or ecx,0x80000000 |
mcall ,<40,31>, ,text_1, |
add ebx,30 |
mcall , , ,text_2, |
add ebx,30 |
mcall , , ,text_3, |
mcall ,<15,115>, ,text_4, |
mcall ,<35,125>, ,text_5, |
mcall ,<35,41>, ,text_6, |
mcall ,<35,101>, ,text_6, |
mcall ,<40,171>, ,text_7, |
mcall ,<40,201>, ,text_8, |
mcall ,<25,10>, ,text_9, |
mcall ,<25,150>, ,text_10, |
mov eax,12 ; function 12:tell os about windowdraw |
mov ebx,2 ; 2, end of draw |
int 0x40 |
ret |
header db appname,version,0 |
text_123 db '12345' |
if lang eq ru |
text_1 db ' ¯ ¯ªã :\KOLIBRI',0 |
text_2 db ' ª®à¥ì ¤¨áª ',0 |
text_3 db 'ãâì ¢ ä ©«¥ RD2HD.TXT',0 |
text_4 db '¯.3 ¤«ï १¥à¢®£® á®åà ¥¨ï',0 |
text_5 db 'â.ª. ¢ ï¤à¥ ¥£® ¥â.',0 |
text_6 db '(¯ ¯ª ¤®«¦ ¯à¨áãâá⢮¢ âì)',0 |
text_7 db ' /FD/1',0 |
text_8 db ' /FD/2',0 |
text_9 db '®åà ¥¨¥ ¦¥á⪨© ¤¨áª:',0 |
text_10 db '®åà ¥¨¥ ¤¨áª¥âã:',0 |
else |
text_1 db 'To the folder C:\KOLIBRI',0 |
text_2 db 'To the root of C',0 |
text_3 db 'To path in the file RD2HD.TXT',0 |
text_4 db 'p.3 for backup, as the kernel',0 |
text_5 db 'can not boot from there.',0 |
text_6 db '(folder must exist)',0 |
text_7 db 'To /FD/1',0 |
text_8 db 'To /FD/2',0 |
text_9 db 'Save to hard disk:',0 |
text_10 db 'Save to floppy:',0 |
end if |
filename db 'RD2HD TXT' |
I_END: |
sc system_colors |
bootpath: |
/programs/system/run/trunk/build_en.bat |
---|
1,4 → 1,5 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm run.asm run |
@erase lang.inc |
@pause |
/programs/system/run/trunk/build_ru.bat |
---|
1,4 → 1,5 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm run.asm run |
@erase lang.inc |
@pause |
/programs/system/run/trunk/editbox.inc |
---|
0,0 → 1,755 |
; <Lrz> 21.07.2006 ¤®¡ ¢«¥ äãªæ¨ï ª®¯ª¨ Del, ⥯¥àì ¬®¦® 㤠«ïâì ᨬ¢®«ë ¯à¨ ¯®¬®é¨ ¤ ®© ª®« ¢¨è¨ |
; ¢â®à: ¢â¨å®¢ ªá¨¬ (Maxxxx32) email: maxxxxm@mail.ru |
; â ¯®á«¥¤¨å ¨§¬¥¥¨©: 13.07.06 10:40 |
; ¯¨è¨â¥ ¢ ¨á室®¬ ª®¤¥ ᢮¥© ¯à®£à ¬¬ë use_edit_box, |
; íâ® ¢áâ ¢¨â ¥®¡å®¤¨¬ë¥ ¯à®æ¥¤ãàë ¢ ª®¤ ¢ 襩 ¯à®£à ¬¬ë. |
; à®æ¥¤ãàë: |
; edit_box.draw - ¯®« ï ¯¥à¥à¨á®¢ª ; |
; edit_box.key - ®¡à ¡®âª ª« ¢¨ âãàë; |
; edit_box.mouse - ®¡à ¡®âª ¬ëè¨; |
; edit_box.focus - ãáâ ®¢ª 䮪ãá ; |
; edit_box.blur - ¥£® à §¬ë¢ ¨¥; |
; edit_box.get_n - ¯®«ãç¨âì ª®«¨ç¥á⢮ ¯à®à¨á®¢ë¢ ¥¬ëå ᨬ¢®«®¢. |
; ਠ¢ë§®¢¥ «î¡ëå ¨§ íâ¨å ¯à®æ¥¤ãà ¢ ॣ¨áâॠedi á«¥¤ã¥â |
; ®áâ ¢¨âì 㪠§ ⥫ì áâàãªâãàã. |
; ਬ¥à áâàãªâãàë: |
; some_edit edit_box 100,10,30,0x00ffffff,0,0x00aaaaaa,0,255,some_edit_text |
; ¤«¨ , «¥¢®, ¢¥àå, 梥â ä® , 梥â à ¬ª¨, ¥á«¨ ¢ë¡à , |
; 梥â à ¬ª¨, ¥á«¨ ¥ ¢ë¡à , ¬ ªá¨¬ «ì®¥ ª®«¨ç¥á⢮ ᨬ¢®«®¢, |
; 㪠§ â¥«ì ¡ãä¥à, £¤¥ ¡ã¤ãâ åà ¨âáï ᨬ¢®«ë. ãä¥à ¤®«¦¥ |
; ®ª 稢 âìáï ã«¥¬, ¯à¨¬¥à ¥á«¨ ¬ ªá¨¬ «ì®¥ ª®«¨ç¥á⢮ 255: |
; some_edit_text: |
; rb 256 ;255+1 |
; ਬ¥à ¢ë§®¢ ¯à®æ¥¤ãàë: |
; mov edi,some_edit |
; call edit_box.draw |
; ਠ¢ë§®¢¥ ¯à®æ¥¤ãàë edit_box.key ª®¤ ª« ¢¨è¨ ¤®«¦¥ |
; 室¨âáï ¢ ah, â® ¥áâì ¯¥à¥¤ ¢ë§®¢®¬ í⮩ ¯à®æ¥¤ãàë ¤® ¢ë§¢ âì |
; 2-ãî á¨á¥¬ãî äãªæ¨î, ¯à¨¬¥à: |
; mov eax,2 |
; int 0x40 |
; mov edi,some_edit1 |
; call edit_box.key |
; mov edi,some_edit2 |
; call edit_box.key |
; ¥à¥¤ ¢ë§®¢®¬ ®¡à ¡®â稪 ¬ëè¨ á«¥¤ã¥â ¯à®¢¥à¨âì, ï¥âáï «¨ ®ª® |
; ªâ¨¢ë¬. |
; ᫨ 饫箪 ¬ëè¨ ¡ë« ¯à®©§¢¥¤¥ § ¯à¥¤¥« ¬¨ edit box |
; 䮪ãá â¥àï¥âáï. |
macro use_edit_box |
{ |
edit_box: |
ed_width equ [edi] |
ed_left equ [edi+2] |
ed_top equ [edi+4] |
ed_color equ [edi+6] |
ed_focus_border_color equ [edi+10] |
ed_blur_border_color equ [edi+14] |
ed_text_color equ [edi+18] |
ed_flags equ [edi+22] |
ed_max equ [edi+24] |
ed_size equ [edi+26] |
ed_pos equ [edi+28] |
ed_offset equ [edi+30] |
ed_text equ [edi+32] |
ed_height=14 ; ¢ëá®â |
;========================================================== |
;=== ¯à®æ¥¤ãà ¯à®à¨á®¢ª¨ ================================= |
;========================================================== |
.draw: |
pusha |
;--- à¨á㥬 à ¬ªã --- |
call .draw_border |
.draw_bg_cursor_text: |
;--- ¨§¬¥ï¥¬ ᬥ饨¥, ¥á«¨ ¤® --- |
call .check_offset |
;--- à¨á㥬 ¢ãâà¥îî ®¡« áâì --- |
call .draw_bg |
.draw_cursor_text: |
;--- à¨á㥬 ªãàá®à --- |
;--- ¬®¦¥â ¥£® ¥ ¤® à¨á®¢ âì ---- |
bt word ed_flags,1 |
jnc @f |
call .draw_cursor |
@@: |
call .draw_text |
popa |
ret |
;---------------------------------------------------------- |
;--- ¯à®æ¥¤ãà ¯à®à¨á®¢ª¨ ⥪áâ -------------------------- |
;---------------------------------------------------------- |
.draw_text: |
;--- ¢ëç¨á«ï¥¬, ᪮«ìª® ¯®¬¥é ¥âáï ᨬ¢®«®¢ --- |
call .get_n |
;--- çâ®¡ë ¬ãá®à ¥ à¨á®¢ âì --- |
movsx esi,word ed_size |
sub si,ed_offset |
cmp ax,si |
ja @f |
mov si,ax |
@@: |
;--- à¨á㥬 ⥪áâ --- |
mov eax,4 |
mov bx,ed_left |
add bx,2 |
shl ebx,16 |
mov bx,ed_top |
add bx,4 |
mov ecx,ed_text_color |
movsx edx,word ed_offset |
add edx,ed_text |
int 0x40 |
ret |
;---------------------------------------------------------- |
;--- ¯à®æ¥¤ãà ¯à®à¨á®¢ª¨ ä® ---------------------------- |
;---------------------------------------------------------- |
.draw_bg_eax: |
pusha |
movsx ebx,ax |
lea ebx,[ebx*2+ebx] |
shl bx,1 |
shl ebx,16 |
shr eax,16 |
lea eax,[eax*2+eax] |
shl ax,1 |
add ax,ed_left |
add ax,2 |
mov bx,ax |
ror ebx,16 |
jmp @f |
.draw_bg: |
pusha |
mov bx,ed_left |
inc bx |
shl ebx,16 |
mov bx,ed_width |
dec bx |
@@: |
mov cx,ed_top |
inc cx |
shl ecx,16 |
mov cx,ed_height |
dec cx |
mov edx,ed_color |
mov eax,13 |
int 0x40 |
popa |
ret |
;---------------------------------------------------------- |
;--- ¯à®æ¥¤ãà ¯®«ãç¥¨ï ª®«¨ç¥á⢠ᨬ¢®«®¢ -------------- |
;---------------------------------------------------------- |
.get_n: |
xor edx,edx |
movsx eax,word ed_width |
sub ax,4 |
mov bx,6 |
div bx |
ret |
;---------------------------------------------------------- |
;--- ¯à®æ¥¤ãà à¨á®¢ ¨ï ªãàá®à -------------------------- |
;---------------------------------------------------------- |
.clear_cursor: |
mov edx,ed_color |
jmp @f |
.draw_cursor: |
mov edx,ed_text_color |
@@: |
movsx ebx,word ed_pos |
sub bx,ed_offset |
;lea ebx,[ebx*2+ebx] |
;shl ebx,1 |
imul ebx,6 |
add bx,ed_left |
inc bx |
push bx |
shl ebx,16 |
pop bx |
mov cx,ed_top |
add cx,2 |
push cx |
shl ecx,16 |
pop cx |
add cx,ed_height-4 |
mov eax,38 |
int 0x40 |
ret |
;---------------------------------------------------------- |
;--- ¯à®æ¥¤ãà à¨á®¢ ¨ï à ¬ª¨ ---------------------------- |
;---------------------------------------------------------- |
.draw_border: |
;--- 梥â à ¬ª¨ --- |
bt word ed_flags,1 |
mov edx,ed_focus_border_color |
jc @f |
mov edx,ed_blur_border_color |
@@: |
;--- ᢥàåã --- |
mov bx,ed_left |
push bx |
shl ebx,16 |
pop bx |
add bx,ed_width |
mov cx,ed_top |
push cx |
shl ecx,16 |
pop cx |
mov eax,38 |
int 0x40 |
;--- ᨧã --- |
push cx |
add cx,ed_height |
push cx |
shl ecx,16 |
pop cx |
int 0x40 |
;--- á«¥¢ --- |
pop cx |
push bx |
sub bx,ed_width |
int 0x40 |
;--- á¯à ¢ --- |
pop bx |
push bx |
shl ebx,16 |
pop bx |
int 0x40 |
ret |
;---------------------------------------------------------- |
;--- ¯à®¢¥àª , § 襫 «¨ ªãàá®à § £à ¨æë ¨, ¥á«¨ ¤®, --- |
;--- ¨§¬¥ï¥¬ ᬥ饨¥ ------------------------------------ |
;--- eax = 1, ¥á«¨ ¥ ¨§¬¥¨«®áì ¨«¨ eax = 0, ¥á«¨ |
; ¨§¬¥¨«®áì |
;---------------------------------------------------------- |
.check_offset: |
push word ed_offset |
call .get_n |
;--- ¯à ¢¥¥ --- |
mov bx,ed_offset |
add bx,ax |
cmp bx,ed_pos |
ja @f |
mov bx,ed_pos |
mov cx,ax |
shr cx,2 |
sub bx,cx |
mov cx,ax |
shr cx,1 |
sub bx,cx |
mov ed_offset,bx |
@@: |
;--- «¥¢¥¥ --- |
mov bx,ed_offset |
cmp bx,ed_pos |
jb @f |
mov bx,ed_pos |
mov cx,ax |
shr cx,2 |
sub bx,cx |
jnc $+5 |
xor bx,bx |
mov ed_offset,bx |
@@: |
xor eax,eax |
pop bx |
cmp bx,ed_offset |
jne @f |
inc eax |
@@: |
ret |
;========================================================== |
;=== ®¡à ¡®âª ª« ¢¨ âãàë ================================= |
;========================================================== |
.key: |
pusha |
bt word ed_flags,1 ; ¥á«¨ ¥ ¢ 䮪ãá¥, ¢ë室¨¬ |
jc @f |
popa |
ret |
@@: |
;---------------------------------------------------------- |
;--- ¯à®¢¥à塞, çâ® ¦ â® -------------------------------- |
;---------------------------------------------------------- |
cmp ah,8 |
je .backspace |
cmp ah,0xb6 |
je .delete |
cmp ah,176 |
je .left |
cmp ah,179 |
je .right |
cmp ah,180 |
je .home |
cmp ah,181 |
je .end |
;--- ¦ â ¤àã£ ï ª« ¢¨è --- |
bt word ed_flags,15 ; ⮫쪮 æ¨äàë ? |
jnc @f |
cmp ah,'0' |
jb .no_figure |
cmp ah,'9' |
ja .no_figure |
jmp @f |
.no_figure: |
popa |
ret |
@@: |
; ¯à®¢¥à塞, 室¨âáï «¨ ªãàá®à ¢ ª®æ¥ |
mov bx,ed_max |
cmp bx,ed_pos |
jne @f ; ¥á«¨ ¤ , ¢ ª®¥æ ¯à®æ¥¤ãàë |
popa |
ret |
@@: |
; ᤢ¨£ ¥¬ ᨬ¢®«ë ¯®á«¥ ªãàá®à ¢¯à ¢® |
mov edx,ed_text |
dec edx |
xor ecx,ecx |
mov cx,ed_size |
cmp cx,ed_pos |
je @f |
.mov_right_next: |
mov bh,[edx+ecx] |
mov [edx+ecx+1],bh |
dec cx |
cmp cx,ed_pos |
jne .mov_right_next |
@@: |
; ¢áâ ¢«ï¥¬ ª®¤ ª« ¢¨è¨ â㤠, £¤¥ ªãàá®à |
mov edx,ed_text |
movsx ebx,word ed_pos |
mov [ebx+edx],ah |
call .clear_cursor |
; 㢥«¨ç¨¢ ¥¬ § 票¥ à §¬¥à ¨ ¯®§¨æ¨¨ |
inc word ed_pos |
mov bx,ed_size |
cmp bx,ed_max |
je .draw_bg_cursor_text;.key_end_draw |
inc word ed_size |
;push word ed_offset |
call .check_offset |
;pop ax |
;cmp ax,ed_offset |
;jne .draw_bg_cursor_text |
test eax,eax |
jz .draw_bg_cursor_text |
call .get_n |
sub ax,ed_pos |
add ax,ed_offset |
inc ax |
shl eax,16 |
mov ax,ed_pos |
sub ax,ed_offset |
dec ax |
ror eax,16 |
call .draw_bg_eax |
jmp .draw_cursor_text |
;jmp .draw_cursor_text;.key_end_draw |
.delete: |
mov dx,ed_size |
mov cx,ed_pos |
;inc edx |
;add ecx,900 |
;sub ecx,1 |
cmp dx,cx |
jg @f |
popa |
ret |
@@: |
mov edx,ed_text |
;dec edx |
.mov_stop_next: |
mov bh,[edx+ecx+1] |
mov [edx+ecx],bh |
inc cx |
mov bx,ed_size |
;dec bx |
;dec bx |
cmp cx,bx |
jne .mov_stop_next |
; 㬥ìè ¥¬ § 票¥ ¯®§¨æ¨¨ ¨ à §¬¥à |
;dec word ed_pos |
dec word ed_size |
;push word ed_offset |
call .check_offset |
;pop ax |
;cmp ax,ed_offset |
;jne .draw_bg_cursor_text |
test eax,eax |
jz .draw_bg_cursor_text |
call .get_n |
sub ax,ed_pos |
add ax,ed_offset |
shl eax,16 |
mov ax,ed_pos |
sub ax,ed_offset |
ror eax,16 |
call .draw_bg_eax |
jmp .draw_cursor_text |
popa |
ret |
;--- ¦ â ª« ¢¨è backspace --- |
.backspace: |
; ¯à®¢¥à塞, ªãàá®à ã «¥¢®£® ªà ï ? |
mov bx,ed_pos |
;cmp bx,0 |
;jne @f; .key_end ; ¥á«¨ ¤ , ¢ ª®¥æ |
test bx,bx |
jnz @f |
popa |
ret |
@@: |
; ᤢ¨£ ¥¬ ᨬ¢®«ë ¯®á«¥ ªãàá®à ¢«¥¢® |
mov edx,ed_text |
dec edx |
movsx ecx,word ed_pos |
.mov_left_next: |
mov bh,[edx+ecx+1] |
mov [edx+ecx],bh |
inc cx |
mov bx,ed_size |
inc bx |
cmp cx,bx |
jne .mov_left_next |
; 㬥ìè ¥¬ § 票¥ ¯®§¨æ¨¨ ¨ à §¬¥à |
dec word ed_pos |
dec word ed_size |
;push word ed_offset |
call .check_offset |
;pop ax |
;cmp ax,ed_offset |
;jne .draw_bg_cursor_text |
test eax,eax |
jz .draw_bg_cursor_text |
call .get_n |
sub ax,ed_pos |
add ax,ed_offset |
shl eax,16 |
mov ax,ed_pos |
sub ax,ed_offset |
ror eax,16 |
call .draw_bg_eax |
jmp .draw_cursor_text |
popa |
ret |
;--- ¦ â ª« ¢¨è left --- |
.left: |
mov bx,ed_pos |
;cmp bx,0 |
;je @f |
test bx,bx |
jz @f |
call .clear_cursor |
dec word ed_pos |
call .check_offset |
test eax,eax |
jz .draw_bg_cursor_text |
call .draw_cursor |
@@: |
popa |
ret |
;--- ¦ â ª« ¢¨è right --- |
.right: |
mov bx,ed_pos |
cmp bx,ed_size |
je @f |
call .clear_cursor |
inc word ed_pos |
call .check_offset |
test eax,eax |
jz .draw_bg_cursor_text |
call .draw_cursor |
@@: |
popa |
ret |
.home: |
mov bx,ed_pos |
test bx,bx |
jz @f |
call .clear_cursor |
xor eax,eax |
mov ed_pos,ax |
call .check_offset |
test eax,eax |
jz .draw_bg_cursor_text |
call .draw_cursor |
@@: |
popa |
ret |
.end: |
mov bx,ed_pos |
cmp bx,ed_size |
je @f |
call .clear_cursor |
mov ax,ed_size |
mov ed_pos,ax |
call .check_offset |
test eax,eax |
jz .draw_bg_cursor_text |
call .draw_cursor |
@@: |
popa |
ret |
;========================================================== |
;=== ®¡à ¡®âª ¬ëè¨ ======================================= |
;========================================================== |
.mouse: |
pusha |
;---------------------------------------------------------- |
;--- ¯®«ãç ¥¬ á®áâ®ï¨¥ ª®¯®ª ¬ëè¨ ----------------------- |
;---------------------------------------------------------- |
mov eax,37 |
mov ebx,2 |
int 0x40 |
;---------------------------------------------------------- |
;--- ¯à®¢¥à塞 á®áâ®ï¨¥ ---------------------------------- |
;---------------------------------------------------------- |
bt eax,0 |
jc .mouse_left_button |
bt eax,1 |
jc @f |
btr word ed_flags,2 |
@@: |
popa |
ret |
.mouse_left_button: |
;---------------------------------------------------------- |
;--- ¯®«ãç ¥¬ ª®®à¤¨ âë ¬ëè¨ ----------------------------- |
;---------------------------------------------------------- |
bts word ed_flags,2 |
jc .mouse_pressed |
mov eax,37 |
;mov ebx,1 |
xor ebx,ebx |
inc ebx |
int 0x40 |
;---------------------------------------------------------- |
;--- ¯à®¢¥à塞, ¯®¯ ¤ ¥â «¨ ªãàá®à ¢ edit box ------------- |
;---------------------------------------------------------- |
mov bx,ed_top |
cmp ax,bx |
jl ._blur;.mouse_end_no_focus |
add bx,ed_height |
cmp ax,bx |
jg ._blur;.mouse_end_no_focus |
shr eax,16 |
mov bx,ed_left |
cmp ax,bx |
jl ._blur;.mouse_end_no_focus |
add bx,ed_width |
cmp ax,bx |
jg ._blur;.mouse_end_no_focus |
;--- ¨§¬¥ï¥¬ ¯®§¨æ¨î ªãàá®à --- |
push eax |
call .clear_cursor |
pop eax |
xor dx,dx |
sub ax,ed_left |
add ax,2 |
mov bx,6 |
div bx |
add ax,ed_offset |
cmp ax,ed_size |
jna @f |
mov ax,ed_size |
@@: |
mov ed_pos,ax |
call .check_offset |
test eax,eax |
jz .draw_bg_cursor_text |
call .draw_cursor |
call .focus |
.mouse_pressed: |
popa |
ret |
;.mouse_end_no_focus: |
; call .blur |
;popa |
;ret |
;---------------------------------------------------------- |
;--- ¯à®æ¥¤ãà ãáâ ®¢ª¨ 䮪ãá --------------------------- |
;---------------------------------------------------------- |
.blur: |
pusha |
._blur: |
bt word ed_flags,14 |
jc @f |
btr word ed_flags,1 |
jnc @f |
call .clear_cursor |
jmp .blur_end |
.focus: |
pusha |
bts word ed_flags,1 |
jc @f |
call .draw_cursor |
.blur_end: |
call .draw_border |
@@: |
popa |
ret |
;---------------------------------------------------------- |
;--- ¯à®æ¥¤ãà à §¬ë¢ ¨ï 䮪ãá -------------------------- |
;---------------------------------------------------------- |
;.blur: |
;pusha |
;._blur: |
;btr word ed_flags,1 |
;jnc @f |
;call .draw_border |
;call .clear_cursor |
;@@: |
;popa |
;ret |
} |
ed_figure_only=1000000000000000b |
ed_always_focus=100000000000000b |
ed_focus=10b |
ed_struc_size=36 |
macro draw_edit_boxes start,end |
{ |
mov edi,start |
mov ecx,((end-start)/ed_struc_size) |
@@: |
call edit_box.draw |
add edi,ed_struc_size |
loop @b |
} |
macro mouse_edit_boxes start,end |
{ |
mov edi,start |
mov ecx,((end-start)/ed_struc_size) |
@@: |
call edit_box.mouse |
add edi,ed_struc_size |
loop @b |
} |
macro key_edit_boxes start,end |
{ |
mov edi,start |
mov ecx,((end-start)/ed_struc_size) |
@@: |
call edit_box.key |
add edi,ed_struc_size |
loop @b |
} |
struc edit_box width,left,top,color,focus_border_color,\ |
blur_border_color,text_color,max,text,flags,size |
{ |
.width dw width |
.left dw left |
.top dw top |
.color dd color |
.focus_border_color dd focus_border_color |
.blur_border_color dd blur_border_color |
.text_color dd text_color |
.flags dw flags+0 |
.max dw max |
.size dw size+0 |
.pos dw 0 |
.offset dw 0 |
.text dd text |
} |
macro edit_boxes_set_sys_color start,end,color_table |
{ |
mov edi,start |
mov ecx,((end-start)/ed_struc_size) |
mov esi,color_table |
@@: |
mov eax,[esi+36] |
mov ebx,[esi+20] |
mov ed_focus_border_color,eax |
shr bh,1 |
shr bl,1 |
shr ah,1 |
shr al,1 |
add ah,bh |
add al,bl |
ror eax,16 |
ror ebx,16 |
shr bl,1 |
shr al,1 |
add al,bl |
ror eax,16 |
mov ed_blur_border_color,eax |
add edi,ed_struc_size |
loop @b |
} |
macro draw_edit_box ed_ptr |
{ |
mov edi,ed_ptr |
call edit_box.draw |
} |
macro mouse_edit_box ed_ptr |
{ |
mov edi,ed_ptr |
call edit_box.mouse |
} |
macro key_edit_box ed_ptr |
{ |
mov edi,ed_ptr |
call edit_box.key |
} |
/programs/system/run/trunk/macros.inc |
---|
1,5 → 1,17 |
; new application structure |
macro meos_app_start |
;--- ¤à㣨¥ ¬ ªà®áë --- |
include 'editbox.inc' |
include 'txtbut.inc' |
;include 'gp.inc' |
;include 'label.inc' |
;include 'checkbox.inc' |
;include 'file_sys.inc' |
;include 'textwork.inc' |
;include 'ini.inc' |
include 'lang.inc' |
;--- § £®«®¢®ª --- |
macro meos_header par_buf,cur_dir_buf |
{ |
use32 |
org 0x0 |
6,261 → 18,294 |
db 'MENUET01' |
dd 0x01 |
dd __start |
dd __end |
dd __memory |
dd __stack |
if used __params & ~defined __params |
dd __params |
dd __app_start |
dd __app_end |
dd __app_end |
dd __app_end |
if <par_buf> eq <> |
dd 0x0 |
else |
dd par_buf |
end if |
if <cur_dir_buf> eq <> |
dd 0x0 |
else |
dd cur_dir_buf |
end if |
} |
dd 0x0 |
;--- ®¯à¥¤¥«¨âì â®çªã ¢å®¤ --- |
macro app_start |
{ |
__app_start: |
} |
MEOS_APP_START fix meos_app_start |
macro code |
;--- ®¯à¥¤¥«¨âì ª®¥æ ¯à¨«®¦¥¨ï ¨ à §¬¥à á⥪ --- |
macro app_end stack_size |
{ |
__start: |
if <stack_size> eq <> |
rb 1024 |
else |
rb stack_size |
end if |
__app_end: |
} |
CODE fix code |
macro data |
;--- § ¢¥àè¨âì ⥪ã騩 ¯®â®ª --- |
macro app_close |
{ |
__data: |
xor eax,eax |
dec eax |
int 0x40 |
} |
DATA fix data |
macro udata |
;--- ¯®«ãç¨âì ª®¤ ¦ ⮩ ª« ¢¨è¨ --- |
macro get_key |
{ |
if used __params & ~defined __params |
__params: |
db 0 |
__end: |
rb 255 |
else |
__end: |
end if |
__udata: |
mov eax,2 |
int 0x40 |
} |
UDATA fix udata |
macro meos_app_end |
;--- ¯®«ãç¨âì ª®¤ ¦ ⮩ ª®¯ª¨ --- |
macro get_pressed_button |
{ |
align 32 |
rb 2048 |
__stack: |
__memory: |
mov eax,17 |
int 0x40 |
} |
MEOS_APP_END fix meos_app_end |
;--- á®®¡é¨âì á¨á⥬¥ ® ç «¥ ¯¥à¥à¨á®¢ª¨ ®ª --- |
macro start_draw_window |
{ |
mov eax,12 |
xor ebx,ebx |
inc ebx |
int 0x40 |
} |
; macro for defining multiline text data |
struc mstr [sstring] |
;--- á®®¡é¨âì á¨á⥬¥ ® § ¢¥à襨¨ ¯¥à¥à¨á®¢ª¨ ®ª --- |
macro stop_draw_window |
{ |
forward |
local ssize |
virtual at 0 |
db sstring |
ssize = $ |
end virtual |
dd ssize |
db sstring |
common |
dd -1 |
mov eax,12 |
mov ebx,2 |
int 0x40 |
} |
;--- ãáâ ®¢¨âì ¬ áªã ®¦¨¤ ¥¬ëå ᮡë⨩ --- |
macro set_events_mask mask |
{ |
mov eax,40 |
mov ebx,mask |
int 0x40 |
} |
; strings |
macro sz name,[data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
;--- ¯®«ãç¨âì ¨ä®à¬ æ¨î ® ¯à®æ¥áᥠ--- |
macro get_procinfo proc_inf_buf,slot_num |
{ |
mov eax,9 |
mov ebx,proc_inf_buf |
if <slot_num> eq <> |
xor ecx,ecx |
dec ecx |
else |
mov ecx,slot_num |
end if |
forward |
if used name |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
int 0x40 |
} |
macro lsz name,[lng,data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
end if |
forward |
if (used name)&(lang eq lng) |
db data |
end if |
common |
if used name |
.size = $-name |
end if |
macro get_sys_colors col_buf |
{ |
mov eax,48 |
mov ebx,3 |
mov ecx,col_buf |
mov edx,40 |
int 0x40 |
} |
macro get_grab_area |
{ |
mov eax,48 |
mov ebx,7 |
int 0x40 |
} |
macro get_scin_height |
{ |
mov eax,48 |
mov ebx,4 |
int 0x40 |
} |
; easy system call macro |
macro mpack dest, hsrc, lsrc |
macro min_window |
{ |
if (hsrc eqtype 0) & (lsrc eqtype 0) |
mov dest, (hsrc) shl 16 + lsrc |
else |
if (hsrc eqtype 0) & (~lsrc eqtype 0) |
mov dest, (hsrc) shl 16 |
add dest, lsrc |
else |
mov dest, hsrc |
shl dest, 16 |
add dest, lsrc |
end if |
end if |
mov eax,18 |
mov ebx,10 |
int 0x40 |
} |
macro __mov reg,a,b { ; mike.dld |
if (~a eq)&(~b eq) |
mpack reg,a,b |
else if (~a eq)&(b eq) |
mov reg,a |
macro activ_window slot_n |
{ |
mov eax,18 |
mov ebx,3 |
if <slot_n> eq <> |
else |
mov ecx,slot_n |
end if |
int 0x40 |
} |
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 |
macro get_active_window |
{ |
mov eax,18 |
mov ebx,7 |
int 0x40 |
} |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
macro add arg1,arg2 |
macro delay time |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
inc arg1 |
mov eax,5 |
if <time> eq <> |
else |
add arg1,arg2 |
mov ebx,time |
end if |
else |
add arg1,arg2 |
end if |
int 0x40 |
} |
macro sub arg1,arg2 |
;--- ®¦¨¤ âì ᮡëâ¨ï --- |
macro wait_event redraw,key,button,mouse,ipc,other |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
dec arg1 |
mov eax,10 |
int 0x40 |
dec ax |
if <redraw> eq <> |
else |
sub arg1,arg2 |
jz redraw |
end if |
dec ax |
if <key> eq <> |
else |
sub arg1,arg2 |
jz key |
end if |
dec ax |
if <button> eq <> |
else |
jz button |
end if |
dec ax |
dec ax |
dec ax |
if <mouse> eq <> |
else |
jz mouse |
end if |
if <ipc> eq <> |
else |
dec ax |
jz ipc |
end if |
if <other> eq <> |
jmp still |
else |
jmp other |
end if |
} |
macro mov arg1,arg2 |
;--- ¯®«ãç¨âì à §¬¥àë íªà --- |
macro get_screen_size |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
xor arg1,arg1 |
inc arg1 |
else if (arg2) = -1 |
or arg1,-1 |
else if (arg2) > -128 & (arg2) < 128 |
push arg2 |
pop arg1 |
mov eax,14 |
int 0x40 |
} |
macro get_screen_prop struc_ptr |
{ |
mov eax,61 |
push eax eax |
xor ebx,ebx |
inc ebx |
int 0x40 |
mov [struc_ptr],eax |
pop eax |
inc ebx |
int 0x40 |
mov [struc_ptr+4],ax |
pop eax |
inc ebx |
int 0x40 |
mov [struc_ptr+6],eax |
} |
macro resize_mem mem_size |
{ |
mov eax,64 |
xor ebx,ebx |
inc ebx |
if <mem_size> eq <> |
else |
mov arg1,arg2 |
mov ecx,mem_size |
end if |
else |
mov arg1,arg2 |
end if |
int 0x40 |
} |
evm_redraw equ 1 |
evm_key equ 10b |
evm_button equ 100b |
evm_mouse equ 100000b |
evm_ipc equ 1000000b |
macro struct name |
struc procinfo |
{ |
virtual at 0 |
name name |
sizeof.#name = $ - name |
end virtual |
.takts_per_second: dd ? |
.window_stack_pos: dw ? |
.slot_number: dw ? |
dw ? |
.name: rb 11 |
.align: db ? |
.addres: dd ? |
.use_mem: dd ? |
.pid: dd ? |
.left: dd ? |
.top: dd ? |
.width: dd ? |
.height: dd ? |
.slot_state: dw ? |
rb (1024-56) |
} |
; structures used in MeOS |
struc process_information |
struc sys_color_table |
{ |
.cpu_usage dd ? ; +0 |
.window_stack_position dw ? ; +4 |
.window_stack_value dw ? ; +6 |
.not_used1 dw ? ; +8 |
.process_name rb 12 ; +10 |
.memory_start dd ? ; +22 |
.used_memory dd ? ; +26 |
.PID dd ? ; +30 |
.x_start dd ? ; +34 |
.y_start dd ? ; +38 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
.frames: dd ? ;+0 |
.grab: dd ? ;+4 |
.grab_button: dd ? ;+8 |
.grab_button_text: dd ? ;+12 |
.grab_text: dd ? ;+16 |
.work: dd ? ;+20 |
.work_button: dd ?;+24 |
.work_button_text: dd ? ;+28 |
.work_text: dd ? ;+32 |
.work_graph: dd ? ;+36 |
} |
struct process_information |
struc system_colors |
struc screen_size |
{ |
.frame dd ? |
.grab dd ? |
.grab_button dd ? |
.grab_button_text dd ? |
.grab_text dd ? |
.work dd ? |
.work_button dd ? |
.work_button_text dd ? |
.work_text dd ? |
.work_graph dd ? |
.height: dw ? |
.width: dw ? |
} |
struct system_colors |
struc screen_prop |
{ |
.height: dw ? ;+0 |
.width: dw ? ;+2 |
.bitspp: dw ? ;+4 |
.bytesps: dd ?;+6 |
} |
; constants |
struc ipc_buffer size |
{ |
.block: dd ? |
.in_use: dd ? |
.messages: rb size |
} |
; events |
EV_IDLE = 0 |
EV_TIMER = 0 |
EV_REDRAW = 1 |
EV_KEY = 2 |
EV_BUTTON = 3 |
EV_EXIT = 4 |
EV_BACKGROUND = 5 |
EV_MOUSE = 6 |
EV_IPC = 7 |
EV_STACK = 8 |
; event mask bits for function 40 |
EVM_REDRAW = 1b |
EVM_KEY = 10b |
EVM_BUTTON = 100b |
EVM_EXIT = 1000b |
EVM_BACKGROUND = 10000b |
EVM_MOUSE = 100000b |
EVM_IPC = 1000000b |
EVM_STACK = 10000000b |
;--- 梥â --- |
cl_white=0xffffff |
cl_black=0x000000 |
/programs/system/run/trunk/run.asm |
---|
1,198 → 1,261 |
; <--- description ---> |
; compiler: FASM 1.54 |
; name: MenuetOS RUN |
; version: 0.02 |
; last update: 28/09/2004 |
; written by: Ivan Poddubny |
; e-mail: ivan-yar@bk.ru |
; <--- include all MeOS stuff ---> |
include "lang.inc" |
include "macros.inc" |
;;;lang fix en |
; <--- start of MenuetOS application ---> |
MEOS_APP_START |
;include "DEBUG.INC" |
; <--- start of code ---> |
CODE |
call draw_window ; at first create and draw the window |
wait_event: ; main cycle |
mcall 10 |
cmp eax, 1 ; if event == 1 |
je redraw ; jump to redraw handler |
cmp eax, 2 ; else if event == 2 |
je key ; jump to key handler |
cmp eax, 3 ; else if event == 3 |
je button ; jump to button handler |
jmp wait_event ; else return to the start of main cycle |
redraw: ; redraw event handler |
window_y=88 |
;window_x=320 |
window_x=450 |
include 'macros.inc' |
meos_header par |
use_edit_box |
use_txt_button |
app_start |
cmp [par],byte 0 |
jne read_par |
set_events_mask evm_mouse+evm_button+evm_key+evm_redraw |
red: |
get_sys_colors sc |
set_sys_colors_txt_button run_but,sc |
push dword [sc.work_graph] |
pop [input_fn.focus_border_color] |
call draw_window |
jmp wait_event |
key: ; key event handler |
mcall 2 |
still: |
wait_event red,key,button,mouse,,still |
key: |
get_key |
cmp ah, 13 |
je _run |
cmp ah, 8 |
je .backspace |
je run |
key_edit_box input_fn |
jmp still |
button: |
get_pressed_button |
dec ah |
jz close |
dec ah |
jz run |
jmp still |
mouse: |
mouse_edit_box input_fn |
jmp still |
mov bl, ah |
mov eax, [position] |
mov [filename + eax], bl |
inc [position] |
call draw_string |
jmp wait_event |
.backspace: |
read_par: |
mov esi,par |
mov edi,fn |
mov ecx,256 |
rep movsb |
run: |
xor eax, eax |
cmp [position], eax |
je wait_event |
dec [position] |
call draw_string |
jmp wait_event |
mov edi,file_info.name |
mov ecx,512 |
rep stosb |
mov edi,run_par |
mov ecx,256 |
rep stosb |
mov esi,fn |
mov edi,file_info.name |
cmp [esi],byte '"' |
je copy_fn_with_spaces |
copy_fn: |
cmp [esi],byte ' ' |
je .stop |
cmp [esi],byte 0 |
je .stop |
mov al,[esi] |
mov [edi],al |
inc esi |
inc edi |
jmp copy_fn |
.stop: |
button: ; button event handler |
mcall 17 |
jmp copy_par |
cmp ah, 10 |
je _run |
copy_fn_with_spaces: |
inc esi |
@@: |
cmp [esi],byte '"' |
je .stop |
cmp [esi],byte 0 |
je .stop |
mov al,[esi] |
mov [edi],al |
inc esi |
inc edi |
jmp @b |
.stop: |
dec ah |
jne wait_event ; return if button id != 1 |
copy_par: |
@@: |
inc esi |
cmp [esi],byte ' ' |
je @b |
mov edi,run_par |
@@: |
cmp [esi],byte 0 |
je .stop |
mov al,[esi] |
mov [edi],al |
inc esi |
inc edi |
jmp @b |
.stop: |
_exit: |
or eax, -1 ; exit application |
mov eax,70 |
mov ebx,file_info |
int 0x40 |
;cmp eax,0 |
;jg error |
bt eax,31 |
je error |
jmp still |
close: |
app_close |
_run: |
mcall 58, fileinfo |
; dps "58th function returned " |
; dpd eax |
; newline |
jmp _exit |
error: |
macro cmp_err code,text_ptr |
{ |
cmp al,code |
jne @f |
mov [status],text_ptr |
;jmp .draw_status |
@@: |
} |
neg eax |
draw_window: |
mcall 12, 1 |
;test al,al |
;jz close |
mcall 14 |
and eax, 0xFFFF |
sub eax, 100 |
shl eax, 16 |
add eax, 80 |
mov ecx, eax |
cmp_err 3,bad_file_sys |
mov ebx, 148*65536+400 ; (window_cx)*65536+(window_sx) |
mov edx, 0x03DDDDDD ; work area color & window type 3 |
mcall 0 |
cmp_err 5,file_not_find |
mov ebx, 8*65536+8 ; coordinates |
mov ecx, 0x10ffffff ; color & font N1 |
mov edx, header ; address of text |
mov esi, header.size ; length of text |
mcall 4 |
cmp_err 9,bad_fat_table |
mpack ebx, 10, 26 |
mov ecx, 0 |
mov edx, message |
mov esi, message.size |
mcall |
cmp_err 10,acces_denyied |
mpack ebx, 385-(runbtn.size*6), runbtn.size*6+4 |
mpack ecx, 56, 14 |
mov edx, 10 |
mov esi, 0xa0a0a0 |
mcall 8 |
cmp_err 11,device_error |
; mpack ebx, 385-runbtn.size*6-findbtn.size*6-8, findbtn.size*6+4 |
; inc edx |
; mcall 8 |
cmp_err 30,out_of_memory |
; mpack ebx, 388-runbtn.size*6-findbtn.size*6-7, 59 |
; mov ecx, 0 |
; mov edx, findbtn |
; mov esi, findbtn.size |
; mcall 4 |
cmp_err 31,file_not_executable |
mpack ebx, 388-runbtn.size*6, 59 |
mov ecx, 0 |
mov edx, runbtn |
mov esi, runbtn.size |
mcall 4 |
cmp_err 32,many_processes |
call draw_string |
.draw_status: |
call draw_status |
jmp still |
mcall 12, 2 |
ret |
draw_window: |
start_draw_window |
get_screen_size |
mov cx,ax |
sub cx,window_y+20 |
shl ecx,16 |
mov cx,window_y |
shr eax,16 |
mov bx,ax |
sub bx,window_x |
shl ebx,15 |
mov bx,window_x |
mov edx,[sc.work] |
or edx,0x03000000 |
xor eax,eax |
xor esi,esi |
xor edi,edi |
int 0x40 |
get_procinfo app |
draw_string: |
mpack ebx, 10, 380 |
mpack ecx, 38, 14 |
mov edx, 0xA0A0A0 |
mcall 13 |
mov ax,[app.width] |
sub ax,20 |
mov [input_fn.width],ax |
mov [run_but.width],ax |
mpack ebx, 14, 41 |
mov ecx, 0 |
mov edx, filename |
mov esi, [position] |
mcall 4 |
ret |
mov bx,5 |
shl ebx,16 |
mov bx,ax |
add bx,15 |
mov cx,70 |
push cx |
shl ecx,16 |
pop cx |
mov edx,[sc.work_graph] |
mov eax,38 |
int 0x40 |
draw_edit_box input_fn |
draw_txt_button run_but |
call draw_status_text |
; <--- initialised data ---> |
DATA |
stop_draw_window |
ret |
position dd filename.size |
draw_status: |
mov ebx,5*65536+(window_x-5-5) |
mov ecx,(window_y-16)*65536+12 |
mov edx,[sc.work] |
mov eax,13 |
int 0x40 |
draw_status_text: |
mov edx,[status] |
xor esi,esi |
@@: |
cmp [edx+esi],byte 0 |
je @f |
inc esi |
jmp @b |
@@: |
mov eax,4 |
mov ebx,10*65536+(window_y-14) |
mov ecx,[sc.work_text] |
int 0x40 |
ret |
lsz header,\ |
ru, " ¯ã᪠¯à®£à ¬¬ë",\ |
en, "Start program" |
run_but txt_button 0,10,15,50,2,0,0,run_but_text, |
if lang eq ru |
run_but_text db '',0 |
else |
run_but_text db 'RUN',0 |
end if |
input_fn edit_box 0,10,30,0xffffff,0,0xaaaaaa,0,511,fn,ed_focus+\ |
ed_always_focus |
lsz message,\ |
ru, "¢¥¤¨â¥ ¯ãâì ª ä ©«ã:",\ |
en, "Enter path to file:" |
if lang eq ru |
hello db '¢¥¤¨â¥ ¯®«ë© ¯ãâì ª ä ©«ã ¨ ¦¬¨â¥ Enter',0 |
bad_file_sys db '¥¨§¢¥áâ ï ä ©«®¢ ï á¨á⥬ ',0 ; 3 |
file_not_find db ' ©« ¥ ©¤¥',0 ; 5 |
bad_fat_table db ' ¡«¨æ FAT à §àãè¥ ',0 ; 9 |
acces_denyied db '®áâ㯠§ ¯à¥é¥',0 ; 10 |
device_error db '訡ª ãáâனá⢠',0 ; 11 |
out_of_memory db '¥¤®áâ â®ç® ¯ ¬ïâ¨',0 ; 30 |
file_not_executable db ' ©« ¥ ï¥âáï ¨á¯®«ï¥¬ë¬',0 ; 31 |
many_processes db '«¨èª®¬ ¬®£® ¯à®æ¥áᮢ',0 ; 32 |
else |
hello db 'Enter full path to file and press <Enter>',0 |
bad_file_sys db 'Unknown file system',0 ; 3 |
file_not_find db 'File not found',0 ; 5 |
bad_fat_table db 'FAT table corrupted',0 ; 9 |
acces_denyied db 'Access denied',0 ; 10 |
device_error db 'Device error',0 ; 11 |
out_of_memory db 'Out of memory',0 ; 30 |
file_not_executable db 'File is not executable',0 ; 31 |
many_processes db 'Too many processes',0 ; 32 |
end if |
; lsz findbtn,\ |
; ru, " ©â¨...",\ |
; en, "Find..." |
status dd hello |
lsz runbtn,\ |
ru, " ¯ãáâ¨âì",\ |
en, "Run" |
file_info: |
.mode dd 7 |
.flags dd 0 |
.par dd run_par |
dd 0,0 |
.name rb 512 |
flags dw ? |
fileinfo: |
.mode dd 16 |
dd 0 |
.param dd 0 |
dd 0 |
.workarea dd workarea |
fn rb 512 |
sz filename, "/rd/1/" |
rb 122 |
; <--- uninitialised data ---> |
UDATA |
workarea rb 4096 |
MEOS_APP_END |
; <--- end of MenuetOS application ---> |
sc sys_color_table |
app procinfo |
run_par rb 256 |
par rb 256 |
app_end |
/programs/system/run/trunk/run.txt |
---|
0,0 → 1,19 |
RUN - § ¯ã᪠«ª ¯à®£à ¬¬ ¢ ®«¨¡à¨ ç¥à¥§ 70-î äãªæ¨î. |
¯ã᪠¯à®£à ¬¬ |
¢¥¤¨â¥ ¯®«ë© ¯ãâì ª ¨á¯®«ï¥¬®¬ã ä ©«ã ¨ ¦¬¨â¥ ª®¯ªã "" ¨«¨ |
ª« ¢¨èã Enter. |
¯ã᪠¯à®£à ¬¬ á ¯ à ¬¥âà ¬¨ |
®áâ ¢ì⥠¯à®¡¥« ¯®á«¥ ¯ã⨠ª ä ©«ã ¨ ¢¢®¤¨â¥ ¯ à ¬¥âàë. ᫨ ¢ ¯ã⨠ª ä ©«ã |
¥áâì ¯à®¡¥«ë, ¥£® ¥®¡å®¤¨¬® ¢ë¤¥«¨âì ª ¢ëçª ¬¨ (⮣¤ ¯à®¡¥«®¬ à §¤¥«ïâì |
¥®¡ï§ ⥫ì®). |
ਬ¥àë |
/rd/1/tinypad /rd/1/menu.dat |
"/hd0/1/long name dir with spaces/tinypad" /rd/1/autorun.dat |
ᥣ® ¬®¦® ¢¢®¤¨âì ¤® 512 ᨬ¢®«®¢. |
¬ï ä ©« ¨«¨ ¯ ¯ª¨ ¬®¦¥â ᮤ¥à¦ âì ¤® 260 ᨬ¢®«®¢. |
᫨ ¯à®¨§®è« ®è¨¡ª , ® ®â®¡à §¨âáï ¢¨§ã. |
¢â¨å®¢ ªá¨¬ (Maxxxx32) |
mailto:maxxxxm@mail.ru |
/programs/system/run/trunk/txtbut.inc |
---|
0,0 → 1,127 |
;-------------------------------------------------------------------- |
;--- à¨á®¢ ¨¥ ª®¯ª¨ á ⥪á⮬ ¢ á¥à¥¤¨¥ -------------------------- |
;-------------------------------------------------------------------- |
macro use_txt_button |
{ |
txt_button: |
.draw: |
pusha |
;--- ¯à®à¨á®¢ª á ¬®© ª®¯ª¨ --- |
mov eax,8 |
mov ebx,[edi] ; [but.width] |
mov ecx,[edi+4] ;[but.height] |
mov edx,[edi+8];[but.id] |
mov esi,[edi+12];[but.color] |
int 0x40 |
;--- ⥪áâ ¥© --- |
; áç¨â ¥¬ ª®«¨ç¥á⢮ ᨬ¢®«®¢ |
mov edx,[edi+20] |
xor esi,esi |
.check_next_symbol: |
cmp [edx+esi],byte 0 |
je .str_end |
inc esi ; ¢ esi ¤«¨ áâப¨ ¢ ᨬ¢®« å |
jmp .check_next_symbol |
.str_end: |
; ¢ëç¨á«ï¥¬ ª®®à¤¨ âë |
lea ebx,[esi*2+esi] |
lea ebx,[ebx*2] ; ¢ ebx ¤«¨ áâப¨ ¢ ¯¨ªá¥«ïå |
;not ebx |
neg ebx |
add bx,[edi] ; [but.width] |
sar bx,1 |
inc bx |
add bx,[edi+2];[but.left] ; ¢ bx ¯®§¨æ¨ï á«¥¢ |
shl ebx,16 |
mov bx,[edi+4];[but.height] |
sub bx,8-1 |
sar bx,1 |
add bx,[edi+6];[but.top] ; ¢ bx ¯®§¨æ¨ï ᢥàåã |
; à¨á㥬 áâபã ⥪áâ |
mov ecx,[edi+16] ;[but.text_color] |
shr eax,1 |
int 0x40 |
popa |
ret |
} |
struc txt_button width,left,height,top,id,color,text_color,text_ptr,\ |
proc_addres |
{ |
.width dw width ;+0 |
.left dw left ;+2 |
.height dw height ;+4 |
.top dw top ;+6 |
.id dd id ;+8 |
.color dd color ;+12 |
.text_color dd text_color ;+16 |
.text_ptr dd text_ptr ;+20 |
.proc_addres dd proc_addres+0 ;+24 |
} |
but_struc_size=24+4 |
macro draw_txt_buttons start,end |
{ |
mov edi,start |
mov ecx,((end-start)/but_struc_size) |
@@: |
call txt_button.draw |
add edi,but_struc_size |
loop @b |
} |
macro txt_but_set_sys_color start,end,color_table |
{ |
mov edi,start |
mov esi,color_table |
mov ecx,((end-start)/but_struc_size) |
@@: |
push dword [esi+24] |
pop dword [edi+12] |
push dword [esi+28] |
pop dword [edi+16] |
add edi,but_struc_size |
loop @b |
} |
macro txt_but_ev start,end |
{ |
mov edi,start |
mov ecx,((end-start)/but_struc_size) |
.txt_but_next: |
cmp ah,[edi+8] |
jne @f |
cmp dword [edi+24],0 |
je @f |
pusha |
call dword [edi+24] |
popa |
@@: |
add edi,but_struc_size |
loop .txt_but_next |
} |
macro draw_txt_button ptr |
{ |
mov edi,ptr |
call txt_button.draw |
} |
macro set_sys_colors_txt_button but,sc |
{ |
mov esi,sc |
mov edi,but |
push dword [esi+24] |
pop dword [edi+12] |
push dword [esi+28] |
pop dword [edi+16] |
} |
macro event_txt_button but,sc |
{ |
} |
/programs/system/setup/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/system/setup/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/system/setup/trunk/build.bat |
---|
0,0 → 1,2 |
@fasm setup.asm setup |
@pause |
/programs/system/setup/trunk/macros.inc |
---|
143,9 → 143,6 |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
177,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
221,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
/programs/system/vrr/trunk/macros.inc |
---|
143,9 → 143,6 |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
177,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
221,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |
/programs/system/vrr_m/trunk/build_ru.bat |
---|
File deleted |
\ No newline at end of file |
/programs/system/vrr_m/trunk/build_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/system/vrr_m/trunk/build.bat |
---|
0,0 → 1,2 |
@fasm vrr_m.asm vrr_m |
@pause |
/programs/system/vrr_m/trunk/macros.inc |
---|
123,8 → 123,10 |
end if |
} |
macro __mov reg,a { ; mike.dld |
if ~a eq |
macro __mov reg,a,b { ; mike.dld |
if (~a eq)&(~b eq) |
mpack reg,a,b |
else if (~a eq)&(b eq) |
mov reg,a |
end if |
} |
141,11 → 143,6 |
; language for programs |
lang fix ru ; ru en fr ge fi |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
177,7 → 174,7 |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & (arg2 eqtype 0) |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
221,7 → 218,13 |
.x_size dd ? ; +42 |
.y_size dd ? ; +46 |
.slot_state dw ? ; +50 |
rb (1024-52) |
dw ? ; +52 - reserved |
.client_left dd ? ; +54 |
.client_top dd ? ; +58 |
.client_width dd ? ; +62 |
.client_height dd ? ; +66 |
.wnd_state db ? ; +70 |
rb (1024-71) |
} |
struct process_information |