diff --git a/programs/15/trunk/15.ASM b/programs/15/trunk/15.ASM new file mode 100644 index 0000000000..e27e65d1fb --- /dev/null +++ b/programs/15/trunk/15.ASM @@ -0,0 +1,489 @@ +; +; The famous game 15 +; Author: Lloyd, coded by Ivushkin Andrey +; Compile with FASM +; +include 'lang.inc' +include 'macros.inc' ; decreases program size (not required) + +BgdColor equ 0x02aabbcc +StatusColor equ 0x02ffffff +StatusColor2 equ 0x02dc1e14 +BgdColor equ 0x03aabbcc + +; Main window dimensions +XXwindow equ 200 shl 16+276 +YYwindow equ 200 shl 16+300 +; Status bar +XYstatus equ 35 shl 16+283 +XXbar equ 35 shl 16+136 +YYbar equ 280 shl 16+15 +; Buttons +BtnTop equ 28 +BtnLeft equ 13 +BtnSize equ 60 +BtnColor equ 0xafbb55 +BtnColor2 equ 0x0228c314 + +NumColor equ 0x10000000 +; Number shifting for nice look +NumShift equ 24 shl 16+27 +NumShift2 equ 4 shl 16 +; Shuffle button +XXSh equ 202 shl 16+60 +YYSh equ 280 shl 16+12 +XYShText equ 212 shl 16+283 + +; Conf button +XXCnf equ 13 shl 16+13 +YYCnf equ 280 shl 16+12 +XYCnfText equ 18 shl 16+283 + +; Position of the 'hole' +null equ (curconf+16) +; Amount of moves to perform shuffle +SH_CYCLES equ 400 +; (Amount of tasks)-1 +CONF_COUNT equ 2 + +use32 + + org 0x0 + + db 'MENUET01' + dd 0x01 + dd START + dd I_END + dd 0x2000 ; 8 Kb + dd 0x2000 + dd 0x0 + dd 0x0 + + +START: + mov [cptr],CONF_COUNT ; number of task + mov eax,3 + int 0x40 + mov cl,16 + ror eax,cl + mov [generator],eax ; random generator from Tetris + init: + mov ecx,17 + movzx eax,[cptr] + inc eax + cmp eax,CONF_COUNT + jna init_ok + xor eax,eax ; cycling 0..CONF_COUNT + init_ok: + mov [cptr],al + mov esi,eax + shl esi,4 + add esi,conf + add esi,eax + add al,0x31 + mov [lenTitle-1],al ;task number to program title + mov [task],esi + mov edi,curconf + rep movsb ; initial configuration + + mov [sts],4 + jmp red +SHUF: + call shuffle ; immediate shuffle +red: ; window redraw + + call draw_window + +still: ; MAIN PROGRAM CYCLE + + mov eax,10 ; wait for event + int 0x40 + + cmp eax,1 ; redraw? - + je red ; goto red + cmp eax,2 ; key pressed? - + je key ; goto key + cmp eax,3 ; button pressed? - + je button ; goto button + + jmp still ; no more events to process + + key: ; Key pressed + mov eax,2 + int 0x40 + shr eax,8 + cmp eax,32 ; = Shuffle + je SHUF + cmp eax,13 ; = Choose task + je init + cmp eax,176 + jl still + sub eax,176 + cmp eax,3 + ja still + movzx eax,byte [eax+correct] ; 'delta' value from correct[] + jmp m_check + + button: ; Button pressed + mov eax,17 + int 0x40 + shr eax,8 + sub eax,2 + + cmp eax,-1 ; id == 1 (closeme)? + jne noclose + int 0x40 + + noclose: + jl SHUF ; Shuffle (id=0) pressed + cmp eax,18 + je init ; Conf button pressed + sub al,byte [null] + mov edi,correct + mov ecx,4 + repne scasb ; checking for valid move-part 1 + jne fail + m_check: + cmp byte[sts],4 ; puzzle completed, blocking buttons + ja still + call move_check ; checking for valid move-part 2 + jnc fail + inc [move_count] + call draw_moves +fail: + jmp still ; возвращаемся + +; ******************************* +; ******* WINDOW DRAWING ******* +; ******************************* + +draw_window: + mov eax,12 + mov ebx,1 ; begin draw + int 0x40 + + ; CREATING WINDOW + mov eax,0 + mov ebx,XXwindow + mov ecx,YYwindow + mov edx,BgdColor + mov esi,0x805080d0 + mov edi,0x005080d0 + int 0x40 + + ; PROGRAM TITLE + mov eax,4 + mov ebx,8*65536+8 + mov ecx,0x10ddeeff + mov edx,txtTitle + mov esi,lenTitle-txtTitle + int 0x40 + + mov eax,8 ; SHUFFLE BUTTON + mov ebx,XXSh + mov ecx,YYSh + xor edx,edx + mov esi,BtnColor + int 0x40 + + mov ebx,XXCnf ; CONF BUTTON + mov ecx,YYCnf + mov edx,20 + mov esi,BtnColor + int 0x40 + + mov ebx, XYShText ; SHUFFLE TEXT + mov ecx, StatusColor + mov edx,txtSh + mov esi,lenSh-txtSh + mov eax,4 + int 0x40 + + mov ebx, XYCnfText ; CONF TEXT + mov edx,lenVictory-1 + mov esi,1 + int 0x40 + + mov ecx, 16 ; FIELD BUTTONS + dbut: + call draw_button + loop dbut + + call draw_moves + + mov eax,12 + mov ebx,2 ; end of drawing + int 0x40 + ret + + +; ********************************************* +; ******* DRAWING A FIELD BUTTON ************** +; ********************************************* +; ECX - button number + +draw_button: + pusha + dec ecx + ; calculating button dimensions + mov edi, ecx + lea edx,[ecx+2] + mov ebx,ecx + and ebx,11b + shr ecx,2 + + imul ebx,BtnSize+3 + add ebx,BtnLeft + shl ebx,16 + add ebx,BtnSize + + imul ecx,BtnSize+3 + add ecx,BtnTop + shl ecx,16 + add ecx,BtnSize + movzx eax,byte [null] + cmp eax,edi + jne no_hole + + pusha + inc ebx + inc ecx + mov edx,BgdColor + mov eax,13 ; clearing - 'hole' + int 0x40 + popa + + or edx,0x80000000 ; and removing button under it +no_hole: + mov al,byte[edi+curconf] + mov esi,[task] + cmp al,byte[edi+esi] + je highlight + mov esi,BtnColor + jmp s_rbutton +highlight: + mov esi,BtnColor2 +s_rbutton: + mov eax,8 ; set/remove button + int 0x40 + movzx eax,byte [null] + cmp eax,edi + je no_text ; no digits - that's hole + mov edx,ebx + shr ecx,16 + mov dx,cx + add edx,NumShift + mov ebx,0x20000 + movzx ecx,byte [edi+curconf] + cmp ecx,9 + ja two_num + add edx,NumShift2 ; shift to center digits + sub ebx,0x10000 +two_num: + mov esi,NumColor + mov eax,47 + int 0x40 +no_text: + popa + ret + + +; ********************************************* +; ******* DRAWING STATUS LINE ***************** +; ********************************************* + +draw_moves: + mov eax, 13 ; clear area + mov ebx, XXbar + mov ecx, YYbar + mov edx, BgdColor + int 0x40 + + mov eax, 4 + mov ebx, XYstatus + mov ecx, StatusColor + cmp ax, [sts] + jl report_victory + jne report_moves + mov edx,txtCnf ; prompt to choose configuration + mov esi,lenCnf-txtCnf + jmp e_dm + report_moves: + mov edx,txtMoves ; how many moves done + mov esi,lenMoves-txtMoves + mov eax,4 + int 0x40 + mov esi,ecx + mov edx,ebx + add edx, 40 shl 16 + mov ebx,0x030000 + movzx ecx, byte[move_count] + mov eax,47 + jmp e_dm + report_victory: ; puzzle completed + mov ecx,StatusColor2 + mov edx,txtVictory + mov esi,lenVictory-txtVictory + e_dm: + int 0x40 + ret + + +; ********************************************* +; ********* SHUFFLE *************************** +; ********************************************* + +shuffle: + xor eax,eax + mov [sts],ax + mov [move_count],ax ; reset moves to 0 + mov [sh_off],al + mov eax, [generator] + + mov ecx,SH_CYCLES + sh_cycle: + sub eax,0x43ab45b5 ; next random number + ror eax,1 + xor eax,0x32c4324f + ror eax,1 + mov [generator],eax + + push eax + and eax,11b ; direction 0..3 + movzx eax,byte [eax+correct] + call move_check + pop eax + jnc sh_cycle ; if fails then retry + loop sh_cycle + inc byte[sh_off] ; shuffling complete + ret + + +; ********************************************* +; ********* MOVE VALIDITY CHECK *************** +; ********************************************* +; AL - 'DELTA' DIRECTION + +move_check: + pusha + mov ah,byte [null] + mov bx,ax + cmp bh,3 + ja no_top + cmp al,-4 ; top of field + je no_move +no_top: + cmp bh,12 + jb no_bottom + cmp al,4 ; bottom of field + je no_move +no_bottom: + and bh,11b + cmp bh,0 + jnz no_left + cmp al,-1 ; left of field + je no_move +no_left: + cmp bh,11b + jnz ok + cmp al,1 ; right of field + je no_move +ok: + mov bx,ax + add bh,bl ; bh-new hole + mov byte [null],bh + movzx ecx,ah + mov al,byte[ecx+curconf] + movzx edx,bh + mov bl,byte[edx+curconf] ; swapping button & hole + mov byte[ecx+curconf],bl + mov byte[edx+curconf],al + + cmp byte[sh_off],0 ; if shuffle in progress, + jz no_win ; then no redraw + + ; drawing button & hole + inc ecx + call draw_button + movzx ecx,bh + inc ecx + call draw_button + ; testing if task completed + mov esi,[task] + mov edi,curconf + mov ecx,16 + repe cmpsb + cmp ecx,0 + jne no_win + mov word[sts],6 ; puzzle done. Victory! +no_win: + popa + stc + ret +no_move: + popa + clc + ret +; this is deprecated debug routine +;ud: +; ud2 + +; These are data used by program + +correct db 1,-4,4,-1 + +conf db 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,15 + db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0 + db 1,2,3,4,12,13,14,5,11,0,15,6,10,9,8,7,9 + +txtMoves: +if lang eq ru + db 'Ходов:' +else + db 'Moves:' +end if +lenMoves: + +txtSh: +if lang eq ru + db 'Тасовка' +else + db 'Shuffle' +end if +lenSh: + +txtCnf: +if lang eq ru + db 'Выберите задачу и нажмите->' +else + db 'Select task, then press ->' +end if +lenCnf: + +txtTitle: ; строка заголовка +if lang eq ru + db 'Игра 15 - задача X' +else + db 'Game 15 - puzzle X' +end if +lenTitle: ; и её конец + +txtVictory: +if lang eq ru + db 'Вы решили задачу! Нажмите->' +else + db 'Puzzle completed! Press->' +end if +lenVictory: + +arrow equ lenVictory-2 + +I_END: ; конец программы +;null db ? +move_count dw ? +cptr db ? +sts dw ? +sh_off db ? +task dd ? +generator dd ? +curconf: \ No newline at end of file diff --git a/programs/15/trunk/build_en.bat b/programs/15/trunk/build_en.bat new file mode 100644 index 0000000000..b1b2656d70 --- /dev/null +++ b/programs/15/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm 15.asm 15 +@pause \ No newline at end of file diff --git a/programs/15/trunk/build_ru.bat b/programs/15/trunk/build_ru.bat new file mode 100644 index 0000000000..f2438fa479 --- /dev/null +++ b/programs/15/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm 15.asm 15 +@pause \ No newline at end of file diff --git a/programs/15/trunk/macros.inc b/programs/15/trunk/macros.inc new file mode 100644 index 0000000000..1d153e8723 --- /dev/null +++ b/programs/15/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 + +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 \ No newline at end of file diff --git a/programs/3dcube2/trunk/3DCUBE2.ASM b/programs/3dcube2/trunk/3DCUBE2.ASM new file mode 100644 index 0000000000..bc26be3ef0 --- /dev/null +++ b/programs/3dcube2/trunk/3DCUBE2.ASM @@ -0,0 +1,691 @@ +; +; 3D POLYGONAL CUBE - ASCL +; +; Pavlushin Evgeni +; mail: waptap@mail.ru site: www.deck4.narod.ru +; +; Create on base 3D test sample +; Mikolaj Felix mfelix@polbox.com +; + +use32 + org 0x0 + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd I_END ; size of image + dd 0x30000 ; memory for app + dd 0x30000 ; esp + dd 0x0 , 0x0 ; I_Param , I_Icon + +MAX_POINTS equ 8 +MAX_TRIANGLES equ 12 +SCREEN_X equ 320 +SCREEN_Y equ 200 + +include 'lang.inc' +include 'ascl.inc' +include 'ascgl.inc' +include 'macros.inc' +START: + call draw_window + call init_sin_cos + +still: +; mov eax,23 ; wait for system event with 10 ms timeout +; mov ebx,1 ; wait 10 ms, then continue +; int 0x40 + + mov eax,11 + int 0x40 + + dec eax +; cmp eax,1 ; window redraw request ? + jz red + dec eax +; cmp eax,2 ; key in buffer ? + jz key + dec eax +; cmp eax,3 ; button in buffer ? + jz button + + fps 280,8,cl_White,cl_Black + +main_loop: + + mov esi,object + mov edi,object_rotated + mov ecx,MAX_POINTS*3 + cld + rep movsw + + mov esi,angle_x + mov edi,object_rotated + mov ecx,MAX_POINTS + call rotate_points + + mov esi,object_rotated + mov edi,object_translated + mov ecx,MAX_POINTS + call translate_points + + call draw_faces + + call clear_screen_buffer + + add [angle_x],2 + add [angle_y],3 + add [angle_z],1 + + 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 + jne still +exit: + mov eax,-1 + int 0x40 + +;Draw window +draw_window: + mov eax,12 ;Start + mov ebx,1 + int 0x40 + + mov eax,0 ;Draw window + mov ebx,100*65536+(SCREEN_X+9) ;x start*65536+x size + mov ecx,100*65536+(SCREEN_Y+26) ;y start*65536+y size + mov edx,0x03000000 ;0x03 use skinned window + int 0x40 + + mov eax,4 ;Out Text + mov ebx,8*65536+8 ;x start*65536+y start + mov ecx,0x00ffffff ;color White + mov edx,head_label + mov esi,hl_end-head_label + int 0x40 + + mov eax,12 ;End + mov ebx,2 + int 0x40 + ret + +head_label: db "3D TEST SAMPLE FOR MENUETOS" +hl_end: + + + +; Draw faces procedure + +draw_faces: + + mov esi,link + mov ecx,MAX_TRIANGLES +df_draw: + push ecx + mov ecx,3 + mov edi,@@tx1 ;bp +df_get_point: + xor bh,bh + mov bl,byte [esi] + shl bx,2 + mov ax,word [object_translated+bx] + mov word [edi],ax + mov ax,word [object_translated+bx+2] + mov word [edi+2],ax + inc esi + add edi,4 + dec ecx + jnz df_get_point + + mov ax,[@@ty1] + sub ax,[@@ty3] + mov bx,[@@tx2] + sub bx,[@@tx1] + imul bx + shl edx,16 + mov dx,ax + push edx + mov ax,[@@tx1] + sub ax,[@@tx3] + mov bx,[@@ty2] + sub bx,[@@ty1] + imul bx + shl edx,16 + mov dx,ax + pop ebx + sub ebx,edx + or ebx,ebx + jge df_next + + xor ah,ah + mov al,byte [si] + + mov [@@xcol],ax + + call filled_triangle +df_next: + inc si + pop ecx + dec ecx + jnz df_draw + ret + +;modify +;include graphlib.asm + +clear_screen_buffer: + +;outscrbuf + mov ebx,scrbuf + mov ecx,SCREEN_X*65536+SCREEN_Y + mov edx,5*65536+22 + mov ax,7 + int 0x40 + +;White background + mov edi,scrbuf + mov ecx,(SCREEN_X*SCREEN_Y*3)/4 + mov eax,0xffffffff + cld + rep stosd + + ret + +;include triangle.asm +; Mikolaj Felix 14/5/2001 +; mfelix@polbox.com + +;filled trangle procedure + +@@tx1 dw 0 +@@ty1 dw 0 +@@tx2 dw 0 +@@ty2 dw 0 +@@tx3 dw 0 +@@ty3 dw 0 +@@xcol dw 0 + +@@dx12 dw 0 +@@dx13 dw 0 +@@dx23 dw 0 + +filled_triangle: + + mov ax,[@@xcol] ;trnsforming color + mov bl,al ;byte bbbggrrx + mov dl,al ;to 3 byte + mov dh,al ;bbbxxxxx ggxxxxxx rrxxxxxx + and dh,00000001b + + and al,11100000b + and bl,00011000b + and dl,00000110b + shl bl,3 + shl dl,5 + + cmp dh,1 + jne no_bitup + or al,00011111b + or bl,00111111b + or dl,00111111b +no_bitup: + + shl eax,8 ;puck colors + mov al,bl + shl eax,8 + mov al,dl + mov dword [@@rgb],eax + mov eax,0 ; for 16 bit instructions + + mov ax,[@@ty1] + cmp ax,[@@ty3] + jb ft_check1 + + xchg ax,[@@ty3] + mov [@@ty1],ax + + mov ax,[@@tx1] + xchg ax,[@@tx3] + mov [@@tx1],ax +ft_check1: + mov ax,[@@ty2] + cmp ax,[@@ty3] + jb ft_check2 + + xchg ax,[@@ty3] + mov [@@ty2],ax + + mov ax,[@@tx2] + xchg ax,[@@tx3] + mov [@@tx2],ax +ft_check2: + mov ax,[@@ty1] + cmp ax,[@@ty2] + jb ft_check3 + + xchg ax,[@@ty2] + mov [@@ty1],ax + + mov ax,[@@tx1] + xchg ax,[@@tx2] + mov [@@tx1],ax +ft_check3: + + mov bx,[@@ty2] + sub bx,[@@ty1] + jnz ft_dx12_make + + mov [@@dx12],word 0 + jmp ft_dx12_done +ft_dx12_make: + mov ax,[@@tx2] + sub ax,[@@tx1] + shl ax,7 + cwd + idiv bx + mov [@@dx12],ax ; dx12 = (x2-x1)/(y2-y1) +ft_dx12_done: + + mov bx,[@@ty3] + sub bx,[@@ty1] + jnz ft_dx13_make + + mov [@@dx13],word 0 + jmp ft_dx13_done +ft_dx13_make: + mov ax,[@@tx3] + sub ax,[@@tx1] + shl ax,7 + cwd + idiv bx + mov [@@dx13],ax ; dx13 = (x3-x1)/(y3-y1) +ft_dx13_done: + + mov bx,[@@ty3] + sub bx,[@@ty2] + jnz ft_dx23_make + + mov [@@dx23],word 0 + jmp ft_dx23_done +ft_dx23_make: + mov ax,[@@tx3] + sub ax,[@@tx2] + shl ax,7 + cwd + idiv bx + mov [@@dx23],ax ; dx23 = (x3-x2)/(y3-y2) +ft_dx23_done: + + mov ax,[@@tx1] + shl ax,7 + mov bx,ax + + mov cx,[@@ty1] +ft_loop1: + + pushad + + mov [@@ly],cx + mov dx,bx + shr dx,7 + mov [@@lx2],dx + mov dx,ax + shr dx,7 + mov [@@lx1],dx + mov ax,[@@xcol] + mov [@@lcol],ax + call horizontal_line + + popad + + add ax,[@@dx13] + add bx,[@@dx12] + inc cx + cmp cx,[@@ty2] + jb ft_loop1 + + + mov bx,[@@tx2] + shl bx,7 + mov cx,[@@ty2] +ft_loop2: + + pushad + + mov [@@ly],cx + mov dx,bx + shr dx,7 + mov [@@lx2],dx + mov dx,ax + shr dx,7 + mov [@@lx1],dx + mov ax,[@@xcol] + mov [@@lcol],ax + call horizontal_line + + popad + + add ax,[@@dx13] + add bx,[@@dx23] + inc ecx + cmp cx,[@@ty3] + jb ft_loop2 + + ret + +;horizontal line subproc + +@@lx1 dw 0 +@@lx2 dw 0 +@@ly dw 0 +@@lcol dw 0 + +@@rgb dd 0 + +horizontal_line: + + mov ecx,0 + mov cx,[@@lx1] + cmp cx,[@@lx2] + ja x12 + je ext +; ret + mov cx,[@@lx2] + sub cx,[@@lx1] + mov edi,3 + jmp xx +x12: + mov cx,[@@lx1] + sub cx,[@@lx2] + mov edi,-3 + jmp xx +ext: + mov ecx,-1 ;1 +; sub ebp,3 +xx: + mov eax,0 + mov ax,[@@ly] + mov ebx,SCREEN_X ;320 + mul ebx + mov ebp,0 + mov bp,[@@lx1] ;for correct 16 bit size + add eax,ebp + mov ebx,3 + mul ebx + mov ebp,eax + sub ebp,3 ;for delete white dots + add ecx,2 +loo: + + mov eax,dword [@@rgb] + mov bl,al + shr eax,8 ;puck colors + + mov byte [scrbuf+ebp],ah + mov byte [scrbuf+ebp+1],al + mov byte [scrbuf+ebp+2],bl + add ebp,edi + dec ecx + jnz loo + + ret + +;include fixed3d.asm +; Mikolaj Felix 25/5/2001 +; mfelix@polbox.com + +;------------------------------------------------------------ +; ds:si - offset to angles +; ds:di - offset to 3d points +; cx - number of points +;------------------------------------------------------------ + +@@sin_x dw 0 +@@cos_x dw 0 +@@sin_y dw 0 +@@cos_y dw 0 +@@sin_z dw 0 +@@cos_z dw 0 + +@@px equ word [edi] +@@py equ word [edi+2] +@@pz equ word [edi+4] + +rotate_points: + + push edi + mov edi,@@sin_x + mov edx,3 +rp_sin_cos: + mov bx,word [esi] + and bx,511 + shl bx,1 + mov ax,word [sin_table+bx] + mov word [edi],ax + mov ax,word [cos_table+bx] + mov word [edi+2],ax + + add esi,2 + add edi,4 + dec edx + jnz rp_sin_cos + pop edi + +rp_rotate: + + ; rotate around x-axis + + mov ax,@@py + imul [@@cos_x] + mov bx,ax + mov si,dx + + mov ax,@@pz + imul [@@sin_x] + sub bx,ax + sbb si,dx + shrd bx,si,14 + push bx + + mov ax,@@py + imul [@@sin_x] + mov bx,ax + mov si,dx + + mov ax,@@pz + imul [@@cos_x] + add bx,ax + adc si,dx + shrd bx,si,14 + + pop @@py + mov @@pz,bx + + ; rotate around y-axis + + mov ax,@@px + imul [@@cos_y] + mov bx,ax + mov si,dx + + mov ax,@@pz + imul [@@sin_y] + sub bx,ax + sbb si,dx + shrd bx,si,14 + push bx + + mov ax,@@px + imul [@@sin_y] + mov bx,ax + mov si,dx + + mov ax,@@pz + imul [@@cos_y] + add bx,ax + adc si,dx + shrd bx,si,14 + + pop @@px + mov @@pz,bx + + ; rotate around z-axis + + mov ax,@@px + imul [@@cos_z] + mov bx,ax + mov si,dx + + mov ax,@@py + imul [@@sin_z] + sub bx,ax + sbb si,dx + shrd bx,si,14 + push bx + + mov ax,@@px + imul [@@sin_z] + mov bx,ax + mov si,dx + + mov ax,@@py + imul [@@cos_z] + add bx,ax + adc si,dx + shrd bx,si,14 + + pop @@px + mov @@py,bx + + add edi,6 + dec ecx + jnz rp_rotate + + ret + +;------------------------------------------------------------ +; ds:si - offset to 3d points +; es:di - offset to 2d points +; cx - number of points +;------------------------------------------------------------ + + mx dw 0 + my dw 0 + +translate_points: + pushad + mov eax,37 + mov ebx,1 + int 0x40 + mov ebx,eax + shr eax,16 + and ebx,0xffff + cmp ax,SCREEN_X + jna x_n + mov ax,0 ;SCREEN_X +x_n: + cmp bx,SCREEN_Y + jna y_n + mov bx,0 ;SCREEN_Y +y_n: + mov [mx],ax + mov [my],bx + popad + + mov ebx,0 ;? + mov bx,word [esi+4] + mov ax,[my] + cmp ax,0 + jng no_m + shl ax,3 + add bx,ax +no_m: + add bx,256 ; Z factor (zoom) + + mov eax,0 ;? + mov ax,word [esi] + shl ax,8 + cwd + idiv bx; bx + add ax,(SCREEN_X/2) ;160 ;X factor (center X) + stosw + + mov eax,0 ;? + mov ax,word [esi+2] + shl ax,8 + cwd + idiv bx + add ax,(SCREEN_Y/2) ;100 ;Y factor (center Y) + stosw + + add esi,6 + dec ecx + jnz translate_points + ret + +init_sin_cos: + finit + fldz + fstp [temp] + xor edi,edi + mov ecx,512 +isc_make: + fld [temp] + fld st0 + fld st0 + fsin + fmul [fixed_point_const] + fistp word [sin_table+edi] + fcos + fmul [fixed_point_const] + fistp word [cos_table+edi] + + fadd [inc_angle] + fstp [temp] + + add edi,2 + loop isc_make + ret + +temp dd 0 + +fixed_point_const dd 16384.0 +inc_angle dd 0.01227184630309 ; pi/256 + +angle_x dw 0 +angle_y dw 0 +angle_z dw 0 + +object dw -50,-50,-50, 50,-50,-50, 50,50,-50, -50,50,-50 + dw -50,-50, 50, 50,-50, 50, 50,50, 50, -50,50, 50 + +link: + db 0,1,2,10000011b, 0,2,3,10000011b ;purpure side + db 5,4,7,00000111b, 5,7,6,00000111b ;soft-red side + db 1,5,6,00011000b, 1,6,2,00011000b ;soft-lime side + db 4,0,3,11100001b, 4,3,7,11100001b ;soft-blue side + db 4,5,1,00011111b, 1,0,4,00011111b ;yellow side + db 3,2,6,00000000b, 3,6,7,00000000b ;black side + +sin_table: +rw 512 +cos_table: +rw 512 + +object_rotated: +rw MAX_POINTS*3 +object_translated: +rw MAX_POINTS*2 + +scrbuf: +I_END: \ No newline at end of file diff --git a/programs/3dcube2/trunk/ascgl.inc b/programs/3dcube2/trunk/ascgl.inc new file mode 100644 index 0000000000..107a8c2b04 --- /dev/null +++ b/programs/3dcube2/trunk/ascgl.inc @@ -0,0 +1,624 @@ +lang equ ru + +; +; Assembler +; SMALL +; CODE +; Graphics +; Libary +; +; Ver 0.10 By Pavlushin Evgeni (RUSSIA) +; www.waptap@mail.ru + +;InfoList +;0.01 LoadImage +;0.02 SetBmp +;0.03 Bmptoimg, Setimg ~01.03.2004 +;0.04 Bug deleted, copyimg ~03.05.2004 +;0.05 fullimg, collimg ~05.05.2004 +;0.06 getimg ~09.05.2004 +;0.07 convbmp ~13.05.2004 +;0.08 fps ~14.05.2004 +;0.09 drawfbox ~03.06.2004 +;0.10 all macros optimized by halyavin, add at ~07.06.2004 + +;DrawBox +macro drawfbox x,y,xs,ys,color +{ + mov ecx,y + mov ebx,x + shl ebx,16 + add ebx,xs + shl ecx,16 + add ecx,ys + mov edx,color + mov eax,13 + int 0x40 +} + +; FPS - Set Frame Per Second Display +fps_show_frequency=40 +macro fps x,y,color,delcolor +{ +local spdat,savetime,new_time,fps,fps_cntr,out_fps,new_time,ttt +local no_out_fps + jmp spdat +savetime dd 0 +fps_cntr dd 0 +fps dd 0 +ttt dd 0 +spdat: +get_time: + mov eax,3 + int 0x40 + cmp eax,[savetime] + jne new_time + inc [fps_cntr] + cmp dword [ttt],0 + je out_fps + dec dword [ttt] + jmp no_out_fps +new_time: + mov [savetime],eax + mov ebx,[fps_cntr] + mov [fps],ebx + mov [fps_cntr],0 +out_fps: +if ~(delcolor eq ) + mov ebx,x*65536+30 + mov ecx,y*65536+7 + mov edx,delcolor + mov eax,13 + int 0x40 +end if + mov dword [ttt],fps_show_frequency + mov eax,47 + mov ebx,5*65536 +; mov bl,0 + mov edx,x*65536+y + mov esi,color + mov ecx,[fps] + int 0x40 +no_out_fps: +} + + + +; COLLIMG - Collusion image's +_ldbounce_count=0; +macro collimg img1_off,x1,y1,img2_off,x2,y2,otv +{ +local bounce,exit,_1dbounce,anot,bc,nbc + mov esi,[img1_off] ;xs1 + mov edi,[img2_off] ;ys2 + mov eax,x1 ; + mov ebx,x2 ; + call _1dbounce + mov edx,ecx + mov esi,[img1_off+4] ;ys1 + mov edi,[img2_off+4] ;ys2 + mov eax,y1 ; + mov ebx,y2 ; + call _1dbounce + add edx,ecx + cmp edx,2 + je bounce + mov otv,0 + jmp exit +_ldbounce_count=_ldbounce_count+1 +if (_ldbounce_count = 1) +_1dbounce: + cmp ebx,eax + jnae anot + add eax,esi + cmp eax,ebx + jna nbc + jmp bc +anot: + add ebx,edi + cmp ebx,eax + jna nbc +bc: + mov ecx,1 + ret +nbc: + mov ecx,0 + ret +end if +bounce: + mov otv,1 +exit: +} + +; SETBMP - Set bmp to window +; (SYNTAX) SETBMP dd xstart ,dd ystart ,BMP_offset,dd soi +; (SAMPLE) SETBMP dword [xt],dword [yt],I_END,dword [tsoi] +; SETBMP 15,10,I_END,dword [tsoi] +; ( NOTE ) SOI - Start of image + +macro setbmp arg1,arg2,arg3,arg4 +{ +local nodi + cmp word [arg3],word 'BM' + jne nodi + mov eax,7 + mov ebx,arg4 ;[soi] + mov ecx,dword [arg3+18] + shl ecx,16 + add ecx,dword [arg3+22] +if (arg1 eqtype 0) & (arg2 eqtype 0) + mov edx,arg1*65536+arg2 +else + mov edx,arg1 + shl edx,16 + add edx,arg2 +end if + int 0x40 + nodi: +} + +macro setimg arg1,arg2,arg3 +{ +local nodi + mov eax,7 + mov ebx,arg3 + add ebx,8 + mov ecx,dword [arg3] + shl ecx,16 + add ecx,dword [arg3+4] +if (arg1 eqtype 0) & (arg2 eqtype 0) + mov edx,arg1*65536+arg2 +else + mov edx,arg1 + shl edx,16 + add edx,arg2 +end if + int 0x40 +} + +;Not optimiz +macro getimg imgsrc,x,y,xs,ys,imgdest +{ +local cyc + mov eax,xs + mov dword [imgdest],eax + mov eax,ys + mov dword [imgdest+4],eax + + mov eax,dword [imgsrc] ;getx size + mov edi,eax + mov ebx,y + mul ebx + add eax,x + mov ebx,3 + mul ebx ;eax=offset on imsrc + + mov ecx,0 + mov ebx,0 + mov ebp,eax + mov esi,0 + + add esi,8 + add ebp,8 + +cyc: + mov al,byte [imgsrc+ebp] + mov [imgdest+esi],al + mov al,byte [imgsrc+ebp+1] + mov [imgdest+esi+1],al + mov al,byte [imgsrc+ebp+2] + mov [imgdest+esi+2],al + add esi,3 + add ebp,3 + inc ecx + cmp ecx,xs + jne cyc + add ebp,edi + add ebp,edi + add ebp,edi + sub ebp,xs + sub ebp,xs + sub ebp,xs + mov ecx,0 + inc ebx + cmp ebx,ys + jne cyc + +} + +; +macro bmptoimg bmp_off,soi,img_off +{ +local nodix,conv + cmp word [bmp_off],word 'BM' + jne nodix + mov eax,dword [bmp_off+18] + mov ebx,dword [bmp_off+22] + mov dword [img_off],eax + mov dword [img_off+4],ebx + mul ebx + lea ecx,[eax+2*eax] + lea edi,[img_off+8] + mov esi,dword [soi] + cld + rep movsb +nodix: +} + +macro copyimg img2_off,img1_off +{ +local cop + mov eax,dword [img1_off] + mov ebx,dword [img1_off+4] + mul ebx + lea ecx,[eax+2*eax] + lea esi,[img1_off+8] + lea edi,[img2_off+8] + cld + rep movsb +} + +macro fullimg img_off,xs,ys,color +{ +local cop + mov eax,xs + mov ebx,ys + mov dword [img_off],eax + mov dword [img_off+4],ebx + mul ebx + lea ebp,[eax+2*eax] + mov esi,color +if color eqtype 0 + mov ecx,color/65536 +else + mov ecx,esi + shr ecx,16 +end if + xor edi,edi +cop: + mov word [img_off+8+edi],si + add edi,2 + mov byte [img_off+8+edi],cl + inc edi + cmp edi,ebp + jne cop +} + + + + +macro convbmp bmp_load_area,bmp_soi +{ +local status,bps,dwps,soi,sop,eop,eos,process,fileinfo,string,end_bmp +local converttable,noaddelem,nextbit,convert1bpp,convert4bpp,convert2 +local nextelem,convertno32,nomorestring,convert1,nextstring,yespicsize +local noaddword +;local qwe,bmpfn + +; convert: + movzx eax,word [bmp_load_area+28] + mul dword [bmp_load_area+18] + mov ebx,32 + div ebx + test edx,edx + je noaddword + inc eax + noaddword: + mov dword [dwps],eax ;dwps-doublewords per string + shl eax,2 + mov dword [bps],eax ;bps-bytes per string + + cmp dword [bmp_load_area+34],0 + jne yespicsize ;if picture size is defined + mul dword [bmp_load_area+22] + mov dword [bmp_load_area+34],eax + + yespicsize: + mov eax,bmp_load_area + mov ebx,eax + add ebx, [bmp_load_area+2];file size + inc ebx + mov dword [bmp_soi],ebx ;soi-start of image area for drawing + add eax, [bmp_load_area+10] + mov dword [sop],eax ;sop-start of picture in file + add eax, [bmp_load_area+34] + mov dword [eop],eax ;eop-end of picture in file + mov eax, [bmp_load_area+18] + lea eax,[eax+2*eax] ;3x pixels in eax + + mov edi,dword [bmp_soi] ;initializing + mov esi,dword [eop] + sub esi,dword [bps] + + + nextstring: + push edi + cmp word [bmp_load_area+28],24 + jne convertno32 + + mov ecx,[dwps] + cld + rep movsd + convert1: + pop edi + sub esi,dword [bps] + sub esi,dword [bps] + cmp esi,dword [sop] + jb end_bmp;nomorestring + add edi,eax + jmp nextstring + +; nomorestring: +; jmp end_bmp + + convertno32: + mov ebx,bmp_load_area + add ebx, [bmp_load_area+14] + add ebx,14 ;start of color table + push esi + add esi,dword [bps] + mov dword [eos],esi + pop esi + nextelem: + push eax + movzx eax,byte [esi] + cmp word [bmp_load_area+28],4 + je convert4bpp + cmp word [bmp_load_area+28],1 + je convert1bpp + call converttable + convert2: + pop eax + inc esi + cmp esi,dword [eos] + jae convert1 + add edi,3 + jmp nextelem + + convert4bpp: + shl ax,4 + shr al,4 + push ax + movzx eax,ah + call converttable + add edi,3 + pop ax + movzx eax,al + call converttable + jmp convert2 + + convert1bpp: + mov ecx,eax + mov edx,7 + nextbit: + xor eax,eax + bt ecx,edx + jnc noaddelem + inc eax + noaddelem: + push edx + call converttable + pop edx + dec edx + cmp edx,0xffffffff + je convert2 + add edi,3 + jmp nextbit + + converttable: + shl eax,2 + add eax,ebx + mov edx, dword [eax] + mov dword [edi],edx + ret + + +; DATA AREA + +;status dd 0 ;bit0=1 if file thread is created +bps dd 0 +dwps dd 0 +;soi dd 0 +sop dd 0 +eop dd 0 +eos dd 0 +;process dd 0 + +end_bmp: +; mov eax,dword [soi] +; mov dword [bmp_soi],eax + +} + + + + +; LOADBMP - Load bmp image from file +; (SYNTAX) LOADBMP 'file_path',temp_area(rb 0x10000),load_area,dd soi +; (SAMPLE) LOADBMP '/rd/1/menuet.bmp',temp_area,I_END,tsoi +; ( NOTE ) Macros create on Base of +; Picture browser by lisovin@26.ru & Ivan Poddubny +; SOI - Start of image + +macro loadbmp bmp_file_name,bmp_temp_area,bmp_load_area,bmp_soi +{ +local status,bps,dwps,soi,sop,eop,eos,process,fileinfo,string,end_bmp +local converttable,noaddelem,nextbit,convert1bpp,convert4bpp,convert2 +local nextelem,convertno32,nomorestring,convert1,nextstring,yespicsize +local noaddword +;local qwe,bmpfn + + mov dword [fileinfo+8],1 ; how many blocks to read (1) + mov eax,58 + mov ebx,fileinfo + int 0x40 + mov eax,[bmp_load_area+2] + shr eax,9 ; поделим на 512 и прибавим 1 - получим число блоков + inc eax + mov dword [fileinfo+8],eax + mov eax,58 + mov ebx,fileinfo + int 0x40 + +; jmp qwe +;bmpfn db bmp_file_name +;qwe: +; mov eax,6 +; mov ebx,bmpfn +; mov ecx,0 +; mov edx,0xFFFFFF +; mov esi,bmp_load_area +; mov edi,0 +; int 0x40 + +; convert: + movzx eax,word [bmp_load_area+28] + mul dword [bmp_load_area+18] + mov ebx,32 + div ebx + test edx,edx + je noaddword + inc eax + noaddword: + mov dword [dwps],eax ;dwps-doublewords per string + shl eax,2 + mov dword [bps],eax ;bps-bytes per string + + cmp dword [bmp_load_area+34],0 + jne yespicsize ;if picture size is defined + mul dword [bmp_load_area+22] + mov dword [bmp_load_area+34],eax + + yespicsize: + mov eax,bmp_load_area + push eax + add eax, [bmp_load_area+2];file size + inc eax + mov dword [soi],eax ;soi-start of image area for drawing + pop eax + add eax, [bmp_load_area+10] + mov dword [sop],eax ;sop-start of picture in file + add eax, [bmp_load_area+34] + mov dword [eop],eax ;eop-end of picture in file + mov eax, [bmp_load_area+18] + mov ebx,3 + mul ebx ;3x pixels in eax + + mov edi,dword [soi] ;initializing + mov esi,dword [eop] + sub esi,dword [bps] + + + nextstring: + push edi + cmp word [bmp_load_area+28],24 + jne convertno32 + + mov ecx,[dwps] + cld + rep movsd + convert1: + pop edi + sub esi,dword [bps] + sub esi,dword [bps] + cmp esi,dword [sop] + jb nomorestring + add edi,eax + jmp nextstring + + nomorestring: + jmp end_bmp + + convertno32: + mov ebx,bmp_load_area + add ebx, [bmp_load_area+14] + add ebx,14 ;start of color table + push esi + add esi,dword [bps] + mov dword [eos],esi + pop esi + nextelem: + push eax + movzx eax,byte [esi] + cmp word [bmp_load_area+28],4 + je convert4bpp + cmp word [bmp_load_area+28],1 + je convert1bpp + call converttable + convert2: + pop eax + inc esi + cmp esi,dword [eos] + jae convert1 + add edi,3 + jmp nextelem + + convert4bpp: + shl ax,4 + shr al,4 + push ax + movzx eax,ah + call converttable + add edi,3 + pop ax + movzx eax,al + call converttable + jmp convert2 + + convert1bpp: + mov ecx,eax + mov edx,7 + nextbit: + xor eax,eax + bt ecx,edx + jnc noaddelem + inc eax + noaddelem: + push edx + call converttable + pop edx + dec edx + cmp edx,0xffffffff + je convert2 + add edi,3 + jmp nextbit + + converttable: + shl eax,2 + add eax,ebx + mov edx, dword [eax] + mov dword [edi],edx + ret + + +; DATA AREA + +;status dd 0 ;bit0=1 if file thread is created +bps dd 0 +dwps dd 0 +soi dd 0 +sop dd 0 +eop dd 0 +eos dd 0 +;process dd 0 + +; DATA AREA +fileinfo: + dd 0 + dd 0 + dd 1 ;number of blocks of 512 bytes + dd bmp_load_area + dd bmp_temp_area +string: + db bmp_file_name,0 + db ' ' + db ' ' + db ' ' + db ' ',0 + + +end_bmp: + mov eax,dword [soi] + mov dword [bmp_soi],eax + +} diff --git a/programs/3dcube2/trunk/ascl.inc b/programs/3dcube2/trunk/ascl.inc new file mode 100644 index 0000000000..216ef7e24b --- /dev/null +++ b/programs/3dcube2/trunk/ascl.inc @@ -0,0 +1,499 @@ +lang equ ru ; ru en fr ge fi + +; +; Assembler +; SMALL +; CODE +; Libary +; +; Ver 0.09 By Pavlushin Evgeni (RUSSIA) +; www.waptap@mail.ru + +;InfoList +;0.01 scank,putpix,puttxt +;0.02 label,random,colors +;0.03 window,startwd,endwd,attributes +;0.04 close,delay,scevent ~30.04.2004 +;0.05 small random, ~04.05.2004 +;0.06 wtevent ~09.05.2004 +;0.07 timeevent ~23.05.2004 +;0.08 txtput ~14.06.2004 +;0.09 opendialog,savedialog ~20.06.2004 + +macro opendialog redproc,openoff,erroff,path,testtime +{ +local still, dlg_file, clip_file, redwait +local button, key, red, zzz, still, zzz2, incf, file_is_open, zzz3 + + mov ecx,200 +zzz3: + mov byte [path+ecx-1],0 + loop zzz3 + + dec byte [clip_file+7] +incf: + inc byte [clip_file+7] + mov eax,6 + mov ebx,clip_file + mov ecx,0 + mov edx,-1 + mov esi,path + int 0x40 + cmp byte [clip_file+7],'Z' + je erroff + cmp eax,0xffffffff + jne incf + + mov ecx,200 +zzz2: + mov byte [path+ecx],0 + loop zzz2 + + mov ebx,clip_file + mov ecx,path + mov edx,100 + mov esi,0 + mov eax,33 + int 0x40 + + mov ebx,dlg_file + mov ecx,clip_file + mov eax,19 + int 0x40 + +still: + scevent red,key,button + cmp byte [path],0 + jne file_is_open + cmp dword [redwait],testtime ;20 + jnae zzz + mov eax,6 + mov ebx,clip_file + mov ecx,0 + mov edx,-1 + mov esi,path + int 0x40 + cmp eax,0xffffffff + je erroff ;errexit + mov dword [redwait],0 +zzz: + delay 5 + inc dword [redwait] + jmp still + +file_is_open: + mov eax,32 + mov ebx,clip_file + int 0x40 + jmp openoff + +key: ; key + int 0x40 ; read (eax=2) + jmp still +button: ; button + mov eax,17 ; get id + int 0x40 + cmp ah,1 ; button id=1 ? + jne still + mov eax,-1 ; close this program + int 0x40 + +red: + call redproc + jmp still + +dlg_file db 'SYSXTREE ' +clip_file db 'OPENCLPACLP' + db 'O' ;Dialog type O-open S-save + db 0 ;Marker +redwait dd 0 +} + +macro savedialog redproc,openoff,erroff,path,testtime +{ +local still, dlg_file, clip_file, redwait, zzz3 +local button, key, red, zzz, still, zzz2, incf, file_is_open + + mov ecx,200 +zzz3: + mov byte [path+ecx-1],0 + loop zzz3 + + dec byte [clip_file+7] +incf: + inc byte [clip_file+7] + mov eax,6 + mov ebx,clip_file + mov ecx,0 + mov edx,-1 + mov esi,path + int 0x40 + cmp byte [clip_file+7],'Z' + je erroff + cmp eax,0xffffffff + jne incf + + mov ecx,200 +zzz2: + mov byte [path+ecx],0 + loop zzz2 + + mov ebx,clip_file + mov ecx,path + mov edx,100 + mov esi,0 + mov eax,33 + int 0x40 + + mov ebx,dlg_file + mov ecx,clip_file + mov eax,19 + int 0x40 + +still: + scevent red,key,button + cmp byte [path],0 + jne file_is_open + cmp dword [redwait],testtime ;20 + jnae zzz + mov eax,6 + mov ebx,clip_file + mov ecx,0 + mov edx,-1 + mov esi,path + int 0x40 + cmp eax,0xffffffff + je erroff ;errexit + mov dword [redwait],0 +zzz: + delay 5 + inc dword [redwait] + jmp still + +file_is_open: + mov eax,32 + mov ebx,clip_file + int 0x40 + jmp openoff + +key: ; key + int 0x40 ; read (eax=2) + jmp still +button: ; button + mov eax,17 ; get id + int 0x40 + cmp ah,1 ; button id=1 ? + jne still + mov eax,-1 ; close this program + int 0x40 + +red: + call redproc + jmp still + +dlg_file db 'SYSXTREE ' +clip_file db 'SAVECLPACLP' + db 'S' ;Dialog type O-open S-save + db 0 ;Marker +redwait dd 0 +} + + +; RANDOM - generate random count (small) +; (SYNTAX) RANDOM MaxCount,OutArgument +; (SAMPLE) RANDOM 10000,eax +; ( NOTE ) Maxint<65536 ; use random 65536,eax for more combinations + +randomuse = 0 + +macro random arg1,arg2 +{ +local rxproc +randomuse = randomuse + 1 + + jmp rxproc + +if defined randomuse & randomuse = 1 +randomproc: + jmp rnj +rsx1 dw 0x4321 +rsx2 dw 0x1234 +rnj: +; mov eax,arg1 + push bx + push cx + push dx + push si + push di + mov cx,ax + mov ax,word ptr rsx1 + mov bx,word ptr rsx2 + mov si,ax + mov di,bx + mov dl,ah + mov ah,al + mov al,bh + mov bh,bl + xor bl,bl + rcr dl,1 + rcr ax,1 + rcr bx,1 + add bx,di + adc ax,si + add bx,0x62e9 + adc ax,0x3619 + mov word ptr rsx1,bx + mov word ptr rsx2,ax + xor dx,dx + cmp ax,0 + je nodiv + cmp cx,0 + je nodiv + div cx +nodiv: + mov ax,dx + pop di + pop si + pop dx + pop cx + pop bx +; mov arg2,0 +; mov arg2,eax + ret +end if + +rxproc: + mov eax,arg1 + call randomproc + mov arg2,0 + mov arg2,eax +} + +macro scank +{ + mov eax,10 + int 0x40 +} + +macro putpix x,y,color +{ + mov ebx,x + mov ecx,y + mov edx,color + mov eax,1 + int 0x40 +} + +macro puttxt x,y,offs,size,color +{ + mov ebx,x + shl ebx,16 + add ebx,y + mov ecx,color + mov edx,offs + mov esi,size + mov eax,4 + int 0x40 +} + +;_ equ '____' + +;macro libtest x,y,color +;{ +;if x = as dword +; mov ebx,x +;end if +; mov ecx,y +; mov edx,color +; mov eax,1 +; int 0x40 +;} + + +macro outcount data, x, y, color, numtype +{ + mov ecx,data + mov ebx,numtype + mov bl,0 + mov edx,x*65536+y + mov esi,color + mov eax,47 + int 0x40 +} + +; SCEVENT - Scan event + +macro scevent red,key,but +{ + mov eax,11 + int 0x40 + dec eax + jz red + dec eax + jz key + dec eax + jz but +} + +; WTEVENT - Wait event + +macro wtevent red,key,but +{ + mov eax,10 + int 0x40 + dec eax + jz red + dec eax + jz key + dec eax + jz but +} + +; TIMEEVENT - Wite for event with timeout + +macro timeevent xfps,noevent,red,key,but +{ + mov eax,23 + mov ebx,xfps + int 0x40 + cmp eax,0 + je noevent + dec eax + jz red + dec eax + jz key + dec eax + jz but +} + + +; CLOSE - Close program + +macro close +{ + mov eax,-1 + int 0x40 +} + +; DELAY - Create delay 1/100 sec +; (SYNTAX) Delay time +; (SAMPLE) Delay 100 ;delay 2 sec 1/100*200=2 sec + +macro delay arg1 +{ + mov eax,5 + mov ebx,arg1 + int 0x40 +} + +; WINDOW - Draw window +; (SYNTAX) WINDOW Xstart,Ystart,'Text',Color +; (SAMPLE) WINDOW 10,10,640+8,480+24,window_Skinned + +macro window arg1,arg2,arg3,arg4,arg5 +{ + mov ebx,arg1*65536+arg3 + mov ecx,arg2*65536+arg4 + mov edx,arg5 + mov eax,0 + int 0x40 +} + +macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7 +{ + mov ebx,arg1*65536+arg3 + mov ecx,arg2*65536+arg4 + mov edx,arg5 + mov esi,arg6 + mov edi,arg7 + mov eax,0 + int 0x40 +} + + +; STARTWD - Start of window draw + +macro startwd +{ + mov eax,12 + mov ebx,1 + int 0x40 +} + +; ENDWD - End window draw + +macro endwd +{ + mov eax,12 + mov ebx,2 + int 0x40 +} + +; LABEL - Put text to frame +; (SYNTAX) LABEL Xstart,Ystart,'Text',Color +; (SAMPLE) LABEL 10,12,'Hello World!',cl_Green+font_Big + +macro label arg1,arg2,arg3,arg4 +{ +local asd,lab + jmp asd +lab db arg3 ;arg label +asd: + mov ebx,arg1 ;arg1=y arg2=x + shl ebx,16 + add ebx,arg2 + mov ecx,arg4 ;arg4 color + mov edx,lab + mov esi,asd-lab ;calc size + mov eax,4 + int 0x40 +} + +;Key's +key_Up equ 178 +key_Down equ 177 +key_Right equ 179 +key_Left equ 176 +key_Esc equ 27 +key_Space equ 32 +key_Enter equ 13 +key_Bspace equ 8 +key_F1 equ 50 +key_F2 equ 51 +key_F3 equ 52 +key_F4 equ 53 +key_F5 equ 54 +key_F6 equ 55 +key_F7 equ 56 +key_F8 equ 57 +key_F9 equ 48 +key_F10 equ 49 +key_F11 equ 68 +key_F12 equ 255 +key_Home equ 180 +key_End equ 181 +key_PgUp equ 184 +key_PgDown equ 183 + +;Attributes + +;Window Attributes +window_Skinned equ 0x03000000 +window_Type2 equ 0x02000000 +window_Type1 equ 0x00000000 +window_Reserve equ 0x01000000 + +;Font Attributes +font_Big equ 0x10000000 + +;Colors +cl_White equ 0x00ffffff +cl_Black equ 0x00000000 +cl_Grey equ 0x00888888 +cl_Red equ 0x00ff0000 +cl_Lime equ 0x0000ff00 +cl_Green equ 0x0000af00 +cl_Blue equ 0x000000ff +cl_Purple equ 0x008080ff +cl_Violet equ 0x008040ff +cl_Cyan equ 0x0040e0ff diff --git a/programs/3dcube2/trunk/build_en.bat b/programs/3dcube2/trunk/build_en.bat new file mode 100644 index 0000000000..2789ea29b8 --- /dev/null +++ b/programs/3dcube2/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm 3dcube2.asm 3dcube2 +@pause \ No newline at end of file diff --git a/programs/3dcube2/trunk/build_ru.bat b/programs/3dcube2/trunk/build_ru.bat new file mode 100644 index 0000000000..18852f6b05 --- /dev/null +++ b/programs/3dcube2/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm 3dcube2.asm 3dcube2 +@pause \ No newline at end of file diff --git a/programs/3dcube2/trunk/macros.inc b/programs/3dcube2/trunk/macros.inc new file mode 100644 index 0000000000..5527ff55c1 --- /dev/null +++ b/programs/3dcube2/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 { ; mike.dld + if ~a eq + mov reg,a + end if +} + +macro mcall a,b,c,d,e,f { ; mike.dld + __mov eax,a + __mov ebx,b + __mov ecx,c + __mov edx,d + __mov esi,e + __mov edi,f + int 0x40 +} + + + +; language for programs +lang fix ru ; ru en fr ge fi + + + +; optimize the code for size +__regs fix + +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 \ No newline at end of file diff --git a/programs/3detx60b/trunk/3DETX60B.ASM b/programs/3detx60b/trunk/3DETX60B.ASM new file mode 100644 index 0000000000..08c20f2097 --- /dev/null +++ b/programs/3detx60b/trunk/3DETX60B.ASM @@ -0,0 +1,2539 @@ +; +; 3D ТЕКСТУРИРОВАНЫЙ ДВИЖОК 3D TEXTURED ENGINE +; АВТОР: Павлюшин Евгений AUTOR: Pavlushin Evgeni +; +; Компилируется с помощью FASM ассемблера для MenuetOS +; Compile with FASM assembler for MenuetOS +; +; 20.11.04 Fast point calc & triangle draw +; Little matrix no (trangle massive) +; Fast triangle, del triangle out of screen +; 16.12.04 Fast triangle with MMX +; 20.12.04 Out triangle fatal bug's deleted, "black zones" deleted +; Matrix move support +; 24.12.04 Fast keyboard scanning +; Z-ground level map work +; Texture draw correction deleted "black zones" +; 04.01.05 Moveing texture +; 05.01.05 Water dynamic texture +; 06.01.05 Texture pack (many textures in one file) +; 07.01.05 Z-sorting +; 08.01.05 Triangle good clipping calculating (speed up) +; 4 byte Z-sorting, more dynamic of water +; 09.01.05 Texture map from 256 color bmp file +; Pixel Z-buffer, good speed! +; 21.01.05 Models buffer add. +; 25.01.05 Models buffer update, Add 2 new models. +; 29.01.05 Dynamic model array +; 01.02.05 1 picture MipMap calculation +; 04.02.05 All picture MipMap calculation, proc speed up. +; Simple Triangel MipMap chose. +; 05.02.05 Normal Triangel MipMap chose. +; 12.02.05 Best QUALITY of Textured TRIANGEL! +; 13.02.05 add new models. All camera axis calculating +; 16.02.05 Simple model turning +; 17.02.05 Advanced model turning, model tmpoints massive deleted +; New map size 128, add new models. +; 25.02.05 Left side clipping bug deleted +; 26.02.05 Optimization of textured line algorythm +; 24.04.05 Test pixel z-buffer it's work. Use new textri algorythm +; 30.04.05 Fast Y-clipping + +use32 + +SCREEN_X equ 800 ;320 ;Screen size easy change +SCREEN_Y equ 600 ;200 +DSCREEN_X equ SCREEN_X-1 ;320 ;For triangle clipping +DSCREEN_Y equ SCREEN_Y-1 ;200 +MATRIX_XSIZE equ 64;32;64;100 ;Ground matrix size +MATRIX_YSIZE equ 64;32;64;100 +SECTOR_SIZE equ 100 ;Size of matrix sector +MAP_XSIZE equ 128 ;Rezolution of map file +MAP_YSIZE equ 128 + + org 0x0 + db 'MENUET01' ; 8 байт интдефикатор + dd 0x01 ; версия заголовка + dd START ; адресс начала кода + dd I_END ; размер программы + dd I_END+(SCREEN_X*SCREEN_Y*3+50000) ; размер памяти для прогграммы + dd I_END+(SCREEN_X*SCREEN_Y*3+10000) ; esp + dd 0x0 , 0x0 ; I_Param , I_Icon + +include 'lang.inc' +include 'ascgl.inc' +include 'ascl.inc' + +START: ; начало приложения +; Draw window at first + call draw_window + + ; Decoding groud texture and ground level map + gif_hash_offset = gif_hash_area + ;texture's + giftoimg texpack_gif,texpack_img-8 + ;ground level map + giftoimg gif_file_area5,glm_img_area + +;get 8bitmap from 256 colors bmp file + mov ebp,128;64 + mov esi,0x043a+128*128-4;64*64-4 + sub esi,128;64 + mov edi,0 + mov ecx,128;64 +texmap_unp: + mov al,[bmp_texmap+esi] + mov [img_area+edi],al + inc esi + inc edi + dec ecx + jnz texmap_unp + mov ecx,128;64 + sub esi,256;128 + dec ebp + jnz texmap_unp + + +;Unpack textures + + mov esi,texpack_img + mov edi,texture_img + mov edx,16 + mov ecx,16 +tpuckloop: + pushad + call unpuck + popad + add esi,32*3 + add edi,4095 + dec ecx + jnz tpuckloop + add esi,31*32*16*3 + mov ecx,16 + dec edx + jnz tpuckloop + +; +; Unpuck one texture procendure +; + jmp skip_unpuck +unpuck: + mov ecx,32 + mov edx,32 +tunploop: + mov ax,[esi] + mov [edi],ax + mov al,[esi+2] + mov [edi+2],al + add esi,3 + add edi,3 + dec ecx + jnz tunploop + mov ecx,32 + add esi,(32*16*3)-(32*3) + dec edx + jnz tunploop + ret +skip_unpuck: + + +;calculating all mipmaps + mov esi,texture_img + mov ecx,256 ;quantity of textures +mmaploop: + mov ebp,32 ;max mipmap texture + pusha + call texgen + popa + add esi,4095 ;next mipmap block + dec ecx + jnz mmaploop + + jmp skip_texgen + +;******************************** +; MIPMAP TEXTURE GENERATION +; +; in put: +; esi - offset to texture +; ebp - mipmap max size (32 for this sample) +;******************************** + +texgen: + push esi + mov eax,ebp + imul eax,ebp + imul eax,3 + add eax,esi + mov edi,eax + + mov eax,ebp + shr eax,1 + mov dh,al + mov dl,al + mov cl,dl + + mov ecx,ebp + mov eax,ebp + shl eax,1 + add ecx,eax + +miploop: +; Red + xor bx,bx ;for add + xor ax,ax ;for add + mov al,[esi+0] + add bx,ax + mov al,[esi+3+0] + add bx,ax + mov al,[esi+ecx+0] + add bx,ax + mov al,[esi+ecx+3+0] + add bx,ax + shr bx,2 ;/4 + mov [edi+0],bl +;Green + xor bx,bx ;for add + xor ax,ax ;for add + mov al,[esi+1] + add bx,ax + mov al,[esi+3+1] + add bx,ax + mov al,[esi+ecx+1] + add bx,ax + mov al,[esi+ecx+3+1] + add bx,ax + shr bx,2 ;/4 + mov [edi+1],bl +;Blue + xor bx,bx ;for add + xor ax,ax ;for add + mov al,[esi+2] + add bx,ax + mov al,[esi+3+2] + add bx,ax + mov al,[esi+ecx+2] + add bx,ax + mov al,[esi+ecx+3+2] + add bx,ax + shr bx,2 ;/4 + mov [edi+2],bl + + add esi,6 + add edi,3 + dec dl + jnz miploop + mov ax,bp + shr ax,1 + mov dl,al + add esi,ecx + dec dh + jnz miploop + pop esi + + mov eax,ebp + imul eax,ebp + imul eax,3 + add esi,eax + shr ebp,1 + cmp ebp,1 + jne texgen + ret +skip_texgen: + + +;Copy dynamic water texture +; ???????????? + mov ecx,32*32*3 + mov esi,texture_img+4095 ;32*32*3 + mov edi,texture_limg + cld + rep movsb + + ; init sine wave for dynamic water texture + finit + mov edi,sinwave + mov ecx,32;256 + isv_loop: + fld [angle] + fld st + fsin + fmul [mul_wave] + fistp word [edi] + fadd [d_angle] + fstp [angle] + add edi,2 + dec ecx + jnz isv_loop + + +;Initalize keyboard + mov eax,66 + mov ebx,1 + mov ecx,1 + int 0x40 + + mov eax,26 + mov ebx,2 + mov ecx,1 + mov edx,keymap+100 + int 0x40 + +;Build triangle matrix + mov esi,points + mov eax,-(MATRIX_XSIZE/2)*SECTOR_SIZE + mov ebx,-(MATRIX_YSIZE/2)*SECTOR_SIZE + mov ebp,img_area+8 +loomat: + mov [esi],eax ;x-set + mov [esi+4],ebx ;y-set + mov [esi+8],ecx ;z-set + add ebp,3 + add esi,4*3 + add eax,SECTOR_SIZE + cmp eax,((MATRIX_YSIZE/2)+1)*SECTOR_SIZE + jnge loomat + mov eax,-(MATRIX_YSIZE/2)*SECTOR_SIZE + add ebx,SECTOR_SIZE + cmp ebx,((MATRIX_XSIZE/2)+1)*SECTOR_SIZE + jnge loomat + +; Create z-ground good algorythm not already yet (64x64 map) + mov esi,glm_img_area+8 + mov edi,ground_level_map +loox: +; draw_courner_points + mov eax,[esi] + call get_z +; mov [edi],eax + + mov eax,[esi+((MATRIX_XSIZE-1)*4)] + call get_z +; mov [edi+((MATRIX_XSIZE)*4)],eax + + mov eax,[esi+(((MATRIX_XSIZE)*(MATRIX_YSIZE-1)+1)*4)] + call get_z +; mov [edi+(((MATRIX_XSIZE+1)*(MATRIX_YSIZE)-0)*4)],eax + + mov eax,[esi+(((MATRIX_XSIZE)*(MATRIX_YSIZE)-1)*4)] + call get_z +; mov [edi+(((MATRIX_XSIZE+1)*(MATRIX_YSIZE+1)-1)*4)],eax + + + jmp skip_gz +get_z: + xor ebx,ebx + xor ecx,ecx + mov bl,al + add ecx,ebx + mov bl,ah + add ecx,ebx + shr eax,16 + mov bl,al + add ecx,ebx + mov eax,ecx + xor edx,edx + mov ebx,3 + cdq + div ebx + neg eax + ret +skip_gz: + +; z-ground livel facking method (65x65 map) + mov esi,glm_img_area+8 + mov edi,ground_level_map + mov ebp,(MAP_XSIZE+1)*(MAP_YSIZE+1) +looglm: + mov eax,[esi] +; and eax,0x000000ff + call get_z + mov [edi],eax + add esi,3 + add edi,1 + dec ebp + jnz looglm + +;Fill model massive + mov ecx,[model_mas_start] + imul ecx,8 + add ecx,4 + mov esi,model_mas_start + mov edi,model_mas + cld + rep movsd + + jmp skip_moddata +model_mas_start: +dd 12 ;quantity of models +dd 0,0,-150,0,0,0,0,bunker +dd 60,-250,-190,0,0,64,0,tank +dd 0,180,-150,0,0,0,0,cannon +dd 0,480,-150,0,0,0,0,outpost +dd 260,60,-150,0,0,0,0,bunker +dd 60,260,-150,0,0,0,0,outpost +dd 210,410,-150,0,0,0,0,cannon +dd 160,260,-150,0,0,0,0,tree +dd 100,-360,-150,0,0,192,0,gqfa +dd 10,580,-150,0,0,0,0,repear +dd 460,160,-100,0,0,0,0,red_flag +dd 60,360,-170,0,0,40,0,cannon +skip_moddata: + + +;Main loop +still: ; основной цикл + mov eax,11 ; проверка состояния окна + int 0x40 + + cmp eax,1 ; окно сдвинули его нужно перерисовать + je red + cmp eax,2 ; нажата клавиша на клавиатуре + je key + cmp eax,3 ; нажата кнопка в окне + je button + +; delay 10 +; cmp [autorot],0 ;frize no fps show when autorot off +; je still + +cycle: + call clrscr ; clear screen buffer + call clrzbuf ; clear z-buffer + call render_scene ; calculating scene + call dispimg ; show buffer + + fps_show_frequency=0 + fps 10,10,cl_White,cl_Black + + +;turn model on z-axis + inc dword [model_mas+4*6] + and dword [model_mas+4*6],011111111b + + +; Sin wave dynamic texture for water +; jmp ndt + xor edi,edi + mov dx,32 + mov bp,word [sin_pos] +dp_ver: + mov cx,32 ;320 + mov si,word [sin_pos] +dp_hor: + and ebp,0000ffffh + mov ax,word [sinwave+ebp] + add ax,cx + and ax,31 + + and esi,0000ffffh + mov bx,word [sinwave+esi] + add bx,dx + and bx,31 + shl bx,5 + add bx,ax + + push bx + imul bx,3 + and ebx,0000ffffh + mov ax,[texture_limg+ebx] + mov [texture_img2+edi],ax + mov al,[texture_limg+ebx+2] + mov [texture_img2+edi+2],al + pop bx + + add edi,3 + add si,2 + and si,63;511 + + dec cx + jnz dp_hor + add bp,2 + and bp,63;511 + dec dx + jnz dp_ver + +; update sine position for next frame + add word [sin_pos],2 + and word [sin_pos],63;511 + +;Move water texture + jmp ndt + mov esi,texture_limg + mov ecx,32*32-1 +loodt: + mov al,byte [esi] + mov bl,byte [esi+1] + mov dl,byte [esi+2] + mov ah,byte [esi+3] + mov bh,byte [esi+4] + mov dh,byte [esi+5] + mov byte [esi],ah + mov byte [esi+1],bh + mov byte [esi+2],dh + mov byte [esi+3],al + mov byte [esi+4],bl + mov byte [esi+5],dl + add esi,3 + dec ecx + jnz loodt +ndt: + +;Creat mipmap pack for dynamic texture + mov ebp,32 + mov esi,texture_img+4095 + call texgen + + + mov eax,4 ; function 4 : write text to window + mov ebx,8*65536+8 ; [x start] *65536 + [y start] + mov ecx,0x0000ff00 ; font 1 & color ( 0xF0RRGGBB ) + mov edx,keymap ; pointer to text beginning + mov esi,100 ; text length + int 0x40 + add edx,100 + add ebx,10 + mov esi,60 ; text length + mov ecx,0x00dddddd ; font 1 & color ( 0xF0RRGGBB ) + int 0x40 + mov edx,usemap + mov esi,60 ; text length + mov ecx,0x0000ff00 + int 0x40 + jmp rx + ;01234567890123456789012345678901234567890123456789 +usemap db ' E wer u [] asd zxc ' + db ' ' +rx: + + cmp byte [keymap+1],0 + je n_esc + jmp exit +n_esc: + + cmp byte [keymap+22],0 + je n_u + mov [Xangle],0 + mov [Yangle],0 + mov [Zangle],0 +n_u: + +; t,y - mipmap cntrol + cmp byte [keymap+20],0 + je n_t + inc [mipzoom] +n_t: + cmp byte [keymap+21],0 + je n_y + dec [mipzoom] +n_y: + cmp byte [keymap+23],0 + je n_i + mov byte [keymap+23],0 ; reset key + cmp [mipmapwork],1 + je i_1 +i_0: + mov [mipmapwork],1 + jmp n_i +i_1: + mov [mipmapwork],0 +n_i: + + + cmp byte [keymap+26],0 + je n_lsk + add [Xcam],1 +n_lsk: + cmp byte [keymap+27],0 + je n_rsk + sub [Xcam],1 +n_rsk: + cmp byte [keymap+18],0 + je n_e + add [Yangle],1 +n_e: + cmp byte [keymap+45],0 + je n_x + sub [Yangle],1 +n_x: + cmp byte [keymap+31],0 + je n_s + add [Xangle],1 +n_s: + cmp byte [keymap+32],0 + je n_d + sub [Xangle],1 +n_d: + cmp byte [keymap+44],0 + je n_z + add [Zangle],1 +n_z: + cmp byte [keymap+46],0 + je n_c + sub [Zangle],1 +n_c: + cmp byte [keymap+17],0 + je n_w + add [Zcam],25 ;250 +n_w: + cmp byte [keymap+19],0 + je n_r + sub [Zcam],25 ;250 +n_r: + + cmp byte [keymap+75],0 + je n_lk + add [Zcamangle],1 + and [Zcamangle],011111111b +n_lk: + cmp byte [keymap+77],0 + je n_rk + sub [Zcamangle],1 + and [Zcamangle],011111111b +n_rk: + + cmp byte [keymap+79],0 + je n_num1 + add [Xcamangle],1 + and [Xcamangle],011111111b +n_num1: + cmp byte [keymap+81],0 + je n_num3 + sub [Xcamangle],1 + and [Xcamangle],011111111b +n_num3: + cmp byte [keymap+71],0 + je n_num7 + add [Ycamangle],1 + and [Ycamangle],011111111b +n_num7: + cmp byte [keymap+73],0 + je n_num9 + sub [Ycamangle],1 + and [Ycamangle],011111111b +n_num9: + + + + cmp byte [keymap+30],0 + je n_a + mov byte [keymap+30],0 ; reset key + cmp [autorot],1 + je a_1 +a_0: + mov [autorot],1 + jmp n_a +a_1: + mov [autorot],0 +n_a: + +; for camera +; mov ebx,[Xcamangle] +; call GetSinCos +; mov [Xcamsin],eax +; mov [Xcamcos],ebx + +; mov ebx,[Ycamangle] +; call GetSinCos +; mov [Ycamsin],eax +; mov [Ycamcos],ebx + + mov ebx,[Zcamangle] + call GetSinCos + mov [Zcamsin],eax + mov [Zcamcos],ebx + + mov eax,[Zcamsin] + mov ebx,[Zcamcos] +; mov ecx,[Xcamsin] +; mov edx,[Xcamcos] +; mov esi,[Ycamsin] +; mov edi,[Ycamcos] + + sar eax,4 + sar ebx,4 +; sar ecx,4 +; sar edx,4 +; sar esi,4 +; sar edi,4 + + cmp byte [keymap+72],0 + je n_uk + sub [Xcam],eax + sub [Ycam],ebx + +; sub [Zcam],ecx +; sub [Ycam],edx + +; sub [Xcam],esi +; add [Zcam],edi + +n_uk: + cmp byte [keymap+80],0 + je n_dk + add [Xcam],eax + add [Ycam],ebx + +; add [Zcam],ecx +; add [Ycam],edx + +; add [Xcam],esi +; sub [Zcam],edi + +n_dk: + + xor ebp,ebp +move_test: + cmp [Xcam],-SECTOR_SIZE/2 + jnl ok1 + add [Xcam],SECTOR_SIZE + dec [Xmap] + jmp move_test +ok1: + cmp [Xcam],SECTOR_SIZE/2 + jng ok2 + sub [Xcam],SECTOR_SIZE + inc [Xmap] + jmp ok1 +ok2: + cmp [Ycam],-SECTOR_SIZE/2 + jnl ok3 + add [Ycam],SECTOR_SIZE + dec [Ymap] + jmp ok2 +ok3: + cmp [Ycam],SECTOR_SIZE/2 + jng ok4 + sub [Ycam],SECTOR_SIZE + inc [Ymap] + jmp ok3 +ok4: + + and [Xangle],011111111b + and [Yangle],011111111b + and [Zangle],011111111b + + jmp still + + red: ; redraw + call draw_window + jmp still + + key: ; key + mov eax,2 ; just read it and ignore + int 0x40 + + shr eax,8 + and eax,0xff + mov ah,al + + mov ebx,0 + mov bl,ah + cmp bl,224 + je noisa ; ignore Ext code + cmp bl,170 + je noisa ; ignore Key Up code + cmp bl,128 + ja isa + mov [keymap+ebx],byte 'X' ; set press marker to key id + jmp noisa +isa: + sub bl,128 + mov [keymap+ebx],byte 0 ; reset key marker +noisa: + jmp n_a + + jmp still ; cycle + + button: ; button + mov eax,17 ; get id + int 0x40 + cmp ah,1 + jz exit + jmp cycle + +exit: + mov eax,-1 + 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 + ; DRAW WINDOW + mov eax,0 ; function 0 : define and draw window + mov ebx,0*65536+SCREEN_X-1 ; [x start] *65536 + [x size] + mov ecx,0*65536+SCREEN_Y-1 ; [y start] *65536 + [y size] + mov edx,0x03ffffff ; color of work area RRGGBB,8->color gl + mov esi,0x005080d0 ; color of grab bar RRGGBB,8->color gl + mov edi,0x005080d0 ; 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,0x10ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelt ; pointer to text beginning + mov esi,labellen-labelt ; text length + int 0x40 + + mov eax,12 + mov ebx,2 + int 0x40 + ret + +dispimg: + mov eax,7 + mov ebx,I_END ;zbuffer + mov ecx,SCREEN_X*65536+SCREEN_Y + xor edx,edx ;0*65536+0 + int 0x40 +; ret + + mov eax,8 + mov ebx,(SCREEN_X-30)*65536+20 + mov ecx,10*65536+20 + mov edx,1 + mov esi,0x0000aa00 + int 0x40 + ret + +clrscr: ; clear screen buffer +; cld +; mov edi,I_END +; xor eax,eax +; mov ecx,SCREEN_X*SCREEN_Y*3/4 +; rep stosd +; ret + +; clear screen buffer with MMX technology +1,5 fps + mov edi,I_END + mov ecx,SCREEN_X*SCREEN_Y*3/32 + xor eax,eax + movd mm0,eax + movd mm1,eax + movd mm2,eax + movd mm3,eax +csloo: + movq qword [edi],mm0 + movq qword [edi+8],mm1 + movq qword [edi+16],mm2 + movq qword [edi+24],mm3 + add edi,32 + dec ecx + jnz csloo + ret + +clrzbuf: ; clear zbuf + cld + mov edi,zbuffer + mov eax,-1 + mov ecx,SCREEN_X*SCREEN_Y*3/4 + rep stosd + ret + + +; mov [@@atx1],dword 0xffffffff +; mov [@@aty1],dword 0xffffffff +; movq mm0,qword [@@atx1] +; movq mm1,qword [@@atx1] +; movq mm2,qword [@@atx1] +; movq mm3,qword [@@atx1] +;czbloo: +; movq qword [edi],mm0 +; movq qword [edi+8],mm1 +; movq qword [edi+16],mm2 +; movq qword [edi+24],mm3 +; add edi,32 +; dec ecx +; jnz czbloo + ret + +@@atx1: dd 0 +@@aty1: dd 0 + +;=========================================================================== +; +; 3D-system example. Use the following formulas to rotate a point: +; +; Rotate around x-axis +; Y = Y * COS(xang) - Z * SIN(xang) / 256 +; Z = Y * SIN(xang) + Z * COS(xang) / 256 +; +; Rotate around y-axis +; X = X * COS(yang) - Z * SIN(yang) / 256 +; Z = X * SIN(yang) + Z * COS(yang) / 256 +; +; Rotate around z-axis +; X = X * COS(zang) - Y * SIN(zang) / 256 +; Y = X * SIN(zang) + Y * COS(zang) / 256 +; +; Divide by 256 coz we have multiplyd our sin values with 256 too. +; This example isn't too fast right now but it'll work just fine. +; +;=========================================================================== + +;*************************************************************************** +; \\\ MAIN 3D LOOP /// +; ****************** +render_scene: + +;******************** +; Turn matrix points +;******************** + + cmp [autorot],0 + je no_autorot + call UpdateAngles ; Calculate new angles +no_autorot: + call SetRotation ; Find sine & cosine of those angles + + mov edi,tpoints + mov esi,points + mov [mapoff],-1 ;-1 at start + mov ebp,[Ymap] + imul ebp,MAP_XSIZE+1 + mov eax,[Xmap] + add ebp,eax + + mov ecx,(MATRIX_XSIZE+1)*(MATRIX_YSIZE+1) +ShowLoop: + push ecx + push esi + mov eax,[esi] + sub eax,[Xcam] + mov [X],eax + mov eax,[esi+4] + sub eax,[Ycam] + mov [Y],eax + mov eax,[ebp+ground_level_map] ;color + and eax,0x000000ff + sub eax,[Zcam] + mov [Z],eax + push ebp + push edi + call TranslatePoint ; Rotates the point using above formulas + pop edi + mov [edi],ebp ;x + mov [edi+4],eax ;y + mov eax,[Z] ;z + add eax,[Zoff] + mov [edi+8],eax + pop ebp + pop esi + pop ecx + + add esi,4*3 ;next in point + add edi,4*3 ;next out point + + inc [mapoff] + cmp [mapoff],MATRIX_XSIZE+1 + jne no_shift_glm + mov [mapoff],dword 0 + add ebp,(MAP_XSIZE-MATRIX_XSIZE) +no_shift_glm: + add ebp,1 + + dec ecx + jnz ShowLoop + + +; Show, how many polygons on screen. + outcount [massize],50,10,cl_White,8*65536 + + +;***************** +; out triangles +;***************** + + mov [mapoff],-1 ;-1 at start + mov [massize],0 ;restet triangle massive counter + + mov ebp,[Ymap] + imul ebp,MAP_XSIZE;64;3*64 ;MAP_XSIZE + mov eax,[Xmap] + add ebp,eax + + mov edi,tpoints + mov ecx,MATRIX_YSIZE ;64 +lootpy: + push ecx + mov ecx,MATRIX_XSIZE ;64 +lootpx: +;draw four angle (two triangles) + +Z_MAX = 10 ;maximal z range for triangles + +; get texture offset at start + inc [mapoff] + cmp [mapoff],MATRIX_XSIZE + jne no_shift + mov [mapoff],dword 0 + add ebp,(MAP_XSIZE-MATRIX_XSIZE) +no_shift: + xor eax,eax + mov al,[ebp+img_area];+8] + inc ebp + imul eax,4095;32*32*3 + add eax,texture_img + mov ebx,eax + +;first triangle + mov eax,[edi+8] ;z1 + cmp eax,Z_MAX + jl no_add1 + mov [@@tz1],eax + mov eax,[edi+8+12] ;z2 + cmp eax,Z_MAX + jl no_add1 + mov [@@tz2],eax + mov eax,[edi+8+(4*3*(MATRIX_XSIZE+2))] ;z3 + cmp eax,Z_MAX + jl no_add1 + mov [@@tz3],eax + + cmp dword [edi],SCREEN_X + ja p11 + cmp dword [edi+4],SCREEN_Y + jna yes_add1 +p11: + cmp dword [edi+12],SCREEN_X + ja p12 + cmp dword [edi+4+12],SCREEN_Y + jna yes_add1 +p12: + cmp dword [edi+(4*3*(MATRIX_XSIZE+2))],SCREEN_X + ja p13 + cmp dword [edi+4+(4*3*(MATRIX_XSIZE+2))],SCREEN_Y + jna yes_add1 +p13: + jmp no_add1 +yes_add1: + + movq mm0,qword [edi] ;x1 + movq mm1,qword [edi+12] ;x2 + movq mm2,qword [edi+(4*3*(MATRIX_XSIZE+2))] ;x3 + movq qword [@@tx1],mm0 + movq qword [@@tx2],mm1 + movq qword [@@tx3],mm2 + + mov eax,ebx;+1 shl 31;[ebp] + mov [@@tex_off],eax ;0x0000ff00 + inc [massize] + pushad + mov [@@tex_x1],0 + mov [@@tex_y1],0 + mov [@@tex_x3],(32 shl 16) -1;128 + mov [@@tex_y3],(32 shl 16) -1;128 + mov [@@tex_x2],0 + mov [@@tex_y2],(32 shl 16) -1;128 + call textured_triangle + popad + +no_add1: + + + +;second triangle + mov eax,[edi+8] ;z1 + cmp eax,Z_MAX + jl no_add2 + mov [@@tz1],eax + mov eax,[edi+8+(4*3*(MATRIX_XSIZE+1))] ;z2 + cmp eax,Z_MAX + jl no_add2 + mov [@@tz2],eax + mov eax,[edi+8+(4*3*(MATRIX_XSIZE+2))] ;z3 + cmp eax,Z_MAX + jl no_add2 + mov [@@tz3],eax + + cmp dword [edi],SCREEN_X + ja p21 + cmp dword [edi+4],SCREEN_Y + jna yes_add2 +p21: + cmp dword [edi+(4*3*(MATRIX_XSIZE+1))],SCREEN_X + ja p22 + cmp dword [edi+4+(4*3*(MATRIX_XSIZE+1))],SCREEN_Y + jna yes_add2 +p22: + cmp dword [edi+(4*3*(MATRIX_XSIZE+2))],SCREEN_X + ja p23 + cmp dword [edi+4+(4*3*(MATRIX_XSIZE+2))],SCREEN_Y + jna yes_add2 +p23: + jmp no_add2 +yes_add2: + + movq mm0,qword [edi] ;x1 + movq mm1,qword [edi+(4*3*(MATRIX_XSIZE+1))] ;x2 + movq mm2,qword [edi+(4*3*(MATRIX_XSIZE+2))] ;x3 + movq qword [@@tx1],mm0 + movq qword [@@tx2],mm1 + movq qword [@@tx3],mm2 + + + mov eax,ebx + mov [@@tex_off],eax ;0x0000ff00 + inc [massize] +; add esi,4*10 + + pushad + mov [@@tex_x1],0 + mov [@@tex_y1],0 + mov [@@tex_x3],(32 shl 16) -1;128 + mov [@@tex_y3],(32 shl 16) -1;128 + mov [@@tex_x2],(32 shl 16) -1 + mov [@@tex_y2],0 + call textured_triangle + popad + + +no_add2: + + add edi,4*3 ;next triangle + dec ecx + jnz lootpx + add edi,4*3 ;next string + pop ecx + dec ecx + jnz lootpy + +;********************************** +;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +;********************************** +; For good models quality -5% speed +; call clrzbuf + + jmp skip_modmas +mmcnt dd 0 ;counter of model read number +modeloff dd 0 ;offset of model structure +modelmoff dd 0 ;offset in model mas +modeltmpoff dd 0 ;tmpoints offset +; massive of models +; format: X,Y,Z coordoinats,offset to model structure + +skip_modmas: + +; Rendering models on map + + mov eax,[model_mas] + mov [mmcnt],eax + +ModelRenderLoop: + + mov ebx,[mmcnt] + dec ebx + imul ebx,4*8 + add ebx,model_mas+4 + mov ebp,ebx ;edi=model offset X,Y,Z,Xturn,Yturn,Zturn,zero,modeloff + + mov ebx,[ebp+4*3];[Xangle] ; Grab angle + call GetSinCos ; Get the sine&cosine + mov [Xsin],eax ; Save sin + mov [Xcos],ebx ; Save cos + mov ebx,[ebp+4*4];[Yangle] + call GetSinCos + mov [Ysin],eax + mov [Ycos],ebx + mov ebx,[ebp+4*5];[Zangle] + call GetSinCos + mov [Zsin],eax + mov [Zcos],ebx + + mov ebx,[mmcnt] + imul ebx,4*8 + add ebx,model_mas+4-4 + mov eax,[ebx] + + mov [modeloff],eax + sub ebx,4*7;3 + mov [modelmoff],ebx + + mov edi,modelpoints + mov esi,eax ;bunker+8 + add esi,8 + mov ecx,[eax] ;[bunker] ;MODEL_POINTS + +TurnModelLoop: + push ecx + push esi + mov eax,[esi] + mov [X],eax + mov eax,[esi+4] + mov [Y],eax + mov eax,[esi+8] + mov [Z],eax + push ebp + push edi + +;RotatePoint + + mov esi,[Y] + mov ebx,[Xcos] + mov edi,[Z] + mov ecx,[Xsin] + call math + mov [Y],esi + mov [Z],edi + mov esi,[X] + mov ebx,[Ycos] + mov ecx,[Ysin] + call math + mov [X],esi + mov [Z],edi + mov ebx,[Zcos] + mov edi,[Y] + mov ecx,[Zsin] + call math + mov [X],esi + mov [Y],edi + + pop edi + + mov eax,[X] + mov [edi],eax + mov eax,[Y] + mov [edi+4],eax + + mov eax,[Z] ;z +; add eax,[Zoff] + mov [edi+8],eax + pop ebp + pop esi + pop ecx + + add esi,4*3 ;next in point + add edi,4*3 ;next out point + + dec ecx + jnz TurnModelLoop + +modxxx: + + +;Turn model off map + + call SetRotation + + mov ebx,[mmcnt] + imul ebx,4*8 + add ebx,model_mas+4-4 + mov eax,[ebx] + + mov [modeloff],eax + sub ebx,4*7;3 + mov [modelmoff],ebx + + mov edi,modelpoints + mov ecx,[eax] ;[bunker] ;MODEL_POINTS + +ShowModelLoop: + push ecx + mov eax,[edi] ;esi] + + mov ebx,[modelmoff] + sub eax,[ebx] ;[Xmod] + + sub eax,[Xcam] + mov ebx,[Xmap] + imul ebx,SECTOR_SIZE + sub eax,ebx + mov [X],eax + mov eax,[edi+4] ;esi+4] + + mov ebx,[modelmoff] + sub eax,[ebx+4] ;[Ymod] + + sub eax,[Ycam] + mov ebx,[Ymap] + imul ebx,SECTOR_SIZE + sub eax,ebx + mov [Y],eax + mov eax,[edi+8];esi+8] + + mov ebx,[modelmoff] + sub eax,[ebx+8] ;[Zmod] + + sub eax,[Zcam] + mov [Z],eax + push ebp + push edi + call TranslatePoint ; Rotates the point using above formulas + pop edi + mov [edi],ebp ;x + mov [edi+4],eax ;y + mov eax,[Z] ;z + add eax,[Zoff] + mov [edi+8],eax + pop ebp + pop ecx + + add edi,4*3 ;next out point + + dec ecx + jnz ShowModelLoop + + +; add [model_mas+8],dword 3 + + + + mov esi,[massize] + imul esi,4*10 + + mov eax,[modeloff] + mov ecx,[eax+4] ;MODEL_TRIANGELS + +;calc tmpoints offset + mov edi,modelpoints + mov [modeltmpoff],edi + +;calc postlink offset + mov edi,[eax] + imul edi,3*4;*2 ;X,Y,Z (3) points dd format (4) 2 masives (2) + add edi,eax + add edi,8 ;skip dd points, dd triangels +msloo: + + mov ebx,[edi] + imul ebx,4*3 + add ebx,[modeltmpoff] ;tmpoints + mov eax,[ebx] + mov [@@tx1],eax + mov eax,[ebx+4] + mov [@@ty1],eax + mov eax,[ebx+8] + mov [@@tz1],eax + + mov ebx,[edi+4] + imul ebx,4*3 + add ebx,[modeltmpoff] ;tmpoints + mov eax,[ebx] + mov [@@tx2],eax + mov eax,[ebx+4] + mov [@@ty2],eax + mov eax,[ebx+8] + mov [@@tz2],eax + + mov ebx,[edi+8] + imul ebx,4*3 + add ebx,[modeltmpoff] ;tmpoints + mov eax,[ebx] + mov [@@tx3],eax + mov eax,[ebx+4] + mov [@@ty3],eax + mov eax,[ebx+8] + mov [@@tz3],eax + + + cmp dword [@@tz1],Z_MAX + jl no_add + cmp dword [@@tz2],Z_MAX + jl no_add + cmp dword [@@tz3],Z_MAX + jl no_add + cmp dword [@@tx1],SCREEN_X + ja pm1 + cmp dword [@@ty1],SCREEN_Y + jna yes_madd +pm1: + cmp dword [@@tx2],SCREEN_X + ja pm2 + cmp dword [@@ty2],SCREEN_Y + jna yes_madd +pm2: + cmp dword [@@tx3],SCREEN_X + ja pm3 + cmp dword [@@ty3],SCREEN_Y + jna yes_madd +pm3: + jmp no_add +yes_madd: + + + + + mov ebx,[edi+12] + dec ebx + js ttex + mov eax,1 shl 31 + jmp posit +ttex: + add ebx,2 + mov eax,0 + neg ebx +posit: + imul ebx,4095;32*32*3 + add ebx,texture_img + mov [@@tex_off],ebx + + pushad + mov [@@tex_x1],0 + mov [@@tex_y1],0 + mov [@@tex_x3],(32 shl 16) -1;128 + mov [@@tex_y3],(32 shl 16) -1;128 + cmp eax,0 + je nez + mov [@@tex_x2],0 + mov [@@tex_y2],(32 shl 16) -1 + jmp isz +nez: + mov [@@tex_x2],(32 shl 16) -1 + mov [@@tex_y2],0 +isz: + call textured_triangle + popad + +; mov [esi+8+24+4],eax +; add esi,4*10 + inc [massize] +no_add: + add edi,4*4; *9 + dec ecx + jnz msloo + + dec [mmcnt] + jnz ModelRenderLoop + + + jmp skip_mdata + +bunker: +dd 8 ;model points +dd 10 ;model triagels +;mpoints: +dd -105,-105,0, -105,105,0, 105,105,0, 105,-105,0 +dd -70,-70,-50, -70,70,-50, 70,70,-50, 70,-70,-50 + +; 4-------7 Points structure +; |\0---3/| +; | | | | +; | | | | +; |/1---2\| +; 5-------6 + +;pointslink: +;dd 0,1,2, -3, 0,3,2, 3 ;far side +dd 4,0,1, -5, 4,5,1, 5 ;left side +dd 6,2,3, -5, 6,7,3, 5 ;right side +dd 4,0,3, -5, 4,7,3, 5 ;up side +dd 5,1,2, -5, 5,6,2, 5 ;down side +dd 4,5,6, -6, 4,7,6, 6 ;far side + +;model 2 outpost +outpost: +dd 8 ;model points +dd 10 ;model triagels +;mpoints: +dd -45,-45,0, -45,45,0, 45,45,0, 45,-45,0 +dd -30,-30,-20, -30,30,-20, 30,30,-20, 30,-30,-20 +;pointslink: +;dd 0,1,2, -3, 0,3,2, 3 ;far side +dd 4,0,1, -8, 4,5,1, 8 ;left side +dd 6,2,3, -8, 6,7,3, 8 ;right side +dd 4,0,3, -8, 4,7,3, 8 ;up side +dd 5,1,2, -8, 5,6,2, 8 ;down side +dd 4,5,6, -7, 4,7,6, 7 ;near side + +;model 3 cannon +cannon: +dd 12 ;model points +dd 12 ;model triagels +;mpoints: +dd -10,-20,0, -10,20,0, 10,20,0, 10,-20,0 +dd -10,-10,-15, -10,10,-15, 10,10,-15, 10,-10,-15 +dd -2,15,-8, 2,15,-8, -2,45,-8, 2,45,-8 +;pointslink: +;dd 0,1,2, -3, 0,3,2, 3 ;far side +dd 4,0,1, -10, 4,5,1, 10 ;left side +dd 6,2,3, -10, 6,7,3, 10 ;right side +dd 4,0,3, -10, 4,7,3, 10 ;up side +dd 5,1,2, -10, 5,6,2, 10 ;down side +dd 4,5,6, -11, 4,7,6, 11 ;near side +dd 8,9,10,-10, 9,10,11,10 ;cannon 1 + +;model 4 red flag +red_flag: +dd 12 ;model points +dd 6*2 ;model triagels +;mpoints: +dd -1,-1,0, -1,1,0, 1,1,0, 1,-1,0 +dd -1,-1,-30, -1,1,-30, 1,1,-30, 1,-1,-30 +dd 1,1,-30, 10,1,-30, 10,1,-20, 1,1,-20 +;pointslink: +dd 4,0,1, -10, 4,5,1, 15 ;left side +dd 6,2,3, -10, 6,7,3, 15 ;right side +dd 4,0,3, -10, 4,7,3, 15 ;up side +dd 5,1,2, -10, 5,6,2, 15 ;down side +dd 4,5,6, -10, 4,7,6, 15 ;near side +dd 8,11,10,-49, 8,9,10,49 ;flag + +repear: +dd 8 ;model points +dd 10 ;model triagels +;mpoints: +dd -45,-45,0, -45,45,0, 45,45,0, 45,-45,0 +dd -30,-30,-20, -30,30,-20, 30,30,-20, 30,-30,-20 +;pointslink: +dd 4,0,1, -5, 4,5,1, 5 ;left side +dd 6,2,3, -5, 6,7,3, 5 ;right side +dd 4,0,3, -5, 4,7,3, 5 ;up side +dd 5,1,2, -5, 5,6,2, 5 ;down side +dd 4,5,6, -3, 4,7,6, 3 ;far side + +;model 5 tree (elka) +tree: +dd 16 ;model points +dd 8*2 ;model triagels +;mpoints: +dd -2,-2,0, -2,2,0, 2,2,0, 2,-2,0 +dd -1,-1,-8, -1,1,-8, 1,1,-8, 1,-1,-8 +dd -10,-10,-8, -10,10,-8, 10,10,-8, 10,-10,-8 +dd -1,-1,-40, -1,1,-40, 1,1,-40, 1,-1,-40 +;pointslink: +dd 4,0,1, -16, 4,5,1, 16 ;left side +dd 6,2,3, -16, 6,7,3, 16 ;right side +dd 4,0,3, -16, 4,7,3, 16 ;up side +dd 5,1,2, -16, 5,6,2, 16 ;down side + +dd 12,8,9, -14, 12,13,9, 14 ;left side +dd 14,10,11, -14, 14,15,11, 14 ;right side +dd 12,8,11, -14, 12,15,11, 14 ;up side +dd 13,9,10, -14, 13,14,10, 14 ;down side + +;model tank +tank: +dd 20 ;model points +dd 12+10 ;model triagels +;mpoints: +dd -10,-20,-10, -10,20,-10, 10,20,-10, 10,-20,-10 +dd -10,-10,-20, -10,10,-20, 10,10,-20, 10,-10,-20 +dd -2,15,-15, 2,15,-15, -2,45,-15, 2,45,-15 + +dd -20,-20,0, -20,20,0, 20,20,0, 20,-20,0 +dd -20,-30,-10, -20,30,-10, 20,30,-10, 20,-30,-10 + +;pointslink: +;dd 0,1,2, -3, 0,3,2, 3 ;far side +dd 4,0,1, -10, 4,5,1, 10 ;left side +dd 6,2,3, -10, 6,7,3, 10 ;right side +dd 4,0,3, -10, 4,7,3, 10 ;up side +dd 5,1,2, -10, 5,6,2, 10 ;down side +dd 4,5,6, -11, 4,7,6, 11 ;near side +dd 8,9,10,-10, 9,10,11,10 ;cannon 1 + +dd 16,12,13, -11, 16,17,13, 11 ;left side +dd 18,14,15, -11, 18,19,15, 11 ;right side +dd 16,12,15, -11, 16,19,15, 11 ;up side +dd 17,13,14, -11, 17,18,14, 11 ;down side +dd 16,17,18, -11, 16,19,18, 11 ;near side + +;Test model +gqfa: ;Good quality four angle +dd 5 ;model points +dd 4 ;model triagels +;mpoints: +;dd -45,-145,0, -45,145,0, 45,45,0, 45,-45,0 +dd -0,-105,0, -0,105,0, 45,45,0, 45,-45,0 +dd 30,0,0 +;pointslink: +dd 1,4,0, 50 ;left side +dd 1,4,2, 51 ;right side +dd 3,4,2, -50 ;up side +dd 3,4,0, -51 ;down side + +skip_mdata: + +;*************** +; Add new models +;*************** +; jmp no_addmodel + + random 20,eax + sub eax,10 + imul eax,SECTOR_SIZE + add eax,SECTOR_SIZE/2 + mov [temp1],eax + random 20,eax + sub eax,10 + imul eax,SECTOR_SIZE + add eax,SECTOR_SIZE/2 + mov [temp2],eax + + mov eax,dword [model_mas] + cmp eax,40;00 + jae no_addmodel + imul eax,4*8; + add eax,4+model_mas + inc dword [model_mas] + mov ebx,[temp1] + mov [eax],ebx + mov ebx,[temp2] + mov [eax+4],ebx + mov [eax+8],dword -170 + mov ebx,0 + mov [eax+12],ebx + mov [eax+16],ebx + mov [eax+20],ebx + mov ebx,tree;red_flag + mov [eax+28],ebx + jmp skip_mdata ;use for auto filling at start +no_addmodel: + + ret + + +UpdateAngles: +; Calculates new x,y,z angles +; to autorotate around + + mov eax,[Xangle] ; Load current angles + mov ebx,[Yangle] + mov ecx,[Zangle] + + add eax,[DeltaX] ; Add velocity + and eax,011111111b ; Range from 0..255 + mov [Xangle],eax ; Update X + add ebx,[DeltaY] ; Add velocity + and ebx,011111111b ; Range from 0..255 + mov [Yangle],ebx ; Update Y + add ecx,[DeltaZ] ; Add velocity + and ecx,011111111b ; Range from 0..255 + mov [Zangle],ecx ; Update Z + ret + +GetSinCos: +; Needed : bx=angle (0..255) +; Returns: ax=Sin bx=Cos + push ebx ; Save angle (use as pointer) + shl ebx,2 ; Grab a word so bx=bx*2 + mov eax,[SinCos + ebx] ; Get sine + pop ebx ; Restore pointer into bx + push eax ; Save sine on stack + add ebx,64 ; Add 64 to get cosine + and ebx,11111111b ; Range from 0..255 + shl ebx,2 ; *2 coz it's a word + mov eax,[SinCos + ebx] ; Get cosine + mov ebx,eax ; Save it bx=Cos + pop eax ; Restore ax=Sin + ret + +; Get sin & cos of x,y,z angle +SetRotation: + mov ebx,[Xangle] ; Grab angle + call GetSinCos ; Get the sine&cosine + mov [Xsin],eax ; Save sin + mov [Xcos],ebx ; Save cos + + mov ebx,[Yangle] + call GetSinCos + mov [Ysin],eax + mov [Ycos],ebx + + mov ebx,[Zangle] + call GetSinCos + mov [Zsin],eax + mov [Zcos],ebx +; for camera + mov ebx,[Xcamangle] + call GetSinCos + mov [Xcamsin],eax + mov [Xcamcos],ebx + + mov ebx,[Ycamangle] + call GetSinCos + mov [Ycamsin],eax + mov [Ycamcos],ebx + + mov ebx,[Zcamangle] + call GetSinCos + mov [Zcamsin],eax + mov [Zcamcos],ebx + + ret + +TranslatePoint: ; Rotates the point around x,y,z +; Gets original x,y,z values +; This can be done elsewhere + + mov esi,[X] + mov edi,[Y] + mov ebx,[Zcamcos] + mov ecx,[Zcamsin] + call math + mov [X],esi + mov [Y],edi + + mov esi,[Y] + mov edi,[Z] + mov ebx,[Xcamcos] + mov ecx,[Xcamsin] + call math + mov [Y],esi + mov [Z],edi + + mov esi,[X] + mov edi,[Z] + mov ebx,[Ycamcos] + mov ecx,[Ycamsin] + call math + mov [X],esi + mov [Z],edi + + mov esi,[Y] + mov ebx,[Xcos] + mov edi,[Z] + mov ecx,[Xsin] + call math + mov [Y],esi + mov [Z],edi + mov esi,[X] + mov ebx,[Ycos] + mov ecx,[Ysin] + call math + mov [X],esi + mov [Z],edi + mov ebx,[Zcos] + mov edi,[Y] + mov ecx,[Zsin] + call math + +;************* +; ShowPoint +;************* + +; Calculates screenposition and +; plots the point on the screen + mov eax,[Xoff] ; Xoff*X / Z+Zoff = screen x + mov ecx,esi + imul ecx + + mov ebx,[Z] + add ebx,[Zoff] ; Distance + + cmp ebx,0 + je notout + idiv ebx + add eax,[Mx] ; Center on screen + mov ebp,eax ;ebp =Xp + + mov eax,[Yoff] ; Yoff*Y / Z+Zoff = screen y + mov ecx,edi + imul ecx + + cmp ebx,0 + je notout + idiv ebx ;eax =Yp + add eax,[My] ; Center on screen + +notout: + ret + +math: + mov eax,esi + imul ebx ; ax = X * Cos(zang) + mov ebp,eax + mov eax,edi + imul ecx ; ax = Y * Sin(zang) + sub ebp,eax ; bp = X * Cos(zang) - Y * Sin(zang) + sar ebp,8 ; bp = X * Cos(zang) - Y * Sin(zang) / 256 + + mov eax,esi + mov esi,ebp + imul ecx ; ax = X * Sin(zang) + mov ebp,eax + mov eax,edi + imul ebx ; ax = Y * Cos(zang) + add ebp,eax ; bp = X * SIN(zang) + Y * COS(zang) + sar ebp,8 ; bp = X * SIN(zang) + Y * COS(zang) / 256 + mov edi,ebp + ret + +SinCos: +dd 0,6,13,19,25,31,38,44,50,56 +dd 62,68,74,80,86,92,98,104,109,115 +dd 121,126,132,137,142,147,152,157,162,167 +dd 172,177,181,185,190,194,198,202,206,209 +dd 213,216,220,223,226,229,231,234,237,239 +dd 241,243,245,247,248,250,251,252,253,254 +dd 255,255,256,256,256,256,256,255,255,254 +dd 253,252,251,250,248,247,245,243,241,239 +dd 237,234,231,229,226,223,220,216,213,209 +dd 206,202,198,194,190,185,181,177,172,167 +dd 162,157,152,147,142,137,132,126,121,115 +dd 109,104,98,92,86,80,74,68,62,56 +dd 50,44,38,31,25,19,13,6,0,-6 +dd -13,-19,-25,-31,-38,-44,-50,-56,-62,-68 +dd -74,-80,-86,-92,-98,-104,-109,-115,-121,-126 +dd -132,-137,-142,-147,-152,-157,-162,-167,-172,-177 +dd -181,-185,-190,-194,-198,-202,-206,-209,-213,-216 +dd -220,-223,-226,-229,-231,-234,-237,-239,-241,-243 +dd -245,-247,-248,-250,-251,-252,-253,-254,-255,-255 +dd -256,-256,-256,-256,-256,-255,-255,-254,-253,-252 +dd -251,-250,-248,-247,-245,-243,-241,-239,-237,-234 +dd -231,-229,-226,-223,-220,-216,-213,-209,-206,-202 +dd -198,-194,-190,-185,-181,-177,-172,-167,-162,-157 +dd -152,-147,-142,-137,-132,-126,-121,-115,-109,-104 +dd -98,-92,-86,-80,-74,-68,-62,-56,-50,-44 +dd -38,-31,-25,-19,-13,-6 + +mipzoom dd 0 +mipmapwork dd 0 +temp1 dd 0 +temp2 dd 0 + +; 4.24.2005 Textured triangle algorythm +; created by Pavlushin Evgeni waptap[at]mail.ru +; on base tex3 from Mikolaj Felix mfelix@polbox.com + +align 512 +@@tx1 dd 0 ;equ [bp+4] +@@ty1 dd 0 ;equ [bp+6] +align 512 +@@tx2 dd 0 ;equ [bp+8] +@@ty2 dd 0 ;equ [bp+10] +align 512 +@@tx3 dd 0 ;equ [bp+12] +@@ty3 dd 0 ;equ [bp+14] + +@@tz1 dd 0 +@@tz2 dd 0 +@@tz3 dd 0 + +@@z_dy12 dd 0 +@@z_dy13 dd 0 +@@z_dy23 dd 0 + +@@tex_off dd 0 ;equ [bp+16] +@@tex_x1 dd 0 ;equ [bp+18] +@@tex_y1 dd 0 ;equ [bp+20] +@@tex_x2 dd 0 ;equ [bp+22] +@@tex_y2 dd 0 ;equ [bp+24] +@@tex_x3 dd 0 ;equ [bp+26] +@@tex_y3 dd 0 ;equ [bp+28] + +@@dx12 dd 0 ;equ [bp-2] +@@dx13 dd 0 ;equ [bp-4] +@@dx23 dd 0 ;equ [bp-6] + +@@tex_dx12 dd 0 ;equ [bp-8] +@@tex_dy12 dd 0 ;equ [bp-10] +@@tex_dx13 dd 0 ;equ [bp-12] +@@tex_dy13 dd 0 ;equ [bp-14] +@@tex_dx23 dd 0 ;equ [bp-16] +@@tex_dy23 dd 0 ;equ [bp-18] + +@@scan_x1 dd 0 +@@scan_y1 dd 0 +@@scan_x2 dd 0 +@@scan_y2 dd 0 + +@@scan_z1 dd 0 +@@scan_z2 dd 0 + +SHIFT=16 + +textured_triangle: + + mov eax,[@@ty1] + cmp eax,[@@ty3] + jle tt_check1 + + xchg eax,[@@ty3] + mov [@@ty1],eax + + mov eax,[@@tx1] + xchg eax,[@@tx3] + mov [@@tx1],eax + + mov eax,[@@tz1] + xchg eax,[@@tz3] + mov [@@tz1],eax + + mov eax,[@@tex_y1] + xchg eax,[@@tex_y3] + mov [@@tex_y1],eax + + mov eax,[@@tex_x1] + xchg eax,[@@tex_x3] + mov [@@tex_x1],eax +tt_check1: + mov eax,[@@ty2] + cmp eax,[@@ty3] + jle tt_check2 + + xchg eax,[@@ty3] + mov [@@ty2],eax + + mov eax,[@@tx2] + xchg eax,[@@tx3] + mov [@@tx2],eax + + mov eax,[@@tz2] + xchg eax,[@@tz3] + mov [@@tz2],eax + + mov eax,[@@tex_y2] + xchg eax,[@@tex_y3] + mov [@@tex_y2],eax + + mov eax,[@@tex_x2] + xchg eax,[@@tex_x3] + mov [@@tex_x2],eax +tt_check2: + mov eax,[@@ty1] + cmp eax,[@@ty2] + jle tt_check3 + + xchg eax,[@@ty2] + mov [@@ty1],eax + + mov eax,[@@tx1] + xchg eax,[@@tx2] + mov [@@tx1],eax + + mov eax,[@@tz1] + xchg eax,[@@tz2] + mov [@@tz1],eax + + mov eax,[@@tex_y1] + xchg eax,[@@tex_y2] + mov [@@tex_y1],eax + + mov eax,[@@tex_x1] + xchg eax,[@@tex_x2] + mov [@@tex_x1],eax +tt_check3: + + mov ebx,[@@ty2] + sub ebx,[@@ty1] + jnz tt_dx12_make + + mov [@@dx12],0 + mov [@@tex_dx12],0 + mov [@@tex_dy12],0 + mov [@@z_dy12],0 + jmp tt_dx12_done +tt_dx12_make: + mov eax,[@@tx2] + sub eax,[@@tx1] + shl eax,SHIFT + cdq + idiv ebx + mov [@@dx12],eax ; dx12 = (x2-x1)/(y2-y1) + + mov eax,[@@tex_x2] + sub eax,[@@tex_x1] + cdq + idiv ebx + mov [@@tex_dx12],eax ; tex_dx12 = (tex_x2-tex_x1)/(y2-y1) + + mov eax,[@@tex_y2] + sub eax,[@@tex_y1] + cdq + idiv ebx + mov [@@tex_dy12],eax ; tex_dy12 = (tex_y2-tex_y1)/(y2-y1) + + mov eax,[@@tz2] + sub eax,[@@tz1] + shl eax,SHIFT + cdq + idiv ebx + mov [@@z_dy12],eax + +tt_dx12_done: + + mov ebx,[@@ty3] + sub ebx,[@@ty1] + jnz tt_dx13_make + + mov [@@dx13],0 + mov [@@tex_dx13],0 + mov [@@tex_dy13],0 + mov [@@z_dy13],0 + jmp tt_dx13_done +tt_dx13_make: + mov eax,[@@tx3] + sub eax,[@@tx1] + shl eax,SHIFT + cdq + idiv ebx + mov [@@dx13],eax ; dx13 = (x3-x1)/(y3-y1) + + mov eax,[@@tex_x3] + sub eax,[@@tex_x1] + cdq + idiv ebx + mov [@@tex_dx13],eax ; tex_dx13 = (tex_x3-tex_x1)/(y3-y1) + + mov eax,[@@tex_y3] + sub eax,[@@tex_y1] + cdq + idiv ebx + mov [@@tex_dy13],eax ; tex_dy13 = (tex_y3-tex_x1)/(y3-y1) + + mov eax,[@@tz3] + sub eax,[@@tz1] + shl eax,SHIFT + cdq + idiv ebx + mov [@@z_dy13],eax +tt_dx13_done: + + mov ebx,[@@ty3] + sub ebx,[@@ty2] + jnz tt_dx23_make + + mov [@@dx23],0 + mov [@@tex_dx23],0 + mov [@@tex_dy23],0 + mov [@@z_dy23],0 + jmp tt_dx23_done +tt_dx23_make: + mov eax,[@@tx3] + sub eax,[@@tx2] + shl eax,SHIFT + cdq + idiv ebx + mov [@@dx23],eax ; dx23 = (x3-x2)/(y3-y2) + + mov eax,[@@tex_x3] + sub eax,[@@tex_x2] + cdq + idiv ebx + mov [@@tex_dx23],eax ; tex_dx23 = (tex_x3-tex_x2)/(y3-y2) + + mov eax,[@@tex_y3] + sub eax,[@@tex_y2] + cdq + idiv ebx + mov [@@tex_dy23],eax ; tex_dy23 = (tex_y3-tex_y2)/(y3-y2) + + mov eax,[@@tz3] + sub eax,[@@tz2] + shl eax,SHIFT + cdq + idiv ebx + mov [@@z_dy23],eax +tt_dx23_done: + + + mov eax,[@@tx1] + shl eax,SHIFT + mov ebx,eax + mov ecx,[@@ty1] + + mov edx,[@@tz1] + shl edx,SHIFT + mov [@@scan_z1],edx + mov [@@scan_z2],edx + + mov edx,[@@tex_x1] + mov [@@scan_x1],edx + mov [@@scan_x2],edx + mov edx,[@@tex_y1] + mov [@@scan_y1],edx + mov [@@scan_y2],edx + +; **************** + mov edx,[@@ty1] ;skip equals + cmp [@@ty2],edx + je tt_loop1_end + + mov ebp,[@@ty1] + cmp ebp,0 + jg no_up_clip + neg ebp + mov edx,[@@ty2] + cmp edx,0 + jg no_sbx + neg edx + sub ebp,edx +no_sbx: + + mov edx,[@@tex_dx13] + imul edx,ebp + add [@@scan_x1],edx + mov edx,[@@tex_dx12] + imul edx,ebp + add [@@scan_x2],edx + mov edx,[@@tex_dy13] + imul edx,ebp + add [@@scan_y1],edx + mov edx,[@@tex_dy12] + imul edx,ebp + add [@@scan_y2],edx + + mov edx,[@@z_dy13] + imul edx,ebp + add [@@scan_z1],edx + mov edx,[@@z_dy12] + imul edx,ebp + add [@@scan_z2],edx + + mov edx,[@@dx13] + imul edx,ebp + add eax,edx + mov edx,[@@dx12] + imul edx,ebp + add ebx,edx + add ecx,ebp +no_up_clip: + + cmp [@@ty2],0 + jl tt_loop1_end + +tt_loop1: + cmp ecx,SCREEN_Y + jge tt_loop2_end + + pushad + mov edx,[@@scan_y2] + mov [@@tex_ly2],edx ;push dx + mov edx,[@@scan_x2] + mov [@@tex_lx2],edx ;push dx + mov edx,[@@scan_y1] + mov [@@tex_ly1],edx ;push dx + mov edx,[@@scan_x1] + mov [@@tex_lx1],edx ;push dx + + mov edx,[@@scan_z1] + mov [@@lz1],edx + mov edx,[@@scan_z2] + mov [@@lz2],edx + + mov [@@ly],ecx ;push cx + mov edx,ebx + sar edx,SHIFT + mov [@@lx2],edx ;push dx + mov edx,eax + sar edx,SHIFT + mov [@@lx1],edx ; push dx + call textured_horizontal_line + popad + + mov edx,[@@tex_dx13] + add [@@scan_x1],edx + mov edx,[@@tex_dx12] + add [@@scan_x2],edx + mov edx,[@@tex_dy13] + add [@@scan_y1],edx + mov edx,[@@tex_dy12] + add [@@scan_y2],edx + + mov edx,[@@z_dy13] + add [@@scan_z1],edx + mov edx,[@@z_dy12] + add [@@scan_z2],edx + + add eax,[@@dx13] + add ebx,[@@dx12] + inc ecx + cmp ecx,[@@ty2] + jl tt_loop1 + +tt_loop1_end: + + mov ebx,[@@tx2] + shl ebx,SHIFT + mov ecx,[@@ty2] + + mov edx,[@@tz2] + shl edx,SHIFT + mov [@@scan_z2],edx + + mov edx,[@@tex_x2] + mov [@@scan_x2],edx + mov edx,[@@tex_y2] + mov [@@scan_y2],edx + + mov ebp,[@@ty2] + cmp ebp,0 + jg no_down_clip + neg ebp + dec ebp + + mov edx,[@@tex_dx13] + imul edx,ebp + add [@@scan_x1],edx + mov edx,[@@tex_dx23] + imul edx,ebp + add [@@scan_x2],edx + mov edx,[@@tex_dy13] + imul edx,ebp + add [@@scan_y1],edx + mov edx,[@@tex_dy23] + imul edx,ebp + add [@@scan_y2],edx + + mov edx,[@@z_dy13] + imul edx,ebp + add [@@scan_z1],edx + mov edx,[@@z_dy23] + imul edx,ebp + add [@@scan_z2],edx + + mov edx,[@@dx13] + imul edx,ebp + add eax,edx + mov edx,[@@dx23] + imul edx,ebp + add ebx,edx + add ecx,ebp +no_down_clip: + +tt_loop2: + cmp ecx,SCREEN_Y + jge tt_loop2_end + + pushad + mov edx,[@@scan_y2] + mov [@@tex_ly2],edx ;push dx + mov edx,[@@scan_x2] + mov [@@tex_lx2],edx ;push dx + mov edx,[@@scan_y1] + mov [@@tex_ly1],edx ;push dx + mov edx,[@@scan_x1] + mov [@@tex_lx1],edx ;push dx + + mov edx,[@@scan_z1] + mov [@@lz1],edx + mov edx,[@@scan_z2] + mov [@@lz2],edx + + mov [@@ly],ecx ;push cx + mov edx,ebx + sar edx,SHIFT + mov [@@lx2],edx ;push dx + mov edx,eax + sar edx,SHIFT + mov [@@lx1],edx ; push dx + call textured_horizontal_line + popad + + mov edx,[@@tex_dx13] + add [@@scan_x1],edx + mov edx,[@@tex_dx23] + add [@@scan_x2],edx + mov edx,[@@tex_dy13] + add [@@scan_y1],edx + mov edx,[@@tex_dy23] + add [@@scan_y2],edx + + mov edx,[@@z_dy13] + add [@@scan_z1],edx + mov edx,[@@z_dy23] + add [@@scan_z2],edx + + add eax,[@@dx13] + add ebx,[@@dx23] + inc ecx + cmp ecx,[@@ty3] + jl tt_loop2 + +tt_loop2_end: + ret + +align 512 +@@lx1 dd 0 +align 512 +@@lx2 dd 0 +align 512 +@@ly dd 0 + +@@lz1 dd 0 +@@lz2 dd 0 +@@z_dx dd 0 + +align 512 +@@tex_loff dd 0 ;equ [bp+10] +@@tex_lx1 dd 0 ;equ [bp+12] +@@tex_ly1 dd 0 ;equ [bp+14] +@@tex_lx2 dd 0 ;equ [bp+16] +@@tex_ly2 dd 0 ;equ [bp+18] + +align 512 +@@tex_ldx dd 0 ;equ [bp-2] +@@tex_ldy dd 0 ;equ [bp-4] + +align 1024 +textured_horizontal_line: + + mov eax,[@@lx1] + cmp eax,[@@lx2] + je thl_quit + jl thl_ok + + xchg eax,[@@lx2] + mov [@@lx1],eax + + mov eax,[@@lz1] + xchg eax,[@@lz2] + mov [@@lz1],eax + + mov eax,[@@tex_lx1] + xchg eax,[@@tex_lx2] + mov [@@tex_lx1],eax + + mov eax,[@@tex_ly1] + xchg eax,[@@tex_ly2] + mov [@@tex_ly1],eax + +thl_ok: + + cmp [@@lx2],0 + jle thl_quit + mov eax,SCREEN_X + cmp [@@lx1],eax + jge thl_quit + + mov ecx,[@@lx2] + sub ecx,[@@lx1] + + ; Uneversal method + mov edi,[@@ly] + mov eax,SCREEN_X ;di = ly*320+lx1 + imul edi + add eax,[@@lx1] + imul eax,3 + mov edi,eax + add edi,I_END + + ;Right side clipping + mov eax,SCREEN_X + cmp [@@lx2],eax + jnge x1ok + mov edx,SCREEN_X + dec edx + sub edx,[@@lx1] + cmp edx,0 + jle thl_quit + mov ecx,edx +x1ok: + + ;Left side clipping + cmp [@@lx1],0 + jg x2ok + mov ecx,[@@lx2] ;cmp lx2 screen x if above cut (for future) + mov edi,[@@ly] + mov eax,SCREEN_X + imul edi,eax + imul edi,3 + add edi,I_END +x2ok: + + mov ebx,[@@lx2] + sub ebx,[@@lx1] + + mov eax,[@@tex_lx2] + sub eax,[@@tex_lx1] + cdq + idiv ebx + mov [@@tex_ldx],eax ; tex_dx = (tex_x2-tex_x1)/(x2-x1) + + mov eax,[@@tex_ly2] + sub eax,[@@tex_ly1] + cdq + idiv ebx + mov [@@tex_ldy],eax ; tex_dy = (tex_y2-tex_y1)/(x2-x1) + + mov eax,[@@lz2] + sub eax,[@@lz1] + cdq + idiv ebx + mov [@@z_dx],eax ; tex_dx = (tex_x2-tex_x1)/(x2-x1) + + ; Left clipping post correction + cmp [@@lx1],0 + jg no_lcpc + mov eax,[@@lx1] + neg eax + mov ebp,[@@tex_ldx] + imul ebp,eax + add [@@tex_lx1],ebp + mov ebp,[@@tex_ldy] + imul ebp,eax + add [@@tex_ly1],ebp + mov ebp,[@@z_dx] + imul ebp,eax + add [@@lz1],ebp +no_lcpc: + + inc ecx ;for equal correction + mov edx,[@@tex_lx1] + mov ebx,[@@tex_ly1] + mov esi,[@@lz1] + +thl_loop: + mov ebp,esi + shr ebp,SHIFT + mov eax,dword [edi-I_END+zbuffer] + cmp ax,bp + jb no_set + mov [edi-I_END+zbuffer],bp + + mov eax,edx +; and eax,0x0fff0000 + ror ebx,16 + mov ax,bx + ror ebx,16 + shl ax,11 ; 8 for 256*256, 9 for 128*128 ... + shr eax,11 + lea eax,[eax*2+eax] ; equ imul eax,3 + add eax,[@@tex_off] + mov ebp,eax + + mov ax,word [ebp] + mov [edi],ax + mov al,byte [ebp+2] + mov [edi+2],al + +no_set: + add edi,3 + + add esi,[@@z_dx] + add edx,[@@tex_ldx] + add ebx,[@@tex_ldy] + dec ecx + jnz thl_loop +thl_quit: + ret + + +@@rgb dd 0 +@@rgbax dw 0 +@@rgbbl db 0 + +; === DATA === + +d_angle dd 0.19634954 ;pi/16 +angle dd 0.0 +mul_wave dd 1.5 + +sin_pos dw 0 +sinwave rw 256 + +Xmap dd 0 +Ymap dd 0 +mapoff dd 0 + +Xcam dd 0 +Ycam dd 0 +Zcam dd -400 + +Xcamangle dd 0 +Ycamangle dd 0 +Zcamangle dd 0 + +Xcamsin dd 0 +Xcamcos dd 0 +Ycamsin dd 0 +Ycamcos dd 0 +Zcamsin dd 0 +Zcamcos dd 0 + +X dd ? ; X,Y,Z variable for formula +Y dd ? +Z dd ? + +Xp dd ? +Yp dd ? + +Xangle dd 0 ; Angle to rotate around x +Yangle dd 0 +Zangle dd 0 + +DeltaX dd 1 ; x,y,z rotation angle +DeltaY dd 1 +DeltaZ dd 1 + +Xoff dd 256 ; x-cord +Yoff dd 256 ; y-cord +Zoff dd 0;800 ; Distance from viewer + +Xsin dd ? ; Sine and cosine of angle to rotate around +Xcos dd ? +Ysin dd ? +Ycos dd ? +Zsin dd ? +Zcos dd ? + +Mx dd SCREEN_X/2 ; Center of the screen +My dd SCREEN_Y/2 + +autorot db 0 ;Auto rotation flag +massize dd 0 ;Size of triangle massive +id dd 0 +temp dd 0 + +; DATA AREA +labelt: + db '3D TEXTURED ENGINE' +labellen: + + +;Texture pusck 32*32 256 +texpack_gif: +file 'TEXPACK.gif' +rb 50 + +;Ground texture +bmp_texmap: +file 'TEXMAP.bmp' +rb 50 + + +; Ground livel map +gif_file_area5: +file 'MAP.gif' ;level map +rb 50 + +rb 8 +texture_limg: +rb 4095 +texture_img: +rb 4095 +texture_img2: +rb 4095 + +rb (4095)*16*16 + +img_area: +rb 128*128*3+8 + +glm_img_area: +rb (MAP_XSIZE+1)*(MAP_YSIZE+1)*3+8 + +rb 8 + +texpack_img: +rb 512*512*3+8 + +keymap: +rb 1000 + +model_mas: +rb 4+8*100 + +; Hash area for decoding GIF +gif_hash_area: +rd 4096+1 + +MAX_MODEL_POINTS = 100 +modelpoints: +rb MAX_MODEL_POINTS*3*4 + +; Matrix points massive +points: +; Massive of turn matrix points +tpoints=points+((MATRIX_XSIZE+1)*(MATRIX_YSIZE+1)*3*4) +; Ground level map massive +ground_level_map=tpoints+((MATRIX_XSIZE+1)*(MATRIX_YSIZE+1)*3*4) +; zbuffer +zbuffer=ground_level_map+((MAP_XSIZE+1)*(MAP_YSIZE+1)*4) +I_END=zbuffer+(SCREEN_X*SCREEN_Y)*3 diff --git a/programs/3detx60b/trunk/ascgl.inc b/programs/3detx60b/trunk/ascgl.inc new file mode 100644 index 0000000000..f60f68662a --- /dev/null +++ b/programs/3detx60b/trunk/ascgl.inc @@ -0,0 +1,1385 @@ +lang equ ru + +; +; Assembler +; SMALL +; CODE +; Graphics +; Libary +; +; Ver 0.18 By Pavlushin Evgeni (RUSSIA) +; www.waptap@mail.ru + +;InfoList +;0.01 LoadImage +;0.02 SetBmp +;0.03 Bmptoimg, Setimg ~01.03.2004 +;0.04 Bug deleted, copyimg ~03.05.2004 +;0.05 fullimg, collimg ~05.05.2004 +;0.06 getimg ~09.05.2004 +;0.07 convbmp ~13.05.2004 +;0.08 fps ~14.05.2004 +;0.09 drawfbox ~03.06.2004 +;0.10 all macros optimized by Halyavin A., add at ~07.06.2004 +;0.11 many macros optimized by Halyavin A., add at ~30.08.2004 +;0.12 bmptoimg ~07.09.2004 +;0.13 imgtoimg ~08.09.2004 +;0.14 imgtoimg modify not brake bmp pict! ~09.09.2004 +;0.15 giftoimg, giftoani ~10.09.2004 +;0.16 setframe, rgbtobgr, setbmp deleted ~20.09.2004 +;0.17 modification giftoimg, giftoani, getframeoff ~01.10.2004 +;0.18 aframetoimg,aimgtoimg,frametoimg ~03.10.2004 + +aframetoimg_use_count=0 +macro aframetoimg img, x, y, canvas,acol +{ +local loo,loo2,acolor +aframetoimg_use_count=aframetoimg_use_count+1 +if aframetoimg_use_count = 1 + + jmp end_aframetoimg_proc + +acolor dd 0 +aframetoimg_proc: +;getout coord + mov [acolor],ebp + + mov edx,ebx ;img ;xsize + movzx eax,word [edx] + add eax,esi ;y cor + +; mov eax,esi ;y cor + mul dword [ecx] ;canvas xsize + add eax,edi ;x cor + + mov ebp,ebx ;img ;xsize + movzx edx,word [ebp] + add eax,edx + + mov ebp,eax + shl eax,1 + add ebp,eax + add ebp,ecx ;canvas+8;start + add ebp,8 +;get img size + add ebx,4 + mov eax,ebx ;img ;xsize + movzx esi,word [eax] + movzx edi,word [eax+2] + add ebx,4 + mov edx,ebx ;img+8 +loo2: +push esi +loo: +;test on alpha color + mov eax,[edx] + shl eax,8 + shr eax,8 + cmp eax,[acolor] + jne yx + add edx,3 + add ebp,3 + jmp nx +yx: + + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx +nx: + dec esi + jnz loo +pop esi + sub ebp,3 + mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) + sub eax,esi + add ebp,eax + shl eax,1 + add ebp,eax + + add ebp,3 + + dec edi + jnz loo2 + ret +end_aframetoimg_proc: +end if + push img + push canvas + push x + push y + push acol + pop ebp + pop esi + pop edi + pop ecx + pop ebx + call aframetoimg_proc +} + +frametoimg_use_count=0 +macro frametoimg img, x, y, canvas +{ +local loo,loo2 +frametoimg_use_count=frametoimg_use_count+1 +if frametoimg_use_count = 1 + + jmp end_frametoimg_proc + +frametoimg_proc: +;getout coord + mov edx,ebx ;img ;xsize + movzx eax,word [edx] + add eax,esi ;y cor + +; mov eax,esi ;y cor + mul dword [ecx] ;canvas xsize + add eax,edi ;x cor + + mov ebp,ebx ;img ;xsize + movzx edx,word [ebp] + add eax,edx + + mov ebp,eax + shl eax,1 + add ebp,eax + add ebp,ecx ;canvas+8;start + add ebp,8 +;get img size + add ebx,4 + mov eax,ebx ;img ;xsize + movzx esi,word [eax] + movzx edi,word [eax+2] + add ebx,4 + mov edx,ebx ;img+8 +loo2: +push esi +loo: + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + + dec esi + jnz loo +pop esi + sub ebp,3 + mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) + sub eax,esi + add ebp,eax + shl eax,1 + add ebp,eax + + add ebp,3 + + dec edi + jnz loo2 + ret +end_frametoimg_proc: +end if + push img + push canvas + push x + push y + pop esi + pop edi + pop ecx + pop ebx + call frametoimg_proc +} + + +aimgtoimg_use_count=0 +macro aimgtoimg img, x, y, canvas,acol +{ +local loo,loo2,acolor +aimgtoimg_use_count=aimgtoimg_use_count+1 +if aimgtoimg_use_count = 1 + + jmp end_aimgtoimg_proc + +acolor dd 0 +aimgtoimg_proc: +;getout coord + mov [acolor],ebp + + mov eax,esi ;y cor + mul dword [ecx] ;canvas xsize + add eax,edi ;x cor + mov ebp,eax + shl eax,1 + add ebp,eax + add ebp,ecx ;canvas+8;start + add ebp,8 +;get img size + mov eax,ebx ;img ;xsize + mov esi,[eax] + add ebx,4 + mov eax,ebx ; img+4 ;ysize + mov edi,[eax] + add ebx,4 + mov edx,ebx ;img+8 +loo2: +push esi +loo: + +;test on alpha color + mov eax,[edx] + shl eax,8 + shr eax,8 + cmp eax,[acolor] + jne yx + add edx,3 + add ebp,3 + jmp nx +yx: + + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx +nx: + dec esi + jnz loo +pop esi + sub ebp,3 + mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) + sub eax,esi + add ebp,eax + shl eax,1 + add ebp,eax + + add ebp,3 + + dec edi + jnz loo2 + ret +end_aimgtoimg_proc: +end if + push img + push canvas + push x + push y + push acol + pop ebp + pop esi + pop edi + pop ecx + pop ebx + call aimgtoimg_proc +} + + + + +imgtoimg_use_count=0 +macro imgtoimg img, x, y, canvas +{ +local loo,loo2 +imgtoimg_use_count=imgtoimg_use_count+1 +if imgtoimg_use_count = 1 + + jmp end_imgtoimg_proc +imgtoimg_proc: +;getout coord + mov eax,esi ;y cor + mul dword [ecx] ;canvas xsize + add eax,edi ;x cor + mov ebp,eax + shl eax,1 + add ebp,eax + add ebp,ecx ;canvas+8;start + add ebp,8 +;get img size + mov eax,ebx ;img ;xsize + mov esi,[eax] + add ebx,4 + mov eax,ebx ; img+4 ;ysize + mov edi,[eax] + add ebx,4 + mov edx,ebx ;img+8 +loo2: +push esi +loo: + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + dec esi + jnz loo +pop esi + sub ebp,3 + mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) + sub eax,esi + add ebp,eax + shl eax,1 + add ebp,eax + + add ebp,3 + + dec edi + jnz loo2 + ret +end_imgtoimg_proc: +end if + push img + push canvas + push x + push y + pop esi + pop edi + pop ecx + pop ebx + call imgtoimg_proc +} + + +;DrawBox +macro drawfbox x,y,xs,ys,color +{ + words2reg ebx,x,xs ;x*65536+xs + words2reg ecx,y,ys ;y*65536+ys + mov edx,color + mov eax,13 + int 0x40 +} + +; FPS - Set Frame Per Second Display +fps_show_frequency=40 +macro fps x,y,color,delcolor +{ +local spdat,savetime,new_time,fps,fps_cntr,out_fps,new_time,ttt +local no_out_fps + jmp spdat +savetime dd 0 +fps_cntr dd 0 +fps dd 0 +ttt dd 0 +spdat: +get_time: + mov eax,3 + int 0x40 + cmp eax,[savetime] + jne new_time + inc [fps_cntr] + cmp dword [ttt],0 + je out_fps + dec dword [ttt] + jmp no_out_fps +new_time: + mov [savetime],eax + mov ebx,[fps_cntr] + mov [fps],ebx + mov [fps_cntr],0 +out_fps: +if ~(delcolor eq ) + mov ebx,x*65536+36 + mov ecx,y*65536+7 + mov edx,delcolor + mov eax,13 + int 0x40 +end if + mov dword [ttt],fps_show_frequency + mov eax,47 + mov ebx,6*65536 +; mov bl,0 + mov edx,x*65536+y + mov esi,color + mov ecx,[fps] + int 0x40 +no_out_fps: +} + +; COLLIMG - Collusion image's +_1dbounce_count=0; +macro collimg img1_off,x1,y1,img2_off,x2,y2,otv +{ +local bounce,exit,anot,bc,nbc + mov esi,[img1_off] ;xs1 + mov edi,[img2_off] ;ys2 + mov eax,x1 ; + mov ebx,x2 ; + call _1dbounce + mov edx,ecx + mov esi,[img1_off+4] ;ys1 + mov edi,[img2_off+4] ;ys2 + mov eax,y1 ; + mov ebx,y2 ; + call _1dbounce + add edx,ecx + cmp edx,2 + je bounce + mov otv,0 + jmp exit +_1dbounce_count=_1dbounce_count+1 +if _1dbounce_count = 1 +_1dbounce: + cmp ebx,eax + jb anot + add eax,esi + cmp eax,ebx + jbe nbc +bc: + mov ecx,1 + ret +anot: + add ebx,edi + cmp ebx,eax + ja bc +nbc: + xor ecx,ecx + ret +end if +bounce: + mov otv,1 +exit: +} + +macro rgbtobgr image +{ +local loo + mov eax,[image] + mul dword [image+4] + mov ecx,eax + mov esi,image+8 +; add esi,8 +loo: + mov al,[esi] + mov bl,[esi+2] + mov [esi],bl + mov [esi+2],al + add esi,3 + dec ecx + jnz loo +} + + +macro setimg x , y ,arg3 +{ + mov eax,7 + mov ebx,arg3 + add ebx,8 + mov cx,[arg3] + shl ecx,16 + add cx,[arg3+4] +; wordstoreg ecx,[arg3],[arg3+4] + words2reg edx, x , y ;arg1*65536+arg2 + int 0x40 +} + +macro setframe x , y ,arg3 +{ + mov eax,7 + mov ebx,arg3 + add ebx,8 + words2reg edx, x , y ;arg1*65536+arg2 + add edx,dword [arg3] + mov ecx,dword [arg3+4] + int 0x40 +} + + +macro getimg imgsrc,x,y,xs,ys,imgdest +{ +local cyc +if xs eqtype 0 + mov dword [imgdest],xs +else + mov eax,xs + mov dword [imgdest],eax +end if +if ys eqtype 0 + mov dword [imgdest+4],ys +else + mov eax,ys + mov dword [imgdest+4],eax +end if + + mov eax,dword [imgsrc] ;getx size +; lea ecx,[eax+2*eax] + mov ecx,eax + shl ecx,1 + add ecx,eax + + mov ebx,y + mul ebx + add eax,x + mov edx,ecx + lea eax,[eax+2*eax] ;eax=offset on imsrc +; mov ebp,eax +; shl eax,1 +; add eax,ebp + + mov ecx,xs + mov ebx,ys + + mov edi,8+imgdest + lea esi,[eax+8+imgsrc] +; mov esi,eax +; add esi,8 +; add esi,imgsrc + + cld +cyc: + movsw + movsb + dec ecx + jne cyc + add esi,edx + mov ecx,xs + sub esi,ecx + sub esi,ecx + sub esi,ecx + dec ebx + jne cyc +} + +macro copyimg img2_off,img1_off +{ + mov eax,dword [img1_off] + mov ebx,dword [img1_off+4] + mul ebx + lea ecx,[eax+2*eax] + lea esi,[img1_off+8] + lea edi,[img2_off+8] + cld + rep movsb +} + +macro fullimg img_off,xs,ys,color +{ +local cop + mov eax,xs + mov ebx,ys + mov dword [img_off],eax + mov dword [img_off+4],ebx + mul ebx + lea ebp,[eax+2*eax] + mov esi,color +if color eqtype 0 + mov ecx,color/65536 +else + mov ecx,esi + shr ecx,16 +end if + xor edi,edi +cop: + mov word [img_off+8+edi],si + add edi,2 + mov byte [img_off+8+edi],cl + inc edi + cmp edi,ebp + jne cop +} + + + + ; number of frame in ecx + ; callculatin offset of raw data + +macro getframeoff num_of_frame,offset_of_animation,offset_of_frame +{ +local loo,setpic + mov ebp,num_of_frame ;ecx + mov esi,offset_of_animation;Image +loo: + cmp ebp,0 + je setpic + movzx eax,word [esi+4] + movzx ebx,word [esi+6] + mul ebx ;dword [esi+4] + mov ebx,3 + mul ebx + add eax,8 + add esi,eax + dec ebp + jmp loo +setpic: + mov dword offset_of_frame,esi +} + + +; BMPTOIMG -Convert BMP format TO IMG format +; (SYNTAX) BMPTOIMG BMP_source_offset,IMG_dest_ofset +; (SAMPLE) View BMPLS.ASM sample. +; ( NOTE ) This is macros is not brake bmp structure! Tested in 32,8,4 bits + + +bmptoimg_data_area_count=0 +macro bmptoimg bmp_load_area,img_dest_area +{ +local fileinfo,string,end_bmp,nodix +local converttable,noaddelem,nextbit,convert1bpp,convert4bpp,convert2 +local nextelem,convertno32,nomorestring,convert1,nextstring,yespicsize +;local qwe,bmpfn + +; convert: + movzx eax,word [bmp_load_area+28] + mul dword [bmp_load_area+18] + add eax,31 + shr eax,5 + mov dword [bmptoimg_data_area_dwps],eax ;dwps-doublewords per string + shl eax,2 + mov dword [bmptoimg_data_area_bps],eax ;bps-bytes per string + + cmp dword [bmp_load_area+34],0 + jne yespicsize ;if picture size is defined + mul dword [bmp_load_area+22] + mov dword [bmp_load_area+34],eax + + yespicsize: + mov ebp,img_dest_area+8 + + mov eax,bmp_load_area + mov ebx,eax + add ebx, [bmp_load_area+2];file size + inc ebx + mov dword [bmptoimg_soi],ebx ;soi-start of image area for drawing + + add eax, [bmp_load_area+10] + mov dword [bmptoimg_data_area_sop],eax ;sop-start of picture in file + add eax, [bmp_load_area+34] + mov dword [bmptoimg_data_area_eop],eax ;eop-end of picture in file + mov eax, [bmp_load_area+18] + lea eax,[eax+2*eax] ;3x pixels in eax + + mov edi,dword [bmptoimg_soi] ;initializing + mov esi,dword [bmptoimg_data_area_eop] + sub esi,dword [bmptoimg_data_area_bps] + + + nextstring: + push edi + push ebp + cmp word [bmp_load_area+28],24 + jne convertno32 + + mov edi,ebp + mov ecx,[bmptoimg_data_area_dwps] + cld + rep movsd + + convert1: + pop ebp + pop edi + sub esi,dword [bmptoimg_data_area_bps] + sub esi,dword [bmptoimg_data_area_bps] + cmp esi,dword [bmptoimg_data_area_sop] + jb end_bmp + add edi,eax + add ebp,eax + jmp nextstring + + convertno32: + mov ebx,bmp_load_area + add ebx, [bmp_load_area+14] + add ebx,14 ;start of color table + push esi + add esi,dword [bmptoimg_data_area_bps] + mov dword [bmptoimg_data_area_eos],esi + pop esi + nextelem: + push eax + movzx eax,byte [esi] + cmp word [bmp_load_area+28],4 + je convert4bpp + cmp word [bmp_load_area+28],1 + je convert1bpp + call converttable + + convert2: + pop eax + inc esi + cmp esi,dword [bmptoimg_data_area_eos] + jae convert1 + add edi,3 + + add ebp,3 + + jmp nextelem + + convert4bpp: + shl ax,4 + shr al,4 + push ax + movzx eax,ah + call converttable + add edi,3 + + add ebp,3 + + pop ax + movzx eax,al + call converttable + jmp convert2 + + convert1bpp: + mov ecx,eax + mov edx,7 + nextbit: + xor eax,eax + bt ecx,edx + jnc noaddelem + inc eax + noaddelem: + push edx + call converttable + pop edx + dec edx + js convert2 + add edi,3 + + add ebp,3 + + jmp nextbit + + converttable: + shl eax,2 + add eax,ebx + mov edx, dword [eax] +; mov dword [edi],edx + mov [ebp],edx + ret + +bmptoimg_data_area_count=bmptoimg_data_area_count+1 +if bmptoimg_data_area_count = 1 +; DATA AREA +bmptoimg_soi dd 0 +bmptoimg_data_area_bps dd 0 +bmptoimg_data_area_dwps dd 0 +bmptoimg_data_area_sop dd 0 +bmptoimg_data_area_eop dd 0 +bmptoimg_data_area_eos dd 0 +end if + +end_bmp: + mov eax,dword [bmp_load_area+18] + mov ebx,dword [bmp_load_area+22] + mov dword [img_dest_area],eax + mov dword [img_dest_area+4],ebx +} + +; For convert RGB to BGR +COLOR_ORDER equ MENUETOS + +macro giftoani gifsrc,imgsrc,num_of_frames +{ +local hasharea, ReadGIF, nextblock,_null +local globalColor, img_count, cur_info, img_start +local codesize, compsize, bit_count, CC, EOI, Palette +local block_ofs, table_ptr, gifmacend +local no_gc, block_skip, no_comm, noextblock, uselocal +local setPal, filltable, reinit, cycle, zadd, noinc +local notintable, er, zend, nxt, continue, ex, Gif_skipmap +local Gif_get_sym, shift, nextbl, noblock, loop1, exx +local Gif_output, next, loop2 + +_null equ 0x1000 ; 0x1000 + +; jmp sss +; if defined gif_hash_offset +; else +; hasharea: +; times 4096 dd 0 ;4096 +; end if +;sss: + + mov esi,gifsrc ;Указатель на ГИФ фаил в памяти + mov edi,imgsrc ;Указатель на список картинок + + if defined gif_hash_offset + mov eax,gif_hash_offset ;Рабочая область минимум 4096*4 байт + else + mov eax,hasharea ;Рабочая область минимум 4096*4 байт + end if + + call ReadGIF + push ecx + pop dword num_of_frames + jmp gifmacend + + if defined gif_hash_offset + else + hasharea: + times 4096 dd 0 ;4096 + end if + +ReadGIF: + push esi edi + mov [table_ptr],eax + mov [cur_info],edi + xor eax,eax + mov [globalColor],eax + mov [img_count],eax + inc eax + cmp dword[esi],'GIF8' + jne er ; signature + mov ecx,[esi+0xa] + inc eax + add esi,0xd + mov edi,esi + bt ecx,7 + jnc nextblock + mov [globalColor],esi + call Gif_skipmap +nextblock: + cmp byte[edi],0x21 + jne noextblock + inc edi + cmp byte[edi],0xf9 ; Graphic Control Ext + jne no_gc + add edi,7 + jmp nextblock +no_gc: + cmp byte[edi],0xfe ; Comment Ext + jne no_comm + inc edi +block_skip: + movzx eax,byte[edi] + lea edi,[edi+eax+1] + cmp byte[edi],0 + jnz block_skip + inc edi + jmp nextblock +no_comm: + cmp byte[edi],0xff ; Application Ext + jne nextblock + add edi,13 + jmp block_skip +noextblock: + cmp byte[edi],0x2c ; image beginning + jne er + inc [img_count] + inc edi + mov esi,[cur_info] + xchg esi,edi + movsd + movsd + + push edi + movzx ecx,word[esi] + inc esi + bt ecx,7 + jc uselocal + push [globalColor] + mov edi,esi + jmp setPal +uselocal: + call Gif_skipmap + push esi +setPal: + movzx ecx,byte[edi] + inc ecx + mov [codesize],ecx + dec ecx + pop [Palette] + lea esi,[edi+1] + mov edi,[table_ptr] + xor eax,eax + cld + lodsb ; eax - block_count + add eax,esi + mov [block_ofs],eax + mov [bit_count],8 + mov eax,1 + shl eax,cl + mov [CC],eax + inc eax + mov [EOI],eax + lea ecx,[eax-1] + mov eax, _null shl 16 +filltable: + stosd + inc eax + loop filltable + pop edi + mov [img_start],edi +reinit: + mov edx,[EOI] + inc edx + push [codesize] + pop [compsize] + call Gif_get_sym + cmp eax,[CC] + je reinit + call Gif_output +cycle: + movzx ebx,ax + call Gif_get_sym + cmp eax,edx + jae notintable + cmp eax,[CC] + je reinit + cmp eax,[EOI] + je zend + call Gif_output +zadd: + push eax + mov eax,[table_ptr] + mov [eax+edx*4],ebx + pop eax + cmp edx,0xFFF + jae cycle + inc edx + bsr ebx,edx + cmp ebx,[compsize] + jne noinc + inc [compsize] +noinc: + jmp cycle +notintable: + push eax + mov eax,ebx + call Gif_output + push ebx + movzx eax,bx + call Gif_output + pop ebx eax + jmp zadd +er: + pop edi + jmp ex +zend: +; mov eax,[.cur_info] ; skip offset to next frame +; mov [eax],edi + mov [cur_info],edi + add esi,2 + xchg esi,edi +nxt: + cmp byte[edi],0 + jnz continue + inc edi + jmp nxt +continue: + cmp byte[edi],0x3b ;read next frame + jne nextblock + xor eax,eax + stosd + mov ecx,[img_count] +ex: + pop edi esi + ret + +Gif_skipmap: +; in: ecx - image descriptor, esi - pointer to colormap +; out: edi - pointer to area after colormap + + and ecx,111b + inc ecx ; color map size + mov ebx,1 + shl ebx,cl + lea ebx,[ebx*2+ebx] + lea edi,[esi+ebx] + ret + +Gif_get_sym: + mov ecx,[compsize] + push ecx + xor eax,eax +shift: + ror byte[esi],1 + rcr eax,1 + dec [bit_count] + jnz loop1 + inc esi + cmp esi,[block_ofs] + jb noblock + push eax + xor eax,eax + lodsb + test eax,eax + jnz nextbl + mov eax,[EOI] + sub esi,2 + add esp,8 + jmp exx +nextbl: + add eax,esi + mov [block_ofs],eax + pop eax +noblock: + mov [bit_count],8 +loop1: + loop shift + pop ecx + rol eax,cl +exx: + xor ecx,ecx + ret + +Gif_output: + push esi eax edx + mov edx,[table_ptr] +next: + push word[edx+eax*4] + mov ax,word[edx+eax*4+2] + inc ecx + cmp ax,_null + jnz next + shl ebx,16 + mov bx,[esp] +loop2: + pop ax + + lea esi,[eax+eax*2] + add esi,[Palette] + + if COLOR_ORDER eq MENUETOS + mov esi,[esi] + bswap esi + shr esi,8 + mov [edi],esi + add edi,3 + else + movsw + movsb + end if + + loop loop2 + pop edx eax esi + ret + + globalColor dd 1 + img_count dd 1 + cur_info dd 1 ; image table pointer + img_start dd 1 + codesize dd 1 + compsize dd 1 + bit_count dd 1 + CC dd 1 + EOI dd 1 + Palette dd 1 + block_ofs dd 1 + table_ptr dd 1 + +gifmacend: +} + + + +macro giftoimg gifsrc,imgsrc +{ +local hasharea, ReadGIF, nextblock,_null +local globalColor, img_count, cur_info, img_start +local codesize, compsize, bit_count, CC, EOI, Palette +local block_ofs, table_ptr, gifmacend +local no_gc, block_skip, no_comm, noextblock, uselocal +local setPal, filltable, reinit, cycle, zadd, noinc +local notintable, er, zend, nxt, continue, ex, Gif_skipmap +local Gif_get_sym, shift, nextbl, noblock, loop1, exx +local Gif_output, next, loop2 + +_null equ 0x1000 ; 0x1000 + + mov esi,gifsrc ;Указатель на ГИФ фаил в памяти + mov edi,imgsrc ;Указатель на список картинок + + if defined gif_hash_offset + mov eax,gif_hash_offset ;Рабочая область минимум 4096*4 байт + else + mov eax,hasharea ;Рабочая область минимум 4096*4 байт + end if + + call ReadGIF + jmp gifmacend + + if defined gif_hash_offset + else + hasharea: + times 4096 dd 0 ;4096 + end if + +ReadGIF: + push esi edi + mov [table_ptr],eax + mov [cur_info],edi + xor eax,eax + mov [globalColor],eax + mov [img_count],eax + inc eax + cmp dword[esi],'GIF8' + jne er ; signature + mov ecx,[esi+0xa] + inc eax + add esi,0xd + mov edi,esi + bt ecx,7 + jnc nextblock + mov [globalColor],esi + call Gif_skipmap +nextblock: + cmp byte[edi],0x21 + jne noextblock + inc edi + cmp byte[edi],0xf9 ; Graphic Control Ext + jne no_gc + add edi,7 + jmp nextblock +no_gc: + cmp byte[edi],0xfe ; Comment Ext + jne no_comm + inc edi +block_skip: + movzx eax,byte[edi] + lea edi,[edi+eax+1] + cmp byte[edi],0 + jnz block_skip + inc edi + jmp nextblock +no_comm: + cmp byte[edi],0xff ; Application Ext + jne nextblock + add edi,13 + jmp block_skip +noextblock: + cmp byte[edi],0x2c ; image beginning + jne er + inc [img_count] + inc edi + mov esi,[cur_info] + xchg esi,edi +; movsd +; movsd + + mov bp,word[esi+4] + movzx ebx,bp + mov [edi],ebx + + mov bp,word[esi+6] + movzx ebx,bp + mov [edi+4],ebx + + add edi,8 + add esi,8 + + push edi + movzx ecx,word[esi] + inc esi + bt ecx,7 + jc uselocal + push [globalColor] + mov edi,esi + jmp setPal +uselocal: + call Gif_skipmap + push esi +setPal: + movzx ecx,byte[edi] + inc ecx + mov [codesize],ecx + dec ecx + pop [Palette] + lea esi,[edi+1] + mov edi,[table_ptr] + xor eax,eax + cld + lodsb ; eax - block_count + add eax,esi + mov [block_ofs],eax + mov [bit_count],8 + mov eax,1 + shl eax,cl + mov [CC],eax + inc eax + mov [EOI],eax + lea ecx,[eax-1] + mov eax, _null shl 16 +filltable: + stosd + inc eax + loop filltable + pop edi + mov [img_start],edi +reinit: + mov edx,[EOI] + inc edx + push [codesize] + pop [compsize] + call Gif_get_sym + cmp eax,[CC] + je reinit + call Gif_output +cycle: + movzx ebx,ax + call Gif_get_sym + cmp eax,edx + jae notintable + cmp eax,[CC] + je reinit + cmp eax,[EOI] + je zend + call Gif_output +zadd: + push eax + mov eax,[table_ptr] + mov [eax+edx*4],ebx + pop eax + cmp edx,0xFFF + jae cycle + inc edx + bsr ebx,edx + cmp ebx,[compsize] + jne noinc + inc [compsize] +noinc: + jmp cycle +notintable: + push eax + mov eax,ebx + call Gif_output + push ebx + movzx eax,bx + call Gif_output + pop ebx eax + jmp zadd +er: + pop edi + jmp ex +zend: +; mov eax,[.cur_info] ; skip offset to next frame +; mov [eax],edi + mov [cur_info],edi + add esi,2 + xchg esi,edi +nxt: + cmp byte[edi],0 + jnz continue + inc edi + jmp nxt +continue: +; cmp byte[edi],0x3b ;read next frame +; jne nextblock + xor eax,eax + stosd + mov ecx,[img_count] +ex: + pop edi esi + ret + +Gif_skipmap: +; in: ecx - image descriptor, esi - pointer to colormap +; out: edi - pointer to area after colormap + + and ecx,111b + inc ecx ; color map size + mov ebx,1 + shl ebx,cl + lea ebx,[ebx*2+ebx] + lea edi,[esi+ebx] + ret + +Gif_get_sym: + mov ecx,[compsize] + push ecx + xor eax,eax +shift: + ror byte[esi],1 + rcr eax,1 + dec [bit_count] + jnz loop1 + inc esi + cmp esi,[block_ofs] + jb noblock + push eax + xor eax,eax + lodsb + test eax,eax + jnz nextbl + mov eax,[EOI] + sub esi,2 + add esp,8 + jmp exx +nextbl: + add eax,esi + mov [block_ofs],eax + pop eax +noblock: + mov [bit_count],8 +loop1: + loop shift + pop ecx + rol eax,cl +exx: + xor ecx,ecx + ret + +Gif_output: + push esi eax edx + mov edx,[table_ptr] +next: + push word[edx+eax*4] + mov ax,word[edx+eax*4+2] + inc ecx + cmp ax,_null + jnz next + shl ebx,16 + mov bx,[esp] +loop2: + pop ax + + lea esi,[eax+eax*2] + add esi,[Palette] + + if COLOR_ORDER eq MENUETOS + mov esi,[esi] + bswap esi + shr esi,8 + mov [edi],esi + add edi,3 + else + movsw + movsb + end if + + loop loop2 + pop edx eax esi + ret + + globalColor dd 1 + img_count dd 1 + cur_info dd 1 ; image table pointer + img_start dd 1 + codesize dd 1 + compsize dd 1 + bit_count dd 1 + CC dd 1 + EOI dd 1 + Palette dd 1 + block_ofs dd 1 + table_ptr dd 1 + +gifmacend: +} + diff --git a/programs/3detx60b/trunk/ascl.inc b/programs/3detx60b/trunk/ascl.inc new file mode 100644 index 0000000000..74c0a46c77 --- /dev/null +++ b/programs/3detx60b/trunk/ascl.inc @@ -0,0 +1,897 @@ +lang equ ru ; ru en fr ge fi + +; +; Assembler +; SMALL +; CODE +; Libary +; +; Ver 0.14 By Pavlushin Evgeni (RUSSIA) +; www.waptap@mail.ru + +;Please compile aplications on FASM ver1.54 or higer!!! + +;InfoList +;0.01 scank,putpix,puttxt +;0.02 label,random,colors +;0.03 window,startwd,endwd,attributes +;0.04 close,delay,scevent ~30.04.2004 +;0.05 small random, ~04.05.2004 +;0.06 wtevent ~09.05.2004 +;0.07 timeevent ~23.05.2004 +;0.08 txtput ~14.06.2004 +;0.09 opendialog,savedialog ~20.06.2004 +;0.10 wordstoreg by halyavin, add at ~30.08.2004 +; random bug deleted eax is use. +;0.11 loadfile from me +puttxt bug del ~07.09.2004 +;0.12 open/save dialog ~13.09.2004 +;0.13 dialogs bugs deleted +;0.14 drawlbut ~03.10.2004 +;0.15 extendet label! + +; LOADFILE +; (SYNTAX) LOADFILE 'full_path_to_file',file_load_area,file_temp_area +; (SAMPLE) LOADFILE '/rd/1/clock.bmp',load_area,temp_area + + +macro loadfile file_name,file_load_area,file_temp_area +{ +local open,fileinfo,string + jmp open +fileinfo: + dd 0 + dd 0 + dd 1 + dd file_load_area + dd file_temp_area +string: + db file_name,0 +open: + mov dword [fileinfo+8],1 ; how many blocks to read (1) + mov eax,58 + mov ebx,fileinfo + int 0x40 + mov eax,[file_load_area+2] + shr eax,9 ; поделим на 512 и прибавим 1 - получим число блоков + inc eax + mov dword [fileinfo+8],eax + mov eax,58 + mov ebx,fileinfo + int 0x40 +} + + +;macro wordstoreg reg,hiword,loword +;{ +;if hiword eqtype 0 & loword eqtype 0 +; mov reg,dword hiword*65536+loword +;else if hiword eqtype 12 & loword eqtype eax +; mov reg,dword hiword*65536 +; add reg,dword loword +;else if hiword eqtype 12 & loword eqtype [123] +; mov reg,dword hiword*65536 +; add reg,dword loword +;else +; mov reg,dword hiword +; shl reg,16 +; add reg,dword loword +;end if +;} + +macro dword2reg reg,doubleword +{ +if doubleword eq + ; not changes +else + mov reg,dword doubleword +end if +} + +macro words2reg reg,hiword,lowword +{ +if hiword eq + if lowword eq + ; not changes + else + if lowword eqtype 12 + and reg,dword 0xffff0000 + add reg,dword lowword + else + and reg,dword 0xffff0000 + add reg,dword lowword + end if + end if +else + if lowword eq + if hiword eqtype 12 + and reg,dword 0x0000ffff + add reg,dword hiword*65536 + else + shl reg,16 + add reg,dword hiword + ror reg,16 + end if + else + if lowword eqtype 12 & hiword eqtype 12 + if lowword eq 0 & hiword eq 0 + xor reg,reg + else + mov reg,dword hiword*65536+lowword + end if + else + mov reg,dword hiword + shl reg,16 + add reg,dword lowword + end if + end if +end if +} + + + + +; DRAW BUTTON with label + +macro drawlbut x,y,xs,ys,text,id,bcolor,tcolor +{ +local asd,lab + jmp asd +lab db text ;arg label +asd: + words2reg ebx,x,xs + words2reg ecx,y,ys + mov edx,id + mov esi,bcolor + mov eax,8 + int 0x40 + + mov eax,asd-lab ;calc size + mov ebx,6 + mul ebx + mov esi,eax + + mov eax,xs + sub eax,esi + shr eax,1 + add eax,x + + mov edx,ys + sub edx,7 + shr edx,1 + add edx,y + + mov ebx,eax + shl ebx,16 + add ebx,edx + + mov ecx,tcolor ;arg4 color + mov edx,lab + mov esi,asd-lab ;calc size + mov eax,4 + int 0x40 +} + + +macro opendialog redproc,openoff,erroff,path +{ +local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc +local run_fileinfo, param +local getmesloop, loox, mred, mkey, mbutton, mgetmes +local dlg_is_work, ready, procinfo +; +; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, +; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) +; + + cld +;; mov esi,path + mov edi,path + mov eax,0 + mov ecx,200 + rep stosb + +;mov [get_loops],0 +mov [dlg_pid_get],0 + +; Get my PID in dec format 4 bytes + mov eax,9 + mov ebx,procinfo + mov ecx,-1 + int 0x40 + +; convert eax bin to param dec + mov eax,dword [procinfo+30] ;offset of myPID + mov edi,param+4-1 ;offset to 4 bytes + mov ecx,4 + mov ebx,10 + cld +new_d: + xor edx,edx + div ebx + add dl,'0' + mov [edi],dl + dec edi + loop new_d + +; wirite 1 byte space to param + mov [param+4],byte 32 ;Space for next parametr +; and 1 byte type of dialog to param + mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog) + +; +; STEP2 prepare IPC area for get messages +; + +; prepare IPC area + mov [path],dword 0 + mov [path+4],dword 8 + +; define IPC memory + mov eax,60 + mov ebx,1 ; define IPC + mov ecx,path ; offset of area + mov edx,150 ; size 150 bytes + int 0x40 + +; change wanted events list 7-bit IPC event + mov eax,40 + mov ebx,01000111b + int 0x40 + +; +; STEP 3 run SYSTEM XTREE with parameters +; + + mov eax,58 + mov ebx,run_fileinfo + int 0x40 + + call redproc + + mov [get_loops],0 +getmesloop: + mov eax,23 + mov ebx,50 ;0.5 sec + int 0x40 + + cmp eax,1 + je mred + cmp eax,2 + je mkey + cmp eax,3 + je mbutton + cmp eax,7 + je mgetmes + +; Get number of procces + mov ebx,procinfo + mov ecx,-1 + mov eax,9 + int 0x40 + mov ebp,eax + +loox: + mov eax,9 + mov ebx,procinfo + mov ecx,ebp + int 0x40 + mov eax,[DLGPID] + cmp [procinfo+30],eax ;IF Dialog find + je dlg_is_work ;jmp to dlg_is_work + dec ebp + jnz loox + + jmp erroff + +dlg_is_work: + cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated + je erroff ;TESTODP2 terminated too + + cmp [dlg_pid_get],dword 1 + je getmesloop + inc [get_loops] + cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated + jae erroff + jmp getmesloop + +mred: + call redproc + jmp getmesloop +mkey: + mov eax,2 + int 0x40 ; read (eax=2) + jmp getmesloop +mbutton: + mov eax,17 ; get id + int 0x40 + cmp ah,1 ; button id=1 ? + jne getmesloop + mov eax,-1 ; close this program + int 0x40 +mgetmes: + +; If dlg_pid_get then second message get jmp to still + cmp [dlg_pid_get],dword 1 + je ready + +; First message is number of PID SYSXTREE dialog + +; convert PID dec to PID bin + movzx eax,byte [path+16] + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+1] + add eax,ebx + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+2] + add eax,ebx + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+3] + add eax,ebx + sub eax,48 + mov [DLGPID],eax + +; Claear and prepare IPC area for next message + mov [path],dword 0 + mov [path+4],dword 8 + mov [path+8],dword 0 + mov [path+12],dword 0 + mov [path+16],dword 0 + +; Set dlg_pid_get for get next message + mov [dlg_pid_get],dword 1 + call redproc ;show DLG_PID + jmp getmesloop + +ready: +; +; The second message get +; Second message is 100 bytes path to SAVE/OPEN file +; shl path string on 16 bytes +; + cld + mov esi,path+16 + mov edi,path + mov ecx,200 + rep movsb + mov [edi],byte 0 + + jmp openoff + + +; DATA AREA +get_loops dd 0 +dlg_pid_get dd 0 +DLGPID dd 0 + +param: + dd 0 ; My dec PID + dd 0,0 ; Type of dialog + +run_fileinfo: + dd 16 + dd 0 + dd param + dd 0 + dd procinfo ; 0x10000 +;run_filepath + db '/RD/1/SYSXTREE',0 + +procinfo: +times 1024 db 0 +} + + +macro savedialog redproc,openoff,erroff,path +{ +local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc +local run_fileinfo, run_filepath, param +local getmesloop, loox, mred, mkey, mbutton, mgetmes +local dlg_is_work, ready, procinfo +; +; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, +; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) +; + + cld +;; mov esi,path + mov edi,path + mov eax,0 + mov ecx,200 + rep stosb + +;mov [get_loops],0 +mov [dlg_pid_get],0 + +; Get my PID in dec format 4 bytes + mov eax,9 + mov ebx,procinfo + mov ecx,-1 + int 0x40 + +; convert eax bin to param dec + mov eax,dword [procinfo+30] ;offset of myPID + mov edi,param+4-1 ;offset to 4 bytes + mov ecx,4 + mov ebx,10 + cld +new_d: + xor edx,edx + div ebx + add dl,'0' + mov [edi],dl + dec edi + loop new_d + +; wirite 1 byte space to param + mov [param+4],byte 32 ;Space for next parametr +; and 1 byte type of dialog to param + mov [param+5],byte 'S' ;Get Open dialog (Use 'S' for Save dialog) + +; +; STEP2 prepare IPC area for get messages +; + +; prepare IPC area + mov [path],dword 0 + mov [path+4],dword 8 + +; define IPC memory + mov eax,60 + mov ebx,1 ; define IPC + mov ecx,path ; offset of area + mov edx,150 ; size 150 bytes + int 0x40 + +; change wanted events list 7-bit IPC event + mov eax,40 + mov ebx,01000111b + int 0x40 + +; +; STEP 3 run SYSTEM XTREE with parameters +; + + mov eax,58 + mov ebx,run_fileinfo + int 0x40 + + call redproc + + mov [get_loops],0 +getmesloop: + mov eax,23 + mov ebx,50 ;0.5 sec + int 0x40 + + cmp eax,1 + je mred + cmp eax,2 + je mkey + cmp eax,3 + je mbutton + cmp eax,7 + je mgetmes + +; Get number of procces + mov ebx,procinfo + mov ecx,-1 + mov eax,9 + int 0x40 + mov ebp,eax + +loox: + mov eax,9 + mov ebx,procinfo + mov ecx,ebp + int 0x40 + mov eax,[DLGPID] + cmp [procinfo+30],eax ;IF Dialog find + je dlg_is_work ;jmp to dlg_is_work + dec ebp + jnz loox + + jmp erroff + +dlg_is_work: + cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated + je erroff ;TESTODP2 terminated too + + cmp [dlg_pid_get],dword 1 + je getmesloop + inc [get_loops] + cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated + jae erroff + jmp getmesloop + +mred: + call redproc + jmp getmesloop +mkey: + mov eax,2 + int 0x40 ; read (eax=2) + jmp getmesloop +mbutton: + mov eax,17 ; get id + int 0x40 + cmp ah,1 ; button id=1 ? + jne getmesloop + mov eax,-1 ; close this program + int 0x40 +mgetmes: + +; If dlg_pid_get then second message get jmp to still + cmp [dlg_pid_get],dword 1 + je ready + +; First message is number of PID SYSXTREE dialog + +; convert PID dec to PID bin + movzx eax,byte [path+16] + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+1] + add eax,ebx + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+2] + add eax,ebx + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+3] + add eax,ebx + sub eax,48 + mov [DLGPID],eax + +; Claear and prepare IPC area for next message + mov [path],dword 0 + mov [path+4],dword 8 + mov [path+8],dword 0 + mov [path+12],dword 0 + mov [path+16],dword 0 + +; Set dlg_pid_get for get next message + mov [dlg_pid_get],dword 1 + call redproc ;show DLG_PID + jmp getmesloop + +ready: +; +; The second message get +; Second message is 100 bytes path to SAVE/OPEN file +; shl path string on 16 bytes +; + cld + mov esi,path+16 + mov edi,path + mov ecx,200 + rep movsb + mov [edi],byte 0 + + jmp openoff + + +; DATA AREA +get_loops dd 0 +dlg_pid_get dd 0 +DLGPID dd 0 + +param: + dd 0 ; My dec PID + dd 0,0 ; Type of dialog + +run_fileinfo: + dd 16 + dd 0 + dd param + dd 0 + dd procinfo +;run_filepath: + db '/RD/1/SYSXTREE',0 + +procinfo: +times 1024 db 0 +} + + + + +; RANDOM - generate random count (small) +; (SYNTAX) RANDOM MaxCount,OutArgument +; (SAMPLE) RANDOM 10000,eax +; ( NOTE ) Maxint<65536 ; use random 65536,eax for more combinations + +randomuse = 0 + +macro random arg1,arg2 +{ +local rxproc +randomuse = randomuse + 1 + + jmp rxproc + +if defined randomuse & randomuse = 1 +randomproc: + jmp rnj +rsx1 dw 0x4321 +rsx2 dw 0x1234 +rnj: +; mov eax,arg1 + push bx + push cx + push dx + push si + push di + mov cx,ax + mov ax,word ptr rsx1 + mov bx,word ptr rsx2 + mov si,ax + mov di,bx + mov dl,ah + mov ah,al + mov al,bh + mov bh,bl + xor bl,bl + rcr dl,1 + rcr ax,1 + rcr bx,1 + add bx,di + adc ax,si + add bx,0x62e9 + adc ax,0x3619 + mov word ptr rsx1,bx + mov word ptr rsx2,ax + xor dx,dx + cmp ax,0 + je nodiv + cmp cx,0 + je nodiv + div cx +nodiv: + mov ax,dx + pop di + pop si + pop dx + pop cx + pop bx + and eax,0000ffffh +; mov arg2,0 +; mov arg2,eax + ret +end if + +rxproc: + mov eax,arg1 + call randomproc + mov arg2,eax +} + +macro scank +{ + mov eax,10 + int 0x40 +} + +macro putpix x,y,color +{ + mov ebx,x + mov ecx,y + mov edx,color + mov eax,1 + int 0x40 +} + +macro puttxt x,y,offs,size,color +{ +; mov ebx,x +; shl ebx,16 +; add ebx,y + words2reg ebx,x,y + + dword2reg ecx,color + dword2reg edx,offs + dword2reg esi,size + +; mov ecx,color +; mov edx,offs +; mov esi,size + mov eax,4 + int 0x40 +} + +macro outcount data, x, y, color, numtype +{ + mov ecx,data + mov ebx,numtype + mov bl,0 +; mov edx,x*65536+y + words2reg edx,x,y + mov esi,color + mov eax,47 + int 0x40 +} + +; SCEVENT - Scan event + +macro scevent red,key,but +{ + mov eax,11 + int 0x40 + dec eax + jz red + dec eax + jz key + dec eax + jz but +} + +; WTEVENT - Wait event + +macro wtevent red,key,but +{ + mov eax,10 + int 0x40 + dec eax + jz red + dec eax + jz key + dec eax + jz but +} + +; TIMEEVENT - Wite for event with timeout + +macro timeevent xfps,noevent,red,key,but +{ + mov eax,23 + mov ebx,xfps + int 0x40 + cmp eax,0 + je noevent + dec eax + jz red + dec eax + jz key + dec eax + jz but +} + + +; CLOSE - Close program + +macro close +{ + mov eax,-1 + int 0x40 +} + +; DELAY - Create delay 1/100 sec +; (SYNTAX) Delay time +; (SAMPLE) Delay 100 ;delay 2 sec 1/100*200=2 sec + +macro delay arg1 +{ + mov eax,5 + mov ebx,arg1 + int 0x40 +} + +; WINDOW - Draw window +; (SYNTAX) WINDOW Xstart,Ystart,'Text',Color +; (SAMPLE) WINDOW 10,10,640+8,480+24,window_Skinned + +macro window arg1,arg2,arg3,arg4,arg5 +{ +; mov ebx,arg1*65536+arg3 +; mov ecx,arg2*65536+arg4 + words2reg ebx,arg1,arg3 + words2reg ecx,arg2,arg4 + mov edx,arg5 + mov eax,0 + int 0x40 +} + +macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7 +{ + mov ebx,arg1*65536+arg3 + mov ecx,arg2*65536+arg4 + mov edx,arg5 + mov esi,arg6 + mov edi,arg7 + mov eax,0 + int 0x40 +} + + +; STARTWD - Start of window draw + +macro startwd +{ + mov eax,12 + mov ebx,1 + int 0x40 +} + +; ENDWD - End window draw + +macro endwd +{ + mov eax,12 + mov ebx,2 + int 0x40 +} + +; LABEL - Put text to frame +; (SYNTAX) LABEL Xstart,Ystart,'Text',Color +; (SAMPLE) LABEL 10,12,'Hello World!',cl_Green+font_Big + +macro label arg1,arg2,arg3,arg4 +{ +local asd,lab + jmp asd +lab db arg3 ;arg label +asd: +; mov ebx,arg1 ;arg1=y arg2=x +; shl ebx,16 +; add ebx,arg2 + + words2reg ebx,arg1,arg2 + + dword2reg ecx,arg4 + + mov edx,lab + mov esi,asd-lab ;calc size + mov eax,4 + int 0x40 +} + +;Key's +key_Up equ 178 +key_Down equ 177 +key_Right equ 179 +key_Left equ 176 +key_Esc equ 27 +key_Space equ 32 +key_Enter equ 13 +key_Bspace equ 8 +key_F1 equ 50 +key_F2 equ 51 +key_F3 equ 52 +key_F4 equ 53 +key_F5 equ 54 +key_F6 equ 55 +key_F7 equ 56 +key_F8 equ 57 +key_F9 equ 48 +key_F10 equ 49 +key_F11 equ 68 +key_F12 equ 255 +key_Home equ 180 +key_End equ 181 +key_PgUp equ 184 +key_PgDown equ 183 + +;Attributes + +;Window Attributes +window_Skinned equ 0x03000000 +window_Type2 equ 0x02000000 +window_Type1 equ 0x00000000 +window_Reserve equ 0x01000000 + +;Font Attributes +font_Big equ 0x10000000 + +;Colors +cl_White equ 0x00ffffff +cl_Black equ 0x00000000 +cl_Grey equ 0x00888888 +cl_Red equ 0x00ff0000 +cl_Lime equ 0x0000ff00 +cl_Green equ 0x0000af00 +cl_Blue equ 0x000000ff +cl_Purple equ 0x008080ff +cl_Violet equ 0x008040ff +cl_Cyan equ 0x0040e0ff diff --git a/programs/3detx60b/trunk/build_en.bat b/programs/3detx60b/trunk/build_en.bat new file mode 100644 index 0000000000..4be7916c02 --- /dev/null +++ b/programs/3detx60b/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm 3detx60b.asm 3detx60b +@pause \ No newline at end of file diff --git a/programs/3detx60b/trunk/build_ru.bat b/programs/3detx60b/trunk/build_ru.bat new file mode 100644 index 0000000000..94f1587484 --- /dev/null +++ b/programs/3detx60b/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm 3detx60b.asm 3detx60b +@pause \ No newline at end of file diff --git a/programs/3detx60b/trunk/map.gif b/programs/3detx60b/trunk/map.gif new file mode 100644 index 0000000000..9192ae989a Binary files /dev/null and b/programs/3detx60b/trunk/map.gif differ diff --git a/programs/3detx60b/trunk/texmap.bmp b/programs/3detx60b/trunk/texmap.bmp new file mode 100644 index 0000000000..d785f877dd Binary files /dev/null and b/programs/3detx60b/trunk/texmap.bmp differ diff --git a/programs/3detx60b/trunk/texpack.gif b/programs/3detx60b/trunk/texpack.gif new file mode 100644 index 0000000000..1dae879c33 Binary files /dev/null and b/programs/3detx60b/trunk/texpack.gif differ diff --git a/programs/3dtcub10/trunk/3DTCUB10.ASM b/programs/3dtcub10/trunk/3DTCUB10.ASM new file mode 100644 index 0000000000..0d51e2df1f --- /dev/null +++ b/programs/3dtcub10/trunk/3DTCUB10.ASM @@ -0,0 +1,938 @@ +; +; 9 Ver Screen saver +; 5 Ver 24 bit texture. +; 23/8/2004 +; Pavlushin Evgeni 3d cube screen saver +; mail: waptap@mail.ru site: www.deck4.narod.ru +; +; This programm develop on sample text3d to Mikolaj Felix 25/5/2001 +; mfelix@polbox.com +; + +use32 + org 0x0 + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd I_END ; size of image + dd 0x200000 ; memory for app + dd 0x200000 ; esp + dd 0x0 , 0x0 ; I_Param , I_Icon + +include 'lang.inc' +MAX_DEGS equ 512 ;quantity of angels 2^n.Minimize for speedup +MAX_POINTS equ 8 ;quantity of points +MAX_FACES equ 6 ;quantity of points + +START: + finit + call draw_window + call clear_screen + call init_sincos + +still: + mov eax,23 ; wait for system event with 2 ms timeout + mov ebx,2 ; wait 2 ms, then continue + int 0x40 + +; mov eax,11 ;If you want maximum speed! :) +; int 0x40 + + dec eax ; window redraw request ? + je red + dec eax ; key in buffer ? + je key + dec eax ; button in buffer ? + je button + +main_loop: + call fade_texture + + mov esi,cube + mov edi,cube_rotated + mov ecx,MAX_POINTS*3 +copy_object: + fild word [esi] + fstp dword [edi] + add esi,2 + add edi,4 + dec ecx + jnz copy_object + + mov esi,angle_x + mov edi,cube_rotated + mov ecx,MAX_POINTS + call rotate_points + + mov esi,cube_rotated + mov edi,coord2d + mov ecx,MAX_POINTS + call translate_points + + call draw_textured_faces + call clear_screen_buffer + + add [angle_x],1 + add [angle_y],3 + add [angle_z],1 + + jmp still + +red: + call draw_window + jmp still +key: + mov eax,2 + jmp exit +button: + mov eax,17 + int 0x40 + cmp ah,1 + jne still +exit: + mov eax,-1 + int 0x40 + +;Draw window +draw_window: + mov eax,12 ;Start + mov ebx,1 + int 0x40 + + mov eax,0 ;Draw window + mov ebx,0*65536+(799) ;x start*65536+x size + mov ecx,0*65536+(599) ;y start*65536+y size + mov edx,0x00000000 ;0x03 use skinned window + int 0x40 + + call clear_screen + + mov eax,12 ;End + mov ebx,2 + int 0x40 + ret + +head_label: db "3D TEXTURED CUBE THE LITTLE SCREEN SAVER FOR MENUETOS. USE " + db "800x600 SCREEN MODE FROM VIEW. PRESS ANY KEY FOR EXIT" +hl_end: + +;FADE IN FADE OUT TEXTURE + +x_step db 0 +x_num db 1 + +fade_texture: + mov ecx,0 +loox: + mov al,[file_texture+ecx] + mov [texture+ecx],al + inc ecx + cmp ecx,128*128*3 + jnae loox + + mov ecx,0 +loox2: + mov al,[file_texture+ecx] + cmp [x_step],al + jae xxx + sub al,[x_step] + jmp nnn +xxx: + mov al,0 +nnn: + mov [texture+ecx],al + inc ecx + cmp ecx,128*128*3 + jnae loox2 + + cmp [x_step],255 + jne no_max + mov [x_num],-1 +no_max: + cmp [x_step],0 + jne no_min + mov [x_num],1 +no_min: + mov al,[x_num] + add [x_step],al + ret + +; Clear Screen +clear_screen: + mov eax,13 + mov ebx,0*65536+800 + mov ecx,0*65536+600 + mov edx,0 + int 40h + + mov eax,4 ;Out Text + mov ebx,8*65536+8 ;x start*65536+y start + mov ecx,0x00ffffff ;color White + mov edx,head_label + mov esi,hl_end-head_label + int 0x40 + ret + +clear_screen_buffer: + mov ebx,scrbuf + mov ecx,800*65536+(600-40) ;sub 40 for antiflickering title + mov edx,0*65536+40 + mov eax,7 + int 0x40 + + mov eax,4 ;Out Text + mov ebx,8*65536+580 ;x start*65536+y start + mov ebp,[n_step] + shl ebp,16 + sub ebx,ebp + mov ecx,0x0000ff00 ;color White + mov edx,move_text + add edx,[step] + mov esi,130 ;mt_end-move_text + int 0x40 + + inc [n_step] + cmp [n_step],6 + jna t_ok + mov [n_step],0 + inc [step] + cmp [step],mt_end-move_text-130 + jng t_ok + mov [step],0 +t_ok: + + mov edi,scrbuf + mov eax,0 ;black background + mov ecx,800*600*3/4 ; 16000 + cld + rep stosd + ret + +n_step dd 0 +step dd 0 + +move_text: db " " + db " " + db " " + db "***** 3D TEXTURED CUBE THE LITTLE SCREEN SAVER FOR " + db "MENUET OS. SET 800x600 SCREEN MODE FROM VIEW THIS SCREEN " + db "SAVER ***** " + db "SITE OF THE RUSSIAN DEVELOPERS TO MENUETOS: " + db "www.menuet.narod.ru " + db "RUSSIAN MENUET APLICATION ARCHIVE PAGE ON: " + db "www.meosfiles.narod.ru " + db "AUTOR OF THIS SCREEN SAVER Pavlushin Evgeni " + db "MY SITE: www.deck4.narod.ru (Slow update) " + db "AND MAIL BOX: waptap@mail.ru " + db "THANK YOU FOR USE! " + db " " + db " " + db " " +mt_end: + + +;include graphlib.asm Mikolaj Felix 9/12/2000 mfelix@polbox.com +;Draw textured faces proc + +@@rx1 dw 0 ;equ [bp-2] +@@ry1 dw 0 ;equ [bp-4] +@@rx2 dw 0 ;equ [bp-6] +@@ry2 dw 0 ;equ [bp-8] +@@rx3 dw 0 ;equ [bp-10] +@@ry3 dw 0 ;equ [bp-12] +@@rx4 dw 0 ;equ [bp-14] +@@ry4 dw 0 ;equ [bp-16] + +draw_textured_faces: + + mov esi,link + mov ecx,MAX_FACES +dtf_loop: + push ecx + + xor ebx,ebx + mov bl,byte [esi] ; point 1 + shl bx,2 + mov eax,dword [coord2d+bx] ;COPY 1 FOURANGLE POINT + mov dword [@@rx1],eax + + xor ebx,ebx + mov bl,byte [esi+1] ; point 2 + shl bx,2 + mov eax,dword [coord2d+bx] ;COPY 2 FOURANGLE POINT + mov dword [@@rx2],eax + + xor ebx,ebx + mov bl,byte [esi+2] ; point 3 + shl bx,2 + mov eax,dword [coord2d+bx] ;COPY 3 FOURANGLE POINT + mov dword [@@rx3],eax + + xor bh,bh ; point 4 + mov bl,byte [esi+3] + shl bx,2 + mov eax,dword [coord2d+bx] ;COPY 4 FOURANGLE POINT + mov dword [@@rx4],eax + + mov ax,[@@ry1] + sub ax,[@@ry3] + mov bx,[@@rx2] + sub bx,[@@rx1] + imul bx + shl edx,16 + mov dx,ax + push edx + mov ax,[@@rx1] + sub ax,[@@rx3] + mov bx,[@@ry2] + sub bx,[@@ry1] + imul bx + shl edx,16 + mov dx,ax + pop ebx + sub ebx,edx ; normal_z = (y1-y3)*(x2-x1)-(x1-x3)*(y2-y1) + or ebx,ebx + jl dtf_next_face ; normal_z < 0 + + ; FIRST PICE OF FOUR ANGLE + + ; Set 3 triangel puts for texture ycoord*65536+xcoord + mov dword [@@tex_x3],127*65536+127 ;3 point + mov dword [@@tex_x2],0*65536+127 ;2 point + mov dword [@@tex_x1],0*65536+0 ;1 point + ; Set texture bitmap offset + mov [@@tex_off],texture + ; Set 3 triangel puts coordinates + mov eax,dword [@@rx3] + mov dword [@@x3],eax + mov eax,dword [@@rx2] + mov dword [@@x2],eax + mov eax,dword [@@rx1] + mov dword [@@x1],eax + call textured_triangle + + ; SECOND PICE OF FOUR ANGLE + + ; Set 3 triangel puts for texture ycoord*65536+xcoord + mov dword [@@tex_x3],127*65536+0 ;3 point + mov dword [@@tex_x2],127*65536+127 ;2 point + mov dword [@@tex_x1],0*65536+0 ;1 point + ; Set texture bitmap offset + mov [@@tex_off],texture + ; Set 3 triangel puts coordinates + mov eax,dword [@@rx4] + mov dword [@@x3],eax + mov eax,dword [@@rx3] + mov dword [@@x2],eax + mov eax,dword [@@rx1] + mov dword [@@x1],eax + call textured_triangle + +dtf_next_face: + add esi,4 + pop ecx + dec ecx + jnz dtf_loop + ret + +;include tex3.asm Mikolaj Felix 15/5/2001 mfelix@polbox.com + +@@x1 dw 0 ;equ [bp+4] +@@y1 dw 0 ;equ [bp+6] +@@x2 dw 0 ;equ [bp+8] +@@y2 dw 0 ;equ [bp+10] +@@x3 dw 0 ;equ [bp+12] +@@y3 dw 0 ;equ [bp+14] + +@@tex_off dd 0 ;equ [bp+16] +@@tex_x1 dw 0 ;equ [bp+18] +@@tex_y1 dw 0 ;equ [bp+20] +@@tex_x2 dw 0 ;equ [bp+22] +@@tex_y2 dw 0 ;equ [bp+24] +@@tex_x3 dw 0 ;equ [bp+26] +@@tex_y3 dw 0 ;equ [bp+28] + +@@dx12 dw 0 ;equ [bp-2] +@@dx13 dw 0 ;equ [bp-4] +@@dx23 dw 0 ;equ [bp-6] + +@@tex_dx12 dw 0 ;equ [bp-8] +@@tex_dy12 dw 0 ;equ [bp-10] +@@tex_dx13 dw 0 ;equ [bp-12] +@@tex_dy13 dw 0 ;equ [bp-14] +@@tex_dx23 dw 0 ;equ [bp-16] +@@tex_dy23 dw 0 ;equ [bp-18] + +@@scan_x1 dw 0 ;equ [bp-20] +@@scan_y1 dw 0 ;equ [bp-22] +@@scan_x2 dw 0 ;equ [bp-24] +@@scan_y2 dw 0 ;equ [bp-26] + + +textured_triangle: + + mov ax,[@@y1] + cmp ax,[@@y3] + jb tt_check1 + + xchg ax,[@@y3] + mov [@@y1],ax + + mov ax,[@@x1] + xchg ax,[@@x3] + mov [@@x1],ax + + mov ax,[@@tex_y1] + xchg ax,[@@tex_y3] + mov [@@tex_y1],ax + + mov ax,[@@tex_x1] + xchg ax,[@@tex_x3] + mov [@@tex_x1],ax +tt_check1: + mov ax,[@@y2] + cmp ax,[@@y3] + jb tt_check2 + + xchg ax,[@@y3] + mov [@@y2],ax + + mov ax,[@@x2] + xchg ax,[@@x3] + mov [@@x2],ax + + mov ax,[@@tex_y2] + xchg ax,[@@tex_y3] + mov [@@tex_y2],ax + + mov ax,[@@tex_x2] + xchg ax,[@@tex_x3] + mov [@@tex_x2],ax +tt_check2: + mov ax,[@@y1] + cmp ax,[@@y2] + jb tt_check3 + + xchg ax,[@@y2] + mov [@@y1],ax + + mov ax,[@@x1] + xchg ax,[@@x2] + mov [@@x1],ax + + mov ax,[@@tex_y1] + xchg ax,[@@tex_y2] + mov [@@tex_y1],ax + + mov ax,[@@tex_x1] + xchg ax,[@@tex_x2] + mov [@@tex_x1],ax +tt_check3: + + mov bx,[@@y2] + sub bx,[@@y1] + jnz tt_dx12_make + + mov word [@@dx12],0 + mov word [@@tex_dx12],0 + mov word [@@tex_dy12],0 + jmp tt_dx12_done +tt_dx12_make: + mov ax,[@@x2] + sub ax,[@@x1] + shl ax,7 + cwd + idiv bx + mov [@@dx12],ax ; dx12 = (x2-x1)/(y2-y1) + + mov ax,[@@tex_x2] + sub ax,[@@tex_x1] + shl ax,7 + cwd + idiv bx + mov [@@tex_dx12],ax ; tex_dx12 = (tex_x2-tex_x1)/(y2-y1) + + mov ax,[@@tex_y2] + sub ax,[@@tex_y1] + shl ax,7 + cwd + idiv bx + mov [@@tex_dy12],ax ; tex_dy12 = (tex_y2-tex_y1)/(y2-y1) +tt_dx12_done: + + mov bx,[@@y3] + sub bx,[@@y1] + jnz tt_dx13_make + + mov word [@@dx13],0 + mov word [@@tex_dx13],0 + mov word [@@tex_dy13],0 + jmp tt_dx13_done +tt_dx13_make: + mov ax,[@@x3] + sub ax,[@@x1] + shl ax,7 + cwd + idiv bx + mov [@@dx13],ax ; dx13 = (x3-x1)/(y3-y1) + + mov ax,[@@tex_x3] + sub ax,[@@tex_x1] + shl ax,7 + cwd + idiv bx + mov [@@tex_dx13],ax ; tex_dx13 = (tex_x3-tex_x1)/(y3-y1) + + mov ax,[@@tex_y3] + sub ax,[@@tex_y1] + shl ax,7 + cwd + idiv bx + mov [@@tex_dy13],ax ; tex_dy13 = (tex_y3-tex_x1)/(y3-y1) +tt_dx13_done: + + mov bx,[@@y3] + sub bx,[@@y2] + jnz tt_dx23_make + + mov word [@@dx23],0 + mov word [@@tex_dx23],0 + mov word [@@tex_dy23],0 + jmp tt_dx23_done +tt_dx23_make: + mov ax,[@@x3] + sub ax,[@@x2] + shl ax,7 + cwd + idiv bx + mov [@@dx23],ax ; dx23 = (x3-x2)/(y3-y2) + + mov ax,[@@tex_x3] + sub ax,[@@tex_x2] + shl ax,7 + cwd + idiv bx + mov [@@tex_dx23],ax ; tex_dx23 = (tex_x3-tex_x2)/(y3-y2) + + mov ax,[@@tex_y3] + sub ax,[@@tex_y2] + shl ax,7 + cwd + idiv bx + mov [@@tex_dy23],ax ; tex_dy23 = (tex_y3-tex_y2)/(y3-y2) +tt_dx23_done: + + + mov ax,[@@x1] + shl ax,7 + mov bx,ax + mov cx,[@@y1] + + mov dx,[@@tex_x1] + shl dx,7 + mov [@@scan_x1],dx + mov [@@scan_x2],dx + mov dx,[@@tex_y1] + shl dx,7 + mov [@@scan_y1],dx + mov [@@scan_y2],dx +tt_loop1: + pushad +; push ax +; push bx +; push cx + + mov dx,[@@scan_y2] + shr dx,7 + mov [@@tex_ly2],dx ;push dx + mov dx,[@@scan_x2] + shr dx,7 + mov [@@tex_lx2],dx ;push dx + mov dx,[@@scan_y1] + shr dx,7 + mov [@@tex_ly1],dx ;push dx + mov dx,[@@scan_x1] + shr dx,7 + mov [@@tex_lx1],dx ;push dx + mov ebp,dword [@@tex_off] ;push word ptr @@tex_off + mov [@@tex_loff],ebp + + mov [@@ly],cx ;push cx + mov dx,bx + shr dx,7 + mov [@@lx2],dx ;push dx + mov dx,ax + shr dx,7 + mov [@@lx1],dx ; push dx + call textured_horizontal_line + +; pop cx +; pop bx +; pop ax + popad + + mov dx,[@@tex_dx13] + add [@@scan_x1],dx + mov dx,[@@tex_dx12] + add [@@scan_x2],dx + mov dx,[@@tex_dy13] + add [@@scan_y1],dx + mov dx,[@@tex_dy12] + add [@@scan_y2],dx + + add ax,[@@dx13] + add bx,[@@dx12] + inc cx + cmp cx,[@@y2] + jb tt_loop1 + + mov bx,[@@x2] + shl bx,7 + mov cx,[@@y2] + + mov dx,[@@tex_x2] + shl dx,7 + mov [@@scan_x2],dx + mov dx,[@@tex_y2] + shl dx,7 + mov [@@scan_y2],dx +tt_loop2: + + pushad +; push ax +; push bx +; push cx + + mov dx,[@@scan_y2] + shr dx,7 + mov [@@tex_ly2],dx ;push dx + mov dx,[@@scan_x2] + shr dx,7 + mov [@@tex_lx2],dx ;push dx + mov dx,[@@scan_y1] + shr dx,7 + mov [@@tex_ly1],dx ;push dx + mov dx,[@@scan_x1] + shr dx,7 + mov [@@tex_lx1],dx ;push dx + mov ebp,dword [@@tex_off] ;push word ptr @@tex_off + mov [@@tex_loff],ebp + + mov [@@ly],cx ;push cx + mov dx,bx + shr dx,7 + mov [@@lx2],dx ;push dx + mov dx,ax + shr dx,7 + mov [@@lx1],dx ; push dx + call textured_horizontal_line + +; pop cx +; pop bx +; pop ax + popad + + mov dx,[@@tex_dx13] + add [@@scan_x1],dx + mov dx,[@@tex_dx23] + add [@@scan_x2],dx + mov dx,[@@tex_dy13] + add [@@scan_y1],dx + mov dx,[@@tex_dy23] + add [@@scan_y2],dx + + add ax,[@@dx13] + add bx,[@@dx23] + inc cx + cmp cx,[@@y3] + jb tt_loop2 + ret + +@@lx1 dw 0 ;equ [bp+4] +@@lx2 dw 0 ;equ [bp+6] +@@ly dw 0 ;equ [bp+8] + +@@tex_loff dd 0 ;equ [bp+10] +@@tex_lx1 dw 0 ;equ [bp+12] +@@tex_ly1 dw 0 ;equ [bp+14] +@@tex_lx2 dw 0 ;equ [bp+16] +@@tex_ly2 dw 0 ;equ [bp+18] + +@@tex_ldx dw 0 ;equ [bp-2] +@@tex_ldy dw 0 ;equ [bp-4] + +textured_horizontal_line: + + mov ax,[@@lx1] + cmp ax,[@@lx2] + je thl_quit + jb thl_ok + + xchg ax,[@@lx2] + mov [@@lx1],ax + + mov ax,[@@tex_lx1] + xchg ax,[@@tex_lx2] + mov [@@tex_lx1],ax + + mov ax,[@@tex_ly1] + xchg ax,[@@tex_ly2] + mov [@@tex_ly1],ax +thl_ok: + + ; Fast method +; mov edi,0 +; mov di,[@@ly] ;edi = calculating start of line +; mov ax,di +; shl di,6 ;ly*64 +; shl ax,8 ;ly*256 +; add di,ax ;di = (ly*64)+(ly*256) +; add di,[@@lx1] ;di = ly*320+lx1 +; mov eax,edi +; shl eax,1 +; add edi,eax +; add edi,scrbuf + + ; Uneversal method + movsx edi,[@@ly] + mov eax,800 ;di = ly*320+lx1 + mul edi + movsx ebx,[@@lx1] + add eax,ebx ;[@@lx1] + mov edi,3 + mul edi + mov edi,eax + add edi,scrbuf + + mov cx,[@@lx2] + sub cx,[@@lx1] + + mov ax,[@@tex_lx2] + sub ax,[@@tex_lx1] + shl ax,7 + cwd + idiv cx + mov [@@tex_ldx],ax ; tex_dx = (tex_x2-tex_x1)/(x2-x1) + + mov ax,[@@tex_ly2] + sub ax,[@@tex_ly1] + shl ax,7 + cwd + idiv cx + mov [@@tex_ldy],ax ; tex_dy = (tex_y2-tex_y1)/(x2-x1) + + cld + inc cx + mov ax,[@@tex_lx1] + shl ax,7 + mov bx,[@@tex_ly1] + shl bx,7 + +thl_loop: + mov dx,ax + push bx + + and bx,0ff80h + shr ax,7 + add bx,ax + mov ebp,0 + mov bp,bx + mov eax,ebp + shl eax,1 + add ebp,eax + add ebp,[@@tex_loff] + + mov al,byte [ebp+2] + stosb + mov al,byte [ebp+1] + stosb + mov al,byte [ebp] + stosb + + pop bx + mov ax,dx + + add ax,[@@tex_ldx] + add bx,[@@tex_ldy] + dec cx + jnz thl_loop +thl_quit: + ret + +;include math3d_2.asm +; Mikolaj Felix 20/06/2001 +; mfelix@polbox.com + +;------------------------------------------------------------ +; ds:si - offset to angles (int) +; ds:di - offset to array of 3d points +; cx - number of points +;------------------------------------------------------------ + +@@sin_x dd 0 ;equ dword ptr [bp-4] +@@cos_x dd 0 ;equ dword ptr [bp-8] +@@sin_y dd 0 ;equ dword ptr [bp-12] +@@cos_y dd 0 ;equ dword ptr [bp-16] +@@sin_z dd 0 ;equ dword ptr [bp-20] +@@cos_z dd 0 ;equ dword ptr [bp-24] + +@@x equ dword [edi] +@@y equ dword [edi+4] +@@z equ dword [edi+8] + +rotate_points: + + push edi + mov edi,@@sin_x + mov edx,3 +rp_sin_cos: + mov bx,word [esi] + and bx,MAX_DEGS-1 + shl bx,2 + mov eax,dword [sintab+bx] + mov dword [edi],eax + mov eax,dword [costab+bx] + mov dword [edi+4],eax + add edi,8 + add esi,2 + dec edx + jnz rp_sin_cos + pop edi + +rp_rotate: + fld @@y + fmul [@@cos_x] + fld @@z + fmul [@@sin_x] + fsubp st1,st + fld @@y + fxch st1 + fstp @@y ; Yrotated = Cos (A)*Y - Sin (A)*Z + fmul [@@sin_x] + fld @@z + fmul [@@cos_x] + faddp st1,st + fstp @@z ; Zrotated = Sin (A)*Y + Cos (A)*Z + + fld @@x + fmul [@@cos_y] + fld @@z + fmul [@@sin_y] + fsubp st1,st + fld @@x + fxch st1 + fstp @@x ; Xrotated = Cos (A)*X - Sin (A)*Z + fmul [@@sin_y] + fld @@z + fmul [@@cos_y] + faddp st1,st + fstp @@z ; Zrotated = Sin (A)*X + Cos (A)*Z + + fld @@x + fmul [@@cos_z] + fld @@y + fmul [@@sin_z] + fsubp st1,st + fld @@x + fxch st1 + fstp @@x ; Xrotated = Cos (A)*X - Sin (A)*Y + fmul [@@sin_z] + fld @@y + fmul [@@cos_z] + faddp st1,st + fstp @@y ; Yrotated = Sin (A)*X + Cos (A)*Y + + add edi,12 + dec ecx + jnz rp_rotate + ret + +;------------------------------------------------------------ +; ds:si - offset to array of 3d points +; ds:di - offset to 2d points +; cx - number of points +;------------------------------------------------------------ + +translate_points: + + fld dword [esi+8] + fadd [perspective] + + fld dword [esi] + fmul [perspective] + fdiv st,st1 + fadd [correct_x] + fistp word [edi] ; x2d = (x*persp)/(z+persp)+correct_x + + fld dword [esi+4] + fmul [perspective] + fdivrp st1,st + fadd [correct_y] + fistp word [edi+2] ; y2d = (y*persp)/(z+persp)+correct_y + + add esi,12 + add edi,4 + dec ecx + jnz translate_points + ret + +; initalize SIN&COS table + +@@temp1 dd 0 ;dword ptr [bp-4] +@@temp2 dd 0 ;dword ptr [bp-8] + +init_sincos: + mov [@@temp1],0 + fldpi + mov [@@temp2],MAX_DEGS/2 + fidiv [@@temp2] + fstp [@@temp2] + + xor edi,edi + mov ecx,MAX_DEGS +isc_loop: + fld [@@temp1] + fld st0 + fld st0 + fsin + fstp dword [sintab+edi] + fcos + fstp dword [costab+edi] + fadd [@@temp2] + fstp [@@temp1] + + add edi,4 + dec ecx + jnz isc_loop + ret + +perspective dd 256.0 +correct_x dd 400.0 +correct_y dd 300.0 + +angle_x dw 0 +angle_y dw 0 +angle_z dw 0 + +file_texture: +file 'texture.raw' + +cube dw -50,-50,50, 50,-50,50, 50,50,50, -50,50,50 + dw -50,-50,-50, 50,-50,-50, 50,50,-50, -50,50,-50 + +link db 0,1,2,3, 5,4,7,6, 1,5,6,2, 4,0,3,7, 4,5,1,0, 3,2,6,7 + +sintab: +rd MAX_DEGS +costab: +rd MAX_DEGS + +cube_rotated: +rd MAX_POINTS*3 +coord2d: +rw MAX_POINTS*2 +texture: +rb 128*128*3 +scrbuf: + +I_END: \ No newline at end of file diff --git a/programs/3dtcub10/trunk/build_en.bat b/programs/3dtcub10/trunk/build_en.bat new file mode 100644 index 0000000000..3ad3c0b79a --- /dev/null +++ b/programs/3dtcub10/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm 3dtcub10.asm 3dtcub10 +@pause \ No newline at end of file diff --git a/programs/3dtcub10/trunk/build_ru.bat b/programs/3dtcub10/trunk/build_ru.bat new file mode 100644 index 0000000000..9a3129bbf4 --- /dev/null +++ b/programs/3dtcub10/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm 3dtcub10.asm 3dtcub10 +@pause \ No newline at end of file diff --git a/programs/3dtcub10/trunk/texture.raw b/programs/3dtcub10/trunk/texture.raw new file mode 100644 index 0000000000..c1cd2c685f Binary files /dev/null and b/programs/3dtcub10/trunk/texture.raw differ diff --git a/programs/ac97wav/trunk/ac97.inc b/programs/ac97wav/trunk/ac97.inc new file mode 100644 index 0000000000..a23ea9fde5 --- /dev/null +++ b/programs/ac97wav/trunk/ac97.inc @@ -0,0 +1,288 @@ +; Vendor ids +INTEL_VID = 0x8086 +SIS_VID = 0x1039 +NVIDIA_VID = 0x10DE +AMD_VID = 0x1022 + +; Device ids +ICH_DID = 0x2415 +ICH0_DID = 0x2425 +ICH2_DID = 0x2445 +ICH3_DID = 0x2485 +ICH4_DID = 0x24C5 +ICH5_DID = 0x24D5 +MX440_DID = 0x7195 +SI7012_DID = 0x7012 +NFORCE_DID = 0x01B1 +NFORCE2_DID = 0x006A +AMD8111_DID = 0x764D +AMD768_DID = 0x7445 + +NAMBAR_REG = 0x10 ; native audio mixer BAR + NAM_SIZE = 256 ; 256 bytes required. + +NABMBAR_REG = 0x14 ; native audio bus mastering BAR + NABM_SIZE = 64 ; 64 bytes + +IRQ_REG = 0x3c ; IRQ holder for PCI +INT_REG = 0x3d ; INT pin +ICH4_CFG_REG = 0x41 ; ICH4 config register + + +; BUS master registers, accessed via NABMBAR+offset + +; ICH supports 3 different types of register sets for three types of things +; it can do, thus: +; +; PCM in (for recording) aka PI +; PCM out (for playback) aka PO +; MIC in (for recording) aka MC + +PI_BDBAR_REG = 0 ; PCM in buffer descriptor BAR +PO_BDBAR_REG = 10h ; PCM out buffer descriptor BAR +MC_BDBAR_REG = 20h ; MIC in buffer descriptor BAR + +; each buffer descriptor BAR holds a pointer which has entries to the buffer +; contents of the .WAV file we're going to play. Each entry is 8 bytes long +; (more on that later) and can contain 32 entries total, so each BAR is +; 256 bytes in length, thus: + +BDL_SIZE = 32*8 ; Buffer Descriptor List size +INDEX_MASK = 31 ; indexes must be 0-31 + + + +PI_CIV_REG = 4 ; PCM in current Index value (RO) +PO_CIV_REG = 14h ; PCM out current Index value (RO) +MC_CIV_REG = 24h ; MIC in current Index value (RO) + +;8bit read only +; each current index value is simply a pointer showing us which buffer +; (0-31) the codec is currently processing. Once this counter hits 31, it +; wraps back to 0. +; this can be handy to know, as once it hits 31, we're almost out of data to +; play back or room to record! + + +PI_LVI_REG = 5 ; PCM in Last Valid Index +PO_LVI_REG = 15h ; PCM out Last Valid Index +MC_LVI_REG = 25h ; MIC in Last Valid Index +;8bit read/write +; The Last Valid Index is a number (0-31) to let the codec know what buffer +; number to stop on after processing. It could be very nasty to play audio +; from buffers that aren't filled with the audio we want to play. + + +PI_SR_REG = 6 ; PCM in Status register +PO_SR_REG = 16h ; PCM out Status register +MC_SR_REG = 26h ; MIC in Status register +;16bit read/write +; status registers. Bitfields follow: + +FIFO_ERR = BIT4 ; FIFO Over/Underrun W1TC. + +BCIS = BIT3 ; buffer completion interrupt status. + ; Set whenever the last sample in ANY + ; buffer is finished. Bit is only + ; set when the Interrupt on Complete + ; (BIT4 of control reg) is set. + +LVBCI = BIT2 ; Set whenever the codec has processed + ; the last buffer in the buffer list. + ; Will fire an interrupt if IOC bit is + ; set. Probably set after the last + ; sample in the last buffer is + ; processed. W1TC + + +CELV = BIT1 ; Current buffer == last valid. + ; Bit is RO and remains set until LVI is + ; cleared. Probably set up the start + ; of processing for the last buffer. + + +DCH = BIT0 ; DMA controller halted. + ; set whenever audio stream is stopped + ; or something else goes wrong. + + +PI_PICB_REG = 8 ; PCM in position in current buffer(RO) +PO_PICB_REG = 18h ; PCM out position in current buffer(RO) +MC_PICB_REG = 28h ; MIC in position in current buffer (RO) +;16bit read only +; position in current buffer regs show the number of dwords left to be +; processed in the current buffer. +; + + + + + +PI_PIV_REG = 0ah ; PCM in Prefected index value +PO_PIV_REG = 1ah ; PCM out Prefected index value +MC_PIV_REG = 2ah ; MIC in Prefected index value +;8bit, read only +; Prefetched index value register. +; tells which buffer number (0-31) has be prefetched. I'd imagine this +; value follows the current index value fairly closely. (CIV+1) +; + + +PI_CR_REG = 0bh ; PCM in Control Register +PO_CR_REG = 1bh ; PCM out Control Register +MC_CR_REG = 2bh ; MIC in Control Register +; 8bit +; Control register *MUST* only be accessed as an 8bit value. +; Control register. See bitfields below. +; + + +IOCE = BIT4 ; interrupt on complete enable. + ; set this bit if you want an intrtpt + ; to fire whenever LVBCI is set. +FEIFE = BIT3 ; set if you want an interrupt to fire + ; whenever there is a FIFO (over or + ; under) error. +LVBIE = BIT2 ; last valid buffer interrupt enable. + ; set if you want an interrupt to fire + ; whenever the completion of the last + ; valid buffer. +RR = BIT1 ; reset registers. Nukes all regs + ; except bits 4:2 of this register. + ; Only set this bit if BIT 0 is 0 +RPBM = BIT0 ; Run/Pause + ; set this bit to start the codec! + + +GLOB_CNT_REG = 2ch ; Global control register +SEC_RES_EN = BIT5 ; secondary codec resume event + ; interrupt enable. Not used here. +PRI_RES_EN = BIT4 ; ditto for primary. Not used here. +ACLINK_OFF = BIT3 ; Turn off the AC97 link +ACWARM_RESET = BIT2 ; Awaken the AC97 link from sleep. + ; registers preserved, bit self clears +ACCOLD_RESET = BIT1 ; Reset everything in the AC97 and + ; reset all registers. Not self clearin +;g + +GPIIE = BIT0 ; GPI Interrupt enable. + ; set if you want an interrupt to + ; fire upon ANY of the bits in the + ; GPI (general pursose inputs?) not used +;. + +GLOB_STS_REG = 30h ; Global Status register (RO) + +MD3 = BIT17 ; modem powerdown status (yawn) +AD3 = BIT16 ; Audio powerdown status (yawn) +RD_COMPLETE_STS = BIT15 ; Codec read timed out. 0=normal +BIT3SLOT12 = BIT14 ; shadowed status of bit 3 in slot 12 +BIT2SLOT12 = BIT13 ; shadowed status of bit 2 in slot 12 +BIT1SLOT12 = BIT12 ; shadowed status of bit 1 in slot 12 +SEC_RESUME_STS = BIT11 ; secondary codec has resumed (and irqed) +PRI_RESUME_STS = BIT10 ; primary codec has resumed (and irqed) +SEC_CODEC_RDY = BIT9 ; secondary codec is ready for action +PRI_CODEC_RDY = BIT8 ; Primary codec is ready for action + ; software must check these bits before + ; starting the codec! +MIC_IN_IRQ = BIT7 ; MIC in caused an interrupt +PCM_OUT_IRQ = BIT6 ; One of the PCM out channels IRQed +PCM_IN_IRQ = BIT5 ; One of the PCM in channels IRQed +MODEM_OUT_IRQ = BIT2 ; modem out channel IRQed +MODEM_IN_IRQ = BIT1 ; modem in channel IRQed +GPI_STS_CHANGE = BIT0 ; set whenever GPI's have changed. + ; BIT0 of slot 12 also reflects this. + + +ACC_SEMA_REG = 34h ; Codec write semiphore register +CODEC_BUSY = BIT0 ; codec register I/O is happening + ; self clearing + + + +; +; Buffer Descriptors List +; As stated earlier, each buffer descriptor list is a set of (up to) 32 +; descriptors, each 8 bytes in length. Bytes 0-3 of a descriptor entry point +; to a chunk of memory to either play from or record to. Bytes 4-7 of an +; entry describe various control things detailed below. +; +; Buffer pointers must always be aligned on a Dword boundry. +; +; + +IOC = BIT31 ; Fire an interrupt whenever this + ; buffer is complete. + +BUP = BIT30 ; Buffer Underrun Policy. + ; if this buffer is the last buffer + ; in a playback, fill the remaining + ; samples with 0 (silence) or not. + ; It's a good idea to set this to 1 + ; for the last buffer in playback, + ; otherwise you're likely to get a lot + ; of noise at the end of the sound. + +; +; Bits 15:0 contain the length of the buffer, in number of samples, which +; are 16 bits each, coupled in left and right pairs, or 32bits each. +; Luckily for us, that's the same format as .wav files. +; +; A value of FFFF is 65536 samples. Running at 44.1Khz, that's just about +; 1.5 seconds of sample time. FFFF * 32bits is 1FFFFh bytes or 128k of data. +; +; A value of 0 in these bits means play no samples. +; + + +;***************************************************************************** +;* AC97 Codec registers include (based on Jeff Leyda AC97 wav player SDK :-) +;***************************************************************************** + +; Not all codecs are created =al. Refer to the spec for your specific codec. +; All registers are 16bits wide. Access to codec registers over the AC97 link +; is defined by the OEM. +; Secondary codec's are accessed by ORing in BIT7 of all register accesses. + + +; each codec/mixer register is 16bits + +CODEC_RESET_REG = 00 ; reset codec +CODEC_MASTER_VOL_REG = 02 ; master volume +CODEC_HP_VOL_REG = 04 ; headphone volume +CODEC_MASTER_MONO_VOL_REG = 06 ; master mono volume +CODEC_MASTER_TONE_REG = 08 ; master tone (R+L) +CODEC_PCBEEP_VOL_REG = 0ah ; PC beep volume +CODEC_PHONE_VOL_REG = 0ch ; phone volume +CODEC_MIC_VOL_REG = 0eh ; MIC volume +CODEC_LINE_IN_VOL_REG = 10h ; line input volume +CODEC_CD_VOL_REG = 12h ; CD volume +CODEC_VID_VOL_REG = 14h ; video volume +CODEC_AUX_VOL_REG = 16h ; aux volume +CODEC_PCM_OUT_REG = 18h ; PCM output volume +CODEC_RECORD_SELECT_REG = 1ah ; record select input +CODEC_RECORD_VOL_REG = 1ch ; record volume +CODEC_RECORD_MIC_VOL_REG = 1eh ; record mic volume +CODEC_GP_REG = 20h ; general purpose +CODEC_3D_CONTROL_REG = 22h ; 3D control +; 24h is reserved +CODEC_POWER_CTRL_REG = 26h ; powerdown control +CODEC_EXT_AUDIO_REG = 28h ; extended audio +CODEC_EXT_AUDIO_CTRL_REG = 2ah ; extended audio control +CODEC_PCM_FRONT_DACRATE_REG = 2ch ; PCM out sample rate +CODEC_PCM_SURND_DACRATE_REG = 2eh ; surround sound sample rate +CODEC_PCM_LFE_DACRATE_REG = 30h ; LFE sample rate +CODEC_LR_ADCRATE_REG = 32h ; PCM in sample rate +CODEC_MIC_ADCRATE_REG = 34h ; mic in sample rate + + +; registers 36-7a are reserved on the ICH + +CODEC_VENDORID1_REG = 7ch ; codec vendor ID 1 +CODEC_VENDORID2_REG = 7eh ; codec vendor ID 2 + + +; When 2 codecs are present in the system, use BIT7 to access the 2nd +; set of registers, ie 80h-feh + +SECONDARY_CODEC = BIT7 ; 80-8f registers for 2nda \ No newline at end of file diff --git a/programs/ac97wav/trunk/ac97wav.asm b/programs/ac97wav/trunk/ac97wav.asm new file mode 100644 index 0000000000..258446d593 --- /dev/null +++ b/programs/ac97wav/trunk/ac97wav.asm @@ -0,0 +1,1084 @@ +;--------------------------------------------------------------------- +; +; MenuetOS AC97 WAV Player +; +; 0.03 November 10, 2004 doesn't halt if file not found +; 0.04 November 11, 2004 better positioning (with mouse) +; 0.05 November 14, 2004 internals clean up +; fixed cutting sound at the edges +; 0.06 November 17, 2004 fixed many bugs +; 0.07 Nov 20, 2004 deactivates text box when 'play' pressed +; stops playing before closing a window +; 0.08 Nov 24, 2004 added support for 8bit and mono modes +; +variable rate for some chipsets +; +; Use [flat assembler 1.56] to compile. +; +;--------------------------------------------------------------------- + + use32 ; turn on 32 bit mode + org 0x0 ; the program is placed at 0 offset + + db 'MENUET01' ; 8-byte identifier of MenuetOS application + dd 0x01 ; header version (always 1) + dd START ; address of the beginning of the code + dd IMAGE_END ; size of the program's image + dd MEMORY_END ; how much memory does it need + dd STACK_P ; a pointer to the top of the stack + dd textbox_string +; dd 0x0 ; address of buffer for parameters (not used) + dd 0x0 ; reserved + +;--------------------------------------------------------------------- + +include "lang.inc" +include "macros.inc" ; standart macros & constants +include "meosfunc.inc" ; MenuetOS API functions names +include "debug.inc" ; printing to debug board +include "constant.inc" ; BIT?? constants +include "ac97.inc" ; AC'97 constants +include "pci.inc" ; PCI interface +include "codec.inc" ; functions for configuring codec +include "frontend.inc" ; main window + +;--------------------------------------------------------------------- + +; Uncomment these strings if you don't want to receive debug messages: + +; macro dps str {} ; dps prints a string without CRLF +; macro dpd num {} ; prints unsigned decimal number +; macro pregs {} ; outputs EAX, EBX, ECX, EDX +; macro newline {} ; CRLF +; macro print str {} ; output a string with CRLF +; macro dph arg {} ; print hex number + +;--------------------------------------------------------------------- + +;macro device id, addr { dd id, addr } +macro devices [id, str] +{ + common + label supported_devices dword + forward + local string + dd id + dd string + forward + string db str + db 0 +} + + +devices \ + (ICH_DID shl 16) + INTEL_VID, "ICH" ,\ + (ICH0_DID shl 16) + INTEL_VID, "ICH0" ,\ + (ICH2_DID shl 16) + INTEL_VID, "ICH2" ,\ + (ICH3_DID shl 16) + INTEL_VID, "ICH2" ,\ + (ICH4_DID shl 16) + INTEL_VID, "ICH4" ,\ + (ICH5_DID shl 16) + INTEL_VID, "ICH5" ,\ + (MX440_DID shl 16) + INTEL_VID, "440MX" ,\ + (SI7012_DID shl 16) + SIS_VID, "SI7012" ,\ + (NFORCE_DID shl 16) + NVIDIA_VID, "NForce" ,\ + (NFORCE2_DID shl 16) + NVIDIA_VID, "NForce2",\ + (AMD8111_DID shl 16) + AMD_VID, "AMD8111",\ + (AMD768_DID shl 16) + AMD_VID, "AMD768" +dd 0 + + +;--------------------------------------------------------------------- +;--- MAIN PROGRAM -------------------------------------------------- +;--------------------------------------------------------------------- + +START: + +; Print PCI version (for example, 2.16) +; mcall MF_PCI, 0 +; mov bl, al +; movzx eax, ah +; dps "PCI version: " +; dpd eax +; movzx eax, bl +; dpd eax +; newline + +; Check PCI access mechanism (must be 1 or 2) + mcall MF_PCI, 2 + dec al + cmp al, 1 + jna @f + print "Error: cannot access PCI bus." + jmp exit +; dps "PCI returned " +; movzx eax, al +; dpd eax +; newline + @@: + + +; Get last bus & then check all buses & devices + mcall MF_PCI, 1 + mov [lastbus], al + + ; looking for a compatible device + mov [bus], -1 + .next_bus: + inc [bus] + + mov al, [lastbus] + cmp al, [bus] + jb .device_not_found + + mov [devfn], 0 + .next_devfn: + + mov cl, 0 + call pciRegRead32 + + mov edi, supported_devices + @@: + mov ebx, [edi] + test ebx, ebx + jz @f + cmp eax, ebx + jnz .skip + add edi, 4 + mov [device_id], eax + mov edx, [edi] + call debug_outstr + jmp proceed + .skip: + add edi, 8 + jmp @b + @@: + + inc [devfn] + cmp [devfn], 255 + jb .next_devfn + + jmp .next_bus + + + .device_not_found: + print "Could not find Intel AC'97 compatible codec!" + print "1) Check if it's enabled in BIOS." + print "2) Check if your device is included in the device list." + jmp exit + + + proceed: + print " integrated AC97 audio codec detected." + mov eax, [device_id] + cmp eax, (ICH4_DID shl 16) + INTEL_VID + je .newich + cmp eax, (ICH5_DID shl 16) + INTEL_VID + jne .nonewich + .newich: + mov [AC97ICH4], 1 + .nonewich: + + cmp eax, (SI7012_DID shl 16) + SIS_VID + jne @f + mov [SI7012], 1 + @@: + +;--------------------------------------------------------------------- + +; Get NAMBAR register base port address & save it + mov cl, NAMBAR_REG + call pciRegRead16 + + and eax, 0xFFFE + mov [NAMBAR], ax + test eax, eax + jnz .mixer_base_ok + + print "Error: Intel ICH based AC97 audio codec disabled in BIOS!" + jmp exit + + .mixer_base_ok: + dps "NAMBAR: " + dph eax + +; Get NABMBAR & save it + mov cl, NABMBAR_REG + call pciRegRead16 + and eax, 0xFFC0 + mov [NABMBAR], ax + test eax, eax + jnz .bm_base_ok + + print "Error: Intel ICH based AC97 audio codec disabled in BIOS!" + jmp exit + + .bm_base_ok: + dps " NABMBAR: " + dph eax + newline + +;--------------------------------------------------------------------- + +; Get IRQ (not used) + mov cl, IRQ_REG + call pciRegRead8 + mov [AC97IRQ], al + +; Get Interrupt pin (not used) + mov cl, INT_REG + call pciRegRead8 + mov [AC97INT], al + +; AC97ICH4 should work then... + cmp [AC97ICH4], 1 + jne .skip_ich4_init + + mov cl, ICH4_CFG_REG ; 0x41 + call pciRegRead8 + or al, 0x1 + mov dl, al + call pciRegWrite8 + + mov cl, 0x54 + call pciRegRead16 + and eax, 0xFFFF + dps "Power Control & Status: " + dph eax + newline + .skip_ich4_init: + +;--------------------------------------------------------------------- + + mov cl, PCI_CMD_REG + call pciRegRead16 ; read PCI command register + mov dx, ax + or dx, IO_ENA+BM_ENA+BIT10 ; enable IO and bus master + disable + ; interrupts + call pciRegWrite16 + +;--------------------------------------------------------------------- + + print "Enabling access to ports..." + + movzx ecx, [NAMBAR] + mov edx, ecx + add edx, NAM_SIZE + mcall MF_PORTS, PRT_RESERVE + test eax, eax + jz @f + print "Error: couldn't enable access to ports" + jmp exit + @@: + + movzx ecx, [NABMBAR] + mov edx, ecx + add edx, NABM_SIZE + mcall MF_PORTS, PRT_RESERVE + test eax, eax + jz @f + print "Error: couldn't enable access to ports" + jmp exit + @@: + +;--------------------------------------------------------------------- + +; setup the Codec + mov eax, 48000 + call codecConfig ; unmute codec, set rates. + test eax, eax + jnz @f + print "Error: cannot initialize AC97 device." + jmp fpexit + @@: + + print "Congrutalations! Your device has been initialized properly!" + call print_info + +;--------------------------------------------------------------------- + +; register reset the DMA engine. + mov edx, PO_CR_REG ; PCM out control register + mov al, RR ; reset + call NABMBAR_write_byte + +;start fix for MM (1) + mcall MF_INTERNAL_SERVICES,ALLOC_PHYS_MEM,120*1024 + test eax,eax + jz no_phys_buffers ;not enough memory + mov [phys_wav_buffer1],eax + add eax,60*1024 + mov [phys_wav_buffer2],eax + mcall MF_INTERNAL_SERVICES,ALLOC_PHYS_MEM,32*8 + test eax,eax + jnz @f + mcall MF_INTERNAL_SERVICES,FREE_PHYS_MEM,[phys_wav_buffer1] + jmp no_phys_buffers +@@: + mov [phys_bdl_buffer],eax +;end fix for MM (1) + +; create Buffer Descriptors List + call prepare_BDL + +; open player's window + mcall MF_THREAD, THR_CREATE, thread, thread_stack + +; wait for command + .new_check: + cmp [status], ST_PLAY + jne @f + call play + @@: + cmp [status], ST_STOP + jne @f + call stop + @@: + cmp [status], ST_EXIT + je stopexit + + mcall MF_DELAY, 10 + jmp .new_check + +stopexit: + call stop + +fpexit: + +; free ports + movzx ecx, [NAMBAR] + mov edx, ecx + add edx, NAM_SIZE + mcall MF_PORTS, PRT_FREE + + movzx ecx, [NABMBAR] + mov edx, ecx + add edx, NABM_SIZE + mcall MF_PORTS, PRT_FREE + +;--------------------------------------------------------------------- +;start fix for MM (2) + mcall MF_INTERNAL_SERVICES,FREE_PHYS_MEM,[phys_bdl_buffer] + mcall MF_INTERNAL_SERVICES,FREE_PHYS_MEM,[phys_wav_buffer1] +;end fix for MM (2) +exit: + mcall MF_EXIT +no_phys_buffers: + print "allocation of physical buffers failed" + jmp exit + +;--------------------------------------------------------------------- +;--- FUNCTIONS ----------------------------------------------------- +;--------------------------------------------------------------------- + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; prepare_BDL - initializes BUFFER DESCRIPTORS LIST +prepare_BDL: + mov ecx, 32 / 2 ; make 32 entries in BDL + mov edi, BDL_BUFFER +; call get_my_address + mov ebx, 30*1024 + cmp [SI7012], 1 + jne @f + add ebx, ebx +@@: + ; set buf. desc. 0 to start of data file in memory + push eax +; add eax, WAV_BUFFER1 +;start fix for MM (6) + mov eax,[phys_wav_buffer1] +;end fix for MM (6) + stosd + ; set length to 60k samples. 1 sample is 16 bit or 2 bytes. + mov eax, ebx ;60*1024 ; number of samples + or eax, BUP + stosd + + mov eax, [esp] +; add eax, WAV_BUFFER2 +;start fix for MM (7) + mov eax,[phys_wav_buffer2] +;end fix for MM (7) + stosd + mov eax, ebx ;60*1024 + or eax, BUP + stosd + + pop eax + loop @b + + + ; tell the DMA engine where to find our list of Buffer Descriptors. + ; eax = base addr! +;start fix for MM (3) + ;copy to physical memory + mcall MF_INTERNAL_SERVICES,SET_PHYS_BUFFER,[phys_bdl_buffer],BDL_BUFFER,32*8 + ;physical address of bdl + mov eax,[phys_bdl_buffer] +;end fix for MM (3) + mov edx, PO_BDBAR_REG +; add eax, BDL_BUFFER + call NABMBAR_write_dword + +ret + + +;--------------------------------------------------------------------- + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; stop - stops current music +;; in: nothing +;; out: nothing +stop: +; print "STOP!" + push eax edx + + mcall MF_DELAY, 10 + mov edx, PO_CR_REG + mov al, 0 + call NABMBAR_write_byte + cmp [status], ST_STOP + jne .exit + mov [status], ST_DONE + .exit: + + pop edx eax +ret + +;--------------------------------------------------------------------- + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; play - plays wav file! +;; in: nothing +;; out: nothing (but sound :) !corrupts registers! +play: + ; at first, reset file + mov [fileinfo.first_block], 0 + mcall MF_SYSTREE, fileinfo ; load a block, returns error code in eax + ; and size of the file in ebx + test eax, eax ; 0 - successful + jz @f + print "AC97: File not found!" + mov [status], ST_STOP + jmp .exit + @@: + shr ebx, 9 ; size_of_file / 512 = number_of_blocks + mov [file_size], ebx + + + mov al, [LOAD_BUFFER+32] ; bytes per sample + dec al + jz @f + cmp al, 3 + je @f + sub al, [LOAD_BUFFER+22] ; channels + add al, 2 + @@: + mov [wav_mode], al + + pusha + movzx ebx,word [LOAD_BUFFER+24] + mov eax,48000 + xor edx,edx + div ebx + mov [difference_of_frequency],al +; dph eax + mov ecx,edx + imul eax,ecx,10 + xor edx,edx + div ebx + mov ecx,edx + imul ecx,10 + push eax + mov eax,ecx + xor edx,edx + div ebx +; dph eax + cmp eax,5 + jl .temp_15 + pop eax +; dph eax + + inc eax + jmp .temp_16 + .temp_15: + pop eax + .temp_16: + mov [difference_of_frequency_1],al +; dph eax + xor edx,edx + movzx ebx,[difference_of_frequency] + imul ebx,10 + add bl,[difference_of_frequency_1] + mov [difference_of_frequency_2],bl +; dph ebx + popa + + movzx eax, word [LOAD_BUFFER+24] + ;dps "Freq: " + ;dpd eax + ;newline + call set_sample_rate + + + ; change the last_valid_index to the (current_index-1) + ; the LVI register tells the DMA engine where to stop playing + call updateLVI + + ; if current index is odd, load buffer 1 then 0, jump to tuneLoop + ; if it is even, buffers 0 then 1; tuneLoop1 + call getCurrentIndex + and eax, BIT0 + + mov esi, eax + push eax + call update_next_buffer + pop eax + xor eax, 1 + call update_next_buffer + + ; start playing! + mov edx, PO_CR_REG + mov al, RPBM + call NABMBAR_write_byte + + jmp [jumpto+esi*4] + + + .tuneLoop: + ; wait while the current_index is even + @@: +; dps "a" + mcall MF_DELAY, 7 + call getCurrentIndex + test al, BIT0 + jz @b ; loop if not ready yet +; print "fa" + + call updateLVI + + mov eax, 0 + call update_next_buffer + test al, al + jnz .exit_wait + + cmp [status], ST_PLAY + jne .exit + + test [volume], 0x10000000 ; test volume_changed bit + je @f + mov al, byte [volume] + call setVolume + and [volume], 0x0FFFFFFF ; clear vloume_changed bit + @@: + + .tuneLoop1: + @@: +; dps "b" + mcall MF_DELAY, 7 + call getCurrentIndex + test al, BIT0 + jnz @b ; loop if not ready yet +; print "fb" + + cmp [status], ST_PLAY + jne .exit + + call updateLVI + + mov eax, 1 + call update_next_buffer + test al, al + jnz .exit_wait + + jmp .tuneLoop + .exit_wait: + mcall MF_DELAY, 30 ; a little pause - let the player finish + .exit: +ret +attempts db 0 + +buffers dd WAV_BUFFER1, WAV_BUFFER2 +jumpto dd play.tuneLoop, play.tuneLoop1 + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; update_first_buffer - load a chunk into the first buffer, increments offset +;; in: eax = number - 0 or 1 +;; out: error code, 0 - successful +update_next_buffer: + push esi edi + + movzx edx, byte [wav_mode] + mov ecx, [blocks + edx * 4] + mov [fileinfo.blocks], ecx + + mov esi, LOAD_BUFFER + mov edi, [buffers+eax*4] + push eax ;save buffer index + start_attempts: + mcall MF_SYSTREE, fileinfo + test eax, eax + jz @f + cmp [attempts],100 + je @f + inc [attempts] + jmp start_attempts + dpd eax + newline + dpd [fileinfo.first_block] + newline + @@: +; print " loaded!" + + push eax ebx edx + mov eax,ecx + xor edx,edx + imul eax,10 + movzx ebx,[difference_of_frequency_2] + + div ebx + mov ecx,eax + +; mov ebx,10 +; mov eax,edx +; xor edx,edx +; div ebx +; cmp edx,5 +; jb temp_12_7 +; inc ecx +; temp_12_7: + cmp edx,0 + je temp_12_7 + inc ecx + temp_12_7: + + pop edx ebx + mov eax,[esp+4] ;restore buffer index + add [fileinfo.first_block], ecx ; +60Kb + call [convert + edx * 4] +;start fix for MM (4) + mov eax,[esp+4] ;restore buffer index + test eax,not 1 + jz .ok + print "buffer index out of range" + dpd eax + jmp .ret + .ok: + push ebp + mov ebp,[phys_wav_buffer1+eax*4] + mov edi,[buffers+eax*4] + mcall MF_INTERNAL_SERVICES,SET_PHYS_BUFFER,ebp,edi,60*1024 + pop ebp +.ret: + pop eax + add esp,4 ;pop buffer index +;end fix for MM (4) + + pop edi esi +ret + +c8mono: + mov [type_of_conversion],1 + jmp for_all_type + +c8mono_1: + lodsb + call c8mono_2 + push ax + shl eax,16 + pop ax + push eax + mov al,[esi] + call c8mono_2 + push ax + shl eax,16 + pop ax + mov ebx,eax + pop eax + jmp for_all_type_1 + +c8mono_2: + sub al, 0x80 + cbw + imul ax, 255 + ret + +c8stereo: + mov [type_of_conversion],2 + jmp for_all_type + +c8stereo_1: + lodsb + call c8stereo_2 + shl eax,16 + lodsb + call c8stereo_2 + push eax + mov al,[esi] + call c8stereo_2 + shl eax,16 + mov al,[esi+1] + call c8stereo_2 + mov ebx,eax + pop eax + jmp for_all_type_1 + +c8stereo_2: + sub al, 0x80 + cbw + imul ax, 255 + ret + +c16mono: + mov [type_of_conversion],3 + jmp for_all_type + +c16mono_1: + lodsw + push ax + shl eax,16 + pop ax + mov bx,[esi] + shl ebx,16 + mov bx,[esi] + jmp for_all_type_1 + +c16stereo: + for_all_type: + xor edx,edx + mov eax, 15*1024*10 + movzx ebx,[difference_of_frequency_2] + xor edx,edx + div ebx + mov ecx,eax + +; mov ebx,10 +; mov eax,edx +; xor edx,edx +; div ebx +; cmp edx,5 +; jb temp_12_6 +; inc ecx +; temp_12_6: + cmp edx,0 + je temp_12_6 + inc ecx + temp_12_6: + + c16stereo_1: + mov [znak],0 + + cmp [type_of_conversion],1 + je c8mono_1 + cmp [type_of_conversion],2 + je c8stereo_1 + cmp [type_of_conversion],3 + je c16mono_1 + lodsd + + mov ebx,[esi] +for_all_type_1: + cmp eax,ebx + jne c16stereo_2 + inc [znak] + c16stereo_2: + push eax + push ecx + sub eax,ebx + push eax + shl eax,16 + movzx ebx,[difference_of_frequency] + inc ebx + xor edx,edx + div ebx + shr eax,16 + mov ecx,eax + pop eax + xor ax,ax + xor edx,edx + div ebx + shl eax,16 + mov cx,ax + mov ebx,ecx + pop ecx + pop eax + mov dl,[difference_of_frequency] + inc dl + @@: +temp_12: + cmp [difference_of_frequency_1],0 + je temp_12_3 + cmp [difference_of_frequency_1],5 + jne temp_12_4 + cmp [difference_of_frequency_4],2 + jne temp_12_3 + jmp temp_12_5 + temp_12_4: + cmp [difference_of_frequency_4],10 + jne temp_12_3 + + temp_12_5: + + cmp [znak],0 + jne temp_12_5_1 + sub eax,ebx + jmp temp_12_5_2 + temp_12_5_1: + add eax,ebx + temp_12_5_2: + + + stosd + inc [schetchik] + mov [difference_of_frequency_4],0 + temp_12_3: + cmp [znak],0 + jne temp_13 + sub eax,ebx + jmp temp_14 + temp_13: + add eax,ebx + + temp_14: + cld + dec dl + jz temp_14_1 + stosd + inc [schetchik] + inc [difference_of_frequency_4] + jmp temp_12 + temp_14_1: + dec ecx + cmp ecx,0 +; jnz c16stereo_1 + jg c16stereo_1 + newline + dph [schetchik] + temp_14_2: + cmp [schetchik],15360 + jge temp_14_3 + stosd + inc [schetchik] + jmp temp_14_2 + + temp_14_3: + newline + dph [schetchik] + cmp [schetchik],15360 + je temp_14_4 +; mov [edi-4],dword 0 + sub edi,4 +; sub esi,4 + temp_14_4: + mov [schetchik],0 + ret + + +difference_of_frequency db 0 +difference_of_frequency_1 db 0 +difference_of_frequency_2 db 0 +difference_of_frequency_4 db 0 +schetchik dd 0 +znak db 0 +type_of_conversion db 0 + +convert dd c8mono, c8stereo, c16mono, c16stereo +blocks dd 30, 60, 60, 120 + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; get_my_address - get base address of the program in physical memory +;; in: nothing +;; out: eax = address +;start fix for MM (8) +;function shouldn't used. +;get_my_address: +; pushad +; mcall MF_PROCINFO, procinfo, PN_MYSELF +; popad +; mov eax, [procinfo.memory_start] +;ret +;end fix for MM (8) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; set the last valid index to something other than we're currently playing +;; so that we never end +;; +;; this routine just sets the last valid index to 1 less than the index +;; that we're currently playing, thus keeping it in and endless loop +;; input: none +;; output: none +updateLVI: + push eax + call getCurrentIndex + ; dps "index " + ; dpd eax + ; newline + dec al + and al, INDEX_MASK + call setLastValidIndex + pop eax +ret + +;--------------------------------------------------------------------- + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; returns AL = current index value +getCurrentIndex: + push edx + mov edx, PO_CIV_REG + call NABMBAR_read_byte + pop edx +ret + +;--------------------------------------------------------------------- + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; input AL = index # to stop on +setLastValidIndex: + push edx + mov edx, PO_LVI_REG + call NABMBAR_write_byte + pop edx +ret + +;--------------------------------------------------------------------- + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; print_info - outputs debug information +;; in: nothing +;; out: nothing +print_info: + dps "BUS: " + movzx eax, [bus] + dph eax + + dps " DEVFN: " + movzx eax, [devfn] + dph eax + + dps " IRQ: " + movzx eax, [AC97IRQ] + dpd eax + newline + + + dps "CODEC_POWER_CTRL: " + mov edx, CODEC_POWER_CTRL_REG + call NAMBAR_read_word + dph eax + dps " (bits 0-3 should be set)" + newline + + mov edx, 0x28 + call NAMBAR_read_word + dph eax + dps " - supported features" + newline + mov edx, 0x2A + call NAMBAR_read_word + dph eax + dps " - config" + newline + mov edx, 0x2C + call NAMBAR_read_word + dph eax + dps " - PCM rate" + + newline +ret + + +;--------------------------------------------------------------------- +;--- DATA OF PROGRAM ----------------------------------------------- +;--------------------------------------------------------------------- +volume dd 15 + +fileinfo: + .mode dd 0 ; READ + .first_block dd 0 + .blocks dd 120 ; 120 Kb + .dest dd LOAD_BUFFER ;file_data + .work dd work_area + ; db "/HD/1/WINDOWS/MEDIA/WICEB7~1.WAV",0 +;sz textbox_string, "/hd/1/testmuz/menuet11.wav",0 +sz textbox_string, " ",0 +; rb 256 +;--------------------------------------------------------------------- + +IMAGE_END: ; end of program's image + rb 100-textbox_string.size +; textbox_string.size + +;--------------------------------------------------------------------- + +device_id dd ? ; (device_id << 16) + vendor_id +lastbus db ? ; pci coordinates +bus db ? +devfn db ? + +AC97ICH4 db ? ; Intel ICH4 codec flag +SI7012 db ? ; SiS SI7012 codec flag +NAMBAR dw ? ; Audio Mixers Registers (base) +NABMBAR dw ? ; Bus Master Registers (base) + +AC97IRQ db ? ; Interrupt request +AC97INT db ? ; Interrupt pin + +wav_mode db ? ; bits per sample & channels + +;--------------------------------------------------------------------- + +ST_DONE = 0x0 ; for interacting with player's window +ST_PLAY = 0x1 +ST_EXIT = 0x2 +ST_STOP = 0x4 + +status db ? + +;--------------------------------------------------------------------- +phys_bdl_buffer rd 1 +phys_wav_buffer1 rd 1 +phys_wav_buffer2 rd 1 +align 32 + + +; Buffer Descriptors List +; ___________________________ +; | physical address | dword +; |_________________________| +; | attr | length | dword max. length = 65535 samples +; |_________________________| + +BDL_BUFFER: + rb 32*8 ; 32 descriptors, 8 bytes each + + +;--------------------------------------------------------------------- + +file_data: + +WAV_BUFFER1: + rb 60 * 1024 ; 60 Kb + +WAV_BUFFER2: + rb 60 * 1024 + +LOAD_BUFFER: + rb 60 * 1024 + +;--------------------------------------------------------------------- + +procinfo process_information + +work_area: + rb 0x10000 + +;--------------------------------------------------------------------- + +rb 0x800 +thread_stack: + +rb 0x1000 ; for stack +STACK_P: + +MEMORY_END: diff --git a/programs/ac97wav/trunk/build_en.bat b/programs/ac97wav/trunk/build_en.bat new file mode 100644 index 0000000000..6f10d56325 --- /dev/null +++ b/programs/ac97wav/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm ac97wav.asm ac97wav +@pause \ No newline at end of file diff --git a/programs/ac97wav/trunk/build_ru.bat b/programs/ac97wav/trunk/build_ru.bat new file mode 100644 index 0000000000..affa5a1e1c --- /dev/null +++ b/programs/ac97wav/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm ac97wav.asm ac97wav +@pause \ No newline at end of file diff --git a/programs/ac97wav/trunk/codec.inc b/programs/ac97wav/trunk/codec.inc new file mode 100644 index 0000000000..5a8d99d7a6 --- /dev/null +++ b/programs/ac97wav/trunk/codec.inc @@ -0,0 +1,344 @@ + +NAMBAR_read_byte: + add dx, [NAMBAR] + in al, dx +ret + + +NAMBAR_read_word: + add dx, [NAMBAR] + in ax, dx +ret + + +NAMBAR_read_dword: + add dx, [NAMBAR] + in eax, dx +ret + +NAMBAR_write_byte: + add dx, [NAMBAR] + out dx, al +ret + +NAMBAR_write_word: + add dx, [NAMBAR] + out dx, ax +ret + +NAMBAR_write_dword: + add dx, [NAMBAR] + out dx, eax +ret + + + +NABMBAR_read_byte: + add dx, [NABMBAR] + in al, dx +ret + +NABMBAR_read_word: + add dx, [NABMBAR] + in ax, dx +ret + +NABMBAR_read_dword: + add dx, [NABMBAR] + in eax, dx +ret + +NABMBAR_write_byte: + add dx, [NABMBAR] + out dx, al +ret + +NABMBAR_write_word: + add dx, [NABMBAR] + out dx, ax +ret + +NABMBAR_write_dword: + add dx, [NABMBAR] + out dx, eax +ret + + + +semaphore: + push ecx edx + + mov edx, GLOB_STS_REG ; 0x30 global status register + call NABMBAR_read_dword + and eax, PRI_CODEC_RDY ; 100h primary codec ready + jz .success ; exit if codec not ready !!! + +; mov ecx, 1024 ; try 1024 times + mov ecx, 0ffffh ; try 65535 times + .wait: + mov edx, ACC_SEMA_REG ; 0x34 codec write semaphore + call NABMBAR_read_byte + and al, CODEC_BUSY ; 01h codec access semaphore + jz .success ; exit if codec not busy !!! + + dec ecx + jnz .wait + + pop edx ecx + mov eax, 0 + jmp .exit + + .success: + pop edx ecx + mov eax, 1 + .exit: +ret + + + + + +codecStop: + push eax ebx edx + + mov edx, PO_CR_REG ; 0x1B control register + mov al, 0 ; stop all PCM out data + call NABMBAR_write_byte + + mcall MF_DELAY, eax ; ebx = (eax = MF_DELAY = 5); wait 50 ms + + mov edx, PO_CR_REG ; 0x1B control register + mov al, RR ; reset PCM out regs + call NABMBAR_write_byte + + mcall MF_DELAY, eax + + pop edx ebx eax +ret + + + + +; set voulme +; in ax = volume level +setVolume: + push eax edx + + push eax + call semaphore + mov edx, CODEC_RESET_REG ; 0 + xor eax, eax ; register reset the codec + call NAMBAR_write_word + + call semaphore + pop eax + imul ax, 0101h ; set volume for both chn + mov edx, CODEC_MASTER_VOL_REG ; 2 + call NAMBAR_write_word + push eax + + call semaphore + pop eax ; set volume for both chn + mov edx, CODEC_HP_VOL_REG ; 4 + call NAMBAR_write_word + push eax + + call semaphore + mov edx, CODEC_CD_VOL_REG ; 12h + pop eax ; set volume for both chn + shr eax, 2 ; adjust CD VOL + call NAMBAR_write_word + + call semaphore + mov edx, CODEC_PCM_OUT_REG ; 18h + mov ax, 0808h ; standard PCM out volume + call NAMBAR_write_word + + pop edx eax +ret + + + + +samplerate dw 0 + + + +; enable codec, unmute stuff, set output to desired rate +; in : ax = desired sample rate +; out: ax = true or false +; +codecConfig: + pushad + mov [samplerate], ax ; save sample rate + + +; mov edx, GLOB_STS_REG ; 30h global status register +; call NABMBAR_read_dword +; and eax, PRI_CODEC_RDY ; 0100h primary codec ready +; jnz skip_init ; skip init if codec ready !!! + + ; stop the codec if currently playing +;;; call codecStop + +; mov edx, GLOB_STS_REG +; call NABMBAR_read_dword +; dps "GLOB_STA = " +; dph eax +; newline + +; mov edx, GLOB_CNT_REG +; call NABMBAR_read_dword +; dps "GLOB_CNT = " +; dph eax +; newline + +; mcall 5, 10 + +;; test eax, ACCOLD_RESET +;; jnz .skip_cold_reset + +; print "cold reset" + ; do a cold reset + mov edx, GLOB_CNT_REG ; 2ch global control register + xor eax, eax + call NABMBAR_write_dword ; enable (AC Link off clear) + +; print "wait" + mcall 5, 5 +; print "alive!" + +;; .skip_cold_reset: + + mov edx, GLOB_CNT_REG ; 2ch global control register + mov eax, ACCOLD_RESET + PRI_RES_EN ; cold reset + primary resume + call NABMBAR_write_dword ; 2 channels & 16 bit samples + + mov edx, GLOB_CNT_REG ; 2ch global control register + call NABMBAR_read_dword + and eax, ACCOLD_RESET ; cold reset + jz init_error ; INIT FAILED !!! + +; print "cold reset finished" + + ; wait for primary codec ready status + mov ecx, 128 +codec_ready_loop: + mov edx, GLOB_STS_REG ; 30h global status register + call NABMBAR_read_dword + and eax, PRI_CODEC_RDY ; 0100h primary codec ready + jnz codec_ready_exit ; move on if codec ready !!! + mcall 5, 1 + dec ecx + jnz codec_ready_loop + ;dps "~" +codec_ready_exit: + + ; wait until codec init ready (*** replaces warm reset wait ***) + mcall 5, 60 + + ; test if codec ready bit is finally set + mov edx, GLOB_STS_REG ; 30h global status register + call NABMBAR_read_dword + and eax, PRI_CODEC_RDY ; 0100h primary codec ready + jnz codec_ready_bit_set ; move on if codec ready !!! + cmp [AC97ICH4], 1 + jne init_error +; je codec_ready_bit_set ; ignore codec ready for ICH4 +; jmp init_error ; codec ready bit not set !!! +codec_ready_bit_set: + + ; clear semaphore flag + mov edx, CODEC_RESET_REG ; 0h codec reset register + call NAMBAR_read_word + + + ; check if codec sections ready + call semaphore + test eax, eax + jz init_error + mov edx, CODEC_POWER_CTRL_REG ; 26h codec powerdown ctrl + call NAMBAR_read_word + and eax, 01111b + cmp eax, 01111b + jne init_error ; codec sections not ready + + + + ; disable interrupts + mov al, 0 + + mov edx, PI_CR_REG ; 0Bh PCM in control register + call NABMBAR_write_byte + + mov edx, PO_CR_REG ; 1Bh PCM out control register + call NABMBAR_write_byte + + mov edx, MC_CR_REG ; 2Bh MIC in control register + call NABMBAR_write_byte + + ; reset channels + mov al, RR ; 02h reset Bus master regs + + mov edx, PI_CR_REG ; 0Bh PCM in control register + call NABMBAR_write_byte + + mov edx, PO_CR_REG ; 1Bh PCM out control register + call NABMBAR_write_byte + + mov edx, MC_CR_REG ; 2Bh MIC in control register + call NABMBAR_write_byte + + ; set default volume + mov eax, 15 ; set average volume level + call setVolume + + ; set VRA and clear DRA (if not supported will be skipped) + call semaphore + test eax, eax + jz init_error + mov edx, CODEC_EXT_AUDIO_CTRL_REG ; register 2ah + call NAMBAR_read_word ; get ext audio ctl + + mov ebx, eax + call semaphore + test eax, eax + jz init_error + mov eax, ebx + and eax, 0FFFFh - BIT1 ; clear DRA (BIT1) + or eax, BIT0 ; set VRA (BIT0) + mov edx, CODEC_EXT_AUDIO_CTRL_REG ; register 2ah + call NAMBAR_write_word ; write ext audio ctl + + ; set desired sample rate +skip_init: + call semaphore + test eax, eax + jz init_error + + ; mov edx, CODEC_PCM_FRONT_DACRATE_REG + ; call NAMBAR_read_word + ; and eax, 0xFFFF + ; newline + ; dps "old PCM OUT RATE: " + ; dpd eax + ; newline + + mov ax, [samplerate] ; restore sample rate +; mov edx, CODEC_PCM_FRONT_DACRATE_REG ; register 2ch +; call NAMBAR_write_word + call set_sample_rate + + popad + mov eax, 1 ; exit with success + jmp exit_config +init_error: + popad + xor eax, eax ; exit with error +exit_config: + ret + +set_sample_rate: ; rate in ax + mov edx, CODEC_PCM_FRONT_DACRATE_REG ; 0x2C reg + call NAMBAR_write_word +ret diff --git a/programs/ac97wav/trunk/constant.inc b/programs/ac97wav/trunk/constant.inc new file mode 100644 index 0000000000..bc3e3a4e9f --- /dev/null +++ b/programs/ac97wav/trunk/constant.inc @@ -0,0 +1,35 @@ +;constants of stuff that seem hard to remember at times. + +BIT0 EQU 1 +BIT1 EQU 2 +BIT2 EQU 4 +BIT3 EQU 8 +BIT4 EQU 10h +BIT5 EQU 20h +BIT6 EQU 40h +BIT7 EQU 80h +BIT8 EQU 100h +BIT9 EQU 200h +BIT10 EQU 400h +BIT11 EQU 800h +BIT12 EQU 1000h +BIT13 EQU 2000h +BIT14 EQU 4000h +BIT15 EQU 8000h +BIT16 EQU 10000h +BIT17 EQU 20000h +BIT18 EQU 40000h +BIT19 EQU 80000h +BIT20 EQU 100000h +BIT21 EQU 200000h +BIT22 EQU 400000h +BIT23 EQU 800000h +BIT24 EQU 1000000h +BIT25 EQU 2000000h +BIT26 EQU 4000000h +BIT27 EQU 8000000h +BIT28 EQU 10000000h +BIT29 EQU 20000000h +BIT30 EQU 40000000h +BIT31 EQU 80000000h + diff --git a/programs/ac97wav/trunk/debug.inc b/programs/ac97wav/trunk/debug.inc new file mode 100644 index 0000000000..45ae9f90c6 --- /dev/null +++ b/programs/ac97wav/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' \ No newline at end of file diff --git a/programs/ac97wav/trunk/frontend.inc b/programs/ac97wav/trunk/frontend.inc new file mode 100644 index 0000000000..a9a7348502 --- /dev/null +++ b/programs/ac97wav/trunk/frontend.inc @@ -0,0 +1,270 @@ +thread: + call draw_window + call main_loop + mov [status], ST_EXIT + mcall MF_EXIT + +;--------------------------------------------------------------------- + +main_loop: + cmp [status], ST_PLAY + je @f + mcall MF_WAIT_EVENT + jmp .handle_event + @@: + call draw_progress_bar + mcall MF_WAIT_EVENT_TIMEOUT, 80 + .handle_event: + cmp eax, EV_REDRAW + je redraw + cmp eax, EV_BUTTON + je button + cmp eax, EV_KEY + je key + jmp main_loop + + redraw: + call draw_window + jmp main_loop + + key: + mcall MF_GETKEY + cmp [textbox_active], 1 + jne main_loop + cmp ah, 13 + je .enter + cmp ah, 8 + je .backspace + movzx ecx, [textbox_position] + cmp ecx, 47 + jae .enter + mov [textbox_string + ecx], ah + inc [textbox_position] + call textbox_draw + jmp main_loop + .enter: + mov [textbox_active], 0 + call textbox_draw + jmp main_loop + .backspace: + movzx ecx, [textbox_position] + test ecx, ecx + jz main_loop + mov [textbox_string + ecx], byte 0 + dec [textbox_position] + call textbox_draw + jmp main_loop + + button: + mcall MF_GETBUTTON + cmp ah, 0x10 + je play_button + cmp ah, 0x11 + je stop_button + cmp ah, 0x12 + je decr_button + cmp ah, 0x13 + je incr_button + cmp ah, 0x14 + je volm_button + cmp ah, 0x15 + je volp_button + cmp ah, 0x20 + je activate_textbox + cmp ah, 0x30 + je progressbar_click + cmp ah, 1 + jne main_loop + +; mov [status], ST_STOP +; mcall MF_DELAY, 40 + ret + + play_button: + xor eax, eax + xchg al, [textbox_active] + cmp al, 0 + je @f + call textbox_draw + @@: + mov [status], ST_PLAY + jmp main_loop + stop_button: + mov [status], ST_STOP + jmp main_loop + + decr_button: +; mov [status], ST_STOP +; @@: +; mcall 5, 1 +; cmp [status], ST_DONE +; jne @b +; movzx esi, [textbox_position] +; add esi, textbox_string +; @@: +; cmp byte [esi], '/' +; je @f +; dec esi +; jmp @b +; @@: +; mov byte [esi+1], 0 +; mov [fileinfo.first_block], 0 +; mov [fileinfo.dest], WAV_BUFFER1 +; mcall 58, fileinfo +; add ebx, WAV_BUFFER1 +; mov esi, WAV_BUFFER1+8 +; .next_file: +; cmp ebx, esi +; jbe .fin +; cmp word [esi], "WA" +; jne .next_file +; cmp byte [esi+1], "V" +; jne .next_file +; .fin: + + ;mov eax, [fileinfo.first_block] + ;cmp eax, 1000 + ;jnl @f + ;mov [fileinfo.first_block], 0 + ;jmp main_loop + ;@@: + ;sub [fileinfo.first_block], 1000 + ;jmp main_loop + + incr_button: + ;add [fileinfo.first_block], 1000 + jmp main_loop + + volm_button: + inc byte [volume] + and byte [volume], 0x1f + jz volp_button + or [volume], 0x10000000 + jmp _print_volume +; jmp main_loop + + volp_button: + dec byte [volume] + and byte [volume], 0x1f + jz volm_button + or [volume], 0x10000000 +; jmp main_loop + + _print_volume: + movzx eax, byte [volume] + neg eax + add eax, 31 + dps "Volume: " + dpd eax + newline + jmp main_loop + + activate_textbox: + cmp [status], ST_DONE + jne main_loop + mov [textbox_active], 1 + call textbox_draw + jmp main_loop + + progressbar_click: + ;print "click on progress bar" + cmp [status], ST_DONE + je main_loop + mcall MF_GETMOUSE, MS_COORDS_WINDOW + shr eax, 16 ; get mouse.x + sub eax, 7 + test eax, eax + jz @f + imul eax, [file_size] + mov ebx, 286 + cdq + div ebx + @@: + ;dps "block: " + ;dpd eax + ;newline + mov [fileinfo.first_block], eax + call draw_progress_bar + jmp main_loop +ret + +;--------------------------------------------------------------------- + +PBAR_WIDTH = 286 + +draw_window: + mcall MF_DRAWSTATUS, DS_BEGIN + + mcall MF_WINDOW, <100,299>, <100,72>, 0x03404040 + + ; create six buttons + mov edi, 6 + mpack ebx, 7, 45 + mpack ecx, 24, 13 + mov edx, 0x10 + mov esi, 0xA0A0A0 + @@: + mcall MF_BUTTON + add ebx, 48 shl 16 + inc edx + dec edi + jnz @b + + mcall MF_TEXT, <8,8>, 0x10FFFFFF, header, header.size + + mcall ,<13,28>, 0x404040, buttons_text, buttons_text.size + sub ebx, 0x00010001 + mov ecx, 0xFFFFFF + mcall + + call draw_progress_bar + call textbox_draw + + mcall MF_DRAWSTATUS, DS_END +ret + +;--------------------------------------------------------------------- + +textbox_draw: + mcall MF_BUTTON, <7,285>, <55,10>, 0x60000020 + + mov edx, 0x808080 + cmp [textbox_active], 1 + jne @f + mov edx, 0xA0A0A0 + @@: + mcall MF_BAR, <7,286>, <55,11> + + movzx esi, [textbox_position] + mcall MF_TEXT, <10,56>, 0x404040, textbox_string +ret + +;--------------------------------------------------------------------- + +draw_progress_bar: + pushad + + imul eax, [fileinfo.first_block], PBAR_WIDTH + cdq + div [file_size] + + push eax + mcall MF_BAR, <7,286>, <41,11>, 0x808080 + mcall MF_BUTTON, , , 0x60000030 + pop eax + + mov bx, ax + mov edx, 0xA0A0A0 + mcall MF_BAR + + popad +ret + +;--------------------------------------------------------------------- + +sz header, "AC'97 WAV player - all PCM audio" +sz buttons_text, " Play Stop << >> Vol- Vol+" + +textbox_active db 0 +textbox_position db textbox_string.size-1 +file_size dd 100 diff --git a/programs/ac97wav/trunk/includes.inc b/programs/ac97wav/trunk/includes.inc new file mode 100644 index 0000000000..d39bca5d72 --- /dev/null +++ b/programs/ac97wav/trunk/includes.inc @@ -0,0 +1,10 @@ +include "MACROS.INC" +include "DEBUG.INC" +include "CONSTANT.INC" +include "AC97.INC" +include "PCI.INC" +include "CODEC.INC" +include "FRONTEND.INC" + + +MF_PCI = 62 diff --git a/programs/ac97wav/trunk/macros.inc b/programs/ac97wav/trunk/macros.inc new file mode 100644 index 0000000000..1d153e8723 --- /dev/null +++ b/programs/ac97wav/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 + +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 \ No newline at end of file diff --git a/programs/ac97wav/trunk/meosfunc.inc b/programs/ac97wav/trunk/meosfunc.inc new file mode 100644 index 0000000000..d503176d0f --- /dev/null +++ b/programs/ac97wav/trunk/meosfunc.inc @@ -0,0 +1,29 @@ +MF_WINDOW = 0 +MF_GETKEY = 2 +MF_TEXT = 4 +MF_DELAY = 5 +MF_BUTTON = 8 +MF_PROCINFO = 9 + PN_MYSELF = -1 +MF_WAIT_EVENT = 10 +MF_DRAWSTATUS = 12 + DS_BEGIN = 1 + DS_END = 2 +MF_BAR = 13 +MF_GETBUTTON = 17 +MF_WAIT_EVENT_TIMEOUT = 23 +MF_GETMOUSE = 37 + MS_COORDS_WINDOW = 1 +MF_PORTS = 46 + PRT_RESERVE = 0 + PRT_FREE = 1 +MF_THREAD = 51 + THR_CREATE = 1 +MF_SYSTREE = 58 +MF_PCI = 62 +MF_EXIT = -1 +MF_INTERNAL_SERVICES = 68 + ALLOC_PHYS_MEM =5 + FREE_PHYS_MEM =6 + SET_PHYS_BUFFER =7 + GET_PHYS_BUFFER =8 \ No newline at end of file diff --git a/programs/ac97wav/trunk/pci.inc b/programs/ac97wav/trunk/pci.inc new file mode 100644 index 0000000000..220d6326f7 --- /dev/null +++ b/programs/ac97wav/trunk/pci.inc @@ -0,0 +1,46 @@ +PCI_CMD_REG = 04h ; reg 04, command reg + IO_ENA = 0x00000001 ; i/o decode enable + MEM_ENA = 0x00000002 ; memory decode enable + BM_ENA = 0x00000004 ; bus master enable + +pciRegRead8: ; register in CL! + mov bl, 4 + mov bh, [bus] + mov ch, [devfn] + mcall MF_PCI +ret + +pciRegRead16: + mov bl, 5 + mov bh, [bus] + mov ch, [devfn] + mcall MF_PCI +ret + +pciRegRead32: + mov bl, 6 + mov bh, [bus] + mov ch, [devfn] + mcall MF_PCI +ret + +pciRegWrite8: ; value in DL! + mov bl, 8 + mov bh, [bus] + mov ch, [devfn] + mcall MF_PCI +ret + +pciRegWrite16: + mov bl, 9 + mov bh, [bus] + mov ch, [devfn] + mcall MF_PCI +ret + +pciRegWrite32: + mov bl, 10 + mov bh, [bus] + mov ch, [devfn] + mcall MF_PCI +ret \ No newline at end of file diff --git a/programs/aclock/trunk/Readme.txt b/programs/aclock/trunk/Readme.txt new file mode 100644 index 0000000000..92d6c48877 --- /dev/null +++ b/programs/aclock/trunk/Readme.txt @@ -0,0 +1,85 @@ +AClock 1.1 +Copyright (c) 2002,2003 Thomas Mathys +killer@vantage.ch + + +what the hell is this ? +----------------------- + +this is aclock, a silly analog clock application +for menuetos (http://www.menuetos.org). + + +why do i need it ? +------------------ + +well, this is certainly one of the last programs on +earth you'd ever need. anyway, it demonstrates how +how to do certain things: + +- writing menuet apps that parse the command line. + includes a strtok-like function that you might + want to use in own projects. or maybe rather not. +- writing menuet apps that are aware of the current + window size and that have no problems with different + skin heights. +- how to write menuet apps with nasm instead of fasm + (there should be a gas version aswell, don't you think ?) + and how to write kick-ass code with nasm in general =) + + +compiling instructions +---------------------- + +yes, it's still written for nasm. +i really can't be bothered to work with fasm. + +oh yes, you wanted to know how to compile aclock: + + nasm -t -f bin -o aclock aclock.asm + +if you get error messages like + + nasm: unrecognised option `-t + type `nasm -h' for help + +then you've got an old version of nasm. +get a newer version (0.98.36 or later) from +http://nasm.sourceforge.net + + +configuration +------------- + +you might want to change some of the constants defined +somewhere at the top of aclock.asm. the following might +be useful: + + - DEFAULT_XPOS + - DEFAULT_YPOS + - DEFAULT_WIDTH + - DEFAULT_HEIGHT + - MIN_WIDTH + - MIN_HEIGHT + +for more info about DEFAULT_XPOS/DEFAULT_YPOS see next +section. + + +usage +----- + +this version of AClock introduces command line parameters. +here's an example command line: + + aclock w128 h128 x20 y-20 + +this creates a window that is 128 pixels wide and 128 pixels +high (that's for the work area, without border/title bar). +the window is placed at x=20, y=screen resolution-20 +(because of the minus sign after the y). + +all parameters are optional and may appear in any order. +you can't have any whitespaces in a parameter, e.g. +"w 128" is an invalid parameter (which will simply be ignored). +the command line parser is case sensitive. diff --git a/programs/aclock/trunk/aclock.asm b/programs/aclock/trunk/aclock.asm new file mode 100644 index 0000000000..bde2679943 --- /dev/null +++ b/programs/aclock/trunk/aclock.asm @@ -0,0 +1,223 @@ +; aclock 1.1 +; Copyright (c) 2002 Thomas Mathys +; killer@vantage.ch +; +; 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. +; +; You should have received a copy of the GNU General Public License +; along with this program; if not, write to the Free Software +; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + bits 32 + %include 'mos.inc' + section .text + + +;******************************************************************** +; configuration stuff +;******************************************************************** + + %define APPNAME "AClock 1.1" + %define STACKSIZE 1024 + + ; default window position/dimensions (work area) + %define DEFAULT_XPOS -20 + %define DEFAULT_YPOS 20 + %define DEFAULT_WIDTH 80 + %define DEFAULT_HEIGHT 80 + + ; minimal size (horizontal and vertical) of work area + %define MIN_WIDTH 80 + %define MIN_HEIGHT 80 + + +;******************************************************************** +; header +;******************************************************************** + + MOS_HEADER01 main,image_end,memory_end,stacktop-4,cmdLine,0 + + ; these includes introduce code and thus mustn't stand + ; before the menuet header =) + %include 'dbgboard.inc' + %include 'strlen.inc' + %include 'str2dwrd.inc' + %include 'strtok.inc' + %include 'cmdline.inc' + %include 'adjstwnd.inc' + %include 'draw.inc' + +;******************************************************************** +; main program +;******************************************************************** +main: + call getDefaultWindowColors + call parseCommandLine + + ; check minimal window dimensions + cmp dword [wndWidth],MIN_WIDTH + jae .widthok + mov dword [wndWidth],MIN_WIDTH +.widthok: + cmp dword [wndHeight],MIN_HEIGHT + jae .heightok + mov dword [wndHeight],MIN_HEIGHT +.heightok: + + ; adjust window dimensions + mov eax,ADJSTWND_TYPE_SKINNED + mov ebx,[wndXPos] + mov ecx,[wndYPos] + mov edx,[wndWidth] + mov esi,[wndHeight] + call adjustWindowDimensions + mov [wndXPos],ebx + mov [wndYPos],ecx + mov [wndWidth],edx + mov [wndHeight],esi + + call drawWindow +.msgpump: + call drawClock + + ; wait up to a second for next event + mov eax,MOS_SC_WAITEVENTTIMEOUT + mov ebx,100 + int 0x40 + + cmp eax,MOS_EVT_REDRAW + je .redraw + cmp eax,MOS_EVT_KEY + je .key + cmp eax,MOS_EVT_BUTTON + je .button + jmp .msgpump + +.redraw: + call drawWindow + jmp .msgpump +.key: + mov eax,MOS_SC_GETKEY + int 0x40 + jmp .msgpump +.button: + mov eax,MOS_SC_EXIT + int 0x40 + jmp .msgpump + + +;******************************************************************** +; get default window colors +; input : nothing +; output : wndColors contains default colors +; destroys : nothing +;******************************************************************** +getDefaultWindowColors: + pushad + pushfd + mov eax,MOS_SC_WINDOWPROPERTIES + mov ebx,3 + mov ecx,wndColors + mov edx,MOS_WNDCOLORS_size + int 0x40 + popfd + popad + ret + + +;******************************************************************** +; define and draw window +; input nothing +; output nothing +; destroys flags +;******************************************************************** + align 4 +drawWindow: + pusha + + ; start window redraw + mov eax,MOS_SC_REDRAWSTATUS + mov ebx,1 + int 0x40 + + ; create window + mov eax,MOS_SC_DEFINEWINDOW + mov ebx,[wndXPos] + shl ebx,16 + or ebx,[wndWidth] + mov ecx,[wndYPos] + shl ecx,16 + or ecx,[wndHeight] + mov edx,[wndColors+MOS_WNDCOLORS.work] + or edx,0x03000000 + mov esi,[wndColors+MOS_WNDCOLORS.grab] + mov edi,[wndColors+MOS_WNDCOLORS.frame] + int 0x40 + + ; draw window label + mov eax,MOS_SC_WRITETEXT + mov ebx,MOS_DWORD(8,8) + mov ecx,[wndColors+MOS_WNDCOLORS.grabText] + mov edx,label + mov esi,LABEL_LEN + int 0x40 + + call drawClock + + ; end window redraw + mov eax,MOS_SC_REDRAWSTATUS + mov ebx,2 + int 0x40 + popa + ret + + +;******************************************************************** +; initialized data +;******************************************************************** + + ; window position and dimensions. + ; dimensions are for work area only. +wndXPos dd DEFAULT_XPOS +wndYPos dd DEFAULT_YPOS +wndWidth dd DEFAULT_WIDTH +wndHeight dd DEFAULT_HEIGHT + + ; window label +label db APPNAME,0 +LABEL_LEN equ ($-label-1) + + ; token delimiter list for command line +delimiters db 9,10,11,12,13,32,0 + + ; don't insert anything after this label +image_end: + + +;******************************************************************** +; uninitialized data +;******************************************************************** + section .bss + +wndColors resb MOS_WNDCOLORS_size +procInfo resb MOS_PROCESSINFO_size + + ; space for command line. at the end we have an additional + ; byte for a terminating zero, just to be sure... +cmdLine resb 257 + + alignb 4 +stack resb STACKSIZE +stacktop: + + ; don't insert anything after this label +memory_end: + diff --git a/programs/aclock/trunk/aclock.bmp b/programs/aclock/trunk/aclock.bmp new file mode 100644 index 0000000000..fe8c413400 Binary files /dev/null and b/programs/aclock/trunk/aclock.bmp differ diff --git a/programs/aclock/trunk/adjstwnd.inc b/programs/aclock/trunk/adjstwnd.inc new file mode 100644 index 0000000000..83313e117b --- /dev/null +++ b/programs/aclock/trunk/adjstwnd.inc @@ -0,0 +1,147 @@ +; adjustWindowDimensions +; adjust menut window dimensions to get a certain work area size. +; or so. who on earth cares anyway, i certinaly don't, i'm just +; writing this code because i've got to kill time somehow... +; +; Copyright (c) 2002 Thomas Mathys +; killer@vantage.ch +; +; 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. +; +; You should have received a copy of the GNU General Public License +; along with this program; if not, write to the Free Software +; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +; +%ifndef _ADJSTWND_INC +%define _ADJSTWND_INC + + + ;window types + ADJSTWND_TYPE_SKINNED equ 0 + + +;******************************************************************** +; adjust window dimensions to get a certain work area size +; +; - first the window width and height are adjusted +; and clamped if they're too large for the screen. +; - then the window positions are adjusted, if the +; window goes out of the screen. +; +; input: +; eax window type, one of the ADJSTWND_TYPE_xxx constants +; ebx window x position +; ecx window y position +; edx desired work area width +; esi desired work area height +; +; output: +; eax return code. 0 = ok, -1 = invalid window type +; ebx adjusted window x position +; ecx adjusted window y position +; edx window width to get desired work area width +; esi window height to get desired work area height +; +; destroys: +; nothing +; +; normally x and y are the upper left corner of the window, +; relative to the upper left corner of the screen. +; if you pass a negative x or y it will be treated as the +; lower right corner of the window, relative to the lower +; right corner of the screen. +;******************************************************************** +adjustWindowDimensions: + push edi + push ebp + pushfd + + ; adjust window dimensions, depending on the window type + cmp eax,ADJSTWND_TYPE_SKINNED + je .adjust_skinned + mov eax,-1 ; invalid window type, + jmp .bye ; return error code + + ; clamp window dimensions +.clamp: + mov eax,MOS_SC_GETSCREENMAX ; get screen dimensions + int 0x40 + mov edi,eax ; edi = screen width + shr edi,16 + mov ebp,eax ; ebp = screen height + and ebp,0xffff + cmp edx,edi ; window width > screen width ? + jna .widthok + mov edx,edi ; yes -> use screen width +.widthok: + cmp esi,ebp ; wnd height > screen height ? + jna .heightok + mov esi,ebp ; yes -> use screen height +.heightok: + + ; adjust x position + or ebx,ebx ; do the lower right corner + jns .foo ; stuff if x is negative. + add ebx,edi + sub ebx,edx +.foo: + or ebx,ebx ; x < 0 ? + jns .xnotnegative + xor ebx,ebx ; yes -> x = 0 +.xnotnegative: + mov eax,ebx ; x + width > screen width ? + add eax,edx + cmp eax,edi + jna .xok + sub eax,edi ; yes -> adjust + sub ebx,eax +.xok: + + ; adjust y position + or ecx,ecx ; do the lower right corner + jns .bar ; stuff if y is negative. + add ecx,ebp + sub ecx,esi +.bar: + or ecx,ecx ; y < 0 ? + jns .ynotnegative + xor ecx,ecx ; yes -> y = 0 +.ynotnegative: + mov eax,ecx ; y + height > screen height ? + add eax,esi + cmp eax,ebp + jna .yok + sub eax,ebp ; yes -> adjust + sub ecx,eax +.yok: + +.done: + xor eax,eax +.bye: + popfd + pop ebp + pop edi + ret + +.adjust_skinned: + ; adjust width (edx) + add edx,MOS_WND_SKIN_BORDER_LEFT+MOS_WND_SKIN_BORDER_RIGHT + ; adjust height (esi). we need the skin height to do this. + push ebx + mov eax,MOS_SC_WINDOWPROPERTIES + mov ebx,4 + int 0x40 + lea esi,[esi+eax+MOS_WND_SKIN_BORDER_BOTTOM] + pop ebx + jmp .clamp + +%endif + diff --git a/programs/aclock/trunk/cmdline.inc b/programs/aclock/trunk/cmdline.inc new file mode 100644 index 0000000000..3c704d04ee --- /dev/null +++ b/programs/aclock/trunk/cmdline.inc @@ -0,0 +1,151 @@ +; command line parsing code for aclock +; +; Copyright (c) 2003 Thomas Mathys +; killer@vantage.ch +; +; 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. +; +; You should have received a copy of the GNU General Public License +; along with this program; if not, write to the Free Software +; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +; +%ifndef _CMDLINE_INC +%define _CMDLINE_INC + + +;******************************************************************** +; parse the command line +; input : nothing +; output : wndXPos, wndYPos, wndWidth, wndHeight +; are changed. +; destroys : nothing +;******************************************************************** +parseCommandLine: + pushad + pushfd + + ; terminate command line, just to be sure + mov byte [cmdLine + 256],0 + + ; go through all tokens + mov eax,cmdLine ; eax -> command line +.parseloop: + mov ebx,delimiters ; ebx -> token delimiter list + call strtok ; get next parameter + or eax,eax ; no more parameters ? + jz .nomoretokens + mov cl,[eax] ; get 1st char of parameter + cmp cl,'x' ; which parameter is it ? + je .param_x + cmp cl,'y' + je .param_y + cmp cl,'w' + je .param_w + cmp cl,'h' + je .param_h + ; if we reach this line it's an unknown parameter, ignore it +.nextparam: + xor eax,eax ; set eax = 0 to continue + jmp .parseloop ; after last token. +.nomoretokens: + DBG_BOARD_PRINTDWORD [wndXPos] + DBG_BOARD_PRINTCHAR 32 + DBG_BOARD_PRINTDWORD [wndYPos] + DBG_BOARD_PRINTCHAR 32 + DBG_BOARD_PRINTDWORD [wndWidth] + DBG_BOARD_PRINTCHAR 32 + DBG_BOARD_PRINTDWORD [wndHeight] + DBG_BOARD_PRINTNEWLINE + popfd + popad + ret + + ; eax -> first character of the parameter +.param_x: + push eax + call parsePositionParam + mov [wndXPos],eax + pop eax + jmp .nextparam + + ; eax -> first character of the parameter +.param_y: + push eax + call parsePositionParam + mov [wndYPos],eax + pop eax + jmp .nextparam + + ; eax -> first character of the parameter +.param_w: + push eax + call parseSizeParam + mov [wndWidth],eax + pop eax + jmp .nextparam + + ; eax -> first character of the parameter +.param_h: + push eax + call parseSizeParam + mov [wndHeight],eax + pop eax + jmp .nextparam + +; parse position parameter +; input : eax = address of first character of parameter +; output : eax contains position +; destroys : nothing +parsePositionParam: + push ebx + push esi + pushfd + + ; is the second char of the parameter a '-' ? + inc eax + xor ebx,ebx ; assume it isn't + cmp byte [eax],'-' + jne .nominus + mov ebx,1 ; yes -> set flag... + inc eax ; ...and move to next char +.nominus: + + ; convert rest of parameter to doubleword + mov esi,eax + call string2dword + + ; negate if necessary + or ebx,ebx + jz .rotationshyperboloid + neg eax +.rotationshyperboloid: + + popfd + pop esi + pop ebx + ret + +; parse dimension parameter +; input : eax = address of first char of parameter +; output : eax contains dimension +; destroys : nothing +parseSizeParam: + push esi + pushfd + lea esi,[eax + 1] ; esi -> 2nd char of parameter + call string2dword + popfd + pop esi + ret + + +%endif + diff --git a/programs/aclock/trunk/dbgboard.inc b/programs/aclock/trunk/dbgboard.inc new file mode 100644 index 0000000000..74940814bf --- /dev/null +++ b/programs/aclock/trunk/dbgboard.inc @@ -0,0 +1,200 @@ +; macros to write stuff to menuet's debug message board. +; the macros don't change any registers, not even flags. +; they take only effect if DEBUG is defined. +; +; Copyright (c) 2003 Thomas Mathys +; killer@vantage.ch +; +; 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. +; +; You should have received a copy of the GNU General Public License +; along with this program; if not, write to the Free Software +; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +; +%ifndef _DBGBOARD_INC +%define _DBGBOARD_INC + + +%ifdef DEBUG + + +;******************************************************************** +; print newline +; no input +;******************************************************************** +%macro DBG_BOARD_PRINTNEWLINE 0 + call dbg_board_printnewline +%endm + + +;******************************************************************** +; print a character +; +; examples : DBG_BOARD_PRINTCHAR '?' +; DBG_BOARD_PRINTCHAR 65 +; DBG_BOARD_PRINTCHAR cl +; DBG_BOARD_PRINTCHAR [esi] +; DBG_BOARD_PRINTCHAR [somevariable] +;******************************************************************** +%macro DBG_BOARD_PRINTCHAR 1 + push ecx + mov cl,byte %1 + call dbg_board_printchar + pop ecx +%endm + + + +;******************************************************************** +; print a dword (in hex) +; +; examples: DBG_BOARD_PRINTDWORD esp +; DBG_BOARD_PRINTDWORD 0xdeadbeef +; DBG_BOARD_PRINTDWORD [somevariable] +;******************************************************************** +%macro DBG_BOARD_PRINTDWORD 1 + push dword %1 + call dbg_board_printdword +%endm + + +;******************************************************************** +; print a string literal +; a terminating zero is automagically appended to the string. +; +; examples DBG_BOARD_PRINTSTRINGLITERAL "foo",0 +; DBG_BOARD_PRINTSTRINGLITERAL "bar",10,13,0 +;******************************************************************** +%macro DBG_BOARD_PRINTSTRINGLITERAL 1+ + jmp %%bar +%%foo db %1, 0 ; terminate string, just to be sure +%%bar: + push dword %%foo + call dbg_board_printstring +%endm + + +;******************************************************************** +; print a string (asciiz) +; +; examples DBG_BOARD_PRINTSTRING addressofstring +; DBG_BOARD_PRINTSTRING esi +; DBG_BOARD_PRINTSTRING [ebx] +;******************************************************************** +%macro DBG_BOARD_PRINTSTRING 1 + push dword %1 + call dbg_board_printstring +%endm + + +; no input +dbg_board_printnewline: + pushad + pushfd + mov eax,MOS_SC_DEBUGBOARD + mov ebx,1 + mov ecx,10 + int 0x40 + mov ecx,13 + int 0x40 + popfd + popad + ret + + +; input : cl = character to print +dbg_board_printchar: + pushad + pushfd + mov eax,MOS_SC_DEBUGBOARD + mov ebx,1 + and ecx,0xff + int 0x40 + popfd + popad + ret + + +; input : dword to print on stack +dbg_board_printdword: + enter 0,0 + pushad + pushfd + mov eax,MOS_SC_DEBUGBOARD + mov ebx,1 + mov ecx,'0' ; print 0x prefix + int 0x40 + mov ecx,'x' + int 0x40 + mov edx,[ebp + 8] ; get dword to print + mov esi,8 ; iterate through all nibbles +.loop: + mov ecx,edx ; display hex digit + shr ecx,28 + movzx ecx,byte [dbg_board_printdword_digits + ecx] + int 0x40 + shl edx,4 ; next nibble + dec esi + jnz .loop + popfd + popad + leave + ret 4 +dbg_board_printdword_digits: + db '0','1','2','3','4','5','6','7' + db '8','9','a','b','c','d','e','f' + + +; input : address of string (asciiz) to print on stack +dbg_board_printstring: + enter 0,0 + pushad + pushfd + cld + mov esi,[ebp + 8] ; esi -> string + mov ebx,1 +.loop: + lodsb ; get character + or al,al ; zero ? + je .done ; yeah -> get outta here + movzx ecx,al ; nope -> display character + mov eax,MOS_SC_DEBUGBOARD + int 0x40 + jmp .loop +.done: + popfd + popad + leave + ret 4 + +%else + + +%macro DBG_BOARD_PRINTNEWLINE 0 +%endm + +%macro DBG_BOARD_PRINTCHAR 1 +%endm + +%macro DBG_BOARD_PRINTDWORD 1 +%endm + +%macro DBG_BOARD_PRINTSTRINGLITERAL 1+ +%endm + +%macro DBG_BOARD_PRINTSTRING 1 +%endm + +%endif + + +%endif + diff --git a/programs/aclock/trunk/draw.inc b/programs/aclock/trunk/draw.inc new file mode 100644 index 0000000000..7ca3005f02 --- /dev/null +++ b/programs/aclock/trunk/draw.inc @@ -0,0 +1,430 @@ +; drawing code for aclock +; +; Copyright (c) 2003 Thomas Mathys +; killer@vantage.ch +; +; 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. +; +; You should have received a copy of the GNU General Public License +; along with this program; if not, write to the Free Software +; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +; +%ifndef _DRAW_INC +%define _DRAW_INC + + +TMR1_FACTOR dd 0.45 +TMR2_FACTOR dd 0.426315789 +SECR_FACTOR dd 0.378947368 +MINR_FACTOR dd 0.355263158 +HOURR_FACTOR dd 0.189473684 +DATE_FACTOR dd 0.1 + + +monthNames: + db "Jan" + db "Feb" + db "Mar" + db "Apr" + db "May" + db "Jun" + db "Jul" + db "Aug" + db "Sep" + db "Oct" + db "Nov" + db "Dec" + + +;******************************************************************** +; draws the clock +; input : nothing +; output : nothing +; destroys : nothing +;******************************************************************** +drawClock: + %push drawClock_context + %stacksize flat + %assign %$localsize 0 + + %local i:dword, \ + TMR1X:dword, \ + TMR1Y:dword, \ + TMR2X:dword, \ + TMR2Y:dword, \ + SECRX:dword, \ + SECRY:dword, \ + MINRX:dword, \ + MINRY:dword, \ + HOURRX:dword, \ + HOURRY:dword, \ + workwidth:dword, \ + workheight:dword, \ + foo:dword + + enter %$localsize,0 + pushad + pushfd + + ; get window dimensions + mov eax,MOS_SC_GETPROCESSINFO + mov ebx,procInfo + mov ecx,-1 + int 0x40 + + ; calculate work area size (width/height = ecx/edx) + ; if the work area is too small (maybe the window is shaded) + ; we don't draw anything. + mov eax,MOS_SC_WINDOWPROPERTIES + mov ebx,4 ; get skin height (eax) + int 0x40 + mov ecx,[procInfo + MOS_PROCESSINFO.wndWidth] + sub ecx,MOS_WND_SKIN_BORDER_LEFT+MOS_WND_SKIN_BORDER_RIGHT + mov edx,[procInfo + MOS_PROCESSINFO.wndHeight] + sub edx,eax + sub edx,MOS_WND_SKIN_BORDER_BOTTOM + cmp ecx,0 ; width too small ? + jle .bye + cmp edx,0 ; height too small ? + jnle .continue +.bye: + jmp .byebye +.continue: + mov [workwidth],ecx ; save for later (for fpu) + mov [workheight],edx + + ; calculate center of clock (x/y = esi/edi) + mov esi,[procInfo + MOS_PROCESSINFO.wndWidth] + shr esi,1 + mov edi,[procInfo + MOS_PROCESSINFO.wndHeight] + sub edi,MOS_WND_SKIN_BORDER_BOTTOM + sub edi,eax + shr edi,1 + add edi,eax + + ; clear work area + pushad + mov ebx,(MOS_WND_SKIN_BORDER_LEFT)*0x10000 ; x start + or ebx,ecx ; width + mov ecx,eax ; y start + shl ecx,16 ; (=skin height) + or ecx,edx ; height + mov edx,[wndColors + MOS_WNDCOLORS.work] + mov eax,MOS_SC_DRAWBAR + int 0x40 + popad + + ; calculate second hand radii + fild dword [workwidth] + fmul dword [SECR_FACTOR] + fstp dword [SECRX] + fild dword [workheight] + fmul dword [SECR_FACTOR] + fstp dword [SECRY] + + ; calculate minute hand radii + fild dword [workwidth] + fmul dword [MINR_FACTOR] + fstp dword [MINRX] + fild dword [workheight] + fmul dword [MINR_FACTOR] + fstp dword [MINRY] + + ; calculate hour hand radii + fild dword [workwidth] + fmul dword [HOURR_FACTOR] + fstp dword [HOURRX] + fild dword [workheight] + fmul dword [HOURR_FACTOR] + fstp dword [HOURRY] + + ; calculate tick mark radii + fild dword [workwidth] + fmul dword [TMR1_FACTOR] + fstp dword [TMR1X] + fild dword [workheight] + fmul dword [TMR1_FACTOR] + fstp dword [TMR1Y] + fild dword [workwidth] + fmul dword [TMR2_FACTOR] + fstp dword [TMR2X] + fild dword [workheight] + fmul dword [TMR2_FACTOR] + fstp dword [TMR2Y] + + ; get system clock (edx) + mov eax,MOS_SC_GETSYSCLOCK + int 0x40 + mov edx,eax + + ; draw second hand + push edx + mov eax,edx + shr eax,16 + call bcdbin + mov ecx,eax ; save seconds for later + push ecx + push eax + fpush32 0.104719755 ; 2*pi/60 + push dword [SECRX] + push dword [SECRY] + push esi + push edi + call getHandCoords + mov eax,MOS_SC_DRAWLINE + shl ebx,16 + or ebx,esi + shl ecx,16 + or ecx,edi + mov edx,[wndColors + MOS_WNDCOLORS.workText] + int 0x40 + pop ecx + pop edx + + ; draw minute hand + push edx + mov eax,edx + shr eax,8 + call bcdbin + mov edx,60 + mul edx + add eax,ecx + mov ecx,eax ; save for later + push ecx + push eax + fpush32 0.001745329 ; 2*pi/60/60 + push dword [MINRX] + push dword [MINRY] + push esi + push edi + call getHandCoords + mov eax,MOS_SC_DRAWLINE + shl ebx,16 + or ebx,esi + shl ecx,16 + or ecx,edi + mov edx,[wndColors + MOS_WNDCOLORS.workText] + int 0x40 + pop ecx + pop edx + + ; draw hour hand + push edx + mov eax,edx + call bcdbin + cmp eax,11 ; % 12 (just to be sure) + jnae .hoursok + sub eax,12 +.hoursok: + mov edx,60*60 + mul edx + add eax,ecx + push eax + fpush32 0.000145444 ; 2*pi/60/60/12 + push dword [HOURRX] + push dword [HOURRY] + push esi + push edi + call getHandCoords + mov eax,MOS_SC_DRAWLINE + shl ebx,16 + or ebx,esi + shl ecx,16 + or ecx,edi + mov edx,[wndColors + MOS_WNDCOLORS.workText] + int 0x40 + pop edx + + ; draw tick marks + mov dword [i],11 ; draw 12 marks +.drawtickmarks: + push dword [i] ; calculate start point + fpush32 0.523598776 ; 2*pi/12 + push dword [TMR1X] + push dword [TMR1Y] + push esi + push edi + call getHandCoords + mov eax,ebx ; save in eax and edx + mov edx,ecx + push dword [i] + fpush32 0.523598776 ; 2*pi/12 + push dword [TMR2X] + push dword [TMR2Y] + push esi + push edi + call getHandCoords + shl eax,16 + shl edx,16 + or ebx,eax ; ebx = x start and end + or ecx,edx ; ecx = y start and end + mov edx,[wndColors + MOS_WNDCOLORS.workText] + mov eax,MOS_SC_DRAWLINE + int 0x40 + dec dword [i] + jns .drawtickmarks + + %define DATE_WIDTH 48 + + ; calculate text start position + mov eax,[procInfo+MOS_PROCESSINFO.wndWidth] + sub eax,DATE_WIDTH ; x = (wndwidth-textwidth)/2 + shr eax,1 ; eax = x + fild dword [workheight] ; y = DATE_FACTOR*workheight... + fmul dword [DATE_FACTOR] + mov [foo],edi ; ... + y_clockcenter + fiadd dword [foo] + fistp dword [foo] + mov ebx,[foo] ; ebx = y + + ; draw text at all ? + cmp dword [workwidth],DATE_WIDTH ; text too wide ? + jb .goodbye + mov ecx,ebx ; text too high ? + add ecx,10-1 + mov edx,[procInfo+MOS_PROCESSINFO.wndHeight] + sub edx,MOS_WND_SKIN_BORDER_BOTTOM + cmp ecx,edx + jnae .yousuck +.goodbye: + jmp .bye +.yousuck: + + + ; ebx = (x << 16) | y + shl eax,16 + or ebx,eax + + ; get date (edi) + mov eax,MOS_SC_GETDATE + int 0x40 + mov edi,eax + + ; display month + mov eax,edi ; get month + shr eax,8 + call bcdbin + ; ebx contains already position + mov ecx,[wndColors+MOS_WNDCOLORS.workText] + lea edx,[monthNames-3+eax*2+eax]; -3 because eax = 1..12 =] + mov esi,3 ; text length + mov eax,MOS_SC_WRITETEXT + int 0x40 + + ; display date + add ebx,MOS_DWORD(3*6+3,0) + mov eax,edi ; get date + shr eax,16 + call bcdbin + mov edx,ebx ; position must be in edx + mov ebx,0x00020000 ; number, display two digits + mov ecx,eax ; number to display + mov esi,[wndColors+MOS_WNDCOLORS.workText] + mov eax,MOS_SC_WRITENUMBER + int 0x40 + + ; display year. the way we avoid the y2k bug is even + ; simpler, yet much better than in the last version: + ; now we simply display the last two digits and let the + ; user decide wether it's the year 1903 or 2003 =] + add edx,MOS_DWORD(2*6+3,0) + mov eax,edi ; get year + call bcdbin + mov ebx,0x00020000 ; number, display two digits + mov ecx,eax ; number to display + ; edx contains already position + mov esi,[wndColors+MOS_WNDCOLORS.workText] + mov eax,MOS_SC_WRITENUMBER + int 0x40 + +.byebye: + popfd + popad + leave + ret + %pop + + +;********************************************************** +; bcdbin +; converts a 8 bit bcd number into a 32 bit binary number +; +; in al = 8 bit bcd number +; out eax = 32 bit binary number +; destroys dl,flags +;********************************************************** +bcdbin: + push edx + pushfd + mov dl,al ; save bcd number + shr al,4 ; convert upper nibble + mov ah,10 + mul ah + and dl,15 ; add lower nibble + add al,dl + and eax,255 ; ! + popfd + pop edx + ret + + +;******************************************************************** +; getHandCoords +; calculates the end point of a hand +; +; input (on stack, push from top to bottom): +; ANGLE angle (integer) +; DEG2RAD conversion factor for ANGLE (32 bit real) +; RADIUSX x radius (32 bit real) +; RADIUSY y radius (32 bit real) +; CENTERX x center of the clock (integer) +; CENTERY y center of the clock (integer) +; +; output: +; ebx x coordinate in bits 0..15, bits 16..31 are zero +; ecx y coordinate in bits 0..15, bits 16..31 are zero +; +; destroys: +; nothing +;******************************************************************** +getHandCoords: + +ANGLE equ 28 +DEG2RAD equ 24 +RADIUSX equ 20 +RADIUSY equ 16 +CENTERX equ 12 +CENTERY equ 8 + + enter 0,0 + pushfd + + fild dword [ebp+ANGLE] ; get angle + fmul dword [ebp+DEG2RAD] ; convert to radians + fsincos + fmul dword [ebp+RADIUSY] ; -y * radius + clockcy + fchs + fiadd dword [ebp+CENTERY] + fistp dword [ebp+CENTERY] + fmul dword [ebp+RADIUSX] ; x * radius + clockcx + fiadd dword [ebp+CENTERX] + fistp dword [ebp+CENTERX] + + mov ebx,[ebp+CENTERX] + mov ecx,[ebp+CENTERY] + + popfd + leave + ret 4*6 + + +%endif + diff --git a/programs/aclock/trunk/make.bat b/programs/aclock/trunk/make.bat new file mode 100644 index 0000000000..016118a765 --- /dev/null +++ b/programs/aclock/trunk/make.bat @@ -0,0 +1,2 @@ +@rem nasm -t -f bin -o aclock -l aclock.lst aclock.asm -DDEBUG +nasm -t -f bin -o aclock aclock.asm diff --git a/programs/aclock/trunk/mos.inc b/programs/aclock/trunk/mos.inc new file mode 100644 index 0000000000..20274343c1 --- /dev/null +++ b/programs/aclock/trunk/mos.inc @@ -0,0 +1,334 @@ +; mos.inc 0.03 +; Copyright (c) 2002 Thomas Mathys +; killer@vantage.ch +; +; 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. +; +; You should have received a copy of the GNU General Public License +; along with this program; if not, write to the Free Software +; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +; +%ifndef _MOS_INC +%define _MOS_INC + + +;********************************************************** +; generates a menuetos 01 header +; takes 6 parameters: +; +; MOS_HEADER01 start, end, appmem, esp, i_param, i_icon +;********************************************************** + +%macro MOS_HEADER01 6 + org 0x0 + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd %1 ; start of code + dd %2 ; image size + dd %3 ; application memory + dd %4 ; esp + dd %5 ; i_param + dd %6 ; i_icon +%endmacro + + +;********************************************************** +; MOS_DWORD +; packs 2 words into a double word +;********************************************************** + +%define MOS_DWORD(hi,lo) ((((hi) & 0xffff) << 16) + ((lo) & 0xffff)) + + +;********************************************************** +; MOS_RGB +; creates a menuet os compatible color (0x00RRGGBB) +;********************************************************** + +%define MOS_RGB(r,g,b) ((((r) & 255) << 16) + (((g) & 255) << 8) + ((b) & 255)) + + +;********************************************************** +; window stuff +;********************************************************** + + ; default window colors +struc MOS_WNDCOLORS + .frame: resd 1 + .grab: resd 1 + .grabButton: resd 1 + .grabButtonText: resd 1 + .grabText: resd 1 + .work: resd 1 + .workButton: resd 1 + .workButtonText: resd 1 + .workText: resd 1 + .workGraphics: resd 1 +endstruc + + ; skinned window borders +MOS_WND_SKIN_BORDER_LEFT equ 5 +MOS_WND_SKIN_BORDER_RIGHT equ 5 +MOS_WND_SKIN_BORDER_BOTTOM equ 5 + + +;********************************************************** +; process info structure +;********************************************************** + +struc MOS_PROCESSINFO + .CPUUsage: resd 1 + .windowStackPos: resw 1 + .windowStackVal: resw 1 + .reserved1: resw 1 + .processName: resb 12 + .memStart: resd 1 + .memUsed: resd 1 + .pid: resd 1 + .wndXPos resd 1 + .wndYPos resd 1 + .wndWidth resd 1 + .wndHeight resd 1 + .reserved2: resb (1024 - 50) +endstruc + + + +;********************************************************** +; system call numbers +;********************************************************** + +MOS_SC_EXIT equ -1 +MOS_SC_DEFINEWINDOW equ 0 +MOS_SC_PUTPIXEL equ 1 +MOS_SC_GETKEY equ 2 +MOS_SC_GETSYSCLOCK equ 3 +MOS_SC_WRITETEXT equ 4 +MOS_SC_DELAY equ 5 +MOS_SC_OPENFILEFLOPPY equ 6 ; obsolete +MOS_SC_PUTIMAGE equ 7 +MOS_SC_DEFINEBUTTON equ 8 +MOS_SC_GETPROCESSINFO equ 9 +MOS_SC_WAITEVENT equ 10 +MOS_SC_CHECKEVENT equ 11 +MOS_SC_REDRAWSTATUS equ 12 +MOS_SC_DRAWBAR equ 13 +MOS_SC_GETSCREENMAX equ 14 +MOS_SC_SETBACKGROUND equ 15 +MOS_SC_GETPRESSEDBUTTON equ 17 +MOS_SC_SYSTEMSERVICE equ 18 +MOS_SC_STARTPROGRAM equ 19 ; obsolete +MOS_SC_MIDIINTERFACE equ 20 +MOS_SC_DEVICESETUP equ 21 +MOS_SC_WAITEVENTTIMEOUT equ 23 +MOS_SC_CDAUDIO equ 24 +MOS_SC_SB16MIXER1 equ 25 +MOS_SC_GETDEVICESETUP equ 26 +MOS_SC_WSS equ 27 +MOS_SC_SB16MIXER2 equ 28 +MOS_SC_GETDATE equ 29 +MOS_SC_READHD equ 30 ; obsolete +MOS_SC_STARTPROGRAMHD equ 31 ; obsolete +MOS_SC_DELETEFILEFLOPPY equ 32 +MOS_SC_SAVEFILERAMDISK equ 33 ; obsolete +MOS_SC_READDIRRAMDISK equ 34 ; obsolete +MOS_SC_GETSCREENPIXEL equ 35 +MOS_SC_GETMOUSEPOSITION equ 37 +MOS_SC_DRAWLINE equ 38 +MOS_SC_GETBACKGROUND equ 39 +MOS_SC_SETEVENTMASK equ 40 +MOS_SC_GETIRQOWNER equ 41 +MOS_SC_GETDATAREADBYIRQ equ 42 +MOS_SC_SENDDATATODEVICE equ 43 +MOS_SC_PROGRAMIRQS equ 44 +MOS_SC_RESERVEFREEIRQ equ 45 +MOS_SC_RESERVEFREEPORTS equ 46 +MOS_SC_WRITENUMBER equ 47 +MOS_SC_WINDOWPROPERTIES equ 48 +MOS_SC_SHAPEDWINDOWS equ 50 +MOS_SC_CREATETHREAD equ 51 +MOS_SC_STACKDRIVERSTATE equ 52 +MOS_SC_SOCKETINTERFACE equ 53 +MOS_SC_SOUNDINTERFACE equ 55 +MOS_SC_WRITEFILEHD equ 56 ; obsolete +MOS_SC_DELETEFILEHD equ 57 +MOS_SC_SYSTREEACCESS equ 58 +MOS_SC_SYSCALLTRACE equ 59 +MOS_SC_IPC equ 60 +MOS_SC_DIRECTGRAPHICS equ 61 +MOS_SC_PCI equ 62 +MOS_SC_DEBUGBOARD equ 63 + + +;********************************************************** +; event numbers +;********************************************************** + +MOS_EVT_NONE equ 0 +MOS_EVT_REDRAW equ 1 +MOS_EVT_KEY equ 2 +MOS_EVT_BUTTON equ 3 + + +;********************************************************** +; event bits +;********************************************************** + +MOS_EVTBIT_REDRAW equ (1 << 0) +MOS_EVTBIT_KEY equ (1 << 1) +MOS_EVTBIT_BUTTON equ (1 << 2) +MOS_EVTBIT_ENDREQUEST equ (1 << 3) +MOS_EVTBIT_BGDRAW equ (1 << 4) +MOS_EVTBIT_MOUSECHANGE equ (1 << 5) +MOS_EVTBIT_IPCEVENT equ (1 << 6) +MOS_EVTBIT_IRQ0 equ (1 << 16) +MOS_EVTBIT_IRQ1 equ (1 << 17) +MOS_EVTBIT_IRQ2 equ (1 << 18) +MOS_EVTBIT_IRQ3 equ (1 << 19) +MOS_EVTBIT_IRQ4 equ (1 << 20) +MOS_EVTBIT_IRQ5 equ (1 << 21) +MOS_EVTBIT_IRQ6 equ (1 << 22) +MOS_EVTBIT_IRQ7 equ (1 << 23) +MOS_EVTBIT_IRQ8 equ (1 << 24) +MOS_EVTBIT_IRQ9 equ (1 << 25) +MOS_EVTBIT_IRQ10 equ (1 << 26) +MOS_EVTBIT_IRQ11 equ (1 << 27) +MOS_EVTBIT_IRQ12 equ (1 << 28) +MOS_EVTBIT_IRQ13 equ (1 << 29) +MOS_EVTBIT_IRQ14 equ (1 << 30) +MOS_EVTBIT_IRQ15 equ (1 << 31) + + +;********************************************************** +; exit application (syscall -1) +;********************************************************** + +; exit application +%macro MOS_EXIT 0 + mov eax,MOS_SC_EXIT + int 0x40 +%endmacro + +; exit application, smaller version +%macro MOS_EXIT_S 0 + xor eax,eax + dec eax + int 0x40 +%endmacro + + +;********************************************************** +; wait event stuff +; (MOS_SC_WAITEVENT, syscall 10) +;********************************************************** + +; wait for event +; destroys : nothing +; returns : eax = event type +%macro MOS_WAITEVENT 0 + mov eax,MOS_SC_WAITEVENT + int 0x40 +%endmacro + +; wait for event, smaller version +; destroys : flags +; returns : eax = event type +%macro MOS_WAITEVENT_S 0 + xor eax,eax + mov al,MOS_SC_WAITEVENT + int 0x40 +%endmacro + + +;********************************************************** +; window redraw status stuff +; (MOS_SC_REDRAWSTATUS, syscall 12) +;********************************************************** + +MOS_RS_STARTREDRAW equ 1 +MOS_RS_ENDREDRAW equ 2 + +; start window redraw +; destroys: eax,ebx +%macro MOS_STARTREDRAW 0 + mov ebx,MOS_RS_STARTREDRAW + mov eax,MOS_SC_REDRAWSTATUS + int 0x40 +%endmacro + +; start window redraw, smaller version +; destroys: eax,ebx,flags +%macro MOS_STARTREDRAW_S 0 + xor ebx,ebx + inc ebx + xor eax,eax + mov al,MOS_SC_REDRAWSTATUS + int 0x40 +%endmacro + +; end window redraw +; destroys: eax,ebx +%macro MOS_ENDREDRAW 0 + mov ebx,MOS_RS_ENDREDRAW + mov eax,MOS_SC_REDRAWSTATUS + int 0x40 +%endmacro + +; end window redraw, smaller version +; destroys: eax,ebx,flags +%macro MOS_ENDREDRAW_S 0 + xor ebx,ebx + mov bl,MOS_RS_ENDREDRAW + xor eax,eax + mov al,MOS_SC_REDRAWSTATUS + int 0x40 +%endmacro + + +;********************************************************** +; get screen max stuff (syscall 14) +;********************************************************** + +; get screen dimensions in eax +; destroys: nothing +%macro MOS_GETSCREENMAX 0 + mov eax,MOS_SC_GETSCREENMAX + int 0x40 +%endmacro + +; get screen dimensions in eax, smaller version +; destroys: flags +%macro MOS_GETSCREENMAX_S 0 + xor eax,eax + mov al,MOS_SC_GETSCREENMAX + int 0x40 +%endmacro + + +;******************************************************************** +; opcode hacks +;******************************************************************** + +; nasm refuses to assemble stuff like +; push dword 4.44 +; with the following macro this becomes possible: +; fpush32 9.81 +; don't forget to use a decimal point. things like +; fpush32 1 +; will probably not do what you expect. instead, write: +; fpush32 1.0 +%macro fpush32 1 + db 0x68 ; push imm32 + dd %1 +%endm + +%endif + diff --git a/programs/aclock/trunk/str2dwrd.inc b/programs/aclock/trunk/str2dwrd.inc new file mode 100644 index 0000000000..d2f1cbfeac --- /dev/null +++ b/programs/aclock/trunk/str2dwrd.inc @@ -0,0 +1,92 @@ +; string2dword - a useless string to double word conversion routine +; +; Copyright (c) 2003 Thomas Mathys +; killer@vantage.ch +; +; 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. +; +; You should have received a copy of the GNU General Public License +; along with this program; if not, write to the Free Software +; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +; + + +;******************************************************************** +; converts an asciiz string into an unsigned doubleword. +; (base 10 is assumed) +; +; - first, leading whitespaces are skipped +; - then the function converts the string, until it +; finds the terminating zero, another character it +; cannot convert or the number becomes too large. +; +; input : esi = pointer to string +; output : eax = unsigned doubleword +; the function tries to convert as +; many digits as possible, before it +; stops. if the value of the dword +; becomes too large, 0xffffffff is +; returned. +; destroys : nothing +;******************************************************************** +string2dword: + push ebx + push ecx + push edx + push esi + pushfd + + xor ebx,ebx ; ebx : dword + + ; skip leading whitespaces +.skipspaces: + lodsb + cmp al,32 ; space + je .skipspaces + cmp al,12 ; ff + je .skipspaces + cmp al,10 ; lf + je .skipspaces + cmp al,13 ; cr + je .skipspaces + cmp al,9 ; ht + je .skipspaces + cmp al,11 ; vt + je .skipspaces + + ; convert string + dec esi ; esi -> 1st non-whitespace +.convert: + xor eax,eax ; get character + lodsb + sub al,'0' ; convert to digit + cmp al,9 ; is digit in range [0,9] ? + ja .done ; nope -> stop conversion + mov ecx,eax ; save new digit + mov eax,10 ; dword = dword * 10 + mul ebx + jc .overflow + add eax,ecx ; + new digit + jc .overflow + mov ebx,eax + jmp .convert + +.overflow: + mov ebx,0xffffffff +.done: + mov eax,ebx + popfd + pop esi + pop edx + pop ecx + pop ebx + ret + diff --git a/programs/aclock/trunk/strlen.inc b/programs/aclock/trunk/strlen.inc new file mode 100644 index 0000000000..d4ece71a79 --- /dev/null +++ b/programs/aclock/trunk/strlen.inc @@ -0,0 +1,49 @@ +; strlen function +; +; Copyright (c) 2003 Thomas Mathys +; killer@vantage.ch +; +; 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. +; +; You should have received a copy of the GNU General Public License +; along with this program; if not, write to the Free Software +; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +; +%ifndef _STRLEN_INC +%define _STRLEN_INC + + +;******************************************************************** +; returns the length of an asciiz string +; input : esi = pointer to string +; output : eax = string length +; destroys : nothing +;******************************************************************** +strlen: + push ecx + push edi + pushfd + cld ; ! + mov ecx,-1 + mov edi,esi ; find terminating zero + xor al,al + repne scasb + mov eax,edi ; calculate string length + sub eax,esi + dec eax + popfd + pop edi + pop ecx + ret + + +%endif + diff --git a/programs/aclock/trunk/strtok.inc b/programs/aclock/trunk/strtok.inc new file mode 100644 index 0000000000..5c8db3dada --- /dev/null +++ b/programs/aclock/trunk/strtok.inc @@ -0,0 +1,125 @@ +; some strtok-like function +; +; Copyright (c) 2003 Thomas Mathys +; killer@vantage.ch +; +; 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. +; +; You should have received a copy of the GNU General Public License +; along with this program; if not, write to the Free Software +; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +; +%ifndef _STRTOK_INC +%define _STRTOK_INC + + +;******************************************************************** +; strtok +; this function works like strtok from a c runtime library. +; note that it is not threadsafe. it would be an easy task +; to make it threadsafe, though: +; .adx must be removed, instead the last search address is +; stored at some location provided by the user (passed as +; a third parameter in ecx or so) +; +; input: +; +; eax : address of string to be searched (asciiz), or +; 0 to get the next token of the current string +; ebx : address of delimiter list (asciiz) +; +; output: +; +; eax : pointer to the next token, or 0 if there +; aren't any tokens anymore. +; +; destroys: nothing +; +;******************************************************************** +strtok: + pushad + pushfd + + ; get start address + ; if the new start address is 0, and the old address (.adx) + ; is also 0, then there's nothing to do and we return 0. + or eax,eax ; new address = 0 ? + jz .nonewstring ; nope -> use old string + mov [.adx],eax ; yeah -> store new string adx +.nonewstring: + mov esi,[.adx] ; load string address + or esi,esi ; 0 ? + jnz .startadxok ; nope -> ok + xor eax,eax ; yeah -> return 0 + je .bye +.startadxok: + + ; skip leading delimiters +.skipdelimiters: + lodsb ; read character + mov edi,ebx ; edi -> delimiter list +.foo: + mov cl,[edi] ; get delimiter + inc edi + or cl,cl ; end of delimiter list + jz .endofdelimiterlist + cmp al,cl ; if AL is a delimiter, then + je .skipdelimiters ; we need to skip it too... + jmp .foo ; otherwise try next delimiter +.endofdelimiterlist: + + ; end of string reached without finding any non-delimiters ? + or al,al ; character = 0 ? + jnz .bar ; nope -> continue + mov dword [.adx],0 ; yeah -> remember this + xor eax,eax ; and return 0 + jmp .bye +.bar: + + ; found the start of a token, let's store its address + mov edx,esi + dec edx ; edx = start address of token + + ; find the end of the token +.abraham: + lodsb ; get character + mov edi,ebx ; edi -> delimiter list +.bebraham: + mov cl,[edi] ; get delimiter + inc edi + cmp al,cl ; is AL a delimiter ? + jne .cebraham ; nope -> continue + or al,al ; terminating zero found ? + jnz .argle + xor esi,esi ; yeah -> remember this + jmp .bargle +.argle: + mov byte [esi-1],0 ; nope -> mark end of token +.bargle: + mov [.adx],esi ; remember search address + mov eax,edx ; return token address + jmp .bye +.cebraham: + or cl,cl ; end of delimiter list ? + jnz .bebraham ; nope -> try next delimiter + jmp .abraham + + ; write return value into stack, so that when popad + ; gets executed, eax will receive the return value. +.bye: + mov [esp+4*8],eax + popfd + popad + ret +.adx dd 0 + +%endif + diff --git a/programs/airc/trunk/airc.asm b/programs/airc/trunk/airc.asm new file mode 100644 index 0000000000..ee088731b8 --- /dev/null +++ b/programs/airc/trunk/airc.asm @@ -0,0 +1,2359 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; IRC CLIENT for MenuetOS ;; +;; ;; +;; License: GPL / See file COPYING for details ;; +;; Copyright 2004 (c) Ville Turjanmaa ;; +;; ;; +;; Compile with FASM for Menuet ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +version equ '0.3' + +use32 + + org 0x0 + + db 'MENUET01' ; 8 byte id + dd 0x01 ; required os + dd START ; program start + dd I_END ; program image size + dd 0x100000 ; required amount of memory + dd 0x100000 + dd 0,0 +include "lang.inc" +include "macros.inc" + +irc_server_ip db 192,168,1,1 + +user_nick dd 4 ; length + db 'airc ' ; string + +user_real_name dd 8 ; length + db 'Joe User ' ; string + + +START: ; start of execution + + mov eax,40 + mov ebx,10000111b + int 0x40 + + mov edi,I_END + mov ecx,60*120 + mov eax,32 + cld + rep stosb + + mov eax,[rxs] + imul eax,11 + mov [pos],eax + + mov ebp,0 + mov edx,I_END + call draw_window ; at first, draw the window + +still: + + inc [cursor_on_off] + + mov eax,5 + mov ebx,1 + int 0x40 + + mov eax,11 ; wait here for event + int 0x40 + + call print_status + + cmp eax,1 ; redraw + je redraw + cmp eax,2 ; key + je main_window_key + cmp eax,3 ; button + je button + + cmp [I_END+120*60],byte 1 + jne no_main_update + mov [I_END+120*60],byte 0 + mov edx,I_END + call draw_channel_text + no_main_update: + + call read_incoming_data + + call send_data_to_server + + test [cursor_on_off],0x3f + jnz nopri + inc [blink] + call blink_cursor + call print_channel_list + nopri: + + jmp still + + +redraw: ; redraw + + call draw_window + jmp still + + +button: ; button + + mov eax,17 ; get id + int 0x40 + + cmp ah,1 ; close program + jne noclose + mov eax,-1 + int 0x40 + noclose: + + call socket_commands + + jmp still + + +print_status: + + pusha + + mov eax,53 + mov ebx,6 + mov ecx,[socket] + int 0x40 + + mov [status],eax + + cmp [old_status],eax + je nopr + + mov [old_status],eax + + push eax + + mov eax,13 + mov ebx,450*65536+30 + mov ecx,231*65536+10 + mov edx,0xffffff + int 0x40 + + pop ecx + mov eax,47 + mov ebx,2*65536 + mov edx,450*65536+231 + mov esi,0x000000 + int 0x40 + + nopr: + + popa + + ret + +status dd 0 +old_status dd 0 + + +socket_commands: + + cmp ah,22 ; open socket + jnz tst3 + mov eax,3 + int 0x40 + mov ecx,eax + mov eax,53 + mov ebx,5 + mov edx,6667 + mov esi,dword [irc_server_ip] + mov edi,1 + int 0x40 + mov [socket], eax + ret + tst3: + + + cmp ah,23 ; write userinfo + jnz tst4 + + mov eax,53 ; user + mov ebx,7 + mov ecx,[socket] + mov edx,string0l-string0 + mov esi,string0 + int 0x40 + + mov eax,53 ; + mov ebx,7 + mov ecx,[socket] + mov edx,[user_real_name] + mov esi,user_real_name+4 + int 0x40 + + mov eax,53 ; + mov ebx,7 + mov ecx,[socket] + mov edx,2 + mov esi,line_feed + int 0x40 + + + mov eax,5 + mov ebx,10 + int 0x40 + + mov eax,53 ; nick + mov ebx,7 + mov ecx,[socket] + mov edx,string1l-string1 + mov esi,string1 + int 0x40 + + mov eax,53 ; + mov ebx,7 + mov ecx,[socket] + mov edx,[user_nick] + mov esi,user_nick+4 + int 0x40 + + mov eax,53 ; + mov ebx,7 + mov ecx,[socket] + mov edx,2 + mov esi,line_feed + int 0x40 + + + ret + + line_feed: db 13,10 + + tst4: + + + cmp ah,24 ; close socket + jnz no_24 + mov eax,53 + mov ebx,8 + mov ecx,[socket] + int 0x40 + ret + no_24: + + + ret + + +main_window_key: + + mov eax,2 + int 0x40 + + shr eax,8 + + cmp eax,8 + jne no_bks2 + cmp [xpos],0 + je still + dec [xpos] + call print_entry + jmp still + no_bks2: + + cmp eax,20 + jbe no_character2 + mov ebx,[xpos] + mov [send_string+ebx],al + inc [xpos] + cmp [xpos],80 + jb noxposdec + mov [xpos],79 + noxposdec: + call print_entry + jmp still + no_character2: + + cmp eax,13 + jne no_send + cmp [xpos],0 + je no_send2 + cmp [send_string],byte '/' ; server command + jne no_send2 + mov [send_to_server],1 + jmp still + no_send2: + + jmp still + + +print_channel_list: + + pusha + + mov eax,13 + mov ebx,415*65536+6*13 + mov ecx,27*65536+12*10 + mov edx,0xffffff + int 0x40 + + mov eax,4 + mov ebx,415*65536+27 + mov ecx,[index_list_1] + mov edx,channel_list+32 + newch: + movzx esi,byte [edx+31] + and esi,0x1f + int 0x40 + add edx,32 + add ebx,12 + cmp edx,channel_list+32*10 + jbe newch + + no_channel_list: + + popa + + ret + + +print_user_list: + + pusha + + newtry: + + mov edx,ebp + imul edx,120*80 + add edx,120*60+8+I_END + cmp [edx],byte 1 + je nonp + + mov edx,ebp + imul edx,120*80 + add edx,120*70+I_END + mov edi,edx + + mov eax,[edx-8] + mov ebx,[edx-4] + add ebx,edx + sub ebx,3 + inc eax + dec edx + newnss: + inc edx + dec eax + jz startuu + asdf: + cmp [edx],word ' ' + jne nodouble + inc edx + nodouble: + cmp [edx],byte ' ' + je newnss + inc edx + cmp edx,ebx + jbe asdf + dec dword [edi-8] + + popa + ret + + startuu: + + cmp [edx],byte ' ' + jne startpr + inc edx + startpr: + + pusha + mov eax,13 + mov ebx,415*65536+6*13 + mov ecx,27*65536+12*10 + mov edx,0xffffff + int 0x40 + popa + + mov eax,4 + mov ebx,415*65536+27 + + mov ebp,0 + newuser: + + mov esi,0 + newusers: + cmp [edx+esi],byte ' ' + je do_print + inc esi + cmp esi,20 + jbe newusers + do_print: + + mov ecx,[index_list_1] + cmp [edx],byte '@' + jne no_op + mov ecx,[index_list_2] + no_op: + + int 0x40 + + inc ebp + cmp ebp,10 + je nonp + + add ebx,12 + + add edx,esi + + inc edx + cmp [edx],byte ' ' + jne newuser + inc edx + jmp newuser + + nonp: + + popa + + ret + + +start_user_list_at dd 0x0 + + + + +send_data_to_server: + + pusha + + cmp [send_to_server],1 + jne sdts_ret + + mov eax,[xpos] + mov [send_string+eax+0],byte 13 + mov [send_string+eax+1],byte 10 + + mov eax,[rxs] + imul eax,11 + mov [pos],eax + mov eax,[send_to_channel] + imul eax,120*80 + add eax,I_END + mov [text_start],eax + + cmp [send_string],byte '/' ; server command + je server_command + + mov bl,13 + call print_character + mov bl,10 + call print_character + mov bl,'<' + call print_character + + mov esi,user_nick+4 + mov ecx,[user_nick] + newnp: + mov bl,[esi] + call print_character + inc esi + loop newnp + + mov bl,'>' + call print_character + mov bl,' ' + call print_character + + mov ecx,[xpos] + mov esi,send_string + newcw: + mov bl,[esi] + call print_character + inc esi + loop newcw + + mov eax,dword [send_to_channel] + shl eax,5 + add eax,channel_list + mov esi,eax + + mov edi,send_string_header+8 + movzx ecx,byte [eax+31] + cld + rep movsb + + mov [edi],word ' :' + + mov esi, send_string_header + mov edx,10 + movzx ebx,byte [eax+31] + add edx,ebx + + mov eax, 53 ; write channel + mov ebx, 7 + mov ecx, [socket] + int 0x40 + + mov esi,send_string + mov edx,[xpos] + inc edx + + mov eax, 53 ; write message + mov ebx, 7 + mov ecx, [socket] + int 0x40 + + jmp send_done + + server_command: + + cmp [send_string+1],dword 'anic' + jne no_set_nick + + mov ecx,[xpos] + sub ecx,7 + mov [user_nick],ecx + + mov esi,send_string+7 + mov edi,user_nick+4 + cld + rep movsb + + pusha + mov edi,text+70*1+15 + mov eax,32 + mov ecx,15 + cld + rep stosb + popa + + mov esi,user_nick+4 + mov edi,text+70*1+15 + mov ecx,[user_nick] + cld + rep movsb + + call draw_window + + mov [xpos],0 + mov [send_to_server],0 + + popa + ret + + no_set_nick: + + cmp [send_string+1],dword 'area' + jne no_set_real_name + + mov ecx,[xpos] + sub ecx,7 + mov [user_real_name],ecx + + mov esi,send_string+7 + mov edi,user_real_name+4 + cld + rep movsb + + pusha + mov edi,text+70*0+15 + mov eax,32 + mov ecx,15 + cld + rep stosb + popa + + mov esi,user_real_name+4 + mov edi,text+70*0+15 + mov ecx,[xpos] + sub ecx,7 + cld + rep movsb + + call draw_window + + mov [xpos],0 + mov [send_to_server],0 + + popa + ret + + no_set_real_name: + + cmp [send_string+1],dword 'aser' + jne no_set_server + + pusha + mov edi,irc_server_ip + mov esi,send_string+7 + mov eax,0 + mov edx,[xpos] + add edx,send_string-1 + newsip: + cmp [esi],byte '.' + je sipn + cmp esi,edx + jg sipn + movzx ebx,byte [esi] + inc esi + imul eax,10 + sub ebx,48 + add eax,ebx + jmp newsip + sipn: + mov [edi],al + xor eax,eax + inc esi + cmp esi,send_string+30 + jg sipnn + inc edi + cmp edi,irc_server_ip+3 + jbe newsip + sipnn: + popa + + mov ecx,[xpos] + sub ecx,7 + + pusha + mov edi,text+70*2+15 + mov eax,32 + mov ecx,15 + cld + rep stosb + popa + + mov esi,send_string+7 + mov edi,text+70*2+15 + cld + rep movsb + + call draw_window + + mov [xpos],0 + mov [send_to_server],0 + + popa + ret + + no_set_server: + + + + + cmp [send_string+1],dword 'quer' + jne no_query_create + + mov edi,I_END+120*80 + mov eax,1 ; create channel window - search for empty slot + newse2: + mov ebx,eax + shl ebx,5 + cmp dword [channel_list+ebx],dword ' ' + je free_found2 + add edi,120*80 + inc eax + cmp eax,[max_windows] + jb newse2 + + free_found2: + + mov edx,send_string+7 + + mov ecx,[xpos] + sub ecx,7 + mov [channel_list+ebx+31],cl + + call create_channel_name + + push edi + push eax + mov [edi+120*60+8],byte 1 ; query window + mov eax,32 + mov ecx,120*60 + cld + rep stosb + pop eax + pop edi + + ; eax has the free position + mov [thread_screen],edi + call create_channel_window + + mov [xpos],0 + mov [send_to_server],0 + + popa + ret + + no_query_create: + + + mov esi, send_string+1 + mov edx, [xpos] + add edx,1 + + mov eax, 53 ; write server command + mov ebx, 7 + mov ecx, [socket] + int 0x40 + + send_done: + + mov [xpos],0 + mov [send_to_server],0 + + cmp [send_string+1],dword 'quit' + jne no_quit_server + mov eax,5 + mov ebx,200 + int 0x40 + + mov eax, 53 ; close socket + mov ebx, 8 + mov ecx, [socket] + int 0x40 + + mov ecx,[max_windows] + mov edi,I_END + newclose: + mov [edi+120*60+4],byte 1 + add edi,120*80 + loop newclose + + popa + ret + + no_quit_server: + + sdts_ret: + + popa + ret + + + +read_incoming_data: + + pusha + + read_new_byte: + + call read_incoming_byte + cmp ecx,-1 + je no_data_in_buffer + + cmp bl,10 + jne no_start_command + mov [cmd],1 + no_start_command: + + cmp bl,13 + jne no_end_command + mov eax,[cmd] + mov [eax+command-2],byte 0 + call analyze_command + mov edi,command + mov ecx,250 + mov eax,0 + cld + rep stosb + mov [cmd],0 + no_end_command: + + mov eax,[cmd] + cmp eax,512 + jge still + + mov [eax+command-2],bl + inc [cmd] + + jmp read_new_byte + + no_data_in_buffer: + + popa + + ret + + +create_channel_name: + + pusha + + search_first_letter: + cmp [edx],byte ' ' + jne first_letter_found + inc edx + jmp search_first_letter + first_letter_found: + + mov esi,edx + mov edi,channel_list + add edi,ebx + mov ecx,30 + xor eax,eax + newcase: + mov al,[esi] + cmp eax,'a' + jb nocdec + cmp eax,'z' + jg nocdec + sub al,97-65 + nocdec: + mov [edi],al + inc esi + inc edi + loop newcase + + popa + + ret + + +create_channel_window: + + pusha + + mov [cursor_on_off],0 + + mov [thread_nro],eax + + mov eax,51 + mov ebx,1 + mov ecx,channel_thread + mov edx,[thread_stack] + int 0x40 + + mov eax,5 + mov ebx,10 + int 0x40 + + add [thread_stack],0x4000 + add [thread_screen],120*80 + + popa + + ret + + +print_entry: + + pusha + + mov eax,13 + mov ebx,8*65536+6*80 + mov ecx,151*65536+13 + mov edx,0xffffff + int 0x40 + + mov eax,4 + mov ebx,8*65536+154 + mov ecx,0x000000 + mov edx,send_string + mov esi,[xpos] + int 0x40 + + popa + + ret + +blink dd 0x0 + +blink_cursor: + + pusha + + mov eax,9 + mov ebx,0xe0000 + mov ecx,-1 + int 0x40 + + mov edx,[blink] + and edx,1 + sub edx,1 + and edx,0xffffff +; mov edx,0 + + cmp ax,word [0xe0000+4] + jne no_blink + + call print_entry + + mov ebx,[xpos] + imul ebx,6 + add ebx,8 + mov cx,bx + shl ebx,16 + mov bx,cx + mov ecx,151*65536+163 + mov eax,38 + int 0x40 + + popa + + ret + + no_blink: + + mov eax,13 + mov ebx,8*65536+6*60 + mov ecx,151*65536+13 + mov edx,0xffffff + int 0x40 + + popa + + ret + + + + + +set_channel: + + pusha + + ; UPPER / LOWER CASE CHECK + + mov esi,eax + mov edi,channel_temp + mov ecx,40 + xor eax,eax + newcase2: + mov al,[esi] + cmp eax,'#' + jb newcase_over2 + cmp eax,'a' + jb nocdec2 + cmp eax,'z' + jg nocdec2 + sub al,97-65 + nocdec2: + mov [edi],al + inc esi + inc edi + loop newcase2 + newcase_over2: + sub edi,channel_temp + mov [channel_temp_length],edi + + mov eax,channel_temp + + mov [text_start],I_END+120*80 + mov ebx,channel_list+32 + mov eax,[eax] + + mov edx,[channel_temp_length] + + stcl1: + cmp dl,[ebx+31] + jne notfound + + pusha + xor eax,eax + xor edx,edx + mov ecx,0 + stc4: + mov dl,[ebx+ecx] + mov al,[channel_temp+ecx] + cmp eax,edx + jne notfound2 + inc ecx + cmp ecx,[channel_temp_length] + jb stc4 + popa + + jmp found + + notfound2: + popa + + notfound: + add [text_start],120*80 + add ebx,32 + cmp ebx,channel_list+19*32 + jb stcl1 + + mov [text_start],I_END + + found: + + popa + + ret + + +channel_temp: times 100 db 0 +channel_temp_length dd 0x0 + + + +print_nick: + + pusha + + mov eax,command+1 + mov dl,'!' + call print_text + + popa + ret + + +analyze_command: + + pusha + + mov [text_start],I_END + mov ecx,[rxs] + imul ecx,11 + mov [pos],ecx + + mov bl,13 +; call print_character + mov bl,10 +; call print_character + + mov ecx,[cmd] + sub ecx,2 + mov esi,command+0 + newcmdc: + mov bl,[esi] +; call print_character + inc esi + loop newcmdc + + mov edx,I_END +; call draw_channel_text + + cmp [cmd],20 + jge cmd_len_ok + + mov [cmd],0 + + popa + ret + + + cmd_len_ok: + + cmp [command],dword 'PING' ; ping response + jne no_ping_responce + + call print_command_to_main + + mov [command],dword 'PONG' + + call print_command_to_main + + mov eax,4 + mov ebx,100*65536+3 + mov ecx,0xffffff + mov edx,command + mov esi,[cmd] + mov [command+esi-1],word '**' +; int 0x40 + + mov eax,53 + mov ebx,7 + mov ecx,[socket] + mov edx,[cmd] + sub edx,2 + and edx,255 + mov esi,command + int 0x40 + + mov eax,53 + mov ebx,7 + mov ecx,[socket] + mov edx,2 + mov esi,linef + int 0x40 + + popa + ret + + linef db 13,10 + + no_ping_responce: + + mov eax,[rxs] + imul eax,11 + mov [pos],eax + + mov [command],byte '<' + + mov eax,command + mov ecx,100 + new_blank: + cmp [eax],byte ' ' + je bl_found + inc eax + loop new_blank + mov eax,50 + bl_found: + + inc eax + mov [command_position],eax + + mov esi,eax + mov edi,irc_command + mov ecx,8 + cld + rep movsb + + + cmp [irc_command],'PRIV' ; message to channel + jne no_privmsg + + ; compare nick + + mov eax,[command_position] + add eax,8 + call compare_to_nick + cmp [cresult],0 + jne no_query_msg + mov eax,command+1 + no_query_msg: + call set_channel + + mov ecx,100 ; [cmd] + mov eax,command+10 + acl3: + cmp [eax],byte ':' + je acl4 + inc eax + loop acl3 + mov eax,10 + acl4: + inc eax + + cmp [eax+1],dword 'ACTI' + jne no_action + push eax + mov eax,action_header_short + mov dl,0 + call print_text + mov eax,command+1 + mov dl,'!' + call print_text + mov bl,' ' + call print_character + pop eax + add eax,8 + mov dl,0 + call print_text + popa + ret + + no_action: + + push eax + mov bl,10 + call print_character + mov eax,command + mov dl,'!' + call print_text + mov bl,'>' + call print_character + mov bl,' ' + call print_character + pop eax + + mov dl,0 + call print_text + + popa + ret + + no_privmsg: + + + cmp [irc_command],'PART' ; channel leave + jne no_part + + ; compare nick + + mov eax,command+1 + call compare_to_nick + cmp [cresult],0 + jne no_close_window + + mov eax,[command_position] + add eax,5 + call set_channel + + mov eax,[text_start] + mov [eax+120*60+4],byte 1 + + popa + ret + + no_close_window: + + mov eax,[command_position] + add eax,5 + call set_channel + + mov eax,action_header_red + mov dl,0 + call print_text + mov eax,command+1 + mov dl,'!' + mov cl,' ' + call print_text + mov eax,has_left_channel + mov dl,0 + call print_text + mov eax,[command_position] + add eax,5 + mov dl,' ' + call print_text + + popa + ret + + no_part: + + + cmp [irc_command],'JOIN' ; channel join + jne no_join + + ; compare nick + + mov eax,command+1 + call compare_to_nick + cmp [cresult],0 + jne no_new_window + + mov edi,I_END+120*80 + mov eax,1 ; create channel window - search for empty slot + newse: + mov ebx,eax + shl ebx,5 + cmp dword [channel_list+ebx],dword ' ' + je free_found + add edi,120*80 + inc eax + cmp eax,[max_windows] + jb newse + + free_found: + + mov edx,[command_position] + add edx,6 + + push eax + push edx + mov ecx,0 + finde: + inc ecx + inc edx + movzx eax,byte [edx] + cmp eax,'#' + jge finde + mov [channel_list+ebx+31],cl + pop edx + pop eax + + call create_channel_name + + push edi + push eax + mov [edi+120*60+8],byte 0 ; channel window + mov eax,32 + mov ecx,120*60 + cld + rep stosb + pop eax + pop edi + + ; eax has the free position + mov [thread_screen],edi + call create_channel_window + + no_new_window: + + mov eax,[command_position] + add eax,6 + call set_channel + + mov eax,action_header_blue + mov dl,0 + call print_text + mov eax,command+1 + mov dl,'!' + mov cl,' ' + call print_text + + mov eax,joins_channel + mov dl,0 + call print_text + + mov eax,[command_position] + add eax,6 + mov dl,0 + call print_text + + popa + ret + + no_join: + + + cmp [irc_command],'NICK' ; nick change + jne no_nick_change + + mov [text_start],I_END + add [text_start],120*80 + + new_all_channels3: + + mov eax,action_header_short + mov dl,0 + call print_text + mov eax,command+1 + mov dl,'!' + call print_text + mov eax,is_now_known_as + mov dl,0 + call print_text + mov eax,[command_position] + add eax,6 + mov dl,0 + call print_text + + add [text_start],120*80 + cmp [text_start],I_END+120*80*20 + jb new_all_channels3 + + popa + ret + + no_nick_change: + + + cmp [irc_command],'KICK' ; kick + jne no_kick + + mov [text_start],I_END + add [text_start],120*80 + + mov eax,[command_position] + add eax,5 + call set_channel + +; new_all_channels4: + + mov eax,action_header_short + mov dl,0 + call print_text + mov eax,command+1 + mov dl,'!' + call print_text + mov eax,kicked + mov dl,0 + call print_text + mov eax,[command_position] + add eax,5 + mov dl,0 + call print_text + +; add [text_start],120*80 +; cmp [text_start],I_END+120*80*20 +; jb new_all_channels4 + + popa + ret + + no_kick: + + + + + cmp [irc_command],'QUIT' ; irc quit + jne no_quit + + mov [text_start],I_END + add [text_start],120*80 + + new_all_channels2: + + mov eax,action_header_red + mov dl,0 + call print_text + mov eax,command+1 + mov dl,'!' + call print_text + mov eax,has_quit_irc + mov dl,0 + call print_text + + add [text_start],120*80 + cmp [text_start],I_END+120*80*20 + jb new_all_channels2 + + popa + ret + + no_quit: + + + cmp [irc_command],dword 'MODE' ; channel mode change + jne no_mode + + mov [text_start],I_END + add [text_start],120*80 + + mov eax,[command_position] + add eax,5 + call set_channel + + new_all_channels: + + mov eax,action_header_short + mov dl,0 + call print_text + + call print_nick + + mov eax,sets_mode + mov dl,0 + call print_text + + mov eax,[command_position] + add eax,5 + mov dl,0 + call print_text + +; add [text_start],120*80 +; cmp [text_start],I_END+120*80*20 +; jb new_all_channels + + popa + ret + + no_mode: + + + cmp [irc_command],dword '353 ' ; channel user names + jne no_user_list + + mov eax,[command_position] + finde2: + inc eax + cmp [eax],byte '#' + jne finde2 + call set_channel + + finde3: + inc eax + cmp [eax],byte ':' + jne finde3 + + pusha + cmp [user_list_pos],0 + jne no_clear_user_list + mov edi,[text_start] + add edi,120*70 + mov [edi-8],dword 0 + mov [edi-4],dword 0 + mov eax,32 + mov ecx,1200 + cld + rep stosb + no_clear_user_list: + popa + + push eax + + mov esi,eax + inc esi + mov edi,[text_start] + add edi,120*70 + add edi,[user_list_pos] + mov edx,edi + mov ecx,command + add ecx,[cmd] + sub ecx,[esp] + sub ecx,3 + and ecx,0xfff + cld + rep movsb + + pop eax + mov ebx,command + add ebx,[cmd] + sub ebx,eax + sub ebx,2 + mov [edx+ebx-1],dword ' ' + + add [user_list_pos],ebx + + mov eax,[user_list_pos] + mov ebx,[text_start] + add ebx,120*70 + mov [ebx-4],eax + + popa + ret + + user_list_pos dd 0x0 + + no_user_list: + + + cmp [irc_command],dword '366 ' ; channel user names end + jne no_user_list_end + + mov [user_list_pos],0 + + popa + ret + + no_user_list_end: + + mov [command],byte '-' + call print_command_to_main + + popa + + ret + + +cresult db 0 + +compare_to_nick: + +; input : eax = start of compare +; output : [cresult] = 0 if match, [cresult]=1 if no match + + + pusha + + mov esi,eax + mov edi,0 + + new_nick_compare: + + mov bl,byte [esi] + mov cl,byte [user_nick+4+edi] + + cmp bl,cl + jne nonickm + + add esi,1 + add edi,1 + + cmp edi,[user_nick] + jb new_nick_compare + + movzx eax,byte [esi] + cmp eax,40 + jge nonickm + + popa + mov [cresult],0 + ret + + nonickm: + + popa + mov [cresult],1 + ret + + + + + +print_command_to_main: + + pusha + + mov [text_start],I_END + mov ecx,[rxs] + imul ecx,11 + mov [pos],ecx + + mov bl,13 + call print_character + mov bl,10 + call print_character + + mov ecx,[cmd] + sub ecx,2 + mov esi,command + newcmdc2: + mov bl,[esi] + call print_character + inc esi + loop newcmdc2 + + mov edx,I_END + call draw_channel_text + + popa + + ret + + + + +print_text: + + pusha + + mov ecx,command-2 + add ecx,[cmd] + + ptr2: + mov bl,[eax] + cmp bl,dl + je ptr_ret + cmp bl,0 + je ptr_ret + call print_character + inc eax + cmp eax,ecx + jbe ptr2 + + ptr_ret: + + mov eax,[text_start] + mov [eax+120*60],byte 1 + + popa + ret + + + +print_character: + + pusha + + cmp bl,13 ; line beginning + jne nobol + mov ecx,[pos] + add ecx,1 + boll1: + sub ecx,1 + mov eax,ecx + xor edx,edx + mov ebx,[rxs] + div ebx + cmp edx,0 + jne boll1 + mov [pos],ecx + jmp newdata + nobol: + + cmp bl,10 ; line down + jne nolf + addx1: + add [pos],dword 1 + mov eax,[pos] + xor edx,edx + mov ecx,[rxs] + div ecx + cmp edx,0 + jnz addx1 + mov eax,[pos] + jmp cm1 + nolf: + no_lf_ret: + + + cmp bl,15 ; character + jbe newdata + + mov eax,[irc_data] + shl eax,8 + mov al,bl + mov [irc_data],eax + + mov eax,[pos] + call draw_data + + mov eax,[pos] + add eax,1 + cm1: + mov ebx,[scroll+4] + imul ebx,[rxs] + cmp eax,ebx + jb noeaxz + + mov esi,[text_start] + add esi,[rxs] + + mov edi,[text_start] + mov ecx,ebx + cld + rep movsb + + mov esi,[text_start] + mov ecx,[rxs] + imul ecx,61 + add esi,ecx + + mov edi,[text_start] + mov ecx,[rxs] + imul ecx,60 + add edi,ecx + mov ecx,ebx + cld + rep movsb + + mov eax,ebx + sub eax,[rxs] + noeaxz: + mov [pos],eax + + newdata: + + mov eax,[text_start] + mov [eax+120*60],byte 1 + + popa + ret + + + +draw_data: + + pusha + + and ebx,0xff + + cmp bl,0xe4 ; finnish a + jne noe4 + mov bl,0xc1 + noe4: + cmp bl,0xc4 ; ? + jne noc4 + mov bl,0xc9 + noc4: + + cmp ebx,229 ; swedish a + jne no_swedish_a + mov bl,192 + no_swedish_a: + + add eax,[text_start] + mov [eax],bl + + popa + ret + + + +read_incoming_byte: + + mov eax, 53 + mov ebx, 2 + mov ecx, [socket] + int 0x40 + + mov ecx,-1 + + cmp eax,0 + je no_more_data + + mov eax, 53 + mov ebx, 3 + mov ecx, [socket] + int 0x40 + + mov ecx,0 + + no_more_data: + + ret + + + +draw_window: + + pusha + + mov eax,12 + mov ebx,1 + int 0x40 + + mov [old_status],300 + + mov eax,0 ; draw window + mov ebx,5*65536+499 + mov ecx,5*65536+345 + mov edx,[wcolor] + add edx,0x03ffffff + mov esi,0x80555599 + mov edi,0x00ffffff + int 0x40 + + mov eax,4 ; label + mov ebx,9*65536+8 + mov ecx,0x10ffffff + mov edx,labelt + mov esi,labellen-labelt + int 0x40 + + mov eax,8 ; button: open socket + mov ebx,43*65536+22 + mov ecx,229*65536+10 + mov edx,22 + mov esi,[main_button] + int 0x40 + + mov eax,8 ; button: send userinfo + mov ebx,180*65536+22 + mov ecx,229*65536+10 + mov edx,23 + int 0x40 + + mov eax,8 ; button: close socket + mov ebx,317*65536+22 + mov ecx,229*65536+10 + mov edx,24 + int 0x40 + + mov eax,38 ; line + mov ebx,5*65536+494 + mov ecx,148*65536+148 + mov edx,[main_line] + int 0x40 + add ecx,1*65536+1 +; mov edx,0x5555cc +; int 0x40 + + mov eax,38 ; line + mov ebx,5*65536+494 + mov ecx,166*65536+166 + int 0x40 + add ecx,1*65536+1 +; mov edx,0x5555cc +; int 0x40 + + mov eax,38 ; line + mov ebx,410*65536+410 + mov ecx,22*65536+148 + int 0x40 + add ebx,1*65536+1 +; mov edx,0x5555cc +; int 0x40 + + mov ebx,25*65536+183 ; info text + mov ecx,0x000000 + mov edx,text + mov esi,70 + newline: + mov eax,4 + int 0x40 + add ebx,12 + add edx,70 + cmp [edx],byte 'x' + jne newline + + mov edx,I_END ; text from server + call draw_channel_text + + mov eax,12 + mov ebx,2 + int 0x40 + + popa + + ret + +main_line dd 0x000000 +main_button dd 0x6565cc + + +text: + +db ' Real name : Joe User - change with eg /areal Jill User ' +db ' Nick : AIRC - change with eg /anick Jill ' +db ' Server : 192.168.1.1 - change with eg /aserv 192.168.1.24 ' +db ' ' +db ' 1) Open socket 2) Send userinfo Close socket ' +db ' ' +db ' Commands after established connection: ' +db ' ' +db ' /join #ChannelName - eg /join #menuet ' +db ' /part #ChannelName - eg /part #linux ' +db ' /query Nickname - eg /query Mary ' +db ' /quit - Quit server and Close socket ' + +db 'x <- END MARKER, DONT DELETE ' + + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +; CHANNEL THREADS +; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + + +channel_thread: + + mov ebp,[thread_nro] + mov eax,ebp + shl eax,14 + add eax,0x80000 + mov esp,eax + + mov edi,ebp ; clear thread memory + imul edi,120*80 + add edi,I_END + mov ecx,120*80 + mov eax,32 + cld +; rep stosb + + mov edx,[thread_screen] + + call thread_draw_window + + w_t: + + mov esi,ebp + imul esi,120*80 + add esi,I_END + cmp [esi+120*60+4],byte 1 + jne no_channel_leave + mov [esi+120*60+4],byte 0 + mov edi,ebp + shl edi,5 + mov dword [channel_list+edi],dword ' ' + mov byte [channel_list+edi+31],byte 1 + mov eax,-1 + int 0x40 + no_channel_leave: + + call check_mouse + + mov eax,23 + mov ebx,1 + int 0x40 + + cmp eax,1 + jne no_draw_window + call thread_draw_window + call draw_channel_text + call print_user_list + no_draw_window: + + cmp eax,2 + je thread_key + + cmp eax,3 + jne no_end + mov eax,17 + int 0x40 + mov eax,ebp + imul eax,120*80 + add eax,I_END + cmp [eax+120*60+8],byte 0 ; channel window + je not_close + mov eax,ebp + shl eax,5 + add eax,channel_list + mov [eax],dword ' ' + mov [eax+31],byte 1 + mov eax,-1 + int 0x40 + not_close: + mov [text_start],eax + mov eax,nocl + newcc: + mov bl,[eax] + call print_character + inc eax + cmp [eax],byte 0 + jne newcc + call draw_channel_text + jmp w_t + nocl: db 13,10,'To exit channel, use PART or QUIT command.',0 + no_end: + + cmp [edx+120*60],byte 1 + jne no_update + mov [edx+120*60],byte 0 + call draw_channel_text + no_update: + + test [cursor_on_off],0x3f + jnz nopri2 + + call blink_cursor + call print_user_list + + nopri2: + + jmp w_t + + + +check_mouse: + + pusha + + mov eax,37 + mov ebx,1 + int 0x40 + + mov ebx,eax + shr eax,16 + and ebx,0xffff + + cmp eax,420 + jb no_mouse + cmp eax,494 + jg no_mouse + + cmp ebx,145 + jg no_mouse + cmp ebx,23 + jb no_mouse + + + cmp ebx,100 + jb no_plus + mov eax,ebp + imul eax,120*80 + add eax,120*70+I_END + inc dword [eax-8] + call print_user_list + mov eax,5 + mov ebx,8 + int 0x40 + jmp no_mouse + no_plus: + + cmp ebx,80 + jg no_mouse + mov eax,ebp + imul eax,120*80 + add eax,120*70+I_END + cmp dword [eax-8],dword 0 + je no_mouse + dec dword [eax-8] + call print_user_list + mov eax,5 + mov ebx,8 + int 0x40 + + no_minus: + + no_mouse: + + popa + + ret + + + + +thread_key: + + mov eax,2 + int 0x40 + + shr eax,8 + + cmp eax,8 + jne no_bks + cmp [xpos],0 + je w_t + dec [xpos] + call print_entry + jmp w_t + no_bks: + + cmp eax,20 + jbe no_character + mov ebx,[xpos] + mov [send_string+ebx],al + inc [xpos] + cmp [xpos],80 + jb xpok + mov [xpos],79 + xpok: + call print_entry + jmp w_t + no_character: + + cmp eax,13 + jne no_send + cmp [xpos],0 + je no_send + mov dword [send_to_channel],ebp + mov [send_to_server],1 + wait_for_sending: + mov eax,5 + mov ebx,1 + int 0x40 + cmp [send_to_server],1 + je wait_for_sending + call draw_channel_text + call print_entry + jmp w_t + no_send: + + jmp w_t + + + + + + +draw_channel_text: + + pusha + + mov eax,4 + mov ebx,10*65536+26 + mov ecx,12 + mov esi,[rxs] + dct: + pusha + mov cx,bx + shl ecx,16 + mov cx,9 + mov eax,13 + mov ebx,10*65536 + mov bx,word [rxs] + imul bx,6 + mov edx,0xffffff + int 0x40 + popa + push ecx + mov eax,4 + mov ecx,0 + cmp [edx],word '* ' + jne no_red + mov ecx,0x0000ff + no_red: + cmp [edx],word '**' + jne no_light_blue + cmp [edx+2],byte '*' + jne no_light_blue + mov ecx,0x0000ff + no_light_blue: + cmp [edx],byte '#' + jne no_blue + mov ecx,0x0000ff + no_blue: + int 0x40 + add edx,[rxs] + add ebx,10 + pop ecx + loop dct + + popa + ret + + + + + +thread_draw_window: + + pusha + + mov eax,12 + mov ebx,1 + int 0x40 + + mov ebx,ebp ; draw window + shl ebx,16+4 + mov eax,0 + mov ecx,ebx + mov bx,499 + mov cx,170 + +; mov edx,ebp ; draw window +; imul edx,120*80 +; add edx,I_END+120*60+8 +; movzx edx,byte [edx] +; imul edx,88 +; sub bx,dx + + mov edx,[wcolor] + add edx,0x03ffffff + mov esi,0x80555599 + mov edi,0x00ffffff + + int 0x40 + + mov eax,ebp ; label + add eax,48 + mov [labelc+14],al + mov eax,ebp + shl eax,5 + add eax,channel_list + mov esi,eax + mov edi,labelc+17 + movzx ecx,byte [eax+31] + cld + rep movsb + + mov esi,17 ; print label + movzx ebx,byte [eax+31] + add esi,ebx + mov eax,4 + mov ebx,9*65536+8 + mov ecx,0x00ffffff + mov edx,labelc + int 0x40 + + mov eax,38 ; line + mov ebx,5*65536+494 + mov ecx,148*65536+148 + mov edx,[channel_line_sun] + int 0x40 + add ecx,1*65536+1 + mov edx,[channel_line_shadow] + int 0x40 + + + mov eax,38 ; line + mov ebx,410*65536+410 + mov ecx,22*65536+148 + mov edx,[channel_line_sun] + int 0x40 + add ebx,1*65536+1 + mov edx,[channel_line_shadow] + int 0x40 + + mov eax,12 + mov ebx,2 + int 0x40 + + popa + + ret + + + +; DATA AREA + +socket dd 0x0 + +bgc dd 0x000000 + dd 0x000000 + dd 0x00ff00 + dd 0x0000ff + dd 0x005500 + dd 0xff00ff + dd 0x00ffff + dd 0x770077 + +tc dd 0xffffff + dd 0xff00ff + dd 0xffffff + dd 0xffffff + dd 0xffffff + dd 0xffffff + dd 0xffffff + dd 0xffffff + +channel_line_sun dd 0x9999ff +channel_line_shadow dd 0x666699 + +cursor_on_off dd 0x0 + +max_windows dd 20 + +thread_stack dd 0x9fff0 +thread_nro dd 1 +thread_screen dd I_END+120*80*1 + +action_header_blue db 10,'*** ',0 +action_header_red db 10,'*** ',0 + +action_header_short db 10,'* ',0 + +has_left_channel db ' left channel ',0 +joins_channel db ' joined channel ',0 +is_now_known_as db ' is now known as ',0 +has_quit_irc db ' has quit irc',0 +sets_mode db ' sets mode ',0 +kicked db ' kicked from ',0 + +index_list_1 dd 0x0000bb +index_list_2 dd 0x0000ff + +posx dd 0x0 +incoming_pos dd 0x0 +incoming_string: times 128 db 0 + +pos dd 0x0 + +text_start dd I_END +irc_data dd 0x0 +print db 0x0 +cmd dd 0x0 +rxs dd 66 + +res: db 0,0 +command: times 600 db 0x0 + +nick dd 0,0,0 +irc_command dd 0,0 + +command_position dd 0x0 +counter dd 0 +send_to_server db 0 + +channel_list: times 32*20 db 32 +send_to_channel dd 0x0 + +send_string_header: db 'privmsg #eax :' + times 100 db 0x0 + +send_string: times 100 db 0x0 +xpos dd 0 + +string0: db 'USER guest ser1 ser2 :' +string0l: +string1: db 'nick ' +string1l: + +attribute dd 0 +scroll dd 1 + dd 12 + +numtext db ' ' + +wcolor dd 0x000000 + +labelc db 'AIRC - WINDOW X: #xxx ' +labelt db 'IRC client ',version +labellen: + +;; +;; Channel data at I_END +;; +;; 120*80 * channel window (1+) +;; +;; At Size +;; +;; 00 , 120*60 window text 120 characters per row +;; 120*60 , 1 text is updated +;; 120*60+4 , 1 close yourself +;; 120*60+8 , 1 0 = channel window : 1 = private chat +;; 120*61 , 256 channel name +;; 120*61+254 , 254 channel entry text from user +;; 120*61+255 , 1 length of entry text +;; 120*69+248 , 4 display names from n:th name +;; 120*69+252 , 4 length of names string +;; 120*70 , 1200 names separated with space +;; +I_END: ;; diff --git a/programs/airc/trunk/build_en.bat b/programs/airc/trunk/build_en.bat new file mode 100644 index 0000000000..e9c13ce8aa --- /dev/null +++ b/programs/airc/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm airc.asm airc +@pause \ No newline at end of file diff --git a/programs/airc/trunk/build_ru.bat b/programs/airc/trunk/build_ru.bat new file mode 100644 index 0000000000..e98562ee24 --- /dev/null +++ b/programs/airc/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm airc.asm airc +@pause \ No newline at end of file diff --git a/programs/airc/trunk/macros.inc b/programs/airc/trunk/macros.inc new file mode 100644 index 0000000000..1d153e8723 --- /dev/null +++ b/programs/airc/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 + +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 \ No newline at end of file diff --git a/programs/arcanii/trunk/arcanii.asm b/programs/arcanii/trunk/arcanii.asm new file mode 100644 index 0000000000..3c663ad72f --- /dev/null +++ b/programs/arcanii/trunk/arcanii.asm @@ -0,0 +1,921 @@ +VERSION equ 'ARCANOID II v. 0.30' +; by jj +; (jacek jerzy malinowski) +; +; contact: 4nic8@casiocalc.org +;---------------------------------------- +; Compile with FASM for Menuet +;---------------------------------------- + +include 'lang.inc' +include 'ascl.inc' +include 'ascgl.inc' +include 'asjc.inc' + +X_SIZE equ 400 +Y_SIZE equ 300 + +MAX_LEVEL equ 5 + +BACK_CL equ 0x00EFEF ; background color + +; THE MAIN PROGRAM: +use32 + + org 0x0 + + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd I_END ; size of image + dd 0x200000 ; memory for app + dd 0x7fff0 ; esp + dd 0x0 , 0x0 ; I_Param , I_Icon + +START: ; start of execution + + bmptoimg bmp_file,img_bmp ; loading ... ;] + getimg img_bmp,0,0,10,10,img_ball + getimg img_bmp,20,0,20,10,img_bonus + getimg img_bmp,0,10,40,20,img_brick1 + getimg img_bmp,0,30,40,20,img_brick2 + getimg img_bmp,0,50,40,20,img_brick3 + getimg img_bmp,0,70,40,20,img_brick4 + + call draw_window + +still: + if_e dword [level],0,.no_intro + call intro + jmp .no_game + .no_intro: + + if_e dword [mode],2,.end_if1 + call level_info + jmp .no_game + .end_if1: + + if_e dword [mode],4,.end_if2 + call game_over + jmp .no_game + .end_if2: + + call fast_gfx ; <-- the main engine + .no_game: + + mov eax,11 + 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 + jmp still + + key: ; key + mov eax,2 ; just read it and ignore + int 0x40 + cmp ah,key_Esc ; if Esc ? + jne .no_q + mov eax,-1 + int 0x40 + .no_q: + + if_e dword [mode],4,.end_if6 + jmp still + .end_if6: + + cmp ah,key_Space + jne .no_space + if_e dword [mode],2,.end_if1 + mov dword [mode],0 + jmp .no_space + .end_if1: + mov dword [mode],1 + call fast_gfx + .no_space: + xor ebx,ebx + mov bl,ah + if_e ebx,key_F1,.no_f1 + inc dword [del] + .no_f1: + if_e ebx,key_F2,.no_f2 + if_a dword [del],0,.end_if3 + dec dword [del] + .end_if3: + .no_f2: + + + jmp still + + button: ; button + mov eax,17 ; get id + int 0x40 + + cmp ah,1 ; button id=1 ? + jne noclose + + mov eax,-1 ; close this program + int 0x40 + noclose: + + jmp still + +; ********************************************* +; ******* VIRTUAL SCREEN FUNCTIONS ************ +; ********************************************* + +show_screen: ; flips the virtual screen to the window + push_abc + + mov eax,7 + mov ebx,screen + mov ecx,X_SIZE*65536+Y_SIZE + mov edx,4*65536+20 + int 0x40 + + pop_abc +ret + +put_bmp_screen: ; eax - y , ebx - x, esi - bmp + cmp ebx,X_SIZE-5 + jb .ok1 + ret + .ok1: + cmp eax,Y_SIZE-5 + jb .ok2 + ret + .ok2: + + push_abc + xor ecx,ecx + xor edx,edx + mov edi,screen + mov ecx,3 + mul ecx ; xx = 3*y*X_SIZE+3*x + mov ecx,X_SIZE + mul ecx + push eax ; #> 1 + mov eax,ebx + mov ecx,3 + mul ecx + mov ebx,eax + pop edx ; #< 1 + add edx,ebx + add edi,edx ; sets the pointer to x,y of the screen + + mov cx,[si] ; loops 1 + xor ebx,ebx + mov ax,cx + mov dx,3 + mul dx + mov bx,ax + + push ebx ;#>4 + + add si,4 + mov ax,[si] ; loops 2 + mov cx,[si] + ;shr ax,2 + mov dx,3 ; dx = ax *3 + mul dx + mov bx,ax + add si,4 + + + pop ebx ;#<4 + .l_y: + mov ax,cx + cld + mov cx,bx + rep movs byte [edi],[esi] + add edi,X_SIZE + add edi,X_SIZE + add edi,X_SIZE + sub edi,ebx + mov cx,ax + loop .l_y + + pop_abc +ret + +rect_screen: ; eax - y , ebx - x, ecx - size x, edx - size y, si -color + mov edi,ebx + add ebx,ecx + cmp ebx,X_SIZE + jb .ok1 + ret + .ok1: + mov ebx,edi + + mov edi,eax + add eax,edx + cmp eax,Y_SIZE + jb .ok2 + ret + .ok2: + mov eax,edi + push_abc + push ecx ;#>2 + push edx ;#>3 + + xor ecx,ecx + xor edx,edx + mov edi,screen + mov ecx,3 + mul ecx ; xx = 3*y*X_SIZE+3*x + mov ecx,X_SIZE + mul ecx + push eax ; #> 1 + mov eax,ebx + mov ecx,3 + mul ecx + mov ebx,eax + pop edx ; #< 1 + add edx,ebx + + add edi,edx ; sets the pointer to x,y of the screen + + pop ecx ; #<3 + pop edx ; #<4 + mov eax,esi + .l_y: + ;mov ax,cx + push ecx + cld + mov ecx,edx + .l_x: + ;rep movs byte [edi],[esi] + mov word [edi],ax + push eax + shr eax,16 + mov byte [edi+2],al + add edi,3 + pop eax + loop .l_x + + add edi,X_SIZE + add edi,X_SIZE + add edi,X_SIZE + sub edi,edx + sub edi,edx + sub edi,edx + ;mov cx,ax + pop ecx + loop .l_y + + pop_abc +ret + +grad_rect_screen: ; eax - y , ebx - x, ecx - size x, edx - size y, si -color, d + push edi ;#>0 + mov edi,ebx + add ebx,ecx + cmp ebx,X_SIZE + jb .ok1 + pop edi ;#<0 + ret + .ok1: + mov ebx,edi + + mov edi,eax + add eax,edx + cmp eax,Y_SIZE + jb .ok2 + pop edi ;#<0 + ret + .ok2: + mov eax,edi + + pop edi ;#<0 + push_abc + + push edi ;#>5 + push ecx ;#>2 + push edx ;#>3 + + xor ecx,ecx + xor edx,edx + mov edi,screen + mov ecx,3 + mul ecx ; xx = 3*y*X_SIZE+3*x + mov ecx,X_SIZE + mul ecx + push eax ; #> 1 + mov eax,ebx + mov ecx,3 + mul ecx + mov ebx,eax + pop edx ; #< 1 + add edx,ebx + + add edi,edx ; sets the pointer to x,y of the screen + + pop ecx ; #<3 + pop edx ; #<2 + mov eax,esi + pop esi ; #<5 + .l_y: + ;mov ax,cx + push ecx + cld + mov ecx,edx + .l_x: + ;rep movs byte [edi],[esi] + mov word [edi],ax + push eax + shr eax,16 + mov byte [edi+2],al + add edi,3 + pop eax + loop .l_x + + add edi,X_SIZE + add edi,X_SIZE + add edi,X_SIZE + sub edi,edx + sub edi,edx + sub edi,edx + add eax,esi + ;mov cx,ax + pop ecx + loop .l_y + + pop_abc +ret + + +fill_screen: ; eax - screen color ( 0x00RRGGBB ) + push_abc + mov edi,screen + cld + mov ecx,X_SIZE*Y_SIZE + .lab1: + mov [edi],eax + add edi,3 + loop .lab1 + pop_abc +ret + +grad_fill_screen: ; eax - screen color ( 0x00RRGGBB ), ebx - mack + push_abc + mov edi,screen + cld + mov ecx,Y_SIZE + mov dl,0 + .lab1: + push ecx + mov ecx,X_SIZE + .lab2: + mov [edi],eax + add edi,3 + loop .lab2 + mov dh,1 ; dl = 1 - dl + sub dh,dl + mov dl,dh + cmp dl,0 + jne .no_ch ; if (dl==0) + add eax,ebx ; change gradient + .no_ch: + pop ecx + loop .lab1 + pop_abc +ret + + +bmp_fill_screen: ; esi - pointer to a backgroung bmp + push_abc + mov edi,screen + cld + mov ecx,X_SIZE*Y_SIZE + rep movs dword [edi],[esi] + pop_abc +ret + +;___________________ +intro: ; INTRO ; + label 140,200,VERSION,0x100000FF + label 120,220,'by jj (jacek jerzy malinowski)',0x050505 + label 100,240,'press SPACE to start a new game',0x10FF0800 + label 15,240,'F1 + delay',0xFFA8FF + label 15,260,'F2 + delay',0xFFA8FF + delay 10 +ret + +;___________________ +level_info: + label 170,230,'L E V E L',0x100000FF + outcount [level],195,250,0x100000FF,2*65536 + label 100,270,'press SPACE to start the level',0x10FF0800 + delay 10 +ret + +;_________________________ +game_over: ; GAME OVER ; + mov eax,0x00FF00 + mov ebx,0xFF01 + .g_ok: + call grad_fill_screen + call show_screen ; flips the screen + label 120,150,'G A M E O V E R',0x10050505 + label 140,200,'Thanks for playing',0x0FFF800 + delay 20 +ret + + +;-----------------------------; +; THE MAIN THE GAME'S ENGINE ; +;-----------------------------; +fast_gfx: + ; the background gradient + if_e dword [level],0,.no_0 + mov eax,0xFF + mov ebx,0xFEFF + jmp .g_ok + .no_0: + if_e dword [level],1,.no_1 + mov eax,BACK_CL + mov ebx,0xFFFF + jmp .g_ok + .no_1: + if_e dword [level],2,.no_2 + mov eax,0xFF0000 + mov ebx,0xFF00FF + jmp .g_ok + .no_2: + + mov eax,BACK_CL + mov ebx,0xFFFF + .g_ok: + call grad_fill_screen + + mov eax,37 ; get mouse position + mov ebx,1 + int 0x40 + shr eax,16 + mov [x],eax + add eax,[s_x] + cmp eax,X_SIZE ; controls if the pad is in the screen + jb .ok + cmp eax,0x7FFF ; if < 0 + jb .upper + mov [x],0 + jmp .ok + .upper: ; if > X_SIZE - pad size + mov dword [x],X_SIZE-1 + mov eax,[s_x] + sub dword [x],eax + .ok: + mov ebx,[x] + mov eax,[y] + mov ecx,[s_x] + mov edx,15 + mov esi,0xFF0000 + mov edi,0xF0000F + call grad_rect_screen + + call draw_level + + cmp dword [mode],1 + jne .no_go ; is the game started ? + mov eax,[v_x] + add dword [b_x],eax + mov eax,[v_y] + add dword [b_y],eax + jmp .go + .no_go: + mov eax,[x] ; b_x = x + x_s/2 + mov ebx,[s_x] + shr ebx,1 + add eax,ebx + mov dword [b_x],eax + mov eax,[y] ; b_y = y - 10 + sub eax,10 + mov dword [b_y],eax + + mov dword [v_x],1 + mov dword [v_y],-1 + .go: + ;TEST WHERE IS THE BALL: + cmp dword [b_x],0x7FFFFFFF + jb .b_ok2 ; if out of the screen (left) + mov dword [b_x],0 + mov eax,0 + sub eax,[v_x] + mov [v_x],eax + .b_ok2: + cmp dword [b_x],X_SIZE-10 + jb .b_ok1 ; if out of the screen (right) + mov dword [b_x],X_SIZE-11 + mov eax,0 + sub eax,[v_x] + mov [v_x],eax + .b_ok1: + cmp dword [b_y],0x7FFFFFFF + jb .b_ok3 ; if out of the screen (up) + mov dword [b_y],0 + mov eax,0 + sub eax,[v_y] + mov [v_y],eax + .b_ok3: + cmp dword [b_y],Y_SIZE-10 + jb .b_ok4 ; if out of the screen (down) + mov dword [mode],0 + if_e dword [lives],0,.end_if5 + mov dword [mode],4 ; GAME OVER + jmp still + .end_if5: + dec dword [lives] + .end_else4: + call draw_window + .b_ok4: + + imgtoimg img_ball,dword [b_x],dword [b_y],screen_img + + call show_screen ; flips the screen + delay dword [del] + + call do_tests ; does all needed tests +ret +;----------------------; +; BALL & BRICKS EVENTS ; +;----------------------; +MAX_SPEED equ 3 +do_tests: + ; BALL <-> PAD + mov eax,[b_x] + add eax,10 + cmp eax,[x] ; if (b_x+10)>[pad x] + jb .skip ; && + mov eax,[b_x] + mov ebx,[s_x] + add ebx,[x] + cmp eax,ebx ; if b_x < x + s_x + ja .skip ; && + mov eax,[b_y] + add eax,10 + cmp eax,[y] ; if (b_y+10) > y + jb .skip + sub eax,15 + cmp eax,[y] ; if b_y < y+15 + ja .skip + cmp dword [v_y],0x7FFFFF ; if v_y > 0 + ja .skip + cmp dword [v_y],MAX_SPEED; speedup: + ja .skip_s + inc dword [speed_t] + cmp dword [speed_t],5 + jb .skip_s + inc dword [v_y] + mov dword [speed_t],0 + .skip_s: + inc dword [speed_t] + mov eax,0 + sub eax,[v_y] + mov [v_y],eax + ;counting v_x:-------- + mov eax,[b_x] + sub eax,[x] + sub eax,5 + mov ecx,eax + if_a eax,100,.end_if3 + mov eax,0 + sub eax,[v_x] + mov [v_x],eax + jmp .skip + .end_if3: + if_a eax,20,.end_if2 + sub eax,20 + shr eax,2 + mov [v_x],eax + jmp .skip + .end_if2: + mov ebx,20 + sub ebx,ecx + shr ebx,2 + mov dword [v_x],0 + sub dword [v_x],ebx + .skip: + + ; BALL <-> BRICK + mov dword [coliz],0 + call colision + if_e dword [coliz],1,.end_if6 + ;abs dword [v_y] + ;abs dword [v_x] + ret + .end_if6: + add dword [b_x],10 + call colision + sub dword [b_x],10 + if_e dword [coliz],1,.end_if7 + ;abs dword [v_y] + ;abs dword [v_x] + ch_sign dword [v_x] + ret + .end_if7: + add dword [b_y],10 + call colision + sub dword [b_y],10 + if_e dword [coliz],1,.end_if8 + ;abs dword [v_y] + ;abs dword [v_x] + ;ch_sign dword [v_y] + ret + .end_if8: + add dword [b_x],10 + add dword [b_y],10 + call colision + sub dword [b_x],10 + sub dword [b_y],10 + if_e dword [coliz],1,.end_if9 + ;abs dword [v_y] + ;abs dword [v_x] + ;ch_sign dword [v_x] + ;ch_sign dword [v_y] + + ret + .end_if9: + + +ret + +colision: + + mov esi,levels + mov eax,[level] ; eax = levels*100 + mov bx,100 + mul bx + add esi,eax + ;-------------- + xor edx,edx + mov eax,[b_x] + mov ebx,40 + div ebx + mov ecx,eax + push edx ;#>1 + + xor edx,edx + mov eax,[b_y] + mov ebx,20 + div ebx + push edx ;#>2 + cmp eax,9 ; out of the bricks board + ja .ok2 + mov ebx,10 + mul ebx + add eax,ecx + add esi,eax + + cmp byte [esi],0 ; 0 - no brick + je .ok2 + if_ne byte [esi],4,.end_if1 + dec byte [esi] + .end_if1: + mov dword [coliz],1 + pop ebx ;#<2 + pop eax ;#<1 + cmp ecx,8 ; x < 5 || x >35 - x inv + jb .inv + cmp ecx,33 + ja .inv + jmp .no_inv + .inv: + mov eax,0 + sub eax,[v_x] + mov [v_x],eax + ;jmp .no_ok + .no_inv: + cmp ebx,6 ; if y < 5 || y>15 - y inv + jb .inv_y + cmp ebx,14 + ja .inv_y + jmp .no_ok + .inv_y: + mov eax,0 + sub eax,[v_y] + mov [v_y],eax + .no_ok: + jmp .ok + .ok2: + pop eax ;#<1 + pop eax ;#<2 + .ok: + + +ret + +;-----------------------------------; +; DRAWS CURRENT LEVEL ON THE SCREEN ; +;-----------------------------------; +draw_level: + mov esi,levels + mov eax,[level] ; eax = levels*100 + mov bx,100 + mul bx + add esi,eax + mov ecx,10 + mov eax,0 + mov dword [l_end],1 + .l_y: + push ecx ;#>1 + mov ebx,0 + mov ecx,10 + .l_x: + cmp byte [esi],1 ; if 1 ? + push esi;#>2 + jne .no_1 + mov esi,img_brick1 + call put_bmp_screen + mov dword [l_end],0 + .no_1: + cmp byte [esi],2 ; if 2 ? + jne .no_2 + mov esi,img_brick2 + call put_bmp_screen + mov dword [l_end],0 + .no_2: + cmp byte [esi],3 ; if 3 ? + jne .no_3 + mov esi,img_brick3 + call put_bmp_screen + mov dword [l_end],0 + .no_3: + cmp byte [esi],4 ; if 4 ? + jne .no_4 + mov esi,img_brick4 + call put_bmp_screen + .no_4: + + add ebx,40 + pop esi ;#<2 + inc esi + loop .l_x + add eax,20 ;#<1 + pop ecx + loop .l_y +;---------------- +; NEXT LEVEL + if_e dword [l_end],1,.end_if ; all bricks are taken + if_e dword [mode],1,.end_if + add dword [level],1 + if_a dword [level],MAX_LEVEL,.end_if2 + mov dword [mode],4 ; game over + jmp still + .end_if2: + call fast_gfx + mov dword [mode],2 + .end_if: +ret + +; ********************************************* +; ******* WINDOW DEFINITIONS AND DRAW ******** +; ********************************************* + + +draw_window: + + startwd + + window 100,100,X_SIZE+8,Y_SIZE+21,0x03ffffff + label 8,8,VERSION,cl_White+font_Big + label 200,8,'LIVES:',0x10ddeeff + outcount dword [lives],250,8,0x10ddeeff,65536 + + call fast_gfx + + endwd + + ret + +;-----------;#################### +; DATA AREA ;#################### +;-----------;#################### + + lives dd 5 + mode dd 0 + l_end dd 0 ; if 1 the level is over +; PAD x: + x dd 20 + y dd Y_SIZE-20 +; PAD length: + s_x dd 40 + +; the ball stuff ;-) + b_x dd 100 + b_y dd 250 + v_y dd 0 + v_x dd 3 + + speed_t dd 0 ; 1/10 times speedup + del dd 1 ; delay + + coliz dd 0 ; if 1 then colizion with a brick + +; LEVELS: +level dd 0 +levels: +;LEVEL 0: +db 0,0,0,0,0,0,0,0,0,0 +db 0,4,0,0,4,4,0,0,0,4 +db 4,0,4,0,4,0,4,0,4,0 +db 4,0,4,0,4,0,4,0,4,0 +db 4,4,4,0,4,4,0,0,4,0 +db 4,0,4,0,4,0,4,0,4,0 +db 4,0,4,0,4,0,4,0,0,4 +db 0,0,0,0,0,0,0,0,0,0 +db 0,0,0,0,0,0,0,0,0,0 +db 0,0,0,0,0,0,0,0,0,0 + +;LEVEL 1: +db 1,1,1,1,1,1,1,1,1,1 +db 0,3,0,0,3,3,0,0,0,3 +db 3,0,3,0,3,0,3,0,3,0 +db 3,0,3,0,3,0,3,0,3,0 +db 3,3,3,0,3,3,0,0,3,0 +db 3,0,3,0,3,0,3,0,3,0 +db 3,0,3,0,3,0,3,0,0,3 +db 2,2,2,2,2,2,2,2,2,2 +db 1,1,1,1,1,1,1,1,1,1 +db 1,1,1,1,1,1,1,1,1,1 +;LEVEL 2: +db 3,3,3,3,0,0,3,3,3,3 +db 3,1,1,1,0,0,1,1,1,3 +db 3,1,2,1,3,3,1,2,1,3 +db 0,1,0,1,3,3,1,0,1,0 +db 2,1,2,1,1,1,1,2,1,2 +db 0,1,0,1,2,2,1,0,1,0 +db 2,1,2,1,1,1,1,2,1,2 +db 0,1,0,1,1,1,1,0,1,0 +db 0,0,0,1,0,0,1,0,0,0 +db 0,0,0,1,0,0,1,0,0,0 +;LEVEL 3: +db 1,2,3,1,2,3,1,3,2,1 +db 2,3,1,2,3,1,3,3,1,2 +db 3,1,2,3,1,2,3,1,2,3 +db 1,2,3,1,2,3,1,3,2,1 +db 2,3,1,2,3,1,3,3,1,2 +db 3,1,2,3,1,2,3,1,2,3 +db 1,2,1,2,1,2,1,2,1,2 +db 1,0,1,0,1,0,1,0,1,0 +db 0,0,3,0,0,0,0,3,0,0 +db 0,0,3,0,0,0,0,3,0,0 +;LEVEL 4: +db 0,0,0,1,1,1,1,0,0,0 +db 0,0,1,2,2,2,2,1,0,0 +db 1,1,1,2,2,2,2,1,1,1 +db 1,0,1,0,2,2,0,1,0,1 +db 0,1,1,2,2,2,2,1,1,0 +db 0,0,1,2,2,2,2,1,0,0 +db 0,0,1,2,2,2,2,1,0,0 +db 0,0,1,2,3,3,2,1,0,0 +db 0,0,1,2,2,2,2,1,0,0 +db 0,0,0,1,1,1,1,0,0,0 +;LEVEL 5: +db 1,1,1,1,1,1,1,1,1,1 +db 1,2,0,0,3,2,0,0,2,1 +db 1,2,0,0,2,3,0,0,2,1 +db 2,2,0,0,3,2,0,0,2,2 +db 0,0,0,0,2,3,0,0,0,0 +db 0,0,0,1,1,1,1,0,0,0 +db 0,0,1,1,0,0,1,1,0,0 +db 0,0,1,1,0,0,1,1,0,0 +db 2,1,2,1,2,1,2,1,2,1 +db 1,2,1,2,1,2,1,2,1,2 + + +; BITMAPs and IMAGEs +bmp_file: + file 'arcanii.bmp' + +img_bmp: + rb 40*90*3+8 +img_brick1: + rb 40*20*3+8 +img_brick2: + rb 40*20*3+8 +img_brick3: + rb 40*20*3+8 +img_brick4: + rb 40*20*3+8 +img_ball: + rb 10*10*3+8 +img_bonus: + rb 20*10*3+8 + + +screen_img: + dd X_SIZE + dd Y_SIZE +screen: + rb X_SIZE*Y_SIZE*3 + +I_END: + diff --git a/programs/arcanii/trunk/arcanii.bmp b/programs/arcanii/trunk/arcanii.bmp new file mode 100644 index 0000000000..6e1d076692 Binary files /dev/null and b/programs/arcanii/trunk/arcanii.bmp differ diff --git a/programs/arcanii/trunk/ascgl.inc b/programs/arcanii/trunk/ascgl.inc new file mode 100644 index 0000000000..666850d23b --- /dev/null +++ b/programs/arcanii/trunk/ascgl.inc @@ -0,0 +1,1387 @@ +lang equ ru + +; +; Assembler +; SMALL +; CODE +; Graphics +; Libary +; +; Ver 0.18 By Pavlushin Evgeni (RUSSIA) +; www.waptap@mail.ru + +;InfoList +;0.01 LoadImage +;0.02 SetBmp +;0.03 Bmptoimg, Setimg ~01.03.2004 +;0.04 Bug deleted, copyimg ~03.05.2004 +;0.05 fullimg, collimg ~05.05.2004 +;0.06 getimg ~09.05.2004 +;0.07 convbmp ~13.05.2004 +;0.08 fps ~14.05.2004 +;0.09 drawfbox ~03.06.2004 +;0.10 all macros optimized by Halyavin A., add at ~07.06.2004 +;0.11 many macros optimized by Halyavin A., add at ~30.08.2004 +;0.12 bmptoimg ~07.09.2004 +;0.13 imgtoimg ~08.09.2004 +;0.14 imgtoimg modify not brake bmp pict! ~09.09.2004 +;0.15 giftoimg, giftoani ~10.09.2004 +;0.16 setframe, rgbtobgr, setbmp deleted ~20.09.2004 +;0.17 modification giftoimg, giftoani, getframeoff ~01.10.2004 +;0.18 aframetoimg,aimgtoimg,frametoimg ~03.10.2004 + +aframetoimg_use_count=0 +macro aframetoimg img, x, y, canvas,acol +{ +local loo,loo2,acolor +aframetoimg_use_count=aframetoimg_use_count+1 +if aframetoimg_use_count = 1 + + jmp end_aframetoimg_proc + +acolor dd 0 +aframetoimg_proc: +;getout coord + mov [acolor],ebp + + mov edx,ebx ;img ;xsize + movzx eax,word [edx] + add eax,esi ;y cor + +; mov eax,esi ;y cor + mul dword [ecx] ;canvas xsize + add eax,edi ;x cor + + mov ebp,ebx ;img ;xsize + movzx edx,word [ebp] + add eax,edx + + mov ebp,eax + shl eax,1 + add ebp,eax + add ebp,ecx ;canvas+8;start + add ebp,8 +;get img size + add ebx,4 + mov eax,ebx ;img ;xsize + movzx esi,word [eax] + movzx edi,word [eax+2] + add ebx,4 + mov edx,ebx ;img+8 +loo2: +push esi +loo: +;test on alpha color + mov eax,[edx] + shl eax,8 + shr eax,8 + cmp eax,[acolor] + jne yx + add edx,3 + add ebp,3 + jmp nx +yx: + + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx +nx: + dec esi + jnz loo +pop esi + sub ebp,3 + mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) + sub eax,esi + add ebp,eax + shl eax,1 + add ebp,eax + + add ebp,3 + + dec edi + jnz loo2 + ret +end_aframetoimg_proc: +end if + push img + push canvas + push x + push y + push acol + pop ebp + pop esi + pop edi + pop ecx + pop ebx + call aframetoimg_proc +} + +frametoimg_use_count=0 +macro frametoimg img, x, y, canvas +{ +local loo,loo2 +frametoimg_use_count=frametoimg_use_count+1 +if frametoimg_use_count = 1 + + jmp end_frametoimg_proc + +frametoimg_proc: +;getout coord + mov edx,ebx ;img ;xsize + movzx eax,word [edx] + add eax,esi ;y cor + +; mov eax,esi ;y cor + mul dword [ecx] ;canvas xsize + add eax,edi ;x cor + + mov ebp,ebx ;img ;xsize + movzx edx,word [ebp] + add eax,edx + + mov ebp,eax + shl eax,1 + add ebp,eax + add ebp,ecx ;canvas+8;start + add ebp,8 +;get img size + add ebx,4 + mov eax,ebx ;img ;xsize + movzx esi,word [eax] + movzx edi,word [eax+2] + add ebx,4 + mov edx,ebx ;img+8 +loo2: +push esi +loo: + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + + dec esi + jnz loo +pop esi + sub ebp,3 + mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) + sub eax,esi + add ebp,eax + shl eax,1 + add ebp,eax + + add ebp,3 + + dec edi + jnz loo2 + ret +end_frametoimg_proc: +end if + push img + push canvas + push x + push y + pop esi + pop edi + pop ecx + pop ebx + call frametoimg_proc +} + + +aimgtoimg_use_count=0 +macro aimgtoimg img, x, y, canvas,acol +{ +local loo,loo2,acolor +aimgtoimg_use_count=aimgtoimg_use_count+1 +if aimgtoimg_use_count = 1 + + jmp end_aimgtoimg_proc + +acolor dd 0 +aimgtoimg_proc: +;getout coord + mov [acolor],ebp + + mov eax,esi ;y cor + mul dword [ecx] ;canvas xsize + add eax,edi ;x cor + mov ebp,eax + shl eax,1 + add ebp,eax + add ebp,ecx ;canvas+8;start + add ebp,8 +;get img size + mov eax,ebx ;img ;xsize + mov esi,[eax] + add ebx,4 + mov eax,ebx ; img+4 ;ysize + mov edi,[eax] + add ebx,4 + mov edx,ebx ;img+8 +loo2: +push esi +loo: + +;test on alpha color + mov eax,[edx] + shl eax,8 + shr eax,8 + cmp eax,[acolor] + jne yx + add edx,3 + add ebp,3 + jmp nx +yx: + + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx +nx: + dec esi + jnz loo +pop esi + sub ebp,3 + mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) + sub eax,esi + add ebp,eax + shl eax,1 + add ebp,eax + + add ebp,3 + + dec edi + jnz loo2 + ret +end_aimgtoimg_proc: +end if + push img + push canvas + push x + push y + push acol + pop ebp + pop esi + pop edi + pop ecx + pop ebx + call aimgtoimg_proc +} + + + + +imgtoimg_use_count=0 +macro imgtoimg img, x, y, canvas +{ +local loo,loo2 +imgtoimg_use_count=imgtoimg_use_count+1 +if imgtoimg_use_count = 1 + + jmp end_imgtoimg_proc +imgtoimg_proc: +;getout coord + mov eax,esi ;y cor + mul dword [ecx] ;canvas xsize + add eax,edi ;x cor + mov ebp,eax + shl eax,1 + add ebp,eax + add ebp,ecx ;canvas+8;start + add ebp,8 +;get img size + mov eax,ebx ;img ;xsize + mov esi,[eax] + add ebx,4 + mov eax,ebx ; img+4 ;ysize + mov edi,[eax] + add ebx,4 + mov edx,ebx ;img+8 +loo2: +push esi +loo: + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + dec esi + jnz loo +pop esi + sub ebp,3 + mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) + sub eax,esi + add ebp,eax + shl eax,1 + add ebp,eax + + add ebp,3 + + dec edi + jnz loo2 + ret +end_imgtoimg_proc: +end if + push img + push canvas + push x + push y + pop esi + pop edi + pop ecx + pop ebx + call imgtoimg_proc +} + + +;DrawBox +macro drawfbox x,y,xs,ys,color +{ + words2reg ebx,x,xs ;x*65536+xs + words2reg ecx,y,ys ;y*65536+ys + mov edx,color + mov eax,13 + int 0x40 +} + +; FPS - Set Frame Per Second Display +fps_show_frequency=40 +macro fps x,y,color,delcolor +{ +local spdat,savetime,new_time,fps,fps_cntr,out_fps,new_time,ttt +local no_out_fps + jmp spdat +savetime dd 0 +fps_cntr dd 0 +fps dd 0 +ttt dd 0 +spdat: +get_time: + mov eax,3 + int 0x40 + cmp eax,[savetime] + jne new_time + inc [fps_cntr] + cmp dword [ttt],0 + je out_fps + dec dword [ttt] + jmp no_out_fps +new_time: + mov [savetime],eax + mov ebx,[fps_cntr] + mov [fps],ebx + mov [fps_cntr],0 +out_fps: +if ~(delcolor eq ) + mov ebx,x*65536+36 + mov ecx,y*65536+7 + mov edx,delcolor + mov eax,13 + int 0x40 +end if + mov dword [ttt],fps_show_frequency + mov eax,47 + mov ebx,6*65536 +; mov bl,0 + mov edx,x*65536+y + mov esi,color + mov ecx,[fps] + int 0x40 +no_out_fps: +} + +; COLLIMG - Collusion image's +_1dbounce_count=0; +macro collimg img1_off,x1,y1,img2_off,x2,y2,otv +{ +local bounce,exit,anot,bc,nbc + mov esi,[img1_off] ;xs1 + mov edi,[img2_off] ;ys2 + mov eax,x1 ; + mov ebx,x2 ; + call _1dbounce + mov edx,ecx + mov esi,[img1_off+4] ;ys1 + mov edi,[img2_off+4] ;ys2 + mov eax,y1 ; + mov ebx,y2 ; + call _1dbounce + add edx,ecx + cmp edx,2 + je bounce + mov otv,0 + jmp exit +_1dbounce_count=_1dbounce_count+1 +if _1dbounce_count = 1 +_1dbounce: + cmp ebx,eax + jb anot + add eax,esi + cmp eax,ebx + jbe nbc +bc: + mov ecx,1 + ret +anot: + add ebx,edi + cmp ebx,eax + ja bc +nbc: + xor ecx,ecx + ret +end if +bounce: + mov otv,1 +exit: +} + +macro rgbtobgr image +{ +local loo + mov eax,[image] + mul dword [image+4] + mov ecx,eax + mov esi,image+8 +; add esi,8 +loo: + mov al,[esi] + mov bl,[esi+2] + mov [esi],bl + mov [esi+2],al + add esi,3 + dec ecx + jnz loo +} + + +macro setimg x , y ,arg3 +{ + mov eax,7 + mov ebx,arg3 + add ebx,8 + mov cx,[arg3] + shl ecx,16 + add cx,[arg3+4] +; wordstoreg ecx,[arg3],[arg3+4] +; wordstoreg edx,x,y + words2reg edx, x , y ;arg1*65536+arg2 + int 0x40 +} + +macro setframe x , y ,arg3 +{ + mov eax,7 + mov ebx,arg3 + add ebx,8 + words2reg edx, x , y ;arg1*65536+arg2 + add edx,dword [arg3] + mov ecx,dword [arg3+4] + int 0x40 +} + + +macro getimg imgsrc,x,y,xs,ys,imgdest +{ +local cyc +if xs eqtype 0 + mov dword [imgdest],xs +else + mov eax,xs + mov dword [imgdest],eax +end if +if ys eqtype 0 + mov dword [imgdest+4],ys +else + mov eax,ys + mov dword [imgdest+4],eax +end if + + mov eax,dword [imgsrc] ;getx size +; lea ecx,[eax+2*eax] + mov ecx,eax + shl ecx,1 + add ecx,eax + + mov ebx,y + mul ebx + add eax,x + mov edx,ecx + lea eax,[eax+2*eax] ;eax=offset on imsrc +; mov ebp,eax +; shl eax,1 +; add eax,ebp + + mov ecx,xs + mov ebx,ys + + mov edi,8+imgdest + lea esi,[eax+8+imgsrc] +; mov esi,eax +; add esi,8 +; add esi,imgsrc + + cld +cyc: + movsw + movsb + dec ecx + jne cyc + add esi,edx + mov ecx,xs + sub esi,ecx + sub esi,ecx + sub esi,ecx + dec ebx + jne cyc +} + +macro copyimg img2_off,img1_off +{ + mov eax,dword [img1_off] + mov ebx,dword [img1_off+4] + mul ebx + lea ecx,[eax+2*eax] + lea esi,[img1_off+8] + lea edi,[img2_off+8] + cld + rep movsb +} + +macro fullimg img_off,xs,ys,color +{ +local cop + mov eax,xs + mov ebx,ys + mov dword [img_off],eax + mov dword [img_off+4],ebx + mul ebx + lea ebp,[eax+2*eax] + mov esi,color +if color eqtype 0 +6 +else + mov ecx,esi + shr ecx,16 +end if + xor edi,edi +cop: + mov word [img_off+8+edi],si + add edi,2 + mov byte [img_off+8+edi],cl + inc edi + cmp edi,ebp + jne cop +} + + + + ; number of frame in ecx + ; callculatin offset of raw data + +macro getframeoff num_of_frame,offset_of_animation,offset_of_frame +{ +local loo,setpic + mov ebp,num_of_frame ;ecx + mov esi,offset_of_animation;Image +loo: + cmp ebp,0 + je setpic + movzx eax,word [esi+4] + movzx ebx,word [esi+6] + mul ebx ;dword [esi+4] + mov ebx,3 + mul ebx + add eax,8 + add esi,eax + dec ebp + jmp loo +setpic: + mov dword offset_of_frame,esi +} + + +; BMPTOIMG -Convert BMP format TO IMG format +; (SYNTAX) BMPTOIMG BMP_source_offset,IMG_dest_ofset +; (SAMPLE) View BMPLS.ASM sample. +; ( NOTE ) This is macros is not brake bmp structure! Tested in 32,8,4 bits + + +bmptoimg_data_area_count=0 +macro bmptoimg bmp_load_area,img_dest_area +{ +local fileinfo,string,end_bmp,nodix +local converttable,noaddelem,nextbit,convert1bpp,convert4bpp,convert2 +local nextelem,convertno32,nomorestring,convert1,nextstring,yespicsize +;local qwe,bmpfn + +; convert: + movzx eax,word [bmp_load_area+28] + mul dword [bmp_load_area+18] + add eax,31 + shr eax,5 + mov dword [bmptoimg_data_area_dwps],eax ;dwps-doublewords per string + shl eax,2 + mov dword [bmptoimg_data_area_bps],eax ;bps-bytes per string + + cmp dword [bmp_load_area+34],0 + jne yespicsize ;if picture size is defined + mul dword [bmp_load_area+22] + mov dword [bmp_load_area+34],eax + + yespicsize: + mov ebp,img_dest_area+8 + + mov eax,bmp_load_area + mov ebx,eax + add ebx, [bmp_load_area+2];file size + inc ebx + mov dword [bmptoimg_soi],ebx ;soi-start of image area for drawing + + add eax, [bmp_load_area+10] + mov dword [bmptoimg_data_area_sop],eax ;sop-start of picture in file + add eax, [bmp_load_area+34] + mov dword [bmptoimg_data_area_eop],eax ;eop-end of picture in file + mov eax, [bmp_load_area+18] + lea eax,[eax+2*eax] ;3x pixels in eax + + mov edi,dword [bmptoimg_soi] ;initializing + mov esi,dword [bmptoimg_data_area_eop] + sub esi,dword [bmptoimg_data_area_bps] + + + nextstring: + push edi + push ebp + cmp word [bmp_load_area+28],24 + jne convertno32 + + mov edi,ebp + mov ecx,[bmptoimg_data_area_dwps] + cld + rep movsd + + convert1: + pop ebp + pop edi + sub esi,dword [bmptoimg_data_area_bps] + sub esi,dword [bmptoimg_data_area_bps] + cmp esi,dword [bmptoimg_data_area_sop] + jb end_bmp + add edi,eax + add ebp,eax + jmp nextstring + + convertno32: + mov ebx,bmp_load_area + add ebx, [bmp_load_area+14] + add ebx,14 ;start of color table + push esi + add esi,dword [bmptoimg_data_area_bps] + mov dword [bmptoimg_data_area_eos],esi + pop esi + nextelem: + push eax + movzx eax,byte [esi] + cmp word [bmp_load_area+28],4 + je convert4bpp + cmp word [bmp_load_area+28],1 + je convert1bpp + call converttable + + convert2: + pop eax + inc esi + cmp esi,dword [bmptoimg_data_area_eos] + jae convert1 + add edi,3 + + add ebp,3 + + jmp nextelem + + convert4bpp: + shl ax,4 + shr al,4 + push ax + movzx eax,ah + call converttable + add edi,3 + + add ebp,3 + + pop ax + movzx eax,al + call converttable + jmp convert2 + + convert1bpp: + mov ecx,eax + mov edx,7 + nextbit: + xor eax,eax + bt ecx,edx + jnc noaddelem + inc eax + noaddelem: + push edx + call converttable + pop edx + dec edx + js convert2 + add edi,3 + + add ebp,3 + + jmp nextbit + + converttable: + shl eax,2 + add eax,ebx + mov edx, dword [eax] +; mov dword [edi],edx + mov [ebp],edx + ret + +bmptoimg_data_area_count=bmptoimg_data_area_count+1 +if bmptoimg_data_area_count = 1 +; DATA AREA +bmptoimg_soi dd 0 +bmptoimg_data_area_bps dd 0 +bmptoimg_data_area_dwps dd 0 +bmptoimg_data_area_sop dd 0 +bmptoimg_data_area_eop dd 0 +bmptoimg_data_area_eos dd 0 +end if + +end_bmp: + mov eax,dword [bmp_load_area+18] + mov ebx,dword [bmp_load_area+22] + mov dword [img_dest_area],eax + mov dword [img_dest_area+4],ebx +} + +; For convert RGB to BGR +COLOR_ORDER equ MENUETOS + +macro giftoani gifsrc,imgsrc,num_of_frames +{ +local hasharea, ReadGIF, nextblock,_null +local globalColor, img_count, cur_info, img_start +local codesize, compsize, bit_count, CC, EOI, Palette +local block_ofs, table_ptr, gifmacend +local no_gc, block_skip, no_comm, noextblock, uselocal +local setPal, filltable, reinit, cycle, zadd, noinc +local notintable, er, zend, nxt, continue, ex, Gif_skipmap +local Gif_get_sym, shift, nextbl, noblock, loop1, exx +local Gif_output, next, loop2 + +_null fix 0x1000 ; 0x1000 + +; jmp sss +; if defined gif_hash_offset +; else +; hasharea: +; times 4096 dd 0 ;4096 +; end if +;sss: + + mov esi,gifsrc ;Указатель на ГИФ фаил в памяти + mov edi,imgsrc ;Указатель на список картинок + + if defined gif_hash_offset + mov eax,gif_hash_offset ;Рабочая область минимум 4096*4 байт + else + mov eax,hasharea ;Рабочая область минимум 4096*4 байт + end if + + call ReadGIF + push ecx + pop dword num_of_frames + jmp gifmacend + + if defined gif_hash_offset + else + hasharea: + times 4096 dd 0 ;4096 + end if + +ReadGIF: + push esi edi + mov [table_ptr],eax + mov [cur_info],edi + xor eax,eax + mov [globalColor],eax + mov [img_count],eax + inc eax + cmp dword[esi],'GIF8' + jne er ; signature + mov ecx,[esi+0xa] + inc eax + add esi,0xd + mov edi,esi + bt ecx,7 + jnc nextblock + mov [globalColor],esi + call Gif_skipmap +nextblock: + cmp byte[edi],0x21 + jne noextblock + inc edi + cmp byte[edi],0xf9 ; Graphic Control Ext + jne no_gc + add edi,7 + jmp nextblock +no_gc: + cmp byte[edi],0xfe ; Comment Ext + jne no_comm + inc edi +block_skip: + movzx eax,byte[edi] + lea edi,[edi+eax+1] + cmp byte[edi],0 + jnz block_skip + inc edi + jmp nextblock +no_comm: + cmp byte[edi],0xff ; Application Ext + jne nextblock + add edi,13 + jmp block_skip +noextblock: + cmp byte[edi],0x2c ; image beginning + jne er + inc [img_count] + inc edi + mov esi,[cur_info] + xchg esi,edi + movsd + movsd + + push edi + movzx ecx,word[esi] + inc esi + bt ecx,7 + jc uselocal + push [globalColor] + mov edi,esi + jmp setPal +uselocal: + call Gif_skipmap + push esi +setPal: + movzx ecx,byte[edi] + inc ecx + mov [codesize],ecx + dec ecx + pop [Palette] + lea esi,[edi+1] + mov edi,[table_ptr] + xor eax,eax + cld + lodsb ; eax - block_count + add eax,esi + mov [block_ofs],eax + mov [bit_count],8 + mov eax,1 + shl eax,cl + mov [CC],eax + inc eax + mov [EOI],eax + lea ecx,[eax-1] + mov eax, _null shl 16 +filltable: + stosd + inc eax + loop filltable + pop edi + mov [img_start],edi +reinit: + mov edx,[EOI] + inc edx + push [codesize] + pop [compsize] + call Gif_get_sym + cmp eax,[CC] + je reinit + call Gif_output +cycle: + movzx ebx,ax + call Gif_get_sym + cmp eax,edx + jae notintable + cmp eax,[CC] + je reinit + cmp eax,[EOI] + je zend + call Gif_output +zadd: + push eax + mov eax,[table_ptr] + mov [eax+edx*4],ebx + pop eax + cmp edx,0xFFF + jae cycle + inc edx + bsr ebx,edx + cmp ebx,[compsize] + jne noinc + inc [compsize] +noinc: + jmp cycle +notintable: + push eax + mov eax,ebx + call Gif_output + push ebx + movzx eax,bx + call Gif_output + pop ebx eax + jmp zadd +er: + pop edi + jmp ex +zend: +; mov eax,[.cur_info] ; skip offset to next frame +; mov [eax],edi + mov [cur_info],edi + add esi,2 + xchg esi,edi +nxt: + cmp byte[edi],0 + jnz continue + inc edi + jmp nxt +continue: + cmp byte[edi],0x3b ;read next frame + jne nextblock + xor eax,eax + stosd + mov ecx,[img_count] +ex: + pop edi esi + ret + +Gif_skipmap: +; in: ecx - image descriptor, esi - pointer to colormap +; out: edi - pointer to area after colormap + + and ecx,111b + inc ecx ; color map size + mov ebx,1 + shl ebx,cl + lea ebx,[ebx*2+ebx] + lea edi,[esi+ebx] + ret + +Gif_get_sym: + mov ecx,[compsize] + push ecx + xor eax,eax +shift: + ror byte[esi],1 + rcr eax,1 + dec [bit_count] + jnz loop1 + inc esi + cmp esi,[block_ofs] + jb noblock + push eax + xor eax,eax + lodsb + test eax,eax + jnz nextbl + mov eax,[EOI] + sub esi,2 + add esp,8 + jmp exx +nextbl: + add eax,esi + mov [block_ofs],eax + pop eax +noblock: + mov [bit_count],8 +loop1: + loop shift + pop ecx + rol eax,cl +exx: + xor ecx,ecx + ret + +Gif_output: + push esi eax edx + mov edx,[table_ptr] +next: + push word[edx+eax*4] + mov ax,word[edx+eax*4+2] + inc ecx + cmp ax,_null + jnz next + shl ebx,16 + mov bx,[esp] +loop2: + pop ax + + lea esi,[eax+eax*2] + add esi,[Palette] + + if COLOR_ORDER eq MENUETOS + mov esi,[esi] + bswap esi + shr esi,8 + mov [edi],esi + add edi,3 + else + movsw + movsb + end if + + loop loop2 + pop edx eax esi + ret + + globalColor dd 1 + img_count dd 1 + cur_info dd 1 ; image table pointer + img_start dd 1 + codesize dd 1 + compsize dd 1 + bit_count dd 1 + CC dd 1 + EOI dd 1 + Palette dd 1 + block_ofs dd 1 + table_ptr dd 1 + +gifmacend: +} + + + +macro giftoimg gifsrc,imgsrc +{ +local hasharea, ReadGIF, nextblock,_null +local globalColor, img_count, cur_info, img_start +local codesize, compsize, bit_count, CC, EOI, Palette +local block_ofs, table_ptr, gifmacend +local no_gc, block_skip, no_comm, noextblock, uselocal +local setPal, filltable, reinit, cycle, zadd, noinc +local notintable, er, zend, nxt, continue, ex, Gif_skipmap +local Gif_get_sym, shift, nextbl, noblock, loop1, exx +local Gif_output, next, loop2 + +_null fix 0x1000 ; 0x1000 + + mov esi,gifsrc ;Указатель на ГИФ фаил в памяти + mov edi,imgsrc ;Указатель на список картинок + + if defined gif_hash_offset + mov eax,gif_hash_offset ;Рабочая область минимум 4096*4 байт + else + mov eax,hasharea ;Рабочая область минимум 4096*4 байт + end if + + call ReadGIF + jmp gifmacend + + if defined gif_hash_offset + else + hasharea: + times 4096 dd 0 ;4096 + end if + +ReadGIF: + push esi edi + mov [table_ptr],eax + mov [cur_info],edi + xor eax,eax + mov [globalColor],eax + mov [img_count],eax + inc eax + cmp dword[esi],'GIF8' + jne er ; signature + mov ecx,[esi+0xa] + inc eax + add esi,0xd + mov edi,esi + bt ecx,7 + jnc nextblock + mov [globalColor],esi + call Gif_skipmap +nextblock: + cmp byte[edi],0x21 + jne noextblock + inc edi + cmp byte[edi],0xf9 ; Graphic Control Ext + jne no_gc + add edi,7 + jmp nextblock +no_gc: + cmp byte[edi],0xfe ; Comment Ext + jne no_comm + inc edi +block_skip: + movzx eax,byte[edi] + lea edi,[edi+eax+1] + cmp byte[edi],0 + jnz block_skip + inc edi + jmp nextblock +no_comm: + cmp byte[edi],0xff ; Application Ext + jne nextblock + add edi,13 + jmp block_skip +noextblock: + cmp byte[edi],0x2c ; image beginning + jne er + inc [img_count] + inc edi + mov esi,[cur_info] + xchg esi,edi +; movsd +; movsd + + mov bp,word[esi+4] + movzx ebx,bp + mov [edi],ebx + + mov bp,word[esi+6] + movzx ebx,bp + mov [edi+4],ebx + + add edi,8 + add esi,8 + + push edi + movzx ecx,word[esi] + inc esi + bt ecx,7 + jc uselocal + push [globalColor] + mov edi,esi + jmp setPal +uselocal: + call Gif_skipmap + push esi +setPal: + movzx ecx,byte[edi] + inc ecx + mov [codesize],ecx + dec ecx + pop [Palette] + lea esi,[edi+1] + mov edi,[table_ptr] + xor eax,eax + cld + lodsb ; eax - block_count + add eax,esi + mov [block_ofs],eax + mov [bit_count],8 + mov eax,1 + shl eax,cl + mov [CC],eax + inc eax + mov [EOI],eax + lea ecx,[eax-1] + mov eax, _null shl 16 +filltable: + stosd + inc eax + loop filltable + pop edi + mov [img_start],edi +reinit: + mov edx,[EOI] + inc edx + push [codesize] + pop [compsize] + call Gif_get_sym + cmp eax,[CC] + je reinit + call Gif_output +cycle: + movzx ebx,ax + call Gif_get_sym + cmp eax,edx + jae notintable + cmp eax,[CC] + je reinit + cmp eax,[EOI] + je zend + call Gif_output +zadd: + push eax + mov eax,[table_ptr] + mov [eax+edx*4],ebx + pop eax + cmp edx,0xFFF + jae cycle + inc edx + bsr ebx,edx + cmp ebx,[compsize] + jne noinc + inc [compsize] +noinc: + jmp cycle +notintable: + push eax + mov eax,ebx + call Gif_output + push ebx + movzx eax,bx + call Gif_output + pop ebx eax + jmp zadd +er: + pop edi + jmp ex +zend: +; mov eax,[.cur_info] ; skip offset to next frame +; mov [eax],edi + mov [cur_info],edi + add esi,2 + xchg esi,edi +nxt: + cmp byte[edi],0 + jnz continue + inc edi + jmp nxt +continue: +; cmp byte[edi],0x3b ;read next frame +; jne nextblock + xor eax,eax + stosd + mov ecx,[img_count] +ex: + pop edi esi + ret + +Gif_skipmap: +; in: ecx - image descriptor, esi - pointer to colormap +; out: edi - pointer to area after colormap + + and ecx,111b + inc ecx ; color map size + mov ebx,1 + shl ebx,cl + lea ebx,[ebx*2+ebx] + lea edi,[esi+ebx] + ret + +Gif_get_sym: + mov ecx,[compsize] + push ecx + xor eax,eax +shift: + ror byte[esi],1 + rcr eax,1 + dec [bit_count] + jnz loop1 + inc esi + cmp esi,[block_ofs] + jb noblock + push eax + xor eax,eax + lodsb + test eax,eax + jnz nextbl + mov eax,[EOI] + sub esi,2 + add esp,8 + jmp exx +nextbl: + add eax,esi + mov [block_ofs],eax + pop eax +noblock: + mov [bit_count],8 +loop1: + loop shift + pop ecx + rol eax,cl +exx: + xor ecx,ecx + ret + +Gif_output: + push esi eax edx + mov edx,[table_ptr] +next: + push word[edx+eax*4] + mov ax,word[edx+eax*4+2] + inc ecx + cmp ax,_null + jnz next + shl ebx,16 + mov bx,[esp] +loop2: + pop ax + + lea esi,[eax+eax*2] + add esi,[Palette] + + if COLOR_ORDER eq MENUETOS + mov esi,[esi] + bswap esi + shr esi,8 + mov [edi],esi + add edi,3 + else + movsw + movsb + end if + + loop loop2 + pop edx eax esi + ret + + globalColor dd 1 + img_count dd 1 + cur_info dd 1 ; image table pointer + img_start dd 1 + codesize dd 1 + compsize dd 1 + bit_count dd 1 + CC dd 1 + EOI dd 1 + Palette dd 1 + block_ofs dd 1 + table_ptr dd 1 + +gifmacend: +} + + \ No newline at end of file diff --git a/programs/arcanii/trunk/ascl.inc b/programs/arcanii/trunk/ascl.inc new file mode 100644 index 0000000000..c556932eea --- /dev/null +++ b/programs/arcanii/trunk/ascl.inc @@ -0,0 +1,906 @@ +lang equ ru ; ru en fr ge fi + +; +; Assembler +; SMALL +; CODE +; Libary +; +; Ver 0.14 By Pavlushin Evgeni (RUSSIA) +; www.waptap@mail.ru + +;Please compile aplications on FASM ver1.54 or higer!!! + +;InfoList +;0.01 scank,putpix,puttxt +;0.02 label,random,colors +;0.03 window,startwd,endwd,attributes +;0.04 close,delay,scevent ~30.04.2004 +;0.05 small random, ~04.05.2004 +;0.06 wtevent ~09.05.2004 +;0.07 timeevent ~23.05.2004 +;0.08 txtput ~14.06.2004 +;0.09 opendialog,savedialog ~20.06.2004 +;0.10 wordstoreg by halyavin, add at ~30.08.2004 +; random bug deleted eax is use. +;0.11 loadfile from me +puttxt bug del ~07.09.2004 +;0.12 open/save dialog ~13.09.2004 +;0.13 dialogs bugs deleted +;0.14 drawlbut ~03.10.2004 +;0.15 extendet label! + +; LOADFILE +; (SYNTAX) LOADFILE 'full_path_to_file',file_load_area,file_temp_area +; (SAMPLE) LOADFILE '/rd/1/clock.bmp',load_area,temp_area + + +macro loadfile file_name,file_load_area,file_temp_area +{ +local open,fileinfo,string + jmp open +fileinfo: + dd 0 + dd 0 + dd 1 + dd file_load_area + dd file_temp_area +string: + db file_name,0 +open: + mov dword [fileinfo+8],1 ; how many blocks to read (1) + mov eax,58 + mov ebx,fileinfo + int 0x40 + mov eax,[file_load_area+2] + shr eax,9 ; поделим на 512 и прибавим 1 - получим число блоков + inc eax + mov dword [fileinfo+8],eax + mov eax,58 + mov ebx,fileinfo + int 0x40 +} + + +;macro wordstoreg reg,hiword,loword +;{ +;if hiword eqtype 0 & loword eqtype 0 +; mov reg,dword hiword*65536+loword +;else if hiword eqtype 12 & loword eqtype eax +; mov reg,dword hiword*65536 +; add reg,dword loword +;else if hiword eqtype 12 & loword eqtype [123] +; mov reg,dword hiword*65536 +; add reg,dword loword +;else +; mov reg,dword hiword +; shl reg,16 +; add reg,dword loword +;end if +;} + +macro dword2reg reg,doubleword +{ +if doubleword eq + ; not changes +else + mov reg,dword doubleword +end if +} + +macro words2reg reg,hiword,lowword +{ +if hiword eq + if lowword eq + ; not changes + else + if lowword eqtype 12 + and reg,dword 0xffff0000 + add reg,dword lowword + else + and reg,dword 0xffff0000 + add reg,dword lowword + end if + end if +else + if lowword eq + if hiword eqtype 12 + and reg,dword 0x0000ffff + add reg,dword hiword*65536 + else + shl reg,16 + add reg,dword hiword + ror reg,16 + end if + else + if lowword eqtype 12 & hiword eqtype 12 + if lowword eq 0 & hiword eq 0 + xor reg,reg + else + mov reg,dword hiword*65536+lowword + end if + else + mov reg,dword hiword + shl reg,16 + add reg,dword lowword + end if + end if +end if +} + + + + +; DRAW BUTTON with label + +macro drawlbut x,y,xs,ys,text,id,bcolor,tcolor +{ +local asd,lab + jmp asd +lab db text ;arg label +asd: + words2reg ebx,x,xs + words2reg ecx,y,ys + mov edx,id + mov esi,bcolor + mov eax,8 + int 0x40 + + mov eax,asd-lab ;calc size + mov ebx,6 + mul ebx + mov esi,eax + + mov eax,xs + sub eax,esi + shr eax,1 + add eax,x + + mov edx,ys + sub edx,7 + shr edx,1 + add edx,y + + mov ebx,eax + shl ebx,16 + add ebx,edx + + mov ecx,tcolor ;arg4 color + mov edx,lab + mov esi,asd-lab ;calc size + mov eax,4 + int 0x40 +} + + +macro opendialog redproc,openoff,erroff,path +{ +local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc +local run_fileinfo, param +local getmesloop, loox, mred, mkey, mbutton, mgetmes +local dlg_is_work, ready, procinfo +; +; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, +; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) +; + + cld +;; mov esi,path + mov edi,path + mov eax,0 + mov ecx,200 + rep stosb + +;mov [get_loops],0 +mov [dlg_pid_get],0 + +; Get my PID in dec format 4 bytes + mov eax,9 + mov ebx,procinfo + mov ecx,-1 + int 0x40 + +; convert eax bin to param dec + mov eax,dword [procinfo+30] ;offset of myPID + mov edi,param+4-1 ;offset to 4 bytes + mov ecx,4 + mov ebx,10 + cld +new_d: + xor edx,edx + div ebx + add dl,'0' + mov [edi],dl + dec edi + loop new_d + +; wirite 1 byte space to param + mov [param+4],byte 32 ;Space for next parametr +; and 1 byte type of dialog to param + mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog) + +; +; STEP2 prepare IPC area for get messages +; + +; prepare IPC area + mov [path],dword 0 + mov [path+4],dword 8 + +; define IPC memory + mov eax,60 + mov ebx,1 ; define IPC + mov ecx,path ; offset of area + mov edx,150 ; size 150 bytes + int 0x40 + +; change wanted events list 7-bit IPC event + mov eax,40 + mov ebx,01000111b + int 0x40 + +; +; STEP 3 run SYSTEM XTREE with parameters +; + + mov eax,58 + mov ebx,run_fileinfo + int 0x40 + + call redproc + + mov [get_loops],0 +getmesloop: + mov eax,23 + mov ebx,50 ;0.5 sec + int 0x40 + + cmp eax,1 + je mred + cmp eax,2 + je mkey + cmp eax,3 + je mbutton + cmp eax,7 + je mgetmes + +; Get number of procces + mov ebx,procinfo + mov ecx,-1 + mov eax,9 + int 0x40 + mov ebp,eax + +loox: + mov eax,9 + mov ebx,procinfo + mov ecx,ebp + int 0x40 + mov eax,[DLGPID] + cmp [procinfo+30],eax ;IF Dialog find + je dlg_is_work ;jmp to dlg_is_work + dec ebp + jnz loox + + jmp erroff + +dlg_is_work: + cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated + je erroff ;TESTODP2 terminated too + + cmp [dlg_pid_get],dword 1 + je getmesloop + inc [get_loops] + cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated + jae erroff + jmp getmesloop + +mred: + call redproc + jmp getmesloop +mkey: + mov eax,2 + int 0x40 ; read (eax=2) + jmp getmesloop +mbutton: + mov eax,17 ; get id + int 0x40 + cmp ah,1 ; button id=1 ? + jne getmesloop + mov eax,-1 ; close this program + int 0x40 +mgetmes: + +; If dlg_pid_get then second message get jmp to still + cmp [dlg_pid_get],dword 1 + je ready + +; First message is number of PID SYSXTREE dialog + +; convert PID dec to PID bin + movzx eax,byte [path+16] + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+1] + add eax,ebx + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+2] + add eax,ebx + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+3] + add eax,ebx + sub eax,48 + mov [DLGPID],eax + +; Claear and prepare IPC area for next message + mov [path],dword 0 + mov [path+4],dword 8 + mov [path+8],dword 0 + mov [path+12],dword 0 + mov [path+16],dword 0 + +; Set dlg_pid_get for get next message + mov [dlg_pid_get],dword 1 + call redproc ;show DLG_PID + jmp getmesloop + +ready: +; +; The second message get +; Second message is 100 bytes path to SAVE/OPEN file +; shl path string on 16 bytes +; + cld + mov esi,path+16 + mov edi,path + mov ecx,200 + rep movsb + mov [edi],byte 0 + + jmp openoff + + +; DATA AREA +get_loops dd 0 +dlg_pid_get dd 0 +DLGPID dd 0 + +param: + dd 0 ; My dec PID + dd 0,0 ; Type of dialog + +run_fileinfo: + dd 16 + dd 0 + dd param + dd 0 + dd procinfo ; 0x10000 +;run_filepath + db '/RD/1/SYSXTREE',0 + +procinfo: +times 1024 db 0 +} + + +macro savedialog redproc,openoff,erroff,path +{ +local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc +local run_fileinfo, run_filepath, param +local getmesloop, loox, mred, mkey, mbutton, mgetmes +local dlg_is_work, ready, procinfo +; +; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, +; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) +; + + cld +;; mov esi,path + mov edi,path + mov eax,0 + mov ecx,200 + rep stosb + +;mov [get_loops],0 +mov [dlg_pid_get],0 + +; Get my PID in dec format 4 bytes + mov eax,9 + mov ebx,procinfo + mov ecx,-1 + int 0x40 + +; convert eax bin to param dec + mov eax,dword [procinfo+30] ;offset of myPID + mov edi,param+4-1 ;offset to 4 bytes + mov ecx,4 + mov ebx,10 + cld +new_d: + xor edx,edx + div ebx + add dl,'0' + mov [edi],dl + dec edi + loop new_d + +; wirite 1 byte space to param + mov [param+4],byte 32 ;Space for next parametr +; and 1 byte type of dialog to param + mov [param+5],byte 'S' ;Get Open dialog (Use 'S' for Save dialog) + +; +; STEP2 prepare IPC area for get messages +; + +; prepare IPC area + mov [path],dword 0 + mov [path+4],dword 8 + +; define IPC memory + mov eax,60 + mov ebx,1 ; define IPC + mov ecx,path ; offset of area + mov edx,150 ; size 150 bytes + int 0x40 + +; change wanted events list 7-bit IPC event + mov eax,40 + mov ebx,01000111b + int 0x40 + +; +; STEP 3 run SYSTEM XTREE with parameters +; + + mov eax,58 + mov ebx,run_fileinfo + int 0x40 + + call redproc + + mov [get_loops],0 +getmesloop: + mov eax,23 + mov ebx,50 ;0.5 sec + int 0x40 + + cmp eax,1 + je mred + cmp eax,2 + je mkey + cmp eax,3 + je mbutton + cmp eax,7 + je mgetmes + +; Get number of procces + mov ebx,procinfo + mov ecx,-1 + mov eax,9 + int 0x40 + mov ebp,eax + +loox: + mov eax,9 + mov ebx,procinfo + mov ecx,ebp + int 0x40 + mov eax,[DLGPID] + cmp [procinfo+30],eax ;IF Dialog find + je dlg_is_work ;jmp to dlg_is_work + dec ebp + jnz loox + + jmp erroff + +dlg_is_work: + cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated + je erroff ;TESTODP2 terminated too + + cmp [dlg_pid_get],dword 1 + je getmesloop + inc [get_loops] + cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated + jae erroff + jmp getmesloop + +mred: + call redproc + jmp getmesloop +mkey: + mov eax,2 + int 0x40 ; read (eax=2) + jmp getmesloop +mbutton: + mov eax,17 ; get id + int 0x40 + cmp ah,1 ; button id=1 ? + jne getmesloop + mov eax,-1 ; close this program + int 0x40 +mgetmes: + +; If dlg_pid_get then second message get jmp to still + cmp [dlg_pid_get],dword 1 + je ready + +; First message is number of PID SYSXTREE dialog + +; convert PID dec to PID bin + movzx eax,byte [path+16] + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+1] + add eax,ebx + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+2] + add eax,ebx + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+3] + add eax,ebx + sub eax,48 + mov [DLGPID],eax + +; Claear and prepare IPC area for next message + mov [path],dword 0 + mov [path+4],dword 8 + mov [path+8],dword 0 + mov [path+12],dword 0 + mov [path+16],dword 0 + +; Set dlg_pid_get for get next message + mov [dlg_pid_get],dword 1 + call redproc ;show DLG_PID + jmp getmesloop + +ready: +; +; The second message get +; Second message is 100 bytes path to SAVE/OPEN file +; shl path string on 16 bytes +; + cld + mov esi,path+16 + mov edi,path + mov ecx,200 + rep movsb + mov [edi],byte 0 + + jmp openoff + + +; DATA AREA +get_loops dd 0 +dlg_pid_get dd 0 +DLGPID dd 0 + +param: + dd 0 ; My dec PID + dd 0,0 ; Type of dialog + +run_fileinfo: + dd 16 + dd 0 + dd param + dd 0 + dd procinfo +;run_filepath: + db '/RD/1/SYSXTREE',0 + +procinfo: +times 1024 db 0 +} + + + + +; RANDOM - generate random count (small) +; (SYNTAX) RANDOM MaxCount,OutArgument +; (SAMPLE) RANDOM 10000,eax +; ( NOTE ) Maxint<65536 ; use random 65536,eax for more combinations + +randomuse = 0 + +macro random arg1,arg2 +{ +local rxproc +randomuse = randomuse + 1 + + jmp rxproc + +if defined randomuse & randomuse = 1 +randomproc: + jmp rnj +rsx1 dw 0x4321 +rsx2 dw 0x1234 +rnj: +; mov eax,arg1 + push bx + push cx + push dx + push si + push di + mov cx,ax + mov ax,word ptr rsx1 + mov bx,word ptr rsx2 + mov si,ax + mov di,bx + mov dl,ah + mov ah,al + mov al,bh + mov bh,bl + xor bl,bl + rcr dl,1 + rcr ax,1 + rcr bx,1 + add bx,di + adc ax,si + add bx,0x62e9 + adc ax,0x3619 + mov word ptr rsx1,bx + mov word ptr rsx2,ax + xor dx,dx + cmp ax,0 + je nodiv + cmp cx,0 + je nodiv + div cx +nodiv: + mov ax,dx + pop di + pop si + pop dx + pop cx + pop bx + and eax,0000ffffh +; mov arg2,0 +; mov arg2,eax + ret +end if + +rxproc: + mov eax,arg1 + call randomproc + mov arg2,eax +} + +macro scank +{ + mov eax,10 + int 0x40 +} + +macro putpix x,y,color +{ + mov ebx,x + mov ecx,y + mov edx,color + mov eax,1 + int 0x40 +} + +macro bar x,y,sizex,sizey,color +{ + words2reg ebx,x,sizex + words2reg ecx,y,sizey + dword2reg edx,color + mov eax,13 + int 0x40 + +} + +macro puttxt x,y,offs,size,color +{ +; mov ebx,x +; shl ebx,16 +; add ebx,y + words2reg ebx,x,y + + dword2reg ecx,color + dword2reg edx,offs + dword2reg esi,size + +; mov ecx,color +; mov edx,offs + mov esi,size + mov eax,4 + int 0x40 +} + +macro outcount data, x, y, color, numtype +{ + mov ecx,data + mov ebx,numtype + mov bl,0 +; mov edx,x*65536+y + words2reg edx,x,y + mov esi,color + mov eax,47 + int 0x40 +} + +; SCEVENT - Scan event + +macro scevent red,key,but +{ + mov eax,11 + int 0x40 + dec eax + jz red + dec eax + jz key + dec eax + jz but +} + +; WTEVENT - Wait event + +macro wtevent red,key,but +{ + mov eax,10 + int 0x40 + dec eax + jz red + dec eax + jz key + dec eax + jz but +} + +; TIMEEVENT - Wite for event with timeout + +macro timeevent xfps,noevent,red,key,but +{ + mov eax,23 + mov ebx,xfps + int 0x40 + cmp eax,0 + je noevent + dec eax + jz red + dec eax + jz key + dec eax + jz but +} + + +; CLOSE - Close program + +macro close +{ + mov eax,-1 + int 0x40 +} + +; DELAY - Create delay 1/100 sec +; (SYNTAX) Delay time +; (SAMPLE) Delay 100 ;delay 2 sec 1/100*200=2 sec + +macro delay arg1 +{ + mov eax,5 + mov ebx,arg1 + int 0x40 +} + +; WINDOW - Draw window +; (SYNTAX) WINDOW Xstart,Ystart,'Text',Color +; (SAMPLE) WINDOW 10,10,640+8,480+24,window_Skinned + +macro window arg1,arg2,arg3,arg4,arg5 +{ +; mov ebx,arg1*65536+arg3 +; mov ecx,arg2*65536+arg4 + words2reg ebx,arg1,arg3 + words2reg ecx,arg2,arg4 + mov edx,arg5 + mov eax,0 + int 0x40 +} + +macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7 +{ + mov ebx,arg1*65536+arg3 + mov ecx,arg2*65536+arg4 + mov edx,arg5 + mov esi,arg6 + mov edi,arg7 + mov eax,0 + int 0x40 +} + + +; STARTWD - Start of window draw + +macro startwd +{ + mov eax,12 + mov ebx,1 + int 0x40 +} + +; ENDWD - End window draw + +macro endwd +{ + mov eax,12 + mov ebx,2 + int 0x40 +} + +; LABEL - Put text to frame +; (SYNTAX) LABEL Xstart,Ystart,'Text',Color +; (SAMPLE) LABEL 10,12,'Hello World!',cl_Green+font_Big + +macro label arg1,arg2,arg3,arg4 +{ +local asd,lab + jmp asd +lab db arg3 ;arg label +asd: +; mov ebx,arg1 ;arg1=y arg2=x +; shl ebx,16 +; add ebx,arg2 + + words2reg ebx,arg1,arg2 + + dword2reg ecx,arg4 + + mov edx,lab + mov esi,asd-lab ;calc size + mov eax,4 + int 0x40 +} + +;Key's +key_Up equ 178 +key_Down equ 177 +key_Right equ 179 +key_Left equ 176 +key_Esc equ 27 +key_Space equ 32 +key_Enter equ 13 +key_Bspace equ 8 +key_F1 equ 50 +key_F2 equ 51 +key_F3 equ 52 +key_F4 equ 53 +key_F5 equ 54 +key_F6 equ 55 +key_F7 equ 56 +key_F8 equ 57 +key_F9 equ 48 +key_F10 equ 49 +key_F11 equ 68 +key_F12 equ 255 +key_Home equ 180 +key_End equ 181 +key_PgUp equ 184 +key_PgDown equ 183 + +;Attributes + +;Window Attributes +window_Skinned equ 0x03000000 +window_Type2 equ 0x02000000 +window_Type1 equ 0x00000000 +window_Reserve equ 0x01000000 + +;Font Attributes +font_Big equ 0x10000000 + +;Colors +cl_White equ 0x00ffffff +cl_Black equ 0x00000000 +cl_Grey equ 0x00888888 +cl_Red equ 0x00ff0000 +cl_Lime equ 0x0000ff00 +cl_Green equ 0x0000af00 +cl_Blue equ 0x000000ff +cl_Purple equ 0x008080ff +cl_Violet equ 0x008040f diff --git a/programs/arcanii/trunk/asjc.inc b/programs/arcanii/trunk/asjc.inc new file mode 100644 index 0000000000..a93b38d294 --- /dev/null +++ b/programs/arcanii/trunk/asjc.inc @@ -0,0 +1,115 @@ +;------------------------- +; +; ASM JJ's 2 C macros ;-) +; +; version history: +; +; *0.01(02/08/05): if_e, if_ne, if_a, if_b +; *0.02(02/09/05): push_abc, pop_abc +; ch_sign, abs +; +; E.X.: if_e dword [x],100,.end_if +; if x = 100 do the instrucsions to .end_if: +; == +macro if_e arg1,arg2,label +{ +if arg1 eq 0 | arg2 eq 0 | arg1 eqtype 12 | arg2 eqtype 12 + cmp arg1,arg2 + jne label +else + push edx + mov edx,arg1 + cmp edx,arg2 + pop edx + jne label +end if +} + +; != +macro if_ne arg1,arg2,label +{ +if arg1 eq 0 | arg2 eq 0 | arg1 eqtype 12 | arg2 eqtype 12 + cmp arg1,arg2 + je label +else + push edx + mov edx,arg1 + cmp edx,arg2 + pop edx + je label +end if +} + +; > +macro if_a arg1,arg2,label +{ +if arg1 eq 0 | arg2 eq 0 | arg1 eqtype 12 | arg2 eqtype 12 + cmp arg1,arg2 + jbe label +else + push edx + mov edx,arg1 + cmp edx,arg2 + pop edx + jbe label +end if +} + +; < +macro if_b arg1,arg2,label +{ +if arg1 eq 0 | arg2 eq 0 | arg1 eqtype 12 | arg2 eqtype 12 + cmp arg1,arg2 + jae label +else + push edx + mov edx,arg1 + cmp edx,arg2 + pop edx + jae label +end if +} + +macro push_abc +{ + push eax + push ebx + push ecx + push edx + push edi + push esi +} + +macro pop_abc +{ + pop esi + pop edi + pop edx + pop ecx + pop ebx + pop eax +} + +UNDER_0 equ 0x7FFFFFFF +; changes sign e.x. ch_sign -1 = 1 +macro ch_sign arg +{ + push edx + mov edx,0 + sub edx,arg + pop edx +} + +; absolut e.x. abs -24 = 24 +macro abs arg +{ +local .end_if + if_a arg,UNDER_0,.end_if + ch_sign arg + .end_if: +} + ;--------------------------------------- + + + + diff --git a/programs/arcanii/trunk/build_en.bat b/programs/arcanii/trunk/build_en.bat new file mode 100644 index 0000000000..3f9afc8ad0 --- /dev/null +++ b/programs/arcanii/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm arcanii.asm arcanii +@pause \ No newline at end of file diff --git a/programs/arcanii/trunk/build_ru.bat b/programs/arcanii/trunk/build_ru.bat new file mode 100644 index 0000000000..7d3a5ed791 --- /dev/null +++ b/programs/arcanii/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm arcanii.asm arcanii +@pause \ No newline at end of file diff --git a/programs/arcanoid/trunk/ARC.BMP b/programs/arcanoid/trunk/ARC.BMP new file mode 100644 index 0000000000..7440645a60 Binary files /dev/null and b/programs/arcanoid/trunk/ARC.BMP differ diff --git a/programs/arcanoid/trunk/arcanoid.asm b/programs/arcanoid/trunk/arcanoid.asm new file mode 100644 index 0000000000..bef47d8779 --- /dev/null +++ b/programs/arcanoid/trunk/arcanoid.asm @@ -0,0 +1,561 @@ +; +; Arcanoid Gaem 4Ver Mini Sample by Pavlushin Evgeni for ASCL +; www.waptap@mail.ru www.cyberdeck.fatal.ru www.deck4.narod.ru +; Play again and exit button added +; +; 3Ver Play again, Exit button. +; 4Ver Next level function. +; +;****************************************************************************** + use32 + org 0x0 + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd IM_END ; size of image + dd 0x300000 ; memory for app + dd 0x300000 ; esp + dd 0x0 , 0x0 ; I_Param , I_Icon + +;****************************************************************************** + +include 'lang.inc' +include 'ascl.inc' +include 'ascgl.inc' +include 'ascgml.inc' + + +START: ; start of execution + bmptoimg arc_file,pong + getimg pong,0,0,80,4,img + getimg pong,0,4,80,4,img2 + getimg pong,5,38,15,15,img3 + getimg pong,0,8,80,20,img5 + fullimg img4 , 80 ,20 ,0x00000000 ;black for rocket + fullimg img6 , 15 ,15 ,0x00000000 ;black for ball + fullimg img7a , 60,20,0x0000cf00 + fullimg img7b , 60,20,0x00af0000 + fullimg img7c , 60,20,0x000000cf + fullimg img8 , 60,20,0x00000000 + + call draw_window + +still: + + scevent red,key,button + + cmp [againbut],1 + je stl2 + + outcount dword [scoreb],256,8,cl_Blue,5*65536 + outcount dword [scorea],332,8,cl_Red,5*65536 + outcount dword [level],368,8,cl_White,2*65536 + +del_images: + setimg dword [ply1x],dword [ply1y],img4 + setimg dword [ballx],dword [bally],img6 + setimg dword [gravx],dword [gravy],img4 + +del_blocks: + mov ecx,0 +xxx: + pushad + mov esi,dword [mass+ecx] + mov edi,dword [mass+ecx+4] + mov ebp,dword [mass+ecx+8] + cmp ebp,0 + jne notptx + setimg esi,edi,img8 +notptx: + popad + add ecx,12 + cmp ecx,[blocks_max] + jne xxx + + + +move_ply1: + + correct [ply1x],[ply1rx],2 + correct [ply1y],[ply1ry],2 + +;automove ball + mov eax,dword [ballxv] + add dword [ballx],eax + mov eax,dword [ballyv] + add dword [bally],eax + +;autoslow ball for rocket gravitation (Space key) + cmp dword [ballxv],0 + jl ballb +balla: + cmp dword [ballxv],2 + jng balln + dec dword [ballxv] + jmp balln +ballb: + cmp dword [ballxv],-2 + jnl balln + inc dword [ballxv] + jmp balln +balln: + cmp dword [ballyv],2 + jng by_n + dec dword [ballyv] +by_n: + +;ball collusion of screen + cmp dword [ballx],400-12 + jna xa_ok + neg dword [ballxv] +xa_ok: + cmp dword [ballx],6 + jnb xb_ok + neg dword [ballxv] +xb_ok: + + cmp dword [bally],30 + jnb yb_ok + neg dword [ballyv] +yb_ok: + + +;if ball far out of screen come back + cmp dword [bally],466 + jng yax_ok + call draw_window + dec dword [scoreb] + mov eax,[ply1ry] + sub eax,6 + mov dword [bally],eax ;240 + mov eax,[ply1rx] + add eax,30 + mov dword [ballx],eax ;200 + mov dword [ballyv],2 + random 3,dword [ballxv] + sub dword [ballxv],1 +yax_ok: + +xorx: + cmp dword [ballxv],0 + jne norx + random 3,dword [ballxv] + sub dword [ballxv],1 + cmp dword [ballxv],0 + je xorx +norx: + +;test on collusion ply1 of ball +collusion_test: + collimg img,[ply1x],[ply1y],img3,[ballx],[bally],eax + cmp eax,1 + jne not_coll + neg dword [ballyv] + sub dword [bally],4 +; neg dword [ballxv] +not_coll: + +;test on collusion gravity of ball +collusion_grav: + collimg img,[gravx],[gravy],img3,[ballx],[bally],eax + cmp eax,1 + jne not_collg + sub dword [bally],30 + neg dword [ballyv] + cmp dword [ballyv],0 + jl ab + jg bf + jmp not_collgx +ab: + sub dword [ballyv],10 + jmp not_collgx +bf: + add dword [ballyv],10 +not_collgx: + cmp dword [ballxv],0 + jl abx + jg bfx + jmp not_collg +abx: + sub dword [ballxv],0 ;8 ;15 + jmp not_collg +bfx: + add dword [ballxv],0 ;8 + + +; mov dword [ballyv],20 +not_collg: + +;ply contorl + control 12,316,[ply1rx] + control 380,470,[ply1ry] + +;garvity +gravity: + cmp dword [gravtime],0 + je no_dg + dec dword [gravtime] +no_dg: + +draw_gravity: + cmp dword [gravtime],0 + je nograv + mov eax,dword [ply1x] + mov ebx,dword [ply1y] + sub ebx,30 + mov dword [gravx],eax + mov dword [gravy],ebx + jmp endgrav +nograv: + mov dword [gravx],1000 + mov dword [gravy],1000 +endgrav: + +redraw_images: + setimg dword [ply1x],dword [ply1y],img2 + setimg dword [ballx],dword [bally],img3 + setimg dword [gravx],dword [gravy],img5 + +draw_blocks: + mov ecx,0 +xxx2: + pushad + mov esi,dword [mass+ecx] + mov edi,dword [mass+ecx+4] + mov ebp,dword [mass+ecx+8] + cmp ebp,0 + je notpt + cmp ebp,1 + jne no_a + setimg esi,edi,img7a + jmp notpt +no_a: + cmp ebp,2 + jne no_b + setimg esi,edi,img7b + jmp notpt +no_b: + cmp ebp,3 + jne no_c + setimg esi,edi,img7c + jmp notpt +no_c: + +notpt: + popad + add ecx,12 + cmp ecx,[blocks_max] + jne xxx2 + +;collusion ball of blocks +coll_blocks: + mov [temp3],0 + mov ecx,0 +testloop: + pushad + mov ebp,dword [mass+ecx+8] + cmp ebp,0 + jne testcol + jmp notest +testcol: + mov [temp3],1 + mov esi,dword [mass+ecx] + mov edi,dword [mass+ecx+4] + mov [temp1],esi + mov [temp2],edi + push ecx + collimg img8,[temp1],[temp2],img3,[ballx],[bally],eax + pop ecx + cmp eax,1 + jne notest + mov dword [mass+ecx+8],0 +; neg [ballxv] + neg [ballyv] + add [scorea],30 + call draw_window + jmp end_col +notest: + popad + add ecx,12 + cmp ecx,[blocks_max] + jne testloop +end_col: + + cmp [delay_cnt],0 + jne no_delay + mov [delay_cnt],1 + delay 1 ;don't generate delay for fast speed programm +no_delay: + dec [delay_cnt] + +win_test: + cmp [temp3],1 + je stl +; inc [level] + mov [nextlev],1 + mov [againbut],1 + call draw_window +; label 160,200,'You Win!',cl_Green+font_Big +; label 130,220,'Youre Score:',cl_Green+font_Big +; outcount dword [scorea],230,220,cl_Green,5*65536 +; label 130,234,'Youre Lives:',cl_Green+font_Big +; outcount dword [scoreb],230,234,cl_Green,5*65536 +; delay 600 ;wait 2sec +; close ;exit from program +stl: + +lose_test: + cmp [scoreb],0 + jne stl2 +; call draw_window +; label 160,200,'You Lose!',cl_Red+font_Big +; label 130,220,'Youre Score:',cl_Red+font_Big +; outcount dword [scorea],230,220,cl_Red,5*65536 +; delay 300 ;wait 2sec +; close ;exit from program +; mov ebx,10*65536+40 +; mov ebx,10*65536+20 +; mov edx,2 +; mov esi,0x0000ff00 +; mov eax,8 +; int 0x40 + mov [level],0 + mov [nextlev],0 + mov [againbut],1 + call draw_window + +stl2: + + jmp still + + red: + call draw_window + jmp still + + key: ; key + mov eax,2 + int 0x40 + cmp ah,key_Left + jne no_l + sub dword [ply1rx],50 ;24 ;16 +no_l: + cmp ah,key_Right + jne no_r + add dword [ply1rx],50 ;24 ;16 +no_r: + cmp ah,key_Up + jne no_u + sub dword [ply1ry],20 +no_u: + cmp ah,key_Down + jne no_d + add dword [ply1ry],20 +no_d: + cmp ah,key_Space + jne no_sp + mov dword [gravtime],100 +no_sp: + jmp still + + button: ; button + 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,2 + jne noplayagain + mov [xt],100 + mov [yt],100 + mov [gravtime],10 + mov [gravx],1000 + mov [gravy],1000 + mov [ply1rx],160 + mov [ply1ry],460 + mov [ply1x],160 + mov [ply1y],400 + mov [ballx],200 + mov [bally],300 + mov [ballyv],2 + mov [ballxv],1 + + cmp [nextlev],1 + je noch + mov [scorex],0 + mov [scorea],0 + mov [scoreb],3 + jmp noch2 +noch: + inc [scoreb] + inc [level] + mov eax,[maxlev] + cmp [level],eax + jna noch2 + mov [level],eax +noch2: + + mov eax,18*4*5 + mul [level] + mov ebp,eax + add ebp,levels + mov ecx,18*4*5 ;bytes +loo: + mov eax,dword [ebp+ecx] + mov dword [mass+ecx],eax + sub ecx,4 + jnz loo + + mov [againbut],0 + + call draw_window +noplayagain: + jmp still + + +draw_window: + startwd + window 0,0,400+8,480+24,window_Skinned + label 12,8,'ARCANOID: USE ARROW KEYS LIVES SCORE',cl_White+font_Big + + cmp [againbut],0 + je no_againbut + + cmp [nextlev],1 + je nlev + label 160,200,'You Lose!',cl_Red+font_Big + label 130,220,'Youre Score:',cl_Red+font_Big + outcount dword [scorea],230,220,cl_Red,5*65536 + mov ebx,150*65536+80 + mov ecx,240*65536+12 + mov edx,2 + mov esi,0x0000aa00 + mov eax,8 + int 0x40 + mov ecx,260*65536+12 + mov edx,1 + int 0x40 + label 152,244,'Play again?',cl_Red+font_Big + jmp elev +nlev: + label 160,200,'You Win!',cl_Green+font_Big + label 130,220,'Youre Score:',cl_Green+font_Big + outcount dword [scorea],230,220,cl_Green,5*65536 + mov ebx,150*65536+80 + mov ecx,240*65536+12 + mov edx,2 + mov esi,0x0000aa00 + mov eax,8 + int 0x40 + mov ecx,260*65536+12 + mov edx,1 + int 0x40 + label 152,244,'Next level?',cl_Red+font_Big +elev: + + label 178,264,'Exit?',cl_Red+font_Big +no_againbut: + + endwd + ret + + +; DATA AREA +againbut dd 0 + +xt dd 100 +yt dd 100 + +gravtime dd 10 +gravx dd 1000 +gravy dd 1000 + +ply1rx dd 160 +ply1ry dd 460 + +ply1x dd 160 +ply1y dd 400 + +ballx dd 200 +bally dd 300 + +ballyv dd 2 +ballxv dd 1 + +temp1 dd 0 +temp2 dd 0 +temp3 dd 0 + +scorex dd 0 +scorea dd 0 +scoreb dd 3 + +level dd 0 +nextlev dd 0 +maxlev dd 2 + +counter dd 0 +tsoi dd 0 + +delay_cnt dd 0 + +blocks_max dd 6*5*12 ;size in bytes 5*3 dd + +mass: + dd 30,200,0 ,90,200,0 ,150,200,0 ,210,200,0 ,270,200,0 ,330,200,0 + dd 30,180,0 ,90,180,0 ,150,180,0 ,210,180,0 ,270,180,0 ,330,180,0 + dd 30,160,0 ,90,160,0 ,150,160,0 ,210,160,0 ,270,160,0 ,330,160,0 + dd 30,140,0 ,90,140,1 ,150,140,1 ,210,140,1 ,270,140,0 ,330,140,0 + dd 30,120,0 ,90,120,0 ,150,120,0 ,210,120,0 ,270,120,0 ,330,120,0 + +levels: + dd 30,200,0 ,90,200,0 ,150,200,0 ,210,200,2 ,270,200,0 ,330,200,0 + dd 30,180,2 ,90,180,1 ,150,180,1 ,210,180,2 ,270,180,2 ,330,180,0 + dd 30,160,1 ,90,160,3 ,150,160,1 ,210,160,2 ,270,160,2 ,330,160,2 + dd 30,140,2 ,90,140,1 ,150,140,1 ,210,140,2 ,270,140,2 ,330,140,0 + dd 30,120,0 ,90,120,0 ,150,120,0 ,210,120,2 ,270,120,0 ,330,120,0 +;level2 + dd 30,200,0 ,90,200,3 ,150,200,0 ,210,200,2 ,270,200,2 ,330,200,2 + dd 30,180,0 ,90,180,1 ,150,180,0 ,210,180,2 ,270,180,2 ,330,180,2 + dd 30,160,0 ,90,160,3 ,150,160,0 ,210,160,2 ,270,160,2 ,330,160,2 + dd 30,140,0 ,90,140,1 ,150,140,0 ,210,140,2 ,270,140,2 ,330,140,2 + dd 30,120,0 ,90,120,3 ,150,120,0 ,210,120,2 ,270,120,2 ,330,120,2 +;level3 + dd 30,200,1 ,90,200,3 ,150,200,1 ,210,200,2 ,270,200,2 ,330,200,2 + dd 30,180,2 ,90,180,1 ,150,180,1 ,210,180,2 ,270,180,2 ,330,180,2 + dd 30,160,1 ,90,160,3 ,150,160,1 ,210,160,2 ,270,160,2 ,330,160,2 + dd 30,140,2 ,90,140,1 ,150,140,1 ,210,140,2 ,270,140,2 ,330,140,2 + dd 30,120,1 ,90,120,3 ,150,120,1 ,210,120,2 ,270,120,2 ,330,120,2 + +arc_file: +file 'arc.bmp' + +rb 20000 + +IM_END: + +pong: +rb 80*60*3+8 +img: +rb 32*32*3+8 +img2: +rb 32*32*3+8 +img3: +rb 32*32*3+8 +img4: +rb 80*20*3+8 +img5: +rb 80*20*3+8 +img6: +rb 15*15*3+8 +img7a: +rb 60*20*3+8 +img7b: +rb 60*20*3+8 +img7c: +rb 60*20*3+8 +img8: +rb 60*40*3+8 + +I_END: diff --git a/programs/arcanoid/trunk/ascgl.inc b/programs/arcanoid/trunk/ascgl.inc new file mode 100644 index 0000000000..117684e3e8 --- /dev/null +++ b/programs/arcanoid/trunk/ascgl.inc @@ -0,0 +1,1385 @@ +lang equ ru + +; +; Assembler +; SMALL +; CODE +; Graphics +; Libary +; +; Ver 0.18 By Pavlushin Evgeni (RUSSIA) +; www.waptap@mail.ru + +;InfoList +;0.01 LoadImage +;0.02 SetBmp +;0.03 Bmptoimg, Setimg ~01.03.2004 +;0.04 Bug deleted, copyimg ~03.05.2004 +;0.05 fullimg, collimg ~05.05.2004 +;0.06 getimg ~09.05.2004 +;0.07 convbmp ~13.05.2004 +;0.08 fps ~14.05.2004 +;0.09 drawfbox ~03.06.2004 +;0.10 all macros optimized by halyavin, add at ~07.06.2004 +;0.11 many macros optimized by halyavin, add at ~30.08.2004 +;0.12 bmptoimg ~07.09.2004 +;0.13 imgtoimg ~08.09.2004 +;0.14 imgtoimg modify not brake bmp pict! ~09.09.2004 +;0.15 giftoimg, giftoani ~10.09.2004 +;0.16 setframe, rgbtobgr, setbmp deleted ~20.09.2004 +;0.17 modification giftoimg, giftoani, getframeoff ~01.10.2004 +;0.18 aframetoimg,aimgtoimg,frametoimg ~03.10.2004 + +aframetoimg_use_count=0 +macro aframetoimg img, x, y, canvas,acol +{ +local loo,loo2,acolor +aframetoimg_use_count=aframetoimg_use_count+1 +if aframetoimg_use_count = 1 + + jmp end_aframetoimg_proc + +acolor dd 0 +aframetoimg_proc: +;getout coord + mov [acolor],ebp + + mov edx,ebx ;img ;xsize + movzx eax,word [edx] + add eax,esi ;y cor + +; mov eax,esi ;y cor + mul dword [ecx] ;canvas xsize + add eax,edi ;x cor + + mov ebp,ebx ;img ;xsize + movzx edx,word [ebp] + add eax,edx + + mov ebp,eax + shl eax,1 + add ebp,eax + add ebp,ecx ;canvas+8;start + add ebp,8 +;get img size + add ebx,4 + mov eax,ebx ;img ;xsize + movzx esi,word [eax] + movzx edi,word [eax+2] + add ebx,4 + mov edx,ebx ;img+8 +loo2: +push esi +loo: +;test on alpha color + mov eax,[edx] + shl eax,8 + shr eax,8 + cmp eax,[acolor] + jne yx + add edx,3 + add ebp,3 + jmp nx +yx: + + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx +nx: + dec esi + jnz loo +pop esi + sub ebp,3 + mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) + sub eax,esi + add ebp,eax + shl eax,1 + add ebp,eax + + add ebp,3 + + dec edi + jnz loo2 + ret +end_aframetoimg_proc: +end if + push img + push canvas + push x + push y + push acol + pop ebp + pop esi + pop edi + pop ecx + pop ebx + call aframetoimg_proc +} + +frametoimg_use_count=0 +macro frametoimg img, x, y, canvas +{ +local loo,loo2 +frametoimg_use_count=frametoimg_use_count+1 +if frametoimg_use_count = 1 + + jmp end_frametoimg_proc + +frametoimg_proc: +;getout coord + mov edx,ebx ;img ;xsize + movzx eax,word [edx] + add eax,esi ;y cor + +; mov eax,esi ;y cor + mul dword [ecx] ;canvas xsize + add eax,edi ;x cor + + mov ebp,ebx ;img ;xsize + movzx edx,word [ebp] + add eax,edx + + mov ebp,eax + shl eax,1 + add ebp,eax + add ebp,ecx ;canvas+8;start + add ebp,8 +;get img size + add ebx,4 + mov eax,ebx ;img ;xsize + movzx esi,word [eax] + movzx edi,word [eax+2] + add ebx,4 + mov edx,ebx ;img+8 +loo2: +push esi +loo: + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + + dec esi + jnz loo +pop esi + sub ebp,3 + mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) + sub eax,esi + add ebp,eax + shl eax,1 + add ebp,eax + + add ebp,3 + + dec edi + jnz loo2 + ret +end_frametoimg_proc: +end if + push img + push canvas + push x + push y + pop esi + pop edi + pop ecx + pop ebx + call frametoimg_proc +} + + +aimgtoimg_use_count=0 +macro aimgtoimg img, x, y, canvas,acol +{ +local loo,loo2,acolor +aimgtoimg_use_count=aimgtoimg_use_count+1 +if aimgtoimg_use_count = 1 + + jmp end_aimgtoimg_proc + +acolor dd 0 +aimgtoimg_proc: +;getout coord + mov [acolor],ebp + + mov eax,esi ;y cor + mul dword [ecx] ;canvas xsize + add eax,edi ;x cor + mov ebp,eax + shl eax,1 + add ebp,eax + add ebp,ecx ;canvas+8;start + add ebp,8 +;get img size + mov eax,ebx ;img ;xsize + mov esi,[eax] + add ebx,4 + mov eax,ebx ; img+4 ;ysize + mov edi,[eax] + add ebx,4 + mov edx,ebx ;img+8 +loo2: +push esi +loo: + +;test on alpha color + mov eax,[edx] + shl eax,8 + shr eax,8 + cmp eax,[acolor] + jne yx + add edx,3 + add ebp,3 + jmp nx +yx: + + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx +nx: + dec esi + jnz loo +pop esi + sub ebp,3 + mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) + sub eax,esi + add ebp,eax + shl eax,1 + add ebp,eax + + add ebp,3 + + dec edi + jnz loo2 + ret +end_aimgtoimg_proc: +end if + push img + push canvas + push x + push y + push acol + pop ebp + pop esi + pop edi + pop ecx + pop ebx + call aimgtoimg_proc +} + + + + +imgtoimg_use_count=0 +macro imgtoimg img, x, y, canvas +{ +local loo,loo2 +imgtoimg_use_count=imgtoimg_use_count+1 +if imgtoimg_use_count = 1 + + jmp end_imgtoimg_proc +imgtoimg_proc: +;getout coord + mov eax,esi ;y cor + mul dword [ecx] ;canvas xsize + add eax,edi ;x cor + mov ebp,eax + shl eax,1 + add ebp,eax + add ebp,ecx ;canvas+8;start + add ebp,8 +;get img size + mov eax,ebx ;img ;xsize + mov esi,[eax] + add ebx,4 + mov eax,ebx ; img+4 ;ysize + mov edi,[eax] + add ebx,4 + mov edx,ebx ;img+8 +loo2: +push esi +loo: + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + mov al,byte [edx] + mov byte [ebp],al + inc ebp + inc edx + dec esi + jnz loo +pop esi + sub ebp,3 + mov eax,[ecx] ;offset = offset+((canxsize-imgxsize)*3) + sub eax,esi + add ebp,eax + shl eax,1 + add ebp,eax + + add ebp,3 + + dec edi + jnz loo2 + ret +end_imgtoimg_proc: +end if + push img + push canvas + push x + push y + pop esi + pop edi + pop ecx + pop ebx + call imgtoimg_proc +} + + +;DrawBox +macro drawfbox x,y,xs,ys,color +{ + wordstoreg ebx,x,xs ;x*65536+xs + wordstoreg ecx,y,ys ;y*65536+ys + mov edx,color + mov eax,13 + int 0x40 +} + +; FPS - Set Frame Per Second Display +fps_show_frequency=40 +macro fps x,y,color,delcolor +{ +local spdat,savetime,new_time,fps,fps_cntr,out_fps,new_time,ttt +local no_out_fps + jmp spdat +savetime dd 0 +fps_cntr dd 0 +fps dd 0 +ttt dd 0 +spdat: +get_time: + mov eax,3 + int 0x40 + cmp eax,[savetime] + jne new_time + inc [fps_cntr] + cmp dword [ttt],0 + je out_fps + dec dword [ttt] + jmp no_out_fps +new_time: + mov [savetime],eax + mov ebx,[fps_cntr] + mov [fps],ebx + mov [fps_cntr],0 +out_fps: +if ~(delcolor eq ) + mov ebx,x*65536+30 + mov ecx,y*65536+7 + mov edx,delcolor + mov eax,13 + int 0x40 +end if + mov dword [ttt],fps_show_frequency + mov eax,47 + mov ebx,5*65536 +; mov bl,0 + mov edx,x*65536+y + mov esi,color + mov ecx,[fps] + int 0x40 +no_out_fps: +} + +; COLLIMG - Collusion image's +_1dbounce_count=0; +macro collimg img1_off,x1,y1,img2_off,x2,y2,otv +{ +local bounce,exit,anot,bc,nbc + mov esi,[img1_off] ;xs1 + mov edi,[img2_off] ;ys2 + mov eax,x1 ; + mov ebx,x2 ; + call _1dbounce + mov edx,ecx + mov esi,[img1_off+4] ;ys1 + mov edi,[img2_off+4] ;ys2 + mov eax,y1 ; + mov ebx,y2 ; + call _1dbounce + add edx,ecx + cmp edx,2 + je bounce + mov otv,0 + jmp exit +_1dbounce_count=_1dbounce_count+1 +if _1dbounce_count = 1 +_1dbounce: + cmp ebx,eax + jb anot + add eax,esi + cmp eax,ebx + jbe nbc +bc: + mov ecx,1 + ret +anot: + add ebx,edi + cmp ebx,eax + ja bc +nbc: + xor ecx,ecx + ret +end if +bounce: + mov otv,1 +exit: +} + +macro rgbtobgr image +{ +local loo + mov eax,[image] + mul dword [image+4] + mov ecx,eax + mov esi,image+8 +; add esi,8 +loo: + mov al,[esi] + mov bl,[esi+2] + mov [esi],bl + mov [esi+2],al + add esi,3 + dec ecx + jnz loo +} + + +macro setimg x , y ,arg3 +{ + mov eax,7 + mov ebx,arg3 + add ebx,8 + mov cx,[arg3] + shl ecx,16 + add cx,[arg3+4] +; wordstoreg ecx,[arg3],[arg3+4] + wordstoreg edx, x , y ;arg1*65536+arg2 + int 0x40 +} + +macro setframe x , y ,arg3 +{ + mov eax,7 + mov ebx,arg3 + add ebx,8 + wordstoreg edx, x , y ;arg1*65536+arg2 + add edx,dword [arg3] + mov ecx,dword [arg3+4] + int 0x40 +} + + +macro getimg imgsrc,x,y,xs,ys,imgdest +{ +local cyc +if xs eqtype 0 + mov dword [imgdest],xs +else + mov eax,xs + mov dword [imgdest],eax +end if +if ys eqtype 0 + mov dword [imgdest+4],ys +else + mov eax,ys + mov dword [imgdest+4],eax +end if + + mov eax,dword [imgsrc] ;getx size +; lea ecx,[eax+2*eax] + mov ecx,eax + shl ecx,1 + add ecx,eax + + mov ebx,y + mul ebx + add eax,x + mov edx,ecx + lea eax,[eax+2*eax] ;eax=offset on imsrc +; mov ebp,eax +; shl eax,1 +; add eax,ebp + + mov ecx,xs + mov ebx,ys + + mov edi,8+imgdest + lea esi,[eax+8+imgsrc] +; mov esi,eax +; add esi,8 +; add esi,imgsrc + + cld +cyc: + movsw + movsb + dec ecx + jne cyc + add esi,edx + mov ecx,xs + sub esi,ecx + sub esi,ecx + sub esi,ecx + dec ebx + jne cyc +} + +macro copyimg img2_off,img1_off +{ + mov eax,dword [img1_off] + mov ebx,dword [img1_off+4] + mul ebx + lea ecx,[eax+2*eax] + lea esi,[img1_off+8] + lea edi,[img2_off+8] + cld + rep movsb +} + +macro fullimg img_off,xs,ys,color +{ +local cop + mov eax,xs + mov ebx,ys + mov dword [img_off],eax + mov dword [img_off+4],ebx + mul ebx + lea ebp,[eax+2*eax] + mov esi,color +if color eqtype 0 + mov ecx,color/65536 +else + mov ecx,esi + shr ecx,16 +end if + xor edi,edi +cop: + mov word [img_off+8+edi],si + add edi,2 + mov byte [img_off+8+edi],cl + inc edi + cmp edi,ebp + jne cop +} + + + + ; number of frame in ecx + ; callculatin offset of raw data + +macro getframeoff num_of_frame,offset_of_animation,offset_of_frame +{ +local loo,setpic + mov ebp,num_of_frame ;ecx + mov esi,offset_of_animation;Image +loo: + cmp ebp,0 + je setpic + movzx eax,word [esi+4] + movzx ebx,word [esi+6] + mul ebx ;dword [esi+4] + mov ebx,3 + mul ebx + add eax,8 + add esi,eax + dec ebp + jmp loo +setpic: + mov dword offset_of_frame,esi +} + + +; BMPTOIMG -Convert BMP format TO IMG format +; (SYNTAX) BMPTOIMG BMP_source_offset,IMG_dest_ofset +; (SAMPLE) View BMPLS.ASM sample. +; ( NOTE ) This is macros is not brake bmp structure! Tested in 32,8,4 bits + + +bmptoimg_data_area_count=0 +macro bmptoimg bmp_load_area,img_dest_area +{ +local fileinfo,string,end_bmp,nodix +local converttable,noaddelem,nextbit,convert1bpp,convert4bpp,convert2 +local nextelem,convertno32,nomorestring,convert1,nextstring,yespicsize +;local qwe,bmpfn + +; convert: + movzx eax,word [bmp_load_area+28] + mul dword [bmp_load_area+18] + add eax,31 + shr eax,5 + mov dword [bmptoimg_data_area_dwps],eax ;dwps-doublewords per string + shl eax,2 + mov dword [bmptoimg_data_area_bps],eax ;bps-bytes per string + + cmp dword [bmp_load_area+34],0 + jne yespicsize ;if picture size is defined + mul dword [bmp_load_area+22] + mov dword [bmp_load_area+34],eax + + yespicsize: + mov ebp,img_dest_area+8 + + mov eax,bmp_load_area + mov ebx,eax + add ebx, [bmp_load_area+2];file size + inc ebx + mov dword [bmptoimg_soi],ebx ;soi-start of image area for drawing + + add eax, [bmp_load_area+10] + mov dword [bmptoimg_data_area_sop],eax ;sop-start of picture in file + add eax, [bmp_load_area+34] + mov dword [bmptoimg_data_area_eop],eax ;eop-end of picture in file + mov eax, [bmp_load_area+18] + lea eax,[eax+2*eax] ;3x pixels in eax + + mov edi,dword [bmptoimg_soi] ;initializing + mov esi,dword [bmptoimg_data_area_eop] + sub esi,dword [bmptoimg_data_area_bps] + + + nextstring: + push edi + push ebp + cmp word [bmp_load_area+28],24 + jne convertno32 + + mov edi,ebp + mov ecx,[bmptoimg_data_area_dwps] + cld + rep movsd + + convert1: + pop ebp + pop edi + sub esi,dword [bmptoimg_data_area_bps] + sub esi,dword [bmptoimg_data_area_bps] + cmp esi,dword [bmptoimg_data_area_sop] + jb end_bmp + add edi,eax + add ebp,eax + jmp nextstring + + convertno32: + mov ebx,bmp_load_area + add ebx, [bmp_load_area+14] + add ebx,14 ;start of color table + push esi + add esi,dword [bmptoimg_data_area_bps] + mov dword [bmptoimg_data_area_eos],esi + pop esi + nextelem: + push eax + movzx eax,byte [esi] + cmp word [bmp_load_area+28],4 + je convert4bpp + cmp word [bmp_load_area+28],1 + je convert1bpp + call converttable + + convert2: + pop eax + inc esi + cmp esi,dword [bmptoimg_data_area_eos] + jae convert1 + add edi,3 + + add ebp,3 + + jmp nextelem + + convert4bpp: + shl ax,4 + shr al,4 + push ax + movzx eax,ah + call converttable + add edi,3 + + add ebp,3 + + pop ax + movzx eax,al + call converttable + jmp convert2 + + convert1bpp: + mov ecx,eax + mov edx,7 + nextbit: + xor eax,eax + bt ecx,edx + jnc noaddelem + inc eax + noaddelem: + push edx + call converttable + pop edx + dec edx + js convert2 + add edi,3 + + add ebp,3 + + jmp nextbit + + converttable: + shl eax,2 + add eax,ebx + mov edx, dword [eax] +; mov dword [edi],edx + mov [ebp],edx + ret + +bmptoimg_data_area_count=bmptoimg_data_area_count+1 +if bmptoimg_data_area_count = 1 +; DATA AREA +bmptoimg_soi dd 0 +bmptoimg_data_area_bps dd 0 +bmptoimg_data_area_dwps dd 0 +bmptoimg_data_area_sop dd 0 +bmptoimg_data_area_eop dd 0 +bmptoimg_data_area_eos dd 0 +end if + +end_bmp: + mov eax,dword [bmp_load_area+18] + mov ebx,dword [bmp_load_area+22] + mov dword [img_dest_area],eax + mov dword [img_dest_area+4],ebx +} + +; For convert RGB to BGR +COLOR_ORDER equ MENUETOS + +macro giftoani gifsrc,imgsrc,num_of_frames +{ +local hasharea, ReadGIF, nextblock,_null +local globalColor, img_count, cur_info, img_start +local codesize, compsize, bit_count, CC, EOI, Palette +local block_ofs, table_ptr, gifmacend +local no_gc, block_skip, no_comm, noextblock, uselocal +local setPal, filltable, reinit, cycle, zadd, noinc +local notintable, er, zend, nxt, continue, ex, Gif_skipmap +local Gif_get_sym, shift, nextbl, noblock, loop1, exx +local Gif_output, next, loop2 + +_null fix 0x1000 ; 0x1000 + +; jmp sss +; if defined gif_hash_offset +; else +; hasharea: +; times 4096 dd 0 ;4096 +; end if +;sss: + + mov esi,gifsrc ;Указатель на ГИФ фаил в памяти + mov edi,imgsrc ;Указатель на список картинок + + if defined gif_hash_offset + mov eax,gif_hash_offset ;Рабочая область минимум 4096*4 байт + else + mov eax,hasharea ;Рабочая область минимум 4096*4 байт + end if + + call ReadGIF + push ecx + pop dword num_of_frames + jmp gifmacend + + if defined gif_hash_offset + else + hasharea: + times 4096 dd 0 ;4096 + end if + +ReadGIF: + push esi edi + mov [table_ptr],eax + mov [cur_info],edi + xor eax,eax + mov [globalColor],eax + mov [img_count],eax + inc eax + cmp dword[esi],'GIF8' + jne er ; signature + mov ecx,[esi+0xa] + inc eax + add esi,0xd + mov edi,esi + bt ecx,7 + jnc nextblock + mov [globalColor],esi + call Gif_skipmap +nextblock: + cmp byte[edi],0x21 + jne noextblock + inc edi + cmp byte[edi],0xf9 ; Graphic Control Ext + jne no_gc + add edi,7 + jmp nextblock +no_gc: + cmp byte[edi],0xfe ; Comment Ext + jne no_comm + inc edi +block_skip: + movzx eax,byte[edi] + lea edi,[edi+eax+1] + cmp byte[edi],0 + jnz block_skip + inc edi + jmp nextblock +no_comm: + cmp byte[edi],0xff ; Application Ext + jne nextblock + add edi,13 + jmp block_skip +noextblock: + cmp byte[edi],0x2c ; image beginning + jne er + inc [img_count] + inc edi + mov esi,[cur_info] + xchg esi,edi + movsd + movsd + + push edi + movzx ecx,word[esi] + inc esi + bt ecx,7 + jc uselocal + push [globalColor] + mov edi,esi + jmp setPal +uselocal: + call Gif_skipmap + push esi +setPal: + movzx ecx,byte[edi] + inc ecx + mov [codesize],ecx + dec ecx + pop [Palette] + lea esi,[edi+1] + mov edi,[table_ptr] + xor eax,eax + cld + lodsb ; eax - block_count + add eax,esi + mov [block_ofs],eax + mov [bit_count],8 + mov eax,1 + shl eax,cl + mov [CC],eax + inc eax + mov [EOI],eax + lea ecx,[eax-1] + mov eax, _null shl 16 +filltable: + stosd + inc eax + loop filltable + pop edi + mov [img_start],edi +reinit: + mov edx,[EOI] + inc edx + push [codesize] + pop [compsize] + call Gif_get_sym + cmp eax,[CC] + je reinit + call Gif_output +cycle: + movzx ebx,ax + call Gif_get_sym + cmp eax,edx + jae notintable + cmp eax,[CC] + je reinit + cmp eax,[EOI] + je zend + call Gif_output +zadd: + push eax + mov eax,[table_ptr] + mov [eax+edx*4],ebx + pop eax + cmp edx,0xFFF + jae cycle + inc edx + bsr ebx,edx + cmp ebx,[compsize] + jne noinc + inc [compsize] +noinc: + jmp cycle +notintable: + push eax + mov eax,ebx + call Gif_output + push ebx + movzx eax,bx + call Gif_output + pop ebx eax + jmp zadd +er: + pop edi + jmp ex +zend: +; mov eax,[.cur_info] ; skip offset to next frame +; mov [eax],edi + mov [cur_info],edi + add esi,2 + xchg esi,edi +nxt: + cmp byte[edi],0 + jnz continue + inc edi + jmp nxt +continue: + cmp byte[edi],0x3b ;read next frame + jne nextblock + xor eax,eax + stosd + mov ecx,[img_count] +ex: + pop edi esi + ret + +Gif_skipmap: +; in: ecx - image descriptor, esi - pointer to colormap +; out: edi - pointer to area after colormap + + and ecx,111b + inc ecx ; color map size + mov ebx,1 + shl ebx,cl + lea ebx,[ebx*2+ebx] + lea edi,[esi+ebx] + ret + +Gif_get_sym: + mov ecx,[compsize] + push ecx + xor eax,eax +shift: + ror byte[esi],1 + rcr eax,1 + dec [bit_count] + jnz loop1 + inc esi + cmp esi,[block_ofs] + jb noblock + push eax + xor eax,eax + lodsb + test eax,eax + jnz nextbl + mov eax,[EOI] + sub esi,2 + add esp,8 + jmp exx +nextbl: + add eax,esi + mov [block_ofs],eax + pop eax +noblock: + mov [bit_count],8 +loop1: + loop shift + pop ecx + rol eax,cl +exx: + xor ecx,ecx + ret + +Gif_output: + push esi eax edx + mov edx,[table_ptr] +next: + push word[edx+eax*4] + mov ax,word[edx+eax*4+2] + inc ecx + cmp ax,_null + jnz next + shl ebx,16 + mov bx,[esp] +loop2: + pop ax + + lea esi,[eax+eax*2] + add esi,[Palette] + + if COLOR_ORDER eq MENUETOS + mov esi,[esi] + bswap esi + shr esi,8 + mov [edi],esi + add edi,3 + else + movsw + movsb + end if + + loop loop2 + pop edx eax esi + ret + + globalColor dd 1 + img_count dd 1 + cur_info dd 1 ; image table pointer + img_start dd 1 + codesize dd 1 + compsize dd 1 + bit_count dd 1 + CC dd 1 + EOI dd 1 + Palette dd 1 + block_ofs dd 1 + table_ptr dd 1 + +gifmacend: +} + + + +macro giftoimg gifsrc,imgsrc +{ +local hasharea, ReadGIF, nextblock,_null +local globalColor, img_count, cur_info, img_start +local codesize, compsize, bit_count, CC, EOI, Palette +local block_ofs, table_ptr, gifmacend +local no_gc, block_skip, no_comm, noextblock, uselocal +local setPal, filltable, reinit, cycle, zadd, noinc +local notintable, er, zend, nxt, continue, ex, Gif_skipmap +local Gif_get_sym, shift, nextbl, noblock, loop1, exx +local Gif_output, next, loop2 + +_null fix 0x1000 ; 0x1000 + + mov esi,gifsrc ;Указатель на ГИФ фаил в памяти + mov edi,imgsrc ;Указатель на список картинок + + if defined gif_hash_offset + mov eax,gif_hash_offset ;Рабочая область минимум 4096*4 байт + else + mov eax,hasharea ;Рабочая область минимум 4096*4 байт + end if + + call ReadGIF + jmp gifmacend + + if defined gif_hash_offset + else + hasharea: + times 4096 dd 0 ;4096 + end if + +ReadGIF: + push esi edi + mov [table_ptr],eax + mov [cur_info],edi + xor eax,eax + mov [globalColor],eax + mov [img_count],eax + inc eax + cmp dword[esi],'GIF8' + jne er ; signature + mov ecx,[esi+0xa] + inc eax + add esi,0xd + mov edi,esi + bt ecx,7 + jnc nextblock + mov [globalColor],esi + call Gif_skipmap +nextblock: + cmp byte[edi],0x21 + jne noextblock + inc edi + cmp byte[edi],0xf9 ; Graphic Control Ext + jne no_gc + add edi,7 + jmp nextblock +no_gc: + cmp byte[edi],0xfe ; Comment Ext + jne no_comm + inc edi +block_skip: + movzx eax,byte[edi] + lea edi,[edi+eax+1] + cmp byte[edi],0 + jnz block_skip + inc edi + jmp nextblock +no_comm: + cmp byte[edi],0xff ; Application Ext + jne nextblock + add edi,13 + jmp block_skip +noextblock: + cmp byte[edi],0x2c ; image beginning + jne er + inc [img_count] + inc edi + mov esi,[cur_info] + xchg esi,edi +; movsd +; movsd + + mov bp,word[esi+4] + movzx ebx,bp + mov [edi],ebx + + mov bp,word[esi+6] + movzx ebx,bp + mov [edi+4],ebx + + add edi,8 + add esi,8 + + push edi + movzx ecx,word[esi] + inc esi + bt ecx,7 + jc uselocal + push [globalColor] + mov edi,esi + jmp setPal +uselocal: + call Gif_skipmap + push esi +setPal: + movzx ecx,byte[edi] + inc ecx + mov [codesize],ecx + dec ecx + pop [Palette] + lea esi,[edi+1] + mov edi,[table_ptr] + xor eax,eax + cld + lodsb ; eax - block_count + add eax,esi + mov [block_ofs],eax + mov [bit_count],8 + mov eax,1 + shl eax,cl + mov [CC],eax + inc eax + mov [EOI],eax + lea ecx,[eax-1] + mov eax, _null shl 16 +filltable: + stosd + inc eax + loop filltable + pop edi + mov [img_start],edi +reinit: + mov edx,[EOI] + inc edx + push [codesize] + pop [compsize] + call Gif_get_sym + cmp eax,[CC] + je reinit + call Gif_output +cycle: + movzx ebx,ax + call Gif_get_sym + cmp eax,edx + jae notintable + cmp eax,[CC] + je reinit + cmp eax,[EOI] + je zend + call Gif_output +zadd: + push eax + mov eax,[table_ptr] + mov [eax+edx*4],ebx + pop eax + cmp edx,0xFFF + jae cycle + inc edx + bsr ebx,edx + cmp ebx,[compsize] + jne noinc + inc [compsize] +noinc: + jmp cycle +notintable: + push eax + mov eax,ebx + call Gif_output + push ebx + movzx eax,bx + call Gif_output + pop ebx eax + jmp zadd +er: + pop edi + jmp ex +zend: +; mov eax,[.cur_info] ; skip offset to next frame +; mov [eax],edi + mov [cur_info],edi + add esi,2 + xchg esi,edi +nxt: + cmp byte[edi],0 + jnz continue + inc edi + jmp nxt +continue: +; cmp byte[edi],0x3b ;read next frame +; jne nextblock + xor eax,eax + stosd + mov ecx,[img_count] +ex: + pop edi esi + ret + +Gif_skipmap: +; in: ecx - image descriptor, esi - pointer to colormap +; out: edi - pointer to area after colormap + + and ecx,111b + inc ecx ; color map size + mov ebx,1 + shl ebx,cl + lea ebx,[ebx*2+ebx] + lea edi,[esi+ebx] + ret + +Gif_get_sym: + mov ecx,[compsize] + push ecx + xor eax,eax +shift: + ror byte[esi],1 + rcr eax,1 + dec [bit_count] + jnz loop1 + inc esi + cmp esi,[block_ofs] + jb noblock + push eax + xor eax,eax + lodsb + test eax,eax + jnz nextbl + mov eax,[EOI] + sub esi,2 + add esp,8 + jmp exx +nextbl: + add eax,esi + mov [block_ofs],eax + pop eax +noblock: + mov [bit_count],8 +loop1: + loop shift + pop ecx + rol eax,cl +exx: + xor ecx,ecx + ret + +Gif_output: + push esi eax edx + mov edx,[table_ptr] +next: + push word[edx+eax*4] + mov ax,word[edx+eax*4+2] + inc ecx + cmp ax,_null + jnz next + shl ebx,16 + mov bx,[esp] +loop2: + pop ax + + lea esi,[eax+eax*2] + add esi,[Palette] + + if COLOR_ORDER eq MENUETOS + mov esi,[esi] + bswap esi + shr esi,8 + mov [edi],esi + add edi,3 + else + movsw + movsb + end if + + loop loop2 + pop edx eax esi + ret + + globalColor dd 1 + img_count dd 1 + cur_info dd 1 ; image table pointer + img_start dd 1 + codesize dd 1 + compsize dd 1 + bit_count dd 1 + CC dd 1 + EOI dd 1 + Palette dd 1 + block_ofs dd 1 + table_ptr dd 1 + +gifmacend: +} + diff --git a/programs/arcanoid/trunk/ascgml.inc b/programs/arcanoid/trunk/ascgml.inc new file mode 100644 index 0000000000..e1d3107b6d --- /dev/null +++ b/programs/arcanoid/trunk/ascgml.inc @@ -0,0 +1,49 @@ +lang equ ru + +; +; Assembler +; SMALL +; CODE +; GaMe +; Libary +; +; Ver 0.03 By Pavlushin Evgeni (RUSSIA) +; www.waptap@mail.ru + +;InfoList +;0.01 correct +;0.02 control ~14.05.2004 +;0.03 all macros optimized by halyavin, add at ~07.06.2004 + + +; corectiryemoe,corectnoe,step +macro correct arg1,arg2,arg3 +{ +local plus,minus,equal + mov eax,arg2 + cmp arg1,eax + je equal + mov eax,arg3 + ja minus +plus: + add arg1,eax + jmp equal +minus: + sub arg1,eax +equal: +} + +macro control min,max,arg +{ +local gr,low,norm + mov eax,max + cmp arg,eax + jg gr + mov eax,min + cmp arg,eax + jnl norm +gr: +low: + mov arg,eax +norm: +} diff --git a/programs/arcanoid/trunk/ascl.inc b/programs/arcanoid/trunk/ascl.inc new file mode 100644 index 0000000000..20a18bf31d --- /dev/null +++ b/programs/arcanoid/trunk/ascl.inc @@ -0,0 +1,835 @@ +lang equ ru ; ru en fr ge fi + +; +; Assembler +; SMALL +; CODE +; Libary +; +; Ver 0.14 By Pavlushin Evgeni (RUSSIA) +; www.waptap@mail.ru + +;Please compile aplications on FASM ver1.54 or higer!!! + +;InfoList +;0.01 scank,putpix,puttxt +;0.02 label,random,colors +;0.03 window,startwd,endwd,attributes +;0.04 close,delay,scevent ~30.04.2004 +;0.05 small random, ~04.05.2004 +;0.06 wtevent ~09.05.2004 +;0.07 timeevent ~23.05.2004 +;0.08 txtput ~14.06.2004 +;0.09 opendialog,savedialog ~20.06.2004 +;0.10 wordstoreg by halyavin, add at ~30.08.2004 +; random bug deleted eax is use. +;0.11 loadfile from me +puttxt bug del ~07.09.2004 +;0.12 open/save dialog ~13.09.2004 +;0.13 dialogs bugs deleted +;0.14 drawlbut ~03.10.2004 + +; LOADFILE +; (SYNTAX) LOADFILE 'full_path_to_file',file_load_area,file_temp_area +; (SAMPLE) LOADFILE '/rd/1/clock.bmp',load_area,temp_area + +macro loadfile file_name,file_load_area,file_temp_area +{ +local open,fileinfo,string + jmp open +fileinfo: + dd 0 + dd 0 + dd 1 + dd file_load_area + dd file_temp_area +string: + db file_name,0 +open: + mov dword [fileinfo+8],1 ; how many blocks to read (1) + mov eax,58 + mov ebx,fileinfo + int 0x40 + mov eax,[file_load_area+2] + shr eax,9 ; поделим на 512 и прибавим 1 - получим число блоков + inc eax + mov dword [fileinfo+8],eax + mov eax,58 + mov ebx,fileinfo + int 0x40 +} + + +macro wordstoreg reg,hiword,loword +{ +if hiword eqtype 0 & loword eqtype 0 + mov reg,hiword*65536+loword +else if hiword eqtype 12 & loword eqtype eax + mov reg,hiword*65536 + add reg,loword +else if hiword eqtype 12 & loword eqtype [123] + mov reg,hiword*65536 + add reg,loword +else + mov reg,hiword + shl reg,16 + add reg,loword +end if +} + + +; DRAW BUTTON with label + +macro drawlbut x,y,xs,ys,text,id,bcolor,tcolor +{ +local asd,lab + jmp asd +lab db text ;arg label +asd: + wordstoreg ebx,x,xs + wordstoreg ecx,y,ys + mov edx,id + mov esi,bcolor + mov eax,8 + int 0x40 + + mov eax,asd-lab ;calc size + mov ebx,6 + mul ebx + mov esi,eax + + mov eax,xs + sub eax,esi + shr eax,1 + add eax,x + + mov edx,ys + sub edx,7 + shr edx,1 + add edx,y + + mov ebx,eax + shl ebx,16 + add ebx,edx + + mov ecx,tcolor ;arg4 color + mov edx,lab + mov esi,asd-lab ;calc size + mov eax,4 + int 0x40 +} + + +macro opendialog redproc,openoff,erroff,path +{ +local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc +local run_fileinfo, param +local getmesloop, loox, mred, mkey, mbutton, mgetmes +local dlg_is_work, ready, procinfo +; +; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, +; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) +; + + cld +;; mov esi,path + mov edi,path + mov eax,0 + mov ecx,200 + rep stosb + +;mov [get_loops],0 +mov [dlg_pid_get],0 + +; Get my PID in dec format 4 bytes + mov eax,9 + mov ebx,procinfo + mov ecx,-1 + int 0x40 + +; convert eax bin to param dec + mov eax,dword [procinfo+30] ;offset of myPID + mov edi,param+4-1 ;offset to 4 bytes + mov ecx,4 + mov ebx,10 + cld +new_d: + xor edx,edx + div ebx + add dl,'0' + mov [edi],dl + dec edi + loop new_d + +; wirite 1 byte space to param + mov [param+4],byte 32 ;Space for next parametr +; and 1 byte type of dialog to param + mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog) + +; +; STEP2 prepare IPC area for get messages +; + +; prepare IPC area + mov [path],dword 0 + mov [path+4],dword 8 + +; define IPC memory + mov eax,60 + mov ebx,1 ; define IPC + mov ecx,path ; offset of area + mov edx,150 ; size 150 bytes + int 0x40 + +; change wanted events list 7-bit IPC event + mov eax,40 + mov ebx,01000111b + int 0x40 + +; +; STEP 3 run SYSTEM XTREE with parameters +; + + mov eax,58 + mov ebx,run_fileinfo + int 0x40 + + call redproc + + mov [get_loops],0 +getmesloop: + mov eax,23 + mov ebx,50 ;0.5 sec + int 0x40 + + cmp eax,1 + je mred + cmp eax,2 + je mkey + cmp eax,3 + je mbutton + cmp eax,7 + je mgetmes + +; Get number of procces + mov ebx,procinfo + mov ecx,-1 + mov eax,9 + int 0x40 + mov ebp,eax + +loox: + mov eax,9 + mov ebx,procinfo + mov ecx,ebp + int 0x40 + mov eax,[DLGPID] + cmp [procinfo+30],eax ;IF Dialog find + je dlg_is_work ;jmp to dlg_is_work + dec ebp + jnz loox + + jmp erroff + +dlg_is_work: + cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated + je erroff ;TESTODP2 terminated too + + cmp [dlg_pid_get],dword 1 + je getmesloop + inc [get_loops] + cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated + jae erroff + jmp getmesloop + +mred: + call redproc + jmp getmesloop +mkey: + mov eax,2 + int 0x40 ; read (eax=2) + jmp getmesloop +mbutton: + mov eax,17 ; get id + int 0x40 + cmp ah,1 ; button id=1 ? + jne getmesloop + mov eax,-1 ; close this program + int 0x40 +mgetmes: + +; If dlg_pid_get then second message get jmp to still + cmp [dlg_pid_get],dword 1 + je ready + +; First message is number of PID SYSXTREE dialog + +; convert PID dec to PID bin + movzx eax,byte [path+16] + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+1] + add eax,ebx + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+2] + add eax,ebx + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+3] + add eax,ebx + sub eax,48 + mov [DLGPID],eax + +; Claear and prepare IPC area for next message + mov [path],dword 0 + mov [path+4],dword 8 + mov [path+8],dword 0 + mov [path+12],dword 0 + mov [path+16],dword 0 + +; Set dlg_pid_get for get next message + mov [dlg_pid_get],dword 1 + call redproc ;show DLG_PID + jmp getmesloop + +ready: +; +; The second message get +; Second message is 100 bytes path to SAVE/OPEN file +; shl path string on 16 bytes +; + cld + mov esi,path+16 + mov edi,path + mov ecx,200 + rep movsb + mov [edi],byte 0 + + jmp openoff + + +; DATA AREA +get_loops dd 0 +dlg_pid_get dd 0 +DLGPID dd 0 + +param: + dd 0 ; My dec PID + dd 0,0 ; Type of dialog + +run_fileinfo: + dd 16 + dd 0 + dd param + dd 0 + dd procinfo ; 0x10000 +;run_filepath + db '/RD/1/SYSXTREE',0 + +procinfo: +times 256 db 0 +} + + +macro savedialog redproc,openoff,erroff,path +{ +local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc +local run_fileinfo, run_filepath, param +local getmesloop, loox, mred, mkey, mbutton, mgetmes +local dlg_is_work, ready, procinfo +; +; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, +; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) +; + + cld +;; mov esi,path + mov edi,path + mov eax,0 + mov ecx,200 + rep stosb + +;mov [get_loops],0 +mov [dlg_pid_get],0 + +; Get my PID in dec format 4 bytes + mov eax,9 + mov ebx,procinfo + mov ecx,-1 + int 0x40 + +; convert eax bin to param dec + mov eax,dword [procinfo+30] ;offset of myPID + mov edi,param+4-1 ;offset to 4 bytes + mov ecx,4 + mov ebx,10 + cld +new_d: + xor edx,edx + div ebx + add dl,'0' + mov [edi],dl + dec edi + loop new_d + +; wirite 1 byte space to param + mov [param+4],byte 32 ;Space for next parametr +; and 1 byte type of dialog to param + mov [param+5],byte 'S' ;Get Open dialog (Use 'S' for Save dialog) + +; +; STEP2 prepare IPC area for get messages +; + +; prepare IPC area + mov [path],dword 0 + mov [path+4],dword 8 + +; define IPC memory + mov eax,60 + mov ebx,1 ; define IPC + mov ecx,path ; offset of area + mov edx,120 ; size 150 bytes + int 0x40 + +; change wanted events list 7-bit IPC event + mov eax,40 + mov ebx,01000111b + int 0x40 + +; +; STEP 3 run SYSTEM XTREE with parameters +; + + mov eax,58 + mov ebx,run_fileinfo + int 0x40 + + call redproc + + mov [get_loops],0 +getmesloop: + mov eax,23 + mov ebx,50 ;0.5 sec + int 0x40 + + cmp eax,1 + je mred + cmp eax,2 + je mkey + cmp eax,3 + je mbutton + cmp eax,7 + je mgetmes + +; Get number of procces + mov ebx,procinfo + mov ecx,-1 + mov eax,9 + int 0x40 + mov ebp,eax + +loox: + mov eax,9 + mov ebx,procinfo + mov ecx,ebp + int 0x40 + mov eax,[DLGPID] + cmp [procinfo+30],eax ;IF Dialog find + je dlg_is_work ;jmp to dlg_is_work + dec ebp + jnz loox + + jmp erroff + +dlg_is_work: + cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated + je erroff ;TESTODP2 terminated too + + cmp [dlg_pid_get],dword 1 + je getmesloop + inc [get_loops] + cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated + jae erroff + jmp getmesloop + +mred: + call redproc + jmp getmesloop +mkey: + int 0x40 ; read (eax=2) + jmp getmesloop +mbutton: + mov eax,17 ; get id + int 0x40 + cmp ah,1 ; button id=1 ? + jne getmesloop + mov eax,-1 ; close this program + int 0x40 +mgetmes: + +; If dlg_pid_get then second message get jmp to still + cmp [dlg_pid_get],dword 1 + je ready + +; First message is number of PID SYSXTREE dialog + +; convert PID dec to PID bin + movzx eax,byte [path+16] + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+1] + add eax,ebx + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+2] + add eax,ebx + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+3] + add eax,ebx + sub eax,48 + mov [DLGPID],eax + +; Claear and prepare IPC area for next message + mov [path],dword 0 + mov [path+4],dword 8 + mov [path+8],dword 0 + mov [path+12],dword 0 + mov [path+16],dword 0 + +; Set dlg_pid_get for get next message + mov [dlg_pid_get],dword 1 + call redproc ;show DLG_PID + jmp getmesloop + +ready: +; +; The second message get +; Second message is 100 bytes path to SAVE/OPEN file +; shl path string on 16 bytes +; + cld + mov esi,path+16 + mov edi,path + mov ecx,200 + rep movsb + mov [edi],byte 0 + + jmp openoff + + +; DATA AREA +get_loops dd 0 +dlg_pid_get dd 0 +DLGPID dd 0 + +param: + rb 4 ; My dec PID + rb 6 ; Type of dialog + +run_fileinfo: + dd 16 + dd 0 + dd param + dd 0 + dd procinfo +run_filepath: + db '/RD/1/SYSXTREE',0 + +procinfo: +times 256 db 0 +} + + + + +; RANDOM - generate random count (small) +; (SYNTAX) RANDOM MaxCount,OutArgument +; (SAMPLE) RANDOM 10000,eax +; ( NOTE ) Maxint<65536 ; use random 65536,eax for more combinations + +randomuse = 0 + +macro random arg1,arg2 +{ +local rxproc +randomuse = randomuse + 1 + + jmp rxproc + +if defined randomuse & randomuse = 1 +randomproc: + jmp rnj +rsx1 dw 0x4321 +rsx2 dw 0x1234 +rnj: +; mov eax,arg1 + push bx + push cx + push dx + push si + push di + mov cx,ax + mov ax,word ptr rsx1 + mov bx,word ptr rsx2 + mov si,ax + mov di,bx + mov dl,ah + mov ah,al + mov al,bh + mov bh,bl + xor bl,bl + rcr dl,1 + rcr ax,1 + rcr bx,1 + add bx,di + adc ax,si + add bx,0x62e9 + adc ax,0x3619 + mov word ptr rsx1,bx + mov word ptr rsx2,ax + xor dx,dx + cmp ax,0 + je nodiv + cmp cx,0 + je nodiv + div cx +nodiv: + mov ax,dx + pop di + pop si + pop dx + pop cx + pop bx + and eax,0000ffffh +; mov arg2,0 +; mov arg2,eax + ret +end if + +rxproc: + mov eax,arg1 + call randomproc + mov arg2,eax +} + +macro scank +{ + mov eax,10 + int 0x40 +} + +macro putpix x,y,color +{ + mov ebx,x + mov ecx,y + mov edx,color + mov eax,1 + int 0x40 +} + +macro puttxt x,y,offs,size,color +{ +; mov ebx,x +; shl ebx,16 +; add ebx,y + wordstoreg ebx,x,y + mov ecx,color + mov edx,offs + mov esi,size + mov eax,4 + int 0x40 +} + +macro outcount data, x, y, color, numtype +{ + mov ecx,data + mov ebx,numtype + mov bl,0 +; mov edx,x*65536+y + wordstoreg edx,x,y + mov esi,color + mov eax,47 + int 0x40 +} + +; SCEVENT - Scan event + +macro scevent red,key,but +{ + mov eax,11 + int 0x40 + dec eax + jz red + dec eax + jz key + dec eax + jz but +} + +; WTEVENT - Wait event + +macro wtevent red,key,but +{ + mov eax,10 + int 0x40 + dec eax + jz red + dec eax + jz key + dec eax + jz but +} + +; TIMEEVENT - Wite for event with timeout + +macro timeevent xfps,noevent,red,key,but +{ + mov eax,23 + mov ebx,xfps + int 0x40 + cmp eax,0 + je noevent + dec eax + jz red + dec eax + jz key + dec eax + jz but +} + + +; CLOSE - Close program + +macro close +{ + mov eax,-1 + int 0x40 +} + +; DELAY - Create delay 1/100 sec +; (SYNTAX) Delay time +; (SAMPLE) Delay 100 ;delay 2 sec 1/100*200=2 sec + +macro delay arg1 +{ + mov eax,5 + mov ebx,arg1 + int 0x40 +} + +; WINDOW - Draw window +; (SYNTAX) WINDOW Xstart,Ystart,'Text',Color +; (SAMPLE) WINDOW 10,10,640+8,480+24,window_Skinned + +macro window arg1,arg2,arg3,arg4,arg5 +{ +; mov ebx,arg1*65536+arg3 +; mov ecx,arg2*65536+arg4 + wordstoreg ebx,arg1,arg3 + wordstoreg ecx,arg2,arg4 + mov edx,arg5 + mov eax,0 + int 0x40 +} + +macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7 +{ + mov ebx,arg1*65536+arg3 + mov ecx,arg2*65536+arg4 + mov edx,arg5 + mov esi,arg6 + mov edi,arg7 + mov eax,0 + int 0x40 +} + + +; STARTWD - Start of window draw + +macro startwd +{ + mov eax,12 + mov ebx,1 + int 0x40 +} + +; ENDWD - End window draw + +macro endwd +{ + mov eax,12 + mov ebx,2 + int 0x40 +} + +; LABEL - Put text to frame +; (SYNTAX) LABEL Xstart,Ystart,'Text',Color +; (SAMPLE) LABEL 10,12,'Hello World!',cl_Green+font_Big + +macro label arg1,arg2,arg3,arg4 +{ +local asd,lab + jmp asd +lab db arg3 ;arg label +asd: +; mov ebx,arg1 ;arg1=y arg2=x +; shl ebx,16 +; add ebx,arg2 + wordstoreg ebx,arg1,arg2 + mov ecx,arg4 ;arg4 color + mov edx,lab + mov esi,asd-lab ;calc size + mov eax,4 + int 0x40 +} + +;Key's +key_Up equ 178 +key_Down equ 177 +key_Right equ 179 +key_Left equ 176 +key_Esc equ 27 +key_Space equ 32 +key_Enter equ 13 +key_Bspace equ 8 +key_F1 equ 50 +key_F2 equ 51 +key_F3 equ 52 +key_F4 equ 53 +key_F5 equ 54 +key_F6 equ 55 +key_F7 equ 56 +key_F8 equ 57 +key_F9 equ 48 +key_F10 equ 49 +key_F11 equ 68 +key_F12 equ 255 +key_Home equ 180 +key_End equ 181 +key_PgUp equ 184 +key_PgDown equ 183 + +;Attributes + +;Window Attributes +window_Skinned equ 0x03000000 +window_Type2 equ 0x02000000 +window_Type1 equ 0x00000000 +window_Reserve equ 0x01000000 + +;Font Attributes +font_Big equ 0x10000000 + +;Colors +cl_White equ 0x00ffffff +cl_Black equ 0x00000000 +cl_Grey equ 0x00888888 +cl_Red equ 0x00ff0000 +cl_Lime equ 0x0000ff00 +cl_Green equ 0x0000af00 +cl_Blue equ 0x000000ff +cl_Purple equ 0x008080ff +cl_Violet equ 0x008040ff +cl_Cyan equ 0x0040e0ff diff --git a/programs/arcanoid/trunk/build_en.bat b/programs/arcanoid/trunk/build_en.bat new file mode 100644 index 0000000000..fd4e1ac468 --- /dev/null +++ b/programs/arcanoid/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm arcanoid.asm arcanoid +@pause \ No newline at end of file diff --git a/programs/arcanoid/trunk/build_ru.bat b/programs/arcanoid/trunk/build_ru.bat new file mode 100644 index 0000000000..b2daa0cacc --- /dev/null +++ b/programs/arcanoid/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm arcanoid.asm arcanoid +@pause \ No newline at end of file diff --git a/programs/archer/trunk/@RCHER.ASM b/programs/archer/trunk/@RCHER.ASM new file mode 100644 index 0000000000..e9c63067f5 --- /dev/null +++ b/programs/archer/trunk/@RCHER.ASM @@ -0,0 +1,424 @@ +; @RCHER - DEflate unpacker v1.0 +; +; Written in pure assembler by Ivushkin Andrey aka Willow +; +; Created: May 6, 2005 +; +; Last changed: July 14, 2005 +; +; Compile with FASM + + +SYS equ meos +PARAM_PTR equ png_image +DUMPFILE equ '/hd/1/out.txt' + +SHOW_RBLOCK equ 0;1 +SHOW_PNG_SEC equ 0;1 +SHOW_METH equ 0;1 +FILE_NUM equ 0 +MEMORY equ 0x800000 + +BITS equ 16 +BUFSIZE equ 32 +BUFPTR equ area + +PASSW_LEN equ 32 +NO_STOPS equ 1 +SHOW_CHARS equ 0 +BSIZE equ 512 +INBUF equ BUFSIZE*BSIZE*2 +OUTBUF equ 4*1024*1024 +IGNORE_DIRS equ 0 + +MOVE_SLINE_LEV equ 8 + +DECRYPT_MODE equ 100b +PNG_MODE equ 10b +TAR_MODE equ 1000b +STAY_MODE equ 10000b +IPC_MODE equ 100000b +RAW_MODE equ 1000000b +THREAD_YES equ 10000000b + +if SYS eq win +format PE console +entry start +;match =win,SYS +;{ +; include 'D:\Ivushkin\projects\fasmw\INCLUDE\win32a.inc' +;} +else +use32 + + org 0x0 + + db 'MENUET01' + dd 0x01 + dd start + dd I_END + dd MEMORY + dd MEMORY-2048 +if PARAM_PTR eq param + dd 0 +else + dd PARAM_PTR +end if + dd 0x0 +include "lang.inc" + +if PARAM_PTR eq param + param db 'RQ' + db '000037' + db '/hd/1/zip/png.zip',0 +end if +;match =meos,SYS +;{ + include "macros.inc" +; purge mov + include "debug.inc" +;} +end if + +language equ en + +if SYS eq win +section '.text' code readable executable writeable +end if +include "arcmacro.inc" +include "parser.inc" +include "deflate.inc" +include "sys.inc" + +FileNum dd FILE_NUM +;FNAME equ '/hd/1/zip/pngsuite/s01n3p01.png' + +start: +if SYS eq win + invoke GetStdHandle, STD_OUTPUT_HANDLE + mov [cons],eax + invoke GetStdHandle, STD_INPUT_HANDLE + mov [cons_in],eax + Msg 0 + Msg 1 +else + Msg 0 + Msg 1 + mcall 40,10000101b +; jmp again + CmdLine + red: + call draw_window + mcall 12,2 + + still: + mcall 10 + cmp eax,1 + je red + cmp eax,2 + jne .nokey + mcall 2 + cmp ah,9 + jz quit + jmp still + .nokey: + cmp eax,3 + jne still + mcall 17 + cmp ah,1 + jne still + mcall 23,30 + cmp eax,3 + jne .noquit + call KillViewer + mcall -1 + .noquit: + mcall 17 + QueryFile + and [FileNum],0 + test eax,eax + jnz still +end if +again: + Newline + xor eax,eax +; and [Flags],STAY_MODE + and [CRC32],eax + and [IDATsize],eax + mov [Adler32],1 + call OpenFile + test ebx,ebx + jnz .sizeok2 + .sizebad2: + Msg 14 + jmp quit + .sizeok2: + mov [filesize],ebx + test [Flags],RAW_MODE + jz .norawm + mov eax,[arc_base] + xor ebx,ebx + call FileSeek + jmp .sizeok + .norawm: + call SfxParse + + call ZipParse + cmp edx,52 + je .notzip + mov ecx,[FileNum] + call ZipFindN + cmp edx,4 + je quit + test [Flags],DECRYPT_MODE + jz .nopass + call ZipDecrypt + push esi + mov ecx,31 + ._: + mov al,[esi] + push eax + call decrypt_byte + xor al,byte[esp] + add esp,4 + call UKeys + mov [esi],al + inc esi + loop ._ + pop esi + ud2 + .nopass: + cmp [unp_size],0 + jne .sizeok + .sizebadq: + Msg 13 + jmp quit + .notzip: + call GzipParse + test edx,edx + jne .notgzip + jmp .sizeok + .notgzip: + call PngParse + test edx,edx + jz .sizeok1 + cmp edx,21 + je .sizebad + test [Flags],RAW_MODE + jne .sizeok + Msg 40 + jmp exit + .sizebad: + Msg 17 + jmp exit + .sizeok1: + if ~ SYS eq win + call KillViewer + end if + Msg 39 + mov edi,[outp] + call Deflate.blkbegin + jmp .defl_end + .sizeok: + call Deflate ; <=========== + .defl_end: + test [bits],7 + jnz .esi_ok + dec esi + .esi_ok: + push dword[esi] ; <- Adler !!! + mov esi,output + sub edi,esi + mov ecx,edi + mov [outfile.size],ecx + test [Flags],RAW_MODE + jnz .skipAdler + test [Flags],PNG_MODE + jnz .skipCRC + push esi ecx + call UCRC + Msg 11 + mov eax,[CRC32] + mov edx,36 + cmp eax,[CRC_check] + je .crcok + dec edx + .crcok: + Msg edx + if SYS eq win + else + dph eax + end if + pop ecx esi + jmp .skipAdler + .skipCRC: + call UAdler + Msg 10 + mov eax,[Adler32] + bswap eax ; <- calculated Adler !!! + mov edx,36 + cmp eax,[esp] + je .adlok + dec edx + .adlok: + Msg edx + if SYS eq win + else + dph eax + end if + .skipAdler: + pop eax + Newline + .nomoreIDAT: + mov ebx,output +if SYS eq win + Msg 37 + invoke CloseHandle, [hnd] + + invoke CreateFile,dumpfile,GENERIC_WRITE, FILE_SHARE_WRITE, NULL, \ + CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,NULL + mov [hnd],eax + invoke WriteFile, eax,ebx,[outfile.size],cparam1,NULL + invoke CloseHandle, [hnd] +else + test [Flags],PNG_MODE + jnz .nosave + test [Flags],TAR_MODE + jnz .nomsg + Msg 37 + .nomsg: + mov [outfile.out],ebx + mcall 58,outfile + test [Flags],TAR_MODE + jnz .nosave + call StartPad + .nosave: +end if + test [Flags],PNG_MODE + jz NoPng + xor eax,eax + mov edi,filters + mov ecx,6 + rep stosd + mov edi,png_image + mov esi,output +;// + mov [outp],edi +;// + call PngFilter + call FiltStats + mov [outfile.size],edi + mov ebx,[outp];png_image +if SYS eq win +exit: + Msg 12 + invoke CreateFile,outfile,GENERIC_WRITE, FILE_SHARE_WRITE, NULL, \ + CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,NULL + mov [hnd],eax + invoke WriteFile, eax,ebx,[outfile.size],cparam1,NULL + invoke CloseHandle, [hnd] + call RunViewer + and [arc_base],0 + and [Flags],STAY_MODE + +quit: + QueryFile + test eax,eax + jnz again + invoke ExitProcess,0 +else +exit: + mov [outfile.out],ebx + test [Flags],TAR_MODE + jz .notar + Msg 37 + mcall 58,outfile + call StartPad + .notar: + Msg 12 + call RunViewer + and [arc_base],0 + and [Flags],STAY_MODE +quit: + test [Flags],STAY_MODE + jnz red + mcall -1 +end if + +NoPng: + test [Flags],TAR_MODE + if SYS eq win + jz quit + else + jz still + end if + mov ecx,dumpf_len + mov esi,dumpfile + mov edi,filename + rep movsb + call OpenFile + test ebx,ebx + jz again.sizebadq + call TarParse + mov ecx,[FileNum] + call TarFindN + cmp [outfile.size],0 + jz again.sizebadq + mov ebx,esi + jmp exit + +if ~ SYS eq win +draw_window: + mcall 12,1 + mov ebx,15 + mov ecx,ebx + mov edx,0x0e26830 + mov edi,edx + mcall 0,,,,0x1f2a870 + mcall 8,,,1+1 shl 30 + mcall 4,<6,5>,0x10d0d0d0,msgs+5,1 + mcall ,<5,5>,0x10202020 + ret +end if + +include 'data.inc' + +if SYS eq win +section '.idata' import data readable writeable + + library kernel,'KERNEL32.DLL',\ + comdlg,'COMDLG32.DLL',\ + user,'USER32.DLL' + + import kernel,\ + CreateFile,'CreateFileA',\ + GetFileSize,'GetFileSize',\ + ReadFile,'ReadFile',\ + WriteFile,'WriteFile',\ + SetFilePointer,'SetFilePointer',\ + CloseHandle,'CloseHandle',\ + GetStdHandle,'GetStdHandle',\ + WriteConsole,'WriteConsoleA',\ + ReadConsole,'ReadConsoleA',\ + CreateProcess,'CreateProcessA',\ + WritePrivateProfileString,'WritePrivateProfileStringA',\ + ExitProcess,'ExitProcess' + + import comdlg,\ + GetOpenFileName,'GetOpenFileNameA' + + import user,\ + wsprintf,'wsprintfA',\ + SendMessage,'SendMessageA',\ + FindWindowEx,'FindWindowExA',\ + WaitForInputIdle,'WaitForInputIdle' + + +section '.reloc' fixups data readable discardable +end if + +if ~ SYS in + error "Please specify SYS: meos OR win" +end if + + diff --git a/programs/archer/trunk/archer.txt b/programs/archer/trunk/archer.txt new file mode 100644 index 0000000000..2cb2f70c44 --- /dev/null +++ b/programs/archer/trunk/archer.txt @@ -0,0 +1,176 @@ +@RCHER FOR MENUET v1.0 July 14, 2005 + Written in pure assembler by Ivushkin Andrey aka Willow + +Deflate unpacker + +Vivat assembler et MENUETOS! +I tender thanks to everyone who spends his time in feasible effortsfor that +little OS evolution. Now in my own rating the Mario79's distro named Kolibri4 +takes 1th place. It is always pleasant to use modern software. Go on! + +@RCHER is intended to view & unpack data compressed by Deflate method +(including both static and dynamic Huffman). This method (although it isn't the +best already) is used by such file formats as ZIP (modern versions: PKZIP for +MS-DOS can create archives using other, less effective compression methods, +which @RCHER doesn't support), GZIP, JAR, OpenOffice files, SFX ZIP executables +and some others. I couldn't prevent myself to include support of PNG images +(they use the similar compression) and TAR and TAR+GZIP archives. + +When the program is started, a little button carrying a @ symbol appears in the +left top corner of screen. Clicking this button opens a SYSXTREE dialog to +select a file being unpacked. Doubleclick closes the application. @RCHER +outputs its information messages to Debug Board. If an archive contains more +than one file, the 1st is by default unpacked into /HD/1/OUT.TXT (you may +change the DUMPFILE constant in @RCHER.ASM) and is opened through TINYPAD +or - if it's a PNG image - in the built-in viewer. + +These are unpacking flags that may exist in a commandline before an archive +filename: + + s - do not close the program after unpacking; + n - decompress the K-th archive file, where K is the following dword in + commandline; + N - decompress the K-th archive file, where K is ASCII number from the + following 6 bytes of commandline; + R - "raw" Deflate data, without descriptors and headers; + q - begin file parsing from offset of K, where K is following dword in + commandline; + Q - begin file parsing from offset of K, where K is ASCII number from the + following 6 bytes of commandline. + +Commandline example: + +cmd_string: + db 'sN000037q' + dd 1465 + db '/hd/1/png.zip',0 + +It means to open the 34th (counting from 0) file of archive /hd/1/png.zip +and do not terminate. Archive will be parsed starting at offset 1465. + + +To-Do list: + +1. Support for interlaced PNG, alpha-channels, gamma-correction, background, + Significant bits and a lot of cool parts of that format. +2. Output of archive content through IPC or into a built-in window like SYSTREE + (as we are going to decide with the respected colleagues). +3. Searching of archive files by name and wildcards! +4. Unpacking into a file specified. +5. Means on saving memory space (now @RCHER gorges 8 Mb!): moving RAM areas, + blocked file output. To do the last thing it is necessary to test carefully + the reliability of harddisk I/O, directory creation and file deletion. These + kernel capabilities aren't still documented. +6. Archive contents integration into SYSXTREE & MFAR filemanagers. We have to + unify the calling format (like a structure in the sysfunc 58). +7. Add comments to source. +8. Correct bugs to be found + +Special thanks to: + + Explanation of algorythm of Deflate format decoder with decoding samples + (evm.narod.ru) + RFC 1951 DEFLATE Compressed Data Format Specification version 1.3 + ZIP File Format Specification version 4.5 by PKWARE Inc. + "An Explanation of the Deflate Algorithm" by Antaeus Feldspar + RFC 1952 GZIP file format specification version 4.3 + TAR Format. Information from File Format List 2.0 by Max Maischein. + RFC 1950 ZLIB Compressed Data Format Specification version 3.3 + PNG (Portable Network Graphics) Specification version 1.0 + Michael Dipperstein's Huffman Code Page + +I expect your remarks and suggestions on the @RCHER's topic, "Coding" section +at meos.sysbin.com forum. + +See you later! + + +**************************************** +**************************************** + +@RCHER ДЛЯ MENUET v1.0 14 июля 2005 г. + Написана на чистом ассемблере Ивушкиным Андреем (Willow) + +Deflate распаковщик + +Vivat assembler et MenuetOS! +Выражаю искреннюю благодарность всем тем, кто не жалея своего времени, +делает посильный вклад в развитие этой маленькой ОС. Сейчас в моем собственном +рейтинге 1-е место занимает дистрибутив Mario79 Kolibri4. Всегда приятно +пользоваться современным ПО. Так держать! + +@RCHER предназначен для просмотра и распаковки данных, сжатых с помощью метода +Deflate (включая статический и динамический Хаффман). Данным методом (хотя он +уже не претендует на звание наилучшего) пользуются форматы файлов ZIP +(современные версии: PKZIP для MS-DOS может создавать архивы с другими, менее +эффективными методами сжатия, которые @RCHER не поддерживает), GZIP, JAR, +файлы OpenOffice, SFX-ZIP приложения и ряд других. Я не мог удержаться и не +сделать поддержку изображений в формате PNG (использующих родственный метод +сжатия) и архивов TAR и TAR+GZIP. + +При запуске программы в левом верхнем углу экрана появляется маленькая кнопка +со значком @. При нажатии на нее открывается окно выбора файла (SYSXTREE) для +распаковки. Двойной щелчок закрывает приложение. Информационные сообщения +@RCHER выводит на доску отладки. Если архив содержит несколько файлов, по +умолчанию первый из них распаковывается на /HD/1/OUT.TXT (поменяйте при +необходимости константу DUMPFILE в @RCHER.ASM) и открывается через TINYPAD +или - в случае картинки PNG - в окне встроенного просмотрщика. + +В командной строке перед именем архива могут в произвольном порядке указываться +флаги распаковки: + + s - не закрывать программу после распаковки; + n - распаковать K-й файл архива, где K - следующий dword в командной строке; + N - распаковать K-й файл архива, где K - ASCII число из следующих 6 байт + командной строки; + R - "сырые" Deflate-данные, без описателей и заголовков; + q - просмотр файла начать со смещения K, где K - следующий dword в командной + строке; + Q - просмотр файла начать со смещения K, где K - ASCII число из следующих 6 + байт командной строки. + +Пример командной строки: + +cmd_string: + db 'sN000037q' + dd 1465 + db '/hd/1/png.zip',0 + +Это означает, что следует открыть 34-й (считая от 0) файл архива /hd/1/png.zip +и не завершать работу. Просмотр архива начнется со смещения 1465. + + +Что еще нужно сделать: + +1. Поддержка чересстрочных (interlaced) PNG, а также альфа-каналов, гаммы, + фона, Significant bits и кучи других примочек этого формата. +2. Вывод содержимого архивов через IPC или во встроенном окне наподобие SYSTREE + (это как решим с уважаемыми коллегами). +3. Поиск файлов в архиве по имени и даже маске! +4. Распаковка в указанный файл. +5. Мероприятия по экономии памяти (сейчас @RCHER жрет 8 Мб!): перемещение + участков памяти, блочный вывод в файл. Для последнего необходимо тщательно + протестировать надежность воода-вывода на ЖД, создания каталогов и удаления + файлов. Пока эти возможности ядра не документированы. +6. Интеграция архивных каталогов в файловые менеджеры SYSXTREE, MFAR. + Потребуется унифицировать формат вызова (наподобие структуры в 58 функции). +7. Откомментировать код. +8. Исправить баги, которые, несомненно, найдутся ;-) + +Особые благодарности: + + Описание алгоритма декодера формата Deflate на примерах декодирования + (evm.narod.ru) + RFC 1951 DEFLATE Compressed Data Format Specification version 1.3 + ZIP File Format Specification version 4.5 by PKWARE Inc. + "An Explanation of the Deflate Algorithm" by Antaeus Feldspar + RFC 1952 GZIP file format specification version 4.3 + TAR Format. Information from File Format List 2.0 by Max Maischein. + RFC 1950 ZLIB Compressed Data Format Specification version 3.3 + PNG (Portable Network Graphics) Specification version 1.0 + Michael Dipperstein's Huffman Code Page + +Жду ваших замечаний и предложений на одноименной ветке раздела "Кодинг" форума +meos.sysbin.com + +До новых встреч! diff --git a/programs/archer/trunk/arcmacro.inc b/programs/archer/trunk/arcmacro.inc new file mode 100644 index 0000000000..6d5da3c5ff --- /dev/null +++ b/programs/archer/trunk/arcmacro.inc @@ -0,0 +1,440 @@ +; @RCHER macros and messages +; Written in pure assembler by Ivushkin Andrey aka Willow + +macro stop +{ + if SYS eq win & NO_STOPS eq 0 + int3 + end if +} + +macro wait +{ +if ~ SYS eq win +local .nodrw,.ex + pusha + mcall 10 + cmp eax,1 + jne .nodrw + call draw_window + .nodrw: + mcall 17 + .ex: + popa +end if +} + +macro rbits dest,cnt +{ + if ~ cnt eq + mov ecx,cnt + end if + if dest eq 0 + xor eax,eax + else + mov eax,dest + end if + call read_bits +} + + +macro rep_err cond_ok, result, msg +{ + local .m + j#cond_ok .m + if ~ msg eq + Msg msg + end if + mov edx,result + jmp .err + .m: +} + +macro memcpy_esi dest, count,_add +{ + push esi + if ~ _add eq + add esi,_add + end if + mov edi,dest + mov ecx,count + rep movsb + pop esi +} + +DebugPrint: +; in: edx-asciiz string ptr + pusha +if SYS eq win + mov ecx,255 + xor eax,eax + mov edi,edx + repne scasb + sub edi,edx + dec edi + invoke WriteConsole,[cons],edx,edi,cparam1,NULL +else + call debug_outstr +end if + popa + ret + +macro DebugPrintDec +{ +if SYS eq win + call int2str + mov edx,os_work + call DebugPrint +else + call debug_outdec +end if +} + +macro Newline +{ +if SYS eq win + pusha + invoke WriteConsole,[cons],cr_lf,2,cparam1,NULL + popa +else + newline +end if +} + +Msgcall: +; edx - msg number + pusha + movzx edx,word[strs+edx*2] + add edx,msgs + call DebugPrint + popa + ret + +macro Msg num +{ + if ~ num eq edx + mov edx,num + end if + call Msgcall +} + +MSG_COUNT=0 +macro str_table [str] +{ + forward + local label + dw label-msgs + common + msgs: + forward + label db str,0 + MSG_COUNT=MSG_COUNT+1 +} + + + +strs: +if language eq ru +str_table \ + <'*** @RCHER - Deflate Unpacker ***',13,10>,\ ;0 + <'*** Copyright Wiland Inc., 2005 ***',13,10>,\ ;1 + 'Файлов в архиве: ',\ ;2 + <'End of Directory достигнут',13,10>,\ ;3 + 'Нет файла с таким номером',\ ;4 + <'FindByNumber ОК',13,10>,\ ;5 + <'Неверный ID блока Хаффмана',13,10>,\ ;6 + <'Ошибка в кодах Хаффмана!',13,10>,\ ;7 + <13,10,'Расчет таблицы CRC32',13,10>,\ ;8 + '.',\ ;9 + 'Adler32',\ ;10 + 'CRC32',\ ;11 + <'Завершено.',13,10>,\ ;12 + <'Файл имеет нулевую длину, распаковка отменена.',13,10>,\ ;13 + <'Странная длина файла-источника. Ошибка в имени? Отмена.',13,10>,\ ;14 + <'Не GZIP архив',13,10>,\ ;15 + <'Слишком большой размер выходного файла',13,10>,\ ;16 + <"Ошибка при распаковке.",13,10>,\ ; 17 + <'Не рисунок PNG',13,10>,\ ; 18 + <13,10,'*д'>,\ ;19 + <13,10,'*с'>,\ ;20 + 'Неожиданный конец блоков IDAT',\ ;21 + 'Дефильтрация:',\ ;22 + 'Фильтры: None ',\ ;23 + ' Sub ',\ ;24 + ' Up ',\ ;25 + ' Avg ',\ ;26 + ' Paeth ',\ ;27 + ' Ошибок: ',\ ;28 + <'Чересстрочный PNG',13,10>,\ ;29 + <'Блок без сжатия',13,10>,\ ;30 + <'Тип цвета не поддерживается',13,10>,\ ;31 + <'Введите пароль для зашифрованного файла:',13,10>,\ ;32 + <'Поиск файла...',13,10>,\ ;33 + 'Не модуль SFX',\ ;34 + ' неверна! ',\ ;35 + ' OK: ',\ ;36 + <'Запись OUT.TXT',13,10>,\ ;37 + ' ',\ ;38 + <'Подготовка изображения...',13,10>,\ ;39 + <'Укажите "R" для обработки сырых данных. Отмена.',13,10>,\ ;40 + ' ',\ ; + ' ',\ ; + ' ',\ ; + ' ',\ ; + ' ',\ ; + ' ',\ ; + ' ',\ ; + ' ',\ ; + ' ',\ ; + ' <- неизвестный метод сжатия',\ ;50 + ' <- зашифрован',\ ;51 + <'Не ZIP архив',13,10> ; 52 +else +str_table \ + <'*** @RCHER - Deflate Unpacker ***',13,10>,\ ;0 + <'*** Copyright Wiland Inc., 2005 ***',13,10>,\ ;1 + 'Files in archive: ',\ ;2 + <'End of Directory reached',13,10>,\ ;3 + 'No file has this number',\ ;4 + <'FindByNumber succeded',13,10>,\ ;5 + <'Invalid Huffman block ID',13,10>,\ ;6 + <'Error while getting Huffman codes!',13,10>,\ ;7 + <13,10,'Rebuilding CRC32 table',13,10>,\ ;8 + '.',\ ;9 + 'Adler32',\ ;10 + 'CRC32',\ ;11 + <'Job finished.',13,10>,\ ;12 + <'File of zero length, unpacking aborted.',13,10>,\ ;13 + <'Source file has strange length, may be missing? Abort.',13,10>,\ ;14 + <'Not a GZIP archive',13,10>,\ ;15 + <'Destination file is too large for now',13,10>,\ ;16 + <"Can't unpack content.",13,10>,\ ; 17 + <'Not a PNG image',13,10>,\ ; 18 + <13,10,'*d'>,\ ;19 + <13,10,'*s'>,\ ;20 + 'Unexpected end of IDAT chunks',\ ;21 + 'Unfiltering:',\ ;22 + 'Filters: None ',\ ;23 + ' Sub ',\ ;24 + ' Up ',\ ;25 + ' Avg ',\ ;26 + ' Paeth ',\ ;27 + ' Invalid ',\ ;28 + <'Interlaced PNG',13,10>,\ ;29 + <'Stored block',13,10>,\ ;30 + <'Color type not supported',13,10>,\ ;31 + <'Enter password for encrypted file:',13,10>,\ ;32 + <'Searching for file...',13,10>,\ ;33 + 'Not a SFX module',\ ;34 + ' error! ',\ ;35 + ' OK: ',\ ;36 + <'Creating OUT.TXT',13,10>,\ ;37 + ' ',\ ;38 + <'Preparing bitmap...',13,10>,\ ;39 + <'Specify "R" to force raw data. Abort.',13,10>,\ ;40 + ' ',\ ; + ' ',\ ; + ' ',\ ; + ' ',\ ; + ' ',\ ; + ' ',\ ; + ' ',\ ; + ' ',\ ; + ' ',\ ; + ' <- unknown compression method',\ ;50 + ' <- encrypted',\ ;51 + <'Not a ZIP archive',13,10> ; 52 +end if + +macro opendialog redproc,openoff,erroff,path +{ +local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc +local run_fileinfo, param +local getmesloop, loox, mred, mkey, mbutton, mgetmes +local dlg_is_work, ready +; +; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, +; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) +; + + cld +;; mov esi,path + mov edi,path + xor eax,eax + mov ecx,200 + rep stosb + +;mov [get_loops],0 +mov [dlg_pid_get],0 + +; Get my PID in dec format 4 bytes + mcall 9,os_work,-1 + +; convert eax bin to param dec + mov eax,dword [os_work+30] ;offset of myPID + mov edi,param+4-1 ;offset to 4 bytes + mov ecx,4 + mov ebx,10 + cld +new_d: + xor edx,edx + div ebx + add dl,'0' + mov [edi],dl + dec edi + loop new_d + +; write 1 byte space to param + mov [param+4],byte 32 ;Space for next parametr +; and 1 byte type of dialog to param + mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog) + +; +; STEP2 prepare IPC area for get messages +; + +; prepare IPC area + mov [path],dword 0 + mov [path+4],dword 8 + +; define IPC memory + mov eax,60 + mov ebx,1 ; define IPC + mov ecx,path ; offset of area + mov edx,150 ; size 150 bytes + int 0x40 + + mcall 40,1000111b +; +; STEP 3 run SYSTEM XTREE with parameters +; + + mcall 58,run_fileinfo + + call redproc + + mov [get_loops],0 +getmesloop: + mov eax,23 + mov ebx,50 ;0.5 sec + int 0x40 + + cmp eax,1 + je mred + cmp eax,2 + je mkey + cmp eax,3 + je mbutton + cmp eax,7 + je mgetmes + +; Get number of procces + mcall 9,os_work,-1 + mov ebp,eax + +loox: + mcall 9,os_work,ebp + mov eax,[DLGPID] + cmp dword[os_work+30],eax ;IF Dialog find + je dlg_is_work ;jmp to dlg_is_work + dec ebp + jnz loox + + jmp erroff + +dlg_is_work: + cmp word[os_work+50],word 9 ;If slot state 9 - dialog is terminated + je erroff ;TESTODP2 terminated too + + cmp [dlg_pid_get],dword 1 + je getmesloop + inc [get_loops] + cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated + jae erroff + jmp getmesloop + +mred: + call redproc + jmp getmesloop +mkey: + mcall 2 ; read (eax=2) + jmp getmesloop +mbutton: + mov eax,17 ; get id + int 0x40 + cmp ah,1 ; button id=1 ? + jne getmesloop + mov eax,-1 ; close this program + int 0x40 +mgetmes: +; If dlg_pid_get then second message get jmp to still + cmp [dlg_pid_get],dword 1 + je ready + +; First message is number of PID SYSXTREE dialog + +; convert PID dec to PID bin + movzx eax,byte [path+16] + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+1] + add eax,ebx + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+2] + add eax,ebx + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+3] + add eax,ebx + sub eax,48 + mov [DLGPID],eax + +; Claear and prepare IPC area for next message + mov [path],dword 0 + mov [path+4],dword 8 + mov [path+8],dword 0 + mov [path+12],dword 0 + mov [path+16],dword 0 + +; Set dlg_pid_get for get next message + mov [dlg_pid_get],dword 1 + call redproc ;show DLG_PID + jmp getmesloop + +ready: +; +; The second message get +; Second message is 100 bytes path to SAVE/OPEN file +; shl path string on 16 bytes +; + cld + mov esi,path+16 + mov edi,path + mov ecx,200 + rep movsb + mov [edi],byte 0 + + jmp openoff + + +; DATA AREA +get_loops dd 0 +dlg_pid_get dd 0 +DLGPID dd 0 + +param: + dd 0 ; My dec PID + dd 0,0 ; Type of dialog + +run_fileinfo: + dd 16 + dd 0 + dd param + dd 0 + dd os_work ; 0x10000 +;run_filepath + db '/RD/1/SYSXTREE',0 + +} + diff --git a/programs/archer/trunk/build_en.bat b/programs/archer/trunk/build_en.bat new file mode 100644 index 0000000000..2e6ba77d98 --- /dev/null +++ b/programs/archer/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm @rcher.asm @rcher +@pause \ No newline at end of file diff --git a/programs/archer/trunk/build_ru.bat b/programs/archer/trunk/build_ru.bat new file mode 100644 index 0000000000..7b76bc7dbb --- /dev/null +++ b/programs/archer/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm @rcher.asm @rcher +@pause \ No newline at end of file diff --git a/programs/archer/trunk/data.inc b/programs/archer/trunk/data.inc new file mode 100644 index 0000000000..ffa0635ae2 --- /dev/null +++ b/programs/archer/trunk/data.inc @@ -0,0 +1,158 @@ +; @RCHER data area +; Written in pure assembler by Ivushkin Andrey aka Willow + +if SYS eq win + dumpfile: + db 'D:\Ivushkin\projects\zip\output.dmp',0 + dumpf_len=$-dumpfile +end if +outfile: +if SYS eq win + db 'D:\Ivushkin\projects\zip\output.raw',0 +end if + dd 1 + dd 0 + .size dd 0 + .out dd output + dd os_work +if ~SYS eq win + dumpfile: + db DUMPFILE,0 + dumpf_len=$-dumpfile +end if +Finfo: + dd 0 + .block dd 0 + .count dd BUFSIZE*2 + .ptr dd BUFPTR + dd os_work + +filename: +if SYS eq win +db 'png\absolut0.png',0 +;db 'fasm-1.54.tgz',0 +;include 'testsu~1.inc' +; db 'pngsuite\pngsuite.tar.gz',0 ; OK +; db 'pngsuite\basn4a08.png',0 ; OK +; db 'goldhill.png',0 ; beeping +; db 'arl_logo.png',0 ; wrong out +; db 'tech.png',0 ; wrong out +; db 'png\lena0000.png',0 +; db 'arcs\' +; db 'NTOSKRNL.gz' +; db 'msg_enc.zip' + ;db 'msgplain.zip' +; db 'c_866.gz' +; db 'zalman_2.png' ;OK +; db 'arcs\headerbar.png',0 ;OK +; db 'fonts1.png' ;OK +; db 'fonts.png' ; +; db 'skin.png' ;OK +; db 'JavaPowered8.png'; OK +; db 'opr008S8.png' +; db 'goldhill.png' +; db 'k3b.png',0 +; db 'image0051.png' +; db 'window-elements.png',0 +; db 'WWW.zip',0 +; db 'png.zip',0 +; db 'zlib09.zip',0 + +else + if ~ FNAME eq + db FNAME + end if +; db '/hd/1/zip/png.zip',0 +; db '/hd/1/zip/files/opossum.png' +; db '/rd/1/www.zip',0 +; db '/hd/1/zip/test2.zip',0 +end if + db 0 +rb 256-($-filename) +I_END: + +if SYS eq win + cr_lf db 0xa,0xd + hnd dd ? + cons dd ? + cons_in dd ? + cparam1 dd ? + cparam2 dd ? +end if + +DKeys rd 3 +Dheader rb 12 +Dpassword rb PASSW_LEN + +png_bpp dd ? +sline_len dd ? +IDATcount dd ? +IDATsize dd ? +PNG_info: + .Width dd ? + .Height dd ? + .Bit_depth db ? + .Color_type db ? + .Compression_method db ? + .Filter_method db ? + .Interlace_method db ? + .Palette rb 3*256 +gpbf dw ? +file_count dd ? +filters rd 6 +arc_base dd ? +outp dd ? +unp_size dd ? +CRC_check dd ? +CRC32 dd ? +CRC32table rd 256 +Adler32 dd ? +child dd ? +clientPID dd ? + +filesize dd ? +bits db ? +cur_byte dd ? +lastblk db ? +Flags dd ? +tblCount dw ? +tblLen dw ? +hclen db ? +max_len dw ? + +bl_count rb BITS + +next_code rw BITS +tmp_clit: + rw 20 +calph: + rw 20 +sorted_clit rw 20 + +seql_c db ? +seql rb BITS + +seqd_c db ? +seqd rb BITS + +hlit dw ? +Literal rw 286 +Lit_c rw 286 + +hdist db ? +Distance rw 32 +Dist_c rw 32 + + +area: + rb INBUF + +os_work rb 4*1024 + +output: +rb OUTBUF + +png_image: +if SYS eq win + rb OUTBUF +end if diff --git a/programs/archer/trunk/debug.inc b/programs/archer/trunk/debug.inc new file mode 100644 index 0000000000..45ae9f90c6 --- /dev/null +++ b/programs/archer/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' \ No newline at end of file diff --git a/programs/archer/trunk/deflate.inc b/programs/archer/trunk/deflate.inc new file mode 100644 index 0000000000..ef0eb07a24 --- /dev/null +++ b/programs/archer/trunk/deflate.inc @@ -0,0 +1,615 @@ +; @RCHER main algorythm +; Written in pure assembler by Ivushkin Andrey aka Willow + +macro get_a _type,_size,c1,c2,c3,c4,c5 +{ +get_#_type: +local .no,.no0,.ex + push edx + and [Flags],not 1 +if _type eq Len + cmp eax,c4 + jne .no + mov eax,c5 + jmp .ex + .no: +end if + sub eax,c1 + ja .no0 + add eax,c2 + jmp .ex + .no0: + add eax,c3 + push eax + mov ecx,eax + shr ecx,_size + xor eax,eax + call read_bits + pop edx + and edx,1 shl _size-1 + shl edx,cl + movzx ecx,[tblH#_type+ecx*2] + add edx,ecx + add eax,edx + .ex: + or [Flags],1 + pop edx + ret +} +; ************************* + +Deflate: + mov edi,[outp] + .init: + mov [bits],8 + lodsb + call setcurb + .blkbegin: + and [lastblk],0 + and [Flags],not 1 + rbits 0,1 + test eax,eax + je .nolast + mov [lastblk],1 + .nolast: + rbits 0,2 + cmp eax,10b + je .DynHuff + cmp eax,01b + je .static + test eax,eax + jnz .errorID + Msg 30 + movzx ecx,[bits] + call read_bits + movzx ecx,word[esi-1] + add esi,3 + rep movsb + jmp .check_last + .errorID: + Msg 6 + ret +; Static Huffman + .static: +if SHOW_METH eq 1 + Msg 20 +end if + mov edi,[outp] + or [Flags],1 + .next: + rbits 0,7 +; stop + cmp eax,0x17 + ja .no7 + add eax,256 + cmp eax,256 + jne .noend + .check_last: + mov [outp],edi + cmp [lastblk],1 + je .ex + jmp .blkbegin + .noend: + call get_Len + mov ebx,eax + rbits 0,5 + call get_Dist + neg eax + push esi + lea esi,[edi+eax] + mov ecx,ebx + rep movsb + pop esi + jmp .next + .no7: + rbits eax,1 + cmp eax,0xc8 + jb .no9 + rbits eax,1 + sub eax,0xd0 + jmp .no81 + .no9: + cmp eax,0xc0 + jb .no81 + add eax,0x58 + jmp .noend + .no81: + sub eax,0x30 + stosb + jmp .next + .ex: + ret +; ************* dynamic Huffman ************ + +.DynHuff: +; dps '##' +if SHOW_METH eq 1 + Msg 19 +end if + pusha + xor eax,eax + mov ecx,(area-bl_count) / 4 + mov edi,bl_count + rep stosd + popa + +; max_len=0 + and [max_len],0 + rbits 0,5 +; hlit-257 + add eax,257 + mov [hlit],ax + rbits 0,5 +; hdist-1 + inc eax + mov [hdist],al + rbits 0,4 +; hclen-4 + add eax,4 + mov [hclen],al + mov ecx,eax + push edi + mov edi,tmp_clit +; read code lengths for code lengths + .alphloop: + push ecx + rbits 0,3 + stosb + pop ecx + loop .alphloop +; sort code lengths for code lengths + push esi + movzx ecx,[hclen] + xor eax,eax + mov edi,tmp_clit + mov esi,tblSort + .sortloop: + lodsb + movzx bx,byte[edi] + mov [sorted_clit+eax*2],bx + inc edi + loop .sortloop + pop esi edi +.generate: + mov ecx,19 + mov ebx,calph + mov edx,seql + mov eax,sorted_clit + call Huffc + and [tblCount],0 + or [Flags],1 + mov edi,Lit_c + mov ebp,sorted_clit + .again: + cmp edi,output+OUTBUF + jb ._ok + Msg 16 + jmp .ex + ._ok: + mov edx,seql + mov ebx,calph + call get_code + call ExpLen + cmp [hlit],ax + ja .again +if SHOW_CHARS eq 1 + mov edi,Lit_c + call Show_codes +end if + mov edi,Dist_c + and [tblCount],0 + .again2: + mov ebx,calph + + call get_code + call ExpLen + cmp [hdist],al + ja .again2 + movzx ecx,[hlit] + mov ebx,Literal + mov edx,seql + mov eax,Lit_c + call Huffc + movzx ecx,[hdist] + mov ebx,Distance + mov edx,seqd + mov eax,Dist_c + call Huffc + + push [hlit] + pop [tblLen] + mov ebp,Lit_c + mov edx,seql + mov ebx,Literal + mov edi,[outp] + and [tblCount],0 + .again3: ; <------------ + call get_code + cmp eax,256 + je .check_last + ja .dist + stosb + jmp .again3 + .dist: + call get_Len + push eax ebx edx ebp + mov ecx,32 + mov ebp,Dist_c + mov edx,seqd + mov ebx,Distance + mov [tblLen],32 + call get_code + call get_Dist + push [hlit] + pop [tblLen] + neg eax + pop ebp edx ebx ecx + push esi + lea esi,[edi+eax] + rep movsb + pop esi + jmp .again3 + +; ****************************************** +Huffc: +; EBX - dest array, ECX - length, EDX - br_seq dest, EAX - source array + push esi edi eax ecx + mov edi,bl_count + xor eax,eax + mov ecx,BITS + rep stosw + pop ecx + mov esi,[esp] + mov [tblLen],cx + mov [max_len],ax +; Count the number of codes for each code length + .cnt_loop: + lodsw + cmp [max_len],ax + jae .skip + mov [max_len],ax + .skip: + inc byte[bl_count+eax] + loop .cnt_loop + movzx ecx,[max_len] + xor eax,eax + and [bl_count],al + xor esi,esi ; edx - bits + mov edi,next_code+2 + push ebx +; Find the numerical value of the smallest code for each code length + .nc_loop: + movzx bx,byte[bl_count+esi] + add ax,bx + shl ax,1 + stosw + inc esi + loop .nc_loop + pop ebx +; clear table + movzx ecx,[tblLen] + xor eax,eax + dec eax + mov edi,ebx + rep stosw + inc eax + movzx ecx,[tblLen] + mov esi,[esp] + mov edi,ebx +; Assign numerical values to all codes + .loop3: + lodsw + test eax,eax + jz .lp + push [next_code+eax*2] + pop word[edi] + inc [next_code+eax*2] + .lp: + add edi,2 + loop .loop3 +; Clear all codes + xor eax,eax + mov edi,edx + movzx ecx,[max_len] + mov [edi-1],al +; Prepare read bit sequences + .rebiloop: + inc eax + cmp [bl_count+eax],0 + jz .sk + stosb + inc byte[edx-1] + .sk: + loop .rebiloop + movzx ecx,byte[edx-1] + dec ecx + jecxz .noreb2 + .reb2loop: + mov al,[edx+ecx-1] + sub [edx+ecx],al + loop .reb2loop + .noreb2: + pop eax edi esi + ret + +; ****************************************** + +; get Codes of variable sizes +get_code: +; EDX - br_seq, EBX - source table, EBP - codelength table + push edx edi + xor eax,eax + movzx ecx,byte[edx-1] + mov [codel],ax + .rb3: + push ecx + movzx ecx,byte[edx] + add [codel],cx + call read_bits + movzx ecx,[tblLen] + inc ecx + mov edi,ebx + .scas: + repne scasw + jecxz .notfound + push edi ecx + sub edi,ebx + sub edi,2 + mov cx,[codel] + cmp cx,[ds:ebp+edi] + jne .notfound2 + mov eax,edi + shr eax,1 + add esp,12 + .pp: + pop edi edx + ret + .notfound2: + pop ecx + pop edi + jmp .scas + .notfound: + pop ecx + inc edx + loop .rb3 + Msg 7 + jmp .pp + +codel dw ? +; ****************************************** +ExpLen: + cmp eax,16 + jae .noliteral + inc [tblCount] + stosw + jmp .nomatch + .noliteral: + and [Flags],not 1 + mov ebx,3 + cmp eax,17 + jae .code1718 + mov ecx,2 + xor eax,eax + call read_bits + lea ecx,[eax+ebx] + mov ax,[edi-2] + .cc: + add [tblCount],cx + rep stosw + or [Flags],1 + jmp .nomatch + .code1718: + jne .code18 + mov ecx,3 + .cc2: + xor eax,eax + call read_bits + lea ecx,[eax+ebx] + xor eax,eax + jmp .cc + .code18: + mov ebx,11 + mov ecx,7 + jmp .cc2 + .nomatch: + mov ax,[tblCount] + ret +get_a Len,2,256+8,10,3,285,258 +get_a Dist,1,3,4,1 + + +; ****************************************** +read_bits: ; eax-dest; ecx-count + push edx ecx + .shift: + if RBLOCK eq 4 + ror [cur_byte],1 + else + ror byte[cur_byte],1 + end if + pushf + test [Flags],1 + je .noh1 + popf + rcl eax,1 + jmp .dec + .noh1: + popf + rcr eax,1 + .dec: + dec [bits] + jnz .loop1 + .push: + push eax + mov eax,[esi] + call setcurb + pop eax + if RBLOCK eq 1 + inc esi + inc [IDATcount] + else + inc esi + inc [IDATcount] + end if + cmp esi,area+INBUF-BSIZE + jbe .ok + pusha +if SHOW_RBLOCK eq 1 + Msg 9 +end if + mov eax,0 + mov ebx,1 + call FileSeek + mov [esp+4],esi + popa + .ok: + test [Flags],PNG_MODE + jz .idatok + mov edx,[IDATcount] + cmp edx,[IDATsize] + jbe .idatok + pusha + lodsd + call PngParse.nxt_sec + mov [IDATcount],1 + mov [esp+4],esi + mov [esp+20],edx + popa + cmp edx,21 + jne .idatok + mov eax,256 + pop ecx + jmp .exx + .idatok: + + mov [bits],8 + .loop1: + loop .shift2 + jmp .popc + .shift2: + jmp .shift + .popc: + pop ecx + test [Flags],1 + jne .exx + .noh2: + rol eax,cl + .exx: + pop edx + ret + +if SHOW_CHARS eq 1 +Show_codes: + pusha + movzx ecx,[tblLen] + mov ecx,256 + xor eax,eax + .lp2: + mov [braces+1],al + push eax ecx + invoke StrFormat,eax,strbuf,20 + invoke WriteConsole,[cons],strbuf,16,param1,NULL + invoke WriteConsole,[cons],braces,6,param1,NULL + mov eax,[esp+4] + movzx eax,word[edi+eax*2] + test eax,eax + jz .skip + invoke WriteConsole,[cons],exist,6,param1,NULL + .skip: + invoke WriteConsole,[cons],braces+6,2,param1,NULL + pop ecx eax + inc eax + loop .lp + jmp .ex + .lp: + jmp .lp2 + .ex: + popa + ret + + cons dd ? + param1 dd ? + braces db '( ) = ',0xa, 0xd + strbuf rb 20 + exist db 'exists' +end if + +makeCRC: + pusha + Msg 8 + mov edi,CRC32table + add edi,255*4 + std + mov ecx,255 + mov ebx,0xedb88320 + .m1: + mov eax,ecx + push ecx + mov ecx,8 + .m2: + shr eax,1 + jnc .m3 + xor eax,ebx + .m3: + loop .m2 + pop ecx + stosd + loop .m1 + popa + cld + ret + +UCRC: +; in: esi - data to calculate CRC +; ecx - its length +; [CRC32] - previous CRC32 +; out: [CRC32]- partial CRC32 (no pre- & post-conditioning!) + pusha + cmp dword[CRC32table+4],0x77073096 + je .tbl_rdy + call makeCRC + .tbl_rdy: + mov eax,[CRC32] + not eax + .m1: + movzx ebx,al + shr eax,8 + xor bl,[esi] + xor eax,[CRC32table+ebx*4] + inc esi + loop .m1 + not eax + mov [CRC32],eax + popa + ret + +UAdler: +; in: esi - data to calculate CRC +; ecx - its length +; [Adler32] - previous Adler32 +; out: [Adler32]- partial Adler32 + pusha + mov ebp,65521 + movzx ebx,word[Adler32] ; s1-ebx + movzx edi,word[Adler32+2] ; s2-edi + .m1: + movzx eax,byte[esi] + add eax,ebx + xor edx,edx + div ebp + mov ebx,edx + lea eax,[edi+ebx] + xor edx,edx + div ebp + mov edi,edx + inc esi + loop .m1 + shl edi,16 + add edi,ebx + mov [Adler32],edi + popa + ret + +tblSort db 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 +tblHLen dw 7,11,19,35,67,131 +tblHDist dw 3,5,9,17,33,65,129,257,513,1025,2049,4097,8193,16385 diff --git a/programs/archer/trunk/macros.inc b/programs/archer/trunk/macros.inc new file mode 100644 index 0000000000..1d153e8723 --- /dev/null +++ b/programs/archer/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 + +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 \ No newline at end of file diff --git a/programs/archer/trunk/parser.inc b/programs/archer/trunk/parser.inc new file mode 100644 index 0000000000..7fc11ddabc --- /dev/null +++ b/programs/archer/trunk/parser.inc @@ -0,0 +1,896 @@ +; @RCHER parser and filter routines +; Written in pure assembler by Ivushkin Andrey aka Willow + + fhs_local equ 0x04034b50 + fhs_central equ 0x02014b50 + fhs_end equ 0x06054b50 + fhs_enc equ 0x08074b50 + +SkipASCIIZ: + xor eax,eax + mov ecx,255 + mov edi,esi + repne scasb + mov esi,edi + ret + +PrintFilename: + pusha + mov esi,edx + mov edi,os_work + mov edx,edi + rep movsb + mov dword[edi],0x00a0d + call DebugPrint +; mcall 10 +; mcall 2 + popa + ret + + +; Parse routines: +; out: edx= 0 if all ok, 1 - central dir, 2-EOD +; 50 - encrypted +; 51 - not deflated +; 52 - invalid format +; 53 - dir skipped +; 1 - encrypted + +; **************************************************** +ZipParse: + + call ResetFile + .nxt: + call ZipCrawl + + cmp edx,3 + je .ex + cmp edx,1 + je .skipinc +if IGNORE_DIRS eq 1 + cmp edx,53 + jne .skipinc +end if + inc [file_count] + .skipinc: + cmp edx,52 + je .er1 + cmp edx,50 + jne .seek + .er1: + Msg edx + ret + .seek: + add eax,ecx + mov ebx,1 + call FileSeek + jmp .nxt + .ex: + Msg 2 + mov eax,[file_count] + if ~ SYS eq win + dpd eax + else + pusha + call int2str + mov edx,os_work + call DebugPrint + popa + end if + Newline + ret + +ZipFindN: +; ecx - file # + Msg 33 + cmp ecx,[file_count] + jae .err + push ecx + call ResetFile + .nxt: + call ZipCrawl + cmp edx,51 + je .ok2 + .noenc: + test edx,edx + jnz .err + .ok2: + add eax,ecx + cmp dword[esp],0 + jz .ok + dec dword[esp] + mov ebx,1 + call FileSeek + jmp .nxt + .err: + mov edx,4 + jmp .ex + .ok: + pop ecx + sub eax,[esi+18] + add esi,eax + mov edx,5 + .ex: + push edx + Msg edx + pop edx + ret + +ZipCrawl: + mov edx,52 + cmp dword[esi],fhs_central + jne .noc + mov eax,46 + movzx ecx,word[esi+28] + add eax,ecx + movzx ecx,word[esi+30] + add eax,ecx + movzx ecx,word[esi+32] + mov edx,1 + ret + .noc: + cmp dword[esi],fhs_end + jne .noe + .edx3: + Msg 3 + mov edx,3 + ret + .noe: + cmp dword[esi],fhs_local + je .loc + cmp dword[esi],fhs_enc + jne .err + mov eax,16 + xor ecx,ecx + mov edx,1 + ret + .loc: + push word[esi+6] + pop [gpbf] + push dword[esi+14] + pop [CRC_check] + push dword[esi+22] + pop [unp_size] + movzx ecx,word[esi+26] + mov eax,30 + lea edx,[esi+eax] + add eax,ecx +if IGNORE_DIRS eq 1 + cmp byte[edx+ecx-1],'/' + je .skipdp +end if + call PrintFilename + .skipdp: + movzx ecx,word[esi+28] + add eax,[esi+18] + test [gpbf],1 + jz .no_enc + or [Flags],DECRYPT_MODE ; encrypted + mov edx,51 + jmp .err + .no_enc: + test word[esi+8],7 + rep_err z,50 + .ok: + xor edx,edx + .err: + ret + +; *********************************************** +GzipParse: + ID1ID2 equ 0x8b1f + FTEXT equ 1b + FHCRC equ 10b + FEXTRA equ 100b + FNAME equ 1000b + FCOMMENT equ 10000b + mov eax,7 + mov ebx,2 + call FileSeek + push dword[esi] + pop [CRC_check] + push dword[esi+4] + pop [unp_size] + call ResetFile + xor edx,edx + cmp word[esi],ID1ID2 + rep_err e, 52, 15 + cmp byte[esi+2],8 + rep_err e, 52, 50 + mov bl,[esi+3] ; bl - FLG + add esi,10 ; esi->extra + test bl,FEXTRA + jz .noextr + movzx eax,word[esi] + lea esi,[esi+eax+2] ; esi->FNAME + .noextr: + test bl,FNAME + jz .nofname + mov edx,esi + call DebugPrint + call SkipASCIIZ + cmp dword[esi-5],'.tar' + jne .nofname + or [Flags],TAR_MODE + .nofname: ; esi->FCOMMENT + test bl,FCOMMENT + jz .nocomm + call SkipASCIIZ + .nocomm: ; esi->HCRC + test bl,FHCRC + jz .noCRC16 + add esi,2 + .noCRC16: + cmp [unp_size],OUTBUF + jb .sizeok2 + Msg 16 + mov edx,15 + ret + .sizeok2: + xor edx,edx + .err: + ret + +PngParse: + ID1 equ 0x474e5089 + ID2 equ 0x0a1a0a0d + FDICT equ 100000b + InitIDAT equ 2 + mov [IDATcount],InitIDAT + call ResetFile + cmp dword[esi],ID1 + rep_err e, 52, 18 + cmp dword[esi+4],ID2 + rep_err e, 52, 18 + add esi,8 + cmp dword[esi+4],'IHDR' + rep_err e,52, 18 + or [Flags],PNG_MODE + memcpy_esi PNG_info,13,8 + mov eax,[PNG_info.Width] + bswap eax + mov [PNG_info.Width],eax + mov eax,[PNG_info.Height] + bswap eax + mov [PNG_info.Height],eax + add esi,25 + cmp byte[esi-5],0 + rep_err e,52,29 + .nxt_sec: + lodsd + bswap eax ; eax - section size + push eax + lodsd + mov edi,Png_ch + mov ecx,(E_ch-Png_ch) / 4 + repne scasd + pop eax + mov ebx,[esi-4] + mov edx,os_work + mov [edx],ebx + mov dword[edx+4],0x0a0d + .dp: + sub edi,Png_ch + shr edi,2 ; edi- chunk # + if SHOW_PNG_SEC eq 1 + call DebugPrint + end if + cmp edi,1 + jne .noend + mov edx,21 + jmp .err + .noend: + cmp edi,2 + jne .noplte + memcpy_esi PNG_info.Palette,eax + jmp .noidat + .noplte: + cmp edi,3 + jne .noidat + mov [IDATsize],eax + cmp [IDATcount],InitIDAT + jne .ex + mov [bits],8 + if RBLOCK eq 4 + lodsd + else + lodsb + end if + call setcurb + rbits 0,16 + test ah,FDICT + jz .ex + rbits 0,32 + add [IDATcount],4 + jmp .ex + .noidat: + add eax,4 + mov ebx,1 + call FileSeek + jmp .nxt_sec + .ex: + xor edx,edx + .err: + ret + +Png_ch: + dd 'IEND','PLTE','IDAT','????' +E_ch: + +ZipDecrypt: + push edi + mov ecx,3 + mov edi,Dheader + rep movsd + pop edi + call QueryPwd + jecxz .ex + push esi + mov [DKeys], 305419896 + mov [DKeys+4],591751049 + mov [DKeys+8],878082192 + xor eax,eax + mov esi,Dpassword + .enc_init: + lodsb + call UKeys + loop .enc_init + mov ecx,12 + mov esi,Dheader + .dec_header: + call decrypt_byte + xor al,[esi] + call UKeys + mov [esi],al + inc esi + loop .dec_header + mov eax,[CRC_check] + pop esi + .ex: + ret + +QueryPwd: +; out: ecx - passwd len +if SYS eq win + Msg 32 + invoke ReadConsole,[cons_in],Dpassword,PASSW_LEN,cparam1,NULL + test eax,eax + jnz .inp_ok + xor ecx,ecx + jmp .ex + .inp_ok: + mov ecx,[cparam1] + cmp ecx,PASSW_LEN + je .ex + sub ecx,2 +else +end if + .ex: + ret + +UKeys: +; in: al - char + pusha + mov edi,134775813 + mov ebx,DKeys + mov esi,os_work + mov byte[esi],al + mov ecx,1 + push dword[ebx] + pop [CRC32] + call UCRC + push [CRC32] + pop dword[ebx] + mov eax,[ebx] + and eax,0xff + add eax,[ebx+4] + mul edi + inc eax + mov [ebx+4],eax + shr eax,24 + mov byte[esi],al + push dword[ebx+8] + pop [CRC32] + call UCRC + push [CRC32] + pop dword[ebx+8] + popa + ret + +decrypt_byte: +; out: al + push ebx edx + movzx ebx,word[DKeys+8] + or ebx,2 + mov eax,ebx + xor eax,1 + mul ebx + shr eax,8 + pop edx ebx + ret + +setcurb: +; in: eax + test [Flags],DECRYPT_MODE + jz .noenc + push eax + call decrypt_byte + xor al,byte[esp] + add esp,4 + call UKeys + .noenc: + mov [cur_byte],eax + ret + +TarParse: + call ResetFile + .nxt: + call TarCrawl +; wait + cmp edx,3 + je ZipParse.ex +if IGNORE_DIRS eq 1 + cmp edx,53 + jne .skipinc +end if + inc [file_count] + .skipinc: + add eax,ecx + mov ebx,1 + call FileSeek + jmp .nxt + +TarFindN: +; in: ecx - file number +; ecx - file # + Msg 33 + cmp ecx,[file_count] + jae .err + push ecx + call ResetFile + .nxt: + call TarCrawl +if IGNORE_DIRS eq 1 + cmp edx,53 + je .seek +end if + test edx,edx + jnz .err + cmp dword[esp],0 + jz .ok + dec dword[esp] + .seek: + add eax,ecx + mov ebx,1 + call FileSeek + jmp .nxt + .err: + mov edx,4 + jmp .ex + .ok: + pop ecx + add esi,eax + mov edx,5 + .ex: + Msg edx + ret + +TarCrawl: + cmp byte[esi],0 + jz ZipCrawl.edx3 + push esi + mov ecx,11 + add esi,0x7c + call Octal_str + mov esi,[esp] + mov [outfile.size],eax + call SkipASCIIZ +if IGNORE_DIRS eq 1 + cmp byte[esi-2],'/' + je .skipdp +end if + mov edx,[esp] + lea ecx,[esi-1] + sub ecx,edx + call PrintFilename + .skipdp: + mov ecx,[outfile.size] + jecxz .zerolen + shr ecx,9 + inc ecx + shl ecx,9 + .zerolen: + mov eax,512 + pop esi + jmp ZipCrawl.ok + +Octal_str: +; in: esi - ASCIIZ octal string +; ecx - its length +; out: eax - value + push esi ebx ecx + xor ebx,ebx + xor eax,eax + .jec: + jecxz .zero + cmp byte[esi+ecx-1],' ' + jne .lp + dec ecx + jmp .jec + .lp: + lodsb + shl ebx,3 + cmp eax,' ' + je .space + lea ebx,[ebx+eax-'0'] + .space: + loop .lp + mov eax,ebx + .zero: + pop ecx ebx esi + ret + +TRAILING_BUF equ 2048 +SfxParse: + call ResetFile + cmp word[esi],'MZ' + rep_err e, 34 + mov eax,TRAILING_BUF + mov ecx,eax + mov ebx,2 + call FileSeek + mov edi,esi + mov al,'P' + .lp: + repne scasb + cmp dword[edi-1],fhs_end + je .end_found + jecxz .err + jmp .lp + .end_found: + dec edi + mov esi,edi + mov eax,[edi+12] + neg eax + mov ebx,1 + call FileSeek + push dword[esi+42] + pop [arc_base] + .err: + ret + +; Created: May 31, 2005 +FiltCall: +dd PngFilter.nofilt,Filt_sub,Filt_up,Filt_av,Filt_paeth,PngFilter.nofilt +PngFilter: +; esi - filtered uncompressed image data +; edi - destination + mov cl,[PNG_info.Color_type] + mov eax,1 + cmp cl,3 + je .palette + test cl,2 + jz .notriple + add eax,2 + .notriple: + test cl,4 + jz .calc_bpp + inc eax + .calc_bpp: + mul [PNG_info.Bit_depth] + .palette: + mov ecx,eax ; in bits + shr eax,3 ; in bytes + test eax,eax + jnz .noz + inc eax + .noz: + mov [png_bpp],eax + mov eax,[PNG_info.Width] + mov ebp,eax + imul ecx + shr eax,3 + test eax,eax + jnz .noz2 + inc eax + .noz2: + mov [sline_len],eax ; scanline length + push edi + and [Flags],not 1 + mov ecx,[PNG_info.Height] + .scanline: +; Msg 9,1 + push ecx + lodsb + movzx eax,al + cmp eax,5 + jb .f_ok + mov eax,5 + .f_ok: + inc dword[filters+eax*4] + jmp dword[FiltCall+eax*4] + .nofilt: + mov dl,[PNG_info.Color_type] + cmp dl,3 + jne .nopalette + lodsb + mov [cur_byte],eax + mov [bits],8 + mov ecx,ebp + .pixel: + push ecx + movzx ecx,[PNG_info.Bit_depth] + call rb_png + push esi + lea esi,[eax+eax*2] + add esi,PNG_info.Palette + call PngStore + pop esi + pop ecx + loop .pixel + cmp [bits],8 + jne .lp + dec esi + .lp: + pop ecx + loop .sl + jmp .sl2 + .sl: +;// +MV equ 1 +; mov eax,ecx +; and eax,1 shl MOVE_SLINE_LEV-1 +; jnz .scanline +;stop +if MV eq 0 + push ecx + mov ecx,edi + sub ecx,esi + sub [outp],esi + mov edi,output + add [outp],edi + rep movsb + mov esi,output + pop ecx + pop eax + push [outp] +end if +;;// + jmp .scanline + .sl2: +;// +; call MoveScanline + sub edi,[outp] +;// +; sub edi,[esp] + pop eax + ret + + .nopalette: + test dl,2 + jz .notriple1 + .__: + mov ecx,[PNG_info.Width] + .RGBcp: + call PngStore + add esi,[png_bpp] + loop .RGBcp + jmp .lp + .notriple1: + test dl,dl + jz .gray + cmp dl,4 + jne .__ +; Msg 31 +; ud2 + .gray: +; stop + push ecx + mov ecx,[PNG_info.Width] + mov [bits],8 + lodsb + mov [cur_byte],eax + .gray2: + push ecx + movzx ecx,[PNG_info.Bit_depth] + push ecx + call rb_png + pop ecx + cmp ecx,8 + jbe .lo + add esi,2 + shr eax,8 + jmp .stsb + .lo: + neg ecx + add ecx,8 + shl eax,cl + .stsb: + mov ecx,3 + rep stosb + pop ecx + loop .gray2 + dec esi + pop ecx + jmp .lp + +Filt_sub: +; dps '-' + mov ecx,[sline_len] + sub ecx,[png_bpp] + push esi edi + mov edi,esi + add edi,[png_bpp] + .scan: ; esi - previous, edi - current + lodsb + add [edi],al + inc edi + loop .scan + + pop edi esi +; dps '-' + jmp PngFilter.nofilt + +Filt_up: + cmp ecx,[PNG_info.Height] + je PngFilter.nofilt + push esi edi + mov ecx,[sline_len] + mov edi,esi + sub esi,ecx + dec esi + jmp Filt_sub.scan + +Filt_av: + pusha + mov ecx,[sline_len] + mov ebp,[PNG_info.Height] + mov edx,[png_bpp] ; edx-raw + neg edx + mov ebx,ecx + sub ebx,[png_bpp] + mov edi,esi + sub esi,ecx + dec esi ; esi-prior + .lpavg: + xor eax,eax + cmp [esp+24h],ebp + je .1stl + movzx eax,byte[esi] + .1stl: + cmp ecx,ebx + ja .leftbad + push ecx + movzx ecx,byte[edi+edx] + add eax,ecx + pop ecx + .leftbad: + shr eax,1 + add [edi],al + inc esi + inc edi + loop .lpavg + popa + jmp PngFilter.nofilt + +Filt_paeth: + pusha + mov ecx,[sline_len] + mov edx,[png_bpp] + neg edx + lea ebp,[ecx+edx] ; left edge + mov edi,esi + sub esi,ecx + dec esi + .lpaeth: + push ecx + movzx eax,byte[edi+edx] + movzx ebx,byte[esi] + movzx ecx,byte[esi+edx] + push eax + mov eax,[esp+28h] + cmp eax,[PNG_info.Height] ; 1st line + jne .no1stlineok + xor ebx,ebx + xor ecx,ecx + .no1stlineok: + pop eax + cmp [esp],ebp ; ecx + jbe .leftok ; x-bpp>=0 + xor eax,eax + xor ecx,ecx + .leftok: + pusha ; eax-28, ebx-16, ecx-24 + lea edx,[eax+ebx] + sub edx,ecx ; p=edx + sub eax,edx ; pa := abs(p - a) + jge .eaxp + neg eax + .eaxp: + sub ebx,edx ; pb := abs(p - b) + jge .ebxp + neg ebx + .ebxp: + sub ecx,edx ; pc := abs(p - c) + jge .ecxp + neg ecx + .ecxp: + cmp eax,ebx + ja .noa + cmp eax,ecx + jbe .ex ; pa-min + .noa: + cmp ebx,ecx + ja .nob + mov eax,[esp+16] + jmp .ex2 + .nob: + mov eax,[esp+24] + .ex2: + mov [esp+28],eax + .ex: + popa + add [edi],al + inc esi + inc edi + pop ecx + loop .lpaeth + popa + jmp PngFilter.nofilt + +rb_png: ; eax-dest; ecx-count + push ecx + xor eax,eax + .shift: + rol byte[cur_byte],1 + rcl eax,1 + .dec: + dec [bits] + jnz .loop1 + .push: + push dword[esi] + pop [cur_byte] + mov [bits],8 + inc esi + .loop1: + loop .shift + pop ecx + ret + +PngStore: + push esi + cmp [PNG_info.Bit_depth],8 + jbe .lo + add esi,3 + .lo: + if ~ SYS eq win + mov esi,[esi] + bswap esi + shr esi,8 + mov [edi],esi + add edi,3 + else + movsw + movsb + end if + pop esi + ret + +FiltStats: + pusha + xor ebx,ebx + mov edx,23 + mov ecx,6 + .lp: + push ecx edx + Msg edx + mov eax,[filters+ebx*4] + DebugPrintDec + pop edx ecx + inc edx + inc ebx + loop .lp + Newline + popa + ret + diff --git a/programs/archer/trunk/sys.inc b/programs/archer/trunk/sys.inc new file mode 100644 index 0000000000..9ac4c94547 --- /dev/null +++ b/programs/archer/trunk/sys.inc @@ -0,0 +1,326 @@ +; @RCHER system-dependent and other stuff +; Written in pure assembler by Ivushkin Andrey aka Willow + +OpenFile: + mov [outp],output + mov esi,area + and [Finfo.block],0 +if SYS eq win + invoke CreateFile, filename, GENERIC_READ, FILE_SHARE_READ, NULL, \ + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,NULL + inc eax + test eax,eax + jz .ex + dec eax + mov [hnd],eax + invoke GetFileSize,eax,NULL + .ex: + mov ebx,eax + mov [filesize],eax +else + mcall 58,Finfo + mov [filesize],ebx +end if + ret + +ResetFile: + and [file_count],0 + mov eax,[arc_base] + xor ebx,ebx + mov esi,area + call FileSeek + ret + + +FileSeek: +; eax - offset +; esi - current pointer (in memory!) +; ebx - translation method: 0 - beginning, 1 - current, 2 - end + push eax ecx edx + mov edx,[Finfo.block] + imul edx,BSIZE + sub esi,BUFPTR + add esi,edx + cmp ebx,1 + je .cur + jb .begin + mov esi,[filesize] + not eax + .cur: + add eax,esi + .begin: + mov ecx,BSIZE + xor edx,edx + div ecx + lea esi,[BUFPTR+edx] + mov [Finfo.block],eax +if SYS eq win + mul ecx + invoke SetFilePointer,[hnd],eax,NULL,FILE_BEGIN + invoke ReadFile,[hnd],area,INBUF, os_work, NULL +; add [byte_count],area +else +; pregs +; wait + mov [Finfo.count],BUFSIZE*2 + mcall 58,Finfo +; mov [byte_count],area+INBUF +end if + pop edx ecx eax + ret + +macro QueryFile +{ +local ex +if SYS eq win + invoke GetOpenFileName,ofstruc +else + opendialog draw_window,QFok,QFcanc,filename + QFok: + xor eax,eax + jmp ex + ret + QFcanc: + mov eax,1 +end if + ex: +} + +RunViewer: + test [Flags],PNG_MODE + jz .ex + if SYS eq win + mov eax,[PNG_info.Width] + call int2str + invoke WritePrivateProfileString,ini_sec,ini_rwidth,os_work,ini_file + mov eax,[PNG_info.Height] + call int2str + invoke WritePrivateProfileString,ini_sec,ini_rheight,os_work,ini_file + invoke CreateProcess,NULL,iview_cmd,NULL,NULL,TRUE,\ + NORMAL_PRIORITY_CLASS,NULL,NULL,suinfo,pinfo + invoke WaitForInputIdle,dword[pinfo],0xFFFFFFFF + invoke FindWindowEx, NULL,NULL,NULL,rawwnd_txt + invoke FindWindowEx, eax,NULL,NULL,ok_txt + invoke SendMessage,eax,BM_CLICK,NULL,NULL + else + test [Flags],THREAD_YES + jnz .ex + mcall 51,1,thread,MEMORY + mov [child],eax + end if + .ex: + ret + +if SYS eq win +int2str: +; in: eax - number +; out: formatted string -> os_work + invoke wsprintf,os_work,fmt_str,eax + add esp,12 + ret + +rawwnd_txt db 'Set RAW open parameters',0 +ok_txt db 'OK',0 +ini_sec db 'RAW',0 +ini_rwidth db 'RWidth',0 +ini_rheight db 'RHeight',0 +ini_file db "C:\Program Files\IrfanView\i_view32.ini",0 +fmt_str db "%d",0 +iview_cmd db '"C:\Program Files\IrfanView\i_view32.exe"' + db ' "D:\Ivushkin\projects\zip\output.raw"',0 +filt_str: + db 'Pictures (*.png)',0,'*.png',0 + db 'Archives (*.zip;*.*gz)',0,'*.zip;*.*gz',0 + db 'All files (*.*)',0,'*.*',0,0 + +suinfo STARTUPINFO +pinfo PROCESS_INFORMATION +cpstruc: +ofstruc: + dd ofstruc_end-ofstruc + dd NULL + dd NULL + dd filt_str + dd NULL + dd NULL + dd 0 + dd filename + dd 256 + dd NULL + dd 0 + dd NULL + dd NULL + dd NULL + dw NULL + dw NULL + dd NULL + dd NULL + dd NULL + dd NULL + dd NULL + dd NULL + dd NULL +ofstruc_end: + + else + mov ebx,-1 + mov ecx,ebx + mov edx,[PNG_info.Width] + add edx,10 + mov esi,[PNG_info.Width] + add esi,30 + mcall 67 + mcall 7,outfile,[outfile.size],10 shl 16+15 + .ex: + ret + +MIN_WIDTH equ 300 +thread: + .red: + mcall 12,1 + mov ebx,[PNG_info.Width] + cmp ebx,MIN_WIDTH + jae .more + mov ebx,MIN_WIDTH + .more: + add ebx,20 + mov ecx,[PNG_info.Height] + add ecx,30 + mcall 0,,,0x3808080 + mcall 4,<5,7>,0x10f0f0f0,filename,255 + mov ecx,[PNG_info.Width] + shl ecx,16 + add ecx,[PNG_info.Height] + mcall 7,png_image,,10 shl 16+25 + mcall 12,2 + .still: + mcall 10 + cmp eax,1 + je .red + cmp eax,2 + jne .nokey + mcall 2 + cmp ah,27 ; Esc - close + je .close + jmp .still + .nokey: + cmp eax,3 + jne .still + .close: + and [child],0 + mcall -1 + +KillViewer: + pusha + mov edi,[child] + test edi,edi + jz .noth + mcall 9,os_work,-1 + mov ecx,eax + .fchild: + push ecx + mcall 9,os_work + cmp edi,[ebx+30] + jne .lp + mov ecx,[esp] + mcall 18,2 + pop ecx + jmp .noth + .lp: + pop ecx + loop .fchild + .noth: + popa + ret + +macro CmdLine +{ + mov esi,PARAM_PTR + .parse: + lodsb + + test al,al + jnz .noend + or [Flags],STAY_MODE + jmp red + .noend: + cmp al,' ' + je .stay + cmp al,'/' + jne .yespar + mov ecx,255 + dec esi + mov edi,filename + xor al,al + rep stosb + mov ecx,255 + mov edi,filename + rep movsb + jmp again + .yespar: + cmp al,'N' + jne .nonum + call get_6ASCII_num + .fnum: + mov [FileNum],eax + jmp .parse + .nonum: + cmp al,'n' + jne .nonum2 + lodsd + jmp .fnum + .nonum2: + cmp al,'s' + jne .nostay + .stay: + or [Flags],STAY_MODE + jmp .parse + .nostay: + cmp al,'i' + jne .noclPID + lodsd + mov [clientPID],eax + or [Flags],IPC_MODE + jmp .parse + .noclPID: + cmp al,'R' + jne .noraw + or [Flags],RAW_MODE + jmp .parse + .noraw: + cmp al,'q' + jne .noofs + lodsd + .fofs: + mov [arc_base],eax + jmp .parse + .noofs: + cmp al,'Q' + jne .noofs2 + call get_6ASCII_num + jmp .fofs + .noofs2: + jmp .parse + +get_6ASCII_num: +; in: esi - str ptr, out: eax - num + xor edx,edx + mov ebx,10 + mov ecx,6 + .lp: + xor eax,eax + lodsb + sub al,'0' + imul edx,ebx + add edx,eax + loop .lp + mov eax,edx + ret +} + +StartPad: + mcall 19,editorcmd,dumpfile + ret + +editorcmd db 'TINYPAD ' +end if \ No newline at end of file diff --git a/programs/arpstat/trunk/arpstat.asm b/programs/arpstat/trunk/arpstat.asm new file mode 100644 index 0000000000..2afdd89341 --- /dev/null +++ b/programs/arpstat/trunk/arpstat.asm @@ -0,0 +1,442 @@ +; +; ARP Status Monitor +; +; Compile with FASM for Menuet +; +; This program displays the ARP table, and it's settings + +use32 + + org 0x0 + + db 'MENUET00' ; 8 byte id + dd 38 ; required os + dd START ; program start + dd I_END ; program image size + dd 0x100000 ; required amount of memory + dd 0x00000000 ; reserved=no extended header + include 'lang.inc' + include 'macros.inc' + +START: ; start of execution + call draw_window ; at first, draw the window + +still: + mov eax,23 ; wait here for event + mov ebx,200 ; Time out after 2s + 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 + + ; read the stack status data, and write it to the screen buffer + + mov eax, 53 + mov ebx, 255 + mov ecx, 200 + int 0x40 + + push eax + mov ebx, text + 24 + call printhex + + mov eax, 53 + mov ebx, 255 + mov ecx, 201 + int 0x40 + + mov ebx, text + 64 + call printhex + + + ; Fill the table with blanks + mov edx, text + 160 +doBlank: + mov esi, blank + mov edi, edx + mov ecx, 40 + rep movsb + add edx, 40 + + cmp edx, text + 560 + jne doBlank + + pop ecx ; The number of entries + + mov ebx, text+ 160 +1 ; the position for the first IP address line + + xor edx, edx ; edx is index into the ARP table + + cmp ecx, 10 + jle show_entries + mov ecx, 10 + + +; The following code is not very efficient; Sorry about that. +; ARPSTAT is a debugging tool, so I didn't want to put much effort in +show_entries: + ; Ecx now holds the number of entries to populate. + ; Ebx holds the place to put the data + ; edx is a counter + cmp ecx, 0 + je red + + push ecx + push edx + push ebx + + + ; select the arp table entry (in edx) + mov eax, 53 + mov ebx, 255 + mov ecx, 202 + int 0x40 + + ; Read the IP address + mov eax, 53 + mov ebx, 255 + mov ecx, 203 + int 0x40 + + ; IP in eax. Get the address to put it back + pop ebx + push ebx + + call writeDecimal ; Extract 1 byte from eax, store it in string + add ebx, 4 + shr eax, 8 + call writeDecimal ; Extract 1 byte from eax, store it in string + add ebx, 4 + shr eax, 8 + call writeDecimal ; Extract 1 byte from eax, store it in string + add ebx, 4 + shr eax, 8 + call writeDecimal ; Extract 1 byte from eax, store it in string + + add ebx, 4 + + ; Now display the 6 byte MAC + push ebx + mov eax, 53 + mov ebx, 255 + mov ecx, 204 + int 0x40 + pop ebx + + mov ecx, eax + + shr eax, 4 + and eax, 0x0f + mov al, [eax + hextable] + mov [ebx], al + inc ebx + mov eax, ecx + and eax, 0x0f + mov al, [eax + hextable] + mov [ebx], al + inc ebx + mov eax, ecx + shr eax, 12 + and eax, 0x0f + mov al, [eax + hextable] + mov [ebx], al + inc ebx + mov eax, ecx + shr eax, 8 + and eax, 0x0f + mov al, [eax + hextable] + mov [ebx], al + inc ebx + mov eax, ecx + shr eax, 20 + and eax, 0x0f + mov al, [eax + hextable] + mov [ebx], al + inc ebx + mov eax, ecx + shr eax, 16 + and eax, 0x0f + mov al, [eax + hextable] + mov [ebx], al + inc ebx + mov eax, ecx + shr eax, 28 + mov al, [eax + hextable] + mov [ebx], al + inc ebx + mov eax, ecx + shr eax, 24 + and eax, 0x0f + mov al, [eax + hextable] + mov [ebx], al + inc ebx + + push ebx + mov eax, 53 + mov ebx, 255 + mov ecx, 205 + int 0x40 + pop ebx + + mov ecx, eax + + shr eax, 4 + and eax, 0x0f + mov al, [eax + hextable] + mov [ebx], al + inc ebx + mov eax, ecx + and eax, 0x0f + mov al, [eax + hextable] + mov [ebx], al + inc ebx + mov eax, ecx + shr eax, 12 + and eax, 0x0f + mov al, [eax + hextable] + mov [ebx], al + inc ebx + mov eax, ecx + shr eax, 8 + and eax, 0x0f + mov al, [eax + hextable] + mov [ebx], al + + ; Now display the stat field + inc ebx + inc ebx + push ebx + mov eax, 53 + mov ebx, 255 + mov ecx, 206 + int 0x40 + pop ebx + + mov ecx, eax + + shr eax, 4 + and eax, 0x0f + mov al, [eax + hextable] + mov [ebx], al + inc ebx + mov eax, ecx + and eax, 0x0f + mov al, [eax + hextable] + mov [ebx], al + inc ebx + mov eax, ecx + shr eax, 12 + and eax, 0x0f + mov al, [eax + hextable] + mov [ebx], al + inc ebx + mov eax, ecx + shr eax, 8 + and eax, 0x0f + mov al, [eax + hextable] + mov [ebx], al + + ; Now display the TTL field (this is intel word format) + inc ebx + inc ebx + push ebx + mov eax, 53 + mov ebx, 255 + mov ecx, 207 + int 0x40 + pop ebx + + mov ecx, eax + + shr eax, 12 + and eax, 0x0f + mov al, [eax + hextable] + mov [ebx], al + inc ebx + mov eax, ecx + shr eax, 8 + and eax, 0x0f + mov al, [eax + hextable] + mov [ebx], al + inc ebx + mov eax, ecx + shr eax, 4 + and eax, 0x0f + mov al, [eax + hextable] + mov [ebx], al + inc ebx + mov eax, ecx + and eax, 0x0f + mov al, [eax + hextable] + mov [ebx], al + + + pop ebx + add ebx, 40 + pop edx + inc edx + pop ecx + dec ecx + jmp show_entries + +red: ; redraw + call draw_window + jmp still + +key: ; Keys are not valid at this part of the + mov eax,2 ; loop. 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,0xffffffff ; close this program + int 0x40 + + jmp still + + + +writeDecimal: + pusha + and eax, 0xff + mov ecx, eax + mov dl, 100 + div dl + mov cl, ah + add al, '0' + mov [ebx], al + inc ebx + mov eax, ecx + mov dl, 10 + div dl + mov cl, ah + add al, '0' + mov [ebx], al + inc ebx + mov al, ah + add al, '0' + mov [ebx], al + popa + ret + + +; ********************************************* +; ******* 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+280 ; [x start] *65536 + [x size] + mov ecx,100*65536+270 ; [y start] *65536 + [y size] + mov edx,0x03224466 ; color of work area RRGGBB + mov esi,0x00334455 ; color of grab bar RRGGBB,8->color gl + mov edi,0x00ddeeff ; 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,labelt ; pointer to text beginning + mov esi,labellen-labelt ; text length + int 0x40 + + ; Re-draw the screen text + cld + mov ebx,25*65536+35 ; draw info text with function 4 + mov ecx,0xffffff + mov edx,text + mov esi,40 + newline: + mov eax,4 + int 0x40 + add ebx,16 + 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 + +; Taken from PS.ASM +printhex: +; number in eax +; print to ebx +; xlat from hextable + pusha + mov esi, ebx + add esi, 8 + mov ebx, hextable + mov ecx, 8 +phex_loop: + mov edx, eax + and eax, 15 + xlatb + mov [esi], al + mov eax, edx + shr eax, 4 + dec esi + loop phex_loop + popa + ret + + +; DATA AREA + +text: + db ' Number of ARP entries: xxxxxxxx ' + db ' Maximum # of entries : xxxxxxxx ' + db ' ' + db ' IP Address MAC Stat TTL ' + db ' xxx.xxx.xxx.xxx xxxxxxxxxxxx xxxx xxxx ' + db ' xxx.xxx.xxx.xxx xxxxxxxxxxxx xxxx xxxx ' + db ' xxx.xxx.xxx.xxx xxxxxxxxxxxx xxxx xxxx ' + db ' xxx.xxx.xxx.xxx xxxxxxxxxxxx xxxx xxxx ' + db ' xxx.xxx.xxx.xxx xxxxxxxxxxxx xxxx xxxx ' + db ' xxx.xxx.xxx.xxx xxxxxxxxxxxx xxxx xxxx ' + db ' xxx.xxx.xxx.xxx xxxxxxxxxxxx xxxx xxxx ' + db ' xxx.xxx.xxx.xxx xxxxxxxxxxxx xxxx xxxx ' + db ' xxx.xxx.xxx.xxx xxxxxxxxxxxx xxxx xxxx ' + db ' xxx.xxx.xxx.xxx xxxxxxxxxxxx xxxx xxxx ' + db 'x <- END MARKER, DONT DELETE ' + + +blank: + db ' xxx.xxx.xxx.xxx xxxxxxxxxxxx xxxx xxxx ' + + +labelt: + db 'ARP Table ( First 10 Entries )' +labellen: + +hextable db '0123456789ABCDEF' + + +I_END: + + + + + + diff --git a/programs/arpstat/trunk/build_en.bat b/programs/arpstat/trunk/build_en.bat new file mode 100644 index 0000000000..e6ac7b88ec --- /dev/null +++ b/programs/arpstat/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm arpstat.asm arpstat +@pause \ No newline at end of file diff --git a/programs/arpstat/trunk/build_ru.bat b/programs/arpstat/trunk/build_ru.bat new file mode 100644 index 0000000000..bf1c32f56b --- /dev/null +++ b/programs/arpstat/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm arpstat.asm arpstat +@pause \ No newline at end of file diff --git a/programs/arpstat/trunk/macros.inc b/programs/arpstat/trunk/macros.inc new file mode 100644 index 0000000000..1d153e8723 --- /dev/null +++ b/programs/arpstat/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 + +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 \ No newline at end of file diff --git a/programs/bcdclk/bcdclk/bcdclk.asm b/programs/bcdclk/bcdclk/bcdclk.asm new file mode 100644 index 0000000000..dd37759829 --- /dev/null +++ b/programs/bcdclk/bcdclk/bcdclk.asm @@ -0,0 +1,157 @@ +; +; BCD CLOCK +; +; Compile with FASM for Menuet +; +; + +use32 + + org 0x0 + + db 'MENUET01' + dd 0x01 + dd START + dd I_END + dd 0x100000 + dd 0x7fff0 + dd 0x0 , 0x0 + +include "lang.inc" +include "macros.inc" + + +START: + + call drawwindow + +still: + + + mov eax,23 ; wait for timeout + mov ebx,50 + int 0x40 + + cmp eax,1 ; redraw ? + je red + + cmp eax,3 ; button in buffer ? + je button + + call drawclock + + jmp still + +red: ; redraw + call drawwindow + jmp still + +button: + mov eax,17 ; get id + int 0x40 + + cmp ah,1 ; button id=1 ? + jne noclose + mov eax,-1 ; close this program + int 0x40 + noclose: + + jmp still + +drawclock: + + mov eax,3 ; get time + int 0x40 + bswap eax + shr eax,8 + mov edi,dg1 + mov ecx,6 +dgtomem: + push eax + and al,15 + mov [edi],al + inc edi + pop eax + shr eax,4 + loop dgtomem + mov ebx,74*65536+10 + mov edi,dg1 +digitlp: + mov ecx,30*65536+10 + xor esi,esi +plotlp: + xor edx,edx + test byte[edi],8 + je nobit + mov edx,0x00ff0000 +nobit: + mov eax,13 ; plot 8,4,2,1 + int 0x40 + add ecx,12*65536 + shl byte[edi],1 + inc esi + cmp esi,4 + jne plotlp + shr byte[edi],4 + mov edx,0x00880040 + mov eax,13 ; draw digit box + int 0x40 + pusha + mov edx,ebx + and edx,0xffff0000 + shr ecx,16 + or edx,ecx + add edx,3*65536+2 + mov ebx,0x00010100 + mov ecx,[edi] + mov esi,0x00ffffff + mov eax,47 ; display decimal + int 0x40 + popa + sub ebx,12*65536 + inc edi + cmp edi,dg1+6 + jne digitlp + ret + + +drawwindow: + + + mov eax,12 + mov ebx,1 ; start redraw + int 0x40 + + mov eax,0 ; window + mov ebx,100*65536+100 + mov ecx,100*65536+100 + mov edx,0x83400088 + mov esi,0x805080d0 + mov edi,0x000000ff + int 0x40 + +call drawclock + + mov eax,4 ; text + mov ebx,8*65536+8 + mov ecx,0x10ddeeff + mov edx,title + mov esi,title-titlend + int 0x40 + + + mov eax,12 + mov ebx,2 ; end redraw + int 0x40 + + ret + + + +title: + db 'BCD Clock' +titlend: + +dg1: db ? + + I_END: \ No newline at end of file diff --git a/programs/bcdclk/bcdclk/build_en.bat b/programs/bcdclk/bcdclk/build_en.bat new file mode 100644 index 0000000000..31edc7d593 --- /dev/null +++ b/programs/bcdclk/bcdclk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm bcdclk.asm bcdclk +@pause \ No newline at end of file diff --git a/programs/bcdclk/bcdclk/build_ru.bat b/programs/bcdclk/bcdclk/build_ru.bat new file mode 100644 index 0000000000..52108e4dbd --- /dev/null +++ b/programs/bcdclk/bcdclk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm bcdclk.asm bcdclk +@pause \ No newline at end of file diff --git a/programs/bcdclk/bcdclk/macros.inc b/programs/bcdclk/bcdclk/macros.inc new file mode 100644 index 0000000000..1d153e8723 --- /dev/null +++ b/programs/bcdclk/bcdclk/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 + +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 \ No newline at end of file diff --git a/programs/bgitest/trunk/FONTS/EURO.CHR b/programs/bgitest/trunk/FONTS/EURO.CHR new file mode 100644 index 0000000000..4f3cb57ab5 Binary files /dev/null and b/programs/bgitest/trunk/FONTS/EURO.CHR differ diff --git a/programs/bgitest/trunk/FONTS/GOTH.CHR b/programs/bgitest/trunk/FONTS/GOTH.CHR new file mode 100644 index 0000000000..ac6ef92c6f Binary files /dev/null and b/programs/bgitest/trunk/FONTS/GOTH.CHR differ diff --git a/programs/bgitest/trunk/FONTS/LCOM.CHR b/programs/bgitest/trunk/FONTS/LCOM.CHR new file mode 100644 index 0000000000..d069b341ec Binary files /dev/null and b/programs/bgitest/trunk/FONTS/LCOM.CHR differ diff --git a/programs/bgitest/trunk/FONTS/LITT.CHR b/programs/bgitest/trunk/FONTS/LITT.CHR new file mode 100644 index 0000000000..ddd97c3156 Binary files /dev/null and b/programs/bgitest/trunk/FONTS/LITT.CHR differ diff --git a/programs/bgitest/trunk/FONTS/SANS.CHR b/programs/bgitest/trunk/FONTS/SANS.CHR new file mode 100644 index 0000000000..e8676117e2 Binary files /dev/null and b/programs/bgitest/trunk/FONTS/SANS.CHR differ diff --git a/programs/bgitest/trunk/FONTS/SCRI.CHR b/programs/bgitest/trunk/FONTS/SCRI.CHR new file mode 100644 index 0000000000..8535f9c7a8 Binary files /dev/null and b/programs/bgitest/trunk/FONTS/SCRI.CHR differ diff --git a/programs/bgitest/trunk/FONTS/SIMP.CHR b/programs/bgitest/trunk/FONTS/SIMP.CHR new file mode 100644 index 0000000000..2f2e8b27fa Binary files /dev/null and b/programs/bgitest/trunk/FONTS/SIMP.CHR differ diff --git a/programs/bgitest/trunk/FONTS/SMAL.CHR b/programs/bgitest/trunk/FONTS/SMAL.CHR new file mode 100644 index 0000000000..13f5d066d9 Binary files /dev/null and b/programs/bgitest/trunk/FONTS/SMAL.CHR differ diff --git a/programs/bgitest/trunk/FONTS/TRIP.CHR b/programs/bgitest/trunk/FONTS/TRIP.CHR new file mode 100644 index 0000000000..8620024400 Binary files /dev/null and b/programs/bgitest/trunk/FONTS/TRIP.CHR differ diff --git a/programs/bgitest/trunk/FONTS/TSCR.CHR b/programs/bgitest/trunk/FONTS/TSCR.CHR new file mode 100644 index 0000000000..5344d42603 Binary files /dev/null and b/programs/bgitest/trunk/FONTS/TSCR.CHR differ diff --git a/programs/bgitest/trunk/bgifont.inc b/programs/bgitest/trunk/bgifont.inc new file mode 100644 index 0000000000..331c9ef9e5 --- /dev/null +++ b/programs/bgitest/trunk/bgifont.inc @@ -0,0 +1,691 @@ +; BGIFONT.INC v1.0 beta +; +; Written in pure assembler by Ivushkin Andrey aka Willow +; +; Created: December 16, 2004 +; +; Last changed: February 2, 2005 +; +; Compile with FASM + +; BGI constants +BGI_NODRAW equ 0x10000 +BGI_ITALIC equ 0x20000 +BGI_BOLD equ 0x40000 +BGI_HALEFT equ 0x0 +BGI_HARIGHT equ 0x1000 +BGI_HACENTER equ 0x2000 +BGI_VABOTTOM equ 0x0 +BGI_VATOP equ 0x4000 +BGI_VACENTER equ 0x8000 + +BGI_FREE equ 0x80000000 +BGI_HAMASK equ 0x3000 +BGI_VAMASK equ 0xc000 + +; Freetext structure +struc BGIfree FontName,XY,Angle,ScaleX,ScaleY,StrPtr,StrLen,Color,Align +{ + dd FontName ;0 + dd XY ;4 + dd Angle ;8 + dd ScaleX ;12 + dd ScaleY ;16 + dd StrPtr ;20 + dd StrLen ;24 + dd Color ;28 + dd Align ;32 +} + +; font options structure +struc BGIrec FontName,CharsCount,FirstChar,UpperMargin,LowerMargin,\ + Widths,FirstData,EOF,font_data +{ + .FontName dd ? ; 0 + .CharsCount db ? ; 4 + .FirstChar db ? ; 5 + .UpperMargin db ? ; 6 + .LowerMargin db ? ; 7 + .Widths dd ? ; 8 + .FirstData dd ? ; 12 + .EOF dd ? ; 16 + .font_data dd ? ; 20 follows (Offsets) +} + +macro BGIfont_GetID +{ + call _BGIfont_GetID +} + +macro BGIfont_Prepare +{ + call _BGIfont_Prepare +} + +macro BGIfont_Freetext +{ + call _BGIfont_Freetext +} + +macro BGIfont_Outtext +{ + call _BGIfont_Outtext +} + +macro _FI name,_size +{ + db name +if BGI_LEVEL eq KERNEL + dw _size +end if +} + +BGIfont_names: +_FI 'LCOM',11485 ;7 +_FI 'EURO',8117 ;5 +_FI 'GOTH',13816 ;6 +_FI 'LITT',3596 ;8 +_FI 'TRIP',11932 ;14 +_FI 'SCRI',8490 ;11 +_FI 'SMAL',4162 ;13 +_FI 'TSCR',12134 ;15 +_FI 'SANS',8453 ;10 +_FI 'SIMP',9522 ;12 +BGIfont_names_end: + +macro BGIfont_Init +{ +; in: ecx - number of fonts to load; +; esi-> _FI structure +; edi-> where to load + push edi +if BGI_LEVEL eq KERNEL + mov edi,0x40000 +end if + .nfont: + mov edx,[esi] +if BGI_LEVEL eq KERNEL + movzx ebx,word[esi+4] + mov [BGIfont_Prepare.okflag],'N' +end if + call _BGIfont_Prepare +if ~ BGI_LEVEL eq KERNEL + add esi,4 +else + push esi + test eax,eax + jz .fail + mov [BGIfont_Prepare.okflag],'*' + .fail: + mov esi,BGIfont_Prepare.font + call boot_log + pop esi + add esi,6 +end if + loop .nfont + dph2 _BGI_BOLD,300,550 +; movzx edi,byte[0x40000] + pop edi +} + +BGIfont_get2head: + shr ecx,28 ; font # + sub ecx,4 + jb .exit2 ; invalid # + mov edi,[BGIfont_Ptr] + inc edi + cmp cl,[edi-1] + jae .exit2 ; # too large + jecxz .ex + .fnext: + mov edi,[edi+16] + loop .fnext + jmp .ex + .exit2: + xor edi,edi + .ex: + ret + +BGIfont_GetName: +; in: ecx-fontID; +; out: edx-font name. + call BGIfont_get2head + xor edx,edx + test edi,edi + jz .ex + mov edx,[edi] + .ex: + ret + +macro dps2 _str +{ +if ~ BGI_LEVEL eq KERNEL + if LOAD_MSG eq 1 + dps _str + end if +else + pusha + mov esi,BGIfont_Prepare.okflag + mov byte[esi], _str + call boot_log + popa +end if +} + +macro dph2 num,x,y +{ +if BGI_LEVEL eq KERNEL + pusha + mov eax,0x00080100 + mov ebx,num + mov ecx,x shl 16+y + mov edx,0xFF0000 + call display_number + popa +end if +} + +_BGIfont_GetID: +; in: edx-font name; +; out: eax-fontID, edi->BGIrec + push ecx edi + mov edi,[BGIfont_Ptr] + movzx ecx,byte[edi] ; ecx-font count + mov eax,ecx + inc edi ; edi->FontName + jecxz .ex + .fnext: + cmp edx,[edi] + jne .floop + sub eax,ecx + add eax,4 + shl eax,28 + jmp .ex + .floop: + mov edi,[edi+16] + loop .fnext + .num0: + xor eax,eax + .ex: + pop edi ecx + ret + +_BGIfont_Prepare: +; in: edx-font name, edi->pointer to load fonts (fonts_count) +; out: eax-ID of new font loaded; eax=0 error + cmp [BGIfont_Ptr],0 + jne .already + mov [BGIfont_Ptr],edi + .already: + pusha + mov edi,[BGIfont_Ptr] + movzx ecx,byte[edi] ; ecx-font count + mov eax,ecx + inc edi ; edi->FontName + jecxz .fload + .fnext: + cmp edx,[edi] + jne .loop + sub eax,ecx + inc eax + jmp .cr_id + .loop: + mov edi,[edi+16] + loop .fnext + .fload: + mov dword[.font],edx ; filename + 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 + int 0x40 + test eax,eax + jnz .fail + dps2 '1' + shr ebx,9 + inc ebx + mov [.fsize],ebx + mov ebx,.fontinfo + mov eax,58 + int 0x40 ; ebx - file size +else + push edi esi edx + mov eax,.font + xor ebx,ebx + mov esi,12 + mov ecx,ebx + mov edx,edi + call fileread + pop edx esi edi + mov ebp,edi + add ebp,ebx + cmp ebp,0x50000 + ja .fail +end if + cmp dword[edi],0x08084b50 ; 'PK',8,8 + jne .fail + dps2 '2' + inc edi + mov eax,26 ; #EOF + mov ecx,253 + cld + repne scasb ; skip Copyright + test ecx,ecx + jz .fail + dps2 '3' + cmp edx,[edi+2] ; FontName + jne .fail + dps2 '4' + movzx ecx,word[edi] ; HeaderSize + sub ebx,ecx ; Filesize-Headersize + movzx eax,word[edi+6] ; FontSize + cmp eax,ebx + jb .fail ; file truncated + add ecx,[.dest] + dps2 '5' + cmp byte[ecx],'+' ; ParPrefix + jne .fail +; font is valid, let's fill parameter table + dps2 '>' + mov [esi],edx ; FontName + mov edx,eax + add eax,ecx + mov [esi+16],eax ; Font EOF + movzx eax,word[ecx+5] + add eax,ecx + mov [esi+12],eax + lea edi,[esi+4] ; edi->CharsCount + lea esi,[ecx+1] ; esi->ParPrefix+1 + xor eax,eax + lodsw + stosb ; CharsCount + inc esi + movsb ; FirstChar + add esi,3 + lodsw + stosb ; UpperMargin + movsb ; LowerMargin + add esi,5 ; esi->offsets + mov eax,[esi] + push edi ; edi->Widths +; prepare moving data + add edi,12 ; edi->offsets + lea ecx,[edx-16] + rep movsb + pop edi ; edi->Widths + mov [edi+8],esi ; EOF +; mov eax,[edi] + movzx ecx,byte[edi-4] ; CharsCount + lea eax,[edi+12+ecx*2] ; eax->widths + stosd ; edi->FirstData + add eax,ecx + stosd ; edi->EOF + mov eax,[esp] ; eax->fonts_count + inc byte[eax] ; increase font counter + movzx eax,byte[eax] + .cr_id: + add eax,0x3 ; create unique ID + shl eax,28 ; to easy use in color(ecx) + jmp .exit + .fail: + xor eax,eax + .exit: + mov [esp+28],eax + popa + ret + +if ~ BGI_LEVEL eq KERNEL +.fontinfo: + dd 0 + dd 0 +.fsize dd 0 +.dest dd 0 + dd 0x10000 + db BGIFONT_PATH +.font db 'FONT.CHR',0 +else + .dest dd 0 + .font db 'FONT CHR' + .okflag db ' ',0 +end if + +BGIfont_Coo: +; y->word[txt.y1], x->word[txt.x1] + fild [txt.y1] ;y + fmul st0,st0; y*y + fild [txt.x1] ;x + fmul st0,st0; x*x + faddp ; x*x+y*y + fsqrt ; sqrt, angle + fild [txt.y1];y + fabs + fild [txt.x1] ; x + fabs + fpatan ; arctg(y/x) + .skip: + cmp [txt.x1],0 + jge .xplus + fchs + fadd st0,st3 + .xplus: + cmp [txt.y1],0 + jge .yplus + fchs + .yplus: + fadd st0,st2 + fsincos + fmul st0,st2 + fiadd [txt.x0] + fistp [txt.x1] ; x=r*cos a + fmulp ; y=r*sin a,angle + fiadd [txt.y0] + fistp [txt.y1] + ret + +_BGIfont_Freetext: +; in: ebx-BGIfree structure +; out: eax-new drawing coords + mov edx,[ebx] + call _BGIfont_GetID + test eax,eax + jnz .fexists + ret + .fexists: + pusha + fninit + fldpi + fld [pi180] + fimul dword[ebx+8] + fst [BGIangle] + mov esi,[ebx+28] + and esi,0xffffff + add esi,eax + mov eax,[ebx+32] + and [deform],0 + test eax,BGI_ITALIC + jz .norm + mov [deform],0.4 + .norm: + mov ebp,eax + or ebp,BGI_FREE + mov eax,[ebx+12] + mov [Xscale],eax + mov eax,[ebx+16] + mov [Yscale],eax + mov ecx,[ebx+20] + mov edx,ebp + and edx,BGI_FREE+BGI_VAMASK+BGI_HAMASK + add edx,[ebx+24] + mov eax,[ebx+4] + mov ebx,esi + add ebx,0x6000000 + mov [esp+4],edx + mov [esp+20],ecx + jmp txt + + pi180 dd 0.017453 + +_BGIfont_Outtext: +; in: ebx-[x][y], ecx-color, edx-string, esi-length + pusha + mov ebp,esi +if ~ BGI_LEVEL eq KERNEL + mov eax,ebx + mov ebx,ecx + mov ecx,edx + mov edx,esi +end if +; in: eax-[x][y], ebx-color, ecx-string, edx-length +txt: +if ~ BGI_LEVEL eq KERNEL + if BGI_WINDOW_CLIP eq 1 + pusha + mov eax,9 + mov ebx,BGI_PRC_INFO + mov ecx,-1 + int 0x40 + popa + end if +end if + mov [.y0],ax + shr eax,16 + mov [.x0],ax + mov ecx,ebx ; color + and ebx,0xfffffff + mov [.color],ebx + call BGIfont_get2head + test edi,edi + jz .exit + mov ecx,[esp+4]; str length + mov esi,[esp+20]; str ptr + movzx eax,byte[edi+5] + push ecx + and ecx,0xff + jnz .lenok + add esp,4 + jmp .ex2 + .lenok: + pusha + push dword[txt.y0] + and dword[txt.y0],0 + xor edx,edx + mov ebx,[edi+8] + .next: + call txt.BGIfont_GetChar + movzx eax,byte[ebx+eax] + add edx,eax + loop .next + mov ecx,edx ; ecx - x size + movzx dx,byte[edi+6] + mov ebx,[esp+36] + and ebx,BGI_HAMASK + cmp ebx,BGI_HARIGHT + je .nova + ja .subv + xor ecx,ecx + jmp .nova + .subv: + shr cx,1 + .nova: + mov ebx,[esp+36] + and ebx,BGI_VAMASK + cmp ebx,BGI_VATOP + je .def + ja .subh + xor edx,edx + jmp .def + .subh: + shr dx,1 + .def: + call txt.BGIfont_Deform + pop dword[txt.y0] + popa + pop ebx + mov ax,[txt.y1] + sub [txt.y0],ax + mov ax,[txt.x1] + sub [txt.x0],ax + xor eax,eax + cld +.mloop: + push [.y0] + pop [.y] + push [.x0] + pop [.x] + call .BGIfont_GetChar + push esi + lea esi,[edi+20] ; offset + movzx edx,word[esi+eax*2] ; ofs1 + add edx,[edi+12] + inc eax + cmp al,[edi+4] + je .eof + movzx eax,word[esi+eax*2]; ofs2 + add eax,[edi+12] + jmp .prc_vec + .eof: + mov eax,[edi+16] ; ofs2=eof + .prc_vec: ; edx-vec cmd ifs, eax-cmd limit + mov [.vec_end],eax + push ecx + .vec_loop: + mov ax,word[edx] + push edx + mov ecx,eax + and eax,0x8080 ; op + and ecx,0x7f ; xx + mov edx,[edx+1] + and edx,0x7f ; yy + cmp edx,63 + jbe .positive + sub edx,128 ; yy-=128 + .positive: + cmp ecx,63 + jbe .positive2 + sub ecx,128 ; xx-=128 + .positive2: + call .BGIfont_Deform + cmp eax,0x8080 + jne .noline + test ebp,BGI_NODRAW + jnz .noline +; draw vector +if ~ BGI_LEVEL eq KERNEL + push eax + mov ebx,dword[.x1] + mov ecx,dword[.y1] + if BGI_WINDOW_CLIP eq 1 + movzx eax,[.x] + cmp eax,dword[BGI_PRC_INFO+42] + ja .nobold + movzx eax,[.y] + cmp eax,dword[BGI_PRC_INFO+46] + ja .nobold + xor eax,eax + cmp ax,bx + jg .nobold + cmp ax,cx + jg .nobold + end if + mov edx,[.color] + mov eax,38 + int 0x40 + test ebp,BGI_BOLD + jz .nobold + test ebp,BGI_FREE + jnz .free5 + .free5: + add ebx,1 shl 16+1 + int 0x40 + .nobold: + pop eax +else + pusha + mov eax,dword[.x1] + mov ebx,dword[.y1] + mov ecx,[.color] +; call syscall_drawline + test dword[esp+8],BGI_BOLD + jz .nobold + add eax,1 shl 16+1 +; call syscall_drawline + .nobold: + popa +end if + .noline: + pop edx + test eax,eax + je .eovecs ; op=0 + push [.y1] + pop [.y] + push [.x1] + pop [.x] + add edx,2 + cmp edx,[.vec_end] + jb .vec_loop + .eovecs: + pop ecx esi + push [.y] + pop [.y0] + push [.x] + pop [.x0] + loop .mloop1 + jmp .exit + .mloop1: + jmp .mloop + .exit: + mov eax,dword[.y0] + mov [esp+28],eax + .ex2: + popa + ret + +.BGIfont_Deform: + test ebp,BGI_FREE + jnz .free0 + movzx ebx,byte[.color+3] ;ebx=scale + imul ecx,ebx + add ecx,2 + shr ecx,2 + imul edx,ebx + add edx,2 + shr edx,2 + neg edx + mov [.x1],cx + mov [.y1],dx + jmp .add + .free0: + mov [.x1],cx + mov [.y1],dx + fild [.y1] + fld st0 + fmul [Yscale] + fchs + fistp [.y1] + fmul [deform] + fiadd [.x1] + fmul [Xscale] + fistp [.x1] + cmp [BGIangle],0 + je .add + call BGIfont_Coo + jmp .eax + .add: + mov cx,[.x0] + add [.x1],cx + mov cx,[.y0] + add [.y1],cx + .eax: + ret + +.BGIfont_GetChar: +; in: esi -> string; edi -> BGIrec +; out: esi -> next char; al - char obtained + lodsb ; al - char from str + sub al,[edi+5] + jb .out + cmp al,[edi+4] + jb .in + .out: + xor al,al ; al - 1st symbol available + .in: + ret + +.y0 dw ? +.x0 dw ? + +.x1 dw ? +.x dw ? +.y1 dw ? +.y dw ? + +.color dd ? +.vec_end dd ? +BGIfont_Ptr dd 0 +width dd ? +deform dd ? +BGIangle dd ? +Xscale dd ? +Yscale dd ? diff --git a/programs/bgitest/trunk/bgitest.asm b/programs/bgitest/trunk/bgitest.asm new file mode 100644 index 0000000000..a3cfe7b1ce --- /dev/null +++ b/programs/bgitest/trunk/bgitest.asm @@ -0,0 +1,444 @@ +; BGI Font Test +; +; Written in pure assembler by Ivushkin Andrey aka Willow +; +; Created: December 20, 2004 +; +; Last changed: February 2, 2005 +; + +BGIFONT_PATH equ '/RD/1/' +_X equ 340 +_Y equ 240 + +BGI_WINDOW_CLIP equ 1 +BGI_PRC_INFO equ pinfo + +macro ListFonts +{ + mov eax,lf_head + call PixelPrint + mov ebx,20 shl 16+60 + mov ecx,(BGIfont_names_end-BGIfont_names)/4 + mov esi,BGIfont_names + .l1: + pusha + pusha + mcall 4,,0x10777fac,esi,4 + popa + mov edx,[esi] + BGIfont_GetID + mov dword[_BGIfont_Prepare.font],edx + mov ecx,eax + add ebx,140 shl 16 + mov edx,ebx + mcall 47,0x80100,,,0x10ffffff + jecxz .nofont + lea ebx,[edx+80 shl 16+12] + mov edx,_BGIfont_Prepare.dest+8 + mov esi,BGIfont_Coo-1 + sub esi,edx + add ecx,0x3b800b8 + BGIfont_Outtext + sub ebx,155 shl 16+12 + mcall 4,,0x1000f000,load_ok,load_fail-load_ok + jmp .pop + .nofont: + lea ebx,[edx-80 shl 16] + mcall 4,,0x10f00010,load_fail,font_msg-load_fail + .pop: + popa + add esi,4 + add ebx,39 + loop .l2 + jmp .ex + .l2: + jmp .l1 +.ex: +} +use32 + org 0x0 + + db 'MENUET01' + dd 0x01 + dd START + dd I_END + dd 0x100000 + dd 0x0cfff0 + dd 0x0 +not1strun dd 0x0 + +include 'lang.inc' +include 'macros.inc' +;include 'debug.inc' +include 'bgifont.inc' +lang equ en;ru;en + +START: + mov [help],0 + mov ecx,(BGIfont_names_end-BGIfont_names)/4 + mov esi,BGIfont_names + mov edi,I_END + BGIfont_Init +reset: + mov esi,[BGIfont_Ptr] + inc esi + mov edi,freeconst + movsd + mov esi,freeconst + mov edi,freetest + mov ecx,36 + rep movsb +red: + mov eax,[freetest] + mov dword[title+19],eax + call draw_window + cmp [not1strun],0 + jnz still + mcall 5,300 + not [not1strun] + inc [help] + jmp red +still: + + mov eax,10 + int 0x40 + + cmp eax,1 + je red + cmp eax,2 + je key + cmp eax,3 + je button + + jmp still + +button: + mov eax,17 + int 0x40 + cmp ah,1 + jnz noclose +close: + xor eax,eax + dec eax + int 0x40 + noclose: + jmp still + +key: + mov eax,2 + int 0x40 + shr eax,8 + cmp al,27 ; esc - close + je close + cmp al,32 ; Space - help + jne .noh + inc [help] + cmp [help],3 + jne red + and [help],0 + jmp red + .noh: + cmp [help],2 + jne still + cmp al,50 + jb .noff + cmp al,57 + ja .noff + sub al,46 + .gn: + movzx ecx,al + shl ecx,28 + call BGIfont_GetName + mov [freetest],edx + jmp red + .noff: + mov ecx,4 + mov edi,Fkeys + .fkey: + cmp al,[edi] + je .fndkey + inc edi + loop .fkey + jmp .notfnd + .fndkey: + lea eax,[edi-Fkeys+0xc] + jmp .gn + .notfnd: + cmp al,114 ; r - reset + je reset + cmp al,176 + jne .nol ; left + sub dword[freetest+8],5 + jmp red + .nol: + cmp al,179 + jne .nor ; right + add dword[freetest+8],5 + jmp red + .nor: + cmp al,105 ; i -italic + jne .noi + xor dword[freetest+32],BGI_ITALIC + jmp red + .noi: + cmp al,98 ; b -bold + jne .nob + xor dword[freetest+32],BGI_BOLD + jmp red + .nob: + mov ecx,2 + mov esi,ali + .ol2: + cmp al,[esi] + jne .othl2 + mov ax,[freetest+32] + add ax,[esi+3] + mov bx,ax + mov dx,[esi+1] + and bx,dx + cmp bx,dx + jne .ok + not dx + and ax,dx + .ok: + mov [freetest+32],ax + jmp red + .othl2: + add esi,5 + loop .ol2 + .other: + mov esi,delt + mov ecx,4 + .ol: + cmp al,[esi] + jne .othl + fld dword[esi+1] + movzx eax,byte[esi+5] + fadd dword[freetest+eax] + fstp dword[freetest+eax] + jmp red + .othl: + add esi,6 + loop .ol + jmp still + +draw_window: + mov eax,12 + mov ebx,1 + int 0x40 + + xor eax,eax + mov ebx,10*65536+_X*2 + mov ecx,100*65536+_Y*2 + mov edx,0x03261212 + mov esi,0x805080d0 + mov edi,0x005080d0 + int 0x40 + + mov eax,4 + mov ebx,8*65536+8 + mov ecx,0x10ddeeff + mov edx,title + mov esi,title_end-title + cmp [help],2 + je .int + sub esi,12 + .int: + int 0x40 + + cmp [help],0 + jnz .help + cmp byte[I_END],0 + jnz .fontsok + mov eax,font_msg + call PixelPrint + .fontsok: + ListFonts + jmp .eod + .help: + cmp [help],1 + jne .nohelp + mov eax,helptxt + cmp byte[I_END],0 + jnz .fontsok2 + mov word[eax+2],_X-80 + call PixelPrint + jmp .eod + .fontsok2: + mov word[eax+2],_X + call Print + jmp .eod + .nohelp: + mov edi,cross + mov eax,38 + mov edx,0x4b331a + mov ebx,[edi] + mov ecx,[edi+4] + int 0x40 + mov ebx,[edi+8] + mov ecx,[edi+12] + int 0x40 + mov ebx,freetest + BGIfont_Freetext + .eod: + mov eax,12 + mov ebx,2 + int 0x40 + ret + +Print: ; eax-pointer to _txt struc + pusha + mov ebx,[eax] + movzx ecx,byte[eax+12] + lea edx,[eax+13] + mov edi,eax + .nextstr: + mov esi,[edx] + add edx,4 + push ecx + mov ecx,[edi+8] + BGIfont_Outtext + add ebx,[edi+4] + pop ecx + and esi,0xfff + add edx,esi + loop .nextstr + popa + ret + +PixelPrint: ; eax-pointer to _txt struc, but used differently + pusha + mov ebp,eax + mov ebx,[ebp] + movzx ecx,byte[ebp+12] + mov eax,4 + lea edx,[ebp+17] + .l: + mov esi,[edx-4] + and esi,0xfff + push ecx + mov ecx,[ebp+8] + int 0x40 + pop ecx + lea edx,[esi+edx+4] + add ebx,[ebp+4] + loop .l + popa + ret + +macro _txt _xy,_vert,_color,_opt,[_str] +{ +common + _counter=0 +forward + _counter=_counter+1 +common + dd _xy ; 0 + dd _vert ; 4 + dd _color ; 8 + db _counter ;_str_count ; 12 +forward + local .str_beg,.str_end + dd (.str_end-.str_beg) or _opt ; 13 + .str_beg: + db _str ;17 + .str_end: +} + +title db 'BGIFONT.INC demo - FONT font' +title_end: +_M equ 30 +cross dd _M shl 16+_X*2-_M,_Y shl 16+_Y,_X shl 16+_X,_M shl 16+_Y*2-_M +helptxt: +if lang eq ru +_txt _X shl 16+60,40,0x434ba010,BGI_HACENTER,\ + "ГОРЯЧИЕ КЛАВИШИ:",\ + "Пробел - шрифты/этот текст/демка;",\ + "<-> стрелки - вращение строки;",\ + "V - выравнивание по вертикали;",\ + "H - выравнивание по горизонтали;",\ + "[,] - масштаб по оси X;",\ + "A,Z - масштаб по оси Y;",\ + "B,I - полужирный шрифт и курсив;",\ + "R - сброс параметров шрифта;",\ + "F1..F12 - выбор шрифта;",\ + "Esc - закрыть прогу :-(" +alpha: + db "Вот пример текста!" +lf_head: +_txt 10 shl 16+30,85 shl 16,0x6e00f7,0,"Имя шрифта","Статус","ID",\ + "Путь к файлу" +load_ok: + db "загружен" +load_fail: + db "не найден" +font_msg: + _txt (_X+20) shl 16+180,25,0x10ff0000,0,\ + "К сожалению, не найдено ни одного",\ + "векторного шрифта *.CHR. Возможно,",\ + "вам следует исправить константу",\ + "BGIFONT_PATH в начале файла BGITEST.ASM",\ + "и перекомпилировать его :-(" +else +_txt _X shl 16+60,40,0x434ba010, BGI_HACENTER,\ + "HOT KEYS:",\ + "Space - font list/this message/demo;",\ + "<-> arrows - rotate text string;",\ + "V - toggle vertical alignment;",\ + "H - toggle horizontal alignment;",\ + "[,] - scale on X axis;",\ + "A,Z - scale on Y axis;",\ + "B,I - toggle bold & italic mode;",\ + "R - reset font options;",\ + "F1..F12 - select font;",\ + "Esc - close demo :-(" +alpha: + db 'This is a Sample text!' +; db 'ABCDEFGHIGKLMNOPQRSTUVWXWZ' +lf_head: +_txt 10 shl 16+30,85 shl 16,0x6e00f7,0,"Font name","Status","ID",\ + "Filename" +load_ok: + db "loaded" +load_fail: + db "not found" +font_msg: + _txt (_X+20) shl 16+180,25,0x10ff0000,0,\ + "Sorry, no vector font *.CHR found.",\ + "Maybe you should correct BGIFONT_PATH",\ + "constant at the beginning of file",\ + "BGITEST.ASM and recompile it :-(" +end if + +macro Deltas _key,_scale,_ofs +{ + db _key + dd _scale + db _ofs +} + +delt: +Deltas 91, -0.15,12 +Deltas 93, 0.15,12 +Deltas 97, 0.15,16 +Deltas 122,-0.15,16 +Fkeys db 48,49,68,255 + +macro Aligns _key,_mask,_add +{ + db _key + dw _mask,_add +} +ali: +Aligns 118,BGI_VAMASK,BGI_VATOP +Aligns 104,BGI_HAMASK,BGI_HARIGHT +freeconst BGIfree 'FONT',_X shl 16+_Y,0, 1.0, 1.0, alpha,\ + lf_head-alpha,0xb800e7,\ + BGI_VACENTER or BGI_HACENTER +freetest BGIfree ?,?,?,?,?,?,?,?,? +help db ? +pinfo: + times 1024 db ? +rb 10000 ; reserve, unless process info will corrupt our fonts (why?) +I_END: diff --git a/programs/bgitest/trunk/build_en.bat b/programs/bgitest/trunk/build_en.bat new file mode 100644 index 0000000000..9e33c73ea3 --- /dev/null +++ b/programs/bgitest/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm bgitest.asm bgitest +@pause \ No newline at end of file diff --git a/programs/bgitest/trunk/build_ru.bat b/programs/bgitest/trunk/build_ru.bat new file mode 100644 index 0000000000..e77c15cfc6 --- /dev/null +++ b/programs/bgitest/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm bgitest.asm bgitest +@pause \ No newline at end of file diff --git a/programs/bgitest/trunk/macros.inc b/programs/bgitest/trunk/macros.inc new file mode 100644 index 0000000000..d599dea0e0 --- /dev/null +++ b/programs/bgitest/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 + +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 \ No newline at end of file diff --git a/programs/bgitest/trunk/read_eng.txt b/programs/bgitest/trunk/read_eng.txt new file mode 100644 index 0000000000..27ff38e267 --- /dev/null +++ b/programs/bgitest/trunk/read_eng.txt @@ -0,0 +1,140 @@ + BGIFONT.INC v1.0 beta + + Written in pure assembler by Ivushkin Andrey aka Willow + + At present Menuet operation system has poor means to draw charaters. Its +distro contains 2 raster fonts (CHAR.MT & CHAR2.MT files). The kernel supports +them internally. That is Jarek Pelczar who makes certain efforts to develop +scalable TTF-like fonts but huge Menuet C Library does not become widespread +inside our assembly-written OS. Bulgarian MenuetOS team also tries to include +third scalable font into the kernel, though, as far as I know, its characters +are still under design and are incomplete. Therefore Bulgarian developing is +not valuable for ordinary users. It is obvious that scalable fonts will help +to develop such products as browsers and word processors where character +formatting is of great importance. + Let me introduce for public domain an include file BGIFONT.INC to process +vector fonts (*.CHR) worked out by famous Borland Corporation to use in Turbo +Pascal, Turbo C and Borland C++ compilers under MS-DOS. Sorry, I still fail to +add BGI font support into kernel - deeper knowledge on memory allocation and +system calls needed. I hope that Menuet system programmers will be glad to help +me. Module compiling within kernel is supposed using constant BGI_LEVEL equ +KERNEL. By means of conditional compiling it will be possible to use the module +at both kernel and application levels. Following is concerned using the include +file while programming an application. + + BGI fonts may reside in any folder on HD or RD. They are searched using value +of constant BGI_PATH. If constant BGI_WINDOW_CLIP is equal to 1, module routines +perform window bounds check to avoid artifacts while drawing. Use this if you +aren't sure that strings are fit in window. All BGIFONT.INC routines are +declared as macros, that is they are used without "call". To load 11 fonts into +application's memory a contiguous free space up to 120 kb is needed. When +loading, font data relocation is performed to save memory. Let us see a chart: + +| Font | | BGIrec | | Font | | BGIrec | | Font | | BGIrec | +| counter | | structure| | data | | structure| | data | | structure| ... +| (1 byte)| | | | | | + | ------------->------ -------------->----- ---------- + - referenced by [BGIfont_Ptr] + + BGIrec structure fields have following meaning: + + +00 dword .FontName font name (4 characters) + +04 byte .CharsCount amount of font characters + +05 byte .FirstChar code of the first character present + +06 byte .UpperMargin high bound of characters + +07 byte .LowerMargin low bound of characters + +08 dword .Widths offset to width array + +12 dword .FirstData offset to vector table + +16 dword .EOF pointer to the following BGIrec + +20 dword .font_data here font data begin + + Font loading and verification are carried out by BGIfont_Prepare procedure. + + BGIfont_Prepare + in: EDX - font name (4 characters) to be loaded. It must to be the same as + the font filename (without extension) + EDI - address to where font have to be loaded. Used only for the + first time. Then you may find this value in [BGIfont_Ptr] + out: EAX=0, if an error occured, otherwise EAX is identifier (ID) of the + loaded font. Later it is possible to get font ID with BGIfont_GetID + function. + + For the simultaneous loading of few fonts you may use BGIfont_Init routine. + + BGIfont_Init + in: ESI - pointer to array of font names (for example db 'TRIPSIMPEURO') + ECX is amount of fonts to load + EDI - see BGIfont_Prepare + out: nothing. + + To load 10 standard fonts the module defines an array BGIfont_names (see in +BGITEST for usage demonstration). + + For compatibility and subsequent kernel introduction, the module offers 2 +routines for drawing vector characters. One of them uses registers (like sysfunc +4), another uses a structure. + + BGIfont_Outtext + in: EAX - "pivot point" of a string [x] shl 16+[y] + ECX - text color and font size 0xXYRRGGBB, + where X - vector font ID(4..F), + Y - size of caracters divided by 4, e.g. 0x1 - 1/4 of + ordinary size, 0xC - triple size. + EDX - pointer to the string + ESI - string length + formatting flags (see below). BGI_ITALIC and + BGI_NODRAW flags are ignored. + out: EAX - coords at the end of the string drawn [x] shl 16+[y]. + + As you can see, BGIfont_Outtext is similar to the 4th system function, +but provides an extended management of drawing symbols. + + The most complete use of vector fonts is provided by BGIfont_Freetext routine. +Parameters are passed in a BGIfree structure. + + BGIfree structure fields have following meaning: + + +00 dword font name (4 characters) + +04 dword "pivot point" of a string [x] shl 16+[y] + +08 dword turn angle (clockwise, 0 is horizontal) + +12 dword X scale (floating point value!) + +16 dword Y scale (floating point value!) + +20 dword pointer to the string + +24 dword string length WITHOUT formatting flags + +28 dword text color 0x00RRGGBB + +32 dword formatting flags + + The module defines following formatting flags: +BGI_NODRAW - do not draw +BGI_ITALIC - italic +BGI_BOLD - bold +BGI_HALEFT - left alignment +BGI_HARIGHT - right alignment +BGI_HACENTER - center alignment +BGI_VABOTTOM - bottom alignment +BGI_VATOP - top alignment +BGI_VACENTER - middle vertical alignment + + Combination of flags can be performed by addition or the OR operation. + + BGIfont_Freetext + in: EBX - pointer to BGIfree structure + out: EAX coords at the end of the string drawn [x] shl 16+[y]. + + BGIfont_GetID routine returns font ID by its name. + + BGIfont_GetID + in: EDX - font name (4 characters) + out: EAX - ID of the font + EDI - pointer on font's BGIrec structure. + + Using functions of BGIFONT.INC module is demonstrated by BGITEST app. + + Todo list: +1. An insidious bug sometimes shows up while loading multiple fonts (as in + BGITEST), that corrupts some characters. It disappears when font loading + order is changed... :-( +2. To correct a hardly reproduceable bug when moving along the font list. +3. To perfect drawing of bold fonts. +4. To add number drawing routines. + + diff --git a/programs/bgitest/trunk/read_rus.txt b/programs/bgitest/trunk/read_rus.txt new file mode 100644 index 0000000000..b0ccda26d4 --- /dev/null +++ b/programs/bgitest/trunk/read_rus.txt @@ -0,0 +1,149 @@ + BGIFONT.INC v1.0 beta for MenuetOS + Модуль для работы с векторными шрифтами формата BGI + + Написан на чистом ассемблере Ивушкиным Андреем aka Willow + + В настоящее время операционная система Menuet обладает скудными средствами +отображения символов. В дистрибутиве имеются 2 растровых шрифта (файлы CHAR.MT и +CHAR2.MT). Работа с ними жестко зашита в ядре. Определенные усилия по внедрению +масштабируемых шрифтов TTF-подобного формата предпринимает Jarek Pelczar, однако +громоздкая MenuetOS C Library не получила до сих пор большой популярности в +ассемблерной ОС. Болгарской командой Menuet делались попытки встроить в ядро +третий масштабируемый шрифт, но, насколько мне известно, его символы находятся в +стадии дизайна. Таким образом, разработка болгар пока не представляет ценности +для рядовых пользователей. Очевидно, что масштабируемые шрифты помогут +разработке таких важных категорий программных продуктов, как браузеры и +текстовые процессоры, где большую роль играет форматирование символов. + Представляю в общественное пользование включаемый файл BGIFONT.INC для работы с +векторными шрифтами *.CHR, разработанные знаменитой фирмой Borland для +использования в компиляторах Turbo Pascal, Turbo C и Borland C++ еще в среде MS- +DOS. К сожалению, пока что мне не удается обеспечить поддержку BGI-шрифтов на +уровне ядра - нужно глубже изучать нюансы распределения памяти и вызова +системных функций. Я надеюсь, что системщики Menuet с готовностью мне помогут. +Компиляция модуля в составе ядра предполагается с использованием константы +BGI_LEVEL equ KERNEL. Благодаря условной компиляции модуль можно будет +использовать с незначительными изменениями на уровне как ядра, так и приложения. +Нижеизложенное касается работы модуля на уровне приложения. + + BGI-шрифты могут располагаться в любом каталоге HD или RD. Их поиск +осуществляется по значению константы BGI_PATH. Если константа BGI_WINDOW_CLIP +установлена в 1, процедурами модуля в процессе вывода векторов шрифта +осуществляется проверка выхода за границы окна, чтобы избежать артефактов. +Используйте это, если вы не уверены, что надписи будут помещаться в окне. В +этом случае необходимо дополнительно определить константу BGI_PRC_INFO - адрес +в памяти (1024 байта), куда приложение может получать информацию о своем окне +через 9-ю системную функцию. Все процедуры модуля BGIFONT.INC объявлены как +макросы, т.е. вызываются без call. Для загрузки 11 шрифтов в адресное +пространство приложения необходим непрерывный участок размером около 120 кб. +При загрузке осуществляется перемещение данных с целью экономии памяти. Схема +размещения шрифтов: + +| Счетчик | | Структура| |Данные| |Структура| | Данные| |Структура| +| шрифтов | | BGIrec | |шрифта| | BGIrec | | шрифта| | BGIrec | ... +| (1 байт)| | | | | | + | ------------->------ -------------->----- ---------- + - сюда ссылается [BGIfont_Ptr] + + Поля структуры BGIrec имеют следующее назначение: + + +00 dword .FontName четырехбуквенное имя шрифта + +04 byte .CharsCount количество символов в шрифте + +05 byte .FirstChar код первого реализованного символа + +06 byte .UpperMargin верхняя граница символа + +07 byte .LowerMargin нижняя граница символа + +08 dword .Widths смещение массива ширин символов + +12 dword .FirstData смещение таблицы векторов + +16 dword .EOF указатель на следующий BGIrec + +20 dword .font_data здесь начинаются данные шрифта + + Собственно загрузку и верификацию шрифта осуществляет процедура +BGIfont_Prepare. + + BGIfont_Prepare + вход: EDX - четырехбуквенное имя шрифта, подлежащего загрузке. Должно + совпадать с именем файла шрифта (без расширения) + EDI - адрес участка памяти, куда следует поместить данные шрифта. + Используется только при загрузке первого шрифта. Это значение + заносится в [BGIfont_Ptr] + выход: EAX=0, если произошла ошибка, иначе в EAX - идентификатор (ID) + загруженного шрифта. Впоследствии ID можно получить функциями + BGIfont_GetID и BGIfont_GetName. + + Для единовременной загрузки нескольких шрифтов можно использовать процедуру +BGIfont_Init. + + BGIfont_Init + вход: ESI - указатель на список имен шрифтов (например db 'TRIPSIMPEURO') + ECX - количество шрифтов для загрузки + EDI - см. BGIfont_Prepare + выход: ничего. + + Для загрузки 10 стандартных шрифтов в модуле определен массив BGIfont_names +(использование см. в BGITEST). + + В целях совместимости и последующего внедрения в ядро модуль предлагает 2 +процедуры для вывода символов векторными шрифтами. Одна из них использует +регистры (подобно 4-й системной функции), другая - структуру. + + BGIfont_Outtext + вход: EAX - "точка отсчета" при выводе строки [x] shl 16+[y] + ECX - цвет текста и размер шрифта 0xXYRRGGBB, + где X - ID векторного шрифта (4..F), + Y - величина символов/4, например 0x1 - 1/4 обычного размера, + 0xC - тройной размер. + EDX - указатель на строку + ESI - длина строки + флаги форматирования (см. ниже). Флаги + BGI_ITALIC и BGI_NODRAW игнорируются. + выход: EAX - координаты конца надписи [x] shl 16+[y]. + + Как видим, BGIfont_Outtext по своим параметрам схожа с 4-й системной функцией, +но допускает расширенное управление выводом символов. + + Наиболее полное использование векторных шрифтов обеспечивает функция +BGIfont_Freetext. Параметры вывода строки передаются в структуре BGIfree. + + Поля структуры BGIfree имеют следующее назначение: + + +00 dword четырехбуквенное имя шрифта + +04 dword "точка отсчета" при выводе строки [x] shl 16+[y] + +08 dword угол поворота (0 - горизонталь, отсчет по часовой стрелке) + +12 dword масштаб по оси X (значение с плавающей точкой!) + +16 dword масштаб по оси Y (значение с плавающей точкой!) + +20 dword указатель на строку + +24 dword длина строки БЕЗ флагов форматирования + +28 dword цвет текста 0x00RRGGBB + +32 dword флаги форматирования + + Модуль определяет следующие флаги форматирования: +BGI_NODRAW - не рисовать символы +BGI_ITALIC - курсив +BGI_BOLD - полужирный шрифт +BGI_HALEFT - выровнять по левому краю +BGI_HARIGHT - выровнять по правому краю +BGI_HACENTER - выровнять по центру +BGI_VABOTTOM - выровнять по нижнему краю +BGI_VATOP - выровнять по верхнему краю +BGI_VACENTER - выровнять по середине + + Комбинация флагов образуется их сложением или операцией OR. + + BGIfont_Freetext + вход: EBX - указатель на структуру BGIfree + выход: EAX - координаты конца надписи [x] shl 16+[y]. + + Функция BGIfont_GetID возвращает ID шрифта по заданному имени. + + BGIfont_GetID + вход: EDX - четырехбуквенное имя шрифта + выход: EAX - ID шрифта + EDI - указатель на BGIrec шрифта. + + Использование функций модуля BGIFONT.INC демонстрирует программа BGITEST. + + Что еще нужно сделать: +1. При множественной загрузке шрифтов (как в BGITEST) иногда проявляется + коварный баг, портящий несколько символов. При изменении порядка загрузки + шрифтов он исчезает... :-( +2. Исправить трудовоспроизводимый баг при движении по списку шрифтов. +3. Усовершенствовать прорисовку полужирных шрифтов. +4. Добавить функции вывода чисел. diff --git a/programs/bmpview/trunk/bmpview.asm b/programs/bmpview/trunk/bmpview.asm new file mode 100644 index 0000000000..267522c842 --- /dev/null +++ b/programs/bmpview/trunk/bmpview.asm @@ -0,0 +1,694 @@ +; +; BMP VIEWER +; modified by Ivan Poddubny +; +; Compile with FASM for Menuet +; + + use32 + org 0x0 + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd I_END ; size of image + dd 0x300000 ; memory for app + dd 0xfff0 ; esp + dd I_Param , 0x0 ; I_Param , I_Icon + +include 'lang.inc' +include 'macros.inc' + + +START: ; start of execution + + cmp dword [I_Param],0 + je noparam + + cmp dword [I_Param],'BOOT' + jne noboot + call load_image + call set_as_background + mov eax,15 + mov ebx,4 + mov ecx,2 + int 0x40 + mov eax,15 + mov ebx,3 + int 0x40 + + or eax,-1 + int 0x40 + noboot: + + mov edi,name_string + mov al,0 + mov ecx,70 + rep stosb + + mov ecx,50 + mov edi,I_Param + repne scasb + sub edi,I_Param + mov ecx,edi + + mov esi,I_Param + mov edi,name_string + cld + rep movsb + call load_image + + noparam: + + call draw_window ; at first, draw the 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 + + 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 ? + jne noclose + mov eax,-1 ; close this program + int 0x40 + noclose: + + cmp ah,2 + jne no_file_name + call read_string + jmp still + no_file_name: + + cmp ah,3 + jne no_load_image + call load_image + call draw_window + jmp still + no_load_image: + + cmp ah,4 + jne no_setasbackground + call set_as_background + jmp still + no_setasbackground: + + cmp ah,5 + jne no_tiled + mov eax,15 + mov ebx,4 + mov ecx,1 + int 0x40 + mov eax,15 + mov ebx,3 + int 0x40 + jmp still + no_tiled: + + cmp ah,6 + jne no_stretch + mov eax,15 + mov ebx,4 + mov ecx,2 + int 0x40 + mov eax,15 + mov ebx,3 + int 0x40 + jmp still + no_stretch: + + + jmp still + +type dd 0x0 +i_pos dd 0x0 +x_size dd 0x1 +y_size dd 0x1 +bpp dd 0x24 + +temp dd 999 + +fileinfoblock: + + dd 0 ; 0 = read + dd 0 ; first 512 block + dd 1 ; number of blocks to read + dd 0x10000+1024 ; read to + dd 35 ; 17000 byte work area +name_string: + db '/HARDDISK/FIRST/MENUET/PICS/NEW.BMP',0 + times 100 db 0 + + +read_header: + + pusha + + mov edi,0x10000 + mov ecx,100 + mov eax,0 + cld + rep stosb + + mov [fileinfoblock+ 8],dword 1 + mov [fileinfoblock+12],dword 0x10000 + +push dword [name_string-4] +mov [name_string-4],dword 0x20000 + mov eax,58 + mov ebx,fileinfoblock + int 0x40 +pop dword [name_string-4] + + movzx eax,word [0x10000+0] + mov [type],eax + mov eax,[0x10000+10] + mov [i_pos],eax + mov eax,[0x10000+18] + mov [x_size],eax + mov eax,[0x10000+22] + mov [y_size],eax + movzx eax,word [0x10000+28] + mov [bpp],eax + + popa + ret + + +draw_picture_info: + + pusha + + mov eax,13 + mov ebx,380*65536+6*5 + mov ecx,65*65536+40 + mov edx,0xffffff + int 0x40 + + mov eax,47 + mov ebx,5*65536 + mov ecx,[x_size] + mov edx,380*65536+65 + mov esi,0x224466 + int 0x40 + + mov ecx,[y_size] + add edx,10 + int 0x40 + + mov ecx,[bpp] + add edx,20 + int 0x40 + + popa + ret + + + +load_image: + + pusha + + call read_header + + cmp word [type],'BM' + je ok_image + + cmp [bpp],24 + je ok_image + + mov eax,13 ; not found ! + mov ebx,150*65536+50 + mov ecx,100*65536+50 + mov edx,0xff0000 + int 0x40 + + mov eax,5 + mov ebx,100 + int 0x40 + + jmp retimage + + ok_image: + + call draw_picture_info + + mov [fileinfoblock+8],dword 0x100000/512 + mov eax,0x80000 + sub eax,[i_pos] + mov [fileinfoblock+12],eax +push dword [name_string-4] +mov [name_string-4],dword 0x20000 + mov eax,58 + mov ebx,fileinfoblock + int 0x40 +pop dword [name_string-4] + + mov eax,[x_size] + imul eax,3 + + mov [x_delta],eax + + mov ebx,[y_size] + dec ebx + imul eax,ebx + add eax,0x80000 + + mov esi,eax + mov edi,0x180000 + newln: + push esi + push edi + mov ecx,[x_delta] + cld + rep movsb + pop edi + pop esi + + sub esi,[x_delta];640*3 + add edi,[x_delta];640*3 + cmp esi,0x80000 + jge newln + + retimage: + + popa + + ret + +x_delta dd 0x1 + + +draw_image: + + pusha + +; mov eax,7 ; draw with putimage +; mov ebx,0x180000 +; mov ecx,200*65536+160 +; mov edx,14*65536+28 +; int 0x40 +; mov eax,5 +; mov ebx,200 +; int 0x40 + + mov ebx,0 ; show the image as 320x240 picture + mov ecx,0 + +times 6 db 0x90 + + newpix: + + push ebx + push ecx + + mov eax,[esp] + imul eax,[y_size] + + mov ebx,240 + xor edx,edx + div ebx + + imul eax,3 + imul eax,[x_size] + + mov esi,eax + + mov eax,[esp+4] + imul eax,[x_size] + + mov ebx,320 + xor edx,edx + div ebx + + imul eax,3 + + add esi,eax + mov edx,[0x180000+esi] + + + and edx,0xffffff + + pop ecx + pop ebx + + add ebx,20 + add ecx,40 + mov eax,1 + int 0x40 + add ebx,-20 + add ecx,-40 + + inc ebx + cmp ebx,320 + jb newpix + + xor ebx,ebx + + inc ecx + cmp ecx,240 + jb newpix + + popa + + ret + +set_as_background: + + pusha + + mov esi,0x180000 + new_smooth: + xor eax,eax + xor ebx,ebx + mov al,[esi] + mov bl,[esi+3] + add eax,ebx + mov bl,[esi+6] + add eax,ebx + mov bl,[esi+9] + add eax,ebx + shr eax,2 + and eax,0xff + inc esi + cmp esi,0x180000+640*480*3 + jbe new_smooth + + + mov eax,15 + mov ebx,1 + mov ecx,[x_size] + mov edx,[y_size] + int 0x40 + + mov eax,15 + mov ebx,5 + mov ecx,0x180000 + mov edx,0 + mov esi,640*480*3 + int 0x40 + + mov eax,15 + mov ebx,3 + int 0x40 + + + popa + + ret + +ya dd 300 +addr dd name_string +case_sens db 0 + + +read_string: +pusha + +mov edi,[addr] +mov eax,[addr] +mov eax,[eax-4] +mov [temp],eax + +add edi,eax + +call print_strings + +f11: +mov eax,10 +int 0x40 +cmp eax,2 +jne read_done +int 0x40 +shr eax,8 + +cmp eax,13 +je read_done + +cmp eax,192 +jne noclear + +xor eax,eax +mov [temp],eax +mov edi,[addr] +mov [edi-4],eax +mov ecx,49 +cld +rep stosb +mov edi,[addr] +call print_strings +jmp f11 + +noclear: + +cmp eax,8 +jnz nobsl +cmp [temp],0 +jz f11 +dec [temp] +mov edi,[addr] +add edi,[temp] +mov [edi],byte 0 + +mov eax,[addr] +dec dword [eax-4] + +call print_strings +jmp f11 + +nobsl: +cmp [temp],50 +jae read_done + +cmp eax,dword 31 +jbe f11 +cmp [case_sens],1 +je keyok +cmp eax,dword 95 +jb keyok +add eax,-32 +keyok: +mov edi,[addr] +add edi,[temp] +mov [edi],al + +inc [temp] + +mov eax,[addr] +inc dword [eax-4] +call print_strings +cmp [temp],50 +jbe f11 + +read_done: +mov ecx,50 +sub ecx,[temp] +mov edi,[addr] +add edi,[temp] +xor eax,eax +cld +rep stosb + +mov [temp],999 + +call print_strings + +popa +ret + +print_strings: +pusha +mov eax,13 +mov ebx,80*65536+6*45 +mov ecx,[ya] +shl ecx,16 +add ecx,12 +mov edx,0xffffff +int 0x40 + +mov edx,[addr] +mov esi,[edx-4] +mov eax,4 +mov ebx,80*65536+2 +add ebx,[ya] +mov ecx,0 +int 0x40 + +cmp [temp],50 +ja @f + +mov eax,[ya] +mov ebx,eax +shl eax,16 +add eax,ebx +add eax,10 +mov ecx,eax + +mov eax,[temp] +imul eax,eax,6 +add eax,80 +mov ebx,eax +shl eax,16 +add ebx,eax + +mov eax,38 +mov edx,0 +int 0x40 +@@: + +popa +ret + + + + +; ********************************************* +; ******* 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,20*65536+444 ; [x start] *65536 + [x size] + mov ecx,10*65536+333 ; [y start] *65536 + [y size] + mov edx,0x03ffffff ; color of work area RRGGBB,8->color gl + mov esi,0x808899ff ; color of grab bar RRGGBB,8->color gl + mov edi,0x008899ff ; 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,0x10ddeeff ; color of text RRGGBB + mov edx,labelt ; pointer to text beginning + mov esi,labellen-labelt ; text length + int 0x40 + + mov eax,8 + mov ebx,20*65536+52 + mov ecx,295*65536+16 + mov edx,2 + mov esi,0x306090 + int 0x40 + + add ebx,336*65536+20 + add ecx,5*65536 + mov edx,3 + int 0x40 + + sub ecx,20*65536 + mov edx,4 + int 0x40 + + sub ecx,40*65536 + inc edx + int 0x40 + + add ecx,20*65536 + inc edx + int 0x40 + + mov ebx,346*65536+45 + mov edx,info+1 + mov esi,15 + newinfo: + mov ecx,[tcolor] + cmp [edx-1],byte 'w' + jne nowhite + mov ecx,[btcolor] + nowhite: + mov eax,4 + int 0x40 + add ebx,10 + add edx,16 + cmp [edx-1],byte 'x' + jne newinfo + + mov ebx,20*65536+300 ; draw info text with function 4 + mov ecx,[btcolor] + mov edx,text + mov esi,70 + newline: + mov eax,4 + int 0x40 + add ebx,10 + add edx,esi + cmp [edx],byte 'x' + jne newline + + call print_strings + + call draw_image + + call draw_picture_info + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + + ret + + +; DATA AREA + +tcolor dd 0x000000 +btcolor dd 0x224466+0x808080 + + +text: + db ' FILE: ' + db 'x' + +info: + db ' IMAGE INFO ' + db ' ' + db ' X: ' + db ' Y: ' + db ' ' + db ' BPP: ' + db ' ' + db ' ' + db ' 16M COLOURS ' + db ' 640x480 max ' +times 10 db ' ' + db 'w TILED ' + db ' ' + db 'w STRETCH ' + db ' ' + db 'w SET AS BGR ' + db ' ' + db 'w LOAD ' + db 'x' + + +labelt: db 'BMP VIEWER' +labellen: + +I_END: +I_Param: diff --git a/programs/bmpview/trunk/build_en.bat b/programs/bmpview/trunk/build_en.bat new file mode 100644 index 0000000000..6985f4677c --- /dev/null +++ b/programs/bmpview/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm bmpview.asm bmpview +@pause \ No newline at end of file diff --git a/programs/bmpview/trunk/build_ru.bat b/programs/bmpview/trunk/build_ru.bat new file mode 100644 index 0000000000..08fa54badf --- /dev/null +++ b/programs/bmpview/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm bmpview.asm bmpview +@pause \ No newline at end of file diff --git a/programs/bmpview/trunk/macros.inc b/programs/bmpview/trunk/macros.inc new file mode 100644 index 0000000000..d599dea0e0 --- /dev/null +++ b/programs/bmpview/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 + +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 \ No newline at end of file diff --git a/programs/board/trunk/board.asm b/programs/board/trunk/board.asm new file mode 100644 index 0000000000..5125d36707 --- /dev/null +++ b/programs/board/trunk/board.asm @@ -0,0 +1,221 @@ +; +; DEBUG BOARD for APPLICATIONS and KERNEL DEVELOPMENT +; +; See f63 +; +; 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 0x2000 ; memory for app (4 Kb) + dd 0x2000 ; esp + dd 0x0 , 0x0 ; I_Param , I_Icon + +MAXSTRINGS = 16 + +xpos dd 0x0 +ypos dd 0 + + +START: ; start of execution + + mov ecx,1024 + flush: + mov eax,63 + mov ebx,2 + int 0x40 + loop flush + + mov ecx, 80*(MAXSTRINGS+1) + xor eax, eax + mov edi, text + rep stosb + + mov [tmp],'x' + + mov eax,14 + int 0x40 + and eax,0xffff0000 + sub eax,400 shl 16 + add eax,400 + mov [xstart],eax + + call draw_window + +still: + + mov eax,23 ; wait here for event + mov ebx,1 + 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 + + mov eax,63 + mov ebx,2 + int 0x40 + + cmp ebx,1 + jne still + + new_data: + + cmp al,13 + jne no13 + mov [xpos],0 + jmp new_check + no13: + cmp al,10 + jne no10 + inc [ypos] + cmp [ypos],MAXSTRINGS + jbe noypos + mov [ypos],MAXSTRINGS + mov esi,text+80 + mov edi,text + mov ecx,80*(MAXSTRINGS) + cld + rep movsb + + mov esi,[ypos] + imul esi,80 + add esi,[xpos] + add esi,text + mov ecx,80 + xor al,al + rep stosb + noypos: + jmp new_check + no10: + + mov esi,[ypos] + imul esi,80 + add esi,[xpos] + mov [text+esi],al + inc [xpos] + cmp [xpos],80 + jb xposok + mov [xpos],79 + xposok: + + new_check: + + mov eax,63 + mov ebx,2 + int 0x40 + + cmp ebx,1 + je new_data + + call draw_window + + 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 ? + jne noclose + + mov eax,-1 ; close this program + int 0x40 + noclose: + + jmp still + + + + +; ********************************************* +; ******* 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,50*65536+400 ; [x start] *65536 + [x size] + mov ebx,[xstart] + mov ecx,MAXSTRINGS*10+40 ; [y start] *65536 + [y size] + mov edx,[sc.work] ; color of work area RRGGBB,8->color gl + or edx,0x03000000 + 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 ebx,15*65536+33 ; draw info text with function 4 + mov ecx,[sc.work_text] + mov edx,text + mov esi,80 + newline: + mov eax,4 + int 0x40 + add ebx,10 + add edx,80 + cmp [edx],byte 'x' + jne newline + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + + ret + + +; DATA AREA + +if lang eq ru + header: + db 'ДОСКА ОТЛАДКИ И СООБЩЕНИЙ' + .len = $ - header +else + header: + db 'GENERAL DEBUG & MESSAGE BOARD' + .len = $ - header +end if +I_END: + text rb 80*(MAXSTRINGS+1) + tmp db ? + xstart dd ? + sc system_colors \ No newline at end of file diff --git a/programs/board/trunk/build_en.bat b/programs/board/trunk/build_en.bat new file mode 100644 index 0000000000..82f5e85066 --- /dev/null +++ b/programs/board/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm board.asm board +@pause \ No newline at end of file diff --git a/programs/board/trunk/build_ru.bat b/programs/board/trunk/build_ru.bat new file mode 100644 index 0000000000..b1138037c9 --- /dev/null +++ b/programs/board/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm board.asm board +@pause \ No newline at end of file diff --git a/programs/board/trunk/macros.inc b/programs/board/trunk/macros.inc new file mode 100644 index 0000000000..d599dea0e0 --- /dev/null +++ b/programs/board/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 + +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 \ No newline at end of file diff --git a/programs/c4/trunk/Readme.txt b/programs/c4/trunk/Readme.txt new file mode 100644 index 0000000000..8f1dc78fb7 --- /dev/null +++ b/programs/c4/trunk/Readme.txt @@ -0,0 +1,27 @@ +C4 0.1 +Copyright (C) 2002 Thomas Mathys +killer@vantage.ch + + +What's this ? +------------- + +C4 is a connect four clone for MenuetOS +(http://www.menuetos.org). + + +Installation +------------ + +Simply copy the executable (C4) onto your MenuetOS floppy. +You don't need to copy anything else, the image files are +linked into the executable. + +If you want to compile C4 yourself you need NASM. +Get it from http://nasm.sourceforge.net. + +Compile C4 using the following command: + + nasm -f bin -o c4 c4.asm + +(nasmw if you have the win32 version) diff --git a/programs/c4/trunk/ai.inc b/programs/c4/trunk/ai.inc new file mode 100644 index 0000000000..e92386aedb --- /dev/null +++ b/programs/c4/trunk/ai.inc @@ -0,0 +1,270 @@ +; C4 +; Copyright (c) 2002 Thomas Mathys +; killer@vantage.ch +; +; This file is part of C4. +; +; C4 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. +; +; C4 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. +; +; You should have received a copy of the GNU General Public License +; along with C4; if not, write to the Free Software +; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +%ifndef _AI_INC +%define _AI_INC + + +INFTY equ 1000000000 + + + + section .data + +; table used to perform some primitive move "ordering": +; middle columns which are usually more important are +; searched first. +moveorder dd 1,7,2,6,3,5,4 + +; table used for static evaluation. +; this table is taken from 4st attack: it is ways better +; than the table i used before =) +evaltable: dd 0, 0, 0, 0, 0, 0, 0, 0, 0 + dd 0, 3, 4, 5, 7, 5, 4, 3, 0 + dd 0, 4, 6, 8,10, 8, 6, 4, 0 + dd 0, 5, 8,12,13,12, 8, 5, 0 + dd 0, 5, 8,12,13,12, 8, 5, 0 + dd 0, 4, 6, 8,10, 8, 6, 4, 0 + dd 0, 3, 4, 5, 7, 5, 4, 3, 0 + dd 0, 0, 0, 0, 0, 0, 0, 0, 0 + + + + section .bss + +cpulevel resd 1 ; level of current cpu player +bestval resd 1 ; value of best move found so far +nbestmoves resd 1 ; # of best moves found so far +bestmoves resd 7 ; array to hold all best moves + + + + section .text + + + +;********************************************************** +; aiGetMove +; returns a move for a computer player +; +; input : eax = cpu level ( >= 1) +; output : eax = move +; destroys : everything +;********************************************************** +aiGetMove: + + ; initialize variables + mov [cpulevel],eax + mov dword [bestval],-INFTY + mov dword [nbestmoves],0 + + ; try every move + mov ecx,6 +.evalmoves: + + ; get move to make from move order table + mov eax,[moveorder+ecx*4] + + ; if this is an invalid move, continue with next move + BOARDISVALIDMOVE eax + jz .nextmove + + ; make move for current player + mov ebx,[currentplayer] + call boardMakeMove + + ; evaluate move + push eax ; save move # + push ecx ; save loop counter + push dword [cpulevel] ; ply + mov ebx,[currentplayer] ; player + BOARDGETOTHERPLAYER ebx + push ebx + push dword -INFTY ; alpha + push dword INFTY ; beta + call alphabeta + neg eax ; damn, how could i forget this ??? + mov ebx,eax ; save result for later + pop ecx ; restore loop counter + pop eax ; restore move # + + ; undo move (eax = move #) + call boardUndoMove + + ; let's see wether we have a new best move + cmp ebx,[bestval] ; new best value found ? + jle .nonewbestval + mov [bestval],ebx ; yes -> save it + mov dword [nbestmoves],1 ; delete everything that was in the list + mov [bestmoves+0],eax ; save move number in list + jmp short .nextmove ; continue with next move +.nonewbestval: + cmp ebx,[bestval] ; another best value found ? + jne .nextmove + mov ebx,[nbestmoves] ; yes -> add move to list + mov [bestmoves+ebx*4],eax + inc dword [nbestmoves] + +.nextmove: + dec ecx + js .done + jmp .evalmoves +.done: + + ; randomly pick one of the best moves + call rand ; rand() % nbestmoves + xor edx,edx + div dword [nbestmoves] + mov eax,[bestmoves+edx*4] ; get move from list + ret + + ; test code : pick first move from list + mov eax,[bestmoves+0] + ret + + + +;********************************************************** +; alphabeta +; +; input : see below +; output : eax = move value +; destroys : everything +;********************************************************** +alphabeta: + +%define ply (ebp+20) +%define player (ebp+16) +%define alpha (ebp+12) +%define beta (ebp+ 8) + + enter 0,0 + + ; win for other player -> end search + mov eax,[player] + BOARDGETOTHERPLAYER eax + call boardIsWin + or eax,eax + jz .nowin + mov eax,-1000000 + mov ebx,[ply] + shl ebx,10 + sub eax,ebx + leave + ret 4*4 +.nowin: + ; board full but no win -> draw -> end search + BOARDISFULL + jnz .notfull + xor eax,eax + leave + ret 4*4 +.notfull + ; max search depth reached -> do static evaluation + cmp dword [ply],0 + je .staticeval + + + ; for each move + mov ecx,6 +.evalmoves: + + ; while (alpha < beta) + mov eax,[alpha] + cmp eax,[beta] + jge .done + + ; pick move from move order table + mov eax,[moveorder+ecx*4] + + ; invalid move ? if so, continue with next move + BOARDISVALIDMOVE eax + jz .nextmove + + ; make move for current player + mov ebx,[player] + call boardMakeMove + + ; evaluate move + push eax + push ecx + mov eax,[ply] ; ply = ply-1 + dec eax + push eax + mov ebx,[player] ; player = other player + BOARDGETOTHERPLAYER ebx + push ebx + mov ecx,[beta] ; alpha = -beta + neg ecx + push ecx + mov edx,[alpha] ; beta = -alpha + neg edx + push edx + call alphabeta + neg eax + + ; new alpha ? + cmp eax,[alpha] + jle .nonewalpha + mov [alpha],eax ; yes -> save it +.nonewalpha: + pop ecx + pop eax + + ; undo move + call boardUndoMove + +.nextmove: ; evaluate next move + dec ecx + jns .evalmoves + +.done: + mov eax,[alpha] + leave + ret 4*4 + + ; static evaluation +.staticeval: + xor eax,eax + mov esi,BWIDTH*BHEIGHT-1 +.l: + mov ebx,[board+esi*4] ; get stone from board + cmp ebx,[player] ; player's stone ? + jne .notplayer ; nope -> go on + add eax,[evaltable+esi*4] ; yes -> add stone value to eax + jmp .next ; next stone +.notplayer: + cmp ebx,EMPTY ; other player's stone ? + je .empty ; nope -> go on + sub eax,[evaltable+esi*4] ; yes -> sub stone value from eax +.empty: + +.next: ; next stone + dec esi + jns .l + leave ; eax contains static value + ret 4*4 + +%undef ply +%undef player +%undef alpha +%undef beta + +%endif \ No newline at end of file diff --git a/programs/c4/trunk/blue.pcx b/programs/c4/trunk/blue.pcx new file mode 100644 index 0000000000..395ee2a325 Binary files /dev/null and b/programs/c4/trunk/blue.pcx differ diff --git a/programs/c4/trunk/board.inc b/programs/c4/trunk/board.inc new file mode 100644 index 0000000000..6bf1ccd2b5 --- /dev/null +++ b/programs/c4/trunk/board.inc @@ -0,0 +1,318 @@ +; C4 +; Copyright (c) 2002 Thomas Mathys +; killer@vantage.ch +; +; This file is part of C4. +; +; C4 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. +; +; C4 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. +; +; You should have received a copy of the GNU General Public License +; along with C4; if not, write to the Free Software +; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +%ifndef _BOARD_INC +%define _BOARD_INC + + +;********************************************************** +; magic numbers +;********************************************************** + +EMPTY equ 0 +PLAYER1 equ 1 +PLAYER2 equ 2 + +; board dimensions (+2 for border) +BWIDTH equ 9 +BHEIGHT equ 8 + + + +;********************************************************** +; uninitialized data +;********************************************************** + + section .bss + +board resd BHEIGHT*BWIDTH ; the board +free resd BWIDTH ; # of free fields for each column +totalfree resd 1 ; total # of free fields +currentplayer resd 1 ; player to make next move +lastmove resd 1 ; last move done on the board + ; (0 if no last move available) + + + +;********************************************************** +; code +;********************************************************** + + section .text + + +;********************************************************** +; boardReset +; reset board for new game +; +; input : nothing +; output : nothing +; destroys : nothing +;********************************************************** +boardReset: + pushfd + pushad + + ; clear all fields + mov edi,board + mov ecx,BHEIGHT * BWIDTH + mov eax,EMPTY + rep stosd + + ; init free array + mov edi,free + mov ecx,BWIDTH + mov eax,BHEIGHT - 2 + rep stosd + + mov dword [totalfree],(BWIDTH-2)*(BHEIGHT-2) + mov dword [currentplayer],PLAYER1 + mov dword [lastmove],0 + + popad + popfd + ret + + + +;********************************************************** +; BOARDISVALIDMOVE +; checks wether a move is valid +; +; input : 32 bit register containing a move +; number (1..7) +; output : zero flag set -> move is invalid +; zero flag clear -> move is valid +; destroys : nothing +;********************************************************** +%macro BOARDISVALIDMOVE 1 + cmp dword [free+%1*4],0 +%endmacro + + + +;********************************************************** +; boardMakeMove +; make a move +; +; input : eax = move number (1..7) +; ebx = PLAYER1/PLAYER2 +; output : nothing +; destroys : edi, flags +;********************************************************** + +boardMakeMove: + mov edi,[free+eax*4] ; place stone + imul edi,BWIDTH + add edi,eax + mov [board+edi*4],ebx + + dec dword [free+eax*4] ; one stone more in this column + dec dword [totalfree] ; one stone more on the board + mov [lastmove],eax ; store move for undo + ret + + + +;********************************************************** +; boardUndoMove +; undo a move +; +; input : eax = move number to undo (1..7) +; output : move is undone +; destroys : edi, flags +;********************************************************** +boardUndoMove: + inc dword [free+eax*4] ; one stone less in this column + inc dword [totalfree] ; one stone less on the board + mov dword [lastmove],0 ; no last move available + + mov edi,[free+eax*4] ; remove stone from board + imul edi,BWIDTH + add edi,eax + mov dword [board+edi*4],EMPTY + ret + + + +;********************************************************** +; BOARDSWITCHPLAYERS +; switch current player +; +; input : nothing +; output : current player is switched +; destroys : flags +;********************************************************** +%macro BOARDSWITCHPLAYERS 0 + xor dword [currentplayer],(PLAYER1 ^ PLAYER2) +%endmacro + + + +;********************************************************** +; BOARDGETOTHERPLAYER +; get other player =) +; +; input : 32 bit register or variable +; output : player changed +; destroys : flags +;********************************************************** +%macro BOARDGETOTHERPLAYER 1 + xor %1,(PLAYER1 ^ PLAYER2) +%endmacro + + + +;********************************************************** +; BOARDISFULL +; check wether board is full +; +; input : nothing +; output : zero flag set -> board is full +; zero flag clear -> board isn't full +;********************************************************** +%macro BOARDISFULL 0 + cmp dword [totalfree],0 +%endmacro + + + +;********************************************************** +; boardIsWin +; check wether the current board state is a win for the +; given player +; +; input : eax = player +; output : eax = nonzero -> win for player +; destroys : everything +;********************************************************** + +boardIsWin: + + ; check wether last move is available + cmp dword [lastmove],0 + jne .lastmoveok + xor eax,eax + ret +.lastmoveok: + + ; calculate the address of the most recently placed stone (edi) + mov edi,[lastmove] + mov esi,[free + edi*4] + inc esi + imul esi,BWIDTH + add edi,esi + shl edi,2 + add edi,board + + ; check vertically + xor ecx,ecx ; reset counter + mov esi,edi ; start at last stone +.vertical: + cmp [esi],eax ; loop as long the stone [esi] belongs to player + jne .verticalend + add esi,BWIDTH*4 ; move to next stone + inc ecx ; one stone more in row + jmp short .vertical +.verticalend: + cmp ecx,4 ; 4 or more stones ? + jl .nope1 ; nope -> continue + mov eax,1 ; yeah -> tell caller =) + ret +.nope1: + + ; check horizontally + xor ecx,ecx + mov esi,edi +.horizontal1: ; left + cmp [esi],eax + jne .horizontalend1 + sub esi,4 + inc ecx + jmp short .horizontal1 +.horizontalend1: + lea esi,[edi+4] ; right +.horizontal2: + cmp [esi],eax + jne .horizontalend2 + add esi,4 + inc ecx + jmp short .horizontal2 +.horizontalend2: + cmp ecx,4 + jl .nope2 + mov eax,1 + ret +.nope2: + + ; diagonally forward + xor ecx,ecx + mov esi,edi +.forward1: + cmp [esi],eax + jne .forwardend1 + sub esi,(1+BWIDTH)*4 + inc ecx + jmp short .forward1 +.forwardend1: + lea esi,[edi+(1+BWIDTH)*4] +.forward2: + cmp [esi],eax + jne .forwardend2 + add esi,(1+BWIDTH)*4 + inc ecx + jmp short .forward2 +.forwardend2: + cmp ecx,4 + jl .nope3 + mov eax,1 + ret +.nope3: + + ; diagonally backward + xor ecx,ecx + mov esi,edi +.backward1: + cmp [esi],eax + jne .backwardend1 + add esi,(1-BWIDTH)*4 + inc ecx + jmp short .backward1 +.backwardend1: + lea esi,[edi+(BWIDTH-1)*4] +.backward2: + cmp [esi],eax + jne .backwardend2 + add esi,(BWIDTH-1)*4 + inc ecx + jmp short .backward2 +.backwardend2: + cmp ecx,4 + jl .nope4 + mov eax,1 + ret +.nope4: + + ; no win for this player + xor eax,eax + ret + + +%endif \ No newline at end of file diff --git a/programs/c4/trunk/c4.asm b/programs/c4/trunk/c4.asm new file mode 100644 index 0000000000..441e3817c7 --- /dev/null +++ b/programs/c4/trunk/c4.asm @@ -0,0 +1,910 @@ +; C4 +; Copyright (c) 2002 Thomas Mathys +; killer@vantage.ch +; +; This file is part of C4. +; +; C4 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. +; +; C4 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. +; +; You should have received a copy of the GNU General Public License +; along with C4; if not, write to the Free Software +; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + bits 32 + %include 'mos.inc' + section .text + + MOS_HEADER01 start,end + + + +;********************************************************** +; magic numbers +;********************************************************** + +; initial player types +PL1TYPE_INIT equ 0 +PL2TYPE_INIT equ 4 + +; window +WND_WIDTH equ 259 +WND_HEIGHT equ 300 +WND_WORKCOLOR equ 0 + +; button dimensions +BUTTON_HEIGHT equ 12 + +BUTTON_NEW_X equ 14 +BUTTON_NEW_Y equ 30 +BUTTON_NEW_WIDTH equ 56 + +BUTTON_SPIN_WIDTH equ 8 +BUTTON_PL1DN_X equ 228 +BUTTON_PL1DN_Y equ 30 +BUTTON_PL1UP_X equ (BUTTON_PL1DN_X + BUTTON_SPIN_WIDTH + 1) +BUTTON_PL1UP_Y equ BUTTON_PL1DN_Y + +BUTTON_PL2DN_X equ BUTTON_PL1DN_X +BUTTON_PL2DN_Y equ (BUTTON_PL1DN_Y + 20) +BUTTON_PL2UP_X equ (BUTTON_PL2DN_X + BUTTON_SPIN_WIDTH + 1) +BUTTON_PL2UP_Y equ BUTTON_PL2DN_Y + +; label dimensions +LABEL_PL1_X equ 90 +LABEL_PL1_Y equ (1 + BUTTON_PL1DN_Y + (BUTTON_HEIGHT-8)/2) +LABEL_PL2_X equ LABEL_PL1_X +LABEL_PL2_Y equ (1 + BUTTON_PL2DN_Y + (BUTTON_HEIGHT-8)/2) +LABEL_PL1TYPE_X equ (LABEL_PL1_X + 10*6) +LABEL_PL1TYPE_Y equ LABEL_PL1_Y +LABEL_PL2TYPE_X equ LABEL_PL1TYPE_X +LABEL_PL2TYPE_Y equ LABEL_PL2_Y +LABEL_STATUS_X equ 14 +LABEL_STATUS_Y equ 279 +LABEL_STATUS_WIDTH equ 220 +LABEL_STATUS_HEIGHT equ 8 + + + +; board and stones +STONESIZE equ 32 ; stone height and width +GRIDX equ 14 ; upper left corner +GRIDY equ 70 +GRIDSPACING equ (STONESIZE + 1) ; space between lines +GRIDHEIGHT equ (6*GRIDSPACING+1) ; total grid width and height +GRIDWIDTH equ (7*GRIDSPACING+1) +GRIDCOLOR equ MOS_RGB(128,128,128) + + + +; button id's +BT_QUIT equ 1 +BT_NEW equ 2 +BT_PLAYER1DN equ 3 +BT_PLAYER1UP equ 4 +BT_PLAYER2DN equ 5 +BT_PLAYER2UP equ 6 + + +start: + jmp main + +%include "pcx.inc" +%include "windows.inc" +%include "board.inc" +%include "rng.inc" +; %include "randomai.inc" +%include "ai.inc" + + + +;********************************************************** +; main program +;********************************************************** +main: + call randomize + call defineWindow + call decrunchImages + call newGame + +.msgpump: + ; wait for event + mov ebx,1 + mov eax,MOS_SC_WAITEVENTTIMEOUT + int 0x40 + + ; process events + cmp eax,MOS_EVT_REDRAW + je short .redraw + cmp eax,MOS_EVT_KEY + je short .key + cmp eax,MOS_EVT_BUTTON + je short .button + + call pollMouse + call gameLoop + jmp short .msgpump + +.redraw: + call defineWindow + jmp short .msgpump +.key: + call keyboardInput + jmp short .msgpump +.button: + call handleButton + jmp short .msgpump + + + +;********************************************************** +; button handling function +;********************************************************** +handleButton: + mov eax,MOS_SC_GETPRESSEDBUTTON ; get button id + int 0x40 + + cmp al,1 ; button pressed ? + je short .bye ; nope -> nothing to do + + cmp ah,BT_QUIT ; which button has been pressed ? + je short .quit + cmp ah,BT_NEW + je short .new + cmp ah,BT_PLAYER1DN + je short .player1dn + cmp ah,BT_PLAYER1UP + je short .player1up + cmp ah,BT_PLAYER2DN + je short .player2dn + cmp ah,BT_PLAYER2UP + je short .player2up +.bye: + ret +.quit: + MOS_EXIT +.new: + call newGame + ret +.player1dn: + mov eax,[player1_type] ; get current type + or eax,eax ; already zero ? + jz .bla + dec eax ; nope -> decrement + mov [player1_type],eax ; write back + mov edi,label_pl1type ; and update label + call updatePlayerType +.bla: + ret +.player1up: + mov eax,[player1_type] ; get current type + cmp eax,NPLAYERTYPES-1 ; already max ? + je .bla2 + inc eax ; nope -> increment + mov [player1_type],eax ; write back + mov edi,label_pl1type ; update label + call updatePlayerType +.bla2: + ret +.player2dn: + mov eax,[player2_type] ; get current type + or eax,eax ; already zero ? + jz .bla3 + dec eax ; nope -> decrement + mov [player2_type],eax ; write back + mov edi,label_pl2type ; and update label + call updatePlayerType +.bla3: + ret +.player2up: + mov eax,[player2_type] + cmp eax,NPLAYERTYPES-1 + je .bla4 + inc eax + mov [player2_type],eax + mov edi,label_pl2type + call updatePlayerType +.bla4: + ret + + + +;********************************************************** +; window definition function +;********************************************************** +defineWindow: + MOS_STARTREDRAW + + mov edi,window + call drawWindow + + mov edi,buttons + mov ecx,NBUTTONS + call drawButtons + + mov edi,labels + mov ecx,NLABELS + call drawLabels + + xor eax,eax + call drawBoard + + MOS_ENDREDRAW + ret + + + +;********************************************************** +; updateStatusText +; +; input : esi = ptr to new string +; output : status bar is updated +; destroys : everything +;********************************************************** +updateStatusText: + + ; different text ? + cmp [statusbar + LABEL.caption],esi + je .bye ; nope -> bye + mov dword [statusbar + LABEL.caption],esi ; yeah -> save & redraw + + ; clear background + mov ebx,MOS_DWORD(LABEL_STATUS_X,LABEL_STATUS_WIDTH) + mov ecx,MOS_DWORD(LABEL_STATUS_Y,LABEL_STATUS_HEIGHT) + xor edx,edx + mov eax,MOS_SC_DRAWBAR + int 0x40 + + ; redraw label + mov edi,statusbar + mov ecx,1 + call drawLabels +.bye: + ret + + + +;********************************************************** +; updatePlayerType +; update player type label +; input: eax = new type +; edi = address label structure to update +;********************************************************** +updatePlayerType: + mov ebx,PLAYERTYPELEN ; calculate type string address + mul ebx + add eax,playertypes + mov [edi + LABEL.caption],eax ; write address + mov ecx,1 ; and redraw label + call drawLabels + ret + + + +;********************************************************** +; board drawing stuff +;********************************************************** + +; drawBoard +; draw whole board +; +; input : eax nonzero = clear board background +drawBoard: + + ; clear background ? + or eax,eax + jz .noclear + mov ebx,MOS_DWORD(GRIDX,GRIDWIDTH) + mov ecx,MOS_DWORD(GRIDY,GRIDHEIGHT) + mov edx,WND_WORKCOLOR + mov eax,MOS_SC_DRAWBAR + int 0x40 +.noclear: + call drawGrid + call drawStones + ret + + + +drawGrid: + + ; vertical lines + mov ebx,MOS_DWORD(GRIDX,GRIDX) + mov ecx,MOS_DWORD(GRIDY,GRIDY+GRIDHEIGHT-1) + mov edx,GRIDCOLOR + mov eax,MOS_SC_DRAWLINE + mov esi,8 +.vlines: + int 0x40 + add ebx,MOS_DWORD(GRIDSPACING,GRIDSPACING) + dec esi + jnz .vlines + + ; horizontal lines + mov ebx,MOS_DWORD(GRIDX,GRIDX+GRIDWIDTH-1) + mov ecx,MOS_DWORD(GRIDY,GRIDY) + mov esi,7 +.hlines: + int 0x40 + add ecx,MOS_DWORD(GRIDSPACING,GRIDSPACING) + dec esi + jnz .hlines + + ret + + +drawStones: + mov ebx,6 +.col: + mov ecx,7 +.row: + call drawStone + loop .row + dec ebx + jnz .col + ret + + + +; ecx = column (1..7) +; ebx = row (1..6) +drawStone: + pushad + + ; see which image to draw. + ; the image offset is stored in ebp + mov eax,BWIDTH ; calculate address + mul ebx + add eax,ecx + mov eax,[board+eax*4] ; get stone ? + cmp eax,EMPTY ; empty field -> nothing to do + je .bye + mov ebp,redstone ; assume red stone + cmp eax,PLAYER1 ; red ? + je .stoneok ; yeah -> continue + mov ebp,bluestone ; nope -> use blue stone +.stoneok: + + ; calculate image position (edx) + mov eax,GRIDSPACING + dec ecx + mul ecx + add eax,GRIDX + 1 + shl eax,16 + mov ecx,eax + mov eax,GRIDSPACING + dec ebx + mul ebx + add eax,GRIDY + 1 + mov cx,ax + mov edx,ecx + + ; put image (position is already in edx) + mov ebx,ebp ; image address + mov ecx,MOS_DWORD(STONESIZE,STONESIZE) ; image dimensions + mov eax,MOS_SC_PUTIMAGE + int 0x40 + +.bye: + popad + ret + + + +decrunchImages: + mov esi,redpcx ; red stone + mov edi,redstone + mov ebx,REDPCXSIZE + call loadPCX + mov esi,bluepcx ; blue stone + mov edi,bluestone + mov ebx,BLUEPCXSIZE + call loadPCX + ret + + + +resetInput: + mov dword [playerinput],0 ; no player input + mov dword [mouseinput],0 + ret + + + +;********************************************************** +; newGame +; set up everything for a game +; +; input : nothing +; output : nothing +; destroys : everything +;********************************************************** +newGame: + call boardReset ; reset and redraw board + mov eax,1 + call drawBoard + call resetInput ; reset input + mov dword [gameover],0 ; game is running + ret + + + +;********************************************************** +; pollMouse +; mouse polling routine +; +; input : nothing +; output : playerinput will be updated, if +; the player clicked on a valid +; field +; destroys : everything +;********************************************************** +pollMouse: + mov ebx,2 + mov eax,MOS_SC_GETMOUSEPOSITION + int 0x40 + and eax,1 + jz .mousenotpressed +.mousepressed: + mov dword [mouseinput],0 + call isActiveApp + or al,al + jz .notactive1 + call getMouseCol + mov [mouseinput],eax +.notactive1: + ret +.mousenotpressed: + call isActiveApp + or al,al + jz .notactive2 + call getMouseCol + cmp eax,[mouseinput] + jne .nonewinput + cmp dword [playerinput],0 + jne .nonewinput + mov [playerinput],eax +.nonewinput: +.notactive2: + mov dword [mouseinput],0 + ret + + + +;********************************************************** +; getMouseCol +; calculate in which column the mouse is. or so. +; +; input : nothing +; output : eax = 0 -> mouse outside board +; eax = 1..7 -> column +; destroys : everything +;********************************************************** +getMouseCol: + + mov ebx,1 ; get mouse position, window relative + mov eax,MOS_SC_GETMOUSEPOSITION + int 0x40 + + movzx ebx,ax ; y clipping + cmp ebx,GRIDY + jl .outside + cmp ebx,GRIDY + GRIDHEIGHT - 1 + jg .outside + + shr eax,16 ; calculate column from x coordinate + sub eax,GRIDX + js .outside ; negative -> outside of board (left) + cdq ; ! + mov ebx,GRIDSPACING + div ebx + cmp eax,BWIDTH-3 ; right outside of board ? + jg .outside ; yes -> bye + + inc eax ; xform into range [1,7] + ret +.outside + xor eax,eax + ret + + + +;********************************************************** +; isActiveApp +; check wether we're the active application +; +; input : nothing +; output : al nonzero -> we are the active app +; destroys : everything +;********************************************************** +isActiveApp: + +%define PROCINFO (ebp-MOS_PROCESSINFO_size) + + enter MOS_PROCESSINFO_size,0 + + ; get process information + mov eax,MOS_SC_GETPROCESSINFO + lea ebx,[ebp-MOS_PROCESSINFO_size] + mov ecx,-1 + int 0x40 + + ; set al to 1 if we are the active application + cmp ax,[PROCINFO+MOS_PROCESSINFO.windowStackPos] + sete al + + leave + ret +%undef PROCINFO + + + +;********************************************************** +; keyboardInput +; keyboard input handler, called from main loop +; +; input : nothing +; output : playerinput is updated +; destroys : everything +;********************************************************** +keyboardInput: + mov eax,MOS_SC_GETKEY ; get key + int 0x40 + or al,al ; key available ? + jnz .bye ; no -> bye + cmp dword [playerinput],0 ; unprocessed input available ? + jne .bye ; yes -> bye + + sub ah,'1' ; valid key ? + cmp ah,BWIDTH-3 + ja .bye ; treat as unsigned : keys below '1' will + ; be greater too =) + + mov al,ah ; save input + and eax,255 + inc eax + mov [playerinput],eax + +.bye: + ret + + + +;********************************************************** +; gameLoop +; game logic code or however you wish to call it. +; actually this is not a loop, but is called from +; the main loop +;********************************************************** +gameLoop: + + ; if the game is over, return + cmp dword [gameover],0 + je .gamerunning + ret +.gamerunning: + + call updatePlayerStatusText + + ; get move + call getMoveForCurrentPlayer + or eax,eax + jnz .moveok + ret ; no move available -> bye +.moveok: + + ; make move and update board graphics + mov ebx,[currentplayer] ; ebx = current player, eax contains already move + call boardMakeMove + call drawStones + + ; check wether game is over (either by a win or because the board is full) + mov eax,[currentplayer] ; win for current player ? + call boardIsWin + or eax,eax + jz .nowin ; no -> continue + mov esi,player1wins ; yes -> display message... + cmp dword [currentplayer],PLAYER1 + je .blubb + mov esi,player2wins +.blubb: + call updateStatusText + mov dword [gameover],1 ; ...and end game + ret +.nowin: + BOARDISFULL ; board full, but no win ? + jnz .notfull ; no -> continue + mov esi,itisadraw ; yes -> display message... + call updateStatusText + mov dword [gameover],1 ; ...and end game + ret +.notfull: + + ; switch players and return to main loop + BOARDSWITCHPLAYERS + ret + + + +;********************************************************** +; getMoveForCurrentPlayer +; returns the move made by the current player +; (either cpu or human) +; +; input : nothing +; output : eax = 0 -> no move made. this is +; usually the case for human players, +; when no valid input is available. +; else eax = move number +;********************************************************** +getMoveForCurrentPlayer: + + ; get type of current player + mov eax,[player1_type] + cmp dword [currentplayer],PLAYER1 + je .ok + mov eax,[player2_type] +.ok: + + ; get move for human/cpu player + or eax,eax + jnz .cpu +.human: + mov eax,[playerinput] ; get input + or eax,eax ; input available ? + jz .nomove ; no -> return no move available + call resetInput ; ! + BOARDISVALIDMOVE eax ; valid move `? + jz .nomove ; no -> return no move available + ret ; valid move available -> return it (eax) + +.cpu: + call dword [aicode] ; call ai machine. cpu level is already in eax + ret +.nomove: + xor eax,eax + ret + + + +;********************************************************** +; update status bar : which player's turn it is +;********************************************************** +updatePlayerStatusText: + cmp dword [currentplayer],PLAYER2 + je .player2 + mov esi,player1hmnprmpt + cmp dword [player1_type],0 + je .statustextok + mov esi,player1cpuprmpt + jmp short .statustextok +.player2: + mov esi,player2hmnprmpt + cmp dword [player2_type],0 + je .statustextok + mov esi,player2cpuprmpt +.statustextok: + call updateStatusText + ret + + + +;********************************************************** +; initialized data +;********************************************************** + + section .data + +; +; window definition +; +windowtitle db "C4 0.1",0 +window: +istruc WND + at WND.xposandsize, dd MOS_DWORD(0,WND_WIDTH) + at WND.yposandsize, dd MOS_DWORD(0,WND_HEIGHT) + at WND.workcolor, dd 0x03000000 | WND_WORKCOLOR + at WND.grabcolor, dd 0 + at WND.framecolor, dd 0 + at WND.caption, dd windowtitle + at WND.captioncolor, dd 0 + at WND.flags, dd WND_CENTER | WND_DEFAULT_GRABCOLOR | WND_DEFAULT_FRAMECOLOR | WND_DEFAULT_CAPTIONCOLOR +iend + +; +; button table +; +buttons: +istruc BUTTON ; new + at BUTTON.xposandsize + dd MOS_DWORD(BUTTON_NEW_X,BUTTON_NEW_WIDTH) + dd MOS_DWORD(BUTTON_NEW_Y,BUTTON_HEIGHT) + dd BT_NEW + dd BUTTON_COLOR_WORK +iend +istruc BUTTON ; player 1 down + at BUTTON.xposandsize + dd MOS_DWORD(BUTTON_PL1DN_X,BUTTON_SPIN_WIDTH) + dd MOS_DWORD(BUTTON_PL1DN_Y,BUTTON_HEIGHT) + dd BT_PLAYER1DN + dd BUTTON_COLOR_WORK +iend +istruc BUTTON ; player 1 up + at BUTTON.xposandsize + dd MOS_DWORD(BUTTON_PL1UP_X,BUTTON_SPIN_WIDTH) + dd MOS_DWORD(BUTTON_PL1UP_Y,BUTTON_HEIGHT) + dd BT_PLAYER1UP + dd BUTTON_COLOR_WORK +iend +istruc BUTTON ; player 2 down + at BUTTON.xposandsize + dd MOS_DWORD(BUTTON_PL2DN_X,BUTTON_SPIN_WIDTH) + dd MOS_DWORD(BUTTON_PL2DN_Y,BUTTON_HEIGHT) + dd BT_PLAYER2DN + dd BUTTON_COLOR_WORK +iend +istruc BUTTON ; player 2 up + at BUTTON.xposandsize + dd MOS_DWORD(BUTTON_PL2UP_X,BUTTON_SPIN_WIDTH) + dd MOS_DWORD(BUTTON_PL2UP_Y,BUTTON_HEIGHT) + dd BT_PLAYER2UP + dd BUTTON_COLOR_WORK +iend +NBUTTONS equ (($-buttons)/BUTTON_size) + + +; +; label table +; + +newgame db "New game",0 +down db "<",0 +up db ">",0 +pl1 db "Player 1:",0 +pl2 db "Player 2:",0 + + +playertypes: + db "Human ",0 +PLAYERTYPELEN equ ($ - playertypes) + db "CPU level 1 ",0 + db "CPU level 2 ",0 + db "CPU level 3 ",0 + db "CPU level 4 ",0 + db "CPU level 5 ",0 + db "CPU level 6 ",0 + db "CPU level 7 ",0 + db "CPU level 8 ",0 +NPLAYERTYPES equ (($-playertypes)/PLAYERTYPELEN) + + +labels: +istruc LABEL ; new + at LABEL.position + dd MOS_DWORD(BUTTON_NEW_X+4,1+BUTTON_NEW_Y+(BUTTON_HEIGHT-8)/2) + dd newgame + dd LABEL_COLOR_WORKBUTTON + dd LABEL_BGCOLOR_TRANSPARENT +iend +istruc LABEL ; player 1 down + at LABEL.position + dd MOS_DWORD(BUTTON_PL1DN_X+(BUTTON_SPIN_WIDTH-4)/2,1+BUTTON_PL1DN_Y+(BUTTON_HEIGHT-8)/2) + dd down + dd LABEL_COLOR_WORKBUTTON + dd LABEL_BGCOLOR_TRANSPARENT +iend +istruc LABEL ; player 1 up + at LABEL.position + dd MOS_DWORD(1+BUTTON_PL1UP_X+(BUTTON_SPIN_WIDTH-4)/2,1+BUTTON_PL1UP_Y+(BUTTON_HEIGHT-8)/2) + dd up + dd LABEL_COLOR_WORKBUTTON + dd LABEL_BGCOLOR_TRANSPARENT +iend +istruc LABEL ; player 2 down + at LABEL.position + dd MOS_DWORD(BUTTON_PL2DN_X+(BUTTON_SPIN_WIDTH-4)/2,1+BUTTON_PL2DN_Y+(BUTTON_HEIGHT-8)/2) + dd down + dd LABEL_COLOR_WORKBUTTON + dd LABEL_BGCOLOR_TRANSPARENT +iend +istruc LABEL ; player 2 up + at LABEL.position + dd MOS_DWORD(1+BUTTON_PL2UP_X+(BUTTON_SPIN_WIDTH-4)/2,1+BUTTON_PL2UP_Y+(BUTTON_HEIGHT-8)/2) + dd up + dd LABEL_COLOR_WORKBUTTON + dd LABEL_BGCOLOR_TRANSPARENT +iend +istruc LABEL ; player 1 + at LABEL.position + dd MOS_DWORD(LABEL_PL1_X,LABEL_PL1_Y) + dd pl1 + dd MOS_RGB(255,255,255) + dd LABEL_BGCOLOR_TRANSPARENT +iend +istruc LABEL ; player 2 + at LABEL.position + dd MOS_DWORD(LABEL_PL2_X,LABEL_PL2_Y) + dd pl2 + dd MOS_RGB(255,255,255) + dd LABEL_BGCOLOR_TRANSPARENT +iend +statusbar: ; status bar +istruc LABEL + at LABEL.position + dd MOS_DWORD(LABEL_STATUS_X,LABEL_STATUS_Y) + dd 0 + dd MOS_RGB(255,255,255) + dd LABEL_BGCOLOR_TRANSPARENT +iend +label_pl1type: +istruc LABEL + at LABEL.position + dd MOS_DWORD(LABEL_PL1TYPE_X,LABEL_PL1TYPE_Y) + dd playertypes+PL1TYPE_INIT*PLAYERTYPELEN + dd MOS_RGB(255,255,255) + dd MOS_RGB(0,0,0) +iend +label_pl2type: +istruc LABEL + at LABEL.position + dd MOS_DWORD(LABEL_PL2TYPE_X,LABEL_PL2TYPE_Y) + dd playertypes+PL2TYPE_INIT*PLAYERTYPELEN + dd MOS_RGB(255,255,255) + dd MOS_RGB(0,0,0) +iend +NLABELS equ (($-labels)/LABEL_size) + + +; player types +player1_type dd PL1TYPE_INIT +player2_type dd PL2TYPE_INIT + + +; status messages +player1hmnprmpt db "Make your move, player 1.",0 +player2hmnprmpt db "Make your move, player 2.",0 +player1cpuprmpt db "Player 1 is thinking, please wait...",0 +player2cpuprmpt db "Player 2 is thinking, please wait...",0 +itisadraw db "It's a draw.",0 +player1wins db "Player 1 wins.",0 +player2wins db "Player 2 wins.",0 + + +; pointer to ai player. future releases C4 might +; or might not support different ai players =) +aicode dd aiGetMove + + +; button images +redpcx: incbin "red.pcx" +REDPCXSIZE equ ($ - redpcx) +bluepcx: incbin "blue.pcx" +BLUEPCXSIZE equ ($ - bluepcx) + + + +;********************************************************** +; uninitialized data +;********************************************************** + + section .bss + +; player input +; 0 : no input available +; 1..7 : column to drop stone into +playerinput resd 1 + +mouseinput resd 1 +gameover resd 1 + +redstone resb STONESIZE*STONESIZE*3 +bluestone resb STONESIZE*STONESIZE*3 + +end: diff --git a/programs/c4/trunk/mos.inc b/programs/c4/trunk/mos.inc new file mode 100644 index 0000000000..72ab5ba7c8 --- /dev/null +++ b/programs/c4/trunk/mos.inc @@ -0,0 +1,305 @@ +; mos.inc 0.0.2 +; Copyright (c) 2002 Thomas Mathys +; killer@vantage.ch +; +; 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. +; +; You should have received a copy of the GNU General Public License +; along with this program; if not, write to the Free Software +; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +; +; +; +; revision history +; ---------------- +; +; 10-04-2002 version 0.0.2 +; - removed MOS_WNDCOLORS_SIZE and similar constants. +; while reading the docs i realized that NASM creates +; such symbols already itself... +; + macros: MOS_WAITEVENT, MOS_WAITEVENT_S, MOS_STARTREDRAW, +; MOS_STARTREDRAW_S, MOS_ENDREDRAW, MOS_ENDREDRAW_S, +; MOS_GETSCREENMAX, MOS_GETSCREENMAX_S, MOS_EXIT, MOS_EXIT_S +; + event bit masks +; + some syscall numbers +; + process info structure +; +; 08-??-2002 version 0.0.1 +; first release +; +%ifndef _MOS_INC +%define _MOS_INC + + + +;********************************************************** +; generates a menuetos 01 header +; takes 2-6 parameters: +; +; MOS_HEADER01 start,end[,appmem,esp,i_param,i_icon] +;********************************************************** + +%macro MOS_HEADER01 2-6 0x100000,0x7fff0,0,0 + org 0x0 + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd %1 ; start of code + dd %2 ; image size + dd %3 ; application memory + dd %4 ; esp + dd %5 ; i_param + dd %6 ; i_icon +%endmacro + + +;********************************************************** +; MOS_DWORD +; packs 2 words into a double word +;********************************************************** + +%define MOS_DWORD(hi,lo) ((((hi) & 0xffff) << 16) + ((lo) & 0xffff)) + + +;********************************************************** +; MOS_RGB +; creates a menuet os compatible color (0x00RRGGBB) +;********************************************************** + +%define MOS_RGB(r,g,b) ((((r) & 255) << 16) + (((g) & 255) << 8) + ((b) & 255)) + + +;********************************************************** +; window color structure +;********************************************************** + +struc MOS_WNDCOLORS + .frame: resd 1 + .grab: resd 1 + .grabButton: resd 1 + .grabButtonText: resd 1 + .grabText: resd 1 + .work: resd 1 + .workButton: resd 1 + .workButtonText: resd 1 + .workText: resd 1 + .workGraphics: resd 1 +endstruc + + +;********************************************************** +; process info structure +;********************************************************** + +struc MOS_PROCESSINFO + .CPUUsage: resd 1 ; cpu usage + .windowStackPos: resw 1 ; process' position in windowing stack + .windowStackVal: resw 1 ; window stack value at ecx + .reserved1: resw 1 + .processName: resb 12 ; process name + .memStart: resd 1 ; start of process memory + .memUsed: resd 1 ; memory used by the process + .pid: resd 1 ; process id + .reserved2: resb (1024-34) +endstruc + + + +;********************************************************** +; system call numbers +;********************************************************** + +MOS_SC_EXIT equ -1 +MOS_SC_DEFINEWINDOW equ 0 +MOS_SC_PUTPIXEL equ 1 +MOS_SC_GETKEY equ 2 +MOS_SC_GETSYSCLOCK equ 3 +MOS_SC_WRITETEXT equ 4 +MOS_SC_DELAY equ 5 +MOS_SC_OPENFILEFLOPPY equ 6 +MOS_SC_PUTIMAGE equ 7 +MOS_SC_DEFINEBUTTON equ 8 +MOS_SC_GETPROCESSINFO equ 9 +MOS_SC_WAITEVENT equ 10 +MOS_SC_CHECKEVENT equ 11 +MOS_SC_REDRAWSTATUS equ 12 +MOS_SC_DRAWBAR equ 13 +MOS_SC_GETSCREENMAX equ 14 +MOS_SC_SETBACKGROUND equ 15 +MOS_SC_GETPRESSEDBUTTON equ 17 +MOS_SC_SYSTEMSERVICE equ 18 +MOS_SC_STARTPROGRAM equ 19 +MOS_SC_MIDIINTERFACE equ 20 +MOS_SC_DEVICESETUP equ 21 +MOS_SC_WAITEVENTTIMEOUT equ 23 +MOS_SC_CDAUDIO equ 24 +MOS_SC_SB16MIXER1 equ 25 +MOS_SC_GETDEVICESETUP equ 26 +MOS_SC_WSS equ 27 +MOS_SC_SB16MIXER2 equ 28 +MOS_SC_GETDATE equ 29 +MOS_SC_READHD equ 30 +MOS_SC_STARTPROGRAMHD equ 31 +MOS_SC_GETSCREENPIXEL equ 35 +MOS_SC_GETMOUSEPOSITION equ 37 +MOS_SC_DRAWLINE equ 38 +MOS_SC_GETBACKGROUND equ 39 +MOS_SC_SETEVENTMASK equ 40 +MOS_SC_WRITENUMBER equ 47 +MOS_SC_WINDOWPROPERTIES equ 48 + + +;********************************************************** +; event numbers +;********************************************************** + +MOS_EVT_NONE equ 0 +MOS_EVT_REDRAW equ 1 +MOS_EVT_KEY equ 2 +MOS_EVT_BUTTON equ 3 + + +;********************************************************** +; event bits +;********************************************************** + +MOS_EVTBIT_REDRAW equ (1 << 0) +MOS_EVTBIT_KEY equ (1 << 1) +MOS_EVTBIT_BUTTON equ (1 << 2) +MOS_EVTBIT_ENDREQUEST equ (1 << 3) +MOS_EVTBIT_BGDRAW equ (1 << 4) +MOS_EVTBIT_MOUSECHANGE equ (1 << 5) +MOS_EVTBIT_IPCEVENT equ (1 << 6) +MOS_EVTBIT_IRQ0 equ (1 << 16) +MOS_EVTBIT_IRQ1 equ (1 << 17) +MOS_EVTBIT_IRQ2 equ (1 << 18) +MOS_EVTBIT_IRQ3 equ (1 << 19) +MOS_EVTBIT_IRQ4 equ (1 << 20) +MOS_EVTBIT_IRQ5 equ (1 << 21) +MOS_EVTBIT_IRQ6 equ (1 << 22) +MOS_EVTBIT_IRQ7 equ (1 << 23) +MOS_EVTBIT_IRQ8 equ (1 << 24) +MOS_EVTBIT_IRQ9 equ (1 << 25) +MOS_EVTBIT_IRQ10 equ (1 << 26) +MOS_EVTBIT_IRQ11 equ (1 << 27) +MOS_EVTBIT_IRQ12 equ (1 << 28) +MOS_EVTBIT_IRQ13 equ (1 << 29) +MOS_EVTBIT_IRQ14 equ (1 << 30) +MOS_EVTBIT_IRQ15 equ (1 << 31) + + +;********************************************************** +; exit application (syscall -1) +;********************************************************** + +; exit application +%macro MOS_EXIT 0 + mov eax,MOS_SC_EXIT + int 0x40 +%endmacro + +; exit application, smaller version +%macro MOS_EXIT_S 0 + xor eax,eax + dec eax + int 0x40 +%endmacro + + +;********************************************************** +; wait event stuff +; (MOS_SC_WAITEVENT, syscall 10) +;********************************************************** + +; wait for event +; destroys : nothing +; returns : eax = event type +%macro MOS_WAITEVENT 0 + mov eax,MOS_SC_WAITEVENT + int 0x40 +%endmacro + +; wait for event, smaller version +; destroys : flags +; returns : eax = event type +%macro MOS_WAITEVENT_S 0 + xor eax,eax + mov al,MOS_SC_WAITEVENT + int 0x40 +%endmacro + + +;********************************************************** +; window redraw status stuff +; (MOS_SC_REDRAWSTATUS, syscall 12) +;********************************************************** + +MOS_RS_STARTREDRAW equ 1 +MOS_RS_ENDREDRAW equ 2 + +; start window redraw +; destroys: eax,ebx +%macro MOS_STARTREDRAW 0 + mov ebx,MOS_RS_STARTREDRAW + mov eax,MOS_SC_REDRAWSTATUS + int 0x40 +%endmacro + +; start window redraw, smaller version +; destroys: eax,ebx,flags +%macro MOS_STARTREDRAW_S 0 + xor ebx,ebx + inc ebx + xor eax,eax + mov al,MOS_SC_REDRAWSTATUS + int 0x40 +%endmacro + +; end window redraw +; destroys: eax,ebx +%macro MOS_ENDREDRAW 0 + mov ebx,MOS_RS_ENDREDRAW + mov eax,MOS_SC_REDRAWSTATUS + int 0x40 +%endmacro + +; end window redraw, smaller version +; destroys: eax,ebx,flags +%macro MOS_ENDREDRAW_S 0 + xor ebx,ebx + mov bl,MOS_RS_ENDREDRAW + xor eax,eax + mov al,MOS_SC_REDRAWSTATUS + int 0x40 +%endmacro + + +;********************************************************** +; get screen max stuff (syscall 14) +;********************************************************** + +; get screen dimensions in eax +; destroys: nothing +%macro MOS_GETSCREENMAX 0 + mov eax,MOS_SC_GETSCREENMAX + int 0x40 +%endmacro + +; get screen dimensions in eax, smaller version +; destroys: flags +%macro MOS_GETSCREENMAX_S 0 + xor eax,eax + mov al,MOS_SC_GETSCREENMAX + int 0x40 +%endmacro + + + +%endif \ No newline at end of file diff --git a/programs/c4/trunk/pcx.inc b/programs/c4/trunk/pcx.inc new file mode 100644 index 0000000000..5b9755b14e --- /dev/null +++ b/programs/c4/trunk/pcx.inc @@ -0,0 +1,137 @@ +; pcx.inc +; Copyright (c) 2002 Thomas Mathys +; killer@vantage.ch +; +; 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. +; +; You should have received a copy of the GNU General Public License +; along with this program; if not, write to the Free Software +; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +%ifndef _PCX_INC +%define _PCX_INC + + +;********************************************************** +; pcx header +;********************************************************** + +PCXHEADER_SIZE equ 128 +struc PCXHEADER + .id: resb 1 ; id, should be 10 + .version: resb 1 ; pcx version + .encoding: resb 1 ; 1 = rle + .bpp: resb 1 ; bits per pixel + .xmin: resw 1 ; image dimensions + .ymin: resw 1 + .xmax: resw 1 + .ymax: resw 1 + .hdpi: resw 1 ; horizontal resolution in dpi + .vdpi: resw 1 ; verttical resolution in dpi + .colormap: resb 48 ; 16 color palette + .reserved1: resb 1 + .nplanes: resb 1 ; # of color planes + .bytesperline: resw 1 ; # of bytes per scanline. always even + .palinfo: resw 1 ; 1 = color/bw, 2 = grayscale + .hscreensize: resw 1 ; horizontal screen size + .vscreensize: resw 1 ; vertical screen size + .reserved2: resb 54 +endstruc + + +section .text + + + +;********************************************************** +; lousy pcx decoder. reads only 8 bit rle packed color images (pcx version 5) +; oh, and yes, currently it can't read images with an odd width. +; +; the routine does not only decode the image data, it converts +; it also to a menuetos putimage compatible format (24 bit, rrggbb) +; +; input : esi address of the pcx file in memory +; edi pointer to the memory where the depacked +; image data should go. (width*height*3 bytes) +; ebx file size in bytes +; +; output : decoded image in [edi] +; +; destroys : nothing +; +;********************************************************** + +loadPCX: + pushad + pushfd + + ; calculate number of pixels to decode. + ; this is actually wrong, because if the image has an odd + ; width, there will be an unused pixel at the end of each + ; scanline. + movzx eax,word [esi+PCXHEADER.xmax] ; eax = image width + sub ax,[esi+PCXHEADER.xmin] + inc eax + movzx ecx,word [esi+PCXHEADER.ymax] ; ecx = image height + sub cx,[esi+PCXHEADER.ymin] + inc ecx + mul ecx + mov ebp,eax ; ebp = # of pixels to decode + + ; move ebx to beginning of palette and + ; esi to beginning of packed image data + sub ebx,768 + add ebx,esi + add esi,PCXHEADER_SIZE + + ; decode image data + xor ecx,ecx ; clear bits 8..31 ! + xor eax,eax ; " +.decode: + lodsb ; read byte from input stream + cmp al,192 ; encoded/unencoded byte ? + jae short .encoded + lea edx,[eax*2+eax] ; read color values from + mov al,[ebx+edx+2] ; palette and store them + stosb ; in the destination image + mov al,[ebx+edx+1] + stosb + mov al,[ebx+edx+0] + stosb + dec ebp ; one less to go... + jmp short .continue +.encoded: + and al,00111111b ; calc # of times to repeat + mov cl,al + lodsb ; read data byte + lea edx,[eax*2+eax] ; read color values from palette + mov al,[ebx+edx+2] + mov ah,[ebx+edx+1] + mov dl,[ebx+edx+0] +.bla: ; write color values + stosb + mov [edi],ah + inc edi + mov [edi],dl + inc edi + dec ebp ; one less to go... + loop .bla + xor ah,ah ; reset ah to 0 ! +.continue: + or ebp,ebp ; all pixels decoded ? + jnz short .decode + + popfd + popad + ret + + +%endif \ No newline at end of file diff --git a/programs/c4/trunk/randomai.inc b/programs/c4/trunk/randomai.inc new file mode 100644 index 0000000000..5fedd0b626 --- /dev/null +++ b/programs/c4/trunk/randomai.inc @@ -0,0 +1,50 @@ +; C4 +; Copyright (c) 2002 Thomas Mathys +; killer@vantage.ch +; +; This file is part of C4. +; +; C4 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. +; +; C4 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. +; +; You should have received a copy of the GNU General Public License +; along with C4; if not, write to the Free Software +; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +%infdef _RANDOMAI_INC +%define _RANDOMAI_INC + + section .text + + + +;********************************************************** +; randomaiGetMove +; getmove routine for random "ai" player +; +; input : eax = cpu level (ignored by this player:) +; output : eax = move +; destroys : everything +;********************************************************** +randomaiGetMove + +.l: + call rand ; get random number in the range [1,7] + xor edx,edx ; ! + mov ebx,7 + div ebx + inc edx + BOARDISVALIDMOVE edx ; is this a valid move ? + jz .l ; no -> try again + + mov eax,edx ; return move + ret + +%endif \ No newline at end of file diff --git a/programs/c4/trunk/red.pcx b/programs/c4/trunk/red.pcx new file mode 100644 index 0000000000..50f362af2e Binary files /dev/null and b/programs/c4/trunk/red.pcx differ diff --git a/programs/c4/trunk/rng.inc b/programs/c4/trunk/rng.inc new file mode 100644 index 0000000000..c175218d18 --- /dev/null +++ b/programs/c4/trunk/rng.inc @@ -0,0 +1,76 @@ +; C4 +; Copyright (c) 2002 Thomas Mathys +; killer@vantage.ch +; +; This file is part of C4. +; +; C4 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. +; +; C4 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. +; +; You should have received a copy of the GNU General Public License +; along with C4; if not, write to the Free Software +; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +%ifndef _RNG_INC +%define _RNG_INC + + section .data + + +; random seed +seed dd 0 + + + + section .text + + +;********************************************************** +; randomize +; initialize random number generator. +; initialization is done using the get system clock syscall +; +; input : nothing +; output : nothing +; destroys : nothing +;********************************************************** +randomize: + push eax + mov eax,MOS_SC_GETSYSCLOCK + int 0x40 + mov [seed],eax + pop eax + ret + + + +;********************************************************** +; rand +; return an unsigned 32 bit "random" number +; +; input : nothing +; output : eax = unsigned 32 bit random number +; destroys : nothing +;********************************************************** +rand: + pushfd + push edx + mov eax,32719 + mul dword [seed] + add eax,123 + xchg al,ah + rol eax,16 + xchg al,ah + mov [seed],eax + pop edx + popfd + ret + +%endif \ No newline at end of file diff --git a/programs/c4/trunk/windows.inc b/programs/c4/trunk/windows.inc new file mode 100644 index 0000000000..f0913ea8ba --- /dev/null +++ b/programs/c4/trunk/windows.inc @@ -0,0 +1,356 @@ +; windows.inc +; Copyright (c) 2002 Thomas Mathys +; killer@vantage.ch +; +; 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. +; +; You should have received a copy of the GNU General Public License +; along with this program; if not, write to the Free Software +; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +%ifndef _WINDOWS_INC +%define _WINDOWS_INC + + +WND_CENTER equ (1 << 0) +WND_DEFAULT_WORKCOLOR equ (1 << 1) +WND_DEFAULT_GRABCOLOR equ (1 << 2) +WND_DEFAULT_FRAMECOLOR equ (1 << 3) +WND_DEFAULT_CAPTIONCOLOR equ (1 << 4) +WND_DEFAULT_COLORS equ (WND_DEFAULT_WORKCOLOR | WND_DEFAULT_GRABCOLOR | WND_DEFAULT_FRAMECOLOR | WND_DEFAULT_CAPTIONCOLOR) + + +struc WND + .xposandsize resd 1 ; x position and size (like syscall) + .yposandsize resd 1 ; y position and size (like syscall) + .workcolor resd 1 ; work area color (like syscall) + .grabcolor resd 1 ; grab bar color (like syscall) + .framecolor resd 1 ; frame color (like syscall) + .caption resd 1 ; pointer to caption (zero terminated) + ; can be zero, if no caption is desired. + .captioncolor resd 1 ; caption color + .flags resd 1 ; combination of WND_xxx flags, or zero. +endstruc + + +BUTTON_COLOR_GRAB equ 0x01000000 +BUTTON_COLOR_WORK equ 0x02000000 + + +struc BUTTON + .xposandsize resd 1 ; x position and size (like syscall) + .yposandsize resd 1 ; y position and size (like syscall) + .id resd 1 ; button id + .color resd 1 ; button color. can be a real color + ; or one of the BUTTON_COLOR_xxx constants +endstruc + + +LABEL_COLOR_GRABBUTTON equ 0x01000000 ; use grab button text default color +LABEL_COLOR_GRAB equ 0x02000000 ; use grab text default color +LABEL_COLOR_WORKBUTTON equ 0x03000000 ; use work button text default color +LABEL_COLOR_WORK equ 0x04000000 ; use work text default color +LABEL_BGCOLOR_TRANSPARENT equ 0x01000000 ; transparent +LABEL_BGCOLOR_WORK equ 0x02000000 ; use work area color + + +struc LABEL + .position resd 1 ; position, x in upper word, y in lower word + .caption resd 1 ; pointer to caption (zero terminated) + ; if this is field is zero, the label will + ; not be drawn. + .color resd 1 ; text color, or a LABEL_COLOR_xxx constant + .bgcolor resd 1 ; background color, or a LABEL_BGCOLOR_xxx constant +endstruc + + + section .text + + +;*********************************************************** +; draw a window +; +; input: edi = pointer to a WND structure +; output: nothing +; destroys: nothing +; notes: you must call begin redraw/end redraw +; yourself, before and after calling +; this function. +;*********************************************************** + +drawWindow: + +%define WNDCOLORS ebp-MOS_WNDCOLORS_size + + enter MOS_WNDCOLORS_size,0 + pushfd + pushad + + ; get default window colors + mov ebx,3 + lea ecx,[WNDCOLORS] + mov edx,MOS_WNDCOLORS_size + mov eax,MOS_SC_WINDOWPROPERTIES + int 0x40 + + ; + ; window position + ; + test dword [edi + WND.flags],WND_CENTER ; center window ? + jnz short .center + mov ebx,[edi + WND.xposandsize] ; nope -> just load dimensions + mov ecx,[edi + WND.yposandsize] + jmp short .positionok +.center: ; so let's center this window... + MOS_GETSCREENMAX ; get screen dimensions + mov ebx,eax ; xpos = (screenx-width)/2 + shr ebx,16 + sub bx,[edi + WND.xposandsize] + jns short .xok + xor ebx,ebx +.xok: + shl ebx,15 ; / 2, move result to hi-word + mov bx,[edi + WND.xposandsize] + movzx ecx,ax ; same for ypos + sub cx,[edi + WND.yposandsize] + jns short .yok + xor ecx,ecx +.yok: + shl ecx,15 + mov cx,[edi + WND.yposandsize] +.positionok: ; ebx/ecx contain dimensions + + ; + ; colors + ; + push edi + mov edx,[edi + WND.workcolor] + test dword [edi + WND.flags],WND_DEFAULT_WORKCOLOR + jz short .workcolorok + and edx,0xff000000 + or edx,[WNDCOLORS + MOS_WNDCOLORS.work] +.workcolorok: + mov esi,[edi + WND.grabcolor] + test dword [edi + WND.flags],WND_DEFAULT_GRABCOLOR + jz short .grabcolorok + and esi,0xff000000 + or esi,[WNDCOLORS + MOS_WNDCOLORS.grab] +.grabcolorok: + test dword [edi + WND.flags],WND_DEFAULT_FRAMECOLOR + mov edi,[edi + WND.framecolor] + jz short .framecolorok + and edi,0xff000000 + or edi,[WNDCOLORS + MOS_WNDCOLORS.frame] +.framecolorok: + + ; define window + mov eax,MOS_SC_DEFINEWINDOW + int 0x40 + pop edi + + ; + ; caption + ; + cmp dword [edi + WND.caption],0 ; is there a caption ? + je short .captionok ; nope -> do nothing + mov ebx,MOS_DWORD(8,8) ; ebx = position + mov edx,[edi + WND.caption] ; edx -> string + push edi ; get string length + mov edi,edx + mov ecx,-1 + xor al,al ; scan for zero byte + repne scasb + sub edi,edx + dec edi + mov esi,edi + pop edi ; esi = string length + mov ecx,[edi + WND.captioncolor] + test dword [edi + WND.flags],WND_DEFAULT_CAPTIONCOLOR + jz short .captioncolorok + mov ecx,[WNDCOLORS + MOS_WNDCOLORS.grabText] +.captioncolorok: + mov eax,MOS_SC_WRITETEXT + int 0x40 +.captionok: + + popad + popfd + leave + ret +%undef WNDCOLORS + + +;*********************************************************** +; draw a bunch of buttons +; +; input: edi = pointer to an array of BUTTON structs +; ecx = # of buttons to draw +; output: nothing +; destroys: nothing +; notes: you must call begin redraw/end redraw yourself +;*********************************************************** + +drawButtons: + +%define WNDCOLORS ebp-MOS_WNDCOLORS_size + + or ecx,ecx + jnz short .ok + ret +.ok: + enter MOS_WNDCOLORS_size,0 + pushfd + pushad + + ; get default window colors + push ecx + mov ebx,3 + lea ecx,[WNDCOLORS] + mov edx,MOS_WNDCOLORS_size + mov eax,MOS_SC_WINDOWPROPERTIES + int 0x40 + pop ecx + +.drawall: + push ecx + mov ebx,[edi + BUTTON.xposandsize] + mov ecx,[edi + BUTTON.yposandsize] + mov edx,[edi + BUTTON.id] + mov esi,[edi + BUTTON.color] + cmp esi,BUTTON_COLOR_GRAB ; use a default color ? + jne .ok1 + mov esi,[WNDCOLORS + MOS_WNDCOLORS.grabButton] +.ok1: + cmp esi,BUTTON_COLOR_WORK + jne .ok2 + mov esi,[WNDCOLORS + MOS_WNDCOLORS.workButton] +.ok2: + mov eax,MOS_SC_DEFINEBUTTON + int 0x40 + add edi,BUTTON_size + pop ecx + loop .drawall + + popad + popfd + leave + ret +%undef WNDCOLORS + + +;*********************************************************** +; draw a bunch of labels +; +; input: edi = pointer to an array of LABEL structs +; ecx = # of labels to draw +; output: nothing +; destroys: nothing +;*********************************************************** + +drawLabels: + +%define WNDCOLORS ebp-MOS_WNDCOLORS_size + + or ecx,ecx + jnz short .ok + ret +.ok: + enter MOS_WNDCOLORS_size,0 + pushfd + pushad + + ; get default window colors + push ecx + mov ebx,3 + lea ecx,[WNDCOLORS] + mov edx,MOS_WNDCOLORS_size + mov eax,MOS_SC_WINDOWPROPERTIES + int 0x40 + pop ecx + +.drawall: + push ecx + + cmp dword [edi + LABEL.caption],0 + jne short .notnull + jmp .next +.notnull: + + ; get caption length + push edi + mov edi,[edi + LABEL.caption] + mov ecx,-1 + xor al,al + repne scasb ; search for zero byte + mov esi,edi + pop edi + sub esi,[edi + LABEL.caption] + dec esi ; esi = string length + + ; clear background, if necessary + cmp dword [edi + LABEL.bgcolor],LABEL_BGCOLOR_TRANSPARENT + je .clearok + mov ebx,[edi + LABEL.position] ; ebx = xstart/width + mov eax,esi ; width = stringlength * 6 + mov edx,6 + mul edx + mov bx,ax + mov ecx,[edi + LABEL.position] ; ecx = ystart/height + shl ecx,16 + mov cx,8 + mov edx,[edi + LABEL.bgcolor] + cmp edx,LABEL_BGCOLOR_WORK + jne short .bgcolorok + mov edx,[WNDCOLORS + MOS_WNDCOLORS.work] +.bgcolorok: + mov eax,MOS_SC_DRAWBAR + int 0x40 +.clearok: + + ; draw label + mov ebx,[edi + LABEL.position] ; ebx = label position + mov edx,[edi + LABEL.caption] ; edx -> caption + mov ecx,[edi + LABEL.color] ; ecx = color + cmp ecx,LABEL_COLOR_GRABBUTTON + jne short .ok1 + mov ecx,[WNDCOLORS + MOS_WNDCOLORS.grabButtonText] +.ok1: + cmp ecx,LABEL_COLOR_GRAB + jne short .ok2 + mov ecx,[WNDCOLORS + MOS_WNDCOLORS.grabText] +.ok2: + cmp ecx,LABEL_COLOR_WORKBUTTON + jne short .ok3 + mov ecx,[WNDCOLORS + MOS_WNDCOLORS.workButtonText] +.ok3: + cmp ecx,LABEL_COLOR_WORK + jne short .ok4 + mov ecx,[WNDCOLORS + MOS_WNDCOLORS.workText] +.ok4: + mov eax,MOS_SC_WRITETEXT + int 0x40 + +.next + add edi,LABEL_size ; next label + pop ecx + dec ecx + jz .done + jmp .drawall +.done: + + popad + popfd + leave + ret +%undef WNDCOLORS + + +%endif \ No newline at end of file diff --git a/programs/calc/trunk/build_en.bat b/programs/calc/trunk/build_en.bat new file mode 100644 index 0000000000..1c2d379c11 --- /dev/null +++ b/programs/calc/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm calc.asm calc +@pause \ No newline at end of file diff --git a/programs/calc/trunk/build_ru.bat b/programs/calc/trunk/build_ru.bat new file mode 100644 index 0000000000..80f90cf12c --- /dev/null +++ b/programs/calc/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm calc.asm calc +@pause \ No newline at end of file diff --git a/programs/calc/trunk/calc.asm b/programs/calc/trunk/calc.asm new file mode 100644 index 0000000000..53c0e43717 --- /dev/null +++ b/programs/calc/trunk/calc.asm @@ -0,0 +1,1007 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; Calculator for MenuetOS +;; +;; Compile with FASM for Menuet +;; + + +use32 + + org 0x0 + + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd I_END ; size of image + dd 0x1000 ; memory for app + dd 0x1000 ; esp + dd 0x0 , 0x0 ; I_Param , I_Icon + +include 'lang.inc' +include 'macros.inc' + +START: ; start of execution + + 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 + + jmp still + + red: ; redraw + call draw_window + jmp still + + key: ; key + mov eax,2 + int 0x40 + shr eax,8 + mov edi,asci ;translation & emulation + mov ecx,35 ;of button ID's + cld + repne scasb + jne still + sub edi,asci + dec edi + mov esi,butid + add esi,edi + lodsb + jmp testbut + + button: ; button + mov eax,17 ; get id + int 0x40 + + shr eax,8 + testbut: + cmp eax,1 ; button id=1 ? + jne noclose + mov eax,-1 ; close this program + int 0x40 + noclose: + + cmp eax,2 + jne no_reset + call clear_all + jmp still + no_reset: + + finit + + mov ebx,muuta1 ; Transform to fpu format + mov esi,18 + call atof + fstp [trans1] + + mov ebx,muuta2 + mov esi,18 + call atof + fstp [trans2] + + fld [trans2] + + cmp eax,30 + jne no_sign + cmp [dsign],byte '-' + jne no_m + mov [dsign],byte '+' + call print_display + jmp still + no_m: + mov [dsign],byte '-' + call print_display + jmp still + no_sign: + + cmp eax,3 + jne no_display_change + inc [display_type] + cmp [display_type],2 + jbe display_continue + mov [display_type],0 + display_continue: + mov eax,[display_type] + mov eax,[multipl+eax*4] + mov [entry_multiplier],eax + call print_display + jmp still + multipl: dd 10,16,2 + + no_display_change: + + + cmp eax,6 + jb no_10_15 + cmp eax,11 + jg no_10_15 + add eax,4 + call number_entry + jmp still + no_10_15: + + cmp eax,12 + jb no_13 + cmp eax,14 + jg no_13 + sub eax,11 + call number_entry + jmp still + no_13: + + cmp eax,12+6 + jb no_46 + cmp eax,14+6 + jg no_46 + sub eax,11+3 + call number_entry + jmp still + no_46: + + cmp eax,12+12 + jb no_79 + cmp eax,14+12 + jg no_79 + sub eax,11+6 + call number_entry + jmp still + no_79: + + cmp eax,13+18 + jne no_0 + mov eax,0 + call number_entry + jmp still + no_0: + + cmp eax,32 + jne no_id + inc [id] + and [id],1 + mov [new_dec],100000 + jmp still + no_id: + + cmp eax,16 + jne no_sin + fld [trans1] + fsin + jmp show_result + no_sin: + + cmp eax,17 + jne no_int + fld [trans1] + frndint + jmp show_result + no_int: + + cmp eax,22 + jne no_cos + fld [trans1] + fcos + jmp show_result + no_cos: + + cmp eax,23 + jne no_lg2 + fldlg2 + jmp show_result + no_lg2: + + cmp eax,28 + jne no_tan + fld [trans1] + fcos + fstp [tmp2] + fld [trans1] + fsin + fdiv [tmp2] + jmp show_result + no_tan: + + cmp eax,29 + jne no_pi + fldpi + jmp show_result + no_pi: + + cmp eax,34 + jne no_sqrt + fld [trans1] + fsqrt + jmp show_result + no_sqrt: + + cmp eax,15 + jne no_add + call calculate + call print_display + call new_entry + mov [calc],'+' + jmp still + no_add: + + cmp eax,21 + jne no_sub + call calculate + call print_display + call new_entry + mov [calc],'-' + jmp still + no_sub: + + cmp eax,27 + jne no_div + call calculate + call print_display + call new_entry + mov [calc],'/' + jmp still + no_div: + + cmp eax,33 + jne no_mul + call calculate + call print_display + mov [calc],'*' + call new_entry + jmp still + no_mul: + + cmp eax,35 + jne no_calc + call calculate + jmp still + no_calc: + + jmp still + + show_result: + + call ftoa + call print_display + + jmp still + +error: + + jmp still + + +calculate: + + pusha + + cmp [calc],' ' + je no_calculation + + cmp [calc],'/' + jne no_cdiv + fdiv [trans1] + no_cdiv: + + cmp [calc],'*' + jne no_cmul + fmul [trans1] + no_cmul: + + cmp [calc],'+' + jne no_cadd + fadd [trans1] + no_cadd: + + cmp [calc],'-' + jne no_cdec + fsub [trans1] + no_cdec: + + call ftoa + call print_display + + no_calculation: + + popa + + ret + + + +number_entry: + + pusha + + cmp eax,[entry_multiplier] + jge no_entry + + cmp [id],1 + je decimal_entry + + mov ebx,[integer] + test ebx,0xF0000000 + jnz no_entry + + mov ebx,eax + mov eax,[integer] + mov ecx,[entry_multiplier] + mul ecx + add eax,ebx + mov [integer],eax + call print_display + + call to_muuta + + popa + ret + + decimal_entry: + + imul eax,[new_dec] + add [decimal],eax + + mov eax,[new_dec] + xor edx,edx + mov ebx,[entry_multiplier] + div ebx + mov [new_dec],eax + + call print_display + + call to_muuta + + popa + + ret + + no_entry: + + call print_display + + call to_muuta + + popa + ret + + +to_muuta: + + pusha + + mov al,[dsign] + + mov esi,muuta0 + mov edi,muuta1 + mov ecx,18 + cld + rep movsb + + mov [muuta1],al + + mov edi,muuta1+10 ; INTEGER + mov eax,[integer] + new_to_muuta1: + mov ebx,10 + xor edx,edx + div ebx + mov [edi],dl + add [edi],byte 48 + dec edi + cmp edi,muuta1+1 + jge new_to_muuta1 + + mov edi,muuta1+17 ; DECIMAL + mov eax,[decimal] + new_to_muuta2: + mov ebx,10 + xor edx,edx + div ebx + mov [edi],dl + add [edi],byte 48 + dec edi + cmp edi,muuta1+12 + jge new_to_muuta2 + + call print_muuta + + popa + ret + + + +print_muuta: + + pusha + + mov eax,13 + mov ebx,25*65536+125 + mov ecx,200*65536+22 + mov edx,0xffffff + int 0x40 + + mov eax,4 + mov ebx,25*65536+200 + mov ecx,0x0 + mov edx,muuta1 + mov esi,18 + int 0x40 + + mov eax,4 + mov ebx,25*65536+210 + mov ecx,0x0 + mov edx,muuta2 + mov esi,18 + int 0x40 + + popa + ret + + + +new_entry: + + pusha + + mov esi,muuta1 + mov edi,muuta2 + mov ecx,18 + cld + rep movsb + + mov esi,muuta0 + mov edi,muuta1 + mov ecx,18 + cld + rep movsb + + mov [integer],0 + mov [decimal],0 + mov [id],0 + mov [new_dec],100000 + mov [sign],byte '+' + + popa + ret + +ten dd 10.0,0 +tmp dw 1,0 +sign db 1,0 +tmp2 dq 0x0,0 +exp dd 0x0,0 +new_dec dd 100000,0 +id db 0x0,0 + +k8 dd 10000000 +k8r dq 0 + +res dd 0 + +trans1 dq 0 +trans2 dq 0 + +controlWord dw 1 + + + + +ftoa: ; fpu st0 -> [integer],[decimal] + + pusha + + fst [tmp2] + + fstcw [controlWord] ; set truncate integer mode + mov ax,[controlWord] + mov [tmp], ax + or [tmp], word 0x0C00 + fldcw [tmp] + + ftst ; test if st0 is negative + fstsw ax + and ax, 4500h + mov [sign], 0 + cmp ax, 0100h + jne no_neg + mov [sign],1 + no_neg: + + fld [tmp2] + fistp [integer] + + fld [tmp2] + fisub [integer] + + fldcw [controlWord] + + cmp byte [sign], 0 ; change fraction to positive + je no_neg2 + fchs + no_neg2: + + mov [res],0 ; convert 6 decimal numbers + mov edi,6 + + newd: + + fimul [kymppi] + fist [decimal] + + mov ebx,[res] + imul ebx,10 + mov [res],ebx + + mov eax,[decimal] + add [res],eax + + fisub [decimal] + + fst [tmp2] + + ftst + fstsw ax + test ax,1 + jnz real_done + + fld [tmp2] + + dec edi + jz real_done + + jmp newd + + real_done: + + mov eax,[res] + mov [decimal],eax + + cmp [integer],0x80000000 ; out of fpu limits + jne no_error + mov [integer],0 + mov [decimal],0 + call clear_all + mov [calc],'E' + no_error: + + mov [dsign],byte '+' + cmp [sign],byte 0 ; convert negative result + je no_negative + mov eax,[integer] + not eax + inc eax + mov [integer],eax + mov [dsign],byte '-' + no_negative: + + call to_muuta + + popa + ret + + + +atof: + + push ax + push di + + fldz + mov di, 0 + cmp si, 0 + je .error ; Jump if string has 0 length. + + mov byte [sign], 0 + + cmp byte [bx], '+' ; Take care of leading '+' or '-'. + jne .noPlus + inc di + jmp .noMinus + .noPlus: + + cmp byte [bx], '-' + jne .noMinus + mov byte [sign], 1 ; Number is negative. + inc di + .noMinus: + + cmp si, di + je .error + + call atof_convertWholePart + jc .error + + call atof_convertFractionalPart + jc .error + + cmp byte [sign], 0 + je .dontNegate + fchs ; Negate value + .dontNegate: + + mov bh, 0 ; Set bh to indicate the string is a valid number. + jmp .exit + + .error: + mov bh, 1 ; Set error code. + fstp st0 ; Pop top of fpu stack. + + .exit: + pop di + pop ax + + ret + + + +atof_convertWholePart: + + ; Convert the whole number part (the part preceding the decimal + ; point) by reading a digit at a time, multiplying the current + ; value by 10, and adding the digit. + +.mainLoop: + + mov al, [bx + di] + cmp al, '.' + je .exit + + cmp al, '0' ; Make sure character is a digit. + jb .error + cmp al, '9' + ja .error + + ; Convert single character to digit and save to memory for + ; transfer to the FPU. + + sub al, '0' + mov ah, 0 + mov [tmp], ax + + ; Multiply current value by 10 and add in digit. + + fmul dword [ten] + fiadd word [tmp] + + inc di + cmp si, di ; Jump if end of string has been reached. + je .exit + jmp .mainLoop + + .error: + stc ; Set error (carry) flag. + ret + + .exit: + clc ; Clear error (carry) flag. + ret + + +atof_convertFractionalPart: + + fld1 ; Load 1 to TOS. This will be the value of the decimal place. + + .mainLoop: + + cmp si, di ; Jump if end of string has been reached. + je .exit + + inc di ; Move past the decimal point. + cmp si, di ; Jump if end of string has been reached. + je .exit + mov al, [bx + di] + + cmp al, '0' ; Make sure character is a digit. + jb .error + cmp al, '9' + ja .error + + fdiv dword [ten] ; Next decimal place + + sub al, '0' + mov ah, 0 + mov [tmp], ax + + ; Load digit, multiply by value for appropriate decimal place, + ; and add to current total. + + fild word [tmp] + fmul st0, st1 + faddp st2, st0 + + jmp .mainLoop + + .error: + + stc ; Set error (carry) flag. + fstp st0 ; Pop top of fpu stack. + ret + + .exit: + + clc ; Clear error (carry) flag. + fstp st0 ; Pop top of fpu stack. + ret + + + + +; ********************************************* +; ******* 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,100*65536+185 ; [y start] *65536 + [y size] + mov edx,0x02ffffff ; color of work area RRGGBB,8->color gl + mov esi,0x805977bb ; color of grab bar RRGGBB,8->color gl + mov edi,0x005977bb ; color of frames RRGGBB + int 0x40 + ; CLOSE BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(230-18)*65536+12 ; [x start] *65536 + [x size] + mov ecx,4*65536+12 ; [y start] *65536 + [y size] + mov edx,1 ; button id + mov esi,0x335599 ; button color 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,0x00ddeeff ; color of text RRGGBB + mov edx,labelt ; pointer to text beginning + mov esi,labellen-labelt ; text length + int 0x40 + + mov ebx,24*65536+25+3 + mov ecx,70*65536+17 + mov edx,6 + mov esi,0x303090;cc2211 + mov edi,7 + newbutton: + dec edi + jnz no_new_row + mov edi,6 + mov ebx,24*65536+25+3 + add ecx,20*65536 + no_new_row: + mov eax,8 + int 0x40 + add ebx,30*65536 + inc edx + cmp edx,11+24 + jbe newbutton + + mov eax,8 ; CLEAR ALL + mov ebx,25*65536+27 + mov ecx,41*65536+15 + mov edx,2 + int 0x40 + + mov eax,8 ; CHANGE DISPLAY TYPE + mov ebx,203*65536+7 + mov ecx,28*65536+7 + mov edx,3 + int 0x40 + + mov ebx,25*65536+35 ; draw info text with function 4 + mov ecx,0xffffff ; 224466 + mov edx,text + mov esi,30 + newline: + mov eax,4 + int 0x40 + add ebx,10 + add edx,30 + cmp [edx],byte 'x' + jne newline + + call print_display + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + + ret + + + +print_display: + + pusha + + mov eax,13 + mov ebx,59*65536+143 + mov ecx,24*65536+44 + mov edx,0xffffff + int 0x40 + + mov eax,4 + mov ebx,120*65536+28 + mov ecx,0 + mov edx,calc + mov esi,1 + int 0x40 + + mov eax,4 + mov ebx,175*65536+28 + mov ecx,0 + mov edx,[display_type] + shl edx,2 + add edx,display_type_text + mov esi,3 + int 0x40 + + cmp [display_type],0 ; display as desimal + jne no_display_decimal + + mov eax,47 + mov ebx,11*65536 ; 11 decimal digits for 32 bits + mov ecx,[integer] + mov edx,84*65536+44 + mov esi,0x0 + int 0x40 + + mov eax,47 + mov ebx,6*65536 + mov ecx,[decimal] + mov edx,156*65536+44 + mov esi,0x0 + int 0x40 + + mov eax,4 + mov ebx,150*65536+44 + mov ecx,0x0 + mov edx,dot + mov esi,1 + int 0x40 + + mov eax,4 + mov ebx,77*65536+44 + mov ecx,0x0 + mov edx,dsign + mov esi,1 + int 0x40 + + no_display_decimal: + + cmp [display_type],1 + jne no_display_hexadecimal + + mov eax,4 + mov ebx,138*65536+44 + mov ecx,0x0 + mov edx,dsign + mov esi,1 + int 0x40 + + mov eax,47 + mov ebx,1*256+8*65536 ; 8 hexadecimal digits for 32 bits + mov ecx,[integer] + mov edx,144*65536+44 + mov esi,0x0 + int 0x40 + + no_display_hexadecimal: + + + cmp [display_type],2 + jne no_display_binary + + mov eax,4 + mov ebx,96*65536+44 + mov ecx,0x0 + mov edx,dsign + mov esi,1 + int 0x40 + + mov eax,47 + mov ebx,2*256+15*65536 ; 16 binary digits for 32 bits + mov ecx,[integer] + mov edx,102*65536+44 + mov esi,0x0 + int 0x40 + + no_display_binary: + + popa + ret + + +clear_all: + + pusha + + mov [calc],' ' + mov [integer],0 + mov [decimal],0 + mov [id],0 + mov [dsign],byte '+' + mov esi,muuta0 + mov edi,muuta1 + mov ecx,18 + cld + rep movsb + mov esi,muuta0 + mov edi,muuta2 + mov ecx,18 + cld + rep movsb + call print_muuta + call print_display + + popa + ret + + + +; DATA AREA + +display_type dd 0 ; 0 = decimal, 1 = hexadecimal, 2= binary +entry_multiplier dd 10 + +display_start_y dd 0x0 +display_type_text db 'dec hex bin' + +dot db '.' + +calc db ' ' + +integer dd 0 +decimal dd 0 + +kymppi dd 10 + +dsign: +muuta1 db '+0000000000.000000' +muuta2 db '+0000000000.000000' +muuta0 db '+0000000000.000000' + + +text: + db ' ' + db ' C ' + db ' ' + db ' ' + db ' A B C D E F ' + db ' ' + db ' 1 2 3 + SIN INT ' + db ' ' + db ' 4 5 6 - COS LG2 ' + db ' ' + db ' 7 8 9 / TAN P ' + db ' ' + db ' -/+ 0 . * SQR = ' + db ' ' + db 'x <- END MARKER, DONT DELETE ' +asci: db 49,50,51,52,53,54,55,56,57,48,43,61,45,42,47,44,46,52,13,97,98,99,100 + db 101,102,65,66,67,68,69,70,112,80,27,182 +butid: db 12,13,14,18,19,20,24,25,26,31,15,35,21,33,27,32,32,33,35,6,7,8,9,10,11 + db 6,7,8,9,10,11,29,29,2,2 + +labelt: + db 'FPU CALCULATOR' +labellen: + +I_END: + + + + + diff --git a/programs/calc/trunk/macros.inc b/programs/calc/trunk/macros.inc new file mode 100644 index 0000000000..d599dea0e0 --- /dev/null +++ b/programs/calc/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 + +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 \ No newline at end of file diff --git a/programs/calendar/trunk/build_en.bat b/programs/calendar/trunk/build_en.bat new file mode 100644 index 0000000000..ce3b1be046 --- /dev/null +++ b/programs/calendar/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm calendar.asm calendar +@pause \ No newline at end of file diff --git a/programs/calendar/trunk/build_ru.bat b/programs/calendar/trunk/build_ru.bat new file mode 100644 index 0000000000..3e2c5ac092 --- /dev/null +++ b/programs/calendar/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm calendar.asm calendar +@pause \ No newline at end of file diff --git a/programs/calendar/trunk/calendar.asm b/programs/calendar/trunk/calendar.asm new file mode 100644 index 0000000000..1357cca97e --- /dev/null +++ b/programs/calendar/trunk/calendar.asm @@ -0,0 +1,838 @@ +; CALENDAR FOR MENUET v1.0 +; Written in pure assembler by Ivushkin Andrey aka Willow +; +; +; Created: November 1, 2004 +; Last changed: January 13, 2005 +; +; COMPILE WITH FASM + +WIN_X equ (150 shl 16+270) +WIN_Y equ (100 shl 16+300) + +LINE1 equ 27 shl 16+16 +B_MONTH_X equ 10 shl 16+158 +B_Y equ LINE1 +B_MONTH equ 63 shl 16+32 + +B_WBAR_X equ 10 shl 16+250 +B_WBAR_Y equ 64 shl 16+20 +B_WEEK equ 30 shl 16+70 +B_WX_SHIFT equ 32 shl 16 + +B_DBAR_X equ B_WBAR_X +B_DBAR_Y equ 85 shl 16+190 + +B_DROP equ B_MONTH+16 +B_DAYS_Y equ 100 +B_DAYS_SHIFT equ 30 + +B_YEAR_X equ 173 shl 16+58 +B_YEAR equ 188 shl 16+32 + +B_TODAY_X equ 25 shl 16 +B_TODAY_Y equ 48 shl 16+10 +B_TODAY equ 30 shl 16+50 + +B_SPIN_WIDTH equ 13 +B_SPIN_X equ 234 shl 16+B_SPIN_WIDTH +B_SPIN equ 238 shl 16+32 + +B_DATE_X equ 26 shl 16+60 +B_DATE_Y equ 275 shl 16+16 +B_DATE_BSHIFT equ 80 shl 16 +B_DATE equ 32 shl 16+280 +B_DATE_SHIFT equ 80 shl 16 + +B_NS_X equ 185 shl 16+75 +B_NS_Y equ 48 shl 16+10 +B_NS equ 190 shl 16+50 + +FOCUSABLE equ 5 +SKIP equ 1 + +use32 ; включить 32-битный режим ассемблера + + org 0x0 ; адресация с нуля + + db 'MENUET01' ; 8-байтный идентификатор MenuetOS + dd 0x01 ; версия заголовка (всегда 1) + dd start ; адрес метки, с которой начинается выполнение программ + dd I_END ; размер программы + dd 0x1000 ; количество памяти + dd 0x1000 ; адрес вершины стэка + dd 0x0 ; адрес буфера для строки параметров (не используется) + dd 0x0 ; зарезервировано +include 'lang.inc' +include 'macros.inc' ; уменьшает размер программы +;include 'debug.inc' + + +macro ShowFocus field,reg +{ + local .nofocus, .exit + cmp [focus],field + jne .nofocus + if reg eq + mov ecx,0x10e7c750;0x10ddeeff + else + mov reg,0x10e7c750;0x10ddeeff + end if + jmp .exit + .nofocus: + if reg eq + mov ecx,0x10000000 + else + mov reg,0x10000000 + end if + .exit: +} + +month_name: +if lang eq ru + db 8 + db 'Январь ' + db 'Февраль ' + db 'Март ' + db 'Апрель ' + db 'Май ' + db 'Июнь ' + db 'Июль ' + db 'Август ' + db 'Сентябрь' + db 'Октябрь ' + db 'Ноябрь ' + db 'Декабрь ' +else if lang eq ge + db 9 + db 'Januar ' + db 'Februar ' + db 'M┴rz ' + db 'April ' + db 'Mai ' + db 'Juni ' + db 'Juli ' + db 'August ' + db 'September' + db 'Oktober ' + db 'November ' + db 'Dezember ' +else if lang eq fr + db 9 + db 'Janvier ' + db 'Fevrier ' + db 'Mars ' + db 'Avril ' + db 'Mai ' + db 'Juin ' + db 'Juliet ' + db 'Aout ' + db 'Septembre' + db 'Octobre ' + db 'Novembre ' + db 'Decembre ' +else if lang eq fi + db 9 + db 'Tammikuu ' + db 'Helmikuu ' + db 'Maaliskuu' + db 'Huhtikuu ' + db 'Toukokuu ' + db 'Kes┴kuu ' + db 'Hein┴kuu ' + db 'Elokuu ' + db 'Syyskuu ' + db 'Lokakuu ' + db 'Marraskuu' + db 'Joulukuu ' +else + db 9 + db 'January ' + db 'February ' + db 'March ' + db 'April ' + db 'May ' + db 'June ' + db 'July ' + db 'August ' + db 'September' + db 'October ' + db 'November ' + db 'December ' +end if +spinner db '< >' +week_days: +if lang eq ru + db 2 + db 1 + db 'Пн' + db 'Вт' + db 'Ср' + db 'Чт' + db 'Пт' + db 'Сб' + db 'Вс' +else if lang eq ge + db 2 + db 7 + db 'So' + db 'Mo' + db 'Di' + db 'Mi' + db 'Do' + db 'Fr' + db 'Sa' +else if lang eq fr + db 3 + db 7 + db 'Dim' + db 'Lun' + db 'Mar' + db 'Mer' + db 'Jeu' + db 'Ven' + db 'Sam' +else if lang eq fi + db 2 + db 7 + db 'Su' + db 'Ma' + db 'Ti' + db 'Ke' + db 'To' + db 'Pe' + db 'La' +else + db 3 + db 7 + db 'Sun' + db 'Mon' + db 'Tue' + db 'Wen' + db 'Thi' + db 'Fri' + db 'Sat' +end if + +str2int: + xor eax,eax + lodsb + mov ebx,eax + shr ebx,4 + and eax,0xf + imul ebx,10 + add al,bl + ret + +start: + mcall 29 + mov [datestr],eax + mov esi,datestr + call str2int + add eax,1900 + mov [Year],eax + call str2int + dec eax + mov [Month],eax + call str2int + mov [day_sel],eax + test byte[esi],0 + jnz .no2000 + add [Year],100 + .no2000: + jmp upd ; здесь начинается выполнение программы +red: ; перерисовать окно + + call draw_window ; вызываем процедуру отрисовки окна + +still: ; ГЛАВНЫЙ ЦИКЛ ПРОГРАММЫ + + mov eax,10 ; функция 10 - ждать события + int 0x40 ; вызываем систему + .evt: + mov ebp,[focus] + cmp eax,1 ; перерисовать окно ? + je red ; если да - на метку red + cmp eax,2 ; нажата клавиша ? + je key ; если да - на key + cmp eax,3 ; нажата кнопка ? + je button ; если да - на button + + jmp still ; если другое событие - в начало цикла + + key: ; нажата клавиша на клавиатуре + mov eax,2 ; функция 2 - считать код символа + int 0x40 ; вызов системы + cmp ah,9 + jne no_tab + .tab: + cmp ebp,FOCUSABLE + je foc_cycle + inc [focus] + upd: + call calculate + jmp red + foc_cycle: + mov [focus],2 + jmp upd + no_tab: + push eax + shr eax,8 + mov ecx,12 + mov edi,Fkeys + repne scasb + pop eax + jnz .noFkey + sub edi,Fkeys+1 + mov [Month],edi + jmp upd + .noFkey: + cmp ebp,4 + jne no_spinner + cmp ah,176 + je year_dec + cmp ah,179 + je year_inc + no_spinner: + cmp ebp,2 + jne .nomonth + cmp ah,177 + je noclose.drop + jmp still + .nomonth: + cmp ebp,3 + je noy_up.year_evt + cmp ebp,5 + jne still + mov ebx,[day_sel] + cmp ah,176 ; left arrow + jb still + cmp ah,179 + ja still + shr eax,8 + sub eax,176 + movsx ecx,byte[day_bounds+eax*2] + movzx eax,byte[day_bounds+eax*2+1] + add ecx,ebx + test eax,eax + jz .chk0 + cmp ecx,eax + ja still + .ok: + mov [day_sel],ecx + call draw_days + jmp still ; вернуться к началу цикла + .chk0: + cmp ecx,eax + jle still + jmp .ok + +day_bounds db -1,0,7,0,-7,0,1,0 ; left,down,up,right + + button: ; нажата кнопка в окне программы + mov eax,17 ; 17 - получить идентификатор нажатой кнопки + int 0x40 ; вызов системы + movzx ebx,ah + cmp ah,200 + jbe nodayselect + sub ah,200 + mov byte[day_sel],ah + cmp ebp,5 + jne .redraw + call draw_days + jmp still + .redraw: + mov [focus],5 + jmp red + nodayselect: + cmp ah,100 + jb no_list + sub ah,100 + mov byte[Month],ah + mov [focus],2 + jmp upd + no_list: + cmp ah,1 ; идентификатор == 1 ? + jne noclose ; если нет - иди вперёд на noclose + close: + or eax,-1 ; выход из программы + int 0x40 ; вызов системы + + noclose: + cmp ah,2 ; drop down list + jne no_dropdn + .drop: + mov [focus],2 + cmp [dropped],al ; ==0 + jne red + call draw_window + mov edx,1 shl 31+231 + mov ecx,31 + mov eax,8 + .bremove: + int 0x40 + dec edx + loop .bremove + call draw_dropdown + jmp still + no_dropdn: + cmp ah,3 ; year -1 + jne noy_dn + year_dec: + dec [Year] + mov [focus],4 + jmp upd + noy_dn: + cmp ah,4 ; year+1 + jne noy_up + year_inc: + inc [Year] + mov [focus],4 + jmp upd + noy_up: + cmp ah,5 + jne noy_click + mov [focus],3 + call draw_window + .still: + mcall 10 + cmp eax,2 + jne still.evt + mcall 2 + .year_evt: + mov ebx,10 + cmp ah,9 + je key.tab + cmp ah,8 ; backspace + jne .nobsp + mov eax,[Year] + xor edx,edx + div ebx + .ch_year: + mov [Year],eax + call draw_year + jmp .still + .nobsp: + cmp ah,13 ; enter + je upd + cmp ah,182 + jne .noclear ; del + xor eax,eax + jmp .ch_year + .noclear: + cmp ah,48 + jb .still + cmp ah,57 + ja .still + cmp [Year],1000 + jae .still + shr eax,8 + lea ecx,[eax-48] + mov eax,[Year] + imul eax,ebx + add eax,ecx + jmp .ch_year + noy_click: + cmp ah,10 + jne start + xor [new_style],1 + jmp upd + + +; ********************************************* +; ******* ОПРЕДЕЛЕНИЕ И ОТРИСОВКА ОКНА ******* +; ********************************************* + +draw_window: + + mov eax,12 ; функция 12: сообщить ОС об отрисовке окна + mov ebx,1 ; 1 - начинаем рисовать + int 0x40 + ; СОЗДАЁМ ОКНО + xor eax,eax ; функция 0 : определить и отрисовать окно + mov ebx,WIN_X + if SKIP eq 0 + mov ecx,WIN_Y + else + mov ecx,WIN_Y-15 + end if + mov edx,0x03aabbcc ; цвет рабочей области RRGGBB,8->color gl + mov esi,0x805080d0 ; цвет полосы заголовка RRGGBB,8->color gl + mov edi,0x005080d0 ; цвет рамки RRGGBB + int 0x40 + call draw_week + + mov eax,8 + mov esi,0x05080d0 + if SKIP eq 0 + mov ebx,B_DATE_X + mov ecx,B_DATE_Y + mov edx,eax + int 0x40 + inc edx + add ebx,B_DATE_BSHIFT + int 0x40 + inc edx + else + mov edx,10 + end if + or edx,1 shl 29+1 shl 30 + mov ebx,B_NS_X + mov ecx,B_NS_Y + int 0x40 + add edx,1-1 shl 29 + mov ebx,B_TODAY_X+8*(today_end-today_msg) + mov ecx,B_TODAY_Y + int 0x40 + mov ecx,B_Y + mov ebx,B_MONTH_X + mov edx,2 + int 0x40 + mov ebx,B_SPIN_X + inc edx + int 0x40 + add ebx,B_SPIN_WIDTH shl 16 + inc edx + int 0x40 + call draw_days + + ; ЗАГОЛОВОК ОКНА + mov eax,4 ; функция 4 : написать в окне текст + mov ebx,8*65536+8 ; [x] *65536 + [y] + mov ecx,0x10ddeeff ; шрифт 1 и цвет ( 0xF0RRGGBB ) + mov edx,zagolovok ; адрес строки + mov esi,zag_konets-zagolovok ; и её длина + int 0x40 + + if SKIP eq 0 + mov ebx,B_DATE + mov edx,datebut + mov esi,9 + btc ecx,28 + int 0x40 + add ebx,B_DATE_SHIFT + add edx,esi + int 0x40 + end if + mov edx,n_style + mov esi,ns_end-n_style + mov ebx,B_NS + cmp [new_style],1 + je .high + mov ecx,0xa0a0a0 + jmp .int + .high: + mov ecx,0xac0000;d048c8 + .int: + int 0x40 + + mov ecx,0xd048c8 + mov edx,today_msg + mov ebx,B_TODAY + mov esi,today_end-today_msg + int 0x40 + + mov ebx,B_SPIN + mov edx,spinner + mov esi,3 + ShowFocus 4 + int 0x40 + + mov edx,[Month] + movzx esi,byte[month_name] + imul edx,esi + add edx,month_name+1 + mov ebx,B_MONTH + ShowFocus 2 + int 0x40 + + call draw_year + mov [dropped],0 + mov eax,12 ; функция 12: сообщить ОС об отрисовке окна + mov ebx,2 ; 2, закончили рисовать + int 0x40 + ret ; выходим из процедуры + +draw_year: + mcall 8,B_YEAR_X,B_Y,5,0x05080d0 + ShowFocus 3,esi + mcall 47,0x40001,Year,B_YEAR + ret + +draw_dropdown: + mov [dropped],1 + push [Month] + pop [focus] + add [focus],100 + mov ecx,12 + mov edx,100 + push dword month_name+1 + push dword B_DROP + push dword B_Y+16 shl 16 + .ddd_loop: + mov edi,edx + push ecx + mov ebx,B_MONTH_X + mov ecx,[esp+4] + mov esi,0x6f9fef + mov eax,8 + int 0x40 + shr eax,1 + mov ebx,[esp+8] + xchg edx,[esp+12] + movzx esi,byte[month_name] + ShowFocus edi + int 0x40 + add edx,esi + xchg edx,[esp+12] + add dword[esp+8],16 + add dword[esp+4],16 shl 16 + inc edx + pop ecx + loop .ddd_loop + add esp,12 + ret + +draw_week: + mov eax,13 + mov ebx,B_WBAR_X + mov ecx,B_WBAR_Y + mov edx,0x90a0b0 + int 0x40 + movzx esi,byte[week_days] + movzx edi,byte[week_days+1] + mov ebx,B_WEEK + mov ecx,7 + mov edx,week_days+2 + mov eax,4 + .week: + push ecx + cmp ecx,edi + je .holiday + mov ecx,0x10000000 + jmp .noholiday + .holiday: + mov ecx,0x10cc1010 + .noholiday: + int 0x40 + add edx,esi + add ebx,B_WX_SHIFT + pop ecx + loop .week + ret + +draw_days: + mov eax,13 + mov ebx,B_DBAR_X + mov ecx,B_DBAR_Y + mov edx,0xe0e0e0 + int 0x40 + call count_days + cmp ecx,[day_sel] + jae .ok + mov [day_sel],ecx + .ok: + mov [number],0 + mov eax,47 + mov edx,B_DAYS_Y + mov ebx,0x20001 + mov edi,[firstday] + .dayloop: + push ecx + movzx edx,dx + mov esi,edi + shl esi,21 + lea edx,[edx+esi+30 shl 16] + mov ecx,edi + add cl,[week_days+1] + cmp ecx,7 + je .holiday + mov esi,0x10000000 + jmp .noholiday + .holiday: + mov esi,0x10cc1010 + .noholiday: + mov ecx,number + inc dword[ecx] + pusha + mov ebx,edx + mov bx,20 + sub ebx,3 shl 16 + shrd ecx,edx,16 + mov cx,20 + sub ecx,7 shl 16 + mov edx,[number] + cmp edx,[day_sel] + je .draw_sel + mov esi,0xe0e0e0 + jmp .draw_but + .draw_sel: + mov esi,0x5080d0 + cmp [focus],5 + jne .draw_but + mov esi,0xef7840;0xe26830 + .draw_but: + add edx,200+1 shl 29 + mov eax,8 + int 0x40 + popa + int 0x40 + pop ecx + inc edi + cmp edi,7 + jne .nowrap + xor edi,edi + add dx,B_DAYS_SHIFT + .nowrap: + loop .eloop + jmp .ex + .eloop: + jmp .dayloop + .ex: + ret + +count_days: ; ecx -days in month + call is_leap_year + mov ecx,[Month] + mov eax,1 + movzx ecx,byte[day_count+ecx] + add ecx,28 + cmp eax,[leap_year] + jne .noleap + cmp eax,[Month] + jne .noleap + inc ecx + .noleap: + mov [day_bounds+3],cl + mov [day_bounds+7],cl + ret + +is_leap_year: + mov [leap_year],0 + mov eax,[Year] + mov bl,100 + div bl ; ah=Year mod 100, al=Year%100 + test ah,ah + jz .century + shr ax,8 ; ax - last 2 digits + .century: + test al,11b + jnz .noleap + inc [leap_year] + .noleap: + ret + +calculate: + mov ebx,[Year] + mov eax,[Month] + sub eax,2 + jge .nojf + dec ebx + add eax,12 + .nojf: + add eax,4 + xor edx,edx + mov ecx,153 + imul cx + mov ecx,5 + div cx + inc eax + mov ecx,365 + imul ecx,ebx + add eax,ecx + mov ecx,ebx + shr ecx,2 + add eax,ecx + dec eax + cmp [new_style],0 + je .nonew + add eax,2 + xchg eax,ebx + mov ecx,100 + xor edx,edx + div cx + sub ebx,eax + shr eax,2 + add ebx,eax + .nonew: + add ebx,5 + mov eax,ebx + xor edx,edx + movzx ebx,byte[week_days+1] + sub eax,ebx + inc eax + mov ebx,7 + div bx + mov [firstday],edx + ret + +; Здесь находятся данные программы: + +; интерфейс программы двуязычный - задайте язык в macros.inc +day_count db 3,0,3,2,3,2,3,3,2,3,2,3 +Fkeys db 210,211,212,213,214,215,216,217,208,209,228,159 + +zagolovok: ; строка заголовка +if lang eq ru + db 'КАЛЕНДАРЬ' +else if lang eq ge + db 'KALENDER' +else if lang eq fr + db 'CALENDRIER' +else + db 'CALENDAR' +end if +zag_konets: ; и её конец +if SKIP eq 0 +datebut: +if lang eq ru + db '1-я дата ' + db '2-я дата ' +else if lang eq fr + db '1ere date' + db '2eme date' +else if lang eq ge + db ' Datum 1 ' + db ' Datum 2 ' +else + db '1st date ' + db '2nd date ' +end if +end if +n_style: +if lang eq ru + db 'Новый стиль' +else if lang eq ge + db 'Neustil' +else if lang eq fr + db 'Nouveau' +else + db 'New style' +end if +ns_end: +today_msg: +if lang eq ru + db 'Сегодня' +else if lang eq ge + db 'Heute' +else if lang eq fr + db "Aujourd'hui" +else + db 'Today' +end if +today_end: +focus dd 3 +new_style dd 1 +dropped db 0 + +I_END: ; конец программы +firstday dd ? +Year dd ? +Month dd ? +day_sel dd ? +all_days dd ? + +datestr dd ? +leap_year dd ? +number dd ? +year_input dd ? diff --git a/programs/calendar/trunk/calendar.txt b/programs/calendar/trunk/calendar.txt new file mode 100644 index 0000000000..c1ff369ba8 --- /dev/null +++ b/programs/calendar/trunk/calendar.txt @@ -0,0 +1,75 @@ +CALENDAR FOR MENUET v1.0 January 13, 2005 + Written in pure assembler by Ivushkin Andrey aka Willow + +I salute users and programmers of Menuet operation system! +Also, I tender thanks to everyone who spends his time in feasible efforts +for that little OS evolution. My special thanks to Ivan Poddubny whose distro +(re8pre2) runs on VMware Workstation incomparably and bugless. That, as well +as MACROS.INC and DEBUG.INC files, simplify the developing greatly. + +Today I let you to judge a desktop calendar, similar to the Windows one. +Application abilities are: + +1. Interface is translated into Russian,English, German, French, and Finnish + (not completely - there was no help). Day sequence difference is taken + into account as well. You may change localization through 'lang' constant + while compiling. +2. Calendar is equipped with additional buttons 'Today' and 'New style' that + are self-explaining. +3. I tied to follow world GUI standards: use TAB to move along fields; while + editing the year, use Backspace and Del, as well as left and right arrows + of 'spinner' when in its focus. Arrow keys navigate along day matrix. + Pressing Ctrl-F1...Ctrl-F12 selects appropriate month. + +To-Do list: + +1. Program internal routines allow calculating amount of days between two dates. + It is possible to add a feature of calculating biorhythms and draw their + graphs. +2. Add comments to source. +3. Correct bugs to be found ;-) + +I dedicate my application to the Ukrainian Orange Revolution. + +Razom nas bahato, nas ne podolaty! + + +**************************************** +**************************************** + +КАЛЕНДАРЬ ДЛЯ MENUET v1.0 13 января 2005 г. + Написана на чистом ассемблере Ивушкиным Андреем (Willow) + +Честь и хвала юзерам и программистам операционной системы Menuet! +Выражаю искреннюю благодарность всем тем, кто не жалея своего времени, +делает посильный вклад в развитие этой маленькой ОС. Особое спасибо хочу сказать +Ивану Поддубному, дистрибутив которого (re8pre2) бесподобно и без глюков +работает в VMware Workstation. Это, а также файлы MACROS.INC и DEBUG.INC сильно +упрощают разработку. + +Сегодня я представляю на ваш суд настольный календарик, наподобие того, что +имеется в Windows. Возможности программы: + +1. Интерфейс переведен на русский, английский, немецкий, французский и финский + (не полностью - кто бы помог?) языки. Учтены отличия в порядке следования + дней недели. Язык можно поменять при компиляции стандартной константой + "lang". +2. Календарик оборудован дополнительными кнопками "Сегодня" и "Новый стиль", + названия которых говорят сами за себя. +3. Я пытался следовать мировым стандартам GUI: для перемещения между полями + ввода используется TAB, в поле года действуют клавиши Backspace и Del, + число года можно изменять стрелками влево и вправо в фокусе "спиннера", в + поле календаря работают стрелки. Нажатием Ctrl-F1...Ctrl-F12 можно быстро + перейти к нужному месяцу. + +Что еще можно сделать: + +1. Внутренние функции программы позволяют определить количество дней от одной + даты до другой. В календарь можно будет добавить возможность расчета такого + популярного показателя, как биоритмы (с графиками). +2. Откомментировать код. +3. Исправить баги, которые, возможно, найдутся ;-) + +Эту программу я посвящаю украинской помаранчевой революции. + +Разом нас багато, нас не подолати! \ No newline at end of file diff --git a/programs/calendar/trunk/macros.inc b/programs/calendar/trunk/macros.inc new file mode 100644 index 0000000000..1d153e8723 --- /dev/null +++ b/programs/calendar/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 + +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 \ No newline at end of file diff --git a/programs/cdp/trunk/build_en.bat b/programs/cdp/trunk/build_en.bat new file mode 100644 index 0000000000..1102aed205 --- /dev/null +++ b/programs/cdp/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm cdp.asm cdp +@pause \ No newline at end of file diff --git a/programs/cdp/trunk/build_ru.bat b/programs/cdp/trunk/build_ru.bat new file mode 100644 index 0000000000..3b418db8cc --- /dev/null +++ b/programs/cdp/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm cdp.asm cdp +@pause \ No newline at end of file diff --git a/programs/cdp/trunk/cdp.asm b/programs/cdp/trunk/cdp.asm new file mode 100644 index 0000000000..1071c3b680 --- /dev/null +++ b/programs/cdp/trunk/cdp.asm @@ -0,0 +1,1332 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; ; +; Audio CD player; code by Dmitry Yushko - dma@bn.by ; +; ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +include "lang.inc" +include "macros.inc" + +FALSE equ 0 +TRUE equ 1 + +ESC_KEY equ 27 +LEFT_KEY equ 176 +RIGHT_KEY equ 179 + +NORMAL_PLAY equ 0 +REPEAT_TRACK equ 1 +REPEAT_DISK equ 2 +SHUFFLE_DISK equ 3 + +COLOR_FUNC_BUTS equ 0x00dddddd + +use32 + + org 0x0 + db 'MENUET01' ; 8 byte id + dd 0x01 ; required os + dd START ; program start + dd I_END ; program image size + dd 0x2000 ; required amount of memory + dd 0x2000 ; esp = 0x7fff0 + dd 0x0, 0x0 ; reserved=no extended header + +START: + call chk_cdrom ; start of execution + call read_cd + call draw_window ; at first, draw the window +still: + + mov eax,23 + mov ebx,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 + + call draw_info + cmp [curr_trk],0 + je @f + call current_trk_time + @@: + jmp still + + red: ; redraw + call draw_window + + jmp still + + key: ; key + mov eax,2 ; just read it and ignore + int 0x40 + +;====== hotkeys: + cmp ah,0x61 + jb @f + cmp ah,0x7a + ja @f + and ah,11011111b + @@: + + cmp ah,'P' ;PLAY + jne no_key_play + call play_acd + jmp still + no_key_play: + + cmp ah,'S' ;STOP + jne no_key_stop + mov [if_paused],FALSE + call stop_playing + jmp still + no_key_stop: + + cmp ah,'N' ;NEXT + jne no_key_next + call play_next_trk + jmp still + no_key_next: + + cmp ah,'B' ;BACK + jne no_key_back + call play_back_trk + jmp still + no_key_back: + + cmp ah,'F' ;FORWARD + jne no_key_fwd + call fast_forward + jmp still + no_key_fwd: + + cmp ah,'R' ;REWIND + jne no_key_rewind + call fast_rewind + jmp still + no_key_rewind: + + cmp ah,'M' ;MODE + jne no_key_mode + call change_mode + jmp still + no_key_mode: + + + cmp ah,'L' ;READ PLAYLIST + jne no_key_list + mov [if_paused],FALSE + mov [curr_trk],0 + call stop_playing + call chk_cdrom + call read_cd + jmp still + no_key_list: + + cmp ah,50 ;F1 key + jz itsahelpkey + + cmp ah,'H' ;HELP + jne no_key_help + itsahelpkey: + cmp [flag],4 + je still + cmp [flag],1 + jne was_it_ok_false + mov [was_it_ok],TRUE + jmp flag4_done + was_it_ok_false: + mov [was_it_ok],FALSE + flag4_done: + mov [flag],4 + mov [help_screen],1 + call draw_window + jmp still + no_key_help: + + + cmp ah,ESC_KEY + jne no_esc_key + cmp [flag],4 + jne still + cmp [was_it_ok],FALSE + jne was_it_ok_true + mov [flag],0 + jmp end_esc_key + was_it_ok_true: + mov [flag],1 + end_esc_key: + call draw_window + no_esc_key: + + cmp ah,LEFT_KEY + jne no_left_key + cmp [flag],4 + jne still + cmp [help_screen],1 + jz still + dec [help_screen] + call draw_window + no_left_key: + + cmp ah,RIGHT_KEY + jne no_right_key + cmp [flag],4 + jne still + cmp [help_screen],3 + jz still + inc [help_screen] + call draw_window + no_right_key: + + + jmp still + + + button: ; button + mov eax,17 + int 0x40 + + cmp ah,1 ; button id=1 ? + jnz no_but_close + mov eax,24 + mov ebx,3 + int 0x40 + mov eax,0xffffffff ; close this program + int 0x40 + no_but_close: + + cmp ah,2 + jne no_but_play + call play_acd + jmp still + no_but_play: + + cmp ah,3 + jne no_but_stop + mov [if_paused],FALSE + call stop_playing + jmp still + no_but_stop: + + cmp ah,4 + jne no_but_reread + mov [curr_trk],0 + call chk_cdrom + call read_cd + mov [if_paused],FALSE + call stop_playing + jmp still + no_but_reread: + + cmp ah,5 + jne no_but_next + call play_next_trk + jmp still + no_but_next: + + cmp ah,6 + jne no_but_back + call play_back_trk + jmp still + no_but_back: + + cmp ah,7 + jne no_but_mode + call change_mode + jmp still + no_but_mode: + + cmp ah,8 + jne no_but_frew + call fast_rewind + jmp still + no_but_frew: + + cmp ah,9 + jne no_but_ffwd + call fast_forward + jmp still + no_but_ffwd: + + cmp ah,10 + jb no_but_track + cmp ah,40 + ja no_but_track + call read_cd + cmp [flag],1 + jne no_but_track + mov cl,ah + sub cl,10 + mov [curr_trk],cl + mov cl,[max_trk] + mov [shuftab],cl + call stop_playing + call renew_shuftab + call play_n_track + call rem_time_trk + jmp still + no_but_track: + + jmp still + + +change_mode: + cmp [mode],3 + jne inc_mode + mov [mode],0 + jmp end_but_mode + inc_mode: + inc [mode] + end_but_mode: + call draw_info +ret + +play_next_trk: + cmp [curr_trk],0 + je @play_next_trk + cmp [if_paused],TRUE + je @play_next_trk + cmp [mode],NORMAL_PLAY + jne play_next_mode1 + xor eax,eax + mov al,[curr_trk] + cmp [max_trk],al + je @play_next_trk + inc [curr_trk] + cmp [if_stopped],TRUE + je @play_next_trk + call play_n_track + jmp @play_next_trk + play_next_mode1: + cmp [mode],REPEAT_TRACK + jne play_next_mode2 + cmp [if_stopped],TRUE + je @play_next_trk + call play_n_track + jmp @play_next_trk + play_next_mode2: + cmp [mode],REPEAT_DISK + jne play_next_mode3 + xor eax,eax + mov al,[curr_trk] + cmp [max_trk],al + jne play_next_mode2_go + mov [curr_trk],1 + cmp [if_stopped],TRUE + je @play_next_trk + call play_n_track + jmp @play_next_trk + play_next_mode2_go: + inc [curr_trk] + cmp [if_stopped],TRUE + je @play_next_trk + call play_n_track + jmp @play_next_trk + play_next_mode3: + cmp [mode],SHUFFLE_DISK + jne @play_next_trk + call shuffle_track + @play_next_trk: +ret + +play_back_trk: + cmp [curr_trk],0 + je @play_back_trk + cmp [if_paused],TRUE + je @play_back_trk + cmp [mode],NORMAL_PLAY + jne play_back_mode1 + xor eax,eax + mov al,[curr_trk] + cmp al,1 + je @play_back_trk + dec [curr_trk] + cmp [if_stopped],TRUE + je @play_next_trk + call play_n_track + jmp @play_back_trk + play_back_mode1: + cmp [mode],REPEAT_TRACK + jne play_back_mode2 + cmp [if_stopped],TRUE + je @play_next_trk + call play_n_track + jmp @play_back_trk + play_back_mode2: + cmp [mode],REPEAT_DISK + jne play_back_mode3 + xor eax,eax + mov al,[curr_trk] + cmp al,1 + jne play_back_mode2_go + mov al,[max_trk] + mov [curr_trk],al + cmp [if_stopped],TRUE + je @play_next_trk + call play_n_track + jmp @play_back_trk + play_back_mode2_go: + dec [curr_trk] + cmp [if_stopped],TRUE + je @play_next_trk + call play_n_track + jmp @play_back_trk + play_back_mode3: ;(shuffle) +; call shuffle_track + @play_back_trk: +ret + + +current_trk_time: + cmp [if_stopped],TRUE + je menshe + call get_uptime + mov ebx,[stimtrk] + sub eax,ebx + ; eax now is seconds from track start * 100 + xor edx,edx + mov ecx,100 + div ecx + mov [curr_trk_pg_time],eax + mov ebx,[curr_trk_length] +; add eax,1 ;{inc curr time on 1 sec) + cmp eax,ebx + jb menshe + call stop_playing + cmp [mode],SHUFFLE_DISK + jne @f + call shuffle_track + @@: + cmp [mode],REPEAT_TRACK + je @@mode_repeat_1 + mov al,[max_trk] + cmp [curr_trk],al + jb @@next_trk_ok + cmp [mode],REPEAT_DISK + jne menshe + mov [curr_trk],0 + @@next_trk_ok: + inc [curr_trk] + @@mode_repeat_1: + call play_n_track + menshe: +ret + + +rem_time_trk: + call get_uptime + mov [stimtrk],eax + ret + +fast_forward: + cmp [if_stopped],TRUE + je end_ffwd + mov eax,[curr_trk_pg_time] + add eax,5 + cmp eax,[curr_trk_length] + jae end_ffwd + cmp [stimtrk],500 + jbe end_ffwd + sub [stimtrk],500 + call current_trk_time + call play_from_x_time + end_ffwd: +ret + +fast_rewind: + cmp [if_stopped],TRUE + je end_frew + cmp [curr_trk_pg_time],5 + jbe end_frew + add [stimtrk],500 + call current_trk_time + call play_from_x_time + end_frew: +ret + +renew_shuftab: + mov ecx,40 + @rn: + mov [shuftab+ecx],cl + loop @rn + mov cl,[max_trk] + mov [shuftab],cl +ret + + +shuffle_track: + call get_uptime + ror eax,16 + cmp eax,0 + je shuffle_track + xor ecx,ecx + mov cl,[shuftab] + cmp ecx,1 + je @enddsk + xor edx,edx + div ecx + cmp edx,0 + je shuffle_track + xor ecx,ecx + mov cl,[max_trk] + @main_loop: + xor eax,eax + mov al,[shuftab+ecx] + cmp al,0 + je @f + dec edx + cmp edx,0 + jne @f + mov cl,[shuftab] + dec cl + mov [shuftab],cl + mov [shuftab+eax],0 + mov [curr_trk],al + call play_n_track + jmp @endofshuffle + @@: + loop @main_loop + jmp @endofshuffle + @enddsk: + call stop_playing + @endofshuffle: + +ret + + + + +play_from_x_time: + xor ecx,ecx + mov cl,[curr_trk] + shl cl,3 + add cl,1 + add ecx,cdp + mov ebx,[ecx] + mov ecx,ebx + and ecx,0x00ffffff + + mov eax,[curr_trk_pg_time] + xor edx,edx + mov ebx,60 + div ebx + add cl,al ;mins + add dl,ch + xor eax,eax + mov al,dl + xor edx,edx + div ebx + add cl,al ;real min + mov ch,dl ;real sec + + mov eax,24 + mov ebx,1 + int 0x40 + ret + +play_n_track: + mov [if_paused],FALSE + mov [if_stopped],FALSE + mov [curr_trk_pg_time],0 + call draw_window +; mov eax,26 +; mov ebx,9 +; int 0x40 + call get_uptime + mov [stimtrk],eax + xor ebx,ebx + xor ecx,ecx + mov cl,[curr_trk] + inc cl + shl cl,3 + add cl,1 + add ecx,cdp + mov ebx,[ecx] + and ecx,0x00ffffff + mov ecx,ebx + ;get_minutes: + and ecx,0x000000ff + mov eax,ecx + imul eax,60 + ;get_seconds: + mov ecx,ebx + and ecx,0x0000ff00 + shr ecx,8 + add eax,ecx + ;eax now is next pos in secs + mov [next_pos_sec],eax + ;eax now is current pos in secs + xor ebx,ebx + xor ecx,ecx + mov cl,[curr_trk] + shl cl,3 + add cl,1 + add ecx,cdp + mov ebx,[ecx] + and ecx,0x00ffffff + mov ecx,ebx + ;get_minutes: + and ecx,0x000000ff + mov eax,ecx + imul eax,60 + ;get_seconds: + mov ecx,ebx + and ecx,0x0000ff00 + shr ecx,8 + add eax,ecx + ;eax now is current pos in secs + mov ecx,[next_pos_sec] + sub ecx,eax + ;eax now is length of trk in sec + mov [curr_trk_length],ecx +;now play that! + mov ecx,ebx + mov eax,24 + mov ebx,1 + int 0x40 + ret + + +play_acd: + call chk_cdrom + call read_cd + call draw_window + call renew_shuftab + mov cl,[curr_trk] + cmp cl,0 + jnz play_acd_trk_ok + mov cl,[max_trk] + mov [shuftab],cl + mov [curr_trk],1 + jmp playing_no_pause + play_acd_trk_ok: +; start_chk_on_pause: + cmp [if_paused],TRUE + jne pause_playing + mov [if_stopped],FALSE + mov [if_paused],FALSE + call current_trk_time + mov eax,[curr_trk_pg_time] + mov ebx,[paused_time] + sub eax,ebx + imul eax,100 + add [stimtrk],eax + call current_trk_time + call play_from_x_time + call draw_window + jmp end_play_acd + pause_playing: + cmp [curr_trk_pg_time],0 + je playing_no_pause + mov eax,[curr_trk_pg_time] + mov [paused_time],eax + mov [if_paused],TRUE + call stop_playing + call draw_window + jmp end_play_acd + playing_no_pause: + mov [if_paused],FALSE + call rem_time_trk + call play_n_track + call draw_window + end_play_acd: + ret + +stop_playing: + mov eax, 24 + mov ebx,3 + int 0x40 + mov cl,[max_trk] + mov [shuftab],cl + mov [if_stopped],TRUE + cmp [if_paused],TRUE + je end_stop_playing + mov [curr_trk_pg_time],0 + end_stop_playing: + call draw_window +ret + +; ********************************************* +; ******* WINDOW DEFINITIONS AND DRAW ******** +; ********************************************* + +draw_info: + ;bar-> + mov eax,13 + mov ebx, 10 shl 16 + 41 + mov ecx,120 shl 16 + 9 + mov edx,0x00ffffff + int 0x40 + mov ebx, 96 shl 16 + 11 + int 0x40 + mov ebx, 185 shl 16 + 11 + int 0x40 + mov ebx, 200 shl 16 + 11 + int 0x40 + mov ebx, 150 shl 16 + 11 + int 0x40 + mov ebx, 165 shl 16 + 11 + int 0x40 + ;bar<- + + mov eax,4 + mov ebx,10 shl 16 +120 + mov ecx,0x00111111 + cmp [mode],NORMAL_PLAY + jne info_mode_1 + mov edx,mode_normal + jmp info_mode_end + info_mode_1: + cmp [mode],REPEAT_TRACK + jne info_mode_2 + mov edx,mode_repeat_1 + jmp info_mode_end + info_mode_2: + cmp [mode],REPEAT_DISK + jne info_mode_3 + mov edx,mode_repeat_all + jmp info_mode_end + info_mode_3: + cmp [mode],SHUFFLE_DISK + jne info_mode_end + mov edx,mode_shuffle +; mov ecx,0x00aaaaaa +; mov cl,[max_trk] +; mov [shuftab],cl + jmp info_mode_end + info_mode_end: + mov esi,7 + int 0x40 + + ;num info -> + mov eax,47 + xor ebx,ebx + mov bl,0 + mov bh,0 + or ebx,0x20000 ;X0000 - number of digits to draw + xor ecx,ecx + mov cl, [curr_trk] ;number to draw + mov edx,96 shl 16 + 120 + mov esi,0x111111 + int 0x40 + mov eax,[curr_trk_pg_time] + xor edx,edx + mov ecx,60 + div ecx + push edx + mov ecx,eax + mov eax,47 + mov edx,150 shl 16 + 120 + int 0x40 + pop ecx + mov edx,165 shl 16 + 120 + int 0x40 + mov eax,[curr_trk_length] + xor edx,edx + mov ecx,60 + div ecx + push edx + mov ecx,eax + mov eax,47 + mov edx,185 shl 16 + 120 + int 0x40 + pop ecx + mov edx,200 shl 16 + 120 + int 0x40 + ;num info <- +ret + + +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, 50*65536+219 ; [x start] *65536 + [x size] + mov ecx,100*65536+168 ; [y start] *65536 + [y size] + mov edx,0x03ffffff ; color of work area RRGGBB + mov esi,0x8099bbff ; color of grab bar RRGGBB,8->color glide + mov edi,0x0099bbee ; 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,0xf000ffff ; color of text RRGGBB + mov edx,labelt ; pointer to text beginning + mov esi,labellen-labelt ; text length + int 0x40 + + mov eax,13 ;bar + mov ebx,8 shl 16 + 204 + mov ecx,28 shl 16 + 84 + mov edx,0x000fe6f5 + int 0x40 + + ;info -> + mov eax,4 + mov ebx,63 shl 16 + 120 + mov ecx,0x00111111 + mov edx,playing_trk_info + mov esi,6 + int 0x40 + mov ebx,120 shl 16 + 120 + mov edx,playing_time_info +; mov esi,5 + dec esi + int 0x40 + mov ebx,178 shl 16 + 120 + mov edx,slash + mov esi,1 + int 0x40 + mov ebx,196 shl 16 + 120 + mov edx,column +; mov esi,1 + int 0x40 + mov ebx,161 shl 16 + 120 + mov edx,column +; mov esi,1 + int 0x40 + ;info <- + +; button MODE + mov eax,8 + mov ebx,12*65536+20 + mov ecx,135*65536+20 + mov edx,7 + mov esi,COLOR_FUNC_BUTS + int 0x40 + ; text + mov eax,4 + mov ebx,19*65536+142 + mov ecx,0xf00f73f5;ffff0f + mov edx,but_mode_lab + mov esi,1 + int 0x40 + +; button BACK + mov eax,8 + mov ebx,37*65536+20 + mov ecx,135*65536+20 + mov edx,6 + mov esi,COLOR_FUNC_BUTS + int 0x40 + mov [coord_x],51 + mov [coord_y],141 + call draw_left_triangle + mov [coord_x],44 + call draw_vertical_line + +; button NEXT + mov eax,8 + mov ebx,62*65536+20 + mov ecx,135*65536+20 + mov edx,5 + mov esi,COLOR_FUNC_BUTS + int 0x40 + mov [coord_x],68 + mov [coord_y],141 + call draw_right_triangle + mov [coord_x],74 + call draw_vertical_line + +; button REWIND + mov eax,8 + mov ebx,87*65536+20 + mov ecx,135*65536+20 + mov edx,8 + mov esi,COLOR_FUNC_BUTS + int 0x40 + mov [coord_x],102 + mov [coord_y],141 + call draw_left_triangle + mov [coord_x],97 + call draw_left_triangle + +; button STOP + mov eax,8 + mov ebx,112*65536+20 + mov ecx,135*65536+20 + mov edx,3 + mov esi,COLOR_FUNC_BUTS + int 0x40 + mov [coord_x],118 + mov [coord_y],142 + call draw_square + + +; button PLAY + mov eax,8 + mov ebx,137*65536+20 + mov ecx,135*65536+20 + mov edx,2 + mov esi,COLOR_FUNC_BUTS + int 0x40 + cmp [if_stopped],TRUE + je playing_paused + cmp [if_paused],TRUE + je playing_paused + mov [coord_x],144 + mov [coord_y],141 + call draw_vertical_line + mov [coord_x],149 + call draw_vertical_line + jmp end_draw_play + playing_paused: + mov [coord_x],144 + mov [coord_y],141 + call draw_right_triangle + end_draw_play: + + +; button FORWARD + mov eax,8 + mov ebx,162*65536+20 + mov ecx,135*65536+20 + mov edx,9 + mov esi,COLOR_FUNC_BUTS + int 0x40 + mov [coord_x],167 + mov [coord_y],141 + call draw_right_triangle + mov [coord_x],172 + call draw_right_triangle + +; button RE-READ PLAYLIST + mov eax,8 + mov ebx,187*65536+20 + mov ecx,135*65536+20 + mov edx,4 + mov esi,COLOR_FUNC_BUTS + int 0x40 + mov [coord_x],192 + mov [coord_y],140 + call draw_vert_list_line + dec [coord_y] + call draw_hor_list_line + mov [coord_y], 151 + call draw_hor_list_line + mov [coord_x],202 + mov [coord_y],140 + call draw_vert_list_line + mov [coord_x],195 + mov [coord_y], 142 + call draw_str_list_line + mov [coord_y],145 + call draw_str_list_line + mov [coord_y],148 + call draw_str_list_line + + cmp [flag],1 + jne flag2 +;Draw tracs buttons + xor eax,eax + xor ebx,ebx + mov ecx,10 + mov al,[cdp+3] + mov [max_trk],al + xor edi,edi + mov di,ax + mov [posx],12 + mov [posy],32 + mov [tracs],1 + draw_tracs_buttons: + mov eax,8 + xor ebx,ebx + mov bl,[posx] + shl ebx,16 + add ebx,15 + xor ecx,ecx + mov cl,[posy] + shl ecx,16 + add ecx,15 + xor edx,edx + mov dx,[tracs] + add edx,10 + mov esi,0xaaaaaa + add esi,edi + int 0x40 + ;---draw tracs numbers + mov eax,47 + xor ebx,ebx + mov bl,0 + or ebx,0x20000 ;number of digits to draw + xor ecx,ecx + mov cx, [tracs] ;number to draw + xor edx,edx + mov dl,[posx] + add dl,3 + shl edx,16 + add dl,[posy] + add dl,5 + mov esi,0xffffff + int 0x40 + ;--- + mov al,[posx] + add al,20 + mov [posx],al + xor eax,eax + mov ax,[tracs] + mov bl,10 + div bl + cmp ah,0 + jnz no_new_str + mov al,[posxstart] + mov [posx], al + mov al,[posy] + add al,20 + mov [posy],al + no_new_str: + inc [tracs] + cmp [tracs],41 + je flag2 + dec edi + cmp edi,0 + jnz draw_tracs_buttons + + flag2: + cmp [flag],2 + jne flag3 + mov eax,4 + mov ebx, 20 shl 16 +67 + mov ecx,0xf0ffff00 + mov edx,define_cdrom + mov esi,define_cdrom_len-define_cdrom + int 0x40 + flag3: + cmp [flag],3 + jne flag4 + mov eax,4 + mov ebx, 47 shl 16 +67 + mov ecx,0xf0ffff00 + mov edx,no_cda + mov esi,no_cda_len-no_cda + int 0x40 + flag4: + cmp [flag],4 + jne flag5 + ;help screen + cmp [help_screen],1 + jnz @hs2 + mov edx,help1 + jmp @ehs + @hs2: + cmp [help_screen],2 + jnz @hs3 + mov edx,help2 + jmp @ehs + @hs3: + mov edx,help3 + @ehs: + xor edi,edi + mov ebx,25*65536+30 + new_line: + mov eax,4 + mov ecx,0x111111 + mov esi,31 + int 0x40 + noline: + add ebx,10 + add edx,31 + inc edi + cmp [edx],byte 'x' + jnz new_line + flag5: + call draw_info + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + +ret + +draw_right_triangle: + mov ebx,[coord_x] + mov ecx,[coord_y] + mov edx,0x00111111 + mov esi,5 + mov eax,9 + start_draw_pixel: + push ebx + cmp eax,5 + jb y_menshe_5 + mov esi,10 + sub esi,eax + jmp draw_pixel + y_menshe_5: + mov esi,eax + draw_pixel: + dec esi + inc ebx + push eax + mov eax,1 + int 0x40 + pop eax + cmp esi,0 + jne draw_pixel + pop ebx + dec eax + inc ecx + cmp eax,0 + jne start_draw_pixel +ret + +draw_square: + mov ebx,[coord_x] + mov ecx,[coord_y] + mov edx,0x00111111 + mov eax,7 + q_start_draw_pixel: + push ebx + mov esi,7 + q_draw_pixel: + dec esi + inc ebx + push eax + mov eax,1 + int 0x40 + pop eax + cmp esi,0 + jne q_draw_pixel + pop ebx + dec eax + inc ecx + cmp eax,0 + jne q_start_draw_pixel +ret + +draw_left_triangle: + mov ebx,[coord_x] + mov ecx,[coord_y] + mov edx,0x00111111 + mov esi,5 + mov eax,9 + l_start_draw_pixel: + push ebx + cmp eax,5 + jb l_y_menshe_5 + mov esi,10 + sub esi,eax + jmp l_draw_pixel + l_y_menshe_5: + mov esi,eax + l_draw_pixel: + dec esi + dec ebx + push eax + mov eax,1 + int 0x40 + pop eax + cmp esi,0 + jne l_draw_pixel + pop ebx + dec eax + inc ecx + cmp eax,0 + jne l_start_draw_pixel +ret + +draw_vertical_line: + mov eax,2 + mov ebx,[coord_x] + mov edx,0x00111111 + @@draw_2_line: + mov ecx,[coord_y] + dec ecx + mov esi,9 + start_draw_vline: + inc ecx + push eax + mov eax,1 + int 0x40 + pop eax + dec esi + cmp esi,0 + jne start_draw_vline + dec eax + inc ebx + cmp eax,0 + jne @@draw_2_line +ret + +draw_vert_list_line: + mov eax,1 + mov ebx,[coord_x] + mov edx,0x00111111 + mov ecx,[coord_y] + dec ecx + mov esi,11 + vlstart_draw_vline: + inc ecx + int 0x40 + dec esi + cmp esi,0 + jne vlstart_draw_vline + dec eax + inc ebx +ret + +draw_hor_list_line: + mov eax,1 + mov ebx,[coord_x] + mov edx,0x00111111 + mov ecx,[coord_y] + dec ebx + mov esi,11 + hlstart_draw_vline: + inc ebx + int 0x40 + dec esi + cmp esi,0 + jne hlstart_draw_vline + dec eax + inc ebx +ret + +draw_str_list_line: + mov eax,1 + mov ebx,[coord_x] + mov edx,0x00111111 + mov ecx,[coord_y] + dec ebx + mov esi,5 + slstart_draw_vline: + inc ebx + int 0x40 + dec esi + cmp esi,0 + jne slstart_draw_vline + dec eax + inc ebx +ret + + + chk_cdrom: + mov eax,24 + mov ebx,1 + int 0x40 + cmp eax,0 + je chk_cdrom_ok + mov [flag],2 + call draw_window + jmp chk_cdrom_end + chk_cdrom_ok: + mov [flag],0 + chk_cdrom_end: +ret + +read_cd: + mov [if_stopped],TRUE + push ax + cmp [flag],2 + je read_cd_end + mov al,101 + mov [cdp+3],al + mov eax,24 + mov ebx,2 + mov ecx, cdp + mov edx,321 + int 0x40 + mov [flag],1 + mov al,100 + cmp [cdp+3],al + jb read_cd_end + mov [flag],3 + call draw_window + read_cd_end: + pop ax +ret + +get_uptime: + push ebx + mov eax,26 + mov ebx,9 + int 0x40 + pop ebx +ret + +; DATA AREA + +paused_time dd 0 +if_paused db FALSE +coord_x dd 0 +coord_y dd 0 +flag db 0 +tracs dw 1 +posx db 12 +posy db 32 +posxstart db 12 +curr_trk db 0 +max_trk db 0 +stimtrk dd 0 +help_screen db 0 +next_pos_sec dd 0 +curr_trk_length dd 0 +curr_trk_pg_time dd 0 +was_it_ok db FALSE +if_stopped db FALSE +mode db NORMAL_PLAY + +shuftab db 00,01,02,03,04,05,06,07,08,09 + db 10,11,12,13,14,15,16,17,18,19 + db 20,21,22,23,24,25,26,27,28,29 + db 30,31,32,33,34,35,36,37,38,39 + db 40 + +but_mode_lab: db 'M' + +playing_time_info: db 'Time ' +slash db '/' +column db ':' +mode_normal db 'Normal ' +mode_repeat_1 db 'Rep trk' +mode_repeat_all db 'Rep all' +mode_shuffle db 'Shuffle' +playing_trk_info: db 'Track ' + +define_cdrom: db 'Please, define your CD-ROM' +define_cdrom_len: + +no_cda: db 'Audio CD not found' +no_cda_len: + +labelt: + db 'CD player' +labellen: + +help1: db 'HotKeys: ' + db 'H - this screen (Help) ' + db 'P - Play/Pause current track ' + db 'S - Stop playing ' + db 'L - re-read playList ' + db 'N - play Next track ' + db 'B - play previous track (Back) ' + db ' next ->' + db 'x' +help2: db 'HotKeys: ' + db 'F - fast Forward track ' + db 'R - fast Rewind track ' + db 'M - change Mode ' + db ' ' + db ' ' + db ' ' + db '<- prev next ->' + db 'x' +help3: db 'About: ' + db 'Audio CD Player ver 1.1beta-2 ' + db 'All questions, wishes and ' + db 'advices please send to: ' + db ' E-mail: dma@bn.by ' + db ' FidoNet: 2:450/258.75 ' + db ' ' + db '<- prev ' + db 'x' +cdp: + + I_END: diff --git a/programs/cdp/trunk/macros.inc b/programs/cdp/trunk/macros.inc new file mode 100644 index 0000000000..1d153e8723 --- /dev/null +++ b/programs/cdp/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 + +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 \ No newline at end of file diff --git a/programs/cdplay/trunk/build_en.bat b/programs/cdplay/trunk/build_en.bat new file mode 100644 index 0000000000..7ace3f3995 --- /dev/null +++ b/programs/cdplay/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm cdplay.asm cdplay +@pause \ No newline at end of file diff --git a/programs/cdplay/trunk/build_ru.bat b/programs/cdplay/trunk/build_ru.bat new file mode 100644 index 0000000000..dce6a76326 --- /dev/null +++ b/programs/cdplay/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm cdplay.asm cdplay +@pause \ No newline at end of file diff --git a/programs/cdplay/trunk/cdplay.asm b/programs/cdplay/trunk/cdplay.asm new file mode 100644 index 0000000000..b516cc4e55 --- /dev/null +++ b/programs/cdplay/trunk/cdplay.asm @@ -0,0 +1,482 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +; CD PLAYER - Compile with fasm +; + +use32 + + org 0x0 + db 'MENUET00' ; 8 byte id + dd 38 ; required os + dd START ; program start + dd I_END ; program image size + dd 0x1000 ; reguired amount of memory + dd 0x1000 + dd 0x00000000 ; reserved=no extended header + +include 'lang.inc' +include 'macros.inc' + +START: + + call draw_window + +still: + + mov eax,10 + 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,byte 41 + jnz nostop + call stop + jmp still + nostop: + + cmp ah,byte 42 + jnz nogetinfo + call getinfo + jmp still + nogetinfo: + + pusha + + cmp ah,100 + jnz err + + jmp noerr + + err: + + xor ecx,ecx + mov cl,ah + shl ecx,3 + add ecx,cdinfo + add ecx,1 + xor ebx,ebx + mov ebx,[ecx] + and ebx,0x00ffffff + mov ecx,ebx + + mov ebx,1 + mov eax,24 + int 0x40 + + cmp eax,0 + je noerr + + error: + + mov eax,13 + mov ebx,10*65536+215 + mov ecx,115*65536+13 + mov edx,0x0088aacc + int 0x40 + + mov eax,dword 0x00000004 ; write text + mov ebx,12*65536+117 + mov ecx,[tcolor] + mov edx,infotext2 + mov esi,itl2-infotext2 + int 0x40 + + mov eax,5 + mov ebx,200 + int 0x40 + + noerr: + + popa + + shr eax,8 + and eax,255 + mov ebx,0 + mov ecx,10 + + cmp eax,100 + jnz noend + mov eax,-1 + int 0x40 + noend: + + newc: + + cmp eax,ecx + jb dri + inc ebx + sub eax,ecx + + jmp newc + + + dri: + + mov ecx,48 + add ebx,ecx + mov [infotext+0],bl + add eax,ecx + mov [infotext+1],al + call drawinfo + jmp still + + +getinfo: + + mov eax,24 ; get info + mov ebx,1 + mov ecx,0x010100 + int 0x40 + + cmp eax,0 + jnz gierror + + mov eax,13 + mov ebx,10*65536+215 + mov ecx,115*65536+13 + mov edx,0x0088aacc + int 0x40 + mov eax,dword 0x00000004 ; write text + mov ebx,12*65536+117 + mov ecx,dword 0x00ffffff ; 8b window nro - RR GG BB color + mov edx,infotext3 ; pointer to text beginning + mov esi,itl3-infotext3 ; text length + int 0x40 + + mov eax,5 + mov ebx,100*10 + int 0x40 + + mov eax,24 ; get info + mov ebx,2 + mov ecx,cdinfo + mov edx,256 + int 0x40 + + cmp eax,0 + jz gi1 + + gierror: + + mov eax,13 + mov ebx,10*65536+215 + mov ecx,115*65536+13 + mov edx,0x0088aacc + int 0x40 + + mov eax,dword 0x00000004 ; write text + mov ebx,12*65536+117 + mov ecx,dword 0x00ffffff ; 8b window nro - RR GG BB color + mov edx,infotext2 ; pointer to text beginning + mov esi,itl2-infotext2 ; text length + int 0x40 + + mov eax,5 + mov ebx,200 + int 0x40 + + gi1: + + call drawinfo + ret + + + +stop: + + mov eax,24 ; get info + mov ebx,3 + int 0x40 + + ret + + + +; info bar + + +drawinfo: + + + ; end + + xor eax,eax + xor ebx,ebx + mov ecx,10 + mov al,[cdinfo+3] + cld + + newco: + + cmp eax,ecx + jb noco + + add ebx,1 + sub eax,ecx + jmp newco + + noco: + + add al,48 + mov [infotext+32],al + + add bl,48 + mov [infotext+31],bl + + + ; start + + xor eax,eax + xor ebx,ebx + mov al,[cdinfo+2] + cld + + newco2: + + cmp eax,ecx + jb noco2 + + add ebx,1 + sub eax,ecx + jmp newco2 + + noco2: + + add al,48 + mov [infotext+17],al + + add bl,48 + mov [infotext+16],bl + + mov eax,13 + mov ebx,10*65536+219 + mov ecx,115*65536+13 + mov edx,[col] + sub edx,0x101010 + int 0x40 + + mov eax,4 ; write text + mov ebx,12*65536+117 + mov ecx,dword 0x00ffffff ; 8b window nro - RR GG BB color + mov edx,infotext ; pointer to text beginning + mov esi,itl-infotext ; text length + int 0x40 + + ret + + +draw_window: + + pusha + + mov eax,12 ; tell os about redraw + mov ebx,1 + int 0x40 + + mov eax,0 ; define and draw window + mov ebx,170*65536+240 + mov ecx,40*65536+135 + mov edx,0x00b6aaff + mov esi,0x80b9aaff; bbee - 0x202020 + mov edi,0x00b9aaff ;bbee + mov edx,[col] + add edx,0x00000000 + mov esi,[col] + add esi,0x80000000 + mov edi,[col] + int 0x40 + + mov eax,4 ; write text + mov ebx,8*65536+8 + mov ecx,[tcolor] + mov edx,labelt + mov esi,labellen-labelt + int 0x40 + + mov eax,8 ; CLOSE BUTTON + mov ebx,(240-18)*65536+10 + mov ecx,6 *65536+10 + mov edx,100 + mov esi,[col] + sub esi,0x302010 + int 0x40 + + + ; first row + + mov eax,8 ; button + mov edx,1 ; button number + mov ebx,9*65536+21 ; button start x & size + mov ecx,30*65536+13 ; button start y & size + mov esi,[bcolor] ; button color + newbutton1: + pusha + int 0x40 + popa + + pusha + mov eax,dword 0x00000004 + and ebx,65535*65536 + shr ecx,16 + add ebx,ecx + add ebx,6*65536+3 + mov ecx,[tcolor] + shl edx,1 + add edx,nro-2 + mov esi,2 + int 0x40 + popa + + add ebx,22*65536 + inc edx + cmp edx,11 + jnz newbutton1 + + ; second row + + mov eax,8 ; button + mov edx,11 ; button number + mov ebx,9*65536+21 ; button start x & size + mov ecx,50*65536+13 ; button start y & size + mov esi,[bcolor] ; button color + newbutton2: + pusha + int 0x40 + popa + + pusha + mov eax,dword 0x00000004 + and ebx,65535*65536 + shr ecx,16 + add ebx,ecx + add ebx,6*65536+3 + mov ecx,[tcolor] + shl edx,1 + add edx,nro2-2-20 + mov esi,2 + int 0x40 + popa + + + add ebx,22*65536 + inc edx + cmp edx,21 + jnz newbutton2 + + ; third row + + mov eax,8 ; button + mov edx,21 ; button number + mov ebx,9*65536+21 ; button start x & size + mov ecx,70*65536+13 ; button start y & size + mov esi,[bcolor] ; button color + newbutton3: + pusha + int 0x40 + popa + + pusha + mov eax,dword 0x00000004 + and ebx,65535*65536 + shr ecx,16 + add ebx,ecx + add ebx,6*65536+3 + mov ecx,[tcolor] + shl edx,1 + add edx,nro3-2-40 + mov esi,2 + int 0x40 + popa + + add ebx,22*65536 + inc edx + cmp edx,31 + jnz newbutton3 + + + ; fourth row + + mov eax,8 ; button + mov edx,41 ; button number + mov ebx,9*65536+109 ; button start x & size + mov ecx,90*65536+13 ; button start y & size + mov esi,0x00aabbcc ; button color + newbutton4: + pusha + int 0x40 + popa + + pusha + mov eax,4 + and ebx,65535*65536 + shr ecx,16 + add ebx,ecx + add ebx,9*65536+3 + mov ecx,[tcolor] + sub edx,41 + shl edx,4 + add edx,text + mov esi,16 + int 0x40 + popa + + add ebx,110*65536 + inc edx + cmp edx,43 + jnz newbutton4 + + call drawinfo + + mov eax,12 ; tell os about redraw end + mov ebx,2 + int 0x40 + + popa + ret + + + + +; DATA AREA + +col dd 0x7777aa +tcolor dd 0xffffff +bcolor dd 0xaabbcc +labelt: db 'CD PLAYER' +labellen: +infotext: db '01 First Track: xx Last Track: xx ' +itl: +infotext2: db 'DEFINE CD ROM BASE WITH SETUP ' +itl2: +infotext3: db 'READING PLAYLIST - (10 secs) ' +itl3: +nro: db '01020304050607080910' +nro2: db '11121314151617181920' +nro3: db '21222324252627282930' +text: db ' STOP READ PLAYLIST ' + +cdinfo: + +I_END: + + + diff --git a/programs/cdplay/trunk/macros.inc b/programs/cdplay/trunk/macros.inc new file mode 100644 index 0000000000..1d153e8723 --- /dev/null +++ b/programs/cdplay/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 + +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 \ No newline at end of file diff --git a/programs/chess/trunk/build_en.bat b/programs/chess/trunk/build_en.bat new file mode 100644 index 0000000000..23af6720c4 --- /dev/null +++ b/programs/chess/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm chess.asm chess +@pause \ No newline at end of file diff --git a/programs/chess/trunk/build_ru.bat b/programs/chess/trunk/build_ru.bat new file mode 100644 index 0000000000..08382a83c7 --- /dev/null +++ b/programs/chess/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm chess.asm chess +@pause \ No newline at end of file diff --git a/programs/chess/trunk/chess.asm b/programs/chess/trunk/chess.asm new file mode 100644 index 0000000000..710526e2e8 --- /dev/null +++ b/programs/chess/trunk/chess.asm @@ -0,0 +1,1323 @@ +; +; CHESS CLIENT for CHESSCLUB.COM (VT) +; +; 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 0x100000 ; required amount of memory + ; esp = 0x7FFF0 + dd 0x00000000 ; reserved=no extended header + +include 'lang.inc' +include 'macros.inc' + +file_info: + + dd 0,0,-1,0x4000,0x20000 + db '/rd/1/chess.bmp',0 + +pawn_color: + + dd 0x000000 + dd 0x222222 + dd 0x444444 + dd 0xf0f0f0 + dd 0xc0c0c0 + dd 0xa0a0a0 + dd 0xa0a0a0 + dd 0x707070 + dd 0xb0b0b0 + dd 0xc0c0c0 + dd 0xd0d0d0 + dd 0xd8d8d8 + dd 0xe0e0e0 + dd 0xe8e8e8 + dd 0x00ff00 + dd 0xffffff + + + +texts equ board_old+80*30 + +text equ texts+80*32*4 + + +START: ; start of execution + + mov eax,58 + mov ebx,file_info + int 0x40 + + mov esi,0x4000+22*3+4+24*2 + mov edi,0x10000+18*3 + + mov ebx,0 + mov ecx,0 + + newp: + + xor eax,eax + mov al,[esi] + and al,0xf0 + shr al,4 + shl eax,2 + mov eax,[pawn_color+eax] + mov [edi+0],eax + + xor eax,eax + mov al,[esi] + and al,0x0f + shl eax,2 + mov eax,[pawn_color+eax] + mov [edi+3],eax + + add edi,6 + add esi,1 + + inc ebx + cmp ebx,23 + jbe newp + + sub edi,12 + + mov ebx,0 + + inc ecx + cmp ecx,279 + jb newp + + ; Clear the screen memory + mov eax, ' ' + mov edi,text + mov ecx,80*30 /4 + cld + rep stosd + + + call draw_window + +still: + + call check_for_board + + call board_changed + + call draw_board + + ; check connection status + mov eax,53 + mov ebx,6 + mov ecx,[socket] + int 0x40 + + mov ebx, [socket_status] + mov [socket_status], eax + + cmp eax, ebx + je waitev + + call display_status + +waitev: + mov eax,23 ; wait here for event + mov ebx,20 + 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 + + ; any data from the socket? + + mov eax, 53 + mov ebx, 2 + mov ecx, [socket] + int 0x40 + cmp eax, 0 + jne read_input + + jmp still + + +read_input: + + push ecx + mov eax, 53 + mov ebx, 3 + mov ecx, [socket] + int 0x40 + pop ecx + + call handle_data + + push ecx + mov eax, 53 + mov ebx, 2 + mov ecx, [socket] + int 0x40 + pop ecx + cmp eax, 0 + + + jne read_input + call draw_text + jmp still + + + +check_for_board: + + pusha + + mov esi,text-80 + news: + add esi,80 + cmp esi,text+80*10 + je board_not_found + cmp [esi+12],dword '----' + je cfb1 + jmp news + cfb1: + cmp [esi+16*80+12],dword '----' + je cfb2 + jmp news + cfb2: + cmp [esi+2*80+12],dword '+---' + jne news + + cmp [esi+4*80+12],dword '+---' + jne news + + board_found: + + mov edi,chess_board + mov ecx,80*18 + cld + rep movsb + + board_not_found: + + popa + + ret + + +yst dd 150 +textx equ 10 +ysts equ 410 + +boardx dd 45 +boardy dd 45 + +boardxs dd 44 +boardys dd 44 + +conx equ 420 +cony equ 118 + +dconx equ 420 +dcony equ 148 + +statusx equ 420 +statusy equ 178 + + +drsq: + + push eax ebx + + mov ecx,ebx + mov ebx,eax + + mov eax,ebx + add eax,ecx + + imul ebx,[boardxs] + add ebx,[boardx] + shl ebx,16 + imul ecx,[boardys] + add ecx,[boardy] + shl ecx,16 + + add ebx,[boardxs] + add ecx,[boardys] + + mov edx,[sq_black] + test eax,1 + jnz dbl22 + mov edx,[sq_white] + dbl22: + + mov eax,13 + int 0x40 + + pop ebx eax + + ret + + + +draw_pawn: + +; edi,0 ; white / black +; esi,0 ; from position 2 , 20 square +; eax,2 ; board x +; ebx,0 ; board y + + pusha + + call drsq + + cmp esi,20 + jne no_sqd + + popa + ret + + no_sqd: + + imul eax,[boardxs] + imul ebx,[boardys] + + add eax,[boardx] + add ebx,[boardy] + + imul esi,44*45*3 + add esi,0x10000+18*3 + + mov ecx,43 + + dp0: + + pusha + + mov ecx,44 + + ldp1: + + pusha + + mov ecx,ebx + mov ebx,eax + + mov edx,[esi] + and edx,0xffffff + mov eax,1 + cmp edx,0x00ff00 + je nowp + cmp edi,1 + jne nobl + shr edx,1 + and edx,0x7f7f7f + nobl: + int 0x40 + nowp: + + popa + + add esi,3 + add eax,1 + + dec ecx + jnz ldp1 + + popa + + add ebx,1 + add esi,3*44 + + dec ecx + jnz dp0 + + popa + + ret + + +board_changed: + + pusha + + mov eax,0 + mov esi,chess_board + bcl1: + add eax,[esi] + add esi,4 + cmp esi,chess_board+19*80 + jb bcl1 + + cmp eax,[checksum] + je bcl2 + mov [changed],1 + bcl2: + mov [checksum],eax + + popa + + ret + + + +checksum dd 0 + +changed db 1 + +draw_board: + + pusha + + cmp [changed],1 + jne no_change_in_board + + mov [changed],0 + + mov eax,0 + mov ebx,0 + scan_board: + + push eax ebx + + mov esi,ebx + imul esi,2 + imul esi,80 + add esi,80 + + imul eax,4 + add eax,10 + + add esi,eax + + movzx edx,word [chess_board+esi] + cmp dx,[board_old+esi] + je empty_slot + + mov ecx,13 + newseek2: + mov edi,ecx + imul edi,8 + sub edi,8 + cmp dx,[edi+nappulat] + je foundnappula2 + loop newseek2 + + jmp empty_slot + + foundnappula2: + + mov esi,[edi+nappulat+4] + mov edi,0 + cmp dl,'*' + jne nnbb + mov edi,1 + nnbb: + mov eax,[esp+4] + mov ebx,[esp] + call draw_pawn + + empty_slot: + + pop ebx eax + + inc eax + cmp eax,8 + jb scan_board + mov eax,0 + inc ebx + cmp ebx,8 + jb scan_board + + mov esi,chess_board + mov edi,board_old + mov ecx,80*19 + cld + rep movsb + + mov eax,13 + mov ebx,[boardx] + sub ebx,14 + shl ebx,16 + add ebx,8 + mov ecx,[boardy] + shl ecx,16 + add ecx,46*8 + mov edx,[wcolor] + int 0x40 + + mov eax,4 ; numbers at left + mov ebx,[boardx] + sub ebx,14 + shl ebx,16 + add ebx,[boardy] + add ebx,18 + mov ecx,[tcolor] + mov edx,chess_board+80+5 + mov esi,3 + db1: + int 0x40 + add edx,80*2 + add ebx,[boardxs] + cmp edx,chess_board+80*16 + jb db1 + + mov eax,13 + mov ebx,[boardx] + shl ebx,16 + add ebx,8*46 + mov ecx,[boardys] + imul ecx,8 + add ecx,[boardy] + add ecx,8 + shl ecx,16 + add ecx,10 + mov edx,[wcolor] + int 0x40 + + mov eax,4 ; letters at bottom + mov ebx,[boardx] + add ebx,3 + shl ebx,16 + mov bx,word [boardys] + imul bx,8 + add ebx,[boardy] + add ebx,8 + mov ecx,[tcolor] + mov edx,chess_board+80*17+8 + mov esi,4 + db3: + int 0x40 + mov edi,[boardxs] + shl edi,16 + add ebx,edi + add edx,4 + cmp edx,chess_board+80*17+8+4*8 + jb db3 + + ; print player times + + mov edi,74 + cmp [chess_board+80+5],byte '1' + jne nowww2 + mov edi,371 + nowww2: + + mov eax,13 + mov ebx,(conx)*65536+100 + mov ecx,edi + shl ecx,16 + add ecx,10 + mov edx,[wcolor] + int 0x40 + + mov eax,4 + mov ebx,(conx)*65536 + add ebx,edi + mov ecx,[tcolor] + mov edx,chess_board+80*7+59-1 + mov esi,20 + int 0x40 + + mov edi,74 + cmp [chess_board+80+5],byte '1' + je nowww + mov edi,371 + nowww: + + mov eax,13 + mov ebx,(conx)*65536+100 + mov ecx,edi + shl ecx,16 + add ecx,10 + mov edx,[wcolor] + int 0x40 + + mov eax,4 + mov ebx,(conx)*65536 + add ebx,edi + mov ecx,[tcolor] + mov edx,chess_board+80*9+59-1 + mov esi,20 + int 0x40 + + ; move # + + mov eax,13 + mov ebx,conx*65536+120 + mov ecx,200*65536+10 + mov edx,[wcolor] + int 0x40 + + mov eax,4 + mov ebx,conx*65536 + add ebx,200 + mov ecx,[tcolor] + mov edx,chess_board+80*1+46 + mov esi,30 + int 0x40 + + no_change_in_board: + + popa + + ret + + +handle_data: + ; Telnet servers will want to negotiate options about our terminal window + ; just reject them all. + ; Telnet options start with the byte 0xff and are 3 bytes long. + + mov al, [telnetstate] + cmp al, 0 + je state0 + cmp al, 1 + je state1 + cmp al, 2 + je state2 + jmp hd001 + +state0: + cmp bl, 255 + jne hd001 + mov al, 1 + mov [telnetstate], al + ret + +state1: + mov al, 2 + mov [telnetstate], al + ret + +state2: + mov al, 0 + mov [telnetstate], al + mov [telnetrep+2], bl + + mov edx, 3 + mov eax,53 + mov ebx,7 + mov ecx,[socket] + mov esi, telnetrep + int 0x40 + ret + +hd001: + cmp bl,13 ; BEGINNING OF LINE + jne nobol + mov ecx,[pos] + add ecx,1 + boll1: + sub ecx,1 + mov eax,ecx + xor edx,edx + mov ebx,80 + div ebx + cmp edx,0 + jne boll1 + mov [pos],ecx + + call check_for_board + + jmp newdata + nobol: + + cmp bl,10 ; LINE DOWN + jne nolf + addx1: + add [pos],dword 1 + mov eax,[pos] + xor edx,edx + mov ecx,80 + div ecx + cmp edx,0 + jnz addx1 + mov eax,[pos] + jmp cm1 + nolf: + + cmp bl,9 ; TAB + jne notab + add [pos],dword 8 + jmp newdata + notab: + + cmp bl,8 ; BACKSPACE + jne nobasp + mov eax,[pos] + dec eax + mov [pos],eax + mov [eax+text],byte 32 + mov [eax+text+60*80],byte 0 + jmp newdata + nobasp: + + cmp bl,15 ; CHARACTER + jbe newdata + mov eax,[pos] + mov [eax+text],bl + mov eax,[pos] + add eax,1 + cm1: + mov ebx,[scroll+4] + imul ebx,80 + cmp eax,ebx + jb noeaxz + mov esi,text+80 + mov edi,text + mov ecx,ebx + cld + rep movsb + mov eax,ebx + sub eax,80 + noeaxz: + mov [pos],eax + newdata: + ret + + + red: ; REDRAW WINDOW + call draw_window + jmp still + + key: ; KEY + mov eax,2 ; send to modem + int 0x40 + + mov ebx, [socket_status] + cmp ebx, 4 ; connection open? + jne still ; no, so ignore key + + shr eax,8 + cmp eax,178 ; ARROW KEYS + jne noaup + mov al,'A' + call arrow + jmp still + noaup: + cmp eax,177 + jne noadown + mov al,'B' + call arrow + jmp still + noadown: + cmp eax,179 + jne noaright + mov al,'C' + call arrow + jmp still + noaright: + cmp eax,176 + jne noaleft + mov al,'D' + call arrow + jmp still + noaleft: + modem_out: + + call to_modem + + jmp still + + button: ; BUTTON + mov eax,17 + int 0x40 + cmp ah,1 ; CLOSE PROGRAM + jne noclose + + mov eax,53 + mov ebx,8 + mov ecx,[socket] + int 0x40 + + mov eax,-1 + int 0x40 + noclose: + + cmp ah, 4 ; connect + jne notcon + + mov eax, [socket_status] + cmp eax, 4 + je still + call connect + + jmp still + +notcon: + cmp ah,5 ; disconnect + jne notdiscon + + call disconnect + jmp still + + notdiscon: + + jmp still + +arrow: + + push eax + mov al,27 + call to_modem + mov al,'[' + call to_modem + pop eax + call to_modem + + ret + + +to_modem: + pusha + push ax + mov [tx_buff], al + mov edx, 1 + cmp al, 13 + jne tm_000 + mov edx, 2 +tm_000: + mov eax,53 + mov ebx,7 + mov ecx,[socket] + mov esi, tx_buff + int 0x40 + pop bx + mov al, [echo] + cmp al, 0 + je tm_001 + + push bx + call handle_data + pop bx + + cmp bl, 13 + jne tm_002 + + mov bl, 10 + call handle_data + +tm_002: + call draw_text + +tm_001: + popa + ret + + + +disconnect: + mov eax,53 + mov ebx,8 + mov ecx,[socket] + int 0x40 + ret + + + +connect: + pusha + + mov ecx, 1000 ; local port starting at 1000 + +getlp: + inc ecx + push ecx + mov eax, 53 + mov ebx, 9 + int 0x40 + pop ecx + cmp eax, 0 ; is this local port in use? + jz getlp ; yes - so try next + + mov eax,53 + mov ebx,5 + mov dl, [ip_address + 3] + shl edx, 8 + mov dl, [ip_address + 2] + shl edx, 8 + mov dl, [ip_address + 1] + shl edx, 8 + mov dl, [ip_address] + mov esi, edx + movzx edx, word [port] ; telnet port id + mov edi,1 ; active open + int 0x40 + mov [socket], eax + + popa + + ret + + + +; ********************************************* +; ******* WINDOW DEFINITIONS AND DRAW ******** +; ********************************************* + + +draw_window: + + pusha + + mov eax,12 + mov ebx,1 + int 0x40 + + mov eax,14 + int 0x40 + + mov ebx,eax + mov ecx,eax + + shr ebx,16 + and ebx,0xffff + and ecx,0xffff + + shr ebx,1 + shr ecx,1 + + sub ebx,275 + sub ecx,235 + + shl ebx,16 + shl ecx,16 + + mov eax,0 ; DRAW WINDOW + mov bx,550 + mov cx,470 + mov edx,[wcolor] + add edx,0x03000000 + mov esi,0x80557799 + mov edi,0x00557799 + int 0x40 + + mov eax,4 ; WINDOW LABEL + mov ebx,8*65536+8 + mov ecx,0x10ffffff + mov edx,labelt + mov esi,labellen-labelt + int 0x40 + + call display_status + + mov eax,8 ; BUTTON 4: Connect + mov ebx,conx*65536+80 + mov ecx,cony*65536+15 + mov esi,[wbutton] + mov edx,4 + int 0x40 + mov eax,4 ; Button text + mov ebx,(conx+4)*65536+cony+4 + mov ecx,0xffffff + mov edx,cont + mov esi,conlen-cont + int 0x40 + + + mov eax,8 ; BUTTON 5: disconnect + mov ebx,dconx*65536+80 + mov ecx,dcony*65536+15 + mov edx,5 + mov esi,[wbutton] + int 0x40 + mov eax,4 ; Button text + mov ebx,(dconx+4)*65536+dcony+4 + mov ecx,0x00ffffff + mov edx,dist + mov esi,dislen-dist + int 0x40 + + + xor eax,eax + mov edi,text+80*30 + mov ecx,80*30 /4 + cld + rep stosd + + call draw_text + + mov [changed],1 + + mov edi,board_old + mov ecx,80*19 + mov al,0 + cld + rep stosb + + mov eax,4 + mov ebx,conx*65536+52 + mov ecx,[tcolor] + mov edx,quick_start + mov esi,30 + + prqs: + + int 0x40 + add ebx,10 + add edx,30 + cmp [edx],byte 'x' + jne prqs + + mov eax,12 + mov ebx,2 + int 0x40 + + popa + + ret + + +display_status: + + pusha + + ; draw status bar + mov eax, 13 + mov ebx, statusx*65536+80 + mov ecx, statusy*65536 + 16 + mov edx, [wcolor] + int 0x40 + + mov esi,contlen-contt ; display connected status + mov edx, contt + mov eax, [socket_status] + cmp eax, 4 ; 4 is connected + je pcon + mov esi,discontlen-discontt + mov edx, discontt + pcon: + mov eax,4 ; status text + mov ebx,statusx*65536+statusy+2 + mov ecx,[tcolor] + int 0x40 + + popa + ret + + +nappulat: + + dd '*P ',5 + dd '*K ',3 + dd '*Q ',4 + dd '*R ',0 + dd '*N ',1 + dd '*B ',2 + + dd ' ',20 + + dd 'P ',5 + dd 'K ',3 + dd 'Q ',4 + dd 'R ',0 + dd 'N ',1 + dd 'B ',2 + + +row dd 0x0 +col dd 0x0 + + + +draw_text: + + mov esi,text+80*24 + mov edi,texts+80*3 + + dtl1: + + cmp [esi],dword 'logi' + je add_text + cmp [esi],dword 'aics' + je add_text + cmp [esi],dword 'You ' + je add_text + cmp [esi],dword 'Your' + je add_text + cmp [esi],dword 'Game' + je add_text + cmp [esi],dword 'Ille' + je add_text + cmp [esi],dword 'No s' + je add_text + + sub esi,80 + cmp esi,text + jge dtl1 + + dtl2: + + mov eax,13 + mov ebx,10*65536+532 + mov ecx,420*65536+40 + mov edx,[wtcom] + int 0x40 + + mov eax,4 + mov ebx,10*65536+420 + mov ecx,[wtxt] + mov edx,texts + mov esi,80 + + dtl3: + + int 0x40 + add edx,80 + add ebx,10 + cmp edx,texts+4*80 + jb dtl3 + + ret + + add_text: + + pusha + + cld + mov ecx,80 + rep movsb + + popa + + + sub esi,80 + sub edi,80 + + cmp edi,texts + jb dtl2 + + jmp dtl1 + + +read_string: + + mov edi,string + mov eax,'_' + mov ecx,[string_length] + inc ecx + cld + rep stosb + call print_text + + mov edi,string + f11: + mov eax,10 + int 0x40 + cmp eax,2 + jne read_done + mov eax,2 + int 0x40 + shr eax,8 + cmp eax,13 + je read_done + cmp eax,8 + jnz nobsl + cmp edi,string + jz f11 + sub edi,1 + mov [edi],byte '_' + call print_text + jmp f11 + nobsl: + cmp eax,dword 31 + jbe f11 + cmp eax,dword 95 + jb keyok + sub eax,32 + keyok: + mov [edi],al + call print_text + + inc edi + mov esi,string + add esi,[string_length] + cmp esi,edi + jnz f11 + + read_done: + + call print_text + + ret + + +print_text: + + pusha + + mov eax,13 + mov ebx,[string_x] + shl ebx,16 + add ebx,[string_length] + imul bx,6 + mov ecx,[string_y] + shl ecx,16 + mov cx,8 + mov edx,[wcolor] + int 0x40 + + mov eax,4 + mov ebx,[string_x] + shl ebx,16 + add ebx,[string_y] + mov ecx,[tcolor] + mov edx,string + mov esi,[string_length] + int 0x40 + + popa + ret + + + + +; DATA AREA + +telnetrep db 0xff,0xfc,0x00 +telnetstate db 0 + +string_length dd 16 +string_x dd 200 +string_y dd 60 + +string db '________________' + +tx_buff db 0, 10 +ip_address db 204,178,125,65 +port dw 5051 ; 0,0 +echo db 1 +socket dd 0x0 +socket_status dd 0x0 +pos dd 80 * 22 +scroll dd 1 + dd 24 + +wbutton dd 0x336688 + +wtcom dd 0x336688 ; 0x666666 +wtxt dd 0xffffff + +wcolor dd 0xe0e0e0 +tcolor dd 0x000000 + +sq_black dd 0x336688 ; 666666 +sq_white dd 0xffffff + +labelt db 'Chess Client for Chessclub.com - v0.1' +labellen: +setipt db ' . . .' +setiplen: +setportt db ' ' +setportlen: +cont db 'Connect' +conlen: +dist db 'Disconnect' +dislen: +contt db 'Connected' +contlen: +discontt db 'Disconnected' +discontlen: +echot db 'Echo On' +echolen: +echoot db 'Echo Off' +echoolen: + +quick_start: + + db '( OPPONENT ) ' + + times 16 db ' 1' + + db 'Quick start: ' + db ' ' + db '1 Connect ' + db '2 login: "guest" ' + db '3 aics% "seek 10 0" ' + db ' (for a player) ' + db ' (wait) ' + db '4 Play eg. "e7e5" ' + db ' or "d2d4" ' + db '5 aics% "resign" ' + db ' (quit game) ' + db '6 Disconnect ' + + times 5 db ' ' + + db '( YOU ) ' + + db 'x' + + +chess_board: + + times 80 db 0 + + db ' 8 *R *N *B *Q *K *B *N *R' + db ' ' + + times 80 db 0 + + db ' 7 *P *P *P *P *P *P *P *P' + db ' ' + + times 80 db 0 + + db ' 6 ' + db ' ' + + times 80 db 0 + + db ' 5 ' + db ' ' + + times 80 db 0 + + db ' 4 ' + db ' ' + + times 80 db 0 + + db ' 3 ' + db ' ' + + times 80 db 0 + + db ' 2 P P P P P P P P ' + db ' ' + + times 80 db 0 + + db ' 1 R N B Q K B N R ' + db ' ' + + times 80 db 0 + + db ' a b c d e f g h ' + db ' ' + + + times 80*20 db 0 + +board_old: + + +I_END: + + + + + + + + + diff --git a/programs/chess/trunk/macros.inc b/programs/chess/trunk/macros.inc new file mode 100644 index 0000000000..1d153e8723 --- /dev/null +++ b/programs/chess/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 + +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 \ No newline at end of file diff --git a/programs/circle/trunk/build_en.bat b/programs/circle/trunk/build_en.bat new file mode 100644 index 0000000000..ced4751a63 --- /dev/null +++ b/programs/circle/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm circle.asm circle +@pause \ No newline at end of file diff --git a/programs/circle/trunk/build_ru.bat b/programs/circle/trunk/build_ru.bat new file mode 100644 index 0000000000..3b3d4fd6b5 --- /dev/null +++ b/programs/circle/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm circle.asm circle +@pause \ No newline at end of file diff --git a/programs/circle/trunk/circle.asm b/programs/circle/trunk/circle.asm new file mode 100644 index 0000000000..2940c8cad5 --- /dev/null +++ b/programs/circle/trunk/circle.asm @@ -0,0 +1,167 @@ +; +; SHAPED WINDOW - BASIC EXAMPLE +; +; 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 + + call shape_window ; function for shaping + + call draw_window ; at first, draw the 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 + + 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 ? + jne noclose + mov eax,-1 ; close this program + int 0x40 + noclose: + + jmp still + + +shape_window: + + pusha + + mov eax,50 ; give the shape reference area + mov ebx,0 + mov ecx,shape_reference + int 0x40 + + mov eax,50 ; give the shape scale 32 x 32 -> 128 x 128 + mov ebx,1 ; you dont have to give this, scale is 1:1 by default + mov ecx,2 + int 0x40 + + popa + + ret + + +shape_reference: ; 32 x 32 ( window_size_X + 1 ) * ( window_size_Y + 1 ) + + db 0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0 + db 0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0 + db 0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0 + db 0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0 + db 0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0 + db 0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0 + db 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 + db 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0 + db 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0 + db 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0 + db 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 + db 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 + db 0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0 + db 0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0 + db 0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0 + db 0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0 + db 0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0 + db 0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,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 ; [x start] *65536 + [x size] + mov ecx,100*65536 ; [y start] *65536 + [y size] + mov bx,word [x_size] + mov cx,word [y_size] + mov edx,0x00cccc00 ; color of work area RRGGBB,8->color glide + mov esi,0x00cccc00 ; color of grab bar RRGGBB,8->color glide + mov edi,0x00cccc00 ; color of frames RRGGBB + int 0x40 + + + ; CLOSE BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,78*65536+12 ; [x start] *65536 + [x size] + mov ecx,20*65536+12 ; [y start] *65536 + [y size] + mov edx,1 ; button id + mov esi,0x5599cc ; button color RRGGBB + int 0x40 + + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + + ret + + +; DATA AREA + + +x_size dd 127 +y_size dd 127 + + +I_END: diff --git a/programs/circle/trunk/macros.inc b/programs/circle/trunk/macros.inc new file mode 100644 index 0000000000..1d153e8723 --- /dev/null +++ b/programs/circle/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 + +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 \ No newline at end of file diff --git a/programs/cmd/trunk/build_en.bat b/programs/cmd/trunk/build_en.bat new file mode 100644 index 0000000000..62fc18d5cd --- /dev/null +++ b/programs/cmd/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm cmd.asm cmd +@pause \ No newline at end of file diff --git a/programs/cmd/trunk/build_ru.bat b/programs/cmd/trunk/build_ru.bat new file mode 100644 index 0000000000..89781135cb --- /dev/null +++ b/programs/cmd/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm cmd.asm cmd +@pause \ No newline at end of file diff --git a/programs/cmd/trunk/cmd.asm b/programs/cmd/trunk/cmd.asm new file mode 100644 index 0000000000..9c934d07cf --- /dev/null +++ b/programs/cmd/trunk/cmd.asm @@ -0,0 +1,2967 @@ +; CMD - Command line interpreter +; copyleft Chemist dmitry_gt@tut.by +; +; Compile with FASM for Menuet +; +; + +use32 + + org 0x0 + + db 'MENUET01' + dd 0x01 + dd START + dd I_END + dd 0x300000 + dd 0x7fff0 + dd 0x0 + dd 0x0 + +include "macros.inc" + +START: + + call cmdexist + call draw + call fill + call clearcmd + call autoexec + call ppr + call cursor + +still: + + mov eax,10 + int 0x40 + + cmp eax,1 + je re + cmp eax,2 + je key + cmp eax,3 + je button + + jmp still + +button: + mov eax,17 + int 0x40 + + cmp ah,1 + jne noclose + + jmp exit + +noclose: + jmp still + +re: + call draw + call red + jmp still + +red: + call cls1 + + mov dword [xpos],24 + + mov dword [linev],2000 + + mov eax,dword [ypos] + push eax + + mov dword [ypos],6 + + mov ecx,dword [lpress] +loop1: + push ecx + mov eax,4 + mov ebx,[ypos] + shl ebx,16 + add ebx,[xpos] + mov ecx,0x00ddeeff + mov edx,tic_table + add edx,dword [linev] + mov esi,81 + int 0x40 + add dword [xpos],10 + add dword [linev],81 + pop ecx + loop loop1 + + sub dword [xpos],10 + +no_line: + pop eax + mov dword [ypos],eax + +no_red: + ret + +key: + mov eax,2 + int 0x40 + + cmp ah,27 + jne no_escape + + mov dword [ypos],42 + call clearstr + call ppr + mov dword [count],0 + call cursor + jmp still + +no_escape: + cmp ah,178 + jne no_aup + cmp dword [count],0 + jne no_aup + cmp dword [oldcount],0 + je no_aup + + call clearsum + sub dword [ypos],6 + + cld + mov ecx,81 + mov edi,tic_table+600 + mov esi,tic_table+900 + rep movsb + + cld + mov ecx,dword [oldcount] + mov edi,tic_table + add edi,dword [linen] + mov esi,tic_table+600 + rep movsb + + call red + + mov eax,dword [oldcount] + mov dword [count],eax + + add dword [linen],eax + add dword [linel],eax + + mov ebx,6 + imul ebx,eax + + add dword [ypos],ebx + + call cursor + + jmp still + +no_aup: + cmp ah,8 + jne no_backspace + cmp dword [count],0 + je still + + cmp dword [count],0 + je no_backspace + + call clearsum + sub dword [ypos],12 + call clearsum + sub dword [ypos],6 + call cursor + dec dword [count] + jmp still + +no_backspace: + cmp ah,13 + jne no_enter + + cmp dword [count],0 + jne enter_ok + call clearsum + jmp ecmd2 + +enter_ok: + call checkcmd + + cmp byte [tic_table+600],'/' + jne no_script + cmp dword [count],1 + je nparam5 + + jmp command + +no_script: + + call oldcmd + + call checkprg + + jmp ecmd2 + +no_enter: + + cmp ah,176 ; Arrow keys, HOME, END, and DEL are unsupported now + je still + cmp ah,179 + je still + cmp ah,177 + je still + cmp ah,178 + je still + cmp ah,182 + je still + cmp ah,180 + je still + cmp ah,181 + je still + + cmp dword [count],74 + je still + + mov byte [smb],ah + + mov edi,tic_table+600 + add edi,dword [count] + mov esi,smb + movsb + + inc dword [count] + + call clearsum + sub dword [ypos],6 + call print + add dword [ypos],6 + call cursor + + jmp still + +clearstr: + mov dword [ypos],6 + mov dword [clr],480 + call clear + + mov eax,dword [linel] + sub dword [linen],eax + mov dword [linel],0 + + mov ecx,eax + push eax +loop4: + push ecx + mov edi,tic_table + add edi,dword [linen] + mov esi,fill1 + movsb + + inc dword [linen] + pop ecx + loop loop4 + + pop eax + sub dword [linen],eax + + mov dword [ypos],42 + + ret + +clearsum: + mov dword [clr],6 + call clear + + dec dword [linen] + dec dword [linel] + + mov edi,tic_table + add edi,dword [linen] + mov esi,fill1 + movsb + + ret + +clear: + mov eax,13 + mov ebx,[ypos] + shl ebx,16 + add ebx,[clr] + mov ecx,[xpos] + shl ecx,16 + add ecx,9 + mov edx,0 + int 0x40 + add dword [ypos],6 + ret + +draw: + + mov eax,12 + mov ebx,1 + int 0x40 + + mov eax,0 + mov ebx,100*65536+492 + mov ecx,100*65536+280 + mov edx,0 + mov esi,0x805080d0 + mov edi,0x005080d0 + int 0x40 + + mov eax,4 + mov ebx,8*65536+8 + mov ecx,0x10ddeeff + mov edx,title + mov esi,title_end-title + int 0x40 + + mov eax,8 + mov ebx,(492-19)*65536+12 + mov ecx,5*65536+12 + mov edx,1 + mov esi,0x6688dd + int 0x40 + + mov eax,12 + mov ebx,2 + int 0x40 + + ret + +print: + mov eax,4 + mov ebx,[ypos] + shl ebx,16 + add ebx,[xpos] + mov ecx,0x00ddeeff + mov edx,smb + mov esi,1 + int 0x40 + + mov edi,tic_table + add edi,dword [linen] + mov esi,smb + movsb + inc dword [linen] + inc dword [linel] + + ret + +cursor: + mov eax,4 + mov ebx,[ypos] + shl ebx,16 + add ebx,[xpos] + mov ecx,0x00ddeeff + mov edx,smb_cursor + mov esi,1 + int 0x40 + + mov edi,tic_table + mov esi,smb_cursor + add edi,dword [linen] + movsb + inc dword [linen] + inc dword [linel] + + ret + +ppr: + mov eax,4 + mov ebx,6 + shl ebx,16 + add ebx,[xpos] + mov ecx,0x00ddeeff + mov edx,prompt + mov esi,5 + int 0x40 + mov dword [ypos],42 + + cld + mov ecx,5 + mov edi,tic_table + add edi,dword [linen] + mov esi,prompt + rep movsb + + add dword [linen],6 + add dword [linel],6 + + ret + +help: + cmp byte [callp],1 + je gonext8 + call clearsum +gonext8: + call newline + call newline + mov edx,h1 + call printf + call newline + mov edx,h2 + call printf + call newline + call newline + mov edx,h3 + call printf + call newline + call newline + mov edx,h4 + call printf + call newline + mov edx,h5 + call printf + call newline + mov edx,h6 + call printf + call newline + mov edx,h7 + call printf + call newline + call newline + mov edx,h8 + call printf + call newline + mov edx,h9 + call printf + call newline + mov edx,h10 + call printf + call newline + mov edx,h11 + call printf + call newline + mov edx,h12 + call printf + call newline + mov edx,h13 + call printf + call newline + call newline + mov edx,h14 + call printf + call newline + call newline + mov edx,h15 + call printf + call newline + mov edx,h16 + call printf + call newline + + cmp byte [callp],1 + je go + + jmp ecmd + +ver: + cmp byte [callp],1 + je gonext7 + call clearsum +gonext7: + call newline + mov edx,about + call printf + + cmp byte [callp],1 + je go + + jmp ecmd + +pause1: + cmp byte [callp],1 + je gonext1 + call clearsum +gonext1: + call pause2 + + cmp byte [callp],1 + je go + + jmp ecmd + +ls: + call oldcmd + call cls2 + +loopls: + inc dword [blockcnt] + + mov eax,34 + mov ebx,0 + mov ecx,0 + mov edx,0 + add edx,dword [blockcnt] + mov esi,1 + mov edi,tic_table+7000 + int 0x40 + + mov ecx,16 +loop40: + push ecx + + cld + mov ecx,8 + mov edi,filename + mov esi,tic_table + add esi,dword [lscnt] + rep movsb + + add dword [lscnt],8 + + mov edi,filename+8 + mov esi,ddot + movsb + + cld + mov ecx,3 + mov edi,filename+9 + mov esi,tic_table + add esi,dword [lscnt] + rep movsb + + cmp byte [filename+10],0 + jne no_fn_space1 + + mov edi,filename+10 + mov esi,dzero + movsb + +no_fn_space1: + cmp byte [filename],0xe5 ; deleted file + je no_newline + cmp byte [filename],0xf ; long fat32 filename + je no_newline + cmp byte [filename],0x10 ; folder + je no_newline + + cmp word [filename],'AK' + jne filename_ok + cmp byte [filename+3],'e' + jne filename_ok + cmp byte [filename+5],'y' + jne filename_ok + cmp byte [filename+7],'a' + jne filename_ok + cmp byte [filename+10],'s' + jne filename_ok + + jmp no_newline + +filename_ok: + mov eax,6 + mov ebx,filename + mov ecx,0 + mov edx,-1 + mov esi,tic_table+25000 + int 0x40 + + cmp eax,4294967295 + jne ls_print + + jmp no_newline + +ls_print_done: + inc byte [lscntf] + + add dword [ypos],96 + + cmp byte [lscntf],5 + jne no_newline + + mov byte [lscntf],0 + inc byte [lscntx] + + cmp byte [lscntx],23 + je pause2n + + mov dword [ypos],6 + call newline + +no_newline: + add dword [lscnt],24 + + pop ecx + dec ecx + cmp ecx,0 + jne loop40 + + cmp dword [blockcnt],16 + je ls_end + + jmp no_pause2 + +pause2n: + mov byte [lscntx],0 + + call newline + call pause2 + call cls2 + mov dword [lscnt],8024 + jmp loopls + +no_pause2: + mov dword [lscnt],8024 + + jmp loopls + +ls_end: + mov dword [blockcnt],0 + mov dword [lscnt],8024 + mov byte [lscntf],0 + mov byte [lscntx],0 + + cmp byte [callp],1 + je go + + jmp ecmd2 + +ls_print: + mov edi,filename+8 + mov esi,fill1 + movsb + + mov eax,4 + mov ebx,[ypos] + shl ebx,16 + add ebx,[xpos] + mov edx,filename + mov ecx,0x00ddeeff + mov esi,12 + int 0x40 + + cld + mov ecx,12 + mov edi,tic_table + add edi,dword [linen] + mov esi,filename + rep movsb + + add dword [linen],16 + add dword [linel],16 + + jmp ls_print_done + +lscheck: + cmp byte [callp],1 + je gonext9 + call clearsum +gonext9: + sub dword [count],3 + + cld + mov ecx,dword [count] + mov edi,tic_table+400 + mov esi,tic_table+600 + add esi,3 + rep movsb + + mov ebx,tic_table+400 + push esi edi ecx eax + mov esi,ebx + + mov edi,tic_table+400 + mov ecx,70 +strup2: + mov al,[esi] + cmp al,'A' + jb @f + cmp al,'z' + ja @f + cmp al,'a' + jb @f + add al,-0x20 +@@: + mov [edi],al + inc esi + inc edi + dec ecx + jnz strup2 + pop eax ecx edi esi + + mov ecx,dword [count] + +looplsc: + cmp byte [tic_table+400+ecx],'.' + je chdot + + loop looplsc + + jmp chnodot + +chdot: + mov ebx,dword [count] + + cld + mov ecx,5 + mov edi,tic_table+400 + add edi,ebx + mov esi,dzero + rep movsb + + mov eax,6 + mov ebx,tic_table+400 + mov ecx,0 + mov edx,-1 + mov esi,tic_table+25000 + int 0x40 + + cmp eax,4294967295 + je nosuchfile + + jmp lschok + +chnodot: + mov ebx,dword [count] + + mov edi,tic_table+400 + add edi,ebx + mov esi,ddot + movsb + + inc ebx + + cld + mov ecx,3 + mov edi,tic_table+400 + add edi,ebx + mov esi,fill3 + rep movsb + + mov eax,6 + mov ebx,tic_table+400 + mov ecx,0 + mov edx,-1 + mov esi,tic_table+25000 + int 0x40 + + cmp eax,4294967295 + je nosuchfile + + mov edi,tic_table+400 + add edi,dword [count] + mov esi,fill1 + movsb + +lschok: + call newline + + mov eax,4 + mov ebx,6 + shl ebx,16 + add ebx,[xpos] + mov edx,tic_table+400 + mov esi,12 + mov ecx,0x00ddeeff + int 0x40 + + cld + mov ecx,12 + mov edi,tic_table + add edi,dword [linen] + mov esi,tic_table+400 + rep movsb + + add dword [linen],12 + add dword [linel],12 + + add dword [count],3 + + cmp byte [callp],1 + je go + + jmp ecmd + +ps: + call oldcmd + call cls2 + call newline + mov edx,proc_head + call printf + call newline + mov edx,proc_hd11 + call printf + call newline + call newline + + mov eax,9 + mov ebx,tic_table + mov ecx,1 + int 0x40 + + mov dword [count2],eax + +ll1: + inc dword [pn] + mov eax,9 + mov ebx,tic_table + mov ecx,[pn] + int 0x40 + + mov ebx,[tic_table+30] + mov dword [fnumb],4 + mov dword [ypos],6 + call decnumb + + cld + mov ecx,4 + mov edi,tic_table + add edi,dword [linen] + mov esi,tic_table+200 + rep movsb + + add dword [linen],5 + add dword [linel],5 + + cld + mov ecx,11 + mov esi,tic_table+10 + mov edi,pname + rep movsb + + mov dword [ypos],36 + mov edx,pname + mov eax,4 + mov ebx,[ypos] + shl ebx,16 + add ebx,[xpos] + mov ecx,0x00ddeeff + mov esi,12 + int 0x40 + + cld + mov ecx,11 + mov edi,tic_table + add edi,dword [linen] + mov esi,pname + rep movsb + + add dword [linen],10 + add dword [linel],10 + + mov dword [ypos],94 + mov ebx,[tic_table+22] + mov dword [fnumb],8 + call decnumb + + cld + mov ecx,8 + mov edi,tic_table + add edi,dword [linen] + mov esi,tic_table+200 + rep movsb + + add dword [linen],10 + add dword [linel],10 + + mov dword [ypos],154 + mov ebx,[tic_table+26] + mov dword [fnumb],8 + call decnumb + + cld + mov ecx,8 + mov edi,tic_table + add edi,dword [linen] + mov esi,tic_table+200 + rep movsb + + add dword [linen],12 + add dword [linel],12 + + mov dword [ypos],228 + mov ebx,[pn] + mov dword [fnumb],4 + call decnumb + + cld + mov ecx,4 + mov edi,tic_table + add edi,dword [linen] + mov esi,tic_table+200 + rep movsb + + add dword [linel],4 + add dword [linen],4 + + call newline + + mov dword [ypos],60 + + cmp dword [xpos],254 + jne nscreen + + call pause2 + call cls2 + + mov dword [xpos],24 + call newline + mov dword [ypos],60 + + mov edx,proc_head + call printf + call newline + mov edx,proc_hd11 + call printf + call newline + call newline + +nscreen: + mov eax, dword [count2] + cmp dword [pn],eax + jne ll1 + mov dword [pn],0 + + cmp byte [callp],1 + je go + + jmp ecmd2 + +printn: + mov eax,47 + shl ebx,16 + mov edx,[ypos] + shl edx,16 + add edx,[xpos] + mov esi,0x00ddeeff + int 0x40 + ret + +pause2: + call newline + mov edx,mess1 + call printf + + mov eax,10 + int 0x40 + +red3: + cmp eax,2 + je back + cmp eax,3 + je exit + + call draw + call red + + mov eax,10 + int 0x40 + jmp red3 + +back: + mov eax,2 + int 0x40 + cmp ah,27 + je checmd + ret + +exit: + mov eax,-1 + int 0x40 + +checmd: + cmp byte [callp],1 + je ecmd3 + + jmp ecmd + +err: + call clearsum + + call newline + + call ppr + cmp dword [count],0 + je ecmd1 + mov edx,err1 + mov eax,4 + mov ebx,[ypos] + shl ebx,16 + add ebx,[xpos] + mov ecx,0x00ddeeff + mov esi,27 + int 0x40 + + cld + mov ecx,27 + mov edi,tic_table + add edi,dword [linen] + mov esi,err1 + rep movsb + + add dword [linen],27 + add dword [linel],27 + + call clearcmd + + jmp cmd_ok2 + +nparam: + cmp byte [callp],1 + je gonext4 + call clearsum +gonext4: + call newline + mov edx,mess2 + call printf + + cmp byte [callp],1 + je go + + jmp ecmd + +nparam2: + cmp byte [callp],1 + je gonext3 + call clearsum +gonext3: + call newline + mov edx,mess5 + call printf + + cmp byte [callp],0 + je ecmd + + jmp go + +cp: + cmp byte [callp],1 + je gonext10 + call clearsum +gonext10: + sub dword [count],3 + + cld + mov ecx,dword [count] + mov edi,tic_table+400 + mov esi,tic_table+600 + add esi,3 + rep movsb + + mov ecx,12 +loop50: + cmp byte [tic_table+400+ecx],'+' + je file2 + + loop loop50 + + add dword [count],3 + jmp nparam3 + +file2: + mov dword [f1len],ecx + + inc ecx + mov ebx,ecx + cld + mov edi,tic_table+9000 + mov esi,tic_table+400 + rep movsb + + mov ecx,12 + mov edi,tic_table+9100 + mov esi,tic_table+400 + add esi,ebx + rep movsb + + mov ebx,tic_table+9000 + push esi edi ecx eax + mov esi,ebx + + mov edi,tic_table+9000 + mov ecx,12 +strup3: + mov al,[esi] + cmp al,'A' + jb @f + cmp al,'z' + ja @f + cmp al,'a' + jb @f + add al,-0x20 +@@: + mov [edi],al + inc esi + inc edi + dec ecx + jnz strup3 + pop eax ecx edi esi + + mov ecx,dword [f1len] + +loopcp: + cmp byte [tic_table+9000+ecx],'.' + je chdotcp + + loop loopcp + + jmp chnodotcp + +chdotcp: + mov ebx,dword [f1len] + + cld + mov ecx,4 + mov edi,tic_table+9000 + add edi,ebx + mov esi,dzero + rep movsb + + jmp gocp1 + +chnodotcp: + mov ebx,dword [f1len] + + mov edi,tic_table+9000 + add edi,ebx + mov esi,ddot + movsb + + inc ebx + + cld + mov ecx,3 + mov edi,tic_table+9000 + add edi,ebx + mov esi,fill3 + rep movsb + +gocp1: + mov eax,6 + mov ebx,tic_table+9000 + mov ecx,0 + mov edx,-1 + mov esi,tic_table+25000 + int 0x40 + + cmp eax,4294967295 + je nosuchfile + + mov dword [filesize],eax + + mov ebx,tic_table+9100 + push esi edi ecx eax + mov esi,ebx + + mov edi,tic_table+9100 + mov ecx,12 +strup4: + mov al,[esi] + cmp al,'A' + jb @f + cmp al,'z' + ja @f + cmp al,'a' + jb @f + add al,-0x20 +@@: + mov [edi],al + inc esi + inc edi + dec ecx + jnz strup4 + pop eax ecx edi esi + + mov ebx,dword [f1len] + mov ecx,dword [count] + sub ecx,ebx + + mov dword [f2len],ecx + +loopcp2: + cmp byte [tic_table+9100+ecx],'.' + je chdotcp2 + + loop loopcp2 + + jmp chnodotcp2 + +chdotcp2: + mov ebx,dword [f2len] + + cld + mov ecx,4 + mov edi,tic_table+9100 + add edi,ebx + mov esi,dzero + rep movsb + + jmp gocp2 + +chnodotcp2: + mov ebx,dword [f2len] + + mov edi,tic_table+9100 + add edi,ebx + mov esi,ddot + movsb + + inc ebx + + cld + mov ecx,3 + mov edi,tic_table+9100 + add edi,ebx + mov esi,fill3 + rep movsb + +gocp2: + mov eax,6 + mov ebx,tic_table+9100 + mov ecx,0 + mov edx,-1 + mov esi,tic_table+25000 + int 0x40 + + cmp eax,4294967295 + jne alreadyexist + + mov eax,33 + mov ebx,tic_table+9100 + mov ecx,tic_table+25000 + mov edx,dword [filesize] + mov esi,0 + int 0x40 + + cmp eax,0 + jne no_ok + + mov eax,6 + mov ebx,tic_table+9100 + mov ecx,0 + mov edx,-1 + mov esi,tic_table+25000 + int 0x40 + + cmp eax,4294967295 + je no_ok + + call newline + mov edx,mess11 + call printf + jmp cp_end + +no_ok: + call newline + mov edx,mess12 + call printf + +cp_end: + add dword [count],3 + + cmp byte [callp],1 + je go + + jmp ecmd + +alreadyexist: + add dword [count],3 + call newline + mov edx,mess13 + call printf + + cmp byte [callp],1 + je go + + jmp ecmd + +rn: + cmp byte [callp],1 + je gonext11 + call clearsum +gonext11: + sub dword [count],3 + + cld + mov ecx,dword [count] + mov edi,tic_table+400 + mov esi,tic_table+600 + add esi,3 + rep movsb + + mov ecx,12 +loop51: + push ecx + cmp byte [tic_table+400+ecx],'+' + je file3 + + pop ecx + loop loop51 + + add dword [count],3 + jmp nparam4 + +file3: + mov dword [f1len],ecx + + inc ecx + mov ebx,ecx + cld + mov edi,tic_table+9000 + mov esi,tic_table+400 + rep movsb + + mov ecx,12 + mov edi,tic_table+9100 + mov esi,tic_table+400 + add esi,ebx + rep movsb + + mov ebx,tic_table+9000 + push esi edi ecx eax + mov esi,ebx + + mov edi,tic_table+9000 + mov ecx,12 +strup5: + mov al,[esi] + cmp al,'A' + jb @f + cmp al,'z' + ja @f + cmp al,'a' + jb @f + add al,-0x20 +@@: + mov [edi],al + inc esi + inc edi + dec ecx + jnz strup5 + pop eax ecx edi esi + + mov ecx,dword [f1len] + +looprn: + cmp byte [tic_table+9000+ecx],'.' + je chdotrn + + loop looprn + + jmp chnodotrn + +chdotrn: + mov ebx,dword [f1len] + + cld + mov ecx,4 + mov edi,tic_table+9000 + add edi,ebx + mov esi,dzero + rep movsb + + jmp gorn1 + +chnodotrn: + mov ebx,dword [f1len] + + mov edi,tic_table+9000 + add edi,ebx + mov esi,ddot + movsb + + inc ebx + + cld + mov ecx,3 + mov edi,tic_table+9000 + add edi,ebx + mov esi,fill3 + rep movsb + +gorn1: + mov eax,6 + mov ebx,tic_table+9000 + mov ecx,0 + mov edx,-1 + mov esi,tic_table+25000 + int 0x40 + + cmp eax,4294967295 + je nosuchfile + + mov ebx,tic_table+9100 + push esi edi ecx eax + mov esi,ebx + + mov edi,tic_table+9100 + mov ecx,12 +strup6: + mov al,[esi] + cmp al,'A' + jb @f + cmp al,'z' + ja @f + cmp al,'a' + jb @f + add al,-0x20 +@@: + mov [edi],al + inc esi + inc edi + dec ecx + jnz strup6 + pop eax ecx edi esi + + mov ebx,dword [f1len] + mov ecx,dword [count] + sub ecx,ebx + + mov dword [f2len],ecx + +looprn2: + cmp byte [tic_table+9100+ecx],'.' + je chdotrn2 + + loop looprn2 + + jmp chnodotrn2 + +chdotrn2: + mov ebx,dword [f2len] + + cld + mov ecx,4 + mov edi,tic_table+9100 + add edi,ebx + mov esi,dzero + rep movsb + + jmp gorn2 + +chnodotrn2: + mov ebx,dword [f2len] + + mov edi,tic_table+9100 + add edi,ebx + mov esi,ddot + movsb + + inc ebx + + cld + mov ecx,3 + mov edi,tic_table+9100 + add edi,ebx + mov esi,fill3 + rep movsb + +gorn2: + mov eax,6 + mov ebx,tic_table+9100 + mov ecx,0 + mov edx,-1 + mov esi,tic_table+25000 + int 0x40 + + cmp eax,4294967295 + jne alreadyexist + + mov eax,6 + mov ebx,tic_table+9000 + mov ecx,0 + mov edx,-1 + mov esi,tic_table+25000 + int 0x40 + + mov dword [filesize],eax + + mov eax,33 + mov ebx,tic_table+9100 + mov ecx,tic_table+25000 + mov edx,dword [filesize] + mov esi,0 + int 0x40 + + cmp eax,0 + jne no_ok1 + + mov eax,6 + mov ebx,tic_table+9100 + mov ecx,0 + mov edx,-1 + mov esi,tic_table+25000 + int 0x40 + + cmp eax,4294967295 + je no_ok1 + + mov eax,32 + mov ebx,tic_table+9000 + int 0x40 + + call newline + mov edx,mess14 + call printf + jmp rn_end + +no_ok1: + call newline + mov edx,mess15 + call printf + +rn_end: + add dword [count],3 + + cmp byte [callp],1 + je go + + jmp ecmd + +del: + cmp byte [callp],1 + je gonext12 + call clearsum +gonext12: + sub dword [count],4 + + cld + mov ecx,dword [count] + mov edi,tic_table+400 + mov esi,tic_table+600 + add esi,4 + rep movsb + + mov ebx,tic_table+400 + push esi edi ecx eax + mov esi,ebx + + mov edi,tic_table+400 + mov ecx,70 +strup1: + mov al,[esi] + cmp al,'A' + jb @f + cmp al,'z' + ja @f + cmp al,'a' + jb @f + add al,-0x20 +@@: + mov [edi],al + inc esi + inc edi + dec ecx + jnz strup1 + pop eax ecx edi esi + + mov ecx,dword [count] + +loopdel: + cmp byte [tic_table+400+ecx],'.' + je chdotdel + + loop loopdel + + jmp chnodotdel + +chdotdel: + mov ebx,dword [count] + + cld + mov ecx,4 + mov edi,tic_table+400 + add edi,ebx + mov esi,dzero + rep movsb + + jmp godel + +chnodotdel: + mov ebx,dword [count] + + mov edi,tic_table+400 + add edi,ebx + mov esi,ddot + movsb + + inc ebx + + cld + mov ecx,3 + mov edi,tic_table+400 + add edi,ebx + mov esi,fill3 + rep movsb + +godel: + mov eax,6 + mov ebx,tic_table+400 + mov ecx,0 + mov edx,-1 + mov esi,tic_table+25000 + int 0x40 + + cmp eax,4294967295 + je nosuchfile2 + + mov eax,32 + mov ebx,tic_table+400 + int 0x40 + + call newline + mov edx,mess6 + call printf + + add dword [count],4 + +del_end: + add dword [count],4 + + cmp byte [callp],1 + je go + + jmp ecmd + +nosuchfile: + add dword [count],3 + call newline + mov edx,mess7 + call printf + + cmp byte [callp],0 + je ecmd + + jmp go + +nosuchfile2: + add dword [count],4 + call newline + mov edx,mess7 + call printf + + cmp byte [callp],1 + je go + + jmp ecmd + +nosuchfile3: + inc dword [count] + call newline + mov edx,mess7 + call printf + jmp ecmd + +autoexec: + mov eax,6 + mov ebx,autoexfile + mov ecx,0 + mov edx,-1 + mov esi,tic_table+15000 + int 0x40 + + cmp eax,4294967295 + je noaxfile + + sub dword [linen],81 + sub dword [xpos],10 + dec dword [lpress] + + jmp autolabel + +noaxfile: + ret + +command: + call clearsum + dec dword [count] + + cld + mov ecx,dword [count] + mov edi,filename + mov esi,tic_table+601 + rep movsb + + mov ebx,filename + push esi edi ecx eax + mov esi,ebx + + mov edi,filename + mov ecx,12 +strup7: + mov al,[esi] + cmp al,'A' + jb @f + cmp al,'z' + ja @f + cmp al,'a' + jb @f + add al,-0x20 +@@: + mov [edi],al + inc esi + inc edi + dec ecx + jnz strup7 + pop eax ecx edi esi + + cld + mov ecx,4 + mov edi,filename+8 + mov esi,dcmd + rep movsb + + mov eax,6 + mov ebx,filename + mov ecx,0 + mov edx,-1 + mov esi,tic_table+15000 + int 0x40 + + cmp eax,4294967295 + je nosuchfile3 + +autolabel: + mov dword [filesize2],eax + mov byte [callp],1 + +go: + call clearcmd + +gonext: + cmp dword [filesize2],0 + je ecmd3 + + mov ebx,tic_table + add ebx,dword [readcnt] + cmp byte [ebx],13 + je read + + inc dword [readcnt] + inc dword [readcnt2] + dec dword [filesize2] + + jmp gonext + +read: + mov ecx,dword [readcnt2] + mov ebx,0 + mov edx,dword [readcnt] + sub edx,dword [readcnt2] +loop60: + push ecx + mov edi,tic_table+600 + add edi,ebx + mov esi,tic_table + add esi,edx + movsb + + inc ebx + inc edx + + pop ecx + loop loop60 + + mov eax,dword [readcnt2] + mov dword [count],eax + + mov dword [readcnt2],0 + add dword [readcnt],2 + + jmp checkcmd + +decnumb: + cmp dword [fnumb],4 + je go1 + + call divide + mov dword [n8],edx + mov ebx,eax + call divide + mov dword [n7],edx + mov ebx,eax + call divide + mov dword [n6],edx + mov ebx,eax + call divide + mov dword [n5],edx + mov ebx,eax + +go1: + call divide + mov dword [n4],edx + mov ebx,eax + call divide + mov dword [n3],edx + mov ebx,eax + call divide + mov dword [n2],edx + mov ebx,eax + call divide + mov dword [n1],edx + + add dword [n1],48 + add dword [n2],48 + add dword [n3],48 + add dword [n4],48 + + cmp dword [fnumb],4 + je go2 + + add dword [n5],48 + add dword [n6],48 + add dword [n7],48 + add dword [n8],48 + +go2: + mov edi,tic_table+200 + mov esi,n1 + movsb + mov edi,tic_table+201 + mov esi,n2 + movsb + mov edi,tic_table+202 + mov esi,n3 + movsb + mov edi,tic_table+203 + mov esi,n4 + movsb + + cmp dword [fnumb],4 + je go4 + + mov edi,tic_table+204 + mov esi,n5 + movsb + mov edi,tic_table+205 + mov esi,n6 + movsb + mov edi,tic_table+206 + mov esi,n7 + movsb + mov edi,tic_table+207 + mov esi,n8 + movsb + +go4: + mov eax,4 + mov ebx,[ypos] + shl ebx,16 + add ebx,[xpos] + mov ecx,0x00ddeeff + mov edx,tic_table+200 + mov esi,dword [fnumb] + int 0x40 + + ret + +divide: + mov eax,ebx + xor edx,edx + mov ecx,10 + div ecx + ret + +kill: + mov eax,0 + mov ebx,0 + mov ecx,0 + mov edx,0 + + mov al, byte [tic_table+608] + mov bl, byte [tic_table+607] + mov cl, byte [tic_table+606] + mov dl, byte [tic_table+605] + + sub al,48 + sub bl,48 + sub cl,48 + sub dl,48 + + imul ebx,10 + imul ecx,100 + imul edx,1000 + + mov esi,0 + add esi,eax + add esi,ebx + add esi,ecx + add esi,edx + mov ecx,esi + + mov eax,9 + mov ebx,tic_table + int 0x40 + + cmp eax,ecx + jb nosuchprocess + + mov eax,18 + mov ebx,2 + mov edx,0 + int 0x40 + + call clearsum + call newline + mov edx,mess3 + call printf + call newline + mov edx,mess4 + call printf + + cmp byte [callp],1 + je go + + jmp ecmd + +ecmd1: + sub dword [xpos],10 + jmp ecmd + +nosuchprocess: + call clearsum + call newline + mov edx,mess8 + call printf + + cmp byte [callp],1 + je go + + jmp ecmd + +echoeol: + cmp byte [callp],1 + je gonext15 + call clearsum +gonext15: + call newline + + cmp byte [callp],1 + je go + + jmp ecmd + +echo: + cmp byte [callp],1 + je gonext13 + call clearsum +gonext13: + sub dword [count],5 + + cld + mov ecx,dword [count] + mov edi,tic_table+300 + mov esi,tic_table+600 + add esi,5 + rep movsb + + call newline + + mov eax,4 + mov ebx,6 + shl ebx,16 + add ebx,[xpos] + mov edx,tic_table+300 + mov ecx,0x00ddeeff + mov esi,dword [count] + int 0x40 + + cld + mov ecx,dword [count] + mov edi,tic_table + add edi,dword [linen] + mov esi,tic_table+300 + rep movsb + + mov eax,dword [count] + add dword [linen],eax + add dword [linel],eax + + add dword [count],5 + + cmp byte [callp],1 + je go + + jmp ecmd + +printf: + mov eax,4 + mov ebx,6 + shl ebx,16 + add ebx,[xpos] + mov ecx,0x00ddeeff + mov esi,45 + int 0x40 + + cld + mov ecx,45 + mov edi,tic_table + add edi,dword [linen] + mov esi,edx + rep movsb + + add dword [linen],46 + add dword [linel],46 + + add dword [ypos],6 + + ret + +printipc: + mov eax,4 + mov ebx,6 + shl ebx,16 + add ebx,[xpos] + mov ecx,0x00ddeeff + mov esi,79 + int 0x40 + + cld + mov ecx,79 + mov edi,tic_table + add edi,dword [linen] + mov esi,edx + rep movsb + + add dword [linen],80 + add dword [linel],80 + + mov dword [ypos],480 + + ret + +clearcmd: + cld + mov ecx,80 + mov edi,tic_table+600 + mov esi,tic_table+500 + rep movsb + + mov ecx,80 + mov edi,tic_table+400 + mov esi,tic_table+500 + rep movsb + + mov ecx,81 + mov edi,tic_table+800 + mov [esi],byte 'x' + rep movsb + + mov ecx,12 + mov edi,filename + mov esi,pname + rep movsb + + mov dword [count],0 + mov dword [pn],0 + mov dword [blockcnt],0 + mov dword [lscnt],8024 + ret + +oldcmd: + mov eax,dword [count] + mov dword [oldcount],eax + + cld + mov ecx,81 + mov edi,tic_table+900 + mov esi,tic_table+500 + rep movsb + + cld + mov ecx,81 + mov edi,tic_table+900 + mov esi,tic_table+600 + rep movsb + + ret + +ecmd: + call oldcmd + call clearcmd + call newline + + call ppr + call cursor + + jmp still + +ecmd2: + call clearcmd + call newline + + call ppr + call cursor + jmp still + +ecmd3: + call clearcmd + call newline + + call ppr + call cursor + + mov dword [readcnt],15000 + mov dword [readcnt2],0 + mov byte [callp],0 + mov dword [filesize2],0 + + jmp still + +chparam: + pop ecx + mov eax,ecx + mov edx,eax + push edx + inc eax + + cld + mov edi,tic_table+400 + mov esi,tic_table+600 + rep movsb + + mov ecx,dword [count] + sub ecx,eax + + cld + mov edi,tic_table+800 + mov esi,tic_table+600 + add esi,eax + rep movsb + + pop edx + + mov dword [ipccount],edx + + cld + mov ecx,11 + mov edi,tic_table+400 + add edi,edx + mov esi,qspace + rep movsb + + mov eax,19 + mov ebx,tic_table+400 + mov ecx,tic_table+800 + int 0x40 + + cmp eax,0xfffffff0 + jb cmd_ok + + jmp err + +cls: + call oldcmd + call cls2 + + cmp byte [callp],0 + jne needret + + call clearcmd + call ppr + call cursor + + jmp still + +needret: + sub dword [linen],81 + dec dword [lpress] + sub dword [xpos],10 + + jmp gonext + +cls1: + mov eax,13 + mov ebx,6*65536+486 + mov ecx,24*65536+250 + mov edx,0 + int 0x40 + ret + +cls2: + mov dword [linen],2000 + mov ecx,2025 +loop2: + push ecx + mov edi,tic_table + add edi,dword [linen] + mov esi,fill1 + movsb + + inc dword [linen] + pop ecx + loop loop2 + + mov dword [linel],0 + mov dword [linen],2000 + mov dword [linev],2000 + mov dword [xpos],24 + mov dword [ypos],6 + mov dword [lpress],1 + mov dword [stnum],1 + + call cls1 + + ret + +chscr: + cmp dword [xpos],264 + jne no_scr + + mov dword [cnt_loop1],4500 + mov dword [cnt_loop2],2000 + + mov ecx,2025 +loop10: + push ecx + mov edi,tic_table + add edi,dword [cnt_loop1] + mov esi,tic_table + add esi,dword [cnt_loop2] + movsb + + inc dword [cnt_loop1] + inc dword [cnt_loop2] + + pop ecx + loop loop10 + + mov dword [cnt_loop1],2000 + + mov ecx,2025 +loop11: + push ecx + mov edi,tic_table + add edi,dword [cnt_loop1] + mov esi,fill1 + movsb + + inc dword [cnt_loop1] + + pop ecx + loop loop11 + + mov dword [cnt_loop1],2000 + mov dword [cnt_loop2],4581 + + mov ecx,1944 +loop12: + push ecx + mov edi,tic_table + add edi,dword [cnt_loop1] + mov esi,tic_table + add esi,dword [cnt_loop2] + movsb + + inc dword [cnt_loop1] + inc dword [cnt_loop2] + + pop ecx + loop loop12 + + dec dword [lpress] + sub dword [linen],81 + + mov dword [xpos],264 + mov dword [ypos],6 + mov dword [clr],480 + call clear + + call red + +no_scr: + ret + +newline: + call chscr + push edx + mov edx,81 + sub edx,dword [linel] + add dword [linen],edx + pop edx + + inc dword [lpress] + + mov dword [linel],0 + add dword [xpos],10 + ret + +fill: + cld + mov ecx,81 + mov edi,tic_table+500 + mov esi,fill1 + rep movsb + ret + +nparam3: + cmp byte [callp],1 + je gonext5 + call clearsum +gonext5: + call newline + mov edx,mess9 + call printf + + cmp byte [callp],1 + je go + + jmp ecmd + +nparam4: + cmp byte [callp],1 + je gonext6 + call clearsum +gonext6: + call newline + mov edx,mess0 + call printf + + cmp byte [callp],1 + je go + + jmp ecmd + +nparam5: + cmp byte [callp],1 + je gonext14 + call clearsum +gonext14: + call newline + mov edx,mess16 + call printf + jmp ecmd + +endscr: + cmp byte [callp],1 + je ecmd3 + call clearsum + call newline + mov edx,mess17 + call printf + jmp ecmd + +checkcmd: + cmp dword [tic_table+600],'help' + jne no_help + cmp dword [count],4 + jne no_help + + jmp help + +no_help: + cmp dword [tic_table+600],'exit' + jne no_exit + cmp dword [count],4 + jne no_exit + + jmp exit + +no_exit: + cmp word [tic_table+600],'ve' + jne no_ver + cmp byte [tic_table+602],'r' + jne no_ver + cmp dword [count],3 + jne no_ver + + jmp ver + +no_ver: + cmp word [tic_table+600],'cl' + jne no_cls + cmp byte [tic_table+602],'s' + jne no_cls + cmp dword [count],3 + jne no_cls + + jmp cls + +no_cls: + cmp dword [tic_table+600],'shut' + jne no_shutdown + cmp dword [tic_table+604],'down' + jne no_shutdown + cmp dword [count],8 + jne no_shutdown + + mov eax,18 + mov ebx,1 + int 0x40 + + mov eax,5 + mov ebx,200 + int 0x40 + +no_shutdown: + cmp word [tic_table+600],'ps' + jne no_ps + cmp dword [count],2 + je ps + +no_ps: + cmp dword [tic_table+600],'kill' + jne no_kill + cmp byte [tic_table+604],' ' + jne no_kill + cmp dword [count],9 + je kill + + jmp nparam + +no_kill: + cmp dword [tic_table+600],'paus' + jne no_pause + cmp byte [tic_table+604],'e' + jne no_pause + cmp dword [count],5 + je pause1 + +no_pause: + cmp dword [tic_table+600],'echo' + jne no_echo + cmp dword [count],4 + je echoeol + cmp byte [tic_table+604],' ' + je echo + +no_echo: + cmp word [tic_table+600],'de' + jne no_del + cmp byte [tic_table+602],'l' + jne no_del + cmp byte [tic_table+603],' ' + jne no_del + cmp dword [count],3 + je nparam2 + cmp dword [count],4 + je nparam2 + + jmp del + +no_del: + cmp word [tic_table+600],'ls' + jne no_ls + cmp dword [count],2 + je ls + cmp dword [count],3 + je ls + + jmp lscheck + +no_ls: + cmp word [tic_table+600],'cp' + jne no_cp + cmp dword [count],2 + je nparam3 + cmp dword [count],3 + je nparam3 + cmp dword [count],4 + je nparam3 + cmp dword [count],5 + je nparam3 + cmp byte [tic_table+602],' ' + jne no_cp + + jmp cp + +no_cp: + cmp word [tic_table+600],'rn' + jne no_rn + cmp dword [count],2 + je nparam4 + cmp dword [count],3 + je nparam4 + cmp dword [count],4 + je nparam4 + cmp dword [count],5 + je nparam4 + cmp byte [tic_table+602],' ' + jne no_rn + + jmp rn + +no_rn: + cmp dword [tic_table+600],'ends' + jne no_end + cmp dword [count],4 + je endscr + +no_end: + cmp byte [callp],1 + je checkprg + + ret + +checkprg: + mov ebx,tic_table+600 + push esi edi ecx eax + mov esi,ebx + + mov edi,tic_table+600 + mov ecx,74 +strup: + mov al,[esi] + cmp al,'A' + jb @f + cmp al,'z' + ja @f + cmp al,'a' + jb @f + add al,-0x20 +@@: + mov [edi],al + inc esi + inc edi + dec ecx + jnz strup + pop eax ecx edi esi + + mov ecx,dword [count] +loop20: + push ecx + cmp byte [tic_table+600+ecx],'&' + je chparam + + pop ecx + loop loop20 + + cld + mov ecx,11 + mov edi,tic_table+600 + add edi,dword [count] + mov esi,qspace + rep movsb + + mov eax,19 + mov ebx,tic_table+600 + mov ecx,0 + int 0x40 + + cmp eax,0xfffffff0 + jb cmd_ok_1 + + jmp err + +cmd_ok_1: + mov eax,dword [count] + mov dword [ipccount],eax + +cmd_ok: + mov eax,60 + mov ebx,1 + mov ecx,ipcb + mov edx,118 + int 0x40 + + call clearipc + + mov eax,40 + mov ebx,01000111b + int 0x40 + + mov eax,23 + mov ebx,10 + int 0x40 + + cmp eax,7 + jne noipc + + cmp byte [callp],1 + je printipcprgname + + call clearsum + +ipccontinue: + mov eax,9 + mov ebx,tic_table+100000 + mov ecx,-1 + int 0x40 + + mov ecx,eax +loopfindipc: + push ecx + + mov eax,9 + mov ebx,tic_table+100000 + int 0x40 + + mov bl,[tic_table+600] + cmp byte [tic_table+100000+10],bl + jne goonipc + cmp dword [ipccount],1 + je ipcfinished + + mov bl,[tic_table+601] + cmp byte [tic_table+100000+11],bl + jne goonipc + cmp dword [ipccount],2 + je ipcfinished + + mov bl,[tic_table+602] + cmp byte [tic_table+100000+12],bl + jne goonipc + cmp dword [ipccount],3 + je ipcfinished + + mov bl,[tic_table+603] + cmp byte [tic_table+100000+13],bl + jne goonipc + cmp dword [ipccount],4 + je ipcfinished + + mov bl,[tic_table+604] + cmp byte [tic_table+100000+14],bl + jne goonipc + cmp dword [ipccount],5 + je ipcfinished + + mov bl,[tic_table+605] + cmp byte [tic_table+100000+15],bl + jne goonipc + cmp dword [ipccount],6 + je ipcfinished + + mov bl,[tic_table+606] + cmp byte [tic_table+100000+16],bl + jne goonipc + cmp dword [ipccount],7 + je ipcfinished + + mov bl,[tic_table+607] + cmp byte [tic_table+100000+17],bl + jne goonipc + +goonipc: + pop ecx + dec ecx + jnz loopfindipc + +ipcfinished: + mov ebx,[tic_table+100000+30] + mov dword [ipcpid],ebx + + mov eax,60 + mov ebx,2 + mov ecx,dword [ipcpid] + mov edx,ddot + mov esi,1 + int 0x40 + + call newline + call clearipc + + jmp waitipc + +printipcprgname: + call newline + call printcmd + jmp ipccontinue + +noipc: + cmp byte [callp],1 + je prtcmd + + call clearsum + + jmp cmd_ok2 + +printcmd: + mov eax,4 + mov ebx,6 + shl ebx,16 + add ebx,[xpos] + mov edx,tic_table+600 + mov ecx,0x00ddeeff + mov esi,dword [count] + int 0x40 + + cld + mov ecx,dword [count] + mov edi,tic_table + add edi,dword [linen] + mov esi,tic_table+600 + rep movsb + + mov eax,dword [count] + add dword [linen],eax + add dword [linel],eax + + ret + +prtcmd: + call newline + call printcmd + jmp go + +cmd_ok2: + cmp byte [callp],1 + je go + + ret + +waitipc: + mov eax,40 + mov ebx,01000111b + int 0x40 + + mov eax,10 + int 0x40 + + cmp eax,7 + je ipcok + cmp eax,1 + je reipc + cmp eax,3 + je exit + cmp eax,2 + je keyipc + + jmp waitipc + +keyipc: + mov eax,2 + int 0x40 + + jmp waitipc + +reipc: + call draw + call red + + jmp waitipc + +clearipc: + cld + mov ecx,118 + mov edi,ipcb + mov esi,ipcc + rep movsb + + ret + +ipcok: + cmp dword [ipcb+16],'~ccc' + je ipccls + cmp dword [ipcb+16],'~eee' + je endipc + cmp dword [ipcb+16],'~lll' + je ipcline + cmp dword [ipcb+16],'~ppp' + je ipcprint + cmp dword [ipcb+16],'~kkk' + je ipckey + + jmp waitipc + +reipc2: + call draw + call red + +ipckey: + mov eax,10 + int 0x40 + + cmp eax,1 + je reipc2 + cmp eax,3 + je exit + cmp eax,2 + je ipckeypressed + + jmp ipckey + +ipckeypressed: + mov eax,2 + int 0x40 + + mov byte [ipckeyvalue],ah + + mov eax,60 + mov ebx,2 + mov ecx,dword [ipcpid] + mov edx,ipckeyvalue + mov esi,1 + int 0x40 + + call clearipc + jmp waitipc + +ipccls: + call cls2 + call clearipc + jmp waitipc + +ipcline: + call newline + call clearipc + jmp waitipc + +ipcprint: + mov edx,ipcb+20 + call printipc + call clearipc + jmp waitipc + +endipc: + cmp byte [callp],1 + je go + + call clearsum + + jmp ecmd + +cmdexist: + mov eax,9 + mov ebx,tic_table + mov ecx,-1 + int 0x40 + + mov ecx,eax +loopex: + push ecx + + mov eax,9 + mov ebx,I_END + int 0x40 + + cmp word [I_END+10],'CM' + jne no_cmd + cmp byte [I_END+12],'D' + jne no_cmd + + inc byte [cmd_ex] + + cmp byte [cmd_ex],2 + je exit + +no_cmd: + pop ecx + loop loopex + + ret + +title: + db 'CMD - Command line interpreter' +title_end: + +smb_cursor db '|' + +prompt db 'CMD>>' + +h1 db ' CMD - Command line interpreter version 0.26 ' +h2 db ' copyleft Chemist - dmitry_gt@tut.by ' +h3 db ' Available commands: ' +h4 db ' HELP - Display this text LS - List files ' +h5 db ' EXIT - Exit Programm CP - Copy file ' +h6 db ' CLS - Clear Screen PS - Process info ' +h7 db ' KILL - Kill Process RN - Rename File ' +h8 db ' VER - Display programm version ' +h9 db ' DEL - Delete file from ramdisk ' +h10 db ' SHUTDOWN - Quit Menuet ' +h11 db ' PAUSE - Wait for keypress ' +h12 db ' ECHO - Print text to screen ' +h13 db ' ENDS - End script ' +h14 db ' /[filename] - Execute script ' +h15 db ' Use & symbol to enter params: ' +h16 db ' tinypad&cmd.asm - open cmd.asm ' + +about db 'Command Line Interpreter version 0.26 ' + +err1 db 'Unknown command or filename' + +proc_head db ' PID Name Start Length Proc_NUMB ' +proc_hd11 db '-------------------------------------------- ' + +mess1 db 'Press any key to continue (ESC - Cancel)... ' +mess2 db 'Plz specify a 4 byte process number (not PID) ' +mess3 db 'Process with number you specified has been ' +mess4 db 'terminated. ' +mess5 db 'Usage: del [filename] ' +mess6 db 'Filename you specified has been deleted. ' +mess7 db 'No such file! ' +mess8 db 'No such process! ' +mess9 db 'Usage: cp [source_file+destination_file] ' +mess0 db 'Usage: rn [source_file+destination_file] ' + +mess11 db 'File successfully copied ' +mess12 db 'ERROR: Can not copy file! ' +mess13 db 'ERROR: Output file alredy exist! ' +mess14 db 'File successfully renamed ' +mess15 db 'ERROR: Can not rename file! ' +mess16 db 'You must specify a command script filename! ' +mess17 db 'This command is available only in scripts! ' + + +linen dd 2000 +lpress dd 1 +linel dd 0 +linev dd 2000 +stnum dd 1 +rdstat dd 0 + +ypos dd 6 +xpos dd 24 +count dd 0 +clr dd 0 +smb db 0 +pn dd 0 +count2 dd 0 +count3 dd 9 +oldcount dd 0 +oldcount1 dd 0 + +fnumb dd 0 +n1 dd 0 +n2 dd 0 +n3 dd 0 +n4 dd 0 +n5 dd 0 +n6 dd 0 +n7 dd 0 +n8 dd 0 + +ddot db '.' +dcmd db '.CMD',0 + +cnt_loop1 dd 0 +cnt_loop2 dd 0 + +lscnt dd 8024 +blockcnt dd 0 +lscntf db 0 +lscntx db 0 + +filesize dd 0 +filesize2 dd 0 + +readcnt dd 15000 +readcnt2 dd 0 + +callp db 0 +callp2 db 0 + +fill1 db ' ' +fill3 db ' ',0 + +pname db ' ',0 +autoexfile db 'AUTOEXEC.CMD',0 +filename db ' ',0 + +dzero db 0,0,0,0 +qspace db ' ' + +f1len dd 0 +f2len dd 0 + +ipcpid dd 0 + +ipckeyvalue db 0 + +ipccount dd 0 + +cmd_ex db 0 + +ipcb: + db 0 + db 0,0,0 + dd 8 +times 110 db 0 + +ipcc: + db 0 + db 0,0,0 + dd 8 +times 110 db 0 + +I_END: + +tic_table: \ No newline at end of file diff --git a/programs/cmd/trunk/cmdipc.inc b/programs/cmd/trunk/cmdipc.inc new file mode 100644 index 0000000000..53353e0ec2 --- /dev/null +++ b/programs/cmd/trunk/cmdipc.inc @@ -0,0 +1,221 @@ +include "macros.inc" + +initipc: + mov eax,9 + mov ebx,prc + mov ecx,-1 + int 0x40 + + mov ecx,eax +loop1: + push ecx + + mov eax,9 + mov ebx,prc + int 0x40 + + cmp word [prc+10],'CM' + jne no_cmd + cmp byte [prc+12],'D' + jne no_cmd + + mov ebx,[prc+30] + mov dword [cmdpid],ebx + + mov dword [cmdnumb],ecx + +no_cmd: + pop ecx + loop loop1 + + cmp dword [cmdpid],0 + jne no_exit + + jmp exit + +no_exit: + mov eax,60 + mov ebx,2 + mov ecx,dword [cmdpid] + mov edx,printf + mov esi,4 + int 0x40 + + call initcmd + +waitcmdinit: + mov eax,40 + mov ebx,01000000b + int 0x40 + + mov eax,23 + mov ebx,100 + int 0x40 + + cmp eax,7 + je cmd_ok + + jmp exit + +cmd_ok: + cmp byte [ipcb+16],'.' + jne exit + + mov eax,18 + mov ebx,3 + mov ecx,dword [cmdnumb] + int 0x40 + + ret + +pause1: + mov eax,5 + mov ebx,1 + int 0x40 + ret + +exit: + mov eax,-1 + int 0x40 + +cls: + mov eax,60 + mov ebx,2 + mov ecx,dword [cmdpid] + mov edx,ipccls + mov esi,4 + int 0x40 + + call pause1 + + ret + +print: + mov ecx,84 +loopprt: + mov edi,stripc + add edi,ecx + mov esi,fill_symbol + movsb + + loop loopprt + + cld + mov ecx,4 + mov edi,stripc + mov esi,printf + rep movsb + + cld + mov edx,79 + sub edx,eax + mov ecx,79 + sub ecx,edx + mov edi,stripc+4 + mov esi,ebx + rep movsb + + mov eax,60 + mov ebx,2 + mov ecx,dword [cmdpid] + mov edx,stripc + mov esi,84 + int 0x40 + + call pause1 + + ret + +eol: + mov eax,60 + mov ebx,2 + mov ecx,dword [cmdpid] + mov edx,ipceol + mov esi,4 + int 0x40 + + call pause1 + + ret + +initcmd: + mov eax,60 + mov ebx,2 + mov ecx,dword [cmdpid] + mov edx,ipckey + mov esi,4 + int 0x40 + + mov eax,60 + mov ebx,1 + mov ecx,ipcb + mov edx,28 + int 0x40 + + cld + mov ecx,28 + mov edi,ipcb + mov esi,ipcc + rep movsb + + ret + +getkey: + call initcmd + +waitagain: + mov eax,40 + mov ebx,01000000b + int 0x40 + + mov eax,10 + int 0x40 + + cmp eax,7 + jne waitagain + + mov edi,key + mov esi,ipcb+16 + movsb + + ret + +endipc: + mov eax,60 + mov ebx,2 + mov ecx,dword [cmdpid] + mov edx,ipcend + mov esi,4 + int 0x40 + + jmp exit + +cmdpid dd 0 +cmdnumb dd 0 + +printf db '~ppp' +ipceol db '~lll' +ipcend db '~eee' +ipccls db '~ccc' +ipckey db '~kkk' + +key db 0 + +ipcb: + db 0 + db 0,0,0 + dd 8 +times 20 db 0 + +ipcc: + db 0 + db 0,0,0 + dd 8 +times 20 db 0 + +stripc: times 84 db 0 + +fill_symbol db 0 + +prc: times 52 db 0 + diff --git a/programs/cmd/trunk/macros.inc b/programs/cmd/trunk/macros.inc new file mode 100644 index 0000000000..1d153e8723 --- /dev/null +++ b/programs/cmd/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 + +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 \ No newline at end of file diff --git a/programs/cmd/trunk/readme.txt b/programs/cmd/trunk/readme.txt new file mode 100644 index 0000000000..6d167da260 --- /dev/null +++ b/programs/cmd/trunk/readme.txt @@ -0,0 +1,381 @@ + CMD - ╚эЄхЁяЁхЄрЄюЁ ъюьрэфэющ ёЄЁюъш фы  Menuet + ═ряшёрэю by Chemist dmitry_gt@tut.by + + ┬хЁёш  0.27 + + ╨єёёъшщ ЄхъёЄ эхьэюую яюэшцх. + +----------------------------------------------------------------------- + + CMD - Command Line Interpreter for Menuet + Copyleft Chemist - dmitry_gt@tut.by + + Version 0.27 + + As my english is not well, I will tell a few words about this + program. It supports 14 commands, such as cp (copy file), + rn (rename file), ps (process list), kill (kill process) etc. + You can type 'help' after starting this shell to examine with + other commands. Also it uses several special symbols, such as + &, /, . and +. Use & sumbol to enter params. For example, + type tinypad&cmd.asm to open cmd.asm file in tinypad editor. + / symbol is used to run special command scripts for CMD. + It's syntax is: /filename without extension (For example, + type /autoexec to execute autoexec.cmd file for CMD). And + + symbol is used in cp and rn commands. You must type + cp example.asm+example.bak to copy example.asm file to + example.bak. Use dot to launch program, if CMD command and + other external command match. For example, type help for + 'help' command or type .help to run 'help' program. + + This shell supports executeing special command + scripts (something like .BAT files in MS-DOS). This files + have an .CMD extinsion and u must use / symbol to execute it. + U can use any CMD commands and filenames in this scripts. + But you can't run other scripts from any CMD script (/ symbol). + I recommed to use tipypad editor to edit this scripts and do + not leave spaces and other symbols after commands in the script + file, because it's executeing is not very developed yet. + And it's strongly recommended to use ends command in the end + of the script, because there are some problems with redrawing + the window after executing scripts without this command. + Every time when you launch CMD autoexec.cmd file automatically + executes. You can edit or delete this file if you want. + + This version of CMD shell supports IPC. It mean, than you can + write your own programs for this shell. Look at .ASM files in + the Examples directory in this archive. I think that you will + understand them without any difficulties. Do not forget, that + you need CMDIPC.ASM file to compile this sources. It's + recommended to compile it with MACROS.INC file (included in + this archieve) to make their size smaller. + + And now about some bugs etc. + + ---------------------------- + + I've noticed, that there are some difficulties with files with + 1 or 2 symbols in extension. I recommend do not use such files + not only in CMD, but almost in every programs in MeOS. It's + possible to create such file in tinypad, and then (in MS-DOS or + Windows) Scandisk will find errors in filenames etc. CMD do + not support properly such filenames now. + + In CMDIPC.INC and CMD.ASM I used 5-th function (pause), because + I need it when CMD communicates with IPC programs. It's + even possible, that it will not enough 1/100 sec. on slow PC's, + because CMD need this time to finish IPC-command from other + IPC-program. U can change ebx value in CMDIPC.ASM in pause1: + if you want. But it slows communication betwen CMD and + IPC-programs for CMD. I hope, that you understand my words. :) + + Now (in this version) you can launch only one CMD shell. + Because it's difficult to make communication betwen several + copyes of CMD in memory and IPC-programs. I will solve this + problem in future. + + I've tested this shell only on Ivan Poddubny's russian + distributive. Also I recommend you to use it. :) CMD shell + is included into this distributive (but possible not it's + final version). + + Source code of this program is not optimized yet. I have such + manner of programming from my childhood that my source code + is not very "compact" + + etc. ;-) + + And now other information: + -------------------------- + + I do not want CMD design to change. I like white symbols on + the black background. If you want to change the source and + redistribute it, please, do not change it's design. :) + + If you will find some bugs or you have some wishes (or even you + correct some mistakes in my english texts) - + email me: dmitry_gt@tut.by + + And this program is distributed "as is". Use it on your own + risk. ;-) + + And again - my English is not well. :) + + That's all! + + 19.06.2004, + Chemist + + Now russian text :) + +----------------------------------------------------------------------- + + ─юёЄєяэ√х ъюьрэф√: + + ls [filename] - т√тюф ёяшёър Їрщыют. ┼ёыш яюёых ъюьрэф√ + єърчрЄ№ шь  Їрщыр, Єю ъюьрэфр яЁютхЁшЄ хую + эр эрышўшх. + + cp [source_file+destination_file] - ъюьрэфр фы  + ъюяшЁютрэш  Їрщыют. ╧ЁютхЁ хЄ Їрщы√ эр + эрышўшх, ш т ёыєўрх ю°шсъш т√тюфшЄ + ёююЄтхЄёЄтє■∙шх ёююс∙хэш . + + rn [source_file+destination_file] - ъюьрэфр фы  + яхЁхшьхэютрэш  Їрщыют. ╥ръ цх + яЁютхЁ хЄ Їрщы√ эр эрышўшх, ш т + ёыєўрх ю°шсъш т√тюфшЄ ёююЄтхЄёЄтє■∙шх + ёююс∙хэш . + + ps - т√тюф шэЇюЁьрЎшш ю яЁюЎхёёрї т ёшёЄхьх. + + kill - яЁхЁтрЄ№ яЁюЎхёё т ёшёЄхьх. ┬эшьрэшх, + яюёых ъюьрэф√ ёыхфєхЄ ттюфшЄ№ 4-ї + чэрўэ√щ эюьхЁ яЁюЎхёёр, р эх PID. ═юьхЁ + яЁюЎхёёр єърчрэ т яюёыхфэхщ ъюыюэъх яЁш + т√чютх ъюьрэф√ ps. + + help - т√тюф ъЁрЄъющ ёяЁртюўэющ шэЇюЁьрЎшш. + + ver - т√тюф шёяюы№чєхьющ тхЁёшш шэЄхЁяЁхЄрЄюЁр. + + cls - юўшёЄър ¤ъЁрэр. + + exit - т√їюф шч шэЄхЁяЁхЄрЄюЁр. + + del [filename] - єфрышЄ№ Їрщы ё Ёрьфшёър. ╧Ёш юЄёєЄёЄтшш + чряЁр°штрхьюую Їрщыр сєфхЄ т√тхфхэю + ёююЄтхЄёЄтє■∙шх ёююс∙хэшх юс ю°шсъх. + + shutdown - чртхЁ°шЄ№ ЁрсюЄє ёшёЄхь√. + + pause - юцшфрЄ№ эрцрЄшх ъыртш°ш. ╚ёяюы№чєхЄё  фы  + "тчршьюфхщёЄтш " яюы№чютрЄхы  ё ъюьрэфэ√ьш + ёъЁшяЄрьш фы  ъюэёюыш (шэЄхЁяЁхЄрЄюЁр). + ═ряЁшьхЁ, ьюцэю шёяюы№чютрЄ№ фрээ√щ ёъЁшяЄ + + echo Do you want to delete cmd.asm? + pause + del cmd.asm + + фы  Єюую, ўЄюс√ яюшэЄхЁхёютрЄ№ё  ьэхэшхь + яюы№чютрЄхы , їюўхЄ ыш юэ єфрышЄ№ Їрщы cmd.asm + шыш яЁхЁтрЄ№ ЁрсюЄє ёъЁшяЄр. + + pause >nul ╥ю цх ёрьюх, Єюы№ъю схч т√тюфр ёЄЁюъш + 'Press ane key to continue (ESC - cancel)' + + echo [text] - т√тюф ЄхъёЄр эр ¤ъЁрэ. ╧Ёхфэрчэрўхэр фы  + яюфрўш яюы№чютрЄхы■ шэЇюЁьрЎшш шч ъюьрэфэюую + ёъЁшяЄр. ┼ёыш ттхёЄш ъюьрэфє echo схч ЄхъёЄр, + Єю ¤Єю яЁюёЄю т√чютхЄ яхЁхїюф эр ёыхфє■∙є■ + ёЄЁюъє. + + ends - ъюьрэфр, фюёЄєяэр  Єюы№ъю шч шёяюыэ хь√ї + ёъЁшяЄют. ╤ыєцшЄ фы  шї ъюЁЁхъЄэюую чртхЁ°хэш , + Є.ъ. шэюуфр ъюьрэфэ√х ёъЁшяЄ√, є ъюЄюЁ√ї т + ъюэЎх ёЄю ыш эхэєцэ√х яЁюсхы√ шыш ёшьтюы√ EOL, + т√ч√трыш яЁюсыхь√ ё яхЁхЁшёютъющ юъэр. ╤ъюЁхх + тёхую ¤Єр ъюьрэфр яЁшёєЄёЄтєхЄ т ъюэёюыш + тЁхьхээю ш сєфхЄ єсЁрэр яюёых Ёх°хэш  ¤Єющ + яЁюсыхь√. + +----------------------------------------------------------------------- + + ╙яЁрты ■∙шх ёшьтюы√: + + /[ъюьрэфэ√щ ёъЁшяЄ] - яЁхфэрчэрўхэ фы  т√чютр эр шёяюыэхэшх + ъюьрэфэюую ёъЁшяЄр шч ъюэёюыш. ═х ьюцхЄ + шёяюы№чютрЄ№ё  т эхяюёЁхфёЄтхээю т ёрьшї + ъюьрэфэ√ї ёъЁшяЄрї. ┼ёыш Ёрё°шЁхэшх шёяюы- + э хьюую ёъЁшяЄр .cmd, Єю хую єърч√трЄ№ + эхюс чрЄхы№эю. + + & - фрээ√щ ёшьтюы шёяюы№чєхЄё  фы  яхЁхфрўш т√ч√трхьющ + яЁюуЁрььх ярЁрьхЄЁют. ═ряЁшьхЁ, ъюьрэфр tinypad&cmd.asm + яхЁхфрёЄ яЁюуЁрььх tinypad ярЁрьхЄЁ cmd.asm, + ёююЄтхЄёЄтхээю, tinypad юЄъЁюхЄ Їрщы cmd.asm. + + + - Ёрчфхы хЄ шьхэр шёїюфэюую ш Ёхчєы№ЄшЁє■∙хую Їрщыют т + ъюьрэфрї cp ш rn. + + . - чряєёърхЄ єърчрээє■ яюёых Єюўъш яЁюуЁрььє, фрцх хёыш юэр + ёютярфрхЄ ё ъюьрэфющ CMD. ═ряЁшьхЁ, help - т√яюыэшЄ№ + ъюьрэфє 'help', эю .help - чряєёЄшЄ№ тэх°э■■ яЁюуЁрььє + 'help' (їюЄ  Єръющ яюър тЁюфх ш эхЄє :). + +----------------------------------------------------------------------- + + ═ртшурЎш  яю ъюэёюыш: + + ─ы  ЁхфръЄшЁютрэш  ъюьрэфэющ ёЄЁюъш шёяюы№чє■Єё  ъыртш°ш ESC, + BACKSPACE. ESC - фы  єфрыхэш  тёхщ ъюьрэфэющ ёЄЁюъш, + BACKSPACE - фы  єфрыхэш  яюёыхфэхую ттхфхээюую ёшьтюыр. ╧ю + ьюхьє ьэхэш■, шёяюы№чютрэшх Єръшї ъыртш°, ъръ HOME, END, ARROW + KEY etc. эх шьххЄ ёь√ёыр, Є.ъ. ттюфшь√х ъюьрэф√ ёыш°ъюь + яЁюёЄ√ ш эх ЄЁхсє■Є яюфЁюсэюую ЁхфръЄшЁютрэш . ╧ю¤Єюьє   + юёЄртшы тёх яЁшьхЁэю Єръ, ъръ с√ыю т MS-DOS 6.22. + + ╩ыртш°р UPARROW шёяюы№чєхЄё  фы  яютЄюЁр яюёыхфэхщ ттхфхээющ + ъюьрэф√. + +----------------------------------------------------------------------- + + ╚ёяюы№чютрэшх IPC тю тэх°эшї яЁюуЁрььрї: + + ┬√ ьюцхЄх яшёрЄ№ яЁюуЁрьь√, тчршьюфхщёЄтє■∙шх ё CMD ўхЁхч IPC. + ┬ юёэютэюь,   яюырур■, ¤Єю ьюцхЄ яЁшуюфшЄё  фы  эряшёрэш  + ъюэёюы№э√ї яЁшыюцхэшщ фы  ёрьюую CMD (їюЄ  тючьюцэю ш фЁєуюх). + + ─ы  ¤Єюую, ъ тр°хщ яЁюуЁрььх трь эхюсїЁфшью яюфъы■ўшЄ№ Їрщы + CMDIPC.INC (┼ёЄхёЄтхээю, юЄ ¤Єюую ЁрчьхЁ яЁюуЁрьь√ яюёых + ъюьяшы Ўшш эхёъюы№ъю єтхышўшЄё ). ╧юёых ¤Єюую трь ёЄрэєЄ + фюёЄєяэ√ 6 ЇєэъЎшш IPC, ъюЄюЁ√х т√ ьюцхЄх т√ч√трЄ№ ё яюью∙№■ + call шч ётюхщ цх яЁюуЁрьь√. ┬юЄ шї юяшёрэшх: + + --------------------------------------------------------------- + + initipc - шэшЎшрышчрЎш  IPC фы  ЁрсюЄ√ ё CMD. + + call initipc - шэшЎшрышчшЁютрЄ№ IPC фы  ЁрсюЄ√ ё CMD. + + ┬═╚╠└═╚┼! ╚ёяюы№чєщЄх т ёрьюь эрўрых яЁюуЁрьь√. CMD сєфхЄ цфрЄ№ + Єюы№ъю 10/100 ёхъєэф√ фы  Єюую, ўЄюс√ яюыєўшЄ№ + ёююс∙хэшх яю IPC (їюЄ  ¤Єюую тяюыэх фюёЄрЄюўэю). + + --------------------------------------------------------------- + + print - т√тхёЄш ёЄЁюъє т ¤ъЁрэ CMD. + + mov eax,strlen + mov ebx,string + call print + + ├фх strlen - фышэр ёЄЁюъш т срщЄрї, + string - єърчрЄхы№ эр ёЄЁюъє. + + call print - т√тюф ёЄЁюъш. + + --------------------------------------------------------------- + + cls - юўшёЄшЄ№ ¤ъЁрэ CMD. + + call cls - т√чтрЄ№ юўшёЄъє ¤ъЁрэр. + + --------------------------------------------------------------- + + eol - яЁюяєёЄшЄ№ ёЄЁюъє. + + call eol - т√чтрЄ№ яЁюяєё ёЄЁюъш. + + --------------------------------------------------------------- + + getkey - ёўшЄрЄ№ ъюф эрцрЄющ ъыртш°ш т CMD. + + call getkey - юцшфрЄ№ эрцрЄш  ъыртш°ш ш ёўшЄрЄ№ хх ъюф. + + ┬√тюф: byte [key] - ъюф эрцрЄющ ъыртш°ш. + + ┬═╚╠└═╚┼: ╧юёых чряєёър яЁюуЁрьь√ шч CMD, ъюЄюЁр  + яюффхЁцштрхЄ IPC, Єю юъэю CMD ръЄштшЁєхЄё  ёЁрчє + яюёых чряєёър яЁюуЁрьь√. ╧ю¤Єюьє, єцх эх эєцэю + Є√ърЄ№ ь√°ъющ эр юъэю фы  Єюую, ўЄюс√ ттхёЄш + ўЄю-эшсєф№ т ъюэёюы№, ъръ ¤Єю с√ыю т яЁю°ы√ї тхЁёш ї. + + --------------------------------------------------------------- + + endipc - ╟ртхЁ°шЄ№ ЁрсюЄє IPC-яЁюуЁрьь√. + + call endipc - чртхЁ°шЄ№ яЁюуЁрььє. + + --------------------------------------------------------------- + + ┬ююс∙хь, т√ ьюцхЄх яюёьюЄЁхЄ№ Їрщы HELLO.ASM, ъюЄюЁ√щ ыхцшЄ т + ¤Єюь рЁїштх. ╥рь тёх фюыцэю с√Є№ яюэ Єэю. ┼ёЄхёЄтхээю, эшъЄю + трь эх ьх°рхЄ шёяюы№чютрЄ№ ярЁрьхЄЁ√ т IPC-яЁюуЁрььрї фы  CMD. + ╤ьюЄЁшЄх яЁшьхЁ PARAM.ASM. + + ╩ёЄрЄш, т ёрьюь CMD ш т CMDIPC.INC шёяюы№чєхЄё  5-  ЇєэъЎш  + (ярєчр) фы  Єюую, ўЄюс√ фрЄ№ тЁхь  фЁєу-фЁєує т√яюыэшЄ№ + ЄЁхсєхь√х юЄ эшї ўхЁхч IPC фхщёЄтш . ╚ хёыш є трё ъюья ёшы№эю + ЄюЁьючэ■ўшщ, Єю тючьюцэю, т√фхыхээюую тЁхьхэш сєфхЄ + эхфюёЄрЄюўэю. ▌Єю эх ёыюцэю яюыхўшЄ№, єтхышўшт чэрўхэшх + ebx яхЁхф т√чютюь ЇєэъЎшш  фЁр (eax,5 - ярєчр). ┬ яЁюЄштэюь + ёыєўрх ьюуєЄ яют√ыхЄрЄ№ т√чют√ IPC шыш ўЄю-эшсєф№ тююс∙х + чртшёэхЄ (яхЁтюх - тхЁю Єэхх). ═ю, хёЄхёЄтхээю, эшўхую + ёЄЁр°эюую т ¤Єюь эхЄ. ;-) + +----------------------------------------------------------------------- + + ╚чтхёЄэ√х ю°шсъш ш эхфюЁрсюЄъш: + + ╧Ёш ЁрсюЄх ё ъюэёюы№■ CMD ш ёшёЄхьющ MenuetOS тююс∙х,   + чрьхЄшы,ўЄю эхъюЄюЁ√х ёючфрээ√х т Menuet Їрщы√ эх + тюёяЁшэшьр■Єё  MS-DOS. ▌Єю т яхЁтє■ юўхЁхф№ ърёрхЄё  Їрщыют, + ё шьхэрьш Єшяр 1.1, b.bb ш Є.ф. ╧ю¤Єюьє тючьюцэ√ Ёрчышўэ√х + Єєяшъют√х ёшЄєрЎшш яЁш тчршьюфхщёЄтшш ёючфрээ√ї шыш + ъюяшЁютрээ√ї Їрщыют т MeOS ё тюёяЁш Єшхь шї т MS-DOS ш Windows + ёшёЄхьрї. ╚ ърёрхЄё  ¤Єю эх Єюы№ъю CMD, эю, эряЁшьхЁ, ш + Єшэшярфр. ╧ю¤Єюьє   Ёхъюьхэфє■ шёяюы№чютрЄ№ т Menuet Їрщы√ шыш + схч Ёрё°шЁхэш  тююс∙х, шыш ё яюыэ√ь Ёрё°шЁхэшхь (чрэшьр■∙шь + тёх 3 срщЄр, Є.х. filename.ext, р эх filename.ex). ┬ яЁшэЎшях + ьхїрэшчь ъюьрэф LS, LS шь _Їрщыр, CP, DEL ш RN шчьхэхэ, эю + яюър эхЄ ёютьхёЄшьюёЄш ьхцфє Ёрчышўэ√ьш яЁюуЁрььрьш, + ЁрсюЄр■∙шьш ё Їрщырьш т Menuet. ╥.х. фрцх тючьюцэю, + ўЄю т√ эх ёьюцхЄх ЁрсюЄрЄ№ т ъюэёюыш ё Їрщыюь, ёючфрээюь т + Єшэшярфх, р яюЄюь skandisk тююс∙х т√фрёЄ ю°шсъє яЁш яЁютхЁъх + Їрщыютющ ёЄЁєъЄєЁ√ фшёъхЄ√, ъюуфр эрЄъэхЄё  эр ¤ЄюЄ Їрщы, ш юэ + эх сєфхЄ ўшЄрхь шч windows шыш MS-DOS. ┬ яЁшэЎшях,   ЄхёЄшЁютры + яЁюуЁрььє Єюы№ъю эр ьюхь PC, яю¤Єюьє тючьюцэю тё╕. :) + + P.S. ╩юьрэфр LS яюърцхЄ яюыэюёЄ№■ тёх Їрщы√ эр Ёрьфшёъх, т Єюь + ўшёых Єх, ъюЄюЁ√х ёючфрэ√ эхяЁртшы№эю ш эх сєфєЄ ЁрсюЄрЄ№ т + MS-DOS, LS шь _Їрщыр ш Є.ф. ьюцхЄ єцх шї эх чрьхЄшЄ№. ┬ + яЁшэЎшях Єрър  цх ърЁЄшэр сєфхЄ ш т windows. ╥.х. т√ ёьюцхЄх + ышЎхчЁхЄ№ шьхэр ¤Єшї Їрщыют, эряЁшьхЁ, т windows commander'e, + эю сыюъэюЄ шї эх юЄъЁюхЄ. + + ─ы  Єюую, ўЄюср фрЄ№ тЁхь  CMD юсЁрсюЄрЄ№ IPC-чряЁюё, т + CMDIPC.ASM ьэх яЁш°ыюё№ шёяюы№чютрЄ№ 5-■ ЇєэъЎш■ (ярєчр), + яю¤Єюьє эхьэюую чрьхфы хЄё  тЁхь  яюыєўхэш  эют√ї IPC-чряЁюёют. + + ┬ фрээющ тхЁёшш т√ эх ьюцхЄх чряєёърЄ№ сюы№°х юфэюую + ЄхЁьшэрыр CMD юфэютЁхьхээю. ▌Єю ёт чрэю ё Єхь, ўЄю   х∙х эх + фюсртшы тючьюцэюёЄш ЁрсюЄ√ эхёъюы№ъшї ъюэёюыхщ ё + IPC-яЁюуЁрььрьш юфэютЁхьхээю. + + ╩юф яЁюуЁрьь√ эр фрээ√щ ьюьхэЄ эхюяЄшьшчшЁютрэ. + + etc. :) + +----------------------------------------------------------------------- + + ┬ьхёЄх ё яЁюуЁрььющ яюёЄрты хЄё  Їрщы autoexec.cmd, ъюЄюЁ√щ + ртЄюьрЄшўхёъш шёяюыэ хЄё  яЁш чряєёъх шэЄхЁяЁхЄрЄюЁр. ┼ую + ьюцэю єфрышЄ№ яЁш эхэрфюсэюёЄш. + + ─ы  т√чютр яЁшьхЁр шёяюыэ хьюую ёъЁшяЁр эрсхЁшЄх /example + + ┬ёт чш ё ьюыюфюёЄ№■ ш ўрёЄшўэющ эхфюЁрсюЄрээюёЄш ёрьющ + яЁюуЁрьь√ тючьюцэ√ ю°шсъш т х╕ ЁрсюЄх, ю ъюЄюЁ√ї яЁюё№ср + ёююс∙рЄ№ эр dmitry_gt@tut.by + + ┬ сышцрщ°хх тЁхь  эх яырэшЁєхЄё  эют√ї эютюттхфхэшщ т ъюэёюы№, + Є.ъ. эр х╕ фюЁрсюЄъє єїюфшЄ ьэюую тЁхьхэш ш   ёўшЄр■, ўЄю юэр + ш эр фрээ√щ ьюьхэЄ сюыхх-ьхэхх ЇєэъЎшюэры№эр (т ьрё°Єрсрї + MenuetOS, ъюэхўэю). ▀ ёўшЄр■, ўЄю ЁрЎшюэры№эхх сєфхЄ ёъюэЎхэЄ- + ЁшЁютрЄ№ё  эр єёЄрэхэшш сруют ш эхфюЁрсюЄюъ т яЁюуЁрььх. + + ┼ёыш ъЄю-эшсєф№ яюцхырхЄ фюфхырЄ№ яЁюуЁрььє, Єю   с√ яюяЁюёшы + эх шчьхэ Є№ х╕ фшчрщэ (ьэх юэ эЁртшЄё  ;-) ). + + ╬ тёхї ю°шсърї (┬ Єюь ўшёых уЁрььрЄшўхёъшї т рэуышщёъюь ЄхъёЄх) + яЁюё№ср ёююс∙рЄ№ эр dmitry_gt@tut.by + + ╚ х∙х чрс√ы ёърчрЄ№, Єю яЁюуЁрььр ЁрёяюёЄЁрэ хЄё  "as is", ш + ртЄюЁ эх эхёхЄ юЄтхЄёЄтхээюёЄш чр тючьюцэ√щ є∙хЁс, яЁшўшэхээ√щ + яЁюуЁрььющ. + + 19.06.2004, + Chemist + diff --git a/programs/colorref/trunk/build_en.bat b/programs/colorref/trunk/build_en.bat new file mode 100644 index 0000000000..5c704008b6 --- /dev/null +++ b/programs/colorref/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm colorref.asm colorref +@pause \ No newline at end of file diff --git a/programs/colorref/trunk/build_ru.bat b/programs/colorref/trunk/build_ru.bat new file mode 100644 index 0000000000..1eba30e40c --- /dev/null +++ b/programs/colorref/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm colorref.asm colorref +@pause \ No newline at end of file diff --git a/programs/colorref/trunk/colorref.asm b/programs/colorref/trunk/colorref.asm new file mode 100644 index 0000000000..5124949ef2 --- /dev/null +++ b/programs/colorref/trunk/colorref.asm @@ -0,0 +1,509 @@ +; COLORREF.ASM - COLOR REFERENCE +; +; Compile with FASM for Menuet +; + +use32 + org 0x0 + + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd start ; start of code + dd finis ; size of image + dd 0x100000 ; memory for app + dd 0x7fff0 ; esp + dd 0x0,0x0 ; I_Param , I_Icon + +include 'lang.inc' +wide: dd 0 ; screen pixels width +mouse: dd 0 ; 1=right,2=left [mouse click] + + +start: + + mov eax,14 ; get screen size + int 0x40 + shr eax,16 ; get width into AX + inc eax ; not 0 based + mov [wide],eax + + call draw_window + +still: + mov eax,23 ; wait for event w/timeout + mov ebx,5 ; delay in hundredths + int 0x40 + + cmp eax,1 ; redraw request ? + jne s1 + jmp red +s1: cmp eax,2 ; key in buffer ? + jne s2 + jmp key +s2: cmp eax,3 ; button in buffer ? + jne s3 + jmp button +s3: mov eax,9 ; process info function + mov ebx,stat_table ; return data table + mov ecx,-1 ; who am i + int 0x40 + cmp ax,[stat_table+4] ; are we active? + je active ; yep + jmp still + + active: + mov eax,37 ; mouse info function + mov ebx,2 ; get buttons + int 0x40 + cmp eax,0 ; mouse click? + jne click + jmp still + click: + mov [mouse],eax ; save mouse click + mov eax,37 ; mouse info + xor ebx,ebx ; get screen pos for mouse + int 0x40 ; into EAX + xor ebx,ebx + mov bx,ax ; BX=y screen position + shr eax,16 ; AX=x screen position + xchg eax,ebx ; EAX=y, EBX=x + dec eax ; don't calc mouse scanline + mov ecx,[wide] ; get pixels wide + mul ecx + add ebx,eax ; add x + mov eax,35 ; get mouse pos pixel + int 0x40 ; EAX=mouse pixel color + mov ebx,eax ; EBX has color + mov esi,colors ; color table + mov ecx,72 ; total colors + xor edx,edx ; init a counter + check: + lodsd + inc edx ; update counter + cmp ebx,eax ; color match? + je _match ; yep + loop check ; check all colors + jmp still ; no match + _match: + cmp [mouse],dword 1 ; right click? + je right ; yep + left: + cmp [picks],edx ; changed left color yet? + jne l1 ; no, do it + jmp still +l1: mov [picks],edx ; update left pick color + call clear ; erase old text + call draw_picks ; redraw colors and text + jmp still + right: + cmp [picks+4],edx ; changed right color yet? + jne r1 ; no, do it + jmp still +r1: mov [picks+4],edx ; update right pick color + call clear ; erase old text + call draw_picks ; redraw colors and text + jmp still + + red: ; redraw + call draw_window + jmp still + + key: ; key + mov eax,2 ; just read it and ignore + int 0x40 + cmp al,0 ; key in buffer? + je k1 ; yep + jmp still +k1: cmp ah,'H' ; cap H ? + je k2 ; yep + cmp ah,'h' ; locase h ? + je k2 ; yep + jmp still +k2: call help ; show help screen + jmp still + + button: ; button + mov eax,17 ; get id + int 0x40 + cmp ah,1 ; button id=1 ? + je close + jmp still + + close: + mov eax,-1 ; close this program + int 0x40 + + +; ********************************************* +; ******* WINDOW DEFINITIONS AND DRAW ******** +; ********************************************* + + +draw_window: + + mov eax,12 ; tell os about windowdraw + mov ebx,1 ; 1, start of draw + int 0x40 + + mov eax,0 ; DRAW WINDOW + mov ebx,1*65536+200 ; [x start] *65536 + [x size] + mov ecx,200*65536+240 ; [y start] *65536 + [y size] + mov edx,0x02000000 ; work area color (type II) + mov esi,0x82a0a0a0 ; grab bar color (w/glide) + mov edi,0x82bbbbbb ; frame color + int 0x40 + mov eax,4 ; WINDOW LABEL + mov ebx,8*65536+8 ; [x start] *65536 + [y start] + mov ecx,0xeeeeee ; color of text (white) + mov edx,prog_name ; pointer to header + mov esi,namelen-prog_name ; text length + int 0x40 + mov eax,8 ; CLOSE BUTTON + mov ebx,(200-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,0xaaaaaa ; button color (light grey) + int 0x40 + + call palette ; display color palette + + mov eax,12 ; tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + + ret + + +; ********************************************* +; ******* COLOR PALETTE LAYOUT ROUTINES ****** +; ********************************************* + + +palette: + mov ebx,15*65536+18 ; LAYOUT: start x and width + mov edx,32*65536+18 ; LAYOUT: start y and depth + mov ecx,8 ; 8 rows + mov ebp,colors ; color table +p1: push ecx + mov ecx,9 ; 9 columns +p2: push ecx + push edx + mov ecx,edx ; y coord + mov edx,[ebp] ; color + mov eax,13 ; draw bar function + int 0x40 + pop edx + pop ecx + add ebx,19*65536 ; next column + add ebp,4 ; next color +p3: loop p2 + pop ecx + mov ebx,15*65536+18 ; restart x + add edx,19*65536 ; next row + loop p1 + call draw_picks + + ret + +draw_picks: + mov ebx,64*65536+24 ; draw x and width + mov ecx,188*65536+42 ; draw y and depth + mov edx,0xc0c0c0 ; color grey + mov eax,13 ; draw bar function + int 0x40 + mov eax,[picks] ; first picked color + mov esi,22*65536+196 ; print at x and y + call do_hex ; print color number + mov eax,[picks+4] ; second picked color + mov esi,22*65536+215 ; print at x and y + call do_hex ; print color number + mov eax,[picks] ; first picked color + mov ebx,67*65536+18 ; x and width + mov esi,191*65536+18 ; y and depth + call do_color ; paint color 1 square + mov eax,[picks+4] ; second picked color + mov ebx,67*65536+18 ; x and width + mov esi,209*65536+18 ; y and depth + call do_color ; paint color 2 square + mov eax,[picks] ; first picked color + mov ebx,96*65536+196 ; x and y + call do_name ; print color's name + mov eax,[picks+4] ; second picked color + mov ebx,96*65536+215 ; x and y + call do_name ; print color's name + + ret + +do_hex: + dec eax ; use 0 base + mov ecx,4 ; dword length + mul ecx ; calc pointer + mov edi,colors ; color table + add edi,eax ; add offset + mov ecx,[edi] ; save color 1 + mov ebx,0x60100 ; print 6 hex digits + mov edx,esi ; copy color + mov esi,0xe1e1e1 ; use white + mov eax,47 ; print number function + int 0x40 + + ret + +do_color: + dec eax ; use 0 base + mov ecx,4 ; dword length + mul ecx ; calc pointer + mov edi,colors ; color table + add edi,eax ; add offset + mov edx,[edi] ; color + mov ecx,esi ; recover y an depth + mov eax,13 ; draw bar function + int 0x40 + + ret + +do_name: + dec eax ; use 0 base + mov ecx,15 ; string length + mul ecx ; calc pointer + mov edx,names ; color table + add edx,eax ; add offset + mov ecx,0xe1e1e1 ; color + mov esi,15 + mov eax,4 ; print text function + int 0x40 + + ret + +clear: + mov ebx,22*65536+36 ; x and width + mov ecx,196*65536+26 ; y and depth + mov edx,0x000000 ; color + mov eax,13 ; draw bar funx + int 0x40 + mov ebx,96*65536+90 ; x and width + mov ecx,196*65536+26 ; y and depth + mov edx,0x000000 ; color + mov eax,13 ; draw bar funx + int 0x40 + + ret + +help: + mov ebx,4*65536+192 ; x and width + mov ecx,20*65536+216 ; y and depth + mov edx,0x465e8f ; dark denim color + mov eax,13 ; write text funx + int 0x40 + mov ebx,20*65536+40 ; starting x and y + mov edx,text ; start of text + mov esi,27 ; width of text + mov ecx,14 ; 14 text lines to do + mov eax,4 ; write text funx +h1: push ecx + sub ebx,65537 ; drop shadow x and y + mov ecx,0x000000 ; black shadow + int 0x40 + add ebx,65537 ; original x and y + mov ecx,0xefefef ; white text + int 0x40 + add edx,27 ; next line of text + add bx,12 ; next row + pop ecx + loop h1 + mov eax,10 ; wait on event + int 0x40 + cmp eax,2 ; got a key? + jne h2 ; nope + mov eax,2 ; yep, burn it + int 0x40 +h2: mov ebx,4*65536+192 ; y and width + mov ecx,20*65536+216 ; x and depth + mov edx,0x00000 ; restore black bkg + mov eax,13 ; draw bar funx + int 0x40 + call palette ; redraw color palette + + ret + + +; ********************************************* +; ********** DATA DEFINITIONS AREA *********** +; ********************************************* + +prog_name: + db 'COLOR REFERENCE H>HELP' +namelen: + +picks: + dd 31,2 ; selected top/bot colors + +colors: + dd 0xe0e0e0 ; white + dd 0xe7e6a0 ; pale yellow + dd 0xe7e05a ; lemon yellow + dd 0xe7c750 ; mustard + dd 0xe7b850 ; cadium yellow + dd 0xbfa461 ; yellow ocre + dd 0xe0c090 ; cream + dd 0xe0b27b ; peach + dd 0xe2986d ; dark peach + dd 0xebb2c0 ; pink + dd 0xe0b0a0 ; flesh + dd 0xc79790 ; artificial arm + dd 0xb88688 ; deep blush + dd 0xc4a077 ; washed khaki + dd 0xb69269 ; khaki + dd 0xa8845b ; dark khaki + dd 0xab937a ; beige + dd 0xa39370 ; poupon + dd 0x988c00 ; camouflage + dd 0x98a024 ; pale olive + dd 0x838b00 ; olive + dd 0x6d7600 ; dark olive + dd 0x5b6200 ; black olive + dd 0x94946a ; washed army + dd 0x74744a ; army + dd 0x66a696 ; pale teal + dd 0x409b90 ; faded teal + dd 0x008d8d ; pastel teal + dd 0x007c7c ; teal + dd 0x006464 ; dark teal + dd 0x00b8ca ; light turquoise + dd 0x00a0b2 ; turquoise + dd 0x00889a ; dark turquoise + dd 0x575f8c ; medium cobalt + dd 0x4e4e7c ; cobalt + dd 0x00459a ; ultramarine + dd 0x400088 ; navy blue + dd 0x4e00e7 ; true blue + dd 0x508cec ; sky blue + dd 0x6a73d0 ; mountain blue + dd 0x677ab0 ; faded jeans + dd 0x576fa0 ; denim + dd 0xd048c8 ; fuschia + dd 0xb800e7 ; lavendar + dd 0xa800a8 ; light violet + dd 0x780078 ; violet + dd 0x520064 ; purple + dd 0xb800b8 ; magenta + dd 0xa4307a ; rose + dd 0x90207f ; mauve + dd 0xe76e83 ; salmon + dd 0xea7a7d ; pastel orange + dd 0xe26830 ; orange + dd 0xac5800 ; burnt sienna + dd 0xcc0000 ; red orange + dd 0xac0000 ; cadium red + dd 0x880040 ; brick red + dd 0x780000 ; rust + dd 0x683020 ; terra cotta + dd 0x7f4658 ; light maroon + dd 0x702050 ; maroon + dd 0x7a5b5f ; umber blush + dd 0x584838 ; burnt umber + dd 0x8a5d1a ; cigar brown + dd 0x64504a ; ice brown + dd 0x564242 ; dark chocolate + dd 0x00aa66 ; celery stalk + dd 0x107a30 ; forest green + dd 0x365800 ; hooker's green + dd 0x8beb88 ; pastel lime + dd 0x7bbb64 ; lime + dd 0x4ba010 ; dark lime + +names: + db 'WHITE ' + db 'PALE YELLOW ' + db 'LEMON YELLOW ' + db 'MUSTARD ' + db 'CADIUM YELLOW ' + db 'YELLOW OCRE ' + db 'CREAM ' + db 'PEACH ' + db 'DARK PEACH ' + db 'PINK ' + db 'FLESH ' + db 'ARTIFICIAL ARM ' + db 'DEEP BLUSH ' + db 'WASHED KHAKI ' + db 'KHAKI ' + db 'DARK KHAKI ' + db 'BEIGE ' + db 'POUPON ' + db 'CAMOUFLAGE ' + db 'PALE OLIVE ' + db 'OLIVE ' + db 'DARK OLIVE ' + db 'BLACK OLIVE ' + db 'WASHED ARMY ' + db 'ARMY ' + db 'PALE TEAL ' + db 'FADED TEAL ' + db 'PASTEL TEAL ' + db 'TEAL ' + db 'DARK TEAL ' + db 'LIGHT TURQUOISE' + db 'TURQUOISE ' + db 'DARK TURQUOISE ' + db 'MEDIUM COBALT ' + db 'COBALT ' + db 'ULTRAMARINE ' + db 'NAVY BLUE ' + db 'TRUE BLUE ' + db 'SKY BLUE ' + db 'MOUNTAIN BLUE ' + db 'FADED JEANS ' + db 'DENIM ' + db 'FUSHIA ' + db 'LAVENDAR ' + db 'LIGHT VIOLET ' + db 'VIOLET ' + db 'PURPLE ' + db 'MAGENTA ' + db 'ROSE ' + db 'MAUVE ' + db 'SALMON ' + db 'PASTEL ORANGE ' + db 'ORANGE ' + db 'BURNT SIENNA ' + db 'RED ORANGE ' + db 'CADIUM RED ' + db 'BRICK RED ' + db 'RUST ' + db 'TERRA COTTA ' + db 'LIGHT MAROON ' + db 'MAROON ' + db 'UMBER BLUSH ' + db 'BURNT UMBER ' + db 'CIGAR BROWN ' + db 'ICE BROWN ' + db 'DARK CHOCOLATE ' + db 'CELERY STALK ' + db 'FOREST GREEN ' + db "HOOKER'S GREEN " + db 'PASTEL LIME ' + db 'LIME ' + db 'DARK LIME ' + + +text: + db 'TO SEE HOW COLORS COMPARE ' + db 'TO ONE ANOTHER, LEFT CLICK ' + db 'THE FIRST COLOR AND RIGHT ' + db 'CLICK THE SECOND. TO GET ' + db "A SENSE OF A COLOR'S TRUE " + db 'HUE, RIGHT AND LEFT CLICK ' + db 'THE SAME COLOR TO SEE IT ' + db 'ON THE NEUTRAL BACKGROUND. ' + db 'TO USE A LIGHTER OR DARKER ' + db 'VALUE OF A COLOR, ADD OR ' + db 'SUBTRACT 0x10 OR 0x20 FROM ' + db 'EACH BYTE OF ITS HEX VALUE.' + db ' ' + db ' ANY KEY ... ' + +stat_table: + + +finis: \ No newline at end of file diff --git a/programs/colors/trunk/build_en.bat b/programs/colors/trunk/build_en.bat new file mode 100644 index 0000000000..82e54d9fca --- /dev/null +++ b/programs/colors/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm colors.asm colors +@pause \ No newline at end of file diff --git a/programs/colors/trunk/build_ru.bat b/programs/colors/trunk/build_ru.bat new file mode 100644 index 0000000000..b3e5e7de48 --- /dev/null +++ b/programs/colors/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm colors.asm colors +@pause \ No newline at end of file diff --git a/programs/colors/trunk/colors.asm b/programs/colors/trunk/colors.asm new file mode 100644 index 0000000000..59af1f7d98 --- /dev/null +++ b/programs/colors/trunk/colors.asm @@ -0,0 +1,206 @@ +; +; COLOR TABLE +; +; 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 = 0x7FFF0 + dd 0x00000000 ; reserved=no extended header + +include 'lang.inc' +include 'macros.inc' + + +START: ; start of execution + + call shape_window + + 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 noclose + mov eax,0xffffffff ; close this program + int 0x40 + noclose: + + jmp still + + +shape_window: + + pusha + + mov eax,50 ; give the address of reference area + mov ebx,0 + mov ecx,shape_reference + int 0x40 + + mov eax,50 ; give the scaling ( 5 -> 2^5 ) + mov ebx,1 + mov ecx,5 + int 0x40 + + popa + + ret + + +shape_reference: + + db 1,0,1,0,1,0,1,0 + db 0,1,0,1,0,1,0,1 + db 1,0,1,0,1,0,1,0 + db 0,1,0,1,0,1,0,1 + db 1,0,1,0,1,0,1,0 + db 0,1,0,1,0,1,0,1 + db 1,0,1,0,1,0,1,0 + db 0,1,0,1,0,1,0,1 + + + +; ********************************************* +; ******* 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+255 ; [x start] *65536 + [x size] + mov ecx,100*65536+255 ; [y start] *65536 + [y size] + mov edx,0x00000000 + mov esi,0x8099bbff ; color of grab bar RRGGBB,8->color glide + mov edi,0x0099bbee ; color of frames RRGGBB + int 0x40 + + call draw_colors + + ; CLOSE BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,5*65536+12 ; [x start] *65536 + [x size] + mov ecx,5*65536+12 ; [y start] *65536 + [y size] + mov edx,1 ; button id + mov esi,0xccaa22 ; button color RRGGBB + int 0x40 + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + + ret + + +draw_colors: + + pusha + + mov [bar],dword 0 + + mov eax,-1 + mov ebx,0 + mov ecx,0 + mov edx,0 + + mov edi,0 + + dc1: + + add eax,1 + cmp eax,256 + jb na1 + mov eax,0 + add ebx,1 + cmp ebx,256 + jb na1 + mov ebx,0 + add ecx,5 + na1: + + mov dl,al + shl edx,8 + mov dl,bl + shl edx,8 + mov dl,cl + + na2: + + pusha + push edx + + xor edx,edx + mov eax,edi + mov ebx,256 + div ebx + mov ebx,edx + mov ecx,eax + + add ebx,[addx] + add ecx,[addy] + + pop edx + mov eax,1 + int 0x40 + popa + + add edi,1 + + cmp edi,256*256 + jb dc1 + + popa + ret + + + +; DATA AREA + +I_END: + +bar dd ? + +add1 dd ? +add2 dd ? + +addx dd ? +addy dd ? diff --git a/programs/colors/trunk/macros.inc b/programs/colors/trunk/macros.inc new file mode 100644 index 0000000000..1d153e8723 --- /dev/null +++ b/programs/colors/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 + +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 \ No newline at end of file diff --git a/programs/copy2/trunk/build_en.bat b/programs/copy2/trunk/build_en.bat new file mode 100644 index 0000000000..516420a11e --- /dev/null +++ b/programs/copy2/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm copy2.asm copy2 +@pause \ No newline at end of file diff --git a/programs/copy2/trunk/build_ru.bat b/programs/copy2/trunk/build_ru.bat new file mode 100644 index 0000000000..24170d989e --- /dev/null +++ b/programs/copy2/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm copy2.asm copy2 +@pause \ No newline at end of file diff --git a/programs/copy2/trunk/copy2.asm b/programs/copy2/trunk/copy2.asm new file mode 100644 index 0000000000..5b1d215894 --- /dev/null +++ b/programs/copy2/trunk/copy2.asm @@ -0,0 +1,427 @@ +; project name: SYSTREE FILE COPIER +; version: 1.1b +; last update: 18/07/2004 +; compiler: FASM 1.52 +; written by: Ivan Poddubny +; e-mail: ivan-yar@bk.ru +; copying-policy: GPL + +; History: +; 18/07/2004 strings using "lsz" macro + french language (not 100%!) +; 04/06/2004 Bugfix for memory - thanks to Ville +; ... + + use32 + org 0x0 + + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd I_END ; size of image + dd 0x20201 ; memory for app + dd 0x10000 ; esp + dd 0x0 , 0x0 ; I_Param , I_Icon + +include 'lang.inc' +include 'macros.inc' ; very useful stuff for MeOS +STRLEN = 48 ; maximal length of filename + + +START: ; start of execution + +red: + call draw_window ; at first, draw the window + +still: ; main cycle of application begins here + + mov eax,10 ; wait here for event + int 0x40 + + dec eax ; redraw request ? + jz red + dec eax ; key in buffer ? + jz key + dec eax ; button in buffer ? + jz button + + jmp still + + key: ; key event handler + mov eax,2 ; just read it and ignore + int 0x40 + jmp still ; return to main loop + + button: ; button + mov eax,17 ; get id + int 0x40 + + cmp ah,1 ; button id=1 ? (close_btn) + jz close + + cmp ah,2 ; copy ? + je copy_file + +; read_string: + + cmp ah,5 ; user pressed dest button ? + jz dstbtn + cmp ah,4 ; user pressed src button ? + jnz still + + srcbtn: + mov [addr],dword source + mov [ya],dword 36 + jmp rk + dstbtn: + mov [addr],dword destination + mov [ya],dword 36+16 + + rk: + mov edi,[addr] ; load the address of the string + mov al,0 ; the symbol we will search for + mov ecx,STRLEN+1 ; length of the string (+1) + cld ; search forward + repne scasb ; do search now + inc ecx ; we've found a zero or ecx became 0 + mov eax,STRLEN+1 + sub eax,ecx ; eax = address of <0> character + mov [temp],eax ; position + + call print_text + + mov edi,[addr] ; address of string + add edi,[temp] ; cursor position + + .waitev: + mov eax,10 + int 0x40 + cmp eax,2 + jnz still +; mov eax,2 + int 0x40 + shr eax,8 + cmp eax,8 + jnz .nobs ; BACKSPACE + cmp edi,[addr] + jz .waitev + dec edi + mov [edi],byte 0 + call print_text + jmp .waitev + .nobs: + cmp eax,13 ; ENTER + je still + cmp eax,192 + jne .noclear + xor al,al + mov edi,[addr] + mov ecx,STRLEN + rep stosb + mov edi,[addr] + call print_text + jmp .waitev + + .noclear: + mov [edi],al + + call print_text + + inc edi + mov esi,[addr] + add esi,STRLEN + cmp esi,edi + jnz .waitev + + jmp still + + + close: + or eax,-1 ; close program + int 0x40 + + +;==================================================== +; copy_file +; This piece of code copies src file to dst file, +; then it pass the control to copy_error routine, +; which returns to the main cycle of the app. +; It's NOT a function! It's reached by direct jump +; from the button handler. +;==================================================== +copy_file: + ; at first we must get the size of the source file + mov [source_info.blocks],1 ; load only 512 bytes + mov eax,58 + mov ebx,source_info + int 0x40 + + ; now eax contains error code + ; and ebx contains file size in bytes + test eax,eax ; check if eax is equal to zero (success) + je .ok_getsize ; eax = 0 => continue + cmp eax,6 + jna @f + mov eax,7 ; if error code is above 6, it will be 7 + @@: + cmp eax,5 ; file might be copied successfully altrough + ; the system reports an error 5 + jne copy_error ; print error code now + .ok_getsize: + + ; allocate memory + push ebx ; save file size + mov ecx,ebx + add ecx,0x20000 ; size of memory needed = 0x20000+filesize + mov eax,64 ; func 64 + mov ebx,1 ; resize application memory + int 0x40 + pop ebx ; restore filesize + + ; check if alloc function failed + test eax,eax ; non-zero value means error + je .ok_memory + mov eax,5 ; error 5 - out of memory + jmp copy_error ; print error code now + .ok_memory: + + ; save number of blocks to source_info + shr ebx,9 ; divide by 512 + inc ebx ; blocks++ + mov [source_info.blocks],ebx + ; read the source file + mov eax,58 + mov ebx,source_info + int 0x40 + + ; ebx = file size + ; save loaded file + mov [dest_info.bytes2write],ebx ; file size in bytes + mov eax,58 + mov ebx,dest_info + int 0x40 + + ; check if 58 function failed + test eax,eax + je .ok_write + add eax,7 ; error number += 7 + cmp eax,6+7 + jna copy_error + mov eax,7+7 + jmp copy_error + .ok_write: + + ; return to the initial amount of memory + mov eax,64 + mov ebx,1 + mov ecx,0x20201 + int 0x40 + + xor eax,eax ; eax = message number (0-OK) + + +; print message now +copy_error: + mov edi,eax + mov eax,4 + mov ebx,20*65536+83 + mov ecx,0x10ff0000 + mov edx,[errors+edi*8] + mov esi,[errors+edi*8+4] + int 0x40 +jmp still + + +; print strings (source & destination) +print_text: + mov eax,13 + mov ebx,107*65536+STRLEN*6 + mov ecx,[ya] + shl ecx,16 + add ecx,9 + mov edx,0xf2f2f2 + int 0x40 + + mov eax,4 + mov ebx,109*65536 + add ebx,[ya] + xor ecx,ecx + mov edx,[addr] + mov esi,STRLEN + int 0x40 + + ret + + +; ********************************************* +; ******* 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 + xor eax, eax ; function 0 : define and draw window + mov ebx, 160*65536+415 ; [x start] *65536 + [x size] + mov ecx, 160*65536+100 ; [y start] *65536 + [y size] + mov edx, 0x03DDDDDD ; color of work area 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, 0x10ffffff ; color of text RRGGBB + mov edx, header ; pointer to text beginning + mov esi, header.size ; text length + int 0x40 + + mov eax, 8 ; COPY BUTTON + mov ebx, 20*65536+375 + mov ecx, 63*65536+16 + mov edx, 2 + mov esi, 0xCCCCCC + int 0x40 + + mov ebx, 105*65536+290 + mov ecx, 33*65536+12 + mov edx, 4 + mov esi, 0xEBEBEB + int 0x40 + + mov ebx, 105*65536+290 + mov ecx, 49*65536+12 + mov edx, 5 + mov esi, 0xEBEBEB + int 0x40 + + mov esi, source + mov edi, text+14 + mov ecx, STRLEN + rep movsb + + mov esi, destination + mov edi, text+STRLEN+59-45+14 + mov ecx, STRLEN + rep movsb + + mov ebx, 25*65536+36 ; print filenames + xor ecx, ecx + mov edx, text + mov esi, STRLEN+59-45 + newline: + mov eax, 4 + int 0x40 + add ebx, 16 + add edx, STRLEN+59-45 + 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 +align 4 +source_info: ; SOURCE FILEINFO + .mode dd 0 ; read file + .start_block dd 0x0 ; block to read + .blocks dd 0x700 ; num of blocks + .address dd 0x20000 + .workarea dd 0x10000 + source db '/HD/1/KERNEL/KERNEL.MNT',0 + times (STRLEN-23) db 0 + +dest_info: ; DESTINATION FILEINFO + .mode dd 1 ; write + .notused dd 0x0 ; not used + .bytes2write dd 0 ; bytes to write + .address dd 0x20000 + .workarea dd 0x10000 + destination db '/RD/1/KERNEL.MNT',0 + times (STRLEN-16) db 0 + + align 4 + addr dd 0x0 + ya dd 0x0 + temp dd 0 + + +lsz text,\ + ru, ' ОТКУДА: | Россия, Ярославль ',\ + ru, ' КУДА: | Поддубный Иван, ivan-yar@bk.ru ',\ + ru, ' КОПИРОВАТЬ ',\ + ru, 'x',\ ; <- END MARKER, DONT DELETE +\ + en, 'SOURCE: | Russia, Yaroslavl ',\ + en, 'DESTINATION: | Poddubny Ivan, ivan-yar@bk.ru ',\ + en, ' COPY SOURCE -> DESTINATION ',\ + en, 'x',\ ; <- END MARKER, DONT DELETE +\ + fr, 'SOURCE: | ',\ + fr, 'DESTINATION: | ',\ + fr, ' COPIER ',\ + fr, 'x' + + +lsz header,\ + ru, 'КОПИРОВАТЬ ФАЙЛ',\ + en, 'SYSTREE FILE COPIER',\ + fr, 'COPIER LE FICHIER' + + +;  This macro is used to define a string table in format +macro strtbl name,[string] + { + common + label name dword + forward + local str,size + dd str,size + forward + str db string + size = $ - str + } + +if lang eq ru +strtbl errors,\ + "файл скопирован успешно",\ + "(чтение) не задана база жд",\ + "(чтение) файловая система не поддерживается",\ + "(чтение) неизвестная файловая система",\ + "(чтение) не задан раздел жд",\ + "недостаточно памяти",\ + "(чтение) конец файла",\ + "(чтение) неизвестная ошибка",\ + "(запись) не задан раздел жд",\ + "(запись) файловая система не поддерживается",\ + "(запись) неизвестная файловая система",\ + "(запись) не задан раздел жд",\ + "?",\ + "(запись) файл не найден",\ + "(запись) неизвестная ошибка" +else +strtbl errors,\ + "Success!",\ + "(read) no hd base or partition defined",\ + "(read) unsupported file system",\ + "(read) unknown file system",\ + "(read) hd partition not defined",\ + "out of memory",\ + "(read) end of file",\ + "(read) unknown error",\ + "(write) no hd base or partition defined",\ + "(write) unsupported file system",\ + "(write) unknown file system",\ + "(write) hd partition not defined",\ + "?",\ + "(write) end of file",\ + "(write) unknown error" +end if + +I_END: diff --git a/programs/copy2/trunk/macros.inc b/programs/copy2/trunk/macros.inc new file mode 100644 index 0000000000..1d153e8723 --- /dev/null +++ b/programs/copy2/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 + +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 \ No newline at end of file diff --git a/programs/copyr/trunk/ascl.inc b/programs/copyr/trunk/ascl.inc new file mode 100644 index 0000000000..20a18bf31d --- /dev/null +++ b/programs/copyr/trunk/ascl.inc @@ -0,0 +1,835 @@ +lang equ ru ; ru en fr ge fi + +; +; Assembler +; SMALL +; CODE +; Libary +; +; Ver 0.14 By Pavlushin Evgeni (RUSSIA) +; www.waptap@mail.ru + +;Please compile aplications on FASM ver1.54 or higer!!! + +;InfoList +;0.01 scank,putpix,puttxt +;0.02 label,random,colors +;0.03 window,startwd,endwd,attributes +;0.04 close,delay,scevent ~30.04.2004 +;0.05 small random, ~04.05.2004 +;0.06 wtevent ~09.05.2004 +;0.07 timeevent ~23.05.2004 +;0.08 txtput ~14.06.2004 +;0.09 opendialog,savedialog ~20.06.2004 +;0.10 wordstoreg by halyavin, add at ~30.08.2004 +; random bug deleted eax is use. +;0.11 loadfile from me +puttxt bug del ~07.09.2004 +;0.12 open/save dialog ~13.09.2004 +;0.13 dialogs bugs deleted +;0.14 drawlbut ~03.10.2004 + +; LOADFILE +; (SYNTAX) LOADFILE 'full_path_to_file',file_load_area,file_temp_area +; (SAMPLE) LOADFILE '/rd/1/clock.bmp',load_area,temp_area + +macro loadfile file_name,file_load_area,file_temp_area +{ +local open,fileinfo,string + jmp open +fileinfo: + dd 0 + dd 0 + dd 1 + dd file_load_area + dd file_temp_area +string: + db file_name,0 +open: + mov dword [fileinfo+8],1 ; how many blocks to read (1) + mov eax,58 + mov ebx,fileinfo + int 0x40 + mov eax,[file_load_area+2] + shr eax,9 ; поделим на 512 и прибавим 1 - получим число блоков + inc eax + mov dword [fileinfo+8],eax + mov eax,58 + mov ebx,fileinfo + int 0x40 +} + + +macro wordstoreg reg,hiword,loword +{ +if hiword eqtype 0 & loword eqtype 0 + mov reg,hiword*65536+loword +else if hiword eqtype 12 & loword eqtype eax + mov reg,hiword*65536 + add reg,loword +else if hiword eqtype 12 & loword eqtype [123] + mov reg,hiword*65536 + add reg,loword +else + mov reg,hiword + shl reg,16 + add reg,loword +end if +} + + +; DRAW BUTTON with label + +macro drawlbut x,y,xs,ys,text,id,bcolor,tcolor +{ +local asd,lab + jmp asd +lab db text ;arg label +asd: + wordstoreg ebx,x,xs + wordstoreg ecx,y,ys + mov edx,id + mov esi,bcolor + mov eax,8 + int 0x40 + + mov eax,asd-lab ;calc size + mov ebx,6 + mul ebx + mov esi,eax + + mov eax,xs + sub eax,esi + shr eax,1 + add eax,x + + mov edx,ys + sub edx,7 + shr edx,1 + add edx,y + + mov ebx,eax + shl ebx,16 + add ebx,edx + + mov ecx,tcolor ;arg4 color + mov edx,lab + mov esi,asd-lab ;calc size + mov eax,4 + int 0x40 +} + + +macro opendialog redproc,openoff,erroff,path +{ +local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc +local run_fileinfo, param +local getmesloop, loox, mred, mkey, mbutton, mgetmes +local dlg_is_work, ready, procinfo +; +; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, +; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) +; + + cld +;; mov esi,path + mov edi,path + mov eax,0 + mov ecx,200 + rep stosb + +;mov [get_loops],0 +mov [dlg_pid_get],0 + +; Get my PID in dec format 4 bytes + mov eax,9 + mov ebx,procinfo + mov ecx,-1 + int 0x40 + +; convert eax bin to param dec + mov eax,dword [procinfo+30] ;offset of myPID + mov edi,param+4-1 ;offset to 4 bytes + mov ecx,4 + mov ebx,10 + cld +new_d: + xor edx,edx + div ebx + add dl,'0' + mov [edi],dl + dec edi + loop new_d + +; wirite 1 byte space to param + mov [param+4],byte 32 ;Space for next parametr +; and 1 byte type of dialog to param + mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog) + +; +; STEP2 prepare IPC area for get messages +; + +; prepare IPC area + mov [path],dword 0 + mov [path+4],dword 8 + +; define IPC memory + mov eax,60 + mov ebx,1 ; define IPC + mov ecx,path ; offset of area + mov edx,150 ; size 150 bytes + int 0x40 + +; change wanted events list 7-bit IPC event + mov eax,40 + mov ebx,01000111b + int 0x40 + +; +; STEP 3 run SYSTEM XTREE with parameters +; + + mov eax,58 + mov ebx,run_fileinfo + int 0x40 + + call redproc + + mov [get_loops],0 +getmesloop: + mov eax,23 + mov ebx,50 ;0.5 sec + int 0x40 + + cmp eax,1 + je mred + cmp eax,2 + je mkey + cmp eax,3 + je mbutton + cmp eax,7 + je mgetmes + +; Get number of procces + mov ebx,procinfo + mov ecx,-1 + mov eax,9 + int 0x40 + mov ebp,eax + +loox: + mov eax,9 + mov ebx,procinfo + mov ecx,ebp + int 0x40 + mov eax,[DLGPID] + cmp [procinfo+30],eax ;IF Dialog find + je dlg_is_work ;jmp to dlg_is_work + dec ebp + jnz loox + + jmp erroff + +dlg_is_work: + cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated + je erroff ;TESTODP2 terminated too + + cmp [dlg_pid_get],dword 1 + je getmesloop + inc [get_loops] + cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated + jae erroff + jmp getmesloop + +mred: + call redproc + jmp getmesloop +mkey: + mov eax,2 + int 0x40 ; read (eax=2) + jmp getmesloop +mbutton: + mov eax,17 ; get id + int 0x40 + cmp ah,1 ; button id=1 ? + jne getmesloop + mov eax,-1 ; close this program + int 0x40 +mgetmes: + +; If dlg_pid_get then second message get jmp to still + cmp [dlg_pid_get],dword 1 + je ready + +; First message is number of PID SYSXTREE dialog + +; convert PID dec to PID bin + movzx eax,byte [path+16] + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+1] + add eax,ebx + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+2] + add eax,ebx + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+3] + add eax,ebx + sub eax,48 + mov [DLGPID],eax + +; Claear and prepare IPC area for next message + mov [path],dword 0 + mov [path+4],dword 8 + mov [path+8],dword 0 + mov [path+12],dword 0 + mov [path+16],dword 0 + +; Set dlg_pid_get for get next message + mov [dlg_pid_get],dword 1 + call redproc ;show DLG_PID + jmp getmesloop + +ready: +; +; The second message get +; Second message is 100 bytes path to SAVE/OPEN file +; shl path string on 16 bytes +; + cld + mov esi,path+16 + mov edi,path + mov ecx,200 + rep movsb + mov [edi],byte 0 + + jmp openoff + + +; DATA AREA +get_loops dd 0 +dlg_pid_get dd 0 +DLGPID dd 0 + +param: + dd 0 ; My dec PID + dd 0,0 ; Type of dialog + +run_fileinfo: + dd 16 + dd 0 + dd param + dd 0 + dd procinfo ; 0x10000 +;run_filepath + db '/RD/1/SYSXTREE',0 + +procinfo: +times 256 db 0 +} + + +macro savedialog redproc,openoff,erroff,path +{ +local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc +local run_fileinfo, run_filepath, param +local getmesloop, loox, mred, mkey, mbutton, mgetmes +local dlg_is_work, ready, procinfo +; +; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, +; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) +; + + cld +;; mov esi,path + mov edi,path + mov eax,0 + mov ecx,200 + rep stosb + +;mov [get_loops],0 +mov [dlg_pid_get],0 + +; Get my PID in dec format 4 bytes + mov eax,9 + mov ebx,procinfo + mov ecx,-1 + int 0x40 + +; convert eax bin to param dec + mov eax,dword [procinfo+30] ;offset of myPID + mov edi,param+4-1 ;offset to 4 bytes + mov ecx,4 + mov ebx,10 + cld +new_d: + xor edx,edx + div ebx + add dl,'0' + mov [edi],dl + dec edi + loop new_d + +; wirite 1 byte space to param + mov [param+4],byte 32 ;Space for next parametr +; and 1 byte type of dialog to param + mov [param+5],byte 'S' ;Get Open dialog (Use 'S' for Save dialog) + +; +; STEP2 prepare IPC area for get messages +; + +; prepare IPC area + mov [path],dword 0 + mov [path+4],dword 8 + +; define IPC memory + mov eax,60 + mov ebx,1 ; define IPC + mov ecx,path ; offset of area + mov edx,120 ; size 150 bytes + int 0x40 + +; change wanted events list 7-bit IPC event + mov eax,40 + mov ebx,01000111b + int 0x40 + +; +; STEP 3 run SYSTEM XTREE with parameters +; + + mov eax,58 + mov ebx,run_fileinfo + int 0x40 + + call redproc + + mov [get_loops],0 +getmesloop: + mov eax,23 + mov ebx,50 ;0.5 sec + int 0x40 + + cmp eax,1 + je mred + cmp eax,2 + je mkey + cmp eax,3 + je mbutton + cmp eax,7 + je mgetmes + +; Get number of procces + mov ebx,procinfo + mov ecx,-1 + mov eax,9 + int 0x40 + mov ebp,eax + +loox: + mov eax,9 + mov ebx,procinfo + mov ecx,ebp + int 0x40 + mov eax,[DLGPID] + cmp [procinfo+30],eax ;IF Dialog find + je dlg_is_work ;jmp to dlg_is_work + dec ebp + jnz loox + + jmp erroff + +dlg_is_work: + cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated + je erroff ;TESTODP2 terminated too + + cmp [dlg_pid_get],dword 1 + je getmesloop + inc [get_loops] + cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated + jae erroff + jmp getmesloop + +mred: + call redproc + jmp getmesloop +mkey: + int 0x40 ; read (eax=2) + jmp getmesloop +mbutton: + mov eax,17 ; get id + int 0x40 + cmp ah,1 ; button id=1 ? + jne getmesloop + mov eax,-1 ; close this program + int 0x40 +mgetmes: + +; If dlg_pid_get then second message get jmp to still + cmp [dlg_pid_get],dword 1 + je ready + +; First message is number of PID SYSXTREE dialog + +; convert PID dec to PID bin + movzx eax,byte [path+16] + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+1] + add eax,ebx + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+2] + add eax,ebx + sub eax,48 + imul eax,10 + movzx ebx,byte [path+16+3] + add eax,ebx + sub eax,48 + mov [DLGPID],eax + +; Claear and prepare IPC area for next message + mov [path],dword 0 + mov [path+4],dword 8 + mov [path+8],dword 0 + mov [path+12],dword 0 + mov [path+16],dword 0 + +; Set dlg_pid_get for get next message + mov [dlg_pid_get],dword 1 + call redproc ;show DLG_PID + jmp getmesloop + +ready: +; +; The second message get +; Second message is 100 bytes path to SAVE/OPEN file +; shl path string on 16 bytes +; + cld + mov esi,path+16 + mov edi,path + mov ecx,200 + rep movsb + mov [edi],byte 0 + + jmp openoff + + +; DATA AREA +get_loops dd 0 +dlg_pid_get dd 0 +DLGPID dd 0 + +param: + rb 4 ; My dec PID + rb 6 ; Type of dialog + +run_fileinfo: + dd 16 + dd 0 + dd param + dd 0 + dd procinfo +run_filepath: + db '/RD/1/SYSXTREE',0 + +procinfo: +times 256 db 0 +} + + + + +; RANDOM - generate random count (small) +; (SYNTAX) RANDOM MaxCount,OutArgument +; (SAMPLE) RANDOM 10000,eax +; ( NOTE ) Maxint<65536 ; use random 65536,eax for more combinations + +randomuse = 0 + +macro random arg1,arg2 +{ +local rxproc +randomuse = randomuse + 1 + + jmp rxproc + +if defined randomuse & randomuse = 1 +randomproc: + jmp rnj +rsx1 dw 0x4321 +rsx2 dw 0x1234 +rnj: +; mov eax,arg1 + push bx + push cx + push dx + push si + push di + mov cx,ax + mov ax,word ptr rsx1 + mov bx,word ptr rsx2 + mov si,ax + mov di,bx + mov dl,ah + mov ah,al + mov al,bh + mov bh,bl + xor bl,bl + rcr dl,1 + rcr ax,1 + rcr bx,1 + add bx,di + adc ax,si + add bx,0x62e9 + adc ax,0x3619 + mov word ptr rsx1,bx + mov word ptr rsx2,ax + xor dx,dx + cmp ax,0 + je nodiv + cmp cx,0 + je nodiv + div cx +nodiv: + mov ax,dx + pop di + pop si + pop dx + pop cx + pop bx + and eax,0000ffffh +; mov arg2,0 +; mov arg2,eax + ret +end if + +rxproc: + mov eax,arg1 + call randomproc + mov arg2,eax +} + +macro scank +{ + mov eax,10 + int 0x40 +} + +macro putpix x,y,color +{ + mov ebx,x + mov ecx,y + mov edx,color + mov eax,1 + int 0x40 +} + +macro puttxt x,y,offs,size,color +{ +; mov ebx,x +; shl ebx,16 +; add ebx,y + wordstoreg ebx,x,y + mov ecx,color + mov edx,offs + mov esi,size + mov eax,4 + int 0x40 +} + +macro outcount data, x, y, color, numtype +{ + mov ecx,data + mov ebx,numtype + mov bl,0 +; mov edx,x*65536+y + wordstoreg edx,x,y + mov esi,color + mov eax,47 + int 0x40 +} + +; SCEVENT - Scan event + +macro scevent red,key,but +{ + mov eax,11 + int 0x40 + dec eax + jz red + dec eax + jz key + dec eax + jz but +} + +; WTEVENT - Wait event + +macro wtevent red,key,but +{ + mov eax,10 + int 0x40 + dec eax + jz red + dec eax + jz key + dec eax + jz but +} + +; TIMEEVENT - Wite for event with timeout + +macro timeevent xfps,noevent,red,key,but +{ + mov eax,23 + mov ebx,xfps + int 0x40 + cmp eax,0 + je noevent + dec eax + jz red + dec eax + jz key + dec eax + jz but +} + + +; CLOSE - Close program + +macro close +{ + mov eax,-1 + int 0x40 +} + +; DELAY - Create delay 1/100 sec +; (SYNTAX) Delay time +; (SAMPLE) Delay 100 ;delay 2 sec 1/100*200=2 sec + +macro delay arg1 +{ + mov eax,5 + mov ebx,arg1 + int 0x40 +} + +; WINDOW - Draw window +; (SYNTAX) WINDOW Xstart,Ystart,'Text',Color +; (SAMPLE) WINDOW 10,10,640+8,480+24,window_Skinned + +macro window arg1,arg2,arg3,arg4,arg5 +{ +; mov ebx,arg1*65536+arg3 +; mov ecx,arg2*65536+arg4 + wordstoreg ebx,arg1,arg3 + wordstoreg ecx,arg2,arg4 + mov edx,arg5 + mov eax,0 + int 0x40 +} + +macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7 +{ + mov ebx,arg1*65536+arg3 + mov ecx,arg2*65536+arg4 + mov edx,arg5 + mov esi,arg6 + mov edi,arg7 + mov eax,0 + int 0x40 +} + + +; STARTWD - Start of window draw + +macro startwd +{ + mov eax,12 + mov ebx,1 + int 0x40 +} + +; ENDWD - End window draw + +macro endwd +{ + mov eax,12 + mov ebx,2 + int 0x40 +} + +; LABEL - Put text to frame +; (SYNTAX) LABEL Xstart,Ystart,'Text',Color +; (SAMPLE) LABEL 10,12,'Hello World!',cl_Green+font_Big + +macro label arg1,arg2,arg3,arg4 +{ +local asd,lab + jmp asd +lab db arg3 ;arg label +asd: +; mov ebx,arg1 ;arg1=y arg2=x +; shl ebx,16 +; add ebx,arg2 + wordstoreg ebx,arg1,arg2 + mov ecx,arg4 ;arg4 color + mov edx,lab + mov esi,asd-lab ;calc size + mov eax,4 + int 0x40 +} + +;Key's +key_Up equ 178 +key_Down equ 177 +key_Right equ 179 +key_Left equ 176 +key_Esc equ 27 +key_Space equ 32 +key_Enter equ 13 +key_Bspace equ 8 +key_F1 equ 50 +key_F2 equ 51 +key_F3 equ 52 +key_F4 equ 53 +key_F5 equ 54 +key_F6 equ 55 +key_F7 equ 56 +key_F8 equ 57 +key_F9 equ 48 +key_F10 equ 49 +key_F11 equ 68 +key_F12 equ 255 +key_Home equ 180 +key_End equ 181 +key_PgUp equ 184 +key_PgDown equ 183 + +;Attributes + +;Window Attributes +window_Skinned equ 0x03000000 +window_Type2 equ 0x02000000 +window_Type1 equ 0x00000000 +window_Reserve equ 0x01000000 + +;Font Attributes +font_Big equ 0x10000000 + +;Colors +cl_White equ 0x00ffffff +cl_Black equ 0x00000000 +cl_Grey equ 0x00888888 +cl_Red equ 0x00ff0000 +cl_Lime equ 0x0000ff00 +cl_Green equ 0x0000af00 +cl_Blue equ 0x000000ff +cl_Purple equ 0x008080ff +cl_Violet equ 0x008040ff +cl_Cyan equ 0x0040e0ff diff --git a/programs/copyr/trunk/build_en.bat b/programs/copyr/trunk/build_en.bat new file mode 100644 index 0000000000..48af7ac79a --- /dev/null +++ b/programs/copyr/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm copyr.asm copyr +@pause \ No newline at end of file diff --git a/programs/copyr/trunk/build_ru.bat b/programs/copyr/trunk/build_ru.bat new file mode 100644 index 0000000000..e7cba7d31c --- /dev/null +++ b/programs/copyr/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm copyr.asm copyr +@pause \ No newline at end of file diff --git a/programs/copyr/trunk/copyr.asm b/programs/copyr/trunk/copyr.asm new file mode 100644 index 0000000000..a3bf7ab247 --- /dev/null +++ b/programs/copyr/trunk/copyr.asm @@ -0,0 +1,341 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; ; +; FILE COPY - system module for copy ; +; files.Prog for SYS X-TREE BROWSER v22 ; +; ; +; Create by Pavlushin Evgeni waptap@mail.ru ; +; homepage www.deck4.narod.ru ; +; ; +; On base SYSTREE FILE COPIER 1.02 ; +; Ivan Poddubny ivan-yar@bk.ru ; +; ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;Данная прога еще сырая и глючная но уже кое как работает + use32 + org 0x0 + + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd I_END ; size of image + dd 0x20000 ; memory for app + dd 0x10000 ; esp + dd param_area , 0x0 ; I_Param , I_Icon + +include 'lang.inc' +include 'macros.inc' ; very useful stuff for MeOS +include 'ascl.inc' + +STRLEN = 48 ; maximal length of filename + + +START: ; start of execution + +; Параметры: +; от 0 до 100 путь к источнику +; от 100 до 200 путь к приемнику +; +;get param + mov eax,15 + cmp byte [param_area],0 + je err_exit ;source not found + mov eax,16 + cmp byte [param_area+100],0 + je err_exit ;dest not found + + mov ecx,199 +cdf: + mov al,[param_area+ecx] + cmp al,byte 32 + jne nor + mov al,byte 0 +nor: + mov al,[param_area+ecx] + dec ecx + jns cdf + + mov ecx,STRLEN - 4 +copysp: + mov al,[param_area+ecx] + mov [source+ecx],al + dec ecx + jns copysp + mov [source+42],byte 0 + + mov ecx,STRLEN - 4 +copydp: + mov al,[param_area+ecx+100] + mov [destination+ecx],al + dec ecx + jns copydp + mov [destination+42],byte 0 + + call draw_window + call copy_file + +dexit: + wtevent red,key,button + jmp dexit +red: + call draw_window + jmp dexit +key: +button: + +exit: + close + +err_exit: + push eax + call draw_window + pop eax + jmp copy_error + +; print message now +copy_error: + mov ebp,43 + mul ebp + mov ebp,eax + + mov eax,4 + mov ebx,20*65536+70 + mov ecx,0x10ff0000 + mov edx,errors ;*8] + add edx,ebp + mov esi,43 ;[errors+edi*8+4] + int 0x40 + jmp dexit + +;closep: +; or eax,-1 ; close program +; int 0x40 + + +;==================================================== +; copy_file +; This piece of code copies src file to dst file, +; then it pass the control to copy_error routine, +; which returns to the main cycle of the app. +; It's NOT a function! It's reached by direct jump +; from the button handler. +;==================================================== +copy_file: + ; at first we must get the size of the source file + mov [source_info.blocks],1 ; load only 512 bytes + mov eax,58 + mov ebx,source_info + int 0x40 + + ; now eax contains error code + ; and ebx contains file size in bytes + test eax,eax ; check if eax is equal to zero (success) + je .ok_getsize ; eax = 0 => continue + cmp eax,6 + jna @f + mov eax,7 ; if error code is above 6, it will be 7 + @@: + cmp eax,5 ; file might be copied successfully altrough + ; the system reports an error 5 + jne copy_error ; print error code now + .ok_getsize: + + ; allocate memory + push ebx ; save file size + mov ecx,ebx + add ecx,0x20000 ; size of memory needed = 0x20000+filesize + mov eax,64 ; func 64 + mov ebx,1 ; resize application memory + int 0x40 + pop ebx ; restore filesize + + ; check if alloc function failed + test eax,eax ; non-zero value means error + je .ok_memory + mov eax,5 ; error 5 - out of memory + jmp copy_error ; print error code now + .ok_memory: + + ; save number of blocks to source_info + shr ebx,9 ; divide by 512 + inc ebx ; blocks++ + mov [source_info.blocks],ebx + ; read the source file + mov eax,58 + mov ebx,source_info + int 0x40 + + ; ebx = file size + ; save loaded file + mov [dest_info.bytes2write],ebx ; file size in bytes + mov eax,58 + mov ebx,dest_info + int 0x40 + + ; check if 58 function failed + test eax,eax + je .ok_write + add eax,7 ; error number += 7 + cmp eax,6+7 + jna copy_error + mov eax,7+7 + jmp copy_error + .ok_write: + + ; return to the initial amount of memory + mov eax,64 + mov ebx,1 + mov ecx,0x20000 + int 0x40 + + xor eax,eax ; eax = message number (0-OK) + +; print strings (source & destination) +print_text: + mov eax,13 + mov ebx,107*65536+STRLEN*6 + mov ecx,[ya] + shl ecx,16 + add ecx,9 + mov edx,0xf2f2f2 + int 0x40 + + mov eax,4 + mov ebx,109*65536 + add ebx,[ya] + xor ecx,ecx + mov edx,[addr] + mov esi,STRLEN + int 0x40 + + ret + + +; ********************************************* +; ******* 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 + xor eax,eax ; function 0 : define and draw window + mov ebx,160*65536+415 ; [x start] *65536 + [x size] + mov ecx,160*65536+90 ; [y start] *65536 + [y size] + mov edx,0x03DDDDDD ; color of work area 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,0x10ffffff ; color of text RRGGBB + mov edx,labelt ; pointer to text beginning + mov esi,labellen-labelt ; text length + int 0x40 + + mov eax,8 + mov ebx,105*65536+290 + mov ecx,33*65536+12 + mov edx,4 + mov esi,0xEBEBEB + int 0x40 + mov ebx,105*65536+290 + mov ecx,49*65536+12 + mov edx,5 + mov esi,0xEBEBEB + int 0x40 + + mov esi,source + mov edi,text+14 + mov ecx,STRLEN + rep movsb + + mov esi,destination + mov edi,text+STRLEN+59-45+14 + mov ecx,STRLEN + rep movsb + + mov ebx,25*65536+36 ; print filenames + xor ecx,ecx + mov edx,text + mov esi,STRLEN+59-45 + newline: + mov eax,4 + int 0x40 + add ebx,16 + add edx,STRLEN+59-45 + 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 +align 4 + +param_area: +times 256 db 0 + +source_info: ; SOURCE FILEINFO + .mode dd 0 ; read file + .start_block dd 0x0 ; block to read + .blocks dd 0x700 ; num of blocks + .address dd 0x20000 + .workarea dd 0x10000 + source: + times (STRLEN) db 32 + db 0 + +dest_info: ; DESTINATION FILEINFO + .mode dd 1 ; write + .notused dd 0x0 ; not used + .bytes2write dd 0 ; bytes to write + .address dd 0x20000 + .workarea dd 0x10000 + destination: + times (STRLEN) db 32 + db 0 + + align 4 + addr dd 0x0 + ya dd 0x0 + temp dd 0 + +text: + db ' ОТКУДА: |Россия, Селятино, МПК Москва , 1 Курс ' + db ' КУДА: | Павлюшин Евгений, waptap@mail.ru ' + db ' ' + db 'x' ; <- END MARKER, DONT DELETE +labelt: + db 'КОПИРОВАИЕ ФАЙЛА' +labellen: + +errors: + db "файл скопирован успешно " + db "(чтение) не задана база жд " + db "(чтение) файловая система не поддерживается" + db "(чтение) неизвестная файловая система " + db "(чтение) не задан раздел жд " + db "недостаточно памяти " + db "(чтение) конец файла " + db "(чтение) неизвестная ошибка " + db "(запись) не задан раздел жд " + db "(запись) файловая система не поддерживается" + db "(запись) неизвестная файловая система " + db "(запись) не задан раздел жд " + db "oh shit! " + db "(запись) файл не найден " + db "(запись) неизвестная ошибка " + db "Путь к источнику и приемнику не указаны!!! " + db "Путь к приемнику не указан!!! " + + ;0123456789012345678901234567890123456789012 +I_END: \ No newline at end of file diff --git a/programs/copyr/trunk/macros.inc b/programs/copyr/trunk/macros.inc new file mode 100644 index 0000000000..1d153e8723 --- /dev/null +++ b/programs/copyr/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 + +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 \ No newline at end of file diff --git a/programs/cpu/trunk/build_en.bat b/programs/cpu/trunk/build_en.bat new file mode 100644 index 0000000000..a74237104b --- /dev/null +++ b/programs/cpu/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm cpu.asm cpu +@pause \ No newline at end of file diff --git a/programs/cpu/trunk/build_ru.bat b/programs/cpu/trunk/build_ru.bat new file mode 100644 index 0000000000..97a6062184 --- /dev/null +++ b/programs/cpu/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm cpu.asm cpu +@pause \ No newline at end of file diff --git a/programs/cpu/trunk/cpu.asm b/programs/cpu/trunk/cpu.asm new file mode 100644 index 0000000000..fe42d65164 --- /dev/null +++ b/programs/cpu/trunk/cpu.asm @@ -0,0 +1,625 @@ +; +; PROCESS MANAGEMENT +; +; VTurjanmaa +; additions by M.Lisovin lisovin@26.ru +; Compile with FASM for Menuet +; + + use32 + org 0x0 +STACK_SIZE=1024 + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd I_END ; size of image + dd U_END+STACK_SIZE ; memory for app + dd U_END+STACK_SIZE ; esp + dd 0x0 , 0x0 ; I_Param , I_Icon + +include 'lang.inc' +include 'macros.inc' +display_processes=32 ; number of processes to show +START: ; start of execution +; calculate window position +; at the center of the screen + call calculate_window_pos + +;main loop when process name isn't edited. +red: + mov ebp,1 + call draw_window ; redraw all window +still: + mov eax,23 ; wait here for event + mov ebx,100 ; 1 sec. + 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 +still_end: + xor ebp,ebp ; draw new state of processes + call draw_window + jmp still + + + key: ; key + mov eax,2 + int 0x40 + cmp ah,184 ; PageUp + je pgdn + cmp ah,183 + je pgup ; PageDown + cmp ah,27 + je close ; Esc + jmp still_end + + button: +; get button id + mov eax,17 + int 0x40 + shr eax,8 + +;id in [10,50] corresponds to terminate buttons. + cmp eax,10 + jb noterm + cmp eax,50 + jg noterm + +;calculate button index + sub eax,11 + +;calculate process slot + mov ecx,[tasklist+4*eax] + +;ignore empty buttons + test ecx,ecx + jle still_end +;terminate application + mov eax,18 + mov ebx,2 + int 0x40 + jmp still_end + noterm: + +;special buttons + cmp eax,51 + jz pgdn + cmp eax,52 + jz pgup + cmp eax,53 + jz read_string + cmp eax,54 + jz program_start + cmp eax,55 + jz reboot + cmp eax,1 + jz close + jmp still_end + +;buttons handlers + pgdn: + sub [list_start],display_processes + cmp [list_start],0 + jge still_end + mov [list_start],0 + jmp still_end + + pgup: + mov eax,[list_add] ;maximal displayed process slot + cmp eax,255 + jge .noinc + inc eax + .noinc: + mov [list_start],eax + jmp still_end + + program_start: + mov eax,58 + mov ebx,file_start + int 0x40 + jmp still_end + + reboot: + mov eax,18 + mov ebx,1 + int 0x40 +;close program if we going to reboot + + close: + mov eax,-1 ; close this program + int 0x40 + +draw_next_process: +;input: +; edi - current slot +; [curposy] - y position +;output: +; edi - next slot (or -1 if no next slot) +;registers corrupted! + +;create button + test ebp,ebp + jnz .nodelete +;delete old button + mov eax,8 + mov edx,[index] + add edx,(1 shl 31)+11 + int 0x40 +.nodelete: +;create terminate process button + mov eax,8 + mov ebx,15*65536+100 + mov ecx,[curposy] + shl ecx,16 + mov cx,10 + mov edx,[index] + add edx,11 + mov esi,0xaabbcc +;contrast + test dword [index],1 + jz .change_color_button + mov esi,0x8899aa +.change_color_button: + int 0x40 + +;draw background for proccess information + mov eax,13 + mov ebx,115*65536+395 + ;ecx was already set + mov edx,0x88ff88 +;contrast + test dword [index],1 + jz .change_color_info + mov edx,0xddffdd +.change_color_info: + int 0x40 + +;nothing else should be done +;if there is no process for this button + test edi,edi + jl .ret + +;find process + inc edi +;more comfortable register for next loop + mov ecx,edi +;precacluate pointer to process buffer + mov ebx,process_info_buffer + +;find process loop +.find_loop: + cmp ecx,256 + jge .no_processes + +;load process information in buffer + mov eax,9 +; mov ebx,process_info_buffer + int 0x40 + +;if current slot greater than maximal slot, +;there is no more proccesses. + cmp ecx,eax + jg .no_processes + +;if slot state is equal to 9, it is empty. + cmp [process_info_buffer+process_information.slot_state],9 + jnz .process_found + + inc ecx + jmp .find_loop + +.no_processes: + mov edi,-1 + ret + +.process_found: + mov edi,ecx + mov [list_add],ecx + +;get processor cpeed +;for percent calculating + mov eax,18 + mov ebx,5 + int 0x40 + + xor edx,edx + mov ebx,100 + div ebx + +;eax = number of operation for 1% now +;calculate process cpu usage percent + mov ebx,eax + mov eax,[process_info_buffer+process_information.cpu_usage] +; cdq + xor edx,edx ; for CPU more 2 GHz - mike.dld + + div ebx + mov [cpu_percent],eax + +;set text color to display process information +;([tcolor] variable) +;0% : black +;1-80% : green +;81-100% : red + test eax,eax + jg .no_black + mov [tcolor],eax + jmp .color_set +.no_black: + cmp eax,80 + ja .no_green + mov dword [tcolor],0x107a30 + jmp .color_set +.no_green: + mov dword [tcolor],0xac0000 +.color_set: + +;show slot number + mov eax,47 + mov ebx,2*65536+1*256 +;ecx haven't changed since .process_found +; mov ecx,edi + mov edx,[curposy] + add edx,20*65536+1 + mov esi,[tcolor] + int 0x40 + +;show process name + mov eax,4 + mov ebx,[curposy] + add ebx,50*65536+1 + mov ecx,[tcolor] + mov edx,process_info_buffer.process_name + mov esi,11 + int 0x40 + +;show pid + mov eax,47 + mov ebx,8*65536+1*256 + mov ecx,[process_info_buffer.PID] + mov edx,[curposy] + add edx,130*65536+1 + mov esi,[tcolor] + int 0x40 + +;show cpu usage + mov ecx,[process_info_buffer.cpu_usage] + add edx,60*65536 + int 0x40 + +;show cpu percent + mov ebx,3*65536+0*256 + mov ecx,[cpu_percent] + add edx,60*65536 + int 0x40 + +;show memory start - obsolete + mov ebx,8*65536+1*256 + mov ecx,[process_info_buffer.memory_start] + add edx,30*65536 + int 0x40 + +;show memory usage + mov ecx,[process_info_buffer.used_memory] + inc ecx + add edx,60*65536 + int 0x40 + +;show window stack and value + mov ecx,dword [process_info_buffer.window_stack_position] + add edx,60*65536 + int 0x40 + +;show window xy size + mov ecx,[process_info_buffer.x_size] + shl ecx,16 + add ecx,[process_info_buffer.y_size] + add edx,60*65536 + int 0x40 + +.ret: +;build index->slot map for terminating processes. + mov eax,[index] + mov [tasklist+4*eax],edi + ret + +read_string: + +;clean string + mov edi,start_application + xor eax,eax + mov ecx,60 + cld + rep stosb + call print_text + + mov edi,start_application +;edi now contains pointer to last symbol + jmp still1 + +;read string main loop + f11: +;full update + push edi + mov ebp,1 + call draw_window + pop edi + still1: +;wait for message + mov eax,23 + mov ebx,100 + int 0x40 + cmp eax,1 + je f11 +;if no message - update process information + cmp eax,0 + jnz .message_received + push edi ;edi should be saved since draw_window + xor ebp,ebp ;corrupt registers + call draw_window + pop edi + jmp still1 + +.message_received: + cmp eax,2 + jne read_done ;buttons message +;read char + mov eax,2 + int 0x40 + shr eax,8 + +;if enter pressed, exit read string loop + cmp eax,13 + je read_done +;if backslash pressed? + cmp eax,8 + jnz nobsl +;decrease pointer to last symbol + cmp edi,start_application + jz still1 + dec edi +;fill last symbol with space because +;print_text show all symbols + mov [edi],byte 32 + call print_text + jmp still1 + + nobsl: +;write new symbol + mov [edi],al +;display new text + call print_text +;increment pointer to last symbol + inc edi +;compare with end of string + mov esi,start_application + add esi,60 + cmp esi,edi + jnz still1 + +;exiting from read string loop + read_done: +;terminate string for file functions + mov [edi],byte 0 + + call print_text + jmp still + + +print_text: +;display start_application string + + pushad + +;display text background + mov eax,13 + mov ebx,64*65536+62*6 + mov ecx,400*65536+12 + mov edx,0xffffcc ;0xeeeeee + int 0x40 + +;display text + mov eax,4 + mov edx,start_application ;from start_application string + mov ebx,70*65536+402 ;text center-aligned + xor ecx,ecx ;black text + mov esi,60 ;60 symbols + int 0x40 + + popad + ret + +window_x_size=524 +window_y_size=430 +calculate_window_pos: +;set window size and position for 0 function +;to [winxpos] and [winypos] variables + +;get screen size + mov eax,14 + int 0x40 + mov ebx,eax + +;calculate (x_screen-window_x_size)/2 + shr ebx,16+1 + sub ebx,window_x_size/2 + shl ebx,16 + mov bx,window_x_size +;winxpos=xcoord*65536+xsize + mov [winxpos],ebx + +;calculate (y_screen-window_y_size)/2 + and eax,0xffff + shr eax,1 + sub eax,window_y_size/2 + shl eax,16 + mov ax,window_y_size +;winypos=ycoord*65536+ysize + mov [winypos],eax + + ret + +; ********************************************* +; ******* WINDOW DEFINITIONS AND DRAW ******** +; ********************************************* + + +draw_window: +;ebp=1 - redraw all +;ebp=0 - redraw only process information + + test ebp,ebp + jz .show_process_info + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,1 ; 1, start of draw + int 0x40 + + ; DRAW WINDOW + xor eax,eax ; function 0 : define and draw window + mov ebx,[winxpos] ; [x start] *65536 + [x size] + mov ecx,[winypos] ; [y start] *65536 + [y size] + mov edx,0x03ddffdd ;ffffff ; color of work area RRGGBB,8->color + mov esi,0x805080d0 ; color of grab bar RRGGBB,8->color gl + mov edi,0x005080d0 ; color of frames RRGGBB + int 0x40 + + ; WINDOW CAPTION + mov eax,4 ; function 4 : write text to window + mov ebx,8*65536+8 ; [x start] *65536 + [y start] + mov ecx,0x10ffffff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelt ; pointer to text beginning + mov esi,labellen-labelt ; text length + int 0x40 + + mov ebx,22*65536+35 ; draw info text with function 4 + xor ecx,ecx + mov edx,text + mov esi,79 + mov eax,4 + int 0x40 + +.show_process_info: + mov edi,[list_start] + mov [list_add],edi + dec dword [list_add] + mov dword [index],0 + mov dword [curposy],54 +.loop_draw: + call draw_next_process + inc dword [index] + add dword [curposy],10 + cmp [index],display_processes + jl .loop_draw + + test ebp,ebp + jz .end_redraw + mov eax,8 + mov esi,0xaabbcc + +; previous page button + mov ebx,30*65536+96 + mov ecx,380*65536+10 + mov edx,51 + int 0x40 + +; next page button + mov ebx,130*65536+96 + inc edx + int 0x40 + +; ">" (text enter) button + mov ebx,30*65536+20 + add ecx,20 shl 16 + inc edx + int 0x40 + +; run button + mov ebx,456*65536+50 + inc edx + int 0x40 + +; reboot button + sub ebx,120*65536 + add ebx,60 + sub ecx,20 shl 16 + inc edx + int 0x40 + +;"PREV PAGE", "NEXT PAGE" and "REBOOT" labels + mov eax,4 + mov ebx,50*65536+382 + xor ecx,ecx + mov edx,tbts + mov esi,tbte-tbts + int 0x40 + +;">" labels + mov eax,4 + mov ebx,40*65536+402 + xor ecx,ecx + mov edx,tbts_2 + mov esi,1 + int 0x40 + +;"RUN" labels + mov eax,4 + mov ebx,475*65536+402 + xor ecx,ecx + mov edx,tbts_3 + mov esi,tbte_2-tbts_3 + int 0x40 + +;print application name in text box + call print_text + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + +.end_redraw: + ret + + +; DATA AREA +list_start dd 0 + +file_start: dd 16 + dd 0,0,0,run_process_buffer + +start_application: db '/RD/1/LAUNCHER',0 + times 60 db 32 + +text: + db ' NAME/TERMINATE PID CPU-USAGE % ' + db 'MEMORY START/USAGE W-STACK W-SIZE' + +tbts: db 'PREV PAGE NEXT PAGE REBOOT SYSTEM' +tbte: +tbts_2 db '>' +tbts_3 db 'RUN' +tbte_2: + +labelt: + db 'Processes - Ctrl/Alt/Del' +labellen: + +I_END: + +winxpos rd 1 +winypos rd 1 + +cpu_percent rd 1 +tcolor rd 1 +list_add rd 1 +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: diff --git a/programs/cpu/trunk/macros.inc b/programs/cpu/trunk/macros.inc new file mode 100644 index 0000000000..f2345b6200 --- /dev/null +++ b/programs/cpu/trunk/macros.inc @@ -0,0 +1,261 @@ +; 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 + +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 \ No newline at end of file diff --git a/programs/cpuid/no.sources b/programs/cpuid/no.sources new file mode 100644 index 0000000000..e69de29bb2 diff --git a/programs/cpuspeed/trunk/build_en.bat b/programs/cpuspeed/trunk/build_en.bat new file mode 100644 index 0000000000..0973bb3c96 --- /dev/null +++ b/programs/cpuspeed/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm cpuspeed.asm cpuspeed +@pause \ No newline at end of file diff --git a/programs/cpuspeed/trunk/build_ru.bat b/programs/cpuspeed/trunk/build_ru.bat new file mode 100644 index 0000000000..62e71522d6 --- /dev/null +++ b/programs/cpuspeed/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm cpuspeed.asm cpuspeed +@pause \ No newline at end of file diff --git a/programs/cpuspeed/trunk/cpuspeed.asm b/programs/cpuspeed/trunk/cpuspeed.asm new file mode 100644 index 0000000000..aec0d17b53 --- /dev/null +++ b/programs/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 + diff --git a/programs/cpuspeed/trunk/macros.inc b/programs/cpuspeed/trunk/macros.inc new file mode 100644 index 0000000000..83b3eddabe --- /dev/null +++ b/programs/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 + +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 \ No newline at end of file diff --git a/programs/crownscr/trunk/build_en.bat b/programs/crownscr/trunk/build_en.bat new file mode 100644 index 0000000000..5f1bca179c --- /dev/null +++ b/programs/crownscr/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm crownscr.asm crownscr +@pause \ No newline at end of file diff --git a/programs/crownscr/trunk/build_ru.bat b/programs/crownscr/trunk/build_ru.bat new file mode 100644 index 0000000000..07b7fc397d --- /dev/null +++ b/programs/crownscr/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm crownscr.asm crownscr +@pause \ No newline at end of file diff --git a/programs/crownscr/trunk/crownscr.asm b/programs/crownscr/trunk/crownscr.asm new file mode 100644 index 0000000000..2a2646275f --- /dev/null +++ b/programs/crownscr/trunk/crownscr.asm @@ -0,0 +1,404 @@ +; +; Crown_s Soft Screensaver v1.13m +; WWW: http://www.crown-s-soft.com +; +; You may add you own figures. See file FIGURES.INC +; +; Compile with FASM v1.48 for Menuet or hier (FASM v1.40 contains bug) +; +; Copyright(c) 2002-2004 Crown_s Soft. All rights reserved. +; + +fullscreen = 1 +n_points = 0x1800 +delay = 2 +speed equ 0.004 + + +macro align value { rb (value-1) - ($ + value-1) mod value } + +use32 + org 0x0 + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd start ; start of code + dd i_end ; size of image + dd i_end+0x1000 ; memory for app + dd i_end+0x1000 ; esp + dd 0x0 ; I_Param + dd 0x0 ; I_Icon + +copyright db 'Crown_s Soft(c) Screensaver v1.13m www.crown-s-soft.com',0 +copyrightlen: + +include "lang.inc" +include "figuresi.inc" +include "macros.inc" +start: + cld + finit + call filling_alfbet ; fill table alfbet by casual numbers + + mov eax,[tabl_calls] + mov [pp1adr],eax + + + cmp [flscr],0 + jz nofullscreen + mov eax,14 + int 0x40 + + mov [maxy],ax + sub ax,480 + jnc m5 + xor ax,ax + m5: + shr ax,1 + mov [posy],ax + + shr eax,16 + mov [maxx],ax + sub ax,480 + jnc m6 + xor ax,ax + m6: + shr ax,1 + mov [posx],ax + + mov [outsize],480+65536*480 + jmp m4 + nofullscreen: + mov [posx],75 + mov [posy],20 + + mov [outsize],450+65536*480 + m4: + +red: + call draw_window + +still: + mov eax,23 + mov ebx,delay + int 0x40 ; wait here for event + + cmp eax,1 ; redraw request ? + je red + cmp eax,2 ; key in buffer ? + je key + cmp eax,3 ; button in buffer ? + je button + + + call calcframe + mov edx,dword [posy] ; edx=image position in window [x]*65536+[y] + mov ecx,[outsize] ; ecx=image position in window [x]*65536+[y] + mov ebx,scr ; ebx pointer to image in memory + mov eax,07 ; putimage + int 0x40 +jmp still + +key: + mov eax,2 + int 0x40 + + cmp al,1 ; is key in buffer ? + jz still + cmp ah,0x1B ; is key ESC ? + jz close +jmp still + +button: ; button + mov eax,17 ; get id + int 0x40 + +; cmp ah,1 ; button id=1 ? +; jne still + +close: + 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 + + cmp [flscr],0 + jnz m2 + mov ebx,1*65536+640 ; [x start] *65536 + [x size] + mov ecx,1*65536+480 ; [y start] *65536 + [y size] + mov edx,0x02000000 ; color of work area RRGGBB,8->color gl + mov esi,0x805080d0 ; color of grab bar RRGGBB,8->color gl + mov edi,0x005080d0 ; color of frames RRGGBB + xor eax,eax ; function 0 : define and draw window + int 0x40 + + ; WINDOW LABEL + mov ebx,8*65536+8 ; [x start] *65536 + [y start] + mov ecx,0x10ddeeff ; color of text RRGGBB + mov edx,copyright ; pointer to text beginning + mov esi,copyrightlen-copyright; text length + mov eax,4 ; function 4 : write text to window + int 0x40 + + ; CLOSE BUTTON + mov ebx,(640-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,0x6688dd ; button color RRGGBB + mov eax,8 ; function 8 : define and draw button + int 0x40 + jmp m3 + m2: + movzx ebx,[maxx] ; [x start] *65536 + [x size] + movzx ecx,[maxy] ; [y start] *65536 + [y size] + + mov edx,0x01000000 ; color of work area RRGGBB,8->color gl + mov esi,0x805080d0 ; color of grab bar RRGGBB,8->color gl + mov edi,0x005080d0 ; color of frames RRGGBB + xor eax,eax ; function 0 : define and draw window + int 0x40 + + inc bx + inc cx + mov eax,13 ; functiom 13 : draw bar + int 0x40 + m3: + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 +ret + + +calcframe: + cld + mov edi,scr + mov ecx,480*480*3/4 + xor eax,eax + rep stosd ; CLS + + + mov ebx,[frame] + not bh + test bh,03h + not bh + jnz lb1 + ; ebx=xxxx xxxx xxxx xxxx xxxx xx11 xxxx xxxxb + mov byte [p],bl + lb1: + + test bx,03ffh + jnz lb2 + ; ebx=xxxx xxxx xxxx xxxx xxxx xx00 0000 0000b + mov [p],0 + + mov eax,[pp1adr] + mov [pp0adr],eax + + inc [pp1] + cmp [pp1],num_tabl_calls + jnz lb3 + mov [pp1],0 + lb3: + + movzx eax,[pp1] + mov eax,[tabl_calls+eax*4] + mov [pp1adr],eax + lb2: + + + fild [frame] ; st0=STime + fmul [speed1] ; st0=STime*Speed + fst [bt_r] ; al_rSTime*Speed + fadd st0,st0 + fstp [al_r] ; al_rSTime*Speed*2 + + + mov [Fl],0 + mov ecx,[mFl] + mov esi,alfbet + ckl1: + call [pp0adr] + cmp [p],0 + jz lb4 + fstp [x1] + fstp [y1] + fstp [z1] + call [pp1adr] + call mix + lb4: + + call turn + + add esi,4 + inc [Fl] + loop ckl1 + + inc ebx + mov [frame],ebx +ret + + +; turn coordinate system +turn: + ; around Y + ; x= x*cos(a)-z*sin(a) + ; y= y + ; z= x*sin(a)+z*cos(a) + fld st2 ; st0=z st1=x st2=y st3=z + fld st1 ; st0=x st1=z st2=x st3=y st4=z + fld [al_r] ; st0=a st1=x st2=z st3=x st4=y st5=z + fsincos ; st0=cos(a) st1=sin(a) st2=x st3=z st4=x st5=y st6=z + fmul st4,st0 + fmulp st6,st0 ; st0=sin(a) st1=x st2=z st3=x*cos(a) st4=y st5=z*cos(a) + fmul st2,st0 + fmulp st1,st0 ; st0=x*sin(a) st1=z*sin(a) st2=x*cos(a) st3=y st4=z*c + faddp st4,st0 + fsubp st1,st0 + + + ; around X + ; x=x + ; y= y*cos(b)+z*sin(b) + ; z=-y*sin(b)+z*cos(b) + fld st2 ; st0=z st1=x st2=y st3=z + fld st2 ; st0=y st1=z st2=x st3=y st4=z + fld [bt_r] ; st0=b st1=y st2=z st3=x st4=y st5=z + fsincos ; st0=cos(b) st1=sin(b) st2=y st3=z st4=x st5=y st6=z + fmul st5,st0 + fmulp st6,st0 ; st0=sin(b) st1=y st2=z st3=x st4=y*cos(b) st5=z*cos(b) + fmul st2,st0 + fmulp st1,st0 ; st0=y*sin(b) st1=z*sin(b) st2=x st3=y*cos(b) st4=z*cos(b) + fsubp st4,st0 ; st0=z*sin(b) st1=x st2=y*cos(b) st3=z*cos(b)-y*sin(b) + faddp st2,st0 + + ; st0=x st1=y st2=z + fistp [x1] + fistp [y1] + fmul [Zdepth] ; st0=z*Zdepth + fiadd [Zcolor] ; st0=z*Zdepth+Zcolor + fistp [z_w] ; st0z*Zdepth+Zcolor + + + push edx + + mov eax,[x1] + add eax,[mid] + mul [const480] + add eax,[y1] + add eax,[mid] + mul [const3] + + mov dl,byte [z_w] ; al=ZZ + mov [scr+0+eax],dl + mov [scr+1+eax],dl + mov [scr+2+eax],dl + + pop edx +ret + + + +mix: + fild [p] ; st0=p + fmul [mp] ; st0=p=p*mp + fld st0 ; st0=p st1=p + fmul st4,st0 + fmul st3,st0 + fmulp st2,st0 ; st0=p st1=x*p st2=y*p st3=z*p + + fld1 + fsubrp st1,st0 ; st0=1-p st1=x*p st2=y*p st3=z*p + fld [z1] ; st0=z1 st1=1-p st2=x*p st3=y*p st4=z*p + fmul st0,st1 + faddp st4,st0 + fld [y1] ; st0=y1 st1=1-p st2=x*p st3=y*p st4= + fmul st0,st1 + faddp st3,st0 + fld [x1] ; st0=x1 st1=1-p st2=x*p st3=y*p+y1*(1-p) st4= + fmulp st1,st0 ; st0=x1*(1-p) st1=x*p st2=y*p+y1*(1-p) st3= + faddp st1,st0 ; st0=x=x*p+x1*(1-p) st1=y=y*p+y1*(1-p) st2=z +ret + + +filling_alfbet: + ; Initialize RND + mov eax,3 + int 40h + ; eax - fist random number + + mov ecx,n_points + mov edi,alfbet + mov ebx,8088405h + ck2: + stosd + ; Compute next random number + ; New := 8088405H * Old + 1 + mul ebx + inc eax + loop ck2 +ret + + +; DATA AREA +align 2 + + frame dd 0 + + mp dd 0.00390625 + n_r dd 0.00390625 + + mal_r dd 6.28318530717958648 + mbt_r dd 6.28318530717958648 + + const3 dd 3 + const6 dw 6 + const480 dd 480 + + mFl dd n_points + pp1 dw 0 + + Zdepth dd 0.3 + Zcolor dw 140 + + mid dd 240 ; centre of screen + + speed1 dd speed + flscr db fullscreen + + align 4 + + outsize dd ? + posy dw ? + posx dw ? + maxy dw ? + maxx dw ? + + Fl dd ? + + p dd ? + al_r dd ? + bt_r dd ? + + + pp0adr dd ? + pp1adr dd ? + + z_w dw ? + + x1 dd ? + y1 dd ? + z1 dd ? + +align 16 + alfbet: ; alfbet db n_points*4 dup (?) + scr = alfbet+n_points*4 ; scr db 480*480*3+1 dup (?) + i_end = scr+480*480*3+1 ; i_param db 256 dup (?) diff --git a/programs/crownscr/trunk/figuresi.inc b/programs/crownscr/trunk/figuresi.inc new file mode 100644 index 0000000000..5415e06c15 --- /dev/null +++ b/programs/crownscr/trunk/figuresi.inc @@ -0,0 +1,564 @@ +; +; include file for Crown_s Soft Screensaver +; +; You may add you own figures for Screensaver. +; For example see tor function. +; If you add new figures, please contact us, we will help you. +; +;input parametrs: +; alf=word [esi] - random quantity 0<=alf<=0xffff +; bet=word [esi+2] - random quantity 0<=bet<=0xffff +; Fl - number of point in frame +; (may be used as random quantity) 0<=Fl<=mFl +; p - number of frame +; (may be use for animated figures) +; +;output parametrs: +; st0=x, st1=y, st2=z + + + + align 8 + + const_mpi dd 0.0000958767251683032697061874258638112 ; 1/00007fffh*pi + const_m dd 0.0000305185094759971922971282082583087 ; 1/00007fffh + + + + tabl_calls dd cubes + dd explosion + dd galaxy + dd cube + dd sin + dd tor1 + dd tors + dd spiral + dd tor + dd planet + dd balls + num_tabl_calls=11 + + tor_r dw 60 + tor_R dw 175 + + balls_x1 dw 0 + balls_x2 dw 189 + balls_x3 dw -94 + balls_x4 dw -94 + balls_y1 dw 0 + balls_y2 dw 0 + balls_y3 dw 163 + balls_y4 dw -163 + balls_z1 dw 200 + balls_z2 dw -71 + balls_z3 dw -71 + balls_z4 dw -71 + balls_R dw 35 + + cube_R dw 118 + + spiral_R dw 100 + spiral_r dw 20 + spiral_h dw 150 + spiral_L dw 12 + + sin_a dw 165 + sin_c dw 3 + sin_k dw 20 + sin_A dw 85 + sin_R dw 10 + + planet_R dw 120 + planet_r dw 25 + planet_h dw 195 + planet_d dw 30 + + tors_r dw 10 + tors_R1 dw 100 + tors_R2 dw 150 + tors_R3 dw 200 + tors_a1 dw 6 + tors_a2 dw 3 + + tor1_R dw 7 + tor1_r dd 1.8 + tor1_turns dd 25.132741228718345907701147066236 ; 2*4*pi + tor1_whorls dd 87.9645943005142106769540147318261 ; 7*4*pi + tor1_a dw 20 + + galaxy_rq dw 45 + galaxy_rz dw 30 + galaxy_R dw 185 + galaxy_k dd 9.42477796076937971538793014983851 ; 3*pi + galaxy_A dw 230 + + + cubes_R dw 70 + + explosion_R dw 230 + +;--------------------------------------------------------------------------- +;----------------------- calculation figures ------------------------------- +;--------------------------------------------------------------------------- + + +;---------------------------- explosion ------------------------------------ +explosion: + fild word [esi] ; st0=alf + fmul [const_mpi] ; st0=a=pi*alf*malf + fsincos ; st0=cos(a) st1=sin(a) + fild [Fl] + fidiv [mFl] + fadd [al_r] + fsin + fimul [explosion_R] ; st0=R st1=cos(a) st2=sin(a) + fmul st2,st0 ; st0=R st1=cos(a) st2=R*sin(a) + fmulp st1,st0 ; st0=R*cos(a) st2=R*sin(a) + fild word [esi+2] ; st0=bet st1=R*cos(a) st2=R*sin(a) + fmul [const_mpi] ; st0=pi*bet*mbet st1=R*cos(a) st2=R*sin(a) + fsincos ; st0=cos(b) st1=sin(b) st2=R*cos(a) st3=R*sin(a) + fxch st2 ; st0=R*cos(a) st1=sin(b) st2=cos(b) st3=R*sin(a) + fmul st2,st0 ; st0=R*cos(a) st1=sin(b) st2=R*cos(a)*cos(b) st3=R*sin(a) + fmulp st1,st0 ; st0=R*cos(a)*sin(b) st1=R*cos(a)*cos(b) st2=R*sin(a) +ret + + +;------------------------------ cubes -------------------------------------- +cubes: + push edx + xor edx,edx + mov eax,[Fl] + div [const6] + + + fild [cubes_R] ; st0=R + bt dx,0 + jc cubes_l0 + ; ax=xxxx xxxx xxxx xxx0b + fchs ; st0=-R + cubes_l0: + + fild word [esi+2] ; st0=bet st1=R + fmul [const_m] ; st0=bet*mbet st1=R + fmul st0,st1 ; st0=R*bet*mbet st1=R + + fild word [esi] ; st0=alf st1=R*bet*mbet st2=R + fmul [const_m] ; st0=alf*malf st1=R*bet*mbet st2=R + fmul st0,st2 ; st0=R*alf*malf st1=R*bet*mbet st2=R + + bt dx,2 + jc cubes_l1 ; dx=xxxx xxxx xxxx x10xb + bt dx,1 + jc cubes_l2 ; dx=xxxx xxxx xxxx x01xb + ; dx=xxxx xxxx xxxx x00xb + fstp st3 + cubes_l1: + fstp st3 + cubes_l2: + + div [const6] + + fild [cubes_R] ; st0=R + fadd st0,st0 + bt dx,0 + jc cubes_l4 + ; ax=xxxx xxxx xxxx xxx0b + fchs ; st0=-R + cubes_l4: + faddp st1,st0 + + bt dx,2 + jc cubes_l5 ; ax=xxxx xxxx xxxx x10xb + bt dx,1 + jc cubes_l6 ; ax=xxxx xxxx xxxx x01xb + ; ax=xxxx xxxx xxxx x00xb + fstp st3 + cubes_l5: + fstp st3 + cubes_l6: + + pop edx +ret + + +;----------------------------- galaxy -------------------------------------- +galaxy: + bt [Fl],0 + jc not_gal + fild [Fl] + fidiv [mFl] ; st0=f=Fl/mFl + fild word [esi+2] ; st0=bet st1=f + fmul [const_mpi] ; st0=b=pi*bet*mbet st1=f + fsincos ; st0=cos(b) st1=sin(b) st2=f + fild word [esi] ; st0=alf st1=cos(b) st2=sin(b) st3=f + fmul [const_m] ; st0=a=alf*malf st1=cos(b) st2=sin(b) st3=f + fmul st2,st0 ; st0=a st1=cos(b) st2=a*sin(b) st3=f + fmulp st1,st0 ; st0=a*cos(b) st1=a*sin(b) st2=f + fmul st0,st2 ; st0=f*a*cos(b) st1=a*sin(b) st2=f + fimul [galaxy_rz] ; st0=rz*f*a*cos(b) st1=a*sin(b) st2=f + fstp st3 ; st0=a*sin(b) st1=f st2=Z + fimul [galaxy_rq] ; st0=a*rq*sin(b) st1=f st2=Z + fiadd [galaxy_R] ; st0=R+a*rq*sin(b) st1=f st2=Z + fxch st1 ; st0=f st1=R+rq*a*sin(b) st2=Z + fmul st1,st0 ; st0=f st1=f*(R+rq*a*sin(b)) st2=Z + fmul [galaxy_k] ; st0=F=k*f st1=f*(R+rq*a*sin(b)) st2=Z + + bt [Fl],1 + jc gal_lb + fldpi + faddp st1,st0 ; st0=F=F+pi st1=f*(R+rq*a*sin(b)) st2=Z + gal_lb: + + fsincos ; st0=cos(F) st1=sin(F) st2=f*(R+rq*a*sin(b)) st3=Z + fxch st2 ; st0=f*(R+rq*a*sin(b)) st1=sin(F) st2=cos(F) st3=Z + fmul st2,st0 + fmulp st1,st0 ; st0=cos(F)*f*(R+rq*a*sin(b)) st1=sin(F)*f*(R+rq*a*sin(b)) st2=Z + ret + not_gal: + fild word [esi] ; st0=alf + fmul [const_mpi] ; st0=a=pi*alf*malf + fsincos ; st0=cos(a) st1=sin(a) + fild [Fl] ; st0=Fl st1=cos(a) st2=sin(a) + fidiv [mFl] ; st0=Fl/mFl st1=cos(a) st2=sin(a) + fmul st0,st0 + fmul st0,st0 + fmul st0,st0 + fst st3 + fimul [galaxy_A] ; st0=R=A*Fl/mFl st1=cos(a) st2=sin(a) + fmul st2,st0 ; st0=R st1=cos(a) st2=R*sin(a) + fmulp st1,st0 ; st0=R*cos(a) st2=R*sin(a) + fild word [esi+2] ; st0=bet st1=R*cos(a) st2=R*sin(a) + fmul [const_mpi] ; st0=pi*bet*mbet st1=R*cos(a) st2=R*sin(a) + fsincos ; st0=cos(b) st1=sin(b) st2=R*cos(a) st3=R*sin(a) + fxch st2 ; st0=R*cos(a) st1=sin(b) st2=cos(b) st3=R*sin(a) + fmul st2,st0 ; st0=R*cos(a) st1=sin(b) st2=R*cos(a)*cos(b) st3=R*sin(a) + fmulp st1,st0 ; st0=R*cos(a)*sin(b) st1=R*cos(a)*cos(b) st2=R*sin(a) + + ; around Z + fld st1 + fld st1 ; st0=x st1=y st2=x st3=y st4=z + fld [al_r] ; st0=a st1=x st2=y st3=x st4=y st5=z + fchs + fmul st0,st6 + fsincos ; st0=cos(a) st1=sin(a) st2=x st3=y st4=x st5=y st6=z + fmul st4,st0 + fmulp st5,st0 + fmul st2,st0 + fmulp st1,st0 ; st0=x*sin(a) st1=y*sin(a) st2=x*cos(a) st3=y*cos(a) st4=z + faddp st3,st0 + fsubp st1,st0 + + ffree st3 +ret + + + +;------------------------------ balls -------------------------------------- +balls: + mov eax,[Fl] + and eax,03h + + fild word [esi] ; st0=alf + fmul [const_mpi] ; st0=a=pi*alf*malf + fsincos ; st0=cos(a) st1=sin(a) + fild [balls_R] ; st0=R st1=cos(a) st2=sin(a) + fmul st2,st0 ; st0=R st1=cos(a) st2=R*sin(a) + fmulp st1,st0 ; st0=R*cos(a) st2=R*sin(a) + fild word [esi+2] ; st0=bet st1=R*cos(a) st2=R*sin(a) + fmul [const_mpi] ; st0=pi*bet*mbet st1=R*cos(a) st2=R*sin(a) + fsincos ; st0=cos(b) st1=sin(b) st2=R*cos(a) st3=R*sin(a) + fxch st2 ; st0=R*cos(a) st1=sin(b) st2=cos(b) st3=R*sin(a) + fmul st2,st0 ; st0=R*cos(a) st1=sin(b) st2=R*cos(a)*cos(b) st3=R*sin(a) + fmulp st1,st0 ; st0=R*cos(a)*sin(b) st1=R*cos(a)*cos(b) st2=R*sin(a) + + fiadd [balls_y1+2*eax] ; st0=y+R*cos(a)*sin(b) st1=R*cos(a)*cos(b) st2=R*sin(a) + fxch st1 ; st0=R*cos(a)*cos(b) st1=y+R*cos(a)*sin(b) st2=R*sin(a) + fiadd [balls_z1+2*eax] ; st0=z+R*cos(a)*cos(b) st1=y+R*cos(a)*sin(b) st2=R*sin(a) + fxch st2 ; st0=R*sin(a) st1=y+R*cos(a)*sin(b) st2=z+R*cos(a)*cos(b) + fiadd [balls_x1+2*eax] ; st0=x+R*sin(a) st1=y+R*cos(a)*sin(b) st2=z+R*cos(a)*cos(b) +ret + + +;------------------------------- sin --------------------------------------- +sin: + test [Fl],3Fh + + fild word [esi] ; st0=alf + + jnz sin_lb1 + fmul [const_mpi] ; st0=a=pi*alf*malf + fsincos ; st0=cos(a) st1=sin(a) + fild [sin_R] ; st0=R st1=cos(a) st2=sin(a) + fmul st2,st0 ; st0=R st1=cos(a) st2=R*sin(a) + fmulp st1,st0 ; st0=R*cos(a) st2=R*sin(a) + fild word [esi+2] ; st0=bet st1=R*cos(a) st2=R*sin(a) + fmul [const_mpi] ; st0=b=pi*bet*mbet st1=R*cos(a) st2=R*sin(a) + fsincos ; st0=cos(b) st1=sin(b) st2=R*cos(a) st3=R*sin(a) + fxch st2 ; st0=R*cos(a) st1=sin(b) st2=cos(b) st3=R*sin(a) + fmul st2,st0 ; st0=R*cos(a) st1=sin(b) st2=R*cos(a)*cos(b) st3=R*sin(a) + fmulp st1,st0 ; st0=R*cos(a)*sin(b) st1=R*cos(a)*cos(b) st2=R*sin(a) + fiadd [sin_A] ; st0=A+R*cos(b)*sin(a) st2=R*cos(a)*cos(b) st3=R*sin(a) + ret + + sin_lb1: + fmul [const_m] ; st0=alf*malf + fild word [esi+2] ; st0=bet st1=alf*malf + fmul [const_m] ; st0=bet*mbet st1=alf*malf + + fld st0 ; st0=bet*mbet st1=bet*mbet st2=alf*malf + fmul st0,st0 ; st0=(bet*mbet)^2 st1=bet*mbet st2=alf*malf + fld st2 ; st0=alf*malf st1=(bet*mbet)^2 st2=bet*mbet st3=alf*malf + fmul st0,st0 ; st0=(alf*malf)^2 st1=(bet*mbet)^2 st2=bet*mbet st3=alf*malf + faddp st1,st0 ; st0=(alf*malf)^2+(bet*mbet)^2 st1=bet*mbet st2=alf*malf + fsqrt ; st0=r=sqr((alf*malf)^2*(bet*mbet)^2) st1=bet*mbet st2=alf*malf + fild [sin_k] ; st0=k st1=r st2=bet*mbet st3=alf*malf + fmul st0,st1 ; st0=k*r st1=r st2=bet*mbet st3=alf*malf + fsin ; st0=sin(k*r) st1=r st2=bet*mbet st3=alf*malf + fdivrp st1,st0 ; st0=sin(k*r)/r st1=bet*mbet st2=alf*malf + fimul [sin_c] ; st0=c*sin(k*r)/r st1=bet*mbet st2=alf*malf + + fild [sin_a] ; st0=a st1=c*sin(k*r)/r st2=bet*mbet st3=alf*malf + fmul st2,st0 ; st0=a st1=c*sin(k*r)/r st2=a*bet*mbet st3=alf*malf + fmulp st3,st0 ; st0=c*sin(k*r)/r st1=a*bet*mbet st2=a*alf*malf +ret + + +;------------------------------ tors --------------------------------------- +tors: + push edx + xor edx,edx + mov eax,[Fl] + div [const3] + mov al,dl + pop edx + + fild word [esi] ; st0=alf + fmul [const_mpi] ; st0=a=pi*alf*malf + fsincos ; st0=cos(a) st1=sin(a) + fild [tors_r] ; st0=r st1=cos(a) st2=sin(a) + fmul st2,st0 ; st0=r st1=cos(a) st2=r*sin(a) + fmulp st1,st0 ; st0=r*cos(a) st1=r*sin(a) + bt ax,1 + jc tors_l1 ; ax=xxxx xxxx xxxx xx1xb + bt ax,0 + jc tors_l2 ; ax=xxxx xxxx xxxx xxx1b + fiadd [tors_R3] ; st0=r*cos(a)+R st1=r*sin(a) + fild word [esi+2] ; st0=bet st1=r*cos(a)+R st2=r*sin(a) + fmul [const_mpi] ; st0=b=pi*bet*mbet st1=r*cos(a)+R st2=r*sin(a) + fsincos ; st0=cos(b) st1=sin(b) st2=r*cos(a)+R st3=r*sin(a) + fxch st2 ; st0=r*cos(a)+R st1=sin(b) st2=cos(b) st3=r*sin(a) + fmul st2,st0 ; st0=r*cos(a)+R st1=sin(b) st2=cos(b)*(r*cos(a)+R) st3=r*sin(a) + fmulp st1,st0 ; st0=sin(b)*(r*cos(a)+R) st1=cos(b)*(r*cos(a)+R) st2=r*sin(a) + ret + + tors_l1: + fiadd [tors_R2] ; st0=r*cos(a)+R st1=r*sin(a) + fild word [esi+2] ; st0=bet st1=r*cos(a)+R st2=r*sin(a) + fmul [const_mpi] ; st0=b=pi*bet*mbet st1=r*cos(a)+R st2=r*sin(a) + fsincos ; st0=cos(b) st1=sin(b) st2=r*cos(a)+R st3=r*sin(a) + fxch st2 ; st0=r*cos(a)+R st1=sin(b) st2=cos(b) st3=r*sin(a) + fmul st2,st0 ; st0=r*cos(a)+R st1=sin(b) st2=cos(b)*(r*cos(a)+R) st3=r*sin(a) + fmulp st1,st0 ; st0=sin(b)*(r*cos(a)+R) st1=cos(b)*(r*cos(a)+R) st2=r*sin(a) + jmp tors_l3 + + tors_l2: + fiadd [tors_R1] ; st0=r*cos(a)+R st1=r*sin(a) + fild word [esi+2] ; st0=bet st1=r*cos(a)+R st2=r*sin(a) + fmul [const_mpi] ; st0=b=pi*bet*mbet st1=r*cos(a)+R st2=r*sin(a) + fsincos ; st0=cos(b) st1=sin(b) st2=r*cos(a)+R st3=r*sin(a) + fxch st2 ; st0=r*cos(a)+R st1=sin(b) st2=cos(b) st3=r*sin(a) + fmul st2,st0 ; st0=r*cos(a)+R st1=sin(b) st2=cos(b)*(r*cos(a)+R) st3=r*sin(a) + fmulp st1,st0 ; st0=sin(b)*(r*cos(a)+R) st1=cos(b)*(r*cos(a)+R) st2=r*sin(a) + + + ; around Y + ; x= x*cos(a)-z*sin(a) + ; y= y + ; z= x*sin(a)+z*cos(a) + fld st2 ; st0=z st1=x st2=y st3=z + fld st1 ; st0=x st1=z st2=x st3=y st4=z + fld [al_r] + fimul [tors_a1] ; st0=a st1=x st2=z st3=x st4=y st5=z + fsincos ; st0=cos(a) st1=sin(a) st2=x st3=z st4=x st5=y st6=z + fmul st4,st0 + fmulp st6,st0 ; st0=sin(a) st1=x st2=z st3=x*cos(a) st4=y st5=z*cos(a) + fmul st2,st0 + fmulp st1,st0 ; st0=x*sin(a) st1=z*sin(a) st2=x*cos(a) st3=y st4=z*cos(a) + faddp st4,st0 + fsubp st1,st0 + + tors_l3: + ; around X + ; x=x + ; y= y*cos(b)+z*sin(b) + ; z=-y*sin(b)+z*cos(b) + fld st2 ; st0=z st1=x st2=y st3=z + fld st2 ; st0=y st1=z st2=x st3=y st4=z + fld [al_r] + fimul [tors_a2] ; st0=b st1=y st2=z st3=x st4=y st5=z + fsincos ; st0=cos(b) st1=sin(b) st2=y st3=z st4=x st5=y st6=z + fmul st5,st0 + fmulp st6,st0 ; st0=sin(b) st1=y st2=z st3=x st4=y*cos(b) st5=z*cos(b) + fmul st2,st0 + fmulp st1,st0 ; st0=y*sin(b) st1=z*sin(b) st2=x st3=y*cos(b) st4=z*cos(b) + fsubp st4,st0 ; st0=z*sin(b) st1=x st2=y*cos(b) st3=z*cos(b)-y*sin(b) + faddp st2,st0 +ret + + +;------------------------------ tor1 --------------------------------------- +tor1: + fild [tor1_a] ; st0=a + fild word [esi+2] ; st0=bet st1=a + fmul [const_mpi] ; st0=b=pi*bet*mbet st1=a + fsincos ; st0=cos(b) st1=sin(b) st2=a + fild word [esi] ; st0=alf st1=cos(b) st2=sin(b) st3=a + fmul [const_m] ; st0=alf*malf st1=cos(b) st2=sin(b) st3=a + fld st0 ; st0=alf*malf st1=alf*malf st2=cos(b) st3=sin(b) st4=a + fmul [tor1_whorls] ; st0=wa=whorls*alf*malf st1=alf*malf st2=cos(b) st3=sin(b) st4=a + fsincos ; st0=cos(wa) st1=sin(wa) st2=alf*malf st3=cos(b) st4=sin(b) st5=a + fld [tor1_r] ; st0=r st1=cos(wa) st2=sin(wa) st3=alf*malf st4=cos(b) st5=sin(b) st6=a + fmul st2,st0 ; st0=r st1=cos(wa) st2=r*sin(wa) st3=alf*malf st4=cos(b) st5=sin(b) st6=a + fmulp st1,st0 ; st0=r*cos(wa) st1=r*sin(wa) st2=alf*malf st3=cos(b) st4=sin(b) st5=a + fiadd [tor1_R] ; st0=R+r*cos(wa) st1=r*sin(wa) st2=alf*malf st3=cos(b) st4=sin(b) st5=a + faddp st3,st0 ; st0=r*sin(wa) st1=alf*malf st2=R+r*cos(wa)+cos(b) st3=sin(b) st4=a + faddp st3,st0 ; st0=alf*malf st1=R+r*cos(wa)+cos(b) st2=r*sin(wa)+sin(b) st3=a + fmul [tor1_turns] ; st0=ta=turns*alf*malf st1=R+r*cos(wa)+cos(b) st2=r*sin(wa)+sin(b) st3=a + fsincos ; st0=cos(ta) st1=sin(ta) st2=R+r*cos(wa)+cos(b) st3=r*sin(wa)+sin(b) st4=a + fmul st0,st2 ; st0=cos(ta)*(R+r*cos(wa)+cos(b)) st1=sin(ta) st2=R+r*cos(wa)+cos(b) st3=r*sin(wa)+sin(b) st4=a + fmul st0,st4 ; st0=a*cos(ta)*(R+r*cos(wa)+cos(b)) st1=sin(ta) st2=R+r*cos(wa)+cos(b) st3=r*sin(wa)+sin(b) st4=a + fstp st5 ; st0=sin(ta) st1=R+r*cos(wa)+cos(b) st2=r*sin(wa)+sin(b) st3=a st4=y + fmulp st1,st0 ; st0=sin(ta)*(R+r*cos(wa)+cos(b)) st1=r*sin(wa)+sin(b) st2=a st3=y + fmul st0,st2 ; st0=z=a*sin(ta)*(R+r*cos(wa)+cos(b)) st1=r*sin(wa)+sin(b) st2=a st3=y + fstp st4 ; st0=r*sin(wa)+sin(b) st1=a st2=y st3=z + fmulp st1,st0 ; st0=x=a*(r*sin(wa)+sin(b)) st1=y st2=z +ret + + + +;------------------------------- tor --------------------------------------- +tor: + fild word [esi] ; st0=alf + fmul [const_mpi] ; st0=a=pi*alf*malf + fsincos ; st0=cos(a) st1=sin(a) + fild [tor_r] ; st0=r st1=cos(a) st2=sin(a) + fmul st2,st0 ; st0=r st1=cos(a) st2=r*sin(a) + fmulp st1,st0 ; st0=r*cos(a) st1=r*sin(a) + fiadd [tor_R] ; st0=r*cos(a)+R st1=r*sin(a) + fild word [esi+2]; st0=bet st1=r*cos(a)+R st2=r*sin(a) + fmul [const_mpi] ; st0=b=pi*bet*mbet st1=r*cos(a)+R st2=r*sin(a) + fsincos ; st0=cos(b) st1=sin(b) st2=r*cos(a)+R st3=r*sin(a) + fxch st2 ; st0=r*cos(a)+R st1=sin(b) st2=cos(b) st3=r*sin(a) + fmul st2,st0 ; st0=r*cos(a)+R st1=sin(b) st2=cos(b)*(r*cos(a)+R) st3=r*sin(a) + fmulp st1,st0 ; st0=sin(b)*(r*cos(a)+R) st1=cos(b)*(r*cos(a)+R) st2=r*sin(a) +ret + + +;------------------------------ spiral ------------------------------------- +spiral: + fild word [esi+2] ; st0=bet + fmul [const_m] ; st0=bet*mbet + fild word [esi] ; st0=alf st1=bet*mbet + fmul [const_mpi] ; st0=a=pi*alf*malf st1=bet*mbet + fsincos ; st0=cos(a) st1=sin(a) st2=bet*mbet + fimul [spiral_r] ; st0=r*cos(a) st1=sin(a) st2=bet*mbet + fld st2 ; st0=bet*mbet st1=r*cos(a) st2=sin(a) st3=bet*mbet + fimul [spiral_h] ; st0=bet*mbet*h st1=r*cos(a) st2=sin(a) st3=bet*mbet + faddp st1,st0 ; st0=z=bet*mbet*h+r*cos(a) st1=sin(a) st2=bet*mbet + fstp st3 ; st0=sin(a) st1=bet*mbet st2=z + fimul [spiral_r] ; st0=r*sin(a) st1=bet*mbet st2=z + fiadd [spiral_R] ; st0=r*sin(a)+R st1=bet*mbet st2=z + fxch st1 ; st0=bet*mbet st1=r*sin(a)+R st2=z + fimul [spiral_L] ; st0=b=L*bet*mbet st1=r*sin(a)+R st2=z + fsincos ; st0=cos(b) st1=sin(b) st2=r*sin(a)+R st3=z + fxch st2 ; st0=r*sin(a)+R st1=sin(b) st2=cos(b) st3=z + fmul st2,st0 ; st0=r*sin(a)+R st1=sin(b) st2=(r*sin(a)+R)*cos(b) st3=z + fmulp st1,st0 ; st0=x=(r*sin(a)+R)*sin(b) st2=y=(r*sin(a)+R)*cos(b) st3=z +ret + + +;------------------------------- cube -------------------------------------- +cube: + push edx + xor edx,edx + mov eax,[Fl] + div [const6] + + fild [cube_R] ; st0=R + bt dx,0 + jc cube_l0 + ; dx=xxxx xxxx xxxx xxx0b + fchs ; st0=-R + cube_l0: + + fild word [esi+2] ; st0=bet st1=R + fmul [const_m] ; st0=bet*mbet st1=R + fmul st0,st1 ; st0=R*bet*mbet st1=R + + fild word [esi] ; st0=alf st1=R*bet*mbet st2=R + fmul [const_m] ; st0=alf*malf st1=R*bet*mbet st2=R + fmul st0,st2 ; st0=R*alf*malf st1=R*bet*mbet st2=R + + bt dx,2 + jc cube_l1 ; dx=xxxx xxxx xxxx x10xb + bt dx,1 + jc cube_l2 ; dx=xxxx xxxx xxxx x01xb + ; dx=xxxx xxxx xxxx x00xb + fstp st3 + cube_l1: + fstp st3 + cube_l2: + pop edx +ret + + +;------------------------------ planet ------------------------------------- +planet: + bt [Fl],0 + jc planet_lb1 + + bt [Fl],1 + jc planet_lb0 + fild word [esi] ; st0=alf + fmul [const_mpi] ; st0=a=pi*alf*malf + fsincos ; st0=cos(a) st1=sin(a) + fild [planet_R] ; st0=R st1=cos(a) st2=sin(a) + fmul st2,st0 ; st0=R st1=cos(a) st2=R*sin(a) + fmulp st1,st0 ; st0=R*cos(a) st2=R*sin(a) + fild word [esi+2] ; st0=bet st1=R*cos(a) st2=R*sin(a) + fmul [const_mpi] ; st0=b=pi*bet*mbet st1=R*cos(a) st2=R*sin(a) + fsincos ; st0=cos(b) st1=sin(b) st2=R*cos(a) st3=R*sin(a) + fxch st2 ; st0=R*cos(a) st1=sin(b) st2=cos(b) st3=R*sin(a) + fmul st2,st0 ; st0=R*cos(a) st1=sin(b) st2=R*cos(a)*cos(b) st3=R*sin(a) + fmulp st1,st0 ; st0=R*cos(a)*sin(b) st1=R*cos(a)*cos(b) st2=R*sin(a) + ret + planet_lb0: + fild word [esi] ; st0=alf + fmul [const_mpi] ; st0=a=pi*alf*malf + fsincos ; st0=cos(a) st1=sin(a) + fild [planet_r] ; st0=R st1=cos(a) st2=sin(a) + fmul st2,st0 ; st0=R st1=cos(a) st2=R*sin(a) + fmulp st1,st0 ; st0=R*cos(a) st2=R*sin(a) + fild word [esi+2] ; st0=bet st1=R*cos(a) st2=R*sin(a) + fmul [const_mpi] ; st0=b=pi*bet*mbet st1=R*cos(a) st2=R*sin(a) + fsincos ; st0=cos(b) st1=sin(b) st2=R*cos(a) st3=R*sin(a) + fxch st2 ; st0=R*cos(a) st1=sin(b) st2=cos(b) st3=R*sin(a) + fmul st2,st0 ; st0=R*cos(a) st1=sin(b) st2=R*cos(a)*cos(b) st3=R*sin(a) + fmulp st1,st0 ; st0=R*cos(a)*sin(b) st1=R*cos(a)*cos(b) st2=R*sin(a) + fiadd [planet_h] ; st0=R*cos(a)*sin(b)+h st1=R*cos(a)*cos(b) st2=R*sin(a) + fxch st1 ; st0=R*cos(a)*cos(b) st1=R*cos(a)*sin(b)+h st2=R*sin(a) + ret + planet_lb1: + fild word [esi+2] ; st0=bet + fmul [const_m] ; st0=bet*mbet + fimul [planet_d] ; st0=d*bet*mbet + fiadd [planet_h] ; st0=h+d*bet*mbet + fild word [esi] ; st0=alf st1=h+d*bet*mbet + fmul [const_mpi] ; st0=a=pi*alf*malf st1=h+d*bet*mbet + fsincos ; st0=cos(a) st1=sin(a) st2=h+d*bet*mbet + fxch st2 ; st0=h+d*bet*mbet st1=sin(a) st2=cos(a) + fmul st2,st0 ; st0=h+d*bet*mbet st1=sin(a) st2=cos(a)*(h+d*bet*mbet) + fmulp st1,st0 ; st0=(h+d*bet*mbet)*sin(a) st1=cos(a)*(h+d*bet*mbet) + fldz ; st0=0 st1=(h+d*bet*mbet)*sin(a) st2=cos(a)*(h+d*bet*mbet) +ret + diff --git a/programs/crownscr/trunk/macros.inc b/programs/crownscr/trunk/macros.inc new file mode 100644 index 0000000000..f2345b6200 --- /dev/null +++ b/programs/crownscr/trunk/macros.inc @@ -0,0 +1,261 @@ +; 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 + +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 \ No newline at end of file diff --git a/programs/cslide/trunk/build_en.bat b/programs/cslide/trunk/build_en.bat new file mode 100644 index 0000000000..74c546e965 --- /dev/null +++ b/programs/cslide/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm cslide.asm cslide +@pause \ No newline at end of file diff --git a/programs/cslide/trunk/build_ru.bat b/programs/cslide/trunk/build_ru.bat new file mode 100644 index 0000000000..c69f7975c5 --- /dev/null +++ b/programs/cslide/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm cslide.asm cslide +@pause \ No newline at end of file diff --git a/programs/cslide/trunk/cslide.asm b/programs/cslide/trunk/cslide.asm new file mode 100644 index 0000000000..7e8de3e3c9 --- /dev/null +++ b/programs/cslide/trunk/cslide.asm @@ -0,0 +1,391 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; ; +; Color Slider Control Demonstration ; +; ; +; Compile with FASM for Menuet ; +; ; +; Author: Jason Delozier ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +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 + +include 'lang.inc' +START: ; start of execution + + call draw_window ; at first, draw the window + +still: + call mouse_info + + mov eax,23 + mov ebx,2 + 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 + 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 + + shr eax,8 + + cmp eax,1 ; button id=1 ? + jne noclose + mov eax,-1 ; close this program + int 0x40 + noclose: + + + nofind: + 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+200 ; [x start] *65536 + [x size] + mov ecx,100*65536+200 ; [y start] *65536 + [y size] + mov edx,0x03ffffff ; color of work area RRGGBB,8->color gl + mov esi,0x806688cc + mov edi,0x006688cc + 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,0x00ddeeff ; color of text RRGGBB + mov edx,labelt ; pointer to text beginning + mov esi,labellen-labelt ; text length + int 0x40 + + call draw_slider_info + + xor ecx,ecx +Draw_Controls_Loop: + mov ebp, [App_Controls+ecx] ;get controls data location + or ebp,ebp + jz Draw_Controls_Done + call dword [App_Controls+ecx+4] ;call controls draw function + add ecx, 12 + jmp Draw_Controls_Loop +Draw_Controls_Done: + + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + + ret + + +;*********************************************** +;* Mouse Stuff +;*********************************************** +mousey dw 0 +mousex dw 0 +mouseb dd 0 + +mouse_info: + mov eax, 37 ;get mouse cordinates + mov ebx, 1 ; + int 0x40 ; + mov ecx, eax ; + push ecx ; + mov eax, 37 ;get mouse buttons + mov ebx, 2 ; + int 0x40 ; + cmp [mouseb], eax ;compare old mouse states to new states + jne redraw_mouse_info ; + cmp [mousey], cx ; + jne redraw_mouse_info ; + shr ecx, 16 ; + cmp [mousex], cx ; + jne redraw_mouse_info ; + pop ecx ; +ret ;return if no change in states + + +redraw_mouse_info: + pop ecx + mov [mouseb], eax ;save new mouse states + mov dword [mousey], ecx + + xor ecx, ecx +Check_Mouse_Over_Controls_Loop: + mov ebp, [App_Controls+ecx] + or ebp,ebp + jz Check_Mouse_Over_Controls_Loop_done + movzx eax,word [ebp+2] + cmp ax, [mousex] + ja mouse_not_on_control + movzx eax,word [ebp+6] + cmp ax, [mousey] + ja mouse_not_on_control + movzx eax,word [ebp] + add ax, [ebp+2] + cmp ax, [mousex] + jb mouse_not_on_control + movzx eax,word [ebp+4] + add ax, [ebp+6] + cmp ax, [mousey] + jb mouse_not_on_control + call dword [App_Controls+ecx+8] +mouse_not_on_control: + add ecx, 12 + jmp Check_Mouse_Over_Controls_Loop +Check_Mouse_Over_Controls_Loop_done: + +ret + + + + +;*********************************************** + + +draw_slider_info: +;Repaint value background + mov eax, 13 + mov ebx, 0x00960028 + mov ecx, 0x00240010 + mov edx, 0x00ffffff + int 0x40 +;Draw Color Box + xor edx, edx + movzx ecx,word [slider_1+12] + mov dh, cl + movzx ecx,word [slider_2+12] + mov dl, cl + shl edx, 8 + movzx ecx,word [slider_3+12] + mov dl,cl + mov ebx, 0x00860035 + mov ecx, 0x00590040 + mov eax, 13 + int 0x40 +;draw current value of slider + mov ecx, edx + mov eax, 47 + mov ebx, 0x00060100 + mov esi, 0 + mov edx, 0x009A0029 + int 0x40 +ret + + +;************************************** +;* +;* App Controls +;* +;************************************** + +App_Controls: + dd slider_1 , draw_slider, slider_mouse_over ; + dd slider_2 , draw_slider, slider_mouse_over ; + dd slider_3 , draw_slider, slider_mouse_over ; + dd 0 , 0 ; denotes last control do not delete + +;************************************** +;* +;* Slider data +;* +;************************************** + +slider_1: + dw 25 ;width +0 + dw 10 ;x +2 + dw 150 ;height +4 + dw 30 ;y +6 + dw 0 ;min +8 + dw 255 ;max +10 + dw 128 ;current +12 + dw 1 ;small change +14 + dw 5 ;big change +16 + +slider_2: + dw 25 ;width +0 + dw 55 ;x +2 + dw 150 ;height +4 + dw 30 ;y +6 + dw 0 ;min +8 + dw 255 ;max +10 + dw 128 ;current +12 + dw 1 ;small change +14 + dw 5 ;big change +16 + +slider_3: + dw 25 ;width +0 + dw 100 ;x +2 + dw 150 ;height +4 + dw 30 ;y +6 + dw 0 ;min +8 + dw 255 ;max +10 + dw 128 ;current +12 + dw 1 ;small change +14 + dw 5 ;big change +16 + +;************************************** +;* +;* Slider Code +;* +;************************************** + +box_h dw 10 ;static slider box height + +draw_slider: + push eax + push ebx + push ecx + push edx +;Draw slider background + mov eax, 13 ;slider background + mov ebx, [ebp] ;x start/width + mov ecx, [ebp+4] ;y start/height + mov edx, 0x002288DD ;color + int 0x40 ;draw bar +;Draw line for slide rail + mov eax, 38 ;draw vertical slide line + movzx ebx,word [ebp] ;x + shr ebx, 1 ; + add bx,word [ebp+2]; + push bx ; + shl ebx, 16 ; + pop bx ; + mov ecx, [ebp+4] ;y start / height + add ecx, 0x000A0000 ; + add ecx, [ebp+6] ;y start + sub ecx, 10 ; + mov edx, 0x00 ;color + int 0x40 ; +;Draw slider box + movzx eax,word [ebp+4] ;height + sub eax, 20 ; + movzx ebx,word [ebp+10] ;max value + sub bx,word [ebp+8] ;min value + movzx ecx,word [ebp+12] ; + call slider_fpu_calc ;EAX = ((EAX/EBX)*ECX) + mov ebx, [ebp] ;x start / width + movzx ecx,word [ebp+4] ;height + add cx, [ebp+6] ;y + sub ecx, 10 ; + movzx edx, [box_h] ; + shr edx, 1 ; + sub ecx, edx ; + sub ecx, eax ;*slide box y position + shl ecx, 16 ; + mov cx, [box_h] ;height + mov eax, 13 ;draw bar sys function + mov edx, 0x00 ;color + int 0x40 ;draw slider box + pop edx + pop ecx + pop ebx + pop eax +ret + +slider_mouse_over: + push eax + push ebx + push ecx + push edx + cmp [mouseb], 1 + jne slider_mouse_over_done + movzx eax,word [ebp+4] + add ax, [ebp+6] + sub eax, 10 + cmp [mousey], ax + ja slider_mouse_min + movzx eax,word [ebp+6] + add eax, 10 + cmp [mousey], ax + jb slider_mouse_max +;determine new current value + movzx eax,word [ebp+10] ;slider max value + sub ax,word [ebp+8] ;slider min value + movzx ebx,word [ebp+4] ;slider height + sub ebx,20 ;rail size + movzx ecx,word [mousey] ;current mouse y pixel + sub cx,word [ebp+6] ;minus y start of slider + sub ecx, 10 ;minus pixels to top of rail + call slider_fpu_calc ;EAX = ((EAX/EBX)*ECX) + movzx ebx,word [ebp+10] ;slider max + sub ebx,eax ;*current calculated position + jmp slider_mouse_change; +slider_mouse_max: ; + movzx ebx,word [ebp+10] ;get maximum value + jmp slider_mouse_change ; +slider_mouse_min: ; + movzx ebx,word [ebp+8] ;get minimum value +slider_mouse_change: ; + mov [ebp+12],bx ;new slider current position + call draw_slider ; + call draw_slider_info ; +slider_mouse_over_done: ; + pop edx + pop ecx + pop ebx + pop eax +ret + + +temp dd 0 ;temp varibles used in fpu computations +temp2 dd 0 +temp3 dd 0 + +slider_fpu_calc: + mov [temp], eax + mov [temp2], ebx + mov [temp3], ecx + finit ;initilize FPU + fld dword [temp] ;load value + fdiv dword [temp2] ;divide + fmul dword [temp3] ;multiply + fst dword [temp] ;store computed value + mov eax, [temp] +ret + +;************************************************** +;* End Slider Code +;************************************************** + +; DATA AREA +labelt: db 'Color Slider' +labellen: +I_END: + + + + diff --git a/programs/desktop/trunk/build_en.bat b/programs/desktop/trunk/build_en.bat new file mode 100644 index 0000000000..0535e8b00d --- /dev/null +++ b/programs/desktop/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm desktop.asm desktop +@pause \ No newline at end of file diff --git a/programs/desktop/trunk/build_ru.bat b/programs/desktop/trunk/build_ru.bat new file mode 100644 index 0000000000..05b7e9d8e8 --- /dev/null +++ b/programs/desktop/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm desktop.asm desktop +@pause \ No newline at end of file diff --git a/programs/desktop/trunk/desktop.asm b/programs/desktop/trunk/desktop.asm new file mode 100644 index 0000000000..2a2bdf35aa --- /dev/null +++ b/programs/desktop/trunk/desktop.asm @@ -0,0 +1,600 @@ +; +; UNIFORM WINDOW COLOURS +; +; Compile with FASM for Menuet +; +; < russian edition by Ivan Poddubny > +; + +;****************************************************************************** + use32 + org 0 + db 'MENUET01' ; identifier + dd 1 ; header version + dd START ; start address + dd I_END ; file size + dd 20000h ; memory + dd 10000h ; stack pointer (0x10000+ - work area for os) + dd 0;,0 ; parameters, reserved + + include 'lang.inc' + include 'macros.inc' +;****************************************************************************** + + + +START: ; start of execution + + mov eax,48 ; get current colors + mov ebx,3 + mov ecx,color_table + mov edx,4*10 + int 0x40 + + cld + mov esi, default_file + mov edi, fname + mov ecx, default_file.size + rep movsb + + mov [read_info.address], color_table + mov [read_info.workarea], 0x10000 + mov [read_info.start_block], 0 + +red: + call draw_window ; at first, draw the window + +still: + + mov eax,23 ; wait here for event + mov ebx,5 + int 0x40 + + dec eax ; redraw request ? + jz red + dec eax ; key in buffer ? + jz key + dec eax ; button in buffer ? + jz button + + call draw_cursor + + 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,14 ; set 3d buttons + jne no_3d + mov eax,48 + mov ebx,1 + mov ecx,1 + int 0x40 + mov eax,48 + mov ebx,0 + mov ecx,0 + int 0x40 + jmp still + no_3d: + + cmp ah,15 ; set flat buttons + jne no_flat + mcall 48, 1, 0 + mcall 48, 0, 0 + jmp still + no_flat: + + cmp ah,51 ; apply + jne no_apply + mov eax,48 + mov ebx,2 + mov ecx,color_table + mov edx,10*4 + int 0x40 + mov eax,48 + mov ebx,0 + mov ecx,0 + int 0x40 + no_apply: + + cmp ah,31 + jb no_new_colour + cmp ah,41 + jg no_new_colour + shr eax,8 + sub eax,31 + shl eax,2 + add eax,color_table + mov ebx,[color] + mov [eax],ebx + call draw_colours + jmp still + no_new_colour: + + cmp ah,1 ; terminate + jnz noid1 + mov eax,-1 + int 0x40 + noid1: + + cmp ah,11 ; read string + jne no_string + call read_string + jmp still + no_string: + + cmp ah,12 ; load file + jne no_load + call load_file + call draw_window + jmp still + no_load: + + cmp ah,13 ; save file + jne no_save + call save_file + jmp still + no_save: + + jmp still + + +draw_cursor: + + pusha + mov eax,37 + mov ebx,2 + int 0x40 + + cmp eax,0 + jne dc1 + popa + ret + + dc1: + + mov eax,37 + mov ebx,1 + int 0x40 + + mov ebx,eax + shr ebx,16 + mov ecx,eax + and ecx,0xffff + + cmp ecx,32 + jbe no_color + cmp ebx,32 + jbe no_color + + cmp ebx,280 ; CHANGE COLOR + jb no_color + cmp ebx,280+20*3 + jg no_color + + cmp ecx,30+128 + jge no_color + cmp ecx,30 + jb no_color + + sub ebx,280 + mov eax,ebx + cdq + mov ebx,20 + div ebx + mov ebx,2 + sub ebx,eax + + add ecx,-30 + not ecx + shl ecx,1 + + mov byte [ebx+color],cl + call draw_color + + popa + ret + + no_color: + + popa + ret + + +load_file: + pushad + + mov [read_info.mode], 0 + mov [read_info.blocks], 1 + mcall 58, read_info + + call draw_colours + + popad +ret + + +save_file: + pushad + + mov [write_info.mode], 1 + mov [write_info.bytes2write], 10*4 + mcall 58, write_info + + popad +ret + + +read_string: + + pusha + + mov edi,fname + mov al,'_' + mov ecx,54 + cld + rep stosb + + call print_text + + mov edi,fname + + f11: + mov eax,10 + int 0x40 + cmp eax,2 + jne read_done + mov eax,2 + int 0x40 + shr eax,8 + cmp eax,13 + je read_done + cmp eax,8 + jne nobsl + cmp edi,fname + je f11 + dec edi + mov [edi],byte '_' + call print_text + jmp f11 + nobsl: + mov [edi],al + + call print_text + + inc edi + cmp edi, fname+54 + jne f11 + + read_done: + + mov ecx, fname + add ecx, 55 + sub ecx, edi + mov eax, 0 + cld + rep stosb + + call print_text + + popa + + ret + + +print_text: + pushad + + mpack ebx, 16, 6*54+4 + mpack ecx, 234, 10 + mcall 13, , , [w_work] + + mpack ebx, 17, 235 + mcall 4, , [w_work_text], fname, 54 + + popad +ret + + +draw_color: + + pusha + + mov eax,13 + mov ebx,280*65536+60 + mov ecx,170*65536+30 + mov edx,[color] + int 0x40 + +; mov eax,13 + mov ebx,280*65536+60 + mov ecx,200*65536+10 + mov edx,[w_work] + int 0x40 + + mov eax,47 + mov ebx,0+1*256+8*65536 + mov ecx,[color] + mov edx,280*65536+201 + mov esi,[w_work_text] + int 0x40 + + popa + + ret + + +draw_colours: + + pusha + + mov esi,color_table + + mov ebx,225*65536+32 + mov ecx,37*65536+12 + newcol: + mov eax,13 + mov edx,[esi] + int 0x40 + add ecx,20*65536 + add esi,4 + cmp esi,color_table+4*9 + jbe newcol + + popa + + ret + + + +; ********************************************* +; ******* 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,app_colours + mov edx,10*4 + int 0x40 + + mov eax,14 + int 0x40 + + sub eax,60*65536 + mov ebx,eax + mov bx,40 + + ; DRAW WINDOW + mov eax,0 ; function 0 : define and draw window + mov ebx,110*65536+360 ; [x start] *65536 + [x size] + mov ecx,50*65536+300 ; [y start] *65536 + [y size] + mov edx,[w_work] ; color of work area RRGGBB,8->color + or edx,0x02000000 + mov esi,[w_grab] ; color of grab bar RRGGBB,8->color gl + or esi,0x80000000 + mov edi,[w_frame] ; color of frames RRGGBB + int 0x40 + + ; WINDOW LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,8*65536+7 ;8 ; [x start] *65536 + [y start] + mov ecx,[w_grab_text] ; color of text RRGGBB +if lang eq ru + or ecx,0x10000000 +end if + mov edx,labelt ; pointer to text beginning + mov esi,labelt.size ; text length + int 0x40 + ; CLOSE BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(360-19)*65536+12 ; [x start] *65536 + [x size] + mov ecx,4*65536+12 ; [y start] *65536 + [y size] + mov edx,1 ; button id + mov esi,[w_grab_button] ; button color RRGGBB + int 0x40 + +; mov eax,8 ; FILENAME BUTTON + mov ebx,280*65536+60 + mov ecx,250*65536+14 + mov edx,11 + mov esi,[w_work_button] + int 0x40 + +; mov eax,8 ; SAVE BUTTON + mov ebx,280*65536+29 + mov ecx,270*65536+14 + mov edx,12 + int 0x40 + +; mov eax,8 ; LOAD BUTTON + add ebx,30*65536 + inc edx + int 0x40 + +; mov eax,8 ; 3D + mov ebx,15*65536+35 + mov ecx,275*65536+14 + inc edx + int 0x40 +; mov eax,8 ; FLAT +if lang eq ru + add ebx,40*65536+7 +else + add ebx,40*65536 +end if + inc edx + int 0x40 + + + mov eax, 4 + mov ebx, 281*65536+254 + mov ecx, [w_work_button_text] + mov edx, t1 + mov esi, t1.size + int 0x40 + +; mov eax, 4 + mov ebx, 277*65536+274 + mov edx, t2 + mov esi, t2.size + int 0x40 + + mov eax,38 ; R G B COLOR GLIDES + mov ebx,280*65536+300 ;295 + mov ecx,30*65536+30 + mov edx,0xff0000 + .newl: + int 0x40 + pusha + add ebx,20*65536+20 + shr edx,8 + int 0x40 + add ebx,20*65536+20 + shr edx,8 + int 0x40 + popa + sub edx,0x020000 + add ecx,0x00010001 + cmp ecx,158*65536+158 + jnz .newl + + call draw_color + + mov edx,31 ; BUTTON ROW + mov ebx,15*65536+200 + mov ecx,35*65536+14 + mov esi,[w_work_button] + newb: + mov eax,8 + int 0x40 + add ecx,20*65536 + inc edx + cmp edx,40 + jbe newb + +; mov eax,8 ; APPLY BUTTON + add ecx,20*65536 + mov edx,51 + int 0x40 + + mov ebx,20*65536+39 ; ROW OF TEXTS + mov ecx,[w_work_button_text] + mov edx,text + mov esi,32 + newline: + mov eax,4 + int 0x40 + add ebx,20 + add edx,32 + cmp [edx],byte 'x' + jne newline + + call draw_colours + + call print_text + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + + ret + + +; DATA AREA + +lsz text,\ + ru, ' РАМКА ОКНА ',\ + ru, ' ПОЛОСА ЗАГОЛОВКА ',\ + ru, ' КНОПКА НА ПОЛОСЕ ЗАГОЛОВКА ',\ + ru, ' ТЕКСТ НА КНОПКЕ НА ЗАГОЛОВКЕ ',\ + ru, ' ТЕКСТ ЗАГОЛОВОКА ',\ + ru, ' РАБОЧАЯ ОБЛАСТЬ ',\ + ru, ' КНОПКА В РАБОЧЕЙ ОБЛАСТИ ',\ + ru, ' ТЕКСТ НА КНОПКЕ ',\ + ru, ' ТЕКСТ В РАБОЧЕЙ ОБЛАСТИ ',\ + ru, ' ГРАФИКА В РАБОЧЕЙ ОБЛАСТИ ',\ + ru, ' ',\ + ru, ' ПРИМЕНИТЬ ',\ + ru, ' 3D ПЛОСК ',\ + ru, 'x',\ + en, ' WINDOW FRAME ',\ + en, ' WINDOW GRAB BAR ',\ + en, ' WINDOW GRAB BUTTON ',\ + en, ' WINDOW GRAB BUTTON TEXT ',\ + en, ' WINDOW GRAB TITLE ',\ + en, ' WINDOW WORK AREA ',\ + en, ' WINDOW WORK AREA BUTTON ',\ + en, ' WINDOW WORK AREA BUTTON TEXT ',\ + en, ' WINDOW WORK AREA TEXT ',\ + en, ' WINDOW WORK AREA GRAPH ',\ + en, ' ',\ + en, ' APPLY CHANGES ',\ + en, ' 3D FLAT ',\ + en, 'x' + + +lsz t2,\ + ru, ' ЗАГР СОХР ',\ + en, ' LOAD SAVE ' + +lsz t1,\ + ru, ' ФАЙЛ ',\ + en, ' FILENAME ' + +lsz labelt,\ + ru, 'НАСТРОЙКА ЦВЕТОВ',\ + en, 'DESKTOP COLOURS - DEFINE COLOR AND CLICK ON TARGET' + + +sz default_file, '/RD/1/DEFAULT.DTP' + +color dd 0 + +I_END: + +read_info: + .mode dd ? ; read + .start_block dd ? ; first block + .blocks dd ? ; 512 bytes + .address dd ? + .workarea dd ? +fname rb 256+1 ; filename (+1 - for zero at the end) + +virtual at read_info + write_info: + .mode dd ? + rd 1 + .bytes2write dd ? + .address dd ? + .workarea dd ? +end virtual + +app_colours: + +w_frame dd ? +w_grab dd ? +w_grab_button dd ? +w_grab_button_text dd ? +w_grab_text dd ? +w_work dd ? +w_work_button dd ? +w_work_button_text dd ? +w_work_text dd ? +w_work_graph dd ? + +color_table: + times 10 dd ? diff --git a/programs/desktop/trunk/macros.inc b/programs/desktop/trunk/macros.inc new file mode 100644 index 0000000000..1d153e8723 --- /dev/null +++ b/programs/desktop/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 + +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 \ No newline at end of file diff --git a/programs/dhcp/trunk/build_en.bat b/programs/dhcp/trunk/build_en.bat new file mode 100644 index 0000000000..7b05f154f9 --- /dev/null +++ b/programs/dhcp/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm dhcp.asm dhcp +@pause \ No newline at end of file diff --git a/programs/dhcp/trunk/build_ru.bat b/programs/dhcp/trunk/build_ru.bat new file mode 100644 index 0000000000..0109c6c7ef --- /dev/null +++ b/programs/dhcp/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm dhcp.asm dhcp +@pause \ No newline at end of file diff --git a/programs/dhcp/trunk/dhcp.asm b/programs/dhcp/trunk/dhcp.asm new file mode 100644 index 0000000000..a7fae8ed46 --- /dev/null +++ b/programs/dhcp/trunk/dhcp.asm @@ -0,0 +1,595 @@ +; +; DHCP Client +; +; Compile with FASM for Menuet +; + +include 'lang.inc' +include 'macros.inc' + +use32 + + org 0x0 + + db 'MENUET00' ; 8 byte id + dd 38 ; required os + dd START ; program start + dd I_END ; program image size + dd 0x100000 ; required amount of memory + dd 0x00000000 ; reserved=no extended header + + +START: ; start of execution + mov eax,40 ; Report events + mov ebx,10000111b ; Stack 8 + defaults + int 0x40 + + 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: ; Keys are not valid at this part of the + mov eax,2 ; loop. 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 noclose + + ; close socket before exiting + mov eax, 53 + mov ebx, 1 + mov ecx, [socketNum] + int 0x40 + + mov eax,0xffffffff ; close this program + int 0x40 + +noclose: + cmp ah,3 ; Resolve address? + jnz still + + call draw_window + + call contactDHCPServer + + jmp still + + +;*************************************************************************** +; Function +; parseResponse +; +; Description +; extracts the fields ( client IP address and options ) from +; a DHCP response +; The values go into +; dhcpMsgType,dhcpLease,dhcpClientIP,dhcpServerIP, +; dhcpDNSIP, dhcpSubnet +; The message is stored in dhcpMsg +; +;*************************************************************************** +parseResponse: + mov edx, dhcpMsg + + mov eax, [edx+16] + mov [dhcpClientIP], eax + + ; Scan options + + add edx, 240 ; Point to first option + +pr001: + ; Get option id + mov al, [edx] + cmp al, 0xff ; End of options? + je pr_exit + + cmp al, 53 ; Msg type is a single byte option + jne pr002 + + mov al, [edx+2] + mov [dhcpMsgType], al + add edx, 3 + jmp pr001 ; Get next option + +pr002: + ; All other (accepted) options are 4 bytes in length + inc edx + movzx ecx, byte [edx] + inc edx ; point to data + + cmp al, 54 ; server id + jne pr0021 + mov eax, [edx] ; All options are 4 bytes, so get it + mov [dhcpServerIP], eax + jmp pr003 + +pr0021: + cmp al, 51 ; lease + jne pr0022 + mov eax, [edx] ; All options are 4 bytes, so get it + mov [dhcpLease], eax + jmp pr003 + +pr0022: + cmp al, 1 ; subnet mask + jne pr0023 + mov eax, [edx] ; All options are 4 bytes, so get it + mov [dhcpSubnet], eax + jmp pr003 + +pr0023: + cmp al, 6 ; dns ip + jne pr0024 + mov eax, [edx] ; All options are 4 bytes, so get it + mov [dhcpDNSIP], eax + +pr0024: + cmp al, 3 ; gateway ip + jne pr003 + mov eax, [edx] ; All options are 4 bytes, so get it + mov [dhcpGateway], eax + +pr003: + add edx, ecx + jmp pr001 + +pr_exit: + ret + + +;*************************************************************************** +; Function +; buildRequest +; +; Description +; Creates a DHCP request packet. +; +;*************************************************************************** +buildRequest: + ; Clear dhcpMsg to all zeros + xor eax,eax + mov edi,dhcpMsg + mov ecx,512 + cld + rep stosb + + mov edx, dhcpMsg + + mov [edx], byte 0x01 ; Boot request + mov [edx+1], byte 0x01 ; Ethernet + mov [edx+2], byte 0x06 ; Ethernet h/w len + mov [edx+4], dword 0x11223344 ; xid + mov [edx+10], byte 0x80 ; broadcast flag set + mov [edx+236], dword 0x63538263 ; magic number + + ; option DHCP msg type + mov [edx+240], word 0x0135 + mov al, [dhcpMsgType] + mov [edx+240+2], al + + ; option Lease time = infinity + mov [edx+240+3], word 0x0433 + mov eax, [dhcpLease] + mov [edx+240+5], eax + + ; option requested IP address + mov [edx+240+9], word 0x0432 + mov eax, [dhcpClientIP] + mov [edx+240+11], eax + + ; option request list + mov [edx+240+15], word 0x0437 + mov [edx+240+17], dword 0x0f060301 + + ; Check which msg we are sending + cmp [dhcpMsgType], byte 0x01 + jne br001 + + ; "Discover" options + ; end of options marker + mov [edx+240+21], byte 0xff + + mov [dhcpMsgLen], dword 262 + jmp br_exit + +br001: + ; "Request" options + + ; server IP + mov [edx+240+21], word 0x0436 + mov eax, [dhcpServerIP] + mov [edx+240+23], eax + + ; end of options marker + mov [edx+240+27], byte 0xff + + mov [dhcpMsgLen], dword 268 + +br_exit: + ret + + + +;*************************************************************************** +; Function +; contactDHCPServer +; +; Description +; negotiates settings with a DHCP server +; +;*************************************************************************** +contactDHCPServer: + ; First, open socket + mov eax, 53 + mov ebx, 0 + mov ecx, 68 ; local port dhcp client + mov edx, 67 ; remote port - dhcp server + mov esi, 0xffffffff ; broadcast + int 0x40 + + mov [socketNum], eax + + ; Setup the first msg we will send + mov [dhcpMsgType], byte 0x01 ; DHCP discover + mov [dhcpLease], dword 0xffffffff + mov [dhcpClientIP], dword 0 + mov [dhcpServerIP], dword 0 + + call buildRequest + +ctr000: + ; write to socket ( send broadcast request ) + mov eax, 53 + mov ebx, 4 + mov ecx, [socketNum] + mov edx, [dhcpMsgLen] + mov esi, dhcpMsg + int 0x40 + + ; Setup the DHCP buffer to receive response + + mov eax, dhcpMsg + mov [dhcpMsgLen], eax ; Used as a pointer to the data + + ; now, we wait for + ; UI redraw + ; UI close + ; or data from remote + +ctr001: + mov eax,10 ; wait here for event + int 0x40 + + cmp eax,1 ; redraw request ? + je ctr003 + cmp eax,2 ; key in buffer ? + je ctr004 + cmp eax,3 ; button in buffer ? + je ctr005 + + + ; Any data in the UDP receive buffer? + mov eax, 53 + mov ebx, 2 + mov ecx, [socketNum] + int 0x40 + + cmp eax, 0 + je ctr001 + + ; we have data - this will be the response +ctr002: + mov eax, 53 + mov ebx, 3 + mov ecx, [socketNum] + int 0x40 ; read byte - block (high byte) + + ; Store the data in the response buffer + mov eax, [dhcpMsgLen] + mov [eax], bl + inc dword [dhcpMsgLen] + + mov eax, 53 + mov ebx, 2 + mov ecx, [socketNum] + int 0x40 ; any more data? + + cmp eax, 0 + jne ctr002 ; yes, so get it + + ; depending on which msg we sent, handle the response + ; accordingly. + ; If the response is to a dhcp discover, then: + ; 1) If response is DHCP OFFER then + ; 1.1) record server IP, lease time & IP address. + ; 1.2) send a request packet + ; 2) else exit ( display error ) + ; If the response is to a dhcp request, then: + ; 1) If the response is DHCP ACK then + ; 1.1) extract the DNS & subnet fields. Set them in the stack + ; 2) else exit ( display error ) + + + cmp [dhcpMsgType], byte 0x01 ; did we send a discover? + je ctr007 + cmp [dhcpMsgType], byte 0x03 ; did we send a request? + je ctr008 + + ; should never get here - we only send discover or request + jmp ctr006 + +ctr007: + call parseResponse + + ; Was the response an offer? It should be + cmp [dhcpMsgType], byte 0x02 + jne ctr006 ; NO - so quit + + ; send request + mov [dhcpMsgType], byte 0x03 ; DHCP request + call buildRequest + jmp ctr000 + +ctr008: + call parseResponse + + ; Was the response an ACK? It should be + cmp [dhcpMsgType], byte 0x05 + jne ctr006 ; NO - so quit + + ; Set or display addresses here... + +ctr006: + ; close socket + mov eax, 53 + mov ebx, 1 + mov ecx, [socketNum] + int 0x40 + + mov [socketNum], dword 0xFFFF + + call draw_window + + jmp ctr001 + +ctr003: ; redraw + call draw_window + jmp ctr001 + +ctr004: ; key + mov eax,2 ; just read it and ignore + int 0x40 + jmp ctr001 + +ctr005: ; button + mov eax,17 ; get id + int 0x40 + + ; close socket + mov eax, 53 + mov ebx, 1 + mov ecx, [socketNum] + int 0x40 + + mov [socketNum], dword 0xFFFF + + call draw_window ; at first, draw the window + + ret + + + + +; ********************************************* +; ******* WINDOW DEFINITIONS AND DRAW ******** +; ********************************************* + + +; Pass in the IP address in edi +; row to display in [ya] +drawIP: +; mov edi,hostIP + mov ecx, edi + add ecx, 4 + mov edx,[ya] + add edx, 97*65536 + mov esi,0x00ffffff + mov ebx,3*65536 + +ipdisplay: + mov eax,47 + push ecx + movzx ecx,byte [edi] + int 0x40 + pop ecx + add edx,6*4*65536 + inc edi + cmp edi,ecx + jb ipdisplay + ret + + +drawDHMS: + + mov eax,[edi] + bswap eax + + mov esi,dhms + mov ecx,16 + mov edi,text+40*4+12 + cmp eax,0xffffffff + jne nforever + mov esi,forever + cld + rep movsb + ret + nforever: + cld + rep movsb + + mov ecx,28 + xor edx,edx + mov ebx,60 + div ebx + call displayDHMS + xor edx,edx + div ebx + call displayDHMS + xor edx,edx + mov ebx,24 + div ebx + call displayDHMS + mov edx,eax + call displayDHMS + + ret + + +displayDHMS: + + pusha + mov eax,47 + mov ebx,3*65536 + mov edx,ecx + imul edx,6 + shl edx,16 + add edx,1*65536+99 + mov ecx,[esp+20] + mov esi,0xffffff + int 0x40 + popa + sub ecx,4 + ret + + +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+156 ; [y start] *65536 + [y size] + mov edx,0x03224466 ; color of work area RRGGBB + mov esi,0x00334455 ; color of grab bar RRGGBB,8->color gl + mov edi,0x00ddeeff ; 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,labelt ; pointer to text beginning + mov esi,labellen-labelt ; text length + int 0x40 + + mov eax,8 ; Resolve + mov ebx,20*65536+90 + mov ecx,127*65536+15 + mov edx,3 + mov esi,0x557799 + int 0x40 + + ; Pass in the IP address in edi + ; row to display in [ya] + mov edi, dhcpClientIP + mov eax, 35 + mov [ya], eax + call drawIP + mov edi, dhcpGateway + mov eax, 35 + 16 + mov [ya], eax + call drawIP + mov edi, dhcpSubnet + mov eax, 35 + 32 + mov [ya], eax + call drawIP + mov edi, dhcpDNSIP + mov eax, 35 + 48 + mov [ya], eax + call drawIP + mov edi, dhcpLease + call drawDHMS + + ; Re-draw the screen text + cld + mov ebx,25*65536+35 ; draw info text with function 4 + mov ecx,0xffffff + mov edx,text + mov esi,40 + +newline: + mov eax,4 + int 0x40 + add ebx,16 + 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 + +ya dd 0x0 + +text: + db 'Client IP : . . . ' + db 'Gateway IP: . . . ' + db 'Subnet : . . . ' + db 'DNS IP : . . . ' + db 'Lease Time: d h m s ' + db ' ' + db ' SEND REQUEST ' + db 'x <- END MARKER, DONT DELETE ' + + +dhms db ' d h m s' +forever db 'Forever ' + +labelt: db 'DHCP Client Test' +labellen: + +dhcpMsgType: db 0 +dhcpLease: dd 0 +dhcpClientIP: dd 0 +dhcpServerIP: dd 0 +dhcpDNSIP: dd 0 +dhcpSubnet: dd 0 +dhcpGateway: dd 0 + +dhcpMsgLen: dd 0 +socketNum: dd 0xFFFF +dhcpMsg: +I_END: + + + + diff --git a/programs/dhcp/trunk/macros.inc b/programs/dhcp/trunk/macros.inc new file mode 100644 index 0000000000..1d153e8723 --- /dev/null +++ b/programs/dhcp/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 + +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 \ No newline at end of file diff --git a/programs/dnsr/trunk/build_en.bat b/programs/dnsr/trunk/build_en.bat new file mode 100644 index 0000000000..9ef599ab0c --- /dev/null +++ b/programs/dnsr/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm dnsr.asm dnsr +@pause \ No newline at end of file diff --git a/programs/dnsr/trunk/build_ru.bat b/programs/dnsr/trunk/build_ru.bat new file mode 100644 index 0000000000..1e44ec469a --- /dev/null +++ b/programs/dnsr/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm dnsr.asm dnsr +@pause \ No newline at end of file diff --git a/programs/dnsr/trunk/dnsr.asm b/programs/dnsr/trunk/dnsr.asm new file mode 100644 index 0000000000..e3194e016c --- /dev/null +++ b/programs/dnsr/trunk/dnsr.asm @@ -0,0 +1,780 @@ +; +; DNS Domain name -> IP lookup +; +; Compile with FASM for Menuet +; + + +; If you like, you camd change the DNS server default by changing the +; IP address in the dnsServer string. + + +; Enabling debugging puts the received response to the +; debug board +DEBUGGING_ENABLED equ 1 +DEBUGGING_DISABLED equ 0 +DEBUGGING_STATE equ DEBUGGING_DISABLED + + +use32 + + org 0x0 + + db 'MENUET00' ; 8 byte id + dd 38 ; required os + dd START ; program start + dd I_END ; program image size + dd 0x100000 ; required amount of memory + dd 0x00000000 ; reserved=no extended header + +include 'lang.inc' +include 'macros.inc' + +START: ; start of execution + mov eax,40 ; Report events + mov ebx,10000111b ; Stack 8 + defaults + int 0x40 + + mov dword [prompt], p1 + mov dword [promptlen], p1len - p1 ; 'waiting for command' + + 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: ; Keys are not valid at this part of the + mov eax,2 ; loop. 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 noclose + + ; close socket before exiting + mov eax, 53 + mov ebx, 1 + mov ecx, [socketNum] + int 0x40 + + mov eax,0xffffffff ; close this program + int 0x40 + +noclose: + cmp ah,3 ; Resolve address? + jnz noresolve + + mov dword [prompt], p5 + mov dword [promptlen], p5len - p5 ; display 'Resolving' + call draw_window + + call translateData ; Convert domain & DNS IP address + + call resolveDomain + + jmp still + + +noresolve: + cmp ah,4 + jz f1 ; Enter domain name + cmp ah,5 + jz f2 ; enter DNS Server IP + jmp still + + +f1: + mov [addr],dword query + mov [ya],dword 35 + jmp rk + +f2: + mov [addr],dword dnsServer + mov [ya],dword 35+16 + +rk: + mov ecx,26 + mov edi,[addr] + mov al,' ' + rep stosb + + call print_text + + mov edi,[addr] + +f11: + mov eax,10 + int 0x40 + cmp eax,2 + jz fbu + jmp still + +fbu: + mov eax,2 + int 0x40 ; get key + shr eax,8 + cmp eax,8 + jnz nobs + cmp edi,[addr] + jz f11 + sub edi,1 + mov [edi],byte ' ' + call print_text + jmp f11 + +nobs: + cmp eax,dword 31 + jbe f11 + cmp eax,dword 95 + jb keyok + sub eax,32 + +keyok: + mov [edi],al + + call print_text + + add edi,1 + mov esi,[addr] + add esi,26 + cmp esi,edi + jnz f11 + + jmp still + + + +print_text: + mov eax,13 + mov ebx,103*65536+26*6 + mov ecx,[ya] + shl ecx,16 + mov cx,8 + mov edx,0x224466 + int 0x40 + + mov eax,4 + mov ebx,103*65536 + add ebx,[ya] + mov ecx,0xffffff + mov edx,[addr] + mov esi,26 + int 0x40 + + ret + + + +;*************************************************************************** +; Function +; translateData +; +; Description +; Coverts the domain name and DNS IP address typed in by the user into +; a format suitable for the IP layer. +; +; The ename, in query, is converted and stored in dnsMsg +; The DNS ip, in dnsServer, is converted and stored in dnsIP +; +;*************************************************************************** +translateData: + + ; first, get the IP address of the DNS server + ; Then, build up the request string. + + xor eax, eax + mov dh, 10 + mov dl, al + mov [dnsIP], eax + + mov esi, dnsServer + mov edi, dnsIP + + mov ecx, 4 + +td003: + lodsb + sub al, '0' + add dl, al + lodsb + cmp al, '.' + je ipNext + cmp al, ' ' + je ipNext + mov dh, al + sub dh, '0' + mov al, 10 + mul dl + add al, dh + mov dl, al + lodsb + cmp al, '.' + je ipNext + cmp al, ' ' + je ipNext + mov dh, al + sub dh, '0' + mov al, 10 + mul dl + add al, dh + mov dl, al + lodsb + +ipNext: + mov [edi], dl + inc edi + mov dl, 0 + loop td003 + + ; Build the request string + + + mov eax, 0x00010100 + mov [dnsMsg], eax + mov eax, 0x00000100 + mov [dnsMsg+4], eax + mov eax, 0x00000000 + mov [dnsMsg+8], eax + + ; domain name goes in at dnsMsg+12 + mov esi, dnsMsg + 12 ; location of label length + mov edi, dnsMsg + 13 ; label start + mov edx, query + mov ecx, 12 ; total string length so far + +td002: + mov [esi], byte 0 + inc ecx + +td0021: + mov al, [edx] + cmp al, ' ' + je td001 ; we have finished the string translation + cmp al, '.' ; we have finished the label + je td004 + + inc byte [esi] + inc ecx + mov [edi], al + inc edi + inc edx + jmp td0021 + +td004: + mov esi, edi + inc edi + inc edx + jmp td002 + + + + ; write label len + label text + +td001: + mov [edi], byte 0 + inc ecx + inc edi + mov [edi], dword 0x01000100 + add ecx, 4 + + mov [dnsMsgLen], ecx + + ret + + + + + +;*************************************************************************** +; Function +; resolveDomain +; +; Description +; Sends a question to the dns server +; works out the IP address from the response from the DNS server +; +;*************************************************************************** +resolveDomain: + ; Get a free port number + mov ecx, 1000 ; local port starting at 1000 +getlp: + inc ecx + push ecx + mov eax, 53 + mov ebx, 9 + int 0x40 + pop ecx + cmp eax, 0 ; is this local port in use? + jz getlp ; yes - so try next + + ; First, open socket + mov eax, 53 + mov ebx, 0 + mov edx, 53 ; remote port - dns + mov esi, [dnsIP] + int 0x40 + + mov [socketNum], eax + + ; write to socket ( request DNS lookup ) + mov eax, 53 + mov ebx, 4 + mov ecx, [socketNum] + mov edx, [dnsMsgLen] + mov esi, dnsMsg + int 0x40 + + ; Setup the DNS response buffer + + mov eax, dnsMsg + mov [dnsMsgLen], eax + + ; now, we wait for + ; UI redraw + ; UI close + ; or data from remote + +ctr001: + mov eax,10 ; wait here for event + int 0x40 + + cmp eax,1 ; redraw request ? + je ctr003 + cmp eax,2 ; key in buffer ? + je ctr004 + cmp eax,3 ; button in buffer ? + je ctr005 + + + ; Any data in the UDP receive buffer? + mov eax, 53 + mov ebx, 2 + mov ecx, [socketNum] + int 0x40 + + cmp eax, 0 + je ctr001 + + ; we have data - this will be the response +ctr002: + mov eax, 53 + mov ebx, 3 + mov ecx, [socketNum] + int 0x40 ; read byte - block (high byte) + + ; Store the data in the response buffer + mov eax, [dnsMsgLen] + mov [eax], bl + inc dword [dnsMsgLen] + + +if DEBUGGING_STATE = DEBUGGING_ENABLED + call debug_print_rx_ip +end if + + mov eax, 53 + mov ebx, 2 + mov ecx, [socketNum] + int 0x40 ; any more data? + + cmp eax, 0 + jne ctr002 ; yes, so get it + + ; close socket + mov eax, 53 + mov ebx, 1 + mov ecx, [socketNum] + int 0x40 + + mov [socketNum], dword 0xFFFF + + ; Now parse the message to get the host IP + ; Man, this is complicated. It's described in + ; RFC 1035 + + ; 1) Validate that we have an answer with > 0 responses + ; 2) Find the answer record with TYPE 0001 ( host IP ) + ; 3) Finally, copy the IP address to the display + ; Note: The response is in dnsMsg + ; The end of the buffer is pointed to by [dnsMsgLen] + + ; Clear the IP address text + mov [hostIP], dword 0 + + mov esi, dnsMsg + + ; Is this a response to my question? + mov al, [esi+2] + and al, 0x80 + cmp al, 0x80 + jne ctr002a + + ; Were there any errors? + mov al, [esi+3] + and al, 0x0F + cmp al, 0x00 + jne ctr002a + + ; Is there ( at least 1 ) answer? + mov ax, [esi+6] + cmp ax, 0x00 + je ctr002a + + ; Header validated. Scan through and get my answer + + add esi, 12 ; Skip to the question field + + ; Skip through the question field + call skipName + add esi, 4 ; skip past the questions qtype, qclass + +ctr002z: + ; Now at the answer. There may be several answers, + ; find the right one ( TYPE = 0x0001 ) + call skipName + mov ax, [esi] + cmp ax, 0x0100 ; Is this the IP address answer? + jne ctr002c + + ; Yes! Point esi to the first byte of the IP address + add esi, 10 + + mov eax, [esi] + mov [hostIP], eax + jmp ctr002a ; And exit... + + +ctr002c: ; Skip through the answer, move to the next + add esi, 8 + movzx eax, byte [esi+1] + mov ah, [esi] + add esi, eax + add esi, 2 + + ; Have we reached the end of the msg? + ; This is an error condition, should not happen + cmp esi, [dnsMsgLen] + jl ctr002z ; Check next answer + jmp ctr002a ; abort + + +ctr002a: + mov dword [prompt], p4 ; Display IP address + mov dword [promptlen], p4len - p4 + call draw_window + + jmp ctr001 + +ctr003: ; redraw + call draw_window + jmp ctr001 + +ctr004: ; key + mov eax,2 ; just read it and ignore + int 0x40 + jmp ctr001 + +ctr005: ; button + mov eax,17 ; get id + int 0x40 + + ; close socket + mov eax, 53 + mov ebx, 1 + mov ecx, [socketNum] + int 0x40 + + mov [socketNum], dword 0xFFFF + mov [hostIP], dword 0 + + mov dword [prompt], p1 + mov dword [promptlen], p1len - p1 ; 'waiting for command' + + call draw_window ; at first, draw the window + + ret + + + +;*************************************************************************** +; Function +; skipName +; +; Description +; Increment esi to the first byte past the name field +; Names may use compressed labels. Normally do. +; RFC 1035 page 30 gives details +; +;*************************************************************************** +skipName: + mov al, [esi] + cmp al, 0 + je sn_exit + and al, 0xc0 + cmp al, 0xc0 + je sn001 + + movzx eax, byte [esi] + inc eax + add esi, eax + jmp skipName + +sn001: + add esi, 2 ; A pointer is always at the end + ret + +sn_exit: + inc esi + ret + + +; ********************************************* +; ******* 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+140 ; [y start] *65536 + [y size] + mov edx,0x03224466 ; color of work area RRGGBB + mov esi,0x00334455 ; color of grab bar RRGGBB,8->color gl + mov edi,0x00ddeeff ; 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,labelt ; pointer to text beginning + mov esi,labellen-labelt ; text length + int 0x40 + + mov eax,8 ; Resolve + mov ebx,20*65536+190 + mov ecx,79*65536+15 + mov edx,3 + mov esi,0x557799 + int 0x40 + + mov eax,8 + mov ebx,270*65536+10 + mov ecx,34*65536+10 + mov edx,4 + mov esi,0x557799 + int 0x40 + + mov eax,8 + mov ebx,270*65536+10 + mov ecx,50*65536+10 + mov edx,5 + mov esi,0x557799 + int 0x40 + + ; Copy the file name to the screen buffer + ; file name is same length as IP address, to + ; make the math easier later. + cld + mov esi,query + mov edi,text+13 + mov ecx,26 + rep movsb + + + ; copy the IP address to the screen buffer + mov esi,dnsServer + mov edi,text+40+13 + mov ecx,26 + rep movsb + + ; copy the prompt to the screen buffer + mov esi,[prompt] + mov edi,text+200 + mov ecx,[promptlen] + rep movsb + + ; Re-draw the screen text + cld + mov ebx,25*65536+35 ; draw info text with function 4 + mov ecx,0xffffff + mov edx,text + mov esi,40 + +newline: + mov eax,4 + int 0x40 + add ebx,16 + add edx,40 + cmp [edx],byte 'x' + jnz newline + + + ; Write the host IP, if we have one + mov eax, [hostIP] + cmp eax, 0 + je dw001 + + ; We have an IP address... display it + mov edi,hostIP + mov edx,97*65536+115 + mov esi,0x00ffffff + mov ebx,3*65536 + +ipdisplay: + mov eax,47 + movzx ecx,byte [edi] + int 0x40 + add edx,6*4*65536 + inc edi + cmp edi,hostIP+4 + jb ipdisplay + +dw001: + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + + ret + + +if DEBUGGING_STATE = DEBUGGING_ENABLED +;**************************************************************************** +; Function +; debug_print_string +; +; Description +; prints a string to the debug board +; +; esi holds ptr to msg to display +; +; Nothing preserved; I'm assuming a pusha/popa is done before calling +; +;**************************************************************************** +debug_print_string: + mov cl, [esi] + cmp cl, 0 + jnz dps_001 + ret + +dps_001: + mov eax,63 + mov ebx, 1 + push esi + int 0x40 + + inc word [ind] + mov ax, [ind] + and ax, 0x1f + cmp ax, 0 + jne ds1 + + mov cl, 13 + mov eax,63 + mov ebx, 1 + int 0x40 + mov cl, 10 + mov eax,63 + mov ebx, 1 + int 0x40 + + +ds1: + pop esi + inc esi + jmp debug_print_string + + +ind: dw 0 +; This is used for translating hex to ASCII for display or output +hexchars db '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' +IP_STR db 'xx',0 + + +debug_print_rx_ip: + pusha + mov edi, IP_STR + + xor eax, eax + mov al, bl + shr al, 4 + mov ah, [eax + hexchars] + mov [edi], ah + inc edi + + xor eax, eax + mov al, bl + and al, 0x0f + mov ah, [eax + hexchars] + mov [edi], ah + mov esi, IP_STR + + call debug_print_string + popa + ret +end if + + +; DATA AREA + +addr dd 0x0 +ya dd 0x0 + +text: + db 'Host name : xxxxxxxxxxxxxxx ' + db 'DNS server : xxx.xxx.xxx.xxx ' + db ' ' + db ' RESOLVE ADDRESS ' + db ' ' + db ' ' + db 'x <- END MARKER, DONT DELETE ' + + +labelt: + db 'DNS Client' +labellen: + + +prompt: dd 0 +promptlen: dd 0 + + +p1: db 'Waiting for Command ' +p1len: + +p4: db 'IP Address: . . . ' +p4len: + +p5: db 'Resolving... ' +p5len: + + +dnsServer db '194.145.128.1 ' ; iolfree.ie DNS +query db 'WWW.MENUETOS.ORG ' + +hostIP: dd 0 +dnsIP: dd 0 +dnsMsgLen: dd 0 +socketNum: dd 0xFFFF +dnsMsg: +I_END: diff --git a/programs/dnsr/trunk/macros.inc b/programs/dnsr/trunk/macros.inc new file mode 100644 index 0000000000..1d153e8723 --- /dev/null +++ b/programs/dnsr/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 + +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 \ No newline at end of file diff --git a/programs/end/trunk/build_en.bat b/programs/end/trunk/build_en.bat new file mode 100644 index 0000000000..a770f894cb --- /dev/null +++ b/programs/end/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm end.asm end +@pause \ No newline at end of file diff --git a/programs/end/trunk/build_ru.bat b/programs/end/trunk/build_ru.bat new file mode 100644 index 0000000000..717b041543 --- /dev/null +++ b/programs/end/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm end.asm end +@pause \ No newline at end of file diff --git a/programs/end/trunk/end.asm b/programs/end/trunk/end.asm new file mode 100644 index 0000000000..a230998439 --- /dev/null +++ b/programs/end/trunk/end.asm @@ -0,0 +1,224 @@ +; +; END +; + +include "lang.inc" +include "macros.inc" + +meos_app_start +code + + mov eax,40 + mov ebx,0111b + int 0x40 + + call draw_window + +still: + + mov eax,10 ; wait here for event +; mov ebx,100 + 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: + mcall 2 + cmp ah,13 + jz restart + cmp ah,27 + jz close_1 + cmp ah,180 + jz restart_kernel + cmp ah,181 + jz power_off + jmp red + + button: + mov eax,17 + int 0x40 + + cmp ah,1 + jne no_1 + power_off: + mcall 18,9,2 + jmp close_1 + +no_1: + cmp ah,3 + jne no_2 + restart: + mcall 18,9,3 + jmp close_1 + +no_2: + cmp ah,2 + jne no_4 + + restart_kernel: + mcall 18,9,4 + +no_4: + cmp ah,4 + jne still + + close_1: + or eax,-1 ; close this program + int 0x40 + + +draw_window: + + pusha + + mov eax,48 + mov ebx,3 + mov ecx,sc + mov edx,sizeof.system_colors + int 0x40 + + mov eax,12 ; tell os about redraw start + mov ebx,1 + int 0x40 + + mov eax,14 ; get screen max x & max y + int 0x40 + + xor ecx,ecx + mov cx,ax + + shr eax,17 + sub eax,110 + shl eax,16 + mov ebx,eax + add ebx,220 + + shr ecx,1 + sub ecx,50 + shl ecx,16 + add ecx,100 + + mov eax,0 ; define and draw window + mov edx,[sc.work_button] + mov esi,edx ;[sc.work_button] + xor edi,edi + int 0x40 + + xor edx,edx + mcall 13,14 shl 16+90,25 shl 16+27 + mcall 13,117 shl 16+90, + mcall 13,14 shl 16+90,59 shl 16+27 + mcall 13,117 shl 16+90, + + mcall 8,15 shl 16+87,26 shl 16+24,1,0xdd7700 + inc dl + mcall 8,118 shl 16+87,,,0xbbbb ;cccc + inc dl + mcall 8,15 shl 16+87,60 shl 16+24,,0xbb00 + inc dl + mcall 8,118 shl 16+87,,,0xbbbbbb ;cccccc + + mov eax,4 ; 0x00000004 = write text + mov ebx,75*65536+10 + mov ecx,[sc.work_button_text] ; 8b window nro - RR GG BB color + or ecx,0x10000000 + mov edx,label1 ; pointer to text beginning + mov esi,label1_len ; text length + int 0x40 + + mov ecx,0x10ffffff + mov ebx,25*65536+30 + mov edx,label2 ; pointer to text beginning + mov esi,label2_len ; text length + int 0x40 + + mov ebx,20*65536+64 + mov edx,label3 ; pointer to text beginning + mov esi,label3_len ; text length + int 0x40 + + mov ecx,0xffffff + mov ebx,45*65536+41 + mov edx,label4 ; pointer to text beginning + mov esi,label4_len ; text length + int 0x40 + + mov ebx,40*65536+75 + mov edx,label5 ; pointer to text beginning + mov esi,label5_len ; text length + int 0x40 + + mov eax,12 ; tell os about redraw end + mov ebx,2 + int 0x40 + + popa + + ret + + + +data + +if lang eq ru + + label1: + db 'ВАШ ВЫБОР:' + label1_len = $ - label1 + + label2: + db 'ВЫКЛЮЧИТЬ ЯДРО' + label2_len = $ - label2 + + label3: + db 'ПЕРЕЗАПУСК ОТМЕНА' + label3_len = $ - label3 + + label4: + db '(End) (Home)' + label4_len = $ - label4 + + label5: + db '(Enter) (Esc)' + label5_len = $ - label5 + +else + + label1: + db ' SELECT:' + label1_len = $ - label1 + + label2: + db 'POWER OFF KERNEL' + label2_len = $ - label2 + + label3: + db ' RESTART CANCEL' + label3_len = $ - label3 + + label4: + db '(End) (Home)' + label4_len = $ - label4 + + label5: + db '(Enter) (Esc)' + label5_len = $ - label5 + +end if + + +udata + sc system_colors + +meos_app_end diff --git a/programs/end/trunk/macros.inc b/programs/end/trunk/macros.inc new file mode 100644 index 0000000000..d599dea0e0 --- /dev/null +++ b/programs/end/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 + +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 \ No newline at end of file diff --git a/programs/ethstat/trunk/build_en.bat b/programs/ethstat/trunk/build_en.bat new file mode 100644 index 0000000000..96434f6965 --- /dev/null +++ b/programs/ethstat/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm ethstat.asm ethstat +@pause \ No newline at end of file diff --git a/programs/ethstat/trunk/build_ru.bat b/programs/ethstat/trunk/build_ru.bat new file mode 100644 index 0000000000..0a2265d46d --- /dev/null +++ b/programs/ethstat/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm ethstat.asm ethstat +@pause \ No newline at end of file diff --git a/programs/ethstat/trunk/ethstat.asm b/programs/ethstat/trunk/ethstat.asm new file mode 100644 index 0000000000..718043c377 --- /dev/null +++ b/programs/ethstat/trunk/ethstat.asm @@ -0,0 +1,228 @@ +; +; Stack Status Monitor +; +; 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 0x100000 ; required amount of memory + dd 0x00000000 ; reserved=no extended header + +include 'lang.inc' +include 'macros.inc' + +START: ; start of execution + call draw_window ; at first, draw the window + +still: + mov eax,23 ; wait here for event + mov ebx,200 ; Time out after 2s + 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 + + ; read the stack status data, and write it to the screen buffer + + mov eax, 53 + mov ebx, 255 + mov ecx, 6 + int 0x40 + + mov ebx, text + 24 + call printhex + + mov eax, 53 + mov ebx, 255 + mov ecx, 2 + int 0x40 + + mov ebx, text + 107 + call printhex + + mov eax, 53 + mov ebx, 255 + mov ecx, 5 + int 0x40 + + mov ebx, text + 107 + 40 + call printhex + + mov eax, 53 + mov ebx, 255 + mov ecx, 4 + int 0x40 + + mov ebx, text + 107 + 80 + call printhex + + mov eax, 53 + mov ebx, 255 + mov ecx, 100 + int 0x40 + + mov ebx, text + 258 + call printhex + + mov eax, 53 + mov ebx, 255 + mov ecx, 101 + int 0x40 + + mov ebx, text + 258 + 40 + call printhex + + mov eax, 53 + mov ebx, 255 + mov ecx, 102 + int 0x40 + + mov ebx, text + 258 + 80 + call printhex + + mov eax, 53 + mov ebx, 255 + mov ecx, 103 + int 0x40 + + mov ebx, text + 258 + 120 + call printhex + +red: ; redraw + call draw_window + jmp still + +key: ; Keys are not valid at this part of the + mov eax,2 ; loop. 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,0xffffffff ; close this program + int 0x40 + + 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+260 ; [x start] *65536 + [x size] + mov ecx,100*65536+205 ; [y start] *65536 + [y size] + mov edx,0x03224466 ; color of work area RRGGBB + mov esi,0x00334455 ; color of grab bar RRGGBB,8->color gl + mov edi,0x00ddeeff ; 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,labelt ; pointer to text beginning + mov esi,labellen-labelt ; text length + int 0x40 + + ; Re-draw the screen text + cld + mov ebx,25*65536+35 ; draw info text with function 4 + mov ecx,0xffffff + mov edx,text + mov esi,40 + newline: + mov eax,4 + int 0x40 + add ebx,16 + 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 + +; Taken from PS.ASM +printhex: +; number in eax +; print to ebx +; xlat from hextable + pusha + mov esi, ebx + add esi, 8 + mov ebx, hextable + mov ecx, 8 +phex_loop: + mov edx, eax + and eax, 15 + xlatb + mov [esi], al + mov eax, edx + shr eax, 4 + dec esi + loop phex_loop + popa + ret + + +; DATA AREA + +text: + db ' Ethernet card status : xxxxxxxx ' + db ' ' + db ' IP packets received : xxxxxxxx ' + db ' ARP packets received : xxxxxxxx ' + db ' Dumped received packets : xxxxxxxx ' + db ' ' + db ' EMPTY QUEUE : xxxxxxxx ' + db ' IPOUT QUEUE : xxxxxxxx ' + db ' IPIN QUEUE : xxxxxxxx ' + db ' NET1OUT QUEUE : xxxxxxxx ' + db 'x <- END MARKER, DONT DELETE ' + + +labelt: + db 'Stack Status' +labellen: + +hextable db '0123456789ABCDEF' + + +I_END: + + + + + + + \ No newline at end of file diff --git a/programs/ethstat/trunk/macros.inc b/programs/ethstat/trunk/macros.inc new file mode 100644 index 0000000000..d599dea0e0 --- /dev/null +++ b/programs/ethstat/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 + +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 \ No newline at end of file diff --git a/programs/example/trunk/build_en.bat b/programs/example/trunk/build_en.bat new file mode 100644 index 0000000000..6fe98597af --- /dev/null +++ b/programs/example/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm example.asm example +@pause \ No newline at end of file diff --git a/programs/example/trunk/build_ru.bat b/programs/example/trunk/build_ru.bat new file mode 100644 index 0000000000..596582067e --- /dev/null +++ b/programs/example/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm example.asm example +@pause \ No newline at end of file diff --git a/programs/example/trunk/example.asm b/programs/example/trunk/example.asm new file mode 100644 index 0000000000..42f26a493f --- /dev/null +++ b/programs/example/trunk/example.asm @@ -0,0 +1,177 @@ +; +; Пример программы для MenuetOS +; озвучивает код нажатой клавиши ;) +; +; Компилировать FASM'ом +; +; См. также: +; template.asm - пример простейшей программы (новый!) +; rb.asm - контекстное меню рабочего стола +; example2.asm - пример меню и дополнительных окон +; example3.asm - пример меню, реализованного по-другому +;--------------------------------------------------------------------- + + use32 ; включить 32-битный режим ассемблера + org 0x0 ; адресация с нуля + + db 'MENUET01' ; 8-байтный идентификатор MenuetOS + dd 0x01 ; версия заголовка (всегда 1) + dd START ; адрес первой команды + dd I_END ; размер программы + dd 0x1000 ; количество памяти + dd 0x1000 ; адрес вершины стэка + dd 0x0 ; адрес буфера для параметров (не используется) + dd 0x0 ; зарезервировано + +include 'lang.inc' +include 'macros.inc' ; макросы облегчают жизнь ассемблерщиков! + +;--------------------------------------------------------------------- +;--- НАЧАЛО ПРОГРАММЫ ---------------------------------------------- +;--------------------------------------------------------------------- + +START: + +red: ; перерисовать окно + + call draw_window ; вызываем процедуру отрисовки окна + +;--------------------------------------------------------------------- +;--- ЦИКЛ ОБРАБОТКИ СОБЫТИЙ ---------------------------------------- +;--------------------------------------------------------------------- + +still: + mcall 10 ; функция 10 - ждать события + + cmp eax,1 ; перерисовать окно ? + je red ; если да - на метку red + cmp eax,2 ; нажата клавиша ? + je key ; если да - на key + cmp eax,3 ; нажата кнопка ? + je button ; если да - на button + + jmp still ; если другое событие - в начало цикла + + +;--------------------------------------------------------------------- + + + key: ; нажата клавиша на клавиатуре + mcall 2 ; функция 2 - считать код символа (в ah) + + mov [Music+1], ah ; записать код символа как код ноты + + ; функция 55-55: системный динамик ("PlayNote") + ; esi - адрес мелодии + + ; mov eax,55 + ; mov ebx,eax + ; mov esi,Music + ; int 0x40 + + ; или коротко: + mcall 55, eax, , , Music + + jmp still ; вернуться к началу цикла + +;--------------------------------------------------------------------- + + button: + mcall 17 ; 17 - получить идентификатор нажатой кнопки + + cmp ah, 1 ; если НЕ нажата кнопка с номером 1, + jne still ; вернуться + + .exit: + mcall -1 ; иначе конец программы + + + +;--------------------------------------------------------------------- +;--- ОПРЕДЕЛЕНИЕ И ОТРИСОВКА ОКНА ---------------------------------- +;--------------------------------------------------------------------- + +draw_window: + + mcall 12, 1 ; функция 12: сообщить ОС об отрисовке окна + ; 1 - начинаем рисовать + + ; далее: сначала длинный вариант (закомментированный) + ; затем короткий аналог с использованием макросов + + + ; СОЗДАЁМ ОКНО +; mov eax,0 ; функция 0 : определить и отрисовать окно +; mov ebx,200*65536+200 ; [x старт] *65536 + [x размер] +; mov ecx,200*65536+100 ; [y старт] *65536 + [y размер] +; mov edx,0x02aabbcc ; цвет рабочей области RRGGBB,8->color gl +; mov esi,0x805080d0 ; цвет полосы заголовка RRGGBB,8->color gl +; mov edi,0x005080d0 ; цвет рамки RRGGBB +; int 0x40 + + mcall 0, <200,200>, <200,50>, 0x02AABBCC, 0x805080D0, 0x005080D0 + + ; ЗАГОЛОВОК ОКНА +; mov eax,4 ; функция 4 : написать в окне текст +; mov ebx,8*65536+8 ; [x] *65536 + [y] +; mov ecx,0x10ddeeff ; шрифт 1 и цвет ( 0xF0RRGGBB ) +; mov edx,header ; адрес строки +; mov esi,header.size ; и её длина +; int 0x40 + + mcall 4, <8,8>, 0x10DDEEFF, header, header.size + +; mov eax,4 +; mov ebx,8 shl 16 + 30 +; mov ecx,0 +; mov edx,message +; mov esi,message.size +; int 0x40 + + mcall 4, <8, 30>, 0, message, message.size + + ; КНОПКА ЗАКРЫТИЯ ОКНА +; mov eax,8 ; функция 8 : определить и нарисовать кнопку +; mov ebx,(200-19)*65536+12 ; [x старт] *65536 + [x размер] +; mov ecx,5*65536+12 ; [y старт] *65536 + [y размер] +; mov edx,1 ; идентификатор кнопки - 1 +; mov esi,0x6688dd ; цвет кнопки RRGGBB +; int 0x40 + + mcall 8, <200-19, 12>, <5, 12>, 1, 0x6688DD + + mcall 12, 2 ; функция 12: сообщить ОС об отрисовке окна + ; 2, закончили рисовать + + ret ; выходим из процедуры + + +;--------------------------------------------------------------------- +;--- ДАННЫЕ ПРОГРАММЫ ---------------------------------------------- +;--------------------------------------------------------------------- + +; Вот такая вот короткая "мелодия". +; Второй байт изменяется нажатием клавишы + +Music: + db 0x90, 0x30, 0 + + +;--------------------------------------------------------------------- + +; интерфейс программы многоязычный +; Вы можете задать язык в MACROS.INC (lang fix язык) + +lsz message,\ + ru,'Нажмите любую клавишу...',\ + en,'Press any key...',\ + fr,'Pressez une touche...' + +lsz header,\ + ru,'ПРИМЕР ПРОГРАММЫ',\ + en,'EXAMPLE APPLICATION',\ + fr,"L'exemplaire programme" + +;--------------------------------------------------------------------- + +I_END: ; метка конца программы diff --git a/programs/example/trunk/macros.inc b/programs/example/trunk/macros.inc new file mode 100644 index 0000000000..d599dea0e0 --- /dev/null +++ b/programs/example/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 + +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 \ No newline at end of file diff --git a/programs/example2/trunk/build_en.bat b/programs/example2/trunk/build_en.bat new file mode 100644 index 0000000000..b73a7642b3 --- /dev/null +++ b/programs/example2/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm example2.asm example2 +@pause \ No newline at end of file diff --git a/programs/example2/trunk/build_ru.bat b/programs/example2/trunk/build_ru.bat new file mode 100644 index 0000000000..e2088aa996 --- /dev/null +++ b/programs/example2/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm example2.asm example2 +@pause \ No newline at end of file diff --git a/programs/example2/trunk/dialogs1.inc b/programs/example2/trunk/dialogs1.inc new file mode 100644 index 0000000000..a6a29624dd --- /dev/null +++ b/programs/example2/trunk/dialogs1.inc @@ -0,0 +1,597 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; ; +; DIALOGS1.INC ; +; ; +; COMPILE WITH FASM for MENUET ; +; ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +menus dd 3 ; number of menus +m_x dd 0x5 ; x start +m_y dd 20 ; y start +m_xs dd 290 ; x size +m_ys dd 14 ; y size +g_stack dd 0xf000 ; thread stack - required + + +menu:; AB C D E F G + + db '*D FILE +Save File +Load File +- +Quit ' + db '*B EDIT +Copy +Paste ' + db '*B HELP +Setup +About.. ' + db '@' ; end mark + +; A : Data type '*' -> New menu , '+' -> menu selection +; B : Number of selections in menu (A+) +; C : Menu header text +; D-G : Menu selection text + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +; DATA BELOW IS FOR DIALOGS1.INC INTERNALS + +menu_action dd '----' + +window_on db 0 + +g_n dd -1 +g_x dd 0x0 +g_t dd 0x0 +g_1 dd 0x0 +g_l dd 0x0 +closet db 0 + +table: times 1024 db 0 + +last_mouse dd 0x0 + +mo_x dd 0x0 +mo_y dd 0x0 + + +check_mouse: + + pusha + + cmp [window_on],1 + je no_open + + mov eax,37 + mov ebx,2 + int 0x40 + + cmp [window_on],0 + jne openw2 + + cmp eax,0 + je no_open + + openw2: + + waitformouse: + + mov eax,23 + mov ebx,2 + int 0x40 + + cmp eax,0 + jne no_open + + mov eax,37 + mov ebx,2 + int 0x40 + + cmp eax,0 + jne waitformouse + + + mov eax,37 + mov ebx,1 + int 0x40 + + mov esi,eax + + shr eax,16 + xor edx,edx + mov ebx,50 + div ebx + mov edx,eax + cmp edx,[g_n] + je no_open + cmp edx,[menus] + jge no_open + mov eax,esi + + and eax,0xffff + + mov ebx,[m_y] + cmp eax,ebx + jbe no_open + add ebx,[m_ys] + cmp eax,ebx + jge no_open + + cmp [window_on],0 + je noww + + mov [closet],1 + mov ecx,100 + waitm: + mov eax,5 + mov ebx,1 + int 0x40 + dec ecx + jz no_open + cmp [window_on],0 + jne waitm + noww: + + mov eax,edx + jmp cll + + no_open: + + mov [last_mouse],esi + + popa + + ret + + cll: + + mov [window_on],2 + + mov [g_n],eax + mov [g_x],96 + mov [g_t],0 + mov [g_1],1 + + mov eax,9 + mov ebx,table + mov ecx,-1 + int 0x40 + + mov eax,[table+34] + mov [mo_x],eax + mov eax,[table+38] + mov [mo_y],eax + + mov eax,51 + mov ebx,1 + mov ecx,alert_entry + mov edx,[g_stack] + int 0x40 + + mov [esp+28],dword 0 ; clear button entry + + mov [menu_action],'MD ' + + check_gr: + + popa + + ret + + +draw_menu: + + mov eax,9 + mov ebx,table + mov ecx,-1 + int 0x40 + + cmp [table+46],dword 30 + jb drmr + + mov eax,13 ; white background + mov ebx,[m_x] + shl ebx,16 + add ebx,[m_xs] + inc ebx + mov ecx,[m_y] + shl ecx,16 + add ecx,[m_ys] + mov edx,0xf0f8ff + int 0x40 + + mov eax,38 ; egde lines + mov ebx,[m_x] + shl ebx,16 + add ebx,[m_x] + add ebx,[m_xs] + mov ecx,[m_y] + shl ecx,16 + add ecx,[m_y] + mov edx,0x000000 + int 0x40 + mov eax,38 + mov ecx,[m_y] + add ecx,[m_ys] + shl ecx,16 + add ecx,[m_y] + add ecx,[m_ys] + int 0x40 + + mov esi,menu-1 + mov edi,[m_x] + mov ebp,1 + new_menu: + inc esi + + cmp [esi],byte '*' + jne drmnl1 + push esi + mov eax,4 + mov ebx,edi + shl ebx,16 + add ebx,[m_y] + add ebx,0x00050004 + mov ecx,0x000000 + mov edx,esi + add edx,3 + mov esi,12 + int 0x40 ; draw text + pop esi + add esi,2 + add edi,50 + inc ebp + + drmnl1: + cmp [esi],byte '@' + jne new_menu + + drmr: + + ret + +alert_box: + + ; eax : x size - min 200 + ; ebx : pointer to ASCIIZ - max 128 character text + ; ecx : button 1 id ( OK or YES ) + ; edx : button 2 id or zero ( NO ) + + + cmp [window_on],0 + jne alert_box_return + + mov [window_on],1 + + cmp eax,100 + jg size_ok + mov eax,100 + size_ok: + + mov [g_x],eax + mov [g_t],ebx + mov [g_1],ecx + + mov ecx,0 + new_search: + cmp [ebx],byte 0 + je found_len + inc ebx + inc ecx + cmp ecx,128 + jbe new_search + found_len: + mov [g_l],ecx + + mov eax,51 + mov ebx,1 + mov ecx,alert_entry + mov edx,[g_stack] + int 0x40 + + mov [menu_action],'MA ' + + alert_box_return: + + ret + +alert_entry: + + call alert_draw_window + +alert_still: + + mov eax,23 ; wait here for event + mov ebx,1 + int 0x40 + + cmp eax,1 ; redraw request ? + je alert_red + cmp eax,2 ; key in buffer ? + je alert_key + cmp eax,3 ; button in buffer ? + je alert_button + + cmp [closet],0 + jne ccc + + mov eax,9 + mov ebx,table + mov ecx,-1 + int 0x40 + + cmp ax,[table+4] + je no_close + ccc: + mov [closet],0 + mov [g_n],-1 + mov [menu_action],'----' + mov [window_on],0 + mov eax,-1 + int 0x40 + no_close: + + jmp alert_still + + alert_red: ; redraw + call alert_draw_window + jmp alert_still + + alert_key: ; key + mov eax,2 ; just read it and ignore + int 0x40 + jmp alert_still + + alert_button: ; button + mov eax,17 ; get id + int 0x40 + + shr eax,8 + cmp eax,3 + jg no_action1 + dec eax + shl eax,2 + mov eax,dword [eax+rtext] + mov [menu_action],eax + jmp action_done + no_action1: + sub eax,16 + add eax,65 + shl eax,8 + mov ebx,[g_n] + add ebx,65 + add eax,ebx + mov [menu_action],eax + + action_done: + + mov [closet],0 + mov [g_n],-1 + mov [window_on],0 + mov eax,-1 ; close this program + int 0x40 + + rtext db 'NO YES OK ' + + jmp alert_still + + +; ********************************************* +; ******* WINDOW DEFINITIONS AND DRAW ******** +; ********************************************* + + +alert_draw_window: + + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,1 ; 1, start of draw + int 0x40 + + cmp [window_on],2 + jne no_win_type_2 + + mov edx,menu-1 + mov ecx,[g_n] + add ecx,1 + find_menu: + inc edx + cmp [edx],byte '*' + je menu_loop + jmp find_menu + menu_loop: + loop find_menu + movzx ebp,byte [edx+1] + sub ebp,64 + push edx + ; DRAW WINDOW + mov eax,0 ; function 0 : define and draw window + mov ebx,[g_n] + imul ebx,50 + add ebx,[mo_x] + add ebx,[m_x] + shl ebx,16 + add ebx,[g_x] + mov ecx,[mo_y] + add ecx,[m_y] + add ecx,[m_ys] + shl ecx,16 + mov edx,14 + imul edx,ebp + add edx,7 + add ecx,edx + mov edx,0x00ffffff ; color of work area RRGGBB,8->color gl + mov esi,0x00ffffff ; color of grab bar RRGGBB,8->color gl + mov edi,0x000000cc ; color of frames RRGGBB + int 0x40 + + pop edx + + mov ebx,5*65536+7 ; draw info text with function 4 + mov ecx,0x10000000 + mov esi,12 + mov ebp,16 + no_d_found: + inc edx + cmp [edx],byte '*' + je d_drawed + cmp [edx],byte '@' + je d_drawed + cmp [edx],byte '+' + jne no_d_found + inc edx + pusha ; draw button + mov eax,8 + mov ecx,ebx + mov ebx,[g_x] + add ebx,0x0000fffe + shl ecx,16 + add ecx,0xfffc0000+14 + mov edx,0x40000000 + add edx,ebp + mov esi,0 + int 0x40 + popa + mov eax,4 ; draw text + int 0x40 + inc ebp + add ebx,14 + jmp no_d_found + d_drawed: + + no_win_type_2: + + + cmp [window_on],1 + jne no_win_1 + + mov eax,14 ; to middle of screen + int 0x40 + mov ecx,eax + and ecx,0xffff + shr ecx,1 + shr eax,1 + mov ebx,[g_x] + shr ebx,1 + shl ebx,16 + sub eax,ebx + mov ebx,eax + + mov eax,0 ; function 0 : define and draw window + mov bx,word [g_x] + sub ecx,80 + shl ecx,16 + mov cx,110 ; [y start] *65536 + [y size] + mov edx,0x02ffffff ; color of work area RRGGBB,8->color gl + mov esi,0x80d05050 ; color of grab bar RRGGBB,8->color gl + mov edi,0x00d05050 ; color of frames RRGGBB + int 0x40 + + + mov eax,4 ; label + mov ebx,8*65536+8 + mov ecx,0x10ddeeff + mov edx,alert_labelt1 + mov esi,alert_label1len-alert_labelt1 + int 0x40 + + mov eax,4 + mov ebx,10*65536+43 + mov ecx,0x10000000 + mov edx,[g_t] + mov esi,[g_l] + int 0x40 + + cmp [g_1],1 + jne gadgets_no_1 + + mov eax,8 + mov ebx,[g_x] + sub ebx,100 + shr ebx,1 + shl ebx,16 + add ebx,30*65536+40 + mov ecx,75*65536+16 + mov edx,3 + mov esi,0x446688 + int 0x40 + + mov eax,4 + mov ebx,[g_x] + sub ebx,100 + shr ebx,1 + shl ebx,16 + add ebx,31*65536+80 + mov ecx,0x10ffffff + mov edx,alert_t2 + mov esi,alert_t2len-alert_t2 + int 0x40 + + gadgets_no_1: + + cmp [g_1],2 + jne gadgets_no_2 + + mov eax,8 + mov ebx,[g_x] + sub ebx,100 + shr ebx,1 + shl ebx,16 + add ebx,0*65536+40 + mov ecx,75*65536+16 + mov edx,1 + mov esi,0x446688 + int 0x40 + + mov eax,8 + mov ebx,[g_x] + sub ebx,100 + shr ebx,1 + shl ebx,16 + add ebx,57*65536+40 + mov ecx,75*65536+16 + mov edx,2 + mov esi,0x446688 + int 0x40 + + mov eax,4 + mov ebx,[g_x] + sub ebx,100 + shr ebx,1 + shl ebx,16 + add ebx,1*65536+80 + mov ecx,0x10ffffff + mov edx,alert_t1 + mov esi,alert_t1len-alert_t1 + int 0x40 + + gadgets_no_2: + + no_win_1: + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + + ret + + +; DATA AREA + + +alert_t1: + db ' No Yes' +alert_t1len: + + +alert_t2: + db ' OK' +alert_t2len: + + +alert_labelt1: + db 'ALERT' +alert_label1len: + + + + + + + + diff --git a/programs/example2/trunk/example2.asm b/programs/example2/trunk/example2.asm new file mode 100644 index 0000000000..3327eb5d10 --- /dev/null +++ b/programs/example2/trunk/example2.asm @@ -0,0 +1,201 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +; MENU / DIALOG EXAMPLE +; +; Compile with FASM for Menuet +; + +use32 + + org 0x0 + + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd I_END ; size of image + dd 0x10000 ; memory for app + dd 0x10000 ; esp + dd 0x0 , 0x0 ; I_Param , I_Icon + +include 'lang.inc' +include 'macros.inc' +include 'dialogs1.inc' + +menu_history dd 0x0 + +START: ; start of execution + + call draw_window_main + +still: ; wait here for event + + mov eax,23 + mov ebx,2 + int 0x40 + + cmp eax,1 ; process events + je red + cmp eax,2 + je key + cmp eax,3 + je button + + call check_mouse ; DIALOG CHECK + + mov eax,[menu_action] + cmp eax,[menu_history] + je nodisplay + + mov [menu_history],eax + + mov eax,13 + mov ebx,220*65536+6*4 + mov ecx,70*65536+8 + mov edx,0xffffff + int 0x40 + + mov eax,4 ; show menu selections + mov ebx,220*65536+70 + mov ecx,0x000000 + mov edx,menu_action + mov esi,4 + int 0x40 + + nodisplay: + + cmp word [menu_action],word 'AD' ; user requests close + jne no_menu_close + mov eax,-1 + int 0x40 + no_menu_close: + + jmp still + + red: ; redraw + call draw_window_main + jmp still + + key: + mov eax,2 ; key in buffer + int 0x40 + jmp still + + button: ; button in buffer + mov eax,17 + int 0x40 + + cmp ah,1 ; close application + jne noclose + mov eax,-1 + int 0x40 + noclose: + + cmp ah,2 + jne no_alert_box ; ALERT BOX + mov eax,170 ; window width + mov ebx,alert_text ; asciiz string + mov ecx,1 ; OK button + call alert_box ; function call + jmp still + no_alert_box: + + cmp ah,3 + jne no_choose_box ; CHOOSE BOX + mov eax,220 ; window width + mov ebx,choose_text ; asciiz string + mov ecx,2 ; YES/NO buttons + call alert_box ; function call + jmp still + no_choose_box: + + + jmp still + + + + +; ********************************************* +; ******* WINDOW DEFINITIONS AND DRAW ******** +; ********************************************* + +draw_window_main: + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,1 ; 1, start of draw + int 0x40 + + mov eax,0 ; open window + mov ebx,100*65536+300 + mov ecx,100*65536+120 + mov edx,0x02ffffff + mov esi,0x805080d0 + mov edi,0x005080d0 + int 0x40 + + call draw_menu ; DRAW MENU + + mov eax,4 ; window label + mov ebx,8*65536+8 + mov ecx,0x10ddeeff + mov edx,labelt + mov esi,labellen-labelt + int 0x40 + + mov eax,8 ; close button + mov ebx,(300-17)*65536+10 + mov ecx,5*65536+10 + mov edx,1 + mov esi,0x4466bb + int 0x40 + + mov eax,8 ; button : OPEN ALERT BOX + mov ebx,25*65536+150 + mov ecx,61*65536+14 + mov edx,2 + mov esi,0x4466aa + int 0x40 + + mov eax,8 ; button : OPEN CHOOSE BOX + mov ebx,25*65536+150 + mov ecx,81*65536+14 + mov edx,3 + mov esi,0x4466aa + int 0x40 + + mov ebx,20*65536+55 ; draw info text with function 4 + mov ecx,0xffffff + mov edx,text + mov esi,40 + newline: + mov eax,4 + int 0x40 + add ebx,10 + add edx,40 + cmp [edx],byte 'x' + jne newline + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + + ret + + +; DATA AREA + +text: + db ' ' + db ' OPEN ALERT BOX ' + db ' ' + db ' OPEN CHOOSE BOX ' + + db 'x <- END MARKER, DONT DELETE ' + +labelt: + db 'EXAMPLE APPLICATION' +labellen: + +alert_text db ' File not found !',0 +choose_text db ' Save file before exit ? ',0 + +I_END: diff --git a/programs/example2/trunk/macros.inc b/programs/example2/trunk/macros.inc new file mode 100644 index 0000000000..d599dea0e0 --- /dev/null +++ b/programs/example2/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 + +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 \ No newline at end of file diff --git a/programs/example3/trunk/build_en.bat b/programs/example3/trunk/build_en.bat new file mode 100644 index 0000000000..28db6d848f --- /dev/null +++ b/programs/example3/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm example3.asm example3 +@pause \ No newline at end of file diff --git a/programs/example3/trunk/build_ru.bat b/programs/example3/trunk/build_ru.bat new file mode 100644 index 0000000000..8d3fcee39d --- /dev/null +++ b/programs/example3/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm example3.asm example3 +@pause \ No newline at end of file diff --git a/programs/example3/trunk/example3.asm b/programs/example3/trunk/example3.asm new file mode 100644 index 0000000000..9c89d4cdc5 --- /dev/null +++ b/programs/example3/trunk/example3.asm @@ -0,0 +1,433 @@ +; +; MENU EXAMPLE +; +; Compile with FASM for Menuet +; + + use32 + org 0x0 + + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd I_END ; size of image + dd 0x1000 ; memory for app + dd 0x1000 ; esp + dd 0x0 , 0x0 ; I_Param , I_Icon + +include 'lang.inc' +include 'macros.inc' + +START: ; start of execution + + call draw_window ; draw window + call clear_data ; clear status bar + +still: + + mov eax,10 ; wait here for event + int 0x40 ; do it + + cmp eax,1 ; redraw request ? + je red ; yes jump to it + cmp eax,2 ; key in buffer ? + je key ; yes jump to it + cmp eax,3 ; button in buffer ? + je button ; yes jump to it + jmp still ; start again + + red: ; redraw + call draw_window ; redraw window + call clear_data ; clear status info + jmp still ; start again + + key: ; key + mov eax,2 ; just read it and ignore + int 0x40 ; do it + jmp still ; start again + + button: ; button + mov eax,17 ; get id + int 0x40 ; do it + + cmp ah,1 ; is it the close button + jne noclose ; no then jump code + mov eax,-1 ; close this program + int 0x40 ; do it +noclose: + + cmp ah,100 ; is it main menu + jb not_menu ; no then jump code + cmp ah,104 ; is it main menu + ja not_menu ; no then jump code + call draw_window ; redraw window + call clear_data ; clear status info + call draw_data ; update status info + call write_sub ; draw a sub menu + jmp still ; start again +not_menu: + + cmp ah,110 ; is it a sub menu + jb not_sub ; no then jump code + cmp ah,145 ; is it a sub menu + ja not_sub ; no then jump code + call draw_window ; redraw window + call clear_data ; clear status info + mov [button_press],1 ; sub button pressed + call draw_data ; update status info + mov [button_press],0 ; clear pressed + jmp still ; start again +not_sub: + + jmp still ; start again + + +; ********************************************* +; ******* WINDOW DEFINITIONS AND DRAW ******** +; ********************************************* + +draw_window: + + push eax ; save register + + mov eax,12 ; function 12: tell os about windowdraw + mov ebx,1 ; 1, start of draw + int 0x40 ; do it + + mov eax,0 ; function 0: define and draw window + mov ebx,50*65536 ; [x start] *65536 + add ebx,[x_size] ; add [x size] + mov ecx,50*65536 ; [y start] *65536 + add ecx,[y_size] ; add [y size] + mov edx,0x80ffffff ; colour of work area RRGGBB + mov esi,0x806688dd ; grab bar colour. negative glide + int 0x40 ; do it + + mov eax,4 ; function 4: write text to window + mov ebx,6*65536+7 ; [x start] *65536 + [y start] + mov ecx,0x00ffffff ; text colour + mov edx,window_text ; pointer to text beginning + mov esi,12 ; text length + int 0x40 ; do it + + mov eax,8 ; function 8: define and draw button + mov ebx,(381-18)*65536+13 ; [x start] *65536 + [x size] + mov ecx,4*65536+13 ; [y start] *65536 + [y size] + mov edx,1 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 ; do it + + mov eax,13 ; function 13: draw bar + mov ebx,1*65536 ; [x start] *65536 + add ebx,[x_size] ; add [x size] + dec ebx ; x size - 1 + mov ecx,[y_size] ; [y start] *65536 + sub ecx,17 ; minus height + shl ecx,16 ; *65536 + add ecx,17 ; add height + mov edx,0x006688dd ; bar colour + int 0x40 ; do it + + mov eax,4 ; function 4 : write text to window + mov ebx,5*65536 ; [x start] *65536 + add ebx,[y_size] ; add [y start] + sub ebx,12 ; move up + xor ecx,ecx ; text colour + mov edx,button_no ; pointer to text beginning + mov esi,14 ; text length + int 0x40 ; do it + + add ebx,95*65536 ; move xy position + mov edx,menu_text ; pointer to text beginning + int 0x40 ; do it + + call write_main ; draw menu + + mov eax,12 ; function 12: tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 ; do it + + pop eax ; restore register + ret ; return + + ; ************* WRITE MAIN ************* + +write_main: + + mov eax,13 ; function 13: draw bar + mov ebx,1*65536 ; [x start] *65536 + add ebx,[x_size] ; +[x_size] + dec ebx ; x size - 1 + mov ecx,21*65536+17 ; [y start] *65536 +[y size] + mov edx,[menu_colour] ; menu colour + int 0x40 ; do it + + mov [main_pos],1 ; start position first button + xor edi,edi ; data offset = 0 + +next_main_item: + mov al,[MENU_DATA+edi] ; get byte at menu_data + offset + cmp al,'E' ; is it the END + je main_get_out ; yes then exit + cmp al,'0' ; is it a main menu item + jne not_main_menu ; no then jump code + +main_menu: + mov al,[MENU_DATA+edi+1] ; get byte at menu_data + offset + 1 + cmp al,'0' ; is it a divider + je is_main_bar ; yes then jump code + mov eax,8 ; function 8: define button + mov ebx,[main_pos] ; [x start] + shl ebx,16 ; *65536 + add bl,75 ; +[x size] + mov ecx,21*65536+16 ; [y start] *65536 +[y size] + xor edx,edx ; clear register + mov dl,[MENU_DATA+edi+2] ; get byte button id number + mov esi,[menu_colour] ; button colour + int 0x40 ; do it + mov eax,4 ; function 4: write text to window + add ebx,6*65536-49 ; move xy position + xor ecx,ecx ; text colour + mov edx,MENU_DATA+3 ; point at menu text + add edx,edi ; add our offset + mov esi,11 ; number of characters + int 0x40 ; do it + +is_main_bar: + add [main_pos],76 ; update button position + +not_main_menu: + add edi,14 ; update offset + jmp next_main_item ; do next menu item + +main_get_out: + + ret ; return + +; *********** DRAW DATA *********** + +draw_data: + + push eax ; save register + mov ebx,0x00030000 ; display 3 decimal characters + xor ecx,ecx ; clear register + mov cl,ah ; swap data + mov eax,47 ; function 47: display number to window + mov edx,70*65536 ; [x start] *65536 + add edx,[y_size] ; +[y start] + sub edx,12 ; move position + xor esi,esi ; text colour + int 0x40 ; do it + pop eax ; restore register + + cmp [button_press],1 ; has a sub button been pressed + je draw_get_out ; then jump code + + push eax ; save register + xor edx,edx ; clear register + shr ax,8 ; move button id into al + sub eax,100 ; subtract 100 + mov dx,14 ; use record length as multiplier + mul dx ; multiply + mov edx,eax ; swap registers + add edx,MENU_DATA ; add offset + inc edx ; add 1 + mov ebx,188*65536 ; [x start] *65536 + add ebx,[y_size] ; +[y start] + sub ebx,12 ; move position + mov esi,1 ; 1 character + mov eax,4 ; function 4: write text to window + xor ecx,ecx ; text colour + int 0x40 ; do it + pop eax ; restore register + +draw_get_out: + ret ; return + +; **************** CLEAR DATA ****************** + +clear_data: + + push eax ; save register + mov eax,13 ; function 13: draw bar + mov ebx,67*65536+23 ; [x start] *65536 +[x size] + mov ecx,[y_size] ; [y start] + sub ecx,15 ; move position + shl ecx,16 ; *65536 + add ecx,13 ; [y size] + mov edx,0x00aaaaaa ; bar colour + int 0x40 ; do it + mov ebx,185*65536+11 ; move position + int 0x40 ; do it again + + pop eax ; restore register + ret ; return + + ; ************* WRITE SUB ************* + +write_sub: + + push eax ; save register + mov [but_pos],38 ; y start position offset + mov [sub_pos],1 ; x start position offset + xor edx,edx ; clear register + shr ax,8 ; move button id into al + sub eax,100 ; subtract 100 + mov dx,76 ; menu width + 1 + mul dx ; multiply + add [sub_pos],eax ; add menu position to offset + pop eax ; restore register + + xor edx,edx ; clear register + shr ax,8 ; move button id into al + sub eax,100 ; subtract 100 + mov dx,14 ; use record length as multiplier + mul dx ; multiply + add eax,MENU_DATA ; add offset + inc eax ; plus 1 + mov al,[eax] ; get menu number byte + mov [menu_number],al ; save it + + xor edi,edi ; clear offset + +next_sub_item: + mov al,[MENU_DATA+edi] ; get byte at menu_data + offset + cmp al,'E' ; is it the END + je sub_get_out ; yes then exit + cmp al,[menu_number] ; is it sub menu item + jne not_sub_menu ; no then jump code + +sub_menu: + mov al,[MENU_DATA+edi+1] ; get byte at menu_data + offset + 1 + cmp al,'0' ; is it a divider + jne is_sub_button ; no then jump code + mov eax,13 ; function 13: draw bar + mov edx,[menu_colour] ; bar colour + mov ebx,[sub_pos] ; [x start] + shl ebx,16 ; *65536 + add ebx,76 ; [x size] + mov ecx,[but_pos] ; [y start] + shl ecx,16 ; *65536 + add ecx,17 ; [y size] + int 0x40 ; do it + jmp is_sub_bar ; jump button code + +is_sub_button: + mov eax,8 ; function 8: define and draw button + xor edx,edx ; clear register + mov dl,[MENU_DATA+edi+2] ; get byte button id number + mov ebx,[sub_pos] ; [x start] + shl ebx,16 ; *65536 + add ebx,75 ; [x size] + mov ecx,[but_pos] ; [y start] + shl ecx,16 ; *65536 + add ecx,16 ; [y size] + mov esi,[menu_colour] ; button colour + int 0x40 ; do it + + mov ebx,[sub_pos] ; [x start] + shl ebx,16 ; *65536 + add ebx,6*65536 ; move position + add ebx,[but_pos] ; [y start] + add bl,5 ; move position + xor ecx,ecx ; clear register + mov edx,MENU_DATA+3 ; point to button text + add edx,edi ; add offset + mov esi,11 ; number of characters + mov eax,4 ; function 4: write text to window + int 0x40 ; do it +is_sub_bar: + add [but_pos],17 ; move y position + +not_sub_menu: + add edi,14 ; move offset + jmp next_sub_item ; do next button + +sub_get_out: + + ret ; return + +; ***************** DATA AREA ****************** + +x_size: dd 381 ; window x size +y_size: dd 200 ; window y size + +window_text db 'MENU EXAMPLE' ; grab bar text +button_no db 'BUTTON No: ' ; status bar text +menu_text db 'MENU SELECTED:' ; status bar text + +button_press dd 0 + +menu_colour dd 0x00aaaaaa ; menu & button colour + +menu_number db '0' ; menu selection + +sub_pos dd 1 ; sub menu x position +but_pos dd 38 ; sub menu y position + +main_pos dd 1 ; main menu x position + +MENU_DATA: db '01' ; MAIN MENU = 0 - 1 = menu + db 100 ; button id + db 'FILE ' ; button text + db '02' ; MAIN MENU = 0 - 2 = menu + db 101 ; button id + db 'EDIT ' ; button text + db '04' ; MAIN MENU = 0 - 3 = menu + db 102 ; button id + db 'TEST ' ; button text + db '00' ; MAIN MENU = 0 - 0 = divider + db 103 ; SPACER ID + db ' ' ; SPACER TEXT padding + db '03' ; MAIN MENU = 0 - 4 = menu + db 104 ; button id + db 'HELP ' ; button text + + db '11' ; menu level = 1 - 1 = button + db 110 ; button id + db 'LOAD ' ; button text + db '11' ; menu level = 1 - 1 = button + db 111 ; button id + db 'SAVE ' ; button text + db '10' ; menu level = 1 - 0 = divider + db 112 ; SPACER ID + db ' ' ; SPACER TEXT padding + db '11' ; menu level = 1 - 1 = button + db 113 ; button id + db 'QUIT ' ; button text + + db '21' ; menu level = 2 - 1 = button + db 120 ; button id + db 'COPY ' ; button text + db '21' ; menu level = 2 - 1 = button + db 121 ; button id + db 'PASTE ' ; button text + + db '31' ; menu level = 3 - 1 = button + db 130 ; button id + db 'SETUP ' ; button text + db '31' ; menu level = 3 - 1 = button + db 131 ; button id + db 'ABOUT.. ' ; button text + + db '41' ; menu level = 3 - 1 = button + db 140 ; button id + db 'TEST 1 ' ; button text + db '41' ; menu level = 3 - 1 = button + db 141 ; button id + db 'TEST 2 ' ; button text + db '41' ; menu level = 3 - 1 = button + db 142 ; button id + db 'TEST 3 ' ; button text + db '41' ; menu level = 3 - 1 = button + db 143 ; button id + db 'TEST 4 ' ; button text + db '41' ; menu level = 3 - 1 = button + db 144 ; button id + db 'TEST 5 ' ; button text + db '41' ; menu level = 3 - 1 = button + db 145 ; button id + db 'TEST 6 ' ; button text + + db 'END' ; IMPORTANT need an END +I_END: diff --git a/programs/example3/trunk/macros.inc b/programs/example3/trunk/macros.inc new file mode 100644 index 0000000000..d599dea0e0 --- /dev/null +++ b/programs/example3/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 + +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 \ No newline at end of file diff --git a/programs/eyes/trunk/build_en.bat b/programs/eyes/trunk/build_en.bat new file mode 100644 index 0000000000..50143ec99e --- /dev/null +++ b/programs/eyes/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm eyes.asm eyes +@pause \ No newline at end of file diff --git a/programs/eyes/trunk/build_ru.bat b/programs/eyes/trunk/build_ru.bat new file mode 100644 index 0000000000..1e9d2ede66 --- /dev/null +++ b/programs/eyes/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm eyes.asm eyes +@pause \ No newline at end of file diff --git a/programs/eyes/trunk/eyes.asm b/programs/eyes/trunk/eyes.asm new file mode 100644 index 0000000000..6efba894ea --- /dev/null +++ b/programs/eyes/trunk/eyes.asm @@ -0,0 +1,388 @@ +; +; EYES FOR MENUET +; +; Written by Nikita Lesnikov (nlo_one@mail.ru) +; +; Position of "eyes" is fixed. To close "eyes" just click on them. +; +; NOTE: quite big timeout is used to disable blinking when redrawing. +; If "eyes" blink on your system, enlarge the TIMEOUT. If not, you can +; decrease it due to more realistic movement. +; + +TIMEOUT equ 5 + +; EXECUTABLE HEADER + +use32 + + org 0x0 + db "MENUET01" + dd 0x01 + dd ENTRANCE + dd EYES_END + dd 0x3000 + dd 0x3000 + dd 0x0 + dd 0x0 + +include 'macros.inc' +ENTRANCE: ; start of code + +; ==== main ==== + +call prepare_eyes + +call shape_window + +still: + +call draw_eyes ; draw those funny "eyes" + +mov eax,23 ; wait for event with timeout +mov ebx,TIMEOUT +int 0x40 + +cmp eax,1 ; redraw ? +jnz no_draw +call redraw_overlap +no_draw: + +cmp eax,2 ; key ? +jz key + +cmp eax,3 ; button ? +jz button + +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 +mov ebx,0 +mov ecx,winref +int 0x40 + +ret + +; -====- redrawing -====- + +draw_eyes: ; check mousepos to disable blinking + +mov eax,37 +xor ebx,ebx +int 0x40 +cmp dword [mouse],eax +jne redraw_ok +ret +redraw_ok: +mov [mouse],eax + +redraw_overlap: ; label for redraw event (without checkmouse) + +mov eax,12 +mov ebx,1 +int 0x40 + +xor eax,eax ; define window +mov ebx,[win_ebx] +mov ecx,[win_ecx] +xor edx,edx +xor esi,esi +xor edi,edi +int 0x40 + +mov eax,8 ; define closebutton +mov ebx,60 +mov ecx,45 +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 + +ret + +draw_eye_point: ; draw eye point (EAX=X, EBX=Y) +pusha + +mov ecx, [mouse] ; ecx = mousex, edx = mousey +mov edx,ecx +shr ecx,16 +and edx,0xFFFF + +; ===> calculate position + +push eax +push ebx +mov byte [sign1],0 +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: +mov [temp1],ecx +mov byte [sign2],0 +mov esi,[win_ecx] +shr esi,16 +add ebx,esi +sub edx,ebx ; EDX=EDX-EBX (signed) , EDX=|EDX| +jnc abs_ok_2 +neg edx +mov byte [sign2],1 +abs_ok_2: +mov [temp2],edx +pop ebx +pop eax + +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 + +push eax ; EDX*=EDX +push ecx +mov ecx,edx +xor eax,eax +xor edx,edx +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: +add ecx,eax +add eax,edi +inc edx +cmp ecx,ebx +jbe sqrt_loop +dec edx +mov esi,edx +mov ax,si ; ESI=ESI/7 +mov dl,7 +div dl +and ax,0xFF +mov si,ax ; ESI ? 0 : ESI=1 +jnz nozeroflag1 +mov si,1 +nozeroflag1: + +pop eax +pop edx +pop ecx +pop ebx + +push eax ; ECX=[temp1]/ESI +push edx +mov eax,[temp1] +mov dx,si +div dl +mov cl,al +and ecx,0xFF +pop edx +pop eax + +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 ; EDX=[temp2]/ESI +push ecx +mov eax,[temp2] +mov dx,si +div dl +mov dl,al +and dx,0xFF +pop ecx +pop eax + +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: + +; <=== + +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 +add ebx,4 +mov eax,13 +xor edx,edx +int 0x40 + +popa +ret + +; -====- 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 +cmp al,0xFF +jnz set_one +mov al,0 +jmp cpl_ok +set_one: +mov al,1 +cpl_ok: +stosb +loop cpl_loop +ret + +; DATA + +; environment + +win_ebx dd 0x0 +win_ecx dd 0x0 +mouse dd 0xFFFFFFFF +;graphix db "EYES.RAW " + +; temporary storage for math routines + +temp1 dd 0 +temp2 dd 0 +sign1 db 0 +sign2 db 0 + +EYES_END: ; end of code +file "EYES.RAW" diff --git a/programs/eyes/trunk/eyes.raw b/programs/eyes/trunk/eyes.raw new file mode 100644 index 0000000000..04e6fe704c Binary files /dev/null and b/programs/eyes/trunk/eyes.raw differ diff --git a/programs/eyes/trunk/macros.inc b/programs/eyes/trunk/macros.inc new file mode 100644 index 0000000000..d599dea0e0 --- /dev/null +++ b/programs/eyes/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 + +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 \ No newline at end of file diff --git a/programs/fasm/trunk/assemble.inc b/programs/fasm/trunk/assemble.inc new file mode 100644 index 0000000000..42a913d571 --- /dev/null +++ b/programs/fasm/trunk/assemble.inc @@ -0,0 +1,1960 @@ + +; flat assembler core +; Copyright (c) 1999-2005, Tomasz Grysztar. +; All rights reserved. + +assembler: + mov ecx,[memory_end] + mov edi,[labels_list] + sub ecx,edi + cmp edi,[code_start] + jbe out_of_memory + shr ecx,2 + xor eax,eax + rep stos dword [edi] + mov [stub_size],eax + mov [number_of_sections],eax + mov [current_pass],ax + assembler_loop: + mov eax,[labels_list] + mov [display_buffer],eax + mov eax,[additional_memory] + mov [free_additional_memory],eax + mov eax,[additional_memory_end] + mov [structures_buffer],eax + mov esi,[source_start] + mov edi,[code_start] + xor eax,eax + mov dword [adjustment],eax + mov dword [adjustment+4],eax + mov dword [org_origin],edi + mov dword [org_origin+4],eax + mov [org_start],edi + mov [org_registers],eax + mov [org_symbol],eax + mov [error_line],eax + mov [counter],eax + mov [format_flags],eax + mov [number_of_relocations],eax + mov [undefined_data_end],eax + mov [next_pass_needed],al + mov [output_format],al + mov [labels_type],al + mov [virtual_data],al + mov [code_type],16 + pass_loop: + call assemble_line + jnc pass_loop + mov eax,[additional_memory_end] + cmp eax,[structures_buffer] + je pass_done + sub eax,20h + mov eax,[eax+4] + mov [current_line],eax + jmp missing_end_directive + pass_done: + call close_pass + mov eax,[labels_list] + check_symbols: + cmp eax,[memory_end] + jae symbols_checked + test byte [eax+8],8 + jz symbol_defined_ok + mov cx,[current_pass] + cmp cx,[eax+18] + jne symbol_defined_ok + test byte [eax+8],1 + jz symbol_defined_ok + sub cx,[eax+16] + cmp cx,1 + jne symbol_defined_ok + and byte [eax+8],not 1 + or [next_pass_needed],-1 + symbol_defined_ok: + test byte [eax+8],10h + jz use_prediction_ok + mov cx,[current_pass] + and byte [eax+8],not 10h + test byte [eax+8],20h + jnz check_use_prediction + cmp cx,[eax+18] + jne use_prediction_ok + test byte [eax+8],8 + jz use_prediction_ok + jmp use_misprediction + check_use_prediction: + test byte [eax+8],8 + jz use_misprediction + cmp cx,[eax+18] + je use_prediction_ok + use_misprediction: + or [next_pass_needed],-1 + use_prediction_ok: + test byte [eax+8],40h + jz check_next_symbol + and byte [eax+8],not 40h + test byte [eax+8],4 + jnz define_misprediction + mov cx,[current_pass] + test byte [eax+8],80h + jnz check_define_prediction + cmp cx,[eax+16] + jne check_next_symbol + test byte [eax+8],1 + jz check_next_symbol + jmp define_misprediction + check_define_prediction: + test byte [eax+8],1 + jz define_misprediction + cmp cx,[eax+16] + je check_next_symbol + define_misprediction: + or [next_pass_needed],-1 + check_next_symbol: + add eax,24 + jmp check_symbols + symbols_checked: + cmp [next_pass_needed],0 + jne next_pass + mov eax,[error_line] + or eax,eax + jz assemble_ok + mov [current_line],eax + jmp near [error] + next_pass: + inc [current_pass] + mov ax,[current_pass] + cmp ax,[passes_limit] + je code_cannot_be_generated + jmp assembler_loop + assemble_ok: + ret + +assemble_line: + mov eax,[display_buffer] + sub eax,100h + cmp edi,eax + ja out_of_memory + lods byte [esi] + cmp al,1 + je assemble_instruction + jb source_end + cmp al,3 + jb define_label + je define_constant + cmp al,0Fh + je new_line + cmp al,13h + je code_type_setting + cmp al,10h + jne illegal_instruction + lods byte [esi] + jmp segment_prefix + code_type_setting: + lods byte [esi] + mov [code_type],al + jmp line_assembled + new_line: + lods dword [esi] + mov [current_line],eax + mov [prefixed_instruction],0 + continue_line: + cmp byte [esi],0Fh + je line_assembled + jmp assemble_line + define_label: + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + mov ebx,eax + lods byte [esi] + mov cl,al + mov eax,edi + xor edx,edx + sub eax,dword [org_origin] + sbb edx,dword [org_origin+4] + mov ch,[labels_type] + cmp [virtual_data],0 + jne make_virtual_label + or byte [ebx+9],1 + xchg eax,[ebx] + xchg edx,[ebx+4] + sub eax,[ebx] + sbb edx,[ebx+4] + mov dword [adjustment],eax + mov dword [adjustment+4],edx + or eax,edx + setnz ah + jmp finish_label_symbol + make_virtual_label: + and byte [ebx+9],not 1 + cmp eax,[ebx] + mov [ebx],eax + setne ah + cmp edx,[ebx+4] + mov [ebx+4],edx + setne al + or ah,al + finish_label_symbol: + cmp cl,[ebx+10] + mov [ebx+10],cl + setne al + or ah,al + cmp ch,[ebx+11] + mov [ebx+11],ch + setne al + or ah,al + mov edx,[org_registers] + cmp edx,[ebx+12] + mov [ebx+12],edx + setne al + or ah,al + or ch,ch + jz label_symbol_ok + mov edx,[org_symbol] + cmp edx,[ebx+20] + mov [ebx+20],edx + setne al + or ah,al + label_symbol_ok: + mov cx,[current_pass] + xchg [ebx+16],cx + and byte [ebx+8],not 2 + test byte [ebx+8],1 + jz new_label + cmp cx,[ebx+16] + je symbol_already_defined + inc cx + sub cx,[ebx+16] + setnz al + or ah,al + jz continue_line + test byte [ebx+8],8 + jz continue_line + mov cx,[current_pass] + cmp cx,[ebx+18] + jne continue_line + or [next_pass_needed],-1 + jmp continue_line + new_label: + or byte [ebx+8],1 + jmp continue_line + define_constant: + lods dword [esi] + inc esi + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + mov edx,[eax+8] + push edx + cmp [current_pass],0 + je get_constant_value + test dl,4 + jnz get_constant_value + mov cx,[current_pass] + cmp cx,[eax+16] + je get_constant_value + and dl,not 1 + mov [eax+8],dl + get_constant_value: + push eax + mov al,byte [esi-1] + push eax + call get_value + pop ebx + mov ch,bl + pop ebx + pop dword [ebx+8] + cmp ebx,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + xor cl,cl + mov ch,[value_type] + cmp ch,3 + je invalid_use_of_symbol + make_constant: + and byte [ebx+9],not 1 + cmp eax,[ebx] + mov [ebx],eax + setne ah + cmp edx,[ebx+4] + mov [ebx+4],edx + setne al + or ah,al + cmp cl,[ebx+10] + mov [ebx+10],cl + setne al + or ah,al + cmp ch,[ebx+11] + mov [ebx+11],ch + setne al + or ah,al + xor edx,edx + cmp edx,[ebx+12] + mov [ebx+12],edx + setne al + or ah,al + or ch,ch + jz constant_symbol_ok + mov edx,[symbol_identifier] + cmp edx,[ebx+20] + mov [ebx+20],edx + setne al + or ah,al + constant_symbol_ok: + mov cx,[current_pass] + xchg [ebx+16],cx + test byte [ebx+8],1 + jz new_constant + cmp cx,[ebx+16] + jne redeclare_constant + test byte [ebx+8],2 + jz symbol_already_defined + or byte [ebx+8],4 + jmp instruction_assembled + redeclare_constant: + inc cx + sub cx,[ebx+16] + setnz al + or ah,al + jz instruction_assembled + test byte [ebx+8],4 + jnz instruction_assembled + test byte [ebx+8],8 + jz instruction_assembled + mov cx,[current_pass] + cmp cx,[ebx+18] + jne instruction_assembled + or [next_pass_needed],-1 + jmp instruction_assembled + new_constant: + or byte [ebx+8],1+2 + jmp instruction_assembled + assemble_instruction: + mov [operand_size],0 + mov [size_override],0 + mov [operand_prefix],0 + mov [rex_prefix],0 + mov [immediate_size],0 + movzx ebx,word [esi] + mov al,[esi+2] + add ebx,assembler + add esi,3 + jmp near ebx + instruction_assembled: + mov al,[esi] + cmp al,0Fh + je line_assembled + or al,al + jnz extra_characters_on_line + line_assembled: + clc + ret + source_end: + dec esi + stc + ret +skip_line: + call skip_symbol + jnc skip_line + ret +skip_symbol: + lods byte [esi] + or al,al + jz nothing_to_skip + cmp al,0Fh + je nothing_to_skip + cmp al,1 + je skip_instruction + cmp al,2 + je skip_label + cmp al,3 + je skip_label + cmp al,20h + jb skip_assembler_symbol + cmp al,'(' + je skip_expression + cmp al,'[' + je skip_address + skip_done: + clc + ret + skip_label: + add esi,2 + skip_instruction: + add esi,2 + skip_assembler_symbol: + inc esi + jmp skip_done + skip_address: + mov al,[esi] + and al,11110000b + cmp al,60h + jb skip_expression + cmp al,70h + ja skip_expression + inc esi + jmp skip_address + skip_expression: + lods byte [esi] + or al,al + jz skip_string + cmp al,'.' + je skip_fp_value + cmp al,')' + je skip_done + cmp al,']' + je skip_done + cmp al,0Fh + je skip_expression + cmp al,10h + je skip_register + cmp al,11h + je skip_label_value + cmp al,80h + jae skip_expression + movzx eax,al + add esi,eax + jmp skip_expression + skip_label_value: + add esi,3 + skip_register: + inc esi + jmp skip_expression + skip_fp_value: + add esi,12 + jmp skip_done + skip_string: + lods dword [esi] + add esi,eax + inc esi + jmp skip_done + nothing_to_skip: + dec esi + stc + ret + +org_directive: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_qword_value + mov cl,[value_type] + test cl,1 + jnz invalid_use_of_symbol + mov [labels_type],cl + mov ecx,edi + sub ecx,eax + sbb edx,0 + mov dword [org_origin],ecx + mov dword [org_origin+4],edx + mov [org_registers],0 + mov [org_start],edi + mov edx,[symbol_identifier] + mov [org_symbol],edx + cmp [output_format],1 + ja instruction_assembled + cmp edi,[code_start] + jne instruction_assembled + cmp eax,100h + jne instruction_assembled + bts [format_flags],0 + jmp instruction_assembled +label_directive: + lods byte [esi] + cmp al,2 + jne invalid_argument + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + inc esi + mov ebx,eax + xor cl,cl + lods byte [esi] + cmp al,':' + je get_label_size + dec esi + cmp al,11h + jne label_size_ok + get_label_size: + lods word [esi] + cmp al,11h + jne invalid_argument + mov cl,ah + label_size_ok: + mov eax,edi + xor edx,edx + sub eax,dword [org_origin] + sbb edx,dword [org_origin+4] + mov ebp,[org_registers] + cmp byte [esi],80h + je get_free_label_value + mov ch,[labels_type] + push [org_symbol] + pop [address_symbol] + cmp [virtual_data],0 + jne make_free_label + or byte [ebx+9],1 + xchg eax,[ebx] + xchg edx,[ebx+4] + sub eax,[ebx] + sbb edx,[ebx+4] + mov dword [adjustment],eax + mov dword [adjustment+4],edx + or eax,edx + setne ah + jmp finish_label + get_free_label_value: + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_argument + push dword [ebx+8] + push ebx ecx + and byte [ebx+8],not 1 + cmp byte [esi],'.' + je invalid_value + call get_address_value + or bh,bh + setnz ch + xchg ch,cl + mov bp,cx + shl ebp,16 + xchg bl,bh + mov bp,bx + pop ecx ebx + pop dword [ebx+8] + mov ch,[value_type] + or ch,ch + jz make_free_label + cmp ch,2 + jne invalid_use_of_symbol + make_free_label: + and byte [ebx+9],not 1 + cmp eax,[ebx] + mov [ebx],eax + setne ah + cmp edx,[ebx+4] + mov [ebx+4],edx + setne al + or ah,al + jmp finish_label + finish_label: + cmp cl,[ebx+10] + mov [ebx+10],cl + setne al + or ah,al + cmp ch,[ebx+11] + mov [ebx+11],ch + setne al + or ah,al + cmp ebp,[ebx+12] + mov [ebx+12],ebp + setne al + or ah,al + or ch,ch + jz free_label_symbol_ok + mov edx,[address_symbol] + cmp edx,[ebx+20] + mov [ebx+20],edx + setne al + or ah,al + free_label_symbol_ok: + mov cx,[current_pass] + xchg [ebx+16],cx + and byte [ebx+8],not 2 + test byte [ebx+8],1 + jz new_free_label + cmp cx,[ebx+16] + je symbol_already_defined + inc cx + sub cx,[ebx+16] + setnz al + or ah,al + jz instruction_assembled + test byte [ebx+8],8 + jz instruction_assembled + mov cx,[current_pass] + cmp cx,[ebx+18] + jne instruction_assembled + or [next_pass_needed],-1 + jmp instruction_assembled + new_free_label: + or byte [ebx+8],1 + jmp instruction_assembled +load_directive: + lods byte [esi] + cmp al,2 + jne invalid_argument + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + inc esi + push eax + mov al,1 + cmp byte [esi],11h + jne load_size_ok + lods byte [esi] + lods byte [esi] + load_size_ok: + cmp al,8 + ja invalid_value + mov [operand_size],al + mov dword [value],0 + mov dword [value+4],0 + lods word [esi] + cmp ax,82h+'(' shl 8 + jne invalid_argument + load_from_code: + cmp byte [esi],'.' + je invalid_value + call get_relative_offset + neg eax + cmp [next_pass_needed],0 + jne load_address_ok + cmp [value_type],0 + jne invalid_use_of_symbol + load_address_ok: + push esi edi + mov esi,edi + sub esi,eax + jc bad_load_address + cmp esi,[org_start] + jb bad_load_address + mov edi,value + movzx ecx,[operand_size] + cmp ecx,eax + ja bad_load_address + rep movs byte [edi],[esi] + jmp value_loaded + bad_load_address: + cmp [error_line],0 + jne value_loaded + mov eax,[current_line] + mov [error_line],eax + mov [error],value_out_of_range + value_loaded: + pop edi esi + mov eax,dword [value] + mov edx,dword [value+4] + pop ebx + xor cx,cx + jmp make_constant +store_directive: + cmp byte [esi],11h + je sized_store + lods byte [esi] + cmp al,'(' + jne invalid_argument + call get_byte_value + xor edx,edx + movzx eax,al + mov [operand_size],1 + jmp store_value_ok + sized_store: + call get_value + store_value_ok: + cmp [value_type],0 + jne invalid_use_of_symbol + mov dword [value],eax + mov dword [value+4],edx + lods word [esi] + cmp ax,80h+'(' shl 8 + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_relative_offset + neg eax + cmp [next_pass_needed],0 + jne store_address_ok + cmp [value_type],0 + jne invalid_use_of_symbol + store_address_ok: + push esi edi + sub edi,eax + jc bad_store_address + cmp edi,[org_start] + jb bad_store_address + mov esi,value + movzx ecx,[operand_size] + cmp ecx,eax + ja bad_store_address + rep movs byte [edi],[esi] + mov eax,edi + pop edi esi + cmp edi,[undefined_data_end] + jne instruction_assembled + cmp eax,[undefined_data_start] + jbe instruction_assembled + mov [undefined_data_start],eax + jmp instruction_assembled + bad_store_address: + pop edi esi + cmp [error_line],0 + jne instruction_assembled + mov eax,[current_line] + mov [error_line],eax + mov [error],value_out_of_range + jmp instruction_assembled + +display_directive: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],0 + jne display_byte + inc esi + lods dword [esi] + mov ecx,eax + push edi + mov edi,[display_buffer] + sub edi,4 + sub edi,eax + mov [display_buffer],edi + rep movs byte [edi],[esi] + stos dword [edi] + pop edi + inc esi + jmp display_next + display_byte: + call get_byte_value + push edi + mov edi,[display_buffer] + sub edi,4+1 + mov [display_buffer],edi + stos byte [edi] + mov eax,1 + stos dword [edi] + pop edi + display_next: + cmp edi,[display_buffer] + ja out_of_memory + lods byte [esi] + cmp al,',' + je display_directive + dec esi + jmp instruction_assembled +flush_display_buffer: + mov eax,[display_buffer] + or eax,eax + jz display_done + mov esi,[labels_list] + cmp esi,eax + je display_done + display_messages: + sub esi,4 + mov ecx,[esi] + sub esi,ecx + push esi + call display_block + pop esi + cmp esi,[display_buffer] + jne display_messages + mov eax,[labels_list] + mov [display_buffer],eax + display_done: + ret +times_directive: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_dword_value + cmp [next_pass_needed],0 + jne times_value_ok + cmp [value_type],0 + jne invalid_use_of_symbol + times_value_ok: + cmp eax,0 + je zero_times + jl negative_times + cmp byte [esi],':' + jne times_argument_ok + inc esi + times_argument_ok: + push [counter] + push [counter_limit] + mov [counter_limit],eax + mov [counter],1 + times_loop: + mov eax,esp + sub eax,100h + jc stack_overflow + cmp eax,[stack_limit] + jb stack_overflow + push esi + or [prefixed_instruction],-1 + call continue_line + mov eax,[counter_limit] + cmp [counter],eax + je times_done + inc [counter] + pop esi + jmp times_loop + times_done: + pop eax + pop [counter_limit] + pop [counter] + jmp instruction_assembled + negative_times: + cmp [error_line],0 + jne zero_times + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_value + zero_times: + call skip_line + jmp instruction_assembled + +virtual_directive: + lods byte [esi] + cmp al,80h + jne virtual_at_current + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_address_value + mov ebp,[address_symbol] + xor ch,ch + or bh,bh + jz set_virtual + mov ch,1 + jmp set_virtual + virtual_at_current: + dec esi + mov al,[labels_type] + mov [value_type],al + mov ebp,[org_symbol] + mov eax,edi + xor edx,edx + sub eax,dword [org_origin] + sbb edx,dword [org_origin+4] + xor bx,bx + xor cx,cx + set_virtual: + push [org_registers] + mov byte [org_registers],bh + mov byte [org_registers+1],bl + mov byte [org_registers+2],ch + mov byte [org_registers+3],cl + call allocate_structure_data + mov word [ebx],virtual_directive-assembler + not eax + not edx + add eax,1 + adc edx,0 + add eax,edi + adc edx,0 + xchg dword [org_origin],eax + xchg dword [org_origin+4],edx + mov [ebx+10h],eax + mov [ebx+14h],edx + pop eax + mov [ebx+18h],eax + mov al,[virtual_data] + mov [ebx+2],al + mov al,[labels_type] + mov [ebx+3],al + mov eax,edi + xchg eax,[org_start] + mov [ebx+0Ch],eax + xchg ebp,[org_symbol] + mov [ebx+1Ch],ebp + mov [ebx+8],edi + mov eax,[current_line] + mov [ebx+4],eax + or [virtual_data],-1 + mov al,[value_type] + test al,1 + jnz invalid_use_of_symbol + mov [labels_type],al + jmp instruction_assembled + allocate_structure_data: + mov ebx,[structures_buffer] + sub ebx,20h + cmp ebx,[free_additional_memory] + jb out_of_memory + mov [structures_buffer],ebx + ret + find_structure_data: + mov ebx,[structures_buffer] + scan_structures: + cmp ebx,[additional_memory_end] + je no_such_structure + cmp ax,[ebx] + jne next_structure + clc + ret + next_structure: + cmp ax,if_directive-assembler + je check_structure_overlapping + cmp ax,repeat_directive-assembler + je check_structure_overlapping + cmp ax,while_directive-assembler + je check_structure_overlapping + add ebx,20h + jmp scan_structures + check_structure_overlapping: + cmp word [ebx],if_directive-assembler + je no_such_structure + cmp word [ebx],repeat_directive-assembler + je no_such_structure + cmp word [ebx],while_directive-assembler + je no_such_structure + add ebx,20h + jmp scan_structures + no_such_structure: + stc + ret + end_virtual: + call find_structure_data + jc unexpected_instruction + mov al,[ebx+2] + mov [virtual_data],al + mov al,[ebx+3] + mov [labels_type],al + mov eax,[ebx+10h] + mov dword [org_origin],eax + mov eax,[ebx+14h] + mov dword [org_origin+4],eax + mov eax,[ebx+18h] + mov [org_registers],eax + mov eax,[ebx+0Ch] + mov [org_start],eax + mov eax,[ebx+1Ch] + mov [org_symbol],eax + mov edi,[ebx+8] + remove_structure_data: + push esi edi + mov esi,[structures_buffer] + mov ecx,ebx + sub ecx,esi + lea edi,[esi+20h] + mov [structures_buffer],edi + shr ecx,2 + rep movs dword [edi],[esi] + pop edi esi + ret +repeat_directive: + cmp [prefixed_instruction],0 + jne unexpected_instruction + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_dword_value + cmp [next_pass_needed],0 + jne repeat_value_ok + cmp [value_type],0 + jne invalid_use_of_symbol + repeat_value_ok: + cmp eax,0 + je zero_repeat + jl negative_repeat + call allocate_structure_data + mov word [ebx],repeat_directive-assembler + xchg eax,[counter_limit] + mov [ebx+10h],eax + mov eax,1 + xchg eax,[counter] + mov [ebx+14h],eax + mov [ebx+8],esi + mov eax,[current_line] + mov [ebx+4],eax + jmp instruction_assembled + end_repeat: + cmp [prefixed_instruction],0 + jne unexpected_instruction + call find_structure_data + jc unexpected_instruction + mov eax,[counter_limit] + inc [counter] + cmp [counter],eax + jbe continue_repeating + stop_repeat: + mov eax,[ebx+10h] + mov [counter_limit],eax + mov eax,[ebx+14h] + mov [counter],eax + call remove_structure_data + jmp instruction_assembled + continue_repeating: + mov esi,[ebx+8] + jmp instruction_assembled + negative_repeat: + cmp [error_line],0 + jne zero_repeat + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_value + zero_repeat: + mov al,[esi] + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + call find_end_repeat + jmp instruction_assembled + find_end_repeat: + call find_structure_end + cmp ax,repeat_directive-assembler + jne unexpected_instruction + ret +while_directive: + cmp [prefixed_instruction],0 + jne unexpected_instruction + call allocate_structure_data + mov word [ebx],while_directive-assembler + mov eax,1 + xchg eax,[counter] + mov [ebx+10h],eax + mov [ebx+8],esi + mov eax,[current_line] + mov [ebx+4],eax + do_while: + push ebx + call calculate_logical_expression + or al,al + jnz while_true + mov al,[esi] + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + stop_while: + call find_end_while + pop ebx + mov eax,[ebx+10h] + mov [counter],eax + call remove_structure_data + jmp instruction_assembled + while_true: + pop ebx + jmp instruction_assembled + end_while: + cmp [prefixed_instruction],0 + jne unexpected_instruction + call find_structure_data + jc unexpected_instruction + mov eax,[ebx+4] + mov [current_line],eax + inc [counter] + jz too_many_repeats + mov esi,[ebx+8] + jmp do_while + find_end_while: + call find_structure_end + cmp ax,while_directive-assembler + jne unexpected_instruction + ret +if_directive: + cmp [prefixed_instruction],0 + jne unexpected_instruction + call calculate_logical_expression + mov dl,al + mov al,[esi] + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + or dl,dl + jnz if_true + call find_else + jc instruction_assembled + mov al,[esi] + cmp al,1 + jne else_true + cmp word [esi+1],if_directive-assembler + jne else_true + add esi,4 + jmp if_directive + if_true: + xor al,al + make_if_structure: + call allocate_structure_data + mov word [ebx],if_directive-assembler + mov byte [ebx+2],al + mov eax,[current_line] + mov [ebx+4],eax + jmp instruction_assembled + else_true: + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + or al,-1 + jmp make_if_structure + else_directive: + cmp [prefixed_instruction],0 + jne unexpected_instruction + mov ax,if_directive-assembler + call find_structure_data + jc unexpected_instruction + cmp byte [ebx+2],0 + jne unexpected_instruction + found_else: + mov al,[esi] + cmp al,1 + jne skip_else + cmp word [esi+1],if_directive-assembler + jne skip_else + add esi,4 + call find_else + jnc found_else + call remove_structure_data + jmp instruction_assembled + skip_else: + or al,al + jz missing_end_directive + cmp al,0Fh + jne extra_characters_on_line + call find_end_if + call remove_structure_data + jmp instruction_assembled + end_if: + cmp [prefixed_instruction],0 + jne unexpected_instruction + call find_structure_data + jc unexpected_instruction + call remove_structure_data + jmp instruction_assembled + find_else: + call find_structure_end + cmp ax,else_directive-assembler + je else_found + cmp ax,if_directive-assembler + jne unexpected_instruction + stc + ret + else_found: + clc + ret + find_end_if: + call find_structure_end + cmp ax,if_directive-assembler + jne unexpected_instruction + ret + find_structure_end: + push [error_line] + mov eax,[current_line] + mov [error_line],eax + find_end_directive: + call skip_line + lods byte [esi] + cmp al,0Fh + jne no_end_directive + lods dword [esi] + mov [current_line],eax + skip_labels: + cmp byte [esi],2 + jne labels_ok + add esi,6 + jmp skip_labels + labels_ok: + cmp byte [esi],1 + jne find_end_directive + mov ax,[esi+1] + cmp ax,prefix_instruction-assembler + je find_end_directive + add esi,4 + cmp ax,repeat_directive-assembler + je skip_repeat + cmp ax,while_directive-assembler + je skip_while + cmp ax,if_directive-assembler + je skip_if + cmp ax,else_directive-assembler + je structure_end + cmp ax,end_directive-assembler + jne find_end_directive + cmp byte [esi],1 + jne find_end_directive + mov ax,[esi+1] + add esi,4 + cmp ax,repeat_directive-assembler + je structure_end + cmp ax,while_directive-assembler + je structure_end + cmp ax,if_directive-assembler + jne find_end_directive + structure_end: + pop [error_line] + ret + no_end_directive: + mov eax,[error_line] + mov [current_line],eax + jmp missing_end_directive + skip_repeat: + call find_end_repeat + jmp find_end_directive + skip_while: + call find_end_while + jmp find_end_directive + skip_if: + call skip_if_block + jmp find_end_directive + skip_if_block: + call find_else + jc if_block_skipped + cmp byte [esi],1 + jne skip_after_else + cmp word [esi+1],if_directive-assembler + jne skip_after_else + add esi,4 + jmp skip_if_block + skip_after_else: + call find_end_if + if_block_skipped: + ret +end_directive: + lods byte [esi] + cmp al,1 + jne invalid_argument + lods word [esi] + inc esi + cmp ax,virtual_directive-assembler + je end_virtual + cmp ax,repeat_directive-assembler + je end_repeat + cmp ax,while_directive-assembler + je end_while + cmp ax,if_directive-assembler + je end_if + cmp ax,data_directive-assembler + je end_data + jmp invalid_argument +break_directive: + mov ebx,[structures_buffer] + mov al,[esi] + or al,al + jz find_breakable_structure + cmp al,0Fh + jne extra_characters_on_line + find_breakable_structure: + cmp ebx,[additional_memory_end] + je unexpected_instruction + mov ax,[ebx] + cmp ax,repeat_directive-assembler + je break_repeat + cmp ax,while_directive-assembler + je break_while + cmp ax,if_directive-assembler + je break_if + add ebx,20h + jmp find_breakable_structure + break_if: + push [current_line] + mov eax,[ebx+4] + mov [current_line],eax + call remove_structure_data + call skip_if_block + pop [current_line] + mov ebx,[structures_buffer] + jmp find_breakable_structure + break_repeat: + push ebx + call find_end_repeat + pop ebx + jmp stop_repeat + break_while: + push ebx + jmp stop_while + +data_bytes: + call define_data + lods byte [esi] + cmp al,'(' + je get_byte + cmp al,'?' + jne invalid_argument + mov eax,edi + mov byte [edi],0 + inc edi + jmp undefined_data + get_byte: + cmp byte [esi],0 + je get_string + call get_byte_value + stos byte [edi] + ret + get_string: + inc esi + lods dword [esi] + mov ecx,eax + lea eax,[edi+ecx] + cmp eax,[display_buffer] + ja out_of_memory + rep movs byte [edi],[esi] + inc esi + ret + undefined_data: + cmp [virtual_data],0 + je mark_undefined_data + ret + mark_undefined_data: + cmp eax,[undefined_data_end] + je undefined_data_ok + mov [undefined_data_start],eax + undefined_data_ok: + mov [undefined_data_end],edi + ret + define_data: + cmp edi,[display_buffer] + jae out_of_memory + cmp byte [esi],'(' + jne simple_data_value + mov ebx,esi + inc esi + call skip_expression + xchg esi,ebx + cmp byte [ebx],81h + jne simple_data_value + inc esi + call get_dword_value + cmp [next_pass_needed],0 + jne dup_value_ok + cmp [value_type],0 + jne invalid_use_of_symbol + dup_value_ok: + inc esi + cmp eax,0 + jg dup_positive + cmp [error_line],0 + jne dup_invalid + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_value + dup_invalid: + mov eax,1 + dup_positive: + cmp byte [esi],'{' + jne duplicate_single_data_value + inc esi + duplicate_data: + push eax esi + duplicated_values: + cmp edi,[display_buffer] + jae out_of_memory + call near dword [esp+8] + lods byte [esi] + cmp al,',' + je duplicated_values + cmp al,'}' + jne invalid_argument + pop ebx eax + dec eax + jz data_defined + mov esi,ebx + jmp duplicate_data + duplicate_single_data_value: + cmp edi,[display_buffer] + jae out_of_memory + push eax esi + call near dword [esp+8] + pop ebx eax + dec eax + jz data_defined + mov esi,ebx + jmp duplicate_single_data_value + simple_data_value: + cmp edi,[display_buffer] + jae out_of_memory + call near dword [esp] + data_defined: + lods byte [esi] + cmp al,',' + je define_data + dec esi + add esp,4 + jmp instruction_assembled +data_unicode: + or [base_code],-1 + jmp define_words +data_words: + mov [base_code],0 + define_words: + call define_data + lods byte [esi] + cmp al,'(' + je get_word + cmp al,'?' + jne invalid_argument + mov eax,edi + mov word [edi],0 + scas word [edi] + jmp undefined_data + ret + get_word: + cmp [base_code],0 + je word_data_value + cmp byte [esi],0 + je word_string + word_data_value: + call get_word_value + call mark_relocation + stos word [edi] + ret + word_string: + inc esi + lods dword [esi] + mov ecx,eax + jecxz word_string_ok + lea eax,[edi+ecx*2] + cmp eax,[display_buffer] + ja out_of_memory + xor ah,ah + copy_word_string: + lods byte [esi] + stos word [edi] + loop copy_word_string + word_string_ok: + inc esi + ret +data_dwords: + call define_data + lods byte [esi] + cmp al,'(' + je get_dword + cmp al,'?' + jne invalid_argument + mov eax,edi + mov dword [edi],0 + scas dword [edi] + jmp undefined_data + get_dword: + push esi + call get_dword_value + pop ebx + cmp byte [esi],':' + je complex_dword + call mark_relocation + stos dword [edi] + ret + complex_dword: + mov esi,ebx + cmp byte [esi],'.' + je invalid_value + call get_word_value + push eax + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[value_type] + push eax + cmp byte [esi],'.' + je invalid_value + call get_word_value + call mark_relocation + stos word [edi] + pop eax + mov [value_type],al + pop eax + call mark_relocation + stos word [edi] + ret +data_pwords: + call define_data + lods byte [esi] + cmp al,'(' + je get_pword + cmp al,'?' + jne invalid_argument + mov eax,edi + mov dword [edi],0 + scas dword [edi] + mov word [edi],0 + scas word [edi] + jmp undefined_data + get_pword: + push esi + call get_pword_value + pop ebx + cmp byte [esi],':' + je complex_pword + call mark_relocation + stos dword [edi] + mov ax,dx + stos word [edi] + ret + complex_pword: + mov esi,ebx + cmp byte [esi],'.' + je invalid_value + call get_word_value + push eax + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[value_type] + push eax + cmp byte [esi],'.' + je invalid_value + call get_dword_value + call mark_relocation + stos dword [edi] + pop eax + mov [value_type],al + pop eax + call mark_relocation + stos word [edi] + ret +data_qwords: + call define_data + lods byte [esi] + cmp al,'(' + je get_qword + cmp al,'?' + jne invalid_argument + mov eax,edi + mov dword [edi],0 + scas dword [edi] + mov dword [edi],0 + scas dword [edi] + jmp undefined_data + get_qword: + call get_qword_value + call mark_relocation + stos dword [edi] + mov eax,edx + stos dword [edi] + ret +data_twords: + call define_data + lods byte [esi] + cmp al,'(' + je get_tword + cmp al,'?' + jne invalid_argument + mov eax,edi + mov dword [edi],0 + scas dword [edi] + mov dword [edi],0 + scas dword [edi] + mov word [edi],0 + scas word [edi] + jmp undefined_data + get_tword: + cmp byte [esi],'.' + jne complex_tword + inc esi + cmp word [esi+8],8000h + je fp_zero_tword + mov eax,[esi] + stos dword [edi] + mov eax,[esi+4] + stos dword [edi] + mov ax,[esi+8] + add ax,3FFFh + cmp ax,8000h + jae value_out_of_range + mov bl,[esi+11] + shl bx,15 + or ax,bx + stos word [edi] + add esi,13 + ret + fp_zero_tword: + xor eax,eax + stos dword [edi] + stos dword [edi] + mov al,[esi+11] + shl ax,15 + stos word [edi] + add esi,13 + ret + complex_tword: + call get_word_value + push eax + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[value_type] + push eax + cmp byte [esi],'.' + je invalid_value + call get_qword_value + call mark_relocation + stos dword [edi] + mov eax,edx + stos dword [edi] + pop eax + mov [value_type],al + pop eax + call mark_relocation + stos word [edi] + ret +data_file: + lods word [esi] + cmp ax,'(' + jne invalid_argument + add esi,4 + call open_binary_file + mov eax,[esi-4] + lea esi,[esi+eax+1] + mov al,2 + xor edx,edx + call lseek + push eax + xor edx,edx + cmp byte [esi],':' + jne position_ok + inc esi + cmp byte [esi],'(' + jne invalid_argument + inc esi + cmp byte [esi],'.' + je invalid_value + push ebx + call get_dword_value + pop ebx + mov edx,eax + sub [esp],edx + position_ok: + cmp byte [esi],',' + jne size_ok + inc esi + cmp byte [esi],'(' + jne invalid_argument + inc esi + cmp byte [esi],'.' + je invalid_value + push ebx edx + call get_dword_value + pop edx ebx + mov [esp],eax + size_ok: + xor al,al + call lseek + pop ecx + mov edx,edi + add edi,ecx + jc out_of_memory + cmp edi,[display_buffer] + ja out_of_memory + call read + jc error_reading_file + call close + lods byte [esi] + cmp al,',' + je data_file + dec esi + jmp instruction_assembled + open_binary_file: + push esi + push edi + mov esi,[current_line] + mov esi,[esi] + get_current_path: + lodsb + stosb + or al,al + jnz get_current_path + cut_current_path: + cmp edi,[esp] + je current_path_ok + cmp byte [edi-1],'\' + je current_path_ok + cmp byte [edi-1],'/' + je current_path_ok + dec edi + jmp cut_current_path + current_path_ok: + mov esi,[esp+4] + call preprocess_path + pop edx + mov esi,edx + call open + jnc file_opened + mov edi,esi + mov esi,[esp] + push edi + call preprocess_path + pop edx + mov esi,edx + call open + jc file_not_found + file_opened: + mov edi,esi + pop esi + ret +reserve_bytes: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_dword_value + cmp [next_pass_needed],0 + jne rb_value_ok + cmp [value_type],0 + jne invalid_use_of_symbol + rb_value_ok: + cmp eax,0 + jl reserve_negative + mov ecx,eax + mov edx,ecx + add edx,edi + jc out_of_memory + cmp edx,[display_buffer] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_bytes + add edi,ecx + jmp reserved_data + zero_bytes: + xor eax,eax + shr ecx,1 + jnc bytes_stosb_ok + stos byte [edi] + bytes_stosb_ok: + shr ecx,1 + jnc bytes_stosw_ok + stos word [edi] + bytes_stosw_ok: + rep stos dword [edi] + reserved_data: + pop eax + call undefined_data + jmp instruction_assembled + reserve_negative: + cmp [error_line],0 + jne instruction_assembled + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_value + jmp instruction_assembled +reserve_words: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_dword_value + cmp [next_pass_needed],0 + jne rw_value_ok + cmp [value_type],0 + jne invalid_use_of_symbol + rw_value_ok: + cmp eax,0 + jl reserve_negative + mov ecx,eax + mov edx,ecx + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[display_buffer] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_words + lea edi,[edi+ecx*2] + jmp reserved_data + zero_words: + xor eax,eax + shr ecx,1 + jnc words_stosw_ok + stos word [edi] + words_stosw_ok: + rep stos dword [edi] + jmp reserved_data +reserve_dwords: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_dword_value + cmp [next_pass_needed],0 + jne rd_value_ok + cmp [value_type],0 + jne invalid_use_of_symbol + rd_value_ok: + cmp eax,0 + jl reserve_negative + mov ecx,eax + mov edx,ecx + shl edx,1 + jc out_of_memory + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[display_buffer] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_dwords + lea edi,[edi+ecx*4] + jmp reserved_data + zero_dwords: + xor eax,eax + rep stos dword [edi] + jmp reserved_data +reserve_pwords: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_dword_value + cmp [next_pass_needed],0 + jne rp_value_ok + cmp [value_type],0 + jne invalid_use_of_symbol + rp_value_ok: + cmp eax,0 + jl reserve_negative + mov ecx,eax + shl ecx,1 + jc out_of_memory + add ecx,eax + mov edx,ecx + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[display_buffer] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_words + lea edi,[edi+ecx*2] + jmp reserved_data +reserve_qwords: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_dword_value + cmp [next_pass_needed],0 + jne rq_value_ok + cmp [value_type],0 + jne invalid_use_of_symbol + rq_value_ok: + cmp eax,0 + jl reserve_negative + mov ecx,eax + shl ecx,1 + jc out_of_memory + mov edx,ecx + shl edx,1 + jc out_of_memory + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[display_buffer] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_dwords + lea edi,[edi+ecx*4] + jmp reserved_data +reserve_twords: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_dword_value + cmp [next_pass_needed],0 + jne rt_value_ok + cmp [value_type],0 + jne invalid_use_of_symbol + rt_value_ok: + cmp eax,0 + jl reserve_negative + mov ecx,eax + shl ecx,2 + jc out_of_memory + add ecx,eax + mov edx,ecx + shl edx,1 + jc out_of_memory + add edx,edi + jc out_of_memory + cmp edx,[display_buffer] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je zero_words + lea edi,[edi+ecx*2] + jmp reserved_data +align_directive: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_dword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,eax + dec edx + test eax,edx + jnz invalid_value + or eax,eax + jz invalid_value + cmp eax,1 + je instruction_assembled + mov ecx,edi + sub ecx,dword [org_origin] + cmp [org_registers],0 + jne section_not_aligned_enough + cmp [labels_type],0 + je make_alignment + cmp [output_format],3 + je pe_alignment + mov ebx,[org_symbol] + cmp byte [ebx],0 + jne section_not_aligned_enough + cmp eax,[ebx+10h] + jbe make_alignment + jmp section_not_aligned_enough + pe_alignment: + cmp eax,1000h + ja section_not_aligned_enough + make_alignment: + dec eax + and ecx,eax + jz instruction_assembled + neg ecx + add ecx,eax + inc ecx + mov edx,ecx + add edx,edi + jc out_of_memory + cmp edx,[display_buffer] + ja out_of_memory + push edi + cmp [next_pass_needed],0 + je nops + add edi,ecx + jmp reserved_data + nops: + mov eax,90909090h + shr ecx,1 + jnc nops_stosb_ok + stos byte [edi] + nops_stosb_ok: + shr ecx,1 + jnc nops_stosw_ok + stos word [edi] + nops_stosw_ok: + rep stos dword [edi] + jmp reserved_data diff --git a/programs/fasm/trunk/build_en.bat b/programs/fasm/trunk/build_en.bat new file mode 100644 index 0000000000..d8a53beae9 --- /dev/null +++ b/programs/fasm/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm fasm.asm fasm +@pause \ No newline at end of file diff --git a/programs/fasm/trunk/build_ru.bat b/programs/fasm/trunk/build_ru.bat new file mode 100644 index 0000000000..1cc0311843 --- /dev/null +++ b/programs/fasm/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm fasm.asm fasm +@pause \ No newline at end of file diff --git a/programs/fasm/trunk/errors.inc b/programs/fasm/trunk/errors.inc new file mode 100644 index 0000000000..8fe197bd60 --- /dev/null +++ b/programs/fasm/trunk/errors.inc @@ -0,0 +1,131 @@ + +; flat assembler core +; Copyright (c) 1999-2005, Tomasz Grysztar. +; All rights reserved. + +out_of_memory: + call fatal_error + db 'out of memory',0 +stack_overflow: + call fatal_error + db 'out of stack space',0 +main_file_not_found: + call fatal_error + db 'source file not found',0 +unexpected_end_of_file: + call fatal_error + db 'unexpected end of file',0 +code_cannot_be_generated: + call fatal_error + db 'code cannot be generated',0 +format_limitations_exceeded: + call fatal_error + db 'format limitations exceeded',0 +write_failed: + call fatal_error + db 'write failed',0 +file_not_found: + call assembler_error + db 'file not found',0 +error_reading_file: + call assembler_error + db 'error reading file',0 +invalid_file_format: + call assembler_error + db 'invalid file format',0 +invalid_macro_arguments: + call assembler_error + db 'invalid macro arguments',0 +incomplete_macro: + call assembler_error + db 'incomplete macro',0 +unexpected_characters: + call assembler_error + db 'unexpected characters',0 +invalid_argument: + call assembler_error + db 'invalid argument',0 +illegal_instruction: + call assembler_error + db 'illegal instruction',0 +invalid_operand: + call assembler_error + db 'invalid operand',0 +invalid_operand_size: + call assembler_error + db 'invalid size of operand',0 +operand_size_not_specified: + call assembler_error + db 'operand size not specified',0 +operand_sizes_do_not_match: + call assembler_error + db 'operand sizes do not match',0 +invalid_address_size: + call assembler_error + db 'invalid size of address value',0 +address_sizes_do_not_agree: + call assembler_error + db 'address sizes do not agree',0 +prefix_conflict: + call assembler_error + db 'disallowed combination of registers',0 +long_immediate_not_encodable: + call assembler_error + db 'not encodable with long immediate',0 +relative_jump_out_of_range: + call assembler_error + db 'relative jump out of range',0 +invalid_expression: + call assembler_error + db 'invalid expression',0 +invalid_address: + call assembler_error + db 'invalid address',0 +invalid_value: + call assembler_error + db 'invalid value',0 +value_out_of_range: + call assembler_error + db 'value out of range',0 +undefined_symbol: + call assembler_error + db 'undefined symbol',0 +invalid_use_of_symbol: + call assembler_error + db 'invalid use of symbol',0 +name_too_long: + call assembler_error + db 'name too long',0 +invalid_name: + call assembler_error + db 'invalid name',0 +reserved_word_used_as_symbol: + call assembler_error + db 'reserved word used as symbol',0 +symbol_already_defined: + call assembler_error + db 'symbol already defined',0 +missing_end_quote: + call assembler_error + db 'missing end quote',0 +missing_end_directive: + call assembler_error + db 'missing end directive',0 +unexpected_instruction: + call assembler_error + db 'unexpected instruction',0 +extra_characters_on_line: + call assembler_error + db 'extra characters on line',0 +section_not_aligned_enough: + call assembler_error + db 'section is not aligned enough',0 +setting_already_specified: + call assembler_error + db 'setting already specified',0 +data_already_defined: + call assembler_error + db 'data already defined',0 +too_many_repeats: + call assembler_error + db 'too many repeats',0 diff --git a/programs/fasm/trunk/expressi.inc b/programs/fasm/trunk/expressi.inc new file mode 100644 index 0000000000..8dfa42e2d0 --- /dev/null +++ b/programs/fasm/trunk/expressi.inc @@ -0,0 +1,2443 @@ + +; flat assembler core +; Copyright (c) 1999-2005, Tomasz Grysztar. +; All rights reserved. + +convert_expression: + push ebp + call get_fp_value + jnc fp_expression + mov ebp,esp + expression_loop: + push ebp edi + mov edi,single_operand_operators + call get_operator + pop edi + push eax + mov al,[esi] + cmp al,1Ah + je expression_number + cmp al,22h + je expression_number + cmp al,'(' + je expression_number + mov al,11h + stos byte [edi] + or eax,-1 + stos dword [edi] + jmp expression_number_ok + expression_number: + call convert_number + expression_number_ok: + pop eax + or al,al + jz expression_operator + stos byte [edi] + expression_operator: + push edi + mov edi,operators + call get_operator + pop edi ebp + or al,al + jz expression_end + operators_loop: + cmp esp,ebp + je push_operator + mov bl,al + and bl,0F0h + mov bh,byte [esp] + and bh,0F0h + cmp bl,bh + ja push_operator + pop ebx + mov byte [edi],bl + inc edi + jmp operators_loop + push_operator: + push eax + jmp expression_loop + expression_end: + cmp esp,ebp + je expression_converted + pop eax + stos byte [edi] + jmp expression_end + expression_converted: + pop ebp + ret + fp_expression: + mov al,'.' + stos byte [edi] + mov eax,[fp_value] + stos dword [edi] + mov eax,[fp_value+4] + stos dword [edi] + mov eax,[fp_value+8] + stos dword [edi] + pop ebp + ret + +convert_number: + cmp byte [esi],'(' + je expression_value + inc edi + call get_number + jc symbol_value + or ebp,ebp + jz valid_number + mov byte [edi-1],0Fh + ret + valid_number: + cmp dword [edi+4],0 + jne qword_number + cmp word [edi+2],0 + jne dword_number + cmp byte [edi+1],0 + jne word_number + byte_number: + mov byte [edi-1],1 + inc edi + ret + qword_number: + mov byte [edi-1],8 + add edi,8 + ret + dword_number: + mov byte [edi-1],4 + scas dword [edi] + ret + word_number: + mov byte [edi-1],2 + scas word [edi] + ret + expression_value: + mov eax,esp + sub eax,100h + jc stack_overflow + cmp eax,[stack_limit] + jb stack_overflow + inc esi + call convert_expression + lods byte [esi] + cmp al,')' + jne invalid_expression + ret + symbol_value: + lods byte [esi] + cmp al,1Ah + jne invalid_value + lods byte [esi] + movzx ecx,al + push ecx esi edi + mov edi,address_registers + call get_symbol + jnc register_value + mov edi,directive_operators + call get_symbol + pop edi esi ecx + jnc broken_value + call get_label_id + store_label_value: + mov byte [edi-1],11h + stos dword [edi] + ret + broken_value: + sub esi,2 + or eax,-1 + jmp store_label_value + register_value: + pop edi + add esp,8 + mov byte [edi-1],10h + mov al,ah + stos byte [edi] + ret + +get_number: + xor ebp,ebp + lods byte [esi] + cmp al,22h + je get_text_number + cmp al,1Ah + jne not_number + lods byte [esi] + movzx ecx,al + mov [number_start],esi + mov al,[esi] + cmp al,'$' + je number_begin + sub al,30h + cmp al,9 + ja invalid_number + number_begin: + mov ebx,esi + add esi,ecx + push esi + dec esi + mov dword [edi],0 + mov dword [edi+4],0 + cmp byte [ebx],'$' + je pascal_hex_number + cmp word [ebx],'0x' + je get_hex_number + mov al,[esi] + dec esi + cmp al,'h' + je get_hex_number + cmp al,'b' + je get_bin_number + cmp al,'d' + je get_dec_number + cmp al,'o' + je get_oct_number + cmp al,'H' + je get_hex_number + cmp al,'B' + je get_bin_number + cmp al,'D' + je get_dec_number + cmp al,'O' + je get_oct_number + inc esi + get_dec_number: + mov ebx,esi + mov esi,[number_start] + get_dec_digit: + cmp esi,ebx + ja number_ok + xor edx,edx + mov eax,[edi] + shld edx,eax,2 + shl eax,2 + add eax,[edi] + adc edx,0 + add eax,eax + adc edx,edx + mov [edi],eax + mov eax,[edi+4] + add eax,eax + jc dec_out_of_range + add eax,eax + jc dec_out_of_range + add eax,[edi+4] + jc dec_out_of_range + add eax,eax + jc dec_out_of_range + add eax,edx + jc dec_out_of_range + mov [edi+4],eax + movzx eax,byte [esi] + sub al,30h + cmp al,9 + ja bad_number + add [edi],eax + adc dword [edi+4],0 + jc dec_out_of_range + inc esi + jmp get_dec_digit + dec_out_of_range: + or ebp,-1 + inc esi + jmp get_dec_digit + bad_number: + pop eax + invalid_number: + mov esi,[number_start] + dec esi + not_number: + dec esi + stc + ret + get_bin_number: + xor bl,bl + get_bin_digit: + cmp esi,[number_start] + jb number_ok + movzx eax,byte [esi] + sub al,30h + cmp al,1 + ja bad_number + xor edx,edx + mov cl,bl + dec esi + cmp bl,64 + je bin_out_of_range + inc bl + cmp cl,32 + jae bin_digit_high + shl eax,cl + or dword [edi],eax + jmp get_bin_digit + bin_digit_high: + sub cl,32 + shl eax,cl + or dword [edi+4],eax + jmp get_bin_digit + bin_out_of_range: + or al,al + jz get_bin_digit + or ebp,-1 + jmp get_bin_digit + pascal_hex_number: + cmp cl,1 + je bad_number + get_hex_number: + xor bl,bl + get_hex_digit: + cmp esi,[number_start] + jb number_ok + movzx eax,byte [esi] + cmp al,'x' + je hex_number_ok + cmp al,'$' + je pascal_hex_ok + sub al,30h + cmp al,9 + jbe hex_digit_ok + sub al,7 + cmp al,15 + jbe hex_letter_digit_ok + sub al,20h + cmp al,15 + ja bad_number + hex_letter_digit_ok: + cmp al,10 + jb bad_number + hex_digit_ok: + xor edx,edx + mov cl,bl + dec esi + cmp bl,64 + je hex_out_of_range + add bl,4 + cmp cl,32 + jae hex_digit_high + shl eax,cl + or dword [edi],eax + jmp get_hex_digit + hex_digit_high: + sub cl,32 + shl eax,cl + or dword [edi+4],eax + jmp get_hex_digit + hex_out_of_range: + or al,al + jz get_hex_digit + or ebp,-1 + jmp get_hex_digit + get_oct_number: + xor bl,bl + get_oct_digit: + cmp esi,[number_start] + jb number_ok + movzx eax,byte [esi] + sub al,30h + cmp al,7 + ja bad_number + oct_digit_ok: + xor edx,edx + mov cl,bl + dec esi + cmp bl,64 + jae oct_out_of_range + add bl,3 + cmp cl,30 + je oct_digit_wrap + ja oct_digit_high + shl eax,cl + or dword [edi],eax + jmp get_oct_digit + oct_digit_wrap: + shl eax,cl + adc dword [edi+4],0 + or dword [edi],eax + jmp get_oct_digit + oct_digit_high: + sub cl,32 + shl eax,cl + or dword [edi+4],eax + jmp get_oct_digit + oct_out_of_range: + or al,al + jz get_oct_digit + or ebp,-1 + jmp get_oct_digit + hex_number_ok: + dec esi + pascal_hex_ok: + cmp esi,[number_start] + jne bad_number + number_ok: + pop esi + number_done: + clc + ret + get_text_number: + lods dword [esi] + mov edx,eax + xor bl,bl + mov dword [edi],0 + mov dword [edi+4],0 + get_text_character: + sub edx,1 + jc number_done + movzx eax,byte [esi] + inc esi + mov cl,bl + cmp bl,64 + je text_out_of_range + add bl,8 + cmp cl,32 + jae text_character_high + shl eax,cl + or dword [edi],eax + jmp get_text_character + text_character_high: + sub cl,32 + shl eax,cl + or dword [edi+4],eax + jmp get_text_character + text_out_of_range: + or ebp,-1 + jmp get_text_character + +get_fp_value: + push edi esi + lods byte [esi] + cmp al,1Ah + je fp_value_start + cmp al,'-' + je fp_sign_ok + cmp al,'+' + jne not_fp_value + fp_sign_ok: + lods byte [esi] + cmp al,1Ah + jne not_fp_value + fp_value_start: + lods byte [esi] + movzx ecx,al + cmp cl,1 + jbe not_fp_value + lea edx,[esi+1] + xor ah,ah + check_fp_value: + lods byte [esi] + cmp al,'.' + je fp_character_dot + cmp al,'E' + je fp_character_exp + cmp al,'e' + je fp_character_exp + cmp al,'F' + je fp_last_character + cmp al,'f' + je fp_last_character + digit_expected: + cmp al,'0' + jb not_fp_value + cmp al,'9' + ja not_fp_value + jmp fp_character_ok + fp_character_dot: + cmp esi,edx + je not_fp_value + or ah,ah + jnz not_fp_value + or ah,1 + lods byte [esi] + loop digit_expected + not_fp_value: + pop esi edi + stc + ret + fp_character_exp: + cmp esi,edx + je not_fp_value + cmp ah,1 + ja not_fp_value + or ah,2 + cmp ecx,1 + jne fp_character_ok + cmp byte [esi],'+' + je fp_exp_sign + cmp byte [esi],'-' + jne fp_character_ok + fp_last_character: + cmp cl,1 + jne not_fp_value + or ah,4 + jmp fp_character_ok + fp_exp_sign: + inc esi + cmp byte [esi],1Ah + jne not_fp_value + inc esi + lods byte [esi] + movzx ecx,al + inc ecx + fp_character_ok: + dec ecx + jnz check_fp_value + or ah,ah + jz not_fp_value + pop esi + lods byte [esi] + mov [fp_sign],0 + cmp al,1Ah + je fp_get + inc esi + cmp al,'+' + je fp_get + mov [fp_sign],1 + fp_get: + lods byte [esi] + movzx ecx,al + xor edx,edx + mov edi,fp_value + mov [edi],edx + mov [edi+4],edx + mov [edi+12],edx + call fp_optimize + mov [fp_format],0 + mov al,[esi] + fp_before_dot: + lods byte [esi] + cmp al,'.' + je fp_dot + cmp al,'E' + je fp_exponent + cmp al,'e' + je fp_exponent + cmp al,'F' + je fp_done + cmp al,'f' + je fp_done + sub al,30h + mov edi,fp_value+16 + xor edx,edx + mov dword [edi+12],edx + mov dword [edi],edx + mov dword [edi+4],edx + mov [edi+7],al + mov dl,7 + mov dword [edi+8],edx + call fp_optimize + mov edi,fp_value + push ecx + mov ecx,10 + call fp_mul + pop ecx + mov ebx,fp_value+16 + call fp_add + loop fp_before_dot + fp_dot: + mov edi,fp_value+16 + xor edx,edx + mov [edi],edx + mov [edi+4],edx + mov byte [edi+7],80h + mov [edi+8],edx + mov dword [edi+12],edx + dec ecx + jz fp_done + fp_after_dot: + lods byte [esi] + cmp al,'E' + je fp_exponent + cmp al,'e' + je fp_exponent + cmp al,'F' + je fp_done + cmp al,'f' + je fp_done + inc [fp_format] + cmp [fp_format],80h + jne fp_counter_ok + mov [fp_format],7Fh + fp_counter_ok: + dec esi + mov edi,fp_value+16 + push ecx + mov ecx,10 + call fp_div + push dword [edi] + push dword [edi+4] + push dword [edi+8] + push dword [edi+12] + lods byte [esi] + sub al,30h + movzx ecx,al + call fp_mul + mov ebx,edi + mov edi,fp_value + call fp_add + mov edi,fp_value+16 + pop dword [edi+12] + pop dword [edi+8] + pop dword [edi+4] + pop dword [edi] + pop ecx + loop fp_after_dot + jmp fp_done + fp_exponent: + or [fp_format],80h + xor edx,edx + xor ebp,ebp + dec ecx + jnz get_exponent + cmp byte [esi],'+' + je fp_exponent_sign + cmp byte [esi],'-' + jne fp_done + not ebp + fp_exponent_sign: + add esi,2 + lods byte [esi] + movzx ecx,al + get_exponent: + movzx eax,byte [esi] + inc esi + sub al,30h + cmp al,10 + jae exponent_ok + imul edx,10 + cmp edx,8000h + jae value_out_of_range + add edx,eax + loop get_exponent + exponent_ok: + mov edi,fp_value + or edx,edx + jz fp_done + mov ecx,edx + or ebp,ebp + jnz fp_negative_power + fp_power: + push ecx + mov ecx,10 + call fp_mul + pop ecx + loop fp_power + jmp fp_done + fp_negative_power: + push ecx + mov ecx,10 + call fp_div + pop ecx + loop fp_negative_power + fp_done: + mov edi,fp_value + mov al,[fp_format] + mov [edi+10],al + mov al,[fp_sign] + mov [edi+11],al + test byte [edi+15],80h + jz fp_ok + add dword [edi],1 + adc dword [edi+4],0 + jnc fp_ok + mov eax,[edi+4] + shrd [edi],eax,1 + shr eax,1 + or eax,80000000h + mov [edi+4],eax + inc word [edi+8] + fp_ok: + pop edi + clc + ret + fp_mul: + or ecx,ecx + jz fp_zero + mov eax,[edi+12] + mul ecx + mov [edi+12],eax + mov ebx,edx + mov eax,[edi] + mul ecx + add eax,ebx + adc edx,0 + mov [edi],eax + mov ebx,edx + mov eax,[edi+4] + mul ecx + add eax,ebx + adc edx,0 + mov [edi+4],eax + .loop: + or edx,edx + jz .done + mov eax,[edi] + shrd [edi+12],eax,1 + mov eax,[edi+4] + shrd [edi],eax,1 + shrd eax,edx,1 + mov [edi+4],eax + shr edx,1 + inc dword [edi+8] + cmp dword [edi+8],8000h + jge value_out_of_range + jmp .loop + .done: + ret + fp_div: + mov eax,[edi+4] + xor edx,edx + div ecx + mov [edi+4],eax + mov eax,[edi] + div ecx + mov [edi],eax + mov eax,[edi+12] + div ecx + mov [edi+12],eax + mov ebx,eax + or ebx,[edi] + or ebx,[edi+4] + jz fp_zero + .loop: + test byte [edi+7],80h + jnz .exp_ok + mov eax,[edi] + shld [edi+4],eax,1 + mov eax,[edi+12] + shld [edi],eax,1 + add eax,eax + mov [edi+12],eax + dec dword [edi+8] + add edx,edx + jmp .loop + .exp_ok: + mov eax,edx + xor edx,edx + div ecx + add [edi+12],eax + adc dword [edi],0 + adc dword [edi+4],0 + jnc .done + mov eax,[edi+4] + mov ebx,[edi] + shrd [edi],eax,1 + shrd [edi+12],ebx,1 + shr eax,1 + or eax,80000000h + mov [edi+4],eax + inc dword [edi+8] + .done: + ret + fp_add: + cmp dword [ebx+8],8000h + je .done + cmp dword [edi+8],8000h + je .copy + mov eax,[ebx+8] + cmp eax,[edi+8] + jge .exp_ok + mov eax,[edi+8] + .exp_ok: + call .change_exp + xchg ebx,edi + call .change_exp + xchg ebx,edi + mov edx,[ebx+12] + mov eax,[ebx] + mov ebx,[ebx+4] + add [edi+12],edx + adc [edi],eax + adc [edi+4],ebx + jnc .done + mov eax,[edi] + shrd [edi+12],eax,1 + mov eax,[edi+4] + shrd [edi],eax,1 + shr eax,1 + or eax,80000000h + mov [edi+4],eax + inc dword [edi+8] + .done: + ret + .copy: + mov eax,[ebx] + mov [edi],eax + mov eax,[ebx+4] + mov [edi+4],eax + mov eax,[ebx+8] + mov [edi+8],eax + mov eax,[ebx+12] + mov [edi+12],eax + ret + .change_exp: + push ecx + mov ecx,eax + sub ecx,[ebx+8] + mov edx,[ebx+4] + jecxz .exp_done + .exp_loop: + mov ebp,[ebx] + shrd [ebx+12],ebp,1 + shrd [ebx],edx,1 + shr edx,1 + inc dword [ebx+8] + loop .exp_loop + .exp_done: + mov [ebx+4],edx + pop ecx + ret + fp_optimize: + mov eax,[edi] + mov ebp,[edi+4] + or ebp,[edi] + or ebp,[edi+12] + jz fp_zero + .loop: + test byte [edi+7],80h + jnz .done + shld [edi+4],eax,1 + mov ebp,[edi+12] + shld eax,ebp,1 + mov [edi],eax + shl dword [edi+12],1 + dec dword [edi+8] + jmp .loop + .done: + ret + fp_zero: + mov dword [edi+8],8000h + ret + +calculate_expression: + mov [current_offset],edi + mov [value_undefined],0 + calculation_loop: + lods byte [esi] + or al,al + jz get_string_value + cmp al,'.' + je convert_fp + cmp al,1 + je get_byte_number + cmp al,2 + je get_word_number + cmp al,4 + je get_dword_number + cmp al,8 + je get_qword_number + cmp al,0Fh + je value_out_of_range + cmp al,10h + je get_register + cmp al,11h + je get_label + cmp al,')' + je expression_calculated + cmp al,']' + je expression_calculated + sub edi,14h + mov ebx,edi + sub ebx,14h + cmp al,0E0h + je calculate_rva + cmp al,0D0h + je calculate_not + cmp al,0D1h + je calculate_neg + mov dx,[ebx+8] + or dx,[edi+8] + cmp al,80h + je calculate_add + cmp al,81h + je calculate_sub + mov ah,[ebx+12] + or ah,[edi+12] + jz absolute_values_calculation + cmp [error_line],0 + jne absolute_values_calculation + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_use_of_symbol + absolute_values_calculation: + cmp al,90h + je calculate_mul + cmp al,91h + je calculate_div + or dx,dx + jnz invalid_expression + cmp al,0A0h + je calculate_mod + cmp al,0B0h + je calculate_and + cmp al,0B1h + je calculate_or + cmp al,0B2h + je calculate_xor + cmp al,0C0h + je calculate_shl + cmp al,0C1h + je calculate_shr + jmp invalid_expression + expression_calculated: + sub edi,14h + cmp [value_undefined],0 + je expression_value_ok + xor eax,eax + mov [edi],eax + mov [edi+4],eax + expression_value_ok: + ret + get_byte_number: + mov word [edi+8],0 + mov byte [edi+12],0 + xor eax,eax + lods byte [esi] + stos dword [edi] + xor al,al + stos dword [edi] + add edi,0Ch + jmp calculation_loop + get_word_number: + mov word [edi+8],0 + mov byte [edi+12],0 + xor eax,eax + lods word [esi] + stos dword [edi] + xor ax,ax + stos dword [edi] + add edi,0Ch + jmp calculation_loop + get_dword_number: + mov word [edi+8],0 + mov byte [edi+12],0 + movs dword [edi],[esi] + xor eax,eax + stos dword [edi] + add edi,0Ch + jmp calculation_loop + get_qword_number: + mov word [edi+8],0 + mov byte [edi+12],0 + movs dword [edi],[esi] + movs dword [edi],[esi] + add edi,0Ch + jmp calculation_loop + get_register: + mov byte [edi+9],0 + mov byte [edi+12],0 + lods byte [esi] + mov [edi+8],al + mov byte [edi+10],1 + xor eax,eax + stos dword [edi] + stos dword [edi] + add edi,0Ch + jmp calculation_loop + get_label: + xor eax,eax + mov [edi+8],eax + mov [edi+12],al + mov [edi+20],eax + lods dword [esi] + cmp eax,0Fh + jb predefined_label + je reserved_word_used_as_symbol + cmp eax,-1 + je invalid_expression + mov ebx,eax + mov ax,[current_pass] + mov [ebx+18],ax + or byte [ebx+8],8 + test byte [ebx+8],1 + jz label_undefined + cmp ax,[ebx+16] + je label_defined + test byte [ebx+8],4 + jnz label_undefined + test byte [ebx+9],1 + jz label_defined + mov eax,[ebx] + sub eax,dword [adjustment] + stos dword [edi] + mov eax,[ebx+4] + sbb eax,dword [adjustment+4] + stos dword [edi] + mov eax,dword [adjustment] + or eax,dword [adjustment+4] + jz got_label + or [next_pass_needed],-1 + jmp got_label + label_defined: + mov eax,[ebx] + stos dword [edi] + mov eax,[ebx+4] + stos dword [edi] + got_label: + mov al,[ebx+11] + mov [edi-8+12],al + mov eax,[ebx+12] + mov [edi-8+8],eax + mov eax,[ebx+20] + mov [edi-8+16],eax + add edi,0Ch + mov al,[ebx+10] + or al,al + jz calculation_loop + cmp [size_override],-1 + je calculation_loop + cmp [size_override],0 + je check_size + cmp [operand_size],0 + jne calculation_loop + mov [operand_size],al + jmp calculation_loop + check_size: + xchg [operand_size],al + or al,al + jz calculation_loop + cmp al,[operand_size] + jne operand_sizes_do_not_match + jmp calculation_loop + current_offset_label: + mov al,[labels_type] + mov [edi+12],al + mov eax,[org_symbol] + mov [edi+16],eax + mov eax,[current_offset] + xor edx,edx + sub eax,dword [org_origin] + sbb edx,dword [org_origin+4] + stos dword [edi] + mov eax,edx + stos dword [edi] + mov eax,[org_registers] + stos dword [edi] + add edi,8 + jmp calculation_loop + org_origin_label: + mov al,[labels_type] + mov [edi+12],al + mov eax,[org_symbol] + mov [edi+16],eax + mov eax,[org_start] + xor edx,edx + sub eax,dword [org_origin] + sbb edx,dword [org_origin+4] + stos dword [edi] + mov eax,edx + stos dword [edi] + mov eax,[org_registers] + stos dword [edi] + add edi,8 + jmp calculation_loop + counter_label: + mov eax,[counter] + make_dword_label_value: + stos dword [edi] + xor eax,eax + stos dword [edi] + add edi,0Ch + jmp calculation_loop + timestamp_label: + call make_timestamp + jmp make_dword_label_value + predefined_label: + or eax,eax + jz current_offset_label + cmp eax,1 + je counter_label + cmp eax,2 + je timestamp_label + cmp eax,3 + je org_origin_label + label_undefined: + cmp [current_pass],1 + jbe force_next_pass + cmp [error_line],0 + jne undefined_value + mov eax,[current_line] + mov [error_line],eax + mov [error],undefined_symbol + jmp undefined_value + force_next_pass: + or [next_pass_needed],-1 + undefined_value: + mov byte [edi+12],0 + or [value_undefined],-1 + xor eax,eax + stos dword [edi] + stos dword [edi] + add edi,0Ch + jmp calculation_loop + calculate_add: + mov ecx,[ebx+16] + cmp byte [edi+12],0 + je add_values + mov ecx,[edi+16] + cmp byte [ebx+12],0 + je add_values + cmp [error_line],0 + jne add_values + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_use_of_symbol + add_values: + mov al,[edi+12] + or [ebx+12],al + mov [ebx+16],ecx + mov eax,[edi] + add [ebx],eax + mov eax,[edi+4] + adc [ebx+4],eax + or dx,dx + jz calculation_loop + push esi + mov esi,ebx + lea ebx,[edi+10] + mov cl,[edi+8] + call add_register + lea ebx,[edi+11] + mov cl,[edi+9] + call add_register + pop esi + jmp calculation_loop + add_register: + or cl,cl + jz add_register_done + add_register_start: + cmp [esi+8],cl + jne add_in_second_slot + mov al,[ebx] + add [esi+10],al + jnz add_register_done + mov byte [esi+8],0 + ret + add_in_second_slot: + cmp [esi+9],cl + jne create_in_first_slot + mov al,[ebx] + add [esi+11],al + jnz add_register_done + mov byte [esi+9],0 + ret + create_in_first_slot: + cmp byte [esi+8],0 + jne create_in_second_slot + mov [esi+8],cl + mov al,[ebx] + mov [esi+10],al + ret + create_in_second_slot: + cmp byte [esi+9],0 + jne invalid_expression + mov [esi+9],cl + mov al,[ebx] + mov [esi+11],al + add_register_done: + ret + calculate_sub: + xor ah,ah + mov ah,[ebx+12] + mov al,[edi+12] + or al,al + jz sub_values + cmp al,ah + jne invalid_sub + xor ah,ah + mov ecx,[edi+16] + cmp ecx,[ebx+16] + je sub_values + cmp ecx,[org_symbol] + jne invalid_sub + test byte [ebx+12],1 + jnz invalid_sub + mov ah,3 + sub_values: + mov [ebx+12],ah + mov eax,[edi] + sub [ebx],eax + mov eax,[edi+4] + sbb [ebx+4],eax + or dx,dx + jz calculation_loop + push esi + mov esi,ebx + lea ebx,[edi+10] + mov cl,[edi+8] + call sub_register + lea ebx,[edi+11] + mov cl,[edi+9] + call sub_register + pop esi + jmp calculation_loop + invalid_sub: + cmp [error_line],0 + jne sub_values + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_use_of_symbol + jmp sub_values + sub_register: + or cl,cl + jz add_register_done + neg byte [ebx] + jmp add_register_start + calculate_mul: + or dx,dx + jz mul_start + cmp word [ebx+8],0 + jne mul_start + mov eax,[ebx] + xchg eax,[edi] + mov [ebx],eax + mov eax,[ebx+4] + xchg eax,[edi+4] + mov [ebx+4],eax + mov eax,[ebx+8] + xchg eax,[edi+8] + mov [ebx+8],eax + mov eax,[ebx+12] + xchg eax,[edi+12] + mov [ebx+12],eax + mul_start: + push esi edx + mov esi,ebx + xor bl,bl + bt dword [esi+4],31 + jnc mul_first_sign_ok + not dword [esi] + not dword [esi+4] + add dword [esi],1 + adc dword [esi+4],0 + not bl + mul_first_sign_ok: + bt dword [edi+4],31 + jnc mul_second_sign_ok + not dword [edi] + not dword [edi+4] + add dword [edi],1 + adc dword [edi+4],0 + not bl + mul_second_sign_ok: + cmp dword [esi+4],0 + jz mul_numbers + cmp dword [edi+4],0 + jnz value_out_of_range + mul_numbers: + mov eax,[esi+4] + mul dword [edi] + or edx,edx + jnz value_out_of_range + mov ecx,eax + mov eax,[esi] + mul dword [edi+4] + or edx,edx + jnz value_out_of_range + add ecx,eax + jc value_out_of_range + mov eax,[esi] + mul dword [edi] + add edx,ecx + jc value_out_of_range + test edx,1 shl 31 + jnz value_out_of_range + mov [esi],eax + mov [esi+4],edx + or bl,bl + jz mul_ok + not dword [esi] + not dword [esi+4] + add dword [esi],1 + adc dword [esi+4],0 + mul_ok: + pop edx + or dx,dx + jz mul_calculated + cmp word [edi+8],0 + jne invalid_value + cmp byte [esi+8],0 + je mul_first_register_ok + mov al,[edi] + cbw + cwde + cdq + cmp edx,[edi+4] + jne value_out_of_range + cmp eax,[edi] + jne value_out_of_range + imul byte [esi+10] + mov dl,ah + cbw + cmp ah,dl + jne value_out_of_range + mov [esi+10],al + mul_first_register_ok: + cmp byte [esi+9],0 + je mul_calculated + mov al,[edi] + cbw + cwde + cdq + cmp edx,[edi+4] + jne value_out_of_range + cmp eax,[edi] + jne value_out_of_range + imul byte [esi+11] + mov dl,ah + cbw + cmp ah,dl + jne value_out_of_range + mov [esi+11],al + mul_calculated: + pop esi + jmp calculation_loop + calculate_div: + push esi edx + mov esi,ebx + call div_64 + pop edx + or dx,dx + jz div_calculated + cmp byte [esi+8],0 + je div_first_register_ok + mov al,[edi] + cbw + cwde + cdq + cmp edx,[edi+4] + jne value_out_of_range + cmp eax,[edi] + jne value_out_of_range + or al,al + jz value_out_of_range + mov al,[esi+10] + cbw + idiv byte [edi] + mov [esi+10],al + div_first_register_ok: + cmp byte [esi+9],0 + je div_calculated + mov al,[edi] + cbw + cwde + cdq + cmp edx,[edi+4] + jne value_out_of_range + cmp eax,[edi] + jne value_out_of_range + or al,al + jz value_out_of_range + mov al,[esi+11] + cbw + idiv byte [edi] + mov [esi+11],al + div_calculated: + pop esi + jmp calculation_loop + calculate_mod: + push esi + mov esi,ebx + call div_64 + mov [esi],eax + mov [esi+4],edx + pop esi + jmp calculation_loop + calculate_and: + mov eax,[edi] + and [ebx],eax + mov eax,[edi+4] + and [ebx+4],eax + jmp calculation_loop + calculate_or: + mov eax,[edi] + or [ebx],eax + mov eax,[edi+4] + or [ebx+4],eax + jmp calculation_loop + calculate_xor: + mov eax,[edi] + xor [ebx],eax + mov eax,[edi+4] + xor [ebx+4],eax + jmp calculation_loop + shr_negative: + not dword [edi] + not dword [edi+4] + add dword [edi],1 + adc dword [edi+4],0 + calculate_shl: + mov eax,dword [edi+4] + bt eax,31 + jc shl_negative + or eax,eax + jnz zero_value + mov ecx,[edi] + cmp ecx,64 + jae zero_value + cmp ecx,32 + jae shl_high + mov edx,[ebx+4] + mov eax,[ebx] + shld edx,eax,cl + shl eax,cl + mov [ebx],eax + mov [ebx+4],edx + jmp calculation_loop + shl_high: + sub cl,32 + mov eax,[ebx] + shl eax,cl + mov [ebx+4],eax + mov dword [ebx],0 + jmp calculation_loop + shl_negative: + not dword [edi] + not dword [edi+4] + add dword [edi],1 + adc dword [edi+4],0 + calculate_shr: + mov eax,dword [edi+4] + bt eax,31 + jc shr_negative + or eax,eax + jnz zero_value + mov ecx,[edi] + cmp ecx,64 + jae zero_value + cmp ecx,32 + jae shr_high + mov edx,[ebx+4] + mov eax,[ebx] + shrd eax,edx,cl + shr edx,cl + mov [ebx],eax + mov [ebx+4],edx + jmp calculation_loop + shr_high: + sub cl,32 + mov eax,[ebx+4] + shr eax,cl + mov [ebx],eax + mov dword [ebx+4],0 + jmp calculation_loop + zero_value: + mov dword [ebx],0 + mov dword [ebx+4],0 + jmp calculation_loop + calculate_not: + cmp word [edi+8],0 + jne invalid_expression + cmp byte [edi+12],0 + je not_ok + cmp [error_line],0 + jne not_ok + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_use_of_symbol + not_ok: + cmp [value_size],1 + je not_byte + cmp [value_size],2 + je not_word + cmp [value_size],4 + je not_dword + cmp [value_size],6 + je not_pword + not_qword: + not dword [edi] + not dword [edi+4] + add edi,14h + jmp calculation_loop + not_byte: + cmp dword [edi+4],0 + jne not_qword + cmp word [edi+2],0 + jne not_qword + cmp byte [edi+1],0 + jne not_qword + not byte [edi] + add edi,14h + jmp calculation_loop + not_word: + cmp dword [edi+4],0 + jne not_qword + cmp word [edi+2],0 + jne not_qword + not word [edi] + add edi,14h + jmp calculation_loop + not_dword: + cmp dword [edi+4],0 + jne not_qword + not dword [edi] + add edi,14h + jmp calculation_loop + not_pword: + cmp word [edi+6],0 + jne not_qword + not dword [edi] + not word [edi+4] + add edi,14h + jmp calculation_loop + calculate_neg: + cmp word [edi+8],0 + jne invalid_expression + cmp byte [edi+12],0 + je neg_ok + cmp [error_line],0 + jne neg_ok + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_use_of_symbol + neg_ok: + mov eax,[edi] + mov edx,[edi+4] + mov dword [edi],0 + mov dword [edi+4],0 + sub [edi],eax + sbb [edi+4],edx + add edi,14h + jmp calculation_loop + calculate_rva: + cmp [output_format],3 + jne invalid_expression + cmp word [edi+8],0 + jne invalid_expression + test [format_flags],8 + jnz pe64_rva + cmp byte [edi+12],2 + je rva_ok + cmp [error_line],0 + jne rva_ok + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_use_of_symbol + rva_ok: + mov byte [edi+12],0 + mov eax,[code_start] + mov eax,[eax+34h] + cdq + sub [edi],eax + sbb [edi+4],edx + add edi,14h + jmp calculation_loop + pe64_rva: + cmp byte [edi+12],4 + je pe64_rva_ok + cmp [error_line],0 + jne pe64_rva_ok + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_use_of_symbol + pe64_rva_ok: + mov byte [edi+12],0 + mov eax,[code_start] + mov edx,[eax+34h] + mov eax,[eax+30h] + sub [edi],eax + sbb [edi+4],edx + add edi,14h + jmp calculation_loop + div_64: + xor ebx,ebx + cmp dword [edi],0 + jne divider_ok + cmp dword [edi+4],0 + jne divider_ok + cmp [next_pass_needed],0 + je value_out_of_range + jmp div_done + divider_ok: + bt dword [esi+4],31 + jnc div_first_sign_ok + not dword [esi] + not dword [esi+4] + add dword [esi],1 + adc dword [esi+4],0 + not bx + div_first_sign_ok: + bt dword [edi+4],31 + jnc div_second_sign_ok + not dword [edi] + not dword [edi+4] + add dword [edi],1 + adc dword [edi+4],0 + not bl + div_second_sign_ok: + cmp dword [edi+4],0 + jne div_high + mov ecx,[edi] + mov eax,[esi+4] + xor edx,edx + div ecx + mov [esi+4],eax + mov eax,[esi] + div ecx + mov [esi],eax + mov eax,edx + xor edx,edx + jmp div_done + div_high: + mov eax,[esi+4] + xor edx,edx + div dword [edi+4] + mov ebx,[esi] + mov [esi],eax + mov dword [esi+4],0 + mov ecx,edx + mul dword [edi] + div_high_loop: + cmp ecx,edx + ja div_high_done + jb div_high_large_correction + cmp ebx,eax + jae div_high_done + div_high_correction: + dec dword [esi] + sub eax,[edi] + sbb edx,[edi+4] + jnc div_high_loop + div_high_done: + sub ebx,eax + sbb ecx,edx + mov edx,ecx + mov eax,ebx + ret + div_high_large_correction: + push eax edx + mov eax,edx + sub eax,ecx + xor edx,edx + div dword [edi+4] + shr eax,1 + jz div_high_small_correction + sub [esi],eax + push eax + mul dword [edi+4] + sub dword [esp+4],eax + pop eax + mul dword [edi] + sub dword [esp+4],eax + sbb dword [esp],edx + pop edx eax + jmp div_high_loop + div_high_small_correction: + pop edx eax + jmp div_high_correction + div_done: + or bh,bh + jz remainder_ok + not eax + not edx + add eax,1 + adc edx,0 + remainder_ok: + or bl,bl + jz div_ok + not dword [esi] + not dword [esi+4] + add dword [esi],1 + adc dword [esi+4],0 + div_ok: + ret + convert_fp: + mov word [edi+8],0 + mov byte [edi+12],0 + mov al,[value_size] + cmp al,4 + je convert_fp_dword + cmp al,8 + je convert_fp_qword + jmp invalid_value + convert_fp_dword: + xor eax,eax + cmp word [esi+8],8000h + je fp_dword_store + mov bx,[esi+8] + mov eax,[esi+4] + shl eax,1 + shr eax,9 + jnc fp_dword_ok + inc eax + bt eax,23 + jnc fp_dword_ok + and eax,1 shl 23 - 1 + inc bx + shr eax,1 + fp_dword_ok: + add bx,7Fh + cmp bx,100h + jae value_out_of_range + shl ebx,23 + or eax,ebx + fp_dword_store: + mov bl,[esi+11] + shl ebx,31 + or eax,ebx + mov [edi],eax + xor eax,eax + mov [edi+4],eax + add esi,13 + ret + convert_fp_qword: + xor eax,eax + xor edx,edx + cmp word [esi+8],8000h + je fp_qword_store + mov bx,[esi+8] + mov eax,[esi] + mov edx,[esi+4] + add eax,eax + adc edx,edx + mov ecx,edx + shr edx,12 + shrd eax,ecx,12 + jnc fp_qword_ok + add eax,1 + adc edx,0 + bt edx,20 + jnc fp_qword_ok + and edx,1 shl 20 - 1 + inc bx + shr edx,1 + rcr eax,1 + fp_qword_ok: + add bx,3FFh + cmp bx,800h + jae value_out_of_range + shl ebx,20 + or edx,ebx + fp_qword_store: + mov bl,[esi+11] + shl ebx,31 + or edx,ebx + mov [edi],eax + mov [edi+4],edx + add esi,13 + ret + get_string_value: + lods dword [esi] + mov ecx,eax + cmp ecx,8 + ja value_out_of_range + mov edx,edi + xor eax,eax + stos dword [edi] + stos dword [edi] + mov edi,edx + rep movs byte [edi],[esi] + mov edi,edx + inc esi + mov word [edi+8],0 + mov byte [edi+12],0 + ret + +get_byte_value: + mov [value_size],1 + mov [size_override],-1 + call calculate_expression + mov eax,[edi+16] + mov [symbol_identifier],eax + mov [value_type],0 + cmp word [edi+8],0 + jne invalid_value + cmp byte [edi+12],0 + je check_byte_value + cmp [error_line],0 + jne check_byte_value + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_use_of_symbol + check_byte_value: + mov eax,[edi] + mov edx,[edi+4] + or edx,edx + jz byte_positive + cmp edx,-1 + jne range_exceeded + cmp eax,-80h + jb range_exceeded + ret + byte_positive: + cmp eax,100h + jae range_exceeded + return_byte_value: + ret + range_exceeded: + xor eax,eax + xor edx,edx + cmp [error_line],0 + jne return_byte_value + mov ecx,[current_line] + mov [error_line],ecx + mov [error],value_out_of_range + ret +get_word_value: + mov [value_size],2 + mov [size_override],-1 + call calculate_expression + mov eax,[edi+16] + mov [symbol_identifier],eax + cmp word [edi+8],0 + jne invalid_value + mov al,[edi+12] + mov [value_type],al + cmp al,2 + jb check_word_value + cmp [error_line],0 + jne check_word_value + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_use_of_symbol + check_word_value: + mov eax,[edi] + mov edx,[edi+4] + or edx,edx + jz word_positive + cmp edx,-1 + jne range_exceeded + cmp eax,-8000h + jb range_exceeded + ret + word_positive: + cmp eax,10000h + jae range_exceeded + ret +get_dword_value: + mov [value_size],4 + mov [size_override],-1 + call calculate_expression + mov eax,[edi+16] + mov [symbol_identifier],eax + cmp word [edi+8],0 + jne invalid_value + mov al,[edi+12] + mov [value_type],al + cmp al,4 + jb check_dword_value + cmp [error_line],0 + jne check_dword_value + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_use_of_symbol + check_dword_value: + mov eax,[edi] + mov edx,[edi+4] + or edx,edx + jz dword_positive + cmp edx,-1 + jne range_exceeded + bt eax,31 + jnc range_exceeded + dword_positive: + ret +get_pword_value: + mov [value_size],6 + mov [size_override],-1 + call calculate_expression + mov eax,[edi+16] + mov [symbol_identifier],eax + cmp word [edi+8],0 + jne invalid_value + mov al,[edi+12] + mov [value_type],al + cmp al,4 + jb check_pword_value + cmp [error_line],0 + jne check_pword_value + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_use_of_symbol + check_pword_value: + mov eax,[edi] + mov edx,[edi+4] + cmp edx,10000h + jge range_exceeded + cmp edx,-8000h + jl range_exceeded + ret +get_qword_value: + mov [value_size],8 + mov [size_override],-1 + call calculate_expression + mov eax,[edi+16] + mov [symbol_identifier],eax + cmp word [edi+8],0 + jne invalid_value + mov al,[edi+12] + mov [value_type],al + check_qword_value: + mov eax,[edi] + mov edx,[edi+4] + ret +get_value: + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,'(' + jne invalid_value + mov al,[operand_size] + cmp al,1 + je value_byte + cmp al,2 + je value_word + cmp al,4 + je value_dword + cmp al,6 + je value_pword + cmp al,8 + je value_qword + or al,al + jnz invalid_value + value_qword: + call get_qword_value + ret + value_pword: + call get_pword_value + movzx edx,dx + ret + value_dword: + call get_dword_value + xor edx,edx + ret + value_word: + call get_word_value + xor edx,edx + movzx eax,ax + ret + value_byte: + call get_byte_value + xor edx,edx + movzx eax,al + ret +get_address_value: + mov [address_size],0 + mov [value_size],8 + calculate_address: + cmp byte [esi],'.' + je invalid_address + call calculate_expression + mov eax,[edi+16] + mov [address_symbol],eax + mov al,[edi+12] + test al,1 + jnz invalid_use_of_symbol + mov [value_type],al + or al,al + jz address_symbol_ok + shl al,5 + mov ah,[address_size] + or [address_size],al + shr al,4 + or ah,ah + jz address_symbol_ok + cmp al,ah + jne address_sizes_do_not_agree + address_symbol_ok: + xor bx,bx + xor cl,cl + mov ch,[address_size] + cmp word [edi+8],0 + je check_immediate_address + mov al,[edi+8] + mov dl,[edi+10] + call get_address_register + mov al,[edi+9] + mov dl,[edi+11] + call get_address_register + mov ax,bx + shr ah,4 + shr al,4 + or bh,bh + jz check_address_registers + or bl,bl + jz check_address_registers + cmp al,ah + jne invalid_address + check_address_registers: + or al,ah + cmp al,4 + je sib_allowed + cmp al,8 + je sib_allowed + or cl,cl + jz check_word_value + cmp cl,1 + je check_word_value + jmp invalid_address + get_address_register: + or al,al + jz address_register_ok + cmp dl,1 + jne scaled_register + or bh,bh + jnz scaled_register + mov bh,al + address_register_ok: + ret + scaled_register: + or bl,bl + jnz invalid_address + mov bl,al + mov cl,dl + jmp address_register_ok + sib_allowed: + or bh,bh + jnz check_index_scale + cmp cl,2 + je special_index_scale + cmp cl,3 + je special_index_scale + cmp cl,5 + je special_index_scale + cmp cl,9 + je special_index_scale + check_index_scale: + or cl,cl + jz address_registers_ok + cmp cl,1 + je address_registers_ok + cmp cl,2 + je address_registers_ok + cmp cl,4 + je address_registers_ok + cmp cl,8 + je address_registers_ok + jmp invalid_address + special_index_scale: + mov bh,bl + dec cl + address_registers_ok: + jmp check_dword_value + check_immediate_address: + cmp [code_type],64 + jne check_dword_value + jmp check_qword_value +get_relative_offset: + mov [value_size],4 + mov [size_override],-1 + call calculate_expression + calculate_relative_offset: + push esi + add edi,14h + mov esi,[display_buffer] + sub esi,7 + lea eax,[esi-14h] + cmp eax,edi + jb out_of_memory + mov byte [esi],11h + xor eax,eax + mov dword [esi+1],eax + mov word [esi+5],')' shl 8 + 81h + call calculation_loop + pop esi + cmp word [edi+8],0 + jne invalid_value + mov al,[edi+12] + mov [value_type],al + mov eax,[edi+16] + mov [symbol_identifier],eax + mov eax,[edi] + mov edx,[edi+4] + or edx,edx + jz offset_positive + cmp edx,-1 + jne range_exceeded + bt eax,31 + jnc range_exceeded + ret + offset_positive: + bt eax,31 + jc range_exceeded + ret + +calculate_logical_expression: + call get_logical_value + logical_loop: + cmp byte [esi],'|' + je logical_or + cmp byte [esi],'&' + je logical_and + ret + logical_or: + inc esi + push eax + call get_logical_value + pop ebx + or al,bl + jmp logical_loop + logical_and: + inc esi + push eax + call get_logical_value + pop ebx + and al,bl + jmp logical_loop + +get_logical_value: + xor al,al + check_for_negation: + cmp byte [esi],'~' + jne negation_ok + inc esi + xor al,-1 + jmp check_for_negation + negation_ok: + push eax + mov al,[esi] + cmp al,'{' + je logical_expression + cmp al,88h + je check_for_defined + cmp al,89h + je check_for_used + push esi + cmp al,11h + jne check_for_values + add esi,2 + check_for_values: + xor bl,bl + cmp byte [esi],'(' + jne find_eq_symbol + call skip_symbol + lods byte [esi] + cmp al,'=' + je compare_values + cmp al,'>' + je compare_values + cmp al,'<' + je compare_values + cmp al,0F1h + je compare_values + cmp al,0F2h + je compare_values + cmp al,0F3h + je compare_values + dec esi + find_eq_symbol: + cmp byte [esi],0F0h + je compare_symbols + cmp byte [esi],0F7h + je compare_symbol_types + cmp byte [esi],0F6h + je scan_symbols_list + call check_character + jc logical_number + cmp al,',' + jne next_eq_symbol + mov bl,1 + next_eq_symbol: + call skip_symbol + jmp find_eq_symbol + compare_symbols: + inc esi + pop ebx + mov edx,esi + push edi + mov edi,ebx + mov ecx,esi + dec ecx + sub ecx,edi + repe cmps byte [esi],[edi] + pop edi + je symbols_equal + mov esi,edx + symbols_different: + call check_character + jc return_false + call skip_symbol + jmp symbols_different + symbols_equal: + call check_character + jc return_true + jmp symbols_different + compare_symbol_types: + inc esi + pop ebx + type_comparision: + call check_character + jc types_compared + mov al,[esi] + cmp al,[ebx] + jne symbols_different + cmp al,'(' + jne equal_type + mov al,[esi+1] + mov ah,[ebx+1] + cmp al,ah + je equal_type + or al,al + jz symbols_different + or ah,ah + jz symbols_different + cmp al,'.' + je symbols_different + cmp ah,'.' + je symbols_different + equal_type: + call skip_symbol + xchg esi,ebx + call skip_symbol + xchg esi,ebx + jmp type_comparision + types_compared: + cmp byte [ebx],0F7h + jne return_false + jmp return_true + scan_symbols_list: + or bl,bl + jnz invalid_expression + xor bp,bp + inc esi + lods byte [esi] + cmp al,'<' + jne invalid_expression + pop ebx + mov ecx,esi + sub ecx,2 + sub ecx,ebx + compare_in_list: + mov edx,esi + push ecx edi + mov edi,ebx + repe cmps byte [esi],[edi] + pop edi ecx + jne not_equal_in_list + cmp byte [esi],',' + je skip_rest_of_list + cmp byte [esi],'>' + jne not_equal_in_list + skip_rest_of_list: + mov al,[esi] + or al,al + jz invalid_expression + cmp al,0Fh + je invalid_expression + cmp al,'>' + je list_return_true + call skip_symbol + jmp skip_rest_of_list + list_return_true: + inc esi + jmp return_true + not_equal_in_list: + mov esi,edx + skip_list_item: + mov al,[esi] + or al,al + jz invalid_expression + cmp al,0Fh + je invalid_expression + cmp al,'<' + je invalid_expression + cmp al,'>' + je list_return_false + cmp al,',' + je next_in_list + call skip_symbol + jmp skip_list_item + next_in_list: + inc esi + jmp compare_in_list + list_return_false: + inc esi + jmp return_false + check_character: + mov al,[esi] + or al,al + jz stop + cmp al,0Fh + je stop + cmp al,'}' + je stop + cmp al,'|' + je stop + cmp al,'&' + je stop + clc + ret + stop: + stc + ret + compare_values: + pop esi + call get_value + mov bl,[value_type] + push eax edx ebx + lods byte [esi] + mov [compare_type],al + call get_value + pop ebx + cmp [next_pass_needed],0 + jne values_ok + cmp bl,[value_type] + jne invalid_use_of_symbol + values_ok: + pop ecx ebx + cmp [compare_type],'=' + je check_equal + cmp [compare_type],'>' + je check_greater + cmp [compare_type],'<' + je check_less + cmp [compare_type],0F1h + je check_not_equal + cmp [compare_type],0F2h + je check_not_less + cmp [compare_type],0F3h + je check_not_greater + jmp invalid_expression + check_equal: + cmp eax,ebx + jne return_false + cmp edx,ecx + jne return_false + jmp return_true + check_greater: + cmp edx,ecx + jl return_true + jg return_false + cmp eax,ebx + jb return_true + jae return_false + check_less: + cmp edx,ecx + jl return_false + jg return_true + cmp eax,ebx + jbe return_false + ja return_true + check_not_less: + cmp edx,ecx + jl return_true + jg return_false + cmp eax,ebx + jbe return_true + ja return_false + check_not_greater: + cmp edx,ecx + jl return_false + jg return_true + cmp eax,ebx + jb return_false + jae return_true + check_not_equal: + cmp eax,ebx + jne return_true + cmp edx,ecx + jne return_true + jmp return_false + logical_number: + pop esi + call get_value + cmp [value_type],0 + jne invalid_expression + or eax,edx + jnz return_true + jmp return_false + check_for_defined: + or bl,-1 + lods word [esi] + cmp ah,'(' + jne invalid_expression + check_expression: + lods byte [esi] + or al,al + jz defined_string + cmp al,'.' + je defined_fp_value + cmp al,')' + je expression_checked + cmp al,0Fh + je check_expression + cmp al,10h + je defined_register + cmp al,11h + je check_if_symbol_defined + cmp al,80h + jae check_expression + movzx eax,al + add esi,eax + jmp check_expression + defined_register: + inc esi + jmp check_expression + defined_fp_value: + add esi,12 + jmp expression_checked + defined_string: + lods dword [esi] + add esi,eax + inc esi + jmp expression_checked + check_if_symbol_defined: + lods dword [esi] + cmp eax,-1 + je invalid_expression + cmp eax,0Fh + jb check_expression + je reserved_word_used_as_symbol + test byte [eax+8],4 + jnz no_prediction + test byte [eax+8],1 + jz symbol_predicted_undefined + mov cx,[current_pass] + sub cx,[eax+16] + jz check_expression + cmp cx,1 + ja symbol_predicted_undefined + or byte [eax+8],40h+80h + jmp check_expression + no_prediction: + test byte [eax+8],1 + jz symbol_undefined + mov cx,[current_pass] + sub cx,[eax+16] + jz check_expression + jmp symbol_undefined + symbol_predicted_undefined: + or byte [eax+8],40h + and byte [eax+8],not 80h + symbol_undefined: + xor bl,bl + jmp check_expression + expression_checked: + mov al,bl + jmp logical_value_ok + check_for_used: + lods word [esi] + cmp ah,2 + jne invalid_expression + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + inc esi + test byte [eax+8],8 + jz not_used + mov cx,[current_pass] + sub cx,[eax+18] + jz return_true + cmp cx,1 + ja not_used + or byte [eax+8],10h+20h + jmp return_true + not_used: + or byte [eax+8],10h + and byte [eax+8],not 20h + return_false: + xor al,al + jmp logical_value_ok + return_true: + or al,-1 + jmp logical_value_ok + logical_expression: + inc esi + call calculate_logical_expression + push eax + lods byte [esi] + cmp al,'}' + jne invalid_expression + pop eax + logical_value_ok: + pop ebx + xor al,bl + ret diff --git a/programs/fasm/trunk/fasm.asm b/programs/fasm/trunk/fasm.asm new file mode 100644 index 0000000000..b9be181039 --- /dev/null +++ b/programs/fasm/trunk/fasm.asm @@ -0,0 +1,551 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; flat assembler source ;; +;; Copyright (c) 1999-2004, Tomasz Grysztar ;; +;; All rights reserved. ;; +;; ;; +;; Menuet port by VT ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +NORMAL_MODE = 8 +CONSOLE_MODE = 32 + +MAGIC1 = 6*(text.line_size-1)+6*2+2 +MAGIC2 = 14 +MAGIC3 = 1 +MAGIC4 = 7 +OUTPUTXY = (5+MAGIC4) shl 16 + MAGIC2*3+MAGIC3+MAGIC4+1+2 +MAX_PATH = 100 + +APP_MEMORY = 0x00800000 + +;; Menuet header + +use32 + + org 0x0 + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; program start + dd program_end ; program image size + dd APP_MEMORY ; required amount of memory + dd 0xDFFF0 ; stack + dd params,0x0 ; parameters,icon + +include 'lang.inc' +include 'fasm.inc' +;include 'debug2.inc' + +center fix true + +START: ; Start of execution + + cmp [params],0 + jz noparams + + mov ecx,10 + mov al,' ' + mov edi,infile + push ecx + cld + rep stosd + mov ecx,[esp] + mov edi,outfile + rep stosd + pop ecx + mov edi,path + rep stosd + + mov esi,params +; DEBUGF "params: %s\n",esi + mov edi,infile + call mov_param_str +; mov edi,infile +; DEBUGF " input: %s\n",edi + inc esi + mov edi,outfile + call mov_param_str +; mov edi,outfile +; DEBUGF "output: %s\n",edi + inc esi + mov edi,path + call mov_param_str +; mov edi,path +; DEBUGF " path: %s\n",edi + + cmp [esi], dword ',run' + jne @f + mov [_run_outfile],1 + @@: + + mov [_mode],CONSOLE_MODE + jmp start + + noparams: + + call draw_window + +still: + + mcall 10 ; Wait here for event + + dec eax ; Redraw request + jz red + dec eax ; Key in buffer + jz key + dec eax ; Button in buffer + jz button + + jmp still + +red: ; Redraw + call draw_window + jmp still + +key: ; Key + mcall 2 ; Read it and ignore + jmp still + +button: ; Button in Window + + mcall 17 + + cmp ah,2 ; Start compiling + je start + cmp ah,3 ; Start compiled file + jnz norunout + + mov edx,outfile + call make_fullpaths + mcall 58,file_info_start +; xor ecx,ecx + jmp still + norunout: + + mov ecx,[skinh] + add ecx,MAGIC3+MAGIC2/2-3 + mov [ya],ecx + + cmp ah,11 ; Infile + je f1 + cmp ah,12 ; Outfile + je f2 + cmp ah,13 ; Path + je f3 + + dec ah ; Close application + jnz still + + mcall -1 + +skinh dd ? + +draw_window: + + pusha + + mcall 12,1 ; Start of draw + + get_sys_colors 1,0 + + mcall 0,<50,280>,<50,250>,[sc.work] ; Draw Window + + draw_caption header,header.size ; Draw Window Label Text + + mov ecx,[skinh-2] + mov cx,word[skinh] + madd ecx,MAGIC3,MAGIC3 + mov ebx,[pinfo.x_size] + madd ebx,5,-5 + + push ecx + madd ecx,MAGIC2*3+2,MAGIC2*3+2 + mcall 38,,,[sc.work_graph] + pop ecx + + sub ebx,MAGIC1+3 + + mcall + madd ecx,MAGIC2,MAGIC2 + mcall + madd ecx,MAGIC2,MAGIC2 + mcall + madd ecx,MAGIC2,MAGIC2 + mcall + push ebx + mpack ebx,MAGIC1+5,MAGIC1+5 + sub cx,MAGIC2*3 + mcall + mov ebx,[esp-2] + pop bx + mcall + add esp,2 + + mpack ebx,5,MAGIC1-1 + mpack ecx,[skinh],MAGIC2-2 + madd ecx,MAGIC3+1,0 + mcall 8,,,0x4000000B ; Button: Enter Infile + madd ecx,MAGIC2,0 + mcall ,,,0x4000000C ; Button: Enter Outfile + madd ecx,MAGIC2,0 + mcall ,,,0x4000000D ; Button: Enter Path + + mpack ebx,[pinfo.x_size],MAGIC1 + msub ebx,MAGIC1+5+1,0 + mpack ecx,[skinh],MAGIC2*3/2-1 + madd ecx,MAGIC3,0 + mcall ,,,0x00000002,[sc.work_button] + madd ecx,MAGIC2*3/2+1,0 + mcall ,,,0x00000003 + + mpack ebx,5+6,[skinh] ; Draw Window Text + add bx,MAGIC3+MAGIC2/2-3 + mov ecx,[sc.work_text] + mov edx,text + mov esi,text.line_size + mov eax,4 + newline: + mcall + add ebx,MAGIC2 + add edx,text.line_size + cmp byte[edx],'x' + jne newline + + mov ebx,[pinfo.x_size] + sub ebx,MAGIC1+5+1-9 + shl ebx,16 + mov bx,word[skinh] + add bx,MAGIC3+(MAGIC2*3/2-1)/2-3 + mcall ,,[sc.work_button_text],s_compile,7 + add ebx,MAGIC2*3/2+1 + mcall ,,,s_run + + mpack ebx,MAGIC1+5+6,[skinh] + add ebx,MAGIC3+MAGIC2/2-3+MAGIC2*0 + mov esi,[pinfo.x_size] + sub esi,MAGIC1*2+5*2+6+3 + mov eax,esi + mov cl,6 + div cl + cmp al,MAX_PATH + jbe @f + mov al,MAX_PATH +@@: movzx esi,al + mcall 4,,[sc.work_text],infile + add ebx,MAGIC2 + mcall ,,,outfile + add ebx,MAGIC2 + mcall ,,,path + + call draw_messages + + mcall 12,2 ; End of Draw + + popa + ret + +bottom_right dd ? + +draw_messages: + mov eax,13 ; clear work area + mpack ebx,5+MAGIC4-2,[pinfo.x_size] + sub ebx,5*2+MAGIC4*2-1-2*2 + mpack ecx,[skinh],[pinfo.y_size] + madd ecx,MAGIC2*3+MAGIC3+MAGIC4+1,-(MAGIC2*3+MAGIC3+MAGIC4*2+5)+2 + mov word[bottom_right+2],bx + mov word[bottom_right],cx + msub [bottom_right],7,11 + add [bottom_right],OUTPUTXY + sub ecx,[skinh] + mov edx,[sc.work] + int 0x40 +_cy = 0 +_sy = 2 +_cx = 4 +_sx = 6 + push ebx ecx + mpack ebx,5+MAGIC4-3,5+MAGIC4-2 + add bx,[esp+_cx] + mov ecx,[esp+_sy-2] + mov cx,[esp+_sy] + msub ecx,1,1 + mcall 38,,,[sc.work_graph] + mov si,[esp+_cy] + add cx,si + shl esi,16 + add ecx,esi + madd ecx,1,1 + mcall + mpack ebx,5+MAGIC4-3,5+MAGIC4-3 + mov esi,[esp+_sy-2] + mov si,cx + mov ecx,esi + mcall + mov si,[esp+_cx] + add bx,si + shl esi,16 + add ebx,esi + madd ebx,1,1 + mcall + pop ecx ebx + ret + +; read string + +f1: mov [addr],infile + add [ya],MAGIC2*0 + jmp rk +f2: mov [addr],outfile + add [ya],MAGIC2*1 + jmp rk +f3: mov [addr],path + add [ya],MAGIC2*2 +rk: + + mov edi,[addr] + mov al,0 + mov ecx,MAX_PATH + add edi,ecx + dec edi + std + repe scasb + sub ecx,MAX_PATH + neg ecx + mov al,$1C ; '' + add edi,2 + push edi + cld + rep stosb + call print_text + pop edi +f11:mcall 10 + cmp eax,2 + jne read_done + mcall; 2 + shr eax,8 + cmp al,13 + je read_done + cmp al,8 + jne nobs + cmp edi,[addr] + je f11 + sub edi,1 + mov byte[edi],$1C ; '_' + call print_text + jmp f11 + nobs: + movzx ebx,al + sub ebx,$20 + jle f11 + sub al,[sub_table+ebx] + keyok: + mov ecx,[addr] + add ecx,MAX_PATH + cmp edi,ecx + jae f11 + mov [edi],al + + call print_text + inc edi + jmp f11 + + read_done: + + mov ecx,[addr] + add ecx,MAX_PATH + sub ecx,edi + mov al,0;' ' + cld + rep stosb + call print_text + + jmp still + +print_text: + + mpack ebx,MAGIC1+5+6,[pinfo.x_size] + sub ebx,MAGIC1*2+5*2+6+3 + movzx esi,bx + mov ecx,[ya-2] + mov cx,8 + mcall 13,,,[sc.work] + + mpack ebx,MAGIC1+5+6,[ya] + mov eax,esi + mov cl,6 + div cl + cmp al,MAX_PATH + jbe @f + mov al,MAX_PATH +@@: movzx esi,al + mcall 4,,[sc.work_text],[addr] + + ret + + +; DATA + +sz header,'FASM FOR MENUET' + +text: + db ' INFILE:' +.line_size = $-text + db 'OUTFILE:' + db ' PATH:' + db 'x' + +s_compile db 'COMPILE' +s_run db ' RUN ' + +infile db 'EXAMPLE.ASM' + times MAX_PATH+$-infile db 0 +outfile db 'EXAMPLE' + times MAX_PATH+$-outfile db 0 +path db '/RD/1/' + times MAX_PATH+$-path db 0 + +lf db 13,10,0 + +addr dd 0x0 +ya dd 0x0 +zero db 0x0 + +mov_param_str: + @@: + mov al,[esi] + cmp al,',' + je @f + cmp al,0 + je @f + mov [edi],al + inc esi + inc edi + jmp @b + @@: + mov al,0 + stosb +ret + +start: + cmp [_mode],NORMAL_MODE + jne @f + call draw_messages + push [skinh] + pop [textxy] + add [textxy],OUTPUTXY +@@: + mov esi,_logo + call display_string + + ; + ; Fasm native code + ; + + mov [input_file],infile + mov [output_file],outfile + + call init_memory + + call make_timestamp + mov [start_time],eax + + call preprocessor + call parser + call assembler + call formatter + + call display_user_messages + movzx eax,[current_pass] + inc eax + call display_number + mov esi,_passes_suffix + call display_string + call make_timestamp + sub eax,[start_time] + xor edx,edx + mov ebx,100 + div ebx + or eax,eax + jz display_bytes_count + xor edx,edx + mov ebx,10 + div ebx + push edx + call display_number + mov dl,'.' + call display_character + pop eax + call display_number + mov esi,_seconds_suffix + call display_string + display_bytes_count: + mov eax,[written_size] + call display_number + mov esi,_bytes_suffix + call display_string + xor al,al + + cmp [_run_outfile],0 + je @f + mov edx,outfile + call make_fullpaths + mov eax,58 + mov ebx,file_info_start + xor ecx,ecx + int 0x40 +@@: + jmp exit_program + + +include 'system.inc' + +include 'version.inc' +include 'errors.inc' +include 'expressi.inc' +include 'preproce.inc' +include 'parser.inc' +include 'assemble.inc' +include 'formats.inc' +include 'x86_64.inc' + +_logo db 'flat assembler version ',VERSION_STRING,13,10,0 + +_passes_suffix db ' passes, ',0 +_seconds_suffix db ' seconds, ',0 +_bytes_suffix db ' bytes.',13,10,0 + +_include db 'INCLUDE',0 + +_counter db 4,'0000' + +_mode dd NORMAL_MODE +_run_outfile dd 0 + +sub_table: +times $41 db $00 +times $1A db $20 +times $25 db $00 +times $10 db $20 +times $30 db $00 +times $10 db $50 +times $04 db $00,$01 +times $08 db $00 + +;include_debug_strings + +params db 0 ; 'TINYPAD.ASM,TINYPAD,/HD/1/TPAD4/', +program_end: +rb 1000h + +align 4 + +include 'variable.inc' + +program_base dd ? +buffer_address dd ? +memory_setting dd ? +start_time dd ? + +sc system_colors +pinfo process_information diff --git a/programs/fasm/trunk/fasm.inc b/programs/fasm/trunk/fasm.inc new file mode 100644 index 0000000000..a5c3875090 --- /dev/null +++ b/programs/fasm/trunk/fasm.inc @@ -0,0 +1,147 @@ +center fix false +SYSTEMCOLORS fix sc +PROCESSINFO fix pinfo + +macro get_sys_colors wnd_skin,font_1 { + mcall 48,3,SYSTEMCOLORS,sizeof.system_colors + if wnd_skin <> 0 + or [SYSTEMCOLORS+system_colors.work],0x03000000 + end if + if font_1 <> 0 + or [SYSTEMCOLORS+system_colors.grab_text],0x10000000 + end if +} + +macro draw_caption _edx,_esi { + mov edx,_edx + mov esi,_esi + call __draw_caption +} + +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 { + 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 { + __mov eax,a + __mov ebx,b + __mov ecx,c + __mov edx,d + __mov esi,e + __mov edi,f + int 0x40 +} + +macro sz name,[data] { + if used name + common + label name + forward + db data + common + .size = $-name + end if +} + +macro lsz name,[lng,data] { + if used name + common + label name + forward + if lang eq lng + db data + end if + common + .size = $-name + end if +} + +macro mmov reg,a1,a2 { + mov reg,(a1) shl 16 + (a2) +} + +macro madd reg,a1,a2 { + add reg,(a1) shl 16 + (a2) +} + +macro msub reg,a1,a2 { + sub reg,(a1) shl 16 + (a2) +} + +macro jmpe reg,def,[val,lab] { + forward + cmp reg,val + je lab + common + if ~def eq + jmp def + end if +} + +macro func name { + if used name + name: +} + +macro endf { + end if +} + +@^ fix macro comment { +^@ fix } + +; structure definition helper + +;include '%fasminc%struct.inc' +include 'struct.inc' + +; structures used in MeOS +struct process_information + cpu_usage dd ? ; +0 + window_stack_position dw ? ; +4 + window_stack_value dw ? ; +6 + not_used1 dw ? ; +8 + process_name db 12 dup(?) ; +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 + not_used2 db 1024-52 dup(?) +ends + +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 diff --git a/programs/fasm/trunk/formats.inc b/programs/fasm/trunk/formats.inc new file mode 100644 index 0000000000..1bed170c48 --- /dev/null +++ b/programs/fasm/trunk/formats.inc @@ -0,0 +1,3802 @@ + +; flat assembler core +; Copyright (c) 1999-2005, Tomasz Grysztar. +; All rights reserved. + +formatter: + cmp [output_file],0 + jne output_path_ok + push edi + mov esi,[input_file] + mov edi,[free_additional_memory] + copy_output_path: + lods byte [esi] + cmp edi,[structures_buffer] + jae out_of_memory + stos byte [edi] + or al,al + jnz copy_output_path + dec edi + mov eax,edi + find_extension: + dec eax + cmp eax,[free_additional_memory] + jb extension_found + cmp byte [eax],'\' + je extension_found + cmp byte [eax],'/' + je extension_found + cmp byte [eax],'.' + jne find_extension + mov edi,eax + extension_found: + lea eax,[edi+9] + cmp eax,[structures_buffer] + jae out_of_memory + cmp [output_format],2 + je exe_extension + jb bin_extension + cmp [output_format],4 + je obj_extension + cmp [output_format],5 + je o_extension + cmp [output_format],3 + jne no_extension + cmp [subsystem],1 + je sys_extension + bt [format_flags],8 + jnc exe_extension + mov eax,'.dll' + jmp make_extension + sys_extension: + mov eax,'.sys' + jmp make_extension + bin_extension: + mov eax,'.bin' + bt [format_flags],0 + jnc make_extension + mov eax,'.com' + jmp make_extension + obj_extension: + mov eax,'.obj' + jmp make_extension + o_extension: + mov eax,'.o' + bt [format_flags],0 + jnc make_extension + no_extension: + xor eax,eax + jmp make_extension + exe_extension: + mov eax,'.exe' + make_extension: + xchg eax,[edi] + scas dword [edi] + mov byte [edi],0 + scas byte [edi] + mov esi,edi + stos dword [edi] + sub edi,9 + xor eax,eax + mov ebx,characters + adapt_case: + mov al,[esi] + or al,al + jz adapt_next + xlat byte [ebx] + cmp al,[esi] + je adapt_ok + sub byte [edi],20h + adapt_ok: + inc esi + adapt_next: + inc edi + cmp byte [edi],0 + jne adapt_case + mov esi,edi + lea ecx,[esi+1] + sub ecx,[free_additional_memory] + mov edi,[structures_buffer] + dec edi + std + rep movs byte [edi],[esi] + cld + inc edi + mov [structures_buffer],edi + mov [output_file],edi + pop edi + output_path_ok: + cmp [output_format],4 + je coff_formatter + cmp [output_format],5 + jne common_formatter + bt [format_flags],0 + jnc elf_formatter + common_formatter: + mov eax,edi + sub eax,[code_start] + mov [real_code_size],eax + cmp edi,[undefined_data_end] + jne calculate_code_size + mov edi,[undefined_data_start] + calculate_code_size: + sub edi,[code_start] + mov [code_size],edi + mov [written_size],0 + mov edx,[output_file] + call create + jc write_failed + cmp [output_format],3 + jne stub_written + mov edx,[code_start] + mov ecx,[stub_size] + sub edx,ecx + add [written_size],ecx + call write + stub_written: + cmp [output_format],2 + jne write_output + call write_mz_header + write_output: + call write_code + output_written: + call close + ret + write_code: + mov eax,[written_size] + mov [headers_size],eax + mov edx,[code_start] + mov ecx,[code_size] + add [written_size],ecx + call write + jc write_failed + ret +format_directive: + cmp edi,[code_start] + jne unexpected_instruction + cmp [virtual_data],0 + jne unexpected_instruction + cmp [output_format],0 + jne unexpected_instruction + lods byte [esi] + cmp al,17h + je format_prefix + cmp al,18h + jne invalid_argument + lods byte [esi] + select_format: + mov dl,al + shr al,4 + mov [output_format],al + and edx,0Fh + or [format_flags],edx + cmp al,2 + je format_mz + cmp al,3 + je format_pe + cmp al,4 + je format_coff + cmp al,5 + je format_elf + jmp instruction_assembled + format_prefix: + lods byte [esi] + mov ah,al + lods byte [esi] + cmp al,18h + jne invalid_argument + lods byte [esi] + mov edx,eax + shr dl,4 + shr dh,4 + cmp dl,dh + jne invalid_argument + or al,ah + jmp select_format +entry_directive: + bts [format_flags],10h + jc setting_already_specified + mov al,[output_format] + cmp al,2 + je mz_entry + cmp al,3 + je pe_entry + cmp al,5 + jne illegal_instruction + bt [format_flags],0 + jc elf_entry + jmp illegal_instruction +stack_directive: + bts [format_flags],11h + jc setting_already_specified + mov al,[output_format] + cmp al,2 + je mz_stack + cmp al,3 + je pe_stack + jmp illegal_instruction +heap_directive: + bts [format_flags],12h + jc setting_already_specified + mov al,[output_format] + cmp al,2 + je mz_heap + cmp al,3 + je pe_heap + jmp illegal_instruction +section_directive: + cmp [virtual_data],0 + jne illegal_instruction + mov al,[output_format] + cmp al,3 + je pe_section + cmp al,4 + je coff_section + cmp al,5 + je elf_section + jmp illegal_instruction +public_directive: + mov al,[output_format] + cmp al,4 + je public_allowed + cmp al,5 + jne illegal_instruction + bt [format_flags],0 + jc illegal_instruction + public_allowed: + lods byte [esi] + cmp al,2 + jne invalid_argument + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + mov dx,[current_pass] + mov [eax+18],dx + or byte [eax+8],8 + inc esi + mov ebx,[free_additional_memory] + lea edx,[ebx+10h] + cmp edx,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],edx + mov [ebx+8],eax + mov eax,[current_line] + mov [ebx+0Ch],eax + lods byte [esi] + cmp al,86h + jne invalid_argument + lods word [esi] + cmp ax,'(' + jne invalid_argument + mov [ebx+4],esi + lods dword [esi] + lea esi,[esi+eax+1] + mov byte [ebx],80h + jmp instruction_assembled +extrn_directive: + mov al,[output_format] + cmp al,4 + je extrn_allowed + cmp al,5 + jne illegal_instruction + bt [format_flags],0 + jc illegal_instruction + extrn_allowed: + lods word [esi] + cmp ax,'(' + jne invalid_argument + mov ebx,esi + lods dword [esi] + lea esi,[esi+eax+1] + mov edx,[free_additional_memory] + lea eax,[edx+0Ch] + cmp eax,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],eax + mov byte [edx],81h + mov [edx+4],ebx + lods byte [esi] + cmp al,86h + jne invalid_argument + lods byte [esi] + cmp al,2 + jne invalid_argument + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + inc esi + mov ebx,eax + xor ah,ah + lods byte [esi] + cmp al,':' + je get_extrn_size + dec esi + cmp al,11h + jne extrn_size_ok + get_extrn_size: + lods word [esi] + cmp al,11h + jne invalid_argument + extrn_size_ok: + mov [address_symbol],edx + movzx ecx,ah + mov [edx+8],ecx + xor eax,eax + xor edx,edx + xor ebp,ebp + mov ch,2 + test [format_flags],8 + jz make_free_label + mov ch,4 + jmp make_free_label +mark_relocation: + cmp [value_type],0 + je relocation_ok + cmp [virtual_data],0 + jne relocation_ok + cmp [output_format],2 + je mark_mz_relocation + cmp [output_format],3 + je mark_pe_relocation + cmp [output_format],4 + je mark_coff_relocation + cmp [output_format],5 + je mark_elf_relocation + relocation_ok: + ret +close_pass: + mov al,[output_format] + cmp al,3 + je close_pe + cmp al,4 + je close_coff + cmp al,5 + je close_elf + ret + +format_mz: + mov edx,[additional_memory] + push edi + mov edi,edx + mov ecx,1Ch shr 2 + xor eax,eax + rep stos dword [edi] + mov [free_additional_memory],edi + pop edi + mov word [edx+0Ch],0FFFFh + mov word [edx+10h],1000h + mov [code_type],16 + jmp instruction_assembled +mark_mz_relocation: + push eax ebx + inc [number_of_relocations] + mov ebx,[free_additional_memory] + mov eax,edi + sub eax,[code_start] + mov [ebx],ax + shr eax,16 + shl ax,12 + mov [ebx+2],ax + cmp word [ebx],0FFFFh + jne mz_relocation_ok + inc word [ebx+2] + sub word [ebx],10h + mz_relocation_ok: + add ebx,4 + cmp ebx,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],ebx + pop ebx eax + ret +segment_directive: + cmp [output_format],2 + jne illegal_instruction + cmp [virtual_data],0 + jne illegal_instruction + lods byte [esi] + cmp al,2 + jne invalid_argument + lods dword [esi] + cmp eax,0Fh + jb invalid_use_of_symbol + je reserved_word_used_as_symbol + inc esi + mov ebx,eax + mov eax,edi + sub eax,[code_start] + mov ecx,0Fh + add eax,0Fh + and eax,1111b + sub ecx,eax + mov edx,edi + xor al,al + rep stos byte [edi] + mov dword [org_origin],edi + mov dword [org_origin+4],0 + mov [org_registers],0 + mov [org_start],edi + mov eax,edx + call undefined_data + mov eax,edi + sub eax,[code_start] + shr eax,4 + cmp eax,10000h + jae value_out_of_range + mov edx,eax + mov al,16 + cmp byte [esi],13h + jne segment_type_ok + inc esi + lods byte [esi] + segment_type_ok: + mov [code_type],al + mov eax,edx + mov cx,0100h + xor edx,edx + xor ebp,ebp + mov [address_symbol],edx + jmp make_free_label +mz_entry: + lods byte [esi] + cmp al,'(' + jne invalid_argument + call get_word_value + cmp [value_type],1 + je initial_cs_ok + cmp [error_line],0 + jne initial_cs_ok + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_address + initial_cs_ok: + mov edx,[additional_memory] + mov [edx+16h],ax + lods byte [esi] + cmp al,':' + jne invalid_argument + lods byte [esi] + cmp al,'(' + jne invalid_argument + ja invalid_address + call get_word_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,[additional_memory] + mov [edx+14h],ax + jmp instruction_assembled +mz_stack: + lods byte [esi] + cmp al,'(' + jne invalid_argument + call get_word_value + cmp byte [esi],':' + je stack_pointer + cmp ax,10h + jb invalid_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,[additional_memory] + mov [edx+10h],ax + jmp instruction_assembled + stack_pointer: + cmp [value_type],1 + je initial_ss_ok + cmp [error_line],0 + jne initial_ss_ok + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_address + initial_ss_ok: + mov edx,[additional_memory] + mov [edx+0Eh],ax + lods byte [esi] + cmp al,':' + jne invalid_argument + lods byte [esi] + cmp al,'(' + jne invalid_argument + call get_word_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,[additional_memory] + mov [edx+10h],ax + bts [format_flags],4 + jmp instruction_assembled +mz_heap: + cmp [output_format],2 + jne illegal_instruction + lods byte [esi] + call get_size_operator + cmp ah,1 + je invalid_value + cmp ah,2 + ja invalid_value + cmp al,'(' + jne invalid_argument + call get_word_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,[additional_memory] + mov [edx+0Ch],ax + jmp instruction_assembled +write_mz_header: + mov edx,[additional_memory] + bt [format_flags],4 + jc mz_stack_ok + mov eax,[real_code_size] + dec eax + shr eax,4 + inc eax + mov [edx+0Eh],ax + shl eax,4 + movzx ecx,word [edx+10h] + add eax,ecx + mov [real_code_size],eax + mz_stack_ok: + mov edi,[free_additional_memory] + mov eax,[number_of_relocations] + shl eax,2 + add eax,1Ch + sub edi,eax + xchg edi,[free_additional_memory] + mov ecx,0Fh + add eax,0Fh + and eax,1111b + sub ecx,eax + xor al,al + rep stos byte [edi] + sub edi,[free_additional_memory] + mov ecx,edi + shr edi,4 + mov word [edx],'MZ' ; signature + mov [edx+8],di ; header size in paragraphs + mov eax,[number_of_relocations] + mov [edx+6],ax ; number of relocation entries + mov eax,[code_size] + add eax,ecx + mov esi,eax + shr esi,9 + and eax,1FFh + inc si + or ax,ax + jnz mz_size_ok + mov ax,200h + dec si + mz_size_ok: + mov [edx+2],ax ; number of bytes in last page + mov [edx+4],si ; number of pages + mov eax,[real_code_size] + dec eax + shr eax,4 + inc eax + mov esi,[code_size] + dec esi + shr esi,4 + inc esi + sub eax,esi + mov [edx+0Ah],ax ; minimum memory in addition to code + add [edx+0Ch],ax ; maximum memory in addition to code + salc + mov ah,al + or [edx+0Ch],ax + mov word [edx+18h],1Ch ; offset of relocation table + add [written_size],ecx + call write + jc write_failed + ret + +make_stub: + mov [stub_file],edx + or edx,edx + jnz stub_from_file + push esi + mov edx,edi + xor eax,eax + mov ecx,20h + rep stos dword [edi] + mov eax,40h+default_stub_end-default_stub + mov cx,100h+default_stub_end-default_stub + mov word [edx],'MZ' + mov word [edx+4],1 + mov word [edx+2],ax + mov word [edx+8],4 + mov word [edx+0Ah],10h + mov word [edx+0Ch],0FFFFh + mov word [edx+10h],cx + mov word [edx+3Ch],ax + mov word [edx+18h],40h + lea edi,[edx+40h] + mov esi,default_stub + mov ecx,default_stub_end-default_stub + rep movs byte [edi],[esi] + pop esi + jmp stub_ok + default_stub: + use16 + push cs + pop ds + mov dx,stub_message-default_stub + mov ah,9 + int 21h + mov ax,4C01h + int 21h + stub_message db 'This program cannot be run in DOS mode.',0Dh,0Ah,24h + rq 1 + default_stub_end: + use32 + stub_from_file: + push esi + mov esi,edx + call open_binary_file + mov edx,edi + mov ecx,1Ch + mov esi,edx + call read + jc binary_stub + cmp word [esi],'MZ' + jne binary_stub + add edi,1Ch + movzx ecx,word [esi+6] + dec ecx + sar ecx,3 + inc ecx + shl ecx,2 + add ecx,(40h-1Ch) shr 2 + lea eax,[edi+ecx*4] + cmp edi,[display_buffer] + jae out_of_memory + xor eax,eax + rep stos dword [edi] + mov edx,40h + xchg dx,[esi+18h] + xor al,al + call lseek + movzx ecx,word [esi+6] + shl ecx,2 + lea edx,[esi+40h] + call read + mov edx,edi + sub edx,esi + shr edx,4 + xchg dx,[esi+8] + shl edx,4 + xor al,al + call lseek + movzx ecx,word [esi+4] + dec ecx + shl ecx,9 + movzx edx,word [esi+2] + add ecx,edx + mov edx,edi + sub ecx,eax + je read_stub_code + jb stub_code_ok + push ecx + dec ecx + shr ecx,3 + inc ecx + shl ecx,1 + lea eax,[edi+ecx*4] + cmp eax,[display_buffer] + jae out_of_memory + xor eax,eax + rep stos dword [edi] + pop ecx + read_stub_code: + call read + stub_code_ok: + call close + mov edx,edi + sub edx,esi + mov ax,dx + and ax,1FFh + mov [esi+2],ax + dec edx + shr edx,9 + inc edx + mov [esi+4],dx + mov eax,edi + sub eax,esi + mov [esi+3Ch],eax + pop esi + stub_ok: + ret + binary_stub: + mov esi,edi + mov ecx,40h shr 2 + xor eax,eax + rep stos dword [edi] + mov al,2 + xor edx,edx + call lseek + push eax + xor al,al + xor edx,edx + call lseek + mov ecx,[esp] + add ecx,40h+111b + and ecx,not 111b + mov ax,cx + and ax,1FFh + mov [esi+2],ax + lea eax,[ecx+1FFh] + and eax,not 1FFh + mov [esi+4],ax + mov [esi+3Ch],ecx + sub ecx,40h + mov eax,10000h + sub eax,ecx + jbe binary_heap_ok + shr eax,4 + mov [esi+0Ah],ax + binary_heap_ok: + mov word [esi],'MZ' + mov word [esi+8],4 + mov ax,0FFFFh + mov [esi+0Ch],ax + dec ax + mov [esi+10h],ax + sub ax,0Eh + mov [esi+0Eh],ax + mov [esi+16h],ax + mov word [esi+14h],100h + mov word [esi+18h],40h + mov eax,[display_buffer] + sub eax,ecx + cmp edi,eax + jae out_of_memory + mov edx,edi + shr ecx,2 + xor eax,eax + rep stos dword [edi] + pop ecx + call read + call close + pop esi + ret + +format_pe: + xor edx,edx + mov [machine],14Ch + mov [subsystem],3 + mov [subsystem_version],3 + 10 shl 16 + mov [image_base],400000h + test [format_flags],8 + jz pe_settings + mov [machine],8664h + mov [subsystem_version],5 + 0 shl 16 + mov [image_base_high],0 + pe_settings: + cmp byte [esi],84h + je get_stub_name + cmp byte [esi],80h + je get_pe_base + cmp byte [esi],1Bh + jne pe_settings_ok + lods byte [esi] + lods byte [esi] + test al,80h+40h + jz subsystem_setting + cmp al,80h + je dll_flag + cmp al,81h + je wdm_flag + jmp pe_settings + dll_flag: + bts [format_flags],8 + jc setting_already_specified + jmp pe_settings + wdm_flag: + bts [format_flags],9 + jc setting_already_specified + jmp pe_settings + subsystem_setting: + bts [format_flags],7 + jc setting_already_specified + and ax,3Fh + mov [subsystem],ax + cmp byte [esi],'(' + jne pe_settings + inc esi + cmp byte [esi],'.' + jne invalid_value + inc esi + push edx + cmp byte [esi+11],0 + jne invalid_value + cmp byte [esi+10],2 + ja invalid_value + mov dx,[esi+8] + cmp dx,8000h + je zero_version + mov eax,[esi+4] + cmp dx,7 + jg invalid_value + mov cx,7 + sub cx,dx + mov eax,[esi+4] + shr eax,cl + mov ebx,eax + shr ebx,24 + cmp bl,100 + jae invalid_value + and eax,0FFFFFFh + mov ecx,100 + mul ecx + shrd eax,edx,24 + jnc version_value_ok + inc eax + version_value_ok: + shl eax,16 + mov ax,bx + jmp subsystem_version_ok + zero_version: + xor eax,eax + subsystem_version_ok: + pop edx + add esi,13 + mov [subsystem_version],eax + jmp pe_settings + get_pe_base: + bts [format_flags],10 + jc setting_already_specified + lods word [esi] + cmp ah,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + push edx edi + add edi,[stub_size] + test [format_flags],8 + jnz get_pe64_base + call get_dword_value + mov [image_base],eax + jmp pe_base_ok + get_pe64_base: + call get_qword_value + mov [image_base],eax + mov [image_base_high],edx + pe_base_ok: + pop edi edx + cmp [value_type],0 + jne invalid_use_of_symbol + cmp byte [esi],84h + jne pe_settings_ok + get_stub_name: + lods byte [esi] + lods word [esi] + cmp ax,'(' + jne invalid_argument + lods dword [esi] + mov edx,esi + add esi,eax + inc esi + pe_settings_ok: + mov ebp,[stub_size] + or ebp,ebp + jz make_pe_stub + cmp edx,[stub_file] + je pe_stub_ok + sub edi,[stub_size] + mov [code_start],edi + make_pe_stub: + call make_stub + mov eax,edi + sub eax,[code_start] + mov [stub_size],eax + mov [code_start],edi + mov ebp,eax + pe_stub_ok: + mov edx,edi + mov ecx,18h+0E0h + test [format_flags],8 + jz zero_pe_header + add ecx,10h + zero_pe_header: + add ebp,ecx + shr ecx,2 + xor eax,eax + rep stos dword [edi] + mov word [edx],'PE' ; signature + mov ax,[machine] + mov word [edx+4],ax + mov dword [edx+38h],1000h ; section alignment + mov dword [edx+3Ch],200h ; file alignment + mov word [edx+40h],1 ; OS version + mov eax,[subsystem_version] + mov [edx+48h],eax + mov ax,[subsystem] + mov [edx+5Ch],ax + cmp ax,1 + jne pe_alignment_ok + mov eax,20h + mov dword [edx+38h],eax + mov dword [edx+3Ch],eax + pe_alignment_ok: + mov word [edx+1Ah],VERSION_MAJOR + VERSION_MINOR shl 8 + test [format_flags],8 + jnz init_pe64_specific + mov dword [edx+14h],0E0h ; size of optional header + mov dword [edx+16h],10B010Eh; flags and magic value + mov eax,[image_base] + mov dword [edx+34h],eax + mov dword [edx+60h],1000h ; stack reserve + mov dword [edx+64h],1000h ; stack commit + mov dword [edx+68h],10000h ; heap reserve + mov dword [edx+6Ch],0 ; heap commit + mov dword [edx+74h],16 ; number of directories + jmp pe_header_ok + init_pe64_specific: + mov dword [edx+14h],0F0h ; size of optional header + mov dword [edx+16h],20B002Eh; flags and magic value + mov eax,[image_base] + mov dword [edx+30h],eax + mov eax,[image_base_high] + mov dword [edx+34h],eax + mov dword [edx+60h],1000h ; stack reserve + mov dword [edx+68h],1000h ; stack commit + mov dword [edx+70h],10000h ; heap reserve + mov dword [edx+78h],0 ; heap commit + mov dword [edx+84h],16 ; number of directories + pe_header_ok: + bsf ecx,[edx+3Ch] + imul ebx,[number_of_sections],28h + or ebx,ebx + jnz reserve_space_for_section_headers + mov ebx,28h + reserve_space_for_section_headers: + add ebx,ebp + dec ebx + shr ebx,cl + inc ebx + shl ebx,cl + sub ebx,ebp + mov ecx,ebx + mov eax,[display_buffer] + sub eax,ecx + cmp edi,eax + jae out_of_memory + shr ecx,2 + xor eax,eax + rep stos dword [edi] + mov eax,edi + sub eax,[code_start] + add eax,[stub_size] + mov [edx+54h],eax ; size of headers + mov ecx,[edx+38h] + dec ecx + add eax,ecx + not ecx + and eax,ecx + bt [format_flags],8 + jc pe_entry_init_ok + mov [edx+28h],eax ; entry point rva + pe_entry_init_ok: + mov [number_of_sections],0 + movzx ebx,word [edx+14h] + lea ebx,[edx+18h+ebx] + mov [current_section],ebx + mov dword [ebx],'.fla' + mov dword [ebx+4],'t' + mov [ebx+14h],edi + mov [ebx+0Ch],eax + mov dword [ebx+24h],0E0000060h + xor ecx,ecx + not eax + not ecx + add eax,1 + adc ecx,0 + add eax,edi + adc ecx,0 + test [format_flags],8 + jnz pe64_org + sub eax,[edx+34h] + sbb ecx,0 + mov [labels_type],2 + mov [code_type],32 + jmp pe_org_ok + pe64_org: + sub eax,[edx+30h] + sbb ecx,[edx+34h] + mov [labels_type],4 + mov [code_type],64 + pe_org_ok: + mov dword [org_origin],eax + mov dword [org_origin+4],ecx + mov [org_registers],0 + mov [org_start],edi + bt [format_flags],8 + jnc dll_flag_ok + or dword [edx+16h],2000h + dll_flag_ok: + bt [format_flags],9 + jnc wdm_flag_ok + or word [edx+5Eh],2000h + wdm_flag_ok: + jmp instruction_assembled +pe_section: + call close_pe_section + bts [format_flags],5 + lea ecx,[ebx+28h] + add edx,[edx+54h] + sub edx,[stub_size] + cmp ecx,edx + jbe new_section + lea ebx,[edx-28h] + or [next_pass_needed],-1 + push edi + mov edi,ebx + mov ecx,28h shr 4 + xor eax,eax + rep stos dword [edi] + pop edi + new_section: + mov [ebx+0Ch],eax + lods word [esi] + cmp ax,'(' + jne invalid_argument + lea edx,[esi+4] + mov ecx,[esi] + lea esi,[esi+4+ecx+1] + cmp ecx,8 + ja name_too_long + xor eax,eax + mov [ebx],eax + mov [ebx+4],eax + push esi edi + mov edi,ebx + mov esi,edx + rep movs byte [edi],[esi] + pop edi esi + mov dword [ebx+24h],0 + mov [ebx+14h],edi + mov edx,[code_start] + mov eax,edi + xor ecx,ecx + sub eax,[ebx+0Ch] + sbb ecx,0 + test [format_flags],8 + jnz pe64_section_org + sub eax,[edx+34h] + sbb ecx,0 + mov [labels_type],2 + mov [code_type],32 + jmp pe_section_org_ok + pe64_section_org: + sub eax,[edx+30h] + sbb ecx,[edx+34h] + mov [labels_type],4 + mov [code_type],64 + pe_section_org_ok: + mov dword [org_origin],eax + mov dword [org_origin+4],ecx + mov [org_registers],0 + mov [org_start],edi + get_section_flags: + lods byte [esi] + cmp al,1Ah + je set_directory + cmp al,19h + je section_flag + dec esi + jmp instruction_assembled + set_directory: + movzx eax,byte [esi] + inc esi + mov ecx,ebx + test [format_flags],8 + jnz pe64_directory + xchg ecx,[edx+78h+eax*8] + mov dword [edx+78h+eax*8+4],-1 + jmp pe_directory_set + pe64_directory: + xchg ecx,[edx+88h+eax*8] + mov dword [edx+88h+eax*8+4],-1 + pe_directory_set: + or ecx,ecx + jnz data_already_defined + push ebx edx + call generate_pe_data + pop edx ebx + jmp get_section_flags + section_flag: + lods byte [esi] + mov cl,al + mov eax,1 + shl eax,cl + test dword [ebx+24h],eax + jnz setting_already_specified + or dword [ebx+24h],eax + jmp get_section_flags + close_pe_section: + mov ebx,[current_section] + mov edx,[code_start] + mov eax,edi + sub eax,[ebx+14h] + jnz finish_section + bt [format_flags],5 + jc finish_section + mov eax,[ebx+0Ch] + ret + finish_section: + mov [ebx+8],eax + cmp edi,[undefined_data_end] + jne align_section + cmp dword [edx+38h],1000h + jb align_section + mov edi,[undefined_data_start] + align_section: + mov [undefined_data_end],0 + mov ebp,edi + sub ebp,[ebx+14h] + mov ecx,[edx+3Ch] + dec ecx + lea eax,[ebp+ecx] + not ecx + and eax,ecx + mov [ebx+10h],eax + sub eax,ebp + mov ecx,eax + xor al,al + rep stos byte [edi] + mov eax,[code_start] + sub eax,[stub_size] + sub [ebx+14h],eax + mov eax,[ebx+8] + or eax,eax + jz udata_ok + cmp dword [ebx+10h],0 + jne udata_ok + or byte [ebx+24h],80h + udata_ok: + mov ecx,[edx+38h] + dec ecx + add eax,ecx + not ecx + and eax,ecx + add eax,[ebx+0Ch] + add ebx,28h + mov [current_section],ebx + inc word [number_of_sections] + jz format_limitations_exceeded + ret +data_directive: + cmp [output_format],3 + jne illegal_instruction + lods byte [esi] + cmp al,1Ah + je predefined_data_type + cmp al,'(' + jne invalid_argument + call get_byte_value + cmp al,16 + jb data_type_ok + jmp invalid_value + predefined_data_type: + movzx eax,byte [esi] + inc esi + data_type_ok: + mov ebx,[current_section] + mov ecx,edi + sub ecx,[ebx+14h] + add ecx,[ebx+0Ch] + mov edx,[code_start] + test [format_flags],8 + jnz pe64_data + xchg ecx,[edx+78h+eax*8] + jmp init_pe_data + pe64_data: + xchg ecx,[edx+88h+eax*8] + init_pe_data: + or ecx,ecx + jnz data_already_defined + call allocate_structure_data + mov word [ebx],data_directive-assembler + mov [ebx+2],al + mov edx,[current_line] + mov [ebx+4],edx + call generate_pe_data + jmp instruction_assembled + end_data: + cmp [output_format],3 + jne illegal_instruction + call find_structure_data + jc unexpected_instruction + movzx eax,byte [ebx+2] + mov edx,[current_section] + mov ecx,edi + sub ecx,[edx+14h] + add ecx,[edx+0Ch] + mov edx,[code_start] + test [format_flags],8 + jnz end_pe64_data + sub ecx,[edx+78h+eax*8] + mov [edx+78h+eax*8+4],ecx + jmp remove_structure_data + end_pe64_data: + sub ecx,[edx+88h+eax*8] + mov [edx+88h+eax*8+4],ecx + jmp remove_structure_data +pe_entry: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + test [format_flags],8 + jnz pe64_entry + call get_dword_value + cmp [value_type],2 + je pe_entry_ok + cmp [error_line],0 + jne pe_entry_ok + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_address + pe_entry_ok: + mov edx,[code_start] + sub eax,[edx+34h] + mov [edx+28h],eax + jmp instruction_assembled + pe64_entry: + call get_qword_value + cmp [value_type],4 + je pe64_entry_ok + cmp [error_line],0 + jne pe64_entry_ok + mov eax,[current_line] + mov [error_line],eax + mov [error],invalid_address + pe64_entry_ok: + mov ecx,[code_start] + sub eax,[ecx+30h] + sbb edx,[ecx+34h] + jnz value_out_of_range + mov [ecx+28h],eax + jmp instruction_assembled +pe_stack: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + test [format_flags],8 + jnz pe64_stack + call get_dword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,[code_start] + mov [edx+60h],eax + cmp byte [esi],',' + jne default_stack_commit + lods byte [esi] + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_dword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,[code_start] + mov [edx+64h],eax + cmp eax,[edx+60h] + ja value_out_of_range + jmp instruction_assembled + default_stack_commit: + mov dword [edx+64h],1000h + mov eax,[edx+60h] + cmp eax,1000h + ja instruction_assembled + mov dword [edx+64h],eax + jmp instruction_assembled + pe64_stack: + call get_qword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov ecx,[code_start] + mov [ecx+60h],eax + mov [ecx+64h],edx + cmp byte [esi],',' + jne default_pe64_stack_commit + lods byte [esi] + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_qword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov ecx,[code_start] + mov [ecx+68h],eax + mov [ecx+6Ch],edx + cmp edx,[ecx+64h] + ja value_out_of_range + jb instruction_assembled + cmp eax,[edx+60h] + ja value_out_of_range + jmp instruction_assembled + default_pe64_stack_commit: + mov dword [edx+68h],1000h + cmp dword [edx+64h],0 + jne instruction_assembled + mov eax,[edx+60h] + cmp eax,1000h + ja instruction_assembled + mov dword [edx+68h],eax + jmp instruction_assembled +pe_heap: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + test [format_flags],8 + jnz pe64_heap + call get_dword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,[code_start] + mov [edx+68h],eax + cmp byte [esi],',' + jne instruction_assembled + lods byte [esi] + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_dword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,[code_start] + mov [edx+6Ch],eax + cmp eax,[edx+68h] + ja value_out_of_range + jmp instruction_assembled + pe64_heap: + call get_qword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov ecx,[code_start] + mov [ecx+70h],eax + mov [ecx+74h],edx + cmp byte [esi],',' + jne instruction_assembled + lods byte [esi] + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + call get_qword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov ecx,[code_start] + mov [ecx+78h],eax + mov [ecx+7Ch],edx + cmp edx,[ecx+74h] + ja value_out_of_range + jb instruction_assembled + cmp eax,[edx+70h] + ja value_out_of_range + jmp instruction_assembled +mark_pe_relocation: + push eax ebx + mov ebx,[current_section] + mov eax,edi + sub eax,[ebx+14h] + add eax,[ebx+0Ch] + mov ebx,[free_additional_memory] + inc [number_of_relocations] + jz invalid_use_of_symbol + mov [ebx],eax + add ebx,4 + cmp ebx,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],ebx + pop ebx eax + ret +generate_pe_data: + cmp al,2 + je make_pe_resource + cmp al,5 + je make_pe_fixups + ret +make_pe_resource: + cmp byte [esi],82h + jne resource_done + inc esi + lods word [esi] + cmp ax,'(' + jne invalid_argument + lods dword [esi] + mov edx,esi + lea esi,[esi+eax+1] + cmp [next_pass_needed],0 + je resource_from_file + cmp [current_pass],0 + jne reserve_space_for_resource + mov [resource_size],0 + reserve_space_for_resource: + add edi,[resource_size] + cmp edi,[display_buffer] + ja out_of_memory + jmp resource_done + resource_from_file: + push esi + mov esi,edx + call open_binary_file + push ebx + mov esi,[free_additional_memory] + lea eax,[esi+20h] + cmp eax,[structures_buffer] + ja out_of_memory + mov edx,esi + mov ecx,20h + call read + jc invalid_file_format + xor eax,eax + cmp [esi],eax + jne invalid_file_format + mov ax,0FFFFh + cmp [esi+8],eax + jne invalid_file_format + cmp [esi+12],eax + jne invalid_file_format + mov eax,20h + cmp [esi+4],eax + jne invalid_file_format + read_resource_headers: + test eax,11b + jz resource_file_alignment_ok + mov edx,4 + and eax,11b + sub edx,eax + mov al,1 + call lseek + resource_file_alignment_ok: + mov [esi],eax + lea edx,[esi+12] + mov ecx,8 + call read + jc resource_headers_ok + mov ecx,[esi+16] + add [esi],ecx + lea edx,[esi+20] + sub ecx,8 + mov [esi+16],ecx + lea eax,[edx+ecx] + cmp eax,[structures_buffer] + ja out_of_memory + call read + jc invalid_file_format + mov edx,[esi] + add edx,[esi+12] + mov eax,[esi+16] + lea ecx,[esi+20] + lea esi,[ecx+eax] + add ecx,2 + cmp word [ecx-2],0FFFFh + je resource_header_type_ok + check_resource_header_type: + cmp ecx,esi + jae invalid_file_format + cmp word [ecx],0 + je resource_header_type_ok + add ecx,2 + jmp check_resource_header_type + resource_header_type_ok: + add ecx,2 + cmp word [ecx],0FFFFh + je resource_header_name_ok + check_resource_header_name: + cmp ecx,esi + jae invalid_file_format + cmp word [ecx],0 + je resource_header_name_ok + add ecx,2 + jmp check_resource_header_name + resource_header_name_ok: + xor al,al + call lseek + jmp read_resource_headers + resource_headers_ok: + xor eax,eax + mov [esi],eax + mov [resource_data],edi + lea eax,[edi+16] + cmp eax,[display_buffer] + jae out_of_memory + xor eax,eax + stos dword [edi] + call make_timestamp + stos dword [edi] + xor eax,eax + stos dword [edi] + stos dword [edi] + xor ebx,ebx + make_type_name_directory: + mov esi,[free_additional_memory] + xor edx,edx + find_type_name: + cmp dword [esi],0 + je type_name_ok + add esi,20 + cmp word [esi],0FFFFh + je check_next_type_name + or ebx,ebx + jz check_this_type_name + xor ecx,ecx + compare_with_previous_type_name: + mov ax,[esi+ecx] + cmp ax,[ebx+ecx] + ja check_this_type_name + jb check_next_type_name + add ecx,2 + mov ax,[esi+ecx] + or ax,[ebx+ecx] + jnz compare_with_previous_type_name + jmp check_next_type_name + check_this_type_name: + or edx,edx + jz type_name_found + xor ecx,ecx + compare_with_current_type_name: + mov ax,[esi+ecx] + cmp ax,[edx+ecx] + ja check_next_type_name + jb type_name_found + add ecx,2 + mov ax,[esi+ecx] + or ax,[edx+ecx] + jnz compare_with_current_type_name + jmp same_type_name + type_name_found: + mov edx,esi + same_type_name: + mov [esi-16],edi + check_next_type_name: + mov eax,[esi-4] + add esi,eax + jmp find_type_name + type_name_ok: + or edx,edx + jz type_name_directory_done + mov ebx,edx + make_type_name_entry: + mov eax,[resource_data] + inc word [eax+12] + lea eax,[edi+8] + cmp eax,[display_buffer] + jae out_of_memory + mov eax,ebx + stos dword [edi] + xor eax,eax + stos dword [edi] + jmp make_type_name_directory + type_name_directory_done: + mov ebx,-1 + make_type_id_directory: + mov esi,[free_additional_memory] + mov edx,10000h + find_type_id: + cmp dword [esi],0 + je type_id_ok + add esi,20 + cmp word [esi],0FFFFh + jne check_next_type_id + movzx eax,word [esi+2] + cmp eax,ebx + jle check_next_type_id + cmp eax,edx + jg check_next_type_id + mov edx,eax + mov [esi-16],edi + check_next_type_id: + mov eax,[esi-4] + add esi,eax + jmp find_type_id + type_id_ok: + cmp edx,10000h + je type_id_directory_done + mov ebx,edx + make_type_id_entry: + mov eax,[resource_data] + inc word [eax+14] + lea eax,[edi+8] + cmp eax,[display_buffer] + jae out_of_memory + mov eax,ebx + stos dword [edi] + xor eax,eax + stos dword [edi] + jmp make_type_id_directory + type_id_directory_done: + mov esi,[resource_data] + add esi,10h + mov ecx,[esi-4] + or cx,cx + jz resource_directories_ok + make_resource_directories: + push ecx + push edi + mov edx,edi + sub edx,[resource_data] + bts edx,31 + mov [esi+4],edx + lea eax,[edi+16] + cmp eax,[display_buffer] + jae out_of_memory + xor eax,eax + stos dword [edi] + call make_timestamp + stos dword [edi] + xor eax,eax + stos dword [edi] + stos dword [edi] + mov ebp,esi + xor ebx,ebx + make_resource_name_directory: + mov esi,[free_additional_memory] + xor edx,edx + find_resource_name: + cmp dword [esi],0 + je resource_name_ok + push esi + cmp [esi+4],ebp + jne check_next_resource_name + add esi,20 + call skip_resource_name + cmp word [esi],0FFFFh + je check_next_resource_name + or ebx,ebx + jz check_this_resource_name + xor ecx,ecx + compare_with_previous_resource_name: + mov ax,[esi+ecx] + cmp ax,[ebx+ecx] + ja check_this_resource_name + jb check_next_resource_name + add ecx,2 + mov ax,[esi+ecx] + or ax,[ebx+ecx] + jnz compare_with_previous_resource_name + jmp check_next_resource_name + skip_resource_name: + cmp word [esi],0FFFFh + jne skip_unicode_string + add esi,4 + ret + skip_unicode_string: + add esi,2 + cmp word [esi-2],0 + jne skip_unicode_string + ret + check_this_resource_name: + or edx,edx + jz resource_name_found + xor ecx,ecx + compare_with_current_resource_name: + mov ax,[esi+ecx] + cmp ax,[edx+ecx] + ja check_next_resource_name + jb resource_name_found + add ecx,2 + mov ax,[esi+ecx] + or ax,[edx+ecx] + jnz compare_with_current_resource_name + jmp same_resource_name + resource_name_found: + mov edx,esi + same_resource_name: + mov eax,[esp] + mov [eax+8],edi + check_next_resource_name: + pop esi + mov eax,[esi+16] + lea esi,[esi+20+eax] + jmp find_resource_name + resource_name_ok: + or edx,edx + jz resource_name_directory_done + mov ebx,edx + make_resource_name_entry: + mov eax,[esp] + inc word [eax+12] + lea eax,[edi+8] + cmp eax,[display_buffer] + jae out_of_memory + mov eax,ebx + stos dword [edi] + xor eax,eax + stos dword [edi] + jmp make_resource_name_directory + resource_name_directory_done: + mov ebx,-1 + make_resource_id_directory: + mov esi,[free_additional_memory] + mov edx,10000h + find_resource_id: + cmp dword [esi],0 + je resource_id_ok + push esi + cmp [esi+4],ebp + jne check_next_resource_id + add esi,20 + call skip_resource_name + cmp word [esi],0FFFFh + jne check_next_resource_id + movzx eax,word [esi+2] + cmp eax,ebx + jle check_next_resource_id + cmp eax,edx + jg check_next_resource_id + mov edx,eax + mov eax,[esp] + mov [eax+8],edi + check_next_resource_id: + pop esi + mov eax,[esi+16] + lea esi,[esi+20+eax] + jmp find_resource_id + resource_id_ok: + cmp edx,10000h + je resource_id_directory_done + mov ebx,edx + make_resource_id_entry: + mov eax,[esp] + inc word [eax+14] + lea eax,[edi+8] + cmp eax,[display_buffer] + jae out_of_memory + mov eax,ebx + stos dword [edi] + xor eax,eax + stos dword [edi] + jmp make_resource_id_directory + resource_id_directory_done: + pop eax + mov esi,ebp + pop ecx + add esi,8 + dec cx + jnz make_resource_directories + resource_directories_ok: + shr ecx,16 + jnz make_resource_directories + mov esi,[resource_data] + add esi,10h + movzx eax,word [esi-4] + movzx edx,word [esi-2] + add eax,edx + lea esi,[esi+eax*8] + push edi ; address of language directories + update_resource_directories: + cmp esi,[esp] + je resource_directories_updated + add esi,10h + mov ecx,[esi-4] + or cx,cx + jz language_directories_ok + make_language_directories: + push ecx + push edi + mov edx,edi + sub edx,[resource_data] + bts edx,31 + mov [esi+4],edx + lea eax,[edi+16] + cmp eax,[display_buffer] + jae out_of_memory + xor eax,eax + stos dword [edi] + call make_timestamp + stos dword [edi] + xor eax,eax + stos dword [edi] + stos dword [edi] + mov ebp,esi + mov ebx,-1 + make_language_id_directory: + mov esi,[free_additional_memory] + mov edx,10000h + find_language_id: + cmp dword [esi],0 + je language_id_ok + push esi + cmp [esi+8],ebp + jne check_next_language_id + add esi,20 + mov eax,esi + call skip_resource_name + call skip_resource_name + neg eax + add eax,esi + and eax,11b + add esi,eax + get_language_id: + movzx eax,word [esi+6] + cmp eax,ebx + jle check_next_language_id + cmp eax,edx + jge check_next_language_id + mov edx,eax + mov eax,[esp] + mov [current_offset],eax + check_next_language_id: + pop esi + mov eax,[esi+16] + lea esi,[esi+20+eax] + jmp find_language_id + language_id_ok: + cmp edx,10000h + je language_id_directory_done + mov ebx,edx + make_language_id_entry: + mov eax,[esp] + inc word [eax+14] + lea eax,[edi+8] + cmp eax,[display_buffer] + jae out_of_memory + mov eax,ebx + stos dword [edi] + mov eax,[current_offset] + stos dword [edi] + jmp make_language_id_directory + language_id_directory_done: + pop eax + mov esi,ebp + pop ecx + add esi,8 + dec cx + jnz make_language_directories + language_directories_ok: + shr ecx,16 + jnz make_language_directories + jmp update_resource_directories + resource_directories_updated: + mov esi,[resource_data] + push edi + make_name_strings: + add esi,10h + movzx eax,word [esi-2] + movzx ecx,word [esi-4] + add eax,ecx + lea eax,[esi+eax*8] + push eax + or ecx,ecx + jz string_entries_processed + process_string_entries: + push ecx + mov edx,edi + sub edx,[resource_data] + bts edx,31 + xchg [esi],edx + mov ebx,edi + xor ax,ax + stos word [edi] + copy_string_data: + lea eax,[edi+2] + cmp eax,[display_buffer] + jae out_of_memory + mov ax,[edx] + or ax,ax + jz string_data_copied + stos word [edi] + inc word [ebx] + add edx,2 + jmp copy_string_data + string_data_copied: + add esi,8 + pop ecx + loop process_string_entries + string_entries_processed: + pop esi + cmp esi,[esp] + jb make_name_strings + mov eax,edi + sub eax,[resource_data] + test al,11b + jz resource_strings_alignment_ok + xor ax,ax + stos word [edi] + resource_strings_alignment_ok: + pop edx + pop ebx ; address of language directories + mov ebp,edi + update_language_directories: + add ebx,10h + movzx eax,word [ebx-2] + movzx ecx,word [ebx-4] + add ecx,eax + make_data_records: + push ecx + mov esi,edi + sub esi,[resource_data] + xchg esi,[ebx+4] + lea eax,[edi+16] + cmp eax,[display_buffer] + jae out_of_memory + mov eax,esi + stos dword [edi] + mov eax,[esi+12] + stos dword [edi] + xor eax,eax + stos dword [edi] + stos dword [edi] + pop ecx + add ebx,8 + loop make_data_records + cmp ebx,edx + jb update_language_directories + pop ebx ; file handle + mov esi,ebp + mov ebp,edi + update_data_records: + push ebp + mov ecx,edi + mov eax,[current_section] + sub ecx,[eax+14h] + add ecx,[eax+0Ch] + xchg ecx,[esi] + mov edx,[ecx] + xor al,al + call lseek + mov edx,edi + mov ecx,[esi+4] + add edi,ecx + cmp edi,[display_buffer] + ja out_of_memory + call read + mov eax,edi + sub eax,[resource_data] + and eax,11b + jz resource_data_alignment_ok + mov ecx,4 + sub ecx,eax + xor al,al + rep stos byte [edi] + resource_data_alignment_ok: + pop ebp + add esi,16 + cmp esi,ebp + jb update_data_records + pop esi + call close + mov eax,edi + sub eax,[resource_data] + mov [resource_size],eax + resource_done: + ret +make_pe_fixups: + push esi + mov ecx,[number_of_relocations] + jecxz fixups_done + mov esi,[free_additional_memory] + mov eax,ecx + shl eax,2 + sub esi,eax + mov [free_additional_memory],esi + or [number_of_relocations],-1 + xor edx,edx + mov ebp,edi + make_fixups: + cmp [esi],edx + jb store_fixup + mov eax,edi + sub eax,ebp + test eax,11b + jz fixups_block + xor ax,ax + stos word [edi] + add dword [ebx],2 + fixups_block: + mov eax,edx + add edx,1000h + cmp [esi],edx + jae fixups_block + stos dword [edi] + mov ebx,edi + mov eax,8 + stos dword [edi] + store_fixup: + add dword [ebx],2 + mov eax,[esi] + and ax,0FFFh + test [format_flags],8 + jnz fixup_64bit + or ax,3000h + jmp fixup_ok + fixup_64bit: + or ax,0A000h + fixup_ok: + stos word [edi] + add esi,4 + loop make_fixups + fixups_done: + pop esi + ret +close_pe: + call close_pe_section + mov edx,[code_start] + mov [edx+50h],eax + call make_timestamp + mov edx,[code_start] + mov [edx+8],eax + mov eax,[number_of_relocations] + cmp eax,0 + jle pe_flags_ok + or word [edx+16h],1 + shl eax,2 + sub [free_additional_memory],eax + pe_flags_ok: + mov eax,[number_of_sections] + mov [edx+6],ax + imul eax,28h + movzx ecx,word [edx+14h] + lea eax,[eax+18h+ecx] + add eax,[stub_size] + mov ecx,[edx+3Ch] + dec ecx + add eax,ecx + not ecx + and eax,ecx + cmp eax,[edx+54h] + je pe_sections_ok + or [next_pass_needed],-1 + pe_sections_ok: + xor ecx,ecx + add edx,78h + test [format_flags],8 + jz process_directories + add edx,10h + process_directories: + mov eax,[edx+ecx*8] + or eax,eax + jz directory_ok + cmp dword [edx+ecx*8+4],-1 + jne directory_ok + section_data: + mov ebx,[edx+ecx*8] + mov eax,[ebx+0Ch] + mov [edx+ecx*8],eax ; directory rva + mov eax,[ebx+8] + mov [edx+ecx*8+4],eax ; directory size + directory_ok: + inc cl + cmp cl,10h + jb process_directories + mov ebx,[code_start] + sub ebx,[stub_size] + mov ecx,edi + sub ecx,ebx + mov ebp,ecx + shr ecx,1 + xor eax,eax + cdq + calculate_checksum: + mov dx,[ebx] + add eax,edx + mov dx,ax + shr eax,16 + add eax,edx + add ebx,2 + loop calculate_checksum + add eax,ebp + mov ebx,[code_start] + mov [ebx+58h],eax + ret + +format_coff: + mov eax,[additional_memory] + mov [symbols_stream],eax + mov ebx,eax + add eax,18h + cmp eax,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],eax + xor eax,eax + mov [ebx],al + mov [ebx+4],eax + mov [ebx+8],edi + mov al,4 + mov [ebx+10h],eax + mov al,60h + bt [format_flags],0 + jnc flat_section_flags_ok + or eax,0E0000000h + flat_section_flags_ok: + mov dword [ebx+14h],eax + mov [current_section],ebx + mov [number_of_sections],0 + mov dword [org_origin],edi + mov dword [org_origin+4],0 + mov [org_registers],0 + mov [org_start],edi + mov [org_symbol],ebx + mov [labels_type],2 + mov [code_type],32 + test [format_flags],8 + jz instruction_assembled + mov [labels_type],4 + mov [code_type],64 + jmp instruction_assembled +coff_section: + call close_coff_section + mov ebx,[free_additional_memory] + lea eax,[ebx+18h] + cmp eax,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],eax + mov [current_section],ebx + inc [number_of_sections] + xor eax,eax + mov [ebx],al + mov [ebx+8],edi + mov dword [org_origin],edi + mov dword [org_origin+4],0 + mov [org_registers],0 + mov [org_start],edi + mov [org_symbol],ebx + mov [labels_type],2 + test [format_flags],8 + jz coff_labels_type_ok + mov [labels_type],4 + coff_labels_type_ok: + mov [ebx+10h],eax + mov [ebx+14h],eax + lods word [esi] + cmp ax,'(' + jne invalid_argument + mov [ebx+4],esi + mov ecx,[esi] + lea esi,[esi+4+ecx+1] + cmp ecx,8 + ja name_too_long + coff_section_flags: + cmp byte [esi],1Ch + je coff_section_alignment + cmp byte [esi],19h + jne coff_section_settings_ok + inc esi + lods byte [esi] + bt [format_flags],0 + jc coff_section_flag_ok + cmp al,7 + ja invalid_argument + coff_section_flag_ok: + mov cl,al + mov eax,1 + shl eax,cl + test dword [ebx+14h],eax + jnz setting_already_specified + or dword [ebx+14h],eax + jmp coff_section_flags + coff_section_alignment: + bt [format_flags],0 + jnc invalid_argument + inc esi + lods byte [esi] + or al,al + jnz invalid_argument + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + push ebx + call get_dword_value + pop ebx + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,eax + dec edx + test eax,edx + jnz invalid_value + or eax,eax + jz invalid_value + cmp eax,2000h + ja invalid_value + bsf edx,eax + inc edx + shl edx,20 + or [ebx+14h],edx + xchg [ebx+10h],eax + or eax,eax + jnz setting_already_specified + jmp coff_section_flags + coff_section_settings_ok: + cmp dword [ebx+10h],0 + jne instruction_assembled + mov dword [ebx+10h],4 + bt [format_flags],0 + jnc instruction_assembled + or dword [ebx+14h],300000h + jmp instruction_assembled + close_coff_section: + mov ebx,[current_section] + mov eax,edi + mov edx,[ebx+8] + sub eax,edx + mov [ebx+0Ch],eax + xor eax,eax + xchg [undefined_data_end],eax + cmp eax,edi + jne coff_section_ok + cmp edx,[undefined_data_start] + jne coff_section_ok + mov edi,edx + or byte [ebx+14h],80h + coff_section_ok: + ret +mark_coff_relocation: + cmp [value_type],3 + je coff_relocation_relative + push ebx eax + test [format_flags],8 + jnz coff_64bit_relocation + mov al,6 + jmp coff_relocation + coff_64bit_relocation: + mov al,1 + jmp coff_relocation + coff_relocation_relative: + push ebx + bt [format_flags],0 + jnc relative_ok + mov ebx,[current_section] + mov ebx,[ebx+8] + sub ebx,edi + sub eax,ebx + add eax,4 + relative_ok: + push eax + mov al,20 + test [format_flags],8 + jnz relative_coff_64bit_relocation + cmp [labels_type],2 + jne invalid_use_of_symbol + jmp coff_relocation + relative_coff_64bit_relocation: + mov al,4 + cmp [labels_type],4 + jne invalid_use_of_symbol + coff_relocation: + mov ebx,[free_additional_memory] + add ebx,0Ch + cmp ebx,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],ebx + mov byte [ebx-0Ch],al + mov eax,[current_section] + mov eax,[eax+8] + neg eax + add eax,edi + mov [ebx-0Ch+4],eax + mov eax,[symbol_identifier] + mov [ebx-0Ch+8],eax + pop eax ebx + ret +close_coff: + call close_coff_section + cmp [next_pass_needed],0 + je coff_closed + mov eax,[symbols_stream] + mov [free_additional_memory],eax + coff_closed: + ret +coff_formatter: + sub edi,[code_start] + mov [code_size],edi + call prepare_default_section + mov edi,[free_additional_memory] + mov ebx,edi + mov ecx,28h shr 2 + imul ecx,[number_of_sections] + add ecx,14h shr 2 + lea eax,[edi+ecx*4] + cmp eax,[structures_buffer] + jae out_of_memory + xor eax,eax + rep stos dword [edi] + mov word [ebx],14Ch + test [format_flags],8 + jz coff_magic_ok + mov word [ebx],8664h + coff_magic_ok: + mov word [ebx+12h],104h + bt [format_flags],0 + jnc coff_flags_ok + or byte [ebx+12h],80h + coff_flags_ok: + push ebx + call make_timestamp + pop ebx + mov [ebx+4],eax + mov eax,[number_of_sections] + mov [ebx+2],ax + mov esi,[symbols_stream] + xor ecx,ecx + enumerate_symbols: + cmp esi,[free_additional_memory] + je symbols_enumerated + mov dl,[esi] + or dl,dl + jz enumerate_section + cmp dl,80h + je enumerate_public + ja enumerate_extrn + add esi,0Ch + jmp enumerate_symbols + enumerate_section: + mov edx,ecx + shl edx,8 + mov [esi],edx + inc ecx + add esi,18h + jmp enumerate_symbols + enumerate_public: + mov edx,eax + shl edx,8 + mov dl,80h + mov [esi],edx + mov edx,[esi+8] + add esi,10h + inc eax + cmp byte [edx+11],2 + jne enumerate_symbols + mov edx,[edx+20] + cmp byte [edx],81h + jne enumerate_symbols + inc eax + jmp enumerate_symbols + enumerate_extrn: + mov edx,eax + shl edx,8 + mov dl,81h + mov [esi],edx + add esi,0Ch + inc eax + jmp enumerate_symbols + prepare_default_section: + mov ebx,[symbols_stream] + cmp dword [ebx+0Ch],0 + jne default_section_ok + cmp [number_of_sections],0 + je default_section_ok + mov edx,ebx + find_references_to_default_section: + cmp ebx,[free_additional_memory] + jne check_reference + add [symbols_stream],18h + ret + check_reference: + mov al,[ebx] + or al,al + jz skip_other_section + cmp al,80h + je check_public_reference + ja next_reference + cmp edx,[ebx+8] + je default_section_ok + next_reference: + add ebx,0Ch + jmp find_references_to_default_section + check_public_reference: + mov eax,[ebx+8] + add ebx,10h + test byte [eax+8],1 + jz find_references_to_default_section + mov cx,[current_pass] + cmp cx,[eax+16] + jne find_references_to_default_section + cmp edx,[eax+20] + je default_section_ok + jmp find_references_to_default_section + skip_other_section: + add ebx,18h + jmp find_references_to_default_section + default_section_ok: + inc [number_of_sections] + ret + symbols_enumerated: + mov [ebx+0Ch],eax + mov ebp,edi + sub ebp,ebx + push ebp + lea edi,[ebx+14h] + mov esi,[symbols_stream] + find_section: + cmp esi,[free_additional_memory] + je sections_finished + mov al,[esi] + or al,al + jz section_found + add esi,0Ch + cmp al,80h + jne find_section + add esi,4 + jmp find_section + section_found: + push esi edi + mov esi,[esi+4] + or esi,esi + jz default_section + mov ecx,[esi] + add esi,4 + rep movs byte [edi],[esi] + jmp section_name_ok + default_section: + mov al,'.' + stos byte [edi] + mov eax,'flat' + stos dword [edi] + section_name_ok: + pop edi esi + mov eax,[esi+0Ch] + mov [edi+10h],eax + mov eax,[esi+14h] + mov [edi+24h],eax + test al,80h + jnz section_ptr_ok + mov eax,[esi+8] + sub eax,[code_start] + add eax,ebp + mov [edi+14h],eax + section_ptr_ok: + mov ebx,[code_start] + mov edx,[code_size] + add ebx,edx + add edx,ebp + xor ecx,ecx + add esi,18h + find_relocations: + cmp esi,[free_additional_memory] + je section_relocations_done + mov al,[esi] + or al,al + jz section_relocations_done + cmp al,80h + jb add_relocation + ja next_relocation + add esi,10h + jmp find_relocations + add_relocation: + lea eax,[ebx+0Ah] + cmp eax,[display_buffer] + ja out_of_memory + mov eax,[esi+4] + mov [ebx],eax + mov eax,[esi+8] + mov eax,[eax] + shr eax,8 + mov [ebx+4],eax + movzx ax,byte [esi] + mov [ebx+8],ax + add ebx,0Ah + inc ecx + next_relocation: + add esi,0Ch + jmp find_relocations + section_relocations_done: + cmp ecx,10000h + jb section_relocations_count_16bit + bt [format_flags],0 + jnc format_limitations_exceeded + mov word [edi+20h],0FFFFh + or dword [edi+24h],1000000h + mov [edi+18h],edx + push esi edi + push ecx + lea esi,[ebx-1] + add ebx,0Ah + lea edi,[ebx-1] + imul ecx,0Ah + std + rep movs byte [edi],[esi] + cld + pop ecx + inc esi + inc ecx + mov [esi],ecx + xor eax,eax + mov [esi+4],eax + mov [esi+8],ax + pop edi esi + jmp section_relocations_ok + section_relocations_count_16bit: + mov [edi+20h],cx + jcxz section_relocations_ok + mov [edi+18h],edx + section_relocations_ok: + sub ebx,[code_start] + mov [code_size],ebx + add edi,28h + jmp find_section + sections_finished: + mov edx,[free_additional_memory] + mov ebx,[code_size] + add ebp,ebx + mov [edx+8],ebp + add ebx,[code_start] + mov edi,ebx + mov ecx,[edx+0Ch] + imul ecx,12h shr 1 + xor eax,eax + shr ecx,1 + jnc zero_symbols_table + stos word [edi] + zero_symbols_table: + rep stos dword [edi] + mov edx,edi + stos dword [edi] + mov esi,[symbols_stream] + make_section_symbols: + cmp esi,[free_additional_memory] + je section_symbols_ok + mov al,[esi] + or al,al + jz add_section_symbol + add esi,0Ch + cmp al,80h + jne make_section_symbols + add esi,4 + jmp make_section_symbols + add_section_symbol: + call store_symbol_name + mov eax,[esi] + shr eax,8 + inc eax + mov [ebx+0Ch],ax + mov byte [ebx+10h],3 + add esi,18h + add ebx,12h + jmp make_section_symbols + section_symbols_ok: + mov esi,[symbols_stream] + make_symbols_table: + cmp esi,[free_additional_memory] + je symbols_table_ok + mov al,[esi] + cmp al,80h + je add_public_symbol + ja add_extrn_symbol + add esi,0Ch + or al,al + jnz make_symbols_table + add esi,0Ch + jmp make_symbols_table + add_extrn_symbol: + call store_symbol_name + mov byte [ebx+10h],2 + add esi,0Ch + add ebx,12h + jmp make_symbols_table + add_public_symbol: + call store_symbol_name + mov eax,[esi+0Ch] + mov [current_line],eax + mov eax,[esi+8] + test byte [eax+8],1 + jz undefined_symbol + mov cx,[current_pass] + cmp cx,[eax+16] + jne undefined_symbol + mov cl,[eax+11] + or cl,cl + jz public_constant + test [format_flags],8 + jnz check_64bit_public_symbol + cmp cl,2 + je public_symbol_type_ok + jmp invalid_use_of_symbol + check_64bit_public_symbol: + cmp cl,4 + jne invalid_use_of_symbol + public_symbol_type_ok: + mov ecx,[eax+20] + mov ecx,[ecx] + cmp cl,81h + je alias_symbol + or cl,cl + jnz invalid_use_of_symbol + shr ecx,8 + inc cx + mov [ebx+0Ch],cx + public_symbol_section_ok: + cmp dword [eax+4],0 + je store_public_symbol + cmp dword [eax+4],-1 + jne value_out_of_range + bt dword [eax],31 + jnc value_out_of_range + store_public_symbol: + mov eax,[eax] + mov [ebx+8],eax + mov byte [ebx+10h],2 + add esi,10h + add ebx,12h + jmp make_symbols_table + alias_symbol: + bt [format_flags],0 + jnc invalid_use_of_symbol + mov ecx,[eax] + or ecx,[eax+4] + jnz invalid_use_of_symbol + mov byte [ebx+10h],69h + mov byte [ebx+11h],1 + add ebx,12h + mov ecx,[eax+20] + mov ecx,[ecx] + shr ecx,8 + mov [ebx],ecx + mov byte [ebx+4],3 + add esi,10h + add ebx,12h + jmp make_symbols_table + public_constant: + mov word [ebx+0Ch],0FFFFh + jmp public_symbol_section_ok + symbols_table_ok: + mov eax,edi + sub eax,edx + mov [edx],eax + sub edi,[code_start] + mov [code_size],edi + mov [written_size],0 + mov edx,[output_file] + call create + jc write_failed + mov edx,[free_additional_memory] + pop ecx + add [written_size],ecx + call write + jc write_failed + jmp write_output + store_symbol_name: + push esi + mov esi,[esi+4] + or esi,esi + jz default_name + lods dword [esi] + mov ecx,eax + cmp ecx,8 + ja add_string + push edi + mov edi,ebx + rep movs byte [edi],[esi] + pop edi esi + ret + default_name: + mov dword [ebx],'.fla' + mov dword [ebx+4],'t' + pop esi + ret + add_string: + mov eax,edi + sub eax,edx + mov [ebx+4],eax + inc ecx + rep movs byte [edi],[esi] + pop esi + ret + +format_elf: + test [format_flags],8 + jnz format_elf64 + mov edx,edi + mov ecx,34h shr 2 + lea eax,[edi+ecx*4] + cmp eax,[display_buffer] + jae out_of_memory + xor eax,eax + rep stos dword [edi] + mov dword [edx],7Fh + 'ELF' shl 8 + mov al,1 + mov [edx+4],al + mov [edx+5],al + mov [edx+6],al + mov [edx+14h],al + mov byte [edx+12h],3 + mov byte [edx+28h],34h + mov byte [edx+2Eh],28h + mov [code_type],32 + cmp word [esi],1D19h + je format_elf_exe + mov [labels_type],2 + elf_header_ok: + mov byte [edx+10h],1 + mov eax,[additional_memory] + mov [symbols_stream],eax + mov ebx,eax + add eax,18h + cmp eax,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],eax + xor eax,eax + mov [current_section],ebx + mov [number_of_sections],eax + mov dword [org_origin],edi + mov dword [org_origin+4],eax + mov [org_registers],eax + mov [org_start],edi + mov [org_symbol],ebx + mov [ebx],al + mov [ebx+4],eax + mov [ebx+8],edi + mov al,111b + mov [ebx+14h],eax + mov al,4 + mov [ebx+10h],eax + test [format_flags],8 + jz instruction_assembled + mov byte [ebx+10h],8 + jmp instruction_assembled + format_elf64: + mov edx,edi + mov ecx,40h shr 2 + lea eax,[edi+ecx*4] + cmp eax,[display_buffer] + jae out_of_memory + xor eax,eax + rep stos dword [edi] + mov dword [edx],7Fh + 'ELF' shl 8 + mov al,1 + mov [edx+5],al + mov [edx+6],al + mov [edx+14h],al + mov byte [edx+4],2 + mov byte [edx+12h],62 + mov byte [edx+34h],40h + mov byte [edx+3Ah],40h + mov [code_type],64 + cmp word [esi],1D19h + je format_elf64_exe + mov [labels_type],4 + jmp elf_header_ok +elf_section: + bt [format_flags],0 + jc elf_exe_section + call close_coff_section + mov ebx,[free_additional_memory] + lea eax,[ebx+18h] + cmp eax,[structures_buffer] + jae out_of_memory + mov [free_additional_memory],eax + mov [current_section],ebx + inc word [number_of_sections] + jz format_limitations_exceeded + xor eax,eax + mov [ebx],al + mov [ebx+8],edi + mov dword [org_origin],edi + mov dword [org_origin+4],0 + mov [org_registers],0 + mov [org_start],edi + mov [org_symbol],ebx + test [format_flags],8 + jnz elf64_labels_type + mov [labels_type],2 + jmp elf_labels_type_ok + elf64_labels_type: + mov [labels_type],4 + elf_labels_type_ok: + mov [ebx+10h],eax + mov al,10b + mov [ebx+14h],eax + lods word [esi] + cmp ax,'(' + jne invalid_argument + mov [ebx+4],esi + mov ecx,[esi] + lea esi,[esi+4+ecx+1] + elf_section_flags: + cmp byte [esi],1Ch + je elf_section_alignment + cmp byte [esi],19h + jne elf_section_settings_ok + inc esi + lods byte [esi] + sub al,28 + xor al,11b + test al,not 10b + jnz invalid_argument + mov cl,al + mov al,1 + shl al,cl + test byte [ebx+14h],al + jnz setting_already_specified + or byte [ebx+14h],al + jmp elf_section_flags + elf_section_alignment: + inc esi + lods byte [esi] + or al,al + jnz invalid_argument + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + push ebx + call get_dword_value + pop ebx + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,eax + dec edx + test eax,edx + jnz invalid_value + or eax,eax + jz invalid_value + xchg [ebx+10h],eax + or eax,eax + jnz setting_already_specified + jmp elf_section_flags + elf_section_settings_ok: + cmp dword [ebx+10h],0 + jne instruction_assembled + mov dword [ebx+10h],4 + test [format_flags],8 + jz instruction_assembled + mov byte [ebx+10h],8 + jmp instruction_assembled +mark_elf_relocation: + cmp [value_type],3 + je elf_relocation_relative + push ebx eax + mov al,1 + jmp coff_relocation + elf_relocation_relative: + cmp [labels_type],0 + je invalid_use_of_symbol + push ebx + mov ebx,[current_section] + mov ebx,[ebx+8] + sub ebx,edi + sub eax,ebx + push eax + mov al,2 + jmp coff_relocation +close_elf: + bt [format_flags],0 + jc close_elf_exe + call close_coff_section + cmp [next_pass_needed],0 + je elf_closed + mov eax,[symbols_stream] + mov [free_additional_memory],eax + elf_closed: + ret +elf_formatter: + push edi + call prepare_default_section + mov esi,[symbols_stream] + mov edi,[free_additional_memory] + xor eax,eax + mov ecx,4 + rep stos dword [edi] + test [format_flags],8 + jz find_first_section + mov ecx,2 + rep stos dword [edi] + find_first_section: + mov al,[esi] + or al,al + jz first_section_found + cmp al,80h + jne skip_other_symbol + add esi,4 + skip_other_symbol: + add esi,0Ch + jmp find_first_section + first_section_found: + mov ebx,esi + mov ebp,esi + add esi,18h + xor ecx,ecx + xor edx,edx + find_next_section: + cmp esi,[free_additional_memory] + je make_section_symbol + mov al,[esi] + or al,al + jz make_section_symbol + cmp al,80h + je skip_public + ja skip_extrn + or byte [ebx+14h],40h + skip_extrn: + add esi,0Ch + jmp find_next_section + skip_public: + add esi,10h + jmp find_next_section + make_section_symbol: + mov eax,edi + xchg eax,[ebx+4] + stos dword [edi] + test [format_flags],8 + jnz elf64_section_symbol + xor eax,eax + stos dword [edi] + stos dword [edi] + call store_section_index + jmp section_symbol_ok + store_section_index: + inc ecx + mov eax,ecx + shl eax,8 + mov [ebx],eax + inc dx + jz format_limitations_exceeded + mov eax,edx + shl eax,16 + mov al,3 + test byte [ebx+14h],40h + jz section_index_ok + or ah,-1 + inc dx + jz format_limitations_exceeded + section_index_ok: + stos dword [edi] + ret + elf64_section_symbol: + call store_section_index + xor eax,eax + stos dword [edi] + stos dword [edi] + stos dword [edi] + stos dword [edi] + section_symbol_ok: + mov ebx,esi + add esi,18h + cmp ebx,[free_additional_memory] + jne find_next_section + inc dx + jz format_limitations_exceeded + mov [current_section],edx + mov esi,[symbols_stream] + find_other_symbols: + cmp esi,[free_additional_memory] + je elf_symbol_table_ok + mov al,[esi] + or al,al + jz skip_section + cmp al,80h + je make_public_symbol + ja make_extrn_symbol + add esi,0Ch + jmp find_other_symbols + skip_section: + add esi,18h + jmp find_other_symbols + make_public_symbol: + mov eax,[esi+0Ch] + mov [current_line],eax + mov ebx,[esi+8] + test byte [ebx+8],1 + jz undefined_symbol + mov ax,[current_pass] + cmp ax,[ebx+16] + jne undefined_symbol + mov dl,[ebx+11] + or dl,dl + jz public_absolute + mov eax,[ebx+20] + cmp byte [eax],0 + jne invalid_use_of_symbol + mov eax,[eax+4] + test [format_flags],8 + jnz elf64_public + cmp dl,2 + jne invalid_use_of_symbol + mov dx,[eax+0Eh] + jmp section_for_public_ok + elf64_public: + cmp dl,4 + jne invalid_use_of_symbol + mov dx,[eax+6] + jmp section_for_public_ok + public_absolute: + mov dx,0FFF1h + section_for_public_ok: + mov eax,[esi+4] + stos dword [edi] + test [format_flags],8 + jnz elf64_public_symbol + call get_public_value + stos dword [edi] + xor eax,eax + mov al,[ebx+10] + stos dword [edi] + mov eax,edx + shl eax,16 + mov al,10h + stos dword [edi] + jmp public_symbol_ok + elf64_public_symbol: + mov eax,edx + shl eax,16 + mov al,10h + stos dword [edi] + call get_public_value + stos dword [edi] + xor eax,eax + stos dword [edi] + mov al,[ebx+10] + stos dword [edi] + xor al,al + stos dword [edi] + public_symbol_ok: + inc ecx + mov eax,ecx + shl eax,8 + mov al,80h + mov [esi],eax + add esi,10h + jmp find_other_symbols + get_public_value: + mov eax,[ebx] + cmp dword [ebx+4],0 + je public_value_ok + cmp dword [ebx+4],-1 + jne value_out_of_range + bt eax,31 + jnc value_out_of_range + public_value_ok: + ret + make_extrn_symbol: + mov eax,[esi+4] + stos dword [edi] + test [format_flags],8 + jnz elf64_extrn_symbol + xor eax,eax + stos dword [edi] + mov eax,[esi+8] + stos dword [edi] + mov eax,10h + stos dword [edi] + jmp extrn_symbol_ok + elf64_extrn_symbol: + mov eax,10h + stos dword [edi] + xor al,al + stos dword [edi] + stos dword [edi] + mov eax,[esi+8] + stos dword [edi] + xor eax,eax + stos dword [edi] + extrn_symbol_ok: + inc ecx + mov eax,ecx + shl eax,8 + mov al,81h + mov [esi],eax + add esi,0Ch + jmp find_other_symbols + elf_symbol_table_ok: + mov edx,edi + mov ebx,[free_additional_memory] + xor al,al + stos byte [edi] + add edi,16 + mov [edx+1],edx + add ebx,10h + test [format_flags],8 + jz make_string_table + add ebx,8 + make_string_table: + cmp ebx,edx + je elf_string_table_ok + test [format_flags],8 + jnz make_elf64_string + cmp byte [ebx+0Dh],0 + je rel_prefix_ok + mov byte [ebx+0Dh],0 + mov eax,'.rel' + stos dword [edi] + rel_prefix_ok: + mov esi,edi + sub esi,edx + xchg esi,[ebx] + add ebx,10h + make_elf_string: + or esi,esi + jz default_string + lods dword [esi] + mov ecx,eax + rep movs byte [edi],[esi] + xor al,al + stos byte [edi] + jmp make_string_table + make_elf64_string: + cmp byte [ebx+5],0 + je elf64_rel_prefix_ok + mov byte [ebx+5],0 + mov eax,'.rel' + stos dword [edi] + mov al,'a' + stos byte [edi] + elf64_rel_prefix_ok: + mov esi,edi + sub esi,edx + xchg esi,[ebx] + add ebx,18h + jmp make_elf_string + default_string: + mov eax,'.fla' + stos dword [edi] + mov ax,'t' + stos word [edi] + jmp make_string_table + elf_string_table_ok: + mov [edx+1+8],edi + mov ebx,[code_start] + mov eax,edi + sub eax,[free_additional_memory] + test [format_flags],8 + jnz finish_elf64_header + mov [ebx+20h],eax + mov eax,[current_section] + inc ax + jz format_limitations_exceeded + mov [ebx+32h],ax + inc ax + jz format_limitations_exceeded + mov [ebx+30h],ax + jmp elf_header_finished + finish_elf64_header: + mov [ebx+28h],eax + mov eax,[current_section] + inc ax + jz format_limitations_exceeded + mov [ebx+3Eh],ax + inc ax + jz format_limitations_exceeded + mov [ebx+3Ch],ax + elf_header_finished: + xor eax,eax + mov ecx,10 + rep stos dword [edi] + test [format_flags],8 + jz elf_null_section_ok + mov ecx,6 + rep stos dword [edi] + elf_null_section_ok: + mov esi,ebp + xor ecx,ecx + make_section_entry: + mov ebx,edi + mov eax,[esi+4] + mov eax,[eax] + stos dword [edi] + mov eax,1 + cmp dword [esi+0Ch],0 + je bss_section + test byte [esi+14h],80h + jz section_type_ok + bss_section: + mov al,8 + section_type_ok: + stos dword [edi] + mov eax,[esi+14h] + and al,3Fh + call store_elf_machine_word + xor eax,eax + call store_elf_machine_word + mov eax,[esi+8] + mov [image_base],eax + sub eax,[code_start] + call store_elf_machine_word + mov eax,[esi+0Ch] + call store_elf_machine_word + xor eax,eax + stos dword [edi] + stos dword [edi] + mov eax,[esi+10h] + call store_elf_machine_word + xor eax,eax + call store_elf_machine_word + inc ecx + add esi,18h + xchg edi,[esp] + mov ebp,edi + convert_relocations: + cmp esi,[free_additional_memory] + je relocations_converted + mov al,[esi] + or al,al + jz relocations_converted + cmp al,80h + jb make_relocation_entry + ja relocation_entry_ok + add esi,10h + jmp convert_relocations + make_relocation_entry: + test [format_flags],8 + jnz make_elf64_relocation_entry + mov eax,[esi+4] + stos dword [edi] + mov eax,[esi+8] + mov eax,[eax] + mov al,[esi] + stos dword [edi] + jmp relocation_entry_ok + make_elf64_relocation_entry: + mov eax,[esi+4] + stos dword [edi] + xor eax,eax + stos dword [edi] + movzx eax,byte [esi] + stos dword [edi] + mov eax,[esi+8] + mov eax,[eax] + shr eax,8 + stos dword [edi] + xor eax,eax + stos dword [edi] + stos dword [edi] + relocation_entry_ok: + add esi,0Ch + jmp convert_relocations + store_elf_machine_word: + stos dword [edi] + test [format_flags],8 + jz elf_machine_word_ok + mov dword [edi],0 + add edi,4 + elf_machine_word_ok: + ret + relocations_converted: + cmp edi,ebp + xchg edi,[esp] + je rel_section_ok + mov eax,[ebx] + sub eax,4 + test [format_flags],8 + jz store_relocations_name_offset + dec eax + store_relocations_name_offset: + stos dword [edi] + test [format_flags],8 + jnz rela_section + mov eax,9 + jmp store_relocations_type + rela_section: + mov eax,4 + store_relocations_type: + stos dword [edi] + xor al,al + call store_elf_machine_word + call store_elf_machine_word + mov eax,ebp + sub eax,[code_start] + call store_elf_machine_word + mov eax,[esp] + sub eax,ebp + call store_elf_machine_word + mov eax,[current_section] + stos dword [edi] + mov eax,ecx + stos dword [edi] + inc ecx + test [format_flags],8 + jnz finish_elf64_rela_section + mov eax,4 + stos dword [edi] + mov al,8 + stos dword [edi] + jmp rel_section_ok + finish_elf64_rela_section: + mov eax,8 + stos dword [edi] + xor al,al + stos dword [edi] + mov al,24 + stos dword [edi] + xor al,al + stos dword [edi] + rel_section_ok: + cmp esi,[free_additional_memory] + jne make_section_entry + pop eax + mov ebx,[code_start] + sub eax,ebx + mov [code_size],eax + mov ecx,20h + test [format_flags],8 + jz adjust_elf_section_headers_offset + mov ecx,28h + adjust_elf_section_headers_offset: + add [ebx+ecx],eax + mov eax,1 + stos dword [edi] + mov al,2 + stos dword [edi] + xor al,al + call store_elf_machine_word + call store_elf_machine_word + mov eax,[code_size] + call store_elf_machine_word + mov eax,[edx+1] + sub eax,[free_additional_memory] + call store_elf_machine_word + mov eax,[current_section] + inc eax + stos dword [edi] + mov eax,[number_of_sections] + inc eax + stos dword [edi] + test [format_flags],8 + jnz finish_elf64_sym_section + mov eax,4 + stos dword [edi] + mov al,10h + stos dword [edi] + jmp sym_section_ok + finish_elf64_sym_section: + mov eax,8 + stos dword [edi] + xor al,al + stos dword [edi] + mov al,18h + stos dword [edi] + xor al,al + stos dword [edi] + sym_section_ok: + mov al,1+8 + stos dword [edi] + mov al,3 + stos dword [edi] + xor al,al + call store_elf_machine_word + call store_elf_machine_word + mov eax,[edx+1] + sub eax,[free_additional_memory] + add eax,[code_size] + call store_elf_machine_word + mov eax,[edx+1+8] + sub eax,[edx+1] + call store_elf_machine_word + xor eax,eax + stos dword [edi] + stos dword [edi] + mov al,1 + call store_elf_machine_word + xor eax,eax + call store_elf_machine_word + mov eax,'tab' + mov dword [edx+1],'.sym' + mov [edx+1+4],eax + mov dword [edx+1+8],'.str' + mov [edx+1+8+4],eax + mov [written_size],0 + mov edx,[output_file] + call create + jc write_failed + call write_code + mov ecx,edi + mov edx,[free_additional_memory] + sub ecx,edx + add [written_size],ecx + call write + jc write_failed + jmp output_written + +format_elf_exe: + add esi,2 + or [format_flags],1 + mov [image_base],8048000h + cmp byte [esi],80h + jne elf_exe_base_ok + lods word [esi] + cmp ah,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + push edx + call get_dword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov [image_base],eax + pop edx + elf_exe_base_ok: + mov byte [edx+10h],2 + mov byte [edx+2Ah],20h + mov ebx,edi + mov ecx,20h shr 2 + cmp [current_pass],0 + je init_elf_exe_sections + imul ecx,[number_of_sections] + init_elf_exe_sections: + xor eax,eax + rep stos dword [edi] + mov [number_of_sections],0 + mov byte [ebx],1 + mov word [ebx+1Ch],1000h + mov byte [ebx+18h],111b + mov eax,edi + sub eax,[code_start] + mov [ebx+4],eax + add eax,[image_base] + mov [ebx+8],eax + mov [ebx+0Ch],eax + mov [edx+18h],eax + xor edx,edx + not eax + not edx + add eax,1 + adc edx,0 + add eax,edi + adc edx,0 + mov dword [org_origin],eax + mov dword [org_origin+4],edx + mov [org_registers],0 + mov [org_start],edi + mov [symbols_stream],edi + jmp instruction_assembled + format_elf64_exe: + add esi,2 + or [format_flags],1 + mov [image_base],400000h + mov [image_base_high],0 + cmp byte [esi],80h + jne elf64_exe_base_ok + lods word [esi] + cmp ah,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + push edx + call get_qword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov [image_base],eax + mov [image_base_high],edx + pop edx + elf64_exe_base_ok: + mov byte [edx+10h],2 + mov byte [edx+36h],38h + mov ebx,edi + mov ecx,38h shr 2 + cmp [current_pass],0 + je init_elf64_exe_sections + imul ecx,[number_of_sections] + init_elf64_exe_sections: + xor eax,eax + rep stos dword [edi] + mov [number_of_sections],0 + mov byte [ebx],1 + mov word [ebx+30h],1000h + mov byte [ebx+4],111b + push edx + mov eax,edi + sub eax,[code_start] + mov [ebx+8],eax + xor edx,edx + add eax,[image_base] + adc edx,[image_base_high] + mov [ebx+10h],eax + mov [ebx+10h+4],edx + mov [ebx+18h],eax + mov [ebx+18h+4],edx + pop ebx + mov [ebx+18h],eax + mov [ebx+18h+4],edx + not eax + not edx + add eax,1 + adc edx,0 + add eax,edi + adc edx,0 + mov dword [org_origin],eax + mov dword [org_origin+4],edx + mov [org_registers],0 + mov [org_start],edi + mov [symbols_stream],edi + jmp instruction_assembled +elf_entry: + lods byte [esi] + cmp al,'(' + jne invalid_argument + cmp byte [esi],'.' + je invalid_value + test [format_flags],8 + jnz elf64_entry + call get_dword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov edx,[code_start] + mov [edx+18h],eax + jmp instruction_assembled + elf64_entry: + call get_qword_value + cmp [value_type],0 + jne invalid_use_of_symbol + mov ebx,[code_start] + mov [ebx+18h],eax + mov [ebx+1Ch],edx + jmp instruction_assembled +elf_exe_section: + test [format_flags],8 + jnz elf64_exe_section + call close_elf_exe_section + push eax + mov ebx,[number_of_sections] + shl ebx,5 + add ebx,[code_start] + add ebx,34h + cmp ebx,[symbols_stream] + jb new_elf_exe_section + mov ebx,[symbols_stream] + sub ebx,20h + push edi + mov edi,ebx + mov ecx,20h shr 2 + xor eax,eax + rep stos dword [edi] + pop edi + or [next_pass_needed],-1 + new_elf_exe_section: + mov byte [ebx],1 + mov word [ebx+1Ch],1000h + elf_exe_section_flags: + cmp byte [esi],19h + jne elf_exe_section_flags_ok + lods word [esi] + sub ah,28 + jbe invalid_argument + cmp ah,1 + je mark_elf_exe_section_flag + cmp ah,3 + ja invalid_argument + xor ah,1 + cmp ah,2 + je mark_elf_exe_section_flag + inc ah + mark_elf_exe_section_flag: + test [ebx+18h],ah + jnz setting_already_specified + or [ebx+18h],ah + jmp elf_exe_section_flags + elf_exe_section_flags_ok: + mov eax,edi + sub eax,[code_start] + mov [ebx+4],eax + pop edx + and eax,0FFFh + add edx,eax + mov [ebx+8],edx + mov [ebx+0Ch],edx + mov eax,edx + xor edx,edx + not eax + not edx + add eax,1 + adc edx,0 + add eax,edi + adc edx,0 + mov dword [org_origin],eax + mov dword [org_origin+4],edx + mov [org_registers],0 + mov [org_start],edi + inc [number_of_sections] + jmp instruction_assembled + close_elf_exe_section: + cmp [number_of_sections],0 + jne finish_elf_exe_section + cmp edi,[symbols_stream] + jne first_elf_exe_section_ok + push edi + mov edi,[code_start] + add edi,34h + mov ecx,20h shr 2 + xor eax,eax + rep stos dword [edi] + pop edi + mov eax,[image_base] + ret + first_elf_exe_section_ok: + inc [number_of_sections] + finish_elf_exe_section: + mov ebx,[number_of_sections] + dec ebx + shl ebx,5 + add ebx,[code_start] + add ebx,34h + mov eax,edi + sub eax,[code_start] + sub eax,[ebx+4] + mov edx,edi + cmp edi,[undefined_data_end] + jne elf_exe_section_size_ok + mov edi,[undefined_data_start] + elf_exe_section_size_ok: + mov [ebx+14h],eax + add eax,edi + sub eax,edx + mov [ebx+10h],eax + mov eax,[ebx+8] + add eax,[ebx+14h] + add eax,0FFFh + and eax,not 0FFFh + ret + elf64_exe_section: + call close_elf64_exe_section + push eax edx + mov ebx,[number_of_sections] + imul ebx,38h + add ebx,[code_start] + add ebx,40h + cmp ebx,[symbols_stream] + jb new_elf64_exe_section + mov ebx,[symbols_stream] + sub ebx,38h + push edi + mov edi,ebx + mov ecx,38h shr 2 + xor eax,eax + rep stos dword [edi] + pop edi + or [next_pass_needed],-1 + new_elf64_exe_section: + mov byte [ebx],1 + mov word [ebx+30h],1000h + elf64_exe_section_flags: + cmp byte [esi],19h + jne elf64_exe_section_flags_ok + lods word [esi] + sub ah,28 + jbe invalid_argument + cmp ah,1 + je mark_elf64_exe_section_flag + cmp ah,3 + ja invalid_argument + xor ah,1 + cmp ah,2 + je mark_elf64_exe_section_flag + inc ah + mark_elf64_exe_section_flag: + test [ebx+4],ah + jnz setting_already_specified + or [ebx+4],ah + jmp elf64_exe_section_flags + elf64_exe_section_flags_ok: + mov ecx,edi + sub ecx,[code_start] + mov [ebx+8],ecx + pop edx eax + and ecx,0FFFh + add eax,ecx + adc edx,0 + mov [ebx+10h],eax + mov [ebx+10h+4],edx + mov [ebx+18h],eax + mov [ebx+18h+4],edx + not eax + not edx + add eax,1 + adc edx,0 + add eax,edi + adc edx,0 + mov dword [org_origin],eax + mov dword [org_origin+4],edx + mov [org_registers],0 + mov [org_start],edi + inc [number_of_sections] + jmp instruction_assembled + close_elf64_exe_section: + cmp [number_of_sections],0 + jne finish_elf64_exe_section + cmp edi,[symbols_stream] + jne first_elf64_exe_section_ok + push edi + mov edi,[code_start] + add edi,40h + mov ecx,38h shr 2 + xor eax,eax + rep stos dword [edi] + pop edi + mov eax,[image_base] + mov edx,[image_base_high] + ret + first_elf64_exe_section_ok: + inc [number_of_sections] + finish_elf64_exe_section: + mov ebx,[number_of_sections] + dec ebx + imul ebx,38h + add ebx,[code_start] + add ebx,40h + mov eax,edi + sub eax,[code_start] + sub eax,[ebx+8] + mov edx,edi + cmp edi,[undefined_data_end] + jne elf64_exe_section_size_ok + mov edi,[undefined_data_start] + elf64_exe_section_size_ok: + mov [ebx+28h],eax + add eax,edi + sub eax,edx + mov [ebx+20h],eax + mov eax,[ebx+10h] + mov edx,[ebx+10h+4] + add eax,[ebx+28h] + adc edx,0 + sub eax,1 + sbb edx,0 + shrd eax,edx,12 + shr edx,12 + add eax,1 + adc edx,0 + shld edx,eax,12 + shl eax,12 + ret +close_elf_exe: + test [format_flags],8 + jnz close_elf64_exe + call close_elf_exe_section + mov edx,[code_start] + mov eax,[number_of_sections] + mov byte [edx+1Ch],34h + mov [edx+2Ch],ax + shl eax,5 + add eax,edx + add eax,34h + cmp eax,[symbols_stream] + je elf_exe_ok + or [next_pass_needed],-1 + elf_exe_ok: + ret + close_elf64_exe: + call close_elf64_exe_section + mov edx,[code_start] + mov eax,[number_of_sections] + mov byte [edx+20h],40h + mov [edx+38h],ax + imul eax,38h + add eax,edx + add eax,40h + cmp eax,[symbols_stream] + je elf64_exe_ok + or [next_pass_needed],-1 + elf64_exe_ok: + ret + +formatter_symbols: + db 5,'align',1Ch,0 + db 6,'binary',18h,10h + db 4,'code',19h,5 + db 4,'coff',18h,40h + db 7,'console',1Bh,3 + db 4,'data',19h,6 + db 11,'discardable',19h,25 + db 3,'dll',1Bh,80h + db 3,'elf',18h,50h + db 5,'elf64',18h,58h + db 10,'executable',19h,29 + db 6,'export',1Ah,0 + db 6,'fixups',1Ah,5 + db 3,'gui',1Bh,2 + db 6,'import',1Ah,1 + db 2,'ms',17h,41h + db 4,'ms64',17h,49h + db 2,'mz',18h,20h + db 6,'native',1Bh,1 + db 11,'notpageable',19h,27 + db 2,'pe',18h,30h + db 4,'pe64',18h,38h + db 8,'readable',19h,30 + db 8,'resource',1Ah,2 + db 9,'shareable',19h,28 + db 3,'wdm',1Bh,81h + db 8,'writable',19h,31 + db 9,'writeable',19h,31 + db 0 diff --git a/programs/fasm/trunk/parser.inc b/programs/fasm/trunk/parser.inc new file mode 100644 index 0000000000..437aae1d5f --- /dev/null +++ b/programs/fasm/trunk/parser.inc @@ -0,0 +1,1022 @@ + +; flat assembler core +; Copyright (c) 1999-2005, Tomasz Grysztar. +; All rights reserved. + +parser: + mov eax,[memory_end] + mov [labels_list],eax + mov eax,[additional_memory] + mov [free_additional_memory],eax + xor eax,eax + mov [current_locals_prefix],eax + mov [anonymous_reverse],eax + mov [anonymous_forward],eax + mov [hash_tree],eax + push [memory_end] + mov esi,[memory_start] + mov edi,[source_start] + parser_loop: + mov [current_line],esi + lea eax,[edi+100h] + cmp eax,[memory_end] + jae out_of_memory + cmp byte [esi+16],0 + je empty_line + mov al,0Fh + stos byte [edi] + mov eax,esi + stos dword [edi] + add esi,16 + call parse_line + parse_next_line: + cmp esi,[source_start] + jb parser_loop + xor al,al + stos byte [edi] + mov eax,[error_line] + mov [current_line],eax + cmp [anonymous_forward],0 + jne invalid_value + add edi,0Fh + and edi,not 0Fh + mov [code_start],edi + pop [memory_end] + ret + empty_line: + add esi,17 + jmp parse_next_line + +parse_line: + mov [parenthesis_stack],0 + instruction_start: + cmp byte [esi],1Ah + jne empty_instruction + push edi + add esi,2 + movzx ecx,byte [esi-1] + cmp byte [esi+ecx],':' + je simple_label + cmp byte [esi+ecx],'=' + je constant_label + cmp byte [esi+ecx],1Ah + jne get_main_instruction + push esi ecx + lea esi,[esi+ecx+2] + movzx ecx,byte [esi-1] + mov edi,data_directives + call get_symbol + jnc data_label + pop ecx esi + get_main_instruction: + call get_instruction + jnc parse_instruction + mov edi,data_directives + call get_symbol + jnc data_instruction + mov edi,symbols + call get_symbol + pop edi + jc unknown_instruction + stos word [edi] + jmp parse_arguments + data_instruction: + movzx ebx,ah + mov bx,[data_handlers+ebx*2] + jmp parse_instruction + unknown_instruction: + sub esi,2 + jmp parse_arguments + constant_label: + pop edi + call get_label_id + mov byte [edi],3 + inc edi + stos dword [edi] + xor al,al + stos byte [edi] + inc esi + jmp parse_arguments + data_label: + pop ecx ebx + pop edi + push eax esi + mov esi,ebx + movzx ecx,byte [esi-1] + call identify_label + mov byte [edi],2 + inc edi + stos dword [edi] + pop esi eax + stos byte [edi] + push edi + jmp data_instruction + simple_label: + pop edi + call identify_label + mov byte [edi],2 + inc edi + stos dword [edi] + inc esi + xor al,al + stos byte [edi] + jmp instruction_start + identify_label: + cmp byte [esi],'.' + je local_label_name + call get_label_id + cmp eax,10h + jb label_identified + or ebx,ebx + jz anonymous_label_name + dec ebx + mov [current_locals_prefix],ebx + label_identified: + ret + anonymous_label_name: + cmp byte [esi-1],'@' + je anonymous_label_name_ok + mov eax,0Fh + anonymous_label_name_ok: + ret + local_label_name: + call get_label_id + ret + parse_label_directive: + cmp byte [esi],1Ah + jne argument_parsed + inc esi + movzx ecx,byte [esi] + inc esi + mov al,2 + stos byte [edi] + call identify_label + stos dword [edi] + xor al,al + stos byte [edi] + jmp argument_parsed + parse_load_directive: + cmp byte [esi],1Ah + jne argument_parsed + inc esi + movzx ecx,byte [esi] + inc esi + mov al,2 + stos byte [edi] + call get_label_id + stos dword [edi] + xor al,al + stos byte [edi] + jmp argument_parsed + parse_prefix_instruction: + cmp byte [esi],1Ah + jne parse_arguments + push edi + inc esi + movzx ecx,byte [esi] + inc esi + jmp get_main_instruction + parse_instruction: + pop edi + mov dl,al + mov al,1 + stos byte [edi] + mov ax,bx + stos word [edi] + mov al,dl + stos byte [edi] + cmp bx,prefix_instruction-assembler + je parse_prefix_instruction + cmp bx,end_directive-assembler + je parse_prefix_instruction + cmp bx,label_directive-assembler + je parse_label_directive + cmp bx,segment_directive-assembler + je parse_label_directive + cmp bx,load_directive-assembler + je parse_load_directive + cmp bx,extrn_directive-assembler + je parse_extrn_directive + cmp bx,public_directive-assembler + je parse_public_directive + parse_arguments: + lods byte [esi] + cmp al,':' + je instruction_separator + cmp al,',' + je separator + cmp al,'=' + je separator + cmp al,'|' + je separator + cmp al,'&' + je separator + cmp al,'~' + je separator + cmp al,'>' + je greater + cmp al,'<' + je less + cmp al,')' + je close_parenthesis + or al,al + jz line_parsed + cmp al,'[' + je address_argument + cmp al,']' + je separator + cmp al,'{' + je unallowed_character + cmp al,'}' + je unallowed_character + cmp al,'#' + je unallowed_character + cmp al,'`' + je unallowed_character + dec esi + cmp al,1Ah + jne expression_argument + push edi + mov edi,directive_operators + call get_operator + or al,al + jnz operator_argument + inc esi + movzx ecx,byte [esi] + inc esi + mov edi,symbols + call get_symbol + jnc symbol_argument + mov edi,formatter_symbols + call get_symbol + jnc symbol_argument + cmp ecx,1 + jne check_argument + cmp byte [esi],'?' + jne check_argument + pop edi + movs byte [edi],[esi] + jmp argument_parsed + symbol_argument: + pop edi + stos word [edi] + jmp argument_parsed + operator_argument: + pop edi + cmp al,85h + je ptr_argument + stos byte [edi] + cmp al,80h + je forced_expression + cmp al,81h + je forced_parenthesis + cmp al,82h + je parse_from_operator + cmp al,89h + je parse_label_operator + jmp argument_parsed + parse_public_directive: + cmp byte [esi],1Ah + jne parse_arguments + inc esi + push esi + movzx ecx,byte [esi] + inc esi + mov al,2 + stos byte [edi] + call get_label_id + stos dword [edi] + mov ax,8600h + stos word [edi] + pop ebx + push ebx esi edi + mov edi,directive_operators + call get_operator + pop edi edx ebx + cmp al,86h + je argument_parsed + mov esi,edx + xchg esi,ebx + movzx ecx,byte [esi] + inc esi + mov ax,'(' + stos word [edi] + mov eax,ecx + stos dword [edi] + rep movs byte [edi],[esi] + xor al,al + stos byte [edi] + xchg esi,ebx + jmp argument_parsed + parse_extrn_directive: + cmp byte [esi],22h + je parse_quoted_extrn + cmp byte [esi],1Ah + jne parse_arguments + push esi + movzx ecx,byte [esi+1] + add esi,2 + mov ax,'(' + stos word [edi] + mov eax,ecx + stos dword [edi] + rep movs byte [edi],[esi] + mov ax,8600h + stos word [edi] + pop esi + parse_label_operator: + cmp byte [esi],1Ah + jne argument_parsed + inc esi + movzx ecx,byte [esi] + inc esi + mov al,2 + stos byte [edi] + call get_label_id + stos dword [edi] + xor al,al + stos byte [edi] + jmp argument_parsed + parse_from_operator: + cmp byte [esi],22h + jne forced_expression + jmp argument_parsed + parse_quoted_extrn: + inc esi + mov ax,'(' + stos word [edi] + lods dword [esi] + mov ecx,eax + stos dword [edi] + rep movs byte [edi],[esi] + xor al,al + stos byte [edi] + push esi edi + mov edi,directive_operators + call get_operator + mov edx,esi + pop edi esi + cmp al,86h + jne argument_parsed + stos byte [edi] + mov esi,edx + jmp parse_label_operator + ptr_argument: + call parse_address + jmp address_parsed + check_argument: + push esi ecx + sub esi,2 + mov edi,single_operand_operators + call get_operator + pop ecx esi + or al,al + jnz not_instruction + call get_instruction + jnc parse_instruction + mov edi,data_directives + call get_symbol + jnc data_instruction + not_instruction: + pop edi + sub esi,2 + expression_argument: + cmp byte [esi],22h + jne not_string + mov eax,[esi+1] + lea ebx,[esi+5+eax] + push ebx ecx esi edi + mov al,'(' + stos byte [edi] + call convert_expression + mov al,')' + stos byte [edi] + pop eax edx ecx ebx + cmp esi,ebx + jne expression_parsed + mov edi,eax + mov esi,edx + string_argument: + inc esi + mov ax,'(' + stos word [edi] + lods dword [esi] + mov ecx,eax + stos dword [edi] + shr ecx,1 + jnc string_movsb_ok + movs byte [edi],[esi] + string_movsb_ok: + shr ecx,1 + jnc string_movsw_ok + movs word [edi],[esi] + string_movsw_ok: + rep movs dword [edi],[esi] + xor al,al + stos byte [edi] + jmp expression_parsed + not_string: + cmp byte [esi],'(' + jne expression + mov eax,esp + sub eax,100h + jc stack_overflow + cmp eax,[stack_limit] + jb stack_overflow + push esi edi + inc esi + mov al,'{' + stos byte [edi] + inc [parenthesis_stack] + jmp parse_arguments + expression: + mov al,'(' + stos byte [edi] + call convert_expression + mov al,')' + stos byte [edi] + jmp expression_parsed + forced_expression: + mov al,'(' + stos byte [edi] + call convert_expression + mov al,')' + stos byte [edi] + jmp argument_parsed + address_argument: + call parse_address + lods byte [esi] + cmp al,']' + jne invalid_address + address_parsed: + mov al,']' + stos byte [edi] + jmp argument_parsed + parse_address: + mov al,'[' + stos byte [edi] + cmp word [esi],021Ah + jne convert_address + push esi + add esi,4 + lea ebx,[esi+1] + cmp byte [esi],':' + pop esi + jne convert_address + add esi,2 + mov ecx,2 + push ebx edi + mov edi,symbols + call get_symbol + pop edi esi + jc invalid_address + cmp al,10h + jne invalid_address + mov al,ah + and ah,11110000b + cmp ah,60h + jne invalid_address + stos byte [edi] + convert_address: + cmp byte [esi],1Ah + jne convert_expression + push esi + lods word [esi] + movzx ecx,ah + push edi + mov edi,address_sizes + call get_symbol + pop edi + jc no_size_prefix + mov al,ah + add al,70h + stos byte [edi] + add esp,4 + jmp convert_expression + no_size_prefix: + pop esi + jmp convert_expression + forced_parenthesis: + cmp byte [esi],'(' + jne argument_parsed + inc esi + mov al,'{' + jmp separator + unallowed_character: + mov al,0FFh + jmp separator + close_parenthesis: + mov al,'}' + separator: + stos byte [edi] + jmp argument_parsed + instruction_separator: + stos byte [edi] + jmp instruction_start + greater: + cmp byte [esi],'=' + jne separator + inc esi + mov al,0F2h + jmp separator + less: + cmp byte [edi-1],0F6h + je separator + cmp byte [esi],'>' + je not_equal + cmp byte [esi],'=' + jne separator + inc esi + mov al,0F3h + jmp separator + not_equal: + inc esi + mov al,0F1h + jmp separator + argument_parsed: + cmp [parenthesis_stack],0 + je parse_arguments + dec [parenthesis_stack] + add esp,8 + jmp argument_parsed + expression_parsed: + cmp [parenthesis_stack],0 + je parse_arguments + cmp byte [esi],')' + jne argument_parsed + dec [parenthesis_stack] + pop edi esi + jmp expression + empty_instruction: + lods byte [esi] + or al,al + jz line_parsed + cmp al,':' + je invalid_name + cmp al,3Bh + je skip_preprocessed_symbol + dec esi + jmp parse_arguments + skip_preprocessed_symbol: + lods byte [esi] + movzx eax,al + add esi,eax + skip_next: + lods byte [esi] + or al,al + jz line_parsed + cmp al,1Ah + je skip_preprocessed_symbol + cmp al,3Bh + je skip_preprocessed_symbol + cmp al,22h + je skip_preprocessed_string + jmp skip_next + skip_preprocessed_string: + lods dword [esi] + add esi,eax + jmp skip_next + line_parsed: + cmp [parenthesis_stack],0 + jne invalid_expression + ret + +get_operator: + cmp byte [esi],1Ah + jne get_simple_operator + mov edx,esi + push ebp + inc esi + lods byte [esi] + movzx ebp,al + push edi + mov ecx,ebp + call lower_case + pop edi + check_operator: + mov esi,converted + movzx ecx,byte [edi] + jecxz no_operator + inc edi + mov ebx,edi + add ebx,ecx + cmp ecx,ebp + jne next_operator + repe cmps byte [esi],[edi] + je operator_found + next_operator: + mov edi,ebx + inc edi + jmp check_operator + no_operator: + mov esi,edx + mov ecx,ebp + pop ebp + no_simple_operator: + xor al,al + ret + operator_found: + lea esi,[edx+2+ebp] + mov ecx,ebp + pop ebp + mov al,[edi] + ret + get_simple_operator: + mov al,[esi] + cmp al,22h + je no_simple_operator + simple_operator: + cmp byte [edi],1 + jb no_simple_operator + ja simple_next_operator + cmp al,[edi+1] + je simple_operator_found + simple_next_operator: + movzx ecx,byte [edi] + lea edi,[edi+1+ecx+1] + jmp simple_operator + simple_operator_found: + inc esi + mov al,[edi+2] + ret + + +get_symbol: + mov edx,esi + mov ebp,ecx + push edi + call lower_case + pop edi + scan_symbols: + mov esi,converted + movzx eax,byte [edi] + or al,al + jz no_symbol + mov ecx,ebp + inc edi + mov ebx,edi + add ebx,eax + mov ah,[esi] + cmp ah,[edi] + jb no_symbol + ja next_symbol + cmp cl,al + jne next_symbol + repe cmps byte [esi],[edi] + jb no_symbol + je symbol_ok + next_symbol: + mov edi,ebx + add edi,2 + jmp scan_symbols + no_symbol: + mov esi,edx + mov ecx,ebp + stc + ret + symbol_ok: + lea esi,[edx+ebp] + mov ax,[ebx] + clc + ret + +get_instruction: + mov edx,esi + mov ebp,ecx + call lower_case + mov ecx,ebp + cmp cl,11 + ja no_instruction + sub cl,2 + jc no_instruction + movzx edi,word [instructions+ecx*2] + add edi,instructions + scan_instructions: + mov esi,converted + mov al,[edi] + or al,al + jz no_instruction + mov ecx,ebp + mov ebx,edi + add ebx,ecx + repe cmps byte [esi],[edi] + jb no_instruction + je instruction_ok + next_instruction: + mov edi,ebx + add edi,3 + jmp scan_instructions + no_instruction: + mov esi,edx + mov ecx,ebp + stc + ret + lower_case: + mov edi,converted + mov ebx,characters + convert_case: + lods byte [esi] + xlat byte [ebx] + stos byte [edi] + loop convert_case + case_ok: + ret + instruction_ok: + lea esi,[edx+ebp] + mov al,[ebx] + mov bx,[ebx+1] + clc + ret + +get_label_id: + cmp ecx,100h + jae name_too_long + cmp byte [esi],'@' + je anonymous_label + cmp byte [esi],'.' + jne standard_label + cmp byte [esi+1],'.' + je standard_label + cmp [current_locals_prefix],0 + je standard_label + push edi + mov edi,[memory_end] + sub edi,2 + sub edi,ecx + push ecx esi + mov esi,[current_locals_prefix] + lods byte [esi] + movzx ecx,al + sub edi,ecx + cmp edi,[esp+8] + jb out_of_memory + mov [memory_end],edi + mov word [edi],0 + add edi,2 + mov ebx,edi + rep movs byte [edi],[esi] + pop esi ecx + add al,cl + jc name_too_long + rep movs byte [edi],[esi] + pop edi + push esi + movzx ecx,al + mov byte [ebx-1],al + mov esi,ebx + call get_label_id + pop esi + ret + anonymous_label: + cmp ecx,2 + jne standard_label + mov al,[esi+1] + mov ebx,characters + xlat byte [ebx] + cmp al,'@' + je new_anonymous + cmp al,'b' + je anonymous_back + cmp al,'r' + je anonymous_back + cmp al,'f' + jne standard_label + add esi,2 + mov eax,[anonymous_forward] + or eax,eax + jnz anonymous_ok + mov eax,[current_line] + mov [error_line],eax + mov eax,[labels_list] + sub eax,24 + mov [labels_list],eax + mov [anonymous_forward],eax + anonymous_ok: + xor ebx,ebx + ret + anonymous_back: + add esi,2 + mov eax,[anonymous_reverse] + or eax,eax + jz invalid_value + jmp anonymous_ok + new_anonymous: + add esi,2 + mov eax,[anonymous_forward] + or eax,eax + jnz new_anonymous_ok + mov eax,[labels_list] + sub eax,24 + mov [labels_list],eax + new_anonymous_ok: + mov [anonymous_reverse],eax + mov [anonymous_forward],0 + jmp anonymous_ok + standard_label: + cmp byte [esi],'%' + je get_predefined_id + cmp byte [esi],'$' + jne find_label + cmp ecx,2 + ja find_label + inc esi + jb get_current_offset_id + inc esi + cmp byte [esi-1],'$' + je get_org_origin_id + sub esi,ecx + jmp find_label + get_current_offset_id: + xor eax,eax + ret + get_counter_id: + mov eax,1 + ret + get_timestamp_id: + mov eax,2 + ret + get_org_origin_id: + mov eax,3 + ret + get_predefined_id: + cmp ecx,2 + ja find_label + inc esi + cmp cl,1 + je get_counter_id + lods byte [esi] + mov ebx,characters + xlat [ebx] + cmp al,'t' + je get_timestamp_id + sub esi,2 + find_label: + xor ebx,ebx + mov eax,2166136261 + mov ebp,16777619 + hash_label: + xor al,[esi+ebx] + mul ebp + inc bl + cmp bl,cl + jb hash_label + mov ebp,eax + shl eax,8 + and ebp,0FFh shl 24 + xor ebp,eax + or ebp,ebx + mov [label_hash],ebp + push edi esi + push ecx + mov ecx,32 + mov ebx,hash_tree + follow_tree: + mov edx,[ebx] + or edx,edx + jz extend_tree + xor eax,eax + shl ebp,1 + adc eax,0 + lea ebx,[edx+eax*4] + dec ecx + jnz follow_tree + mov [label_leaf],ebx + pop edx + mov eax,[ebx] + or eax,eax + jz add_label + mov ebx,esi + mov ebp,[label_hash] + compare_labels: + mov esi,ebx + mov ecx,edx + mov edi,[eax+4] + repe cmps byte [esi],[edi] + je label_found + mov eax,[eax] + or eax,eax + jnz compare_labels + jmp add_label + label_found: + add esp,4 + pop edi + mov ebx,[eax+4] + mov eax,[eax+8] + ret + extend_tree: + mov edx,[free_additional_memory] + lea eax,[edx+8] + cmp eax,[additional_memory_end] + ja out_of_memory + mov [free_additional_memory],eax + xor eax,eax + mov [edx],eax + mov [edx+4],eax + shl ebp,1 + adc eax,0 + mov [ebx],edx + lea ebx,[edx+eax*4] + dec ecx + jnz extend_tree + mov [label_leaf],ebx + pop edx + add_label: + mov ecx,edx + pop esi + cmp byte [esi-2],0 + je label_name_ok + mov al,[esi] + cmp al,30h + jb name_first_char_ok + cmp al,39h + jbe invalid_name + name_first_char_ok: + cmp ecx,1 + jne check_for_reserved_word + cmp al,'$' + je reserved_word + check_for_reserved_word: + call get_instruction + jnc reserved_word + mov edi,data_directives + call get_symbol + jnc reserved_word + mov edi,symbols + call get_symbol + jnc reserved_word + mov edi,formatter_symbols + call get_symbol + jnc reserved_word + sub esi,2 + mov edi,operators + call get_operator + or al,al + jnz reserved_word + mov edi,single_operand_operators + call get_operator + or al,al + jnz reserved_word + mov edi,directive_operators + call get_operator + or al,al + jnz reserved_word + inc esi + movzx ecx,byte [esi] + inc esi + label_name_ok: + mov edx,[free_additional_memory] + lea eax,[edx+12] + cmp eax,[additional_memory_end] + ja out_of_memory + mov [free_additional_memory],eax + mov [edx+4],esi + mov ebx,esi + add esi,ecx + mov eax,[label_leaf] + mov edi,[eax] + mov [edx],edi + mov [eax],edx + mov eax,[labels_list] + sub eax,24 + mov [labels_list],eax + mov [edx+8],eax + pop edi + ret + reserved_word: + mov eax,0Fh + pop edi + ret + +operators: + db 1,'+',80h + db 1,'-',81h + db 1,'*',90h + db 1,'/',91h + db 3,'mod',0A0h + db 3,'and',0B0h + db 2,'or',0B1h + db 3,'xor',0B2h + db 3,'shl',0C0h + db 3,'shr',0C1h + db 0 + +single_operand_operators: + db 1,'+',0 + db 1,'-',0D1h + db 3,'not',0D0h + db 3,'rva',0E0h + db 0 + +directive_operators: + db 2,'as',86h + db 2,'at',80h + db 7,'defined',88h + db 3,'dup',81h + db 2,'eq',0F0h + db 6,'eqtype',0F7h + db 4,'from',82h + db 2,'in',0F6h + db 2,'on',84h + db 3,'ptr',85h + db 4,'used',89h + db 0 diff --git a/programs/fasm/trunk/preproce.inc b/programs/fasm/trunk/preproce.inc new file mode 100644 index 0000000000..c63ce26b04 --- /dev/null +++ b/programs/fasm/trunk/preproce.inc @@ -0,0 +1,2422 @@ + +; flat assembler core +; Copyright (c) 1999-2005, Tomasz Grysztar. +; All rights reserved. + +preprocessor: + mov edi,characters + mov ecx,100h + xor al,al + make_characters_table: + stosb + inc al + loop make_characters_table + mov esi,characters+'a' + mov edi,characters+'A' + mov ecx,26 + rep movsb + mov edi,characters + mov esi,symbol_characters+1 + movzx ecx,byte [esi-1] + xor eax,eax + mark_symbol_characters: + lodsb + mov byte [edi+eax],0 + loop mark_symbol_characters + mov edi,locals_counter + mov al,7 + stos byte [edi] + movzx ecx,al + mov al,'0' + rep stos byte [edi] + mov edi,[memory_start] + mov [include_paths],edi + mov esi,include_variable + call get_environment_variable + xor al,al + stosb + mov [memory_start],edi + mov eax,[additional_memory] + mov [free_additional_memory],eax + mov eax,[additional_memory_end] + mov [labels_list],eax + xor eax,eax + mov [display_buffer],eax + mov [hash_tree],eax + mov [macro_status],al + mov esi,[input_file] + mov edx,esi + call open + jc main_file_not_found + mov edi,[memory_start] + call preprocess_file + mov eax,[error_line] + mov [current_line],eax + cmp [macro_status],0 + jne incomplete_macro + mov [source_start],edi + ret + +preprocess_file: + push [memory_end] + push esi + mov al,2 + xor edx,edx + call lseek + push eax + xor al,al + xor edx,edx + call lseek + pop ecx + mov edx,[memory_end] + dec edx + mov byte [edx],1Ah + sub edx,ecx + jc out_of_memory + mov esi,edx + cmp edx,edi + jbe out_of_memory + mov [memory_end],edx + call read + call close + pop edx + xor ecx,ecx + mov ebx,esi + preprocess_source: + inc ecx + mov [current_line],edi + mov eax,edx + stos dword [edi] + mov eax,ecx + stos dword [edi] + mov eax,esi + sub eax,ebx + stos dword [edi] + xor eax,eax + stos dword [edi] + push ebx edx + call convert_line + call preprocess_line + pop edx ebx + next_line: + cmp byte [esi-1],1Ah + jne preprocess_source + file_end: + pop [memory_end] + clc + ret + +convert_line: + push ecx + test [macro_status],0Fh + jz convert_line_data + mov ax,3Bh + stos word [edi] + convert_line_data: + cmp edi,[memory_end] + jae out_of_memory + lods byte [esi] + cmp al,20h + je convert_line_data + cmp al,9 + je convert_line_data + mov ah,al + mov ebx,characters + xlat byte [ebx] + or al,al + jz convert_separator + cmp ah,27h + je convert_string + cmp ah,22h + je convert_string + mov byte [edi],1Ah + scas word [edi] + xchg al,ah + stos byte [edi] + mov ebx,characters + xor ecx,ecx + convert_symbol: + lods byte [esi] + stos byte [edi] + xlat byte [ebx] + or al,al + loopnzd convert_symbol + neg ecx + cmp ecx,255 + ja name_too_long + mov ebx,edi + sub ebx,ecx + mov byte [ebx-2],cl + found_separator: + dec edi + mov ah,[esi-1] + convert_separator: + xchg al,ah + cmp al,20h + jb control_character + je convert_line_data + symbol_character: + cmp al,3Bh + je ignore_comment + cmp al,5Ch + je backslash_character + stos byte [edi] + jmp convert_line_data + control_character: + cmp al,1Ah + je line_end + cmp al,0Dh + je cr_character + cmp al,0Ah + je lf_character + cmp al,9 + je convert_line_data + or al,al + jnz symbol_character + jmp line_end + lf_character: + lods byte [esi] + cmp al,0Dh + je line_end + dec esi + jmp line_end + cr_character: + lods byte [esi] + cmp al,0Ah + je line_end + dec esi + jmp line_end + convert_string: + mov al,22h + stos byte [edi] + scas dword [edi] + mov ebx,edi + copy_string: + lods byte [esi] + stos byte [edi] + cmp al,0Ah + je missing_end_quote + cmp al,0Dh + je missing_end_quote + or al,al + jz missing_end_quote + cmp al,1Ah + je missing_end_quote + cmp al,ah + jne copy_string + lods byte [esi] + cmp al,ah + je copy_string + dec esi + dec edi + mov eax,edi + sub eax,ebx + mov [ebx-4],eax + jmp convert_line_data + backslash_character: + mov byte [edi],0 + lods byte [esi] + cmp al,20h + je concatenate_lines + cmp al,9 + je concatenate_lines + cmp al,1Ah + je unexpected_end_of_file + cmp al,0Ah + je concatenate_lf + cmp al,0Dh + je concatenate_cr + cmp al,3Bh + je find_concatenated_line + mov al,1Ah + stos byte [edi] + mov ecx,edi + mov ax,5C01h + stos word [edi] + dec esi + group_backslashes: + lods byte [esi] + cmp al,5Ch + jne backslashed_symbol + stos byte [edi] + inc byte [ecx] + jmp group_backslashes + backslashed_symbol: + cmp al,1Ah + je unexpected_end_of_file + cmp al,0Ah + je extra_characters_on_line + cmp al,0Dh + je extra_characters_on_line + cmp al,20h + je extra_characters_on_line + cmp al,9 + je extra_characters_on_line + cmp al,22h + je extra_characters_on_line + cmp al,27h + je extra_characters_on_line + cmp al,3Bh + je extra_characters_on_line + mov ah,al + mov ebx,characters + xlat byte [ebx] + or al,al + jz backslashed_symbol_character + mov al,ah + convert_backslashed_symbol: + stos byte [edi] + xlat byte [ebx] + or al,al + jz found_separator + inc byte [ecx] + jz name_too_long + lods byte [esi] + jmp convert_backslashed_symbol + backslashed_symbol_character: + mov al,ah + stos byte [edi] + inc byte [ecx] + jmp convert_line_data + concatenate_lines: + lods byte [esi] + cmp al,20h + je concatenate_lines + cmp al,9 + je concatenate_lines + cmp al,1Ah + je unexpected_end_of_file + cmp al,0Ah + je concatenate_lf + cmp al,0Dh + je concatenate_cr + cmp al,3Bh + jne extra_characters_on_line + find_concatenated_line: + lods byte [esi] + cmp al,0Ah + je concatenate_lf + cmp al,0Dh + je concatenate_cr + or al,al + jz concatenate_ok + cmp al,1Ah + jne find_concatenated_line + jmp unexpected_end_of_file + concatenate_lf: + lods byte [esi] + cmp al,0Dh + je concatenate_ok + dec esi + jmp concatenate_ok + concatenate_cr: + lods byte [esi] + cmp al,0Ah + je concatenate_ok + dec esi + concatenate_ok: + inc dword [esp] + jmp convert_line_data + ignore_comment: + lods byte [esi] + cmp al,0Ah + je lf_character + cmp al,0Dh + je cr_character + or al,al + jz line_end + cmp al,1Ah + jne ignore_comment + line_end: + xor al,al + stos byte [edi] + pop ecx + ret + +preprocess_line: + mov eax,esp + sub eax,100h + jc stack_overflow + cmp eax,[stack_limit] + jb stack_overflow + push ecx esi + preprocess_current_line: + mov esi,[current_line] + add esi,16 + cmp word [esi],3Bh + jne line_start_ok + add esi,2 + line_start_ok: + test [macro_status],0F0h + jnz macro_preprocessing + cmp byte [esi],1Ah + jne not_fix_constant + movzx edx,byte [esi+1] + lea edx,[esi+2+edx] + cmp word [edx],031Ah + jne not_fix_constant + mov ebx,characters + movzx eax,byte [edx+2] + xlat byte [ebx] + ror eax,8 + mov al,[edx+3] + xlat byte [ebx] + ror eax,8 + mov al,[edx+4] + xlat byte [ebx] + ror eax,16 + cmp eax,'fix' + je define_fix_constant + not_fix_constant: + call process_fix_constants + jmp initial_preprocessing_ok + macro_preprocessing: + call process_macro_operators + initial_preprocessing_ok: + mov esi,[current_line] + add esi,16 + mov al,[macro_status] + test al,2 + jnz skip_macro_block + test al,1 + jnz find_macro_block + preprocess_instruction: + mov [current_offset],esi + lods byte [esi] + movzx ecx,byte [esi] + inc esi + cmp al,1Ah + jne not_preprocessor_symbol + cmp cl,3 + jb not_preprocessor_directive + push edi + mov edi,preprocessor_directives + call get_symbol + pop edi + jc not_preprocessor_directive + mov byte [edx-2],3Bh + movzx ebx,ax + add ebx,preprocessor + jmp near ebx + not_preprocessor_directive: + xor ch,ch + call get_preprocessor_symbol + jc not_macro + mov byte [ebx-2],3Bh + mov [struc_name],0 + jmp use_macro + not_macro: + mov [struc_name],esi + add esi,ecx + lods byte [esi] + cmp al,':' + je preprocess_label + cmp al,1Ah + jne not_preprocessor_symbol + lods byte [esi] + cmp al,3 + jne not_symbolic_constant + mov ebx,characters + movzx eax,byte [esi] + xlat byte [ebx] + ror eax,8 + mov al,[esi+1] + xlat byte [ebx] + ror eax,8 + mov al,[esi+2] + xlat byte [ebx] + ror eax,16 + cmp eax,'equ' + je define_equ_constant + mov al,3 + not_symbolic_constant: + mov ch,1 + mov cl,al + call get_preprocessor_symbol + jc not_preprocessor_symbol + push edx esi + mov esi,[struc_name] + mov [struc_label],esi + sub [struc_label],2 + mov cl,[esi-1] + mov ch,10b + call get_preprocessor_symbol + jc struc_name_ok + mov ecx,[edx+12] + add ecx,3 + lea ebx,[edi+ecx] + mov ecx,edi + sub ecx,[struc_label] + lea esi,[edi-1] + lea edi,[ebx-1] + std + rep movs byte [edi],[esi] + cld + mov edi,[struc_label] + mov esi,[edx+8] + mov ecx,[edx+12] + add [struc_name],ecx + add [struc_name],3 + call move_data + mov al,3Ah + stos byte [edi] + mov ax,3Bh + stos word [edi] + mov edi,ebx + pop esi + add esi,[edx+12] + add esi,3 + pop edx + jmp use_macro + struc_name_ok: + mov edx,[struc_name] + movzx eax,byte [edx-1] + add edx,eax + mov al,3Ah + mov [edx],al + inc al + xchg al,[edx+1] + dec al + mov [edx+2],al + pop esi edx + jmp use_macro + preprocess_label: + dec esi + sub esi,ecx + lea ebp,[esi-2] + mov ch,10b + call get_preprocessor_symbol + jnc symbolic_constant_in_label + lea esi,[esi+ecx+1] + jmp preprocess_instruction + symbolic_constant_in_label: + mov ebx,[edx+8] + mov ecx,[edx+12] + add ecx,ebx + check_for_broken_label: + cmp ebx,ecx + je label_broken + cmp byte [ebx],1Ah + jne label_broken + movzx eax,byte [ebx+1] + lea ebx,[ebx+2+eax] + cmp ebx,ecx + je label_constant_ok + cmp byte [ebx],':' + jne label_broken + inc ebx + jmp check_for_broken_label + label_broken: + push line_preprocessed + jmp replace_symbolic_constant + label_constant_ok: + mov ecx,edi + sub ecx,esi + mov edi,[edx+12] + add edi,ebp + push edi + lea eax,[edi+ecx] + push eax + cmp esi,edi + je replace_label + jb move_rest_of_line_up + rep movs byte [edi],[esi] + jmp replace_label + move_rest_of_line_up: + lea esi,[esi+ecx-1] + lea edi,[edi+ecx-1] + std + rep movs byte [edi],[esi] + cld + replace_label: + mov ecx,[edx+12] + mov edi,[esp+4] + sub edi,ecx + mov esi,[edx+8] + rep movs byte [edi],[esi] + pop edi esi + inc esi + jmp preprocess_instruction + not_preprocessor_symbol: + mov esi,[current_offset] + call process_equ_constants + line_preprocessed: + pop esi ecx + ret + +get_preprocessor_symbol: + push ebp edi esi + mov ebp,ecx + shl ebp,22 + movzx ecx,cl + mov ebx,hash_tree + mov edi,10 + follow_hashes_roots: + mov edx,[ebx] + or edx,edx + jz preprocessor_symbol_not_found + xor eax,eax + shl ebp,1 + adc eax,0 + lea ebx,[edx+eax*4] + dec edi + jnz follow_hashes_roots + mov edi,ebx + call calculate_hash + mov ebp,eax + and ebp,3FFh + shl ebp,10 + xor ebp,eax + mov ebx,edi + mov edi,22 + follow_hashes_tree: + mov edx,[ebx] + or edx,edx + jz preprocessor_symbol_not_found + xor eax,eax + shl ebp,1 + adc eax,0 + lea ebx,[edx+eax*4] + dec edi + jnz follow_hashes_tree + mov al,cl + mov edx,[ebx] + or edx,edx + jz preprocessor_symbol_not_found + compare_with_preprocessor_symbol: + mov edi,[edx+4] + cmp edi,1 + jbe next_equal_hash + repe cmps byte [esi],[edi] + je preprocessor_symbol_found + mov cl,al + mov esi,[esp] + next_equal_hash: + mov edx,[edx] + or edx,edx + jnz compare_with_preprocessor_symbol + preprocessor_symbol_not_found: + pop esi edi ebp + stc + ret + preprocessor_symbol_found: + pop ebx edi ebp + clc + ret + calculate_hash: + xor ebx,ebx + mov eax,2166136261 + mov ebp,16777619 + fnv1a_hash: + xor al,[esi+ebx] + mul ebp + inc bl + cmp bl,cl + jb fnv1a_hash + ret +add_preprocessor_symbol: + push edi esi + call calculate_hash + mov ebp,eax + and ebp,3FFh + shr eax,10 + xor ebp,eax + shl ecx,22 + or ebp,ecx + mov ebx,hash_tree + mov ecx,32 + find_leave_for_symbol: + mov edx,[ebx] + or edx,edx + jz extend_hashes_tree + xor eax,eax + rol ebp,1 + adc eax,0 + lea ebx,[edx+eax*4] + dec ecx + jnz find_leave_for_symbol + mov edx,[ebx] + or edx,edx + jz add_symbol_entry + shr ebp,30 + cmp ebp,11b + je reuse_symbol_entry + cmp dword [edx+4],0 + jne add_symbol_entry + find_entry_to_reuse: + mov edi,[edx] + or edi,edi + jz reuse_symbol_entry + cmp dword [edi+4],0 + jne reuse_symbol_entry + mov edx,edi + jmp find_entry_to_reuse + add_symbol_entry: + mov eax,edx + mov edx,[labels_list] + sub edx,16 + cmp edx,[free_additional_memory] + jb out_of_memory + mov [labels_list],edx + mov [edx],eax + mov [ebx],edx + reuse_symbol_entry: + pop esi edi + mov [edx+4],esi + ret + extend_hashes_tree: + mov edx,[labels_list] + sub edx,8 + cmp edx,[free_additional_memory] + jb out_of_memory + mov [labels_list],edx + xor eax,eax + mov [edx],eax + mov [edx+4],eax + shl ebp,1 + adc eax,0 + mov [ebx],edx + lea ebx,[edx+eax*4] + dec ecx + jnz extend_hashes_tree + mov edx,[labels_list] + sub edx,16 + cmp edx,[free_additional_memory] + jb out_of_memory + mov [labels_list],edx + mov dword [edx],0 + mov [ebx],edx + pop esi edi + mov [edx+4],esi + ret + +define_fix_constant: + add edx,5 + add esi,2 + push edx esi + mov esi,edx + call process_fix_constants + xchg esi,[esp] + mov ch,11b + jmp define_symbolic_constant +define_equ_constant: + add esi,3 + push esi + call process_equ_constants + push esi + mov esi,[struc_name] + mov ch,10b + define_symbolic_constant: + mov byte [esi-2],3Bh + mov cl,[esi-1] + call add_preprocessor_symbol + pop esi ebx + mov ecx,edi + dec ecx + sub ecx,ebx + mov [edx+8],ebx + mov [edx+12],ecx + jmp line_preprocessed +define_struc: + mov ch,1 + jmp make_macro +define_macro: + xor ch,ch + make_macro: + lods byte [esi] + cmp al,1Ah + jne invalid_name + lods byte [esi] + mov cl,al + call add_preprocessor_symbol + mov eax,[current_line] + mov [edx+12],eax + movzx eax,byte [esi-1] + add esi,eax + mov [edx+8],esi + mov al,[macro_status] + and al,0F0h + or al,1 + mov [macro_status],al + mov eax,[current_line] + mov [error_line],eax + xor bl,bl + lods byte [esi] + or al,al + jz line_preprocessed + cmp al,'{' + je found_macro_block + dec esi + skip_macro_arguments: + lods byte [esi] + cmp al,1Ah + je skip_macro_argument + cmp al,'[' + jne invalid_macro_arguments + xor bl,-1 + jz invalid_macro_arguments + lods byte [esi] + cmp al,1Ah + jne invalid_macro_arguments + skip_macro_argument: + movzx eax,byte [esi] + inc esi + add esi,eax + lods byte [esi] + cmp al,'*' + jne macro_argument_end + lods byte [esi] + macro_argument_end: + cmp al,',' + je skip_macro_arguments + cmp al,']' + jne end_macro_arguments + lods byte [esi] + not bl + end_macro_arguments: + or bl,bl + jnz invalid_macro_arguments + or al,al + jz line_preprocessed + cmp al,'{' + je found_macro_block + jmp invalid_macro_arguments + find_macro_block: + add esi,2 + lods byte [esi] + or al,al + jz line_preprocessed + cmp al,'{' + jne unexpected_characters + found_macro_block: + or [macro_status],2 + skip_macro_block: + lods byte [esi] + cmp al,1Ah + je skip_macro_symbol + cmp al,3Bh + je skip_macro_symbol + cmp al,22h + je skip_macro_string + or al,al + jz line_preprocessed + cmp al,'}' + jne skip_macro_block + mov al,[macro_status] + and [macro_status],0F0h + test al,8 + jnz use_instant_macro + cmp byte [esi],0 + je line_preprocessed + mov ecx,edi + sub ecx,esi + mov edx,esi + lea esi,[esi+ecx-1] + lea edi,[edi+1+16] + mov ebx,edi + dec edi + std + rep movs byte [edi],[esi] + cld + mov edi,edx + xor al,al + stos byte [edi] + mov esi,[current_line] + mov [current_line],edi + mov ecx,4 + rep movs dword [edi],[esi] + mov edi,ebx + jmp preprocess_current_line + skip_macro_symbol: + movzx eax,byte [esi] + inc esi + add esi,eax + jmp skip_macro_block + skip_macro_string: + lods dword [esi] + add esi,eax + jmp skip_macro_block +rept_directive: + mov [base_code],0 + jmp define_instant_macro +irp_directive: + mov [base_code],1 + jmp define_instant_macro +irps_directive: + mov [base_code],2 + jmp define_instant_macro +match_directive: + mov [base_code],10h +define_instant_macro: + mov al,[macro_status] + and al,0F0h + or al,8+1 + mov [macro_status],al + mov eax,[current_line] + mov [error_line],eax + mov [instant_macro_start],esi + cmp [base_code],10h + je prepare_match + skip_parameters: + lods byte [esi] + or al,al + jz instant_macro_parameters_end + cmp al,'{' + je instant_macro_parameters_end + cmp al,22h + je skip_quoted_parameter + cmp al,1Ah + jne skip_parameters + lods byte [esi] + movzx eax,al + add esi,eax + jmp skip_parameters + skip_quoted_parameter: + lods dword [esi] + add esi,eax + jmp skip_parameters + instant_macro_parameters_end: + dec esi + mov [parameters_end],esi + lods byte [esi] + cmp al,'{' + je found_macro_block + or al,al + jnz invalid_macro_arguments + jmp line_preprocessed +prepare_match: + call skip_pattern + mov [value_type],80h+10b + call process_symbolic_constants + jmp instant_macro_parameters_end + skip_pattern: + lods byte [esi] + or al,al + jz invalid_macro_arguments + cmp al,',' + je pattern_skipped + cmp al,22h + je skip_quoted_string_in_pattern + cmp al,1Ah + je skip_symbol_in_pattern + cmp al,'=' + jne skip_pattern + mov al,[esi] + cmp al,1Ah + je skip_pattern + cmp al,22h + je skip_pattern + inc esi + jmp skip_pattern + skip_symbol_in_pattern: + lods byte [esi] + movzx eax,al + add esi,eax + jmp skip_pattern + skip_quoted_string_in_pattern: + lods dword [esi] + add esi,eax + jmp skip_pattern + pattern_skipped: + ret + +purge_macro: + xor ch,ch + jmp restore_preprocessor_symbol +purge_struc: + mov ch,1 + jmp restore_preprocessor_symbol +restore_equ_constant: + mov ch,10b + restore_preprocessor_symbol: + push ecx + lods byte [esi] + cmp al,1Ah + jne invalid_name + lods byte [esi] + mov cl,al + call get_preprocessor_symbol + jc no_symbol_to_restore + mov dword [edx+4],0 + jmp symbol_restored + no_symbol_to_restore: + add esi,ecx + symbol_restored: + pop ecx + lods byte [esi] + cmp al,',' + je restore_preprocessor_symbol + or al,al + jnz extra_characters_on_line + jmp line_preprocessed + +process_fix_constants: + mov [value_type],11b + jmp process_symbolic_constants +process_equ_constants: + mov [value_type],10b + process_symbolic_constants: + mov ebp,esi + lods byte [esi] + cmp al,1Ah + je check_symbol + cmp al,22h + je ignore_string + cmp al,'{' + je check_brace + or al,al + jnz process_symbolic_constants + ret + ignore_string: + lods dword [esi] + add esi,eax + jmp process_symbolic_constants + check_brace: + test [value_type],80h + jz process_symbolic_constants + ret + no_replacing: + movzx ecx,byte [esi-1] + add esi,ecx + jmp process_symbolic_constants + check_symbol: + mov cl,[esi] + inc esi + mov ch,[value_type] + call get_preprocessor_symbol + jc no_replacing + mov [current_section],edi + replace_symbolic_constant: + mov ecx,[edx+12] + mov edx,[edx+8] + xchg esi,edx + call move_data + mov esi,edx + process_after_replaced: + lods byte [esi] + cmp al,1Ah + je symbol_after_replaced + stos byte [edi] + cmp al,22h + je string_after_replaced + cmp al,'{' + je brace_after_replaced + or al,al + jnz process_after_replaced + mov ecx,edi + sub ecx,esi + mov edi,ebp + call move_data + mov esi,edi + ret + move_data: + shr ecx,1 + jnc movsb_ok + movs byte [edi],[esi] + movsb_ok: + shr ecx,1 + jnc movsw_ok + movs word [edi],[esi] + movsw_ok: + rep movs dword [edi],[esi] + ret + string_after_replaced: + lods dword [esi] + stos dword [edi] + mov ecx,eax + call move_data + jmp process_after_replaced + brace_after_replaced: + test [value_type],80h + jz process_after_replaced + mov edx,edi + mov ecx,[current_section] + sub edx,ecx + sub ecx,esi + rep movs byte [edi],[esi] + mov ecx,edi + sub ecx,esi + mov edi,ebp + call move_data + lea esi,[ebp+edx] + ret + symbol_after_replaced: + mov cl,[esi] + inc esi + mov ch,[value_type] + call get_preprocessor_symbol + jnc replace_symbolic_constant + movzx ecx,byte [esi-1] + mov al,1Ah + mov ah,cl + stos word [edi] + call move_data + jmp process_after_replaced +process_macro_operators: + xor dl,dl + mov ebp,edi + before_macro_operators: + mov edi,esi + lods byte [esi] + cmp al,'`' + je symbol_conversion + cmp al,'#' + je concatenation + cmp al,1Ah + je symbol_before_macro_operators + cmp al,3Bh + je no_more_macro_operators + cmp al,22h + je string_before_macro_operators + xor dl,dl + or al,al + jnz before_macro_operators + mov edi,esi + ret + no_more_macro_operators: + mov edi,ebp + ret + symbol_before_macro_operators: + mov dl,1Ah + mov ebx,esi + lods byte [esi] + movzx ecx,al + jecxz symbol_before_macro_operators_ok + mov edi,esi + cmp byte [esi],'\' + je escaped_symbol + symbol_before_macro_operators_ok: + add esi,ecx + jmp before_macro_operators + string_before_macro_operators: + mov dl,22h + mov ebx,esi + lods dword [esi] + add esi,eax + jmp before_macro_operators + escaped_symbol: + dec byte [edi-1] + dec ecx + inc esi + cmp ecx,1 + rep movs byte [edi],[esi] + jne after_macro_operators + mov al,[esi-1] + mov ecx,ebx + mov ebx,characters + xlat byte [ebx] + mov ebx,ecx + or al,al + jnz after_macro_operators + sub edi,3 + mov al,[esi-1] + stos byte [edi] + xor dl,dl + jmp after_macro_operators + symbol_conversion: + cmp byte [esi],1Ah + jne unexpected_characters + lea eax,[edi+3] + sub eax,esi + ja shift_line_data + mov al,22h + mov dl,al + stos byte [edi] + lods word [esi] + movzx eax,ah + mov ecx,eax + mov ebx,edi + stos dword [edi] + rep movs byte [edi],[esi] + cmp edi,esi + je before_macro_operators + jmp after_macro_operators + shift_line_data: + lea edx,[esi+2] + lea esi,[ebp-1] + add ebp,eax + lea edi,[ebp-1] + lea ecx,[esi+1] + sub ecx,edx + std + rep movs byte [edi],[esi] + cld + movzx eax,byte [edx-1] + sub edi,3 + mov dl,22h + mov [edi-1],dl + mov ebx,edi + mov [edi],eax + lea esi,[edi+4+eax] + jmp before_macro_operators + concatenation: + cmp byte [esi],'#' + je reduce_concatenation_symbol + cmp dl,1Ah + je symbol_concatenation + cmp dl,22h + je string_concatenation + no_concatenation: + cmp esi,edi + je before_macro_operators + jmp after_macro_operators + reduce_concatenation_symbol: + movs byte [edi],[esi] + cmp byte [esi],'#' + je reduce_concatenation_symbol + jmp no_concatenation + symbol_concatenation: + cmp byte [esi],1Ah + jne no_concatenation + inc esi + lods byte [esi] + movzx ecx,al + jecxz do_symbol_concatenation + cmp byte [esi],'\' + jne do_symbol_concatenation + sub esi,2 + jmp no_concatenation + do_symbol_concatenation: + add [ebx],al + jc name_too_long + rep movs byte [edi],[esi] + jmp after_macro_operators + string_concatenation: + cmp byte [esi],22h + je do_string_concatenation + cmp byte [esi],'`' + jne no_concatenation + inc esi + cmp byte [esi],1Ah + jne unexpected_characters + inc esi + lods byte [esi] + movzx ecx,al + add [ebx],ecx + rep movs byte [edi],[esi] + jmp after_macro_operators + do_string_concatenation: + inc esi + lods dword [esi] + mov ecx,eax + add [ebx],eax + rep movs byte [edi],[esi] + after_macro_operators: + lods byte [esi] + cmp al,'`' + je symbol_conversion + cmp al,'#' + je concatenation + stos byte [edi] + cmp al,1Ah + je symbol_after_macro_operators + cmp al,3Bh + je no_more_macro_operators + cmp al,22h + je string_after_macro_operators + xor dl,dl + or al,al + jnz after_macro_operators + ret + symbol_after_macro_operators: + mov dl,1Ah + mov ebx,edi + lods byte [esi] + stos byte [edi] + movzx ecx,al + jecxz symbol_after_macro_operatorss_ok + cmp byte [esi],'\' + je escaped_symbol + symbol_after_macro_operatorss_ok: + rep movs byte [edi],[esi] + jmp after_macro_operators + string_after_macro_operators: + mov dl,22h + mov ebx,edi + lods dword [esi] + stos dword [edi] + mov ecx,eax + rep movs byte [edi],[esi] + jmp after_macro_operators + +use_macro: + push [free_additional_memory] + push [macro_symbols] + mov [macro_symbols],0 + push [counter_limit] + push dword [edx+4] + mov dword [edx+4],1 + push edx + mov ebx,esi + mov esi,[edx+8] + mov eax,[edx+12] + mov [macro_line],eax + mov [counter_limit],0 + process_macro_arguments: + mov al,[esi] + or al,al + jz arguments_end + cmp al,'{' + je arguments_end + inc esi + cmp al,'[' + jne get_macro_arguments + mov ebp,esi + inc esi + inc [counter_limit] + get_macro_arguments: + call get_macro_argument + lods byte [esi] + cmp al,',' + je next_argument + cmp al,']' + je next_arguments_group + dec esi + jmp arguments_end + next_argument: + cmp byte [ebx],',' + jne process_macro_arguments + inc ebx + jmp process_macro_arguments + next_arguments_group: + cmp byte [ebx],',' + jne arguments_end + inc ebx + inc [counter_limit] + mov esi,ebp + jmp process_macro_arguments + get_macro_argument: + lods byte [esi] + movzx ecx,al + mov eax,[counter_limit] + call add_macro_symbol + add esi,ecx + xchg esi,ebx + mov [edx+12],esi + cmp byte [esi],'<' + jne simple_argument + inc esi + mov [edx+12],esi + mov ecx,1 + enclosed_argument: + lods byte [esi] + or al,al + jz invalid_macro_arguments + cmp al,1Ah + je enclosed_symbol + cmp al,22h + je enclosed_string + cmp al,'>' + je enclosed_argument_end + cmp al,'<' + jne enclosed_argument + inc ecx + jmp enclosed_argument + enclosed_symbol: + movzx eax,byte [esi] + inc esi + add esi,eax + jmp enclosed_argument + enclosed_string: + lods dword [esi] + add esi,eax + jmp enclosed_argument + enclosed_argument_end: + loop enclosed_argument + mov al,[esi] + or al,al + jz enclosed_argument_ok + cmp al,',' + jne invalid_macro_arguments + enclosed_argument_ok: + mov eax,esi + sub eax,[edx+12] + dec eax + or eax,80000000h + mov [edx+8],eax + jmp argument_value_ok + simple_argument: + lods byte [esi] + or al,al + jz argument_value_end + cmp al,',' + je argument_value_end + cmp al,22h + je argument_string + cmp al,1Ah + jne simple_argument + movzx eax,byte [esi] + inc esi + add esi,eax + jmp simple_argument + argument_string: + lods dword [esi] + add esi,eax + jmp simple_argument + argument_value_end: + dec esi + mov eax,esi + sub eax,[edx+12] + mov [edx+8],eax + argument_value_ok: + xchg esi,ebx + cmp byte [esi],'*' + jne macro_argument_ok + cmp dword [edx+8],0 + je invalid_macro_arguments + inc esi + macro_argument_ok: + ret + arguments_end: + cmp byte [ebx],0 + jne invalid_macro_arguments + mov eax,[esp+4] + dec eax + call process_macro + pop edx + pop dword [edx+4] + pop [counter_limit] + pop [macro_symbols] + pop [free_additional_memory] + jmp line_preprocessed +use_instant_macro: + push edi [current_line] esi + mov eax,[error_line] + mov [current_line],eax + mov [macro_line],eax + mov esi,[instant_macro_start] + cmp [base_code],10h + jae do_match + cmp [base_code],0 + jne do_irp + call get_number + jc invalid_value + or ebp,ebp + jnz invalid_value + cmp dword [edi+4],0 + jne value_out_of_range + mov eax,[edi] + or eax,eax + jz instant_macro_done + cmp eax,80000000h + jae value_out_of_range + push [free_additional_memory] + push [macro_symbols] + mov [macro_symbols],0 + push [counter_limit] + mov [struc_name],0 + mov [counter_limit],eax + lods byte [esi] + or al,al + jz rept_counters_ok + cmp al,'{' + je rept_counters_ok + cmp al,1Ah + jne invalid_macro_arguments + add_rept_counter: + lods byte [esi] + movzx ecx,al + xor eax,eax + call add_macro_symbol + add esi,ecx + xor eax,eax + mov dword [edx+12],eax + inc eax + mov dword [edx+8],eax + lods byte [esi] + cmp al,':' + jne rept_counter_added + push edx + call get_number + jc invalid_value + or ebp,ebp + jnz invalid_value + cmp dword [edi+4],0 + jne value_out_of_range + mov eax,[edi] + mov edx,eax + add edx,[counter_limit] + jc value_out_of_range + pop edx + mov dword [edx+8],eax + lods byte [esi] + rept_counter_added: + cmp al,',' + jne rept_counters_ok + lods byte [esi] + cmp al,1Ah + jne invalid_macro_arguments + jmp add_rept_counter + rept_counters_ok: + dec esi + instant_macro_parameters_ok: + xor eax,eax + call process_macro + pop [counter_limit] + pop [macro_symbols] + pop [free_additional_memory] + instant_macro_done: + pop ebx esi edx + cmp byte [ebx],0 + je line_preprocessed + mov [current_line],edi + mov ecx,4 + rep movs dword [edi],[esi] + test [macro_status],0Fh + jz instant_macro_attached_line + mov ax,3Bh + stos word [edi] + instant_macro_attached_line: + mov esi,ebx + sub edx,ebx + mov ecx,edx + call move_data + jmp preprocess_current_line +do_irp: + cmp byte [esi],1Ah + jne invalid_macro_arguments + movzx eax,byte [esi+1] + lea esi,[esi+2+eax] + lods byte [esi] + cmp [base_code],1 + ja irps_name_ok + cmp al,'*' + jne irp_name_ok + lods byte [esi] + irp_name_ok: + cmp al,',' + jne invalid_macro_arguments + jmp irp_parameters_start + irps_name_ok: + cmp al,',' + jne invalid_macro_arguments + mov al,[esi] + or al,al + jz instant_macro_done + cmp al,'{' + je instant_macro_done + irp_parameters_start: + xor eax,eax + push [free_additional_memory] + push [macro_symbols] + mov [macro_symbols],eax + push [counter_limit] + mov [counter_limit],eax + mov [struc_name],eax + mov ebx,esi + cmp [base_code],1 + ja get_irps_parameter + mov edx,[parameters_end] + mov al,[edx] + push eax + mov byte [edx],0 + get_irp_parameter: + inc [counter_limit] + mov esi,[instant_macro_start] + inc esi + call get_macro_argument + cmp byte [ebx],',' + jne irp_parameters_end + inc ebx + jmp get_irp_parameter + irp_parameters_end: + mov esi,ebx + pop eax + mov [esi],al + jmp instant_macro_parameters_ok + get_irps_parameter: + mov esi,[instant_macro_start] + inc esi + lods byte [esi] + movzx ecx,al + inc [counter_limit] + mov eax,[counter_limit] + call add_macro_symbol + mov [edx+12],ebx + cmp byte [ebx],1Ah + je irps_symbol + cmp byte [ebx],22h + je irps_quoted_string + mov eax,1 + jmp irps_parameter_ok + irps_quoted_string: + mov eax,[ebx+1] + add eax,1+4 + irps_symbol: + movzx eax,byte [ebx+1] + add eax,1+1 + irps_parameter_ok: + mov [edx+8],eax + add ebx,eax + cmp byte [ebx],0 + je irps_parameters_end + cmp byte [ebx],'{' + jne get_irps_parameter + irps_parameters_end: + mov esi,ebx + jmp instant_macro_parameters_ok +do_match: + mov ebx,esi + call skip_pattern + call exact_match + mov edx,edi + mov al,[ebx] + cmp al,1Ah + je free_match + cmp al,',' + jne instant_macro_done + cmp esi,[parameters_end] + je matched_pattern + jmp instant_macro_done + free_match: + add edx,12 + cmp edx,[memory_end] + ja out_of_memory + mov [edx-12],ebx + mov [edx-8],esi + call skip_match_element + jc try_different_matching + mov [edx-4],esi + movzx eax,byte [ebx+1] + lea ebx,[ebx+2+eax] + cmp byte [ebx],1Ah + je free_match + find_exact_match: + call exact_match + cmp esi,[parameters_end] + je end_matching + cmp byte [ebx],1Ah + je free_match + mov ebx,[edx-12] + movzx eax,byte [ebx+1] + lea ebx,[ebx+2+eax] + mov esi,[edx-4] + jmp match_more_elements + try_different_matching: + sub edx,12 + cmp edx,edi + je instant_macro_done + mov ebx,[edx-12] + movzx eax,byte [ebx+1] + lea ebx,[ebx+2+eax] + cmp byte [ebx],1Ah + je try_different_matching + mov esi,[edx-4] + match_more_elements: + call skip_match_element + jc try_different_matching + mov [edx-4],esi + jmp find_exact_match + skip_match_element: + cmp esi,[parameters_end] + je cannot_match + mov al,[esi] + cmp al,1Ah + je skip_match_symbol + cmp al,22h + je skip_match_quoted_string + add esi,1 + ret + skip_match_quoted_string: + mov eax,[esi+1] + add esi,5 + jmp skip_match_ok + skip_match_symbol: + movzx eax,byte [esi+1] + add esi,2 + skip_match_ok: + add esi,eax + ret + cannot_match: + stc + ret + exact_match: + cmp esi,[parameters_end] + je exact_match_complete + mov ah,[esi] + mov al,[ebx] + cmp al,',' + je exact_match_complete + cmp al,1Ah + je exact_match_complete + cmp al,'=' + je match_verbatim + call match_elements + je exact_match + exact_match_complete: + ret + match_verbatim: + inc ebx + call match_elements + je exact_match + dec ebx + ret + match_elements: + mov al,[ebx] + cmp al,1Ah + je match_symbols + cmp al,22h + je match_quoted_strings + cmp al,ah + je symbol_characters_matched + ret + symbol_characters_matched: + lea ebx,[ebx+1] + lea esi,[esi+1] + ret + match_quoted_strings: + mov ecx,[ebx+1] + add ecx,5 + jmp compare_elements + match_symbols: + movzx ecx,byte [ebx+1] + add ecx,2 + compare_elements: + mov eax,esi + mov ebp,edi + mov edi,ebx + repe cmps byte [esi],[edi] + jne elements_mismatch + mov ebx,edi + mov edi,ebp + ret + elements_mismatch: + mov esi,eax + mov edi,ebp + ret + end_matching: + cmp byte [ebx],',' + jne instant_macro_done + matched_pattern: + xor eax,eax + push [free_additional_memory] + push [macro_symbols] + mov [macro_symbols],eax + push [counter_limit] + mov [counter_limit],eax + mov [struc_name],eax + push esi edi edx + add_matched_symbol: + cmp edi,[esp] + je matched_symbols_ok + mov esi,[edi] + inc esi + lods byte [esi] + movzx ecx,al + xor eax,eax + call add_macro_symbol + mov eax,[edi+4] + mov dword [edx+12],eax + mov ecx,[edi+8] + sub ecx,eax + mov dword [edx+8],ecx + add edi,12 + jmp add_matched_symbol + matched_symbols_ok: + pop edx edi esi + jmp instant_macro_parameters_ok + +process_macro: + push dword [macro_status] + or [macro_status],10h + push [counter] + push [macro_block] + push [macro_block_line] + push [macro_block_line_number] + push [struc_label] + push [struc_name] + push eax + push [current_line] + lods byte [esi] + cmp al,'{' + je macro_instructions_start + or al,al + jnz unexpected_characters + find_macro_instructions: + mov [macro_line],esi + add esi,16+2 + lods byte [esi] + or al,al + jz find_macro_instructions + cmp al,'{' + je macro_instructions_start + cmp al,3Bh + jne unexpected_characters + call skip_foreign_symbol + jmp find_macro_instructions + macro_instructions_start: + mov ecx,80000000h + mov [macro_block],esi + mov eax,[macro_line] + mov [macro_block_line],eax + mov [macro_block_line_number],ecx + xor eax,eax + mov [counter],eax + cmp [counter_limit],eax + je process_macro_line + inc [counter] + process_macro_line: + mov [current_line],edi + cmp edi,[memory_end] + jae out_of_memory + mov eax,[esp+4] + or eax,eax + jz instant_macro_line_header + stos dword [edi] + mov eax,ecx + stos dword [edi] + mov eax,[esp] + stos dword [edi] + mov eax,[macro_line] + stos dword [edi] + jmp macro_line_header_ok + instant_macro_line_header: + mov edx,[macro_line] + mov eax,[edx] + stos dword [edi] + mov eax,[edx+4] + stos dword [edi] + mov eax,[edx+8] + stos dword [edi] + mov eax,[edx+12] + stos dword [edi] + macro_line_header_ok: + or [macro_status],20h + push ebx ecx + test [macro_status],0Fh + jz process_macro_line_element + mov ax,3Bh + stos word [edi] + process_macro_line_element: + lods byte [esi] + cmp al,'}' + je macro_line_processed + or al,al + jz macro_line_processed + cmp al,1Ah + je process_macro_symbol + cmp al,3Bh + je macro_foreign_line + and [macro_status],not 20h + stos byte [edi] + cmp al,22h + jne process_macro_line_element + copy_macro_string: + mov ecx,[esi] + add ecx,4 + rep movs byte [edi],[esi] + jmp process_macro_line_element + process_macro_symbol: + push esi edi + test [macro_status],20h + jz not_macro_directive + movzx ecx,byte [esi] + inc esi + mov edi,macro_directives + call get_symbol + jnc process_macro_directive + dec esi + jmp not_macro_directive + process_macro_directive: + movzx edx,ax + add edx,preprocessor + pop edi eax + mov byte [edi],0 + inc edi + pop ecx ebx + jmp near edx + not_macro_directive: + and [macro_status],not 20h + movzx ecx,byte [esi] + inc esi + mov eax,[counter] + call get_macro_symbol + jnc group_macro_symbol + xor eax,eax + cmp [counter],eax + je multiple_macro_symbol_values + call get_macro_symbol + jc not_macro_symbol + replace_macro_symbol: + pop edi eax + mov ecx,[edx+8] + and ecx,not 80000000h + mov edx,[edx+12] + or edx,edx + jz replace_macro_counter + xchg esi,edx + rep movs byte [edi],[esi] + mov esi,edx + jmp process_macro_line_element + group_macro_symbol: + xor eax,eax + cmp [counter],eax + je replace_macro_symbol + push esi edx + sub esi,ecx + call get_macro_symbol + mov ebx,edx + pop edx esi + jc replace_macro_symbol + cmp edx,ebx + ja replace_macro_symbol + mov edx,ebx + jmp replace_macro_symbol + multiple_macro_symbol_values: + inc eax + push eax + call get_macro_symbol + pop eax + jc not_macro_symbol + pop edi + push ecx + mov ecx,[edx+8] + mov edx,[edx+12] + xchg esi,edx + btr ecx,31 + jc enclose_macro_symbol_value + rep movs byte [edi],[esi] + jmp macro_symbol_value_ok + enclose_macro_symbol_value: + mov byte [edi],'<' + inc edi + rep movs byte [edi],[esi] + mov byte [edi],'>' + inc edi + macro_symbol_value_ok: + cmp eax,[counter_limit] + je multiple_macro_symbol_values_ok + mov byte [edi],',' + inc edi + mov esi,edx + pop ecx + push edi + sub esi,ecx + jmp multiple_macro_symbol_values + multiple_macro_symbol_values_ok: + pop ecx eax + mov esi,edx + jmp process_macro_line_element + replace_macro_counter: + mov eax,[counter] + and eax,not 80000000h + jz group_macro_counter + add ecx,eax + dec ecx + call store_number_symbol + jmp process_macro_line_element + group_macro_counter: + mov edx,ecx + xor ecx,ecx + multiple_macro_counter_values: + push ecx edx + add ecx,edx + call store_number_symbol + pop edx ecx + inc ecx + cmp ecx,[counter_limit] + je process_macro_line_element + mov byte [edi],',' + inc edi + jmp multiple_macro_counter_values + store_number_symbol: + mov ax,1Ah + stos word [edi] + push edi + mov eax,ecx + mov ecx,1000000000 + xor edx,edx + xor bl,bl + store_number_digits: + div ecx + push edx + or bl,bl + jnz store_number_digit + cmp ecx,1 + je store_number_digit + or al,al + jz number_digit_ok + not bl + store_number_digit: + add al,30h + stos byte [edi] + number_digit_ok: + mov eax,ecx + xor edx,edx + mov ecx,10 + div ecx + mov ecx,eax + pop eax + or ecx,ecx + jnz store_number_digits + pop ebx + mov eax,edi + sub eax,ebx + mov [ebx-1],al + ret + not_macro_symbol: + pop edi esi + mov al,1Ah + stos byte [edi] + mov al,[esi] + inc esi + stos byte [edi] + cmp byte [esi],'.' + jne copy_raw_symbol + mov ebx,[esp+8+8] + or ebx,ebx + jz copy_raw_symbol + cmp al,1 + je copy_struc_name + xchg esi,ebx + movzx ecx,byte [esi-1] + add [edi-1],cl + jc name_too_long + rep movs byte [edi],[esi] + xchg esi,ebx + copy_raw_symbol: + movzx ecx,al + rep movs byte [edi],[esi] + jmp process_macro_line_element + copy_struc_name: + inc esi + xchg esi,ebx + movzx ecx,byte [esi-1] + mov [edi-1],cl + rep movs byte [edi],[esi] + xchg esi,ebx + mov eax,[esp+8+12] + cmp byte [eax],3Bh + je process_macro_line_element + cmp byte [eax],1Ah + jne disable_replaced_struc_name + mov byte [eax],3Bh + jmp process_macro_line_element + disable_replaced_struc_name: + mov ebx,[esp+8+8] + push esi edi + lea edi,[ebx-3] + lea esi,[edi-2] + lea ecx,[esi+1] + sub ecx,eax + std + rep movs byte [edi],[esi] + cld + mov word [eax],3Bh + pop edi esi + jmp process_macro_line_element + skip_foreign_symbol: + lods byte [esi] + movzx eax,al + add esi,eax + skip_foreign_line: + lods byte [esi] + cmp al,1Ah + je skip_foreign_symbol + cmp al,3Bh + je skip_foreign_symbol + cmp al,22h + je skip_foreign_string + or al,al + jnz skip_foreign_line + ret + skip_foreign_string: + lods dword [esi] + add esi,eax + jmp skip_foreign_line + macro_foreign_line: + call skip_foreign_symbol + macro_line_processed: + mov byte [edi],0 + inc edi + push eax + call preprocess_line + pop eax + pop ecx ebx + cmp al,'}' + je macro_block_processed + process_next_line: + inc ecx + mov [macro_line],esi + add esi,16+2 + jmp process_macro_line + macro_block_processed: + call close_macro_block + jc process_macro_line + pop [current_line] + add esp,12 + pop [macro_block_line_number] + pop [macro_block_line] + pop [macro_block] + pop [counter] + pop eax + and al,0F0h + and [macro_status],0Fh + or [macro_status],al + ret + +local_symbols: + lods byte [esi] + cmp al,1Ah + jne invalid_argument + mov byte [edi-1],3Bh + xor al,al + stos byte [edi] + make_local_symbol: + push ecx + lods byte [esi] + movzx ecx,al + mov eax,[counter] + call add_macro_symbol + mov [edx+12],edi + movzx eax,[locals_counter] + add eax,ecx + inc eax + cmp eax,100h + jae name_too_long + lea ebp,[edi+2+eax] + cmp ebp,[memory_end] + jae out_of_memory + mov ah,al + mov al,1Ah + stos word [edi] + rep movs byte [edi],[esi] + mov al,'?' + stos byte [edi] + push esi + mov esi,locals_counter+1 + movzx ecx,[locals_counter] + rep movs byte [edi],[esi] + pop esi + mov eax,edi + sub eax,[edx+12] + mov [edx+8],eax + xor al,al + stos byte [edi] + mov eax,locals_counter + movzx ecx,byte [eax] + counter_loop: + inc byte [eax+ecx] + cmp byte [eax+ecx],':' + jb counter_ok + jne letter_digit + mov byte [eax+ecx],'A' + jmp counter_ok + letter_digit: + cmp byte [eax+ecx],'F' + jbe counter_ok + mov byte [eax+ecx],'0' + loop counter_loop + counter_ok: + pop ecx + lods byte [esi] + cmp al,'}' + je macro_block_processed + or al,al + jz process_next_line + cmp al,',' + jne extra_characters_on_line + dec edi + lods byte [esi] + cmp al,1Ah + je make_local_symbol + jmp invalid_argument +common_block: + call close_macro_block + jc process_macro_line + mov [counter],0 + jmp new_macro_block +forward_block: + cmp [counter_limit],0 + je common_block + call close_macro_block + jc process_macro_line + mov [counter],1 + jmp new_macro_block +reverse_block: + cmp [counter_limit],0 + je common_block + call close_macro_block + jc process_macro_line + mov eax,[counter_limit] + or eax,80000000h + mov [counter],eax + new_macro_block: + mov [macro_block],esi + mov eax,[macro_line] + mov [macro_block_line],eax + mov [macro_block_line_number],ecx + jmp process_macro_line +close_macro_block: + cmp [counter],0 + je block_closed + jl reverse_counter + mov eax,[counter] + cmp eax,[counter_limit] + je block_closed + inc [counter] + jmp continue_block + reverse_counter: + mov eax,[counter] + dec eax + cmp eax,80000000h + je block_closed + mov [counter],eax + continue_block: + mov esi,[macro_block] + mov eax,[macro_block_line] + mov [macro_line],eax + mov ecx,[macro_block_line_number] + stc + ret + block_closed: + clc + ret +get_macro_symbol: + push ecx + call find_macro_symbol_leaf + jc macro_symbol_not_found + mov edx,[ebx] + mov ebx,esi + try_macro_symbol: + or edx,edx + jz macro_symbol_not_found + mov ecx,[esp] + mov edi,[edx+4] + repe cmps byte [esi],[edi] + je macro_symbol_found + mov esi,ebx + mov edx,[edx] + jmp try_macro_symbol + macro_symbol_found: + pop ecx + clc + ret + macro_symbol_not_found: + pop ecx + stc + ret + find_macro_symbol_leaf: + shl eax,8 + mov al,cl + mov ebp,eax + mov ebx,macro_symbols + follow_macro_symbols_tree: + mov edx,[ebx] + or edx,edx + jz no_such_macro_symbol + xor eax,eax + shr ebp,1 + adc eax,0 + lea ebx,[edx+eax*4] + or ebp,ebp + jnz follow_macro_symbols_tree + add ebx,8 + clc + ret + no_such_macro_symbol: + stc + ret +add_macro_symbol: + push ebx ebp + call find_macro_symbol_leaf + jc extend_macro_symbol_tree + mov eax,[ebx] + make_macro_symbol: + mov edx,[free_additional_memory] + add edx,16 + cmp edx,[labels_list] + ja out_of_memory + xchg edx,[free_additional_memory] + mov [ebx],edx + mov [edx],eax + mov [edx+4],esi + pop ebp ebx + ret + extend_macro_symbol_tree: + mov edx,[free_additional_memory] + add edx,16 + cmp edx,[labels_list] + ja out_of_memory + xchg edx,[free_additional_memory] + xor eax,eax + mov [edx],eax + mov [edx+4],eax + mov [edx+8],eax + mov [edx+12],eax + shr ebp,1 + adc eax,0 + mov [ebx],edx + lea ebx,[edx+eax*4] + or ebp,ebp + jnz extend_macro_symbol_tree + add ebx,8 + xor eax,eax + jmp make_macro_symbol + +include_file: + lods byte [esi] + cmp al,22h + jne invalid_argument + lods dword [esi] + cmp byte [esi+eax],0 + jne extra_characters_on_line + push esi + push edi + mov ebx,[current_line] + find_current_file_path: + mov esi,[ebx] + test byte [ebx+7],80h + jz copy_current_file_path + mov ebx,[ebx+8] + jmp find_current_file_path + copy_current_file_path: + lods byte [esi] + stos byte [edi] + or al,al + jnz copy_current_file_path + cut_current_file_name: + cmp edi,[esp] + je current_file_path_ok + cmp byte [edi-1],'\' + je current_file_path_ok + cmp byte [edi-1],'/' + je current_file_path_ok + dec edi + jmp cut_current_file_name + current_file_path_ok: + mov esi,[esp+4] + call preprocess_path + pop edx + mov esi,edx + call open + jnc include_path_ok + mov ebp,[include_paths] + try_include_directories: + mov edi,esi + mov esi,ebp + cmp byte [esi],0 + je try_in_current_directory + push ebp + push edi + copy_include_directory: + lods byte [esi] + cmp al,';' + je include_directory_ok + stos byte [edi] + or al,al + jnz copy_include_directory + dec esi + dec edi + include_directory_ok: + cmp byte [edi-1],'/' + je path_separator_ok + cmp byte [edi-1],'\' + je path_separator_ok + mov al,'/' + stos byte [edi] + path_separator_ok: + mov [esp+4],esi + mov esi,[esp+8] + call preprocess_path + pop edx + mov esi,edx + call open + pop ebp + jnc include_path_ok + jmp try_include_directories + mov edi,esi + try_in_current_directory: + mov esi,[esp] + push edi + call preprocess_path + pop edx + mov esi,edx + call open + jc file_not_found + include_path_ok: + mov edi,[esp] + copy_preprocessed_path: + lods byte [esi] + stos byte [edi] + or al,al + jnz copy_preprocessed_path + pop esi + lea ecx,[edi-1] + sub ecx,esi + mov [esi-4],ecx + push dword [macro_status] + and [macro_status],0Fh + call preprocess_file + pop eax + mov [macro_status],al + jmp line_preprocessed + preprocess_path: + lods byte [esi] + cmp al,'%' + je environment_variable + stos byte [edi] + or al,al + jnz preprocess_path + cmp edi,[memory_end] + ja out_of_memory + ret + environment_variable: + mov ebx,esi + find_variable_end: + lods byte [esi] + or al,al + jz not_environment_variable + cmp al,'%' + jne find_variable_end + mov byte [esi-1],0 + push esi + mov esi,ebx + call get_environment_variable + pop esi + mov byte [esi-1],'%' + jmp preprocess_path + not_environment_variable: + mov al,'%' + stos byte [edi] + mov esi,ebx + jmp preprocess_path + +include_variable db 'INCLUDE',0 + +symbol_characters db 27 + db 9,0Ah,0Dh,1Ah,20h,'+-/*=<>()[]{}:,|&~#`;\' + +preprocessor_directives: + db 7,'include' + dw include_file-preprocessor + db 3,'irp' + dw irp_directive-preprocessor + db 4,'irps' + dw irps_directive-preprocessor + db 5,'macro' + dw define_macro-preprocessor + db 5,'match' + dw match_directive-preprocessor + db 5,'purge' + dw purge_macro-preprocessor + db 4,'rept' + dw rept_directive-preprocessor + db 7,'restore' + dw restore_equ_constant-preprocessor + db 7,'restruc' + dw purge_struc-preprocessor + db 5,'struc' + dw define_struc-preprocessor + db 0 + +macro_directives: + db 6,'common' + dw common_block-preprocessor + db 7,'forward' + dw forward_block-preprocessor + db 5,'local' + dw local_symbols-preprocessor + db 7,'reverse' + dw reverse_block-preprocessor + db 0 diff --git a/programs/fasm/trunk/struct.inc b/programs/fasm/trunk/struct.inc new file mode 100644 index 0000000000..fea1819aa6 --- /dev/null +++ b/programs/fasm/trunk/struct.inc @@ -0,0 +1,180 @@ + +; 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, \} + struc dw [val] \{ \common fields@struct equ fields@struct,.,dw, \} + struc du [val] \{ \common fields@struct equ fields@struct,.,du, \} + struc dd [val] \{ \common fields@struct equ fields@struct,.,dd, \} + struc dp [val] \{ \common fields@struct equ fields@struct,.,dp, \} + struc dq [val] \{ \common fields@struct equ fields@struct,.,dq, \} + struc dt [val] \{ \common fields@struct equ fields@struct,.,dt, \} + 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, \} + macro dw [val] \{ \common \local anonymous + fields@struct equ fields@struct,anonymous,dw, \} + macro du [val] \{ \common \local anonymous + fields@struct equ fields@struct,anonymous,du, \} + macro dd [val] \{ \common \local anonymous + fields@struct equ fields@struct,anonymous,dd, \} + macro dp [val] \{ \common \local anonymous + fields@struct equ fields@struct,anonymous,dp, \} + macro dq [val] \{ \common \local anonymous + fields@struct equ fields@struct,anonymous,dq, \} + macro dt [val] \{ \common \local anonymous + fields@struct equ fields@struct,anonymous,dt, \} + 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, \} + 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 + common + sizeof.#name = $ + restruc name + match values, list \{ + struc name value \\{ + match any, fields@struct \\\{ fields@struct equ fields@struct,.,name, \\\} + 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, \\} + \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 + 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 \} } diff --git a/programs/fasm/trunk/system.inc b/programs/fasm/trunk/system.inc new file mode 100644 index 0000000000..a3710aed1f --- /dev/null +++ b/programs/fasm/trunk/system.inc @@ -0,0 +1,462 @@ +; flat assembler version 1.60 +; Copyright (c) 1999-2005, Tomasz Grysztar +; All rights reserved. +; +; MenuetOS system.inc by VT + +file_info_open: dd 0,0,0xffffff,0x20000,0xf0000 +fullpath_open:; db '/HD/1/EXAMPLE.ASM' + times MAX_PATH db 0 + +file_info_write: dd 1,0,0,0,0xf0000 +fullpath_write:; db '/HD/1/EXAMPLE' + times MAX_PATH db 0 + +file_info_start: dd 16,0,0,0,0xf0000 +fullpath_start:; db '/HD/1/EXAMPLE' + times MAX_PATH db 0 + +_ramdisk db '/RD/1/' +filepos dd 0x0 + +; info by Privalov: starting from FASM 1.51 +; ~3/8 - additional memory +; ~5/8 - main memory +init_memory: + mov [memory_start],0x100000 + mov [memory_end],0x100000+(APP_MEMORY-0x100000)/8*5 + mov [additional_memory],0x100000+(APP_MEMORY-0x100000)/8*5 + mov [additional_memory_end],APP_MEMORY + ret + +exit_program: + cmp [_mode],NORMAL_MODE + je still + or eax,-1 + int 0x40 + +make_timestamp: + push ebx + mcall 26,9 + imul eax,10 + pop ebx + ret + +get_environment_variable: + mov ecx,[memory_end] + sub ecx,edi + cmp ecx,7 + jb out_of_memory + cmp dword[esi],'INCL' + jne .finish + mov esi,_ramdisk + mov ecx,6 + cld + rep movsb + .finish: +; stc + ret + +open: + call make_fullpaths + +; mov eax,fullpath_open +; DEBUGF '"%s"\n',eax + + mov dword[file_info_open+8],-1 + mcall 58,file_info_open + or eax,eax ; found + jz @f + cmp eax,6 + jne file_error + @@: mov [filesize],ebx + clc + ret + file_error: + stc + ret + +create: + call make_fullpaths + ret + +; ebx file handle +; ecx count of bytes to write +; edx pointer to buffer +write: + pusha + mov [file_info_write+8],ecx + mov [file_info_write+12],edx + mov [filesize],edx + mov eax,58 + mov ebx,file_info_write + int 0x40 + popa + ret + +make_fullpaths: + pusha + push edx + + mov esi,path ; open +; DEBUGF " '%s'",esi + mov edi,fullpath_open + cld + newc1: + movsb + cmp byte[esi],0;' ' + jne newc1 + mov esi,[esp] + + cmp byte[esi],'/' + jne @f + mov edi,fullpath_open + + @@: + lodsb + stosb + cmp al,0 + jne @b +; mov ecx,12 +; cld +; rep movsb +; mov byte[edi],0 + + mov esi,path ; write + mov edi,fullpath_write + cld + newc2: + movsb + cmp byte[esi],0;' ' + jne newc2 + mov esi,[esp] + + cmp byte[esi],'/' + jne @f + mov edi,fullpath_write + + @@: + lodsb + stosb + cmp al,0 + jne @b +; mov ecx,12 +; cld +; rep movsb +; mov byte[edi],0 + + mov esi,path ; start + mov edi,fullpath_start + cld + newc3: + movsb + cmp byte[esi],0;' ' + jne newc3 +; mov esi,[esp] + pop esi + + cmp byte[esi],'/' + jne @f + mov edi,fullpath_start + + @@: + lodsb + stosb + cmp al,0 + jne @b +; mov ecx,12 +; cld +; rep movsb +; mov byte[edi],0 + +; add esp,4 + popa + ret + +read: + pusha + mov edi,edx + mov esi,[filepos] + add esi,0x20000 + cld + rep movsb + popa +; ret + +close: ret + +lseek: + cmp al,0 + jnz @f + mov [filepos],0 + @@: cmp al,1 + jnz @f + @@: cmp al,2 + jnz @f + mov eax,[filesize] + mov [filepos],eax + @@: mov eax,[filepos] + add eax,edx + mov [filepos],eax + ret + + + +display_character: + pusha + cmp [_mode],NORMAL_MODE + jne @f + cmp dl,13 + jz dc2 + cmp dl,0xa + jnz dc1 + and [textxy],0x0000FFFF + add [textxy],OUTPUTXY and 0xFFFF0000 + 10 +dc2: popa + ret +dc1: mov eax,[textxy] + cmp ax,word[bottom_right] + ja dc2 + shr eax,16 + cmp ax,word[bottom_right+2] + ja dc2 + mov [dc],dl + mcall 4,[textxy],[sc.work_text],dc,1 + add [textxy],0x00060000 + popa + ret +@@: mov eax,63 + mov ebx,1 + mov cl,dl + int 0x40 + popa + ret + + + +display_string: + pusha + @@: cmp byte[esi],0 + je @f + mov dl,[esi] + call display_character + add esi,1 + jmp @b + @@: popa + ret + +display_number: + push ebx + mov ecx,1000000000 + xor edx,edx + xor bl,bl + display_loop: + div ecx + push edx + cmp ecx,1 + je display_digit + or bl,bl + jnz display_digit + or al,al + jz digit_ok + not bl + display_digit: + mov dl,al + add dl,30h + push ebx ecx + call display_character + pop ecx ebx + digit_ok: + mov eax,ecx + xor edx,edx + mov ecx,10 + div ecx + mov ecx,eax + pop eax + or ecx,ecx + jnz display_loop + pop ebx + ret + +display_user_messages: +; push [skinh] +; pop [textxy] +; add [textxy],OUTPUTXY + mov [displayed_count],0 + call flush_display_buffer + cmp [displayed_count],1 + jb line_break_ok + je make_line_break + mov ax,word[last_displayed] + cmp ax,0A0Dh + je line_break_ok + cmp ax,0D0Ah + je line_break_ok + make_line_break: + mov esi,lf + call display_string + line_break_ok: + ret + +display_block: + pusha + @@: mov dl,[esi] + call display_character + inc esi + loop @b + popa + ret + +fatal_error: + mov esi,error_prefix + call display_string + pop esi + call display_string + mov esi,error_suffix + call display_string + mov esi,lf + call display_string + mov al,0FFh + jmp exit_program + +assembler_error: + call display_user_messages + push dword 0 + mov ebx,[current_line] + get_error_lines: + push ebx + test byte [ebx+7],80h + jz display_error_line + mov edx,ebx + find_definition_origin: + mov edx,[edx+12] + test byte [edx+7],80h + jnz find_definition_origin + push edx + mov ebx,[ebx+8] + jmp get_error_lines + display_error_line: + mov esi,[ebx] + call display_string + mov esi,line_number_start + call display_string + mov eax,[ebx+4] + and eax,7FFFFFFFh + call display_number + mov dl,']' + call display_character + pop esi + cmp ebx,esi + je line_number_ok + mov dl,20h + call display_character + push esi + mov esi,[esi] + movzx ecx,byte [esi] + inc esi + call display_block + mov esi,line_number_start + call display_string + pop esi + mov eax,[esi+4] + and eax,7FFFFFFFh + call display_number + mov dl,']' + call display_character + line_number_ok: + mov esi,line_data_start + call display_string + mov esi,ebx + mov edx,[esi] + call open + mov al,2 + xor edx,edx + call lseek + mov edx,[esi+8] + sub eax,edx + push eax + xor al,al + call lseek + mov ecx,[esp] + mov edx,[additional_memory] + lea eax,[edx+ecx] + cmp eax,[additional_memory_end] + ja out_of_memory + call read + call close + pop ecx + mov esi,[additional_memory] + get_line_data: + mov al,[esi] + cmp al,0Ah + je display_line_data + cmp al,0Dh + je display_line_data + cmp al,1Ah + je display_line_data + or al,al + jz display_line_data + inc esi + loop get_line_data + display_line_data: + mov ecx,esi + mov esi,[additional_memory] + sub ecx,esi + call display_block + mov esi,cr_lf + call display_string + pop ebx + or ebx,ebx + jnz display_error_line + mov esi,error_prefix + call display_string + pop esi + call display_string + mov esi,error_suffix + call display_string + jmp exit_program + +__draw_caption: +; mcall 48,4 +; mov [skinh],eax +; mov ebx,eax +; shr ebx,1 +; adc ebx,1+0x000A0000-4 +; mcall 4,,[sc.grab_text],s_title,[s_title.size] + + mcall 48,4 + mov [skinh],eax + shr eax,1 + adc eax,0 + add eax,1-4 + push ax + if center eq true + mcall 9,PROCESSINFO,-1 + mov ebx,[PROCESSINFO+process_information.x_size] + shr ebx,1 + sub ebx,header.size*6/2 + 8 + else + mov ebx,8 + end if + shl ebx,16 + pop bx + mcall 4,,[SYSTEMCOLORS+system_colors.grab_text] + ret + +character db ?,0 +bytes_count dd ? + +textxy dd 0x000500A0 +dc db 0x0 +filesize dd 0x0 + +displayed_count dd ? +last_displayed rb 2 + +error_prefix db 'error: ',0 +error_suffix db '.',0 +line_data_start db ':' +cr_lf db 0Dh,0Ah,0 +line_number_start db ' [',0 + +macro dm string { db string,0 } \ No newline at end of file diff --git a/programs/fasm/trunk/variable.inc b/programs/fasm/trunk/variable.inc new file mode 100644 index 0000000000..d0cf1abb15 --- /dev/null +++ b/programs/fasm/trunk/variable.inc @@ -0,0 +1,116 @@ + +; flat assembler core variables +; Copyright (c) 1999-2005, Tomasz Grysztar. +; All rights reserved. + +; Variables which have to be set up by interface: + +memory_start dd ? +memory_end dd ? + +additional_memory dd ? +additional_memory_end dd ? + +stack_limit dd ? + +input_file dd ? +output_file dd ? + +passes_limit dw ? + +; Internal core variables: + +current_pass dw ? + +include_paths dd ? +free_additional_memory dd ? +source_start dd ? +code_start dd ? +code_size dd ? +real_code_size dd ? +written_size dd ? +headers_size dd ? + +current_line dd ? +macro_line dd ? +macro_block dd ? +macro_block_line dd ? +macro_block_line_number dd ? +macro_symbols dd ? +struc_name dd ? +struc_label dd ? +instant_macro_start dd ? +parameters_end dd ? +locals_counter rb 8 +current_locals_prefix dd ? +anonymous_reverse dd ? +anonymous_forward dd ? +labels_list dd ? +label_hash dd ? +label_leaf dd ? +hash_tree dd ? +org_origin dq ? +org_registers dd ? +org_start dd ? +org_symbol dd ? +undefined_data_start dd ? +undefined_data_end dd ? +counter dd ? +counter_limit dd ? +error_line dd ? +error dd ? +display_buffer dd ? +structures_buffer dd ? +number_start dd ? +current_offset dd ? +value dq ? +fp_value rd 8 +adjustment dq ? +symbol_identifier dd ? +address_symbol dd ? +address_high dd ? +format_flags dd ? +symbols_stream dd ? +number_of_relocations dd ? +number_of_sections dd ? +stub_size dd ? +stub_file dd ? +current_section dd ? +machine dw ? +subsystem dw ? +subsystem_version dd ? +image_base dd ? +image_base_high dd ? +resource_data dd ? +resource_size dd ? + +next_pass_needed db ? +macro_status db ? +parenthesis_stack db ? +output_format db ? +code_type db ? +labels_type db ? +prefixed_instruction db ? +virtual_data db ? +fp_sign db ? +fp_format db ? +value_size db ? +size_override db ? +address_size db ? +operand_size db ? +size_declared db ? +value_undefined db ? +value_type db ? +compare_type db ? +base_code db ? +extended_code db ? +postbyte_register db ? +segment_register db ? +mmx_size db ? +jump_type db ? +operand_prefix db ? +rex_prefix db ? +immediate_size db ? + +characters rb 100h +converted rb 100h diff --git a/programs/fasm/trunk/version.inc b/programs/fasm/trunk/version.inc new file mode 100644 index 0000000000..8448999b8c --- /dev/null +++ b/programs/fasm/trunk/version.inc @@ -0,0 +1,39 @@ + +; flat assembler version 1.64 +; Copyright (c) 1999-2005, Tomasz Grysztar. +; All rights reserved. +; +; This programs is free for commercial and non-commercial use as long as +; the following conditions are adhered to. +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions are +; met: +; +; 1. Redistributions of source code must retain the above copyright notice, +; this list of conditions and the following disclaimer. +; 2. Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in the +; documentation and/or other materials provided with the distribution. +; +; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +; TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +; PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR +; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +; +; The licence and distribution terms for any publically available +; version or derivative of this code cannot be changed. i.e. this code +; cannot simply be copied and put under another distribution licence +; (including the GNU Public Licence). + +VERSION_STRING equ "1.64" + +VERSION_MAJOR = 1 +VERSION_MINOR = 64 diff --git a/programs/fasm/trunk/x86_64.inc b/programs/fasm/trunk/x86_64.inc new file mode 100644 index 0000000000..a9a0c8d400 --- /dev/null +++ b/programs/fasm/trunk/x86_64.inc @@ -0,0 +1,7923 @@ + +; flat assembler core +; Copyright (c) 1999-2005, Tomasz Grysztar. +; All rights reserved. + +simple_instruction_except64: + cmp [code_type],64 + je illegal_instruction +simple_instruction: + stos byte [edi] + jmp instruction_assembled +simple_instruction_only64: + cmp [code_type],64 + jne illegal_instruction + jmp simple_instruction +simple_instruction_16bit_except64: + cmp [code_type],64 + je illegal_instruction +simple_instruction_16bit: + cmp [code_type],16 + jne size_prefix + stos byte [edi] + jmp instruction_assembled + size_prefix: + mov ah,al + mov al,66h + stos word [edi] + jmp instruction_assembled +simple_instruction_32bit_except64: + cmp [code_type],64 + je illegal_instruction +simple_instruction_32bit: + cmp [code_type],16 + je size_prefix + stos byte [edi] + jmp instruction_assembled +simple_instruction_64bit: + cmp [code_type],64 + jne illegal_instruction + mov ah,al + mov al,48h + stos word [edi] + jmp instruction_assembled +simple_extended_instruction: + mov ah,al + mov al,0Fh + stos word [edi] + jmp instruction_assembled +prefix_instruction: + stos byte [edi] + or [prefixed_instruction],-1 + jmp continue_line +segment_prefix: + mov ah,al + shr ah,4 + cmp ah,6 + jne illegal_instruction + and al,1111b + mov [segment_register],al + call store_segment_prefix + or [prefixed_instruction],-1 + jmp continue_line +int_instruction: + lods byte [esi] + call get_size_operator + cmp ah,1 + ja invalid_operand_size + cmp al,'(' + jne invalid_operand + call get_byte_value + mov ah,al + mov al,0CDh + stos word [edi] + jmp instruction_assembled +iret_instruction: + cmp [code_type],64 + jne simple_instruction + call operand_64bit + jmp simple_instruction +aa_instruction: + cmp [code_type],64 + je illegal_instruction + push eax + mov bl,10 + cmp byte [esi],'(' + jne aa_store + inc esi + xor al,al + xchg al,[operand_size] + cmp al,1 + ja invalid_operand_size + call get_byte_value + mov bl,al + aa_store: + cmp [operand_size],0 + jne invalid_operand + pop eax + mov ah,bl + stos word [edi] + jmp instruction_assembled + +basic_instruction: + mov [base_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je basic_reg + cmp al,'[' + jne invalid_operand + basic_mem: + call get_address + push edx bx cx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je basic_mem_imm + cmp al,10h + jne invalid_operand + basic_mem_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + pop cx bx edx + mov al,ah + cmp al,1 + je basic_mem_reg_8bit + call operand_autodetect + inc [base_code] + basic_mem_reg_8bit: + call store_instruction + jmp instruction_assembled + basic_mem_imm: + mov al,[operand_size] + cmp al,1 + je basic_mem_imm_8bit + cmp al,2 + je basic_mem_imm_16bit + cmp al,4 + je basic_mem_imm_32bit + cmp al,8 + je basic_mem_imm_64bit + or al,al + jnz invalid_operand_size + cmp [error_line],0 + jne basic_mem_imm_8bit + mov eax,[current_line] + mov [error_line],eax + mov [error],operand_size_not_specified + basic_mem_imm_8bit: + call get_byte_value + mov byte [value],al + mov al,[base_code] + shr al,3 + mov [postbyte_register],al + pop cx bx edx + mov [base_code],80h + call store_instruction_with_imm8 + jmp instruction_assembled + basic_mem_imm_16bit: + call operand_16bit + call get_word_value + mov word [value],ax + mov al,[base_code] + shr al,3 + mov [postbyte_register],al + pop cx bx edx + cmp [value_type],0 + jne basic_mem_imm_16bit_store + cmp [size_declared],0 + jne basic_mem_imm_16bit_store + cmp word [value],80h + jb basic_mem_simm_8bit + cmp word [value],-80h + jae basic_mem_simm_8bit + basic_mem_imm_16bit_store: + mov [base_code],81h + call store_instruction_with_imm16 + jmp instruction_assembled + basic_mem_simm_8bit: + mov [base_code],83h + call store_instruction_with_imm8 + jmp instruction_assembled + basic_mem_imm_32bit: + call operand_32bit + call get_dword_value + basic_mem_imm_32bit_ok: + mov dword [value],eax + mov al,[base_code] + shr al,3 + mov [postbyte_register],al + pop cx bx edx + cmp [value_type],0 + jne basic_mem_imm_32bit_store + cmp [size_declared],0 + jne basic_mem_imm_32bit_store + cmp dword [value],80h + jb basic_mem_simm_8bit + cmp dword [value],-80h + jae basic_mem_simm_8bit + basic_mem_imm_32bit_store: + mov [base_code],81h + call store_instruction_with_imm32 + jmp instruction_assembled + basic_mem_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp basic_mem_imm_32bit_ok + get_simm32: + call get_qword_value + mov ecx,edx + cdq + cmp ecx,edx + jne value_out_of_range + ret + basic_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je basic_reg_reg + cmp al,'(' + je basic_reg_imm + cmp al,'[' + jne invalid_operand + basic_reg_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je basic_reg_mem_8bit + call operand_autodetect + add [base_code],3 + call store_instruction + jmp instruction_assembled + basic_reg_mem_8bit: + add [base_code],2 + call store_instruction + jmp instruction_assembled + basic_reg_reg: + lods byte [esi] + call convert_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je basic_reg_reg_8bit + call operand_autodetect + inc [base_code] + basic_reg_reg_8bit: + call store_nomem_instruction + jmp instruction_assembled + basic_reg_imm: + mov al,[operand_size] + cmp al,1 + je basic_reg_imm_8bit + cmp al,2 + je basic_reg_imm_16bit + cmp al,4 + je basic_reg_imm_32bit + cmp al,8 + je basic_reg_imm_64bit + or al,al + jnz invalid_operand_size + cmp [error_line],0 + jne basic_reg_imm_32bit + mov eax,[current_line] + mov [error_line],eax + mov [error],operand_size_not_specified + jmp basic_reg_imm_32bit + basic_reg_imm_8bit: + call get_byte_value + mov dl,al + mov bl,[base_code] + shr bl,3 + xchg bl,[postbyte_register] + or bl,bl + jz basic_al_imm + mov [base_code],80h + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + basic_al_imm: + mov al,[base_code] + add al,4 + stos byte [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled + basic_reg_imm_16bit: + call operand_16bit + call get_word_value + mov dx,ax + mov bl,[base_code] + shr bl,3 + xchg bl,[postbyte_register] + cmp [value_type],0 + jne basic_reg_imm_16bit_store + cmp [size_declared],0 + jne basic_reg_imm_16bit_store + cmp dx,80h + jb basic_reg_simm_8bit + cmp dx,-80h + jae basic_reg_simm_8bit + basic_reg_imm_16bit_store: + or bl,bl + jz basic_ax_imm + mov [base_code],81h + call store_nomem_instruction + mov ax,dx + call mark_relocation + stos word [edi] + jmp instruction_assembled + basic_reg_simm_8bit: + mov [base_code],83h + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + basic_ax_imm: + add [base_code],5 + call store_instruction_code + mov ax,dx + call mark_relocation + stos word [edi] + jmp instruction_assembled + basic_reg_imm_32bit: + call operand_32bit + call get_dword_value + basic_reg_imm_32bit_ok: + mov edx,eax + mov bl,[base_code] + shr bl,3 + xchg bl,[postbyte_register] + cmp [value_type],0 + jne basic_reg_imm_32bit_store + cmp [size_declared],0 + jne basic_reg_imm_32bit_store + cmp edx,80h + jb basic_reg_simm_8bit + cmp edx,-80h + jae basic_reg_simm_8bit + basic_reg_imm_32bit_store: + or bl,bl + jz basic_eax_imm + mov [base_code],81h + call store_nomem_instruction + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + basic_eax_imm: + add [base_code],5 + call store_instruction_code + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + basic_reg_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp basic_reg_imm_32bit_ok +single_operand_instruction: + mov [base_code],0F6h + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + je single_reg + cmp al,'[' + jne invalid_operand + single_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je single_mem_8bit + jb single_mem_nosize + call operand_autodetect + inc [base_code] + call store_instruction + jmp instruction_assembled + single_mem_nosize: + cmp [error_line],0 + jne single_mem_8bit + mov eax,[current_line] + mov [error_line],eax + mov [error],operand_size_not_specified + single_mem_8bit: + call store_instruction + jmp instruction_assembled + single_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + cmp al,1 + je single_reg_8bit + call operand_autodetect + inc [base_code] + single_reg_8bit: + call store_nomem_instruction + jmp instruction_assembled +mov_instruction: + mov [base_code],88h + lods byte [esi] + call get_size_operator + cmp al,10h + je mov_reg + cmp al,'[' + jne invalid_operand + mov_mem: + call get_address + push edx bx cx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je mov_mem_imm + cmp al,10h + jne invalid_operand + mov_mem_reg: + lods byte [esi] + cmp al,60h + jb mov_mem_general_reg + cmp al,70h + jb mov_mem_sreg + mov_mem_general_reg: + call convert_register + mov [postbyte_register],al + pop cx bx edx + cmp ah,1 + je mov_mem_reg_8bit + mov al,ah + call operand_autodetect + mov al,[postbyte_register] + or al,bl + or al,bh + jz mov_mem_ax + inc [base_code] + call store_instruction + jmp instruction_assembled + mov_mem_reg_8bit: + or al,bl + or al,bh + jz mov_mem_al + call store_instruction + jmp instruction_assembled + mov_mem_al: + test ch,22h + jnz mov_mem_address16_al + test ch,44h + jnz mov_mem_address32_al + test ch,88h + jnz mov_mem_address64_al + or ch,ch + jnz invalid_address_size + cmp [code_type],64 + je mov_mem_address64_al + cmp [code_type],32 + je mov_mem_address32_al + cmp edx,10000h + jb mov_mem_address16_al + mov_mem_address32_al: + call store_segment_prefix_if_necessary + call address_32bit_prefix + mov [base_code],0A2h + store_mov_address32: + call store_instruction_code + push instruction_assembled + jmp store_address_32bit_value + mov_mem_address16_al: + call store_segment_prefix_if_necessary + call address_16bit_prefix + mov [base_code],0A2h + store_mov_address16: + cmp [code_type],64 + je invalid_address + call store_instruction_code + mov eax,edx + stos word [edi] + cmp edx,10000h + jge value_out_of_range + jmp instruction_assembled + mov_mem_address64_al: + call store_segment_prefix_if_necessary + mov [base_code],0A2h + store_mov_address64: + call store_instruction_code + push instruction_assembled + jmp store_address_64bit_value + mov_mem_ax: + test ch,22h + jnz mov_mem_address16_ax + test ch,44h + jnz mov_mem_address32_ax + test ch,88h + jnz mov_mem_address64_ax + or ch,ch + jnz invalid_address_size + cmp [code_type],64 + je mov_mem_address64_ax + cmp [code_type],32 + je mov_mem_address32_ax + cmp edx,10000h + jb mov_mem_address16_ax + mov_mem_address32_ax: + call store_segment_prefix_if_necessary + call address_32bit_prefix + mov [base_code],0A3h + jmp store_mov_address32 + mov_mem_address16_ax: + call store_segment_prefix_if_necessary + call address_16bit_prefix + mov [base_code],0A3h + jmp store_mov_address16 + mov_mem_address64_ax: + call store_segment_prefix_if_necessary + mov [base_code],0A3h + jmp store_mov_address64 + mov_mem_sreg: + sub al,61h + mov [postbyte_register],al + pop cx bx edx + mov ah,[operand_size] + or ah,ah + jz mov_mem_sreg_store + cmp ah,2 + jne invalid_operand_size + mov_mem_sreg_store: + mov [base_code],8Ch + call store_instruction + jmp instruction_assembled + mov_mem_imm: + mov al,[operand_size] + cmp al,1 + je mov_mem_imm_8bit + cmp al,2 + je mov_mem_imm_16bit + cmp al,4 + je mov_mem_imm_32bit + cmp al,8 + je mov_mem_imm_64bit + or al,al + jnz invalid_operand_size + cmp [error_line],0 + jne mov_mem_imm_32bit + mov eax,[current_line] + mov [error_line],eax + mov [error],operand_size_not_specified + jmp mov_mem_imm_32bit + mov_mem_imm_8bit: + call get_byte_value + mov byte [value],al + mov [postbyte_register],0 + mov [base_code],0C6h + pop cx bx edx + call store_instruction_with_imm8 + jmp instruction_assembled + mov_mem_imm_16bit: + call operand_16bit + call get_word_value + mov word [value],ax + mov [postbyte_register],0 + mov [base_code],0C7h + pop cx bx edx + call store_instruction_with_imm16 + jmp instruction_assembled + mov_mem_imm_32bit: + call operand_32bit + call get_dword_value + mov_mem_imm_32bit_store: + mov dword [value],eax + mov [postbyte_register],0 + mov [base_code],0C7h + pop cx bx edx + call store_instruction_with_imm32 + jmp instruction_assembled + mov_mem_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp mov_mem_imm_32bit_store + mov_reg: + lods byte [esi] + mov ah,al + sub ah,10h + and ah,al + test ah,0F0h + jnz mov_sreg + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je mov_reg_mem + cmp al,'(' + je mov_reg_imm + cmp al,10h + jne invalid_operand + mov_reg_reg: + lods byte [esi] + mov ah,al + sub ah,10h + and ah,al + test ah,0F0h + jnz mov_reg_sreg + call convert_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je mov_reg_reg_8bit + call operand_autodetect + inc [base_code] + mov_reg_reg_8bit: + call store_nomem_instruction + jmp instruction_assembled + mov_reg_sreg: + mov bl,[postbyte_register] + mov ah,al + and al,1111b + mov [postbyte_register],al + shr ah,4 + cmp ah,5 + je mov_reg_creg + cmp ah,7 + je mov_reg_dreg + ja mov_reg_treg + dec [postbyte_register] + cmp [operand_size],8 + je mov_reg_sreg64 + cmp [operand_size],4 + je mov_reg_sreg32 + cmp [operand_size],2 + jne invalid_operand_size + call operand_16bit + jmp mov_reg_sreg_store + mov_reg_sreg64: + call operand_64bit + jmp mov_reg_sreg_store + mov_reg_sreg32: + call operand_32bit + mov_reg_sreg_store: + mov [base_code],8Ch + call store_nomem_instruction + jmp instruction_assembled + mov_reg_treg: + cmp ah,9 + jne invalid_operand + mov [extended_code],24h + jmp mov_reg_xrx + mov_reg_dreg: + mov [extended_code],21h + jmp mov_reg_xrx + mov_reg_creg: + mov [extended_code],20h + mov_reg_xrx: + mov [base_code],0Fh + cmp [code_type],64 + je mov_reg_xrx_64bit + cmp [operand_size],4 + jne invalid_operand_size + call store_nomem_instruction + jmp instruction_assembled + mov_reg_xrx_64bit: + cmp [operand_size],8 + jne invalid_operand_size + call store_nomem_instruction + jmp instruction_assembled + mov_reg_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je mov_reg_mem_8bit + call operand_autodetect + mov al,[postbyte_register] + or al,bl + or al,bh + jz mov_ax_mem + add [base_code],3 + call store_instruction + jmp instruction_assembled + mov_reg_mem_8bit: + mov al,[postbyte_register] + or al,bl + or al,bh + jz mov_al_mem + add [base_code],2 + call store_instruction + jmp instruction_assembled + mov_al_mem: + test ch,22h + jnz mov_al_mem_address16 + test ch,44h + jnz mov_al_mem_address32 + test ch,88h + jnz mov_al_mem_address64 + or ch,ch + jnz invalid_address_size + cmp [code_type],64 + je mov_al_mem_address64 + cmp [code_type],32 + je mov_al_mem_address32 + cmp edx,10000h + jb mov_al_mem_address16 + mov_al_mem_address32: + call store_segment_prefix_if_necessary + call address_32bit_prefix + mov [base_code],0A0h + jmp store_mov_address32 + mov_al_mem_address16: + call store_segment_prefix_if_necessary + call address_16bit_prefix + mov [base_code],0A0h + jmp store_mov_address16 + mov_al_mem_address64: + call store_segment_prefix_if_necessary + mov [base_code],0A0h + jmp store_mov_address64 + mov_ax_mem: + test ch,22h + jnz mov_ax_mem_address16 + test ch,44h + jnz mov_ax_mem_address32 + test ch,88h + jnz mov_ax_mem_address64 + or ch,ch + jnz invalid_address_size + cmp [code_type],64 + je mov_ax_mem_address64 + cmp [code_type],32 + je mov_ax_mem_address32 + cmp edx,10000h + jb mov_ax_mem_address16 + mov_ax_mem_address32: + call store_segment_prefix_if_necessary + call address_32bit_prefix + mov [base_code],0A1h + jmp store_mov_address32 + mov_ax_mem_address16: + call store_segment_prefix_if_necessary + mov [base_code],0A1h + jmp store_mov_address16 + mov_ax_mem_address64: + call store_segment_prefix_if_necessary + mov [base_code],0A1h + jmp store_mov_address64 + mov_reg_imm: + mov al,[operand_size] + cmp al,1 + je mov_reg_imm_8bit + cmp al,2 + je mov_reg_imm_16bit + cmp al,4 + je mov_reg_imm_32bit + cmp al,8 + je mov_reg_imm_64bit + or al,al + jnz invalid_operand_size + cmp [error_line],0 + jne mov_reg_imm_32bit + mov eax,[current_line] + mov [error_line],eax + mov [error],operand_size_not_specified + jmp mov_reg_imm_32bit + mov_reg_imm_8bit: + call get_byte_value + mov dl,al + mov al,0B0h + call store_mov_reg_imm_code + mov al,dl + stos byte [edi] + jmp instruction_assembled + mov_reg_imm_16bit: + call get_word_value + mov dx,ax + call operand_16bit + mov al,0B8h + call store_mov_reg_imm_code + mov ax,dx + call mark_relocation + stos word [edi] + jmp instruction_assembled + mov_reg_imm_32bit: + call operand_32bit + call get_dword_value + mov edx,eax + mov al,0B8h + call store_mov_reg_imm_code + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + mov_reg_imm_64bit: + call operand_64bit + call get_qword_value + mov ecx,edx + cmp [size_declared],0 + jne mov_reg_imm_64bit_store + cmp [value_type],4 + jae mov_reg_imm_64bit_store + cdq + cmp ecx,edx + je mov_reg_64bit_imm_32bit + mov_reg_imm_64bit_store: + push eax ecx + mov al,0B8h + call store_mov_reg_imm_code + pop edx eax + call mark_relocation + stos dword [edi] + mov eax,edx + stos dword [edi] + jmp instruction_assembled + store_mov_reg_imm_code: + mov ah,[postbyte_register] + test ah,1000b + jz mov_reg_imm_prefix_ok + or [rex_prefix],41h + mov_reg_imm_prefix_ok: + and ah,111b + add al,ah + mov [base_code],al + call store_instruction_code + ret + mov_reg_64bit_imm_32bit: + mov edx,eax + mov bl,[postbyte_register] + mov [postbyte_register],0 + mov [base_code],0C7h + call store_nomem_instruction + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + mov_sreg: + mov ah,al + and al,111b + mov [postbyte_register],al + shr ah,4 + cmp ah,5 + je mov_creg + cmp ah,7 + je mov_dreg + ja mov_treg + cmp al,2 + je illegal_instruction + dec [postbyte_register] + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je mov_sreg_mem + cmp al,10h + jne invalid_operand + mov_sreg_reg: + lods byte [esi] + call convert_register + or ah,ah + jz mov_sreg_reg_size_ok + cmp ah,2 + jne invalid_operand_size + mov bl,al + mov_sreg_reg_size_ok: + mov [base_code],8Eh + call store_nomem_instruction + jmp instruction_assembled + mov_sreg_mem: + call get_address + mov al,[operand_size] + or al,al + jz mov_sreg_mem_size_ok + cmp al,2 + jne invalid_operand_size + mov_sreg_mem_size_ok: + mov [base_code],8Eh + call store_instruction + jmp instruction_assembled + mov_treg: + cmp ah,9 + jne invalid_operand + mov [extended_code],26h + jmp mov_xrx + mov_dreg: + mov [extended_code],23h + jmp mov_xrx + mov_creg: + mov [extended_code],22h + mov_xrx: + mov [base_code],0Fh + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov bl,al + cmp [code_type],64 + je mov_xrx_64bit + cmp ah,4 + jne invalid_operand_size + call store_nomem_instruction + jmp instruction_assembled + mov_xrx_64bit: + cmp ah,8 + jne invalid_operand_size + call store_nomem_instruction + jmp instruction_assembled +cmov_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je cmov_reg_mem + cmp al,10h + jne invalid_operand + cmov_reg_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + call operand_autodetect + call store_nomem_instruction + jmp instruction_assembled + cmov_reg_mem: + call get_address + mov al,[operand_size] + call operand_autodetect + call store_instruction + jmp instruction_assembled +test_instruction: + mov [base_code],84h + lods byte [esi] + call get_size_operator + cmp al,10h + je test_reg + cmp al,'[' + jne invalid_operand + test_mem: + call get_address + push edx bx cx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je test_mem_imm + cmp al,10h + jne invalid_operand + test_mem_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + pop cx bx edx + mov al,ah + cmp al,1 + je test_mem_reg_8bit + call operand_autodetect + inc [base_code] + test_mem_reg_8bit: + call store_instruction + jmp instruction_assembled + test_mem_imm: + mov al,[operand_size] + cmp al,1 + je test_mem_imm_8bit + cmp al,2 + je test_mem_imm_16bit + cmp al,4 + je test_mem_imm_32bit + cmp al,8 + je test_mem_imm_64bit + or al,al + jnz invalid_operand_size + cmp [error_line],0 + jne test_mem_imm_32bit + mov eax,[current_line] + mov [error_line],eax + mov [error],operand_size_not_specified + jmp test_mem_imm_32bit + test_mem_imm_8bit: + call get_byte_value + mov byte [value],al + mov [postbyte_register],0 + mov [base_code],0F6h + pop cx bx edx + call store_instruction_with_imm8 + jmp instruction_assembled + test_mem_imm_16bit: + call operand_16bit + call get_word_value + mov word [value],ax + mov [postbyte_register],0 + mov [base_code],0F7h + pop cx bx edx + call store_instruction_with_imm16 + jmp instruction_assembled + test_mem_imm_32bit: + call operand_32bit + call get_dword_value + test_mem_imm_32bit_store: + mov dword [value],eax + mov [postbyte_register],0 + mov [base_code],0F7h + pop cx bx edx + call store_instruction_with_imm32 + jmp instruction_assembled + test_mem_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp test_mem_imm_32bit_store + test_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je test_reg_mem + cmp al,'(' + je test_reg_imm + cmp al,10h + jne invalid_operand + test_reg_reg: + lods byte [esi] + call convert_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je test_reg_reg_8bit + call operand_autodetect + inc [base_code] + test_reg_reg_8bit: + call store_nomem_instruction + jmp instruction_assembled + test_reg_imm: + mov al,[operand_size] + cmp al,1 + je test_reg_imm_8bit + cmp al,2 + je test_reg_imm_16bit + cmp al,4 + je test_reg_imm_32bit + cmp al,8 + je test_reg_imm_64bit + jmp invalid_operand_size + test_reg_imm_8bit: + call get_byte_value + mov dl,al + mov bl,[postbyte_register] + mov [postbyte_register],0 + mov [base_code],0F6h + or bl,bl + jz test_al_imm + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + test_al_imm: + mov [base_code],0A8h + call store_instruction_code + mov al,dl + stos byte [edi] + jmp instruction_assembled + test_reg_imm_16bit: + call operand_16bit + call get_word_value + mov dx,ax + mov bl,[postbyte_register] + mov [postbyte_register],0 + mov [base_code],0F7h + or bl,bl + jz test_ax_imm + call store_nomem_instruction + mov ax,dx + call mark_relocation + stos word [edi] + jmp instruction_assembled + test_ax_imm: + mov [base_code],0A9h + call store_instruction_code + mov ax,dx + stos word [edi] + jmp instruction_assembled + test_reg_imm_32bit: + call operand_32bit + call get_dword_value + test_reg_imm_32bit_store: + mov edx,eax + mov bl,[postbyte_register] + mov [postbyte_register],0 + mov [base_code],0F7h + or bl,bl + jz test_eax_imm + call store_nomem_instruction + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + test_eax_imm: + mov [base_code],0A9h + call store_instruction_code + mov eax,edx + stos dword [edi] + jmp instruction_assembled + test_reg_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp test_reg_imm_32bit_store + test_reg_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je test_reg_mem_8bit + call operand_autodetect + inc [base_code] + test_reg_mem_8bit: + call store_instruction + jmp instruction_assembled +xchg_instruction: + mov [base_code],86h + lods byte [esi] + call get_size_operator + cmp al,10h + je xchg_reg + cmp al,'[' + jne invalid_operand + xchg_mem: + call get_address + push edx bx cx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je test_mem_reg + jmp invalid_operand + xchg_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + je test_reg_mem + cmp al,10h + jne invalid_operand + xchg_reg_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + cmp al,1 + je xchg_reg_reg_8bit + call operand_autodetect + cmp [postbyte_register],0 + je xchg_ax_reg + or bl,bl + jnz xchg_reg_reg_store + mov bl,[postbyte_register] + xchg_ax_reg: + cmp [code_type],64 + jne xchg_ax_reg_ok + cmp ah,4 + jne xchg_ax_reg_ok + or bl,bl + jz xchg_reg_reg_store + xchg_ax_reg_ok: + test bl,1000b + jz xchg_ax_reg_store + or [rex_prefix],41h + and bl,111b + xchg_ax_reg_store: + add bl,90h + mov [base_code],bl + call store_instruction_code + jmp instruction_assembled + xchg_reg_reg_store: + inc [base_code] + xchg_reg_reg_8bit: + call store_nomem_instruction + jmp instruction_assembled +push_instruction: + mov [extended_code],al + push_next: + lods byte [esi] + call get_size_operator + cmp al,10h + je push_reg + cmp al,'(' + je push_imm + cmp al,'[' + jne invalid_operand + push_mem: + call get_address + mov al,[operand_size] + mov ah,[extended_code] + cmp al,2 + je push_mem_16bit + cmp al,4 + je push_mem_32bit + cmp al,8 + je push_mem_64bit + or al,al + jnz invalid_operand_size + cmp ah,2 + je push_mem_16bit + cmp ah,4 + je push_mem_32bit + cmp ah,8 + je push_mem_64bit + cmp [error_line],0 + jne push_mem_store + mov eax,[current_line] + mov [error_line],eax + mov [error],operand_size_not_specified + jmp push_mem_store + push_mem_16bit: + test ah,not 2 + jnz invalid_operand_size + call operand_16bit + jmp push_mem_store + push_mem_32bit: + test ah,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp push_mem_store + push_mem_64bit: + test ah,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + push_mem_store: + mov [base_code],0FFh + mov [postbyte_register],110b + call store_instruction + jmp push_done + push_reg: + lods byte [esi] + mov ah,al + sub ah,10h + and ah,al + test ah,0F0h + jnz push_sreg + call convert_register + test al,1000b + jz push_reg_ok + or [rex_prefix],41h + and al,111b + push_reg_ok: + add al,50h + mov [base_code],al + mov al,ah + mov ah,[extended_code] + cmp al,2 + je push_reg_16bit + cmp al,4 + je push_reg_32bit + cmp al,8 + jne invalid_operand_size + push_reg_64bit: + test ah,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + jmp push_reg_store + push_reg_32bit: + test ah,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp push_reg_store + push_reg_16bit: + test ah,not 2 + jnz invalid_operand_size + call operand_16bit + push_reg_store: + call store_instruction_code + jmp push_done + push_sreg: + mov bl,al + mov dl,[operand_size] + mov dh,[extended_code] + cmp dl,2 + je push_sreg16 + cmp dl,4 + je push_sreg32 + cmp dl,8 + je push_sreg64 + or dl,dl + jnz invalid_operand_size + cmp dh,2 + je push_sreg16 + cmp dh,4 + je push_sreg32 + cmp dh,8 + je push_sreg64 + jmp push_sreg_store + push_sreg16: + test dh,not 2 + jnz invalid_operand_size + call operand_16bit + jmp push_sreg_store + push_sreg32: + test dh,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp push_sreg_store + push_sreg64: + test dh,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + push_sreg_store: + mov al,bl + cmp al,70h + jae invalid_operand + sub al,61h + cmp al,4 + jae push_sreg_386 + shl al,3 + add al,6 + mov [base_code],al + cmp [code_type],64 + je illegal_instruction + jmp push_reg_store + push_sreg_386: + sub al,4 + shl al,3 + add al,0A0h + mov [extended_code],al + mov [base_code],0Fh + jmp push_reg_store + push_imm: + mov al,[operand_size] + mov ah,[extended_code] + or al,al + je push_imm_size_ok + or ah,ah + je push_imm_size_ok + cmp al,ah + jne invalid_operand_size + push_imm_size_ok: + cmp al,2 + je push_imm_16bit + cmp al,4 + je push_imm_32bit + cmp al,8 + je push_imm_64bit + cmp ah,2 + je push_imm_optimized_16bit + cmp ah,4 + je push_imm_optimized_32bit + cmp ah,8 + je push_imm_optimized_64bit + or al,al + jnz invalid_operand_size + cmp [code_type],16 + je push_imm_optimized_16bit + cmp [code_type],32 + je push_imm_optimized_32bit + push_imm_optimized_64bit: + cmp [code_type],64 + jne illegal_instruction + call get_simm32 + mov edx,eax + cmp [value_type],0 + jne push_imm_32bit_store + cmp eax,-80h + jl push_imm_32bit_store + cmp eax,80h + jge push_imm_32bit_store + jmp push_imm_8bit + push_imm_optimized_32bit: + cmp [code_type],64 + je illegal_instruction + call get_dword_value + mov edx,eax + cmp [value_type],0 + jne push_imm_32bit_store + cmp eax,-80h + jl push_imm_32bit_store + cmp eax,80h + jge push_imm_32bit_store + call operand_32bit + jmp push_imm_8bit + push_imm_optimized_16bit: + call get_word_value + mov dx,ax + cmp [value_type],0 + jne push_imm_16bit_store + cmp ax,-80h + jl push_imm_16bit_store + cmp ax,80h + jge push_imm_16bit_store + call operand_16bit + push_imm_8bit: + mov ah,al + mov al,6Ah + stos word [edi] + jmp push_done + push_imm_16bit: + call get_word_value + mov dx,ax + call operand_16bit + push_imm_16bit_store: + mov [base_code],68h + call store_instruction_code + mov ax,dx + call mark_relocation + stos word [edi] + jmp push_done + push_imm_64bit: + cmp [code_type],64 + jne illegal_instruction + call get_simm32 + mov edx,eax + jmp push_imm_32bit_store + push_imm_32bit: + cmp [code_type],64 + je illegal_instruction + call get_dword_value + mov edx,eax + call operand_32bit + push_imm_32bit_store: + mov [base_code],68h + call store_instruction_code + mov eax,edx + call mark_relocation + stos dword [edi] + push_done: + lods byte [esi] + dec esi + cmp al,0Fh + je instruction_assembled + or al,al + jz instruction_assembled + mov [operand_size],0 + mov [size_override],0 + mov [operand_prefix],0 + mov [rex_prefix],0 + jmp push_next +pop_instruction: + mov [extended_code],al + pop_next: + lods byte [esi] + call get_size_operator + cmp al,10h + je pop_reg + cmp al,'[' + jne invalid_operand + pop_mem: + call get_address + mov al,[operand_size] + mov ah,[extended_code] + cmp al,2 + je pop_mem_16bit + cmp al,4 + je pop_mem_32bit + cmp al,8 + je pop_mem_64bit + or al,al + jnz invalid_operand_size + cmp ah,2 + je pop_mem_16bit + cmp ah,4 + je pop_mem_32bit + cmp ah,8 + je pop_mem_64bit + cmp [error_line],0 + jne pop_mem_store + mov eax,[current_line] + mov [error_line],eax + mov [error],operand_size_not_specified + jmp pop_mem_store + pop_mem_16bit: + test ah,not 2 + jnz invalid_operand_size + call operand_16bit + jmp pop_mem_store + pop_mem_32bit: + test ah,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp pop_mem_store + pop_mem_64bit: + test ah,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + pop_mem_store: + mov [base_code],08Fh + mov [postbyte_register],0 + call store_instruction + jmp pop_done + pop_reg: + lods byte [esi] + mov ah,al + sub ah,10h + and ah,al + test ah,0F0h + jnz pop_sreg + call convert_register + test al,1000b + jz pop_reg_ok + or [rex_prefix],41h + and al,111b + pop_reg_ok: + add al,58h + mov [base_code],al + mov al,ah + mov ah,[extended_code] + cmp al,2 + je pop_reg_16bit + cmp al,4 + je pop_reg_32bit + cmp al,8 + je pop_reg_64bit + jmp invalid_operand_size + pop_reg_64bit: + test ah,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + jmp pop_reg_store + pop_reg_32bit: + test ah,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp pop_reg_store + pop_reg_16bit: + test ah,not 2 + jnz invalid_operand_size + call operand_16bit + pop_reg_store: + call store_instruction_code + pop_done: + lods byte [esi] + dec esi + cmp al,0Fh + je instruction_assembled + or al,al + jz instruction_assembled + mov [operand_size],0 + mov [size_override],0 + mov [operand_prefix],0 + mov [rex_prefix],0 + jmp pop_next + pop_sreg: + mov bl,al + mov dl,[operand_size] + mov dh,[extended_code] + cmp dl,2 + je pop_sreg16 + cmp dl,4 + je pop_sreg32 + cmp dl,8 + je pop_sreg64 + or dl,dl + jnz invalid_operand_size + cmp dh,2 + je pop_sreg16 + cmp dh,4 + je pop_sreg32 + cmp dh,8 + je pop_sreg64 + jmp pop_sreg_store + pop_sreg16: + test dh,not 2 + jnz invalid_operand_size + call operand_16bit + jmp pop_sreg_store + pop_sreg32: + test dh,not 4 + jnz invalid_operand_size + cmp [code_type],64 + je illegal_instruction + call operand_32bit + jmp pop_sreg_store + pop_sreg64: + test dh,not 8 + jnz invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + pop_sreg_store: + mov al,bl + cmp al,70h + jae invalid_operand + sub al,61h + cmp al,4 + jae pop_sreg_386 + shl al,3 + add al,7 + mov [base_code],al + cmp [code_type],64 + je illegal_instruction + jmp pop_reg_store + pop_sreg_386: + sub al,4 + shl al,3 + add al,0A1h + mov [extended_code],al + mov [base_code],0Fh + jmp pop_reg_store +inc_instruction: + mov [base_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je inc_reg + cmp al,'[' + je inc_mem + jne invalid_operand + inc_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je inc_mem_8bit + jb inc_mem_nosize + call operand_autodetect + mov al,0FFh + xchg al,[base_code] + mov [postbyte_register],al + call store_instruction + jmp instruction_assembled + inc_mem_nosize: + cmp [error_line],0 + jne inc_mem_8bit + mov eax,[current_line] + mov [error_line],eax + mov [error],operand_size_not_specified + inc_mem_8bit: + mov al,0FEh + xchg al,[base_code] + mov [postbyte_register],al + call store_instruction + jmp instruction_assembled + inc_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,0FEh + xchg al,[base_code] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je inc_reg_8bit + call operand_autodetect + cmp [code_type],64 + je inc_reg_long_form + mov al,[postbyte_register] + shl al,3 + add al,bl + add al,40h + mov [base_code],al + call store_instruction_code + jmp instruction_assembled + inc_reg_long_form: + inc [base_code] + inc_reg_8bit: + call store_nomem_instruction + jmp instruction_assembled +set_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je set_reg + cmp al,'[' + jne invalid_operand + set_mem: + call get_address + cmp [operand_size],1 + ja invalid_operand_size + mov [postbyte_register],0 + call store_instruction + jmp instruction_assembled + set_reg: + lods byte [esi] + call convert_register + cmp ah,1 + jne invalid_operand_size + mov bl,al + mov [postbyte_register],0 + call store_nomem_instruction + jmp instruction_assembled +arpl_instruction: + cmp [code_type],64 + je illegal_instruction + mov [base_code],63h + lods byte [esi] + call get_size_operator + cmp al,10h + je arpl_reg + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + cmp ah,2 + jne invalid_operand_size + call store_instruction + jmp instruction_assembled + arpl_reg: + lods byte [esi] + call convert_register + cmp ah,2 + jne invalid_operand_size + mov bl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + cmp ah,2 + jne invalid_operand_size + mov [postbyte_register],al + call store_nomem_instruction + jmp instruction_assembled +bound_instruction: + cmp [code_type],64 + je illegal_instruction + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,2 + je bound_16bit + cmp al,4 + je bound_32bit + jmp invalid_operand_size + bound_32bit: + call operand_32bit + mov [base_code],62h + call store_instruction + jmp instruction_assembled + bound_16bit: + call operand_16bit + mov [base_code],62h + call store_instruction + jmp instruction_assembled +enter_instruction: + lods byte [esi] + call get_size_operator + cmp ah,2 + je enter_imm16_size_ok + or ah,ah + jnz invalid_operand_size + enter_imm16_size_ok: + cmp al,'(' + jne invalid_operand + call get_word_value + cmp [next_pass_needed],0 + jne enter_imm16_ok + cmp [value_type],0 + jne invalid_use_of_symbol + enter_imm16_ok: + push eax + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp ah,1 + je enter_imm8_size_ok + or ah,ah + jnz invalid_operand_size + enter_imm8_size_ok: + cmp al,'(' + jne invalid_operand + call get_byte_value + mov dl,al + pop ebx + mov al,0C8h + stos byte [edi] + mov ax,bx + stos word [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled +ret_instruction_only64: + cmp [code_type],64 + jne illegal_instruction + jmp ret_instruction +ret_instruction_32bit_except64: + cmp [code_type],64 + je illegal_instruction +ret_instruction_32bit: + call operand_32bit + jmp ret_instruction +ret_instruction_16bit: + call operand_16bit + jmp ret_instruction +retf_instruction: + cmp [code_type],64 + jne ret_instruction +ret_instruction_64bit: + call operand_64bit +ret_instruction: + mov [base_code],al + lods byte [esi] + dec esi + or al,al + jz simple_ret + cmp al,0Fh + je simple_ret + lods byte [esi] + call get_size_operator + or ah,ah + jz ret_imm + cmp ah,2 + je ret_imm + jmp invalid_operand_size + ret_imm: + cmp al,'(' + jne invalid_operand + call get_word_value + cmp [next_pass_needed],0 + jne ret_imm_ok + cmp [value_type],0 + jne invalid_use_of_symbol + ret_imm_ok: + mov dx,ax + call store_instruction_code + mov ax,dx + stos word [edi] + jmp instruction_assembled + simple_ret: + inc [base_code] + call store_instruction_code + jmp instruction_assembled +lea_instruction: + mov [base_code],8Dh + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + xor al,al + xchg al,[operand_size] + push eax + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + pop eax + call operand_autodetect + call store_instruction + jmp instruction_assembled +ls_instruction: + or al,al + jz les_instruction + cmp al,3 + jz lds_instruction + add al,0B0h + mov [extended_code],al + mov [base_code],0Fh + jmp ls_code_ok + les_instruction: + mov [base_code],0C4h + jmp ls_short_code + lds_instruction: + mov [base_code],0C5h + ls_short_code: + cmp [code_type],64 + je illegal_instruction + ls_code_ok: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + add [operand_size],2 + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,4 + je ls_16bit + cmp al,6 + je ls_32bit + cmp al,10 + je ls_64bit + jmp invalid_operand_size + ls_16bit: + call operand_16bit + call store_instruction + jmp instruction_assembled + ls_32bit: + call operand_32bit + call store_instruction + jmp instruction_assembled + ls_64bit: + call operand_64bit + call store_instruction + jmp instruction_assembled +sh_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + je sh_reg + cmp al,'[' + jne invalid_operand + sh_mem: + call get_address + push edx bx cx + mov al,[operand_size] + push eax + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je sh_mem_imm + cmp al,10h + jne invalid_operand + sh_mem_reg: + lods byte [esi] + cmp al,11h + jne invalid_operand + pop eax cx bx edx + cmp al,1 + je sh_mem_cl_8bit + jb sh_mem_cl_nosize + call operand_autodetect + mov [base_code],0D3h + call store_instruction + jmp instruction_assembled + sh_mem_cl_nosize: + cmp [error_line],0 + jne sh_mem_cl_8bit + mov eax,[current_line] + mov [error_line],eax + mov [error],operand_size_not_specified + sh_mem_cl_8bit: + mov [base_code],0D2h + call store_instruction + jmp instruction_assembled + sh_mem_imm: + mov al,[operand_size] + or al,al + jz sh_mem_imm_size_ok + cmp al,1 + jne invalid_operand_size + sh_mem_imm_size_ok: + call get_byte_value + mov byte [value],al + pop eax cx bx edx + cmp al,1 + je sh_mem_imm_8bit + jb sh_mem_imm_nosize + call operand_autodetect + cmp byte [value],1 + je sh_mem_1 + mov [base_code],0C1h + call store_instruction_with_imm8 + jmp instruction_assembled + sh_mem_1: + mov [base_code],0D1h + call store_instruction + jmp instruction_assembled + sh_mem_imm_nosize: + cmp [error_line],0 + jne sh_mem_imm_8bit + mov eax,[current_line] + mov [error_line],eax + mov [error],operand_size_not_specified + sh_mem_imm_8bit: + cmp byte [value],1 + je sh_mem_1_8bit + mov [base_code],0C0h + call store_instruction_with_imm8 + jmp instruction_assembled + sh_mem_1_8bit: + mov [base_code],0D0h + call store_instruction + jmp instruction_assembled + sh_reg: + lods byte [esi] + call convert_register + mov bx,ax + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'(' + je sh_reg_imm + cmp al,10h + jne invalid_operand + sh_reg_reg: + lods byte [esi] + cmp al,11h + jne invalid_operand + mov al,bh + cmp al,1 + je sh_reg_cl_8bit + call operand_autodetect + mov [base_code],0D3h + call store_nomem_instruction + jmp instruction_assembled + sh_reg_cl_8bit: + mov [base_code],0D2h + call store_nomem_instruction + jmp instruction_assembled + sh_reg_imm: + mov al,[operand_size] + or al,al + jz sh_reg_imm_size_ok + cmp al,1 + jne invalid_operand_size + sh_reg_imm_size_ok: + push ebx + call get_byte_value + mov dl,al + pop ebx + mov al,bh + cmp al,1 + je sh_reg_imm_8bit + call operand_autodetect + cmp dl,1 + je sh_reg_1 + mov [base_code],0C1h + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + sh_reg_1: + mov [base_code],0D1h + call store_nomem_instruction + jmp instruction_assembled + sh_reg_imm_8bit: + cmp dl,1 + je sh_reg_1_8bit + mov [base_code],0C0h + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled + sh_reg_1_8bit: + mov [base_code],0D0h + call store_nomem_instruction + jmp instruction_assembled +shd_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je shd_reg + cmp al,'[' + jne invalid_operand + shd_mem: + call get_address + push edx bx cx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + mov al,ah + mov [operand_size],0 + push eax + lods byte [esi] + call get_size_operator + cmp al,'(' + je shd_mem_reg_imm + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,11h + jne invalid_operand + pop eax cx bx edx + call operand_autodetect + inc [extended_code] + call store_instruction + jmp instruction_assembled + shd_mem_reg_imm: + mov al,[operand_size] + or al,al + jz shd_mem_reg_imm_size_ok + cmp al,1 + jne invalid_operand_size + shd_mem_reg_imm_size_ok: + call get_byte_value + mov byte [value],al + pop eax cx bx edx + call operand_autodetect + call store_instruction_with_imm8 + jmp instruction_assembled + shd_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + push eax ebx + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,'(' + je shd_reg_reg_imm + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,11h + jne invalid_operand + pop ebx eax + call operand_autodetect + inc [extended_code] + call store_nomem_instruction + jmp instruction_assembled + shd_reg_reg_imm: + mov al,[operand_size] + or al,al + jz shd_reg_reg_imm_size_ok + cmp al,1 + jne invalid_operand_size + shd_reg_reg_imm_size_ok: + call get_byte_value + mov dl,al + pop ebx eax + call operand_autodetect + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled +movx_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + mov al,ah + push eax + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je movx_reg + cmp al,'[' + jne invalid_operand + call get_address + pop eax + mov ah,[operand_size] + cmp ah,al + jae invalid_operand_size + cmp ah,1 + je movx_mem_8bit + cmp ah,2 + je movx_mem_16bit + or ah,ah + jnz invalid_operand_size + cmp [error_line],0 + jne movx_mem_8bit + mov eax,[current_line] + mov [error_line],eax + mov [error],operand_size_not_specified + movx_mem_8bit: + call operand_autodetect + call store_instruction + jmp instruction_assembled + movx_mem_16bit: + inc [extended_code] + call operand_autodetect + call store_instruction + jmp instruction_assembled + movx_reg: + lods byte [esi] + call convert_register + pop ebx + xchg bl,al + cmp ah,al + jae invalid_operand_size + cmp ah,1 + je movx_reg_8bit + cmp ah,2 + je movx_reg_16bit + jmp invalid_operand_size + movx_reg_8bit: + call operand_autodetect + call store_nomem_instruction + jmp instruction_assembled + movx_reg_16bit: + call operand_autodetect + inc [extended_code] + call store_nomem_instruction + jmp instruction_assembled +movsxd_instruction: + mov [base_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + cmp ah,8 + jne invalid_operand_size + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je movsxd_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],4 + je movsxd_mem_store + cmp [operand_size],0 + jne invalid_operand_size + movsxd_mem_store: + call operand_64bit + call store_instruction + jmp instruction_assembled + movsxd_reg: + lods byte [esi] + call convert_register + cmp ah,4 + jne invalid_operand_size + call operand_64bit + call store_nomem_instruction + jmp instruction_assembled +bt_instruction: + mov [postbyte_register],al + shl al,3 + add al,83h + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + je bt_reg + cmp al,'[' + jne invalid_operand + call get_address + push eax bx cx + lods byte [esi] + cmp al,',' + jne invalid_operand + cmp byte [esi],'(' + je bt_mem_imm + cmp byte [esi],11h + jne bt_mem_reg + cmp byte [esi+2],'(' + je bt_mem_imm + bt_mem_reg: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + pop cx bx edx + mov al,ah + call operand_autodetect + call store_instruction + jmp instruction_assembled + bt_mem_imm: + xor al,al + xchg al,[operand_size] + push eax + lods byte [esi] + call get_size_operator + cmp al,'(' + jne invalid_operand + mov al,[operand_size] + or al,al + jz bt_mem_imm_size_ok + cmp al,1 + jne invalid_operand_size + bt_mem_imm_size_ok: + call get_byte_value + mov byte [value],al + pop eax + or al,al + jz bt_mem_imm_nosize + call operand_autodetect + bt_mem_imm_store: + pop cx bx edx + mov [extended_code],0BAh + call store_instruction_with_imm8 + jmp instruction_assembled + bt_mem_imm_nosize: + cmp [error_line],0 + jne bt_mem_imm_store + mov eax,[current_line] + mov [error_line],eax + mov [error],operand_size_not_specified + jmp bt_mem_imm_store + bt_reg: + lods byte [esi] + call convert_register + mov bl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + cmp byte [esi],'(' + je bt_reg_imm + cmp byte [esi],11h + jne bt_reg_reg + cmp byte [esi+2],'(' + je bt_reg_imm + bt_reg_reg: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + mov al,ah + call operand_autodetect + call store_nomem_instruction + jmp instruction_assembled + bt_reg_imm: + xor al,al + xchg al,[operand_size] + push eax + lods byte [esi] + call get_size_operator + cmp al,'(' + jne invalid_operand + mov al,[operand_size] + or al,al + jz bt_reg_imm_size_ok + cmp al,1 + jne invalid_operand_size + bt_reg_imm_size_ok: + call get_byte_value + mov byte [value],al + pop eax + call operand_autodetect + bt_reg_imm_store: + mov [extended_code],0BAh + call store_nomem_instruction + mov al,byte [value] + stos byte [edi] + jmp instruction_assembled +bs_instruction: + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je bs_reg_reg + cmp al,'[' + jne invalid_argument + call get_address + mov al,[operand_size] + call operand_autodetect + call store_instruction + jmp instruction_assembled + bs_reg_reg: + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + call operand_autodetect + call store_nomem_instruction + jmp instruction_assembled +imul_instruction: + mov [base_code],0F6h + mov [postbyte_register],5 + lods byte [esi] + call get_size_operator + cmp al,10h + je imul_reg + cmp al,'[' + jne invalid_operand + imul_mem: + call get_address + mov al,[operand_size] + cmp al,1 + je imul_mem_8bit + jb imul_mem_nosize + call operand_autodetect + inc [base_code] + call store_instruction + jmp instruction_assembled + imul_mem_nosize: + cmp [error_line],0 + jne imul_mem_8bit + mov eax,[current_line] + mov [error_line],eax + mov [error],operand_size_not_specified + imul_mem_8bit: + call store_instruction + jmp instruction_assembled + imul_reg: + lods byte [esi] + call convert_register + cmp byte [esi],',' + je imul_reg_ + mov bl,al + mov al,ah + cmp al,1 + je imul_reg_8bit + call operand_autodetect + inc [base_code] + call store_nomem_instruction + jmp instruction_assembled + imul_reg_8bit: + call store_nomem_instruction + jmp instruction_assembled + imul_reg_: + mov [postbyte_register],al + inc esi + cmp byte [esi],'(' + je imul_reg_imm + cmp byte [esi],11h + jne imul_reg_noimm + cmp byte [esi+2],'(' + je imul_reg_imm + imul_reg_noimm: + lods byte [esi] + call get_size_operator + cmp al,10h + je imul_reg_reg + cmp al,'[' + jne invalid_operand + imul_reg_mem: + call get_address + push edx bx cx + cmp byte [esi],',' + je imul_reg_mem_imm + mov al,[operand_size] + call operand_autodetect + pop cx bx edx + mov [base_code],0Fh + mov [extended_code],0AFh + call store_instruction + jmp instruction_assembled + imul_reg_mem_imm: + inc esi + lods byte [esi] + call get_size_operator + cmp al,'(' + jne invalid_operand + mov al,[operand_size] + cmp al,2 + je imul_reg_mem_imm_16bit + cmp al,4 + je imul_reg_mem_imm_32bit + cmp al,8 + je imul_reg_mem_imm_64bit + jmp invalid_operand_size + imul_reg_mem_imm_16bit: + call operand_16bit + call get_word_value + mov word [value],ax + cmp [value_type],0 + jne imul_reg_mem_imm_16bit_store + cmp [size_declared],0 + jne imul_reg_mem_imm_16bit_store + cmp ax,-80h + jl imul_reg_mem_imm_16bit_store + cmp ax,80h + jl imul_reg_mem_imm_8bit_store + imul_reg_mem_imm_16bit_store: + pop cx bx edx + mov [base_code],69h + call store_instruction_with_imm16 + jmp instruction_assembled + imul_reg_mem_imm_32bit: + call operand_32bit + call get_dword_value + imul_reg_mem_imm_32bit_ok: + mov dword [value],eax + cmp [value_type],0 + jne imul_reg_mem_imm_32bit_store + cmp [size_declared],0 + jne imul_reg_mem_imm_32bit_store + cmp eax,-80h + jl imul_reg_mem_imm_32bit_store + cmp eax,80h + jl imul_reg_mem_imm_8bit_store + imul_reg_mem_imm_32bit_store: + pop cx bx edx + mov [base_code],69h + call store_instruction_with_imm32 + jmp instruction_assembled + imul_reg_mem_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp imul_reg_mem_imm_32bit_ok + imul_reg_mem_imm_8bit_store: + pop cx bx edx + mov [base_code],6Bh + call store_instruction_with_imm8 + jmp instruction_assembled + imul_reg_imm: + mov bl,[postbyte_register] + dec esi + jmp imul_reg_reg_imm + imul_reg_reg: + lods byte [esi] + call convert_register + mov bl,al + cmp byte [esi],',' + je imul_reg_reg_imm + mov al,ah + call operand_autodetect + mov [base_code],0Fh + mov [extended_code],0AFh + call store_nomem_instruction + jmp instruction_assembled + imul_reg_reg_imm: + inc esi + lods byte [esi] + call get_size_operator + cmp al,'(' + jne invalid_operand + mov al,[operand_size] + cmp al,2 + je imul_reg_reg_imm_16bit + cmp al,4 + je imul_reg_reg_imm_32bit + cmp al,8 + je imul_reg_reg_imm_64bit + jmp invalid_operand_size + imul_reg_reg_imm_16bit: + call operand_16bit + push ebx + call get_word_value + pop ebx + mov dx,ax + cmp [value_type],0 + jne imul_reg_reg_imm_16bit_store + cmp [size_declared],0 + jne imul_reg_reg_imm_16bit_store + cmp ax,-80h + jl imul_reg_reg_imm_16bit_store + cmp ax,80h + jl imul_reg_reg_imm_8bit_store + imul_reg_reg_imm_16bit_store: + mov [base_code],69h + call store_nomem_instruction + mov ax,dx + call mark_relocation + stos word [edi] + jmp instruction_assembled + imul_reg_reg_imm_32bit: + call operand_32bit + push ebx + call get_dword_value + imul_reg_reg_imm_32bit_ok: + pop ebx + mov edx,eax + cmp [value_type],0 + jne imul_reg_reg_imm_32bit_store + cmp [size_declared],0 + jne imul_reg_reg_imm_32bit_store + cmp eax,-80h + jl imul_reg_reg_imm_32bit_store + cmp eax,80h + jl imul_reg_reg_imm_8bit_store + imul_reg_reg_imm_32bit_store: + mov [base_code],69h + call store_nomem_instruction + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + imul_reg_reg_imm_64bit: + cmp [size_declared],0 + jne long_immediate_not_encodable + call operand_64bit + push ebx + call get_simm32 + cmp [value_type],4 + jae long_immediate_not_encodable + jmp imul_reg_reg_imm_32bit_ok + imul_reg_reg_imm_8bit_store: + mov [base_code],6Bh + call store_nomem_instruction + mov al,dl + stos byte [edi] + jmp instruction_assembled +in_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + or al,al + jnz invalid_operand + lods byte [esi] + cmp al,',' + jne invalid_operand + mov al,ah + push eax + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,'(' + je in_imm + cmp al,10h + je in_reg + jmp invalid_operand + in_reg: + lods byte [esi] + cmp al,22h + jne invalid_operand + pop eax + cmp al,1 + je in_al_dx + cmp al,2 + je in_ax_dx + cmp al,4 + je in_eax_dx + jmp invalid_operand_size + in_al_dx: + mov al,0ECh + stos byte [edi] + jmp instruction_assembled + in_ax_dx: + call operand_16bit + mov [base_code],0EDh + call store_instruction_code + jmp instruction_assembled + in_eax_dx: + call operand_32bit + mov [base_code],0EDh + call store_instruction_code + jmp instruction_assembled + in_imm: + mov al,[operand_size] + or al,al + jz in_imm_size_ok + cmp al,1 + jne invalid_operand_size + in_imm_size_ok: + call get_byte_value + mov dl,al + pop eax + cmp al,1 + je in_al_imm + cmp al,2 + je in_ax_imm + cmp al,4 + je in_eax_imm + jmp invalid_operand_size + in_al_imm: + mov al,0E4h + stos byte [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled + in_ax_imm: + call operand_16bit + mov [base_code],0E5h + call store_instruction_code + mov al,dl + stos byte [edi] + jmp instruction_assembled + in_eax_imm: + call operand_32bit + mov [base_code],0E5h + call store_instruction_code + mov al,dl + stos byte [edi] + jmp instruction_assembled +out_instruction: + lods byte [esi] + call get_size_operator + cmp al,'(' + je out_imm + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,22h + jne invalid_operand + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + or al,al + jnz invalid_operand + mov al,ah + cmp al,1 + je out_dx_al + cmp al,2 + je out_dx_ax + cmp al,4 + je out_dx_eax + jmp invalid_operand_size + out_dx_al: + mov al,0EEh + stos byte [edi] + jmp instruction_assembled + out_dx_ax: + call operand_16bit + mov [base_code],0EFh + call store_instruction_code + jmp instruction_assembled + out_dx_eax: + call operand_32bit + mov [base_code],0EFh + call store_instruction_code + jmp instruction_assembled + out_imm: + mov al,[operand_size] + or al,al + jz out_imm_size_ok + cmp al,1 + jne invalid_operand_size + out_imm_size_ok: + call get_byte_value + mov dl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + or al,al + jnz invalid_operand + mov al,ah + cmp al,1 + je out_imm_al + cmp al,2 + je out_imm_ax + cmp al,4 + je out_imm_eax + jmp invalid_operand_size + out_imm_al: + mov al,0E6h + stos byte [edi] + mov al,dl + stos byte [edi] + jmp instruction_assembled + out_imm_ax: + call operand_16bit + mov [base_code],0E7h + call store_instruction_code + mov al,dl + stos byte [edi] + jmp instruction_assembled + out_imm_eax: + call operand_32bit + mov [base_code],0E7h + call store_instruction_code + mov al,dl + stos byte [edi] + jmp instruction_assembled + +conditional_jump: + mov [base_code],al + lods byte [esi] + call get_jump_operator + cmp [jump_type],2 + je invalid_operand + call get_size_operator + cmp al,'(' + jne invalid_operand + cmp byte [esi],'.' + je invalid_value + call get_relative_offset + sub eax,2 + jo jump_out_of_range + cmp [next_pass_needed],0 + jne conditional_jump_value_ok + cmp [value_type],1 + je invalid_use_of_symbol + ja conditional_jump_32bit + conditional_jump_value_ok: + mov bl,[operand_size] + cmp bl,1 + je conditional_jump_8bit + cmp bl,2 + je conditional_jump_16bit + cmp bl,4 + je conditional_jump_32bit + or bl,bl + jnz invalid_operand_size + cmp eax,80h + jb conditional_jump_8bit + cmp eax,-80h + jae conditional_jump_8bit + cmp [code_type],16 + je conditional_jump_16bit + conditional_jump_32bit: + sub eax,2 + jo jump_out_of_range + mov edx,eax + mov ecx,edi + call operand_32bit + mov al,[base_code] + add al,10h + mov [extended_code],al + mov [base_code],0Fh + call store_instruction_code + mov eax,edi + sub eax,ecx + sub edx,eax + jo jump_out_of_range + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + conditional_jump_16bit: + mov edx,eax + mov ecx,edi + call operand_16bit + mov al,[base_code] + add al,10h + mov [extended_code],al + mov [base_code],0Fh + call store_instruction_code + mov eax,edi + sub eax,ecx + sub edx,eax + jo jump_out_of_range + mov eax,edx + stos word [edi] + cmp eax,10000h + jge jump_out_of_range + cmp eax,-10000h + jl jump_out_of_range + jmp instruction_assembled + conditional_jump_8bit: + mov edx,eax + mov ah,al + mov al,[base_code] + stos word [edi] + cmp edx,80h + jge jump_out_of_range + cmp edx,-80h + jl jump_out_of_range + jmp instruction_assembled + jump_out_of_range: + cmp [error_line],0 + jne instruction_assembled + mov eax,[current_line] + mov [error_line],eax + mov [error],relative_jump_out_of_range + jmp instruction_assembled +loop_instruction_16bit: + cmp [code_type],64 + je illegal_instruction + mov dl,al + call address_16bit_prefix + mov al,dl + jmp loop_instruction +loop_instruction_32bit: + mov dl,al + call address_32bit_prefix + mov al,dl + jmp loop_instruction +loop_instruction_64bit: + cmp [code_type],64 + jne illegal_instruction +loop_instruction: + mov [base_code],al + lods byte [esi] + call get_jump_operator + cmp [jump_type],2 + je invalid_operand + call get_size_operator + cmp al,'(' + jne invalid_operand + cmp byte [esi],'.' + je invalid_value + call get_relative_offset + cmp [next_pass_needed],0 + jne loop_value_ok + cmp [value_type],0 + jne invalid_use_of_symbol + loop_value_ok: + mov bl,[operand_size] + cmp bl,1 + je loop_8bit + or bl,bl + jnz invalid_operand_size + loop_8bit: + sub eax,2 + jo jump_out_of_range + mov edx,eax + mov al,[base_code] + stos byte [edi] + mov al,dl + stos byte [edi] + cmp edx,80h + jge jump_out_of_range + cmp edx,-80h + jl jump_out_of_range + jmp instruction_assembled +call_instruction: + mov [postbyte_register],10b + mov [base_code],0E8h + mov [extended_code],9Ah + jmp process_jmp +jmp_instruction: + mov [postbyte_register],100b + mov [base_code],0E9h + mov [extended_code],0EAh + process_jmp: + lods byte [esi] + call get_jump_operator + call get_size_operator + cmp al,'(' + je jmp_imm + mov [base_code],0FFh + cmp al,10h + je jmp_reg + cmp al,'[' + jne invalid_operand + jmp_mem: + call get_address + mov edx,eax + mov al,[operand_size] + or al,al + jz jmp_mem_size_not_specified + cmp al,2 + je jmp_mem_16bit + cmp al,4 + je jmp_mem_32bit + cmp al,6 + je jmp_mem_48bit + cmp al,8 + je jmp_mem_64bit + cmp al,10 + je jmp_mem_80bit + jmp invalid_operand_size + jmp_mem_size_not_specified: + cmp [jump_type],2 + je jmp_mem_far + cmp [jump_type],1 + je jmp_mem_near + cmp [error_line],0 + jne jmp_mem_near + mov eax,[current_line] + mov [error_line],eax + mov [error],operand_size_not_specified + jmp_mem_near: + cmp [code_type],16 + je jmp_mem_16bit + cmp [code_type],32 + je jmp_mem_near_32bit + jmp_mem_64bit: + cmp [jump_type],2 + je invalid_operand_size + cmp [code_type],64 + jne illegal_instruction + call store_instruction + jmp instruction_assembled + jmp_mem_far: + cmp [code_type],16 + je jmp_mem_far_32bit + jmp_mem_48bit: + call operand_32bit + jmp_mem_far_store: + cmp [jump_type],1 + je invalid_operand_size + inc [postbyte_register] + call store_instruction + jmp instruction_assembled + jmp_mem_80bit: + call operand_64bit + jmp jmp_mem_far_store + jmp_mem_far_32bit: + call operand_16bit + jmp jmp_mem_far_store + jmp_mem_32bit: + cmp [jump_type],2 + je jmp_mem_far_32bit + cmp [jump_type],1 + je jmp_mem_near_32bit + cmp [code_type],16 + je jmp_mem_far_32bit + jmp_mem_near_32bit: + cmp [code_type],64 + je illegal_instruction + call operand_32bit + call store_instruction + jmp instruction_assembled + jmp_mem_16bit: + cmp [jump_type],2 + je invalid_operand_size + call operand_16bit + call store_instruction + jmp instruction_assembled + jmp_reg: + cmp [jump_type],2 + je invalid_operand + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + cmp al,2 + je jmp_reg_16bit + cmp al,4 + je jmp_reg_32bit + cmp al,8 + jne invalid_operand_size + jmp_reg_64bit: + cmp [code_type],64 + jne illegal_instruction + call store_nomem_instruction + jmp instruction_assembled + jmp_reg_32bit: + cmp [code_type],64 + je illegal_instruction + call store_nomem_instruction + jmp instruction_assembled + jmp_reg_16bit: + call operand_16bit + call store_nomem_instruction + jmp instruction_assembled + jmp_imm: + cmp byte [esi],'.' + je invalid_value + mov ebx,esi + dec esi + call skip_symbol + xchg esi,ebx + cmp byte [ebx],':' + je jmp_far + call get_relative_offset + cmp [jump_type],2 + je invalid_operand + sub eax,2 + jo jump_out_of_range + cmp [next_pass_needed],0 + jne jmp_value_ok + cmp [value_type],1 + je invalid_use_of_symbol + ja jmp_32bit + jmp_value_ok: + mov bl,[operand_size] + cmp bl,1 + je jmp_8bit + cmp bl,2 + je jmp_16bit + cmp bl,4 + je jmp_32bit + or bl,bl + jnz invalid_operand_size + cmp [base_code],0E9h + jne jmp_no8bit + cmp eax,80h + jb jmp_8bit + cmp eax,-80h + jae jmp_8bit + jmp_no8bit: + cmp [code_type],16 + je jmp_16bit + jmp_32bit: + test [operand_size],not 4 + jnz invalid_operand_size + sub eax,2 + jo jump_out_of_range + mov edx,eax + mov ecx,edi + call operand_32bit + call store_instruction_code + mov eax,edi + sub eax,ecx + sub edx,eax + jo jump_out_of_range + mov eax,edx + call mark_relocation + stos dword [edi] + jmp instruction_assembled + jmp_16bit: + mov edx,eax + mov ecx,edi + call operand_16bit + call store_instruction_code + mov eax,edi + sub eax,ecx + sub edx,eax + jo jump_out_of_range + mov eax,edx + stos word [edi] + cmp eax,10000h + jge jump_out_of_range + cmp eax,-10000h + jl jump_out_of_range + jmp instruction_assembled + jmp_8bit: + cmp [base_code],0E9h + jne invalid_operand_size + mov edx,eax + mov ah,al + mov al,0EBh + stos word [edi] + cmp edx,80h + jge jump_out_of_range + cmp edx,-80h + jl jump_out_of_range + jmp instruction_assembled + jmp_far: + cmp [jump_type],1 + je invalid_operand + cmp [code_type],64 + je illegal_instruction + mov al,[extended_code] + mov [base_code],al + call get_word_value + push eax + inc esi + lods byte [esi] + cmp al,'(' + jne invalid_operand + mov al,[value_type] + push eax [symbol_identifier] + cmp byte [esi],'.' + je invalid_value + mov al,[operand_size] + cmp al,4 + je jmp_far_16bit + cmp al,6 + je jmp_far_32bit + or al,al + jnz invalid_operand_size + cmp [code_type],16 + jne jmp_far_32bit + jmp_far_16bit: + call get_word_value + mov ebx,eax + call operand_16bit + call store_instruction_code + mov ax,bx + call mark_relocation + stos word [edi] + jmp_far_segment: + pop [symbol_identifier] eax + mov [value_type],al + pop eax + call mark_relocation + stos word [edi] + jmp instruction_assembled + jmp_far_32bit: + call get_dword_value + mov ebx,eax + call operand_32bit + call store_instruction_code + mov eax,ebx + call mark_relocation + stos dword [edi] + jmp jmp_far_segment + +movs_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp [segment_register],1 + ja invalid_address + push ebx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + pop edx + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + mov al,dh + mov ah,bh + shr al,4 + shr ah,4 + cmp al,ah + jne address_sizes_do_not_agree + and bh,111b + and dh,111b + cmp bh,6 + jne invalid_address + cmp dh,7 + jne invalid_address + cmp al,2 + je movs_address_16bit + cmp al,4 + je movs_address_32bit + cmp [code_type],64 + jne invalid_address_size + jmp movs_store + movs_address_32bit: + call address_32bit_prefix + jmp movs_store + movs_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + movs_store: + cmp [segment_register],4 + je movs_segment_ok + call store_segment_prefix + movs_segment_ok: + mov al,0A4h + mov bl,[operand_size] + cmp bl,1 + je simple_instruction + inc al + cmp bl,2 + je simple_instruction_16bit + cmp bl,4 + je simple_instruction_32bit + cmp bl,8 + je simple_instruction_64bit + or bl,bl + jz operand_size_not_specified + jmp invalid_operand_size +lods_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,26h + je lods_address_16bit + cmp bh,46h + je lods_address_32bit + cmp bh,86h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp lods_store + lods_address_32bit: + call address_32bit_prefix + jmp lods_store + lods_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + lods_store: + cmp [segment_register],4 + je lods_segment_ok + call store_segment_prefix + lods_segment_ok: + mov al,0ACh + mov bl,[operand_size] + cmp bl,1 + je simple_instruction + inc al + cmp bl,2 + je simple_instruction_16bit + cmp bl,4 + je simple_instruction_32bit + cmp bl,8 + je simple_instruction_64bit + or bl,bl + jz operand_size_not_specified + jmp invalid_operand_size +stos_instruction: + mov [base_code],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,27h + je stos_address_16bit + cmp bh,47h + je stos_address_32bit + cmp bh,87h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp stos_store + stos_address_32bit: + call address_32bit_prefix + jmp stos_store + stos_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + stos_store: + cmp [segment_register],1 + ja invalid_address + mov al,[base_code] + mov bl,[operand_size] + cmp bl,1 + je simple_instruction + inc al + cmp bl,2 + je simple_instruction_16bit + cmp bl,4 + je simple_instruction_32bit + cmp bl,8 + je simple_instruction_64bit + or bl,bl + jz operand_size_not_specified + jmp invalid_operand_size +cmps_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + mov al,[segment_register] + push ax bx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + pop dx ax + cmp [segment_register],1 + ja invalid_address + mov [segment_register],al + mov al,dh + mov ah,bh + shr al,4 + shr ah,4 + cmp al,ah + jne address_sizes_do_not_agree + and bh,111b + and dh,111b + cmp bh,7 + jne invalid_address + cmp dh,6 + jne invalid_address + cmp al,2 + je cmps_address_16bit + cmp al,4 + je cmps_address_32bit + cmp [code_type],64 + jne invalid_address_size + jmp cmps_store + cmps_address_32bit: + call address_32bit_prefix + jmp cmps_store + cmps_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + cmps_store: + cmp [segment_register],4 + je cmps_segment_ok + call store_segment_prefix + cmps_segment_ok: + mov al,0A6h + mov bl,[operand_size] + cmp bl,1 + je simple_instruction + inc al + cmp bl,2 + je simple_instruction_16bit + cmp bl,4 + je simple_instruction_32bit + cmp bl,8 + je simple_instruction_64bit + or bl,bl + jz operand_size_not_specified + jmp invalid_operand_size +ins_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,27h + je ins_address_16bit + cmp bh,47h + je ins_address_32bit + cmp bh,87h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp ins_store + ins_address_32bit: + call address_32bit_prefix + jmp ins_store + ins_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + ins_store: + cmp [segment_register],1 + ja invalid_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,22h + jne invalid_operand + mov al,6Ch + mov bl,[operand_size] + cmp bl,1 + je simple_instruction + inc al + cmp bl,2 + je simple_instruction_16bit + cmp bl,4 + je simple_instruction_32bit + or bl,bl + jz operand_size_not_specified + jmp invalid_operand_size +outs_instruction: + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + cmp al,22h + jne invalid_operand + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,26h + je outs_address_16bit + cmp bh,46h + je outs_address_32bit + cmp bh,86h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp outs_store + outs_address_32bit: + call address_32bit_prefix + jmp outs_store + outs_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + outs_store: + cmp [segment_register],4 + je outs_segment_ok + call store_segment_prefix + outs_segment_ok: + mov al,6Eh + mov bl,[operand_size] + cmp bl,1 + je simple_instruction + inc al + cmp bl,2 + je simple_instruction_16bit + cmp bl,4 + je simple_instruction_32bit + or bl,bl + jz operand_size_not_specified + jmp invalid_operand_size +xlat_instruction: + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + or eax,eax + jnz invalid_address + or bl,ch + jnz invalid_address + cmp bh,23h + je xlat_address_16bit + cmp bh,43h + je xlat_address_32bit + cmp bh,83h + jne invalid_address + cmp [code_type],64 + jne invalid_address_size + jmp xlat_store + xlat_address_32bit: + call address_32bit_prefix + jmp xlat_store + xlat_address_16bit: + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + xlat_store: + call store_segment_prefix_if_necessary + mov al,0D7h + cmp [operand_size],1 + jbe simple_instruction + jmp invalid_operand_size + +pm_word_instruction: + mov ah,al + shr ah,4 + and al,111b + mov [base_code],0Fh + mov [extended_code],ah + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + je pm_reg + pm_mem: + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,2 + je pm_mem_store + or al,al + jnz invalid_operand_size + pm_mem_store: + call store_instruction + jmp instruction_assembled + pm_reg: + lods byte [esi] + call convert_register + mov bl,al + cmp ah,2 + jne invalid_operand_size + call store_nomem_instruction + jmp instruction_assembled +pm_store_word_instruction: + mov ah,al + shr ah,4 + and al,111b + mov [base_code],0Fh + mov [extended_code],ah + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne pm_mem + lods byte [esi] + call convert_register + mov bl,al + mov al,ah + call operand_autodetect + call store_nomem_instruction + jmp instruction_assembled +lgdt_instruction: + mov [base_code],0Fh + mov [extended_code],1 + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,6 + je lgdt_mem_48bit + cmp al,10 + je lgdt_mem_80bit + or al,al + jnz invalid_operand_size + cmp [code_type],64 + je lgdt_mem_80bit + lgdt_mem_48bit: + cmp [code_type],64 + je illegal_instruction + call store_instruction + jmp instruction_assembled + lgdt_mem_80bit: + cmp [code_type],64 + jne illegal_instruction + call store_instruction + jmp instruction_assembled +lar_instruction: + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + xor al,al + xchg al,[operand_size] + call operand_autodetect + lods byte [esi] + call get_size_operator + cmp al,10h + je lar_reg_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz lar_reg_mem + cmp al,2 + jne invalid_operand_size + lar_reg_mem: + call store_instruction + jmp instruction_assembled + lar_reg_reg: + lods byte [esi] + call convert_register + cmp ah,2 + jne invalid_operand_size + mov bl,al + call store_nomem_instruction + jmp instruction_assembled +invlpg_instruction: + mov [base_code],0Fh + mov [extended_code],1 + mov [postbyte_register],7 + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + call store_instruction + jmp instruction_assembled +swapgs_instruction: + mov [base_code],0Fh + mov [extended_code],1 + mov [postbyte_register],7 + mov bl,al + call store_nomem_instruction + jmp instruction_assembled + +basic_486_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + je basic_486_reg + cmp al,'[' + jne invalid_operand + call get_address + push edx bx cx + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + pop cx bx edx + mov al,ah + cmp al,1 + je basic_486_mem_reg_8bit + call operand_autodetect + inc [extended_code] + basic_486_mem_reg_8bit: + call store_instruction + jmp instruction_assembled + basic_486_reg: + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov bl,[postbyte_register] + mov [postbyte_register],al + mov al,ah + cmp al,1 + je basic_486_reg_reg_8bit + call operand_autodetect + inc [extended_code] + basic_486_reg_reg_8bit: + call store_nomem_instruction + jmp instruction_assembled +bswap_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + add al,0C8h + mov [extended_code],al + mov [base_code],0Fh + cmp ah,8 + je bswap_reg64 + cmp ah,4 + jne invalid_operand_size + call operand_32bit + call store_instruction_code + jmp instruction_assembled + bswap_reg64: + call operand_64bit + call store_instruction_code + jmp instruction_assembled +cmpxchgx_instruction: + mov [base_code],0Fh + mov [extended_code],0C7h + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov ah,1 + xchg [postbyte_register],ah + mov al,[operand_size] + or al,al + jz cmpxchgx_size_ok + cmp al,ah + jne invalid_operand_size + cmpxchgx_size_ok: + cmp ah,16 + jne cmpxchgx_store + call operand_64bit + cmpxchgx_store: + call store_instruction + jmp instruction_assembled + +basic_fpu_instruction: + mov [postbyte_register],al + mov [base_code],0D8h + lods byte [esi] + call get_size_operator + cmp al,10h + je basic_fpu_streg + cmp al,'[' + je basic_fpu_mem + dec esi + mov ah,[postbyte_register] + cmp ah,2 + jb invalid_operand + cmp ah,3 + ja invalid_operand + mov bl,1 + call store_nomem_instruction + jmp instruction_assembled + basic_fpu_mem: + call get_address + mov al,[operand_size] + cmp al,4 + je basic_fpu_mem_32bit + cmp al,8 + je basic_fpu_mem_64bit + or al,al + jnz invalid_operand_size + cmp [error_line],0 + jne basic_fpu_mem_32bit + mov eax,[current_line] + mov [error_line],eax + mov [error],operand_size_not_specified + basic_fpu_mem_32bit: + call store_instruction + jmp instruction_assembled + basic_fpu_mem_64bit: + mov [base_code],0DCh + call store_instruction + jmp instruction_assembled + basic_fpu_streg: + lods byte [esi] + call convert_fpu_register + mov bl,al + mov ah,[postbyte_register] + cmp ah,2 + je basic_fpu_single_streg + cmp ah,3 + je basic_fpu_single_streg + or al,al + jz basic_fpu_st0 + test ah,110b + jz basic_fpu_streg_st0 + xor [postbyte_register],1 + basic_fpu_streg_st0: + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + or al,al + jnz invalid_operand + mov [base_code],0DCh + call store_nomem_instruction + jmp instruction_assembled + basic_fpu_st0: + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + mov bl,al + basic_fpu_single_streg: + mov [base_code],0D8h + call store_nomem_instruction + jmp instruction_assembled +simple_fpu_instruction: + mov ah,al + or ah,11000000b + mov al,0D9h + stos word [edi] + jmp instruction_assembled +fi_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,2 + je fi_mem_16bit + cmp al,4 + je fi_mem_32bit + or al,al + jnz invalid_operand_size + cmp [error_line],0 + jne fi_mem_32bit + mov eax,[current_line] + mov [error_line],eax + mov [error],operand_size_not_specified + fi_mem_32bit: + mov [base_code],0DAh + call store_instruction + jmp instruction_assembled + fi_mem_16bit: + mov [base_code],0DEh + call store_instruction + jmp instruction_assembled +fld_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + je fld_streg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,4 + je fld_mem_32bit + cmp al,8 + je fld_mem_64bit + cmp al,10 + je fld_mem_80bit + or al,al + jnz invalid_operand_size + cmp [error_line],0 + jne fld_mem_32bit + mov eax,[current_line] + mov [error_line],eax + mov [error],operand_size_not_specified + fld_mem_32bit: + mov [base_code],0D9h + call store_instruction + jmp instruction_assembled + fld_mem_64bit: + mov [base_code],0DDh + call store_instruction + jmp instruction_assembled + fld_mem_80bit: + mov al,[postbyte_register] + cmp al,0 + je fld_mem_80bit_store + dec [postbyte_register] + cmp al,3 + je fld_mem_80bit_store + jmp invalid_operand_size + fld_mem_80bit_store: + add [postbyte_register],5 + mov [base_code],0DBh + call store_instruction + jmp instruction_assembled + fld_streg: + lods byte [esi] + call convert_fpu_register + mov bl,al + cmp [postbyte_register],2 + jae fst_streg + mov [base_code],0D9h + call store_nomem_instruction + jmp instruction_assembled + fst_streg: + mov [base_code],0DDh + call store_nomem_instruction + jmp instruction_assembled +fild_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + cmp al,2 + je fild_mem_16bit + cmp al,4 + je fild_mem_32bit + cmp al,8 + je fild_mem_64bit + or al,al + jnz invalid_operand_size + cmp [error_line],0 + jne fild_mem_32bit + mov eax,[current_line] + mov [error_line],eax + mov [error],operand_size_not_specified + fild_mem_32bit: + mov [base_code],0DBh + call store_instruction + jmp instruction_assembled + fild_mem_16bit: + mov [base_code],0DFh + call store_instruction + jmp instruction_assembled + fild_mem_64bit: + mov al,[postbyte_register] + cmp al,1 + je fisttp_64bit_store + jb fild_mem_64bit_store + dec [postbyte_register] + cmp al,3 + je fild_mem_64bit_store + jmp invalid_operand_size + fild_mem_64bit_store: + add [postbyte_register],5 + mov [base_code],0DFh + call store_instruction + jmp instruction_assembled + fisttp_64bit_store: + mov [base_code],0DDh + call store_instruction + jmp instruction_assembled +fbld_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz fbld_mem_80bit + cmp al,10 + je fbld_mem_80bit + jmp invalid_operand_size + fbld_mem_80bit: + mov [base_code],0DFh + call store_instruction + jmp instruction_assembled +faddp_instruction: + mov [postbyte_register],al + mov [base_code],0DEh + mov edx,esi + lods byte [esi] + call get_size_operator + cmp al,10h + je faddp_streg + mov esi,edx + mov bl,1 + call store_nomem_instruction + jmp instruction_assembled + faddp_streg: + lods byte [esi] + call convert_fpu_register + mov bl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + or al,al + jnz invalid_operand + call store_nomem_instruction + jmp instruction_assembled +fcompp_instruction: + mov ax,0D9DEh + stos word [edi] + jmp instruction_assembled +fucompp_instruction: + mov ax,0E9DAh + stos word [edi] + jmp instruction_assembled +fxch_instruction: + mov dx,01D9h + jmp fpu_single_operand +ffreep_instruction: + mov dx,00DFh + jmp fpu_single_operand +ffree_instruction: + mov dl,0DDh + mov dh,al + fpu_single_operand: + mov ebx,esi + lods byte [esi] + call get_size_operator + cmp al,10h + je fpu_streg + or dh,dh + jz invalid_operand + mov esi,ebx + shl dh,3 + or dh,11000001b + mov ax,dx + stos word [edi] + jmp instruction_assembled + fpu_streg: + lods byte [esi] + call convert_fpu_register + shl dh,3 + or dh,al + or dh,11000000b + mov ax,dx + stos word [edi] + jmp instruction_assembled +fstenv_instruction: + mov byte [edi],9Bh + inc edi +fldenv_instruction: + mov [base_code],0D9h + jmp fpu_mem +fsave_instruction: + mov byte [edi],9Bh + inc edi +fnsave_instruction: + mov [base_code],0DDh + fpu_mem: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + jne invalid_operand_size + call store_instruction + jmp instruction_assembled +fstcw_instruction: + mov byte [edi],9Bh + inc edi +fldcw_instruction: + mov [postbyte_register],al + mov [base_code],0D9h + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz fldcw_mem_16bit + cmp al,2 + je fldcw_mem_16bit + jmp invalid_operand_size + fldcw_mem_16bit: + call store_instruction + jmp instruction_assembled +fstsw_instruction: + mov al,9Bh + stos byte [edi] +fnstsw_instruction: + mov [base_code],0DDh + mov [postbyte_register],7 + lods byte [esi] + call get_size_operator + cmp al,10h + je fstsw_reg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz fstsw_mem_16bit + cmp al,2 + je fstsw_mem_16bit + jmp invalid_operand_size + fstsw_mem_16bit: + call store_instruction + jmp instruction_assembled + fstsw_reg: + lods byte [esi] + call convert_register + cmp ax,0200h + jne invalid_operand + mov ax,0E0DFh + stos word [edi] + jmp instruction_assembled +finit_instruction: + mov byte [edi],9Bh + inc edi +fninit_instruction: + mov ah,al + mov al,0DBh + stos word [edi] + jmp instruction_assembled +fcmov_instruction: + mov dh,0DAh + jmp fcomi_streg +fcomi_instruction: + mov dh,0DBh + jmp fcomi_streg +fcomip_instruction: + mov dh,0DFh + fcomi_streg: + mov dl,al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + mov ah,al + cmp byte [esi],',' + je fcomi_st0_streg + add ah,dl + mov al,dh + stos word [edi] + jmp instruction_assembled + fcomi_st0_streg: + or ah,ah + jnz invalid_operand + inc esi + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_fpu_register + mov ah,al + add ah,dl + mov al,dh + stos word [edi] + jmp instruction_assembled + +mmx_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je mmx_mmreg_mmreg + cmp al,'[' + jne invalid_operand + mmx_mmreg_mem: + call get_address + call store_instruction + jmp instruction_assembled + mmx_mmreg_mmreg: + lods byte [esi] + call convert_mmx_register + mov bl,al + call store_nomem_instruction + jmp instruction_assembled +mmx_ps_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je mmx_mmreg_mmreg + cmp al,'(' + je mmx_ps_mmreg_imm8 + cmp al,'[' + je mmx_mmreg_mem + jmp invalid_operand + mmx_ps_mmreg_imm8: + call get_byte_value + mov byte [value],al + test [operand_size],not 1 + jnz invalid_value + mov bl,[extended_code] + mov al,bl + shr bl,4 + and al,1111b + add al,70h + mov [extended_code],al + sub bl,0Ch + shl bl,1 + xchg bl,[postbyte_register] + call store_nomem_instruction + mov al,byte [value] + stos byte [edi] + jmp instruction_assembled +pextrw_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + cmp ah,4 + jnz invalid_operand_size + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + mov bl,al + call make_mmx_prefix + cmp [extended_code],0C5h + je mmx_nomem_imm8 + call store_nomem_instruction + jmp instruction_assembled + mmx_imm8: + push bx cx edx + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + test ah,not 1 + jnz invalid_operand_size + cmp al,'(' + jne invalid_operand + call get_byte_value + mov byte [value],al + pop edx cx bx + call store_instruction_with_imm8 + jmp instruction_assembled + mmx_nomem_imm8: + call store_nomem_instruction + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + test ah,not 1 + jnz invalid_operand_size + cmp al,'(' + jne invalid_operand + call get_byte_value + stosb + jmp instruction_assembled +pinsrw_instruction: + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je pinsrw_mmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je mmx_imm8 + cmp [operand_size],2 + jne invalid_operand_size + jmp mmx_imm8 + pinsrw_mmreg_reg: + lods byte [esi] + call convert_register + cmp ah,4 + jne invalid_operand_size + mov bl,al + jmp mmx_nomem_imm8 +pshufw_instruction: + mov [mmx_size],8 + mov [operand_prefix],al + jmp pshuf_instruction +pshufd_instruction: + mov [mmx_size],16 + mov [operand_prefix],al + pshuf_instruction: + mov [base_code],0Fh + mov [extended_code],70h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,[mmx_size] + jne invalid_operand_size + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je pshuf_mmreg_mmreg + cmp al,'[' + jne invalid_operand + call get_address + jmp mmx_imm8 + pshuf_mmreg_mmreg: + lods byte [esi] + call convert_mmx_register + mov bl,al + jmp mmx_nomem_imm8 +movd_instruction: + mov [base_code],0Fh + mov [extended_code],7Eh + lods byte [esi] + call get_size_operator + cmp al,10h + je movd_reg + cmp al,'[' + jne invalid_operand + call get_address + test [operand_size],not 4 + jnz invalid_operand_size + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + call store_instruction + jmp instruction_assembled + movd_reg: + lods byte [esi] + cmp al,0B0h + jae movd_mmreg + call convert_register + cmp ah,4 + jne invalid_operand_size + mov [operand_size],0 + mov bl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + mov [postbyte_register],al + call make_mmx_prefix + call store_nomem_instruction + jmp instruction_assembled + movd_mmreg: + mov [extended_code],6Eh + call convert_mmx_register + call make_mmx_prefix + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je movd_mmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + test [operand_size],not 4 + jnz invalid_operand_size + call store_instruction + jmp instruction_assembled + movd_mmreg_reg: + lods byte [esi] + call convert_register + cmp ah,4 + jne invalid_operand_size + mov bl,al + call store_nomem_instruction + jmp instruction_assembled + make_mmx_prefix: + cmp [operand_size],16 + jne no_mmx_prefix + mov [operand_prefix],66h + no_mmx_prefix: + ret +movq_instruction: + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + je movq_reg + cmp al,'[' + jne invalid_operand + call get_address + test [operand_size],not 8 + jnz invalid_operand_size + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + mov [postbyte_register],al + cmp ah,16 + je movq_mem_xmmreg + mov [extended_code],7Fh + call store_instruction + jmp instruction_assembled + movq_mem_xmmreg: + mov [extended_code],0D6h + mov [operand_prefix],66h + call store_instruction + jmp instruction_assembled + movq_reg: + lods byte [esi] + cmp al,0B0h + jae movq_mmreg + call convert_register + cmp ah,8 + jne invalid_operand_size + mov [operand_size],0 + mov bl,al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + mov [postbyte_register],al + call make_mmx_prefix + mov [extended_code],7Eh + call operand_64bit + call store_nomem_instruction + jmp instruction_assembled + movq_mmreg: + call convert_mmx_register + mov [postbyte_register],al + mov [extended_code],6Fh + cmp ah,16 + jne movq_mmreg_ + mov [extended_code],7Eh + mov [operand_prefix],0F3h + movq_mmreg_: + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je movq_mmreg_reg + call get_address + test [operand_size],not 8 + jnz invalid_operand_size + call store_instruction + jmp instruction_assembled + movq_mmreg_reg: + lods byte [esi] + cmp al,0B0h + jae movq_mmreg_mmreg + mov [operand_size],0 + call convert_register + cmp ah,8 + jne invalid_operand_size + mov [extended_code],6Eh + mov [operand_prefix],0 + mov bl,al + call make_mmx_prefix + call operand_64bit + call store_nomem_instruction + jmp instruction_assembled + movq_mmreg_mmreg: + call convert_mmx_register + mov bl,al + call store_nomem_instruction + jmp instruction_assembled +movdq_instruction: + mov [operand_prefix],al + mov [base_code],0Fh + mov [extended_code],6Fh + lods byte [esi] + call get_size_operator + cmp al,10h + je movdq_mmreg + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,16 + jne invalid_operand_size + mov [postbyte_register],al + mov [extended_code],7Fh + call store_instruction + jmp instruction_assembled + movdq_mmreg: + lods byte [esi] + call convert_mmx_register + cmp ah,16 + jne invalid_operand_size + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je movdq_mmreg_mmreg + cmp al,'[' + jne invalid_operand + call get_address + call store_instruction + jmp instruction_assembled + movdq_mmreg_mmreg: + lods byte [esi] + call convert_mmx_register + cmp ah,16 + jne invalid_operand_size + mov bl,al + call store_nomem_instruction + jmp instruction_assembled +lddqu_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,16 + jne invalid_operand_size + push eax + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + pop eax + mov [postbyte_register],al + mov [operand_prefix],0F2h + mov [base_code],0Fh + mov [extended_code],0F0h + call store_instruction + jmp instruction_assembled +movq2dq_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,16 + jne invalid_operand_size + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,8 + jne invalid_operand_size + mov bl,al + mov [operand_prefix],0F3h + mov [base_code],0Fh + mov [extended_code],0D6h + call store_nomem_instruction + jmp instruction_assembled +movdq2q_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,8 + jne invalid_operand_size + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,16 + jne invalid_operand_size + mov bl,al + mov [operand_prefix],0F2h + mov [base_code],0Fh + mov [extended_code],0D6h + call store_nomem_instruction + jmp instruction_assembled + +sse_ps_instruction: + mov [mmx_size],16 + jmp sse_instruction +sse_pd_instruction: + mov [mmx_size],16 + mov [operand_prefix],66h + jmp sse_instruction +sse_ss_instruction: + mov [mmx_size],4 + mov [operand_prefix],0F3h + jmp sse_instruction +sse_sd_instruction: + mov [mmx_size],8 + mov [operand_prefix],0F2h + jmp sse_instruction +comiss_instruction: + mov [mmx_size],4 + jmp sse_instruction +comisd_instruction: + mov [mmx_size],8 + mov [operand_prefix],66h + jmp sse_instruction +cvtps2pd_instruction: + mov [mmx_size],8 + jmp sse_instruction +cvtpd2dq_instruction: + mov [mmx_size],16 + mov [operand_prefix],0F2h + jmp sse_instruction +cvtdq2pd_instruction: + mov [mmx_size],16 + mov [operand_prefix],0F3h +sse_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + sse_xmmreg: + lods byte [esi] + call convert_mmx_register + cmp ah,16 + jne invalid_operand_size + sse_reg: + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je sse_xmmreg_xmmreg + sse_reg_mem: + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je sse_mem_size_ok + mov al,[mmx_size] + cmp [operand_size],al + jne invalid_operand_size + sse_mem_size_ok: + cmp [extended_code],0C6h + je mmx_imm8 + call store_instruction + jmp instruction_assembled + sse_xmmreg_xmmreg: + cmp [operand_prefix],66h + jne sse_xmmreg_xmmreg_ok + cmp [extended_code],12h + je invalid_operand + cmp [extended_code],16h + je invalid_operand + sse_xmmreg_xmmreg_ok: + lods byte [esi] + call convert_mmx_register + cmp ah,16 + jne invalid_operand_size + mov bl,al + cmp [extended_code],0C6h + je mmx_nomem_imm8 + call store_nomem_instruction + jmp instruction_assembled +ps_dq_instruction: + mov [postbyte_register],al + mov [operand_prefix],66h + mov [base_code],0Fh + mov [extended_code],73h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,16 + jne invalid_operand_size + mov bl,al + jmp mmx_nomem_imm8 +movpd_instruction: + mov [operand_prefix],66h +movps_instruction: + mov [base_code],0Fh + mov [extended_code],al + mov [mmx_size],16 + jmp sse_mov_instruction +movss_instruction: + mov [mmx_size],4 + mov [operand_prefix],0F3h + jmp sse_movs +movsd_instruction: + mov al,0A5h + mov ah,[esi] + or ah,ah + jz simple_instruction_32bit + cmp ah,0Fh + je simple_instruction_32bit + mov [mmx_size],8 + mov [operand_prefix],0F2h + sse_movs: + mov [base_code],0Fh + mov [extended_code],10h + jmp sse_mov_instruction +sse_mov_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + je sse_xmmreg + sse_mem: + cmp al,'[' + jne invalid_operand + inc [extended_code] + call get_address + cmp [operand_size],0 + je sse_mem_xmmreg + mov al,[mmx_size] + cmp [operand_size],al + jne invalid_operand_size + mov [operand_size],0 + sse_mem_xmmreg: + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,16 + jne invalid_operand_size + mov [postbyte_register],al + call store_instruction + jmp instruction_assembled +movlpd_instruction: + mov [operand_prefix],66h +movlps_instruction: + mov [base_code],0Fh + mov [extended_code],al + mov [mmx_size],8 + lods byte [esi] + call get_size_operator + cmp al,10h + jne sse_mem + lods byte [esi] + call convert_mmx_register + cmp ah,16 + jne invalid_operand_size + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + jmp sse_reg_mem +movhlps_instruction: + mov [base_code],0Fh + mov [extended_code],al + mov [mmx_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,16 + jne invalid_operand_size + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je sse_xmmreg_xmmreg_ok + jmp invalid_operand +maskmovq_instruction: + mov cl,8 + jmp maskmov_instruction +maskmovdqu_instruction: + mov cl,16 + mov [operand_prefix],66h + maskmov_instruction: + mov [base_code],0Fh + mov [extended_code],0F7h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,cl + jne invalid_operand_size + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + mov bl,al + call store_nomem_instruction + jmp instruction_assembled +movmskpd_instruction: + mov [operand_prefix],66h +movmskps_instruction: + mov [base_code],0Fh + mov [extended_code],50h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + cmp ah,4 + jne invalid_operand_size + mov [operand_size],0 + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,16 + jne invalid_operand_size + mov bl,al + call store_nomem_instruction + jmp instruction_assembled +cmppd_instruction: + mov [operand_prefix],66h +cmpps_instruction: + mov [base_code],0Fh + mov [extended_code],0C2h + mov [mmx_size],16 + mov byte [value],-1 + jmp sse_cmp_instruction +cmp_pd_instruction: + mov [operand_prefix],66h +cmp_ps_instruction: + mov [base_code],0Fh + mov [extended_code],0C2h + mov [mmx_size],16 + mov byte [value],al + jmp sse_cmp_instruction +cmpss_instruction: + mov [mmx_size],4 + mov [operand_prefix],0F3h + jmp cmpsx_instruction +cmpsd_instruction: + mov al,0A7h + mov ah,[esi] + or ah,ah + jz simple_instruction_32bit + cmp ah,0Fh + je simple_instruction_32bit + mov [mmx_size],8 + mov [operand_prefix],0F2h + cmpsx_instruction: + mov [base_code],0Fh + mov [extended_code],0C2h + mov byte [value],-1 + jmp sse_cmp_instruction +cmp_ss_instruction: + mov [mmx_size],4 + mov [operand_prefix],0F3h + jmp cmp_sx_instruction +cmp_sd_instruction: + mov [mmx_size],8 + mov [operand_prefix],0F2h + cmp_sx_instruction: + mov [base_code],0Fh + mov [extended_code],0C2h + mov byte [value],al +sse_cmp_instruction: + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,16 + jne invalid_operand_size + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + mov [operand_size],0 + lods byte [esi] + call get_size_operator + cmp al,10h + je sse_cmp_xmmreg_xmmreg + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz sse_cmp_size_ok + cmp al,[mmx_size] + jne invalid_operand_size + sse_cmp_size_ok: + push bx cx edx + call get_nextbyte + pop edx cx bx + call store_instruction_with_imm8 + jmp instruction_assembled + sse_cmp_xmmreg_xmmreg: + lods byte [esi] + call convert_mmx_register + cmp ah,16 + jne invalid_operand_size + mov bl,al + call store_nomem_instruction + call get_nextbyte + mov al,byte [value] + stos byte [edi] + jmp instruction_assembled + get_nextbyte: + cmp byte [value],-1 + jne nextbyte_ok + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + test [operand_size],not 1 + jnz invalid_value + cmp al,'(' + jne invalid_operand + call get_byte_value + cmp al,7 + ja invalid_value + mov byte [value],al + nextbyte_ok: + ret +cvtpi2pd_instruction: + mov [operand_prefix],66h +cvtpi2ps_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,16 + jne invalid_operand_size + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je cvtpi_xmmreg_xmmreg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je cvtpi_size_ok + cmp [operand_size],8 + jne invalid_operand_size + cvtpi_size_ok: + call store_instruction + jmp instruction_assembled + cvtpi_xmmreg_xmmreg: + lods byte [esi] + call convert_mmx_register + cmp ah,8 + jne invalid_operand_size + mov bl,al + call store_nomem_instruction + jmp instruction_assembled +cvtsi2ss_instruction: + mov [operand_prefix],0F3h + jmp cvtsi_instruction +cvtsi2sd_instruction: + mov [operand_prefix],0F2h + cvtsi_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,16 + jne invalid_operand_size + mov [postbyte_register],al + mov [operand_size],0 + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je cvtsi_xmmreg_reg + cmp al,'[' + jne invalid_operand + call get_address + cmp [operand_size],0 + je cvtsi_size_ok + cmp [operand_size],4 + jne invalid_operand_size + cvtsi_size_ok: + call store_instruction + jmp instruction_assembled + cvtsi_xmmreg_reg: + lods byte [esi] + call convert_register + cmp ah,4 + je cvtsi_xmmreg_reg_store + cmp ah,8 + jne invalid_operand_size + call operand_64bit + cvtsi_xmmreg_reg_store: + mov bl,al + call store_nomem_instruction + jmp instruction_assembled +cvtps2pi_instruction: + mov [mmx_size],8 + jmp cvtpd_instruction +cvtpd2pi_instruction: + mov [operand_prefix],66h + mov [mmx_size],16 + cvtpd_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,8 + jne invalid_operand_size + mov [operand_size],0 + jmp sse_reg +cvtss2si_instruction: + mov [operand_prefix],0F3h + mov [mmx_size],4 + jmp cvt2si_instruction +cvtsd2si_instruction: + mov [operand_prefix],0F2h + mov [mmx_size],8 + cvt2si_instruction: + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [operand_size],0 + cmp ah,4 + je sse_reg + cmp ah,8 + jne invalid_operand_size + call operand_64bit + jmp sse_reg +amd3dnow_instruction: + mov [base_code],0Fh + mov [extended_code],0Fh + mov byte [value],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,8 + jne invalid_operand_size + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + je amd3dnow_mmreg_mmreg + cmp al,'[' + jne invalid_operand + call get_address + call store_instruction_with_imm8 + jmp instruction_assembled + amd3dnow_mmreg_mmreg: + lods byte [esi] + call convert_mmx_register + cmp ah,8 + jne invalid_operand_size + mov bl,al + call store_nomem_instruction + mov al,byte [value] + stos byte [edi] + jmp instruction_assembled + +fxsave_instruction: + mov [extended_code],0AEh + mov [base_code],0Fh + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov ah,[operand_size] + or ah,ah + jz fxsave_size_ok + mov al,[postbyte_register] + cmp al,111b + je clflush_size_check + cmp al,10b + jb invalid_operand_size + cmp al,11b + ja invalid_operand_size + cmp ah,4 + jne invalid_operand_size + jmp fxsave_size_ok + clflush_size_check: + cmp ah,1 + jne invalid_operand_size + fxsave_size_ok: + call store_instruction + jmp instruction_assembled +prefetch_instruction: + mov [extended_code],18h + prefetch_mem_8bit: + mov [base_code],0Fh + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + or ah,ah + jz prefetch_size_ok + cmp ah,1 + jne invalid_operand_size + prefetch_size_ok: + call get_address + call store_instruction + jmp instruction_assembled +amd_prefetch_instruction: + mov [extended_code],0Dh + jmp prefetch_mem_8bit +fence_instruction: + mov bl,al + mov ax,0AE0Fh + stos word [edi] + mov al,bl + stos byte [edi] + jmp instruction_assembled +pause_instruction: + mov ax,90F3h + stos word [edi] + jmp instruction_assembled +movntq_instruction: + mov [mmx_size],8 + jmp movnt_instruction +movntps_instruction: + mov [mmx_size],16 + jmp movnt_instruction +movntdq_instruction: + mov [operand_prefix],66h + mov [mmx_size],16 + movnt_instruction: + mov [extended_code],al + mov [base_code],0Fh + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_mmx_register + cmp ah,[mmx_size] + jne invalid_operand_size + mov [postbyte_register],al + call store_instruction + jmp instruction_assembled +movnti_instruction: + mov [base_code],0Fh + mov [extended_code],al + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + cmp ah,4 + je movnti_store + cmp ah,8 + jne invalid_operand_size + call operand_64bit + movnti_store: + mov [postbyte_register],al + call store_instruction + jmp instruction_assembled +monitor_instruction: + mov [postbyte_register],al + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + cmp ax,0400h + jne invalid_operand + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + cmp ax,0401h + jne invalid_operand + cmp [postbyte_register],0C8h + jne monitor_instruction_store + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + cmp ax,0402h + jne invalid_operand + monitor_instruction_store: + mov ax,010Fh + stos word [edi] + mov al,[postbyte_register] + stos byte [edi] + jmp instruction_assembled + +simple_vmx_instruction: + mov ah,al + mov al,0Fh + stos byte [edi] + mov al,1 + stos word [edi] + jmp instruction_assembled +vmclear_instruction: + mov [operand_prefix],66h + jmp vmx_instruction +vmxon_instruction: + mov [operand_prefix],0F3h +vmx_instruction: + mov [postbyte_register],al + mov [extended_code],0C7h + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + mov al,[operand_size] + or al,al + jz vmx_size_ok + cmp al,8 + jne invalid_operand_size + vmx_size_ok: + mov [base_code],0Fh + call store_instruction + jmp instruction_assembled +vmread_instruction: + mov [extended_code],78h + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + vmread_check_size: + cmp [code_type],64 + je vmread_long + cmp [operand_size],4 + je vmx_size_ok + jmp invalid_operand_size + vmread_long: + cmp [operand_size],8 + je vmx_size_ok + jmp invalid_operand_size +vmwrite_instruction: + mov [extended_code],79h + lods byte [esi] + call get_size_operator + cmp al,10h + jne invalid_operand + lods byte [esi] + call convert_register + mov [postbyte_register],al + lods byte [esi] + cmp al,',' + jne invalid_operand + lods byte [esi] + call get_size_operator + cmp al,'[' + jne invalid_operand + call get_address + jmp vmread_check_size + +convert_register: + mov ah,al + shr ah,4 + and al,0Fh + cmp ah,8 + je match_register_size + cmp ah,4 + ja invalid_operand + cmp ah,1 + ja match_register_size + cmp al,4 + jb match_register_size + or ah,ah + jz high_byte_register + or [rex_prefix],40h + match_register_size: + cmp ah,[operand_size] + je register_size_ok + cmp [operand_size],0 + jne operand_sizes_do_not_match + mov [operand_size],ah + register_size_ok: + ret + high_byte_register: + mov ah,1 + or [rex_prefix],80h + jmp match_register_size +convert_fpu_register: + mov ah,al + shr ah,4 + and al,111b + cmp ah,10 + jne invalid_operand + jmp match_register_size +convert_mmx_register: + mov ah,al + shr ah,4 + cmp ah,0Ch + je xmm_register + ja invalid_operand + and al,111b + cmp ah,0Bh + jne invalid_operand + mov ah,8 + jmp match_register_size + xmm_register: + and al,0Fh + mov ah,16 + cmp al,8 + jb match_register_size + cmp [code_type],64 + jne invalid_operand + jmp match_register_size +get_size_operator: + xor ah,ah + cmp al,11h + jne no_size_operator + mov [size_declared],1 + lods word [esi] + xchg al,ah + mov [size_override],1 + cmp ah,[operand_size] + je size_operator_ok + cmp [operand_size],0 + jne operand_sizes_do_not_match + mov [operand_size],ah + size_operator_ok: + ret + no_size_operator: + mov [size_declared],0 + cmp al,'[' + jne size_operator_ok + mov [size_override],0 + ret +get_jump_operator: + mov [jump_type],0 + cmp al,12h + jne jump_operator_ok + lods word [esi] + mov [jump_type],al + mov al,ah + jump_operator_ok: + ret +get_address: + mov [segment_register],0 + mov [address_size],0 + mov al,[code_type] + shr al,3 + mov [value_size],al + mov al,[esi] + and al,11110000b + cmp al,60h + jne get_size_prefix + lods byte [esi] + sub al,60h + mov [segment_register],al + mov al,[esi] + and al,11110000b + get_size_prefix: + cmp al,70h + jne address_size_prefix_ok + lods byte [esi] + sub al,70h + cmp al,2 + jb invalid_address_size + cmp al,8 + ja invalid_address_size + mov [address_size],al + mov [value_size],al + address_size_prefix_ok: + call calculate_address + mov [address_high],edx + mov edx,eax + cmp [code_type],64 + jne address_ok + or bx,bx + jnz address_ok + test ch,0Fh + jnz address_ok + calculate_relative_address: + call calculate_relative_offset + mov [address_high],edx + mov edx,[symbol_identifier] + mov [address_symbol],edx + mov edx,eax + mov ch,[value_type] + mov bx,0FF00h + xor cl,cl + address_ok: + ret + +operand_16bit: + cmp [code_type],16 + je size_prefix_ok + mov [operand_prefix],66h + ret +operand_32bit: + cmp [code_type],16 + jne size_prefix_ok + mov [operand_prefix],66h + size_prefix_ok: + ret +operand_64bit: + cmp [code_type],64 + jne invalid_operand_size + or [rex_prefix],48h + ret +operand_autodetect: + cmp al,2 + je operand_16bit + cmp al,4 + je operand_32bit + cmp al,8 + je operand_64bit + jmp invalid_operand_size +store_segment_prefix_if_necessary: + mov al,[segment_register] + or al,al + jz segment_prefix_ok + cmp al,3 + je ss_prefix + cmp al,4 + ja segment_prefix_386 + jb segment_prefix_86 + cmp bl,25h + je segment_prefix_86 + cmp bh,25h + je segment_prefix_86 + cmp bh,45h + je segment_prefix_86 + cmp bh,44h + je segment_prefix_86 + ret + ss_prefix: + cmp bl,25h + je segment_prefix_ok + cmp bh,25h + je segment_prefix_ok + cmp bh,45h + je segment_prefix_ok + cmp bh,44h + je segment_prefix_ok + jmp segment_prefix_86 +store_segment_prefix: + mov al,[segment_register] + or al,al + jz segment_prefix_ok + cmp al,5 + jae segment_prefix_386 + segment_prefix_86: + dec al + shl al,3 + add al,26h + stos byte [edi] + jmp segment_prefix_ok + segment_prefix_386: + add al,64h-5 + stos byte [edi] + segment_prefix_ok: + ret +store_instruction_code: + mov al,[operand_prefix] + or al,al + jz operand_prefix_ok + stos byte [edi] + operand_prefix_ok: + mov al,[rex_prefix] + test al,40h + jz rex_prefix_ok + cmp [code_type],64 + jne invalid_operand + test al,0B0h + jnz prefix_conflict + stos byte [edi] + rex_prefix_ok: + mov al,[base_code] + stos byte [edi] + cmp al,0Fh + jne instruction_code_ok + store_extended_code: + mov al,[extended_code] + stos byte [edi] + instruction_code_ok: + ret +store_nomem_instruction: + test [postbyte_register],1000b + jz nomem_reg_code_ok + or [rex_prefix],44h + and [postbyte_register],111b + nomem_reg_code_ok: + test bl,1000b + jz nomem_rm_code_ok + or [rex_prefix],41h + and bl,111b + nomem_rm_code_ok: + call store_instruction_code + mov al,[postbyte_register] + shl al,3 + or al,bl + or al,11000000b + stos byte [edi] + ret +store_instruction: + mov [current_offset],edi + test [postbyte_register],1000b + jz reg_code_ok + or [rex_prefix],44h + and [postbyte_register],111b + reg_code_ok: + call store_segment_prefix_if_necessary + or bx,bx + jz address_immediate + cmp bx,0F000h + je address_rip_based + cmp bx,0FF00h + je address_relative + mov al,bl + or al,bh + and al,11110000b + cmp al,80h + je postbyte_64bit + cmp al,40h + je postbyte_32bit + cmp al,20h + jne invalid_address + cmp [code_type],64 + je invalid_address_size + call address_16bit_prefix + call store_instruction_code + cmp bx,2326h + je address_bx_si + cmp bx,2623h + je address_bx_si + cmp bx,2327h + je address_bx_di + cmp bx,2723h + je address_bx_di + cmp bx,2526h + je address_bp_si + cmp bx,2625h + je address_bp_si + cmp bx,2527h + je address_bp_di + cmp bx,2725h + je address_bp_di + cmp bx,2600h + je address_si + cmp bx,2700h + je address_di + cmp bx,2300h + je address_bx + cmp bx,2500h + je address_bp + jmp invalid_address + address_bx_si: + xor al,al + jmp postbyte_16bit + address_bx_di: + mov al,1 + jmp postbyte_16bit + address_bp_si: + mov al,10b + jmp postbyte_16bit + address_bp_di: + mov al,11b + jmp postbyte_16bit + address_si: + mov al,100b + jmp postbyte_16bit + address_di: + mov al,101b + jmp postbyte_16bit + address_bx: + mov al,111b + jmp postbyte_16bit + address_bp: + mov al,110b + postbyte_16bit: + test ch,22h + jnz address_16bit_value + or ch,ch + jnz address_sizes_do_not_agree + cmp edx,10000h + jge value_out_of_range + cmp edx,-8000h + jl value_out_of_range + or dx,dx + jz address + cmp dx,80h + jb address_8bit_value + cmp dx,-80h + jae address_8bit_value + address_16bit_value: + or al,10000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + mov eax,edx + stos word [edi] + ret + address_8bit_value: + or al,01000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + mov al,dl + stos byte [edi] + cmp dx,80h + jge value_out_of_range + cmp dx,-80h + jl value_out_of_range + ret + address: + cmp al,110b + je address_8bit_value + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + ret + postbyte_32bit: + call address_32bit_prefix + call store_instruction_code + cmp bl,44h + je invalid_address + or cl,cl + jz only_base_register + jmp base_and_index + postbyte_64bit: + cmp [code_type],64 + jne invalid_address_size + test bh,1000b + jz base_code_ok + or [rex_prefix],41h + base_code_ok: + test bl,1000b + jz index_code_ok + or [rex_prefix],42h + index_code_ok: + call store_instruction_code + or cl,cl + jz only_base_register + base_and_index: + mov al,100b + xor ah,ah + cmp cl,1 + je scale_ok + cmp cl,2 + je scale_1 + cmp cl,4 + je scale_2 + or ah,11000000b + jmp scale_ok + scale_2: + or ah,10000000b + jmp scale_ok + scale_1: + or ah,01000000b + scale_ok: + or bh,bh + jz only_index_register + and bl,111b + shl bl,3 + or ah,bl + and bh,111b + or ah,bh + test ch,44h + jnz sib_address_32bit_value + or ch,ch + jnz address_sizes_do_not_agree + cmp bh,5 + je address_value + or edx,edx + jz sib_address + address_value: + cmp edx,80h + jb sib_address_8bit_value + cmp edx,-80h + jae sib_address_8bit_value + sib_address_32bit_value: + or al,10000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + jmp store_address_32bit_value + sib_address_8bit_value: + or al,01000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + mov al,dl + stos byte [edi] + cmp edx,80h + jge value_out_of_range + cmp edx,-80h + jl value_out_of_range + ret + sib_address: + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + ret + only_index_register: + or ah,101b + and bl,111b + shl bl,3 + or ah,bl + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + test ch,44h + jnz store_address_32bit_value + or ch,ch + jnz invalid_address_size + jmp store_address_32bit_value + zero_index_register: + mov bl,4 + mov cl,1 + jmp base_and_index + only_base_register: + mov al,bh + and al,111b + cmp al,4 + je zero_index_register + test ch,44h + jnz simple_address_32bit_value + or ch,ch + jnz address_sizes_do_not_agree + or edx,edx + jz simple_address + cmp edx,80h + jb simple_address_8bit_value + cmp edx,-80h + jae simple_address_8bit_value + simple_address_32bit_value: + or al,10000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + jmp store_address_32bit_value + simple_address_8bit_value: + or al,01000000b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + mov al,dl + stos byte [edi] + cmp edx,80h + jge value_out_of_range + cmp edx,-80h + jl value_out_of_range + ret + simple_address: + cmp al,5 + je simple_address_8bit_value + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + ret + address_immediate: + cmp [code_type],64 + je address_immediate_sib + test ch,44h + jnz address_immediate_32bit + test ch,22h + jnz address_immediate_16bit + or ch,ch + jnz invalid_address_size + cmp [code_type],16 + je addressing_16bit + address_immediate_32bit: + call address_32bit_prefix + call store_instruction_code + store_immediate_address: + mov al,101b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + store_address_32bit_value: + test ch,0F0h + jz address_32bit_relocation_ok + mov al,2 + xchg [value_type],al + mov ebx,[address_symbol] + xchg ebx,[symbol_identifier] + call mark_relocation + mov [value_type],al + mov [symbol_identifier],ebx + address_32bit_relocation_ok: + mov eax,edx + stos dword [edi] + ret + store_address_64bit_value: + test ch,0F0h + jz address_64bit_relocation_ok + mov al,4 + xchg [value_type],al + mov ebx,[address_symbol] + xchg ebx,[symbol_identifier] + call mark_relocation + mov [value_type],al + mov [symbol_identifier],ebx + address_64bit_relocation_ok: + mov eax,edx + stos dword [edi] + mov eax,[address_high] + stos dword [edi] + ret + address_immediate_sib: + test ch,not 44h + jnz invalid_address_size + call address_32bit_prefix + call store_instruction_code + mov al,100b + mov ah,100101b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos word [edi] + jmp store_address_32bit_value + address_rip_based: + cmp [code_type],64 + jne invalid_address + call store_instruction_code + jmp store_immediate_address + address_relative: + call store_instruction_code + movzx eax,[immediate_size] + add eax,edi + sub eax,[current_offset] + add eax,5 + sub edx,eax + jo value_out_of_range + mov al,101b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + xchg [value_type],ch + mov ebx,[address_symbol] + xchg ebx,[symbol_identifier] + mov eax,edx + call mark_relocation + mov [value_type],ch + mov [symbol_identifier],ebx + stos dword [edi] + ret + addressing_16bit: + cmp edx,10000h + jge address_immediate_32bit + cmp edx,-8000h + jl address_immediate_32bit + movzx edx,dx + address_immediate_16bit: + call address_16bit_prefix + call store_instruction_code + mov al,110b + mov cl,[postbyte_register] + shl cl,3 + or al,cl + stos byte [edi] + mov eax,edx + stos word [edi] + cmp edx,10000h + jge value_out_of_range + cmp edx,-8000h + jl value_out_of_range + ret + address_16bit_prefix: + cmp [code_type],16 + je instruction_prefix_ok + mov al,67h + stos byte [edi] + ret + address_32bit_prefix: + cmp [code_type],32 + je instruction_prefix_ok + mov al,67h + stos byte [edi] + instruction_prefix_ok: + ret +store_instruction_with_imm8: + mov [immediate_size],1 + call store_instruction + mov al,byte [value] + stos byte [edi] + ret +store_instruction_with_imm16: + mov [immediate_size],2 + call store_instruction + mov ax,word [value] + call mark_relocation + stos word [edi] + ret +store_instruction_with_imm32: + mov [immediate_size],4 + call store_instruction + mov eax,dword [value] + call mark_relocation + stos dword [edi] + ret + +address_registers: + db 2,'bp',0,25h + db 2,'bx',0,23h + db 2,'di',0,27h + db 3,'eax',0,40h + db 3,'ebp',0,45h + db 3,'ebx',0,43h + db 3,'ecx',0,41h + db 3,'edi',0,47h + db 3,'edx',0,42h + db 3,'esi',0,46h + db 3,'esp',0,44h + db 3,'r10',10h,8Ah + db 3,'r11',10h,8Bh + db 3,'r12',10h,8Ch + db 3,'r13',10h,8Dh + db 3,'r14',10h,8Eh + db 3,'r15',10h,8Fh + db 2,'r8',10h,88h + db 2,'r9',10h,89h + db 3,'rax',0,80h + db 3,'rbp',0,85h + db 3,'rbx',0,83h + db 3,'rcx',0,81h + db 3,'rdi',0,87h + db 3,'rdx',0,82h + db 3,'rip',0,0F0h + db 3,'rsi',0,86h + db 3,'rsp',0,84h + db 2,'si',0,26h + db 0 + +address_sizes: + db 4,'byte',0,1 + db 5,'dword',0,4 + db 5,'qword',0,8 + db 4,'word',0,2 + db 0 + +symbols: + db 2,'ah',10h,04h + db 2,'al',10h,10h + db 2,'ax',10h,20h + db 2,'bh',10h,07h + db 2,'bl',10h,13h + db 2,'bp',10h,25h + db 3,'bpl',10h,15h + db 2,'bx',10h,23h + db 4,'byte',11h,1 + db 2,'ch',10h,05h + db 2,'cl',10h,11h + db 3,'cr0',10h,50h + db 3,'cr1',10h,51h + db 3,'cr2',10h,52h + db 3,'cr3',10h,53h + db 3,'cr4',10h,54h + db 3,'cr5',10h,55h + db 3,'cr6',10h,56h + db 3,'cr7',10h,57h + db 3,'cr8',10h,58h + db 3,'cr9',10h,59h + db 4,'cr10',10h,5Ah + db 4,'cr11',10h,5Bh + db 4,'cr12',10h,5Ch + db 4,'cr13',10h,5Dh + db 4,'cr14',10h,5Eh + db 4,'cr15',10h,5Fh + db 2,'cs',10h,62h + db 2,'cx',10h,21h + db 2,'dh',10h,06h + db 2,'di',10h,27h + db 3,'dil',10h,17h + db 2,'dl',10h,12h + db 6,'dqword',11h,16 + db 3,'dr0',10h,70h + db 3,'dr1',10h,71h + db 3,'dr2',10h,72h + db 3,'dr3',10h,73h + db 3,'dr4',10h,74h + db 3,'dr5',10h,75h + db 3,'dr6',10h,76h + db 3,'dr7',10h,77h + db 3,'dr8',10h,78h + db 3,'dr9',10h,79h + db 4,'dr10',10h,7Ah + db 4,'dr11',10h,7Bh + db 4,'dr12',10h,7Ch + db 4,'dr13',10h,7Dh + db 4,'dr14',10h,7Eh + db 4,'dr15',10h,7Fh + db 2,'ds',10h,64h + db 5,'dword',11h,4 + db 2,'dx',10h,22h + db 3,'eax',10h,40h + db 3,'ebp',10h,45h + db 3,'ebx',10h,43h + db 3,'ecx',10h,41h + db 3,'edi',10h,47h + db 3,'edx',10h,42h + db 2,'es',10h,61h + db 3,'esi',10h,46h + db 3,'esp',10h,44h + db 3,'far',12h,2 + db 2,'fs',10h,65h + db 5,'fword',11h,6 + db 2,'gs',10h,66h + db 3,'mm0',10h,0B0h + db 3,'mm1',10h,0B1h + db 3,'mm2',10h,0B2h + db 3,'mm3',10h,0B3h + db 3,'mm4',10h,0B4h + db 3,'mm5',10h,0B5h + db 3,'mm6',10h,0B6h + db 3,'mm7',10h,0B7h + db 4,'near',12h,1 + db 5,'pword',11h,6 + db 5,'qword',11h,8 + db 3,'r10',10h,8Ah + db 4,'r10b',10h,1Ah + db 4,'r10d',10h,4Ah + db 4,'r10w',10h,2Ah + db 3,'r11',10h,8Bh + db 4,'r11b',10h,1Bh + db 4,'r11d',10h,4Bh + db 4,'r11w',10h,2Bh + db 3,'r12',10h,8Ch + db 4,'r12b',10h,1Ch + db 4,'r12d',10h,4Ch + db 4,'r12w',10h,2Ch + db 3,'r13',10h,8Dh + db 4,'r13b',10h,1Dh + db 4,'r13d',10h,4Dh + db 4,'r13w',10h,2Dh + db 3,'r14',10h,8Eh + db 4,'r14b',10h,1Eh + db 4,'r14d',10h,4Eh + db 4,'r14w',10h,2Eh + db 3,'r15',10h,8Fh + db 4,'r15b',10h,1Fh + db 4,'r15d',10h,4Fh + db 4,'r15w',10h,2Fh + db 2,'r8',10h,88h + db 3,'r8b',10h,18h + db 3,'r8d',10h,48h + db 3,'r8w',10h,28h + db 2,'r9',10h,89h + db 3,'r9b',10h,19h + db 3,'r9d',10h,49h + db 3,'r9w',10h,29h + db 3,'rax',10h,80h + db 3,'rbp',10h,85h + db 3,'rbx',10h,83h + db 3,'rcx',10h,81h + db 3,'rdi',10h,87h + db 3,'rdx',10h,82h + db 3,'rsi',10h,86h + db 3,'rsp',10h,84h + db 2,'si',10h,26h + db 3,'sil',10h,16h + db 2,'sp',10h,24h + db 3,'spl',10h,14h + db 2,'ss',10h,63h + db 2,'st',10h,0A0h + db 3,'st0',10h,0A0h + db 3,'st1',10h,0A1h + db 3,'st2',10h,0A2h + db 3,'st3',10h,0A3h + db 3,'st4',10h,0A4h + db 3,'st5',10h,0A5h + db 3,'st6',10h,0A6h + db 3,'st7',10h,0A7h + db 5,'tbyte',11h,0Ah + db 3,'tr0',10h,90h + db 3,'tr1',10h,91h + db 3,'tr2',10h,92h + db 3,'tr3',10h,93h + db 3,'tr4',10h,94h + db 3,'tr5',10h,95h + db 3,'tr6',10h,96h + db 3,'tr7',10h,97h + db 5,'tword',11h,0Ah + db 5,'use16',13h,16 + db 5,'use32',13h,32 + db 5,'use64',13h,64 + db 4,'word',11h,2 + db 4,'xmm0',10h,0C0h + db 4,'xmm1',10h,0C1h + db 5,'xmm10',10h,0CAh + db 5,'xmm11',10h,0CBh + db 5,'xmm12',10h,0CCh + db 5,'xmm13',10h,0CDh + db 5,'xmm14',10h,0CEh + db 5,'xmm15',10h,0CFh + db 4,'xmm2',10h,0C2h + db 4,'xmm3',10h,0C3h + db 4,'xmm4',10h,0C4h + db 4,'xmm5',10h,0C5h + db 4,'xmm6',10h,0C6h + db 4,'xmm7',10h,0C7h + db 4,'xmm8',10h,0C8h + db 4,'xmm9',10h,0C9h + db 0 + +data_handlers: + dw data_bytes-assembler + dw data_file-assembler + dw reserve_bytes-assembler + dw data_words-assembler + dw data_unicode-assembler + dw reserve_words-assembler + dw data_dwords-assembler + dw reserve_dwords-assembler + dw data_pwords-assembler + dw reserve_pwords-assembler + dw data_qwords-assembler + dw reserve_qwords-assembler + dw data_twords-assembler + dw reserve_twords-assembler + +data_directives: + db 2,'db',1,0 + db 2,'dd',4,6 + db 2,'df',6,8 + db 2,'dp',6,8 + db 2,'dq',8,10 + db 2,'dt',10,12 + db 2,'du',2,4 + db 2,'dw',2,3 + db 4,'file',1,1 + db 2,'rb',1,2 + db 2,'rd',4,7 + db 2,'rf',6,9 + db 2,'rp',6,9 + db 2,'rq',8,11 + db 2,'rt',10,13 + db 2,'rw',2,5 + db 0 + +instructions: + dw instructions_2-instructions + dw instructions_3-instructions + dw instructions_4-instructions + dw instructions_5-instructions + dw instructions_6-instructions + dw instructions_7-instructions + dw instructions_8-instructions + dw instructions_9-instructions + dw instructions_10-instructions + dw instructions_11-instructions + +instructions_2: + db 'bt',4 + dw bt_instruction-assembler + db 'if',0 + dw if_directive-assembler + db 'in',0 + dw in_instruction-assembler + db 'ja',77h + dw conditional_jump-assembler + db 'jb',72h + dw conditional_jump-assembler + db 'jc',72h + dw conditional_jump-assembler + db 'je',74h + dw conditional_jump-assembler + db 'jg',7Fh + dw conditional_jump-assembler + db 'jl',7Ch + dw conditional_jump-assembler + db 'jo',70h + dw conditional_jump-assembler + db 'jp',7Ah + dw conditional_jump-assembler + db 'js',78h + dw conditional_jump-assembler + db 'jz',74h + dw conditional_jump-assembler + db 'or',08h + dw basic_instruction-assembler + db 0 +instructions_3: + db 'aaa',37h + dw simple_instruction_except64-assembler + db 'aad',0D5h + dw aa_instruction-assembler + db 'aam',0D4h + dw aa_instruction-assembler + db 'aas',3Fh + dw simple_instruction_except64-assembler + db 'adc',10h + dw basic_instruction-assembler + db 'add',00h + dw basic_instruction-assembler + db 'and',20h + dw basic_instruction-assembler + db 'bsf',0BCh + dw bs_instruction-assembler + db 'bsr',0BDh + dw bs_instruction-assembler + db 'btc',7 + dw bt_instruction-assembler + db 'btr',6 + dw bt_instruction-assembler + db 'bts',5 + dw bt_instruction-assembler + db 'cbw',98h + dw simple_instruction_16bit-assembler + db 'cdq',99h + dw simple_instruction_32bit-assembler + db 'clc',0F8h + dw simple_instruction-assembler + db 'cld',0FCh + dw simple_instruction-assembler + db 'cli',0FAh + dw simple_instruction-assembler + db 'cmc',0F5h + dw simple_instruction-assembler + db 'cmp',38h + dw basic_instruction-assembler + db 'cqo',99h + dw simple_instruction_64bit-assembler + db 'cwd',99h + dw simple_instruction_16bit-assembler + db 'daa',27h + dw simple_instruction_except64-assembler + db 'das',2Fh + dw simple_instruction_except64-assembler + db 'dec',1 + dw inc_instruction-assembler + db 'div',6 + dw single_operand_instruction-assembler + db 'end',0 + dw end_directive-assembler + db 'fld',0 + dw fld_instruction-assembler + db 'fst',2 + dw fld_instruction-assembler + db 'hlt',0F4h + dw simple_instruction-assembler + db 'inc',0 + dw inc_instruction-assembler + db 'ins',6Ch + dw ins_instruction-assembler + db 'int',0CDh + dw int_instruction-assembler + db 'jae',73h + dw conditional_jump-assembler + db 'jbe',76h + dw conditional_jump-assembler + db 'jge',7Dh + dw conditional_jump-assembler + db 'jle',7Eh + dw conditional_jump-assembler + db 'jmp',0 + dw jmp_instruction-assembler + db 'jna',76h + dw conditional_jump-assembler + db 'jnb',73h + dw conditional_jump-assembler + db 'jnc',73h + dw conditional_jump-assembler + db 'jne',75h + dw conditional_jump-assembler + db 'jng',7Eh + dw conditional_jump-assembler + db 'jnl',7Dh + dw conditional_jump-assembler + db 'jno',71h + dw conditional_jump-assembler + db 'jnp',7Bh + dw conditional_jump-assembler + db 'jns',79h + dw conditional_jump-assembler + db 'jnz',75h + dw conditional_jump-assembler + db 'jpe',7Ah + dw conditional_jump-assembler + db 'jpo',7Bh + dw conditional_jump-assembler + db 'lar',2 + dw lar_instruction-assembler + db 'lds',3 + dw ls_instruction-assembler + db 'lea',0 + dw lea_instruction-assembler + db 'les',0 + dw ls_instruction-assembler + db 'lfs',4 + dw ls_instruction-assembler + db 'lgs',5 + dw ls_instruction-assembler + db 'lsl',3 + dw lar_instruction-assembler + db 'lss',2 + dw ls_instruction-assembler + db 'ltr',3 + dw pm_word_instruction-assembler + db 'mov',0 + dw mov_instruction-assembler + db 'mul',4 + dw single_operand_instruction-assembler + db 'neg',3 + dw single_operand_instruction-assembler + db 'nop',90h + dw simple_instruction-assembler + db 'not',2 + dw single_operand_instruction-assembler + db 'org',0 + dw org_directive-assembler + db 'out',0 + dw out_instruction-assembler + db 'pop',0 + dw pop_instruction-assembler + db 'por',0EBh + dw mmx_instruction-assembler + db 'rcl',2 + dw sh_instruction-assembler + db 'rcr',3 + dw sh_instruction-assembler + db 'rep',0F3h + dw prefix_instruction-assembler + db 'ret',0C2h + dw ret_instruction-assembler + db 'rol',0 + dw sh_instruction-assembler + db 'ror',1 + dw sh_instruction-assembler + db 'rsm',0AAh + dw simple_extended_instruction-assembler + db 'sal',4 + dw sh_instruction-assembler + db 'sar',7 + dw sh_instruction-assembler + db 'sbb',18h + dw basic_instruction-assembler + db 'shl',4 + dw sh_instruction-assembler + db 'shr',5 + dw sh_instruction-assembler + db 'stc',0F9h + dw simple_instruction-assembler + db 'std',0FDh + dw simple_instruction-assembler + db 'sti',0FBh + dw simple_instruction-assembler + db 'str',1 + dw pm_store_word_instruction-assembler + db 'sub',28h + dw basic_instruction-assembler + db 'ud2',0Bh + dw simple_extended_instruction-assembler + db 'xor',30h + dw basic_instruction-assembler + db 0 +instructions_4: + db 'arpl',0 + dw arpl_instruction-assembler + db 'call',0 + dw call_instruction-assembler + db 'cdqe',98h + dw simple_instruction_64bit-assembler + db 'clts',6 + dw simple_extended_instruction-assembler + db 'cmps',0A6h + dw cmps_instruction-assembler + db 'cwde',98h + dw simple_instruction_32bit-assembler + db 'data',0 + dw data_directive-assembler + db 'else',0 + dw else_directive-assembler + db 'emms',77h + dw simple_extended_instruction-assembler + db 'fabs',100001b + dw simple_fpu_instruction-assembler + db 'fadd',0 + dw basic_fpu_instruction-assembler + db 'fbld',4 + dw fbld_instruction-assembler + db 'fchs',100000b + dw simple_fpu_instruction-assembler + db 'fcom',2 + dw basic_fpu_instruction-assembler + db 'fcos',111111b + dw simple_fpu_instruction-assembler + db 'fdiv',6 + dw basic_fpu_instruction-assembler + db 'feni',0E0h + dw finit_instruction-assembler + db 'fild',0 + dw fild_instruction-assembler + db 'fist',2 + dw fild_instruction-assembler + db 'fld1',101000b + dw simple_fpu_instruction-assembler + db 'fldz',101110b + dw simple_fpu_instruction-assembler + db 'fmul',1 + dw basic_fpu_instruction-assembler + db 'fnop',010000b + dw simple_fpu_instruction-assembler + db 'fsin',111110b + dw simple_fpu_instruction-assembler + db 'fstp',3 + dw fld_instruction-assembler + db 'fsub',4 + dw basic_fpu_instruction-assembler + db 'ftst',100100b + dw simple_fpu_instruction-assembler + db 'fxam',100101b + dw simple_fpu_instruction-assembler + db 'fxch',0 + dw fxch_instruction-assembler + db 'heap',0 + dw heap_directive-assembler + db 'idiv',7 + dw single_operand_instruction-assembler + db 'imul',0 + dw imul_instruction-assembler + db 'insb',6Ch + dw simple_instruction-assembler + db 'insd',6Dh + dw simple_instruction_32bit-assembler + db 'insw',6Dh + dw simple_instruction_16bit-assembler + db 'int1',0F1h + dw simple_instruction-assembler + db 'int3',0CCh + dw simple_instruction-assembler + db 'into',0CEh + dw simple_instruction_except64-assembler + db 'invd',8 + dw simple_extended_instruction-assembler + db 'iret',0CFh + dw iret_instruction-assembler + db 'jcxz',0E3h + dw loop_instruction_16bit-assembler + db 'jnae',72h + dw conditional_jump-assembler + db 'jnbe',77h + dw conditional_jump-assembler + db 'jnge',7Ch + dw conditional_jump-assembler + db 'jnle',7Fh + dw conditional_jump-assembler + db 'lahf',9Fh + dw simple_instruction_except64-assembler + db 'lgdt',2 + dw lgdt_instruction-assembler + db 'lidt',3 + dw lgdt_instruction-assembler + db 'lldt',2 + dw pm_word_instruction-assembler + db 'lmsw',16h + dw pm_word_instruction-assembler + db 'load',0 + dw load_directive-assembler + db 'lock',0F0h + dw prefix_instruction-assembler + db 'lods',0ACh + dw lods_instruction-assembler + db 'loop',0E2h + dw loop_instruction-assembler + db 'movd',0 + dw movd_instruction-assembler + db 'movq',0 + dw movq_instruction-assembler + db 'movs',0A4h + dw movs_instruction-assembler + db 'orpd',56h + dw sse_pd_instruction-assembler + db 'orps',56h + dw sse_ps_instruction-assembler + db 'outs',6Eh + dw outs_instruction-assembler + db 'pand',0DBh + dw mmx_instruction-assembler + db 'popa',61h + dw simple_instruction_except64-assembler + db 'popd',4 + dw pop_instruction-assembler + db 'popf',9Dh + dw simple_instruction-assembler + db 'popq',8 + dw pop_instruction-assembler + db 'popw',2 + dw pop_instruction-assembler + db 'push',0 + dw push_instruction-assembler + db 'pxor',0EFh + dw mmx_instruction-assembler + db 'repe',0F3h + dw prefix_instruction-assembler + db 'repz',0F3h + dw prefix_instruction-assembler + db 'retd',0C2h + dw ret_instruction_32bit_except64-assembler + db 'retf',0CAh + dw retf_instruction-assembler + db 'retn',0C2h + dw ret_instruction-assembler + db 'retq',0C2h + dw ret_instruction_only64-assembler + db 'retw',0C2h + dw ret_instruction_16bit-assembler + db 'sahf',9Eh + dw simple_instruction_except64-assembler + db 'salc',0D6h + dw simple_instruction_except64-assembler + db 'scas',0AEh + dw stos_instruction-assembler + db 'seta',97h + dw set_instruction-assembler + db 'setb',92h + dw set_instruction-assembler + db 'setc',92h + dw set_instruction-assembler + db 'sete',94h + dw set_instruction-assembler + db 'setg',9Fh + dw set_instruction-assembler + db 'setl',9Ch + dw set_instruction-assembler + db 'seto',90h + dw set_instruction-assembler + db 'setp',9Ah + dw set_instruction-assembler + db 'sets',98h + dw set_instruction-assembler + db 'setz',94h + dw set_instruction-assembler + db 'sgdt',0 + dw lgdt_instruction-assembler + db 'shld',0A4h + dw shd_instruction-assembler + db 'shrd',0ACh + dw shd_instruction-assembler + db 'sidt',1 + dw lgdt_instruction-assembler + db 'sldt',0 + dw pm_store_word_instruction-assembler + db 'smsw',14h + dw pm_store_word_instruction-assembler + db 'stos',0AAh + dw stos_instruction-assembler + db 'test',0 + dw test_instruction-assembler + db 'verr',4 + dw pm_word_instruction-assembler + db 'verw',5 + dw pm_word_instruction-assembler + db 'wait',9Bh + dw simple_instruction-assembler + db 'xadd',0C0h + dw basic_486_instruction-assembler + db 'xchg',0 + dw xchg_instruction-assembler + db 'xlat',0D7h + dw xlat_instruction-assembler + db 0 +instructions_5: + db 'addpd',58h + dw sse_pd_instruction-assembler + db 'addps',58h + dw sse_ps_instruction-assembler + db 'addsd',58h + dw sse_sd_instruction-assembler + db 'addss',58h + dw sse_ss_instruction-assembler + db 'align',0 + dw align_directive-assembler + db 'andpd',54h + dw sse_pd_instruction-assembler + db 'andps',54h + dw sse_ps_instruction-assembler + db 'bound',0 + dw bound_instruction-assembler + db 'break',0 + dw break_directive-assembler + db 'bswap',0 + dw bswap_instruction-assembler + db 'cmova',47h + dw cmov_instruction-assembler + db 'cmovb',42h + dw cmov_instruction-assembler + db 'cmovc',42h + dw cmov_instruction-assembler + db 'cmove',44h + dw cmov_instruction-assembler + db 'cmovg',4Fh + dw cmov_instruction-assembler + db 'cmovl',4Ch + dw cmov_instruction-assembler + db 'cmovo',40h + dw cmov_instruction-assembler + db 'cmovp',4Ah + dw cmov_instruction-assembler + db 'cmovs',48h + dw cmov_instruction-assembler + db 'cmovz',44h + dw cmov_instruction-assembler + db 'cmppd',0 + dw cmppd_instruction-assembler + db 'cmpps',0 + dw cmpps_instruction-assembler + db 'cmpsb',0A6h + dw simple_instruction-assembler + db 'cmpsd',0 + dw cmpsd_instruction-assembler + db 'cmpsq',0 + dw simple_instruction_64bit-assembler + db 'cmpss',0 + dw cmpss_instruction-assembler + db 'cmpsw',0A7h + dw simple_instruction_16bit-assembler + db 'cpuid',0A2h + dw simple_extended_instruction-assembler + db 'divpd',5Eh + dw sse_pd_instruction-assembler + db 'divps',5Eh + dw sse_ps_instruction-assembler + db 'divsd',5Eh + dw sse_sd_instruction-assembler + db 'divss',5Eh + dw sse_ss_instruction-assembler + db 'enter',0 + dw enter_instruction-assembler + db 'entry',0 + dw entry_directive-assembler + db 'extrn',0 + dw extrn_directive-assembler + db 'f2xm1',110000b + dw simple_fpu_instruction-assembler + db 'faddp',0 + dw faddp_instruction-assembler + db 'fbstp',6 + dw fbld_instruction-assembler + db 'fclex',0E2h + dw finit_instruction-assembler + db 'fcomi',0F0h + dw fcomi_instruction-assembler + db 'fcomp',3 + dw basic_fpu_instruction-assembler + db 'fdisi',0E1h + dw finit_instruction-assembler + db 'fdivp',7 + dw faddp_instruction-assembler + db 'fdivr',7 + dw basic_fpu_instruction-assembler + db 'femms',0Eh + dw simple_extended_instruction-assembler + db 'ffree',0 + dw ffree_instruction-assembler + db 'fiadd',0 + dw fi_instruction-assembler + db 'ficom',2 + dw fi_instruction-assembler + db 'fidiv',6 + dw fi_instruction-assembler + db 'fimul',1 + dw fi_instruction-assembler + db 'finit',0E3h + dw finit_instruction-assembler + db 'fistp',3 + dw fild_instruction-assembler + db 'fisub',4 + dw fi_instruction-assembler + db 'fldcw',5 + dw fldcw_instruction-assembler + db 'fldpi',101011b + dw simple_fpu_instruction-assembler + db 'fmulp',1 + dw faddp_instruction-assembler + db 'fneni',0E0h + dw fninit_instruction-assembler + db 'fprem',111000b + dw simple_fpu_instruction-assembler + db 'fptan',110010b + dw simple_fpu_instruction-assembler + db 'fsave',6 + dw fsave_instruction-assembler + db 'fsqrt',111010b + dw simple_fpu_instruction-assembler + db 'fstcw',7 + dw fstcw_instruction-assembler + db 'fstsw',0 + dw fstsw_instruction-assembler + db 'fsubp',5 + dw faddp_instruction-assembler + db 'fsubr',5 + dw basic_fpu_instruction-assembler + db 'fucom',4 + dw ffree_instruction-assembler + db 'fwait',9Bh + dw simple_instruction-assembler + db 'fyl2x',110001b + dw simple_fpu_instruction-assembler + db 'iretd',0CFh + dw simple_instruction_32bit-assembler + db 'iretq',0CFh + dw simple_instruction_64bit-assembler + db 'iretw',0CFh + dw simple_instruction_16bit-assembler + db 'jecxz',0E3h + dw loop_instruction_32bit-assembler + db 'jrcxz',0E3h + dw loop_instruction_64bit-assembler + db 'label',0 + dw label_directive-assembler + db 'lddqu',0 + dw lddqu_instruction-assembler + db 'leave',0C9h + dw simple_instruction-assembler + db 'lodsb',0ACh + dw simple_instruction-assembler + db 'lodsd',0ADh + dw simple_instruction_32bit-assembler + db 'lodsq',0ADh + dw simple_instruction_64bit-assembler + db 'lodsw',0ADh + dw simple_instruction_16bit-assembler + db 'loopd',0E2h + dw loop_instruction_32bit-assembler + db 'loope',0E1h + dw loop_instruction-assembler + db 'loopq',0E2h + dw loop_instruction_64bit-assembler + db 'loopw',0E2h + dw loop_instruction_16bit-assembler + db 'loopz',0E1h + dw loop_instruction-assembler + db 'maxpd',5Fh + dw sse_pd_instruction-assembler + db 'maxps',5Fh + dw sse_ps_instruction-assembler + db 'maxsd',5Fh + dw sse_sd_instruction-assembler + db 'maxss',5Fh + dw sse_ss_instruction-assembler + db 'minpd',5Dh + dw sse_pd_instruction-assembler + db 'minps',5Dh + dw sse_ps_instruction-assembler + db 'minsd',5Dh + dw sse_sd_instruction-assembler + db 'minss',5Dh + dw sse_ss_instruction-assembler + db 'movsb',0A4h + dw simple_instruction-assembler + db 'movsd',0 + dw movsd_instruction-assembler + db 'movsq',0A5h + dw simple_instruction_64bit-assembler + db 'movss',0 + dw movss_instruction-assembler + db 'movsw',0A5h + dw simple_instruction_16bit-assembler + db 'movsx',0BEh + dw movx_instruction-assembler + db 'movzx',0B6h + dw movx_instruction-assembler + db 'mulpd',59h + dw sse_pd_instruction-assembler + db 'mulps',59h + dw sse_ps_instruction-assembler + db 'mulsd',59h + dw sse_sd_instruction-assembler + db 'mulss',59h + dw sse_ss_instruction-assembler + db 'mwait',0C9h + dw monitor_instruction-assembler + db 'outsb',6Eh + dw simple_instruction-assembler + db 'outsd',6Fh + dw simple_instruction_32bit-assembler + db 'outsw',6Fh + dw simple_instruction_16bit-assembler + db 'paddb',0FCh + dw mmx_instruction-assembler + db 'paddd',0FEh + dw mmx_instruction-assembler + db 'paddq',0D4h + dw mmx_instruction-assembler + db 'paddw',0FDh + dw mmx_instruction-assembler + db 'pandn',0DFh + dw mmx_instruction-assembler + db 'pause',0 + dw pause_instruction-assembler + db 'pavgb',0E0h + dw mmx_instruction-assembler + db 'pavgw',0E3h + dw mmx_instruction-assembler + db 'pf2id',1Dh + dw amd3dnow_instruction-assembler + db 'pf2iw',1Ch + dw amd3dnow_instruction-assembler + db 'pfacc',0AEh + dw amd3dnow_instruction-assembler + db 'pfadd',9Eh + dw amd3dnow_instruction-assembler + db 'pfmax',0A4h + dw amd3dnow_instruction-assembler + db 'pfmin',94h + dw amd3dnow_instruction-assembler + db 'pfmul',0B4h + dw amd3dnow_instruction-assembler + db 'pfrcp',96h + dw amd3dnow_instruction-assembler + db 'pfsub',9Ah + dw amd3dnow_instruction-assembler + db 'pi2fd',0Dh + dw amd3dnow_instruction-assembler + db 'pi2fw',0Ch + dw amd3dnow_instruction-assembler + db 'popad',61h + dw simple_instruction_32bit_except64-assembler + db 'popaw',61h + dw simple_instruction_16bit_except64-assembler + db 'popfd',9Dh + dw simple_instruction_32bit_except64-assembler + db 'popfw',9Dh + dw simple_instruction_16bit-assembler + db 'popfq',9Dh + dw simple_instruction_only64-assembler + db 'pslld',0F2h + dw mmx_ps_instruction-assembler + db 'psllq',0F3h + dw mmx_ps_instruction-assembler + db 'psllw',0F1h + dw mmx_ps_instruction-assembler + db 'psrad',0E2h + dw mmx_ps_instruction-assembler + db 'psraw',0E1h + dw mmx_ps_instruction-assembler + db 'psrld',0D2h + dw mmx_ps_instruction-assembler + db 'psrlq',0D3h + dw mmx_ps_instruction-assembler + db 'psrlw',0D1h + dw mmx_ps_instruction-assembler + db 'psubb',0F8h + dw mmx_instruction-assembler + db 'psubd',0FAh + dw mmx_instruction-assembler + db 'psubq',0FBh + dw mmx_instruction-assembler + db 'psubw',0F9h + dw mmx_instruction-assembler + db 'pusha',60h + dw simple_instruction_except64-assembler + db 'pushd',4 + dw push_instruction-assembler + db 'pushf',9Ch + dw simple_instruction-assembler + db 'pushq',8 + dw push_instruction-assembler + db 'pushw',2 + dw push_instruction-assembler + db 'rcpps',53h + dw sse_ps_instruction-assembler + db 'rcpss',53h + dw sse_ss_instruction-assembler + db 'rdmsr',32h + dw simple_extended_instruction-assembler + db 'rdpmc',33h + dw simple_extended_instruction-assembler + db 'rdtsc',31h + dw simple_extended_instruction-assembler + db 'repne',0F2h + dw prefix_instruction-assembler + db 'repnz',0F2h + dw prefix_instruction-assembler + db 'retfd',0CAh + dw ret_instruction_32bit-assembler + db 'retfq',0CAh + dw ret_instruction_64bit-assembler + db 'retfw',0CAh + dw ret_instruction_16bit-assembler + db 'retnd',0C2h + dw ret_instruction_32bit_except64-assembler + db 'retnq',0C2h + dw ret_instruction_only64-assembler + db 'retnw',0C2h + dw ret_instruction_16bit-assembler + db 'scasb',0AEh + dw simple_instruction-assembler + db 'scasd',0AFh + dw simple_instruction_32bit-assembler + db 'scasq',0AFh + dw simple_instruction_64bit-assembler + db 'scasw',0AFh + dw simple_instruction_16bit-assembler + db 'setae',93h + dw set_instruction-assembler + db 'setbe',96h + dw set_instruction-assembler + db 'setge',9Dh + dw set_instruction-assembler + db 'setle',9Eh + dw set_instruction-assembler + db 'setna',96h + dw set_instruction-assembler + db 'setnb',93h + dw set_instruction-assembler + db 'setnc',93h + dw set_instruction-assembler + db 'setne',95h + dw set_instruction-assembler + db 'setng',9Eh + dw set_instruction-assembler + db 'setnl',9Dh + dw set_instruction-assembler + db 'setno',91h + dw set_instruction-assembler + db 'setnp',9Bh + dw set_instruction-assembler + db 'setns',99h + dw set_instruction-assembler + db 'setnz',95h + dw set_instruction-assembler + db 'setpe',9Ah + dw set_instruction-assembler + db 'setpo',9Bh + dw set_instruction-assembler + db 'stack',0 + dw stack_directive-assembler + db 'store',0 + dw store_directive-assembler + db 'stosb',0AAh + dw simple_instruction-assembler + db 'stosd',0ABh + dw simple_instruction_32bit-assembler + db 'stosq',0ABh + dw simple_instruction_64bit-assembler + db 'stosw',0ABh + dw simple_instruction_16bit-assembler + db 'subpd',5Ch + dw sse_pd_instruction-assembler + db 'subps',5Ch + dw sse_ps_instruction-assembler + db 'subsd',5Ch + dw sse_sd_instruction-assembler + db 'subss',5Ch + dw sse_ss_instruction-assembler + db 'times',0 + dw times_directive-assembler + db 'vmxon',6 + dw vmxon_instruction-assembler + db 'while',0 + dw while_directive-assembler + db 'wrmsr',30h + dw simple_extended_instruction-assembler + db 'xlatb',0D7h + dw simple_instruction-assembler + db 'xorpd',57h + dw sse_pd_instruction-assembler + db 'xorps',57h + dw sse_ps_instruction-assembler + db 0 +instructions_6: + db 'andnpd',55h + dw sse_pd_instruction-assembler + db 'andnps',55h + dw sse_ps_instruction-assembler + db 'cmovae',43h + dw cmov_instruction-assembler + db 'cmovbe',46h + dw cmov_instruction-assembler + db 'cmovge',4Dh + dw cmov_instruction-assembler + db 'cmovle',4Eh + dw cmov_instruction-assembler + db 'cmovna',46h + dw cmov_instruction-assembler + db 'cmovnb',43h + dw cmov_instruction-assembler + db 'cmovnc',43h + dw cmov_instruction-assembler + db 'cmovne',45h + dw cmov_instruction-assembler + db 'cmovng',4Eh + dw cmov_instruction-assembler + db 'cmovnl',4Dh + dw cmov_instruction-assembler + db 'cmovno',41h + dw cmov_instruction-assembler + db 'cmovnp',4Bh + dw cmov_instruction-assembler + db 'cmovns',49h + dw cmov_instruction-assembler + db 'cmovnz',45h + dw cmov_instruction-assembler + db 'cmovpe',4Ah + dw cmov_instruction-assembler + db 'cmovpo',4Bh + dw cmov_instruction-assembler + db 'comisd',2Fh + dw comisd_instruction-assembler + db 'comiss',2Fh + dw comiss_instruction-assembler + db 'fcmovb',0C0h + dw fcmov_instruction-assembler + db 'fcmove',0C8h + dw fcmov_instruction-assembler + db 'fcmovu',0D8h + dw fcmov_instruction-assembler + db 'fcomip',0F0h + dw fcomip_instruction-assembler + db 'fcompp',0 + dw fcompp_instruction-assembler + db 'fdivrp',6 + dw faddp_instruction-assembler + db 'ffreep',0 + dw ffreep_instruction-assembler + db 'ficomp',3 + dw fi_instruction-assembler + db 'fidivr',7 + dw fi_instruction-assembler + db 'fisttp',1 + dw fild_instruction-assembler + db 'fisubr',5 + dw fi_instruction-assembler + db 'fldenv',4 + dw fldenv_instruction-assembler + db 'fldl2e',101010b + dw simple_fpu_instruction-assembler + db 'fldl2t',101001b + dw simple_fpu_instruction-assembler + db 'fldlg2',101100b + dw simple_fpu_instruction-assembler + db 'fldln2',101101b + dw simple_fpu_instruction-assembler + db 'fnclex',0E2h + dw fninit_instruction-assembler + db 'fndisi',0E1h + dw fninit_instruction-assembler + db 'fninit',0E3h + dw fninit_instruction-assembler + db 'fnsave',6 + dw fnsave_instruction-assembler + db 'fnstcw',7 + dw fldcw_instruction-assembler + db 'fnstsw',0 + dw fnstsw_instruction-assembler + db 'format',0 + dw format_directive-assembler + db 'fpatan',110011b + dw simple_fpu_instruction-assembler + db 'fprem1',110101b + dw simple_fpu_instruction-assembler + db 'frstor',4 + dw fnsave_instruction-assembler + db 'frstpm',0E5h + dw fninit_instruction-assembler + db 'fscale',111101b + dw simple_fpu_instruction-assembler + db 'fsetpm',0E4h + dw fninit_instruction-assembler + db 'fstenv',6 + dw fstenv_instruction-assembler + db 'fsubrp',4 + dw faddp_instruction-assembler + db 'fucomi',0E8h + dw fcomi_instruction-assembler + db 'fucomp',5 + dw ffree_instruction-assembler + db 'fxsave',0 + dw fxsave_instruction-assembler + db 'haddpd',07Ch + dw sse_pd_instruction-assembler + db 'haddps',07Ch + dw cvtpd2dq_instruction-assembler + db 'hsubpd',07Dh + dw sse_pd_instruction-assembler + db 'hsubps',07Dh + dw cvtpd2dq_instruction-assembler + db 'invlpg',0 + dw invlpg_instruction-assembler + db 'lfence',0E8h + dw fence_instruction-assembler + db 'looped',0E1h + dw loop_instruction_32bit-assembler + db 'loopeq',0E1h + dw loop_instruction_64bit-assembler + db 'loopew',0E1h + dw loop_instruction_16bit-assembler + db 'loopne',0E0h + dw loop_instruction-assembler + db 'loopnz',0E0h + dw loop_instruction-assembler + db 'loopzd',0E1h + dw loop_instruction_32bit-assembler + db 'loopzq',0E1h + dw loop_instruction_64bit-assembler + db 'loopzw',0E1h + dw loop_instruction_16bit-assembler + db 'mfence',0F0h + dw fence_instruction-assembler + db 'movapd',28h + dw movpd_instruction-assembler + db 'movaps',28h + dw movps_instruction-assembler + db 'movdqa',66h + dw movdq_instruction-assembler + db 'movdqu',0F3h + dw movdq_instruction-assembler + db 'movhpd',16h + dw movlpd_instruction-assembler + db 'movhps',16h + dw movlps_instruction-assembler + db 'movlpd',12h + dw movlpd_instruction-assembler + db 'movlps',12h + dw movlps_instruction-assembler + db 'movnti',0C3h + dw movnti_instruction-assembler + db 'movntq',0E7h + dw movntq_instruction-assembler + db 'movsxd',63h + dw movsxd_instruction-assembler + db 'movupd',10h + dw movpd_instruction-assembler + db 'movups',10h + dw movps_instruction-assembler + db 'paddsb',0ECh + dw mmx_instruction-assembler + db 'paddsw',0EDh + dw mmx_instruction-assembler + db 'pextrw',0C5h + dw pextrw_instruction-assembler + db 'pfnacc',8Ah + dw amd3dnow_instruction-assembler + db 'pfsubr',0AAh + dw amd3dnow_instruction-assembler + db 'pinsrw',0C4h + dw pinsrw_instruction-assembler + db 'pmaxsw',0EEh + dw mmx_instruction-assembler + db 'pmaxub',0DEh + dw mmx_instruction-assembler + db 'pminsw',0EAh + dw mmx_instruction-assembler + db 'pminub',0DAh + dw mmx_instruction-assembler + db 'pmulhw',0E5h + dw mmx_instruction-assembler + db 'pmullw',0D5h + dw mmx_instruction-assembler + db 'psadbw',0F6h + dw mmx_instruction-assembler + db 'pshufd',66h + dw pshufd_instruction-assembler + db 'pshufw',0 + dw pshufw_instruction-assembler + db 'pslldq',111b + dw ps_dq_instruction-assembler + db 'psrldq',011b + dw ps_dq_instruction-assembler + db 'psubsb',0E8h + dw mmx_instruction-assembler + db 'psubsw',0E9h + dw mmx_instruction-assembler + db 'pswapd',0BBh + dw amd3dnow_instruction-assembler + db 'public',0 + dw public_directive-assembler + db 'pushad',60h + dw simple_instruction_32bit_except64-assembler + db 'pushaw',60h + dw simple_instruction_16bit_except64-assembler + db 'pushfd',9Ch + dw simple_instruction_32bit_except64-assembler + db 'pushfq',9Ch + dw simple_instruction_only64-assembler + db 'pushfw',9Ch + dw simple_instruction_16bit-assembler + db 'rdtscp',1 + dw swapgs_instruction-assembler + db 'repeat',0 + dw repeat_directive-assembler + db 'setalc',0D6h + dw simple_instruction_except64-assembler + db 'setnae',92h + dw set_instruction-assembler + db 'setnbe',97h + dw set_instruction-assembler + db 'setnge',9Ch + dw set_instruction-assembler + db 'setnle',9Fh + dw set_instruction-assembler + db 'sfence',0F8h + dw fence_instruction-assembler + db 'shufpd',0C6h + dw sse_pd_instruction-assembler + db 'shufps',0C6h + dw sse_ps_instruction-assembler + db 'sqrtpd',51h + dw sse_pd_instruction-assembler + db 'sqrtps',51h + dw sse_ps_instruction-assembler + db 'sqrtsd',51h + dw sse_sd_instruction-assembler + db 'sqrtss',51h + dw sse_ss_instruction-assembler + db 'sysret',07h + dw simple_extended_instruction-assembler + db 'swapgs',0 + dw swapgs_instruction-assembler + db 'vmcall',0C1h + dw simple_vmx_instruction-assembler + db 'vmread',0 + dw vmread_instruction-assembler + db 'vmxoff',0C4h + dw simple_vmx_instruction-assembler + db 'wbinvd',9 + dw simple_extended_instruction-assembler + db 0 +instructions_7: + db 'clflush',111b + dw fxsave_instruction-assembler + db 'cmovnae',42h + dw cmov_instruction-assembler + db 'cmovnbe',47h + dw cmov_instruction-assembler + db 'cmovnge',4Ch + dw cmov_instruction-assembler + db 'cmovnle',4Fh + dw cmov_instruction-assembler + db 'cmpeqpd',0 + dw cmp_pd_instruction-assembler + db 'cmpeqps',0 + dw cmp_ps_instruction-assembler + db 'cmpeqsd',0 + dw cmp_sd_instruction-assembler + db 'cmpeqss',0 + dw cmp_ss_instruction-assembler + db 'cmplepd',2 + dw cmp_pd_instruction-assembler + db 'cmpleps',2 + dw cmp_ps_instruction-assembler + db 'cmplesd',2 + dw cmp_sd_instruction-assembler + db 'cmpless',2 + dw cmp_ss_instruction-assembler + db 'cmpltpd',1 + dw cmp_pd_instruction-assembler + db 'cmpltps',1 + dw cmp_ps_instruction-assembler + db 'cmpltsd',1 + dw cmp_sd_instruction-assembler + db 'cmpltss',1 + dw cmp_ss_instruction-assembler + db 'cmpxchg',0B0h + dw basic_486_instruction-assembler + db 'display',0 + dw display_directive-assembler + db 'fcmovbe',0D0h + dw fcmov_instruction-assembler + db 'fcmovnb',0C0h + dw fcomi_instruction-assembler + db 'fcmovne',0C8h + dw fcomi_instruction-assembler + db 'fcmovnu',0D8h + dw fcomi_instruction-assembler + db 'fdecstp',110110b + dw simple_fpu_instruction-assembler + db 'fincstp',110111b + dw simple_fpu_instruction-assembler + db 'fnstenv',6 + dw fldenv_instruction-assembler + db 'frndint',111100b + dw simple_fpu_instruction-assembler + db 'fsincos',111011b + dw simple_fpu_instruction-assembler + db 'fucomip',0E8h + dw fcomip_instruction-assembler + db 'fucompp',0 + dw fucompp_instruction-assembler + db 'fxrstor',1 + dw fxsave_instruction-assembler + db 'fxtract',110100b + dw simple_fpu_instruction-assembler + db 'fyl2xp1',111001b + dw simple_fpu_instruction-assembler + db 'ldmxcsr',10b + dw fxsave_instruction-assembler + db 'loopned',0E0h + dw loop_instruction_32bit-assembler + db 'loopneq',0E0h + dw loop_instruction_64bit-assembler + db 'loopnew',0E0h + dw loop_instruction_16bit-assembler + db 'loopnzd',0E0h + dw loop_instruction_32bit-assembler + db 'loopnzq',0E0h + dw loop_instruction_64bit-assembler + db 'loopnzw',0E0h + dw loop_instruction_16bit-assembler + db 'monitor',0C8h + dw monitor_instruction-assembler + db 'movddup',12h + dw sse_sd_instruction-assembler + db 'movdq2q',0 + dw movdq2q_instruction-assembler + db 'movhlps',12h + dw movhlps_instruction-assembler + db 'movlhps',16h + dw movhlps_instruction-assembler + db 'movntdq',0E7h + dw movntdq_instruction-assembler + db 'movntpd',2Bh + dw movntdq_instruction-assembler + db 'movntps',2Bh + dw movntps_instruction-assembler + db 'movq2dq',0 + dw movq2dq_instruction-assembler + db 'paddusb',0DCh + dw mmx_instruction-assembler + db 'paddusw',0DDh + dw mmx_instruction-assembler + db 'pavgusb',0BFh + dw amd3dnow_instruction-assembler + db 'pcmpeqb',74h + dw mmx_instruction-assembler + db 'pcmpeqd',76h + dw mmx_instruction-assembler + db 'pcmpeqw',75h + dw mmx_instruction-assembler + db 'pcmpgtb',64h + dw mmx_instruction-assembler + db 'pcmpgtd',66h + dw mmx_instruction-assembler + db 'pcmpgtw',65h + dw mmx_instruction-assembler + db 'pfcmpeq',0B0h + dw amd3dnow_instruction-assembler + db 'pfcmpge',90h + dw amd3dnow_instruction-assembler + db 'pfcmpgt',0A0h + dw amd3dnow_instruction-assembler + db 'pfpnacc',8Eh + dw amd3dnow_instruction-assembler + db 'pfrsqrt',97h + dw amd3dnow_instruction-assembler + db 'pmaddwd',0F5h + dw mmx_instruction-assembler + db 'pmulhrw',0B7h + dw amd3dnow_instruction-assembler + db 'pmulhuw',0E4h + dw mmx_instruction-assembler + db 'pmuludq',0F4h + dw mmx_instruction-assembler + db 'pshufhw',0F3h + dw pshufd_instruction-assembler + db 'pshuflw',0F2h + dw pshufd_instruction-assembler + db 'psubusb',0D8h + dw mmx_instruction-assembler + db 'psubusw',0D9h + dw mmx_instruction-assembler + db 'rsqrtps',52h + dw sse_ps_instruction-assembler + db 'rsqrtss',52h + dw sse_ss_instruction-assembler + db 'section',0 + dw section_directive-assembler + db 'segment',0 + dw segment_directive-assembler + db 'stmxcsr',11b + dw fxsave_instruction-assembler + db 'syscall',05h + dw simple_extended_instruction-assembler + db 'sysexit',35h + dw simple_extended_instruction-assembler + db 'ucomisd',2Eh + dw comisd_instruction-assembler + db 'ucomiss',2Eh + dw comiss_instruction-assembler + db 'virtual',0 + dw virtual_directive-assembler + db 'vmclear',6 + dw vmclear_instruction-assembler + db 'vmptrld',6 + dw vmx_instruction-assembler + db 'vmptrst',7 + dw vmx_instruction-assembler + db 'vmwrite',0 + dw vmwrite_instruction-assembler + db 0 +instructions_8: + db 'addsubpd',0D0h + dw sse_pd_instruction-assembler + db 'addsubps',0D0h + dw cvtpd2dq_instruction-assembler + db 'cmpneqpd',4 + dw cmp_pd_instruction-assembler + db 'cmpneqps',4 + dw cmp_ps_instruction-assembler + db 'cmpneqsd',4 + dw cmp_sd_instruction-assembler + db 'cmpneqss',4 + dw cmp_ss_instruction-assembler + db 'cmpnlepd',6 + dw cmp_pd_instruction-assembler + db 'cmpnleps',6 + dw cmp_ps_instruction-assembler + db 'cmpnlesd',6 + dw cmp_sd_instruction-assembler + db 'cmpnless',6 + dw cmp_ss_instruction-assembler + db 'cmpnltpd',5 + dw cmp_pd_instruction-assembler + db 'cmpnltps',5 + dw cmp_ps_instruction-assembler + db 'cmpnltsd',5 + dw cmp_sd_instruction-assembler + db 'cmpnltss',5 + dw cmp_ss_instruction-assembler + db 'cmpordpd',7 + dw cmp_pd_instruction-assembler + db 'cmpordps',7 + dw cmp_ps_instruction-assembler + db 'cmpordsd',7 + dw cmp_sd_instruction-assembler + db 'cmpordss',7 + dw cmp_ss_instruction-assembler + db 'cvtdq2pd',0E6h + dw cvtdq2pd_instruction-assembler + db 'cvtdq2ps',5Bh + dw sse_ps_instruction-assembler + db 'cvtpd2dq',0E6h + dw cvtpd2dq_instruction-assembler + db 'cvtpd2pi',2Dh + dw cvtpd2pi_instruction-assembler + db 'cvtpd2ps',5Ah + dw sse_pd_instruction-assembler + db 'cvtpi2pd',2Ah + dw cvtpi2pd_instruction-assembler + db 'cvtpi2ps',2Ah + dw cvtpi2ps_instruction-assembler + db 'cvtps2dq',5Bh + dw sse_pd_instruction-assembler + db 'cvtps2pd',5Ah + dw cvtps2pd_instruction-assembler + db 'cvtps2pi',2Dh + dw cvtps2pi_instruction-assembler + db 'cvtsd2si',2Dh + dw cvtsd2si_instruction-assembler + db 'cvtsd2ss',5Ah + dw sse_sd_instruction-assembler + db 'cvtsi2sd',2Ah + dw cvtsi2sd_instruction-assembler + db 'cvtsi2ss',2Ah + dw cvtsi2ss_instruction-assembler + db 'cvtss2sd',5Ah + dw sse_ss_instruction-assembler + db 'cvtss2si',2Dh + dw cvtss2si_instruction-assembler + db 'fcmovnbe',0D0h + dw fcomi_instruction-assembler + db 'maskmovq',0 + dw maskmovq_instruction-assembler + db 'movmskpd',0 + dw movmskpd_instruction-assembler + db 'movmskps',0 + dw movmskps_instruction-assembler + db 'movshdup',16h + dw cvtdq2pd_instruction-assembler + db 'movsldup',12h + dw cvtdq2pd_instruction-assembler + db 'packssdw',6Bh + dw mmx_instruction-assembler + db 'packsswb',63h + dw mmx_instruction-assembler + db 'packuswb',67h + dw mmx_instruction-assembler + db 'pfrcpit1',0A6h + dw amd3dnow_instruction-assembler + db 'pfrcpit2',0B6h + dw amd3dnow_instruction-assembler + db 'pfrsqit1',0A7h + dw amd3dnow_instruction-assembler + db 'pmovmskb',0D7h + dw pextrw_instruction-assembler + db 'prefetch',0 + dw amd_prefetch_instruction-assembler + db 'sysenter',34h + dw simple_extended_instruction-assembler + db 'unpckhpd',15h + dw sse_pd_instruction-assembler + db 'unpckhps',15h + dw sse_ps_instruction-assembler + db 'unpcklpd',14h + dw sse_pd_instruction-assembler + db 'unpcklps',14h + dw sse_ps_instruction-assembler + db 'vmlaunch',0C2h + dw simple_vmx_instruction-assembler + db 'vmresume',0C3h + dw simple_vmx_instruction-assembler + db 0 +instructions_9: + db 'cmpxchg8b',8 + dw cmpxchgx_instruction-assembler + db 'cvttpd2dq',0E6h + dw sse_pd_instruction-assembler + db 'cvttpd2pi',2Ch + dw cvtpd2pi_instruction-assembler + db 'cvttps2dq',5Bh + dw cvtdq2pd_instruction-assembler + db 'cvttps2pi',2Ch + dw cvtps2pi_instruction-assembler + db 'cvttsd2si',2Ch + dw cvtsd2si_instruction-assembler + db 'cvttss2si',2Ch + dw cvtss2si_instruction-assembler + db 'prefetchw',1 + dw amd_prefetch_instruction-assembler + db 'punpckhbw',68h + dw mmx_instruction-assembler + db 'punpckhdq',6Ah + dw mmx_instruction-assembler + db 'punpckhwd',69h + dw mmx_instruction-assembler + db 'punpcklbw',60h + dw mmx_instruction-assembler + db 'punpckldq',62h + dw mmx_instruction-assembler + db 'punpcklwd',61h + dw mmx_instruction-assembler + db 0 +instructions_10: + db 'cmpunordpd',3 + dw cmp_pd_instruction-assembler + db 'cmpunordps',3 + dw cmp_ps_instruction-assembler + db 'cmpunordsd',3 + dw cmp_sd_instruction-assembler + db 'cmpunordss',3 + dw cmp_ss_instruction-assembler + db 'cmpxchg16b',16 + dw cmpxchgx_instruction-assembler + db 'loadall286',5 + dw simple_extended_instruction-assembler + db 'loadall386',7 + dw simple_extended_instruction-assembler + db 'maskmovdqu',0 + dw maskmovdqu_instruction-assembler + db 'prefetcht0',1 + dw prefetch_instruction-assembler + db 'prefetcht1',2 + dw prefetch_instruction-assembler + db 'prefetcht2',3 + dw prefetch_instruction-assembler + db 'punpckhqdq',6Dh + dw sse_pd_instruction-assembler + db 'punpcklqdq',6Ch + dw sse_pd_instruction-assembler + db 0 +instructions_11: + db 'prefetchnta',0 + dw prefetch_instruction-assembler + db 0 diff --git a/programs/fire/trunk/build_en.bat b/programs/fire/trunk/build_en.bat new file mode 100644 index 0000000000..3e927bbf2d --- /dev/null +++ b/programs/fire/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm fire.asm fire +@pause \ No newline at end of file diff --git a/programs/fire/trunk/build_ru.bat b/programs/fire/trunk/build_ru.bat new file mode 100644 index 0000000000..691aab83b5 --- /dev/null +++ b/programs/fire/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm fire.asm fire +@pause \ No newline at end of file diff --git a/programs/fire/trunk/fire.asm b/programs/fire/trunk/fire.asm new file mode 100644 index 0000000000..430d8e9348 --- /dev/null +++ b/programs/fire/trunk/fire.asm @@ -0,0 +1,306 @@ +; +; FIRE for MENUET - Compile with FASM +; + +use32 + + org 0x0 + db 'MENUET00' ; 8 byte id + dd 38 ; required os + dd START ; program start + dd I_END ; image size + dd 0x80000 ; reguired amount of memory + dd 0x80000 + dd 0x00000000 ; reserved=no extended header + +include 'lang.inc' +include 'macros.inc' + +START: + + call draw_window + + mov edi,0x40000 + mov ecx,320*600+100 + mov eax,0 + cld + rep stosb + +sta: ; calculate fire image + + mov esi, FireScreen + add esi, 0x2300 + sub esi, 80 + mov ecx, 80 + xor edx, edx + + NEWLINE: + + mov eax,dword [FireSeed] ; New number + mov edx, 0x8405 + mul edx + inc eax + mov dword [FireSeed], eax ; Store seed + + mov [esi], dl + inc esi + dec ecx + jnz NEWLINE + + mov ecx, 0x2300 + sub ecx, 80 + mov esi, FireScreen + add esi, 80 + + FIRELOOP: + + xor eax,eax + + cmp [type],0 + jnz notype1 + mov al, [esi] + add al, [esi + 2] + adc ah, 0 + add al, [esi + 1] + adc ah, 0 + add al, [esi + 81] + adc ah, 0 + notype1: + + cmp [type],1 + jnz notype2 + mov al, [esi] + add al, [esi - 1] + adc ah, 0 + add al, [esi - 1] + adc ah, 0 + add al, [esi + 79] + adc ah,0 + notype2: + + cmp [type],2 + jnz notype3 + mov al, [esi] + add al, [esi - 1] + adc ah,0 + add al, [esi + 1] + adc ah, 0 + add al, [esi + 81] + adc ah,0 + notype3: + + shr eax, 2 + jz ZERO + dec eax + + ZERO: + + mov [esi - 80], al + inc esi + dec ecx + jnz FIRELOOP + + pusha + + mov eax,5 + mov ebx,[delay] + int 0x40 + + mov al,byte [calc] + inc al + mov byte [calc],al + cmp al,byte 2 + jz pdraw + + jmp nodrw + + pdraw: + + mov byte [calc],byte 0 + + mov edi,0x40000 + add edi,[fcolor] + mov esi,FireScreen + xor edx,edx + + newc: + + movzx eax,byte [esi] + mov ebx,eax + mov ecx,eax + shl ax,8 + shr bx,1 + mov al,bl + add ecx,eax + shl ax,8 + mov ch,ah + + mov [edi+0],cx + mov [edi+3],cx + mov [edi+6],cx + mov [edi+9],cx + mov [edi+0+320*3],cx + mov [edi+3+320*3],cx + mov [edi+6+320*3],cx + mov [edi+9+320*3],cx + + add edi,12 + inc edx + cmp edx,80 + jnz nnl + xor edx,edx + add edi,320*3 + nnl: + inc esi + cmp esi,FireScreen+0x2000 + jnz newc + + mov eax,dword 0x00000007 ; display image + mov ebx,0x40000 + mov ecx,4*80*65536+200 + mov edx,1*65536+22 + int 0x40 + + nodrw: + + popa + + mov eax,11 ; check if os wants to talk to us + int 0x40 + cmp eax,1 + jz red + cmp eax,3 + jz button + + jmp sta + + red: ; draw window + call draw_window + jmp sta + + button: ; get button id + mov eax,17 + int 0x40 + + cmp ah,1 + jnz noclose + mov eax,-1 ; close this program + int 0x40 + noclose: + + cmp ah,2 ; change fire type + jnz nob2 + mov eax,[type] + add eax,1 + and eax,1 + mov [type],eax + nob2: + + cmp ah,3 ; change delay + jnz nob3 + mov eax,[delay] + sub eax,1 + and eax,1 + mov [delay],eax + nob3: + + cmp ah,4 ; change color + jnz nob4 + mov eax,[fcolor] + add eax,1 + cmp eax,2 + jbe fcok + mov eax,0 + fcok: + mov [fcolor],eax + mov eax,0 + mov ecx,0x10000 + mov edi,0x40000 + cld + rep stosd + + nob4: + + jmp sta + + + +; ************************************************ +; ********* WINDOW DEFINITIONS AND DRAW ********** +; ************************************************ + + +draw_window: + + pusha + + mov eax,12 ; tell os about redraw + mov ebx,1 + int 0x40 + + mov eax,0 ; define and draw window + mov ebx,100*65536+321 + mov ecx,70*65536+222 + mov edx,0x00000000 + mov esi,0x00000000 + mov edi,0x00000000 + int 0x40 + + mov eax,dword 0x00000004 ; 'FIRE FOR MENUET' + mov ebx,110*65536+8 + mov ecx,dword 0x00FFFFFF + mov edx,text + mov esi,textlen-text + int 0x40 + + mov eax,8 + mov ebx,(321-19)*65536+12 ; button start x & size + mov ecx,5*65536+12 ; button start y & size + mov edx,1 ; button number + mov esi,0x009a0000 + int 0x40 + + mov eax,8 + mov ebx,5*65536+12 + mov ecx,5*65536+12 + mov edx,2 + int 0x40 + + mov eax,8 + mov ebx,18*65536+12 + mov ecx,5*65536+12 + mov edx,3 + int 0x40 + + mov eax,8 + mov ebx,31*65536+12 + mov ecx,5*65536+12 + mov edx,4 + int 0x40 + + mov eax,12 ; tell os about redraw end + mov ebx,2 + int 0x40 + + popa + + ret + + +; DATA SECTION + +calc dd 0 +fcolor dd 2 +xx db 'x' +type dd 0 +delay dd 0 +FireSeed dd 0x1234 +text: db 'FIRE FOR MENUET' +textlen: + +FireScreen: + +I_END: + + + diff --git a/programs/fire/trunk/macros.inc b/programs/fire/trunk/macros.inc new file mode 100644 index 0000000000..d599dea0e0 --- /dev/null +++ b/programs/fire/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 + +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 \ No newline at end of file diff --git a/programs/fire2/trunk/build_en.bat b/programs/fire2/trunk/build_en.bat new file mode 100644 index 0000000000..e85ef4789f --- /dev/null +++ b/programs/fire2/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm fire2.asm fire2 +@pause \ No newline at end of file diff --git a/programs/fire2/trunk/build_ru.bat b/programs/fire2/trunk/build_ru.bat new file mode 100644 index 0000000000..97b8211907 --- /dev/null +++ b/programs/fire2/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm fire2.asm fire2 +@pause \ No newline at end of file diff --git a/programs/fire2/trunk/fire2.asm b/programs/fire2/trunk/fire2.asm new file mode 100644 index 0000000000..f1ba1a2dcc --- /dev/null +++ b/programs/fire2/trunk/fire2.asm @@ -0,0 +1,246 @@ +use32 + org 0x0 + + db 'MENUET01' + dd 0x01 + dd START + dd I_END + dd 0x100000 + dd 0x7fff0 + dd 0x0, 0x0 + +include 'lang.inc' +START: + + call draw_window + + mov edi,my_img + mov ecx,64001*3/4 + xor eax,eax + rep stosd + + mov esi,my_img + mov [count1],esi + + mov eax,3 + int 0x40 + mov [curtime],eax + +still: + + mov eax,11 + int 0x40 + + cmp eax,1 + je red + cmp eax,2 + je key + cmp eax,3 + je button + call image + mov eax,3 + int 0x40 + mov ebx,[curtime] + cmp eax,ebx + jz still + mov [curtime],eax + call print_fps + jmp still + +red: + call draw_window + jmp still + +key: + mov eax,2 + int 0x40 + cmp ah,1 + jne still + mov eax,0xffffffff + int 0x40 + jmp still + +button: + mov eax,17 + int 0x40 + + cmp ah,1 + jne still + mov eax,-1 + int 0x40 + retn + +;Window + +draw_window: + + mov eax,12 + mov ebx,1 + int 0x40 + + mov eax,0 + mov ebx,200*65536+325 + mov ecx,150*65536+225 + mov edx,0x00000000 + mov esi,edx + mov edi,0x00100000 + int 0x40 + + mov eax,4 + mov ebx,8*65536+8 + mov ecx,0x00402020 + mov edx,fire_label + mov esi,len00 + int 0x40 + + mov eax,8 + mov ebx,(325-19)*65536+12 + mov ecx,5*65536+12 + mov edx,1 + mov esi,0x00400000 + int 0x40 + + mov eax,12 + mov ebx,2 + int 0x40 + + retn + +penta: +; Рисуем пентагpамму + + mov edi,my_img + mov ebx,(320)*3 +DrawP: mov eax,0x00fc0000 + add edi,0x540*3 + push edi + mov ecx,0x78 +ll_3: mov [edi],eax + mov [edi+3],eax + mov [edi-3],eax + mov [edi+ebx],eax + add edi,6 + add edi,ebx + loop ll_3 + pop edi + mov ecx,0x60 +ll_4: mov [ebx+edi],eax + mov [edi],eax + mov [edi+3],eax + mov [edi-3],eax + add edi,3 + add edi,ebx + add edi,ebx + loop ll_4 + mov ecx,0x61 +ll_5: mov [ebx+edi],eax + mov [edi],eax + mov [edi+3],eax + mov [edi-3],eax + add edi,3 + sub edi,ebx + sub edi,ebx + loop ll_5 + add edi,0x98D1*3 + push edi + mov ecx,0x78 +ll_6: mov [edi],eax + mov [edi+ebx],eax + mov [edi+3],eax + mov [edi-3],eax + add edi,6 + sub edi,ebx + loop ll_6 + pop edi + mov ecx,0x8F*2 +ll_7: mov [edi],eax + mov [edi+ebx],eax + add edi,3 + loop ll_7 + + retn + + +fire: +; _ВHИМАHИЕ_! Здесь самое интеpесное. +; Алгоpитм гоpения. + mov esi,[count1] + mov edx,[count2] + mov ebx,320*3 + mov ecx,0xffff +Flame: cmp esi,0xFA00*3+my_img ; Псевдослучайная точка в пpедалах экp + jae NxtP ; если HЕТ - беpем следующую. + lodsd + dec esi ; Считываем ее цвет. + and eax,0x00ff0000 + ; Точка чеpная? (гоpеть нечему?) + jz NxtP ; если ДА - беpем следующую. + sub eax,0x00040000 + ; Цветом на единицу меньшим + mov [esi-2*3],eax ; ставим точку слева, + mov [esi],eax ; спpава, + mov [ebx+esi-1*3],eax ; снизу + mov [esi-0x141*3],eax ; и свеpху. +NxtP: + add esi,edx + cmp esi,0xffff*3+my_img + jbe loc_cont + sub esi,0xfffe*3 +loc_cont: + ; Беpем следующую + add edx,3 + cmp edx,0x10000*3 + jbe loc_cont2 + sub edx,0xfffe*3 +loc_cont2: + ; псевдослучайную точку. + ;jnz Flame ; И так 65536 pаз. + loop Flame + mov [count1],esi + mov [count2],edx + retn + +image: + call penta + call fire + + mov ebx,my_img + mov ecx,320*65536+200 + mov edx,2*65536+23 + mov eax,7 + int 0x40 + + inc [fps] + retn + +print_fps: + mov eax,13 + mov ebx,(8+27*6)*65536+18 + mov ecx,8*65536+8 + mov edx,0x00000000 + int 0x40 + mov eax,47 + xor ebx,ebx + mov bx,3 + shl ebx,16 + mov ecx,[fps] + mov edx,(8+27*6)*65536+8 + mov esi,0x00400000 + int 0x40 + xor eax,eax + mov [fps],eax + retn + +;DATA + +count1 dd 0 +count2 dd 0 +curtime dd 0 +fps dd 0 +fire_label db 'Pentagramm in FIRE FPS:' +len00=$-fire_label + org 320*3*2 +my_img: + +I_END: + \ No newline at end of file diff --git a/programs/free3d04/trunk/build_en.bat b/programs/free3d04/trunk/build_en.bat new file mode 100644 index 0000000000..42a848ec2a --- /dev/null +++ b/programs/free3d04/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm free3d04.asm free3d04 +@pause \ No newline at end of file diff --git a/programs/free3d04/trunk/build_ru.bat b/programs/free3d04/trunk/build_ru.bat new file mode 100644 index 0000000000..3b7af6e902 --- /dev/null +++ b/programs/free3d04/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm free3d04.asm free3d04 +@pause \ No newline at end of file diff --git a/programs/free3d04/trunk/ceil.inc b/programs/free3d04/trunk/ceil.inc new file mode 100644 index 0000000000..4c1f0b9cd8 --- /dev/null +++ b/programs/free3d04/trunk/ceil.inc @@ -0,0 +1,64 @@ +dd 0x004E4034,0x0082614C,0x00A06646,0x009F6945,0x00916946,0x00AB6754,0x0067412E,0x008C6048,0x006F4838,0x004F3A29,0x00966C4C,0x00C2835D,0x008E5B3D,0x008A6641,0x008B603F,0x00A6684B,0x007B462C,0x00624325,0x00A16957,0x00987461,0x00BC977C,0x00CC997A,0x00E0A985,0x00E5A981,0x00DB9E75,0x00DDA27A,0x00CB8B65,0x00AA6240,0x00D38765,0x00C97A53,0x00DB8460,0x00DB825D,0x00BA784C,0x00C5885B,0x00D28263,0x00A77F55,0x00D48973,0x00A06A4B,0x00CF8F6D,0x00F1AE89,0x00E6A27E,0x00F3B08C,0x00EBAC86,0x00DB9D76,0x00BB7D59,0x00BB7E57,0x009A623D,0x006C4120,0x00855C3C,0x00A7714B,0x00A86C50,0x0096573D,0x00B16A49,0x00D7895D,0x00975A38,0x006D4935,0x00B9795C,0x009E5E41,0x00916445,0x00A46D4D,0x009A5E3D,0x00AF6F46,0x00BD7A4D,0x00BF7656 +dd 0x008C5E4F,0x009A6F51,0x00986D41,0x00936643,0x00785038,0x00894E42,0x00654532,0x00A77356,0x008C5F47,0x00543F2C,0x0071513B,0x008F6047,0x006C452E,0x00715635,0x0067452A,0x00784632,0x006C432D,0x0060442A,0x00A76D57,0x00AA775E,0x00C5997D,0x00D19F80,0x00E8B18C,0x00EDB189,0x00E0A379,0x00E1A67E,0x00D2906B,0x00B46C4A,0x00D28967,0x00CC7D54,0x00DA8761,0x00CC7956,0x00B4724B,0x00B97C58,0x00D78967,0x00B48053,0x00D38C71,0x00AA7253,0x00D29571,0x00F3B28C,0x00E9A780,0x00F7B58E,0x00EFB088,0x00E0A17A,0x00BC7F5F,0x00B77B5B,0x009B6344,0x006E4729,0x00885F47,0x00825338,0x0085553A,0x0089573C,0x00815138,0x0091644A,0x006E4C3A,0x00674836,0x00B47554,0x00A06243,0x00694730,0x00705337,0x00926540,0x00B87849,0x00C57B4F,0x00D07859 +dd 0x00A2694E,0x00A67051,0x00A6734F,0x00AE7455,0x00926247,0x00704330,0x006B4D35,0x00A97656,0x00996749,0x0079533C,0x0075513C,0x00795338,0x00795130,0x009B704C,0x00916040,0x00AE7555,0x00A66F4D,0x0070462C,0x009D6B4F,0x00B17756,0x00CD9C7D,0x00D7A586,0x00ECB590,0x00F1B68D,0x00E3A77E,0x00E8A883,0x00DE9372,0x00BA7053,0x00D1916D,0x00D88E60,0x00DC946A,0x00BC7652,0x00A96846,0x00AE7255,0x00E0956D,0x00D78B59,0x00DB946E,0x00B67655,0x00D69C74,0x00F3B78A,0x00E9A97C,0x00F8B78A,0x00F0B385,0x00E2A47A,0x00B87E61,0x00B07A5F,0x00966345,0x00775630,0x00C48464,0x00BB7657,0x00B17652,0x00B37A56,0x008F5A3E,0x00916049,0x00815743,0x00875B43,0x00B47A55,0x00A76C4A,0x00774A33,0x008C6044,0x00C6855A,0x00D6844F,0x00CB7D4F,0x00C87B56 +dd 0x00A86E51,0x00AB7254,0x00B07556,0x00C07C5E,0x00AE7657,0x007B5135,0x00725034,0x00A37350,0x009E684B,0x00754C35,0x00714D39,0x0079543A,0x006D4D2E,0x00856246,0x007A5138,0x00845839,0x00865D35,0x006C4526,0x00A46E53,0x00C2785B,0x00D59B7E,0x00DBA787,0x00EDB590,0x00F4B78E,0x00E7AB80,0x00EBAA83,0x00DE9674,0x00B56B4F,0x00D0916C,0x00CC8052,0x00CF8559,0x00CE865E,0x00BF7753,0x00D28864,0x00DB8F69,0x00CB7E59,0x00D89571,0x00B76C49,0x00DA9E74,0x00F5BA8D,0x00EAAA7D,0x00F9BA8D,0x00F1B688,0x00E5A77D,0x00BA8163,0x00BC8466,0x00A26543,0x00694D26,0x00906146,0x00815441,0x00896147,0x00885C42,0x007A5339,0x00865D3E,0x006A4932,0x00734C36,0x00B47C55,0x0099603F,0x006A422E,0x007A5239,0x00B17752,0x00CC8052,0x00D08154,0x00CD7F5A +dd 0x00AA6B53,0x00B37556,0x00AF7553,0x00AB7055,0x008E5C48,0x00754E40,0x00674839,0x00956A50,0x00B27B62,0x00644B32,0x00795944,0x00B2785D,0x00966347,0x00835F4E,0x00845E4D,0x008A6046,0x00795333,0x00644222,0x009E7054,0x00BF7B60,0x00D79C7E,0x00E1AA85,0x00F1B78E,0x00F9BA8E,0x00EDAF82,0x00EDAF82,0x00E19C74,0x00B76C4E,0x00D68F6C,0x00D08158,0x00DA8D62,0x00E69669,0x00D48156,0x00E99365,0x00E29063,0x00D1825C,0x00DD9A75,0x00B86F4A,0x00DCA278,0x00F5BD91,0x00EBAE81,0x00FABE91,0x00F3B88B,0x00E6A97F,0x00BC8263,0x00BB8061,0x00A66343,0x00674620,0x00895F40,0x009F6C52,0x00AC7154,0x009D644F,0x00B37A5D,0x00D08859,0x008F5538,0x007A4A32,0x00C3875D,0x009B5E3C,0x0092634A,0x0098664A,0x00A36947,0x00B87347,0x00C67D4C,0x00C27C54 +dd 0x006F4E3E,0x00986D57,0x00A5735B,0x00A37359,0x009E6F58,0x00A6705E,0x00935F50,0x00825744,0x009C705B,0x005D4631,0x00875E4B,0x00D0896D,0x00C17B5A,0x0091604A,0x009A6A54,0x00B9846A,0x00A9735A,0x00744831,0x00936B4D,0x00B57A5F,0x00D19F88,0x00E3B18F,0x00F1BB94,0x00F6BE98,0x00EAB58D,0x00EAAF82,0x00E3996E,0x00C17852,0x00D8936E,0x00D88E67,0x00E89A6C,0x00ED9D6C,0x00DF9163,0x00EFA071,0x00E39464,0x00D98E5E,0x00E19B6C,0x00BD764E,0x00DAA079,0x00F1BA93,0x00E6AC86,0x00FABD96,0x00F2B890,0x00E1A77F,0x00BB7E59,0x00B6734E,0x00A06040,0x00704427,0x009F6F4F,0x00BC7E59,0x00AC6B48,0x009B6144,0x00BC7A55,0x00D58754,0x00905430,0x006F3D22,0x00AE6D4C,0x00824B2E,0x00905740,0x00955740,0x008E5738,0x00AB6039,0x00B5693C,0x00A6653C +dd 0x0045342B,0x00644C44,0x00886259,0x00A4796C,0x00926C5A,0x009A715A,0x00AB7663,0x00855445,0x006E4D3C,0x005D4537,0x00986A5E,0x00A86C5D,0x009A634F,0x00774E3F,0x00845C4C,0x00966954,0x00A36E59,0x00845240,0x00936A4A,0x00C18167,0x00CD9F8B,0x00E0B493,0x00EEBC98,0x00F3C09C,0x00E7B693,0x00EAAC7E,0x00E49868,0x00C1784F,0x00D38D6A,0x00E29E75,0x00E49D6D,0x00E49C6C,0x00E19C6C,0x00E8A173,0x00E29C6F,0x00E19C6E,0x00DC9264,0x00BD754D,0x00DB9F7B,0x00F0B995,0x00E3AC87,0x00F8BF9A,0x00EDB891,0x00DFA57D,0x00B97A54,0x00BE764E,0x00A36240,0x007A452D,0x00996244,0x00A0603C,0x00854F2F,0x007B4F35,0x00A36B48,0x00B97550,0x009F6A47,0x00694125,0x00724630,0x00784B35,0x00AE6049,0x009E583E,0x008E5B3B,0x00B86A4A,0x009F5F3D,0x00714729 +dd 0x005D4A45,0x00745958,0x005A4640,0x00877064,0x0078564C,0x00795A4E,0x00A87B6E,0x00B47C6A,0x0098694E,0x00875E47,0x00996D5A,0x007B4F41,0x00835D51,0x00835A4E,0x007D5948,0x007E5943,0x00976654,0x007E4D3C,0x00876347,0x00C08466,0x00C39D8A,0x00DBB698,0x00EBBD9A,0x00F4C4A0,0x00E7B691,0x00E6AA7B,0x00E39869,0x00C1734A,0x00C27750,0x00C7835A,0x00BE7B50,0x00BE7B51,0x00C38259,0x00C07A51,0x00BD754D,0x00C27C54,0x00C37950,0x00BA714B,0x00DFA17B,0x00F4B991,0x00E9AE86,0x00F8C097,0x00E7B48B,0x00DFA379,0x00BB7951,0x00C57D52,0x00A46540,0x00834F36,0x009D6449,0x00895336,0x00784D33,0x00764C34,0x00835137,0x00844B35,0x00986149,0x007C482E,0x0088553A,0x00AD6E50,0x00BF654B,0x00844C31,0x00744C31,0x009B5845,0x005A3422,0x005F3E26 +dd 0x006C5C5A,0x00906F68,0x005F4C3D,0x0081705F,0x00725248,0x006D504B,0x008E695E,0x00B8846E,0x00C5896B,0x00C28769,0x00AF7A61,0x00946654,0x009C7164,0x00A16F61,0x0073513D,0x006D4E37,0x008F6452,0x007E543F,0x0081614C,0x00B7815A,0x00BF9B87,0x00DAB9A1,0x00ECBE9E,0x00F9C6A2,0x00E8B78D,0x00E5AD7B,0x00F0B781,0x00ECBC85,0x00EFC389,0x00EFC58F,0x00ECC390,0x00EDC391,0x00EEC592,0x00ECC48A,0x00ECC385,0x00EAC485,0x00EAC384,0x00E9C087,0x00F4CB97,0x00F0C08E,0x00E7B283,0x00F8C294,0x00E8B386,0x00E0A375,0x00B97649,0x00C27E50,0x009D5E3B,0x007F4A33,0x00955D43,0x0076442C,0x00734A35,0x008C5E44,0x00946042,0x008F553A,0x00AA6C4E,0x00B9754F,0x00C5784C,0x00C37349,0x00AE5B41,0x00744631,0x006A4630,0x00965747,0x005D3621,0x00975F3B +dd 0x008B7B79,0x0079605C,0x0058463B,0x00615045,0x00674F4B,0x006A504D,0x00916C5E,0x00B6846D,0x00A7765D,0x00A1785E,0x00976E5B,0x00865D4F,0x00664637,0x0089614F,0x00966656,0x00976555,0x00815642,0x00765139,0x008F6A52,0x00BC8865,0x00C09B88,0x00DCB7A3,0x00EABC9E,0x00F7C6A3,0x00E7B991,0x00E4B587,0x00F0CE96,0x00EFDA9E,0x00F0DCA0,0x00F3D9A3,0x00F4D8A3,0x00F5D7A3,0x00F5D7A3,0x00F3D9A0,0x00F2DB9E,0x00F2DA9E,0x00F3D99E,0x00F4DBA1,0x00F2D7A0,0x00E5C08D,0x00E3B585,0x00F8C295,0x00ECB386,0x00DEA072,0x00B8774D,0x00C78359,0x00A76644,0x0075462D,0x007A4F2F,0x00885839,0x0089563F,0x008B513D,0x006D3926,0x00784937,0x00875945,0x0091644C,0x009E6648,0x00B9734E,0x00AC6144,0x007B4C38,0x006C432F,0x00683627,0x004A2E17,0x00734E28 +dd 0x0099817D,0x00775C57,0x00A07A6B,0x009A7567,0x0068504D,0x005F4947,0x00A17967,0x00AF7F68,0x008A6254,0x00866559,0x00805E54,0x00805C50,0x00765145,0x00956B5A,0x00A17262,0x00956758,0x007C5341,0x00875E49,0x00A2745C,0x00B68B74,0x00C9A899,0x00E2B8A6,0x00E9B9A2,0x00F6C5A6,0x00EEC19C,0x00E8BC93,0x00EDC095,0x00ECC095,0x00ECBF95,0x00EDBF95,0x00EDBE95,0x00EEBF95,0x00EFBF95,0x00EFBF91,0x00F0BF8E,0x00F0BF8F,0x00F0BF8F,0x00EEBF8D,0x00ECBE8C,0x00ECBA8B,0x00F2BD90,0x00FBC396,0x00F0B689,0x00E6A87B,0x00CA926B,0x00B3805F,0x00AD7250,0x00915B36,0x00724829,0x008E6347,0x00A56C50,0x00995B45,0x006D3E2A,0x0079523E,0x00784E3D,0x00835B44,0x0084583E,0x00B3704C,0x00B26644,0x00633424,0x00663926,0x0099523A,0x0098603E,0x00633F1F +dd 0x00937B79,0x00705550,0x00916E61,0x00957368,0x0067514D,0x00725955,0x00B38875,0x00A0715E,0x007C574D,0x00947064,0x00876256,0x00704A3D,0x00835C4F,0x00876651,0x006D533A,0x00634832,0x00875D4A,0x00B07A68,0x00B18779,0x00C5A89B,0x00E1C4B1,0x00E6C0A6,0x00F1C4A6,0x00FACCAA,0x00F9CCA6,0x00FBD0A6,0x00FBD0A5,0x00FBD0A4,0x00FBD0A5,0x00FBD0A4,0x00FBCFA4,0x00FBCFA4,0x00FACEA3,0x00FAD09F,0x00F9D09C,0x00FAD19C,0x00FAD19C,0x00FACD9A,0x00FACB98,0x00FBCA99,0x00FAC897,0x00FDC392,0x00F6BC8A,0x00EDB281,0x00E8B585,0x00C19C74,0x00AD7E5B,0x00B77950,0x00915435,0x006B381E,0x00734226,0x00855539,0x007B4F35,0x00683F2B,0x007B4E3A,0x00936144,0x007A503D,0x009D6848,0x00C07250,0x0075422F,0x00644027,0x00A4593C,0x00985D3A,0x005A381C +dd 0x0072605F,0x00594A43,0x0058493F,0x005A4B43,0x004E3E37,0x007E6157,0x00BE917C,0x008B604E,0x00684740,0x00957368,0x00886257,0x007B5548,0x00846053,0x00644C3A,0x005E422D,0x00825C46,0x00A77962,0x00BB8D7A,0x00C5AAA0,0x00DCC2B2,0x00E2C0A2,0x00EEC8A3,0x00FAD1AB,0x00F3CCA6,0x00EEC59F,0x00F2C59C,0x00F3C69C,0x00F4C59B,0x00F3C59B,0x00F0C59B,0x00EFC49A,0x00EEC199,0x00EEC097,0x00ECC192,0x00EAC18F,0x00ECC391,0x00EDC392,0x00EDC090,0x00EDBD8E,0x00EEBC8C,0x00EDB889,0x00F5BC8B,0x00FBC28D,0x00F5BC88,0x00EFB581,0x00E6B480,0x00C5996F,0x00B3805D,0x00AC7152,0x00885032,0x00633112,0x00693A1B,0x00845337,0x00714531,0x00835641,0x00A36B4D,0x006F4231,0x00865A41,0x00CD7B5C,0x00914B33,0x004C2513,0x00672F1F,0x00552E1B,0x003C2816 +dd 0x00615351,0x006F5D5A,0x00886B63,0x008C6C65,0x007C605D,0x0086665E,0x00A27968,0x008A614F,0x00664337,0x008B6D63,0x0079574C,0x00714F43,0x006A4A41,0x005A423B,0x007D5A49,0x00AD846C,0x00B28F7B,0x00C6AA9C,0x00DCC6B6,0x00DFC2A8,0x00ECC8A2,0x00F9D2AA,0x00F2CDA7,0x00E5BD98,0x00D8A684,0x00D19C7C,0x00D09F7D,0x00CF9D7B,0x00D09D7C,0x00CE9A79,0x00CE9979,0x00CF9979,0x00CF9878,0x00CD9A75,0x00CB9C74,0x00CC9C74,0x00CA9C74,0x00CD9A74,0x00D19772,0x00D29873,0x00D59A76,0x00EAB085,0x00F4BA8A,0x00FAC293,0x00F5BC8D,0x00ECB483,0x00E1AF82,0x00C1946F,0x00A97758,0x00AE7252,0x008C5031,0x00613215,0x00653A21,0x006C412A,0x00764730,0x009D654B,0x00613220,0x00795138,0x00AA6B4E,0x00895437,0x005D3D27,0x006F4836,0x00704637,0x00714432 +dd 0x00675B56,0x007A6265,0x00755855,0x0075584E,0x00765D55,0x00755952,0x00805C50,0x00AE8574,0x007E5646,0x006B4C43,0x0064453C,0x006B4D45,0x0064453D,0x00775549,0x009E755F,0x00B08E7B,0x00BEADA4,0x00DAC2B7,0x00E3C1AC,0x00EEC6AA,0x00F9D2AE,0x00F0CCA5,0x00E4BF99,0x00D6A583,0x00BA7F61,0x00B57B5D,0x00B47A5B,0x00B57A5A,0x00BC8363,0x00B67B5A,0x00BA7E5D,0x00BC8463,0x00B67D5C,0x00B47F5B,0x00B4805B,0x00B37753,0x00B17D59,0x00B57F58,0x00B6774E,0x00B67E5C,0x00B28168,0x00CE9F7F,0x00EAB589,0x00F3B88A,0x00F9C193,0x00F3BC8F,0x00E7B285,0x00DDAB7F,0x00BE926D,0x00AA7A5F,0x00AA6C53,0x00894B33,0x0063361F,0x006B4129,0x0063331C,0x006D4529,0x00653C23,0x00A76F54,0x0093573E,0x0065452A,0x0062432F,0x006F4433,0x00674030,0x007C533B +dd 0x00746359,0x00665551,0x005C4C4A,0x0080675E,0x0085665A,0x007B5E5A,0x00734D45,0x00AC7C6A,0x009C6955,0x007B5245,0x0072544B,0x005B3E36,0x00745246,0x00A77D66,0x00AE8976,0x00BDA499,0x00D6C4B7,0x00E0BFAA,0x00EEC5AA,0x00F8D0B2,0x00F0CAA9,0x00E4BD96,0x00D3A581,0x00BA8565,0x00B57D5C,0x00B9835A,0x00A86F4D,0x00A46950,0x00A76D50,0x00A66A4B,0x00AB6E4E,0x00A96E4F,0x00A7694B,0x00AA6C4C,0x00A86B49,0x00A36745,0x00A16F4B,0x00A17049,0x00A77149,0x00B27C55,0x00B48260,0x00AD846A,0x00CCA283,0x00E8B184,0x00EFB585,0x00F8C090,0x00F3BB8C,0x00E6AE7D,0x00DEA879,0x00BC8F6B,0x00A7725A,0x00AE6D55,0x00804A33,0x005A2D18,0x00663922,0x006C492B,0x007C4C31,0x00A56046,0x00783F29,0x006D4835,0x007A4D38,0x00854B34,0x00542C1B,0x00532E1B +dd 0x008C6E67,0x00826864,0x007A5D55,0x00977265,0x00835D52,0x007A5C5C,0x008E675F,0x00CB9682,0x00C88E76,0x007E5343,0x00684A43,0x0071534A,0x009C7462,0x00B18976,0x00BCA49C,0x00D6BFB2,0x00DFC0A4,0x00EEC5A5,0x00FACFAF,0x00EECAA9,0x00E2BD9D,0x00D3A582,0x00B68666,0x00BA8866,0x00B3805D,0x0086603E,0x00906247,0x00B07860,0x00985D43,0x009F6C4E,0x00A97857,0x00A77452,0x00945C3D,0x00A46847,0x00B06F4D,0x00AA6D4B,0x0098603F,0x00955B39,0x00AC7655,0x00955A3F,0x009E654A,0x00B17D60,0x00B5856B,0x00C89E7E,0x00E0B287,0x00EBB383,0x00F7BE8D,0x00F4B887,0x00EAAA79,0x00E1A273,0x00C18C68,0x00B07E5E,0x00A96E50,0x0082462D,0x0062331C,0x00704524,0x00B8734D,0x00D07E59,0x00945A3E,0x00835542,0x00784430,0x00985A3C,0x0078462E,0x0084573B +dd 0x007C605C,0x007F6460,0x0084645F,0x008B6961,0x007D5B54,0x00775B59,0x00785751,0x009E7464,0x008E6153,0x0060423E,0x0075544A,0x00A17C69,0x00B38C78,0x00C1A398,0x00D6BDB4,0x00E0BFAC,0x00EEC5A7,0x00F7CEAF,0x00EEC8A8,0x00E3C09B,0x00D0A885,0x00B5876A,0x00AF825E,0x00B6855C,0x00996344,0x00825536,0x00A36A4A,0x00C88769,0x00A26449,0x00B17655,0x00D5936B,0x00E09F74,0x00AF754D,0x00C28760,0x00E29F73,0x00D49163,0x00A66C4A,0x00A4704F,0x00B78664,0x008E573C,0x007E4B32,0x009D6C48,0x00B0795A,0x00A88067,0x00C4A37F,0x00E3AE83,0x00EDB382,0x00F8BD8B,0x00F5B887,0x00E8A876,0x00DDA372,0x00C08E67,0x00AA785A,0x00A97153,0x0078462A,0x00543114,0x00845238,0x009F6049,0x0073432D,0x006F4833,0x005F3B26,0x00794F35,0x0088543E,0x00855C42 +dd 0x00594441,0x00624E47,0x006C5851,0x0066514C,0x005F4844,0x006A524F,0x006C504A,0x00816154,0x006D483F,0x00745451,0x00A07666,0x00B08875,0x00C2A599,0x00D8BDB2,0x00DFBCAD,0x00EFC5B0,0x00F8CDB3,0x00EAC6AA,0x00E1BD9C,0x00CEA783,0x00B68866,0x00BC8568,0x00AC7D5E,0x0096674B,0x00B47A5E,0x00D7976A,0x00E39A6C,0x00D08C67,0x00A2714C,0x00A5704A,0x00DC9B72,0x00DF9B6F,0x009B653C,0x00AE7A54,0x00E2A478,0x00D69769,0x009F6040,0x009D644E,0x00B97F61,0x00C48B68,0x00BC835E,0x00A5633F,0x00986644,0x00A67B5C,0x00AF886A,0x00C59F7A,0x00E3AE7E,0x00ECB07D,0x00F7BB8A,0x00F1B786,0x00E1A976,0x00DBA273,0x00BE8C68,0x00AC7B5F,0x00A06950,0x0075412A,0x00613422,0x00754A36,0x006A3C27,0x00623726,0x004C2B19,0x0057341F,0x0071432C,0x005C3C25 +dd 0x00805F5A,0x0088625C,0x0087615A,0x0087615A,0x008D6861,0x008F685E,0x0095685E,0x00A36F63,0x009F6859,0x00B07E6B,0x00B98C7F,0x00C0A195,0x00D7BFAF,0x00DFBDAB,0x00EDC6B1,0x00F8D0B9,0x00ECC5AD,0x00E2BA9B,0x00D0A586,0x00B3866A,0x00AE7B5C,0x00B17955,0x00875F47,0x00855E4A,0x00D29C74,0x00E7A675,0x00ECA475,0x00D69268,0x00C38E62,0x00BA8053,0x00B5714A,0x00B47953,0x009A6442,0x00AB7351,0x00BB7E5B,0x00B5724F,0x00B57653,0x00B57B5C,0x00DD9A68,0x00E7A46F,0x00E7A873,0x00BB7344,0x00825334,0x00966746,0x00AC7B59,0x00A48263,0x00C2A07A,0x00E3AF7D,0x00EBAE7C,0x00F5BB8C,0x00F1B786,0x00E4A877,0x00DB9F70,0x00BD8A66,0x00AB7D64,0x00B27458,0x00A36445,0x009B6541,0x00945F3E,0x008E563D,0x008F543B,0x008B5236,0x007C4B2F,0x00714528 +dd 0x009E786E,0x00A67F72,0x00A37C6F,0x00A27B6E,0x00AA8373,0x00AA7F6B,0x00B58371,0x00C18778,0x00BF856F,0x00C19073,0x00CAA49A,0x00D9BAB2,0x00DEBEA9,0x00EDC4AC,0x00F7CDB6,0x00E9C3AC,0x00E1BBA1,0x00D2A789,0x00B98A6F,0x00B8876B,0x00A97354,0x00B27F54,0x00B28864,0x00B47B5F,0x00CC8F6F,0x00BD876A,0x00D89B72,0x00D39467,0x00BB8262,0x00DDA87F,0x00C18159,0x00BA7D59,0x00A6684B,0x00B57452,0x00BC7B58,0x00D18D65,0x00D8976B,0x00B17451,0x00DA9E6A,0x00C99062,0x00C58D64,0x00BF7E4D,0x00AB704F,0x00AA6649,0x00A6674A,0x00A87759,0x00AB8367,0x00C49D7C,0x00E0AD7E,0x00EBAE78,0x00F7B988,0x00F1B585,0x00E3A775,0x00DB9B6D,0x00C08461,0x00B07854,0x00AF734F,0x00B06F4F,0x00AC6D4C,0x00A66545,0x00AB6949,0x00A76A4D,0x0098644D,0x009C684A +dd 0x00B09284,0x00B79887,0x00B99B89,0x00BC9D8D,0x00C3A48F,0x00C9A58E,0x00D0A994,0x00D8AD9A,0x00DAB099,0x00DDB59A,0x00E0BAAB,0x00DEB8AA,0x00EBC3B0,0x00F7CEB7,0x00EDC3AA,0x00DFB69A,0x00CEA589,0x00B6896F,0x00B48066,0x00AD785C,0x00916142,0x00D3986F,0x00E9AB7C,0x00BC8056,0x008C5C43,0x00A67B68,0x00B4866A,0x00A77553,0x00925B45,0x00C58A6F,0x00A86E4F,0x00BB7C61,0x00B57C64,0x00BC8766,0x00A8694B,0x00C28563,0x00C18766,0x008A543B,0x00B07D54,0x00BF8F5C,0x009E714E,0x00986948,0x00C89168,0x00DD9564,0x00B26E48,0x00975E3E,0x00A37353,0x00A17E66,0x00C49F7D,0x00E3AC7C,0x00EAAC7A,0x00F6B786,0x00F2B381,0x00E3A16F,0x00DB9868,0x00DB9E70,0x00DE9F73,0x00DC9A71,0x00D89970,0x00D5956C,0x00D19269,0x00CF8F68,0x00C98965,0x00C78761 +dd 0x00BA9F97,0x00C1A098,0x00C4A49B,0x00C6A69D,0x00CBA99D,0x00D0AB9D,0x00D3AEA1,0x00D6B1A4,0x00DCB4A5,0x00E1B5A2,0x00E3B8A5,0x00ECC4B1,0x00F5CEBA,0x00EEC5AE,0x00E7BA9F,0x00D0A488,0x00B58B72,0x00BA8972,0x00AA775C,0x00956349,0x0091684E,0x00BF8A6B,0x00D89D73,0x00D9A777,0x009B694A,0x00A1735B,0x009C6853,0x00BC886A,0x00A3694D,0x00B0765B,0x008A5F42,0x009B604B,0x00A96F55,0x00A67454,0x008A4A30,0x00A2674E,0x00A46954,0x00A36F55,0x00AF7F5E,0x00A37354,0x009A6D53,0x00AD7B53,0x00DBA56F,0x00D28C63,0x00B67555,0x007E472D,0x00965F3C,0x00AB7750,0x00AF8667,0x00C49E7C,0x00E0AA7C,0x00E8AB7B,0x00F6B584,0x00F1AE7C,0x00E09D6C,0x00E09B69,0x00E19A69,0x00DE9767,0x00D99669,0x00D79466,0x00D59265,0x00D19164,0x00C88E62,0x00C78C61 +dd 0x00C5ABAA,0x00CDADAB,0x00D1B2B0,0x00D4B5B3,0x00DAB9B4,0x00DEBBB3,0x00E2BEB7,0x00E5C2BB,0x00EBC5B9,0x00F2C5B3,0x00F5C8B5,0x00F8CCBA,0x00E9C2AE,0x00E3B79D,0x00D2A289,0x00B0856F,0x00AD7F67,0x00A5775D,0x00966C4D,0x00B07B60,0x00B88365,0x00B27656,0x00915A43,0x00B8886C,0x00C88E6A,0x00BF8662,0x00AC7558,0x00C1906E,0x00966241,0x00B07B59,0x00B37B58,0x00AD6D50,0x00BF805E,0x00B67E61,0x00A26450,0x00B9846E,0x00985E48,0x00A8724F,0x00BB8A64,0x00AB7155,0x00BA8063,0x00C98E66,0x00B17B51,0x009C5E3F,0x00C08157,0x00A5693E,0x009B613B,0x009D623B,0x00AA7553,0x00A77D61,0x00C69E7B,0x00DFAB7E,0x00E5A675,0x00F7B280,0x00F6AF7E,0x00F2AA79,0x00F0A877,0x00EFA877,0x00EBA87B,0x00E8A477,0x00E4A174,0x00E19E71,0x00D99A6D,0x00D59569 +dd 0x00C2A9A8,0x00C9ACA8,0x00CBAEAB,0x00CCB1AC,0x00D1B3AD,0x00D6B5AC,0x00D9B8B0,0x00DBBBB2,0x00E1BCAF,0x00E6BAA8,0x00EFC2B0,0x00F6C9B7,0x00DFB49D,0x00DCA885,0x00B37E62,0x00B48465,0x00A36F54,0x006E4F3A,0x008F7459,0x00E4A988,0x00E2A078,0x00BE805E,0x0094604B,0x00A3735E,0x00C78E6F,0x00D89B70,0x00C2845C,0x00B57D59,0x00A47354,0x009D694E,0x009E634A,0x009E6048,0x00AD6C4F,0x00A9694D,0x00955C42,0x0094664D,0x00986149,0x00A26A4E,0x00A77052,0x00C6825D,0x00CF855F,0x00B47558,0x00925F47,0x009F5F42,0x00CF8856,0x00E89D5C,0x00CC8653,0x007E4730,0x008C5642,0x00AC7757,0x00AC8365,0x00D8B18B,0x00DCA472,0x00EFAE7B,0x00F8AF7E,0x00EDA473,0x00EAA070,0x00E9A170,0x00E5A174,0x00E3A073,0x00E19D70,0x00DC996C,0x00D69667,0x00D49365 +dd 0x00B99E99,0x00C0A19A,0x00C3A49D,0x00C7A9A2,0x00CBAAA1,0x00CEACA0,0x00D1AFA3,0x00D4B2A5,0x00D9B5AA,0x00DCB6AC,0x00E3B9AD,0x00F5C9B9,0x00DEB59E,0x00E1AB84,0x00AD7053,0x00BB8262,0x009A614A,0x008E5F49,0x00AE7A5A,0x00E7A67D,0x00DC9C72,0x00D09673,0x00B07B62,0x00A67A63,0x00A27760,0x00BA8862,0x00E09D65,0x00E69A5F,0x00EAA976,0x00C38A65,0x00A46B50,0x00985A40,0x00AE694A,0x00A45F3F,0x00966144,0x00A27658,0x00D89D6D,0x00DC9260,0x00DC915F,0x00D89861,0x00B37953,0x00A97456,0x00A57455,0x00C78258,0x00CD7E54,0x00EA9461,0x00D48752,0x008C5235,0x0087523F,0x00A36D4B,0x00A67153,0x00D3B195,0x00DEA66F,0x00EDB07A,0x00EFAA7A,0x00D69364,0x00D48E5D,0x00D68E5D,0x00D49063,0x00D28F62,0x00D08D60,0x00CC895D,0x00C78759,0x00C48656 +dd 0x009F827C,0x00A38178,0x00A5847B,0x00A98980,0x00AB857C,0x00AE8478,0x00B1867B,0x00AD8478,0x00C4A198,0x00DFC1BA,0x00E1BBB0,0x00F5C9BA,0x00DEB59D,0x00E2AE87,0x00B07255,0x00B77F62,0x0094604D,0x00B88970,0x00B77A5E,0x00CA8666,0x00CE8E6D,0x00CA8D71,0x00AA6A53,0x00CB9B7A,0x00B68D6C,0x00AE815B,0x00E1A26A,0x00F8A76B,0x00E9A06E,0x00B37857,0x00AF6F4E,0x00BA7A56,0x00A4674A,0x00AA6D4F,0x00A87556,0x0096654A,0x00D69866,0x00F6A766,0x00F5A168,0x00CE865A,0x00A56F4D,0x00C69266,0x00AD7C57,0x00B77D59,0x00D38C62,0x00D8835B,0x00C57A52,0x00BD8052,0x00A76C4E,0x00996A4C,0x00A86B51,0x00D7B295,0x00E4A870,0x00EEAF7A,0x00F0AA7A,0x00D99463,0x00CC8252,0x00B36E43,0x00B17149,0x00AE6F48,0x00AA6B44,0x00AC6C45,0x00AD6943,0x00A96942 +dd 0x00866862,0x00866057,0x008C665D,0x00936E66,0x00926C63,0x00976E5F,0x009F7666,0x00846259,0x00A08783,0x00DBC1BB,0x00E0BAAF,0x00F6CABB,0x00E2B49F,0x00E4AD8C,0x00B17457,0x00B38060,0x0085513C,0x00966855,0x00875946,0x00A7725A,0x00C78F6C,0x00BC8365,0x00AB7358,0x00AB775D,0x0097684E,0x009E7252,0x00E8A97A,0x00E8A06E,0x00AA784F,0x00855939,0x00955B3E,0x00A66649,0x00864E38,0x00A36748,0x00A96B49,0x00874D34,0x00926146,0x00D0915E,0x00F39F69,0x00CB855A,0x00A06C4A,0x00B17252,0x00B27855,0x00A96D45,0x00C98B59,0x00C27B51,0x00985D3D,0x0097623B,0x00824A32,0x00896D56,0x00A77156,0x00DDB48C,0x00E4A874,0x00F3AE7F,0x00F3AA7D,0x00E09562,0x00C77B4E,0x00905336,0x009E5F3D,0x009D5C3A,0x009B5A37,0x00A15E3C,0x009A553C,0x008F533C +dd 0x00B88A7A,0x00B57C67,0x00B57C68,0x00C58C78,0x00BC846F,0x00BF8267,0x00CE9376,0x00A27767,0x00A78983,0x00E0C1BA,0x00DEB8AD,0x00F6C9B9,0x00E6B6A2,0x00E5AC8D,0x00AF7053,0x00AB7456,0x0088523B,0x00AC7861,0x00B2795A,0x00AF7052,0x00C18463,0x00DF9E76,0x00C49269,0x009E6D50,0x00A67960,0x00855E49,0x00BA896A,0x00B37B5C,0x00845741,0x008A5740,0x008E5D44,0x0097654B,0x00965D45,0x009A5D44,0x0086513A,0x0084513D,0x007B5141,0x00996E51,0x00CB8865,0x00B27751,0x00A57651,0x00A46B52,0x00B17859,0x00DA955F,0x00D78C58,0x00B1643E,0x00A1653F,0x00A4724A,0x0088543D,0x00896E5A,0x009C6D57,0x00DDB68B,0x00DEA775,0x00F3AF7F,0x00F0A97D,0x00E19561,0x00D07F52,0x009A6042,0x00BF744A,0x00B36940,0x00B76C41,0x00CB7646,0x00B86B47,0x00B6694A +dd 0x00BC887D,0x00B57869,0x00B17364,0x00C28678,0x00AE7B6B,0x00B87E65,0x00CD9176,0x00A07465,0x00A3817D,0x00E1C0BA,0x00DBB5AB,0x00F5C7B8,0x00E6B59F,0x00E4AB8B,0x00AE735A,0x00AD775A,0x0086543D,0x00AD8468,0x00D99A76,0x00CF8C6E,0x00AD765A,0x00B2775B,0x00956249,0x007C4C3C,0x00956A59,0x00895B4D,0x009C6E56,0x00A8745F,0x0091614F,0x00A16951,0x00784430,0x005D3925,0x00633B21,0x00603016,0x00563517,0x00965C3E,0x00AB6342,0x00A9714D,0x00B2724E,0x00A96F47,0x009F6344,0x00844D38,0x007E4D38,0x00AD7653,0x00B57652,0x00BF784E,0x00DE9461,0x00CC8459,0x009A5839,0x00A36F50,0x00A4705A,0x00DDB88D,0x00DAA673,0x00F1AE7D,0x00EBA87C,0x00DC975F,0x00D1794F,0x0094593D,0x00C4764C,0x00B3663C,0x00B96D3F,0x00D27340,0x00B1653E,0x00AD623E +dd 0x00C88A84,0x00C28175,0x00AB7365,0x00966857,0x009D7360,0x00C48A6F,0x00D7967A,0x00A67667,0x00A3807A,0x00E1C0BA,0x00DAB5AA,0x00F4C6B6,0x00E4B49C,0x00E4AA89,0x00AC735C,0x00AE775B,0x008C563E,0x00B99171,0x00CD946A,0x00BA7D55,0x00AD7C57,0x00A3735C,0x00B28A71,0x00A86F57,0x00BD8163,0x00A66C55,0x00875D4B,0x00AC7160,0x00A46952,0x00B17C5E,0x006C3825,0x00442012,0x0049250D,0x00471C05,0x00482A11,0x00A46F4F,0x00B76A45,0x00B36F46,0x00A0603F,0x00966647,0x00B57852,0x00A66845,0x00A77659,0x00A9795E,0x00B67B5C,0x00C07D54,0x00D9915F,0x00DA8963,0x00995338,0x00A57250,0x009F7661,0x00DBB78D,0x00DCA671,0x00F2AF7E,0x00ECAA7E,0x00D99662,0x00CF774D,0x00955C43,0x00CD7C52,0x00C86C38,0x00BF7141,0x00A75F3B,0x00A06449,0x00BF6F47 +dd 0x00BE8278,0x00AA6E60,0x009A6B59,0x007E5945,0x00896153,0x00B07561,0x00C6876E,0x00A67A6A,0x00A8887F,0x00E1C0B5,0x00D9B2A2,0x00F4C4B0,0x00E2B599,0x00E3AB89,0x00A8715A,0x00AE755A,0x00864C37,0x009B6F5A,0x0099664C,0x0091583D,0x00AA7357,0x0096644D,0x00AE8165,0x00AD694B,0x00CD845E,0x00AC6749,0x00956754,0x00BC785A,0x00995942,0x00A5765D,0x00643926,0x003A2012,0x00371C06,0x003A1A03,0x00482510,0x009A694A,0x00A25A3C,0x00B06441,0x00B06949,0x009D6147,0x00CA8359,0x00B4693F,0x00A77250,0x009A674D,0x00AF6F50,0x009E6140,0x00965A39,0x00B06648,0x00864129,0x009E6C4C,0x0096735F,0x00D9B790,0x00E3A673,0x00F5B17E,0x00EEAA7E,0x00D8956B,0x00D0784B,0x009A5F47,0x00CA7950,0x00BB5F31,0x00A75D35,0x00874A26,0x00935537,0x00B66136 +dd 0x00C68675,0x00BD7C68,0x00B37B64,0x00A06E58,0x00A67465,0x00CB8974,0x00D79375,0x00A5745E,0x00A78476,0x00E2BFB1,0x00DBB3A0,0x00F4C4AD,0x00E0B597,0x00E1AB88,0x00A7735D,0x00B37B60,0x008E5541,0x00B9876D,0x00DD9E71,0x00CA875E,0x00B27759,0x00AB795D,0x00B48567,0x00A1694F,0x00B67C60,0x00A36B4F,0x008E6050,0x00BE7F5C,0x00B3775D,0x00B37F64,0x00703E25,0x004B2A15,0x0049280E,0x003F220A,0x00512B15,0x009B6948,0x00B67249,0x00C1754C,0x00A55A3B,0x009D5F48,0x00BB7D5E,0x00A76C4A,0x00A87D59,0x00B07A53,0x00B6744D,0x00BB7F55,0x00D6925F,0x00D28861,0x0099503A,0x00B17152,0x00AA7252,0x00DEB48C,0x00E2A679,0x00F6AF7C,0x00F0A677,0x00D8956D,0x00CD7444,0x0095573F,0x00D58050,0x00D1723C,0x00BA6A3B,0x00A86234,0x00AF623C,0x00CE7546 +dd 0x00C28875,0x00B57964,0x00B07863,0x00BB8671,0x00AB7863,0x00B4745F,0x00C6816B,0x00A5725F,0x00AE867A,0x00E5BEB1,0x00DFB1A1,0x00F5C1AB,0x00E0B292,0x00E3AD86,0x00A7725B,0x00B0775F,0x00905B4A,0x00B2826B,0x00D9986C,0x00CF8D62,0x00AC7355,0x00B78168,0x00976149,0x007A533A,0x00A47059,0x009D6A4E,0x00A67B60,0x00A97657,0x009D684D,0x009E6647,0x00814529,0x00744128,0x00714128,0x00673A26,0x00703A23,0x00935E3A,0x00996841,0x00A2704D,0x009A5E46,0x0099604E,0x00A66A4C,0x008A5532,0x007D5538,0x00A97652,0x00AE6D4E,0x00BC7952,0x00E19A62,0x00C4845B,0x00934E36,0x00AF6A4C,0x00B06C4E,0x00DFB389,0x00E1A579,0x00F6AC80,0x00EEA578,0x00D8946D,0x00CE7442,0x0095573C,0x00C4754C,0x00B65E36,0x00B4633E,0x00CD784A,0x00B1623B,0x00A56347 +dd 0x00B48373,0x00A87564,0x00A26F5F,0x00AC7968,0x00A77661,0x00B17562,0x00BE7E6F,0x00A57463,0x00B68E84,0x00E6BDB2,0x00E1AF9F,0x00F5BEAA,0x00DDAD8D,0x00E1AB82,0x00A77259,0x00AD725D,0x0093594A,0x00AA7A66,0x00A66B51,0x00A96746,0x00BF7F54,0x00E09D6F,0x00C78862,0x00986F4F,0x00A7745D,0x00976B51,0x00C89869,0x00B77C4F,0x00885439,0x00835439,0x00996143,0x00B06E4E,0x00B16C46,0x00B46F4C,0x009D5E42,0x008D583E,0x007D4B31,0x00A16540,0x00B97852,0x00A96A4D,0x00B3734F,0x00A86C46,0x00B67C57,0x00D89761,0x00C68153,0x009E5C3D,0x00AE6F48,0x00BC7C51,0x009B5133,0x00AC6748,0x00AF6C51,0x00DFB388,0x00E1A578,0x00F5AC82,0x00EBA678,0x00DB9369,0x00D17643,0x009D6141,0x00C17B53,0x00BE6F48,0x00BB6D49,0x00C97547,0x00BB6E40,0x00AD6A4A +dd 0x008B6052,0x008B6052,0x008B5F51,0x008F6456,0x008C5F4C,0x00915D4A,0x009A6452,0x008C5C49,0x00B18A7E,0x00E5BFB2,0x00DFB09F,0x00F3BFA9,0x00DDAD8E,0x00E0A783,0x00AA7159,0x00AE755C,0x0089523A,0x009B6A4D,0x009B5C41,0x00BB7254,0x00CB855F,0x00BB754F,0x00AC6F50,0x00AB805D,0x009E7452,0x00AC7957,0x00EBA46F,0x00E99663,0x00B16D4E,0x0087523A,0x0098593E,0x00A76548,0x00905332,0x00A3603B,0x009D6141,0x00844F38,0x009C6444,0x00DA8B5B,0x00ED9662,0x00C7774E,0x00A7633F,0x00A76944,0x00AD6E4A,0x00B47446,0x00C78752,0x00B0754B,0x00915739,0x009C613F,0x008E492F,0x00AF6E50,0x00B27155,0x00DEB187,0x00E1A477,0x00F6AD84,0x00EBA674,0x00E1915C,0x00CE7744,0x0094573A,0x009B6047,0x00995944,0x00905641,0x008F583F,0x008C563D,0x008B533F +dd 0x008F695C,0x00936D61,0x00956F62,0x009C7669,0x009E7462,0x00A27561,0x00A77B67,0x00A47764,0x00BC9587,0x00DFBAAB,0x00DDB09D,0x00F3C1A9,0x00DDAD90,0x00E0A685,0x00A66D55,0x00A67156,0x009C6346,0x00BE8864,0x00C88058,0x00DC8F62,0x00DE9264,0x00CF875D,0x00A86C4F,0x00C1956F,0x00AB8B65,0x00AA7B5C,0x00D99263,0x00F49B66,0x00E9976B,0x00B17355,0x00AB714D,0x00B37A53,0x00AD6A47,0x00B46A4C,0x00BA7A5E,0x00B06C4F,0x00E59462,0x00F79A63,0x00EC9361,0x00CC7D50,0x00B67F57,0x00C09166,0x00A56C46,0x00C58454,0x00D28D56,0x00C68854,0x00B5744B,0x00C3845A,0x0099573B,0x00AA6B4F,0x00B17052,0x00DFB084,0x00E1A476,0x00F6AE84,0x00E8A775,0x00D79458,0x00CC804C,0x00B76949,0x00B9694C,0x00B56847,0x00AF6844,0x00AC6A44,0x00AA6945,0x00A96845 +dd 0x00AC897E,0x00AF8C82,0x00B39086,0x00B9958A,0x00BF9484,0x00C49784,0x00C89B88,0x00CA9D8A,0x00CEA18E,0x00D5AA97,0x00DBAB97,0x00F2C0A9,0x00DBAC8F,0x00E0A685,0x00A77059,0x00AC795B,0x008B573D,0x00785840,0x00B47F60,0x00E99E79,0x00D18861,0x00C28562,0x00A97458,0x009F7359,0x00A0795D,0x00C68B68,0x00D58E62,0x00DB8E5E,0x00E2966D,0x00B2735A,0x00945F44,0x008D5E40,0x009D6746,0x0093533B,0x00995940,0x00B1714F,0x00E49C68,0x00DC8B5B,0x00D78B5A,0x00D78B59,0x00B27B56,0x009F755B,0x00A07156,0x00CD8B62,0x00DB8957,0x00DE9561,0x00AD6743,0x00985B3E,0x00915235,0x00B4724B,0x00AE7452,0x00DEB085,0x00DDA174,0x00F1AF82,0x00E5A578,0x00D29262,0x00CF8E5F,0x00D18D62,0x00D28E61,0x00CF8C5D,0x00CE8A5B,0x00CB8758,0x00C68555,0x00C28253 +dd 0x00B7958D,0x00BB9991,0x00BF9E95,0x00C4A298,0x00CBA190,0x00D0A390,0x00D2A592,0x00D6A996,0x00D9A993,0x00DAA992,0x00E2B099,0x00EDBDA6,0x00D6A88C,0x00DAA282,0x00B07A5F,0x00B27B5E,0x00985E4B,0x006B4637,0x00A37256,0x00E59D7A,0x00D39166,0x00A46F51,0x00855942,0x00A17257,0x00CA8560,0x00D78F64,0x00B3764F,0x00AC7958,0x009A684F,0x0095634D,0x009D614B,0x00A56A53,0x00A07451,0x009D6D51,0x009B5D42,0x00A56D50,0x00A37055,0x00AD765C,0x00B77854,0x00DA8F5E,0x00D08B5B,0x00AC704E,0x00905A43,0x00AD7157,0x00DC9064,0x00E59B62,0x00AC643C,0x00773B24,0x00915435,0x00B16E47,0x00AE7957,0x00E0AB80,0x00DE9F72,0x00F0AD80,0x00EBA87B,0x00DE9C6E,0x00DD9A6C,0x00DD9A6D,0x00DB986B,0x00D69568,0x00D59265,0x00D39063,0x00CF8E5F,0x00CA8B5C +dd 0x00C3A295,0x00C6A69A,0x00CAAA9D,0x00CEADA0,0x00D6AC9A,0x00DBAE9A,0x00DEB29E,0x00E3B6A3,0x00EABAA4,0x00ECB9A2,0x00EBB9A2,0x00EDBCA5,0x00DDAB94,0x00D9A586,0x00CB9671,0x00AF7D5F,0x00A4715E,0x0094624B,0x008E5E40,0x00A37056,0x00B77B5D,0x00AB6849,0x00975F3F,0x00C1885C,0x00BE7A50,0x00B37D5D,0x00A96D4B,0x00B57E5A,0x00874E35,0x00B27857,0x00B47958,0x00B27456,0x00B5744F,0x00A97159,0x00A97250,0x00C8865E,0x00945A40,0x00AD7F5C,0x00A96D4C,0x00B07A5C,0x00BC825A,0x00C38155,0x0090593D,0x009C664D,0x00C07854,0x00A87041,0x00985B38,0x008E5C41,0x009F6D4F,0x00A66F51,0x00C69575,0x00E2A57B,0x00E49D70,0x00F6AA7A,0x00F5AC7B,0x00F3AA7A,0x00F2A878,0x00F1A877,0x00ECA678,0x00E5A275,0x00E19F71,0x00DE9B6F,0x00DA986A,0x00D49566 +dd 0x00B59586,0x00B9998A,0x00BE9E8F,0x00C2A193,0x00CAA08E,0x00CFA28F,0x00D2A592,0x00D6A895,0x00DCAB96,0x00DEAC96,0x00E0AF98,0x00E8B8A0,0x00E9B99F,0x00DCAD91,0x00DAA384,0x00CB926E,0x00AC8262,0x00AB7E61,0x00996249,0x0080513F,0x00976A54,0x00CA8860,0x00E39761,0x00D79261,0x00965C44,0x00A37868,0x009A664B,0x00AC7353,0x008C5946,0x009B6C51,0x00804F36,0x0097654A,0x009D5D42,0x009C634E,0x007B4A30,0x00B56E4F,0x009F5943,0x00A96F51,0x00A45E43,0x00A56E55,0x00915942,0x00CC8E68,0x00D89560,0x00C28250,0x00AC6742,0x007D5436,0x00945E41,0x00A8714E,0x00A77656,0x00C39372,0x00DFA882,0x00E2A076,0x00F1AA7C,0x00F1A776,0x00E49E6D,0x00E0996A,0x00DD9465,0x00DC9364,0x00D89366,0x00D39265,0x00CF8E61,0x00CD8A5E,0x00C9895A,0x00C38857 +dd 0x00B39585,0x00B69888,0x00BC9D8E,0x00C0A091,0x00CB9F8E,0x00D1A291,0x00D4A695,0x00D7AB99,0x00DCB09E,0x00DEB19D,0x00DDAE97,0x00D9A88D,0x00E2B391,0x00EABA9A,0x00DAA98B,0x00D8A27C,0x00C4936A,0x00A77F61,0x00A7745B,0x00955F49,0x00885741,0x00D0906A,0x00E29461,0x00A26D43,0x008E5E47,0x00AF8068,0x00B07B58,0x008B523A,0x00865949,0x00C48960,0x009D5A3A,0x00B27B5C,0x00B77655,0x00BB795A,0x008E5B34,0x00C98B5B,0x009F5F3D,0x008E5937,0x00B2754F,0x00AB7352,0x008E533E,0x00AB7051,0x00E99763,0x00D78D58,0x00945931,0x008E5A3A,0x00AA6C4B,0x00A57055,0x00BF9073,0x00E2A67C,0x00E7A373,0x00F0AB7B,0x00F2AE7D,0x00E49F6D,0x00DA9765,0x00D89D6B,0x00D99F6E,0x00D89C6A,0x00D49A67,0x00D29864,0x00D19863,0x00CF925E,0x00CB8B5B,0x00C5865C +dd 0x00916A5E,0x00956F62,0x00946D61,0x00946D5F,0x00A1745C,0x00A5775D,0x00AA7D63,0x00AE8066,0x00AB7E65,0x00B1876E,0x00C29F87,0x00D2B098,0x00D5AB8A,0x00EAB893,0x00EABB97,0x00DBAC87,0x00D7A37A,0x00C2916B,0x00AA7D61,0x00AC7B63,0x008F5F46,0x00926349,0x00AE7358,0x00A77651,0x00CC8964,0x00B37553,0x00D69361,0x00BC784F,0x00B27A57,0x00DD965D,0x00B8734A,0x00A26A4B,0x009E5F3B,0x00A96541,0x00AE6E3E,0x00DF8E5D,0x00C2754F,0x00B67A4B,0x00D18D5D,0x00B0714E,0x00CE855E,0x00C37B4C,0x00C97E52,0x00A45D41,0x008D5737,0x00AD6F4A,0x00B07453,0x00BE8D74,0x00DDA786,0x00E8A377,0x00F3AC7A,0x00F6AF7D,0x00EBA472,0x00DE9A6B,0x00B9805B,0x00A87653,0x00A87655,0x00A87552,0x00A8704D,0x00A36746,0x00A86A47,0x00A2623E,0x00995B3A,0x00955D3A +dd 0x0083534D,0x008C5D56,0x008B5B55,0x008C5C52,0x0099664C,0x00996247,0x00A36A50,0x00AE7259,0x00A76D53,0x00B27659,0x00B3826E,0x00C39F96,0x00D6AF9E,0x00DBAB8D,0x00EAB796,0x00ECB694,0x00DFAA84,0x00DDA57D,0x00C4906E,0x00A6795F,0x009D6F53,0x008D5842,0x007A4A3A,0x008C684A,0x00E1996E,0x00E69160,0x00E99460,0x00C77D52,0x00BB8159,0x00AB6C42,0x00AC6B4D,0x00AE6D51,0x00A6673F,0x00B9774E,0x00BD7A51,0x00C17350,0x00CE855E,0x00CB8255,0x00E99761,0x00E2905A,0x00E49461,0x009D603E,0x007B4A30,0x00914F34,0x00A76A4C,0x00A76E55,0x00BD8A6D,0x00DBA27F,0x00E3A37B,0x00F1AD7F,0x00F5B37C,0x00EAA46E,0x00E09C6C,0x00C2845F,0x00A46A4D,0x00B17049,0x00AA6742,0x00A8643F,0x00A3603B,0x00965737,0x00985933,0x0090512C,0x00894E2C,0x0084522D +dd 0x0055382F,0x0051352B,0x00573C31,0x005D4236,0x00553E26,0x005A4027,0x0061402C,0x00704A36,0x00684129,0x00794F37,0x009D725E,0x00AE8574,0x00C2A091,0x00D7AE98,0x00E0AB8E,0x00EEB492,0x00EEB690,0x00E0AA83,0x00DBA27A,0x00C08B68,0x00A07B57,0x00A67856,0x008F5E4B,0x0088674D,0x00BF8360,0x00E18F67,0x00D48963,0x00AE6F51,0x00905F42,0x00A67245,0x00D6945F,0x00C57E51,0x00885536,0x00C58A64,0x00DB9362,0x00B66B42,0x00A66849,0x00B67857,0x00D68D5D,0x00E8955B,0x00D0804F,0x00925339,0x008C543E,0x00B1704E,0x00B17A5A,0x00BA8D6E,0x00D9A67D,0x00DFA676,0x00EEAC79,0x00F6B27B,0x00E8A86D,0x00E29F67,0x00C9875A,0x00B36C49,0x00A66347,0x008D4C30,0x0068321A,0x006E4227,0x00643C22,0x0059331C,0x00522E16,0x004F2B13,0x0060371A,0x00582F16 +dd 0x005F4237,0x0054362B,0x00725045,0x007B584E,0x005D4234,0x005C3E33,0x006A463D,0x007C554B,0x00704C33,0x00533723,0x00755341,0x00A5765A,0x00AB8267,0x00C19E8C,0x00D7AA97,0x00DCAA8A,0x00ECB890,0x00EDB68F,0x00DCA780,0x00D39F78,0x00AF8A62,0x0094714E,0x009B6C55,0x0090664F,0x00804E38,0x008C4C33,0x00AB6643,0x00AB704B,0x00825136,0x00B77C50,0x00E09358,0x00DB9056,0x00A1643F,0x00DB9868,0x00DA8A55,0x00B87244,0x00925639,0x00B77D55,0x00AA6741,0x00905638,0x00885133,0x0097573A,0x00AC694F,0x00A77259,0x00BD8C6C,0x00DEA377,0x00E5A472,0x00EDAE7C,0x00F5B27F,0x00E8A873,0x00DEA36D,0x00D09262,0x00B57049,0x00B66B43,0x00874F2C,0x0057280E,0x0067331B,0x0093553B,0x00824931,0x0071452D,0x00694028,0x00784A30,0x008A5932,0x007C4924 +dd 0x007A5D4F,0x00745143,0x00865A4F,0x00815448,0x007A5646,0x005F3A2F,0x0073473A,0x00895749,0x00B47B5B,0x00774B35,0x00513325,0x006E4F3B,0x00946F52,0x00A7806C,0x00C09B8F,0x00D4AB8F,0x00DBA980,0x00F0B790,0x00ECB891,0x00D9AA83,0x00CC9E76,0x00AD805C,0x00986D52,0x00AB7861,0x00915A49,0x00683A2B,0x009C6044,0x00AF6E4E,0x008B523D,0x00AB7056,0x00BA704C,0x00B17047,0x00885133,0x00B4754D,0x00B06C43,0x009C6945,0x00855438,0x00B27F54,0x0096623E,0x00633422,0x00855337,0x00B77952,0x00B87A5A,0x00BB8970,0x00DAA37F,0x00E5A474,0x00F0AA78,0x00F6B281,0x00E7A776,0x00E1A070,0x00D1966F,0x00B37F5E,0x00A46A49,0x0088502F,0x00562D14,0x00552C13,0x00A1643D,0x00D57F52,0x009C5435,0x00774A32,0x0074452B,0x00925D40,0x007F4F31,0x00935E3E +dd 0x007D6051,0x00735144,0x00714B3F,0x00764F41,0x00916F59,0x00724D3E,0x008A5D4B,0x009F6B58,0x00C38865,0x00895A40,0x006A4639,0x005A3529,0x007A5240,0x00A87660,0x00B07D6B,0x00C29D87,0x00CFA78A,0x00DBA584,0x00EFB793,0x00EBB590,0x00D5A27C,0x00CF9771,0x00AD7C5A,0x00996951,0x00A46B54,0x00905A3F,0x008A4F30,0x00854928,0x007C4725,0x00854F31,0x008A4C2F,0x00844A2B,0x00754022,0x00834828,0x00854729,0x007F4629,0x007A4327,0x00824F32,0x00825134,0x008F5637,0x00AE6F4A,0x00AE7753,0x00BD8764,0x00DA9E78,0x00E5A376,0x00EFAB79,0x00F6B280,0x00EAA574,0x00E29F6E,0x00D79669,0x00B67A5A,0x00B17350,0x00925230,0x005F2B16,0x00603625,0x006C442C,0x0097633B,0x00CD7D4C,0x009B5130,0x008A543D,0x008C5338,0x009C6143,0x006A3A26,0x006C3D2D +dd 0x005D4134,0x006C4E40,0x005B3C2F,0x004B2E22,0x006F5541,0x006A4D3F,0x006B4537,0x00805544,0x008A5D41,0x005E3920,0x0063432F,0x00503422,0x0056382A,0x00835749,0x00A46A5A,0x00AA7D69,0x00C49F8E,0x00D6A790,0x00E0A585,0x00F2B58F,0x00E9B28A,0x00D6A57D,0x00CD9971,0x00AB7757,0x009D6548,0x00BC7753,0x00C07853,0x00BD7551,0x00C07B53,0x00B8764E,0x00B8754E,0x00BB7951,0x00B2724A,0x00B3714A,0x00BB764F,0x00B57049,0x00B9744B,0x00BA714B,0x00B26A45,0x00B8744E,0x00AB7352,0x00B48365,0x00D69D76,0x00E2A377,0x00F0AC7B,0x00F8B380,0x00ECA876,0x00E5A06F,0x00DA986B,0x00C17D54,0x00A86944,0x008F5939,0x005F3118,0x00582A15,0x00552C1A,0x00553620,0x005D3C1F,0x0099633D,0x00713E27,0x00654631,0x006D452E,0x00633B27,0x004D2B1D,0x00643928 +dd 0x00583C2F,0x0068463A,0x007D5547,0x0074483B,0x007A523D,0x006A4733,0x00754C3B,0x009A6959,0x008C614E,0x005A3921,0x0073432D,0x005C3927,0x005B4131,0x00543525,0x00805542,0x00AB755B,0x00B18471,0x00CBA993,0x00DCAC8B,0x00E2A680,0x00F2B48D,0x00EBB18B,0x00DBA37D,0x00D09670,0x00AA7150,0x00996544,0x00986646,0x009B6949,0x009D6A49,0x009B6546,0x00996245,0x009B6446,0x009A6346,0x009B6548,0x009F684D,0x009E684C,0x00A0694C,0x00A36948,0x00A06543,0x00A36A49,0x00AF795A,0x00D69A76,0x00E7A477,0x00F0AC7D,0x00F9B382,0x00EDA978,0x00E1A471,0x00D89E6E,0x00C08059,0x00BC734B,0x00975C37,0x0065371D,0x00572C15,0x006C3E26,0x00603523,0x007D4A37,0x005E3825,0x008B6343,0x00935639,0x0075462B,0x0076412B,0x0088513A,0x00865239,0x007F4D2A +dd 0x005E463C,0x005C3E33,0x006D4638,0x007A4B3B,0x00714331,0x005D3C25,0x0091694D,0x00925B46,0x0063382B,0x00604127,0x00985A40,0x00643A28,0x005D3F29,0x004E2F15,0x00523219,0x008B5A44,0x00A07361,0x00A89079,0x00CFB190,0x00DDAB83,0x00E1A47C,0x00F2B28D,0x00EBAF8A,0x00DDA37E,0x00D59771,0x00D1946D,0x00D3966F,0x00D49870,0x00D69871,0x00D79670,0x00D89670,0x00D99771,0x00DA9872,0x00DA996E,0x00DA9A6D,0x00DA9B6D,0x00DB9B6E,0x00DD9A6D,0x00DF996D,0x00DE986B,0x00E0996C,0x00E9A072,0x00F1AB7A,0x00F9B382,0x00F1AA78,0x00E9A36F,0x00DD9F64,0x00C28350,0x00AF6A45,0x009F5B3D,0x006A341C,0x0056250E,0x0066341B,0x00693A25,0x0074422F,0x00A05C45,0x00593121,0x0065452C,0x00B76A47,0x008E492D,0x00522B16,0x005A3723,0x005F3622,0x00633B1A +dd 0x00513931,0x00614A3D,0x00452E1D,0x00583C26,0x00543421,0x00412B18,0x008F6A4D,0x00AB6F52,0x00774C3B,0x0075533B,0x00986249,0x00714736,0x00704932,0x00654228,0x004A2A14,0x0059301F,0x00815947,0x009D7A61,0x00B59479,0x00D4B08D,0x00D8A87F,0x00DDA37D,0x00F0B48D,0x00EEB28C,0x00E9AC85,0x00EBAA82,0x00EDAA82,0x00EBAB82,0x00EBAC82,0x00ECAD7E,0x00EEAF7E,0x00EFAF7F,0x00F0AF7F,0x00EFAD7E,0x00EEAC7E,0x00EEAC7E,0x00EEAC7E,0x00F0AD7D,0x00F2AD7B,0x00F0AC79,0x00F1AB78,0x00F4AC7A,0x00F7B07F,0x00F0AA79,0x00E8A473,0x00E2A16D,0x00C8874D,0x00BA7443,0x009E5A39,0x0068321A,0x0052260E,0x006B3924,0x007D4A36,0x00663F2E,0x0080523E,0x009E6047,0x00724833,0x00935A3B,0x00D3764B,0x007F4224,0x004B2C12,0x00734126,0x00613416,0x0056361D +dd 0x00724B41,0x00875B4E,0x007A4837,0x00A1664D,0x008D563E,0x00573B2A,0x007A5543,0x00B7775F,0x008A5A45,0x00774D39,0x00855A45,0x006A4130,0x006B402E,0x00754D3A,0x00764D37,0x00522813,0x005B3923,0x00885F47,0x00A47661,0x00B2967C,0x00D2B28E,0x00DAA67F,0x00E0A47D,0x00F2B48E,0x00F5B78E,0x00F7B588,0x00F7B487,0x00F5B386,0x00F5B385,0x00F7B383,0x00F8B382,0x00F9B180,0x00F9B07F,0x00F9B080,0x00F9B080,0x00F9B07F,0x00F9B080,0x00F9B080,0x00F9B080,0x00F8AF7F,0x00F9AF7E,0x00F9B07E,0x00EEA675,0x00E39D6C,0x00E0A170,0x00CA8858,0x00B86B3F,0x00A3633C,0x0066381B,0x004E2510,0x006D3D22,0x00855135,0x006D3F29,0x00653D29,0x007E553E,0x008B5D45,0x007F533D,0x00B36643,0x00CA6941,0x006C4126,0x00694429,0x00BF6A49,0x00AB5C2D,0x0073421E +dd 0x00754E3A,0x008A5B45,0x007E4E39,0x00A76C55,0x00894B3A,0x00583727,0x00614230,0x00AC775E,0x00926045,0x00774833,0x00764F3C,0x006E4837,0x006D4332,0x00714330,0x0099664E,0x007F4B32,0x006E442B,0x00653A26,0x008C5C47,0x00A87C60,0x00B58E70,0x00D5AA8A,0x00DA9E77,0x00EFAE85,0x00ECAE86,0x00E4A47B,0x00E5A47A,0x00E6A375,0x00E6A373,0x00E4A274,0x00E3A374,0x00E5A374,0x00E6A374,0x00E6A274,0x00E6A275,0x00E7A276,0x00E8A376,0x00E8A373,0x00E7A270,0x00E49E6C,0x00EFA977,0x00F7B07F,0x00E59F70,0x00D89867,0x00C5845B,0x00BF724C,0x00A55D3C,0x00714322,0x00552F13,0x00894B33,0x00A05E3A,0x00844F2C,0x00583119,0x00724B33,0x0077563E,0x00826049,0x00935E40,0x00C06C40,0x00B25B34,0x005D3621,0x005C3D27,0x00965D3D,0x00975731,0x007E4928 +dd 0x005D402C,0x00876144,0x00593C29,0x00563C30,0x0059372A,0x005C4230,0x00684033,0x00A66556,0x00A66547,0x0090573E,0x00825340,0x006B4534,0x00543526,0x0063402F,0x007F5A46,0x00734B37,0x0071462E,0x005E341F,0x006B422E,0x00A66F4E,0x00A37254,0x00C69F88,0x00D99B74,0x00EFAC7E,0x00E1A379,0x00DCA275,0x00EDBC89,0x00F0C98B,0x00EFCA89,0x00F0C68E,0x00F2C68F,0x00F3C992,0x00F3CA93,0x00F2C790,0x00F2C68E,0x00F2C790,0x00F3C890,0x00F3C78F,0x00F1C18A,0x00DDA56F,0x00DFA56F,0x00F2B280,0x00E59F73,0x00D29566,0x00B4704C,0x00C06B49,0x008C492D,0x0065361A,0x006F4226,0x00794129,0x006D3F26,0x00774F34,0x00653E23,0x006E472A,0x00896142,0x009E6E4F,0x00AF6A44,0x00C46F44,0x00A65D3C,0x0078503A,0x006D4936,0x005B3B28,0x0052351E,0x00985E34 +dd 0x00553828,0x007E5941,0x0061442F,0x005D3F31,0x00775141,0x00573D30,0x00734D41,0x009D6350,0x00AE6C4A,0x00A76649,0x0099624C,0x00774D39,0x00734C33,0x008A5C3E,0x0074472F,0x0059321F,0x006D412C,0x00754932,0x00643A27,0x009C6549,0x00A46F53,0x00C79B82,0x00D89A74,0x00EEAB7E,0x00DEA174,0x00D89C6B,0x00E8AC73,0x00D8A56A,0x00D0A56C,0x00D2A672,0x00D2A571,0x00D1A671,0x00D3A773,0x00D3A26F,0x00D3A06C,0x00D4A371,0x00D1A16E,0x00D49F6F,0x00EFB182,0x00E3A170,0x00DEA06E,0x00F0AD7E,0x00E69F74,0x00D39768,0x00B36F4A,0x00BC6545,0x00824027,0x0064371D,0x00864F36,0x00673721,0x005B321B,0x00855234,0x008D5935,0x007A4E2C,0x009A6943,0x00B47049,0x00C2734B,0x00C66E47,0x00A95C3A,0x006E452C,0x007E5032,0x0092583D,0x0064452C,0x00A66C3F +dd 0x00462A1F,0x00684B3F,0x00593C30,0x0060382A,0x00855440,0x0056352B,0x00815949,0x00A26B4F,0x00A66749,0x00864A35,0x007E503D,0x00694630,0x005D3A23,0x00704429,0x00734328,0x006A3C26,0x007B4A34,0x00794931,0x00663826,0x00A6664E,0x00B27055,0x00CF9877,0x00D79A73,0x00EAA87C,0x00DD9C71,0x00D8986D,0x00D98D5B,0x00A55C30,0x009B5E39,0x00A76745,0x009F5D3D,0x009E5C3A,0x00A66441,0x009E5E3A,0x009A5C37,0x00A16541,0x00985B38,0x009C5B39,0x00DF9971,0x00E19E71,0x00D89D6D,0x00E8AB7C,0x00E49E71,0x00D29566,0x00B26D49,0x00C46B4A,0x0090442B,0x0064391D,0x008C5035,0x0079472E,0x00694226,0x00693A22,0x0070422A,0x00744A34,0x008D6145,0x0071412A,0x0086553C,0x00B26A43,0x00BF6739,0x007F472C,0x00865933,0x00905236,0x00533524,0x00734D36 +dd 0x004E3329,0x0048332A,0x00573B30,0x0080503B,0x00975E3F,0x00784A34,0x0099654C,0x008E583D,0x006B402E,0x004B291A,0x006A4E30,0x00945F3A,0x00925431,0x006A3D25,0x005F3E29,0x00653F26,0x00814F34,0x006E3E25,0x00633824,0x009F624B,0x00AC6C54,0x00CD9673,0x00D49872,0x00E7A57A,0x00DA976C,0x00D6966A,0x00D38859,0x00A45831,0x00BA724D,0x00DD8756,0x00E28452,0x00DD824E,0x00D87E4A,0x00DA804D,0x00D78250,0x00D68355,0x00C67045,0x00A95B33,0x00DC966B,0x00E09D71,0x00D7986A,0x00E6A678,0x00E29C6F,0x00CF9164,0x00AB6A48,0x00B56949,0x008B4329,0x005B3618,0x008D5132,0x00905030,0x0072431E,0x00633B1F,0x0099613D,0x00B56C45,0x00975738,0x00602E17,0x0067432F,0x00774A34,0x00AF6B43,0x009C5635,0x00AC643A,0x00C36640,0x00964C2D,0x004C271A +dd 0x00684538,0x005A382B,0x00875742,0x00975E41,0x00905A37,0x00834F34,0x00925B47,0x006A3D2D,0x007B5140,0x00673F2D,0x00503C20,0x009A5F42,0x00BD7249,0x00814D31,0x007A503D,0x007D4A33,0x00965A41,0x00603019,0x005A371D,0x00906045,0x00A26A4F,0x00C99471,0x00D2956F,0x00E5A378,0x00DA9568,0x00D59466,0x00CE865B,0x00A65838,0x00C77551,0x00CF7647,0x00D67C4B,0x00DA8251,0x00C66F3D,0x00D97B47,0x00D47949,0x00CD7850,0x00CD7B54,0x00A55C34,0x00D69467,0x00E19E70,0x00DA9669,0x00E8A477,0x00E29D70,0x00CF8F65,0x00A3694A,0x009F6546,0x00884427,0x004F2F10,0x00825335,0x009F6244,0x009C5D3B,0x00834D38,0x00B7714E,0x00CB6F3E,0x0078381F,0x006A351F,0x00A36640,0x00753E25,0x008F5D41,0x008B5434,0x009A5C35,0x00AA6233,0x00B36737,0x007D4328 +dd 0x0088513B,0x008C4F37,0x00975B3C,0x00925738,0x008B5239,0x00633627,0x0057362A,0x00503220,0x00976348,0x00794B36,0x0042311A,0x00734737,0x008E573D,0x00623B29,0x006A4C3D,0x005E3929,0x006A422A,0x0048280C,0x00613A1C,0x00A66249,0x00B0684E,0x00C6906E,0x00CD936C,0x00E09F74,0x00D79467,0x00D39265,0x00CB815A,0x009B4F31,0x00BF724F,0x00BD6942,0x00C27047,0x00CA784D,0x00B7663D,0x00D0784D,0x00C9724C,0x00BD694A,0x00C87857,0x009D532F,0x00D18E63,0x00DE9C6E,0x00D69367,0x00E6A275,0x00E29D70,0x00CD8E64,0x00A3694A,0x00A06749,0x008E4B2A,0x004B2D0D,0x00623C28,0x00613A2A,0x00734A32,0x00663B28,0x006F4329,0x007E4B28,0x004E2D1A,0x005E3622,0x00A8693F,0x00713C20,0x00502D1D,0x00633A25,0x009B5E39,0x00AD6235,0x00B8683D,0x00A35533 +dd 0x008D5538,0x00915538,0x0091593A,0x009A5C3D,0x00A66446,0x007D4A30,0x00543017,0x00613D20,0x008F5B3A,0x006C3D26,0x0053301B,0x00573422,0x0057371D,0x005B3A20,0x0069442C,0x00603420,0x00794A2A,0x005A3113,0x00673B20,0x00A46043,0x00AE6A4D,0x00C08E70,0x00C99370,0x00D99D75,0x00CE9167,0x00CF8E68,0x00C87B5A,0x009B5135,0x00B57550,0x00B6683C,0x00B46B43,0x00A7643F,0x00965736,0x00A86444,0x00C2734C,0x00BB6841,0x00C37752,0x009E5734,0x00CD8A5F,0x00DB996C,0x00D28F62,0x00E09D6F,0x00E09B6D,0x00CB8B61,0x00A26849,0x00986345,0x00834E2C,0x00583915,0x00A16245,0x009B583F,0x00905D3B,0x00925A38,0x006F3D21,0x006F422A,0x00623A28,0x0071432D,0x009F623C,0x008A5332,0x0060331E,0x00845035,0x00BA7042,0x00BC6833,0x00B06236,0x00A85A35 +dd 0x0081492C,0x008A5235,0x008A5536,0x00955A3A,0x00965C3D,0x0075452B,0x00563018,0x00714A2B,0x00965F3D,0x006E4229,0x00623B26,0x005F3B24,0x005F3A1A,0x00734A28,0x00825232,0x00854F33,0x00A26443,0x0068381E,0x00673921,0x00955C3D,0x00A26C4F,0x00BB8A6D,0x00C99371,0x00D79B73,0x00C98D63,0x00CE8D67,0x00C47956,0x00A05739,0x00B77551,0x00C27346,0x00C97A4F,0x00A25A35,0x008D4D2B,0x0097573C,0x00D17A52,0x00C47241,0x00C37754,0x00985C3B,0x00CA865D,0x00DB976C,0x00D28E63,0x00DF9C70,0x00DC996D,0x00CA8A60,0x00A56A4B,0x00935B41,0x00824C33,0x00593418,0x00935A42,0x008D4D37,0x007D4A2F,0x00854F34,0x00683620,0x006D412F,0x00563327,0x00543223,0x00935837,0x00844B2E,0x00482716,0x00583C22,0x008B5930,0x00A96331,0x00AE6136,0x00B35C3B +dd 0x0064321F,0x00854F38,0x007E532B,0x007D522A,0x0067432A,0x00592E24,0x004F251C,0x005C3B26,0x00965B3F,0x00492C19,0x003E2816,0x00623D28,0x005B3421,0x004B2D16,0x0050351A,0x004D2817,0x005E2F20,0x003F260F,0x006A3D26,0x00995D45,0x00996E52,0x00B68567,0x00C58F6D,0x00D2966E,0x00C4885E,0x00C68A63,0x00B7744E,0x00984F2D,0x00B96D4B,0x00B15F37,0x00C56B45,0x00B5623E,0x009D5E36,0x00A86643,0x00C06748,0x0098643B,0x00BB6F57,0x008C5535,0x00C37F5B,0x00D8946E,0x00D08C67,0x00DC9A74,0x00D79971,0x00C5875F,0x00A86A48,0x009D5F3C,0x008C502D,0x0053280B,0x00583722,0x00683E26,0x00714129,0x00713C23,0x00794225,0x009E5F3D,0x006D3D25,0x00513222,0x00A56242,0x00904D2E,0x00684227,0x00744D2F,0x00744423,0x00905329,0x00A45E31,0x00AA5A3B +dd 0x002A170F,0x006A4839,0x007E5131,0x00874E26,0x00784C27,0x00854933,0x007A3B2A,0x005C3622,0x0089513B,0x003F2715,0x004F351E,0x0099623F,0x008B5338,0x00613B21,0x006F4F2D,0x0073452B,0x006D311E,0x0041220A,0x006B3E28,0x008E5C4B,0x008D6F55,0x00B28264,0x00BF8A67,0x00CA8F67,0x00C1845B,0x00C38760,0x00B06E49,0x008F4624,0x00BB6D4C,0x00B16039,0x00C76D49,0x00BF6741,0x009C5C30,0x00AF6D43,0x00BC6648,0x00966941,0x00BD6C58,0x00854F31,0x00BF7C59,0x00D5916C,0x00CD8965,0x00D89771,0x00D3966F,0x00C1845D,0x00A76946,0x009B5D39,0x00874F2B,0x0056290C,0x0074482A,0x00AE7247,0x00965940,0x00824836,0x009C573B,0x00CD764A,0x00984F2A,0x004B2515,0x007B4632,0x00753D28,0x00744225,0x009D5839,0x00975131,0x00A6623B,0x009C5C2F,0x007B4729 diff --git a/programs/free3d04/trunk/free3d04.asm b/programs/free3d04/trunk/free3d04.asm new file mode 100644 index 0000000000..7a5a1efcbc --- /dev/null +++ b/programs/free3d04/trunk/free3d04.asm @@ -0,0 +1,1427 @@ +; +; Fisheye Raycasting Engine Etc. FREE3D for MENUETOS by Dieter Marfurt +; Version 0.4 (requires some texture-files to compile (see Data Section)) +; dietermarfurt@angelfire.com - www.melog.ch/mos_pub/ +; Don't hit me - I'm an ASM-Newbie... since years :) +; +; Compile with FASM for Menuet (requires .INC files - see DATA Section) +; + +use32 + + org 0x0 + + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd I_END ; size of image + dd 0x300000 ; memory for app + dd 0x7fff0 ; esp + dd 0x0 , 0x0 ; I_Param , I_Icon + +include 'lang.inc' +START: ; start of execution + + call draw_window ; at first, draw the window + call draw_stuff + +gamestart: +; ******* MOUSE CHECK ******* +; mov eax,37 ; check mouse (use mouse over window to navigate) +; mov ebx,2 ; check mousebuttons +; int 0x40 +; cmp eax,0 ; only use mouse when button down +; je noneed ; deactivated cause of disappear-bug etc. + mov eax,37 + mov ebx,1 ; check mouseposition + int 0x40 + + mov ebx,eax + shr eax,16 + and eax,0x0000FFFF ; mousex + and ebx,0x0000FFFF ; mousey + + cmp eax,5 ; mouse out of window ? + jb check_refresh ; it will prevent an app-crash + cmp ebx,22 + jb check_refresh + cmp eax, 640 + jg check_refresh + cmp ebx,501 + jg check_refresh + + cmp eax,315 ; navigating? + jb m_left + cmp eax,325 ; + jg m_right +continue: + cmp ebx,220 ; + jb s_up + cmp ebx,260 ; + jg s_down +; ******* END OF MOUSE CHECK ******* +check_refresh: + +; mov eax,23 ; wait for system event with 10 ms timeout +; mov ebx,1 ; thats max 100 FPS + mov eax,11 ; ask no wait for full speed + int 0x40 + + cmp eax,1 ; window redraw request ? + je red2 + cmp eax,2 ; key in buffer ? + je key2 + cmp eax,3 ; button in buffer ? + je button2 + + mov edi,[mouseya] ; check flag if a refresh has to be done + cmp edi,1 + jne gamestart + mov [mouseya],dword 0 + call draw_stuff + + + jmp gamestart + +; END OF MAINLOOP + +red2: ; redraw + call draw_window + call draw_stuff + jmp gamestart + +key2: ; key + mov eax,2 + int 0x40 + cmp al,1 + je gamestart ; keybuffer empty + + cmp ah,27 ; esc=End App + je finish + + cmp ah,178 ; up + je s_up + cmp ah,177 ; down + je s_down + cmp ah,176 ; left + je s_left + cmp ah,179 ; right + je s_right + + jmp gamestart ; was any other key + + +s_up: ; walk forward (key or mouse) + mov eax,[vpx] + mov ebx,[vpy] + + + mov ecx,[vheading] + imul ecx,4 + add ecx,sinus + mov edi,[ecx] + + mov edx,[vheading] + imul edx,4 + add edx,sinus + add edx,3600 + cmp edx,eosinus ;cosinus taken from (sinus plus 900) mod 3600 + jb ok200 + sub edx,14400 + ok200: + mov esi,[edx] +; sal esi,1 ; edit walking speed here +; sal edi,1 + + add eax,edi ; newPx + add ebx,esi ; newPy + mov edi,eax ; newPx / ffff + mov esi,ebx ; newPy / ffff + sar edi,16 + sar esi,16 + mov ecx,esi + sal ecx,5 ; equal *32 + add ecx,edi + add ecx,grid + cmp [ecx],byte 0 ; collision check + jne cannotwalk0 + mov [vpx],eax + mov [vpy],ebx + mov [mouseya],dword 1 ; set refresh flag +cannotwalk0: + jmp check_refresh + +s_down: ; walk backward + mov eax,[vpx] + mov ebx,[vpy] + + mov ecx,[vheading] + imul ecx,4 + add ecx,sinus + mov edi,[ecx] + + mov edx,[vheading] + imul edx,4 + add edx,sinus + add edx,3600 + cmp edx,eosinus ;cosinus taken from (sinus plus 900) mod 3600 + jb ok201 + sub edx,14400 + ok201: + + mov esi,[edx] +; sal esi,1 ; edit walking speed here +; sal edi,1 + + sub eax,edi ; newPx + sub ebx,esi ; newPy + mov edi,eax ; newPx / ffff + mov esi,ebx ; newPy / ffff + sar edi,16 + sar esi,16 + mov ecx,esi + sal ecx,5 + add ecx,edi + add ecx,grid + cmp [ecx],byte 0 + jne cannotwalk1 + mov [vpx],eax + mov [vpy],ebx + mov [mouseya],dword 1 +cannotwalk1: + jmp check_refresh + +s_left: ; turn left (key) + mov edi,[vheading] ; heading + add edi,50 + cmp edi,3600 + jb ok_heading0 + sub edi,3600 + ok_heading0: + mov [vheading],edi + mov [mouseya],dword 1 + jmp check_refresh + +s_right: ; turn right + mov edi,[vheading] + sub edi,50 + cmp edi,-1 + jg ok_heading1 + add edi,3600 + ok_heading1: + mov [vheading],edi + mov [mouseya],dword 1 + jmp check_refresh + +m_left: ; turn left (mouse) + mov edi,[vheading] ; heading + mov ecx,315 + sub ecx,eax + sar ecx,2 + add edi,ecx + cmp edi,3600 + jb ok_heading2 + sub edi,3600 + ok_heading2: + mov [vheading],edi + mov [mouseya],dword 1 + jmp continue ; allow both: walk and rotate + +m_right: ; turn right + mov edi,[vheading] + sub eax,325 + sar eax,2 + sub edi,eax + cmp edi,-1 + jg ok_heading3 + add edi,3600 + ok_heading3: + mov [vheading],edi + mov [mouseya],dword 1 + jmp continue + + + + button2: ; button + mov eax,17 ; get id + int 0x40 + cmp ah,1 ; button id=1 ? + jne gamestart + +; eo GAME mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm + finish: + 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 + + ; DRAW WINDOW + mov eax,0 ; function 0 : define and draw window + mov ebx,50*65536+649 ; [x start] *65536 + [x size] + mov ecx,50*65536+504 ; [y start] *65536 + [y size] + mov edx,0x02ffffff ; color of work area RRGGBB,8->color gl + mov esi,0x80777777 ; color of grab bar RRGGBB,8->color gl + mov edi,0x00777777 ; 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,0x00ddeeff ; 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,(649-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,0x777777 ; button color RRGGBB + int 0x40 + + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + + ret + +; ********************************************* +; ******* COMPUTE 3D-VIEW ******** +; ********************************************* +draw_stuff: + + +mov [step1],dword 1 +;mov [step64],dword 64 + mov esi,[vheading] + add esi,320 + mov [va],esi + mov eax,[vheading] + sub eax,320 + mov [vacompare],eax +;------------------------------------ CAST 640 PIXEL COLUMNS --------------- +; FOR A=320+heading to -319+heading step -1 (a is stored in [va]) +;--------------------------------------------------------------------------- +; mov edx,5 + mov [vx1],dword 0 ;5 ;edx ; init x1 ... pixelcolumn +for_a: +mov edx,[vx1] +mov [vx1b],edx +sub [vx1b],dword 320 + mov edx,[va] ; a2 + cmp edx,-1 ; a2 is a mod 3600 + jg ok1 + add edx,3600 +ok1: + cmp edx,3600 + jb ok2 + sub edx,3600 +ok2: + +; get stepx and stepy + mov ecx,edx + imul ecx,4 + add ecx,sinus ; pointer to stepx + mov esi,[ecx] + sar esi,4 ; accuracy + mov [vstepx],esi ; store stepx + + mov esi,edx + imul esi,4 + add esi,sinus ; pointer to stepy + add esi,3600 + cmp esi,eosinus ;cosinus taken from ((sinus plus 900) mod 3600) + jb ok202 + sub esi,14400 + ok202: + + mov ecx,[esi] + sar ecx,4 + mov [vstepy],ecx ; store stepy + + + mov eax,[vpx] ; get Camera Position + mov ebx,[vpy] + mov [vxx],eax ; init caster position + mov [vyy],ebx + + mov edi,0 ; init L (number of raycsting-steps) + mov [step1],dword 1 ; init Caster stepwidth for L + + ; raycast a pixel column................................. +raycast: + add edi,[step1] ; count caster steps +;jmp nodouble ; use this to prevent blinking/wobbling textures: much slower! + + cmp edi,32 + je double + cmp edi,512 + je double + cmp edi,1024 + je double + jmp nodouble + + double: + mov edx,[step1] + sal edx,1 + mov [step1],edx + + mov edx,[vstepx] + sal edx,1 + mov [vstepx],edx + + mov edx,[vstepy] + sal edx,1 + mov [vstepy],edx + +nodouble: + + mov eax,32000 ; 3600 ; determine Floors Height based on distance + mov edx,0 + mov ebx,edi + + div ebx + mov esi,eax + mov [vdd],esi + mov edx,260 + sub edx,esi + mov [vh],edx + + cmp edx,22 + jb no_nu_pixel + cmp edx,259 + jg no_nu_pixel ; draw only new pixels + cmp edx,[h_old] + je no_nu_pixel + + mov eax,[vxx] ; calc floor pixel + mov ebx,[vyy] + + and eax,0x0000FFFF + and ebx,0x0000FFFF + + shr eax,10 + shr ebx,10 ; pixel coords inside Texture x,y 64*64 + mov [xfrac],eax + mov [yfrac],ebx + + + + ; plot floor pixel !!!! + mov [vl],edi ; save L + mov [ytemp],esi ; remember L bzw. H + + mov edi,[yfrac] ; get pixel color of this floor pixel + sal edi,8 + mov esi,[xfrac] + sal esi,2 + add edi,esi + add edi,wall ; in fact its floor, just using the wall texture :) + mov edx,[edi] + mov [remesi],esi + + ;**** calculate pixel adress:**** + mov esi,[ytemp] + add esi,240 + imul esi,1920 + add esi,[vx1] + add esi,[vx1] + add esi,[vx1] + add esi,0x80000 + + cmp esi,0x80000+1920*480 + jg foff0 + cmp esi,0x80000 + jb foff0 + ; now we have the adress of the floor-pixel color in edi + ; and the adress of the pixel in the image in esi + + mov edx,[edi] + ;******************** custom distance DARKEN Floor + + mov eax,[vdd] + +; jmp nodark0 ; use this to deactivate darkening floor (a bit faster) + + cmp eax,80 + jg nodark0 + ; split rgb + + mov [blue],edx + and [blue],dword 255 + + shr edx,8 + mov [green],edx + and [green],dword 255 + + shr edx,8 + mov [red],edx + and [red],dword 255 + + mov eax,81 ; darkness parameter + sub eax,[vdd] + sal eax,1 + +; reduce rgb + sub [red],eax + cmp [red], dword 0 + jg notblack10 + mov [red],dword 0 + notblack10: + + sub [green],eax + cmp [green],dword 0 + jg notblack20 + mov [green],dword 0 + notblack20: + + mov edx,[blue] + sub [blue],eax + cmp [blue],dword 0 + jg notblack30 + mov [blue],dword 0 + notblack30: + + shl dword [red],16 ; reassemble rgb + shl dword [green],8 + mov edx,[red] + or edx,[green] + or edx,[blue] + +nodark0: +; eo custom darken floor + + + mov eax,edx + mov [esi],eax ; actually draw the floor pixel + + ; paint "forgotten" pixels + + mov edx,[lasty] + sub edx,1920 + cmp esi,edx + je foff0 + mov [esi+1920],eax + + sub edx,1920 + cmp esi,edx + je foff0 + mov [edx+1920],eax + + sub edx,1920 + cmp esi,edx + je foff0 + mov [edx+1920],eax + +foff0: +mov [lasty],esi +;**** end of draw floor pixel **** + + mov esi,[remesi] + mov edi,[vl] ; restore L + +no_nu_pixel: + + + mov esi,[vh] + mov [h_old],esi + + mov eax,[vxx] + mov ebx,[vyy] + + add eax,[vstepx] ; casting... + add ebx,[vstepy] + + mov [vxx],eax + mov [vyy],ebx + + sar eax,16 + sar ebx,16 + + mov [vpxi],eax ; casters position in Map Grid + mov [vpyi],ebx + + mov edx,ebx +; imul edx,32 + shl edx,5 + add edx,grid + add edx,eax + cmp [edx],byte 0 ; raycaster reached a wall? (0=no) + jne getout + cmp edi,10000 ; limit view range + jb raycast +;................................................ +getout: + mov eax,[edx] ; store Grid Wall Value for Texture Selection + mov [vk],eax + + call blur ; deactivate this (blurs the near floor) : a bit faster + +; simply copy floor to ceil pixel column here +;jmp nocopy ; use this for test purposes + + pusha + mov eax,0x80000+1920*240 + mov ebx,0x80000+1920*240 + +copyfloor: + sub eax,1920 + add ebx,1920 + + mov ecx,0 + add ecx,[vx1] + add ecx,[vx1] + add ecx,[vx1] + + mov edx,ecx + add ecx,eax + add edx,ebx + + mov esi,[edx] + mov [ecx],esi + + cmp eax,0x80000 + jg copyfloor + + popa +; *** end of copy floor to ceil +;nocopy: +;__________________________________________________________________________ + + +; draw this pixelrows wall + mov [vl],edi + + mov edi,260 + sub edi,[vdd] + cmp edi,0 + jg ok3 + xor edi,edi + ok3: + mov [vbottom],edi ; end wall ceil (or window top) + + mov esi,262 + add esi,[vdd] ; start wall floor + + xor edi,edi + +; somethin is wrong with xfrac,so recalc... + + mov eax,[vxx] + and eax,0x0000FFFF + shr eax,10 + mov [xfrac],eax + + mov eax,[vyy] + and eax,0x0000FFFF + shr eax,10 + mov [yfrac],eax + + pixelrow: + +; find each pixels color: + + add edi,64 + sub esi,1 + cmp esi, 502 ; dont calc offscreen-pixels + jg speedup + + xor edx,edx + mov eax, edi + mov ebx,[vdd] + add ebx,[vdd] + div ebx + and eax,63 + mov [ytemp],eax ; get y of texture for wall + + mov eax,[xfrac] + add eax,[yfrac] + + and eax,63 + mov [xtemp],eax ; get x of texture for wall + + ; now prepare to plot that wall-pixel... + mov [remedi],edi + + mov edi,[ytemp] + sal edi,8 + mov edx,[xtemp] + sal edx,2 + add edi,edx + + mov eax,[vk] ; determine which texture should be used + and eax,255 + + cmp eax,1 + jne checkmore1 + add edi,ceil + jmp foundtex + checkmore1: + + cmp eax,2 + jne checkmore2 + add edi,wall + jmp foundtex + checkmore2: + + cmp eax,3 + jne checkmore3 + add edi,wall2 + jmp foundtex + checkmore3: + + cmp eax,4 + jne checkmore4 + add edi,wall3 + jmp foundtex + checkmore4: + + cmp eax,5 + jne checkmore5 + add edi,wall4 + jmp foundtex + checkmore5: + + cmp eax,6 + jne checkmore6 + add edi,wall5 + jmp foundtex + checkmore6: + + cmp eax,7 + jne checkmore7 + add edi,wall6 + jmp foundtex + checkmore7: + + cmp eax,8 + jne checkmore8 + add edi,wall7 + jmp foundtex + checkmore8: + + foundtex: + + mov edx,[edi] ; get pixel color inside texture + +; ***pseudoshade south-west +jmp east ; activate this for southwest pseudoshade : a bit slower + blink-bug + mov edi,[yfrac] + mov [pseudo],dword 0 ; store flag for custom distance darkening + cmp edi,[xfrac] + jge east + and edx,0x00FEFEFE + shr edx,1 + mov [pseudo],dword 1 +east: + + call dark_distance ; deactivate wall distance darkening: a bit faster + +; ******* DRAW WALL PIXEL ******* + mov eax,esi + sub eax,22 + imul eax,1920 + add eax,[vx1] + add eax,[vx1] + add eax,[vx1] + add eax,0x80000 + + cmp eax,0x80000+1920*480 + jg dont_draw + cmp eax,0x80000 + jb dont_draw + mov [eax],edx ; actually set the pixel in the image +; *** eo draw wall pixel +dont_draw: + mov edi,[remedi] +speedup: + cmp esi,[vbottom] ; end of this column? + jg pixelrow + + mov edi,[vl] ; restoring + mov eax,[vx1] ; inc X1 + add eax,1 + mov [vx1],eax + + ;*** NEXT A *** + mov esi,[va] + sub esi,1 + mov [va],esi + cmp esi,[vacompare] + jg for_a + ;*** EO NEXT A *** +;--------------------------------------------------------------------------- + + +; **** put image !!!!!**** +; *********************** + mov eax,7 + mov ebx,0x80000 + mov ecx,640*65536+480 + mov edx,5*65536+20 + int 0x40 + + ret + +blur: + +pusha +mov eax,0x080000+360*1920 + +copyfloor2: + add eax,1920 + mov ebx,eax + add ebx,[vx1] + add ebx,[vx1] + add ebx,[vx1] + + mov ecx,[ebx-15] + and ecx,0x00FEFEFE + shr ecx,1 + mov edx,[ebx-12] + and edx,0x00FEFEFE + shr edx,1 + add edx,ecx + and edx,0x00FEFEFE + shr edx,1 + + mov ecx,[ebx-9] + and ecx,0x00FEFEFE + shr ecx,1 + add edx,ecx + + and edx,0x00FEFEFE + shr edx,1 + + mov ecx,[ebx-6] + and ecx,0x00FEFEFE + shr ecx,1 + add edx,ecx + + and edx,0x00FEFEFE + shr edx,1 + + mov ecx,[ebx-3] + and ecx,0x00FEFEFE + shr ecx,1 + add edx,ecx + + and edx,0x00FEFEFE + shr edx,1 + + mov ecx,[ebx] + and ecx,0x00FEFEFE + shr ecx,1 + add edx,ecx + + mov [ebx],edx + + cmp eax,0x80000+478*1920 + jb copyfloor2 + +popa + +ret + + + +; ******* Darken by Distance ******* +dark_distance: + +; color must be in edx, wall height in [vdd] + + mov eax,[vdd] + cmp eax,50 + jg nodark + ; split rgb + + mov [blue],edx + and [blue],dword 255 + + shr edx,8 + mov [green],edx + and [green],dword 255 + + shr edx,8 + mov [red],edx + and [red],dword 255 + + mov eax,51 ; darkness parameter + sub eax,[vdd] + cmp [pseudo],dword 1 + je isdarkside + sal eax,2 +isdarkside: + +; reduce rgb + sub [red],eax + cmp [red], dword 0 + jg notblack10b + mov [red],dword 0 + notblack10b: + + sub [green],eax + cmp [green],dword 0 + jg notblack20b + mov [green],dword 0 + notblack20b: + + mov edx,[blue] + sub [blue],eax + cmp [blue],dword 0 + jg notblack30b + mov [blue],dword 0 + notblack30b: + + shl dword [red],16 ; reassemble rgb + shl dword [green],8 + mov edx,[red] + or edx,[green] + or edx,[blue] + mov eax,edx + +nodark: + + ret + + +; DATA AREA + +;ceil=ceil +;wall=wall floor +;2 corner stone +;3 leaf mosaic +;4 closed window +;5 greek mosaic +;6 old street stones +;7 maya wall + +grid: ; 32*32 Blocks, Map: 0 = Air, 1 to 8 = Wall +db 2,1,2,1,2,1,2,1,2,1,2,1,1,1,1,1,1,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 +db 1,0,0,0,1,0,0,0,0,0,0,3,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,8,8 +db 5,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8 +db 1,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1,0,0,0,0,3,3,3,3,0,0,0,0,0,0,8 +db 5,0,1,2,3,4,5,6,7,8,2,1,3,3,3,0,5,0,2,1,2,3,0,0,0,0,0,0,0,0,0,8 +db 1,0,0,0,0,0,0,0,0,0,2,3,0,0,0,0,5,0,0,0,0,3,0,0,0,0,0,0,0,0,0,8 +db 5,0,0,0,1,0,0,4,0,0,0,1,0,0,0,0,5,0,0,0,0,3,3,0,3,3,0,0,0,0,0,8 +db 1,1,0,1,1,1,1,4,1,0,1,3,0,0,0,0,5,2,1,2,0,3,0,0,0,3,0,0,0,0,0,8 +db 5,0,0,0,1,0,0,0,0,0,0,1,0,3,3,3,5,0,0,0,0,3,0,0,0,3,0,0,0,0,0,8 +db 1,0,0,0,1,0,0,5,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,3,0,0,0,0,0,8 +db 5,0,0,0,0,0,0,5,0,0,0,1,0,0,0,0,5,0,0,0,0,3,0,0,0,0,0,0,0,0,0,8 +db 1,4,4,4,4,4,4,4,4,4,4,3,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,8,8 +db 2,2,2,2,2,2,8,8,8,8,8,8,8,8,8,0,0,0,6,6,0,7,7,7,7,7,7,7,7,7,8,8 +db 1,0,0,0,1,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,1 +db 5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,2,2,2,2,0,0,0,0,3,3,3,3,3,1 +db 1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,6,0,0,0,0,2,0,0,0,0,3,0,0,0,0,1 +db 5,0,2,3,2,3,2,3,2,3,2,1,0,0,0,0,6,0,2,2,0,2,0,0,0,0,3,0,5,5,0,1 +db 1,0,0,0,0,0,0,4,0,0,0,3,0,0,0,0,6,0,0,2,0,2,0,2,0,0,3,0,0,0,0,1 +db 5,0,0,0,1,0,0,4,0,0,0,1,0,0,0,0,6,0,0,2,2,2,0,2,0,0,3,3,3,3,0,1 +db 1,1,0,1,1,1,1,4,1,0,1,3,7,7,7,0,6,0,0,0,0,0,0,2,0,0,0,0,0,3,0,1 +db 5,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,6,0,0,0,0,2,2,2,0,0,0,0,0,3,0,1 +db 1,0,0,0,1,0,0,5,0,0,0,3,0,0,0,0,6,0,0,0,0,2,0,0,0,0,0,0,0,0,0,1 +db 5,0,0,0,0,0,0,5,0,0,0,1,0,0,0,0,6,0,5,1,0,2,0,0,4,4,0,4,4,0,0,1 +db 1,4,1,4,1,4,1,4,1,4,1,3,0,0,0,0,6,0,0,5,0,2,0,0,0,4,0,4,0,0,0,1 +db 1,0,0,0,0,0,0,4,0,0,0,3,0,3,3,3,6,0,0,1,0,1,0,0,4,4,0,4,4,0,0,1 +db 5,0,0,0,1,0,0,4,0,0,0,1,0,0,0,0,6,0,0,5,0,1,0,4,4,0,0,0,4,4,0,1 +db 1,1,0,1,1,1,1,4,1,0,1,3,0,0,0,0,6,0,0,1,0,1,0,4,0,0,0,0,0,4,0,1 +db 5,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,6,0,0,5,0,1,0,4,0,0,0,0,0,4,0,1 +db 1,0,0,0,1,0,0,5,0,0,0,3,0,0,0,0,6,1,5,1,0,1,0,4,4,0,0,0,4,4,0,1 +db 5,0,0,0,0,0,0,5,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,4,4,4,4,4,0,0,1 +db 1,4,1,4,1,4,1,4,1,4,1,3,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1 +db 2,1,2,1,2,1,2,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + + +sinus: +dd 0,11,23,34,46,57,69,80,92,103 +dd 114,126,137,149,160,172,183,194,206,217 +dd 229,240,252,263,274,286,297,309,320,332 +dd 343,354,366,377,389,400,411,423,434,446 +dd 457,469,480,491,503,514,526,537,548,560 +dd 571,583,594,605,617,628,640,651,662,674 +dd 685,696,708,719,731,742,753,765,776,787 +dd 799,810,821,833,844,855,867,878,889,901 +dd 912,923,935,946,957,969,980,991,1003,1014 +dd 1025,1036,1048,1059,1070,1082,1093,1104,1115,1127 +dd 1138,1149,1161,1172,1183,1194,1206,1217,1228,1239 +dd 1250,1262,1273,1284,1295,1307,1318,1329,1340,1351 +dd 1363,1374,1385,1396,1407,1418,1430,1441,1452,1463 +dd 1474,1485,1496,1508,1519,1530,1541,1552,1563,1574 +dd 1585,1597,1608,1619,1630,1641,1652,1663,1674,1685 +dd 1696,1707,1718,1729,1740,1751,1762,1773,1784,1795 +dd 1806,1817,1828,1839,1850,1861,1872,1883,1894,1905 +dd 1916,1927,1938,1949,1960,1971,1982,1992,2003,2014 +dd 2025,2036,2047,2058,2069,2079,2090,2101,2112,2123 +dd 2134,2144,2155,2166,2177,2188,2198,2209,2220,2231 +dd 2241,2252,2263,2274,2284,2295,2306,2316,2327,2338 +dd 2349,2359,2370,2381,2391,2402,2413,2423,2434,2444 +dd 2455,2466,2476,2487,2497,2508,2518,2529,2540,2550 +dd 2561,2571,2582,2592,2603,2613,2624,2634,2645,2655 +dd 2666,2676,2686,2697,2707,2718,2728,2738,2749,2759 +dd 2770,2780,2790,2801,2811,2821,2832,2842,2852,2863 +dd 2873,2883,2893,2904,2914,2924,2934,2945,2955,2965 +dd 2975,2985,2996,3006,3016,3026,3036,3046,3056,3067 +dd 3077,3087,3097,3107,3117,3127,3137,3147,3157,3167 +dd 3177,3187,3197,3207,3217,3227,3237,3247,3257,3267 +dd 3277,3287,3297,3306,3316,3326,3336,3346,3356,3365 +dd 3375,3385,3395,3405,3414,3424,3434,3444,3453,3463 +dd 3473,3483,3492,3502,3512,3521,3531,3540,3550,3560 +dd 3569,3579,3588,3598,3608,3617,3627,3636,3646,3655 +dd 3665,3674,3684,3693,3703,3712,3721,3731,3740,3750 +dd 3759,3768,3778,3787,3796,3806,3815,3824,3834,3843 +dd 3852,3861,3871,3880,3889,3898,3907,3917,3926,3935 +dd 3944,3953,3962,3971,3980,3990,3999,4008,4017,4026 +dd 4035,4044,4053,4062,4071,4080,4089,4098,4106,4115 +dd 4124,4133,4142,4151,4160,4169,4177,4186,4195,4204 +dd 4213,4221,4230,4239,4247,4256,4265,4274,4282,4291 +dd 4299,4308,4317,4325,4334,4342,4351,4360,4368,4377 +dd 4385,4394,4402,4411,4419,4427,4436,4444,4453,4461 +dd 4469,4478,4486,4495,4503,4511,4519,4528,4536,4544 +dd 4552,4561,4569,4577,4585,4593,4602,4610,4618,4626 +dd 4634,4642,4650,4658,4666,4674,4682,4690,4698,4706 +dd 4714,4722,4730,4738,4746,4754,4762,4769,4777,4785 +dd 4793,4801,4808,4816,4824,4832,4839,4847,4855,4863 +dd 4870,4878,4885,4893,4901,4908,4916,4923,4931,4938 +dd 4946,4953,4961,4968,4976,4983,4991,4998,5006,5013 +dd 5020,5028,5035,5042,5050,5057,5064,5071,5079,5086 +dd 5093,5100,5107,5115,5122,5129,5136,5143,5150,5157 +dd 5164,5171,5178,5185,5192,5199,5206,5213,5220,5227 +dd 5234,5241,5248,5254,5261,5268,5275,5282,5288,5295 +dd 5302,5309,5315,5322,5329,5335,5342,5349,5355,5362 +dd 5368,5375,5381,5388,5394,5401,5407,5414,5420,5427 +dd 5433,5439,5446,5452,5459,5465,5471,5477,5484,5490 +dd 5496,5502,5509,5515,5521,5527,5533,5539,5546,5552 +dd 5558,5564,5570,5576,5582,5588,5594,5600,5606,5612 +dd 5617,5623,5629,5635,5641,5647,5652,5658,5664,5670 +dd 5675,5681,5687,5693,5698,5704,5709,5715,5721,5726 +dd 5732,5737,5743,5748,5754,5759,5765,5770,5776,5781 +dd 5786,5792,5797,5802,5808,5813,5818,5824,5829,5834 +dd 5839,5844,5850,5855,5860,5865,5870,5875,5880,5885 +dd 5890,5895,5900,5905,5910,5915,5920,5925,5930,5935 +dd 5939,5944,5949,5954,5959,5963,5968,5973,5978,5982 +dd 5987,5992,5996,6001,6005,6010,6015,6019,6024,6028 +dd 6033,6037,6041,6046,6050,6055,6059,6063,6068,6072 +dd 6076,6081,6085,6089,6093,6097,6102,6106,6110,6114 +dd 6118,6122,6126,6130,6134,6138,6142,6146,6150,6154 +dd 6158,6162,6166,6170,6174,6178,6181,6185,6189,6193 +dd 6196,6200,6204,6208,6211,6215,6218,6222,6226,6229 +dd 6233,6236,6240,6243,6247,6250,6254,6257,6260,6264 +dd 6267,6270,6274,6277,6280,6284,6287,6290,6293,6296 +dd 6300,6303,6306,6309,6312,6315,6318,6321,6324,6327 +dd 6330,6333,6336,6339,6342,6345,6348,6350,6353,6356 +dd 6359,6362,6364,6367,6370,6372,6375,6378,6380,6383 +dd 6386,6388,6391,6393,6396,6398,6401,6403,6405,6408 +dd 6410,6413,6415,6417,6420,6422,6424,6426,6429,6431 +dd 6433,6435,6437,6440,6442,6444,6446,6448,6450,6452 +dd 6454,6456,6458,6460,6462,6464,6466,6467,6469,6471 +dd 6473,6475,6476,6478,6480,6482,6483,6485,6486,6488 +dd 6490,6491,6493,6494,6496,6497,6499,6500,6502,6503 +dd 6505,6506,6507,6509,6510,6511,6513,6514,6515,6516 +dd 6518,6519,6520,6521,6522,6523,6524,6525,6527,6528 +dd 6529,6530,6531,6531,6532,6533,6534,6535,6536,6537 +dd 6538,6538,6539,6540,6541,6541,6542,6543,6543,6544 +dd 6545,6545,6546,6546,6547,6547,6548,6548,6549,6549 +dd 6550,6550,6550,6551,6551,6551,6552,6552,6552,6552 +dd 6553,6553,6553,6553,6553,6553,6553,6553,6553,6553 +dd 6554,6553,6553,6553,6553,6553,6553,6553,6553,6553 +dd 6553,6552,6552,6552,6552,6551,6551,6551,6550,6550 +dd 6550,6549,6549,6548,6548,6547,6547,6546,6546,6545 +dd 6545,6544,6543,6543,6542,6541,6541,6540,6539,6538 +dd 6538,6537,6536,6535,6534,6533,6532,6531,6531,6530 +dd 6529,6528,6527,6525,6524,6523,6522,6521,6520,6519 +dd 6518,6516,6515,6514,6513,6511,6510,6509,6507,6506 +dd 6505,6503,6502,6500,6499,6497,6496,6494,6493,6491 +dd 6490,6488,6486,6485,6483,6482,6480,6478,6476,6475 +dd 6473,6471,6469,6467,6466,6464,6462,6460,6458,6456 +dd 6454,6452,6450,6448,6446,6444,6442,6440,6437,6435 +dd 6433,6431,6429,6426,6424,6422,6420,6417,6415,6413 +dd 6410,6408,6405,6403,6401,6398,6396,6393,6391,6388 +dd 6386,6383,6380,6378,6375,6372,6370,6367,6364,6362 +dd 6359,6356,6353,6350,6348,6345,6342,6339,6336,6333 +dd 6330,6327,6324,6321,6318,6315,6312,6309,6306,6303 +dd 6300,6296,6293,6290,6287,6284,6280,6277,6274,6270 +dd 6267,6264,6260,6257,6254,6250,6247,6243,6240,6236 +dd 6233,6229,6226,6222,6218,6215,6211,6208,6204,6200 +dd 6196,6193,6189,6185,6181,6178,6174,6170,6166,6162 +dd 6158,6154,6150,6146,6142,6138,6134,6130,6126,6122 +dd 6118,6114,6110,6106,6102,6097,6093,6089,6085,6081 +dd 6076,6072,6068,6063,6059,6055,6050,6046,6041,6037 +dd 6033,6028,6024,6019,6015,6010,6005,6001,5996,5992 +dd 5987,5982,5978,5973,5968,5963,5959,5954,5949,5944 +dd 5939,5935,5930,5925,5920,5915,5910,5905,5900,5895 +dd 5890,5885,5880,5875,5870,5865,5860,5855,5850,5844 +dd 5839,5834,5829,5824,5818,5813,5808,5802,5797,5792 +dd 5786,5781,5776,5770,5765,5759,5754,5748,5743,5737 +dd 5732,5726,5721,5715,5709,5704,5698,5693,5687,5681 +dd 5675,5670,5664,5658,5652,5647,5641,5635,5629,5623 +dd 5617,5612,5606,5600,5594,5588,5582,5576,5570,5564 +dd 5558,5552,5546,5539,5533,5527,5521,5515,5509,5502 +dd 5496,5490,5484,5477,5471,5465,5459,5452,5446,5439 +dd 5433,5427,5420,5414,5407,5401,5394,5388,5381,5375 +dd 5368,5362,5355,5349,5342,5335,5329,5322,5315,5309 +dd 5302,5295,5288,5282,5275,5268,5261,5254,5248,5241 +dd 5234,5227,5220,5213,5206,5199,5192,5185,5178,5171 +dd 5164,5157,5150,5143,5136,5129,5122,5115,5107,5100 +dd 5093,5086,5079,5071,5064,5057,5050,5042,5035,5028 +dd 5020,5013,5006,4998,4991,4983,4976,4968,4961,4953 +dd 4946,4938,4931,4923,4916,4908,4901,4893,4885,4878 +dd 4870,4863,4855,4847,4839,4832,4824,4816,4808,4801 +dd 4793,4785,4777,4769,4762,4754,4746,4738,4730,4722 +dd 4714,4706,4698,4690,4682,4674,4666,4658,4650,4642 +dd 4634,4626,4618,4610,4602,4593,4585,4577,4569,4561 +dd 4552,4544,4536,4528,4519,4511,4503,4495,4486,4478 +dd 4469,4461,4453,4444,4436,4427,4419,4411,4402,4394 +dd 4385,4377,4368,4360,4351,4342,4334,4325,4317,4308 +dd 4299,4291,4282,4274,4265,4256,4247,4239,4230,4221 +dd 4213,4204,4195,4186,4177,4169,4160,4151,4142,4133 +dd 4124,4115,4106,4098,4089,4080,4071,4062,4053,4044 +dd 4035,4026,4017,4008,3999,3990,3980,3971,3962,3953 +dd 3944,3935,3926,3917,3907,3898,3889,3880,3871,3861 +dd 3852,3843,3834,3824,3815,3806,3796,3787,3778,3768 +dd 3759,3750,3740,3731,3721,3712,3703,3693,3684,3674 +dd 3665,3655,3646,3636,3627,3617,3608,3598,3588,3579 +dd 3569,3560,3550,3540,3531,3521,3512,3502,3492,3483 +dd 3473,3463,3453,3444,3434,3424,3414,3405,3395,3385 +dd 3375,3365,3356,3346,3336,3326,3316,3306,3297,3287 +dd 3277,3267,3257,3247,3237,3227,3217,3207,3197,3187 +dd 3177,3167,3157,3147,3137,3127,3117,3107,3097,3087 +dd 3077,3067,3056,3046,3036,3026,3016,3006,2996,2985 +dd 2975,2965,2955,2945,2934,2924,2914,2904,2893,2883 +dd 2873,2863,2852,2842,2832,2821,2811,2801,2790,2780 +dd 2770,2759,2749,2738,2728,2718,2707,2697,2686,2676 +dd 2666,2655,2645,2634,2624,2613,2603,2592,2582,2571 +dd 2561,2550,2540,2529,2518,2508,2497,2487,2476,2466 +dd 2455,2444,2434,2423,2413,2402,2391,2381,2370,2359 +dd 2349,2338,2327,2316,2306,2295,2284,2274,2263,2252 +dd 2241,2231,2220,2209,2198,2188,2177,2166,2155,2144 +dd 2134,2123,2112,2101,2090,2079,2069,2058,2047,2036 +dd 2025,2014,2003,1992,1982,1971,1960,1949,1938,1927 +dd 1916,1905,1894,1883,1872,1861,1850,1839,1828,1817 +dd 1806,1795,1784,1773,1762,1751,1740,1729,1718,1707 +dd 1696,1685,1674,1663,1652,1641,1630,1619,1608,1597 +dd 1585,1574,1563,1552,1541,1530,1519,1508,1496,1485 +dd 1474,1463,1452,1441,1430,1418,1407,1396,1385,1374 +dd 1363,1351,1340,1329,1318,1307,1295,1284,1273,1262 +dd 1250,1239,1228,1217,1206,1194,1183,1172,1161,1149 +dd 1138,1127,1115,1104,1093,1082,1070,1059,1048,1036 +dd 1025,1014,1003,991,980,969,957,946,935,923 +dd 912,901,889,878,867,855,844,833,821,810 +dd 799,787,776,765,753,742,731,719,708,696 +dd 685,674,662,651,640,628,617,605,594,583 +dd 571,560,548,537,526,514,503,491,480,469 +dd 457,446,434,423,411,400,389,377,366,354 +dd 343,332,320,309,297,286,274,263,252,240 +dd 229,217,206,194,183,172,160,149,137,126 +dd 114,103,92,80,69,57,46,34,23,11 +dd 0,-11,-23,-34,-46,-57,-69,-80,-92,-103 +dd -114,-126,-137,-149,-160,-172,-183,-194,-206,-217 +dd -229,-240,-252,-263,-274,-286,-297,-309,-320,-332 +dd -343,-354,-366,-377,-389,-400,-411,-423,-434,-446 +dd -457,-469,-480,-491,-503,-514,-526,-537,-548,-560 +dd -571,-583,-594,-605,-617,-628,-640,-651,-662,-674 +dd -685,-696,-708,-719,-731,-742,-753,-765,-776,-787 +dd -799,-810,-821,-833,-844,-855,-867,-878,-889,-901 +dd -912,-923,-935,-946,-957,-969,-980,-991,-1003,-1014 +dd -1025,-1036,-1048,-1059,-1070,-1082,-1093,-1104,-1115,-1127 +dd -1138,-1149,-1161,-1172,-1183,-1194,-1206,-1217,-1228,-1239 +dd -1250,-1262,-1273,-1284,-1295,-1307,-1318,-1329,-1340,-1351 +dd -1363,-1374,-1385,-1396,-1407,-1418,-1430,-1441,-1452,-1463 +dd -1474,-1485,-1496,-1508,-1519,-1530,-1541,-1552,-1563,-1574 +dd -1585,-1597,-1608,-1619,-1630,-1641,-1652,-1663,-1674,-1685 +dd -1696,-1707,-1718,-1729,-1740,-1751,-1762,-1773,-1784,-1795 +dd -1806,-1817,-1828,-1839,-1850,-1861,-1872,-1883,-1894,-1905 +dd -1916,-1927,-1938,-1949,-1960,-1971,-1982,-1992,-2003,-2014 +dd -2025,-2036,-2047,-2058,-2069,-2079,-2090,-2101,-2112,-2123 +dd -2134,-2144,-2155,-2166,-2177,-2188,-2198,-2209,-2220,-2231 +dd -2241,-2252,-2263,-2274,-2284,-2295,-2306,-2316,-2327,-2338 +dd -2349,-2359,-2370,-2381,-2391,-2402,-2413,-2423,-2434,-2444 +dd -2455,-2466,-2476,-2487,-2497,-2508,-2518,-2529,-2540,-2550 +dd -2561,-2571,-2582,-2592,-2603,-2613,-2624,-2634,-2645,-2655 +dd -2666,-2676,-2686,-2697,-2707,-2718,-2728,-2738,-2749,-2759 +dd -2770,-2780,-2790,-2801,-2811,-2821,-2832,-2842,-2852,-2863 +dd -2873,-2883,-2893,-2904,-2914,-2924,-2934,-2945,-2955,-2965 +dd -2975,-2985,-2996,-3006,-3016,-3026,-3036,-3046,-3056,-3067 +dd -3077,-3087,-3097,-3107,-3117,-3127,-3137,-3147,-3157,-3167 +dd -3177,-3187,-3197,-3207,-3217,-3227,-3237,-3247,-3257,-3267 +dd -3277,-3287,-3297,-3306,-3316,-3326,-3336,-3346,-3356,-3365 +dd -3375,-3385,-3395,-3405,-3414,-3424,-3434,-3444,-3453,-3463 +dd -3473,-3483,-3492,-3502,-3512,-3521,-3531,-3540,-3550,-3560 +dd -3569,-3579,-3588,-3598,-3608,-3617,-3627,-3636,-3646,-3655 +dd -3665,-3674,-3684,-3693,-3703,-3712,-3721,-3731,-3740,-3750 +dd -3759,-3768,-3778,-3787,-3796,-3806,-3815,-3824,-3834,-3843 +dd -3852,-3861,-3871,-3880,-3889,-3898,-3907,-3917,-3926,-3935 +dd -3944,-3953,-3962,-3971,-3980,-3990,-3999,-4008,-4017,-4026 +dd -4035,-4044,-4053,-4062,-4071,-4080,-4089,-4098,-4106,-4115 +dd -4124,-4133,-4142,-4151,-4160,-4169,-4177,-4186,-4195,-4204 +dd -4213,-4221,-4230,-4239,-4247,-4256,-4265,-4274,-4282,-4291 +dd -4299,-4308,-4317,-4325,-4334,-4342,-4351,-4360,-4368,-4377 +dd -4385,-4394,-4402,-4411,-4419,-4427,-4436,-4444,-4453,-4461 +dd -4469,-4478,-4486,-4495,-4503,-4511,-4519,-4528,-4536,-4544 +dd -4552,-4561,-4569,-4577,-4585,-4593,-4602,-4610,-4618,-4626 +dd -4634,-4642,-4650,-4658,-4666,-4674,-4682,-4690,-4698,-4706 +dd -4714,-4722,-4730,-4738,-4746,-4754,-4762,-4769,-4777,-4785 +dd -4793,-4801,-4808,-4816,-4824,-4832,-4839,-4847,-4855,-4863 +dd -4870,-4878,-4885,-4893,-4901,-4908,-4916,-4923,-4931,-4938 +dd -4946,-4953,-4961,-4968,-4976,-4983,-4991,-4998,-5006,-5013 +dd -5020,-5028,-5035,-5042,-5050,-5057,-5064,-5071,-5079,-5086 +dd -5093,-5100,-5107,-5115,-5122,-5129,-5136,-5143,-5150,-5157 +dd -5164,-5171,-5178,-5185,-5192,-5199,-5206,-5213,-5220,-5227 +dd -5234,-5241,-5248,-5254,-5261,-5268,-5275,-5282,-5288,-5295 +dd -5302,-5309,-5315,-5322,-5329,-5335,-5342,-5349,-5355,-5362 +dd -5368,-5375,-5381,-5388,-5394,-5401,-5407,-5414,-5420,-5427 +dd -5433,-5439,-5446,-5452,-5459,-5465,-5471,-5477,-5484,-5490 +dd -5496,-5502,-5509,-5515,-5521,-5527,-5533,-5539,-5546,-5552 +dd -5558,-5564,-5570,-5576,-5582,-5588,-5594,-5600,-5606,-5612 +dd -5617,-5623,-5629,-5635,-5641,-5647,-5652,-5658,-5664,-5670 +dd -5675,-5681,-5687,-5693,-5698,-5704,-5709,-5715,-5721,-5726 +dd -5732,-5737,-5743,-5748,-5754,-5759,-5765,-5770,-5776,-5781 +dd -5786,-5792,-5797,-5802,-5808,-5813,-5818,-5824,-5829,-5834 +dd -5839,-5844,-5850,-5855,-5860,-5865,-5870,-5875,-5880,-5885 +dd -5890,-5895,-5900,-5905,-5910,-5915,-5920,-5925,-5930,-5935 +dd -5939,-5944,-5949,-5954,-5959,-5963,-5968,-5973,-5978,-5982 +dd -5987,-5992,-5996,-6001,-6005,-6010,-6015,-6019,-6024,-6028 +dd -6033,-6037,-6041,-6046,-6050,-6055,-6059,-6063,-6068,-6072 +dd -6076,-6081,-6085,-6089,-6093,-6097,-6102,-6106,-6110,-6114 +dd -6118,-6122,-6126,-6130,-6134,-6138,-6142,-6146,-6150,-6154 +dd -6158,-6162,-6166,-6170,-6174,-6178,-6181,-6185,-6189,-6193 +dd -6196,-6200,-6204,-6208,-6211,-6215,-6218,-6222,-6226,-6229 +dd -6233,-6236,-6240,-6243,-6247,-6250,-6254,-6257,-6260,-6264 +dd -6267,-6270,-6274,-6277,-6280,-6284,-6287,-6290,-6293,-6296 +dd -6300,-6303,-6306,-6309,-6312,-6315,-6318,-6321,-6324,-6327 +dd -6330,-6333,-6336,-6339,-6342,-6345,-6348,-6350,-6353,-6356 +dd -6359,-6362,-6364,-6367,-6370,-6372,-6375,-6378,-6380,-6383 +dd -6386,-6388,-6391,-6393,-6396,-6398,-6401,-6403,-6405,-6408 +dd -6410,-6413,-6415,-6417,-6420,-6422,-6424,-6426,-6429,-6431 +dd -6433,-6435,-6437,-6440,-6442,-6444,-6446,-6448,-6450,-6452 +dd -6454,-6456,-6458,-6460,-6462,-6464,-6466,-6467,-6469,-6471 +dd -6473,-6475,-6476,-6478,-6480,-6482,-6483,-6485,-6486,-6488 +dd -6490,-6491,-6493,-6494,-6496,-6497,-6499,-6500,-6502,-6503 +dd -6505,-6506,-6507,-6509,-6510,-6511,-6513,-6514,-6515,-6516 +dd -6518,-6519,-6520,-6521,-6522,-6523,-6524,-6525,-6527,-6528 +dd -6529,-6530,-6531,-6531,-6532,-6533,-6534,-6535,-6536,-6537 +dd -6538,-6538,-6539,-6540,-6541,-6541,-6542,-6543,-6543,-6544 +dd -6545,-6545,-6546,-6546,-6547,-6547,-6548,-6548,-6549,-6549 +dd -6550,-6550,-6550,-6551,-6551,-6551,-6552,-6552,-6552,-6552 +dd -6553,-6553,-6553,-6553,-6553,-6553,-6553,-6553,-6553,-6553 +dd -6554,-6553,-6553,-6553,-6553,-6553,-6553,-6553,-6553,-6553 +dd -6553,-6552,-6552,-6552,-6552,-6551,-6551,-6551,-6550,-6550 +dd -6550,-6549,-6549,-6548,-6548,-6547,-6547,-6546,-6546,-6545 +dd -6545,-6544,-6543,-6543,-6542,-6541,-6541,-6540,-6539,-6538 +dd -6538,-6537,-6536,-6535,-6534,-6533,-6532,-6531,-6531,-6530 +dd -6529,-6528,-6527,-6525,-6524,-6523,-6522,-6521,-6520,-6519 +dd -6518,-6516,-6515,-6514,-6513,-6511,-6510,-6509,-6507,-6506 +dd -6505,-6503,-6502,-6500,-6499,-6497,-6496,-6494,-6493,-6491 +dd -6490,-6488,-6486,-6485,-6483,-6482,-6480,-6478,-6476,-6475 +dd -6473,-6471,-6469,-6467,-6466,-6464,-6462,-6460,-6458,-6456 +dd -6454,-6452,-6450,-6448,-6446,-6444,-6442,-6440,-6437,-6435 +dd -6433,-6431,-6429,-6426,-6424,-6422,-6420,-6417,-6415,-6413 +dd -6410,-6408,-6405,-6403,-6401,-6398,-6396,-6393,-6391,-6388 +dd -6386,-6383,-6380,-6378,-6375,-6372,-6370,-6367,-6364,-6362 +dd -6359,-6356,-6353,-6350,-6348,-6345,-6342,-6339,-6336,-6333 +dd -6330,-6327,-6324,-6321,-6318,-6315,-6312,-6309,-6306,-6303 +dd -6300,-6296,-6293,-6290,-6287,-6284,-6280,-6277,-6274,-6270 +dd -6267,-6264,-6260,-6257,-6254,-6250,-6247,-6243,-6240,-6236 +dd -6233,-6229,-6226,-6222,-6218,-6215,-6211,-6208,-6204,-6200 +dd -6196,-6193,-6189,-6185,-6181,-6178,-6174,-6170,-6166,-6162 +dd -6158,-6154,-6150,-6146,-6142,-6138,-6134,-6130,-6126,-6122 +dd -6118,-6114,-6110,-6106,-6102,-6097,-6093,-6089,-6085,-6081 +dd -6076,-6072,-6068,-6063,-6059,-6055,-6050,-6046,-6041,-6037 +dd -6033,-6028,-6024,-6019,-6015,-6010,-6005,-6001,-5996,-5992 +dd -5987,-5982,-5978,-5973,-5968,-5963,-5959,-5954,-5949,-5944 +dd -5939,-5935,-5930,-5925,-5920,-5915,-5910,-5905,-5900,-5895 +dd -5890,-5885,-5880,-5875,-5870,-5865,-5860,-5855,-5850,-5844 +dd -5839,-5834,-5829,-5824,-5818,-5813,-5808,-5802,-5797,-5792 +dd -5786,-5781,-5776,-5770,-5765,-5759,-5754,-5748,-5743,-5737 +dd -5732,-5726,-5721,-5715,-5709,-5704,-5698,-5693,-5687,-5681 +dd -5675,-5670,-5664,-5658,-5652,-5647,-5641,-5635,-5629,-5623 +dd -5617,-5612,-5606,-5600,-5594,-5588,-5582,-5576,-5570,-5564 +dd -5558,-5552,-5546,-5539,-5533,-5527,-5521,-5515,-5509,-5502 +dd -5496,-5490,-5484,-5477,-5471,-5465,-5459,-5452,-5446,-5439 +dd -5433,-5427,-5420,-5414,-5407,-5401,-5394,-5388,-5381,-5375 +dd -5368,-5362,-5355,-5349,-5342,-5335,-5329,-5322,-5315,-5309 +dd -5302,-5295,-5288,-5282,-5275,-5268,-5261,-5254,-5248,-5241 +dd -5234,-5227,-5220,-5213,-5206,-5199,-5192,-5185,-5178,-5171 +dd -5164,-5157,-5150,-5143,-5136,-5129,-5122,-5115,-5107,-5100 +dd -5093,-5086,-5079,-5071,-5064,-5057,-5050,-5042,-5035,-5028 +dd -5020,-5013,-5006,-4998,-4991,-4983,-4976,-4968,-4961,-4953 +dd -4946,-4938,-4931,-4923,-4916,-4908,-4901,-4893,-4885,-4878 +dd -4870,-4863,-4855,-4847,-4839,-4832,-4824,-4816,-4808,-4801 +dd -4793,-4785,-4777,-4769,-4762,-4754,-4746,-4738,-4730,-4722 +dd -4714,-4706,-4698,-4690,-4682,-4674,-4666,-4658,-4650,-4642 +dd -4634,-4626,-4618,-4610,-4602,-4593,-4585,-4577,-4569,-4561 +dd -4552,-4544,-4536,-4528,-4519,-4511,-4503,-4495,-4486,-4478 +dd -4469,-4461,-4453,-4444,-4436,-4427,-4419,-4411,-4402,-4394 +dd -4385,-4377,-4368,-4360,-4351,-4342,-4334,-4325,-4317,-4308 +dd -4299,-4291,-4282,-4274,-4265,-4256,-4247,-4239,-4230,-4221 +dd -4213,-4204,-4195,-4186,-4177,-4169,-4160,-4151,-4142,-4133 +dd -4124,-4115,-4106,-4098,-4089,-4080,-4071,-4062,-4053,-4044 +dd -4035,-4026,-4017,-4008,-3999,-3990,-3980,-3971,-3962,-3953 +dd -3944,-3935,-3926,-3917,-3907,-3898,-3889,-3880,-3871,-3861 +dd -3852,-3843,-3834,-3824,-3815,-3806,-3796,-3787,-3778,-3768 +dd -3759,-3750,-3740,-3731,-3721,-3712,-3703,-3693,-3684,-3674 +dd -3665,-3655,-3646,-3636,-3627,-3617,-3608,-3598,-3588,-3579 +dd -3569,-3560,-3550,-3540,-3531,-3521,-3512,-3502,-3492,-3483 +dd -3473,-3463,-3453,-3444,-3434,-3424,-3414,-3405,-3395,-3385 +dd -3375,-3365,-3356,-3346,-3336,-3326,-3316,-3306,-3297,-3287 +dd -3277,-3267,-3257,-3247,-3237,-3227,-3217,-3207,-3197,-3187 +dd -3177,-3167,-3157,-3147,-3137,-3127,-3117,-3107,-3097,-3087 +dd -3077,-3067,-3056,-3046,-3036,-3026,-3016,-3006,-2996,-2985 +dd -2975,-2965,-2955,-2945,-2934,-2924,-2914,-2904,-2893,-2883 +dd -2873,-2863,-2852,-2842,-2832,-2821,-2811,-2801,-2790,-2780 +dd -2770,-2759,-2749,-2738,-2728,-2718,-2707,-2697,-2686,-2676 +dd -2666,-2655,-2645,-2634,-2624,-2613,-2603,-2592,-2582,-2571 +dd -2561,-2550,-2540,-2529,-2518,-2508,-2497,-2487,-2476,-2466 +dd -2455,-2444,-2434,-2423,-2413,-2402,-2391,-2381,-2370,-2359 +dd -2349,-2338,-2327,-2316,-2306,-2295,-2284,-2274,-2263,-2252 +dd -2241,-2231,-2220,-2209,-2198,-2188,-2177,-2166,-2155,-2144 +dd -2134,-2123,-2112,-2101,-2090,-2079,-2069,-2058,-2047,-2036 +dd -2025,-2014,-2003,-1992,-1982,-1971,-1960,-1949,-1938,-1927 +dd -1916,-1905,-1894,-1883,-1872,-1861,-1850,-1839,-1828,-1817 +dd -1806,-1795,-1784,-1773,-1762,-1751,-1740,-1729,-1718,-1707 +dd -1696,-1685,-1674,-1663,-1652,-1641,-1630,-1619,-1608,-1597 +dd -1585,-1574,-1563,-1552,-1541,-1530,-1519,-1508,-1496,-1485 +dd -1474,-1463,-1452,-1441,-1430,-1418,-1407,-1396,-1385,-1374 +dd -1363,-1351,-1340,-1329,-1318,-1307,-1295,-1284,-1273,-1262 +dd -1250,-1239,-1228,-1217,-1206,-1194,-1183,-1172,-1161,-1149 +dd -1138,-1127,-1115,-1104,-1093,-1082,-1070,-1059,-1048,-1036 +dd -1025,-1014,-1003,-991,-980,-969,-957,-946,-935,-923 +dd -912,-901,-889,-878,-867,-855,-844,-833,-821,-810 +dd -799,-787,-776,-765,-753,-742,-731,-719,-708,-696 +dd -685,-674,-662,-651,-640,-628,-617,-605,-594,-583 +dd -571,-560,-548,-537,-526,-514,-503,-491,-480,-469 +dd -457,-446,-434,-423,-411,-400,-389,-377,-366,-354 +dd -343,-332,-320,-309,-297,-286,-274,-263,-252,-240 +dd -229,-217,-206,-194,-183,-172,-160,-149,-137,-126 +dd -114,-103,-92,-80,-69,-57,-46,-34,-23,-11 + +eosinus: + +col1: + dd 0 +; misc raycaster vars: +vxx: + dd 0 +vyy: + dd 0 +vl: + dd 0 +vpx: +dd 0x0001FFFF ; initial player position * 0xFFFF + vpy: +dd 0x0001FFFF +vstepx: + dd 0 +vstepy: + dd 0 +vxxint: + dd 0 +vyyint: + dd 0 +vk: + dd 0 +va: + dd 0 +va2: + dd 0 +vdd: + dd 0 +vx1: + dd 0 +vx1b: + dd 0 +vh: + dd 0 +vdt: + dd 0 +vheading: ; initial heading: 0 to 3599 + dd 0 +vacompare: + dd 0 +vpxi: + dd 0 +vpyi: + dd 0 +wtolong: + dw 0,0 + +xtemp: + dd 0 +ytemp: + dd 0 +xfrac: + dd 0 +yfrac: + dd 0 +h_old: + dd 0 +vbottom: + dd 0 +mouseya: + dd 0 +remeax: + dd 0 +remebx: + dd 0 +remecx: + dd 0 +remedx: + dd 0 +remedi: + dd 0 +remesi: + dd 0 +red: + dd 0 +green: + dd 0 +blue: + dd 0 +pseudo: + dd 0 +step1: + dd 0 +step64: + dd 0 +lasty: + dd 0 +ceil: +include "ceil.inc" +wall: +include "wall.inc" +wall2: +include "wall2.inc" +wall3: +include "wall3.inc" +wall4: +include "wall4.inc" +wall5: +include "wall5.inc" +wall6: +include "wall6.inc" +wall7: +include "wall7.inc" + + + +labelt: + db 'FISHEYE RAYCASTING ENGINE ETC. FREE3D' + +labellen: + +I_END: + + + + + \ No newline at end of file diff --git a/programs/free3d04/trunk/readme.txt b/programs/free3d04/trunk/readme.txt new file mode 100644 index 0000000000..50634f72b8 --- /dev/null +++ b/programs/free3d04/trunk/readme.txt @@ -0,0 +1,23 @@ + +-------------------------------------------- +*** Fisheye Raycasting Engine Etc. V.0.4 *** +-------------------------------------------- + +For the MenuetOs Operating System. +Assembler-Source for FASM for MenuetOs. + +By Dieter Marfurt + +-------------------------------------------- + +Format of texture include files: + +dd 0x00RRGGBB,0x00RRGGBB.... + +for 64*64 pixels. + +Have fun! + +dietermarfurt@angelfire.com + +-------------------------------------------- diff --git a/programs/free3d04/trunk/wall.inc b/programs/free3d04/trunk/wall.inc new file mode 100644 index 0000000000..d4f38fdd78 --- /dev/null +++ b/programs/free3d04/trunk/wall.inc @@ -0,0 +1,64 @@ +dd 0x00C0B4B0,0x00BEB2AE,0x00B4A9A5,0x00B5A8A5,0x00B5A7A4,0x00AD9F9C,0x00A0918F,0x007B6C6C,0x008A7C7F,0x00AFA6A7,0x00A59D9F,0x00A9A2A2,0x00B1A8AA,0x00999093,0x0092888B,0x00978B8F,0x00827177,0x0094888C,0x00A19F9F,0x009B9E9D,0x00979898,0x008E8E8E,0x00949494,0x00979898,0x00A3A3A2,0x00A4A4A4,0x007F7F7F,0x006F6F6F,0x00767978,0x007F8783,0x008A938F,0x00878F8F,0x006D767A,0x00626B71,0x0064686C,0x00676766,0x005B5754,0x004E4C4A,0x005D5D5D,0x00777878,0x00858585,0x00868788,0x00888C8F,0x00888C90,0x0084898C,0x00818487,0x00898582,0x008F8883,0x008A837E,0x00615A55,0x005F5858,0x008A8386,0x00ABA3A6,0x00B0AAAD,0x00ADAAA9,0x00A0A29B,0x009E9B96,0x00928885,0x00796A65,0x00715F54,0x007D6B5E,0x00968578,0x00B1A095,0x00BFB1AC +dd 0x00BEB7B1,0x00B9B3AD,0x00AFA8A2,0x00B3A8A4,0x00B7A9A6,0x00B6A8A6,0x00ADA09E,0x00817576,0x00887E81,0x00B5ADB0,0x00AEA5A8,0x00A9A0A3,0x00B0A7AA,0x00A49C9F,0x00968D91,0x008F8488,0x0078686D,0x009B9093,0x00ADABAB,0x00A5A7A5,0x009B9B9B,0x00969696,0x009D9C9C,0x00AAA9A9,0x00B0B0AF,0x00A1A2A2,0x00858585,0x00717171,0x007F8181,0x0098A09E,0x008B9493,0x00798184,0x006C757A,0x005E696F,0x0061696E,0x00696E70,0x00565958,0x00474A49,0x006B706F,0x00828887,0x00848988,0x00868A8A,0x008C9093,0x008F9395,0x008C8F91,0x0087898B,0x00898984,0x008F8D85,0x008D8581,0x006B605D,0x00746D70,0x009A989E,0x00AFADB3,0x00B2AFB6,0x00B2AEB3,0x00ADA8A8,0x00ADA6A7,0x00A9A0A2,0x00A19696,0x00968884,0x00827470,0x009B8D89,0x00B1A4A0,0x00B6ADA9 +dd 0x00B6AEA8,0x00B7AFAA,0x00B0A7A2,0x00B4A8A5,0x00B6A8A5,0x00B4A7A4,0x00AFA29F,0x00877B7C,0x008A8083,0x00B4ABAF,0x00B3AAAD,0x00AFA7A9,0x00B2AAAD,0x00A9A1A3,0x009B9396,0x008A8084,0x00716569,0x009F9699,0x00B1ABAC,0x00AAA6A7,0x00A49FA1,0x00A09A9C,0x009F999C,0x00ACA6A8,0x00B0ADAE,0x00A5A5A5,0x00999999,0x00777778,0x00737576,0x00899092,0x00767D80,0x006C7378,0x006C7477,0x00636C6B,0x00666F6D,0x006A7371,0x00545C5A,0x00454D4B,0x00676F6C,0x007D8683,0x00868F8B,0x008D9391,0x00969798,0x00999999,0x00919191,0x00898988,0x008B8D86,0x0092948B,0x00928B86,0x00706260,0x00776F72,0x0099979F,0x00AAAAB2,0x00ABAAB2,0x00B1ADB3,0x00B3ABAD,0x00B3ABAE,0x00ADA6A9,0x00A69C9E,0x00908380,0x00716360,0x008F827F,0x00A39794,0x00A99F9B +dd 0x00B8ACA8,0x00BCB0AC,0x00B7AAA7,0x00BAACA9,0x00BAACA9,0x00B5A7A4,0x00B2A4A2,0x008F8483,0x0091898B,0x00ACA4A6,0x00AEA6A9,0x00B0A8AA,0x00B0A8AB,0x00AEA6A8,0x00A9A1A3,0x0090888A,0x0070686A,0x009C9396,0x00B0A8AB,0x00B2AAAD,0x00B1A9AC,0x00AFA6A9,0x00A59DA0,0x00ADA4A8,0x00ADA8AA,0x00A5A4A4,0x00969696,0x00767676,0x00717373,0x007D8383,0x006D7475,0x006E7576,0x00737B7B,0x006E7674,0x006E7674,0x006F7875,0x005B6360,0x0048504D,0x00646C69,0x007B8481,0x00878F8C,0x008D9491,0x00979898,0x00989898,0x00909090,0x008C8C8B,0x0093948F,0x00999994,0x00948E8B,0x006A6160,0x00746E72,0x0099979F,0x00A7A5AE,0x00A9A8B1,0x00AFACB3,0x00B3AFB0,0x00B1AEAF,0x00A8A5A6,0x00A09C9C,0x00827976,0x00736A66,0x009A918D,0x00A79E99,0x00ABA09C +dd 0x00B4A6A3,0x00B9ABA8,0x00B8AAA8,0x00B7A9A6,0x00B2A4A1,0x00B2A4A1,0x00B6A8A5,0x00988E8E,0x00A29A9C,0x00B2AAAC,0x00B4ACAE,0x00B4ACAF,0x00B2A9AC,0x00B1A9AB,0x00ADA5A8,0x0090888B,0x006A6265,0x00958C8F,0x00B4ACAF,0x00BDB5B8,0x00BCB5B8,0x00BCB6B8,0x00B0AAAB,0x00A59EA1,0x00999696,0x009A9A97,0x0091918D,0x006D6E6A,0x006A6D69,0x00747C79,0x006C7572,0x00727A77,0x007B8481,0x00777F7C,0x00717976,0x0077807D,0x00656E6B,0x003F4744,0x005C6462,0x007A827F,0x00818986,0x00848A88,0x00909190,0x00949494,0x00959595,0x009A9A9A,0x009A9A99,0x009E9E9D,0x00969595,0x00616060,0x006C6B6F,0x009B9AA2,0x00ACAAB3,0x00B5B3BC,0x00B2B1B8,0x00B4B4B3,0x00B1B1B1,0x00A8A8A8,0x00A4A2A1,0x00827C77,0x00746D67,0x0099928C,0x00A49C97,0x00AEA29F +dd 0x00B4A6A3,0x00B9ABA8,0x00B8ABA8,0x00B4A6A3,0x00AFA19E,0x00B4A7A4,0x00B5A7A4,0x00928787,0x00999093,0x00B2A9AC,0x00BFB6B9,0x00B9B1B3,0x00B6AEB1,0x00B3ABAE,0x00AAA2A5,0x008C8487,0x0060585B,0x00898184,0x00ACA4A6,0x00B6AFB1,0x00B7B3B4,0x00B8B6B7,0x00B0AFAF,0x009F9E9E,0x00939390,0x00979890,0x00989991,0x0071736B,0x00696D67,0x00707977,0x00707976,0x00727A77,0x00777F7C,0x00707975,0x006F7774,0x007B8381,0x006F7775,0x00454D4A,0x005F6764,0x007B8481,0x00828A87,0x00878E8B,0x00939494,0x00969696,0x009A9B9B,0x00A0A0A0,0x009E9E9E,0x00A2A2A2,0x009B9B9B,0x00666666,0x00706F74,0x009F9DA6,0x00B1AFB8,0x00BCBBC3,0x00B6B5BB,0x00B1B1B1,0x00AEAEAE,0x00A7A7A7,0x00A3A3A2,0x0088827F,0x007A6E67,0x00948880,0x009A928F,0x00AA9F9E +dd 0x00AA9B98,0x00B4A6A3,0x00B4A7A4,0x00AEA09D,0x00AC9E9B,0x00B6A8A5,0x00B0A39F,0x008C8181,0x00898083,0x00B4ABAE,0x00C6BEC1,0x00BEB6B8,0x00BCB3B6,0x00B3ABAE,0x00A49C9E,0x008E8588,0x0062595C,0x008A8184,0x00ABA3A5,0x00B1AAAC,0x00B1AEAF,0x00AFAEAE,0x00AAAAAA,0x00A5A5A5,0x009B9A97,0x0096968F,0x0095958D,0x0075756E,0x00686C67,0x006B7574,0x006B7371,0x006F7774,0x00727977,0x006B7372,0x006B7374,0x00747C7D,0x006C7274,0x00484F4E,0x005A625F,0x00747C7A,0x007C8582,0x00838B88,0x008C9290,0x008C9290,0x008B918F,0x008E9392,0x00959796,0x009E9E9E,0x00969696,0x006A6A69,0x0079787D,0x009E9CA5,0x00A8A6B0,0x00B0AFB7,0x00B0AFB5,0x00ABABAC,0x00ACACAC,0x00A7A7A7,0x009D9E9F,0x008D8788,0x0087756D,0x0098857A,0x0099908E,0x00A29898 +dd 0x00AB9E9B,0x00B3A5A3,0x00B2A5A2,0x00A99B98,0x00A1928F,0x00A69895,0x00A69895,0x008C7F7F,0x0082777A,0x00A69DA0,0x00B2ADAE,0x00B5B0B1,0x00BBB3B6,0x00B5ADAF,0x00A79FA2,0x00948C8F,0x006B6265,0x00837B7E,0x00A59D9F,0x00A69EA1,0x00AAA6A8,0x00A6A5A6,0x009A9B9B,0x009C9C9C,0x00959391,0x00938E89,0x008E8983,0x00837E78,0x0073726E,0x006C7474,0x00646C6A,0x006A7370,0x006D7675,0x006B7376,0x00697076,0x006E7479,0x0064696F,0x003B4343,0x004F5754,0x006F7774,0x0079817E,0x007B8481,0x007E8683,0x007D8683,0x007B8381,0x00828A88,0x00909291,0x00979797,0x00858585,0x005D5E5D,0x0077767A,0x0095939C,0x009C9AA4,0x00A7A5AD,0x00B2B0B7,0x00ADADAF,0x00ABABAC,0x00A8A8A9,0x0098989B,0x008C8486,0x0085736B,0x0097837A,0x00A79C9A,0x00ABA1A0 +dd 0x009E9698,0x00A09799,0x00989092,0x00908584,0x00857673,0x00857674,0x008B7D7A,0x00786969,0x0074656A,0x008E8488,0x00989696,0x00A3A2A2,0x00B3ACAE,0x00B4ABAE,0x00A9A1A4,0x008B8487,0x00776F72,0x00766E71,0x00958D90,0x009D9598,0x00A09C9D,0x009F9E9E,0x00929292,0x00929192,0x00938F8E,0x00948D88,0x0089827D,0x00807974,0x0075716C,0x006C7170,0x0067706E,0x006D7673,0x0067716F,0x00636B6E,0x005C6269,0x005B6268,0x00525960,0x00343B3D,0x00505856,0x006D7572,0x006D7573,0x00707875,0x00717876,0x00727876,0x00707674,0x00777C7B,0x0080807F,0x007B7877,0x00605D5B,0x00494643,0x00615C5E,0x007F7982,0x00908995,0x008F8893,0x00908B93,0x00929297,0x00929297,0x0097969C,0x008B888D,0x007A7070,0x006E5F5A,0x0081716D,0x009D908E,0x00A49A9B +dd 0x00786A67,0x00756563,0x006A5B59,0x00716361,0x007B6E6B,0x00827572,0x007D706D,0x006F6060,0x00706164,0x00746A6D,0x00787675,0x00828180,0x008B8687,0x008C8384,0x00827779,0x00695D60,0x00696063,0x00625A5C,0x00797073,0x008E8689,0x00928F90,0x00949494,0x00909090,0x00939393,0x00939292,0x0080817E,0x007F7C76,0x008A8075,0x007E7163,0x00646059,0x00646561,0x00656864,0x004A5151,0x00394044,0x002B3237,0x002D3439,0x002F353A,0x00323A3A,0x00434B49,0x00535B59,0x00535B59,0x00555B59,0x004E5050,0x00474847,0x00464747,0x004E4E4F,0x0055504E,0x00514A47,0x00524B46,0x005A534E,0x00585050,0x00544C50,0x00594F54,0x00494044,0x00463E41,0x004D4648,0x00554D50,0x00645B5D,0x00635A5A,0x00625654,0x005F524F,0x005C4E4C,0x00675A58,0x00716360 +dd 0x00996851,0x00865948,0x00795C50,0x0080726A,0x00918883,0x009C938E,0x009A928C,0x00988E8B,0x00968C8A,0x008E8582,0x0085807C,0x007A7672,0x00635E5A,0x005E5451,0x006E5D5C,0x006E5C5B,0x0063575A,0x005E5558,0x00635B5D,0x006E6568,0x00747171,0x006F7070,0x006C6C6C,0x00707070,0x00707373,0x006F7673,0x00818178,0x00968B7A,0x008F806D,0x007B756D,0x00737372,0x00747878,0x00686E71,0x005C6266,0x0052595C,0x00525959,0x00474F4C,0x00444C48,0x00363E3B,0x00373F3C,0x003D4542,0x00474D4A,0x004C4D4D,0x004E4E4E,0x00606060,0x00727271,0x00817D7A,0x0086817B,0x00847E79,0x007E7873,0x00746E6A,0x006D6864,0x006C6763,0x005D5754,0x005F5955,0x00645B57,0x006E635F,0x00766B67,0x00766A66,0x00776C68,0x00736964,0x00665C58,0x00675B54,0x007C5F4E +dd 0x008E6A56,0x008A675B,0x00938278,0x009A968D,0x00ABA59F,0x00AFA7A2,0x00AEA7A1,0x00B3ACA6,0x00B5AEA9,0x00B2ABA6,0x00A9A29D,0x009D938F,0x0081716F,0x00776765,0x00857975,0x008F8581,0x008B8383,0x00928A8D,0x008D8487,0x0082797C,0x00777474,0x00737373,0x007B7C7B,0x00757474,0x00716F6C,0x0089877D,0x008F8C7F,0x00979387,0x00949187,0x00939596,0x0091979C,0x00949A9F,0x0090979C,0x00888F93,0x007C8486,0x00747E7D,0x0066716E,0x005D6866,0x005A6565,0x00636C69,0x00626762,0x005D5F5B,0x00636463,0x00777777,0x00858585,0x00969695,0x009D9C9A,0x009E9D9B,0x00939291,0x00868584,0x00868483,0x00848381,0x00757473,0x00666564,0x00757271,0x00837C78,0x00857E78,0x008B847E,0x0097908A,0x009B948F,0x00938B86,0x00817A74,0x00746C65,0x00786755 +dd 0x0071605E,0x00826C6B,0x00A29390,0x00AAA39D,0x00B2ABA5,0x00B2ACA6,0x00B3ACA7,0x00B9B2AB,0x00BCB5AF,0x00BCB5B1,0x00B8B0B0,0x00ADA2A5,0x0089797A,0x00786B68,0x008C837E,0x009F9A94,0x009D9A99,0x00A29EA0,0x00A4A0A1,0x00A5A2A2,0x00A2A5A4,0x009FA5A3,0x00A7A8A7,0x009C9798,0x008A8585,0x00969791,0x008F938D,0x00959A95,0x009AA19D,0x00979FA2,0x008C959A,0x00848D91,0x007A8385,0x00778184,0x00778386,0x007A8789,0x00778486,0x00788689,0x007D8B8D,0x007D8684,0x00767872,0x0063625C,0x00585856,0x007B7B7B,0x00898989,0x00969696,0x009E9E9E,0x00A0A0A0,0x008D8E8E,0x00878787,0x008A8A8A,0x008E8E8E,0x00818181,0x00686868,0x00777676,0x009A948F,0x00A59E98,0x00A59E99,0x00A7A09C,0x00A8A39E,0x009E9894,0x008B847E,0x00817973,0x007B756E +dd 0x00605855,0x007A716C,0x00A09792,0x00ABA39E,0x00B1AAA4,0x00B2ABA5,0x00B4ADA8,0x00BEB7B1,0x00C3BCB7,0x00BFB7B6,0x00BBB2B8,0x00B3A9B2,0x008D8584,0x00736C66,0x0088817B,0x00A19A96,0x00A3A09F,0x00A3A3A3,0x00A4A5A5,0x00A6A6A5,0x00A5A9A7,0x00A0A7A5,0x00A4A5A4,0x00969091,0x00857E81,0x009AA09D,0x009AA19F,0x0099A19E,0x0099A2A0,0x008F989A,0x00778488,0x00647173,0x00546060,0x00576365,0x00667477,0x00788689,0x0079878A,0x007A888C,0x007A898A,0x00767F7B,0x00777971,0x0068685F,0x00585856,0x00727271,0x007F7F7F,0x00868686,0x008F9291,0x00969A99,0x00848887,0x00868B89,0x008E9191,0x00919292,0x007B7C7C,0x00636363,0x00747371,0x00989389,0x00A9A299,0x00A49D9A,0x009C9597,0x009B999A,0x00959392,0x0087807A,0x00867970,0x00897F77 +dd 0x006C6661,0x007C7670,0x009E9792,0x00ABA49F,0x00ADA6A1,0x00AFA8A3,0x00B4ADA8,0x00BEB7B1,0x00C3BCB5,0x00C8C0BE,0x00C7BDC3,0x00BDB3BC,0x00948D8B,0x006F6863,0x007C756F,0x0097918C,0x00A19F9C,0x00A4A4A3,0x00A7A7A7,0x00A7A7A7,0x00A0A4A2,0x009CA29F,0x00A3A4A1,0x00908989,0x00787070,0x00969B99,0x00A0A8A5,0x009FA8A4,0x00929B9A,0x007B8789,0x00606E71,0x00526062,0x00505B5B,0x004D5A5B,0x00526062,0x00647274,0x006F7D7F,0x006C7B7D,0x00697876,0x00717A73,0x007A7D72,0x0075756A,0x0071716E,0x00797978,0x00878787,0x00818282,0x00838987,0x008A9290,0x007C8582,0x0086908D,0x00979D9B,0x009A9B9B,0x007D7D7D,0x005B5B5B,0x006E6C6A,0x00959084,0x00A9A399,0x00A19998,0x00938B8F,0x008A888C,0x00888686,0x008C857F,0x008F8378,0x00998E86 +dd 0x00766F6A,0x00837C76,0x00A69F99,0x00B2ACA6,0x00B2ABA5,0x00B6AFAA,0x00B8B1AC,0x00BDB7AF,0x00C0BBAE,0x00C8C1BA,0x00C2BABB,0x00B9B1B6,0x00958E8B,0x00736C67,0x007B746E,0x008E8782,0x009C9A98,0x00A2A2A2,0x00A3A3A3,0x00A4A4A5,0x00A0A3A0,0x009DA099,0x00A3A19A,0x008E8380,0x00786E6B,0x009A9E9B,0x00A2AAA7,0x0099A19F,0x007C8688,0x00626E72,0x004F5E61,0x004D5A5D,0x00535E5E,0x00525F60,0x00515F61,0x00596669,0x00626F73,0x00627175,0x006A777C,0x007A8284,0x007C7D7B,0x00676561,0x00686765,0x00717070,0x00858584,0x008E8F8E,0x00949998,0x00969D9B,0x00838B89,0x00838B88,0x00949897,0x00949594,0x007C7C7C,0x00555656,0x006D6C69,0x00979187,0x00A9A49A,0x00A49D9A,0x00999192,0x008C878A,0x00858082,0x00948E87,0x009B9286,0x00A39B91 +dd 0x006A635D,0x00807973,0x00A9A29C,0x00B7B0AA,0x00B9B2AC,0x00BCB5AF,0x00B8B2AC,0x00BFB9B1,0x00BFBAAC,0x00B8B2A8,0x00ABA3A3,0x00ACA4A7,0x00978F8D,0x0077706B,0x008B857F,0x009E9792,0x00A2A09E,0x00A2A2A2,0x00A1A2A2,0x00A3A3A3,0x009FA19E,0x009C9F97,0x009D9B94,0x00837875,0x00766C69,0x009BA09D,0x00A0A8A5,0x00909998,0x006D787B,0x005E6B6E,0x0059666A,0x00576467,0x00576363,0x005A6769,0x005F6D70,0x005F6D70,0x005D6B6E,0x00677477,0x00727C80,0x00767E80,0x00747978,0x00585A58,0x00555050,0x00696768,0x007E817F,0x00929896,0x009EA2A1,0x00929493,0x00787A79,0x007E807F,0x009A9A9A,0x00919191,0x00737373,0x004B4B4C,0x006A6968,0x0099938E,0x00ABA49E,0x00A9A29C,0x009B938F,0x008A8284,0x00888083,0x00948D87,0x00999386,0x00A29C91 +dd 0x00706963,0x007B746E,0x00A09994,0x00AAA39D,0x00AEA7A1,0x00B6AFA9,0x00BAB3AD,0x00C1BBB3,0x00BBB5AA,0x00ACA59D,0x00A09996,0x00A09998,0x00928C8B,0x00757270,0x00989592,0x00A9A7A4,0x00A3A4A3,0x009DA2A1,0x009FA4A3,0x00A1A6A4,0x009EA2A0,0x009D9F9C,0x009B9A97,0x007A7776,0x006D6B6A,0x00949A9B,0x00A1A8AB,0x00939B9E,0x006A7579,0x005C6A6D,0x00606F71,0x005E6B6E,0x00566465,0x00566467,0x005B686C,0x00556366,0x004F5D60,0x005E6968,0x006A7370,0x00717976,0x00717976,0x00565A59,0x00534C4E,0x006F6B6C,0x007D817F,0x008C9491,0x00949897,0x007F807F,0x006A6A6A,0x00808180,0x009E9E9E,0x00999999,0x00727272,0x00474748,0x00626261,0x008E8985,0x00A49D99,0x00A19B97,0x00938D8A,0x00847C7D,0x00898182,0x00958E89,0x009D978C,0x00A59E94 +dd 0x00655E58,0x00655E58,0x0099928C,0x00A9A29D,0x00AFA8A3,0x00B7B0AA,0x00BAB3AC,0x00B8B1AB,0x00B7B0AA,0x00B3ADA6,0x00AAA39D,0x009E9894,0x008A8886,0x006B6C6C,0x00939393,0x00A7A8A7,0x009FA3A1,0x0099A29F,0x009BA4A1,0x009CA5A2,0x009DA2A1,0x009FA0A0,0x009B9B9B,0x00797879,0x00656767,0x008B9195,0x009BA2A8,0x00959CA2,0x00778186,0x00667376,0x006C797C,0x00737F82,0x006F7B7C,0x006B777A,0x00647073,0x00515E61,0x00455155,0x00566161,0x0067716E,0x006B7571,0x00636D69,0x0049504D,0x00484445,0x006C696A,0x00858686,0x008C9290,0x008E9393,0x00828688,0x00717577,0x008A8E91,0x0095989A,0x00909091,0x006F6F6F,0x004D4D4D,0x00616161,0x00888685,0x009E9C9C,0x00999797,0x00918E8E,0x00888280,0x008E8783,0x0097908B,0x009F9891,0x009D968F +dd 0x00524A44,0x0059524C,0x008E8781,0x00A8A19C,0x00AAA39F,0x00ACA4A0,0x00ACA5A0,0x00AAA29D,0x00ACA59F,0x00ACA6A0,0x00A19B96,0x008C8582,0x007B7877,0x00676667,0x008C8B8B,0x009C9A9B,0x00969896,0x00949A96,0x00969D99,0x00989F9B,0x009CA09E,0x009FA0A0,0x009B9B9B,0x007D7D7D,0x006A6B6B,0x007D8184,0x0085898D,0x00878B8F,0x0080868A,0x007B8386,0x0080898C,0x00858D90,0x00778082,0x006F7779,0x00626A6B,0x004D5657,0x003F4848,0x004E5856,0x0065736E,0x00697773,0x005D6A66,0x0046504D,0x00474948,0x005E5E5F,0x007B7B7B,0x007B7C7B,0x00757A7D,0x00747B81,0x006F777C,0x0080878C,0x007B8184,0x00717273,0x005F5F5F,0x004E4E4E,0x00626262,0x00888988,0x00979898,0x00888989,0x007F7E7E,0x00817C79,0x008B847E,0x00968F89,0x0097908A,0x0088817B +dd 0x005B4F4B,0x00625652,0x006E635F,0x00877D7B,0x008F8787,0x008F8788,0x00908788,0x00958C8D,0x008F8787,0x0081797B,0x0070696A,0x005C5455,0x00564F50,0x0060595B,0x00766F72,0x007A7375,0x006F6D6A,0x006D6F68,0x0072756D,0x00787B74,0x00838580,0x00888887,0x007E7E7E,0x006D6D6D,0x00676767,0x005C5D5D,0x00505152,0x00555656,0x005B5C5C,0x00555858,0x00565D5C,0x005A6261,0x00454D4B,0x00404847,0x00363E3D,0x002F3736,0x0038413D,0x00424846,0x00414645,0x00464B49,0x00484C4A,0x00464948,0x004B4B4B,0x00434343,0x004F4F4F,0x00484948,0x003A3E40,0x003B4146,0x0041464B,0x004A5055,0x0054575A,0x00555656,0x00525252,0x00575757,0x005D5D5D,0x00626262,0x006B6B6B,0x00616161,0x00686867,0x00726D6C,0x0078706F,0x00837C7B,0x007A7371,0x00625957 +dd 0x007D7576,0x00766D6F,0x0061595B,0x00625B5D,0x0061595C,0x00574E51,0x00584F52,0x00655C5F,0x006C6365,0x006D6467,0x00655C5F,0x00645B5E,0x006C6467,0x007C7476,0x007A7275,0x00685F63,0x005A5654,0x0064655E,0x00666760,0x00686961,0x00696B64,0x00626361,0x005D5D5D,0x00696A69,0x00737373,0x00676666,0x00585858,0x00575757,0x005F5F5F,0x005B5F5E,0x005A625F,0x005C6562,0x004C5653,0x00454F4E,0x003D4846,0x00414B4A,0x004E5756,0x00494D4E,0x002F2F2F,0x00302F2F,0x003C3B3B,0x003F3E3E,0x003B3A3A,0x00373737,0x004B4B4B,0x00545453,0x00525353,0x00565759,0x005B5C5D,0x00535456,0x005F6061,0x00696A6A,0x006C6C6C,0x00777777,0x00767677,0x00606060,0x005A5A5A,0x00646464,0x00969796,0x00847F80,0x00585053,0x005C5456,0x00645C5E,0x00645D5E +dd 0x00B4B5BB,0x00A6A6AD,0x008A8C93,0x007B7A80,0x006E6467,0x005A4F50,0x00665B5C,0x00766C6C,0x00878081,0x00878183,0x008A8588,0x00999496,0x009F9C9F,0x00949397,0x00929094,0x00838186,0x006B6B6C,0x00676864,0x00676763,0x0081827E,0x00898A86,0x00777B79,0x00757A79,0x007E8281,0x007E8180,0x007D8180,0x007A7E7D,0x006B6F6E,0x00646967,0x00747B7A,0x007B8585,0x00778281,0x006C7876,0x00647171,0x00626F71,0x00637174,0x00606C6F,0x004F5557,0x003D3D3E,0x004A4A4A,0x00585858,0x00585757,0x004F4E4E,0x00515151,0x00555555,0x00595A59,0x005D5D5D,0x0059595A,0x00666666,0x00616161,0x006D6D6D,0x00707170,0x00747575,0x00868687,0x00929293,0x007E7E7F,0x00686868,0x005F5F5F,0x007D7D7D,0x00746F71,0x00686165,0x00807A7E,0x00918D90,0x009D9A9E +dd 0x00BFC5CB,0x00BBC1C7,0x00A7AEB4,0x00979A9E,0x00827A77,0x006A5F5B,0x00776C68,0x00827975,0x00908D8C,0x00908F90,0x00969595,0x00A0A0A1,0x00A0A3A7,0x0091979D,0x00959CA2,0x0092999E,0x007D8185,0x00696A6A,0x00686968,0x00858686,0x00929392,0x008A918E,0x008E9693,0x008A928F,0x00848D89,0x00818986,0x007F8884,0x006F7773,0x0059615D,0x00707A78,0x00818E8F,0x00838F92,0x007D888A,0x00758083,0x006D7A7D,0x006A787A,0x00657375,0x004F5657,0x00353737,0x00515353,0x00696A6A,0x00656666,0x00616262,0x00757877,0x00747776,0x00646766,0x005F6060,0x00525252,0x00606060,0x00737474,0x00838685,0x007F8483,0x00838887,0x008E9292,0x008F9392,0x00868787,0x00737373,0x005C5C5C,0x005F5E5F,0x007A7B7E,0x0091949A,0x00A7ABB1,0x00B1B6BC,0x00BCC1C6 +dd 0x00B2B8BE,0x00B1B7BD,0x00A7AEB3,0x009DA1A4,0x0083817D,0x0068665F,0x0066655E,0x007E7E78,0x0090918F,0x00919192,0x00949494,0x009A9A9A,0x00989C9E,0x00969CA1,0x0099A0A5,0x00959CA1,0x007E8286,0x00636565,0x00747574,0x008A8B8B,0x008C8E8E,0x00868D8A,0x00909895,0x008D9593,0x00848C89,0x0079817E,0x00767F7C,0x00707976,0x0059615F,0x00687271,0x007A8789,0x00818C90,0x00818B8E,0x00808A8D,0x00768383,0x006E7C79,0x00697774,0x004B5552,0x00242B29,0x00474E4C,0x00646B69,0x00616865,0x00626967,0x00767E7B,0x007D8682,0x00757D79,0x00696C6B,0x00555555,0x00565656,0x00757575,0x00828684,0x00838A88,0x008A9290,0x0089918E,0x007D8481,0x00828483,0x00757575,0x00535353,0x005B5A5C,0x00919699,0x00B2B9BF,0x00BCC3C9,0x00B8BFC5,0x00BFC6CB +dd 0x00A7ACAE,0x009CA0A3,0x0094979A,0x00999B9C,0x00878886,0x006B6D6A,0x005D5E5B,0x007B7D7A,0x008D8D8D,0x008D8D8E,0x00909090,0x009A9A9A,0x00A5A5A9,0x00A7A8AF,0x00A2A2AA,0x0097989F,0x007D7F84,0x00575D5C,0x0069706D,0x00818886,0x00818785,0x00808784,0x00878F8C,0x0089918F,0x00828A87,0x007A8280,0x007A8380,0x00777F7C,0x005E6663,0x00636D6B,0x00717E7F,0x00778387,0x00788285,0x007B8587,0x00778482,0x00707D7A,0x00667570,0x0044504C,0x002B3331,0x00505855,0x00666E6B,0x00606865,0x00676F6D,0x00757D7A,0x00838B88,0x00868E8B,0x007B7F7D,0x00616161,0x00484848,0x00605F5F,0x00747776,0x007F8684,0x00848C8A,0x00808885,0x0079817E,0x00858787,0x00787878,0x00565656,0x00656566,0x00979B9F,0x00ADB3B9,0x00ACB3B9,0x00A0A7AD,0x00A3AAAE +dd 0x00A3A3A3,0x009B9B9C,0x00999999,0x00A1A1A2,0x00929393,0x006C6D6D,0x005B5B5B,0x007B7C7B,0x008F8F8F,0x00939393,0x00979797,0x00A3A3A3,0x00AFAFB2,0x00B0AFB7,0x00A9A7B0,0x009D9CA4,0x0087888D,0x00535B59,0x005C6562,0x007D8683,0x007D8582,0x007F8785,0x00808986,0x00818986,0x007F8784,0x007D8583,0x00808986,0x007E8683,0x00646C68,0x00626B69,0x006A7778,0x006F7C7E,0x00687475,0x00687573,0x00697873,0x00677671,0x00616F6A,0x003F4A45,0x00303835,0x005C6461,0x00727A78,0x00666F6C,0x00747C79,0x007C8482,0x00828B88,0x0079827F,0x00717473,0x00585958,0x00434343,0x00595959,0x006C6F6E,0x0078807E,0x0078817E,0x00767E7C,0x007A807F,0x00828383,0x007A7A7A,0x005D5D5D,0x00676868,0x0094989B,0x00A8AEB4,0x00A2A9B0,0x00959CA2,0x00959A9F +dd 0x009B9B9B,0x00989898,0x00929292,0x00929292,0x00828283,0x00646464,0x00646464,0x00818181,0x00949597,0x009D9FA1,0x009C9FA0,0x00A3A5A6,0x00A8A9AD,0x00A8A9B0,0x00A2A4AB,0x009799A1,0x00898B90,0x005A5F5E,0x00656B69,0x00828785,0x00868C8A,0x00878F8C,0x00858E8B,0x00808986,0x007B8380,0x007E8784,0x008A9290,0x00858D8A,0x0068706C,0x00616A68,0x00687576,0x00798488,0x00788285,0x00727F7D,0x006E7B78,0x00667470,0x005E6D67,0x00424C48,0x002B3230,0x004F5754,0x00656D6B,0x00545C5A,0x0068716E,0x0077807D,0x007C8582,0x00717876,0x00606463,0x004C4C4C,0x00484848,0x005F5F5F,0x00666967,0x00747B79,0x00767F7C,0x0078807D,0x007B817F,0x00797A79,0x00767474,0x005A5A59,0x00616262,0x00919598,0x00AAB1B6,0x00A6ADB3,0x0098A0A6,0x0091979B +dd 0x00929292,0x008F8F90,0x00878787,0x00878787,0x00838383,0x00676767,0x005F6060,0x007F7F80,0x0093979A,0x009CA2A8,0x009AA1A6,0x009DA3A9,0x009BA2A6,0x00999FA5,0x00999FA5,0x008E959B,0x007D8387,0x005D5E5E,0x00767777,0x00868787,0x008C8D8D,0x00848A88,0x007B8380,0x00737C79,0x006D7673,0x00747D7A,0x00858E8B,0x00808885,0x00656D69,0x005B6361,0x00647071,0x00758185,0x00737F82,0x006C7978,0x00697573,0x00616F6B,0x00596863,0x003F4A46,0x00282F2D,0x0049514E,0x00565E5C,0x00474F4C,0x00626B68,0x00747D7A,0x00737B78,0x006A726F,0x00585B5A,0x00484747,0x004F4F4F,0x00666666,0x00676A68,0x00737B78,0x00737B78,0x00727A77,0x00787F7D,0x00818382,0x007B7A7A,0x00525252,0x00595959,0x00838886,0x00919998,0x00959CA1,0x008E949E,0x00878C95 +dd 0x00848485,0x00858586,0x00828282,0x007F807F,0x00797A79,0x005E5F5E,0x005B5A5A,0x00797A7A,0x008F9396,0x00969CA2,0x0092989E,0x00959CA1,0x00999FA4,0x00989FA3,0x00979EA3,0x0090969C,0x00797F83,0x005B5C5D,0x00737373,0x007B7B7B,0x00808181,0x00767B79,0x006A7371,0x00656E6B,0x00626967,0x00636B68,0x00717A77,0x00717977,0x005E6663,0x00616A68,0x00677273,0x00667475,0x005B6A69,0x00566563,0x00586665,0x00586766,0x00546362,0x00313D3B,0x00242C29,0x00454E4B,0x00545C5A,0x004B5350,0x005F6764,0x00646C69,0x005A625F,0x005B635F,0x004D514F,0x00333333,0x003C3C3C,0x005F5E5E,0x00656766,0x006D7573,0x00757D7B,0x006F7774,0x00727977,0x007C7D7D,0x006F6F6F,0x00454545,0x004F4F4F,0x007A7E7C,0x00858E8A,0x0091989D,0x008F95A2,0x00898D99 +dd 0x007B7B7C,0x006A6A6A,0x005D5D5D,0x005C5C5B,0x005C5A58,0x0058504F,0x005C5050,0x00605B59,0x006F7171,0x00777B7E,0x00747679,0x0075787B,0x007C7F82,0x007A7D7F,0x006B6E71,0x0067696C,0x005A5C5F,0x004C4D4D,0x00606060,0x00646464,0x00686868,0x00606566,0x005A6263,0x005D6161,0x00676763,0x0063635D,0x00646760,0x005E635F,0x004E5856,0x005C6969,0x00576665,0x0052605E,0x00495754,0x00485757,0x004F5E60,0x00576669,0x0049575A,0x00232F2E,0x00202926,0x00373F3C,0x00444D4A,0x00444D4A,0x00515956,0x0048504E,0x00363E3C,0x003A413F,0x003C3F3E,0x00373737,0x00464545,0x005C5C5B,0x005F615F,0x00656C6A,0x00717976,0x00686F6D,0x006C716F,0x00676A69,0x00595A59,0x0040403F,0x00494746,0x00666865,0x00727876,0x0080858B,0x00838694,0x00848594 +dd 0x005B5959,0x004A4746,0x00434240,0x004A4948,0x004D4A46,0x005C4D4C,0x00634F4E,0x004E443E,0x004A4743,0x004E4D4C,0x00504E4D,0x00504D4E,0x00555153,0x005C5759,0x004F4B4D,0x004D4A4B,0x004E4E4C,0x00474846,0x00474646,0x00474546,0x004E4C4D,0x00484B4D,0x00454B4E,0x00494A4B,0x005B5653,0x0066605A,0x0067655E,0x0060625D,0x004D5556,0x004B585C,0x00455353,0x00384542,0x00232C2B,0x00232E30,0x00293538,0x002B373A,0x00222E31,0x00232D2E,0x002B3331,0x00232B2A,0x00222B29,0x002C3533,0x00373F3D,0x00293030,0x00252B2B,0x00313636,0x003E4140,0x00484646,0x00484343,0x00484843,0x004B5049,0x00494D47,0x00434640,0x00434741,0x004E514B,0x0041463F,0x003D413B,0x00403F3A,0x004B4640,0x0056524D,0x005F5F5D,0x0068676C,0x0066646F,0x00625F6B +dd 0x005C5550,0x00594F49,0x0064605C,0x006A6B6A,0x006E6E6D,0x00757170,0x0077716E,0x0069625D,0x005E5955,0x00645F5B,0x00716A69,0x0073676A,0x006A5B60,0x0063555A,0x006F6267,0x00766F71,0x006B6968,0x00656563,0x006A6969,0x00696567,0x00716C6E,0x00717172,0x006E7373,0x00606564,0x005A5959,0x00615C5E,0x006A6768,0x006E6D70,0x00595D62,0x004C545B,0x00576064,0x00485054,0x00282E32,0x0030373C,0x0032393E,0x002D363B,0x00303B41,0x003A454A,0x00455155,0x003A454A,0x00363D42,0x002F3539,0x00393F43,0x003B4146,0x0043494D,0x00575D61,0x00686C71,0x0065666C,0x005C5C5F,0x00595E59,0x00545A54,0x00434944,0x00353B36,0x004B4E4A,0x00656563,0x005F605E,0x00616260,0x00666361,0x0077716C,0x007F7974,0x00827D79,0x007A7674,0x0069696C,0x00606063 +dd 0x005F6060,0x00635F5D,0x00898885,0x00919292,0x009B9A9B,0x009D9E9E,0x009E9E9E,0x00989798,0x00919091,0x00919090,0x00959494,0x00949295,0x00827F82,0x005E5A5B,0x00686362,0x00848385,0x0085888C,0x00808488,0x00898C90,0x00818487,0x00818484,0x00838987,0x00848C8A,0x00767F7C,0x00676D70,0x0071757B,0x00797D83,0x007A7F86,0x006A7177,0x004F565C,0x0051585E,0x00515A5F,0x00374245,0x00414D50,0x00556164,0x00637175,0x006D7F86,0x00687C82,0x006D8289,0x006A7D84,0x00656F75,0x00484E54,0x004C5258,0x00666D73,0x00737A80,0x00868D92,0x008D9399,0x0083898F,0x007E8489,0x0079817F,0x0078807D,0x0067706C,0x00464E4B,0x00616564,0x007A7A7A,0x007E7E7F,0x007E7E7F,0x00807F80,0x00919292,0x009E9FA0,0x009FA0A2,0x00939799,0x0081898F,0x007D848B +dd 0x0064676D,0x006A6A6F,0x008F9295,0x00979CA0,0x00A1A6AA,0x00A3A8AD,0x00A4A7AB,0x00A5A6A7,0x00A5A7A7,0x00A1A2A3,0x009C9FA0,0x00999EA3,0x008F9397,0x00727170,0x00736D68,0x00858585,0x00858C91,0x00888F95,0x00969DA3,0x008C9397,0x00828B89,0x00858D8A,0x0088908D,0x00767E7C,0x00646B6F,0x00777D83,0x007B8288,0x00798086,0x006F767B,0x0050575C,0x004B5358,0x004C5659,0x003C494B,0x004C5A5D,0x006B797C,0x00748588,0x00798E94,0x0071878D,0x0070858C,0x0073878E,0x00727F84,0x00545B5F,0x0053575C,0x00797D83,0x00899095,0x00939BA0,0x00939BA0,0x008A9298,0x0081898C,0x007F8887,0x00899190,0x007D8383,0x00565B5B,0x00707372,0x007F7F7F,0x00838383,0x00888888,0x00909294,0x00989FA3,0x009CA4A9,0x00929A9F,0x00848D92,0x007A818B,0x007B818B +dd 0x0067666F,0x0075747D,0x0092959C,0x00969EA3,0x009FA7AD,0x00A4ABB1,0x00A4A8AD,0x00A6A7A6,0x00A7A7A7,0x00A4A5A4,0x00A0A2A3,0x009BA1A6,0x00959A9D,0x00767574,0x006D6763,0x00828282,0x00888F93,0x008D9499,0x009AA0A5,0x00949B9C,0x008B928F,0x008C9292,0x00898E8E,0x00707673,0x005B6363,0x0070797A,0x007D8687,0x007B8484,0x006E7777,0x00535B5B,0x00515958,0x004D5555,0x00444F51,0x00576468,0x006A7B7D,0x006C8081,0x00758A8C,0x0072888A,0x0072888B,0x007C9293,0x00758886,0x005A5E5F,0x005E565B,0x00797479,0x00858A8C,0x008D989C,0x008D989C,0x00828E92,0x007D8A8D,0x00849193,0x00909B9E,0x0084898E,0x005E5D65,0x0078777B,0x00888888,0x0080807F,0x00868686,0x00929495,0x0093999E,0x008C9399,0x00848B91,0x007D848A,0x007E7F88,0x00787780 +dd 0x005B585F,0x007B7A81,0x0097989F,0x00969CA1,0x009FA5AA,0x00A2A8AC,0x00A7AAAD,0x00ACADAD,0x00AEAEAE,0x00AFAFAE,0x00A8AAA9,0x00A0A3A6,0x009A9C9F,0x00706F6E,0x00615E5C,0x00878787,0x00959799,0x00959699,0x009B9D9E,0x00999B98,0x00979894,0x009898A0,0x008A8992,0x006E706A,0x005B5F5A,0x006E7371,0x00818584,0x00787B7A,0x00686D6C,0x00555D5B,0x004C5551,0x004C5352,0x004D5559,0x005D686C,0x0066797A,0x006C8383,0x00728888,0x00728888,0x00708787,0x00778E8E,0x006F847F,0x004E5351,0x005E5156,0x0081777B,0x00828587,0x00889496,0x008E9B9D,0x00839093,0x00808D90,0x0089979A,0x008E9A9E,0x00848990,0x00605E67,0x0078757B,0x008E8D8E,0x00848484,0x00848484,0x008B8D8E,0x008A9095,0x00858C92,0x00888E94,0x00868B91,0x00888890,0x006F6D75 +dd 0x00787074,0x008B8487,0x009F9C9E,0x009E9FA0,0x00A1A2A3,0x00A2A3A4,0x00A5A5A6,0x00AAAAAA,0x00ACACAC,0x00AFAFAF,0x00AEAEAE,0x00A6A6A7,0x00949494,0x005F5F5F,0x005A5959,0x00898989,0x009C9B9C,0x009A9A9A,0x009D9D9D,0x009B9B96,0x00949590,0x0096959F,0x00898892,0x0072726D,0x006F6B68,0x00797475,0x00787376,0x00686367,0x005F5F60,0x00575F5D,0x00525A58,0x00505857,0x004A5155,0x005C676C,0x006C7F81,0x00748B8B,0x00738888,0x00768A8A,0x00788B8C,0x00788B8D,0x00697C78,0x00414845,0x00585254,0x00817C7E,0x007C8081,0x007E8A8D,0x00839093,0x00808D90,0x00849295,0x008B989C,0x008C969A,0x00848589,0x00676365,0x007A7877,0x00909090,0x00989898,0x00919191,0x008B8C8D,0x008D8F91,0x008B8E90,0x00929596,0x00939496,0x00949194,0x007D767A +dd 0x00776F72,0x007C7577,0x00938F90,0x009C9C9C,0x00A2A2A2,0x00A6A6A6,0x00A4A3A3,0x00A5A5A5,0x00A6A6A6,0x00A8A8A8,0x00A7A7A7,0x00A1A1A1,0x008C8C8C,0x005E5E5E,0x0060605F,0x008A8A8B,0x009C9C9E,0x009F9EA1,0x00A3A1A4,0x00A6A6A6,0x00999C9B,0x0092949C,0x007F828A,0x006B6E6E,0x00787370,0x00746D6B,0x00646163,0x0058595F,0x00575C60,0x005A6361,0x0059615F,0x00555D5D,0x004B5155,0x00636E72,0x00738688,0x00758B8C,0x00758588,0x00818F91,0x00859496,0x00808E90,0x00717E7C,0x0039413E,0x003C4240,0x00686E6C,0x00747D7C,0x00788487,0x007B898C,0x007D8B8F,0x00839295,0x00879298,0x008B9195,0x0080807F,0x005F5954,0x00746E6A,0x00888887,0x009A9B9B,0x00959595,0x008A8A8A,0x00909090,0x008A8989,0x008A8A8A,0x008F8E8E,0x009A9597,0x00968D90 +dd 0x0071686B,0x00746C6F,0x008B8789,0x009C9B9C,0x00A7A7A7,0x00ADADAD,0x00ABABAB,0x00A8A8A8,0x00A7A7A7,0x00A5A5A5,0x00A3A3A3,0x009D9D9D,0x008F8F8F,0x006D6D6D,0x00656465,0x008B8B8F,0x009C9BA2,0x009F9DA6,0x00A09EA6,0x00A4A5AB,0x00959B9F,0x008C9398,0x007F868B,0x00767B7F,0x00736E6B,0x0065605C,0x005A5B5C,0x00555B61,0x00586064,0x005E6664,0x0059615E,0x00555D5D,0x00474E54,0x00687478,0x00778A8B,0x00728888,0x00748487,0x007F8C90,0x00859395,0x00828F93,0x00798483,0x003C4441,0x002D3532,0x005B6360,0x00838C8A,0x00849193,0x007E8D8F,0x007B898B,0x007F8D90,0x00889399,0x008F9498,0x007E7D7D,0x005A534F,0x00746E6A,0x00848483,0x00919292,0x00939494,0x008D8D8D,0x00919191,0x00868686,0x00838383,0x00878686,0x00948E91,0x00999194 +dd 0x0061595B,0x00766E71,0x00918C8E,0x009D9C9D,0x00A6A6A6,0x00A7A7A7,0x00A8A9A8,0x00ABABAB,0x00ABABAB,0x00A5A5A5,0x00A3A4A4,0x009B9C9B,0x00919191,0x006A6B6B,0x00585858,0x00807F83,0x0097979E,0x009999A0,0x0099989F,0x009D9EA4,0x008C9197,0x0082888D,0x00787E83,0x006E7276,0x005D5854,0x0057514D,0x00545557,0x00545A61,0x00515B5E,0x00545C5A,0x00515956,0x00495150,0x00424C50,0x0069767A,0x00738486,0x006D7F81,0x00728489,0x0078898F,0x007D8F95,0x007D8E95,0x00727D82,0x003D4043,0x00363A3A,0x00595E5A,0x00818781,0x00818D8D,0x007C8A8D,0x00758385,0x00738184,0x00768081,0x0077797A,0x006B6668,0x00605457,0x00766C6E,0x00838283,0x008A8B8B,0x008C8C8C,0x008A8A8B,0x008A8A8A,0x007C7C7C,0x00808080,0x008D8D8D,0x00948E90,0x00978F92 +dd 0x004E4648,0x006D6467,0x00868183,0x008B898A,0x00919090,0x008F8E8F,0x008D8B8C,0x008D8B8B,0x008E8C8D,0x008A8889,0x008F8C8D,0x008E8B8B,0x007B7879,0x00555152,0x004E4B4C,0x00656467,0x006F7074,0x00747578,0x00707173,0x006D6D6F,0x005A5B5D,0x00555658,0x0058595B,0x00555555,0x00514C46,0x004C4742,0x003F4040,0x00404549,0x003B4244,0x00404845,0x003A423F,0x002D3533,0x0031393D,0x0050595E,0x005D666B,0x00566065,0x0059686B,0x005E6E72,0x00647378,0x00616E74,0x0050585F,0x0037363E,0x004C4C4E,0x00585954,0x005C5F57,0x005F6663,0x00636B69,0x0057605D,0x004F5754,0x003F4543,0x0040403F,0x004C4648,0x005E5054,0x00584D50,0x00595859,0x00666667,0x006D6D6D,0x00696968,0x00706E6E,0x00797878,0x00838382,0x00848483,0x007F7A7B,0x007F7678 +dd 0x00685B59,0x005C4F4E,0x00574D4D,0x00595254,0x00554F50,0x00595355,0x005B5457,0x00574F52,0x00686163,0x0070696C,0x00736B6E,0x00746C6E,0x0070696B,0x006C6466,0x00696264,0x00635E60,0x00454143,0x00443F41,0x00474243,0x00494546,0x004C4C4B,0x005C5C5D,0x006C6C6C,0x00767677,0x00767879,0x006A6C6D,0x005A5958,0x00585551,0x004B4D48,0x004F5755,0x004E5655,0x00424848,0x0036373D,0x00313139,0x002E2E35,0x00292A30,0x00303637,0x002D3533,0x002A3230,0x00353D3B,0x003E4245,0x003D3E43,0x004A4B4D,0x004F514D,0x0041443B,0x003B3B34,0x0041413B,0x004C4D48,0x0060635E,0x005D615F,0x00626465,0x006B696C,0x00716A6F,0x00615D61,0x00515453,0x004E504E,0x004F4E49,0x004B4842,0x00655B58,0x00695D5D,0x00615958,0x0054504D,0x00524A48,0x00615655 +dd 0x00948C8D,0x00888082,0x00888083,0x0092898C,0x00888082,0x007F777A,0x0070686B,0x00665D60,0x00898184,0x00999093,0x00948B8E,0x00978F92,0x00A1999D,0x009D9599,0x00888084,0x0082787C,0x00625559,0x006B5D61,0x0073666A,0x00776E72,0x0087888A,0x00959899,0x0096999B,0x0092969A,0x008C969C,0x00889194,0x00777A77,0x005F5B53,0x00585854,0x0062696C,0x006A7275,0x0061696A,0x005D6263,0x005A5E5F,0x004D5152,0x00494D4E,0x00444A48,0x00383F3C,0x00454D4A,0x005A615D,0x005D6461,0x005E6564,0x005D6563,0x005D6561,0x005B605C,0x0056534E,0x0057524E,0x006D6D6D,0x00878D90,0x008C9398,0x0090979B,0x0091979C,0x0091979C,0x008B9296,0x00828B8D,0x00828684,0x00817F79,0x00726A62,0x00746460,0x00665755,0x006F6863,0x007D7B73,0x0084807D,0x008F8688 +dd 0x00AAA7AE,0x00AEABB1,0x00B1ABB0,0x00B4ABAE,0x00AFA7AA,0x00968E91,0x007B7376,0x00757071,0x009D989A,0x00A7A3A5,0x00A4A1A3,0x00A4A1A3,0x00A3A0A2,0x009A9899,0x008D8A8C,0x00918B8D,0x00756B6E,0x0084797C,0x00968B8F,0x00979296,0x009CA2A6,0x009EA5A9,0x00999FA4,0x008F969B,0x008A979C,0x00859293,0x00707773,0x0056574F,0x00626561,0x006A7074,0x00697173,0x005F6767,0x005D6664,0x005F6764,0x0059615E,0x005B6260,0x004A524F,0x0039423F,0x00626B68,0x00818A87,0x007F8785,0x00838B89,0x0089918F,0x00848C89,0x007B817F,0x006A6762,0x00605B57,0x00757676,0x00878E92,0x00899198,0x0091989E,0x00969CA2,0x00979EA4,0x00949BA2,0x009198A2,0x009698A0,0x00949195,0x00766E6E,0x00625855,0x0078726D,0x0092948D,0x009BA49C,0x00A2A6A5,0x00A9A6AC +dd 0x00B8B1B5,0x00BEB8BB,0x00B8B0B4,0x00B3AAAD,0x00B4ABAE,0x009F9699,0x007E787A,0x00767575,0x009C9C9B,0x00A6A6A6,0x00A9A9A9,0x00AEAEAE,0x00ABABAB,0x009F9F9F,0x00989797,0x00959092,0x00797174,0x00847C7E,0x009A9294,0x009C979B,0x009DA2A7,0x00A0A7AC,0x009BA1A7,0x00939BA0,0x008F9B9F,0x008A9697,0x007C8280,0x00636560,0x00646865,0x00666D6D,0x00636C6B,0x005F6765,0x005E6664,0x00555D5A,0x004B5350,0x004E5653,0x00444C4C,0x00495253,0x00767D7F,0x00858D8E,0x00808889,0x00848C8D,0x008F9698,0x008D9495,0x00818889,0x00686964,0x0055544D,0x007D7D7D,0x0091949A,0x008B8F97,0x008E959A,0x00959CA1,0x009AA1A7,0x009DA3AA,0x009C9EA8,0x009898A2,0x00918E97,0x006F6B72,0x00696360,0x00938F8A,0x00999B99,0x00979EA0,0x00A2A5A8,0x00B0A9AD +dd 0x00BAB1B4,0x00C4BBBE,0x00BAB2B5,0x00AFA6A9,0x00AEA6A8,0x009A9194,0x00777072,0x00696667,0x00949393,0x00A3A2A2,0x00A4A2A3,0x00A7A6A6,0x00A9A9A9,0x00A5A5A5,0x00A2A1A2,0x00989597,0x00716C6E,0x00777374,0x00949091,0x009A989A,0x009D9FA1,0x009FA2A4,0x009C9EA0,0x009EA1A2,0x009AA2A6,0x00929B9F,0x00838A8D,0x006D7376,0x006B7272,0x00646D6B,0x00646C6A,0x00656E6B,0x006A726F,0x005C6461,0x0048504D,0x0049514F,0x0042494B,0x00565D62,0x0080878D,0x00848B90,0x007F878C,0x007F868B,0x00868D92,0x00848B90,0x007E858A,0x006E726E,0x00585951,0x00848483,0x009C9BA2,0x00989AA2,0x00939A9F,0x00969DA2,0x00989EA4,0x009AA0A6,0x009B9DA4,0x0096969D,0x008E8D95,0x0068666D,0x00696261,0x00908B86,0x00929293,0x0093999E,0x00A5A6AB,0x00B4ABAF +dd 0x00ACA4A7,0x00B2AAAC,0x00B1A9AC,0x00B1A9AC,0x00ACA4A6,0x00898184,0x0072696C,0x00696264,0x00969091,0x00ACA5A8,0x00ACA5A9,0x00A3A1A2,0x00A0A0A0,0x00A1A1A1,0x009E9E9E,0x009C9C9D,0x00717171,0x006D6D6D,0x008A8A8A,0x00979797,0x009A9A9A,0x00989898,0x009F9F9F,0x00ABABAC,0x00A1A6AB,0x00969DA3,0x007F868C,0x00676E73,0x00727A7B,0x006A7270,0x00666E6C,0x00656D6A,0x006A716F,0x00626A68,0x005C6462,0x00636B69,0x004D5556,0x004C5358,0x007B8287,0x00858C90,0x00838B90,0x007E858A,0x0081888D,0x0081888D,0x007E8489,0x006D716E,0x005D5F58,0x008B8A8A,0x009B99A2,0x009B9CA5,0x00999DA3,0x009FA2A9,0x009EA2A9,0x009A9EA4,0x00A1A4AB,0x009FA0A6,0x008C8B8F,0x006A6669,0x00685F5C,0x00817975,0x00908D8E,0x009B9EA4,0x00AEADB3,0x00B8B0B3 +dd 0x00AEA6A9,0x00A49C9F,0x00938B8E,0x009A9194,0x00A0989A,0x008B8386,0x007B7275,0x006D6467,0x00958C8F,0x00ACA3A6,0x00AEA6A9,0x00A2A0A0,0x009B9B9A,0x009A9999,0x00969594,0x00989898,0x00717171,0x00727272,0x00919191,0x00A2A2A2,0x00A1A1A3,0x009D9D9F,0x00A2A2A5,0x00A9A9AC,0x009CA0A6,0x00949BA2,0x007E858B,0x0062696F,0x006F7879,0x006B7473,0x00676F6E,0x00646C6C,0x00656D6E,0x00646D6E,0x006B7376,0x0070787A,0x00505859,0x0047504F,0x0078807F,0x00838B8B,0x008D9595,0x00888F93,0x0083898F,0x007F868B,0x007B8186,0x006E7172,0x0060615F,0x008F8F94,0x00A19FAC,0x00A4A2B1,0x00A3A3AB,0x00A4A3AC,0x00A3A2AA,0x00999AA2,0x009DA2A9,0x009B9FA3,0x007C7A79,0x005F5853,0x0062554F,0x007B6E6C,0x00918A8D,0x00A3A2A9,0x00AEABB2,0x00B8B0B3 +dd 0x00BBB3B5,0x00B0A8AA,0x00978F91,0x009F9799,0x00A69DA0,0x00A0989A,0x00827A7D,0x00696164,0x00938B8E,0x00A69DA0,0x00A8A0A2,0x009B9694,0x0097938E,0x0096908C,0x00948F8A,0x00918F8B,0x006A6A6A,0x007B7B7B,0x00969696,0x00A8A7A9,0x00ABAAB0,0x00ACABB2,0x00A4A3AB,0x00A2A1A9,0x00999CA3,0x0092989F,0x007E858A,0x00676E73,0x006F777A,0x006F7777,0x006A7373,0x00656D6F,0x00656C70,0x006A7176,0x006F757B,0x0071777C,0x004A5052,0x00454E4B,0x00747D79,0x007F8784,0x00909896,0x0092999D,0x008B9197,0x00858C92,0x007A8186,0x00636668,0x005C5C5C,0x00919097,0x00A3A1AF,0x00A4A2B1,0x00A2A2AA,0x00A5A5AD,0x00A4A4AC,0x0093939B,0x0083878E,0x006E7174,0x00575453,0x00594F4B,0x006B5E58,0x00857876,0x00938C8E,0x009B98A0,0x00A8A3AB,0x00B2AAAD +dd 0x00B5ADB0,0x00B6AEB1,0x00A8A0A2,0x00A49C9F,0x00A29A9D,0x00A1989B,0x007B7375,0x00675F62,0x00938B8E,0x00A79EA1,0x009E9698,0x008C8582,0x00938D87,0x009A938D,0x009F9993,0x00928F8C,0x00636363,0x006E6E6E,0x00838383,0x00A0A1A3,0x00A7A6AE,0x00A7A7AF,0x00A4A3AB,0x00A1A1A9,0x0094999E,0x008E959A,0x007B8086,0x0065696E,0x006E7476,0x00757E7D,0x00717979,0x00656E6F,0x00656F70,0x006B7476,0x00676D70,0x005E6367,0x003A3E3E,0x00484D48,0x00787E7A,0x00848D8A,0x008D9797,0x008E9698,0x008B9294,0x0090989A,0x00858D8E,0x00626667,0x00626262,0x0088878B,0x008E8E94,0x008B8B92,0x00878990,0x008C9097,0x008B8F96,0x007C7F85,0x00636465,0x004A4744,0x005B514E,0x00796866,0x00746661,0x008C827E,0x00A59C9F,0x00A199A3,0x00A69DA7,0x00AFA6AA +dd 0x00AAA1A4,0x00A79FA2,0x00A69DA0,0x009D9598,0x009A9294,0x00938A8D,0x006F6769,0x006F6669,0x008F8689,0x00A89FA3,0x00A49A9D,0x00968F8F,0x00A19A9A,0x00A49D9D,0x00A49D9D,0x00888282,0x005C5655,0x00656260,0x0080807D,0x00969896,0x009A979B,0x00949295,0x00919295,0x00909797,0x00899392,0x00868D8D,0x006E6E70,0x005D595B,0x006B6B69,0x00787E77,0x006D736F,0x005B6161,0x00576461,0x005B6865,0x005C6361,0x004B4C4C,0x00312F2D,0x00484841,0x00727772,0x00838D8D,0x00869396,0x00899393,0x0088908D,0x00878F8D,0x006F7875,0x00525655,0x004B4B4B,0x005A5959,0x00595859,0x005A5A5B,0x00575859,0x00595A5B,0x005C5D5E,0x005A5A59,0x004D4B46,0x00534C47,0x006E605D,0x00857270,0x0071625E,0x007E7672,0x009B9395,0x00A49BA4,0x00A69CA5,0x00ABA2A6 +dd 0x00787073,0x00766E71,0x00847C7E,0x007D7574,0x00716967,0x0068605D,0x005F5755,0x0074686B,0x0078696E,0x007F7076,0x00817378,0x007F747A,0x00837980,0x00776D73,0x006C6268,0x0063585A,0x00655B57,0x00655E59,0x00726E68,0x00726E69,0x00736669,0x00695E61,0x00605E5F,0x00565A59,0x00474D4C,0x00494D4C,0x004A4748,0x00423D3F,0x003E3B3C,0x00444544,0x00444444,0x00404241,0x003A4541,0x003B4842,0x003D4441,0x00323332,0x00333230,0x0041413B,0x00474C48,0x00555F60,0x005B686C,0x005F6869,0x005D6462,0x004F5754,0x00454C4A,0x00545757,0x00505051,0x00484747,0x00424242,0x00474544,0x0046413D,0x00453E39,0x004A443F,0x004A453F,0x00524D47,0x00706964,0x007C716D,0x0081736F,0x006E625D,0x00625B56,0x00625A59,0x00726A6C,0x00857C7F,0x00938B8E +dd 0x00635B5F,0x005B5357,0x005B5455,0x00655E5A,0x00766F6A,0x0079726C,0x00837B77,0x00908385,0x00817177,0x006B5B61,0x00605055,0x00675659,0x005F4D50,0x005C494B,0x00685657,0x006F6461,0x007A7871,0x006A655F,0x006B5F5D,0x00685859,0x006A575C,0x006B5C60,0x006D6568,0x00525152,0x00323432,0x00343634,0x00514E4E,0x0059585A,0x00545658,0x004F5457,0x004D5254,0x00454A4B,0x002B3432,0x0025302C,0x00323A38,0x003D4340,0x00434847,0x004D5253,0x003E4447,0x00394145,0x00454D52,0x003D4244,0x00383B39,0x003C3F3E,0x00585959,0x00737474,0x00747474,0x00757676,0x00767777,0x00797877,0x007A746E,0x007B746D,0x007D7670,0x0077706A,0x00756F69,0x006C655F,0x0068605B,0x00837B76,0x0089827D,0x0089827D,0x00807974,0x00766F6A,0x007E7774,0x00877F82 +dd 0x009C9497,0x008F8689,0x00776E70,0x00807977,0x00A19898,0x00A19A98,0x00AEA6A6,0x00ACA3A9,0x00A3999F,0x00988B8E,0x007F6F70,0x00796867,0x006E5C5B,0x0072605E,0x00897876,0x008F8481,0x00888381,0x00746D6D,0x00716768,0x00766C6E,0x00767173,0x00777575,0x007A7879,0x00696868,0x00525049,0x004C4D46,0x0073746F,0x008E9393,0x008D9598,0x0082888E,0x007E868B,0x00737B7F,0x004C5656,0x00404846,0x00565D5A,0x00686F6C,0x006E7575,0x007E858A,0x00767D83,0x00777E84,0x008D9399,0x006A6D6F,0x00484747,0x00575757,0x007E7E7E,0x00858585,0x00818181,0x008B8B8B,0x00909090,0x008D8C8C,0x008F8985,0x00938C86,0x008C857F,0x00847D77,0x00867F7A,0x006F6863,0x00655F5A,0x00928B87,0x00A49D99,0x00ACA4A0,0x00AFA7A3,0x00AAA19D,0x00B0A7A4,0x00B1A9AB +dd 0x00AFA7AA,0x00B3AAAD,0x0090888B,0x00847C7E,0x009F979A,0x00ACA4A5,0x00B7B1B3,0x00A9A7AF,0x00A9A7AD,0x00ACA3A5,0x00938583,0x00786A66,0x00746663,0x007C6E6B,0x00867875,0x00867A79,0x007E7577,0x00786F72,0x00736B6D,0x00736C6F,0x006F6E6E,0x006C6D6D,0x00666666,0x00646362,0x0058544C,0x004E4F46,0x007B7D77,0x009AA19F,0x0097A0A1,0x008C9497,0x008E959A,0x00838B8F,0x00636C6E,0x004A5252,0x005D6464,0x00767D7E,0x00858C8E,0x008D9498,0x008B9297,0x0092989E,0x00989FA4,0x00717376,0x004D4D4D,0x00606060,0x00848484,0x008A8A8A,0x008D8D8D,0x00959595,0x00919191,0x008C8B8B,0x00918C88,0x0097908B,0x00938C86,0x00938B86,0x00877F7E,0x00686060,0x006A6262,0x009B9394,0x00B1A7A7,0x00BBAFAC,0x00B1A4A2,0x00AC9F9D,0x00BCB0AF,0x00B9B1B3 +dd 0x00B1A9AC,0x00B4ACAE,0x00948B8E,0x0080787A,0x00968E90,0x00B2AAAD,0x00BBB4B6,0x00ACABB2,0x00B1B0B7,0x00B0A8AA,0x00A29492,0x00867974,0x00807470,0x00857877,0x008A7E7F,0x00887D80,0x00837A7D,0x007F777A,0x00756C6F,0x00736C6F,0x006E6C6D,0x00646464,0x005F5F5F,0x00616060,0x005D5755,0x00555250,0x00797A78,0x00939B98,0x0096A09D,0x008F9895,0x00909897,0x00878E8E,0x00636B6E,0x003D4449,0x00555C61,0x006C7379,0x0082898E,0x00878E93,0x00868D93,0x0090979E,0x00939A9F,0x007D8183,0x00525353,0x00585858,0x00868686,0x00949494,0x00939393,0x00959595,0x00959495,0x00969495,0x009D9894,0x00A09994,0x009F9892,0x009B948F,0x007C7473,0x005F575A,0x006E6568,0x00A49B9E,0x00B8AEAE,0x00BCAEAC,0x00AB9D9B,0x00A19391,0x00BBAFAE,0x00BEB5B8 +dd 0x00BBB2B5,0x00B5ADAF,0x00938B8E,0x007C7476,0x00948C8E,0x00B1A9AB,0x00B4ADB0,0x00A9A7AD,0x00A4A3A9,0x00A8A0A3,0x00A69896,0x00827871,0x007F7773,0x008B8284,0x00887F88,0x00817780,0x007F777A,0x007E7578,0x00756D70,0x00797174,0x00757374,0x00737373,0x00707070,0x006A6969,0x00635B5D,0x005D5759,0x00787979,0x008C9391,0x00959E9B,0x00929B98,0x0089908E,0x00818988,0x00586164,0x00343C41,0x005F666C,0x00767D83,0x0082888E,0x00848B90,0x00858C92,0x008D949A,0x0090979C,0x00858A8B,0x005B5C5C,0x005C5C5C,0x00898989,0x00949494,0x00919191,0x00929292,0x00949494,0x00989797,0x009C9893,0x009F9792,0x009D9691,0x00968F8A,0x00736C69,0x005A5251,0x00675E5E,0x009F9797,0x00B4ABAB,0x00B2A7A8,0x00AEA3A5,0x009A9091,0x00ADA2A4,0x00BAB1B5 +dd 0x00BFB7BA,0x00B1A9AC,0x008A8285,0x0071696C,0x008B8285,0x00A0989B,0x00A79FA2,0x00A6A4AA,0x00A2A0A6,0x00AFA7A9,0x00B0A3A1,0x00807670,0x007A716D,0x00847C7E,0x00837B84,0x007D747F,0x00797174,0x00746C6E,0x0071696C,0x00797174,0x00737172,0x00747474,0x006F6F6F,0x00737272,0x006D6869,0x00605C5E,0x00767778,0x008B8F8E,0x00949999,0x00909799,0x00878E90,0x007D8587,0x0050585B,0x00333A3F,0x005E656B,0x00797F85,0x0080868C,0x00868D92,0x008E959A,0x00949BA1,0x0092999F,0x00818587,0x005A5B5A,0x00626261,0x00898989,0x00909090,0x00909090,0x00919191,0x008F8F8E,0x00959493,0x009E9A95,0x009E9791,0x009D9691,0x009D9791,0x008A837D,0x006A635E,0x0068615C,0x009A938E,0x00B5ADAC,0x00B6AEB1,0x00B6AEB1,0x00ADA6A8,0x00B9B1B4,0x00C1BABD +dd 0x00B8B0B3,0x00B1A8AB,0x00898184,0x006B6163,0x007F7475,0x008A7F80,0x009A8F90,0x00A39DA1,0x00A39DA2,0x00ABA3A6,0x00ACA2A2,0x00887C7A,0x00827673,0x00807879,0x007F7B82,0x007B777F,0x00756D71,0x006E6669,0x0071696B,0x007A7375,0x00767475,0x00757575,0x00727272,0x00787878,0x006B6A6A,0x00595859,0x00707070,0x008C8C8C,0x00959799,0x0091989D,0x0090989E,0x00828A8E,0x00555E61,0x0040474B,0x00596065,0x006F757B,0x00757B81,0x007A8186,0x0080878C,0x00858D92,0x00848B91,0x007C8082,0x005B5B5B,0x00616161,0x00878787,0x008E8E8E,0x008F8F8F,0x00929292,0x00929292,0x00969695,0x009D9996,0x009D9791,0x009B9590,0x009D9792,0x0096908C,0x00706965,0x00635C58,0x0097908B,0x00B8B1AF,0x00B8B0B3,0x00B6AEB1,0x00B3ABAE,0x00B9B1B4,0x00C6BDC0 +dd 0x00B4ACAF,0x00A9A0A3,0x007B7376,0x005F5453,0x006A5C5A,0x00776866,0x00918381,0x00A09696,0x00A0989A,0x009B9295,0x00847B7D,0x00716664,0x00837572,0x007F7778,0x0076747A,0x00737078,0x006F676B,0x006F6769,0x00776F72,0x007B7477,0x00777677,0x007C7C7D,0x00767676,0x00727273,0x00626263,0x00555454,0x00757475,0x00959494,0x00989B9B,0x0091989C,0x008F979B,0x007F888B,0x00586366,0x00535D61,0x00626B70,0x006C767B,0x006E787C,0x0072797C,0x0073787B,0x007A7E82,0x007F8386,0x007A7C7E,0x00505050,0x004B4B4B,0x00797979,0x00868686,0x00898989,0x008F8F8F,0x00939393,0x00949494,0x00989796,0x00989795,0x00989695,0x00989796,0x008F8B8B,0x00706869,0x00625A5C,0x008F8788,0x00A8A0A2,0x00ABA3A6,0x00B8B0B3,0x00B1A9AC,0x00AAA1A4,0x00B9B0B3 +dd 0x00A69DA0,0x0091888B,0x0073696B,0x006A5E5D,0x005B4D4A,0x006A5C59,0x008B7E7B,0x00958C8B,0x008B8384,0x00786E70,0x006A5D5E,0x00827070,0x00907C7B,0x00796A6B,0x006A6465,0x00696467,0x00696265,0x006C6567,0x006C6668,0x006A6366,0x0068676B,0x0075757A,0x006A6A6F,0x00646368,0x005E5B5E,0x00595355,0x00767072,0x00918B8D,0x00908F8F,0x00888F8E,0x00838A89,0x00727A79,0x004C5759,0x003A4446,0x004D5759,0x00646F70,0x00606A6A,0x00676B6B,0x006A6B6B,0x006E6E6F,0x00797979,0x00777777,0x00504F4F,0x00454444,0x006E6E6D,0x007F7F7F,0x007D7D7D,0x007B7B7B,0x00848484,0x008B8B8A,0x00888787,0x00858686,0x00878787,0x00848585,0x00797476,0x00665E61,0x005A5255,0x00786F72,0x0090878A,0x009D9598,0x00AAA2A5,0x00AAA2A5,0x00A29A9D,0x00A69EA0 +dd 0x006A5F5D,0x00665A59,0x006F6260,0x007E716E,0x00615350,0x005E514E,0x00726663,0x006E6461,0x00635A57,0x00675A58,0x00796766,0x00A28A8B,0x009F8586,0x00745D5E,0x005C4A49,0x00645455,0x00665A5D,0x005D5154,0x0054494D,0x00504549,0x004F484A,0x00484244,0x00433C3F,0x004D4548,0x00564E51,0x005E5659,0x00635B5E,0x00696063,0x00666062,0x00666363,0x005D5A5A,0x00565557,0x00474D4D,0x00333733,0x00383A35,0x004B4D46,0x00474841,0x00484846,0x004A4A4A,0x00505050,0x004E4E4E,0x004E4E4D,0x00444240,0x0043413E,0x00514E4C,0x00585654,0x00555351,0x00514F4D,0x00595756,0x00636160,0x005E5A5B,0x005C5A5B,0x00585556,0x00535052,0x004F4748,0x00584C4D,0x00726465,0x00746164,0x00736062,0x00746969,0x00756C6B,0x00756B6B,0x007C7070,0x00776C6B +dd 0x006A5D5B,0x007A6C69,0x00837572,0x00887A77,0x006A5C59,0x005E504D,0x00655754,0x005F4D4C,0x0061504E,0x007C6E6C,0x008D847F,0x009A918C,0x00988A88,0x007C6767,0x00715658,0x008F7276,0x008D767C,0x007A666B,0x00756268,0x00736065,0x007A6C6B,0x005D514F,0x00514643,0x00574C49,0x00605858,0x006F686A,0x00615C5D,0x00554F51,0x00504C4D,0x00575555,0x004C4B4C,0x00474849,0x00313637,0x002D2C28,0x003B3631,0x00564D44,0x006B6055,0x005A5551,0x003A393A,0x003B3B3B,0x003D3D3D,0x004B4946,0x00554F4A,0x0058534D,0x004C4742,0x00413C36,0x005A544F,0x0066605B,0x0056504B,0x004B4440,0x00494141,0x0051494C,0x00534A4D,0x004E4549,0x00484040,0x004C413E,0x006A5A58,0x00765F5F,0x00826767,0x007C615F,0x00836664,0x00715451,0x00785D5A,0x00655451 diff --git a/programs/free3d04/trunk/wall2.inc b/programs/free3d04/trunk/wall2.inc new file mode 100644 index 0000000000..e64875ed1a --- /dev/null +++ b/programs/free3d04/trunk/wall2.inc @@ -0,0 +1,64 @@ +dd 0x00060C19,0x00172C33,0x001B362F,0x001A3424,0x00142B1A,0x00101C13,0x00101910,0x00111C10,0x00121A11,0x000F160D,0x000B1008,0x0012170C,0x001F2214,0x002A2C1B,0x00242716,0x001C1F11,0x001D2113,0x002A2E1D,0x002D311F,0x00242815,0x00212B13,0x002F3C1E,0x002A3619,0x0028341A,0x002A3523,0x002B3628,0x00283427,0x00212D21,0x0024301F,0x00293520,0x0026321D,0x0027331D,0x002D3923,0x00323E28,0x0037442E,0x00394833,0x00384B39,0x00384D3C,0x002F4432,0x00283D2B,0x002F4533,0x00354A39,0x00334836,0x00354C3B,0x0037544B,0x00345553,0x00325553,0x003F615D,0x00496B68,0x004F716E,0x004E716E,0x00496C6A,0x0042686A,0x00396367,0x00366165,0x00386368,0x003B676A,0x003B676B,0x00376368,0x00315A5F,0x00304F57,0x002F4E5D,0x002A556A,0x00215570 +dd 0x000C131C,0x00283E3E,0x00395445,0x00405C43,0x003F5D40,0x003C553C,0x003E553C,0x003E543B,0x003F5039,0x0038452F,0x00313B26,0x003B442F,0x004A543F,0x00525E48,0x004D5943,0x0047533E,0x0046533E,0x00505E47,0x0056644E,0x004F5C44,0x004A583B,0x00546141,0x00556243,0x0059654B,0x005C6754,0x005B6658,0x005C675A,0x005D695C,0x00616D5B,0x00616E58,0x005A6752,0x00596650,0x005D6A54,0x0063705A,0x0068765F,0x00697963,0x00677B68,0x00667D6B,0x00667C6B,0x00677C6B,0x006C8271,0x006F8674,0x006C8271,0x006E8573,0x00718B7B,0x00718D7E,0x006E8A7A,0x00738E7E,0x007A9686,0x007D9A89,0x00789584,0x006E8B7A,0x00698876,0x006C8C79,0x0070907D,0x00708F7E,0x0070907E,0x0070907F,0x006D8D7C,0x00668676,0x00607B72,0x004A696A,0x0027505C,0x00104055 +dd 0x000F1E1C,0x002F463B,0x003F5A44,0x00466142,0x00476340,0x0046613E,0x004E6644,0x004D6342,0x004D5E41,0x004A583D,0x004A563C,0x00535F47,0x00596B53,0x005D7259,0x005A7157,0x00596F55,0x00556C51,0x005C7258,0x00657C62,0x00697D63,0x00697A5B,0x006D7B5A,0x006C7A5A,0x006A785C,0x0068745F,0x00626E5B,0x005D6857,0x00606C5A,0x0066715C,0x0068735C,0x00646F58,0x0065705A,0x006A7862,0x0071806B,0x00778671,0x00798B75,0x00768E79,0x0075907C,0x007B9482,0x007E9585,0x007E9586,0x007F9588,0x007B8F84,0x007B8F84,0x00809588,0x00869B8D,0x0084998A,0x00809586,0x00829588,0x00859A8C,0x00879C8E,0x00819889,0x0078947F,0x0077957B,0x007B9A80,0x007B9980,0x007C9B81,0x0081A087,0x00819F86,0x007D9C83,0x007D9780,0x00658274,0x00355C5C,0x00174A56 +dd 0x00182D24,0x00344B3D,0x003F5643,0x0043573F,0x00415435,0x003C4E2D,0x00415131,0x00404F32,0x00414E38,0x00424E3C,0x00404B3B,0x00434E41,0x00475C4C,0x004A6755,0x00496855,0x00496754,0x00476451,0x004C6A56,0x00597662,0x005E7964,0x0060765D,0x0063755B,0x0063755B,0x0060735A,0x0063745D,0x0062735C,0x0055654F,0x0052614B,0x005A654B,0x0060674C,0x005F664C,0x005F6750,0x0063705B,0x006C7D6A,0x00758876,0x007B917F,0x007B9782,0x00799682,0x007B9886,0x00789385,0x00758F86,0x00758E8A,0x00728A88,0x00708987,0x00728B87,0x0079938B,0x00789389,0x00738E84,0x006E887F,0x006E887F,0x00728E84,0x00789489,0x00809B88,0x00819A81,0x007F9980,0x007C967D,0x007C967D,0x00809981,0x00819A81,0x007C957B,0x007C8D74,0x006B7D68,0x0044635B,0x0028575C +dd 0x00183024,0x0032483A,0x003B503F,0x0040533E,0x003F4F33,0x00384627,0x00334021,0x00303C21,0x003A4532,0x00444E3F,0x00313A2E,0x0019211C,0x00162A26,0x001B3A36,0x001D403B,0x0020433D,0x0020443D,0x00274A44,0x00345852,0x00355850,0x00335148,0x00344F43,0x00365044,0x003E574B,0x00556E61,0x006D8679,0x00668173,0x00617969,0x006D7961,0x00797D61,0x00777C5F,0x00737A61,0x00717D69,0x00728473,0x00788E7D,0x007F9585,0x00819684,0x007D9280,0x00738A79,0x005B7567,0x00516C64,0x0052716D,0x00547573,0x00557776,0x00567877,0x005A7D7A,0x005A7D78,0x00597C77,0x00547671,0x004F716C,0x0050726C,0x0056766D,0x00708B79,0x00829880,0x00849A80,0x007F967D,0x007C927A,0x007D937B,0x007F957D,0x007C9178,0x0078856C,0x0066745F,0x00456158,0x002A575A +dd 0x00162E23,0x00364E42,0x00455C4E,0x004B604F,0x004C5E45,0x004B5C3D,0x004A5A38,0x00495A38,0x00516145,0x00586753,0x003C483C,0x00131C19,0x00142423,0x001F3434,0x00253C3B,0x0028403D,0x0029423C,0x00334C45,0x003D564F,0x00385049,0x00384D46,0x003C4E47,0x003A4C44,0x003B4E47,0x004D625A,0x006B8379,0x00748C82,0x00758C7F,0x007F8C75,0x008B9175,0x00888F74,0x00879078,0x008A9785,0x00899D8C,0x008CA292,0x008DA597,0x0089A493,0x007D9987,0x00627E6D,0x00425D4E,0x003F5950,0x004B655F,0x00526A66,0x00526A65,0x004E6863,0x00536F68,0x00567268,0x00567064,0x00536A5D,0x004C6152,0x004D6050,0x004C5E4B,0x006A7B62,0x00859679,0x0087997C,0x0083967A,0x007F9276,0x007D9075,0x007D9076,0x007C8F74,0x00758166,0x00616E58,0x00405B52,0x00265054 +dd 0x00173226,0x00415B4F,0x00567064,0x005D7768,0x005E7760,0x005B7356,0x00526B49,0x00526A47,0x00536D4D,0x00576E58,0x0043574C,0x0020302F,0x002B3C3F,0x0038494D,0x00415355,0x00425553,0x0043564F,0x004B6053,0x004E6354,0x004D6052,0x00556657,0x005E6F61,0x00596A5E,0x004D6056,0x00435B52,0x004E6A62,0x005E7B73,0x006C897F,0x007D947E,0x008C9D82,0x008E9F85,0x008E9F8B,0x0090A293,0x0092A69A,0x0092A69C,0x008CA19A,0x0087A099,0x0079938D,0x00637D74,0x00587066,0x00637A70,0x006F847A,0x0073877A,0x006E8274,0x0060796E,0x00657F75,0x00678074,0x00647A6B,0x00657766,0x005C6A58,0x00535F4C,0x00495640,0x0066755C,0x00809378,0x00809378,0x00809275,0x007E8E71,0x007D8C6E,0x007A896B,0x007A886A,0x00717B5E,0x00627059,0x00425F56,0x00285257 +dd 0x001F3C27,0x00425F4A,0x0055725C,0x00607F66,0x00668668,0x00587A5C,0x0035533C,0x00335243,0x00416056,0x0047665F,0x00415F58,0x00324E47,0x003F5655,0x00485A5D,0x00516466,0x00576B69,0x00566A62,0x00576B5C,0x00576D5B,0x005B705C,0x0063775F,0x00697D64,0x00667C66,0x00597161,0x00436057,0x00375756,0x0037585C,0x0045676B,0x006A887A,0x00879E86,0x0090A68E,0x008FA591,0x008FA396,0x0090A49B,0x00879B94,0x006D8180,0x00697C83,0x00677983,0x006D7F86,0x00798B8E,0x007F9392,0x00849892,0x008B9E94,0x0086998B,0x00788C7E,0x007D9082,0x007E9182,0x00798D7C,0x007E9283,0x007D9182,0x006D8375,0x00577063,0x005C7D71,0x00668B7F,0x00628678,0x005D7B6A,0x005F7660,0x006F8064,0x00768262,0x0078825F,0x00727D5D,0x0070816A,0x004E6A60,0x00315659 +dd 0x00294329,0x00435E43,0x00516C51,0x005A765A,0x00638563,0x0056785C,0x00203A2E,0x00244041,0x00446369,0x00547375,0x00587A71,0x00567768,0x005A756B,0x00576D68,0x005A706B,0x005F766F,0x0060766B,0x00607666,0x00667D6B,0x006A816E,0x006F8371,0x00708373,0x006F8376,0x00657C71,0x00506B63,0x003D5D57,0x00325250,0x00335452,0x005F7C6F,0x00879E89,0x0094AA95,0x0096AB9A,0x0097AC9F,0x0095AAA1,0x0080948E,0x00506361,0x0054676B,0x00687A7F,0x0078898C,0x007F9290,0x007F928B,0x00829789,0x008DA290,0x0090A28D,0x0086957F,0x0084927D,0x00859682,0x00889B8A,0x008DA595,0x0087A294,0x00759386,0x00688A7F,0x0060867F,0x00577F7A,0x00507570,0x00415F57,0x003F5448,0x0064725B,0x00747D5A,0x007A8155,0x007E855E,0x00879378,0x00637568,0x004A5F5F +dd 0x00324830,0x004D634A,0x005A7158,0x00647B62,0x006D8B6E,0x005F7D68,0x00243A34,0x0030494F,0x0058727A,0x006E898A,0x00769488,0x00719079,0x00708C78,0x006F8979,0x006E8979,0x006C8777,0x00678271,0x0064806D,0x006E8A76,0x0075907C,0x00778D80,0x00768982,0x00758983,0x006F837D,0x005D736C,0x004D665D,0x00465F56,0x003C554D,0x0060776C,0x00849A8D,0x0093A79A,0x0098ADA1,0x009EB3AA,0x00A3B8B0,0x0092A69F,0x005A6D69,0x00657778,0x00839697,0x008FA2A1,0x008FA29E,0x008CA095,0x008CA290,0x0091A692,0x0095AA94,0x008FA48E,0x00879E88,0x00859E89,0x0087A18E,0x008BA693,0x0085A290,0x007B9987,0x00809E8C,0x00779485,0x00688277,0x005F7671,0x004A5D5B,0x00444F49,0x00707763,0x007E855E,0x00818752,0x00848858,0x008B8F6E,0x006C705E,0x005B5E5A +dd 0x003D533A,0x00586E55,0x00637A61,0x006F866D,0x0078947A,0x00678471,0x002D4540,0x00425B60,0x00637D83,0x0075908F,0x00809C8E,0x007D9B81,0x007B9980,0x007D9A85,0x007F9C88,0x007B9884,0x0073907C,0x00728F7B,0x00789681,0x007D9984,0x007D9486,0x007F938B,0x007E928C,0x007B8E87,0x0072857E,0x006B8078,0x0060756D,0x004E635D,0x00728780,0x008FA49D,0x0094A8A1,0x0095A9A2,0x00A0B4AE,0x00ADC1BB,0x00A0B4AE,0x00697D78,0x0076888A,0x0098AAAD,0x00A0B3B4,0x0099ADAA,0x0097ABA1,0x009AAF9E,0x0099AF9C,0x009BB29F,0x009BB49F,0x0093AE9A,0x008CA995,0x0085A390,0x00819F8C,0x0082A08E,0x0084A18E,0x0090AB97,0x00869F8E,0x0073897D,0x00657A75,0x00526462,0x004D5852,0x007C826F,0x00878F68,0x00868E59,0x007F8453,0x007A7D5C,0x00676957,0x005A5A54 +dd 0x00475F45,0x00637D63,0x006D876E,0x00779279,0x007F9C84,0x006D8B7A,0x003B5650,0x00597375,0x00718B8C,0x007C978E,0x0083A089,0x0086A483,0x0086A588,0x0083A18C,0x00829F8A,0x00809D87,0x007D9883,0x0079937D,0x006F8971,0x006D876E,0x00728774,0x007A8B7E,0x007A8B80,0x0078877D,0x00728277,0x006B7C71,0x00566860,0x004C5E56,0x0083978F,0x00A3B8B2,0x00A3B9B2,0x009FB3AC,0x00A4B8B1,0x00ADC2BB,0x009EB3AC,0x00647972,0x006B7D7B,0x008A9B9A,0x008C9D9B,0x0083958F,0x00879A8D,0x00899C8A,0x007E927E,0x007A8D78,0x0080937B,0x00879E88,0x008BA898,0x0084A79D,0x0083A99F,0x008EB1A7,0x0092AE9F,0x0095AD9B,0x008AA596,0x0079948C,0x00698481,0x00556D6A,0x0052645C,0x00818F7D,0x00919E80,0x008E9A75,0x00848B66,0x007C7F64,0x00707260,0x005A5C51 +dd 0x00496449,0x00638064,0x006A8A6E,0x0075977B,0x0085A58C,0x00769482,0x00415C56,0x005C7677,0x00738D8E,0x00819C93,0x0086A38C,0x0089A887,0x0089A98F,0x0084A291,0x0087A392,0x0086A28D,0x00778F79,0x0063775E,0x004E6144,0x004C5C3E,0x004F5B41,0x00505A43,0x004F5942,0x004E5841,0x0049523D,0x00424B38,0x00323C2F,0x00404C40,0x008B9D92,0x00AFC7BF,0x00B3CBC4,0x00AEC6BE,0x00ACC4BC,0x00AEC6BE,0x0097B0A7,0x0051695E,0x0049594E,0x00616B5F,0x00656E62,0x00646E60,0x006D7666,0x00646E5C,0x00545D4A,0x00535943,0x005C6144,0x006F7C64,0x0088A59B,0x0086B1B2,0x007FAFB3,0x0085AFAF,0x008CABA2,0x0093AD9D,0x008EACA4,0x0080A19F,0x00739594,0x005F807B,0x005A756B,0x007A9081,0x008A9E8C,0x00889984,0x00858D76,0x0080826D,0x00717361,0x00575A4A +dd 0x004B664B,0x00617E62,0x0068886C,0x0077987C,0x008AAB8F,0x007C9A87,0x00415C58,0x00546E75,0x00718B96,0x0087A0A6,0x008DA8A3,0x008BA79B,0x0088A69C,0x008BA7A2,0x0091ACA5,0x008AA49A,0x00788D80,0x00758674,0x007F8D78,0x0085917A,0x00838D77,0x007F8B74,0x007D8A73,0x0078846D,0x00717C66,0x006A7660,0x00616D5A,0x006C7A68,0x009BAEA0,0x00B1CAC1,0x00B7D1C9,0x00B6D0C6,0x00B3CCC3,0x00B5CEC5,0x00A8C2B9,0x00788E84,0x006D7A6F,0x007B8175,0x007F8378,0x0082867C,0x00878B81,0x00787E73,0x006A7065,0x006D7164,0x00727761,0x0075816C,0x008AA397,0x008AADAA,0x0086AEAE,0x008AB1B0,0x0092B4AF,0x0097B8B0,0x008DB1AE,0x007B9F9D,0x00709390,0x0063857F,0x00627D72,0x007A9181,0x00899E8B,0x00889A86,0x008B9480,0x00888B78,0x00727464,0x005D6052 +dd 0x00576B56,0x006B836D,0x00728D76,0x007F9D86,0x008CAE95,0x00779987,0x003F5E5D,0x00597680,0x007F9BAB,0x008DA9B6,0x008DABAE,0x0089A7A3,0x0086A4A3,0x008CAAAD,0x0085A2A4,0x00779493,0x00738C87,0x008A9F95,0x00AEC0B3,0x00B8C9B9,0x00B6C6B6,0x00B2C4B3,0x00AFC3B1,0x00ABBFAD,0x00ABC0AF,0x00A9BFAD,0x00A3B9A8,0x00A2B7A7,0x00AAC1B5,0x00B2CAC1,0x00B8D0C7,0x00B7D0C6,0x00B6CEC4,0x00BAD2C8,0x00BBD3CB,0x00B1C9BF,0x00B4CABD,0x00BACFC3,0x00BBCEC7,0x00BBCEC8,0x00BCCEC9,0x00B1C4BD,0x00A6BAAF,0x00A8BAAE,0x00A5B7A8,0x00889B8C,0x0084998D,0x008EA69C,0x009AB5AE,0x009EBDB7,0x0097B8B3,0x0092B4AF,0x008DB0AD,0x007C9D99,0x006D8C87,0x00617E75,0x0060786A,0x007D8F7D,0x0091A18C,0x0098A58F,0x00A2AB95,0x009AA08F,0x00797E76,0x00606763 +dd 0x00627261,0x00768978,0x007E9483,0x0087A290,0x008BAD99,0x006F9486,0x003B5E5E,0x00567782,0x007C9CAB,0x0088A8B3,0x0090B3B1,0x0090B4A9,0x0087A9A5,0x008BABB1,0x0083A4A9,0x007A9C9F,0x00779896,0x008CADA4,0x00B4D4C8,0x00BCDBCD,0x00B8D4C7,0x00B2CDC1,0x00AAC4B8,0x00A3BDB1,0x00A1BCB0,0x009FBAAD,0x009DB7AA,0x009BB3A7,0x009CB1A8,0x00A3B6AE,0x00A9BCB3,0x00AABDB3,0x00AABCB3,0x00ACBEB6,0x00AFC1B9,0x00AFC4B8,0x00B2CCB9,0x00B5D1C0,0x00B5D0C9,0x00B7D2D2,0x00BBD6D8,0x00B7D3CF,0x00B1CEC1,0x00B5D1C1,0x00B5CDC1,0x008CA198,0x0081958C,0x0098ACA4,0x00A4B9B1,0x00A8BFB8,0x00A1B9B2,0x0099B3AD,0x009CBAB4,0x0092ADA7,0x007A958D,0x00617A6E,0x00627666,0x008A9986,0x009AA792,0x0098A38C,0x009EA78D,0x00939C86,0x00778177,0x00606B6B +dd 0x006A7B69,0x007F9282,0x00889E8E,0x008EA898,0x0091B29F,0x00779C8E,0x00476969,0x005E7F8B,0x007D9EAC,0x0086A8B2,0x0090B4B2,0x0090B5A9,0x0088ACA6,0x008BADB3,0x008DAEB6,0x0089ACB0,0x007DA09E,0x0089AEA4,0x00B1D5C8,0x00B6DACC,0x00AED2C9,0x00A0C3BF,0x0086A8A3,0x0077948C,0x006D867B,0x006B7F6F,0x006E7E6B,0x00707B67,0x00727A68,0x00787F6F,0x007D8575,0x007D8475,0x007B8272,0x007D8475,0x0081897A,0x00808876,0x00818D71,0x00829175,0x0088988A,0x0094A8A8,0x00A1BABF,0x00ABC9CA,0x00ABCFC6,0x00AFD2C3,0x00B6D0C6,0x0095AAA3,0x008FA39D,0x00A6BAB4,0x00A8BDB7,0x00A8BDB7,0x00A9BEB8,0x00A1B9B3,0x009DB9B3,0x0093AFA7,0x007E988E,0x0061786C,0x00627563,0x00909F8A,0x009CA993,0x00929D84,0x008F9879,0x00848F6E,0x00798571,0x0068746F +dd 0x006C7D6C,0x00849887,0x008DA394,0x0095AE9E,0x009EBBAA,0x0088A79A,0x00527072,0x0062818F,0x0082A3B5,0x0090B4C2,0x0091B8BD,0x0089B1AC,0x0090B7B4,0x0097BEC3,0x0095BBC1,0x008CB1B4,0x007BA09E,0x0087AAA2,0x00AACBBF,0x00AFCFC3,0x00ABCBC1,0x0099B8B3,0x00738E86,0x006B7C6E,0x00626954,0x005B5739,0x00594C27,0x0059461D,0x005B471E,0x00625029,0x00685831,0x006A5833,0x00645230,0x00675635,0x006F5D3D,0x00695734,0x00675528,0x0064572B,0x006C6649,0x00787C6F,0x0085938F,0x00A5BAB5,0x00B3CDC1,0x00B4D1C1,0x00B6CFC6,0x0092A9A4,0x00899F9B,0x00A5BBB7,0x00B3C9C6,0x00B0C6C3,0x00AAC1BD,0x00A1BAB4,0x0095B2AB,0x008CA89F,0x007F998F,0x00677D71,0x00647766,0x008D9C87,0x0099A690,0x00919B83,0x008B9574,0x00818D6B,0x007E8A76,0x006E7876 +dd 0x0070806F,0x00869B89,0x008DA493,0x0097B0A0,0x00A8C2B1,0x0093AEA2,0x00567073,0x005E7A89,0x0085A7BB,0x009FC6D8,0x009DC7D2,0x0089B6B8,0x0090BDBE,0x009DC9CD,0x00A2CED2,0x0098C1C3,0x0085AAA8,0x008FAFA9,0x00AFCBC1,0x00B4CFC5,0x00B1CCC4,0x009AB5B0,0x00687E75,0x00758070,0x00828269,0x00796D4A,0x00685026,0x005E4012,0x005D3F0D,0x00634814,0x006A4F1C,0x006C5121,0x00654920,0x00694C28,0x00715430,0x00694B27,0x006B5026,0x0074613A,0x00807A60,0x00767F73,0x006E7F7B,0x0098ACA7,0x00B2C4BB,0x00B5C7BC,0x00B1C8C4,0x008AA3A1,0x00799392,0x008EA7A6,0x00A4BDBD,0x00AEC7C6,0x00B0CBC9,0x00AAC6C3,0x009CBAB4,0x0092AEA6,0x00839D95,0x006F867B,0x006A7D6D,0x008D9B88,0x0098A58F,0x00929C84,0x008F987A,0x00899375,0x00848F80,0x0070797C +dd 0x006C7D6B,0x00819785,0x008DA494,0x0098B0A2,0x00A6BFB0,0x0092ACA3,0x005B7479,0x00668393,0x008DB0C5,0x00A2CADD,0x009EC8D4,0x0092BDC1,0x0097C4C5,0x00A2CFD3,0x00ABD8DB,0x00A5D0D2,0x008FB5B3,0x008EAFA8,0x00AFCBC1,0x00BCD6CB,0x00BFD9CC,0x00A7C1B2,0x00667C6A,0x00778771,0x00949C80,0x00969674,0x00857E56,0x0074683D,0x006B5826,0x0069501C,0x006D521E,0x00705423,0x006B4E24,0x006B4E2A,0x00755937,0x00775F41,0x0082755B,0x008F8E7A,0x00929F93,0x00778E8A,0x00627B7B,0x0091A6A3,0x00ACBAB1,0x00ACB8AD,0x00A5BBB7,0x00819B99,0x00738D8D,0x00809A99,0x0092ACAC,0x009FB9B8,0x00ABC6C5,0x00B2CFCB,0x00A7C3BE,0x0097B0AA,0x00829B93,0x00758C80,0x00728474,0x008C9A87,0x0095A28C,0x008D987E,0x008A9273,0x00869071,0x00828D7D,0x006E787B +dd 0x0070816E,0x00839785,0x008FA695,0x0099B1A4,0x00A4BBB3,0x0093ABAB,0x00617F8A,0x007095A9,0x008BB4CC,0x0096C0D6,0x009BC0CF,0x009CBEC5,0x00A0C5C9,0x00A5D1D5,0x00A8D5D8,0x00A9D4D6,0x0095BBB9,0x008AA9A3,0x00AAC5BC,0x00B8D1C7,0x00BAD3C4,0x00A1B9A6,0x00607761,0x0071856C,0x00919F84,0x009DA688,0x00999F7F,0x00919471,0x0086825C,0x007A6D44,0x00766032,0x00785B2A,0x0075572A,0x00715834,0x007D6E53,0x00878472,0x00929B91,0x0093A6A1,0x0093ADAC,0x007D989A,0x0068807F,0x0090A29B,0x00A6B2A6,0x00A7B2A5,0x00A2B6AF,0x00829A95,0x0078908C,0x00889F9C,0x0097ADAB,0x009BB2AF,0x00A0B8B4,0x00B0C7C4,0x00B0C5C2,0x00A3B5B1,0x008E9E98,0x007A8A80,0x00707E6E,0x0086927E,0x008F9C86,0x00879279,0x00869070,0x008C9777,0x008A9786,0x00737D7F +dd 0x00798976,0x008A9F8D,0x0095AD9B,0x009DB5A8,0x00A4BBB4,0x0092ACAC,0x0060838C,0x00739FAF,0x0086B6C9,0x0089B5C6,0x0093B6C1,0x009FB9BC,0x00A6C5C7,0x00A3CDD1,0x00A6D2D5,0x00ABD5D7,0x0096BBB9,0x008BABA3,0x00A7C3BA,0x00AEC8BE,0x00ACC4B8,0x008DA595,0x00536A58,0x00657965,0x0087957E,0x009BA48A,0x00A1A78B,0x009FA386,0x009DA087,0x0095957C,0x00918565,0x008E7750,0x0088714A,0x00807558,0x00848A7B,0x00859A96,0x008CA8A8,0x008CA7A8,0x0090AAAA,0x00829996,0x0070817A,0x0094A195,0x00AAB4A6,0x00AEB9AB,0x00ADBEB5,0x008BA099,0x007A8F88,0x00869A94,0x0093A7A1,0x009AAEA8,0x0098ADA7,0x00ABBDB9,0x00B2C0BE,0x00AAB5B2,0x0099A3A0,0x00848E87,0x00778275,0x008B9784,0x00919F88,0x008A977D,0x008B9777,0x00929E7E,0x008F9B8A,0x00747E80 +dd 0x007F8E7C,0x0095A997,0x009FB6A4,0x00A4BBAD,0x00A6BEB2,0x0092ADA6,0x005E8181,0x00729DA4,0x008BB9C2,0x0090BBC2,0x009ABDBD,0x00A7C2BC,0x00ADCDC9,0x00A2CDD0,0x00A6D2D6,0x00ACD5D8,0x0099BDBC,0x0093B1AB,0x00A4BFB6,0x00A3BCB1,0x00A1B7AB,0x00809687,0x004D6251,0x005E705E,0x007D8A74,0x00989F86,0x00A5AA8D,0x00A2A588,0x00A3A58B,0x00A6A892,0x00ABA992,0x00ABA790,0x009E9E88,0x008D9485,0x0087978E,0x00849C99,0x0089A4A4,0x008BA6A7,0x0090A8A8,0x00819693,0x00718179,0x0096A298,0x00AEB9AD,0x00B2BEB2,0x00B1C1BA,0x0095A9A4,0x008DA29C,0x0096AAA6,0x009BAFAA,0x00A3B7B1,0x00A0B3AE,0x00ADBDB9,0x00B2BEBB,0x00AEB8B4,0x009BA5A0,0x00879189,0x007D8779,0x00939F8C,0x009AA791,0x0093A087,0x00939E7E,0x00919B7A,0x0087917F,0x00757D7D +dd 0x00849482,0x009CB09F,0x00A5BCAC,0x00AAC2B2,0x00A8C3B4,0x0093B0A5,0x0061807F,0x0072939B,0x008FB0BC,0x0099B8C2,0x00A1BEBF,0x00A9C5BC,0x00B1D5D0,0x00B1DEE5,0x00B4E0E9,0x00AED5DB,0x0098B8B9,0x0094ACA7,0x00A4B7AE,0x00A3B2A5,0x00A0AC9E,0x00849081,0x00586553,0x00687360,0x00818A73,0x009DA386,0x00AEB393,0x00A8AB8A,0x00A2A284,0x00A6A48B,0x00AEAD97,0x00AFB2A0,0x009CA698,0x008A978D,0x0084948B,0x0082958F,0x00869C9A,0x0091A7A8,0x0098ADAF,0x00819596,0x006E7F7D,0x0092A29E,0x00AEBCB8,0x00B3C1BE,0x00AEBFBD,0x0094A7A7,0x0096AAA9,0x009EB1B1,0x009CAEAE,0x00A5B8B7,0x00ADBFBF,0x00B3C3C1,0x00AAB5AF,0x00ACB5AD,0x00A4AEA5,0x008F9A8F,0x007D887B,0x00929D8E,0x009DA898,0x00919D89,0x008E9878,0x008C9370,0x0080856F,0x00757873 +dd 0x008FA08E,0x00A3B8A6,0x00A8BFAF,0x00ABC4B4,0x00A4C5B2,0x0090B5A6,0x00638683,0x007798A3,0x009AB9CB,0x00A1C0D5,0x00A4C3D1,0x00A2C2C7,0x00A7CED4,0x00AFDEEB,0x00B2DEEB,0x00A1C7CE,0x0089A6A8,0x008CA09C,0x00A8B5AA,0x00ADB5A6,0x00A7AB9B,0x008D9181,0x00666B58,0x00777B67,0x008A9075,0x009EA383,0x00ACB18D,0x00A7AB86,0x009F9E7D,0x00A29D81,0x00ABA68C,0x00ACAB95,0x00969C8B,0x00848D80,0x007E8A7E,0x007F8E85,0x00879998,0x0099ACAE,0x00A2B4B8,0x0086989C,0x00708184,0x0091A3A6,0x00B1C2C5,0x00BACACE,0x00B2C3C7,0x0091A3A8,0x008B9DA1,0x0093A4A9,0x0097A9AC,0x00A4B6B9,0x00B2C4C8,0x00B7C7C6,0x00A6B2A8,0x00A5AFA3,0x00A1ACA0,0x00889387,0x00788376,0x00949F91,0x00A1AC9E,0x008F9B8A,0x00889071,0x00848964,0x007C7E68,0x00767871 +dd 0x0098AA98,0x00ABC0B0,0x00B2C8BA,0x00B3CCBF,0x00ACCFBC,0x0099C1B1,0x00668C89,0x007A9FA9,0x00A6CCDF,0x00B0D6F1,0x00B5DBF3,0x00B6DDEE,0x00B0DCEC,0x00A8D7E6,0x0097C1CC,0x00799B9E,0x00677F7B,0x00809188,0x00AFBBAE,0x00BDC6B7,0x00B0B5A6,0x008C9081,0x005F6351,0x00767963,0x008D9175,0x009DA07E,0x00A7AB83,0x00A5A87F,0x00A29F7C,0x00A7A184,0x00AEA78D,0x00AEAB95,0x00969A88,0x0081887B,0x007E877B,0x00838F87,0x008F9FA0,0x009FB1B6,0x00A8BABE,0x0091A3A7,0x007B8E91,0x0097A9AB,0x00B5C7C9,0x00C2D2D6,0x00BDCDD4,0x0093A3A9,0x00728285,0x00778888,0x008C9D9C,0x00A1B2B3,0x00B2C2C8,0x00BAC8CB,0x00A8B4AF,0x00A2ADA6,0x00A8B3AB,0x00919C94,0x007D887D,0x0097A295,0x009FAB9D,0x008F9B8A,0x008A9273,0x00868A66,0x007E806A,0x0074766F +dd 0x0093A493,0x00A4B8AB,0x00B2C7C0,0x00BED5D1,0x00C3DEDB,0x00B1CDCB,0x006B878C,0x006F8F99,0x009DC0CF,0x00B1D6E9,0x00C0E5F3,0x00C4EBF3,0x00B3DEE5,0x0093BFC5,0x00759999,0x005F7970,0x00627162,0x0084907D,0x00B1BDAA,0x00C4D2C0,0x00BBC7B8,0x00969C8F,0x005F6352,0x00797C64,0x00949475,0x00A3A07A,0x00ACA97B,0x00ABA675,0x00AAA079,0x00B0A488,0x00B2A78E,0x00B1A993,0x009B9988,0x00888B7E,0x00878D82,0x008F9892,0x0099A8AD,0x00A5B6BF,0x00AFC1C9,0x009EB1B5,0x00869A9B,0x009DB1AE,0x00B7CBC7,0x00C2D4D3,0x00C6D3D8,0x00A8B4B8,0x00798682,0x00647167,0x006C7A70,0x0086938F,0x00A9B5B9,0x00BCC6CD,0x00B2BABF,0x00B1B9BC,0x00B5BDBD,0x00959E9B,0x007E8680,0x009CA59A,0x00A5AFA1,0x009AA390,0x00969C7E,0x00929773,0x00868A73,0x00757870 +dd 0x0096A696,0x00A5B8AC,0x00B4C9C4,0x00C4DBDC,0x00D0E8ED,0x00BAD2D9,0x00617982,0x00566C74,0x007D969F,0x0094ADB6,0x00A4BCC2,0x00A4BDC0,0x008FABAB,0x007F9D9A,0x0085A29B,0x0096AFA6,0x00A3B8AC,0x00AABCAB,0x00B3C1AD,0x00B9C5AF,0x00B8C2AE,0x009EA395,0x00676B5A,0x0084876D,0x00989876,0x00A39C74,0x00B0A776,0x00AFA470,0x00AE9F76,0x00B3A388,0x00B3A68E,0x00B2A792,0x00A09B8B,0x008E8F82,0x008C8F85,0x00969D98,0x009DAAB1,0x00A5B5C2,0x00B3C4CF,0x00A3B5BC,0x0086999A,0x009FB4AF,0x00B8CDC5,0x00C2D4CC,0x00CEDBD7,0x00CED9D6,0x00B8C3BF,0x009CA7A3,0x0088928D,0x0078827E,0x0086918F,0x00A2A9A9,0x00A3A5A7,0x00A8A8A9,0x00A6A6A3,0x0085857F,0x00797970,0x00A3A495,0x00AEB09E,0x00A4A78F,0x00A1A482,0x009A9E7B,0x00878B75,0x0072756D +dd 0x0093A491,0x00A3B7A9,0x00B3C8C2,0x00C2DAD9,0x00CEE8EB,0x00BBD4D9,0x00627A7F,0x00435356,0x00516364,0x00586A69,0x00616F6D,0x00667470,0x006B7A73,0x008B9E95,0x00ADC6BF,0x00BAD6D3,0x00BEDBD6,0x00BDD7CD,0x00BBCEBC,0x00B6C0A8,0x00B1B79F,0x009A9E8C,0x00676A56,0x00878A6F,0x00989875,0x009E976F,0x00AFA577,0x00B4A877,0x00B0A07A,0x00B0A288,0x00B2A78F,0x00B3AB96,0x00A5A393,0x008E9183,0x00868B80,0x00929993,0x0098A6A9,0x00A4B6BE,0x00B6C7D1,0x00A3B3BB,0x007E8D90,0x009CABA7,0x00B6C5BA,0x00BFCEBE,0x00CBD6C7,0x00D3DCD4,0x00D1D9D7,0x00CBD2D6,0x00C5CDCF,0x009EA9A8,0x007B8882,0x007D867E,0x007D7E79,0x007A7873,0x006E6B64,0x00555147,0x005F5B4E,0x009E9987,0x00AFAB95,0x00A6A388,0x00A0A27F,0x009CA280,0x00868C78,0x006D726D +dd 0x0095A68E,0x00A4B7A4,0x00B0C6BA,0x00BDD6CE,0x00CCE6E4,0x00CCE7E8,0x00A3BEC0,0x0094ABAC,0x0096AEAE,0x0091A8A8,0x008DA4A3,0x0093A8A6,0x00A3B4B2,0x00BDCECE,0x00C6DADB,0x00BCD3D3,0x00BBD3CF,0x00C3D9CF,0x00C5DBCA,0x00BACBB7,0x00AEBBA5,0x00949C85,0x0060644B,0x00828467,0x00969573,0x009B936D,0x00ACA176,0x00B4A87D,0x00B1A381,0x00B1A68C,0x00B5AD94,0x00B3B099,0x00A3A695,0x00899082,0x00859083,0x00919D93,0x0097A9A3,0x00A6BABA,0x00B7C8CE,0x009CA8B2,0x00757C84,0x009CA2A0,0x00BBC1B2,0x00C4C9B4,0x00CED0C0,0x00D7DACF,0x00D8DCD6,0x00D8DEDD,0x00DBE5E8,0x00CDDBDF,0x00B6C7C8,0x00B0C0BF,0x00ACB7B5,0x009CA5A2,0x00919893,0x008A8E87,0x0095958B,0x00B4B1A4,0x00B0AA9B,0x00A5A18D,0x00A1A486,0x009BA385,0x00848D7D,0x00697171 +dd 0x00A1B399,0x00B1C4B1,0x00B9CEC1,0x00BFD7CE,0x00CAE5E0,0x00D2EDEC,0x00C7E2E3,0x00C7E2E1,0x00CDE6E6,0x00CEE6E6,0x00CAE4E3,0x00CEE5E4,0x00D9E9EA,0x00DBECEF,0x00CFE2E6,0x00C1D4D5,0x00BED1CC,0x00BFD2C6,0x00BED3C2,0x00B5C9B7,0x00ABBCA7,0x00939C84,0x005C6146,0x00797D5F,0x00929270,0x009B956E,0x00AAA076,0x00B2A67D,0x00B0A582,0x00B4AB90,0x00BAB59B,0x00B6B49F,0x00A5A897,0x008B9385,0x008A9588,0x00919E93,0x0094A79F,0x00A7BBB8,0x00B7C7CD,0x009AA4AF,0x00747780,0x00A3A3A4,0x00C2C4B5,0x00C7C8B3,0x00CDCDBD,0x00D6D7CC,0x00D9DDD3,0x00DBE1DC,0x00DDE9E9,0x00DEEEF0,0x00DAEDEF,0x00D5E9EC,0x00D3E6E9,0x00C4D8DC,0x00BED0D3,0x00C2D0D0,0x00C4CDCB,0x00C2C8C3,0x00AFB2AA,0x00AAADA1,0x00AAB098,0x009AA487,0x00889384,0x00778180 +dd 0x00AABBA5,0x00BED0C0,0x00C4D8CF,0x00C3DAD4,0x00C8E2DE,0x00CDE8E4,0x00C6E1DD,0x00C5E0DB,0x00CBE6E1,0x00CEE8E3,0x00CDE7E3,0x00CFE9E5,0x00D5EAE8,0x00D4E7E8,0x00CADDDE,0x00C1D4D2,0x00BCCCC6,0x00B6C4B8,0x00B1BEAE,0x00ACB9A8,0x00A5AF9C,0x008F937C,0x0058593E,0x006F7052,0x008A8A68,0x00959069,0x00A59D73,0x00ACA378,0x00ABA27B,0x00B1AA8A,0x00BAB59C,0x00BBB8A7,0x00B1B1A6,0x009B9E94,0x0092968C,0x0090988D,0x008E9F99,0x00A6B9BB,0x00B8C8D0,0x0099A3AE,0x00767A81,0x00ADAEAE,0x00CCCDC2,0x00C8C8B9,0x00CACCBD,0x00D2D6CA,0x00D6DCD1,0x00D9E1D8,0x00DBE7E2,0x00DDECE8,0x00DBEBE9,0x00D5E7E9,0x00D5EAF0,0x00D4EBF2,0x00D1E7EC,0x00CCE0E4,0x00CCDDDF,0x00CFDCDD,0x00C1CDCC,0x00BAC5C1,0x00B6C0B1,0x00A1AB96,0x008F9A8E,0x007A8584 +dd 0x00B0C1B0,0x00C4D6CA,0x00C9DDD7,0x00C5DAD9,0x00C7DFDD,0x00C9E3DF,0x00C2DDD8,0x00BCD8D2,0x00BFDAD4,0x00C0DBD4,0x00BDD8D1,0x00BDD7D2,0x00BFD6D3,0x00BFD3D1,0x00BACEC9,0x00B6CAC3,0x00B5C3BA,0x00B2B9AC,0x00AEB3A2,0x00AFB2A0,0x00ACAD99,0x0096947D,0x005F5B41,0x00747154,0x008A8765,0x008F8C64,0x009C996E,0x00A4A173,0x00A7A376,0x00AFAB84,0x00BEB9A0,0x00C7C0B6,0x00C0B9B6,0x00ACA5A3,0x00A09B92,0x0098978C,0x008D9997,0x00A3B5BC,0x00B2C3C9,0x00929DA1,0x00727778,0x00ACADAA,0x00CFCEC7,0x00CBCDC2,0x00CBD3C6,0x00D0D9CC,0x00CDD7CA,0x00CAD5C8,0x00CEDACE,0x00D5E0D5,0x00D8E3D9,0x00D4E2DC,0x00D2E3E6,0x00D5E7EC,0x00D8E9ED,0x00D2E3E8,0x00D3E3E7,0x00E1EFF1,0x00DBEAEC,0x00CBDADC,0x00C2CCC8,0x00B0B9AE,0x00949E98,0x00727B7D +dd 0x00B0C0B1,0x00C3D5CB,0x00C7DCD9,0x00C6DBDD,0x00C9E0E3,0x00C5DFE2,0x00B7D1D5,0x00AFC9CE,0x00B0CACF,0x00B0CACE,0x00AAC4C7,0x00ABC4C8,0x00B4CCCD,0x00BAD1CF,0x00BAD0CA,0x00BBCDC4,0x00BEC9BC,0x00C2C5B3,0x00BEBFAC,0x00BABAA6,0x00B5B39E,0x009E9882,0x00665F46,0x007B765A,0x00918C6B,0x00939068,0x009A976C,0x009F9C6E,0x00A19E70,0x00AAA77F,0x00C1BCA3,0x00CDC5BA,0x00C5BCB9,0x00B4ABA8,0x00A59D94,0x00969285,0x0088928A,0x009DAFAE,0x00AABAB9,0x00909C98,0x00787E77,0x00A7A99E,0x00C5C6B6,0x00CBCEBD,0x00D3DDCD,0x00D6E1D3,0x00C7D1C4,0x00BBC4B6,0x00B9C3B6,0x00C0CBBF,0x00C5D0C6,0x00C5D2CD,0x00C1D2D5,0x00BDCFD4,0x00C1D2D7,0x00C8D9DE,0x00CEDFE2,0x00DBEAEE,0x00DAEAED,0x00CEDEDF,0x00C7D2CD,0x00BCC4BA,0x009BA39C,0x00777E7F +dd 0x00B3C2B7,0x00C7DAD3,0x00CBDEDF,0x00C4D9DE,0x00C1DCDF,0x00B2D1D4,0x0084A3AA,0x007E9CA9,0x0096B2C2,0x00A7C3D1,0x00ABC8D1,0x00ADCACF,0x00B3D2D4,0x00BAD7D8,0x00BED5D1,0x00C4D1C5,0x00CACBB7,0x00CFC8AF,0x00CAC3A9,0x00C0BBA2,0x00BAB49E,0x00A29883,0x00695E47,0x00847960,0x009F9576,0x00A19971,0x00A59E72,0x00AAA578,0x00A8A377,0x00AFAC86,0x00C7C3A6,0x00CEC7B3,0x00C1B9AC,0x00B3ABA1,0x00A39B8F,0x00959183,0x0091958B,0x00A6AEA9,0x00AEB6B4,0x00989F9E,0x0080857F,0x00A1A496,0x00BBC0A7,0x00C8CEB4,0x00D5E0CC,0x00DCE5D5,0x00D5D9C8,0x00CBCCBD,0x00BEC2B7,0x00B9C3BF,0x00B5C5C9,0x00B5C9D2,0x00B6CAD5,0x00B2C4CE,0x00B0C1C7,0x00B4C4C7,0x00BAC7C6,0x00C2CCC9,0x00C2CCC5,0x00BAC3B9,0x00B6BAAA,0x00AFB19F,0x0097988A,0x007A7B74 +dd 0x00AFBEB7,0x00C8DAD7,0x00D2E4E8,0x00CFE2E8,0x00CAE4E2,0x00ABCAC4,0x00577679,0x00567380,0x008DA9BA,0x00ABC8D6,0x00B2D0D5,0x00AFCEC9,0x00AECFCB,0x00ADCDD0,0x00AEC9C8,0x00B5C5BD,0x00B9BEAF,0x00BEBCA6,0x00BDB79D,0x00B9B095,0x00B7AC94,0x00A1937F,0x006A5B45,0x00867860,0x00A39778,0x00A59973,0x00ABA076,0x00B8AF83,0x00B8B186,0x00BCB993,0x00CECBAA,0x00CFCAAD,0x00C1BCA5,0x00B6AF9F,0x00A8A193,0x00A39D90,0x00A5A59A,0x00B2B3AE,0x00B1B2B5,0x0098999F,0x007E7F81,0x009C9E93,0x00BABFA4,0x00CCD3B1,0x00DEE4CA,0x00E5E9D4,0x00E3E6D5,0x00DEE2D7,0x00CCD3D0,0x00C0CCD3,0x00BBCCDC,0x00BCD1E4,0x00B9CDDF,0x00AEBFCF,0x00A3B4BC,0x00A0AEB0,0x00A2AAA5,0x00A7AB9F,0x00ABAF9C,0x00A7A992,0x00A09E83,0x009D997C,0x00948F77,0x007F7968 +dd 0x00B5C3BB,0x00D1E3DF,0x00DFF1F3,0x00E0F2F4,0x00DCF1EB,0x00B6CEC2,0x00566D69,0x005C7177,0x009FB4BE,0x00BDD3DA,0x00B9D0CE,0x00AAC2B7,0x00A7C1B8,0x00A5C2C3,0x00A1BFC4,0x00A0BDC0,0x009FB8B8,0x00A6B6B0,0x00AEB2A5,0x00B1AC97,0x00B3A991,0x00A09581,0x006C5F4B,0x00847861,0x00A09478,0x00A19472,0x00A69A73,0x00B4AA80,0x00B8B087,0x00BFBB95,0x00CECBA8,0x00D0CCAC,0x00C6C1A7,0x00BFB9A5,0x00B3AD9D,0x00ADA899,0x00ACAB9F,0x00AFB1AC,0x00ACADB1,0x0093939C,0x0076777C,0x0093978D,0x00B4BA9E,0x00C8CCA8,0x00DAD8BB,0x00D3D4C0,0x00C1CABF,0x00C2D2D0,0x00BCCED3,0x00C1D1DB,0x00C4D2DE,0x00C6D4E1,0x00C3D3E4,0x00B4C2D3,0x00A3B1BB,0x0099A5A7,0x00979E99,0x009EA295,0x00A7AB98,0x00A6A88F,0x009C9A7D,0x00948F72,0x008B866D,0x0075705D +dd 0x00B9C8BB,0x00D1E5D9,0x00DAEFE7,0x00D8EDE8,0x00D2E7DE,0x00AFC3B8,0x00566962,0x00697B79,0x00AEC0C0,0x00C6D9D7,0x00BBCFC9,0x00AEC2B9,0x00AEC5BE,0x00ABC5C5,0x00A6C3C6,0x00A1BEC2,0x009BB5BA,0x009FB1B4,0x00A9B4B3,0x00B1B4AD,0x00AEADA1,0x00989787,0x0063604D,0x007C7863,0x009A937A,0x00A09577,0x00A59977,0x00B1A580,0x00B7AE86,0x00BDB991,0x00C7C49E,0x00CDC9A6,0x00C2BE9F,0x00B6B199,0x00AEA995,0x00AAA695,0x00A8AA9F,0x00A9AFAD,0x00A6AAB2,0x008E919E,0x00737880,0x008F9792,0x00B3BDA5,0x00C6CFB1,0x00D0D4BF,0x00B4B9AE,0x00909A95,0x00A6B5B5,0x00BAC9CC,0x00C9D7DA,0x00CBD5D9,0x00C7D0D4,0x00C5D1DB,0x00BBC7D3,0x00B0BAC2,0x00A2ACAC,0x0097A09A,0x009EA79A,0x00ADB5A4,0x00AFB6A1,0x00A6A892,0x009D9B86,0x008E8C7A,0x00727061 +dd 0x00B9C9B7,0x00CDE0CF,0x00CFE5D5,0x00CDE4D8,0x00C8DED5,0x00ACC0B8,0x00566963,0x00667974,0x00A6B9B4,0x00BDD1CA,0x00B8CCC5,0x00B7CCC4,0x00B6CDC6,0x00ABC7BF,0x00A8C4BD,0x00A6C0BA,0x00A1B5B0,0x00A0AEAB,0x00ABB5B2,0x00B5BDB9,0x00B3B9B1,0x00989D8E,0x005C5E4C,0x007A7A67,0x009B9881,0x00A89E82,0x00AB9F80,0x00B1A482,0x00B4AB86,0x00B5B18B,0x00B9B794,0x00C3BFA0,0x00B5B196,0x00A39D89,0x009F998A,0x00A39E93,0x00A7A9A7,0x00AAB1B9,0x00A6ACBE,0x008F93AA,0x00767C8F,0x00919A9F,0x00B7C2B6,0x00CAD5C2,0x00CED7CD,0x00ABB3B0,0x00858E8C,0x00ABB5B3,0x00C1CAC9,0x00C5CECC,0x00C4CCCB,0x00C2CAC9,0x00C5CECE,0x00C8D1D1,0x00C4CDCC,0x00B6BFBC,0x00A2ACA7,0x00A3ADA6,0x00B1BBB3,0x00B4BDB3,0x00ABB1A6,0x00A7A89B,0x009B9D90,0x00808275 +dd 0x00B4C6B4,0x00CADFCF,0x00CEE3D5,0x00CDE4DA,0x00C7DDD5,0x00AABFB9,0x00516660,0x00586D67,0x0096AAA4,0x00AFC3BC,0x00AFC4BD,0x00B9CEC7,0x00BAD1C6,0x00AFC7B7,0x00AAC2B1,0x00A6BBAA,0x0099AA9A,0x0098A495,0x00A7AFA2,0x00AFB5A9,0x00B1B7A9,0x009BA090,0x005B5E4C,0x007A7B69,0x00A3A18B,0x00B8B298,0x00B8B094,0x00B5AD8F,0x00B3AD8C,0x00AEAC8B,0x00ADAB8F,0x00B7B29E,0x00A8A194,0x00958D85,0x0099928C,0x00A5A19C,0x00AEB0B7,0x00B2B8CB,0x00ACB1CC,0x009296B5,0x007B8099,0x00969EA8,0x00BCC7BF,0x00C9D5C5,0x00CBD5CD,0x00B0B9B7,0x00959E9C,0x00BAC3C1,0x00C4CCCA,0x00C0C8C6,0x00C3CBC9,0x00C1C9C4,0x00C3CDC0,0x00CAD3C6,0x00C1CABE,0x00AFB8AE,0x009EA7A2,0x00A6AFAD,0x00B6BEBF,0x00B9C1C2,0x00B3B9B6,0x00AEB0A6,0x00A1A396,0x0085877B +dd 0x00B3C5B5,0x00CEE3D6,0x00D6EBE3,0x00D5EBE6,0x00C8DCD8,0x00A5B9B4,0x004E635C,0x005B7069,0x009DB1AA,0x00B5C8C1,0x00B6C9C2,0x00C4D7CF,0x00C9D8CC,0x00BECAB9,0x00B0BAA8,0x00A7AF9D,0x00939B88,0x00919685,0x00A4A797,0x00AFB2A1,0x00BEC1B0,0x00ADB09F,0x00636654,0x007E806E,0x00A6A793,0x00BDBDA8,0x00BEBEA9,0x00BDBDA5,0x00BBBC9F,0x00B5B899,0x00B2B7A3,0x00BCC0BA,0x00AFB1B5,0x0098999F,0x00999A99,0x00A5A6A1,0x00AFB4B9,0x00B4BBCD,0x00ACB2CC,0x00949AB6,0x00797F94,0x00919A9F,0x00B9C4B5,0x00C3D0B9,0x00C5D0C5,0x00B3BCBA,0x00A4ADAB,0x00C3CBC9,0x00C4CDCB,0x00C5CECC,0x00CCD5D4,0x00CCD5CF,0x00C7CEBF,0x00C6CBB9,0x00B9BEAD,0x00A6AB9C,0x009BA094,0x00A8ADA4,0x00B4B8B0,0x00AFB3AC,0x00ADB1A9,0x00ACAFA3,0x009FA195,0x0083867A +dd 0x00BBCDBA,0x00D3E8D9,0x00DAF0E4,0x00D9EEE5,0x00CEDED5,0x00AAB6AD,0x00556257,0x0068756A,0x00A9B4AA,0x00BAC4BA,0x00BAC6BB,0x00C5D0C4,0x00C7CEC0,0x00C0C4B3,0x00AEB2A0,0x00A4A796,0x00959987,0x00939584,0x00A5A796,0x00B4B5A4,0x00C8CAB9,0x00B7BAAA,0x00696C5B,0x00858775,0x00A4A593,0x00B6B7A4,0x00BDBFAD,0x00C0C2AE,0x00BFC4AB,0x00BBC7AF,0x00BAD0CA,0x00BEDDE7,0x00B3D5E9,0x00A2BED4,0x009EB1BD,0x00A2ACAA,0x00A9B1AE,0x00ADB5BB,0x00AAB1C2,0x00999FB6,0x00787E92,0x00939BA3,0x00C5CFC7,0x00D0DCCC,0x00C8D2CB,0x00AFB7B6,0x00A1A9A8,0x00C2CAC8,0x00CBD3D2,0x00CBD4D1,0x00CAD2D0,0x00C9D2CB,0x00C0C5B6,0x00BFC2B0,0x00BBBDAB,0x00ADAF9D,0x00A0A392,0x00A8AB9C,0x00B2B4A4,0x00AAAC9B,0x00A3A597,0x009EA094,0x0094968A,0x0083867A +dd 0x00B7C9B2,0x00CFE4CC,0x00D6ECD4,0x00D7EBD6,0x00D7E2D0,0x00B7BCAD,0x0064685B,0x00787C71,0x00AFB4A9,0x00B9BEB3,0x00BFC5B8,0x00C9CFBF,0x00C4CAB9,0x00C0C6B3,0x00AFB4A2,0x00A0A593,0x00979B89,0x009B9C8B,0x00ACAB9B,0x00B5B4A3,0x00BDBEB0,0x00A9AEA2,0x00616457,0x00818070,0x009D9986,0x00AEAA97,0x00BCBBAB,0x00C1C5B8,0x00C0CCC3,0x00BED7D4,0x00BAE1ED,0x00B2E6FC,0x00A9E0FC,0x00A5D5F4,0x00A3C7E1,0x00A0B8C4,0x00A2B1B3,0x00A3AEB0,0x00A4AEB6,0x00949CAB,0x00727789,0x00969BA6,0x00D1D7D9,0x00DFE7E3,0x00D4D9DD,0x00B4B8C1,0x00999DA3,0x00B7BBBD,0x00C6CCCB,0x00CAD1CC,0x00CBD2CA,0x00C6CEC2,0x00B9BFAB,0x00B7BBA4,0x00B4B7A2,0x00ABAD9A,0x00A3A596,0x00A8AA9D,0x00B2B4A8,0x00B0B2A6,0x00A8AA9E,0x009D9F93,0x00929488,0x0086887D +dd 0x00B8C5AC,0x00D3E4CB,0x00D9EBD1,0x00D5E6D0,0x00D6E2CE,0x00B8C0B2,0x00656C66,0x007D8483,0x00B0B5B7,0x00B5BBBB,0x00C6CEC6,0x00D2DCCB,0x00C7D3BE,0x00C2CFB9,0x00B5C0AB,0x00A1AB97,0x00929784,0x00989785,0x00A8A393,0x00AFA99B,0x00ACAAA1,0x00939A96,0x00585C54,0x007F7C6E,0x009A9481,0x00A9A594,0x00B8BDB4,0x00BDCCCE,0x00BAD5E5,0x00B4DCF3,0x00AFDDFA,0x00A9DAFD,0x00A2D4FB,0x00A1D0FA,0x00A3CFF8,0x00A2C9EA,0x00A1BDD4,0x009FB3C2,0x009FAFBB,0x008D97A3,0x006E737C,0x0095969A,0x00D1CECD,0x00E5E1E0,0x00E1DEE8,0x00C4C2D1,0x009E9DA8,0x00B8B9BC,0x00CACDC8,0x00CDD2C5,0x00D0D5C3,0x00C5CAB4,0x00B7BDA1,0x00B5BA9D,0x00B2B69E,0x00AAAC9A,0x00A2A398,0x00A8A8A3,0x00B8B7B9,0x00C0BEC4,0x00BABABB,0x00ABACA4,0x00989A8F,0x0086887E +dd 0x00BBC3AA,0x00D5E1CA,0x00D8E7D0,0x00D3E2CC,0x00D4E2C9,0x00B4C1AC,0x00646F66,0x00899392,0x00BEC7C9,0x00C0CAC8,0x00C7D2C6,0x00C0CEB7,0x00AFBFA4,0x00B3C3AB,0x00B0BEA7,0x00A0AB96,0x00929784,0x009B9A89,0x00ABA595,0x00B0A998,0x00ABA89C,0x008E938D,0x0052554D,0x0076746A,0x00919288,0x009BA5A2,0x00A7BFC7,0x00A9CDE3,0x00A5D1F3,0x00A0CFF7,0x009CCCF6,0x009AC9F6,0x0098C7F4,0x009AC7F6,0x009FCDFB,0x00A1CEF8,0x009FC7EA,0x009DBEDA,0x009CB6CB,0x008E9FAD,0x00797E83,0x009D9994,0x00D4C6BC,0x00E8D9CD,0x00E7E1D9,0x00CBCBC6,0x00A0A09B,0x00B6B9AF,0x00CDD0C4,0x00D4D6C7,0x00D3D5C2,0x00C3C7B2,0x00BABEA8,0x00C3C7B2,0x00C6C9B8,0x00B8BAAC,0x00A4A59B,0x00A5A59F,0x00BAB8B8,0x00C6C5C8,0x00C1C1C1,0x00B0B2A9,0x009A9C92,0x0083857C +dd 0x00BBC1A9,0x00D5E0CA,0x00D8E5D0,0x00D2E1CA,0x00D3E0C1,0x00B1BCA2,0x00646C5E,0x00929A96,0x00C6D0CF,0x00C6D2CE,0x00C3D2C5,0x00B4C6AD,0x00A4B59B,0x00ABB9A4,0x00A9B5A4,0x009AA296,0x0096998F,0x00A4A196,0x00AFA898,0x00B0A892,0x00B1AC98,0x00999B8D,0x0055584F,0x00696E6A,0x00859093,0x00889DAD,0x008AADC9,0x008AB7DD,0x008CBAE5,0x008FBCE6,0x0092BBE6,0x0093BCE8,0x0092BBE7,0x0091BBE6,0x0093BDE9,0x0090BAE5,0x008DB6DF,0x0092B7DB,0x0095B3D0,0x008FA4B6,0x007D858C,0x00A19F9A,0x00DBD0C2,0x00EFE4D0,0x00ECE8D4,0x00D3D4C2,0x00AAAC9C,0x00BBBFAF,0x00CCCFC2,0x00D2D3CA,0x00D1D2CA,0x00C7C8C1,0x00BFC0B8,0x00C4C6BD,0x00BFC0B7,0x00B0B1A8,0x00A0A297,0x00A0A296,0x00B2B3A8,0x00B5B8AE,0x00AFB2A6,0x00A4A799,0x00939589,0x007F8177 +dd 0x00BDC5AC,0x00D5E0CA,0x00D5E3CE,0x00D2DFC9,0x00D1D9BD,0x00AAAF9A,0x0061655C,0x00979B9E,0x00C4CDD5,0x00BFCDD2,0x00BBCDCA,0x00B4C8BC,0x00AFC3B3,0x00B5C5B9,0x00B4C0BC,0x00A7AFB2,0x00A5A8AE,0x00AEADAD,0x00B7B4A7,0x00B8B49A,0x00BCB79C,0x00AAA691,0x00636153,0x00595B54,0x006A7174,0x006F7C8B,0x007487A0,0x00768EAD,0x007A92B0,0x008197B2,0x00869AB3,0x008C9FB8,0x008B9FB8,0x00859AB4,0x008498B3,0x008094AF,0x008291AB,0x008794AA,0x008693A6,0x00828E9C,0x00727E85,0x0097A2A3,0x00CFD8D4,0x00E0E7DF,0x00DDE0D7,0x00CED0C6,0x00B1B2A9,0x00C0C2BB,0x00C8C9C6,0x00CDCDCF,0x00D1D0D5,0x00C7C7CB,0x00C1C2BF,0x00C4C4BD,0x00B7B8AF,0x00A6A79D,0x00999B90,0x009A9D90,0x00ABAEA2,0x00ADB0A4,0x00A8AB9D,0x009EA191,0x00929286,0x00808178 +dd 0x00B9C1AA,0x00D1DDC8,0x00D4E2CE,0x00D6E3CE,0x00D5DAC1,0x00A9AA99,0x005F615C,0x00989BA2,0x00C3CBD8,0x00B8C6D0,0x00AFC2C4,0x00B1C7C0,0x00B5CEC4,0x00B7CECB,0x00B5C8CE,0x00ADBBC9,0x00A7B1C0,0x00A7AFB8,0x00B1B8B2,0x00B5BAA7,0x00B6B9A4,0x00B4B3A5,0x00919086,0x0082827C,0x00888989,0x00909199,0x00999AA7,0x009EA1B0,0x00A1A6B4,0x00A8ADB8,0x00ACB0BA,0x00B1B5BE,0x00ACB1BC,0x00A6ABB6,0x00A7ACB7,0x00A8ABB6,0x00AEABB4,0x00AEA8AE,0x00A8A4AA,0x00A8A8AD,0x00A4A8AB,0x00BDC6C8,0x00DCE9E9,0x00E3EFEE,0x00DADEE1,0x00CDCDD1,0x00B6B5B8,0x00C4C5C6,0x00CFD0D0,0x00D7D8D7,0x00D7D9D8,0x00C9CBC8,0x00CBCDC6,0x00D4D7CD,0x00C8CBBF,0x00B3B5AA,0x00A2A499,0x009B9E92,0x00A9ABA0,0x00B0B3A9,0x00B1B3A9,0x00A8A9A2,0x009B9B98,0x00858484 +dd 0x00B1BCA7,0x00CCD9C6,0x00D0DFCE,0x00D3E2D0,0x00D1DBC3,0x00A4AA99,0x00575C59,0x008E939C,0x00BCC5D2,0x00B9C7CF,0x00AEC0BE,0x00AEC4BA,0x00AEC7BE,0x00B3CCCB,0x00B7CED3,0x00B1C5CD,0x00A5B6BE,0x00A4B4B8,0x00B3C2BD,0x00B8C7BB,0x00BBC7BF,0x00C2CACD,0x00BEC4CB,0x00B8BEC5,0x00BBC0C9,0x00C3C7D3,0x00CDD0DD,0x00D1D6E3,0x00D3DAE5,0x00D5E0E6,0x00D8E4E8,0x00DAE5E9,0x00D2DCE3,0x00CAD6DD,0x00CCD8DF,0x00CFD9E1,0x00D5DAE0,0x00D8DAE0,0x00DCDDE2,0x00E2E4E8,0x00E3E7E9,0x00E8EDEF,0x00ECF2F2,0x00EAF0F0,0x00DFE3E7,0x00D0D4D9,0x00BABDC2,0x00C9CCCF,0x00D6DAD8,0x00D8DCD7,0x00D2D7D0,0x00C9CFC5,0x00D3D8CB,0x00DEE5D5,0x00D1D8C8,0x00B7BCAE,0x00A9AEA2,0x00A0A59B,0x00A8ACA2,0x00B1B5AD,0x00B5B8B3,0x00AFB1B2,0x00A4A5A9,0x008A8A8E +dd 0x00ADBEAC,0x00C8D9CC,0x00CEDFD9,0x00D0E2DA,0x00CADCC9,0x00A1B2A3,0x00546262,0x0085929D,0x00AEBBC8,0x00AFBEC5,0x00ACBEB7,0x00ADC3B2,0x00A9C0B0,0x00ADC3BA,0x00B4CAC3,0x00AFC4BE,0x009FB3AF,0x00A1B4B2,0x00ABBFBC,0x00ADC0BE,0x00B1C1C5,0x00B8C5CF,0x00C1CDD9,0x00C6D2DE,0x00CAD7E3,0x00CAD5E3,0x00CED9E6,0x00CFDBE7,0x00D1E0E9,0x00D4E4E9,0x00D6E7EB,0x00D9E9ED,0x00D7E7EC,0x00D1E3E7,0x00D0E2E7,0x00CADBE0,0x00CCDAE1,0x00D8E5EF,0x00DEEBF3,0x00E1EDF5,0x00E1EDF6,0x00DFEBF4,0x00DDE8F1,0x00DCE7EF,0x00D9E2E6,0x00CDD6D6,0x00BAC1C1,0x00C6CDCD,0x00D3DAD8,0x00D1D9D6,0x00CAD2CF,0x00C9D1CB,0x00CBD5C6,0x00D1DDC7,0x00CAD6C0,0x00AFB9A6,0x009CA598,0x00959F95,0x009EA6A0,0x00A9B1AD,0x00ADB5B1,0x00A7AFAA,0x0099A29C,0x00848C86 +dd 0x00AABBAC,0x00C4D7CD,0x00CFE3E0,0x00CEE3DE,0x00C2D7C6,0x0099AEA1,0x00536566,0x008B9BA6,0x00B1C1CE,0x00ADBEC4,0x00ACC0B7,0x00AEC4AF,0x00A6BDA4,0x00A9BFA7,0x00B2C8B4,0x00B2C6B9,0x00A6B9B2,0x00A3B6B6,0x00A2B4BA,0x00A3B4BF,0x00A3B5C1,0x00A0B3BC,0x00A4B8C0,0x00A9BEC6,0x00B1C6CE,0x00A9BDC6,0x00ABBFC7,0x00B1C5CD,0x00BFD2D8,0x00C7D9DC,0x00C8DADD,0x00C8DADD,0x00C9DBDF,0x00CCDDE2,0x00CBDCE2,0x00AABCC3,0x009FB1BD,0x00BACDDD,0x00BFD3E3,0x00BCD0E0,0x00C0D3E3,0x00C3D6E6,0x00C5D8E7,0x00C9DAE7,0x00CEDAE0,0x00CCD6D5,0x00C4CBCA,0x00C6CFCD,0x00D0D8D7,0x00D6DFDD,0x00D5DDDC,0x00D2DAD7,0x00CAD4C7,0x00C6D3BC,0x00C5D2BA,0x00B0BCA8,0x00949F91,0x008C978F,0x009BA4A1,0x00A8B1AF,0x00ABB4B3,0x00A3ADAA,0x00939E9A,0x00828C8A +dd 0x00A2B3A4,0x00BCD0C4,0x00CADFD8,0x00CCE2DA,0x00C6D9CB,0x009CAEA3,0x00566565,0x00919FA6,0x00BAC9D1,0x00B7C6C8,0x00B6C8C0,0x00B6C8B8,0x00ABBDA6,0x00B0C2A9,0x00BFD0BB,0x00BDCDBE,0x00B2C0B8,0x00A9B7B4,0x009EABAC,0x009DABAF,0x009BA9AD,0x0095A6A8,0x009AABAD,0x009EAEB0,0x00A7B7B9,0x00A1B1B3,0x00A2B1B3,0x00A5B4B6,0x00B3C3C2,0x00BCCECC,0x00C1D4D2,0x00C4D6D5,0x00C4D5D9,0x00CADAE2,0x00C7D6E1,0x0098A8B4,0x008E9DAC,0x00BCCBDC,0x00C3D2E3,0x00B9C8D7,0x00B9C8D4,0x00BCCDD5,0x00BDCED4,0x00C1D2D7,0x00C7D1D4,0x00D0D4D4,0x00CFD2D2,0x00C9CECE,0x00CFD4D4,0x00DAE1DF,0x00E1E7E5,0x00DCE2DF,0x00D2DBCF,0x00C8D4BD,0x00C4D1B9,0x00B4C1AD,0x009BA798,0x008E9990,0x009AA4A1,0x00A6AFAD,0x00AAB3B5,0x00A1ACAF,0x00919CA1,0x00828B91 +dd 0x0097A997,0x00B7CCBB,0x00C9E0D1,0x00CEE4D9,0x00CFDDD5,0x00A8B4AF,0x005C6665,0x00919C9C,0x00BFCACA,0x00C3CDCC,0x00C3CFCB,0x00C5D0CA,0x00BAC7BA,0x00BAC7B7,0x00C6D2C3,0x00C8D3C5,0x00BFCBBE,0x00B2BEB2,0x00A6B1A6,0x00A9B4AB,0x00AAB5AE,0x00A8B3B0,0x00ADB8B6,0x00ABB5B3,0x00AEB8B6,0x00A8B1B0,0x00A0A9A8,0x009AA3A2,0x00A7B5B0,0x00B4C7C0,0x00BDD0CB,0x00C4D7D4,0x00C9DCDF,0x00D4E6ED,0x00CDDBE7,0x009BA9B8,0x00939FAD,0x00CAD4E0,0x00D6E0E9,0x00CED7DC,0x00CCD6D6,0x00CAD6D0,0x00C5D2C9,0x00C7D4CB,0x00C9CFCB,0x00D6D7D7,0x00DCDCDD,0x00D8D9D9,0x00DBDCDC,0x00E0E2E2,0x00E5E7E7,0x00E1E3E1,0x00DBE1D7,0x00CEDAC4,0x00C2D0B8,0x00B4C1AD,0x00A6B1A3,0x0096A099,0x00A1AAA7,0x00ABB4B2,0x00ABB6B7,0x009EAEAF,0x008D9DA1,0x007B8A8F +dd 0x0096A796,0x00BCD1BF,0x00CDE4D4,0x00CEE3D7,0x00CFDBD6,0x00ADB6B3,0x0058615F,0x00818A88,0x00B1BAB7,0x00BDC6C3,0x00C1C9C6,0x00C6CECA,0x00BCC7BE,0x00B6C2B6,0x00BBC6BB,0x00C0CBC0,0x00BFCABF,0x00B2BDB0,0x00A7B3A5,0x00A3AEA1,0x009FA9A0,0x00A6AEAB,0x00AFB8B5,0x00A7AFAB,0x00A5ACA8,0x00A1A6A1,0x00979A96,0x00919590,0x00A4B0A9,0x00B4C6C0,0x00BACCC8,0x00C2D3D2,0x00CEDFE0,0x00E2F1F4,0x00DAE5EB,0x009EABB6,0x008A959D,0x00BEC5C8,0x00D3D9D9,0x00D6DDD9,0x00D9E0D7,0x00D1DBCB,0x00CAD5C2,0x00D0DBC8,0x00D2D8CE,0x00D8D9D8,0x00DBDBDB,0x00DCDDDC,0x00DEDFDE,0x00DEDEDC,0x00DEDFDD,0x00DBDCD9,0x00D5DAD0,0x00CCD7C2,0x00C3CFB9,0x00B7C3AF,0x00ABB6A8,0x009CA69E,0x00A7B0AC,0x00B0B8B6,0x00A8B3B2,0x0094A6A6,0x00839598,0x00738589 +dd 0x0093A292,0x00B6C9B9,0x00C6D9CB,0x00C6D7CD,0x00C6D2CC,0x00A6AFAB,0x00505753,0x006F7670,0x009FA59B,0x00ABAFA5,0x00AEB1A6,0x00BDBFB6,0x00B7BEB8,0x00B0BAB5,0x00B5BFBA,0x00B7C1BC,0x00B5BFB7,0x00ABB6AB,0x00A6B1A4,0x009BA799,0x0098A297,0x00A4AAA3,0x00AEB3AC,0x00ABAEA6,0x00AAAA9F,0x00A39E90,0x00938B7C,0x00878071,0x00A5A8A0,0x00C0CCCC,0x00C6D3D6,0x00CDD9DD,0x00D7E3E7,0x00E5F1F3,0x00DBE5E8,0x0099A2AA,0x006F7377,0x00999794,0x00BCB9B3,0x00CECBC4,0x00D5D3C9,0x00D1D0C3,0x00CDCCBF,0x00D2D2C4,0x00D1D2CB,0x00CFD0D0,0x00CDCDCE,0x00CECECD,0x00D1D1CE,0x00D0D0CA,0x00D0D2CA,0x00CDCFC7,0x00C4C6B7,0x00B7B9A3,0x00B1B39E,0x00A7AA96,0x009B9F8E,0x00949A8E,0x00A5ABA4,0x00ACB4AF,0x00A5B0AC,0x0093A39F,0x007F9290,0x00708384 +dd 0x008E998A,0x00AEBAAD,0x00C1CDC1,0x00C5D2C9,0x00C3D2CA,0x00A0ACA6,0x004D554F,0x00565D52,0x007B7F6E,0x0080816D,0x00777560,0x008B8978,0x00A5AAA5,0x00B1BABA,0x00BCC7C6,0x00BBC6C2,0x00B0BBB1,0x00A8B3A5,0x00A8B4A1,0x009AA692,0x0099A394,0x00AAAFA4,0x00B7B9AE,0x00B8B8AC,0x00B5B0A1,0x00A29782,0x008B7C67,0x007D6F5B,0x009C9990,0x00BCC3C7,0x00C4CDD4,0x00C9D2D8,0x00CDD6DD,0x00D4DDE3,0x00CFD8DD,0x0098A0A5,0x00626262,0x006E6560,0x008D847D,0x00ABA39C,0x00BEB7AF,0x00C4BCB5,0x00C5BDB6,0x00C9C2BB,0x00C9C6C3,0x00C6C5C7,0x00C4C4C5,0x00C2C3C2,0x00C9CAC4,0x00CCCEC2,0x00CDCFC0,0x00C5C8B6,0x00B4B39D,0x009C947D,0x008C836E,0x007C7561,0x00706D5C,0x007D7E71,0x009FA29A,0x00A6ADA7,0x00A1ABA4,0x0095A298,0x007D8C85,0x006C7D7A +dd 0x008D9688,0x00ACB5A8,0x00BFC9BD,0x00C3D1C9,0x00C1D6D2,0x00AEC3C1,0x0082948F,0x00808F86,0x00939F92,0x00949C8C,0x00717564,0x005D6051,0x008E958C,0x00B1BAB4,0x00BCC7BE,0x00B7C1B5,0x00A6B19F,0x009BA791,0x009EAA8F,0x0099A489,0x009FA791,0x00AAAD9F,0x00ACAC9F,0x00AAA89A,0x00A69F8F,0x009B907C,0x009E917B,0x00A49884,0x00B0ADA3,0x00B9C0C1,0x00BFC7CB,0x00C0C9CD,0x00C0C8CE,0x00C9D0D7,0x00D3DAE1,0x00C2C9CF,0x00A3A3A4,0x008D8580,0x007D746E,0x007F766F,0x00988E87,0x00B1A69F,0x00B8ADA6,0x00BAB1A9,0x00B9B3AF,0x00B4B3B3,0x00B7B7B6,0x00B7B8B5,0x00C2C3BC,0x00C8CABD,0x00C4C6B5,0x00B8BBA7,0x00ADAF99,0x00A9A593,0x00A7A293,0x009E9D90,0x0093958B,0x00939A93,0x00A2ACA9,0x00A2AFAF,0x009FACAB,0x009BA29A,0x0080857F,0x00676E6C +dd 0x008B9383,0x00ACB3A3,0x00BEC5B7,0x00BEC9BF,0x00BCD3CF,0x00BDD6D4,0x00B6CFCB,0x00B6CCC6,0x00C1D3CC,0x00BFCEC5,0x0089958B,0x00444D41,0x00717767,0x00A0A493,0x00AEB3A1,0x00AAAE99,0x009B9F86,0x008F9477,0x008F9476,0x00949677,0x0098977B,0x0098927B,0x00938C76,0x00918B77,0x009B9682,0x00A09D89,0x00AEAA97,0x00B7B4A3,0x00B8B9AE,0x00B9BDB7,0x00BEC3BE,0x00BDC2BF,0x00B9BDBE,0x00C0C2C9,0x00CDCFD8,0x00D3D4DD,0x00D0CED1,0x00C0BBB6,0x009F9891,0x00786E67,0x00786A61,0x0099897C,0x00AB998C,0x00B4A396,0x00B5A89D,0x00AFA9A0,0x00B1ADA4,0x00ADAAA1,0x00B5B2A7,0x00BDBBAD,0x00B8B7A6,0x00ADAD99,0x00ACAD9B,0x00BDBFB4,0x00C6C7C0,0x00C5C7C2,0x00BDC2C0,0x00B3BCBC,0x00AAB5B7,0x00A2ADB1,0x009FA8A9,0x009FA198,0x0087877D,0x00676662 +dd 0x00838976,0x00A8AC9A,0x00C2C6B4,0x00C5CCBD,0x00C2D3CB,0x00C2D7D1,0x00C2D7D2,0x00BFD4CE,0x00C3D7D0,0x00BED1CB,0x008B9B94,0x003A4137,0x00575139,0x00847758,0x00958868,0x00938565,0x008A7C5A,0x0080714F,0x007D6E4C,0x007F704D,0x00776947,0x006E6041,0x00675B3E,0x006E654A,0x00908C75,0x00A5A692,0x00ADAF9E,0x00B1B3A4,0x00B3B6A9,0x00B5B8AD,0x00BBBDB3,0x00BCBDB6,0x00B8B8B7,0x00BCBBC2,0x00C5C2CE,0x00CAC7D2,0x00C9C9CD,0x00C6C7C0,0x00B2B0A7,0x00847E75,0x0060564A,0x00716451,0x008B7865,0x00998571,0x009E8A75,0x009D8B75,0x009F8D76,0x009A8A73,0x009D8D76,0x00A1937C,0x009C8E76,0x00978870,0x009F9581,0x00BDBCB3,0x00C8CAC5,0x00C9CBC7,0x00C4C6C2,0x00BABDB9,0x00ADB0AD,0x00A2A4A2,0x009B9E98,0x00989886,0x00868773,0x00636557 +dd 0x00747864,0x009C9E8B,0x00BCBFAC,0x00C8CDBD,0x00C3D2C8,0x00B8CCC5,0x00B6C9C3,0x00B2C5BF,0x00B1C5BE,0x00AEC2BB,0x008A9D96,0x004F594D,0x00585135,0x006F5E3C,0x00766542,0x0073613E,0x0071603C,0x006E5D3A,0x0071603D,0x00776745,0x006E603D,0x00675A3B,0x0063583B,0x006B6248,0x008B8972,0x009FA18D,0x00A4A695,0x00A6A99A,0x00ACAEA2,0x00B0B1A7,0x00B4B6AD,0x00B8BAB2,0x00B6B6B5,0x00B8B6BC,0x00BEBCC6,0x00C1C0C9,0x00BFC2C4,0x00BFC6BD,0x00B7BDB1,0x00A1A297,0x007E7D6D,0x007E7A64,0x008D836C,0x008F826B,0x008C7E66,0x008F7F66,0x00928068,0x00938168,0x0095826A,0x00938168,0x008D7C62,0x008B7960,0x00948771,0x00B5B3A3,0x00C2C4B8,0x00C5C7BA,0x00C2C5B7,0x00BDBFB1,0x00B1B2A5,0x00A5A79A,0x009FA191,0x00959780,0x0080836C,0x00555847 +dd 0x00666551,0x0094937E,0x00ADAF9C,0x00B6BBAC,0x00B4BEB1,0x00AAB7AB,0x00A8B5AA,0x00A6B2A8,0x00A1AEA3,0x009EACA1,0x0097A398,0x008B9485,0x008E8E75,0x00908A6E,0x008B856A,0x00857E63,0x00817B60,0x00807B60,0x00827D63,0x008C876C,0x0089856A,0x0087836A,0x0086826B,0x00888670,0x0091927D,0x009A9D8A,0x009C9E8D,0x009FA292,0x00A7A99D,0x00A9ACA1,0x00A7AAA0,0x00ABADA4,0x00AFB0A9,0x00B3B3B0,0x00B7B7B5,0x00B7B7B6,0x00B5B6B0,0x00B7B9AC,0x00B4B6A7,0x00B1B1A4,0x00A9A898,0x00B0AD9A,0x00BBB6A2,0x00B7B09D,0x00AFAA98,0x00B0AC9D,0x00B2AEA1,0x00B6B2A5,0x00BBB7A8,0x00BBB7A8,0x00BBB7A9,0x00BCB7AA,0x00B8B4A6,0x00BDBCAC,0x00BDBCAB,0x00BDBDAB,0x00BFBFAC,0x00BDBDAB,0x00B5B4A3,0x00A9A897,0x009F9F8E,0x0090927D,0x00747761,0x003B3C2C +dd 0x003B352A,0x00867E67,0x00A19E87,0x00A2A28F,0x00A0A18E,0x009C9D8A,0x009B9C89,0x00989985,0x0091927F,0x008D8F7B,0x008F907B,0x0096957F,0x00969178,0x00918971,0x008F876E,0x008E866D,0x008A826A,0x00867E66,0x00857E65,0x008B856C,0x008C8971,0x008A8972,0x008D8B76,0x008F8D78,0x008E8D77,0x0094937D,0x0095947F,0x00999884,0x00A2A08F,0x00A8A697,0x00A4A294,0x00A4A294,0x00A7A497,0x00ABA89B,0x00AEAB9E,0x00ADAA9D,0x00ADA798,0x00AFA794,0x00A89F8C,0x00A69D8B,0x00A99F8D,0x00B6AD9A,0x00C4BBA8,0x00C7BEAC,0x00C0BAA9,0x00BCB9AB,0x00BEBCB0,0x00C2C0B4,0x00C4C2B5,0x00C4C2B5,0x00C1BFB2,0x00BEBCAF,0x00BBB7A9,0x00BBB3A2,0x00B7AE9C,0x00B5AD9B,0x00B5AD9A,0x00B3AB98,0x00B0A795,0x00A89F8D,0x009B9481,0x00888671,0x00696752,0x002A251B +dd 0x00241E15,0x0074664A,0x0093876A,0x00938A71,0x00938A70,0x00948B70,0x0091886D,0x008A8166,0x00857B60,0x0083795E,0x0084795E,0x0085795F,0x0086755E,0x0086735D,0x008B7762,0x008E7A64,0x0089755F,0x0083705B,0x00816E59,0x0083725C,0x0084775E,0x0082775C,0x00867B61,0x00867C61,0x0083795D,0x00897E63,0x008A7F64,0x008B8066,0x0090846E,0x00978B78,0x00998D7B,0x009C917E,0x009E9380,0x00A09682,0x00A49986,0x00A09582,0x00A1927E,0x00A5927A,0x009C886F,0x0099856E,0x009B8770,0x00A39178,0x00AE9C84,0x00B3A08A,0x00B3A38C,0x00B1A491,0x00B6AA98,0x00BBAF9D,0x00BDB09F,0x00BCB09E,0x00B5A896,0x00AC9F8D,0x00AD9E8B,0x00AD9B85,0x00A6927C,0x00A08C76,0x009D8A72,0x009A876F,0x009A866F,0x0099866E,0x008E7D65,0x007A6E52,0x005E5136,0x002E1D0E +dd 0x00151109,0x0056492D,0x00796D4E,0x0081775B,0x00857D60,0x00887F61,0x0083785C,0x00796D51,0x00726348,0x006F5D44,0x006C583F,0x006B563E,0x006F5540,0x00735843,0x00755A46,0x00715541,0x006A4E3A,0x00684C38,0x00644A34,0x00654C35,0x00685039,0x00664F38,0x0069523B,0x0069533C,0x0068543A,0x006E583F,0x006A553D,0x0067513B,0x00675341,0x006C5C4D,0x00706051,0x00746556,0x0077695A,0x007A6C5D,0x00817163,0x007D6C5D,0x007D6857,0x00826752,0x007B5F49,0x007C614B,0x007C614B,0x007C614B,0x00826651,0x00876A56,0x008E745F,0x00917A67,0x00957F6D,0x00977F6E,0x00987E6E,0x009A8270,0x00967D6B,0x008A7260,0x008D7361,0x008F735F,0x00886B56,0x007F634E,0x007B5F4A,0x00785D47,0x00765A45,0x00795E48,0x00755B44,0x00664F34,0x004E381D,0x002E1506 diff --git a/programs/free3d04/trunk/wall3.inc b/programs/free3d04/trunk/wall3.inc new file mode 100644 index 0000000000..44e602f08c --- /dev/null +++ b/programs/free3d04/trunk/wall3.inc @@ -0,0 +1,64 @@ +dd 0x00485D5E,0x0073837F,0x00707D79,0x00798682,0x00929F9C,0x00899693,0x007C8885,0x008A9793,0x008E9B97,0x007A8783,0x00687570,0x007D8A86,0x0076837F,0x00626F6B,0x006D7370,0x00747474,0x00616161,0x00636463,0x006E6D6D,0x00717071,0x006D6D6D,0x007A7A7A,0x007F7F7E,0x00767675,0x00717171,0x007D7C7D,0x00818080,0x00737473,0x00717371,0x007C7D7C,0x00777777,0x00737373,0x007D7D7D,0x007F7F7F,0x00777777,0x00888888,0x008C8C8C,0x00717171,0x006C6C6C,0x007E7E7E,0x00838383,0x006F6F6F,0x00727272,0x00767676,0x006E6E6E,0x00686968,0x007C7D7D,0x00838383,0x00737373,0x006D6D6D,0x00838483,0x00777B79,0x005B6662,0x006A7773,0x00707E7B,0x00596568,0x0066727A,0x007A858E,0x00636E77,0x00616C75,0x007E8992,0x007A858E,0x0066717A,0x00455259 +dd 0x005C7070,0x007E908B,0x00768680,0x007E8F8A,0x0096A6A1,0x008B9B96,0x007D8D88,0x00909C98,0x00939A98,0x007C8381,0x006B716D,0x0080867F,0x007C847B,0x00697068,0x00737773,0x00797A7A,0x006A6B6B,0x006B6C6B,0x007B7979,0x007E7A7B,0x00726E6F,0x007A7776,0x00878481,0x007E7D7A,0x007D7B7A,0x00898787,0x008F8C8D,0x00848282,0x00838282,0x00868485,0x007B797A,0x007D7B7C,0x00858383,0x00848283,0x007B7A7A,0x00878887,0x008A8B8B,0x00747575,0x00737473,0x00868786,0x008C8D8C,0x007C7E7C,0x00848584,0x00868686,0x00797979,0x00757474,0x00878585,0x008F8D8D,0x00858383,0x00817F80,0x00989798,0x008F9291,0x0078807D,0x00919B97,0x009AA4A2,0x007D8A8C,0x008A979D,0x009DAAB0,0x008A959D,0x0087919A,0x00A4AEB7,0x0098A2AB,0x0077818B,0x005D6770 +dd 0x00586965,0x006D817A,0x005D726B,0x0060756E,0x00758982,0x006C8179,0x0061746D,0x007B827F,0x00878183,0x00787072,0x006C6361,0x007E776D,0x00817B6D,0x00726D5F,0x007B7A73,0x00818482,0x00737775,0x00656564,0x0081797B,0x008F8488,0x00817779,0x00786F6C,0x008F8880,0x00928B84,0x00877F7C,0x008B8284,0x00A1989A,0x009E9597,0x00928A8C,0x008E8589,0x00898083,0x00857D80,0x0081797C,0x00888183,0x00837E7F,0x00797A79,0x00797C7A,0x00767A78,0x00717573,0x006D716F,0x00767A78,0x00797C7A,0x00777A78,0x00717472,0x007A7A7A,0x00827C7D,0x007E7578,0x007F7679,0x0080787A,0x00756D6F,0x00837B7D,0x00888284,0x007C7778,0x00888586,0x00959697,0x00869392,0x008DA09E,0x0095A7A6,0x008A9699,0x00848893,0x009C9FAA,0x00999CA9,0x00797B8E,0x00656678 +dd 0x00687671,0x0083948E,0x00768881,0x00748680,0x008E9F98,0x00879892,0x00798983,0x00949896,0x00A59B9D,0x00998C90,0x008E8181,0x00A0958C,0x009E9488,0x008C8277,0x0093908A,0x009A9C9B,0x008E918F,0x00777575,0x00948A8C,0x00AA9EA2,0x00A5989B,0x00918480,0x00A1968D,0x00AA9F96,0x009F938F,0x00978B8E,0x00B0A3A8,0x00B8ABAF,0x00AA9DA2,0x00A2959A,0x00A6989D,0x009E9195,0x0093878B,0x00A4989C,0x00A59D9F,0x008F8F8E,0x00919391,0x009B9E9C,0x00919593,0x007C7F7D,0x00868886,0x00969997,0x008E918E,0x00808380,0x00939292,0x00A0979A,0x008F8186,0x008C8084,0x009B8F93,0x008B7F83,0x00908388,0x00A4979C,0x009B8E93,0x0084777C,0x00938C8E,0x009BA4A2,0x0097A9A3,0x0090A39D,0x008F9A9B,0x0084848F,0x008D8B98,0x009B99AA,0x0086829C,0x007A768C +dd 0x0066716C,0x00757F7B,0x0068716E,0x005C6461,0x00707875,0x006F7875,0x00606866,0x00656464,0x0072676A,0x00716367,0x00635558,0x00756965,0x007E736D,0x00726661,0x00635B59,0x00615C5D,0x00625C5E,0x00564E51,0x005F5356,0x0075676C,0x007F7174,0x0070635F,0x0072675E,0x007F746C,0x00837874,0x00786B6F,0x00817478,0x0096898D,0x00918488,0x00796B70,0x00776A6E,0x00776A6E,0x0075686D,0x00807277,0x007F7578,0x00746F6F,0x00797676,0x007B7979,0x00737172,0x00656364,0x006A6868,0x00716F6F,0x00757172,0x006E6A6B,0x006C6668,0x00716569,0x006C5E63,0x006C5F63,0x00776A6F,0x0074676B,0x0074666B,0x007B6D72,0x007F7177,0x00706267,0x00746A6D,0x00747876,0x00717D78,0x00727F7B,0x007C8286,0x007A7984,0x00757280,0x00807D8E,0x0077728D,0x00736F85 +dd 0x003E4543,0x003B3D3C,0x003B3A3A,0x002B2B2B,0x00333132,0x003B393A,0x00393739,0x002E282B,0x003C3034,0x004A3D41,0x003D2F34,0x003C2F33,0x0045383C,0x004C3F43,0x003A2E31,0x00382B2F,0x00423439,0x0045373C,0x003A2C31,0x0046393D,0x0056494C,0x004F433F,0x00433830,0x004E423A,0x005F5450,0x005C4F53,0x00524549,0x0064575B,0x006B5E62,0x0056494D,0x0054474B,0x00594C51,0x00605358,0x0063545A,0x005A4D51,0x005D5356,0x00675E60,0x0061585B,0x005E5558,0x005A5154,0x00574D50,0x0051474A,0x005E5457,0x0063585C,0x00594E52,0x005E5256,0x00695B5F,0x0066595D,0x00605357,0x0066595D,0x0066595D,0x005C4F53,0x00615358,0x0063555A,0x00605558,0x00575555,0x005E615F,0x00656766,0x0065666C,0x006D6C78,0x00615F6C,0x00605D6F,0x005F5B75,0x00565268 +dd 0x001F2422,0x001B1919,0x00292123,0x00191012,0x00160C0F,0x00201519,0x002C2125,0x0023171C,0x002C1F23,0x00392C30,0x0031232A,0x002C1E29,0x00332533,0x0041303E,0x002F1B26,0x002C151E,0x00382129,0x00442F36,0x00312126,0x00322529,0x00413437,0x00413532,0x0030251C,0x0032271F,0x00443935,0x004B3E41,0x003D3034,0x0045383D,0x00514448,0x0046393D,0x0045383C,0x004A3C41,0x00504248,0x0054454B,0x0049393F,0x00503D44,0x005D4A50,0x00544248,0x00503E44,0x00523F45,0x00523E45,0x004B373E,0x00513D44,0x00564149,0x004E3C43,0x00514348,0x005A4D51,0x00574A4E,0x004D4044,0x0052454A,0x0055484D,0x00514449,0x00514348,0x0054474B,0x0053474A,0x004B4244,0x00534D4E,0x00585053,0x004C484F,0x0051505C,0x004C4A57,0x00484557,0x004D4963,0x00444157 +dd 0x00101311,0x00140D0F,0x002A1A1F,0x001F0D12,0x001E0C11,0x0028161B,0x00322126,0x002D1E23,0x0034262B,0x003A2D32,0x0032252D,0x00322335,0x003A2A3F,0x00453247,0x00371E2F,0x00371926,0x0041232E,0x004D333C,0x003D2C32,0x00382B30,0x00403336,0x00443936,0x00342921,0x00342920,0x003D312D,0x00413436,0x00372A2E,0x003C2F34,0x00493C40,0x0046393D,0x0044363B,0x0047393E,0x0047393E,0x00493B40,0x00402E34,0x00493139,0x00573D46,0x00523840,0x004B3038,0x0051353F,0x005B3E49,0x00593D47,0x00553841,0x00583C45,0x00574048,0x0054464B,0x0054474B,0x0055484C,0x0055484C,0x00594C50,0x00594C51,0x00594C51,0x0057494E,0x0054474B,0x0054464A,0x004D3F43,0x00514247,0x0053434A,0x00433942,0x003C3946,0x0044414E,0x00454254,0x004A4660,0x00454358 +dd 0x00161613,0x001E1415,0x002F2022,0x00241418,0x0027171A,0x00312223,0x00352528,0x002D2023,0x00362C2D,0x003B3132,0x002F242A,0x00332534,0x003D2D40,0x004A374A,0x00412837,0x0040212C,0x0045252E,0x004F343C,0x0045353A,0x003D3134,0x00403436,0x004B403C,0x0042372E,0x0041362E,0x00473B36,0x004E4141,0x004B3D40,0x004A3C41,0x00504347,0x00524448,0x004D3F44,0x00514448,0x00504346,0x00524348,0x004B373E,0x00573A44,0x0060404B,0x0062424C,0x005D3C46,0x0062414C,0x006C4C57,0x006E4D58,0x0066454E,0x0066464F,0x00684F56,0x0067585C,0x005C4F53,0x005A4D51,0x005E5155,0x0064565B,0x005C4E53,0x0056494E,0x005D4F54,0x00605358,0x005E4F54,0x0059484D,0x00634F54,0x00675459,0x00574B52,0x0047444E,0x00524F5B,0x00555161,0x00534F67,0x004C495D +dd 0x0023261B,0x002A2822,0x002B2722,0x001B1714,0x0025221E,0x0034322A,0x0035322A,0x00282620,0x00313028,0x0036342D,0x002C2825,0x00322829,0x003C2F30,0x00534446,0x004F3E3F,0x00432F2F,0x003E2928,0x00473735,0x00403A35,0x00302D26,0x00312C26,0x00453D36,0x0042382F,0x003B3028,0x0040342E,0x004F423F,0x004E4140,0x00453838,0x00463A39,0x00463938,0x00423534,0x00483B3A,0x00463938,0x00493C3B,0x00473536,0x00563C41,0x00573C41,0x005A3E43,0x00583C41,0x0053373C,0x00593E42,0x005D4045,0x00593B3F,0x005D3F43,0x005D4549,0x005E4F53,0x0055484C,0x00524549,0x0057494E,0x00594B50,0x0056484D,0x004D4045,0x004E4145,0x00594C51,0x005D5054,0x00564747,0x0060504E,0x0060504E,0x00574E4B,0x004E4D4B,0x00494947,0x00504E50,0x00544C58,0x0050474E +dd 0x005E6053,0x00696B60,0x005A5B4F,0x004C4D42,0x0065675C,0x00838678,0x007F8274,0x00616357,0x005C5F52,0x00686B5E,0x00747368,0x007D756C,0x007A6F67,0x00968A82,0x009C9089,0x008A7E76,0x007A6F66,0x00847B72,0x00797A6E,0x00585C4E,0x00515246,0x006B665B,0x0072685E,0x006D6259,0x007D726A,0x0090857D,0x00877C75,0x00796E66,0x007A6F67,0x006B5F58,0x00695D55,0x006F635B,0x0060554E,0x00635851,0x006A5E57,0x00877873,0x0083746E,0x0072635E,0x0070615B,0x00655751,0x006B5C56,0x00735F5B,0x007C6360,0x00987E7C,0x00998585,0x00928387,0x008F8186,0x0095888C,0x0094868B,0x0085777C,0x00928489,0x008E8186,0x00796C70,0x007E7075,0x00908385,0x00948883,0x00AB9F98,0x00A0948D,0x00999289,0x00A1A197,0x0084857A,0x008A8981,0x008B8283,0x00786D6A +dd 0x007A7C6F,0x00898B7E,0x00787A6D,0x007F8174,0x008A8C7F,0x00989A8D,0x00949689,0x007C7E71,0x0075776A,0x008E9083,0x00AEAEA2,0x00B4ADA3,0x00A3988F,0x00B5AAA1,0x00C1B6AE,0x00B5AAA1,0x00A99E95,0x00B7AEA5,0x00B3B0A5,0x00949387,0x00918F84,0x009D978C,0x00978D83,0x008F847B,0x00ADA299,0x00C2B7AE,0x00B5AAA1,0x00A79C93,0x00A89D94,0x0092877E,0x008E837A,0x00958A81,0x00978C83,0x00A3988F,0x009F948B,0x00B6ABA3,0x00B2A89F,0x0091867D,0x008E837A,0x00A1968D,0x00B9ADA4,0x00B6A39E,0x00AB938F,0x00D3BBB7,0x00DAC6C6,0x00C3B5B9,0x00C4B7BB,0x00D5C8CC,0x00CEC0C5,0x00AFA2A6,0x00CBBEC2,0x00D1C4C8,0x00A5989C,0x008A7D81,0x0096898A,0x00A29690,0x00BFB4AB,0x00B7ABA2,0x00BBB6AC,0x00CFCFC6,0x00A8A99E,0x00AFAFA5,0x00B4ABAB,0x00918681 +dd 0x008E9083,0x00A3A598,0x008B8D80,0x00909285,0x007E8173,0x006E7063,0x0085877A,0x009C9E91,0x009A9C8F,0x009C9F91,0x00B4B4A7,0x00B6AFA5,0x00A2978F,0x00A89D94,0x00B0A59D,0x00A3988F,0x009B9087,0x00B0A69D,0x00B4ACA2,0x00A39B91,0x00B4ACA1,0x00C7BDB4,0x00BEB3AA,0x00998E85,0x009A8F86,0x00A69B92,0x00A2978E,0x009E938A,0x00ACA098,0x00AFA49B,0x00A59A91,0x00A0948C,0x00BCB1A8,0x00C5BAB1,0x00A59A91,0x00A1968D,0x00ACA198,0x00A49990,0x009F948B,0x00B8ADA4,0x00D7CBC3,0x00CEBCB6,0x00AE9792,0x00CEB5B1,0x00D6C2C2,0x00B3A5A8,0x00B3A5AA,0x00C6B9BD,0x00C1B3B8,0x00AA9CA1,0x00CDBFC4,0x00D5C8CC,0x00B4A6AB,0x00B4A7AB,0x00D0C3C5,0x00CDC2BD,0x00B4A9A1,0x0092867D,0x00A49E94,0x00C6C6BD,0x00A7A99D,0x00A09F97,0x00A99FA0,0x00908480 +dd 0x008D8F82,0x009FA194,0x007C7E71,0x007E8073,0x007F8274,0x00787A6D,0x0095978A,0x00B5B7AA,0x00ACAEA1,0x008F9184,0x008D8D81,0x00898379,0x00796F66,0x00766C63,0x007B7067,0x006E635A,0x006D6259,0x00867B72,0x00968780,0x0096857F,0x00B3A29B,0x00C8BAB2,0x00C1B5AC,0x00A89D94,0x00B5AAA1,0x00B3A79F,0x00988D84,0x008E837A,0x00AEA29A,0x00CABFB6,0x00BFB4AB,0x00AA9E96,0x00C0B5AC,0x00BBAFA7,0x009B9087,0x009B9087,0x00C2B7AE,0x00CEC3BA,0x00B9AEA5,0x00B8ADA4,0x00D4C8C0,0x00C8B8B2,0x0098817D,0x0099807D,0x00A08B8B,0x00857579,0x00796B70,0x00807277,0x0086797E,0x0086787D,0x00A19398,0x00A79A9E,0x009D9095,0x00BBAEB2,0x00DFD3D5,0x00E1D8D2,0x00BFB5AD,0x00A49990,0x00A7A298,0x00ACADA2,0x00989A8D,0x00929189,0x00988E8F,0x00857A76 +dd 0x007E8073,0x007E8073,0x00636558,0x00808376,0x00A1A497,0x009EA092,0x00949588,0x00999B8E,0x00898B7E,0x0064665A,0x00525347,0x004A443A,0x0041362E,0x00433932,0x0051473E,0x00483D35,0x0041362E,0x0050433B,0x005E4944,0x0069504B,0x0088706B,0x009F8D86,0x009F938A,0x00A99E95,0x00D1C6BD,0x00D5CAC1,0x00B4A9A0,0x009E938A,0x00ABA097,0x00BCB1A8,0x00ACA198,0x0092877E,0x00968B82,0x00A69B92,0x00AA9F96,0x00ACA198,0x00CDC2B9,0x00DBD0C7,0x00BFB4AB,0x009B9087,0x009E9289,0x008E7C76,0x006C5551,0x00624946,0x006C5756,0x0068585C,0x005F5156,0x005A4D51,0x00675A5F,0x006D6065,0x0075676C,0x0076696D,0x007D7074,0x0095888C,0x00AB9FA0,0x00B7ADA7,0x00B4AAA2,0x00CEC3BB,0x00D2CFC5,0x00AEB0A3,0x008C8F81,0x009F9E96,0x00B1A8A9,0x00988C88 +dd 0x008A8C7E,0x00777A6C,0x00696C5E,0x008F9184,0x00B0B0A3,0x00ACAB9E,0x00807F72,0x005E5D51,0x00454639,0x00343529,0x00353429,0x00342D24,0x002A201B,0x00342C27,0x004B423A,0x00443A32,0x00332820,0x003C2E26,0x00422924,0x00442522,0x00563A35,0x00634E48,0x00675952,0x00887C74,0x00B8ACA3,0x00C8BCB4,0x00C3B7AF,0x00C4B7AF,0x00B4A89F,0x0092877E,0x00756960,0x006D6159,0x007B6F67,0x00AFA39B,0x00CEC2B9,0x00BAAEA5,0x00B8ACA3,0x00BEB3AA,0x00A0948C,0x006F645B,0x00675B53,0x0063504A,0x005F4742,0x00563D39,0x0054403F,0x00534447,0x00534649,0x004F4244,0x00574A4D,0x00625558,0x00685B5E,0x00635659,0x0065595D,0x006A5D61,0x00695D5E,0x00776C67,0x0090857E,0x00C9BEB7,0x00DCD6CE,0x00BABAAE,0x008C8D81,0x00908D86,0x00A99FA0,0x00A19591 +dd 0x0095988A,0x0085887A,0x0086897B,0x00909184,0x00969186,0x008C847A,0x00625A50,0x00433B31,0x00352E24,0x00302A20,0x0040392F,0x0052493F,0x00564C43,0x00736961,0x00897E73,0x007E7465,0x00655B4B,0x006D6251,0x00665346,0x004B3328,0x00462F25,0x0046312C,0x00473434,0x005D4A4B,0x007E6B6A,0x009D8C86,0x00C3B2AB,0x00DACAC2,0x00C4B3AD,0x0085746E,0x005D4C46,0x00594945,0x00685855,0x00A08F8C,0x00D4C2BE,0x00C4B3AC,0x0096867E,0x007F6F68,0x00695A53,0x0054443D,0x0056453E,0x0057423A,0x0061493F,0x00674F45,0x00655249,0x0061554E,0x00756A63,0x00746760,0x00675852,0x0075655F,0x00776861,0x005C4F4B,0x004D423F,0x00534746,0x00534746,0x005F5452,0x006F6462,0x008F8382,0x009D9492,0x00AAA3A0,0x00AFA9A6,0x00A59E9B,0x009C918E,0x00928680 +dd 0x008C8F81,0x008B8E80,0x00A6A99B,0x009E9E92,0x00797268,0x00554A41,0x00352A22,0x0031261D,0x00443930,0x005E544B,0x0082776F,0x00978C83,0x0090867C,0x00ABA096,0x00BFB5A6,0x00B5AC96,0x00A39A82,0x00BCB39B,0x00B7AD95,0x00887D66,0x00746854,0x00625049,0x004C343C,0x00452B36,0x00563C43,0x00765F5D,0x00A8918C,0x00BFA8A3,0x00AF9894,0x00755E59,0x00553E3A,0x00543C3D,0x00584045,0x0081686E,0x00AD9496,0x00A38C89,0x007A635E,0x00644E48,0x005D4642,0x00634C46,0x00735D56,0x007C6558,0x0097806F,0x00BAA592,0x00BBAA96,0x00A89E89,0x00C6BCA7,0x00C6B9A6,0x00AD9A88,0x00C0AB99,0x00C1AD9C,0x00918377,0x0073675F,0x0071665F,0x005F534F,0x0056494B,0x00594C50,0x0064575B,0x00716468,0x00AC9FA3,0x00DCCFD3,0x00D1C5C5,0x00A69B95,0x00877D74 +dd 0x007D7F72,0x007F8174,0x00909385,0x007E7F71,0x00595249,0x003C3129,0x00291E18,0x003B3028,0x0063584F,0x00897E76,0x00AFA49B,0x00B6ABA2,0x009D9289,0x00A0958A,0x00B3A99A,0x00ADA48D,0x00A19880,0x00BFB69D,0x00BCB39B,0x00A29980,0x00B0A68F,0x00AD9B91,0x008A7075,0x00583D46,0x004C3035,0x00573D3B,0x0078605B,0x00987F7B,0x00AC948F,0x00816964,0x00583F3C,0x005C4245,0x006B5159,0x0091787F,0x008D7578,0x006E5552,0x005C433F,0x005F4742,0x006E5551,0x0098807C,0x00C0A8A2,0x00BDA798,0x00C0AB97,0x00DECAB6,0x00D7C8B2,0x00B8AE96,0x00CFC6AE,0x00D0C4AE,0x00BFAB97,0x00D8C2AD,0x00DDC8B4,0x00B7A89B,0x00B9ADA4,0x00C0B5AD,0x00998C89,0x00645759,0x004C3E43,0x004D4044,0x005B4E52,0x00928489,0x00C5B7BC,0x00C8BCBD,0x00A59A93,0x00857A71 +dd 0x008E9082,0x00939588,0x00828477,0x004F4F43,0x00332D25,0x00382D25,0x004D4139,0x00756A61,0x0092877E,0x0093887F,0x00A2978E,0x00A99E95,0x0090857C,0x0083786E,0x00948A7B,0x00918871,0x00877E65,0x00A0977F,0x00A19880,0x009C937B,0x00BDB39C,0x00CBBBAC,0x00BBA2A0,0x008F7576,0x006D5352,0x004E3531,0x00523A35,0x00745C57,0x00A18884,0x00917874,0x005B4340,0x00573D41,0x00775C65,0x0090767D,0x00785F62,0x005C4441,0x0058403B,0x00715955,0x00937B77,0x00C0A8A5,0x00E5CEC8,0x00D7C0B1,0x00BCA692,0x00C9B4A0,0x00C1B29C,0x00A29880,0x00AA9F88,0x00AFA28B,0x00AA9682,0x00BEA894,0x00C8B4A0,0x00B5A699,0x00D1C5BB,0x00E2D7CF,0x00C8BBB8,0x00988B8F,0x006D6065,0x00504347,0x0053464A,0x00685B5F,0x0085787C,0x00A49899,0x009F948E,0x008A7F76 +dd 0x009A9C8F,0x00A4A798,0x007E8173,0x0038392E,0x001D1912,0x003A3129,0x00776C64,0x00A69B92,0x00ADA299,0x008F847B,0x00857A71,0x0091857D,0x008A7E76,0x0090847A,0x00ADA294,0x00ACA38D,0x00978F76,0x00A0977E,0x009B937A,0x00958C74,0x00B0A68E,0x00BCAC9A,0x00B19A90,0x00B69D94,0x00AF958E,0x00775E58,0x004C342F,0x00513935,0x0079615C,0x00967D79,0x00806764,0x00755B5F,0x00947A82,0x007B6068,0x005D4447,0x005A413F,0x00775F5A,0x00AD9691,0x00C9B2AD,0x00CAB2AE,0x00D6C0BA,0x00C9B3A4,0x00A8927E,0x00B39F8A,0x00C1B39C,0x00AFA58D,0x00A79D85,0x00BDB09A,0x00BCA894,0x00AD9884,0x00B19D8A,0x00AD9E92,0x00C3B7AE,0x00CEC2BA,0x00C1B4B1,0x00C0B3B7,0x00ADA2A6,0x006E6165,0x004F4246,0x0054474C,0x006F6166,0x00AC9FA0,0x00B3A8A2,0x0090857C +dd 0x008C8E80,0x008F9283,0x00717366,0x0048493D,0x003A352D,0x005B5148,0x0092877E,0x00A99E95,0x009E938A,0x008A7F76,0x0090857C,0x00A79C93,0x009F948B,0x009C9188,0x00B7AEA0,0x00B6AD98,0x00A79F86,0x00BEB59C,0x00BDB49B,0x009E957C,0x009B9179,0x009E8F79,0x009E8876,0x00C5AD9C,0x00D6BFB1,0x00B29B93,0x00755D59,0x00553D39,0x00654D48,0x008E7671,0x009D8482,0x00998082,0x00A1868E,0x006C5159,0x00593F42,0x006A524F,0x009E8783,0x00DAC5C0,0x00E2CBC6,0x00BDA5A1,0x00B8A099,0x00BEA898,0x00B59F8C,0x00C9B5A0,0x00DFD1BA,0x00C9C0A8,0x00BCB39B,0x00DCD1BA,0x00D2BFAA,0x00BCA692,0x00CEBAA7,0x00BEB0A4,0x009E9389,0x008F847B,0x00998D8A,0x00C5BABC,0x00D2C9CC,0x00918689,0x005B4E52,0x00605358,0x0076696E,0x00A99C9D,0x00B1A59F,0x00897E76 +dd 0x006F7063,0x0068685B,0x0056554A,0x0058564B,0x00686158,0x008E847B,0x009F948B,0x008D827A,0x00786C65,0x007F746D,0x00A0948E,0x00B5AAA1,0x00A59A8F,0x008C8177,0x00978D7F,0x00978E79,0x00968D75,0x00B3AA92,0x00BAB198,0x00AAA289,0x00B5AC93,0x00B0A289,0x009D8970,0x00B9A38C,0x00CDB6A4,0x00C3ABA2,0x009C837E,0x006A514C,0x00573F3B,0x006B534F,0x008D7472,0x00987E82,0x007D626A,0x00533840,0x00593F42,0x00816966,0x00AC9591,0x00CDB6B2,0x00CDB6B1,0x00B9A19C,0x00C8B0A9,0x00DAC4B5,0x00C7B19E,0x00C8B4A0,0x00DBCDB7,0x00C8BFA7,0x00BEB69E,0x00D6CCB5,0x00C2AF9A,0x00C3AD9A,0x00DCC8B7,0x00BDAFA4,0x00847870,0x00665A53,0x00736664,0x00A09497,0x00BDB2B5,0x00A4979B,0x007C6F72,0x007E7175,0x007F7275,0x00857878,0x00867A73,0x00655A52 +dd 0x0047453A,0x00463F36,0x00302820,0x003D352C,0x00685E55,0x00A0958D,0x009A8F87,0x006C615A,0x00514543,0x005A4E4E,0x00796D6B,0x0091877D,0x00968C7B,0x00897F6D,0x00847B67,0x008A816A,0x00988F77,0x009C937A,0x00968F75,0x009D977D,0x00B9B298,0x00B6A98E,0x00A08C72,0x00A69077,0x00A9937D,0x00B7A08F,0x00BBA495,0x008C746A,0x005A4140,0x00604748,0x008A7073,0x009D7E86,0x006E4D57,0x005B3A43,0x00785B5F,0x00B89F9C,0x00CBB3AF,0x00BAA29D,0x00B29A95,0x00B9A09C,0x00CBB3AD,0x00DBC4B9,0x00C1AB9D,0x00B19B8E,0x00C2AFA1,0x00BBAB9C,0x00AF9F8F,0x00BBAA98,0x00AF9B86,0x00C3AE9A,0x00C5B0A0,0x00917D78,0x006B5958,0x005F4D4D,0x005D4C4E,0x006C5E62,0x00908387,0x00AFA2A4,0x008C807F,0x00726664,0x006C605D,0x00615551,0x0062574E,0x004D4239 +dd 0x004D4A3E,0x0051483E,0x003D3229,0x00463B32,0x0062564E,0x008A7F76,0x00756960,0x00483D37,0x003C3031,0x00403337,0x00504446,0x00766B61,0x00A49B85,0x00B5AC95,0x00A69D86,0x009F967E,0x00BBB199,0x00B1A88F,0x00958E74,0x00959076,0x009D967C,0x009B8D73,0x00B09B83,0x00BDA790,0x00B39D86,0x00CFB9A3,0x00E1CBB6,0x00B39C8E,0x00664C4C,0x00553B41,0x0070535B,0x007C5964,0x005F3743,0x00653D48,0x00937377,0x00D7BDBB,0x00E1CAC6,0x00C5ADA9,0x00C3ABA6,0x00CBB3AE,0x00C1A8A3,0x00C9B2AB,0x00BEA6A0,0x00B59D97,0x00CEB6B0,0x00CFB9B3,0x00B59E98,0x00B9A297,0x00B49E8C,0x00B8A28F,0x00998374,0x00664F4E,0x0060474D,0x005F464D,0x00533F45,0x0058494E,0x0086797D,0x00BFB4B5,0x00908480,0x00635951,0x0062574F,0x005F544C,0x0062574D,0x004B4037 +dd 0x00817D71,0x00877D74,0x006E635A,0x00665B52,0x0070645C,0x0092877E,0x006F645B,0x003F3430,0x00403435,0x003D3034,0x003F3234,0x00695E53,0x00A79E88,0x00BEB59D,0x00ABA28A,0x00968D75,0x00B1A88F,0x00AEA48C,0x00A59A82,0x00B7AA94,0x00A99B83,0x008B7862,0x00A08976,0x00B29B89,0x00AF9886,0x00CCB4A2,0x00E0C9B6,0x00C0A99B,0x00715758,0x00533941,0x0060434C,0x0068434F,0x00623947,0x006D4450,0x0097757A,0x00C7ADAA,0x00C6AEAA,0x00AF9793,0x00B09893,0x00BBA29E,0x00B9A19C,0x00D0B8B3,0x00CEB6B1,0x00C2A9A4,0x00D8BFBB,0x00DBC3BF,0x00C9B0AB,0x00DBC4B9,0x00DFC9B7,0x00D2BCA9,0x00957F70,0x00614849,0x00624851,0x005E454E,0x00513D44,0x0056474C,0x00897D81,0x00C4BBBC,0x00958B86,0x00776D64,0x007E746B,0x00958A82,0x00A1958C,0x00786D64 +dd 0x00827E72,0x0092887F,0x00685C54,0x00433830,0x0052473E,0x0080756C,0x006C625A,0x00473E3B,0x00423639,0x0036292E,0x002F2223,0x004E4338,0x00837A63,0x008D856C,0x00887F67,0x007F765E,0x00887F66,0x00867B63,0x009A8974,0x00BCA693,0x00A58F7C,0x00755D4E,0x006C5249,0x007A6159,0x0090786F,0x00A48A82,0x00B89F97,0x00A78E88,0x00674D4F,0x004F343C,0x005A3D46,0x0066414D,0x006A404E,0x00754B58,0x009B7A7E,0x00BEA7A3,0x00B69E99,0x00A8908C,0x00927A76,0x00876F6A,0x00927A75,0x00AF9793,0x00BBA39F,0x00B69E99,0x00BFA7A2,0x00BDA5A0,0x00BCA39E,0x00D9C1B6,0x00DDC7B5,0x00CEB8A4,0x008D7568,0x0063494A,0x006F555D,0x00765D65,0x0078666C,0x007D6F74,0x0095888C,0x00AB9FA1,0x00796E69,0x00695E55,0x007D7269,0x00AA9F96,0x00B7ACA3,0x0080756C +dd 0x00716D63,0x00938880,0x006E635B,0x00362C25,0x00332820,0x00534840,0x006A5F57,0x00726762,0x005D5152,0x00413439,0x003B2E30,0x005C5147,0x008D836E,0x008D846C,0x009C937B,0x00A9A088,0x00978E76,0x008C7F68,0x009F8874,0x00A0816F,0x007A5B4A,0x00583B31,0x00513535,0x006A4F50,0x00A28888,0x00AF9596,0x00C0A6A7,0x00A3898A,0x0060464C,0x004A2F37,0x0051343D,0x005E3A45,0x00613644,0x006F4652,0x009F7F84,0x00CAB4B0,0x00C3ADA8,0x00CAB3AF,0x00A18984,0x006F5752,0x006F5752,0x00876F6B,0x00AA928E,0x00CDB6B2,0x00CEB7B2,0x00B29994,0x00A18983,0x00B59C92,0x00BFA997,0x00BDA693,0x00897164,0x005A3F41,0x00674C54,0x00826A72,0x009B898F,0x009A8D91,0x0083777A,0x00746768,0x00524641,0x005B5047,0x0083786F,0x00AA9F96,0x00A99E95,0x0070655C +dd 0x00625D52,0x008B8178,0x00887C74,0x00554A42,0x0032281F,0x00372C25,0x004C4139,0x00574B45,0x00413435,0x0036292D,0x004B3E41,0x007F746B,0x00ADA58F,0x00A0977F,0x00ACA38B,0x00BCB39A,0x00A29981,0x00AB9E88,0x00CAB09F,0x00AC8778,0x006E483A,0x0055332F,0x0051353B,0x00674B54,0x00A58992,0x00B0949E,0x00BCA0A9,0x00957982,0x005D424B,0x004E323C,0x0053363F,0x005F3A46,0x00643946,0x006C424D,0x0089686C,0x00B09895,0x00BAA49F,0x00CDB8B3,0x00A58E89,0x006C544F,0x00644C47,0x00765E59,0x009D8682,0x00D4BFBA,0x00D6BFBA,0x00BEA6A1,0x00AD958F,0x00B9A196,0x00D8C2B0,0x00DFC9B6,0x00AC9589,0x00654B4E,0x0060454E,0x00755B64,0x00806C73,0x0073646A,0x0064575B,0x005E5253,0x00584D48,0x00776C64,0x00B8ADA4,0x00CBC0B7,0x00A69B92,0x005F554C +dd 0x00514E42,0x007B7268,0x009B9087,0x0082776F,0x00483D35,0x002E231E,0x002E231D,0x00372C25,0x002B1F1E,0x00322728,0x005A4E4E,0x008B8077,0x00A49B87,0x00908671,0x00968D76,0x00A29980,0x00888067,0x009C917A,0x00BFA796,0x009E776C,0x005C342B,0x004E2C2B,0x00563942,0x005D414E,0x007B5F6B,0x007E6370,0x00826673,0x006C505C,0x005A3F49,0x00614650,0x00664953,0x0066434F,0x00663E4B,0x00633C47,0x006B4A4E,0x00846968,0x00957B79,0x00A08884,0x0088706D,0x00684F4C,0x005D4441,0x00684F4B,0x00836B67,0x00B19A95,0x00BFA7A3,0x00C9B1AD,0x00CAB2AE,0x00C0A89F,0x00E0C9B9,0x00E6D0BE,0x00C1AA9F,0x008A7274,0x006A5058,0x005F464D,0x00644F55,0x0059494E,0x00534548,0x005D4F50,0x00766B65,0x009B9087,0x00D0C5BB,0x00D0C4BB,0x009E938B,0x0060554D +dd 0x0038342D,0x005C534A,0x00897E76,0x00948980,0x00766B62,0x00564B44,0x0040352F,0x004E433C,0x0051453F,0x00695E57,0x0091867F,0x00998E85,0x008B8074,0x007C7165,0x00817868,0x008B826B,0x007A7159,0x00887D67,0x008C786A,0x006C4E47,0x00442520,0x003D211F,0x00492F30,0x004B3134,0x0053383E,0x005A404A,0x00614651,0x005B404B,0x00543943,0x005B4049,0x0060454E,0x0060424C,0x005A3A44,0x0053333D,0x005D3C45,0x00704E54,0x00745258,0x00715156,0x006E5356,0x0063494C,0x00573C3F,0x00624946,0x007B625E,0x00A48C87,0x00C3ABA6,0x00CBB3AF,0x00C6AFAB,0x00B29A94,0x00C7AFA6,0x00CAB3A8,0x00CAB5AC,0x00C8B4B3,0x009D8588,0x00705758,0x00725B5C,0x006F5C5C,0x006A5756,0x00887572,0x00B1A39B,0x00B6A59B,0x00B2A196,0x009A8A83,0x00766966,0x00544847 +dd 0x0025211D,0x004D443C,0x00796E65,0x008C8178,0x00998E85,0x00968B83,0x00887D75,0x00998E86,0x00968B83,0x009A8F86,0x00B3A89F,0x00ABA098,0x009E938A,0x00978C83,0x00A49A8D,0x00AFA690,0x00A29A81,0x00B6AC96,0x009C8A7E,0x005D4540,0x00422925,0x003E2421,0x00422925,0x00402723,0x00412829,0x00442A31,0x004A3039,0x00543942,0x00583E46,0x00583D46,0x00593E47,0x00634851,0x005D424B,0x0052363F,0x005C3C45,0x006D4551,0x0068404B,0x005B3842,0x005E414A,0x0060454E,0x005D4248,0x006A5150,0x007C6360,0x009A817D,0x00C6AFAA,0x00C2ABA6,0x00A78E8A,0x009C847F,0x00AC9791,0x00B09892,0x00CAB3AD,0x00E1CCC8,0x00C0A8A5,0x00AC9490,0x00C4ADAA,0x00C5B0AB,0x00A8928D,0x00BCA7A2,0x00D7C7C0,0x00BBA79E,0x008F7871,0x00675551,0x005D4F51,0x0054484B +dd 0x002D2724,0x0060564E,0x008C8178,0x00887D74,0x008D8279,0x00978C83,0x00A0958D,0x00B1A69D,0x00A99E95,0x0093887F,0x009A8F86,0x009D9289,0x00A89D94,0x009A8F85,0x00A79C8E,0x00AEA690,0x00A19980,0x00BDB49D,0x00AD9B8F,0x00644D48,0x00442C28,0x00462D29,0x004A312C,0x00472F2B,0x00482F2F,0x0042272E,0x00422831,0x004D323B,0x00593E47,0x005F444D,0x0060454E,0x0061464F,0x005F454E,0x00593E47,0x005B3944,0x00683F4C,0x00663D4A,0x005F3A45,0x00644650,0x006B4F58,0x00654A50,0x00644B4A,0x0069514D,0x00846B67,0x00AF9893,0x00B49C98,0x00AB938F,0x00B6A19D,0x00C8B8B4,0x00B6A09C,0x00B49C98,0x00C1AAA6,0x00AF9692,0x00C0A7A3,0x00DEC6C1,0x00DCC5C0,0x00B59D98,0x00AF9793,0x00B49F9C,0x00A28B88,0x00957D7A,0x006D5A59,0x00635558,0x005E5255 +dd 0x002B2825,0x006A6159,0x008C8279,0x0071665F,0x00675C54,0x007A6F66,0x00968B82,0x00A0958C,0x00948980,0x007D7269,0x00847970,0x008E837A,0x009B9087,0x00887D74,0x00887C6F,0x00867D67,0x00817960,0x00958B74,0x00968578,0x0077605B,0x00543C37,0x003E2621,0x003C231F,0x00412824,0x004C3332,0x004D3239,0x00482D36,0x00432932,0x00482E37,0x00583E47,0x0060454E,0x0051363F,0x004C323B,0x00573B45,0x005E3B46,0x0069404D,0x00643A48,0x005A3642,0x005E414B,0x00634851,0x005E4349,0x005D4443,0x006D5551,0x00957D78,0x00AD9692,0x00A48C88,0x00BAA29E,0x00C1AAA6,0x00C2ACA8,0x00B59D99,0x00B29B97,0x00AE9793,0x00907874,0x00A38B86,0x00BCA49F,0x00BBA49F,0x00967D79,0x007D6462,0x007B6165,0x00866B71,0x009E858A,0x00766266,0x0056474C,0x00524549 +dd 0x004A4541,0x00756B63,0x0071675F,0x00403731,0x00392E28,0x005C5149,0x00847970,0x0091867D,0x00897E75,0x0082776E,0x00988D84,0x0091857D,0x008B7F77,0x00968A82,0x0093887B,0x00887E69,0x00999078,0x00998E78,0x008F7E71,0x00A68F89,0x0098807B,0x00634A46,0x004F3732,0x004F3632,0x005F4646,0x00654A51,0x00543942,0x00412730,0x003F242D,0x004C323B,0x00593F48,0x00523740,0x00492E37,0x00533740,0x005A3742,0x00663D4A,0x00673D4B,0x0065414D,0x006B4F59,0x00654B54,0x006B5056,0x007F6664,0x00977F7B,0x00B09994,0x00C0AAA5,0x00AD9591,0x00CAB2AE,0x00CEB7B3,0x00B29B97,0x00AD9692,0x00CCB8B4,0x00CFBCB7,0x00A18A86,0x00A58E89,0x00B5A19C,0x00AC9793,0x00775F5B,0x00563C3D,0x005B3F4B,0x006B4E5F,0x00876C7C,0x007A646F,0x005E4E55,0x0053454A +dd 0x00625B57,0x00675D55,0x00574C45,0x00392F29,0x00342923,0x005D524A,0x00998E85,0x00B2A79F,0x00A2978E,0x00887E75,0x00A39990,0x00A2978E,0x00998D84,0x00B1A59B,0x00A89E90,0x00948B74,0x00AEA58C,0x00A59A84,0x008F7E71,0x00B9A29C,0x00C6ADA9,0x009F8581,0x009F8681,0x00947B77,0x00816968,0x006B5158,0x00553A43,0x00492E37,0x00422730,0x00422831,0x004C313A,0x0050353E,0x004E333C,0x005B3E47,0x00603E48,0x00653D49,0x00714754,0x0084606B,0x00957982,0x008C727B,0x00A1868C,0x00C3A9A8,0x00C2AAA5,0x00A28985,0x00A68E8A,0x00A68E89,0x00BAA29E,0x00C7B2AD,0x00B19A95,0x00A78F8B,0x00BBA4A0,0x00BFA8A4,0x00A68E8A,0x00C5B0AB,0x00DACDC9,0x00C6B9B6,0x007E6865,0x004A3033,0x00523548,0x005E4058,0x0073556D,0x00866E7F,0x008A7981,0x00706267 +dd 0x005C5651,0x00413831,0x00302622,0x003D322C,0x0050453D,0x0070655C,0x00998E85,0x00A89F98,0x009A928D,0x00817974,0x00948C86,0x0093897F,0x00897E72,0x009C9183,0x00918776,0x007C735A,0x0090876C,0x008B7F68,0x006E5B4F,0x0088716C,0x009E8580,0x008E736F,0x009F827E,0x008E726E,0x00694E4E,0x004C3239,0x00472D36,0x004B3039,0x004C2D38,0x00492A34,0x004D2E38,0x0053343F,0x0050313C,0x00573742,0x00613E4A,0x005F3744,0x00673A49,0x00754C59,0x0081616B,0x007E606A,0x0094777F,0x00AD9193,0x00A28686,0x00826565,0x009E8481,0x00C3ABA3,0x00BBA59B,0x00A89289,0x00AC958E,0x00BFA9A2,0x00B29A93,0x009E8780,0x00977F78,0x00AE9790,0x00BDAAA3,0x00B7A39D,0x008D7671,0x005D4446,0x00573B4E,0x00583C55,0x00634760,0x00816B7C,0x00A3939C,0x0083767B +dd 0x0059534E,0x00483F38,0x002D2622,0x00332A25,0x005E534C,0x0082776E,0x00867C74,0x0087807A,0x007E7C7B,0x007A7979,0x008A8886,0x00868174,0x00837A66,0x00998F7A,0x008B826B,0x007E765A,0x00999073,0x009F947A,0x006D5A4D,0x00563E38,0x005C423E,0x00593A38,0x006B4745,0x006B4645,0x00573639,0x0042262F,0x00432932,0x004C2E39,0x00542F3B,0x0056303C,0x00552F3B,0x005B3442,0x005B3440,0x0059333F,0x00603E49,0x005E3846,0x00613141,0x00643242,0x006A404D,0x006D4653,0x0076505B,0x0076515A,0x006F4A53,0x00755158,0x00AF9290,0x00E1CABC,0x00CEBCA5,0x00A39079,0x00A89483,0x00CDB9AA,0x00BEA89A,0x00B8A193,0x00BDA798,0x00A68F80,0x00A38D7E,0x00BAA496,0x00BBA597,0x008B756C,0x00574345,0x004C3A41,0x005F4D55,0x00847379,0x00A7989D,0x007F7176 +dd 0x004F4742,0x00685D56,0x00655C54,0x005A5049,0x007E736A,0x009D9289,0x00958A82,0x00968E88,0x00888685,0x00919091,0x00A3A19E,0x009B9587,0x00938A74,0x00A59C84,0x00918870,0x0090876E,0x00B9B097,0x00C1B6A0,0x00847166,0x00503833,0x00422824,0x00472825,0x00583231,0x005D3537,0x00573439,0x004A2E37,0x00442A34,0x004B2C37,0x00512A37,0x00542B38,0x00542A38,0x00552C39,0x00552C39,0x00512936,0x0055333E,0x005D3845,0x006C3C4C,0x00713C4D,0x006C3F4C,0x00653B48,0x00643A48,0x005D3341,0x005E3541,0x00724B56,0x00A68889,0x00CBB4A6,0x00C2AE94,0x00AC987C,0x00AB9580,0x00B7A18E,0x00B49E8B,0x00CCB7A5,0x00DBC8B5,0x00BDA794,0x00BAA591,0x00DBC6B3,0x00DFCAB8,0x00B09D8C,0x0065564C,0x00564B43,0x007B6F68,0x00918582,0x0096898C,0x00726469 +dd 0x00332C27,0x006A6058,0x008E837A,0x00887E75,0x008F847B,0x0090847C,0x0082776E,0x00857C74,0x00767069,0x00847E79,0x009A948D,0x00908978,0x007D745D,0x008F866E,0x00958C76,0x00978D7B,0x00ACA290,0x009F9383,0x006D5A50,0x00503733,0x003F2522,0x00462624,0x00552F2F,0x00552E2F,0x00502C31,0x0050343C,0x004D333D,0x005A3C46,0x00633D4A,0x005A313E,0x00532937,0x00542A38,0x00582E3B,0x00532A37,0x0053303C,0x00532F3C,0x00663646,0x00713C4E,0x006E424F,0x00673D4A,0x00633846,0x005F3542,0x00643B48,0x00724A56,0x0088686E,0x00A0877F,0x00BAA58D,0x00D1BCA1,0x00C7B19B,0x00A38D79,0x009C8672,0x00C0AA96,0x00CCB7A3,0x00B7A18D,0x00B49E8A,0x00CBB5A1,0x00C1AC98,0x00AF9B89,0x008B7D71,0x0080756B,0x009A8F87,0x008E837F,0x0073666A,0x005D4F54 +dd 0x00231D19,0x005B5149,0x0092877E,0x0090857C,0x00867B72,0x007D7269,0x00867A71,0x0094887E,0x00807367,0x00817468,0x00998D81,0x00928775,0x00726A52,0x00857D65,0x00AEA593,0x00ABA095,0x00897E75,0x0061544C,0x0045312A,0x00462E2A,0x00422824,0x00422220,0x00502929,0x00532C2D,0x004D2A2D,0x0053373F,0x00634851,0x0080626B,0x0089636E,0x006F4552,0x00603644,0x005A303D,0x00623845,0x00714855,0x00805B68,0x00643F4D,0x005D2C3E,0x00602C3D,0x00623643,0x00633946,0x005C323F,0x00592F3C,0x005F3542,0x00643C49,0x006D4C58,0x00826868,0x00B19A89,0x00D5BFA8,0x00C6B09A,0x009D8773,0x0099836F,0x00B4A08C,0x00B19C88,0x009A8470,0x009D8774,0x00AE9A87,0x00A08B76,0x00B8A592,0x00C4B8AB,0x00A2978E,0x0082776E,0x00655A56,0x00594D50,0x0055484D +dd 0x00231D1A,0x00534942,0x00968B82,0x00A2978E,0x009A8F86,0x0092877E,0x00A3988D,0x00B6A79A,0x009F8C7A,0x00998573,0x00B7A492,0x00AFA18C,0x0080765E,0x00847B64,0x00A89E8F,0x00AC9F9D,0x00766968,0x00433533,0x00331F1B,0x003B241F,0x00442A26,0x0041201E,0x004D2727,0x00563030,0x00502C30,0x004D3139,0x00644A53,0x008B6D77,0x0086606B,0x00633946,0x005A2F3D,0x00552A38,0x005E3441,0x007D5662,0x00A3808C,0x00835E6C,0x00653245,0x00612C3E,0x00653746,0x006D4350,0x00643A47,0x005C313F,0x00572E3A,0x00562E3C,0x005B394A,0x00664B54,0x0089716B,0x00B29B8A,0x00BCA691,0x00AF9985,0x00B19C88,0x00D8C6B2,0x00D6C3AF,0x00B09B87,0x00B8A491,0x00C4B4A2,0x00A6937F,0x00BCAA98,0x00D7CCC0,0x00B6ABA2,0x00786C64,0x00514541,0x00584B4E,0x00594C50 +dd 0x0025211E,0x00544A43,0x008E837A,0x00978C83,0x008F847B,0x008D8279,0x009E9388,0x00B1A192,0x00A08874,0x00A18772,0x00BBA38D,0x00AB9B84,0x008B8068,0x009A907A,0x00958A7E,0x00817578,0x005A4D53,0x003C2E30,0x0036211F,0x003B221E,0x00432926,0x003F1F1D,0x00462120,0x00522D2D,0x004E2C2F,0x00563940,0x00765A63,0x00846570,0x006C4653,0x00532937,0x00532937,0x00582E3B,0x005D3440,0x00744D59,0x0094727D,0x00835E6B,0x00653546,0x00612E3F,0x00613442,0x00663D4A,0x00683E4B,0x00663C49,0x00603743,0x005A3341,0x0058364C,0x005E4052,0x007E6366,0x00B39C91,0x00DBC7B3,0x00D6C0AC,0x00BCA793,0x00D7C4B0,0x00D8C8B4,0x00A99481,0x00AA9480,0x00B29E8B,0x00927C68,0x009B8775,0x00B0A296,0x00A0958B,0x008C8077,0x00665A56,0x00544749,0x004A3D41 +dd 0x004A4540,0x006D635B,0x008F847B,0x0090857C,0x00867B72,0x007C7168,0x0083786D,0x00928374,0x0087715B,0x008B745D,0x009C8770,0x008B7D68,0x00827764,0x00A39888,0x00897E75,0x00594E4E,0x00463A3C,0x00473939,0x00442F2D,0x00412825,0x00422A25,0x00422824,0x00412622,0x004C312D,0x00513632,0x006F5453,0x00997D82,0x00846670,0x005D3B48,0x004E2936,0x004E2936,0x0055323E,0x00502D38,0x0057343F,0x0073515A,0x0086636A,0x0078535B,0x005D363F,0x0058333B,0x005C3841,0x0058343C,0x0057333B,0x00603C43,0x0063404A,0x005E3E51,0x005C3E51,0x0073575F,0x00A38A83,0x00D7C2AF,0x00E0CAB6,0x00BAA490,0x00B49F8B,0x00B9A591,0x009B8571,0x00AC9682,0x00BFAC97,0x00A48F7A,0x00AA9784,0x00BDAEA1,0x00A69A90,0x00B8ADA2,0x009A8F89,0x005D5151,0x00433739 +dd 0x0059524A,0x00766B62,0x0093877E,0x009D9289,0x009A8F86,0x00857A71,0x00867C71,0x008F8373,0x007E715A,0x007C7057,0x00887B65,0x00817565,0x0071665A,0x00877C72,0x00776B63,0x00463B35,0x00382C27,0x00443630,0x003F2925,0x0039201C,0x003D2621,0x0043302A,0x00372820,0x0043352C,0x00625244,0x00887165,0x00987F7E,0x006D525C,0x00543843,0x00553843,0x0050333D,0x0050343D,0x004B2E37,0x00492A33,0x00664148,0x009B787A,0x00B09895,0x007B6562,0x00593E3E,0x005C3F41,0x00604444,0x00553939,0x004F3532,0x00553A3B,0x00573B46,0x00573A4A,0x00624651,0x00846B68,0x00B59F8E,0x00C9B39F,0x00B09A86,0x00A9937F,0x00BBA692,0x00A8927E,0x00B9A793,0x00CEC2AB,0x00ADA089,0x00AEA28B,0x00C3B7A4,0x00A39987,0x00C0B6A5,0x00C1B8A9,0x0083786D,0x00554A40 +dd 0x00544C43,0x006D6259,0x00887D73,0x0092877E,0x00968B82,0x00897E75,0x00988E83,0x00A39989,0x00938972,0x009D937B,0x00ADA38F,0x00A79D8F,0x00897D74,0x009C9188,0x00A1968D,0x0071665E,0x00554941,0x0061514A,0x0057403B,0x00513834,0x006B544F,0x0076645D,0x005B4F46,0x006B5F55,0x009B8C7C,0x00A89384,0x00836A69,0x00513741,0x00452B36,0x0050363F,0x00513740,0x00533942,0x005A3F48,0x00563942,0x00654047,0x00916D6E,0x00BAA59F,0x00A2918A,0x007C655F,0x00775D59,0x00927974,0x00907773,0x00715954,0x006E5553,0x00694E53,0x00775A65,0x0081656D,0x00977E7A,0x00C0AC9A,0x00BDA792,0x0097816D,0x009E8874,0x00B49E8A,0x009D8974,0x009C8D77,0x00B4AA93,0x00958C74,0x008E866D,0x00A49C84,0x008D846C,0x00A69D86,0x00BBB39C,0x009B927C,0x00645B45 +dd 0x004E473C,0x006A6056,0x00847A70,0x00877C73,0x008D8279,0x007F746B,0x00867B70,0x008D8372,0x00867D65,0x009A9178,0x00A9A18C,0x009E9488,0x007F746B,0x009A8F86,0x00B2A79E,0x00948980,0x008A7E75,0x00A5968D,0x009A847E,0x008C746F,0x00AD9691,0x00AD9D95,0x00887D75,0x0092867D,0x00BBAB9C,0x00BEA99A,0x00836B69,0x00553B44,0x00492F39,0x004E333C,0x00533841,0x00563C45,0x005D434C,0x00553841,0x00563237,0x006D4B4B,0x0098837C,0x00BAAA9F,0x00C1AC9F,0x00B59D91,0x00BEA59C,0x00C4ACA5,0x00AE9691,0x00BAA19E,0x00AC9291,0x00C4AAAC,0x00C1A7A8,0x00B09A92,0x00D6C4B2,0x00D6C1AC,0x00A8927D,0x00B6A08C,0x00C6B09C,0x00AC9782,0x0094836D,0x00ADA38B,0x009A9279,0x00948B73,0x00ABA38B,0x008E856D,0x00968D75,0x00AFA78E,0x00A89F87,0x006F674F +dd 0x005A5448,0x00786E64,0x0092887E,0x0092877E,0x009D9289,0x0093887F,0x00968B81,0x00978E7D,0x007F775F,0x007E765D,0x00857D68,0x007A6F63,0x0061564D,0x007F746B,0x0091867D,0x007A6F66,0x007E736A,0x0096877F,0x00917A75,0x00866D68,0x00A48E88,0x00A3948B,0x00887C73,0x008E8378,0x00A09181,0x00998374,0x00664D4B,0x00523841,0x00543A44,0x004F353E,0x004E333C,0x004E333C,0x00513740,0x004A2E36,0x00482429,0x00603E3E,0x0097827B,0x00D4C6B7,0x00E9D6C1,0x00D2BCA7,0x00C0A998,0x00C4ACA4,0x00B39B96,0x00C3AAA5,0x00AF9690,0x00CBB2AB,0x00CCB4AC,0x00AB9488,0x00C5B09E,0x00D4BEA9,0x00AF9884,0x00C8B29E,0x00DAC4B0,0x00C3AE99,0x00A2917B,0x00BDB29B,0x00B0A88F,0x00AAA28A,0x00C4BEA7,0x00A09880,0x00B0A78F,0x00D2CAB2,0x00C9C2AA,0x00817961 +dd 0x005B544B,0x00766B62,0x008D8279,0x0092877E,0x009E938A,0x00958A81,0x00A59990,0x00ADA393,0x008D856E,0x008A8169,0x0099907B,0x008F8478,0x00786D64,0x00998D85,0x00978C83,0x007D7269,0x008E837B,0x009D8E87,0x0098827C,0x00977E79,0x00BEA6A1,0x00BDADA5,0x009D9289,0x00A89D92,0x00AC9D8D,0x008A7464,0x00513836,0x00462A34,0x004D323D,0x004D323C,0x004F353D,0x004F343D,0x004F353D,0x004B3038,0x00472329,0x005D3B3A,0x00917C75,0x00CABBA9,0x00DAC7A9,0x00C0AB8C,0x00A79179,0x00AD958A,0x009E8681,0x00A68D87,0x009D8479,0x00B49D8D,0x00BAA492,0x009C8573,0x009F8975,0x00B29C88,0x009F8975,0x00B8A18D,0x00CBB4A1,0x00B8A28E,0x00978670,0x00A89D85,0x00A49B83,0x009D957D,0x00B2AA93,0x00938A72,0x00B2A991,0x00D2CAB1,0x00C2BAA1,0x007A725A +dd 0x005D564C,0x00776D64,0x00887E75,0x00877D74,0x00887D74,0x007A6F66,0x00897F74,0x00938978,0x007C735C,0x00867D65,0x009C937E,0x0092877B,0x007C7068,0x009C9188,0x00998D84,0x0083776F,0x00998E86,0x00A79891,0x009A857F,0x008D7470,0x00AA938F,0x00A99892,0x00877B73,0x0093877D,0x00A59686,0x008D7667,0x005A403D,0x004C3038,0x004D313B,0x00523740,0x005B4149,0x00593F47,0x00573C43,0x005C4046,0x00563337,0x00603F3D,0x00836E64,0x00A99985,0x00B29F7F,0x009F8B67,0x00988266,0x00AC9588,0x00A28A84,0x009A827A,0x00A58E7F,0x00AB9580,0x00A8927C,0x00937D68,0x00937D69,0x00A8927E,0x00A08975,0x009B8471,0x00A8917D,0x00A48E7A,0x008D7C67,0x00837961,0x008F876E,0x00948B73,0x00948C73,0x00736A51,0x00938A71,0x00AAA188,0x009B9279,0x00685F46 +dd 0x005A554A,0x007E766C,0x00948C82,0x008F867C,0x008E8378,0x0080756B,0x00877D70,0x008A806D,0x00736A54,0x007D755D,0x008B826C,0x00827868,0x006A6052,0x00847A6B,0x00887D6F,0x00736A5B,0x00807669,0x0096897D,0x00907F73,0x007D6A5F,0x00917F74,0x008E8174,0x007B7062,0x00948879,0x00AF9F8E,0x009A8373,0x0060473E,0x00503634,0x004F3537,0x004D3336,0x0052393B,0x004F3638,0x004B3133,0x00553A3B,0x004E2F2C,0x00593C34,0x008A7567,0x00BFAE98,0x00CBB79A,0x00B49F80,0x00AE997E,0x00CDB6A7,0x00C3ABA2,0x00AF988C,0x00CBB5A3,0x00D2BCA6,0x00C7B19A,0x00AB957E,0x00B19B87,0x00CCB6A2,0x00C7B19D,0x00AB9682,0x00BDA894,0x00CAB6A2,0x00B9A993,0x00998D76,0x00B4AA93,0x00CAC1AA,0x00BCB39B,0x008C836A,0x00A49B82,0x00B9B097,0x00AAA189,0x00726950 +dd 0x004C4C40,0x006C6C60,0x00828175,0x00888577,0x009B9381,0x00928976,0x009B927D,0x00A39A83,0x008F866E,0x00A19880,0x00AAA189,0x009E957F,0x00837B64,0x009E957F,0x00ABA28B,0x00958C76,0x009B927C,0x00B5AC96,0x00A79D87,0x00938973,0x00B1A691,0x00AEA58F,0x00948A74,0x00ADA38C,0x00C9B9A3,0x00AA9580,0x005D4633,0x00462F22,0x00462D28,0x00452D29,0x004C3430,0x0049312D,0x00412924,0x00472F28,0x00472E22,0x00563E2D,0x0088735F,0x00C1AC98,0x00CFBAA5,0x00B7A18B,0x00A58F79,0x00BDA694,0x00B29C8A,0x00A28B79,0x00C1AB97,0x00D4BEA9,0x00CCB6A1,0x00AA947F,0x00B6A08C,0x00D0BAA6,0x00C8B49F,0x00A89782,0x00BEB099,0x00D1C4AE,0x00C0B4A0,0x009A8F7F,0x00B6AB9C,0x00D1C6B5,0x00C6BDA8,0x00A0977E,0x00BEB59D,0x00CFC6AE,0x00C1B8A0,0x0081785F +dd 0x00484A3D,0x005E6153,0x006E7063,0x007A7969,0x00918A74,0x008A816A,0x00938A72,0x009E957D,0x008B826A,0x009C937B,0x00A59C84,0x009E957D,0x00857C64,0x009B9279,0x00A79E86,0x00928970,0x00948B72,0x00A9A087,0x00999078,0x008B826A,0x00AFA68F,0x00AFA68E,0x00887F67,0x00938971,0x00AF9F89,0x00A18C78,0x006F5945,0x00685143,0x00523A33,0x00432B26,0x004C342F,0x00513834,0x004C342F,0x00513933,0x00614A3D,0x00705947,0x007F6955,0x009C8672,0x00AE9884,0x00A48E7A,0x008E7864,0x00A08A76,0x00A38D79,0x00957F6B,0x009E8874,0x00B09A86,0x00AE9884,0x00937D69,0x00A18B77,0x00BBA490,0x00B19C87,0x008F806A,0x009A9078,0x00AFA58E,0x00A89F8C,0x008C8276,0x00A1968D,0x00B9AEA3,0x00B2A996,0x00988F77,0x00BDB49C,0x00CDC4AC,0x00C0B79F,0x00867D64 +dd 0x004F5245,0x00616356,0x006B6D60,0x007A7968,0x00857E68,0x00827961,0x00857C64,0x00867D65,0x00736A52,0x007B725A,0x00827961,0x00837A61,0x00736A51,0x00847B62,0x008C836B,0x00797057,0x007D745B,0x008C836A,0x007F765E,0x00726951,0x008F866E,0x00958C74,0x00756D55,0x00786E56,0x0093836C,0x0096816C,0x00917B67,0x00A58E80,0x00705851,0x0049302C,0x00523A35,0x0059403C,0x00543C37,0x00604842,0x008E786A,0x00B29B88,0x00A48D79,0x00A18A76,0x00BAA390,0x00BFA995,0x00A7907D,0x00B49E8A,0x00C5AF9B,0x00B49E8A,0x00AB9581,0x00C2AC98,0x00C3AD99,0x009F8975,0x009B8471,0x00B19A86,0x00AB9681,0x008C7E67,0x00938971,0x00A79E86,0x00A79E8B,0x008F8479,0x00938880,0x00A69B91,0x00A29886,0x00897F68,0x00A29981,0x00B3AA92,0x00A59C83,0x00766D54 +dd 0x00484B3D,0x00646759,0x006D7062,0x00868574,0x008A856E,0x00928A72,0x00A29981,0x009C937A,0x00857C64,0x008D846C,0x008F866D,0x008E856C,0x00898068,0x00A19880,0x00A79E86,0x008F866D,0x009C947B,0x00ADA48B,0x009F967D,0x008E856D,0x00ABA38A,0x00B3AA92,0x00958C74,0x009B9079,0x00BBAB94,0x00B7A18D,0x00B09986,0x00C6AFA1,0x00836B65,0x00422925,0x00462D29,0x004C332F,0x004B332F,0x0068504A,0x00AA9385,0x00D0B9A6,0x00B7A18D,0x00AE9884,0x00CAB4A0,0x00D0B9A5,0x00B39D89,0x00B7A08C,0x00CBB5A1,0x00B9A38F,0x00B09A86,0x00CCB6A2,0x00D0B9A6,0x00AD9683,0x00AA9380,0x00CCB6A2,0x00CEB9A4,0x00AE9F88,0x00B3A990,0x00CAC1A8,0x00CAC1AD,0x00ABA095,0x00A49990,0x00BCB1A6,0x00BFB5A2,0x00978E76,0x00999178,0x00B5AC94,0x00AFA68D,0x0080775F +dd 0x003E4032,0x00585A4C,0x005E6052,0x00807F6F,0x008D8670,0x00958D74,0x00ABA289,0x00AAA189,0x00978E76,0x00A59C83,0x00A29981,0x009B927A,0x00999078,0x00B2AA91,0x00B5AD95,0x00999078,0x00A89F87,0x00B5AC94,0x00A49B82,0x00938B72,0x00B6AE95,0x00BEB59C,0x00A29980,0x00A59B83,0x00C1B19B,0x00BBA591,0x00B19B88,0x00C9B2A3,0x009A827B,0x004F3632,0x00432B26,0x00432A26,0x00412924,0x006A534C,0x00AD9688,0x00C5AF9C,0x00AD9783,0x00A8917D,0x00C2AC98,0x00CAB39F,0x00B39C88,0x00AE9784,0x00C3AD99,0x00B39D89,0x00AA9480,0x00C7B19D,0x00CAB39F,0x00A7907C,0x00A48E7A,0x00CAB4A0,0x00D1BBA6,0x00AF9F88,0x00B1A78D,0x00CBC2A9,0x00CBC2AD,0x00ABA094,0x00A2978E,0x00BBB0A5,0x00C0B6A3,0x00A19880,0x00AAA189,0x00C8BFA7,0x00C0B79E,0x00898067 +dd 0x00484A3D,0x00595B4D,0x0057594C,0x00747463,0x008F8771,0x008A8169,0x008D846C,0x00938A71,0x008C836B,0x00978E76,0x00999076,0x00968D74,0x00968D75,0x00A29A81,0x00A39B82,0x0090886F,0x00958D74,0x00958C73,0x00877E65,0x0080775F,0x00999078,0x009C937A,0x0091876E,0x00928870,0x00A4937D,0x00A48E7A,0x009F8975,0x00AC9486,0x00A08881,0x00735B56,0x0058403B,0x00503833,0x00503833,0x00765E57,0x009C8577,0x00A38C78,0x00957F6B,0x009B8571,0x00A9937F,0x00AF9985,0x009E8874,0x00998370,0x00A6907C,0x009B8571,0x0097816C,0x00B19B86,0x00B39C88,0x00917B67,0x00907A66,0x00B09A86,0x00B19C88,0x0092836D,0x0091876E,0x00AEA58C,0x00AFA591,0x0094897D,0x0092877E,0x00A89E93,0x00A69C8A,0x008E856D,0x00A39A82,0x00BDB49C,0x00B5AC93,0x007F765E +dd 0x0055584D,0x00696C5F,0x006A6D5F,0x00787968,0x00938D75,0x00857D62,0x0080785E,0x00938A72,0x00948B75,0x008F8670,0x00978E77,0x00A1987F,0x009F967D,0x008E866B,0x00898167,0x00938B70,0x00958D73,0x00877E65,0x00857D62,0x008E856B,0x0091876E,0x008C7E66,0x00A09078,0x009F8E75,0x00927E65,0x00A38A71,0x00B19980,0x00A38C7A,0x00958078,0x008D7973,0x00614C45,0x00503932,0x006F584F,0x00A79085,0x00B9A292,0x00A8927D,0x009D8773,0x00BCA692,0x00C1AB97,0x00B59F8C,0x00A48E7B,0x00B09B89,0x00B39F8D,0x00A28E7C,0x00A08B78,0x00B9A28E,0x00B7A18D,0x0097816D,0x0099836F,0x00B19B87,0x00B19B87,0x00998973,0x0091866E,0x00AEA48D,0x00B1A693,0x00968C7F,0x00988D83,0x00B0A69A,0x00A9A08D,0x008B826A,0x00958C74,0x00ABA289,0x00A79E86,0x00736A52 +dd 0x0041473E,0x005C6053,0x006E7163,0x0080806E,0x009A947A,0x008B8366,0x0092896F,0x00ADA390,0x00B0A698,0x00A59C8D,0x00ADA48F,0x00B5AD92,0x00B3AC8F,0x009C9477,0x00989073,0x00B4AC8F,0x00B4AC8F,0x009B9376,0x009D9678,0x00B3AA8D,0x00AA9E83,0x009F8871,0x00C5AB94,0x00C5AA91,0x00A4896C,0x00BBA07F,0x00D2B897,0x00B6A088,0x009A8B7F,0x00AB9F97,0x00807269,0x005E4A40,0x008A7565,0x00C4AE9C,0x00CDB6A3,0x00B49D89,0x009F8975,0x00CAB39F,0x00D3BDA9,0x00C4AE9A,0x00AF9988,0x00C6B6A8,0x00C9BBAE,0x00B0A194,0x00AF9D8D,0x00D3BEA9,0x00D5BFAB,0x00B09A86,0x00B49E8A,0x00D0BAA6,0x00D4BDA9,0x00B7A38E,0x00A79680,0x00C5B59E,0x00C6B7A3,0x00A69B89,0x00A99F8E,0x00C2B8A7,0x00BCB39E,0x009E957D,0x00ACA38B,0x00C9C0A8,0x00C3BAA1,0x007F765D +dd 0x00383A31,0x004C4E42,0x00626456,0x00757463,0x008B846C,0x007D745A,0x00877D67,0x00A19688,0x00A69B92,0x009E9389,0x00A29887,0x00A69D84,0x00A59D82,0x00978F73,0x00968C71,0x00B2A98E,0x00B2A98E,0x00968E73,0x00978E73,0x00ACA489,0x00A0937A,0x00967E69,0x00C1A691,0x00C2A891,0x00A1886B,0x00B59D7B,0x00C7B08F,0x00AF9D84,0x0093867B,0x00B4A9A1,0x00AB9E94,0x00877464,0x009F8A76,0x00C3AD99,0x00C5AF9B,0x00B29C88,0x009B8470,0x00C2AB97,0x00D0B9A5,0x00C3AD99,0x00AF9B89,0x00C8B9AD,0x00CBC0B6,0x00ADA197,0x00AB9A8C,0x00D7C3AE,0x00DBC5B1,0x00B39D89,0x00B59F8B,0x00CFB9A5,0x00D2BCA8,0x00B7A18D,0x00AA9480,0x00C4AE99,0x00C2AF9A,0x009F947C,0x00A59C84,0x00BFB69E,0x00BFB69E,0x00A29A81,0x00B8AF96,0x00D5CCB4,0x00C6BDA5,0x007A7158 +dd 0x00373428,0x003E3F33,0x004E5043,0x005A5849,0x006B6350,0x00665C48,0x006F6453,0x0084796D,0x0090857D,0x0090847B,0x00958B7D,0x00918873,0x00867D68,0x007A725C,0x00736954,0x00837A65,0x0089806B,0x007C735E,0x00796F5A,0x007D735E,0x00746854,0x00776452,0x009B8674,0x009A8672,0x00826F55,0x00907E61,0x009A896C,0x008C7D68,0x00776B60,0x008F847C,0x0094877C,0x007F6C5B,0x0089735F,0x009E8874,0x009B8571,0x00907A66,0x00826C58,0x00A38C78,0x00B19B87,0x00A9927F,0x009B8674,0x00A89A8D,0x00ABA097,0x00978C83,0x0097877A,0x00BFAA96,0x00C2AC98,0x009F8975,0x00A58F7B,0x00BAA490,0x00BCA692,0x00A58F7B,0x009F8975,0x00B7A08C,0x00B3A08B,0x008E836B,0x008F866E,0x00AAA189,0x00B3AA92,0x009A9279,0x00ADA48B,0x00C0B89F,0x00ADA48B,0x006A6149 +dd 0x002E281E,0x002F3024,0x003C3E32,0x00424034,0x004E463B,0x00554A3F,0x005A4F44,0x0060544B,0x006A5E55,0x0071655D,0x0083786F,0x00786D62,0x00665B4F,0x005F5548,0x00594E42,0x005B5044,0x00655B4F,0x00655A4F,0x005F5449,0x0051463A,0x00584D41,0x006C5E52,0x007C6E62,0x006F6254,0x00635642,0x006E634C,0x00736850,0x006A5F4D,0x005F5349,0x006F645C,0x0076695E,0x006C5848,0x0068523E,0x0077614D,0x0079634F,0x00735D49,0x006F5945,0x00856F5B,0x008E7764,0x00866F5B,0x007B6754,0x007E7063,0x0080746B,0x0074685F,0x00766759,0x00907B68,0x00927C68,0x0079634F,0x00816B57,0x00907A66,0x008F7965,0x00816B57,0x007C6652,0x008C7662,0x008C7A65,0x0071664F,0x006E654D,0x0081785F,0x00898067,0x00746B53,0x007B725A,0x00877E66,0x007D745C,0x00534A32 +dd 0x001D1913,0x001D1F14,0x002D3023,0x00353329,0x00352B27,0x003A2E2B,0x00453834,0x00433730,0x0043372E,0x0051453D,0x006F645E,0x005F5350,0x004C3F3D,0x004B3E3B,0x00504440,0x00483C38,0x00524643,0x005A4E4B,0x005E524F,0x00514642,0x00534944,0x005F5852,0x00625C56,0x00554F47,0x00504B3D,0x005C5846,0x00605B49,0x005F5749,0x005B5047,0x00665B52,0x006B5E54,0x006B5846,0x005F4A36,0x006B5440,0x00725C48,0x006F5945,0x006C5542,0x007A6350,0x00806956,0x0079634F,0x00715D4B,0x00756659,0x0074685F,0x00675B53,0x006C5C4F,0x00816C5A,0x00856E5A,0x00725C48,0x007E6854,0x008D7763,0x008B7561,0x007F6955,0x0076604C,0x007F6955,0x007C6A56,0x00695E46,0x006B634A,0x007F765D,0x00827961,0x006D644C,0x0070674F,0x0080785F,0x007B725A,0x00524931 +dd 0x00121211,0x000F110C,0x0023251A,0x002F2C24,0x0023191A,0x00271B1E,0x00413335,0x003F332D,0x002F2219,0x003C3027,0x00635654,0x004E4144,0x0037292D,0x0035282B,0x0046393C,0x003C2E32,0x0046383C,0x00514447,0x005B4F52,0x0054494A,0x00483F3F,0x004A4847,0x004D4B4B,0x00454442,0x003F4136,0x0046483A,0x00494A3B,0x004F4A3E,0x004F453C,0x0053483F,0x005A4D42,0x00655140,0x0059432F,0x005F4935,0x006C5642,0x006B5541,0x00644E3A,0x006F5945,0x00735D49,0x006D5744,0x00655140,0x006B5B50,0x006D6159,0x0062564E,0x00665649,0x00786351,0x007B6551,0x006C5642,0x0078614D,0x00846E5A,0x00856E5A,0x007C6551,0x00705845,0x00755E4B,0x0073604C,0x00675B44,0x006E654D,0x00837A61,0x00827960,0x006B634A,0x006D644C,0x007E755C,0x007B7259,0x00534A32 diff --git a/programs/free3d04/trunk/wall4.inc b/programs/free3d04/trunk/wall4.inc new file mode 100644 index 0000000000..bbb9176c40 --- /dev/null +++ b/programs/free3d04/trunk/wall4.inc @@ -0,0 +1,64 @@ +dd 0x002C3E40,0x00313F43,0x0029333A,0x0028323A,0x002D383E,0x00333D43,0x00354046,0x003B464B,0x003A454A,0x00384348,0x00404A4F,0x00424E52,0x003E4A4E,0x00414B54,0x00404A53,0x00434D56,0x00424C55,0x00444C56,0x00424953,0x004A525B,0x004C515C,0x004D4D59,0x0050505D,0x0051505C,0x004F505A,0x0054575E,0x004F5259,0x0052555C,0x005B626B,0x0068707A,0x005B636D,0x00373C44,0x003D3E42,0x003C3C3F,0x00353539,0x00323238,0x00303238,0x00323336,0x002E3035,0x0025282E,0x002C2D32,0x00333437,0x002B2D32,0x00272A2E,0x002A2F32,0x002C3034,0x002F3235,0x00303638,0x00384041,0x003A4242,0x003F4848,0x00444D55,0x00474E56,0x004A525A,0x00525A62,0x0053616A,0x0053616A,0x0055636B,0x00515E68,0x004E5B69,0x004B5968,0x00435160,0x00475763,0x00354750 +dd 0x002A3438,0x002D373B,0x00343F43,0x003B474A,0x003F4B4E,0x00444F53,0x004A5559,0x00505B5E,0x00545F63,0x00596468,0x005C666A,0x00646F73,0x00657074,0x006B767E,0x00717B84,0x00727C85,0x00768089,0x007F8690,0x00818892,0x00858B96,0x00878D98,0x00888C97,0x008A8E99,0x008B919C,0x008B8F98,0x0091949B,0x0084878E,0x008D9097,0x009197A0,0x009EA5AF,0x00878E98,0x00828892,0x00A2A2A7,0x00A3A2A7,0x00A1A0A6,0x009B9CA2,0x008C8D95,0x0093949C,0x009A9BA5,0x009598A1,0x0090969E,0x0090969F,0x008B919A,0x00838892,0x007D828E,0x007A7E8C,0x00777C8A,0x006F7780,0x0069737A,0x005E6770,0x004E5760,0x004F565C,0x004C5156,0x0040474C,0x003E4348,0x00383A44,0x00383B47,0x00393C47,0x00383C45,0x00353C3E,0x00343B3E,0x002F3838,0x002F3A3E,0x004A585D +dd 0x001C2529,0x00394448,0x004F5A5E,0x00535D61,0x00586367,0x00576266,0x00616D71,0x00646F74,0x006D797D,0x006E7A7E,0x00717D81,0x00707C80,0x00717D82,0x00727B84,0x00778089,0x0078818A,0x007B838D,0x00818892,0x00828993,0x00868D97,0x00878D97,0x00878E95,0x008A9097,0x008A9198,0x00898D94,0x008E9198,0x0081848B,0x00888B92,0x0092959F,0x00989AA7,0x008D8F9B,0x00848692,0x00999BA7,0x009B9DAA,0x009EA1AD,0x009A9CA8,0x00898B98,0x009496A2,0x00989AA6,0x009599A5,0x00959DA7,0x00979FA9,0x00939BA4,0x00979EAB,0x00999FAE,0x00989EAC,0x00979EAC,0x0097A1AD,0x0099A3AF,0x00929CA8,0x008A949F,0x0089959E,0x008A97A2,0x0084929C,0x00828F99,0x007B858F,0x00747E87,0x00647179,0x005F6A72,0x0060656E,0x005A5F68,0x004D515A,0x0021272E,0x00303A3E +dd 0x002D3436,0x00434B4F,0x00526067,0x0056636B,0x005C6971,0x0059656B,0x00667276,0x00667176,0x00747F83,0x00707C7F,0x006F7A7D,0x00727C7F,0x00768084,0x00717981,0x00757B86,0x007A818B,0x007F8690,0x00818892,0x00838A94,0x00818993,0x00888D95,0x008B8D94,0x008C8F96,0x008D8F96,0x00898B92,0x008E9198,0x00868990,0x008E9197,0x009A9CA6,0x009C9EAA,0x009294A0,0x00868893,0x00A0A1AD,0x00A1A3AF,0x00A0A2AE,0x009A9DA9,0x008B8D99,0x009496A2,0x009899A6,0x009498A3,0x00939AA4,0x00929AA4,0x00959BA6,0x00969CA8,0x00949AA7,0x009197A4,0x009198A5,0x009099A0,0x008F999D,0x008D9698,0x00838E8D,0x00838E96,0x0084909A,0x00838E98,0x00828E96,0x0076858C,0x0078878D,0x0067787E,0x00647179,0x00686E78,0x00636A74,0x00596069,0x00323943,0x0047515A +dd 0x002B3334,0x004B5353,0x00566266,0x00586266,0x005A6569,0x00596264,0x00626869,0x005F6565,0x005D6364,0x00585E5E,0x00595E5F,0x005C6160,0x00606565,0x00767D86,0x0079818C,0x007D848E,0x007C838D,0x00808791,0x00838A94,0x00818892,0x00868C96,0x00898C92,0x00868990,0x008A8D94,0x00898C93,0x008E9199,0x00898C94,0x0090939A,0x009B9EA8,0x009DA0AD,0x008F929E,0x00818490,0x009FA2AF,0x009FA2AE,0x00A0A2AC,0x009E9EA7,0x008C8E98,0x0092949D,0x00989BA3,0x00989BA4,0x009598A4,0x009599A4,0x00989AA7,0x00969BA6,0x009298A3,0x009097A1,0x00959CA6,0x008A919B,0x008C939C,0x00868E91,0x00606968,0x00616B71,0x00606A73,0x00616B74,0x005D6770,0x005C666F,0x00606972,0x00555E67,0x00535A62,0x005B6264,0x00565F60,0x00565F60,0x00374146,0x0049535D +dd 0x00293132,0x00373D3D,0x003C4343,0x003F4649,0x003A4041,0x00393C39,0x003B3B38,0x002C2C29,0x0041413E,0x002E2E2A,0x00403F3A,0x005E5D58,0x002D2C27,0x005A5C5E,0x0081838E,0x007C808D,0x007C838A,0x0080888E,0x00818890,0x0080878E,0x00848A91,0x00888B91,0x00878A91,0x008B8E95,0x008C8F97,0x008E909C,0x008A8C98,0x0092949F,0x009B9FAC,0x009DA3B0,0x008C92A0,0x00818694,0x00A0A7B5,0x00A2A6B2,0x00A09FA8,0x00A09FA4,0x008F9299,0x0093969C,0x0095989F,0x009497A0,0x009294A1,0x009394A0,0x009697A3,0x00959AA5,0x009299A3,0x009198A3,0x009198A2,0x008D949F,0x008C929B,0x007C8487,0x006C7574,0x00858F95,0x00909AA3,0x008B959E,0x007F8992,0x006B737B,0x00646B73,0x00646A74,0x00575F67,0x00505D60,0x004A5356,0x00464A4A,0x003C3F41,0x004C535B +dd 0x00253034,0x00434B4B,0x00545E5E,0x006D7A89,0x005E6464,0x00615E53,0x00514D4A,0x00484340,0x006E6966,0x00635F59,0x00625F57,0x00737068,0x003D3931,0x004E4C48,0x00817F89,0x007A7C8B,0x007A8288,0x007E868B,0x007F868C,0x0080878D,0x00858B91,0x00878A91,0x00898C93,0x008F9299,0x008E919A,0x008F919D,0x008A8C98,0x009496A2,0x009CA0AD,0x009CA2B0,0x008E94A2,0x00838997,0x00A0A6B4,0x00A4A7B4,0x00A2A1AA,0x00A2A1A7,0x0091959B,0x009599A0,0x009A9DA4,0x009699A1,0x009294A1,0x009496A2,0x009495A2,0x008F949F,0x008F959E,0x0090969F,0x008D929A,0x008F959D,0x008C939A,0x007D848A,0x007E858A,0x008E97A0,0x008D98A1,0x008E98A1,0x008F9AA2,0x007C878A,0x00778285,0x00838D91,0x00848F95,0x0088989F,0x00666E74,0x00525257,0x00424246,0x004E5458 +dd 0x00273237,0x00515B5F,0x00697377,0x006B7B7F,0x00515656,0x004D4845,0x0047423F,0x005E5956,0x00504C49,0x005F5B55,0x0056524B,0x004A463F,0x0058544D,0x0053514E,0x00787780,0x007B7D8C,0x007A8189,0x007F888C,0x0080878E,0x0082898F,0x00858C93,0x00898C93,0x008B8D95,0x008F9199,0x008F929B,0x0091939F,0x008C8E9A,0x009799A4,0x009CA0AD,0x009CA2B0,0x009096A4,0x00858B9A,0x009CA2B0,0x00A1A5B2,0x00A5A4AD,0x00A2A0A6,0x0094949A,0x009A9AA0,0x00A2A2A7,0x009B9BA3,0x009496A2,0x009597A2,0x009496A2,0x0092949D,0x0092959C,0x008E9198,0x0090939A,0x008E949A,0x00899096,0x00848B91,0x007C8389,0x007E8890,0x007F8A93,0x007F8A93,0x007B858E,0x00838694,0x0080828D,0x006C7071,0x005E635E,0x006C7474,0x00797F83,0x005D646E,0x00394049,0x004D5357 +dd 0x00273136,0x005F686D,0x00677275,0x00465450,0x003B4442,0x003E403F,0x003D3F39,0x00454742,0x00484B46,0x00484944,0x00474843,0x004C4D48,0x00494A45,0x00525754,0x005E6566,0x0061696C,0x00666F6F,0x006F7576,0x006F7376,0x006B6F72,0x00727678,0x00777A7E,0x00787B80,0x00797D80,0x007F8287,0x0084878E,0x00767980,0x008E9197,0x00A0A4AE,0x009DA3B2,0x00949AA8,0x008B919F,0x009AA1AF,0x009DA0AD,0x00A6A6AF,0x00A19FA5,0x0087868B,0x00828186,0x0088878C,0x00818187,0x007E8187,0x007C7F84,0x007E8185,0x007E8287,0x007A7E85,0x00777A80,0x00777A81,0x0071787D,0x0070787D,0x006E747A,0x006B7276,0x006B737B,0x0069717A,0x006C747D,0x00686F78,0x006F717E,0x0070747C,0x00696E6F,0x00616767,0x0063696C,0x00646B70,0x00697179,0x003D4248,0x00515258 +dd 0x00272D33,0x005E6468,0x00586463,0x00667171,0x00535F5F,0x00364142,0x003E4847,0x00444E50,0x00475253,0x00464D51,0x004A4F53,0x00484E52,0x00464B50,0x00464D51,0x00495155,0x004A5255,0x00474F53,0x004A504D,0x004C504B,0x00494E4A,0x004F5350,0x00525651,0x004F544F,0x0050554F,0x00535855,0x004E5158,0x004B4E54,0x00787B82,0x00A0A5AF,0x00A0A6B5,0x00949AA8,0x00888E9C,0x00A0A7B4,0x00A1A5B1,0x00A1A1AA,0x00959399,0x00646368,0x005D5C60,0x00646266,0x00616164,0x005E6362,0x005E6362,0x005E6261,0x005E6063,0x005C5D64,0x005E6166,0x00585E64,0x00585C62,0x005E5F66,0x00606169,0x005F6069,0x005C616A,0x005A5F69,0x00585E68,0x00555B66,0x00535B61,0x0051585E,0x00495057,0x004F575F,0x006E757B,0x0060676D,0x00737B80,0x0041464B,0x004D4E53 +dd 0x002A3136,0x005F656C,0x006B767D,0x006C777E,0x006D777F,0x008B969F,0x008E9CA7,0x0099A6B1,0x009CAAB6,0x009CA7B3,0x009DA6B3,0x0098A2B0,0x0097A1AE,0x0098A1AC,0x009CA2AD,0x009EA4AF,0x009BA1AD,0x00969AA5,0x00969AA3,0x00999CA6,0x00999DA7,0x009C9FA7,0x009B9EA4,0x009CA1A6,0x009A9EA3,0x009A9BA5,0x009EA0A9,0x0094969D,0x009EA1AB,0x00A2A8B6,0x009399A7,0x00878D9B,0x00A1AAB9,0x009FA6B4,0x00A0A2AD,0x0092919A,0x009F9A9F,0x00B3AEB3,0x00AEA8AF,0x00AAA7AE,0x00A3A6AC,0x00A6AAAF,0x00A6AAB0,0x00A9A7B3,0x00A7A3B3,0x00A8AAB8,0x00A6ACB7,0x00A7ABB9,0x00A3A6B9,0x00A1A6B7,0x00A4A9B8,0x00A3ACBA,0x00A6B2C0,0x00A0ACBA,0x00A0ABB6,0x00A0A7B3,0x00989EAB,0x008E94A3,0x00838996,0x006E757B,0x005D646A,0x00788086,0x0040464C,0x0045484E +dd 0x002B3438,0x005F676B,0x00697477,0x00717C86,0x00768088,0x007F8D8E,0x00819295,0x00859497,0x00859496,0x0088959A,0x00909CA4,0x00929EA6,0x00919EA6,0x00969EA7,0x009EA1AB,0x009DA0AA,0x009FA2AC,0x00A2A7AF,0x00A4AAB2,0x00A5ABB2,0x00A5ACB2,0x00A7ADBA,0x00ACB1BE,0x00B1B6C2,0x00B4B8C5,0x00B6B3C4,0x00B5B3C0,0x00A9A7AE,0x009FA1AA,0x009EA5B3,0x009399A7,0x008A909E,0x00A0AABA,0x009DA5B5,0x00A1A5B0,0x00A1A0AB,0x00B1AFBC,0x00BCBAC7,0x00B9B8C6,0x00B7B7C4,0x00B5B8C2,0x00B7BAC4,0x00B6BAC4,0x00B8B7C4,0x00B2B0BE,0x00ACAEB8,0x00ADB4B9,0x00ABB5BE,0x00A8B2BF,0x00A5AFB9,0x00A7B0B8,0x00A5AFBD,0x00A5AFBD,0x00A0AAB7,0x009DA7B1,0x00959FA8,0x00929DA6,0x00869198,0x00828E93,0x007B8388,0x005F666C,0x006B7278,0x0040474C,0x003D4449 +dd 0x002F3A3E,0x005B6668,0x005F6B69,0x00758088,0x006F7B81,0x00202A26,0x00111C14,0x00162119,0x0019241D,0x001C271F,0x00232B25,0x00272E29,0x00262E28,0x00282E29,0x002B302B,0x002A2F2A,0x002B312B,0x00323433,0x00353638,0x00353637,0x00333435,0x00323337,0x0036373B,0x0037383C,0x0039393D,0x00353435,0x0037373A,0x008E8C94,0x00A7A8B4,0x009EA4B2,0x00959BA9,0x009196A5,0x00A2ABBB,0x009CA4B4,0x00A2A5B1,0x00A4A4AE,0x006E7274,0x00313436,0x0036393A,0x003B3E3D,0x003A3D3E,0x00383B3B,0x00393B3C,0x003B3B3D,0x0038383A,0x00353537,0x00343537,0x0032363A,0x0033373A,0x00323639,0x00323437,0x00293132,0x00293131,0x00272F2E,0x00262D2C,0x00262E2C,0x00202926,0x00141B18,0x00505555,0x007F868B,0x00636A70,0x0071787E,0x003D4348,0x003E4846 +dd 0x002B3639,0x006C7779,0x00697575,0x00758089,0x0058636A,0x003E4747,0x00404549,0x00404549,0x003F4549,0x0041474A,0x00414345,0x00434648,0x00434547,0x0047494C,0x0044484A,0x00404446,0x00434749,0x00444545,0x00434441,0x00464746,0x00494A49,0x00484847,0x004B4A49,0x004C4B49,0x004F4F4D,0x004D4D4F,0x004F4F53,0x00817E86,0x00A4A4B1,0x00A2A7B9,0x009298A6,0x008E959E,0x00A8B0BB,0x00A3A7BA,0x00A6A5B8,0x009A989E,0x00686464,0x00494746,0x004A4646,0x00484447,0x004B4A4F,0x004B4A4F,0x004A494E,0x0046454B,0x0046464C,0x004B4A50,0x004A4850,0x0045474A,0x00424648,0x0044464B,0x0048494E,0x00434B4C,0x00414A4C,0x0041484C,0x0041454B,0x003E3F47,0x003E3F49,0x003E3F49,0x0050515E,0x00747A81,0x006A7277,0x00838D92,0x00434C4F,0x003C423E +dd 0x002A333B,0x006E7880,0x006F7E84,0x00737E86,0x00777D87,0x009BA1AC,0x0099A3AF,0x0099A2B0,0x009CA6B3,0x00A2AAB8,0x00A5ABBA,0x00A3A9B7,0x00A3A8B7,0x00A4A9B7,0x00A2A4B0,0x009DA0AC,0x00A5A7B4,0x00A9ABB6,0x00A7AAB1,0x00AAADB3,0x00AAACB1,0x00ACABB2,0x00B3B1B9,0x00B6B4BE,0x00B7B5C1,0x00B8B7BF,0x00B9B8C0,0x00A6A4AC,0x00A3A4B0,0x00A4AABD,0x00969CAA,0x008F969E,0x00AAB1BB,0x00A7ABBE,0x00A4A3B6,0x0096959B,0x00A8A3A9,0x00BBB6BC,0x00B7B2B9,0x00B6B3B9,0x00BBBBC3,0x00B8B6C2,0x00B3B1BD,0x00B4B2BC,0x00B5B3BD,0x00B6B4C0,0x00B7B5C2,0x00B2B4C3,0x00B1B5C3,0x00B4B8C8,0x00B1B5C7,0x00AEB6C3,0x00AEB6C1,0x00B1B9C7,0x00AEB7C8,0x00AAB2C2,0x00AEB6C4,0x00ACB4C4,0x009EA7B7,0x00787E84,0x00656D73,0x007C8A8E,0x00465456,0x00323939 +dd 0x001B222B,0x00646F79,0x0055646B,0x00707C84,0x007F858F,0x00858995,0x008994A0,0x008F99A5,0x00919CA7,0x00969FAB,0x009CA3B0,0x00A1A7B5,0x00A1A8B5,0x00A3A9B5,0x00A1A4AD,0x00A4A6AF,0x00A6A9B2,0x00A6A9B2,0x00A8AAB4,0x00A9ACB4,0x00A4A7AE,0x00A6A6AD,0x00ABA9B1,0x00ADABB4,0x00ACABB4,0x00ADACB4,0x00A7A6AD,0x00A4A4AB,0x00A7A8B3,0x00A6ACBE,0x009CA2AF,0x009297A0,0x00A9B0BB,0x00A9ADBF,0x00A19FB1,0x00A4A2AA,0x00B5B0B9,0x00BCB8C1,0x00BEBBC2,0x00B8B6BE,0x00BBB9C5,0x00BAB8C7,0x00BBB8C5,0x00BCBAC4,0x00B8B7BF,0x00B0AFB7,0x00ADACB3,0x00ABAEBA,0x00AAB1BB,0x00AFB4BF,0x00ABB0BC,0x00A9B0BB,0x00ABB1BB,0x00AAAFB9,0x00A7ADB7,0x00A3ADB8,0x00A0AAB3,0x00919BA5,0x00848E97,0x0072787E,0x004B5259,0x005E6B6E,0x00374446,0x00323B3E +dd 0x003C4650,0x004D585F,0x0053626A,0x005D6A72,0x0078818A,0x002C3138,0x0019221F,0x00222D29,0x00252E2A,0x00232D28,0x00262C28,0x002A2F2B,0x00303632,0x00343834,0x00333530,0x00343732,0x00343630,0x0032352F,0x002B302B,0x002E322C,0x002D322B,0x0031332F,0x00333231,0x00353535,0x00363634,0x0031312F,0x00383839,0x009B999E,0x00ADAEB9,0x00A8ADC1,0x009FA5B3,0x008E969E,0x00A9B0BE,0x00AAADBE,0x00A3A2B0,0x00AEABB6,0x00818085,0x003B3B3F,0x00403F45,0x003F3E42,0x003F3F3E,0x003E3E3D,0x00424340,0x003C3C3C,0x003C3B3E,0x00343335,0x00313031,0x002F2F30,0x00303031,0x00323232,0x00343434,0x00323436,0x00313435,0x00323434,0x00313433,0x002A3439,0x00273136,0x00182126,0x005E686C,0x00676D6F,0x005E6669,0x00586468,0x0066747B,0x00748591 +dd 0x006D7A8C,0x00556265,0x00788993,0x00687981,0x005B676C,0x00363F41,0x002D3234,0x0031383A,0x00363E40,0x00373E40,0x00393C3D,0x003A3D3E,0x003C3E3F,0x003E3F41,0x003E3E40,0x003F3F43,0x00454549,0x00444547,0x00404442,0x003D4241,0x003E4241,0x00464848,0x004D4C4E,0x004E4E51,0x004D4D4F,0x004E4E4F,0x00555459,0x008B8894,0x00ABA9B9,0x00A9AEC0,0x009DA4B1,0x009199A1,0x00ADB4C1,0x00ABAEC0,0x00A7A7B5,0x00A09EA9,0x006B696F,0x00414045,0x00434248,0x00444348,0x00454445,0x00444447,0x00444448,0x003F3F41,0x00434343,0x00444444,0x00474648,0x00424548,0x003B3F42,0x003F4247,0x0042464B,0x0042494A,0x003F4648,0x003D4446,0x003C4146,0x00384044,0x00363D42,0x00373D43,0x005A6167,0x00585D60,0x00596066,0x00818D96,0x0072818D,0x00738594 +dd 0x006C7F89,0x007B8FA2,0x00788B97,0x00697981,0x00717D82,0x00909B9E,0x008E99A7,0x008E9AA9,0x0097A3B1,0x0099A5B4,0x009EA8B4,0x009FA8B3,0x0099A2AE,0x0098A1AD,0x009BA0AE,0x00A1A5B2,0x00A7ABB9,0x00AAAEBC,0x00AAACB8,0x00A9ACB6,0x00ABADBA,0x00B2B2BD,0x00B6B4BE,0x00B6B4BF,0x00B3B2BD,0x00B8B8C1,0x00BBB9C2,0x009B98A4,0x00AAAABA,0x00AAAEC1,0x009FA3B2,0x009297A0,0x00ADB3C0,0x00ABAFC2,0x00ABABB9,0x009997A3,0x009E9AA3,0x00B7B2BA,0x00B7B2B9,0x00B5B0BA,0x00B0AEBE,0x00B3B0C0,0x00B6B2C1,0x00B6B4C1,0x00B8B6C2,0x00B7B4C3,0x00B7B4C4,0x00ADB1C0,0x00ACB2C3,0x00ACB2C6,0x00A7ADC1,0x00AAB1C0,0x00ABB0BD,0x00ABB1C1,0x00A9AFC0,0x00A9AFBB,0x00A6ADB8,0x00A2A8B5,0x00959BA7,0x00767B84,0x00707782,0x00B2BCCB,0x00808D9D,0x0061707E +dd 0x004C5B60,0x009DAEBE,0x0077838E,0x006E7D85,0x007F8E93,0x00949D9C,0x0096A1AA,0x0094A0AA,0x0099A6AE,0x0098A3AC,0x009FA8B1,0x00A4ADB5,0x00A3ADB4,0x00A3ABB3,0x00A2A7B6,0x00A7AABA,0x00A9ABBA,0x00A9ACBB,0x00AFB1BF,0x00B2B4C0,0x00B0B2BF,0x00ADADB9,0x00B1AEB9,0x00B7B6BF,0x00B5B3BC,0x00B6B8C2,0x00B1ADB2,0x00AEAAAD,0x00A9ABB7,0x00AEAFC3,0x00A2A3B2,0x0092949F,0x00AEB3C0,0x00ADB2C4,0x00ACACBA,0x00AAA8B4,0x00BAB5BF,0x00C0B9C4,0x00C5BEC7,0x00C2BDC9,0x00BBB8C9,0x00BEBBC9,0x00BDBBC6,0x00BCBAC6,0x00B9B7C5,0x00B6B4C1,0x00B5B2BE,0x00ADB1BB,0x00ADB4BE,0x00ABB2BC,0x00ABB1BB,0x00A9AEB8,0x00A8ACB5,0x00A6ACB5,0x00A6ABB4,0x00A8AEBA,0x00A4ABB6,0x009AA0AC,0x009BA1AB,0x0089929B,0x00727B85,0x0087919A,0x007C868F,0x00464D57 +dd 0x003C474A,0x00737D80,0x005D6166,0x0075838D,0x00788990,0x003A423F,0x001B241D,0x00242F28,0x00222F27,0x00212D25,0x00262F28,0x00263028,0x00252E27,0x0027302A,0x00292E2E,0x00292D2E,0x00282B2C,0x002C2F30,0x002E3233,0x002E3132,0x002D3131,0x002E312F,0x002D2E2B,0x0031312E,0x0030312D,0x002C3131,0x00383636,0x00A09BA2,0x00ACACC3,0x00B1B3C7,0x00A5A7B6,0x009497A2,0x00ABB0BD,0x00A9AEC0,0x00A8A8B6,0x00AFACB7,0x008A868F,0x0038333A,0x003B383F,0x00363539,0x00353533,0x00333330,0x00323330,0x00323230,0x00323332,0x0031322F,0x0030302E,0x002B2F30,0x002B2F31,0x002C3031,0x002C3031,0x002B2F30,0x002A2D2E,0x00282B2C,0x00292C2D,0x00282F2F,0x0028302F,0x00192120,0x005C6564,0x008E98A1,0x00737D85,0x00879099,0x00848D96,0x00545B65 +dd 0x004C575C,0x00707A7E,0x00585D63,0x007A8790,0x0061737A,0x0038403E,0x0029302E,0x002C3635,0x002F3B3A,0x00333E3D,0x00353D3F,0x00394143,0x003B4243,0x003C4346,0x00404549,0x0043464B,0x0042464B,0x0044484D,0x0046494E,0x00484B51,0x00454950,0x00494B51,0x004F4E53,0x00545358,0x00535357,0x0057555A,0x00666365,0x00908F94,0x00AEB0C3,0x00B0B4C6,0x009FA5B4,0x008E94A3,0x00A6ACBD,0x00ADB1C3,0x00ACADBA,0x00A3A0AD,0x007A7579,0x004F4C4D,0x00464948,0x004A4E4E,0x004E4F50,0x004B4B4D,0x004D4C51,0x0046464B,0x0047464B,0x004C4B52,0x0049474F,0x00494B52,0x00494B52,0x0046484F,0x004A4C53,0x004A4C52,0x004A4C53,0x004A4C55,0x00494C54,0x00454A4E,0x00454A4E,0x0042494F,0x005C646C,0x008C959E,0x008D97A1,0x0087949E,0x0083909C,0x00606771 +dd 0x00525D64,0x0079868F,0x007B8A96,0x00788793,0x00717F88,0x008E979D,0x008F99A2,0x00929DA8,0x0096A0AC,0x009CA6B2,0x00A1A8B6,0x00A5ABB9,0x00A8AEBC,0x00A5ABB9,0x00A7ADBC,0x00A9AFBE,0x00ACB2C0,0x00ADB3C1,0x00B1B2C1,0x00B5B6C5,0x00B5B6C4,0x00B9B9C6,0x00BDBAC9,0x00C1BFCD,0x00BFBDCD,0x00C2BCC9,0x00C2BDC1,0x00A4A5A8,0x00ABAFBE,0x00ABB1C2,0x009EA4B4,0x009096A6,0x00A7AEBF,0x00ACB1C3,0x00B6B6C4,0x00A6A3AF,0x00AAA0A9,0x00C1B5BE,0x00B8B2BA,0x00B9B6BE,0x00BEBBCA,0x00BAB8C7,0x00B9B5C4,0x00B8B6C3,0x00B8B6C5,0x00B9B6C7,0x00B7B6C7,0x00B6B8C6,0x00AEB2BC,0x00ADB1BC,0x00B7BBC9,0x00B4B9CB,0x00B0B7C7,0x00B0B7C6,0x00AEB4C5,0x00AFB5C4,0x00ACB2C0,0x00ABB0BE,0x00A1A8B3,0x008D99A3,0x008E9DA8,0x008497A7,0x007D92A2,0x0067707A +dd 0x00556069,0x007F8E98,0x007B8C9A,0x00778895,0x00838F99,0x0099A3AB,0x009CA6B2,0x009EA9B7,0x009DA7B5,0x009DA7B4,0x00A1A9B7,0x00A8AFBE,0x00ABB1C0,0x00A7AEBB,0x00AAB1BD,0x00ABB2BD,0x00A6AEB7,0x00A8AFB9,0x00ABAEB8,0x00A6A8B2,0x00A4A6AD,0x00A4A6AE,0x00A7A5B2,0x00ABA9B4,0x00AFADB8,0x00B6B0BB,0x00B0ACAF,0x00AFAFB3,0x00AAADBC,0x00A9ADBE,0x00A8ADBD,0x00999EAE,0x00ADB2C2,0x00AEB2C4,0x00B8B8C6,0x00B2B2BC,0x00BEB6C0,0x00C9C0C9,0x00C6BEC7,0x00C2BDC5,0x00C0BDCA,0x00BBB9C6,0x00B9B7C2,0x00B8B9C4,0x00B3B4C3,0x00AEAFBE,0x00AFB0BF,0x00ACB0BD,0x00AAAFBA,0x00AAAEB9,0x00A8ACB8,0x00A2A9B6,0x00A2A8B4,0x00A1A7B2,0x009FA5B0,0x00A0A7B1,0x009EA5AE,0x009198A0,0x00959CA3,0x0093A0A8,0x008E9DA9,0x008397A6,0x007D92A3,0x0068717C +dd 0x005A656E,0x007F8D97,0x007B8B99,0x007E8F9C,0x007F8D95,0x003F4A4F,0x001E2828,0x0028322F,0x00293330,0x0027312D,0x00272E2C,0x002B312E,0x002D3331,0x002D3230,0x002E332F,0x002B2E2B,0x00272B26,0x00292C28,0x002D2E2B,0x002E2E2B,0x002C2D29,0x002D2E2A,0x00292828,0x00282827,0x002D2C2B,0x002A2A2B,0x00333237,0x00A5A4AC,0x00B6B4C1,0x00A9ABB9,0x00A6A8B7,0x009A9CAA,0x00B3B4C5,0x00B1B2C6,0x00B5B6C4,0x00B3B6BF,0x009B999F,0x003F3A3F,0x00433E43,0x003D393E,0x00383837,0x00363633,0x00363734,0x00343435,0x00333037,0x00343135,0x00353135,0x00313032,0x002D2E2F,0x002C2D2D,0x002D2D2C,0x002A2C2D,0x002A2C2C,0x00282A2A,0x00262A29,0x00242B2D,0x001F2528,0x00151B1C,0x00616669,0x0097A1AC,0x0093A0AE,0x008697A4,0x008295A3,0x006B737E +dd 0x0058656D,0x00798C95,0x007B8D9C,0x007E8E9C,0x0069777C,0x003D4745,0x0028302E,0x002B3133,0x0032393A,0x00383F41,0x00393D41,0x0037393C,0x003C3E42,0x003D4045,0x00404145,0x00434347,0x00424246,0x00414246,0x0046474B,0x004C4D52,0x004D4E54,0x004F5056,0x00545356,0x00575659,0x00545357,0x004D4D4F,0x00545458,0x00919099,0x00B9B7C5,0x00ABAEBC,0x00A4A6B5,0x00989AA8,0x00B7B8CA,0x00B1B2C6,0x00B4B6C4,0x00AAADB7,0x007B787F,0x00474247,0x00474249,0x004D494F,0x00484749,0x00464547,0x00474649,0x00484648,0x004B4849,0x004D4A4C,0x00444143,0x00393A3B,0x00454748,0x0047484A,0x0046484B,0x00444648,0x0046484B,0x004A4B50,0x0047494E,0x0046484B,0x00444649,0x00434549,0x005F6268,0x009197A8,0x00969FAE,0x008A98A5,0x00899BA7,0x006D7580 +dd 0x0058666C,0x00798C95,0x007D8F9B,0x007C8C9A,0x00778491,0x00959DAB,0x00929CA9,0x008E9AA7,0x00939FAD,0x009CA9B6,0x009FA9B8,0x009BA3B3,0x009DA5B6,0x009FA7B7,0x00A7ADBA,0x00ACB1BB,0x00ADB2BD,0x00ACB2BE,0x00AAB0BF,0x00ABB0C1,0x00A9AFC0,0x00B0B4C3,0x00BAB7C2,0x00BEBCC6,0x00BCB9C4,0x00BDBBC2,0x00C2C0C3,0x00A7A6AC,0x00B3B4C2,0x00B2B4C5,0x00A9ABBC,0x009899AA,0x00B5B6C7,0x00B0B1C2,0x00B4B6C5,0x00A1A3B2,0x009D9AA4,0x00BEB9C2,0x00B7B1BB,0x00B8B3BC,0x00B9B3BD,0x00BDB5C4,0x00BAB3C3,0x00B6B1C0,0x00B5B4C2,0x00B9B7C4,0x00B4B2BF,0x00B2B2C3,0x00B3B5C8,0x00B0B2C6,0x00B1B3C6,0x00B1B6C6,0x00B3B8C7,0x00B1B7CC,0x00B2B7CD,0x00ABB3C0,0x00A9B0BD,0x00AEB5C2,0x00A2A8B4,0x008F96A6,0x00919BAA,0x008C9BA8,0x008E9FAC,0x006E7781 +dd 0x005B666E,0x007B8B94,0x007E909C,0x0081929F,0x008895A2,0x00A5AEB7,0x00A3AEBA,0x009DA9BA,0x009EA9BA,0x00A3AEBD,0x00A6ADBC,0x00A7ACBA,0x00A7ACBA,0x00ABB0BB,0x00ABB1BD,0x00A8AEB9,0x00A7ADB7,0x00A6ACB7,0x00A8ABB8,0x00A6A9B6,0x00A7AAB6,0x00A8AAB4,0x00ABA8B4,0x00B1AFB9,0x00B4B3BC,0x00B7B2BC,0x00B5AFB3,0x00B4B5B6,0x00B5B8C7,0x00B5B7CA,0x00ABACBE,0x009B9CAF,0x00B6B7C8,0x00AFB1C0,0x00AFB1C0,0x00ADAFBF,0x00BCB9C4,0x00C9C2CC,0x00C8C1CC,0x00C4BEC8,0x00C1BBC8,0x00C1B9C9,0x00C1B9CA,0x00BBB6C4,0x00B8B6C0,0x00B6B4BC,0x00B5B4BA,0x00B0B0BD,0x00AEAFBF,0x00ADACBC,0x00ACACBA,0x00A6ACB9,0x00A0A7B3,0x009FA6B3,0x00A6ADB9,0x00A8ADBC,0x00A6ACB9,0x009AA3AD,0x00929DA5,0x0096A1AE,0x00909FAC,0x008A9CA8,0x008BA1AC,0x006A7C84 +dd 0x005B656D,0x007E8B95,0x007E8E9B,0x007F919F,0x00849198,0x00485552,0x00272D2C,0x00313135,0x00303235,0x002D2D31,0x002B2E2E,0x002B302B,0x002C302D,0x002E332F,0x002B2E2B,0x002A2D2A,0x002B2C29,0x002B2D29,0x002F2E2A,0x00302F2B,0x00312F2A,0x002F2D29,0x002B2A29,0x002B2B2A,0x002E2F2C,0x002E2A2E,0x00383238,0x009FA0A2,0x00B8BBCA,0x00B8BACC,0x00ABACBE,0x00999AAC,0x00B6B8C8,0x00B2B3C4,0x00AEAFBD,0x00B5B5C4,0x009F9CA4,0x00433E42,0x00423C41,0x003F3A3E,0x003E393C,0x003B3638,0x003A3537,0x00383536,0x00363635,0x00343535,0x00323332,0x00343132,0x00342F31,0x00342F30,0x00333030,0x002D2F30,0x00282C2D,0x00262929,0x00272A29,0x002A2A2C,0x00262A2B,0x001E2725,0x0062706D,0x0097A5B0,0x0093A2B0,0x00889BA7,0x00889EA9,0x006D8186 +dd 0x0059636A,0x007B8891,0x0080909D,0x007F909E,0x006C7A82,0x003B4646,0x00242B29,0x00262C2D,0x00282F30,0x002A3233,0x002F3537,0x00323638,0x002F3435,0x00313637,0x00383B3B,0x003D3F3E,0x003F4142,0x00414345,0x00464547,0x00484748,0x0049484A,0x0048484C,0x00494A4F,0x004D4E53,0x004D4F53,0x004F5155,0x005B575B,0x00968D92,0x00B9B7C7,0x00B7B9C9,0x00A8AAB8,0x009598A6,0x00B6B7C8,0x00B5B2C7,0x00AEABBB,0x00ABA9B5,0x00807D81,0x00494445,0x00454043,0x004D494B,0x004A4648,0x00474346,0x00484347,0x00444145,0x00424245,0x00464548,0x00444347,0x00424345,0x00444546,0x00404243,0x003D4041,0x003F4248,0x0040434B,0x003F414B,0x0041434C,0x0043444B,0x003A3E44,0x0020262A,0x00435054,0x008D9BA7,0x0095A4B2,0x00889AA6,0x00889DA8,0x006F7E88 +dd 0x00556068,0x00748490,0x007F91A0,0x0080919F,0x0074828D,0x008A949A,0x00939DA3,0x00939EA9,0x00929DA8,0x0097A2AD,0x009BA3AF,0x009DA3AD,0x00A2A9B3,0x00A1A7B5,0x00A4ABB8,0x00A9B0BF,0x00ACB2C3,0x00AFB5C5,0x00AEB0BE,0x00ACAEBB,0x00AFB1BF,0x00B8BAC6,0x00BCBFC8,0x00B9BCC6,0x00B7B9C4,0x00BCC0C9,0x00C2BFC4,0x00B1A5AB,0x00B0ACBD,0x00B2B5C5,0x00A4A7B6,0x009194A2,0x00B4B5C5,0x00B4AFC5,0x00ACA9BA,0x00A09FAB,0x00A29FA8,0x00BFB9C2,0x00BCB7C0,0x00BFB9C3,0x00BEB8C2,0x00BEB8C2,0x00BDB6C1,0x00B8B4BD,0x00B6B4BF,0x00B3B2BE,0x00B4B2BF,0x00B3B5C3,0x00B0B5C2,0x00AEB2C0,0x00ABAFBF,0x00AEB3C5,0x00B2B6CB,0x00B0B4C9,0x00B0B5C9,0x00ACB5C1,0x00AAB4BF,0x00A6AFBC,0x0097A1AD,0x008E9DAA,0x0092A2AF,0x008B9CA8,0x008F9FAC,0x00757E8C +dd 0x005C686F,0x007F909D,0x007F93A1,0x007F909E,0x008C9AA5,0x00A5B0B9,0x00ADB6C0,0x00ADB6C4,0x00ACB6C3,0x00ADB8C3,0x00B2BAC6,0x00B6BCCB,0x00B7BCCB,0x00B9BFD0,0x00BAC0CE,0x00B5BCCA,0x00B5BBCA,0x00B5BBC7,0x00B7BAC7,0x00B6B6C6,0x00B4B5C4,0x00B6B8C4,0x00B2B3BF,0x00B0B1BD,0x00B3B2BE,0x00AFB1B9,0x00A8A6A8,0x00B2A6AD,0x00ABA7B6,0x00B1B2C2,0x00A8A7B7,0x009190A0,0x00AFB0C1,0x00ABADC0,0x00A8A2AD,0x00A4A1AB,0x00B8B5C0,0x00C6C0CA,0x00C5C0CA,0x00C5C0CA,0x00C3BCCA,0x00C6BFCB,0x00C5BECA,0x00C4BFCB,0x00BFBDCB,0x00BEBBCA,0x00BCBAC7,0x00B6B6C3,0x00B5B8C4,0x00B9BCC7,0x00B9BCC8,0x00B8BAC6,0x00B3B5C1,0x00B1B2BD,0x00B0B1BC,0x00ACB0C0,0x00ABAFC0,0x00A7AABB,0x009EA0B0,0x0095A2B0,0x0093A4B1,0x008E9EAB,0x008E9EAB,0x0077818F +dd 0x005F6971,0x008393A0,0x007F91A0,0x007F8F9D,0x0084939C,0x00465057,0x00212A2C,0x002A3531,0x0029332F,0x00293330,0x002C3432,0x00303436,0x002E3333,0x00303534,0x00303334,0x002E3032,0x002B2C2F,0x002E2E31,0x00313134,0x00302F33,0x00302E32,0x00302F32,0x002E2A2B,0x002F2A2B,0x00332E2F,0x002B2B29,0x00373535,0x00897E86,0x007D7B83,0x00B2B0BF,0x00A6A3B4,0x00888495,0x00AFAFC1,0x00A9ACBB,0x00847A7E,0x007B7278,0x00918D94,0x00434042,0x00403B3D,0x003E3A3C,0x003A353B,0x0039333A,0x003B363B,0x003A353B,0x00353536,0x00333333,0x00333333,0x002F2F30,0x002F2F33,0x00313033,0x00303032,0x002F2F31,0x002E2C2E,0x002C2B2D,0x002B2A2B,0x0027292B,0x0025282A,0x00181B1E,0x00606267,0x009BA7B4,0x0097A6B3,0x008E9BA9,0x008B99A7,0x00787F8D +dd 0x005F6971,0x007E8F9C,0x007A8D9C,0x007E8E9E,0x00707E86,0x003A4645,0x00292F2E,0x002F3335,0x002F3537,0x002E3439,0x002D3236,0x002E3133,0x00303436,0x00313537,0x0033363A,0x0038393F,0x003A3B41,0x003A3C42,0x003C3E44,0x0043454C,0x00484B52,0x00494C53,0x004D4E53,0x00535459,0x00525459,0x00505459,0x00545059,0x006F646B,0x00747371,0x009E9EA8,0x009B97A9,0x00807D8E,0x009D9CAD,0x009895A0,0x006E5F60,0x007C6D6E,0x006B6367,0x00565155,0x00504C51,0x004F4D53,0x00524F54,0x004E4C51,0x004B484E,0x004C4B4E,0x004A4D4D,0x00494C4E,0x004E5155,0x004B4F54,0x0043494E,0x0042484D,0x00454C51,0x0042454A,0x00404146,0x004B4D53,0x004C4F55,0x003F4745,0x003D4644,0x003B4346,0x00575F66,0x00919CA9,0x009BA6B5,0x00909CAA,0x008E9BA8,0x00797F8D +dd 0x00616B73,0x007A8B98,0x007C8F9D,0x007F919D,0x007A8895,0x008993A0,0x008E96A4,0x00909CAA,0x00939FAD,0x0097A3AF,0x0094A0AD,0x009BA5B1,0x00A1ABB7,0x009EA7B6,0x009FA7B3,0x00A6ACB7,0x00AAB0B9,0x00AAB0B9,0x00ACB2BD,0x00B0B6C3,0x00ACB2BF,0x00B3B9C6,0x00B8BAC5,0x00B7B8C4,0x00B6B6C3,0x00BBBBC8,0x00BBB7C6,0x0070686F,0x00544B47,0x008D868B,0x009B97A2,0x009394A0,0x00A1A4B3,0x0098939C,0x00584545,0x00524140,0x009C8F9B,0x00C5BBCC,0x00BFBCC9,0x00BFBFCB,0x00B7B7C3,0x00B9B8C5,0x00BDBBCB,0x00B9B7C9,0x00B4B6C9,0x00B3B5C8,0x00B6B7C8,0x00B2B6C6,0x00B2B8C8,0x00B4BBCD,0x00B5BBCF,0x00B0B6C6,0x00AAB0C0,0x00ADB5C3,0x00B0B8C6,0x00B1B6C5,0x00AFB4C3,0x00ACB1C1,0x009EA5B0,0x00949FAC,0x009BA8B6,0x00939FAD,0x00909CAA,0x007C8290 +dd 0x00636D74,0x0081919F,0x008093A2,0x008697A5,0x008D9BAA,0x00A6AFBE,0x00ABB3C2,0x00A7B4C4,0x00A9B6C4,0x00ADB8C2,0x00AFB9C5,0x00B1B8C9,0x00B4BACA,0x00B1B7C6,0x00B1B8C4,0x00B2B8C1,0x00AFB4BB,0x00AFB5BB,0x00B3B5C0,0x00B1B2C0,0x00AAABB8,0x00ACACB8,0x00AEAAB5,0x00ACA8B3,0x00ACA7B3,0x00ADA9B3,0x00A7A4AE,0x00918990,0x0066585C,0x00B7AEB4,0x00ACA8B1,0x0090919D,0x00ADB1C0,0x00B5AFBF,0x00806C73,0x006E5C62,0x00C0B3C2,0x00C6BDCD,0x00BEBAC7,0x00BBB9C4,0x00B7B5BD,0x00B9B7BE,0x00BCBAC2,0x00B7B5BF,0x00AFAFBE,0x00ACABBA,0x00B1B0BB,0x00ADAFBA,0x00A8ABB8,0x00A8ABB8,0x00AAADBA,0x00A6ABBA,0x00A0A6B7,0x00A1A8B5,0x00A0A6B3,0x00A4A9BA,0x00A5AABD,0x009B9FB1,0x00989CAB,0x009BA5B3,0x009BA7B5,0x0094A0AE,0x008F9DAA,0x007A818B +dd 0x00636D74,0x008394A0,0x008396A5,0x008799A7,0x0086949F,0x004F595F,0x0030393C,0x00363E3F,0x00343C3D,0x00313839,0x00343A3A,0x00363737,0x00343535,0x00343635,0x00343533,0x00343433,0x002F302F,0x002C2E2B,0x00312E2F,0x00332E31,0x00332E30,0x00312C2D,0x00332B2D,0x00322A2C,0x0030292A,0x002B2526,0x00312F32,0x00A8A1A8,0x00AFA5AF,0x00B0A8B4,0x00A3A2AD,0x008B8D9A,0x00A2A4B5,0x00AEA9BD,0x00ABA0AC,0x00A29599,0x00ABA1A4,0x004A4448,0x00403C3F,0x003C383A,0x003A3335,0x00383032,0x00383132,0x003A3335,0x00383334,0x00353131,0x00322E2F,0x0031302F,0x002F2E2F,0x002C2B2B,0x002E2E2D,0x002A2C2D,0x00282B2D,0x00262A2B,0x0026292A,0x002B2B2E,0x002A262B,0x001C181C,0x005B575B,0x00A0A7B2,0x0098A5B3,0x0095A1AF,0x00939FAE,0x007D848E +dd 0x00606A71,0x008393A1,0x008295A2,0x0083959B,0x00738387,0x002D3838,0x00101515,0x001B1E20,0x00222527,0x0024272A,0x00262A2C,0x002B2C2C,0x00282A2A,0x002A2B2C,0x002C3030,0x00303637,0x00313437,0x00343539,0x003A3A3E,0x003E3E41,0x00404144,0x0044464A,0x0046454A,0x004F4C52,0x004D4C52,0x00515054,0x0058585B,0x00919099,0x00BAB9C6,0x00BABBCA,0x00B2B4C4,0x009799A9,0x00B7B9C9,0x00BBBCCD,0x00B8B7C4,0x00B4AFB7,0x00868084,0x003D383B,0x003B363A,0x003C373D,0x003E3A3F,0x003F3C40,0x003E3C40,0x0039383C,0x00393A3A,0x003B3D3E,0x003A3D3F,0x00363839,0x003A3938,0x00403F3F,0x00414041,0x003C3E42,0x003B3F45,0x003C4045,0x003D4047,0x003B3E42,0x00383B3B,0x00383B3D,0x0053575A,0x008C96A0,0x0099A5B4,0x00939FAD,0x00919DAC,0x007E8590 +dd 0x005F686F,0x0083939D,0x008194A0,0x0082949F,0x006E7D86,0x00717C82,0x007B848A,0x007F8892,0x00828A96,0x00858E9C,0x0089919E,0x008E949E,0x008F96A0,0x008F95A2,0x00919AA7,0x009BA5B3,0x00A1A6B6,0x00A7A7B8,0x00A8AAB6,0x00A5A9B2,0x00A6AAB3,0x00ADB0BB,0x00B4B3BF,0x00B9B6C4,0x00BDBBC7,0x00BFBEC9,0x00BFBFC5,0x00A5A3B0,0x00B7B4C8,0x00BBBBCC,0x00B0B2C1,0x00999BAA,0x00BBBDCC,0x00B5BCC8,0x00B3B6C5,0x00B0AFC1,0x00A09BAB,0x00B8B2BB,0x00B4AEB8,0x00B9B1BE,0x00B7B5C1,0x00B5B4C2,0x00B4B3BF,0x00B1B1BD,0x00ABAEBB,0x00B0B2C1,0x00B5B8C8,0x00B1B4C5,0x00ABB0BD,0x00ADB1BE,0x00AEB3BE,0x00B0B5C2,0x00B1B7C5,0x00B3B8C6,0x00B1B6C7,0x00ABB3C1,0x00A6B0BC,0x00A7B1BE,0x009EA8B6,0x00929CAB,0x0094A0AE,0x00939FAD,0x00929FAD,0x007D858F +dd 0x005E676E,0x0084959C,0x007F929D,0x007E909F,0x008E9CA9,0x00A9B4BC,0x00AEB8C1,0x00AFB7CA,0x00B1B9CC,0x00B1BBCC,0x00B4BCCC,0x00BBC1CE,0x00BCC2D0,0x00BCC1D3,0x00BCC3D5,0x00BDC6D5,0x00B9BDCB,0x00B9B8C3,0x00BAB9C5,0x00BCBCC8,0x00BDBCC8,0x00B9B9C4,0x00BBB8C5,0x00BCB8C6,0x00BCB8C3,0x00BEB9C4,0x00B8B4BC,0x00B8B7C2,0x00B6B7C8,0x00BBBDCE,0x00B2B3C4,0x009C9DAE,0x00BABBCD,0x00B9B7CA,0x00B4B1C4,0x00B6B3C7,0x00C2BECF,0x00D1C7D3,0x00CCC1CF,0x00C6BBC8,0x00BDB8C6,0x00BCBAC9,0x00C1BECA,0x00BDBAC5,0x00B8B7C3,0x00B8B7C3,0x00BCBBC7,0x00BCBCCB,0x00B4B6C9,0x00B8B9CA,0x00B4B5C3,0x00B0B0BE,0x00ACADBA,0x00AEAEBB,0x00B0AFBE,0x00AAAEBE,0x00A4AFBF,0x00A1AAB8,0x0099A3B2,0x009BA6B5,0x00939FAE,0x00919DAB,0x00909DAC,0x007A818C +dd 0x005C646B,0x0082939B,0x007D909C,0x007F919D,0x008897A0,0x004F5961,0x003B4449,0x003E4649,0x003E4446,0x003B4242,0x00393F3F,0x00393A40,0x0038393F,0x0039393F,0x003B3A3F,0x003C393B,0x00383435,0x00383335,0x00393537,0x00383536,0x00383334,0x00363231,0x00353132,0x00363232,0x00363131,0x00332E2F,0x003C363E,0x00B2B0BA,0x00B8BBC8,0x00BBBDCE,0x00B3B3C6,0x009D9FB1,0x00BBBDCE,0x00B5B2C5,0x00B2AFC2,0x00BBB8CC,0x00A7A2B1,0x004B4047,0x0041373F,0x003D323A,0x00382F33,0x00383133,0x003B3336,0x00393133,0x00363135,0x00342F34,0x00332E33,0x00322E31,0x002F2E2F,0x00313031,0x002F2E2F,0x002E2D2D,0x002E2D2C,0x00302F2E,0x002F2D2C,0x002C3130,0x00263131,0x00192323,0x00464F4E,0x009AA5AB,0x0095A2B0,0x008F9BA9,0x008D9AA8,0x00757D86 +dd 0x0059666B,0x008192A0,0x007C8E9E,0x007F929B,0x00718087,0x002A3539,0x00141A1D,0x001B1E1D,0x00232626,0x0026292A,0x0025292B,0x002B2B2F,0x002A2A2E,0x002B2C31,0x00333437,0x00353437,0x0037373A,0x00393A3D,0x00363739,0x00393B3C,0x00414244,0x00424448,0x00474446,0x00423D40,0x00433E41,0x00484447,0x004C484E,0x009C99A5,0x00BABCCA,0x00BABCCD,0x00B5B6C8,0x009FA0B2,0x00BBBCCE,0x00B3B0C3,0x00B1AEC1,0x00B4B1C4,0x00868291,0x00444245,0x004C484C,0x004B474D,0x0049454A,0x004B484C,0x00484549,0x00444145,0x00444647,0x00464949,0x00434648,0x00454647,0x00413F41,0x003D3C3E,0x003B3A3D,0x0038383B,0x0035383A,0x0034373A,0x00313436,0x002C3031,0x002B2F31,0x00242A2C,0x003C4445,0x00869097,0x0097A4B0,0x00919DA9,0x008995A1,0x006A737B +dd 0x005C676A,0x007F8D92,0x007F8F97,0x007E909F,0x006E7D8B,0x007B8691,0x007F8891,0x00848D97,0x008A939E,0x008B95A1,0x008C95A1,0x009198A0,0x00929AA3,0x00939AA6,0x00979DA8,0x009BA0AA,0x00A0A5AF,0x00A0A5B0,0x00A0A5B2,0x00A6A8B8,0x00A8ABBB,0x00A6A9B9,0x00AEABB9,0x00B1AEBB,0x00B2AFBE,0x00B6B2BF,0x00B6AFB7,0x00A29FAA,0x00B7B8C6,0x00BABCCD,0x00B5B6C8,0x009E9FB1,0x00B8B9CB,0x00B5B3C5,0x00B3B0C3,0x00B1AEC1,0x00A29EAF,0x00B2B2BA,0x00B3B2BC,0x00B5B4BE,0x00B7B6C0,0x00B5B4BD,0x00B4B3BC,0x00B6B5C0,0x00B7B9C5,0x00B1B3C1,0x00B2B4C2,0x00B1B3BF,0x00AAADBA,0x00A6A8B5,0x00AAACBA,0x00A9ADB8,0x00A7AEB9,0x00A6ADBB,0x00A3AABA,0x0097A1AF,0x0097A3AF,0x0098A5B0,0x00919DA9,0x008A97A3,0x0097A4B0,0x0096A2AE,0x008996A2,0x00656E77 +dd 0x00555B5D,0x00616967,0x006B787B,0x008695A9,0x0096A2B1,0x00B3BBC8,0x00B3BAC7,0x00B2BDCF,0x00B3BED0,0x00B2BDCE,0x00B1BBCA,0x00B3B9C7,0x00B1B7C8,0x00B6BBCE,0x00BBBFD0,0x00B9BDCC,0x00B8BBC8,0x00B2B6C3,0x00B6B7C7,0x00BBBACE,0x00B8B7C8,0x00B9B6C7,0x00BEBCCC,0x00C1BFCF,0x00C0BECF,0x00C2BECC,0x00C2BBC2,0x00BBB9C3,0x00AFB2BF,0x00B8BACA,0x00B5B6C8,0x009B9CAE,0x00B5B6C8,0x00B4B1C3,0x00B8B5C7,0x00B9B6C9,0x00C6C3D5,0x00CDCAD8,0x00C5C1D0,0x00C4C0CE,0x00C1BECB,0x00C0BEC9,0x00C3C0CD,0x00C4C2CE,0x00BEBECE,0x00B8B9CB,0x00BBBBCA,0x00BEC0CD,0x00B3B9C7,0x00B6BBC8,0x00B3B8C5,0x00AEB3BF,0x00B1B8C7,0x00B3BBCB,0x00AFB7C9,0x00B0B9C9,0x00ADB6C3,0x00AFB7C4,0x00A4ACB9,0x009AA0B0,0x009497A9,0x00757C88,0x007D888E,0x006C7678 +dd 0x004B5352,0x006B7277,0x007F8891,0x008996A5,0x008B94A1,0x00545962,0x0042474C,0x00414A4C,0x003D4545,0x003A4140,0x003B4141,0x003B3A46,0x003D3C47,0x003F3F48,0x00434249,0x00403F45,0x003E3C42,0x0038373C,0x003A373C,0x00413C41,0x00413B3F,0x003D383A,0x003A373B,0x0039383C,0x003B393C,0x00373539,0x00423E43,0x00B0AFB7,0x00B4B8C3,0x00B7BBC9,0x00B5B6C9,0x009798AA,0x00B5B6C8,0x00B1B0C7,0x00B5B5CA,0x00B9BBCC,0x00AEAFBA,0x004C4449,0x00443B41,0x00423A3E,0x003E363A,0x003D3537,0x003B3235,0x003D3336,0x003A3436,0x003A3436,0x003B3436,0x00393335,0x00373338,0x00373439,0x00373538,0x00343136,0x00333037,0x00343138,0x00353238,0x0036363B,0x002F3638,0x00293133,0x00404849,0x00959A9E,0x00858590,0x0072767E,0x00757F83,0x00677274 +dd 0x00404849,0x006A7372,0x00677272,0x007C8C94,0x00737E84,0x001B2325,0x00090E0C,0x00141815,0x00151817,0x00141817,0x00161A19,0x001D1F1E,0x001E1F1F,0x00202120,0x001F2323,0x00202425,0x0024282A,0x00212628,0x00272828,0x00292726,0x002A2829,0x00313031,0x00312B32,0x00322D34,0x0038333B,0x00353038,0x003B393D,0x00999AA2,0x00B7BCC7,0x00B7BCCB,0x00AFB0C2,0x009798AA,0x00B8B8CA,0x00B4B4CC,0x00B6B6CC,0x00B4B5C6,0x008C8E98,0x00403E3D,0x003B3939,0x003C3B3B,0x003F3B3D,0x00413A3E,0x003A3538,0x00393537,0x00393838,0x00393A38,0x00363636,0x00333535,0x002F3437,0x002C3135,0x002B3235,0x002B3033,0x002A2B2D,0x002B2C2E,0x00292C2E,0x00272B2D,0x00232B2C,0x00181F20,0x002B3334,0x00767E7D,0x006A6C67,0x00777C7C,0x0070787D,0x006B777E +dd 0x005B656C,0x004C524F,0x00565B57,0x006C7A7F,0x006E7B7F,0x00657176,0x006F7A80,0x00757D86,0x0079818C,0x0078818D,0x0079838E,0x007F8992,0x007E8892,0x007F8894,0x00828C97,0x008D949E,0x009097A2,0x008B929F,0x008E939E,0x009394A1,0x009698A6,0x009C9EAC,0x00A4A4B2,0x00A3A3B0,0x00A1A2AF,0x00A4A5B2,0x00AAA8B2,0x00A5A3B1,0x00B5B9CB,0x00B7BBCE,0x00ACADBF,0x009597A9,0x00B7B9CB,0x00B6B6CC,0x00B9B9CE,0x00B5B6C7,0x009293A1,0x00A4A3B2,0x00AAA9B8,0x00ABAABB,0x00A9AABB,0x00A5A9B8,0x00A7ABBA,0x00A4A8B7,0x00A0A8B4,0x009FA8B1,0x00A0A9B3,0x009CA5B0,0x009AA6B1,0x009CA9B4,0x0099A6B1,0x0098A4AF,0x0098A4AE,0x0095A1AB,0x00929EA8,0x008E99A4,0x008F97A3,0x008E97A2,0x008B95A1,0x007E8691,0x00444347,0x006D6E71,0x00585D61,0x005E686B +dd 0x007E8C98,0x00495055,0x0074797E,0x00808B9B,0x0096A3B2,0x00AAB6C7,0x00ACB8CA,0x00AEB7CA,0x00B5BECC,0x00B1BACA,0x00B3BDCF,0x00B4BED0,0x00B5BECD,0x00B6C0CB,0x00B4BCCD,0x00BDC1D7,0x00B8BCD3,0x00B7BBD0,0x00BABFCE,0x00BEC2D2,0x00BCC0D2,0x00BABDCE,0x00BEC1CE,0x00B8BBC8,0x00BBBDCA,0x00C1C2CF,0x00C4BFCA,0x00B9B5C4,0x00B4B6C8,0x00B5B9CB,0x00ACB2C2,0x009399A9,0x00B3BACA,0x00B3B5C6,0x00B9B9CC,0x00B9BACC,0x00BABBCC,0x00CAC7D6,0x00C8C6D3,0x00C6C3D0,0x00C2C0D0,0x00BEBDD2,0x00C1C0D2,0x00C3C1D1,0x00C0C1D0,0x00C1C2D0,0x00C1C2CF,0x00C4C4D0,0x00C1C5D5,0x00C2C6D7,0x00BEC3D5,0x00BCC0D3,0x00BCC0CF,0x00BDC1CF,0x00BBBFCB,0x00B9BECB,0x00B8C1CC,0x00B8C1CD,0x00B3BCC9,0x009098A7,0x007C7A7F,0x007D7D80,0x00595E5F,0x005A6567 +dd 0x00738491,0x008496A3,0x00738391,0x007A8791,0x0086939D,0x00505D65,0x004F5A62,0x004E565E,0x004D545A,0x004A5155,0x00495054,0x00494D53,0x004C5055,0x00494B4F,0x004A4C52,0x00474B53,0x0044474D,0x0046494D,0x004A4C4E,0x004A494B,0x00474847,0x00444443,0x00474446,0x00444043,0x00484446,0x00413C3E,0x004B4550,0x00B7B2C1,0x00B8B8CB,0x00B4B8CA,0x00ADB4C3,0x009399A9,0x00B3BACA,0x00B1B3C4,0x00B6B7C9,0x00B8B9CC,0x00B5B6C8,0x0058515A,0x00494049,0x00494148,0x00463F45,0x00454046,0x00423D43,0x00464046,0x00434044,0x00403F42,0x003F3E40,0x00403F41,0x00424249,0x0044454C,0x0044444B,0x0043434A,0x00404147,0x00404047,0x00414147,0x00414248,0x0040494C,0x00384245,0x003D474A,0x00889093,0x00696A72,0x00898C94,0x00787D83,0x006F7A80 +dd 0x005C6673,0x00A6B2C7,0x008D9AB3,0x00818F98,0x006B767C,0x000C1116,0x0005080B,0x000A0C0D,0x000E1113,0x00111417,0x00131619,0x00151418,0x0016151A,0x0018181C,0x00191B1C,0x001B201A,0x00191E18,0x00151A14,0x00191A16,0x0021201F,0x00232422,0x00282727,0x00292928,0x002C2B2B,0x00282929,0x00262627,0x00322E38,0x009A97A5,0x00BBBCCE,0x00B4B7CA,0x00AEB3C3,0x009397A8,0x00B5B9CA,0x00AFB3C4,0x00B4B6C8,0x00B6B6C6,0x00918F9D,0x00342F33,0x002A2528,0x002E2B2F,0x002D2A2E,0x002C2C2A,0x0031302F,0x00323130,0x002F2E2E,0x002F2E2E,0x002C2B2C,0x00292829,0x001F2020,0x001C1D1E,0x00191B1C,0x001C1D1E,0x001F2123,0x00202223,0x00202122,0x00212223,0x001E2124,0x00161A1C,0x001B2024,0x007B8287,0x00737C8B,0x00B5BECC,0x00B3BCCB,0x007C8594 +dd 0x005C636E,0x008C96A5,0x008694A5,0x008394A4,0x0061707E,0x0058626C,0x005E676D,0x0061686D,0x00676F76,0x00697279,0x00687078,0x0070757F,0x00747A83,0x00777C88,0x00767A84,0x007C7E85,0x007B7C86,0x00767883,0x007D7E88,0x0085878F,0x00888B94,0x008D919A,0x008E929A,0x0091949D,0x008F949D,0x009497A0,0x008E919A,0x008C8D9B,0x00B9BACD,0x00B5B6CA,0x00AFB0C2,0x009394A6,0x00B6B6C8,0x00AFB3C6,0x00B5B8C9,0x00B3B2BF,0x00898791,0x0097959F,0x009A9AA3,0x009B9AA5,0x0093919C,0x0094929D,0x009A98A4,0x009694A0,0x0091909D,0x009596A2,0x009797A4,0x0092929F,0x00878C98,0x00838995,0x00808691,0x007F8591,0x00898F9B,0x008A919D,0x00888E9B,0x00878D98,0x00828B98,0x00818B99,0x008690A0,0x008691A2,0x008891A1,0x00A4ADBC,0x008A94A4,0x007C8593 +dd 0x005D656D,0x00859194,0x00808E91,0x008197A7,0x0096A8B6,0x00B2BFD0,0x00B4BFCF,0x00B1BDCB,0x00B9C5CF,0x00BCC7D3,0x00BCC7D7,0x00C0C9D9,0x00C3CDDC,0x00C9D5E2,0x00C9D4E3,0x00CFD7E6,0x00CAD3E2,0x00CCD6E2,0x00D4DDE8,0x00D8DDE8,0x00D7DEE9,0x00D7DDE8,0x00D6D9E3,0x00DDDEE5,0x00DFE1EA,0x00DFE1EC,0x00BBBFC7,0x00A7AAB6,0x00B5B6C8,0x00B5B5C9,0x00ABACBE,0x009192A4,0x00B2B3C4,0x00AFB3C6,0x00B3B6C9,0x00B6B5C3,0x00A8A5B0,0x00D6D4E0,0x00E7E4EE,0x00E4E2EA,0x00D9D7E1,0x00D7D5E2,0x00DAD9E8,0x00D8D5E6,0x00D6D8E5,0x00D5DCE7,0x00D4DBEB,0x00D2DAEC,0x00D4DEF2,0x00D6E1F3,0x00D5E0F3,0x00D2DCF1,0x00CFD8ED,0x00D1D9ED,0x00CCD4E7,0x00CAD3E7,0x00C6D3E8,0x00C6D4E6,0x00B6C3D2,0x009EAABB,0x00838F9D,0x009298A2,0x009097A1,0x007E8A97 +dd 0x005D6868,0x00606B69,0x00737779,0x00899AA4,0x008B98A8,0x009BA3BA,0x00A8AFC9,0x00ACB7CE,0x00B3BCD2,0x00B5BED2,0x00B5C0D4,0x00B2C2D6,0x00B5C4D7,0x00BBC9DA,0x00B7C4D5,0x00B3C1D1,0x00AFBDCB,0x00ADBAC8,0x00B2BBCD,0x00BCC0D5,0x00B8BCD0,0x00B1B6C9,0x00B0B2C5,0x00B2B1C5,0x00AFADC1,0x00A1A0B2,0x0086878F,0x00ADAEBC,0x00B7B9CA,0x00B4B7C7,0x00A9AABC,0x009091A3,0x00B0B1C3,0x00AFB1C3,0x00B1B3C5,0x00B4B4C6,0x00B3B4C4,0x00A8A7B4,0x00B4B2BE,0x00B9B6C2,0x00B9B7C4,0x00B1B4C4,0x00ACAFBE,0x00AEB0BF,0x00AEB2BF,0x00A8AEBA,0x00A5AAB6,0x00A1A6B1,0x00A2A6B7,0x00A2A5B9,0x009EA0B5,0x009798AD,0x00979AAD,0x009A9DB0,0x00999CAF,0x009C9FB2,0x0099A1B8,0x008893A9,0x006E7987,0x00919EA9,0x008796A0,0x007C8084,0x008B9194,0x007E8D98 +dd 0x0058696B,0x007C8E90,0x00757D84,0x008393A1,0x008A99A5,0x004D5862,0x003C444C,0x00494F57,0x004A5057,0x0051575C,0x00585D63,0x005A5D64,0x00595B60,0x005B5C60,0x00585B5D,0x00525558,0x0055585A,0x00565859,0x00555658,0x005B5C60,0x005C5D5F,0x00555656,0x004F4B50,0x004D484F,0x004E484D,0x00464143,0x00535154,0x00AFAEBE,0x00B5B7C9,0x00B1B8C3,0x00ABACBE,0x009091A3,0x00B0B1C3,0x00AFB0C2,0x00B2B2C4,0x00B3B4C7,0x00B8B9CA,0x00595862,0x0047464C,0x00515057,0x004F4E53,0x004E4B4A,0x004E4B4A,0x004D4B4A,0x004D4B49,0x004A4847,0x00474443,0x00484443,0x00484545,0x00464545,0x00474445,0x00454243,0x00454444,0x00464646,0x00444445,0x00434343,0x00413F43,0x0035363C,0x003B454C,0x0096A7AE,0x008796A0,0x00878C91,0x00868C90,0x007C8A96 +dd 0x00506067,0x0083959C,0x00839099,0x008195A2,0x008FA0A9,0x00313C3F,0x00030807,0x000F1111,0x00111314,0x00121415,0x00141415,0x00161617,0x00151618,0x00151719,0x00131516,0x00101311,0x00101312,0x000D1211,0x000D1010,0x00121313,0x00121415,0x000F1213,0x000F100D,0x000F100B,0x000E100C,0x000A0C08,0x00292829,0x00B1B0BF,0x00B3B6C9,0x00B5BBC6,0x00B1B2C4,0x008E8FA1,0x00B4B5C7,0x00B1B2C4,0x00B2B3C5,0x00B3B4C6,0x00B8B9CB,0x00393A3F,0x00090B0B,0x00111415,0x000E1010,0x00111010,0x0011100F,0x00100E0E,0x00101211,0x000C1210,0x000A110E,0x000A100D,0x00090E0B,0x000B100C,0x000A0D0B,0x000A0D0C,0x000B0D0C,0x000C0C0C,0x000A0A0A,0x00060706,0x00060302,0x00000000,0x001B2322,0x0097A5B1,0x008390A0,0x00909297,0x008A8B8F,0x0075818D +dd 0x004E555B,0x00848E98,0x00808E99,0x007E8E98,0x00839098,0x00374247,0x0025292E,0x00292C31,0x00282D32,0x00272B31,0x0022282D,0x0021282D,0x001E262D,0x001B232A,0x00222A2F,0x00272F31,0x002B3437,0x002E393C,0x0030383D,0x0032393F,0x00363D44,0x003D454D,0x00434951,0x00434850,0x00414650,0x003D414C,0x00474A50,0x00898D97,0x00999FA9,0x00969DA8,0x00888D9E,0x007F8494,0x00A6ACBC,0x00A5A9BA,0x00A9A9BB,0x00A8A9BC,0x00AFAFC2,0x005C606B,0x003E454D,0x00474E57,0x004B525C,0x004B525A,0x00474F57,0x00474F57,0x00454D55,0x0049515B,0x004C545F,0x004A505B,0x00434C56,0x00435058,0x00414E56,0x00435058,0x0045535B,0x0044515A,0x00495660,0x004C5B65,0x00536070,0x00576470,0x00607179,0x0094A3B7,0x00818991,0x00898F95,0x007D8490,0x00757887 +dd 0x00565E64,0x00838E97,0x00798791,0x006B6C72,0x0074777E,0x00767E89,0x00838F9C,0x008C969D,0x00889298,0x008E999E,0x00939EA5,0x0099A2AC,0x008E969E,0x00929EA7,0x009AA9B2,0x009FACB6,0x00A3AFBB,0x00A5B1BE,0x00A8B3C1,0x00AAB3C1,0x00AAB4C2,0x00ADB6C6,0x00B4BBCC,0x00B8BECF,0x00B8BED0,0x00B6BCCD,0x00B4BBC6,0x00A4ABB5,0x00A9AFBA,0x00ADB3C0,0x00A6ACBD,0x008A90A0,0x00ACB2C2,0x00ACB0C1,0x00AFAFC1,0x00ACADBF,0x00A8A8BB,0x00B7BBCE,0x00BBC0D3,0x00BABED1,0x00BDC2D5,0x00BFC4D9,0x00C0C5DB,0x00BDC2D8,0x00B7BCD2,0x00B6BAD1,0x00B9BED5,0x00BABED5,0x00B4BBCE,0x00B2BECC,0x009EAAB9,0x00ABB7C6,0x00B5C0CF,0x00B4BFCC,0x00B6C0CD,0x00B3BCC8,0x00AEB9CF,0x00AAB6C6,0x00AAB0B6,0x009E9BA6,0x00767672,0x008C979D,0x008996A8,0x007C7F92 +dd 0x00565D63,0x007A858E,0x00788791,0x006A727B,0x006C747C,0x00696F76,0x005D6164,0x005E5E5B,0x006F7171,0x00747C7E,0x00747C85,0x0070727E,0x00807E82,0x00909AA0,0x009DADBA,0x00A2AEBC,0x00A1ADBB,0x00A2AEBD,0x00A6B0BF,0x00A6AFBF,0x00A9B2C1,0x00AAB3C2,0x00ADB4C3,0x00AFB5C5,0x00AFB5C5,0x00AFB5C5,0x00AFB4C5,0x00AFB4C6,0x00AFB5C7,0x00B2B8C9,0x00ACB2C2,0x008C93A2,0x00AAB1C1,0x00AEB2C3,0x00B0B0C2,0x00ACAEBF,0x00A7A9B8,0x00ABB1C0,0x00AEB3C3,0x00ABB0C0,0x00ABB0C0,0x00B0B5C8,0x00B1B6CA,0x00B1B6CA,0x00B1B6CA,0x00ADB3C4,0x00AAB2C2,0x00ACB4C4,0x00AEB4C5,0x00A9AABA,0x008C898E,0x00898A87,0x00828382,0x007D7B7C,0x006F7175,0x00787D82,0x007D868C,0x00737C7F,0x00717478,0x0067656B,0x006C7378,0x00949EA6,0x00838D9B,0x00798293 +dd 0x004D5459,0x00707B84,0x008795A0,0x008C9FAF,0x0097A9B7,0x009EACB5,0x00838D94,0x00888994,0x00ACB1C2,0x00A6AFC4,0x009FACC1,0x008E9BA4,0x00818185,0x00888992,0x00A0A9B8,0x00A3B0BD,0x00A4B0BE,0x00A4B0BE,0x00A4AFBE,0x00A9B1C1,0x00AAB3C3,0x00ABB4C4,0x00ACB2C3,0x00AEB4C5,0x00AEB4C6,0x00ADB3C5,0x00AEB4C6,0x00ADB2C3,0x00ADB3C4,0x00AEB4C4,0x00ABB1C1,0x009197A7,0x00AEB5C5,0x00ACAFC2,0x00ABAABD,0x00A5A7B5,0x0081848D,0x00A4A8B8,0x00B1B7CC,0x00AEB3C7,0x00B3B8CC,0x00B2B7CB,0x00B0B5C9,0x00B0B4C9,0x00AFB5C8,0x00ABB4C3,0x00ADB6C5,0x00ACB5C3,0x00AAB4C6,0x00ABB1C5,0x007D7678,0x00474139,0x007A7975,0x009DA0A3,0x008E959B,0x009BA7B0,0x0089989F,0x009DADB4,0x009EAEBC,0x009EB0C4,0x009FB1C1,0x0083929E,0x00818793,0x0082818C +dd 0x004E555B,0x005F6A72,0x006C7A85,0x006B7882,0x00656C74,0x00696D72,0x00797A7E,0x008E959E,0x009099A4,0x0088939E,0x0099A7B4,0x00A1ADB5,0x008E9399,0x00888B94,0x00A3ABB7,0x00A0ADBB,0x00A2AEBC,0x00A2AEBC,0x00A4ADBF,0x00A7AFC2,0x00A9B1C4,0x00A9B1C4,0x00ACB2C5,0x00ADB2C6,0x00ADB2C6,0x00ADB2C6,0x00AEB4C4,0x00ACB2C2,0x00ADB3C3,0x00AEB4C4,0x00A8AEBE,0x009096A6,0x00AEB3C3,0x00AAB1C2,0x00A3ACBC,0x009899A9,0x00908B98,0x00A9AABC,0x00B1B7CD,0x00ACB1C5,0x00B1B6CA,0x00B0B5C9,0x00AFB4C8,0x00ADB2C7,0x00AEB3C7,0x00ABB3C3,0x00A2AAB9,0x00A9B1C0,0x00A7B3C4,0x00A4B4C4,0x00767273,0x005E4E4A,0x009A9393,0x00AFB6BB,0x00A7B0B6,0x009BA6AF,0x00959C9F,0x008B8D91,0x008E939E,0x00919AA8,0x008795A3,0x0085929D,0x00767E86,0x007F8189 +dd 0x005C6669,0x00707E85,0x00697B84,0x006C7E83,0x0069797D,0x00707C82,0x00727B83,0x007E888F,0x007E8991,0x0079848C,0x00949EA6,0x0089949C,0x0085919A,0x00929FA8,0x009EAAB5,0x009FABB9,0x009FACB9,0x00A0ACBA,0x00A3ADBD,0x00A6ADC1,0x00A8B0C3,0x00A9B1C4,0x00ACB2C5,0x00AEB2C6,0x00ADB2C6,0x00ADB2C6,0x00AEB4C5,0x00ACB3C3,0x00ADB4C4,0x00AEB5C5,0x00A7AEBD,0x008D94A2,0x00ABB1BF,0x00A8B1C0,0x00A3ABBA,0x008B8A94,0x00A39AA5,0x00ABA3B2,0x00B0AEBF,0x00AAADBF,0x00A9B1C4,0x00ACB2C5,0x00ADB3C4,0x00ADB2C4,0x00ACB1C3,0x00A9B4C4,0x00A3AFC0,0x00A5B1C1,0x00A4B1C2,0x00A9B4C6,0x0082828E,0x0062585C,0x00746C6E,0x00737778,0x00787C7E,0x00737779,0x0070757B,0x006B737C,0x00727B83,0x00747E86,0x0078838B,0x00758088,0x00808B94,0x0079868F +dd 0x00626C74,0x008E9CA8,0x008C9EAD,0x0085A0AE,0x0088A5B2,0x008EA3B4,0x008FA1B4,0x0090A1AE,0x0091A2AE,0x0093A4B1,0x0091A3B0,0x0095A6B4,0x0095A7B6,0x0091A3B2,0x0096A5B4,0x009AA6B5,0x009BA7B6,0x0099A7B5,0x009CA7B9,0x00A0A8BD,0x00A4ADC2,0x00A4AEC2,0x00A6ADC2,0x00A7ABC3,0x00A9AFC5,0x00A9AFC5,0x00A9AFC2,0x00A7ACBF,0x00A3A8BB,0x00A4AABC,0x00A8ADBD,0x00858A9A,0x00A1A7B7,0x00A7A9BD,0x00A6A3B2,0x006A6868,0x00BEB5BD,0x00756966,0x00665F56,0x009FA0A5,0x00AEB4C8,0x00A5B0C1,0x00A5B2BF,0x00A4B2BF,0x00A4B0BE,0x00A7B1C3,0x00A6AFC3,0x00A3ACC0,0x00A3ACBF,0x00A2B2C1,0x00A1AEBB,0x009CA6B1,0x009AA4B0,0x0098A5B4,0x0098A5B5,0x009DA9B9,0x009DACBA,0x009DAEB9,0x009DADB8,0x009FAFBA,0x009CACB8,0x009BACB6,0x0098AAB5,0x007E909D +dd 0x006A7380,0x008A95A4,0x008C98A6,0x0092A1AE,0x0098A5B4,0x00A1A9B8,0x00A5ABB7,0x00A4B1BB,0x00A7B5C2,0x00A8B5C0,0x00A9B5C0,0x00AAB5C3,0x00B0BBCA,0x00B4BECC,0x00B3BCCA,0x00B4BDC9,0x00B3BCC9,0x00B9C0CB,0x00B6BDCA,0x00B6BDCE,0x00BAC1D1,0x00BEC4D3,0x00C1C4D4,0x00C0C2D2,0x00C5C7D8,0x00C2C4D3,0x00C2C3D1,0x00BEC0CE,0x0090919E,0x008F8F9D,0x00BAB9CB,0x008A8A9D,0x00B1B0C2,0x00AFAEC0,0x00A4A2B1,0x00848284,0x00C6BEC5,0x008F888A,0x008C8C87,0x00A5A4A9,0x00ABA9B6,0x00BBBDCC,0x00BBBDCD,0x00B8BAC8,0x00B7BAC6,0x00B6B8C7,0x00B2B5C5,0x00ACAEBE,0x00AFB1BF,0x00AFB3BF,0x00A9AFBC,0x00A2A7B4,0x009EA5B0,0x00999DA9,0x00969AA7,0x009295A2,0x009397A1,0x008C919A,0x00848791,0x00797C86,0x006C727A,0x006C747C,0x006E7780,0x00707984 +dd 0x00646A75,0x00585E68,0x005A6069,0x00616770,0x00686E77,0x00676D76,0x00676D75,0x00686F79,0x006F7680,0x006C727B,0x006D727B,0x006D7279,0x0071777E,0x006F757B,0x0075797F,0x00727581,0x00737782,0x006D6F79,0x00696B72,0x006D7177,0x00797C82,0x007B7C82,0x0076767B,0x00767579,0x007E7E83,0x007F7E83,0x007F7C86,0x007D7B84,0x006E6C74,0x00737078,0x0078767C,0x006C6A6F,0x008A888B,0x00928E96,0x00888390,0x00918C90,0x00C6BDC3,0x00958E9B,0x00898693,0x00837E87,0x0079747C,0x00807A80,0x00888186,0x008B8488,0x00898487,0x0086848D,0x00868590,0x0083818C,0x00878490,0x00898996,0x00848692,0x00848691,0x0080828D,0x0080818D,0x00858692,0x00848692,0x007F818D,0x00797A87,0x006E707C,0x006E6F7B,0x006A6F7B,0x00747A85,0x00757B85,0x00717882 diff --git a/programs/free3d04/trunk/wall5.inc b/programs/free3d04/trunk/wall5.inc new file mode 100644 index 0000000000..3eb8fb5027 --- /dev/null +++ b/programs/free3d04/trunk/wall5.inc @@ -0,0 +1,64 @@ +dd 0x003F4C56,0x003C4A55,0x00414452,0x00444453,0x00464655,0x00474757,0x00515261,0x00525364,0x00404052,0x0039384A,0x00413F52,0x00565568,0x005A5769,0x00574F5E,0x00615869,0x00686171,0x00615A69,0x0061586B,0x006B6273,0x00756E7F,0x00736C7D,0x00615A6B,0x00645D6F,0x00645A6D,0x00615267,0x006D5E72,0x00716277,0x0078687D,0x007C6C7E,0x00776674,0x00776673,0x00786977,0x007C6C79,0x007D6E7C,0x00716172,0x00726274,0x007C6B7E,0x0079687A,0x0078687A,0x00786B79,0x007C6D79,0x007E6B7A,0x007A687C,0x006C6377,0x00726D7E,0x007F6E82,0x00846D82,0x007F697E,0x007F7183,0x00756B7A,0x00847384,0x00837183,0x00826F82,0x007F6E80,0x00837283,0x00786877,0x0071626F,0x00786B78,0x007C6D79,0x00796B77,0x00685B63,0x006D6269,0x006F6B75,0x00696C7A +dd 0x003E4A55,0x003B4953,0x00424252,0x004F4A5B,0x00535061,0x00555162,0x005A5666,0x005C586B,0x00565267,0x00504C61,0x00575368,0x00615D72,0x00605C71,0x00615668,0x00665B6E,0x006E6477,0x00685D6F,0x00615669,0x005B5062,0x005A4F61,0x006B6072,0x006E6375,0x006D6274,0x00675D6F,0x00625A6C,0x00716879,0x006E6678,0x006B6173,0x006E6374,0x00796975,0x0073636F,0x007A6B77,0x007A6B77,0x00776773,0x00716173,0x00746378,0x00806F84,0x007C6B7F,0x007D6C82,0x00786C79,0x00786B74,0x00826C7D,0x00826F85,0x00807F95,0x00888FA1,0x00878093,0x00806980,0x007F627C,0x00756278,0x00716779,0x007C6D82,0x007C697E,0x007A697E,0x00756479,0x007E6D82,0x00806F7E,0x00776672,0x007D6D79,0x0084747F,0x0084747F,0x00786778,0x00746378,0x006D6072,0x006C6477 +dd 0x003C4753,0x00394450,0x00414251,0x004A4957,0x004B4958,0x00504D5D,0x00555262,0x00555163,0x00535063,0x00524F63,0x005C586D,0x00666277,0x00686277,0x00675D6F,0x00635A6C,0x00696072,0x006F6678,0x00665C6E,0x00574D60,0x005B5163,0x006F6678,0x0073697C,0x0072687A,0x0073697C,0x006B6072,0x0073697C,0x00746B7D,0x006D6475,0x006E6374,0x007A6C78,0x0072636E,0x007C6C78,0x006E5E6B,0x005B4B57,0x00635266,0x00756479,0x007A697E,0x00756479,0x007D6C80,0x007A717D,0x007A6D78,0x00856E80,0x00847187,0x009493A9,0x0099A9B7,0x00858F9A,0x00736779,0x008D6D88,0x0091728B,0x00826982,0x00746278,0x00756478,0x00756479,0x00716074,0x00736277,0x007F6F7D,0x007A6B77,0x007F6F7C,0x00857580,0x0080717C,0x00736274,0x00736177,0x006C5E72,0x00686273 +dd 0x00464C5D,0x003F4455,0x00404453,0x00424753,0x00444955,0x004A4F5C,0x004C505E,0x00575564,0x005C5366,0x00585062,0x005B5164,0x00685E72,0x006B6274,0x00635A6C,0x00564B5D,0x00574D60,0x006B6173,0x00696072,0x00696072,0x00645B6D,0x005E5567,0x00645B6D,0x00675D6F,0x0075697A,0x006F626F,0x00716372,0x00786B79,0x00736473,0x00746474,0x007A6977,0x007D6D78,0x007D6D78,0x006C5C67,0x0061515D,0x0067566B,0x0079687E,0x00806F84,0x007C6B7F,0x00746378,0x00746878,0x007A6B7A,0x008E7288,0x008E738A,0x00988AA0,0x00969AAA,0x00808793,0x006F6779,0x008D758D,0x00987791,0x008F728D,0x0084788B,0x00807385,0x0078687D,0x00746177,0x00735D73,0x007C697C,0x007F6F80,0x007F6F80,0x007F6E7F,0x00786778,0x00695667,0x006D5868,0x006E5E71,0x00696072 +dd 0x003F4255,0x00363A4C,0x003F4252,0x00424755,0x00454A57,0x00474D5B,0x004A505D,0x00605D6D,0x006B6072,0x00625769,0x00615668,0x00645A6D,0x00645B6D,0x00605668,0x00584F61,0x00534A5C,0x00635A6C,0x006E6477,0x00786E80,0x00786E80,0x006D6375,0x00675E6F,0x005A5062,0x00645867,0x00645561,0x00685864,0x00786874,0x00796874,0x00796874,0x0073636F,0x00796975,0x00756672,0x00776773,0x007E6E7A,0x0079687C,0x007D6C80,0x00806F84,0x007E6D82,0x00726177,0x006F6277,0x007F6C83,0x0093718B,0x00906E88,0x008E788E,0x0085798B,0x007A6E80,0x00716277,0x00806F84,0x008A788E,0x007E6D82,0x007A7384,0x007D7484,0x0079697E,0x007C677D,0x007C6279,0x00756278,0x0077667C,0x0079687E,0x00746278,0x00726175,0x006F5A69,0x00735B67,0x00736071,0x00726277 +dd 0x003B3F51,0x00333647,0x003C404F,0x00404552,0x00464B58,0x00424755,0x00464B58,0x00575564,0x00675B6E,0x00625669,0x00625669,0x00675B6E,0x0063586C,0x00575061,0x00635C6E,0x005E5768,0x00676071,0x0071697A,0x007A7183,0x0094899B,0x007F7788,0x00675E6F,0x005C5366,0x00635A68,0x00645861,0x006B5D68,0x00756773,0x00756671,0x00746671,0x007A6B77,0x007F6F7C,0x00776873,0x00796B75,0x00786774,0x00746377,0x0077667A,0x0079687D,0x00837285,0x00827287,0x00776B7E,0x007D6B7F,0x0084627C,0x0083627A,0x007D687D,0x0078667A,0x00796177,0x006C566B,0x006C5D71,0x00736C7C,0x00524F5C,0x00474152,0x00635A6C,0x00726275,0x00786379,0x007F667D,0x00756177,0x00635066,0x0069576C,0x006D5B6F,0x00726175,0x00786372,0x007A636F,0x00746172,0x006D5D71 +dd 0x003E4153,0x00353A4B,0x003F4251,0x00404452,0x00424755,0x00353A47,0x003F4552,0x00575766,0x00645C6E,0x00615769,0x005C5264,0x0062586B,0x005B5264,0x00464453,0x005E5C6C,0x005E5C6C,0x00615E6E,0x006E6B7A,0x00796B7E,0x008D778D,0x0079677D,0x00605568,0x005A5263,0x0053505C,0x0045454A,0x005D5A60,0x00716871,0x0071646E,0x006F606B,0x00786671,0x007A6773,0x00796773,0x007A6873,0x0077646F,0x0071626E,0x006E616D,0x00695C69,0x00756875,0x007F727F,0x007C6E7A,0x006B5A67,0x005C4655,0x00664F5E,0x006F5E6C,0x0072616E,0x0073616E,0x00685764,0x00635561,0x006C606B,0x00635663,0x00625063,0x00736075,0x00745E74,0x00776177,0x007A6179,0x00746175,0x005D4B5E,0x0058465B,0x0068556B,0x006F5C72,0x00685A68,0x006D616B,0x00736773,0x006E6371 +dd 0x003E4255,0x00363B4C,0x003A3E4C,0x003C404F,0x00474B58,0x00454956,0x00494C5A,0x00515663,0x00505362,0x004B4D5C,0x00555764,0x00525362,0x00525362,0x00565563,0x005E5B6B,0x00575563,0x00555362,0x006C6877,0x00756378,0x007F637C,0x00796279,0x00635568,0x00665B6D,0x006C6775,0x00585864,0x00635D6B,0x007C6E7F,0x00826D80,0x007F687C,0x00786072,0x00755D6F,0x007E6679,0x00846D7F,0x007C6477,0x006F5B6C,0x00786373,0x00756172,0x00786474,0x007D697A,0x007A6B79,0x00615563,0x00514553,0x00665A69,0x00726775,0x007D6E7F,0x008B798B,0x007D6C7D,0x00715E71,0x00796779,0x007F697F,0x00826880,0x008A7189,0x00836980,0x0080687F,0x007E647C,0x0077687C,0x006B6172,0x005B5263,0x00696071,0x006B6172,0x00635A67,0x00685E68,0x006E676F,0x006D646D +dd 0x003E4C5E,0x003C4C5E,0x00425162,0x0050606F,0x005C6C7C,0x00516171,0x005B6B7C,0x00697785,0x00404D5A,0x003B4756,0x007D8998,0x00647185,0x00566177,0x00687183,0x006E7284,0x006F7385,0x006F7384,0x007D8090,0x0079798B,0x00838394,0x008D909E,0x007F8794,0x008993A0,0x008F9EAB,0x0099AAB6,0x008D99AA,0x008990A2,0x00908FA5,0x008F8BA2,0x009394A7,0x00AFADBE,0x009394A9,0x008D8FA2,0x00888A9E,0x0088859A,0x009C96AB,0x008E889C,0x008B879B,0x009C98AC,0x009A95AB,0x0089879B,0x007E7C91,0x0087849A,0x00878499,0x008E8BA1,0x009C9BB1,0x008E8EA4,0x009899AD,0x00BBBDCE,0x00B8BACC,0x009895A7,0x009996A9,0x009998A9,0x00888799,0x0078778A,0x00747588,0x007F8293,0x008B8D9E,0x009495A6,0x00898A9B,0x00827F8E,0x0075717D,0x0075717E,0x007C7582 +dd 0x003A5264,0x00455D6E,0x0050687A,0x00556D7F,0x0060778A,0x00576F82,0x0060788A,0x00697E8E,0x0050616C,0x00526273,0x007E8EA4,0x007E8EAA,0x008796B5,0x008596AC,0x008795A9,0x008A9AAF,0x008090A5,0x008290A5,0x008595AA,0x009BACBE,0x009FB0BE,0x009AABBB,0x0099A9BB,0x008E9FB3,0x00A0B1C7,0x008EA0BA,0x008A9BB5,0x00A7B6CF,0x009AA7C0,0x0094A0B5,0x00B8C1D1,0x00A1ACC0,0x00A4B0C3,0x00A2AFC3,0x00A1ABC2,0x00A1ACC1,0x0096A1B6,0x009AA5BA,0x00ABB5C7,0x00A1A9BD,0x00989CB3,0x00969BB3,0x00A5ABC0,0x00A7ADC1,0x009199AF,0x00919BB2,0x008B96AD,0x00959EB3,0x00BBC4D4,0x00BCC4D5,0x00ACB1C7,0x00B8BCD2,0x00A2A7C0,0x008488A1,0x00757993,0x00848BA1,0x009099AF,0x00A6AFC4,0x00B7BED3,0x00A4ADC2,0x00939AB1,0x00919AAF,0x009BA4BA,0x00A4ACC1 +dd 0x00455C6E,0x00465D6F,0x00536B7E,0x004C6377,0x005D7488,0x00728A9C,0x00687F91,0x00677A8A,0x006F7F8B,0x00667788,0x00617187,0x008896B3,0x00B0BEDD,0x0094A2BB,0x007E8EA1,0x008898AB,0x007E8EA4,0x0075859B,0x007A8A9F,0x009EACBC,0x008D9BAB,0x00728295,0x00728296,0x007D8DA4,0x008998B2,0x007E8DAA,0x007887A5,0x009FADC7,0x00B2C1D5,0x00A2ACC2,0x009AA2B7,0x0099A2B8,0x0098A1B7,0x009AA2B8,0x00A9B0C6,0x008E96AF,0x00959FB6,0x009FA7BE,0x00969FB3,0x00949CB1,0x00A9B0C4,0x00959CB3,0x008993A7,0x00A2ABBB,0x00A0A9BB,0x008E96AC,0x0096A0B6,0x00B0B8CC,0x00B8C1D3,0x00A7AFC3,0x00C8CCDF,0x00C9CBDF,0x009599B0,0x008D8FA7,0x008487A0,0x009399B0,0x00A6B0C3,0x00ADB6C9,0x0098A0B5,0x008D95AC,0x008089A0,0x007A849A,0x007C849C,0x007E889F +dd 0x0041576F,0x004C637C,0x00798FA9,0x00687F99,0x00627891,0x00667C95,0x005A6F89,0x0071859F,0x007A8FA6,0x006D839A,0x007387A0,0x008094AF,0x00A6B8D4,0x0094A4BD,0x007E8DA4,0x008896AD,0x007E8BA4,0x007F8EA6,0x007989A0,0x008390A6,0x008795AB,0x008D9BB2,0x008F9FB5,0x007E8DA6,0x008896B1,0x008F9EB8,0x008898B2,0x00A0B0C7,0x00D7E5F1,0x00C6CEE3,0x009FA7BD,0x00969FB5,0x00959EB3,0x008890A7,0x00969EB3,0x009FA6BC,0x00A6ADC6,0x00A7B0C7,0x00959CB3,0x0099A1B7,0x00A1A9C0,0x009098B0,0x00ADB5C7,0x00E4EBF4,0x00DDE3F0,0x009EA5BA,0x009AA1B7,0x00B3BBCF,0x00C6CDDF,0x00A1A9BD,0x00AAADC0,0x00969AB0,0x009EA4BA,0x00BCC1D4,0x00A4A9BE,0x008A91A9,0x009BA4B7,0x00A4ACBE,0x008B94AB,0x00919AB1,0x00939BB2,0x008A93AA,0x007D859E,0x007A839A +dd 0x003B516C,0x00445A74,0x005D738E,0x00516782,0x00627893,0x006D839E,0x005C728E,0x00687E99,0x006B809C,0x00758BA6,0x00A1B7D3,0x00758BA6,0x00738AA4,0x007F8FAB,0x008996B2,0x008996B1,0x00828FAB,0x008290AD,0x007988A4,0x00909FB6,0x009FADC4,0x0095A5C0,0x0098A7C2,0x008291AC,0x009EACC6,0x00B7C6DF,0x00ABBAD4,0x008F9EB8,0x00A2B1C9,0x009CA6BE,0x00969FB5,0x00B6BED2,0x00B2BBCF,0x008A93A9,0x009EA5B8,0x00C3C8D5,0x009CA4B8,0x008D95AD,0x008B93AA,0x009396AF,0x008B8FA7,0x00878AA2,0x009395AD,0x00C9CCDE,0x00C6C9DD,0x009A9CB3,0x009B9EB3,0x008F91AB,0x00A2A5BC,0x009A9EB3,0x00A1A9BA,0x009099AF,0x0098A0B7,0x00949BB1,0x00AAB1C3,0x00A4ACC0,0x009BA4B7,0x009AA1B3,0x008991A9,0x00878FA7,0x00838BA2,0x009AA2B8,0x00ACB5CC,0x00939BB2 +dd 0x003F5673,0x00627C99,0x00667D99,0x00536883,0x004F647F,0x00647A95,0x006E859F,0x00849AB1,0x007E94AC,0x007188A1,0x009AB0CB,0x00778DA7,0x006B809B,0x007789A5,0x008B9BB6,0x007A8AA5,0x007887A2,0x008290AB,0x008594AD,0x00909FB6,0x008E9CB7,0x008898B3,0x008F9FBB,0x00B1C0D9,0x00D5E4F9,0x00CFDDF5,0x00ACBBD4,0x0099A7C0,0x00909EB7,0x008D98B0,0x00949EB3,0x00ADB7CC,0x00959FB5,0x009099B0,0x0096A0B6,0x00A6AFC1,0x008A93AA,0x008D96AC,0x00A2ABC0,0x008D91AB,0x00888AA4,0x008B8EA7,0x007C7F99,0x00999BB2,0x009FA1B8,0x00A9AABE,0x00A0A2B7,0x008789A1,0x00B7BACC,0x00A9ACC2,0x00828AA0,0x009BA4BA,0x00B6BED3,0x00939AB0,0x009FA6BA,0x009BA4BA,0x009AA4BA,0x00B6BECF,0x00A2ABC0,0x009FA6BC,0x00B6BDCF,0x00ADB6C9,0x00ADB6CD,0x009AA4BA +dd 0x00395373,0x005A7898,0x00667F9B,0x007489A4,0x00738AA4,0x008DA2BC,0x0090A7C1,0x00748DA4,0x00728DA0,0x006E859A,0x006F849A,0x006E7E96,0x0074809A,0x007E8DA6,0x008093AA,0x0064788F,0x0063778F,0x00778AA1,0x00A0B0C3,0x00919FB6,0x00808EA9,0x009AA7C1,0x008D9BB6,0x00ABB8D3,0x00B8C4DC,0x009CA7C1,0x00838EA7,0x00ABB6CB,0x00BDC9DE,0x00B0BCD4,0x0099A6BE,0x0096A4BC,0x00A4B0C3,0x00B8C3D5,0x0094A1B6,0x008996AB,0x008D99AD,0x00ACB7C8,0x00C3CDDC,0x00989CB3,0x009E9EB5,0x00999AB5,0x008B8DA9,0x009394AD,0x009696B0,0x00AAAABE,0x00ADADC0,0x009A99B2,0x00B5B5C9,0x00B0B3C8,0x008991A7,0x00919BB0,0x00A2ABC0,0x00949CB1,0x009099AD,0x0099A0BA,0x00A2ABC4,0x00A4ABC3,0x009199B1,0x00959CB5,0x00B6BBCF,0x00999FB5,0x00909AB2,0x0095A5BC +dd 0x003F5269,0x004F647D,0x00516780,0x00607590,0x00637994,0x006E849F,0x006E84A0,0x003E536B,0x002B404D,0x00364955,0x00313E4D,0x00454B5C,0x00555669,0x00494C61,0x00494D61,0x005C6275,0x00646C80,0x00697185,0x00858D9F,0x00777E90,0x00646C80,0x006F778A,0x0050586D,0x00555B71,0x00646779,0x00686B7C,0x005E6173,0x007C7F90,0x008B8E9E,0x00888595,0x00747282,0x00666374,0x007E7C89,0x009694A1,0x007F7D8F,0x00827F93,0x008D8A9C,0x009390A2,0x00898799,0x006E6C7E,0x00746F7E,0x00777382,0x00625E6D,0x00534F5D,0x005D586B,0x00777184,0x008D8798,0x008A8498,0x00847D91,0x008F899C,0x00878496,0x00797587,0x00837E90,0x00847F90,0x00807C8E,0x008A839A,0x007E778F,0x00797289,0x00898098,0x00837A91,0x009A90A5,0x008F839A,0x00847E95,0x00808399 +dd 0x00424F62,0x004D6275,0x00475E77,0x00647C96,0x006C829C,0x006E839C,0x00607490,0x002F425B,0x00222B38,0x00303841,0x0031333F,0x0045404C,0x005E5666,0x00524758,0x00504453,0x005B4F5E,0x005E5363,0x00665C6C,0x00675E6E,0x00565362,0x00464452,0x00535161,0x00444150,0x003B3846,0x00524B56,0x00645D67,0x004B444F,0x004B4450,0x00645C67,0x0087737F,0x007E6673,0x00624B57,0x00634D58,0x007F6874,0x00695161,0x006D5566,0x007E6777,0x00826B7C,0x00755E6E,0x00574652,0x003C2F38,0x003B2E36,0x003C2F38,0x00493A44,0x00453641,0x004C3E4A,0x006C5C69,0x007D6E7A,0x00776774,0x00826F7D,0x00786373,0x00695262,0x0077606F,0x006E5866,0x00634D5C,0x006E5669,0x0071586C,0x00796174,0x00836B7D,0x00785E73,0x007F6678,0x00806678,0x00796073,0x00715E72 +dd 0x004A5369,0x00445C6F,0x004F697F,0x008FA4C0,0x009BB1CC,0x008BA0B8,0x007187A1,0x004A5D77,0x00494C5D,0x004F4D5C,0x00494151,0x0056475A,0x00736377,0x006E606F,0x005D535D,0x00564C56,0x004D444D,0x005A505B,0x006B616D,0x006C6373,0x00564D5D,0x005E5666,0x005A5162,0x004D4455,0x00645763,0x0072626D,0x00584A53,0x0052444D,0x006C5D68,0x008B7887,0x00836D7E,0x00604A5A,0x00513B4C,0x00725C6D,0x00644F5D,0x00634F5C,0x00725D6B,0x0075616E,0x006E5764,0x005E4B5A,0x00534251,0x00564655,0x00574757,0x005E4C5D,0x005A4C56,0x005A4D52,0x0075646B,0x0089747C,0x00896F78,0x008D727D,0x00876F7E,0x00806777,0x007C6372,0x006C5361,0x005E4756,0x00664F5E,0x00796272,0x00806978,0x0078606E,0x00796272,0x007C6972,0x007D696E,0x007E606D,0x00775B6E +dd 0x00565D74,0x00556E80,0x00536F85,0x00778BA7,0x00849AB5,0x006D829E,0x00687F9A,0x005B6F89,0x00565B6C,0x00535261,0x004D4557,0x0055465B,0x006F5E74,0x00685A6B,0x0049404A,0x004D464F,0x00665D67,0x006C636D,0x00665D68,0x004B4052,0x0042384B,0x005D5264,0x006C6174,0x005E5366,0x00645663,0x00675764,0x00685866,0x006B5B67,0x0073626E,0x007C6775,0x00695362,0x00634D5C,0x00685261,0x00725C6B,0x00745E6D,0x00786371,0x00735D6C,0x00725C6B,0x006E5866,0x00574552,0x0050414D,0x005C4C5A,0x00675763,0x00645561,0x0064555D,0x006D5B60,0x00856E75,0x0093747E,0x009A7480,0x00987583,0x008E7887,0x007F6979,0x00745D6D,0x00735D6C,0x00685261,0x00715B69,0x0077616F,0x00685261,0x00695362,0x007A6473,0x00807178,0x007D6C6F,0x00836671,0x00785B6E +dd 0x003F4A60,0x00507182,0x00557189,0x00617491,0x00647E94,0x005C758A,0x0053667A,0x00566073,0x004A4958,0x00474152,0x00443A4C,0x004B3E52,0x0064566B,0x00514656,0x0039343B,0x00413A42,0x00685E67,0x006E626C,0x0060525D,0x00473F4C,0x00453F4D,0x005A5161,0x00625C69,0x00504756,0x0052444F,0x00574751,0x00665661,0x006F5E6B,0x005C4A57,0x00634F5C,0x00614B57,0x00755E6C,0x007C6672,0x007A6672,0x00846F7D,0x00856F7E,0x006E5767,0x00634C5B,0x00634C5B,0x00564250,0x00574653,0x00645260,0x00715E6B,0x00806D7A,0x00826C77,0x006E535D,0x0080626D,0x00946E7D,0x00966979,0x00886272,0x00776171,0x005D4957,0x00675160,0x00826C7C,0x00796372,0x007E6877,0x00745E6D,0x00675160,0x00725C6B,0x00786171,0x00796872,0x007D6B71,0x00806372,0x00715568 +dd 0x00404D61,0x00618595,0x005C7890,0x00637493,0x00557287,0x00527180,0x00394A58,0x00424453,0x004D4455,0x00564C5E,0x004A4052,0x0051475B,0x00605568,0x0046414F,0x003C3F46,0x0047454D,0x00534B56,0x0061525E,0x005C4C58,0x00454149,0x003B3A42,0x0045444C,0x00424149,0x003A3940,0x00423841,0x00554652,0x00746471,0x0082727E,0x0061515D,0x005B4750,0x00665057,0x007F696F,0x007A646B,0x00836D75,0x0089727F,0x0075606E,0x00604957,0x005B4552,0x0067505E,0x00775C6C,0x007C606F,0x006B4D5E,0x00604052,0x006F5162,0x0066505E,0x004C3B47,0x005E4A57,0x00876B7A,0x008A687A,0x007D5D6E,0x00725D6C,0x00614B5A,0x006B5563,0x00786271,0x00735D6C,0x007D6877,0x00745E6D,0x0077616F,0x00836C7A,0x0077616F,0x0074626D,0x007C6873,0x00806275,0x0072566D +dd 0x003C495E,0x00537385,0x00456178,0x005A6C89,0x00678298,0x00668393,0x00566675,0x004C4D5D,0x00534B5C,0x00584F61,0x0041364A,0x0051475A,0x005E5366,0x00514D5D,0x00465160,0x0062697A,0x005D5E71,0x006B677A,0x006D667A,0x005B5769,0x00585567,0x00646174,0x00626072,0x005C5A6C,0x005D5769,0x00666072,0x007F788D,0x007D7589,0x00665E71,0x005E5262,0x006F626E,0x00776975,0x00645864,0x006E606D,0x00736471,0x00665762,0x005D505A,0x006C5E68,0x007A6D78,0x007E6C79,0x007E6875,0x006C5663,0x0066505D,0x00685260,0x005B505B,0x00514D56,0x00554C55,0x00756772,0x00897382,0x00836C7A,0x007A6372,0x00745D6D,0x0075606E,0x006F5A68,0x006C5664,0x0074606D,0x00745E6D,0x00806B79,0x00786271,0x00695261,0x006C5B64,0x006B5863,0x007F6174,0x007E6179 +dd 0x003B475D,0x00576B80,0x00637C90,0x00627C8F,0x005D7588,0x006D8094,0x00808BA1,0x00646B80,0x004F4F5C,0x00494650,0x004D4653,0x005A4F5C,0x00665764,0x00756E7F,0x0074839A,0x00909FB8,0x0096A1BC,0x009EA6C2,0x008F98B1,0x0080859E,0x0082879C,0x009195AB,0x00969AB0,0x008D8FA7,0x00A2A4B7,0x00A0A2B7,0x009A9EB5,0x00989BB2,0x00ABADC0,0x00ACABBD,0x00A9A7B7,0x008F8FA1,0x008B8B9E,0x00848496,0x00787585,0x00918E9A,0x00908E9B,0x00908E9C,0x009390A1,0x008F8999,0x00A69EAA,0x00A79FAD,0x00AAA2AF,0x008E8796,0x007A7988,0x00808490,0x007E7F8A,0x0083808D,0x008D8795,0x008D8495,0x008B8094,0x0090879B,0x00988FA2,0x0090889C,0x00847C90,0x00837F91,0x00877F94,0x00887A8E,0x006D576B,0x006E5367,0x00726069,0x006B5A5E,0x007C606D,0x007D6174 +dd 0x00243146,0x0053667D,0x006E8599,0x005E7989,0x005A7182,0x006C7A8F,0x006F788F,0x005E677E,0x00454955,0x0033343A,0x005B575E,0x00665A64,0x00695A64,0x00746C7C,0x007885A1,0x008495B2,0x00909EBB,0x0093A1BE,0x008594B1,0x008A95AC,0x008A94AA,0x007D879E,0x00828BA2,0x00838DA4,0x0099A1B6,0x00919AAD,0x00828BA1,0x008B95AA,0x00AFB7C9,0x00A7B0C4,0x0098A0B3,0x00ADB5C4,0x00D2D9E4,0x00A7B0C3,0x008D91A6,0x009091A9,0x00888AA4,0x008B8EA7,0x009498B1,0x008E90AA,0x00B8BBD1,0x00DCDEF3,0x00DFE2F3,0x00AAADC4,0x009094AA,0x009396A7,0x009396A6,0x00A7ACBE,0x00B6BACB,0x00A5A9BA,0x009FA1BA,0x009A9CB6,0x009C9FB7,0x00A4A7C0,0x00989BB2,0x00969EB6,0x009C9FB8,0x0080798F,0x005E4B61,0x006F5369,0x006D5862,0x00736264,0x007D616C,0x006E5264 +dd 0x00344156,0x004A5C73,0x00586C83,0x00556C82,0x005D7589,0x00687D90,0x00616D83,0x00535B71,0x00404150,0x0024242D,0x00423F47,0x00554A56,0x005D4F5B,0x00696172,0x008894AF,0x00A7B7D1,0x0094A1BA,0x0072809B,0x006F7E9A,0x00A7B1C8,0x00B0B8CD,0x008890A6,0x00858EA4,0x007E879F,0x008089A0,0x009099AF,0x00959EB2,0x007F889F,0x008991A9,0x00919AB0,0x00878FA5,0x00B8C0D2,0x00D5DCE8,0x00ACB5C6,0x00BBBDCD,0x00A7A9C0,0x009496B1,0x009194AD,0x008E90AA,0x008387A0,0x00A4A7C0,0x00CDD1E6,0x00C8CCDE,0x009496AF,0x008D8FA5,0x00999BAC,0x009FA2B2,0x00A6AABC,0x009C9FB2,0x008F91A5,0x009FA1B8,0x009195AD,0x007F809B,0x009395AD,0x009195AB,0x00999EB7,0x00A6A9C2,0x00857E94,0x00625064,0x006D5367,0x006E5B64,0x0078666B,0x00795D69,0x00694D60 +dd 0x003F4B60,0x0055677D,0x005E6F89,0x007385A4,0x007E99B1,0x008DABBC,0x00879BAA,0x005B6171,0x00524C5D,0x00493F50,0x00423A4B,0x00413647,0x00423647,0x00625C6F,0x00A5B1C6,0x00CDDDEB,0x00A7B6C6,0x008A9AAD,0x007F90A4,0x00A0ABC0,0x009BA4B8,0x00798298,0x00A4ABBE,0x00B1BACC,0x00919AAF,0x007D859C,0x00838BA2,0x00828AA2,0x00AAB2C6,0x00C8D1E0,0x009EA6BC,0x00919AB0,0x00949CB0,0x008F98AD,0x009599AD,0x008B8DA6,0x009496B0,0x008E90AA,0x00797C96,0x007D7C94,0x008A889C,0x009B9AB0,0x009E9CB2,0x008D8AA0,0x00B1B1C7,0x00CECFE4,0x00D5D7EA,0x00C8CBDE,0x00A6A9C0,0x008E90A5,0x00999EB0,0x009196A9,0x00A4A7B8,0x00CED1DF,0x00A6A9BB,0x009696AF,0x00A4A1B7,0x008A8294,0x005D505E,0x0062505B,0x006F6069,0x00715E6B,0x00755868,0x00785B6C +dd 0x00303E51,0x00627389,0x00687993,0x008291B1,0x007E99B0,0x006D8E9E,0x008096A5,0x00606474,0x00514A5C,0x00574C5E,0x004F4557,0x00493F51,0x004B4052,0x006C6679,0x0096A2B6,0x009BABBD,0x008796AA,0x0095A5B8,0x008796AA,0x00747F95,0x008991A6,0x00949CB0,0x00ABB2C6,0x00AAB2C6,0x00939BB1,0x00828BA2,0x008B94AB,0x008990A7,0x00B5BCCF,0x00DEE6F6,0x00B2BBCF,0x008890A7,0x00858EA5,0x008B95AC,0x009499B0,0x009498B0,0x009598AF,0x009B9EB6,0x008F90AA,0x008E8DA2,0x008B879B,0x008F8BA0,0x009B98AC,0x008E8BA0,0x00B0B0C7,0x00C9CBE3,0x00BABBD2,0x00A6A9BD,0x00A0A2B7,0x009A9EB0,0x00999EAD,0x009396A9,0x00B5BAC9,0x00BDC1CF,0x009194A6,0x00ADACBC,0x00A09CAD,0x00786E80,0x005C4F5C,0x0066555E,0x0071616C,0x006E5B69,0x00775869,0x00775B6B +dd 0x00424F5D,0x00788B9C,0x006F8296,0x006C7D95,0x005C778A,0x004F6E7F,0x007F95A6,0x0063677C,0x004B4258,0x004F4457,0x00524A5C,0x00584F61,0x00564C5E,0x00787284,0x008A95AA,0x00828FA6,0x007C8AA0,0x0096A4BA,0x00909EB5,0x0077849A,0x009FACC2,0x00B1BED1,0x008491A6,0x008A96AB,0x00919EB1,0x008F9AB0,0x00A2ACBE,0x0096A1B5,0x009CA7BB,0x00A7B1C6,0x008790A7,0x008D95AA,0x008F96AD,0x008D94AC,0x00ADB1C8,0x00B7B8CF,0x009C9EB6,0x00A7A9C2,0x00B6B7CE,0x00B5B3C7,0x00C4C1D4,0x00B0ACC1,0x00ABA7BC,0x008A899E,0x008D8DA5,0x00999BB6,0x00969AB2,0x00A2A6BD,0x009B9FB7,0x00989BB1,0x00989BB0,0x008B8EA4,0x00888BA0,0x00898DA0,0x009598AB,0x00BCBECD,0x009C9BAD,0x00877F93,0x00645868,0x00625260,0x006E606B,0x0075626F,0x007D6071,0x00755768 +dd 0x00535E6C,0x005E7280,0x004D6172,0x004C5D71,0x00577180,0x00638393,0x00849AAC,0x005E627D,0x005A516B,0x005D5367,0x00564C5E,0x00584F61,0x0053495B,0x006B6477,0x0072788D,0x00687187,0x00697187,0x00858DA2,0x008991A7,0x00798399,0x0094A0B3,0x00A5B2C2,0x00808DA0,0x0098A2B5,0x009EA6BA,0x009399AD,0x008B91A5,0x00838A9F,0x006E748A,0x006E7289,0x0083859E,0x009194AA,0x007D7F96,0x007F829A,0x009493A7,0x009995A9,0x00918FA2,0x009995AA,0x009A98AB,0x009995AA,0x00BBB6C8,0x00A6A1B5,0x00ADAABD,0x00908DA0,0x008F8EA4,0x009C9FB6,0x008E8FA7,0x00999BB2,0x009C9EB6,0x00999BB3,0x009EA1BB,0x00A7AAC3,0x008D8FA7,0x0080849C,0x00969AB3,0x00A5AAC0,0x009A9EB5,0x009E9BAF,0x005E5769,0x004C4050,0x005D505C,0x006F5C69,0x00785B6C,0x006C4F61 +dd 0x004D5B67,0x00526675,0x00586E80,0x005A6C82,0x00556E7F,0x005B7889,0x006F8498,0x00525871,0x004F4760,0x00534A5C,0x004B4153,0x00584F60,0x005E5567,0x00625A6B,0x00504C5C,0x00403F4D,0x00444452,0x00525261,0x00585766,0x005D5768,0x005D5567,0x00635C6D,0x00635C6D,0x006E6778,0x00786D7F,0x007E7184,0x0077697D,0x006C5E72,0x004F4155,0x00453A4D,0x005C5264,0x005A5263,0x0051495B,0x00716B7D,0x00837988,0x00837583,0x007E717E,0x006E616E,0x00625562,0x00635764,0x00736673,0x00726472,0x00837584,0x00807380,0x007F7584,0x00847D8E,0x00625B6D,0x00675E71,0x00756D7F,0x006C687D,0x008E90AA,0x00C3C7DE,0x00ABADC3,0x00989BAF,0x00A1A5BC,0x009FA4BB,0x009699B1,0x0089859B,0x005B5266,0x00504453,0x005D515C,0x006B5763,0x00755869,0x006B4F60 +dd 0x00455567,0x006B8396,0x00839FB3,0x00677F9A,0x005B7289,0x0062788D,0x006B7A8E,0x004B5667,0x00414152,0x00494455,0x004B4657,0x005B5566,0x00524C5E,0x00524D5D,0x005B5262,0x00564D5D,0x004D4555,0x00524B5C,0x00585060,0x00665766,0x00614F5D,0x00574655,0x005A4956,0x00584756,0x005D4F5C,0x005D505C,0x00564A56,0x00524551,0x00534551,0x0060505D,0x00615160,0x00554552,0x005B4C5A,0x00746774,0x006B5A66,0x006E5A66,0x007D6975,0x00725D69,0x00685561,0x0061505C,0x00574753,0x006F5D69,0x0089727F,0x00896E7D,0x0078636F,0x006D5E6C,0x00584A56,0x005C4F5B,0x005C4C5A,0x004D4151,0x007E778A,0x009994A9,0x009B9AAD,0x00CBCDD9,0x009EA4B8,0x008590A9,0x00AAB0C6,0x009693A7,0x0063566B,0x00584658,0x00695563,0x006E5764,0x00715A68,0x00675562 +dd 0x00405163,0x00668093,0x00718FA4,0x004D6883,0x004F647F,0x005D6F87,0x0069778A,0x00535E6D,0x00505362,0x00514F5E,0x00454151,0x00454252,0x004B4958,0x00585566,0x005A5162,0x004C4255,0x004D4456,0x004D4256,0x00362D40,0x0039303C,0x00473F47,0x00524A52,0x00564C56,0x00554C55,0x005A515B,0x00514952,0x00473F49,0x00474049,0x00564D57,0x006E616C,0x0072616D,0x005D4D5A,0x0071616D,0x007F717D,0x0073606C,0x007C6672,0x00725B69,0x00574050,0x005B4553,0x0052414F,0x00463844,0x00554250,0x007E6373,0x00826073,0x00644B5A,0x004D3E4A,0x004B3C47,0x00554551,0x005E4F5B,0x0061525E,0x00897C8B,0x00908899,0x00ACAABA,0x00D4D7DF,0x0098A0B3,0x00AAB8C9,0x00DDE6EF,0x00A4A1B2,0x006D5E73,0x006F5A6D,0x00735B6B,0x006E5664,0x00675362,0x0060525D +dd 0x003E4D60,0x00496073,0x004C687E,0x004D6683,0x005C718D,0x0066788F,0x006C788B,0x004B5564,0x003B404F,0x00494756,0x00464555,0x00444252,0x00464656,0x00464555,0x0050495A,0x00564D5E,0x005B5263,0x004C4456,0x0030293B,0x002B2A34,0x003E3C45,0x005D5862,0x005A5660,0x004C4C55,0x00615C66,0x00605761,0x00524752,0x00504751,0x00605661,0x00746772,0x007A6977,0x00695866,0x0074636F,0x00776672,0x0073626E,0x00776371,0x006C5764,0x00584251,0x00685160,0x0062505C,0x004A3B47,0x00493844,0x00725867,0x0078586B,0x00674F5D,0x0062515D,0x005E4D5B,0x005A4955,0x00675663,0x006C5B68,0x00847787,0x009F99AA,0x00A7A7BB,0x009498AC,0x009095AF,0x009BA7BD,0x00C0C8D7,0x009391A5,0x00685B6F,0x006C5769,0x006B5363,0x00695161,0x006B5666,0x006C5C69 +dd 0x00465264,0x0045576C,0x004C637A,0x00728AA6,0x00879CB8,0x006C7E95,0x00576478,0x00343C4C,0x001F2835,0x00353A47,0x00404652,0x004A4D5C,0x00393E4A,0x002B303C,0x00414050,0x005D5A69,0x005B5767,0x00474453,0x00393546,0x00393947,0x004A4555,0x006E5B6F,0x00715E73,0x00443E4F,0x00494250,0x00685866,0x00665562,0x00635361,0x00746472,0x0074626F,0x006F5A68,0x00715B69,0x00715B6B,0x00685261,0x00564955,0x004C454F,0x0060525D,0x00614D5C,0x00695160,0x00695562,0x00574753,0x005A4A55,0x00584753,0x0062515D,0x006E5B68,0x006C5766,0x0075606E,0x00644F5D,0x00574150,0x006B5563,0x00958495,0x00A5A4B3,0x009EA6B7,0x009198AD,0x00A5A2BD,0x00969CB6,0x00989BB3,0x007D7A90,0x005D5667,0x005C4F5E,0x00635564,0x00685368,0x006F526B,0x0072556C +dd 0x00697788,0x0057687E,0x00465C74,0x00667E9A,0x00849AB6,0x00677990,0x004D5B6E,0x00293140,0x001C2230,0x002D313F,0x00363B47,0x004C515E,0x003B414D,0x002B303C,0x00414050,0x00514D5D,0x00504C5C,0x00514D5D,0x00494556,0x00424252,0x005A5163,0x00775E75,0x006F5A71,0x0040394B,0x003A3140,0x0061505D,0x005E4D5B,0x004D3C4A,0x00564652,0x00634F5C,0x0067505E,0x00725C69,0x00796372,0x00755E6D,0x00625661,0x004C464F,0x005A4D58,0x0063515E,0x006C5261,0x00745E6D,0x00675764,0x006C5C67,0x0062525E,0x00665763,0x00776372,0x00664F5E,0x006B5563,0x00604957,0x00553E4C,0x00664D5D,0x00938091,0x00A5A5B3,0x009FAABA,0x00BCC1D3,0x00A09CB7,0x00878BA7,0x009A9EB7,0x008E8DA1,0x00696374,0x00625767,0x00645869,0x006B576D,0x0072526D,0x0072526C +dd 0x004D5B6D,0x0044566C,0x00556B82,0x005D758E,0x006D849C,0x006F8398,0x00556779,0x003F4F5E,0x00414C5C,0x004C5361,0x00424756,0x00515764,0x004D5362,0x003A3F4D,0x004C495A,0x005B5567,0x00666172,0x006F6B7C,0x00686475,0x00636172,0x006D6678,0x0075687D,0x007C6E83,0x006C6678,0x00675E6E,0x007C6E7C,0x00776977,0x00675A67,0x00685B69,0x00716271,0x006C5B6B,0x006E5E6D,0x0072616F,0x00806F7E,0x00726873,0x005A555E,0x00625A64,0x006C616D,0x00645662,0x00625561,0x00665A63,0x00695B64,0x0072606B,0x0077616E,0x00685361,0x005B4755,0x00675562,0x005E4C58,0x00574551,0x005E4A57,0x00857587,0x00A7AABE,0x008794AD,0x00939AB5,0x008484A0,0x00A5ADC7,0x00C8CFE5,0x009E9CB1,0x006D6377,0x00695B6C,0x006E5C6D,0x00745E72,0x006D5268,0x00684F63 +dd 0x00354153,0x0047586E,0x006B7F95,0x00637C8E,0x006D8599,0x008298AA,0x00687F91,0x00647A8E,0x00627588,0x007A899A,0x007F8D9F,0x00738093,0x005E6B7E,0x00586678,0x006D798D,0x00748294,0x00838FA2,0x0095A0B5,0x0079859A,0x0069778A,0x007A8899,0x0079879A,0x0091A0B3,0x008998AB,0x008D98AA,0x00959EAC,0x0089919F,0x0088909F,0x00949BAB,0x008E91A2,0x00827E90,0x00827C8F,0x00888395,0x009691A4,0x00848394,0x00777889,0x008B8D9E,0x008F90A1,0x00808291,0x007F7E8B,0x009A96A1,0x009A939C,0x00A091A0,0x008F7A8B,0x00635060,0x004B3B47,0x00564652,0x0053444F,0x00554551,0x00685662,0x00988B9A,0x00B5B8D1,0x0093A1C1,0x009CA7C3,0x00959BB3,0x00ADBBD2,0x00D1DCF3,0x00A4A2B8,0x0078697E,0x006E586C,0x00664D5D,0x00695160,0x00665362,0x0061525E +dd 0x003B495A,0x004D5E74,0x0052677D,0x004F6678,0x00576E80,0x00687F91,0x005B7283,0x00647C8E,0x006C8396,0x0096ABC4,0x0098ADC7,0x007188A1,0x00627993,0x00677D98,0x008294AF,0x008495B0,0x007585A1,0x007D8DA9,0x00697995,0x0072829B,0x009EADC4,0x008A9BB6,0x008798B3,0x006E7F9A,0x0075839E,0x007E889F,0x00828BA1,0x008B94AB,0x00909BB1,0x008D95AC,0x009196AF,0x009396B0,0x00A1A5BE,0x008F94AC,0x008389A0,0x00848DA4,0x00ABB5CC,0x00BDC4DD,0x009AA2BA,0x008B94A7,0x009EA2B3,0x009093A4,0x00A19CB1,0x0091879F,0x006B5B6E,0x00564651,0x005D4D5A,0x004F3F4B,0x0052424F,0x0071606B,0x00897C8A,0x00A7AAC1,0x00C8D5EA,0x00E3EBFB,0x00C6C9DC,0x00A0ACC3,0x00B6C0D7,0x009898AC,0x00675A6D,0x005E4A5D,0x00634A5B,0x00674F5D,0x00675362,0x00665662 +dd 0x00475666,0x0063798D,0x00556E83,0x00566D80,0x006D8596,0x00758D9E,0x005A7182,0x00607787,0x00576C7F,0x005E7188,0x00607289,0x0062758D,0x008B9FB6,0x008093AA,0x006F7E96,0x0078859E,0x006F7E95,0x0074829A,0x007C89A0,0x007F8DA4,0x007F8EA4,0x008999B0,0x008D9BB2,0x0078879E,0x0078839A,0x008288A1,0x009399B0,0x00ABB2C8,0x00989FB6,0x00878EA6,0x007E879E,0x00838BA2,0x00A6AFC3,0x00959EB2,0x008B93A6,0x008E93A6,0x00989CB0,0x00AFB3C7,0x009095A9,0x00858FA0,0x00828D9C,0x008890A1,0x00B6B6CB,0x00948EA5,0x00625669,0x00695562,0x00715C69,0x00584552,0x005A4552,0x0077616D,0x00897883,0x00B1AFC2,0x00D8E2F5,0x00E0E6F9,0x00B7B6CB,0x00888EA7,0x009096B0,0x0088859B,0x00615869,0x005D5061,0x00665161,0x0068515E,0x00675260,0x00675763 +dd 0x00415163,0x005D778A,0x004F6D80,0x0052697D,0x006F8798,0x006E8598,0x00536B7C,0x00637A8B,0x006C7F93,0x00717F94,0x0067758B,0x005A697E,0x006B7A8F,0x0069788D,0x006B798E,0x0077859A,0x00758499,0x006E7D91,0x008090A5,0x008E9EB2,0x006D7D91,0x007D8DA1,0x007E8EA4,0x007F8FA4,0x009BA7BC,0x00ACB3CB,0x009AA1B8,0x00949CB2,0x008D95AC,0x009CA5BC,0x008D95AC,0x00949CB3,0x00969FB5,0x00848DA2,0x008D93A6,0x00A7ABBB,0x008A8EA0,0x00848799,0x00848799,0x00959EAF,0x008995A4,0x009FA7B7,0x00CED1E3,0x009B98AC,0x00675C6D,0x00735C6B,0x00735D6C,0x006E5867,0x00604957,0x006C5561,0x007D6974,0x009591A6,0x00969EB8,0x00A9ACC4,0x00908DA2,0x009194AF,0x00AFB2CD,0x009A99AF,0x00666072,0x00615667,0x00695764,0x006D5362,0x00624F5B,0x00554652 +dd 0x00364557,0x00576F82,0x005D7A8D,0x0050697D,0x00536C7E,0x00688294,0x0060798D,0x00627C8F,0x006B8295,0x007D90A2,0x006F8294,0x0056697C,0x00526678,0x00697D8F,0x007A8EA0,0x0074879A,0x00889AAD,0x00728599,0x006C8094,0x007F8FA2,0x007D8A9F,0x007D89A0,0x0078849B,0x0099A6BB,0x00AAB5C7,0x00878FA2,0x007F889B,0x007C8499,0x00828BA0,0x009BA5BA,0x00ABB3C8,0x00C1C9DF,0x00959EB5,0x007A839B,0x008F94AA,0x00A5A9BA,0x008D90A1,0x007E8294,0x008A8DA0,0x009BA2B3,0x008890A1,0x009CA2B3,0x00C9CCDE,0x00878599,0x004F495A,0x0060505C,0x00664F5D,0x00634A5A,0x0045313F,0x00584753,0x00826E7C,0x009A95AA,0x008089A2,0x00A5AAC3,0x008E8AA1,0x007A8099,0x009AA0B7,0x008F8EA1,0x0067606F,0x00665868,0x00735E6C,0x007A616E,0x0063505C,0x003A2B38 +dd 0x004C586B,0x004D6175,0x0051697F,0x0057748A,0x005A788F,0x00809FB5,0x0069889E,0x00628098,0x00638093,0x006C8490,0x00607884,0x00536C78,0x00576F7C,0x00647C89,0x00758D9E,0x006D8598,0x00788FA1,0x00677D90,0x008298AB,0x0094A2B8,0x00888FA7,0x007C849C,0x00858DA5,0x00939BB2,0x00919BAD,0x00939BAB,0x00BEC7D3,0x00A6AFBD,0x007F8999,0x007F899B,0x00959FB6,0x00A5ADC6,0x00878FA7,0x008089A0,0x009CA1B5,0x009EA1B1,0x008B8F9F,0x009195A6,0x00797D8F,0x00676B7D,0x00878B9C,0x009599AB,0x00C0C3D2,0x008B8F9F,0x003F404F,0x004A424C,0x006E5666,0x00735667,0x0052424F,0x00534B56,0x00857283,0x00A4A1B1,0x008B95A5,0x00A1A7BD,0x009B98B1,0x007F8A9F,0x008A96A7,0x007F828F,0x0069606C,0x00665260,0x006E5761,0x00786066,0x00625057,0x00352733 +dd 0x004F5C6F,0x00506279,0x005A6F85,0x005A7284,0x00556D7F,0x00778FA0,0x00576E7F,0x005A6F80,0x005B6E7F,0x005A6B78,0x005C6C79,0x00667483,0x00748390,0x00647382,0x00778398,0x007A879C,0x00838FA5,0x00758096,0x00919CB2,0x0099A1B8,0x00848BA2,0x006F788E,0x00757D94,0x00798098,0x00788094,0x00989FAF,0x00B5BCCB,0x00A9B1C0,0x008B94A2,0x00838A9E,0x008088A0,0x00757D94,0x007E859B,0x008F98AD,0x00A0A6B8,0x00969BAC,0x008A8EA0,0x00B0B3C3,0x009FA2B2,0x006C6F80,0x00888B9C,0x00828496,0x00898D9E,0x007A7E90,0x00444655,0x004C4550,0x00725B69,0x00775B6C,0x0061515D,0x00514952,0x00786677,0x008F8B9A,0x00788291,0x008288A0,0x009491AF,0x008E9AAF,0x008491A1,0x00838594,0x006E6471,0x006D5B67,0x006E5760,0x006F565B,0x00624F56,0x00423440 +dd 0x00353C4F,0x00344155,0x00445264,0x00455160,0x00414C5A,0x00404B58,0x0036414D,0x004B5360,0x00515666,0x00505564,0x00515564,0x004C5061,0x00494C5C,0x00343647,0x00404153,0x0047495B,0x005C5D71,0x005D5D71,0x00646477,0x0064606F,0x005C5262,0x00514A58,0x005C5362,0x006F6675,0x006B616F,0x00726774,0x006E6472,0x00716874,0x006D636F,0x007C7280,0x007C7280,0x0069606E,0x00635A68,0x0069616F,0x006C626F,0x006F6673,0x006B606D,0x005C5260,0x0069606D,0x006B606E,0x00635867,0x00665B69,0x00665C69,0x005B5160,0x00493E4B,0x0050424D,0x006E5D6B,0x006C5866,0x004B3C49,0x003B2F3A,0x00726272,0x00A79FB3,0x009596AF,0x009599B1,0x009FA2B5,0x008790A2,0x00949EB0,0x00ABADBD,0x0069636F,0x0062535D,0x0066515B,0x005C4651,0x0062505C,0x00615563 +dd 0x00292E3B,0x001E2330,0x00272A39,0x00363545,0x003E3B4B,0x002F2D3B,0x00353442,0x00403F4C,0x003F3C4C,0x003B394A,0x00444151,0x003E3A4B,0x00424051,0x00353444,0x00343141,0x00413F4D,0x00424050,0x00383545,0x0042404F,0x005E5361,0x0061505B,0x005C4B57,0x0061505C,0x00685762,0x0061505B,0x005C4B57,0x00604F5B,0x0062515D,0x0050404C,0x00665561,0x00665561,0x005C4B57,0x004A3945,0x0052424F,0x005D4D5A,0x00645360,0x00685864,0x00493945,0x00493842,0x005B4A56,0x006B5A67,0x006D5C69,0x005A4A56,0x00443440,0x00493945,0x005E4F5B,0x00645662,0x005B4B58,0x004D3E4A,0x0042333F,0x00746875,0x00BDB2CB,0x00ACA6C4,0x008E90A9,0x00A0AAB2,0x008B94A2,0x009398AC,0x009B9BAA,0x0058535E,0x00473E46,0x005B4C57,0x005C4A5E,0x005D4D62,0x005E5366 +dd 0x00282D3A,0x001D222F,0x00282A39,0x003B394A,0x00413F4F,0x00403E4D,0x00494656,0x00444151,0x00383445,0x002D2A3A,0x003B3949,0x00332F40,0x003B3847,0x00444151,0x00454253,0x00413E4F,0x003A3646,0x00343040,0x002A2736,0x00473C4B,0x005C4C58,0x00574955,0x005B4B56,0x005C4D5A,0x005B4D58,0x00584B56,0x0060525D,0x005D4F5A,0x00493B47,0x005A4B57,0x005B4A56,0x004B404B,0x003F343F,0x0051444F,0x00675662,0x00635360,0x005C4B58,0x0050404C,0x0052424D,0x005A4B56,0x006D5D69,0x00665662,0x005D4D5A,0x005D4D5A,0x0061515D,0x006E606C,0x00534450,0x00463945,0x00574A55,0x00534551,0x00756878,0x00A69CB6,0x008885A4,0x007D8099,0x00949CA9,0x00828999,0x00878B9F,0x00808090,0x0066626D,0x00564D56,0x005A4C56,0x005C495E,0x0056465C,0x0051465A +dd 0x00232835,0x00222734,0x00363947,0x00454453,0x00413F4F,0x003A3949,0x003A3847,0x003C3A4A,0x00403C4B,0x003E3844,0x00423C47,0x003F3844,0x0047404B,0x00524A57,0x00575061,0x00474052,0x00453E4F,0x004D4456,0x00403649,0x004A404D,0x00564D57,0x004C444D,0x005B515B,0x00615761,0x00524B55,0x00504952,0x00615862,0x00635A63,0x00605761,0x00645663,0x00645662,0x0041414A,0x002E3038,0x004A404A,0x0063505E,0x00695866,0x0061505D,0x00695A66,0x00665662,0x00584955,0x00645561,0x0062525E,0x005B4B57,0x00675763,0x0060515D,0x005E555E,0x00504751,0x003F3640,0x00423A44,0x004D424F,0x0078697E,0x00A7A5B8,0x007C8899,0x00717D8E,0x007E8595,0x006D7487,0x00808599,0x00888898,0x006D6974,0x005A5058,0x00524750,0x00574A5B,0x0055475C,0x004F4457 +dd 0x00303542,0x002D313F,0x00303441,0x003C3A4B,0x00424050,0x00413F4F,0x003C3A4A,0x00413F4F,0x00464150,0x0049404A,0x004B414B,0x004F4650,0x00524A52,0x00524953,0x00574D5E,0x00564C5E,0x00554B5D,0x0051475A,0x004C4253,0x004F4452,0x00574D58,0x0058505A,0x00625A63,0x005C555D,0x004B444C,0x00504951,0x0058505A,0x00514952,0x005C535D,0x00665A66,0x00685A67,0x004C4D55,0x003A3E44,0x004B414C,0x005C4956,0x006D5D69,0x00685864,0x00685864,0x0060505C,0x005C4C58,0x005D4D5B,0x005C4C58,0x00564652,0x00554551,0x0040313E,0x003C333C,0x00463F49,0x003F3640,0x003F3640,0x00524753,0x0064536B,0x008D8A9F,0x007A8B99,0x006C7D8A,0x006D7485,0x006D7387,0x00747A8F,0x00828394,0x0067646F,0x00584F58,0x00524750,0x00554C5C,0x00574D61,0x00584F61 +dd 0x002E3340,0x002D313F,0x00303441,0x003E3C4B,0x003E3C4B,0x00403F4D,0x003E3B4B,0x00454252,0x004A4451,0x004A3F49,0x00473E46,0x004A4049,0x004D424B,0x00534752,0x004A404D,0x00494050,0x00494150,0x004B4451,0x00524C5A,0x004F4650,0x00514750,0x005C525C,0x00615861,0x00605760,0x005D555D,0x00625861,0x00584D57,0x0051464F,0x00554B53,0x005B5057,0x0062555C,0x005C575B,0x00575357,0x00574D52,0x00564650,0x005D4C5A,0x0062515E,0x00564552,0x004B3A46,0x00584752,0x0053424C,0x004D3C45,0x004F3E46,0x005A4951,0x004A3A42,0x0041353F,0x004C404B,0x004F414C,0x004B3F4A,0x00504450,0x004D4157,0x009594A7,0x009AA5B6,0x007C8A98,0x00798090,0x00999CB0,0x00999EB1,0x00838795,0x00555560,0x00514952,0x00584B56,0x00564C5B,0x00514757,0x004C4251 +dd 0x00272935,0x002E303C,0x00343842,0x003B3E49,0x0031343F,0x00343440,0x003C3E4A,0x00454552,0x0045404B,0x00493E47,0x00463C46,0x004A414B,0x00564D55,0x00574F58,0x00403C45,0x003C3B44,0x00303039,0x003C3C45,0x00585861,0x004D4B53,0x00413A45,0x004C4651,0x00514C57,0x0057525D,0x00645B68,0x00665766,0x005B4B5B,0x0060505E,0x00675767,0x00635360,0x0062515A,0x00695760,0x0073626B,0x0068565E,0x004A3A44,0x00453842,0x00584B56,0x004A3C49,0x00463A45,0x0060525C,0x005B4F56,0x0050444A,0x0041343B,0x004A3C44,0x004D4047,0x00423640,0x004F414D,0x005D505C,0x00534550,0x00403540,0x003E3C4C,0x00777A8D,0x00838799,0x00828798,0x00727588,0x00878798,0x009496A4,0x007D8893,0x00565D69,0x00564D5E,0x00665062,0x00554A55,0x004F464F,0x00574D57 +dd 0x00283041,0x003A4253,0x003B4455,0x00404A58,0x00454F5E,0x00404958,0x0045505E,0x004A5564,0x00404756,0x004B515D,0x00515763,0x00585E6C,0x00686F7C,0x00626B78,0x00646C79,0x00616977,0x00505867,0x00505A69,0x005D6777,0x00606675,0x00606274,0x005B6071,0x00565B6D,0x00696D7F,0x00686D7F,0x00646D7D,0x006B7283,0x00727A8B,0x0071788B,0x00696E7F,0x00696775,0x0074717F,0x007C7987,0x00747280,0x00585562,0x005A5661,0x0067666E,0x00605D66,0x0058565E,0x0066636D,0x006F6C79,0x006C6977,0x005D5A67,0x005A5663,0x00686672,0x00605E67,0x006D6B72,0x006F6D74,0x006E6B73,0x00626068,0x00626472,0x006F7487,0x00787C8E,0x009BA0B2,0x00878B9C,0x006B6B7C,0x0071717E,0x00727D87,0x00646E79,0x00585061,0x00634D64,0x00585566,0x005E606D,0x00686775 +dd 0x0034465B,0x00526379,0x00607288,0x005C6E83,0x0057697F,0x004F6278,0x005B6E84,0x00617489,0x00526679,0x00607484,0x00617585,0x005B6F80,0x005E7485,0x00576D7D,0x00687989,0x00697989,0x00738393,0x00718090,0x00616F80,0x0069788A,0x0079859A,0x006C788E,0x006F7D93,0x008F9CB2,0x006E7E93,0x00687D8F,0x007E93A5,0x0090A5B6,0x00889CAF,0x008496A7,0x00919CAC,0x008A96A5,0x007C8896,0x0085909F,0x006F7988,0x007C8390,0x007C8391,0x00737A88,0x007D8490,0x009BA2B1,0x009BA1B6,0x007F859B,0x007D8298,0x007A7F95,0x007E8498,0x00808895,0x0099A1AB,0x008D94A0,0x009CA4B0,0x008A909C,0x008D93A2,0x009EA5B6,0x008D93A5,0x00959BAD,0x00808798,0x00676B7C,0x00737485,0x006C7584,0x006D7785,0x007A788B,0x007C7389,0x006D7488,0x007F8A9B,0x00828D9C +dd 0x00384F61,0x00445B6D,0x0041586B,0x00455C6E,0x00576D80,0x00476073,0x004B6275,0x00586F82,0x00556C7F,0x004D6678,0x004C6477,0x00556C7E,0x005E7789,0x006B8293,0x00647584,0x00556673,0x00667784,0x0071828F,0x00677885,0x00637384,0x00617185,0x007A8A9F,0x008090A5,0x008A9AAF,0x006C7C91,0x0068788D,0x0067778B,0x0075859A,0x0075859A,0x0078879A,0x008E96A6,0x00858F9E,0x006D7787,0x00737D8D,0x0066717F,0x00757F8E,0x00828D9C,0x007A8595,0x007C8795,0x00909AAB,0x0080889F,0x007D849B,0x008D95AC,0x007F879F,0x007C859C,0x00798294,0x00828B9B,0x007D8798,0x009BA5B6,0x00959FAF,0x009CA6B6,0x00A9B2C2,0x0099A2B2,0x007A8495,0x006B7484,0x006D7789,0x00626B82,0x00697389,0x00919BB2,0x0098A0B8,0x007E889E,0x007F909F,0x009CADBB,0x00A2B3C1 +dd 0x003B5264,0x00455C6E,0x00405769,0x0042586C,0x00556C7E,0x004A6174,0x00496072,0x00667D90,0x0062798B,0x005D7487,0x004F6678,0x00586F82,0x006E8598,0x007A90A2,0x006F8090,0x00536673,0x00627380,0x008798A4,0x00899AA7,0x007C8B9E,0x0057677D,0x006E7E94,0x006E7E91,0x006C7C8F,0x0077879A,0x0090A0B5,0x006D7D91,0x00748399,0x00738396,0x006B788A,0x00697383,0x00717A89,0x007D8796,0x00717A8A,0x006C7585,0x008791A0,0x009AA4B5,0x00858F9F,0x00757F8F,0x007D8798,0x00919AAF,0x008F98AF,0x007C849C,0x0071788F,0x00757E94,0x00788093,0x00798393,0x00788091,0x00838B9B,0x008F98A7,0x00A1ABBB,0x009EA7B7,0x00919BAB,0x00717A8A,0x00727C8B,0x00798395,0x006F7990,0x007D879C,0x00959EB5,0x0099A1B8,0x00828DA2,0x00748594,0x008E9FAC,0x0098A7B5 +dd 0x00395062,0x00465D6F,0x004C6374,0x003F5767,0x00495E6E,0x004B6272,0x0049616F,0x006B8291,0x00627889,0x006F8596,0x005C6F80,0x00607384,0x00728795,0x00667989,0x00637382,0x00526371,0x005C6D7A,0x008A9BA9,0x0099AAB7,0x008898A7,0x005C6C7D,0x00617282,0x0060717F,0x0060717F,0x00738395,0x008090A7,0x00637387,0x00738391,0x00667780,0x005E6D77,0x00697383,0x00757F8F,0x007F8999,0x006F7989,0x006C7587,0x00727C8B,0x00727C8B,0x007F8999,0x008D96A6,0x00778290,0x009AA4B5,0x009AA4B5,0x007F899B,0x00838B9E,0x00727A8D,0x00828799,0x00A1A5B7,0x007E8395,0x006C7183,0x0083889A,0x008E95A5,0x00717A8A,0x006D7787,0x00687180,0x00828A9A,0x00757E8F,0x00626B7D,0x00888FA0,0x00949BAC,0x00828A9C,0x006F798B,0x00626E7E,0x00717D8D,0x007C8896 +dd 0x0030475A,0x0040576B,0x0052697C,0x0038505D,0x00415864,0x00465D68,0x004A626C,0x00556D78,0x004C616E,0x0051626F,0x004D5E6C,0x00526371,0x005A6B77,0x00556673,0x005B6C79,0x00556472,0x004D5D6B,0x00798A98,0x0090A1AF,0x00748793,0x00536472,0x00647584,0x00667784,0x006F828E,0x008293A4,0x00687990,0x007A8B9E,0x009AACB7,0x006D7F85,0x0057676D,0x00717C8B,0x00717A8A,0x006E7888,0x00646E7E,0x00687282,0x006F7989,0x00747E8E,0x00909AAA,0x009AA4B3,0x006D7787,0x00778090,0x00808A99,0x0096A0B0,0x00B5BECE,0x00909AAA,0x00878B9E,0x009EA1B3,0x00737789,0x00717485,0x007E8093,0x00747C8B,0x00616B7A,0x00727C8B,0x00666E7E,0x00687282,0x00757F8E,0x00727D8B,0x00838B9A,0x007C8493,0x00798391,0x00727C8B,0x006B7484,0x007F8999,0x009099A9 +dd 0x00384F61,0x003E5568,0x004A6174,0x003F5663,0x004C646F,0x00405863,0x00506873,0x0058727D,0x00566C78,0x00576977,0x00576875,0x00556673,0x00566774,0x00627480,0x005E717E,0x005B6C79,0x00556473,0x00697988,0x00667785,0x005D6F7D,0x005C6D7C,0x00687887,0x005D6D7C,0x00647483,0x00778598,0x007C8AA1,0x0099A9BC,0x009AA9B7,0x006F7E8A,0x00687582,0x007C8596,0x00727C8E,0x00747D90,0x00727C8E,0x007A8395,0x00858FA0,0x008A94A5,0x00919BAD,0x008E96AA,0x006D7789,0x006E7789,0x00757D90,0x008790A2,0x008E98AA,0x00757E90,0x006C7184,0x0072758A,0x006D7184,0x007A7F91,0x0073778A,0x0062697A,0x00606B7C,0x006D7888,0x006E7888,0x00828B9B,0x008D96A6,0x0099A2B2,0x00828B9B,0x00626C7D,0x006B7484,0x00778090,0x00848D9C,0x00727C8B,0x00677182 +dd 0x00334A56,0x003F5662,0x00465C68,0x003A4A55,0x003F4B58,0x003B4753,0x00495562,0x00525E6B,0x004B5A68,0x00526474,0x00576B7A,0x00526675,0x00516474,0x00677888,0x0050606F,0x003B495A,0x00536172,0x00677485,0x00576374,0x00536172,0x00525E6F,0x005C6778,0x00586474,0x005E6879,0x00666D7F,0x0073798B,0x00717588,0x00626778,0x00585D6F,0x0064697D,0x00686C7E,0x006C7182,0x0062677A,0x0064697D,0x007E8395,0x0084899B,0x00797F91,0x00727789,0x00787D90,0x00797F91,0x00717589,0x0074798B,0x0074788B,0x00686D80,0x0064697D,0x00727789,0x0075798D,0x00888B9F,0x008B91A5,0x00777D90,0x00666D7F,0x00798395,0x008790A1,0x00778294,0x00909CAD,0x008F9AAB,0x008F95A9,0x0073798D,0x006C7385,0x00757C8F,0x00777C8F,0x008B91A2,0x00696F82,0x005D6274 +dd 0x00192933,0x001A2933,0x00202E38,0x001A202E,0x00181A28,0x00242835,0x00383C4A,0x003A3F4C,0x00393B4A,0x003B3A4B,0x003C3B4C,0x003E3C4D,0x00414051,0x004A4A5A,0x003A404D,0x002F3542,0x00393E4B,0x00393F4B,0x00353A46,0x003E414D,0x003F444F,0x00444952,0x003E424C,0x00424650,0x00464651,0x00494550,0x003F3A46,0x0046414D,0x004A4551,0x0046414D,0x003B3642,0x004F4B55,0x00524C58,0x00504B56,0x0057525D,0x005E5A64,0x005E5A66,0x004C4752,0x00453F4B,0x00524D5A,0x0055515D,0x00504B58,0x004B4753,0x004F4B56,0x00464450,0x00514F5B,0x005B5A64,0x0064626F,0x00676672,0x00646271,0x00585864,0x00505560,0x00575B66,0x00474C57,0x00555A66,0x005A5C68,0x00605D6C,0x00585764,0x00565361,0x00524F5C,0x003C3946,0x00393542,0x00363442,0x0053505D +dd 0x001C202F,0x001C1F2D,0x00252935,0x001C1F2D,0x000C111E,0x00161A28,0x002A2F3E,0x00272B3A,0x00232430,0x0025232A,0x002F2D33,0x002F2F35,0x002E2E34,0x0035343B,0x00333139,0x0035353B,0x0038363C,0x00302F35,0x00312F35,0x003A363F,0x003C3A42,0x003F3E45,0x0039363F,0x0036343C,0x00443E46,0x004B4149,0x0040363E,0x0040363E,0x00463C44,0x00473C46,0x003F343E,0x004D454D,0x00534B52,0x00493E46,0x00423A41,0x00413C42,0x00423E44,0x00352F35,0x00332D34,0x00453F46,0x00524A51,0x004C424B,0x00493E46,0x004C414A,0x00463C44,0x004A4049,0x00423941,0x003F353E,0x00423941,0x003C333B,0x003B333B,0x00343339,0x003F3E42,0x003B363C,0x00464046,0x00564D56,0x00534A53,0x00493E46,0x0051474F,0x00564B53,0x003A3038,0x002A222A,0x00352933,0x0051424C +dd 0x00131724,0x00202330,0x00252936,0x00232835,0x001D222F,0x001C202E,0x00222734,0x001A1F2D,0x001A1D28,0x001E1E24,0x0025252B,0x00292A30,0x00282A2F,0x002D2E34,0x00333139,0x003A3940,0x00403E45,0x003B3A41,0x003C3B44,0x003F3C4A,0x00403E4D,0x0042404F,0x003B3947,0x0033303F,0x003B3644,0x00443B45,0x00453C46,0x00413942,0x00413942,0x00463C46,0x00453C47,0x004F464F,0x00504951,0x00423942,0x00403840,0x00423F46,0x00454149,0x003E3A41,0x00403E45,0x004C4950,0x004D474F,0x00493F4A,0x00403840,0x00443B45,0x00453C46,0x00554C56,0x005E5660,0x005C535D,0x00463C47,0x00352B35,0x003F3942,0x00414249,0x0049464D,0x004A404B,0x0050414C,0x00574753,0x00463B46,0x003C333B,0x004A404A,0x00514750,0x004A444C,0x0038363E,0x00443842,0x004D3846 +dd 0x00131825,0x00232835,0x00202533,0x00222734,0x00292E3B,0x00232835,0x00272B39,0x00202533,0x00282A35,0x0034313B,0x003C3B42,0x003B3A40,0x00333139,0x00333139,0x00403F46,0x00414049,0x00403E46,0x003C3B42,0x003F3C45,0x00403E4C,0x00424050,0x00464453,0x00454152,0x00393647,0x00332E3A,0x00382F39,0x00403640,0x003F3640,0x003E353F,0x00403841,0x00423A45,0x00443B45,0x004D454F,0x004B424B,0x00463C46,0x00514550,0x00584B56,0x00524551,0x00584B57,0x004A3C47,0x00362D36,0x003E353F,0x00362E38,0x00362E38,0x003E353F,0x00574F58,0x00665D67,0x00645C66,0x004A414B,0x00312833,0x00221C25,0x001C1E25,0x003A3940,0x00534953,0x00534551,0x004C3B49,0x00362D36,0x00382F39,0x0049404A,0x0049404A,0x00443C46,0x0035353E,0x00403541,0x00422D3C +dd 0x00181D2A,0x001E2430,0x00191E2B,0x001E2330,0x00232835,0x001F2431,0x002A2F3C,0x00313645,0x0030333F,0x00302E36,0x0035333A,0x0038363E,0x0036353C,0x0039383F,0x0047464D,0x0045444B,0x0036353C,0x002E2D34,0x00302E36,0x0034313C,0x00353440,0x003A3945,0x00464452,0x00413F4C,0x0034303B,0x00332D39,0x0036303C,0x003E3844,0x003E3945,0x003B3540,0x003F3841,0x003B333C,0x0049404A,0x00504751,0x004F4550,0x00534652,0x0052444F,0x0050414C,0x0051424F,0x002F202D,0x00291E29,0x00463C46,0x00463E47,0x003E353F,0x0039303A,0x00473E49,0x00625660,0x00665B66,0x0050444F,0x00332430,0x00180E18,0x0018141D,0x0039333C,0x00534A53,0x004F444F,0x00453944,0x00312933,0x002D242F,0x00443A45,0x004C444D,0x003C3640,0x00343039,0x00403641,0x00423541 +dd 0x001E2330,0x00222734,0x00191E2B,0x001D222F,0x00242936,0x00202533,0x00282D3A,0x003A3F4C,0x00353942,0x002B2B31,0x00333139,0x0038363E,0x00333139,0x002B2A31,0x00333139,0x003A3940,0x002F2E35,0x002A2930,0x002B2A33,0x002D2D34,0x002B2A31,0x0029282E,0x00313038,0x0036353C,0x0031303A,0x002D2B3B,0x002B2A3A,0x003C3A4A,0x00444152,0x00383542,0x003C353F,0x003A313B,0x003F3640,0x00413942,0x003F3640,0x00403841,0x003C343F,0x003E3540,0x00403640,0x002D242E,0x00342B35,0x00443B45,0x003B333C,0x00312A34,0x0038303A,0x00423642,0x0055444F,0x0051414D,0x004B3B47,0x0040303C,0x00332430,0x003F363F,0x003E353F,0x003E353F,0x0039333C,0x003B343C,0x00413A42,0x003A313B,0x003C343E,0x00443B45,0x003E353F,0x00382F39,0x003B333C,0x003E343E diff --git a/programs/free3d04/trunk/wall6.inc b/programs/free3d04/trunk/wall6.inc new file mode 100644 index 0000000000..7bb7cdedcf --- /dev/null +++ b/programs/free3d04/trunk/wall6.inc @@ -0,0 +1,64 @@ +dd 0x008B818D,0x00716773,0x005C535C,0x00453C3F,0x005B5256,0x00736A6C,0x00857D82,0x0067646D,0x005D5B66,0x005B5A64,0x0056555D,0x00504A4E,0x003B3136,0x005A555D,0x0067656F,0x00686770,0x005F5E67,0x005A595D,0x005D5C5D,0x00606060,0x00646463,0x0053524E,0x00433C32,0x004D4645,0x0045494D,0x004C5459,0x005E656B,0x005B6267,0x0052585E,0x004C515A,0x00434851,0x00495054,0x004B4D4C,0x00343334,0x0046474F,0x005B606E,0x006A707D,0x00656B79,0x00606673,0x005C636E,0x00616467,0x003E3A36,0x00434846,0x005A626A,0x00636572,0x0062606A,0x00615F68,0x005E5D66,0x00545459,0x0032322C,0x00635853,0x00908A89,0x006C6A74,0x005E5867,0x006E646F,0x00716672,0x006B606C,0x00625763,0x00665B64,0x0069605E,0x00504642,0x00786A72,0x00908491,0x009A8F9C +dd 0x00766A76,0x006D626D,0x0062595F,0x00494041,0x005E5556,0x006B6265,0x00746C71,0x00625F66,0x00605D64,0x00605B63,0x005C575E,0x00494043,0x00362D2E,0x00595358,0x006B676F,0x0069666E,0x005E5C63,0x005D5C5F,0x005F5F5F,0x005D5E5F,0x00606164,0x005A5658,0x003A312A,0x003F3A38,0x00474A50,0x00595D66,0x005F646C,0x00585C63,0x00575A5E,0x00585B5F,0x00515659,0x0049514F,0x004B4D49,0x00444445,0x0054555F,0x00636977,0x006D7481,0x00606573,0x005B616E,0x005F6671,0x005E6265,0x00332F2B,0x00404541,0x0061686F,0x006C6E79,0x00636169,0x005F5C64,0x005B5861,0x004E4C52,0x0025231E,0x00473D38,0x00847D7C,0x0077757D,0x00635D6B,0x006A616B,0x006D626E,0x006A5F6B,0x006E626F,0x00766C74,0x005D5250,0x00493A37,0x00806D74,0x0091838E,0x008D838F +dd 0x00685E64,0x00675E62,0x005A5252,0x00453D39,0x005D5551,0x00665D5F,0x00665E61,0x00645D61,0x00675E62,0x00605257,0x0057494E,0x003D3230,0x002E2621,0x00423938,0x00534A4D,0x00474345,0x00363636,0x003D3D3D,0x004F4F50,0x004F5252,0x004E5153,0x004B4448,0x00382C29,0x00383632,0x00454647,0x00555659,0x00545558,0x00505051,0x00575756,0x00595A5A,0x00535654,0x004B514C,0x004F4F49,0x0046413F,0x004E4B50,0x00636871,0x006B727C,0x005E626F,0x00545663,0x00575963,0x004B4D4D,0x0023201B,0x002C2A1F,0x003B3B32,0x0046463F,0x004E4C44,0x00574C47,0x00554849,0x004F4847,0x002B2621,0x0039312B,0x00645D58,0x007A7473,0x00696265,0x00675D63,0x00645861,0x00645462,0x006D5E6B,0x00716869,0x00524340,0x004A3836,0x00726161,0x0074686C,0x006E656C +dd 0x0062595B,0x005D5356,0x00403738,0x002D2523,0x003D3433,0x00494042,0x004A4144,0x0051494B,0x00544A4D,0x0044353A,0x0037272D,0x002C2023,0x00261D1C,0x002D2424,0x00483F41,0x00464143,0x003B3A3A,0x00393939,0x004A4A4A,0x00424641,0x0033392D,0x00282119,0x00332520,0x002D2C24,0x00292C21,0x0025291C,0x0025281C,0x0025271B,0x00282A22,0x002D2D2C,0x00242625,0x00252C28,0x003E3D38,0x00403934,0x003F3C3B,0x00595F64,0x006A7177,0x00616366,0x00464646,0x003F403F,0x003F3E3F,0x00201F1E,0x001F1B12,0x001D180F,0x001B1A11,0x00211E13,0x00372820,0x004E3C38,0x00574E48,0x004D4740,0x00433C36,0x0039312B,0x004E4740,0x004E4643,0x0050474A,0x00564B51,0x00594953,0x0055464F,0x004E4543,0x003D2C29,0x00382623,0x0050413E,0x00544A48,0x004B4344 +dd 0x00645C58,0x00686062,0x00595054,0x00594E56,0x00645A60,0x006C6165,0x00655B5E,0x00696063,0x00675E61,0x00584A4E,0x00403036,0x00332830,0x00433A41,0x00584F53,0x006F6668,0x00686465,0x005E5E5E,0x005B5B5B,0x00656665,0x00636863,0x004E544C,0x00312925,0x003F312D,0x00312F27,0x002C2E26,0x0021231B,0x001E1F19,0x001C1C17,0x000E0E0D,0x00101011,0x000E0F0F,0x001A201E,0x003A3B3A,0x00434141,0x003E3E41,0x0040474C,0x00495155,0x00454A43,0x00383A2C,0x00303229,0x00403F44,0x00414147,0x004C4B4D,0x00484748,0x00454644,0x003D3A34,0x00392826,0x00483432,0x00483F39,0x0048433C,0x003E3731,0x002F2822,0x003B342D,0x0048403D,0x004C4347,0x00554A4E,0x005B4C4F,0x0056494A,0x004E4742,0x004F3E3B,0x004A3735,0x004A3B39,0x003C322D,0x0017100E +dd 0x006E6660,0x00797073,0x00776D74,0x00766B77,0x007F747E,0x00877D81,0x00807779,0x007A7176,0x006B6367,0x005E5055,0x0046373D,0x003F353F,0x00564D5A,0x00635A63,0x00716A6D,0x00706C6E,0x00616263,0x005C5C5D,0x005E5E5E,0x005B5D5E,0x004A4C52,0x0030282F,0x00403535,0x0043413C,0x004B4C4E,0x0046454C,0x0043434A,0x00404047,0x001F1F22,0x00141413,0x00252828,0x003B4343,0x0055595D,0x005D6165,0x005F6469,0x00565D64,0x00485055,0x00474C4A,0x0061635D,0x00646464,0x00605E6B,0x00605E6E,0x00626371,0x005C606E,0x00595D65,0x00534E50,0x00423035,0x00493333,0x004E443F,0x00544E47,0x00534C46,0x00564E48,0x00665E58,0x00756D69,0x00746C6E,0x00756B6C,0x007A6C69,0x007D6F6C,0x00776F69,0x007D6C6A,0x007D6A68,0x00786965,0x005B514A,0x0018110F +dd 0x007D7474,0x00837A7E,0x007E7579,0x00797076,0x007E747A,0x007F777A,0x007F777A,0x00777279,0x00646268,0x005C5458,0x004A4145,0x004A454D,0x00605C67,0x00615E67,0x00615D66,0x00605E66,0x005C5B63,0x005D5D61,0x00636363,0x00606063,0x0045464B,0x002F2F2D,0x00454341,0x004C4D4B,0x0054585C,0x00555A5E,0x0052585C,0x004C5256,0x00313632,0x0035372E,0x00404243,0x00464C50,0x00535A61,0x005C646B,0x00666E75,0x006A7178,0x005C6469,0x0052565B,0x0062646B,0x00646471,0x005F5F70,0x005F5F71,0x005A5F70,0x00545B6B,0x00515561,0x00524E55,0x00504349,0x005B4B4A,0x00635A55,0x0068625B,0x00645D57,0x006B635D,0x00786F69,0x007A726D,0x00756E6B,0x00756D6A,0x007D746E,0x00877E77,0x00817A73,0x00837872,0x007F706C,0x007B6C69,0x006A5F5B,0x00312927 +dd 0x008A8184,0x007D7477,0x0072696C,0x00766D6F,0x007F7679,0x00786F72,0x00766E72,0x0077747C,0x0074737B,0x00655E62,0x004C4347,0x004A464D,0x005E5C65,0x005F5D66,0x005B5962,0x005D5B64,0x0064626C,0x0066666C,0x006A696A,0x00626165,0x003B3A40,0x0032332E,0x00565653,0x00545454,0x0055595B,0x005A6063,0x005A5F62,0x004D5356,0x00282D28,0x00303227,0x003E3F40,0x0041474D,0x004C535B,0x00596167,0x00636C71,0x00676F75,0x00595F66,0x004B5153,0x005A6065,0x005B606F,0x005E6472,0x00636975,0x00626972,0x005A6169,0x00555860,0x0057555E,0x00625E62,0x00776F6B,0x00706963,0x0067605A,0x005E5650,0x0069615B,0x00706862,0x00756E67,0x00776F69,0x00777069,0x007E7770,0x0089817B,0x00847C76,0x00807972,0x007E726E,0x007C6D6A,0x00685D5C,0x00342B2D +dd 0x00857C7F,0x0072696C,0x006F6669,0x00736A6D,0x007F7679,0x007D7477,0x00766E71,0x00726F77,0x007C7A83,0x00645D62,0x004D4448,0x004A464E,0x005E5C66,0x005E5C65,0x00595861,0x00605F68,0x00686770,0x006C6B71,0x006B6B6C,0x005F5E62,0x0039383E,0x00373733,0x00585855,0x00565657,0x0053575B,0x00545A5D,0x00555B5E,0x004A5154,0x001C221C,0x0026281C,0x003C3F3F,0x00424A50,0x004B535B,0x00545C62,0x005D6569,0x0061686D,0x0051575D,0x00484F50,0x00656D70,0x005E6572,0x005E6473,0x00626874,0x005F666E,0x00626A70,0x00676B72,0x00696770,0x005C5A5F,0x00605955,0x006A635D,0x0068615B,0x00615953,0x006B635D,0x006E6761,0x00716A64,0x0078706A,0x007D7670,0x00817973,0x0088807A,0x008B837D,0x00867E78,0x00827772,0x0080716E,0x00635756,0x00251E20 +dd 0x00867D80,0x00797174,0x00756C6F,0x0071696C,0x00756C6F,0x006F6569,0x00736B6F,0x00736E76,0x00726E77,0x005C5359,0x0050464B,0x004C474F,0x0065636B,0x00696770,0x005E5D66,0x0062626A,0x00606069,0x00606067,0x005E6061,0x0055575A,0x003C3C41,0x00424340,0x005B5D5C,0x00565759,0x00515558,0x0051575A,0x0054595C,0x004A4F53,0x001C201C,0x0026281D,0x003C3E3D,0x00444B50,0x004A545B,0x00525A60,0x00575E63,0x00596065,0x00484F55,0x003C4546,0x00677072,0x005D6471,0x00595F6D,0x00626875,0x005E656E,0x005C636A,0x0060656C,0x00686770,0x00514F56,0x0048423F,0x006B635D,0x00716A64,0x006B635D,0x00726B65,0x00746C66,0x00746D67,0x0077706A,0x007B736D,0x007C756E,0x00817973,0x00847D77,0x00807973,0x007F746F,0x007E706D,0x005F5454,0x0022181C +dd 0x00887A7C,0x00777073,0x006F696D,0x00686166,0x00675E63,0x0072666C,0x00776B71,0x00766B73,0x006E636B,0x005B4E55,0x00483941,0x00463B42,0x00605A60,0x00646166,0x005A5B5F,0x005A5C62,0x0051575F,0x004B5158,0x004A5156,0x004C5258,0x0046474F,0x0046464D,0x005C5C63,0x00535359,0x004B4D4F,0x00515252,0x00535453,0x00424444,0x001C1E1A,0x0024261E,0x00353833,0x003B4343,0x00434C50,0x004C5259,0x0052585E,0x00545B60,0x0042494D,0x00272E2E,0x00505859,0x005D646E,0x00585E6A,0x005C616D,0x00596067,0x0052585B,0x00505557,0x00535256,0x00535154,0x00655F5B,0x0079716A,0x00726A64,0x006D6761,0x00726A65,0x00746861,0x00756A63,0x00786F67,0x007C746C,0x007D7673,0x00827C7B,0x00827D7C,0x007A7474,0x0079726F,0x00756C67,0x00584D4A,0x002A1A1B +dd 0x007A6768,0x00605759,0x00564D50,0x004E4447,0x00493E40,0x0057474B,0x004B393E,0x00503E42,0x005E4C50,0x004C3C40,0x0037272B,0x0034282A,0x00393132,0x00393434,0x003F3D3C,0x00454647,0x00404549,0x00373B3F,0x0034393D,0x0047494E,0x004F4D53,0x00343136,0x003F3E43,0x003C3C41,0x003C3B3D,0x003B3B3A,0x003F3F3E,0x00292A29,0x000C0E0A,0x00090C07,0x0013160F,0x001A211E,0x002D302E,0x003C3B3D,0x004C4A4B,0x00494946,0x003C3B35,0x0022231C,0x00292D29,0x003C403E,0x003A3D3C,0x00353736,0x00373832,0x00333228,0x002F2E23,0x002C2A1F,0x00413E34,0x00736C63,0x0070665C,0x0060574F,0x005F5955,0x00665B57,0x006B5851,0x00645149,0x00625449,0x006E6158,0x00685F5F,0x007A7376,0x007D7579,0x006D6468,0x00645C5C,0x00534C46,0x00473A36,0x00483232 +dd 0x008E7979,0x00655553,0x00766765,0x006F5F5C,0x00705E5B,0x00897270,0x00866D6C,0x008A7271,0x00967E7C,0x0082706C,0x00766964,0x0070665F,0x004F4840,0x00514A42,0x00696059,0x0069635E,0x005C5B58,0x00565452,0x00565352,0x00716C6B,0x00877F7F,0x006B6261,0x004D4B49,0x0030312E,0x003E3F3E,0x00292928,0x00444443,0x003F403D,0x002F322B,0x00252920,0x0021241B,0x001C1F18,0x0024231B,0x00322D26,0x004C443E,0x00484136,0x00454032,0x00454235,0x003F4036,0x004B4B42,0x005A5B51,0x0058574E,0x00474338,0x00574F43,0x00645C50,0x006C6357,0x007B7267,0x00A59890,0x00A39289,0x00978880,0x009C9189,0x00A89A91,0x00AD9992,0x007E6962,0x005E4940,0x00928078,0x008E7F7B,0x00A69997,0x00B1A3A2,0x00A59795,0x00A29491,0x009F928E,0x00A1918E,0x00A99292 +dd 0x00CFB7B6,0x0099837D,0x00DCC7BF,0x00E2CCC2,0x00E1C9BF,0x00E6CAC2,0x00E6C7C1,0x00E8CAC4,0x00E8CAC4,0x00DECAC0,0x00DCCEC2,0x00D5CBBD,0x009B9486,0x00ABA194,0x00DDD0C4,0x00DACCC1,0x00CEC4BE,0x00CDC3BD,0x00CCC2BB,0x00D6CAC3,0x00E3D3D0,0x00DFD0CC,0x00AFAAA2,0x0066675F,0x0091908C,0x00898887,0x00AAA8A6,0x00AFADA8,0x00ABA99F,0x00A9A59A,0x00A7A296,0x009F9B8F,0x009C978A,0x009D978A,0x00A69D92,0x00ADA699,0x00BCB6A8,0x00CBC6B7,0x00CEC9BA,0x00D6CFC1,0x00DFD8C9,0x00D0C9BA,0x00A3988B,0x00D0BFB6,0x00E0CEC5,0x00E6D3CC,0x00E3D0C8,0x00EAD2CC,0x00F0D5CF,0x00EED6CD,0x00EEDCCE,0x00F1DED1,0x00EDDFD6,0x00B09D97,0x00836A64,0x00DEC8C3,0x00E8D1CB,0x00EDD8CF,0x00F4E0D8,0x00F3E0D8,0x00F2DFDB,0x00F3DFDE,0x00F4E1E0,0x00F5DEDD +dd 0x00D9C3BD,0x009D887F,0x00EDD4CC,0x00F5DCD3,0x00F0D8CF,0x00EED4CC,0x00EFD4CD,0x00EED7CE,0x00ECD7CC,0x00EBD7CC,0x00EAD7CC,0x00E8D4C7,0x00A6968C,0x00B1A39A,0x00F2E7D9,0x00F4DFD3,0x00EEDBD3,0x00EFDDD4,0x00F0DDD0,0x00F1DED1,0x00F1DCD4,0x00F1DDD4,0x00C7BBB0,0x00777169,0x00B7AEA7,0x00C4BEB8,0x00C9C3BC,0x00CAC3BB,0x00CFC6BB,0x00D4C8BB,0x00D8CABC,0x00DACCBF,0x00DCCEC0,0x00DBCEBF,0x00D7CCBD,0x00D7CFC0,0x00DED7C9,0x00ECE3D3,0x00F2E5D1,0x00F4E7D3,0x00F8EAD6,0x00E5D7C3,0x00AF9E8F,0x00EBD4CB,0x00F5DBD5,0x00F9DFDA,0x00F4DAD4,0x00F7D9D5,0x00FDDED9,0x00FCDFD6,0x00FCE4D4,0x00FCE6D7,0x00F6E4DB,0x00BAA49D,0x00886B66,0x00E8CBC7,0x00FBE2DA,0x00FAE2D8,0x00FCE5DA,0x00FEE8DE,0x00FDE7DF,0x00FEE7E4,0x00FFECE9,0x00FEE7E4 +dd 0x00D8C4BB,0x009F8F86,0x00EFD9D4,0x00F6DED8,0x00F2DBD4,0x00EED8D1,0x00F1DBD4,0x00EFDED5,0x00EBDDD3,0x00ECDAD1,0x00EDD6CF,0x00E9CFC4,0x00A48E86,0x00A7968F,0x00F2E5D7,0x00FBE3D7,0x00F6E0D8,0x00F5E0D6,0x00F6E1D1,0x00F5E0D0,0x00F1DAD0,0x00F1DAD1,0x00D0C0B6,0x00857B74,0x00C1B4AB,0x00CCC1BC,0x00CDC4BC,0x00D7CCC0,0x00E2D3C5,0x00E8D5C8,0x00ECD7C8,0x00EED9CA,0x00EFDACB,0x00ECD8C9,0x00E6D5C5,0x00DFD2C2,0x00DED4C3,0x00E6DCC9,0x00EEE0CC,0x00F3E4D0,0x00F8E5D5,0x00E4D4C4,0x00A89A8B,0x00ECD7CA,0x00F6DED3,0x00F6DED7,0x00F7DFD8,0x00F9E1D9,0x00FBE2DB,0x00F9E0D9,0x00FBE4DA,0x00FEE6DE,0x00F6E1DA,0x00B5A49C,0x0085716A,0x00E9D1CB,0x00FAE4DC,0x00F8E3DB,0x00FCE7DF,0x00FFEDE5,0x00FEECE5,0x00FDE7DF,0x00FBE6DE,0x00F8E1D9 +dd 0x00D0BDB4,0x0095867F,0x00ECD5D1,0x00F4DBD4,0x00F3DCD5,0x00F3DDD5,0x00F4DED6,0x00F2E2D8,0x00EFE2D7,0x00EEDBD2,0x00EBD5CD,0x00E6CCC1,0x00A89188,0x00A3928A,0x00F2E3D6,0x00FEE7DB,0x00FAE3DC,0x00F5E0D7,0x00F2DDCE,0x00F0DBCC,0x00ECD6CD,0x00ECD4CD,0x00CFBEB5,0x00877D77,0x00C1B3AA,0x00C8BFB8,0x00D3C9C0,0x00E3D6CA,0x00EFDCCE,0x00F3DDCF,0x00F4DDCE,0x00F4DDCE,0x00F4DCCD,0x00F1DACB,0x00EBD8C9,0x00E3D4C3,0x00DDD1BE,0x00DDD3BF,0x00E2D8C6,0x00EEE1D0,0x00F9E5DA,0x00E6D8CE,0x009E9587,0x00E5D3C3,0x00F5DFD0,0x00F5DFD6,0x00F9E2DC,0x00F8E1DA,0x00F9E2DB,0x00F7E1DA,0x00F9E3DC,0x00FEE5DF,0x00F6DDD8,0x00B7A79F,0x0084726B,0x00E7D1CA,0x00EFD9D2,0x00F0DAD2,0x00F9E2DA,0x00FCE7DF,0x00F8E3DC,0x00F3DCD4,0x00EED7D0,0x00ECD6CE +dd 0x00CFBBB2,0x008D7E76,0x00EBD2CD,0x00F3DBD3,0x00F4DDD5,0x00F6E0D8,0x00F4DFD7,0x00F0E0D6,0x00F0E2D7,0x00EEDCD3,0x00EBD4CD,0x00E7CDC3,0x00AC968C,0x009C8A83,0x00F1E3D7,0x00FEE8DC,0x00FAE4DB,0x00F2DCD3,0x00E4CFC0,0x00EAD4C4,0x00ECD5CC,0x00E6D0C8,0x00C4B4A9,0x007E746E,0x00BCAFA5,0x00C2B9B2,0x00CDC3BB,0x00E0D4CA,0x00E8D9CC,0x00ECDACB,0x00EED9CB,0x00EDD8CA,0x00EED9CA,0x00ECD8C9,0x00E8D6C8,0x00E2D3C3,0x00DBCFBC,0x00DDD2BE,0x00E1D7C3,0x00EEE2D0,0x00FCE9DD,0x00EADCD1,0x00958E7F,0x00DDCDBD,0x00F7E2D3,0x00F7E1D8,0x00F8E3DC,0x00F8E3DA,0x00FAE5DD,0x00F6E0D9,0x00F6E1D9,0x00FCE4DD,0x00F7DFD9,0x00C1B0A6,0x007F6B63,0x00E4CEC6,0x00ECD5CD,0x00EDD6CE,0x00F1DAD3,0x00F6DFD8,0x00F4DED6,0x00EDD7CF,0x00EFD8D0,0x00F0D9D1 +dd 0x00BDADA4,0x007F7167,0x00DBC7C0,0x00EAD7CE,0x00EAD8CF,0x00EBD6CE,0x00EAD4CC,0x00EAD7CD,0x00ECD9D0,0x00EAD6CE,0x00E6D0C9,0x00E0CAC0,0x009F8E84,0x00877870,0x00E4DAD1,0x00F5E5DC,0x00F2DFD7,0x00EBD5CE,0x00DDC5BB,0x00E0C9BE,0x00E1D1C7,0x00D9CEC1,0x00B9B0A3,0x007D766D,0x00B7ADA2,0x00BBB4A9,0x00BDB6AB,0x00C7C1B6,0x00CCC4B8,0x00D1C5B9,0x00D6C7BB,0x00D6C8BB,0x00D7CABC,0x00D5C9BB,0x00D2C8BA,0x00D4C9BB,0x00D6C9BB,0x00DDCFC0,0x00E4D8C4,0x00ECDFCC,0x00F3E1D4,0x00DED0C6,0x008C8476,0x00D4C5B6,0x00F0E1D3,0x00F3E1D8,0x00F0DFD8,0x00EEDBD4,0x00EEDED7,0x00EADBD4,0x00E9D9D1,0x00EBD9D2,0x00E5D3CD,0x00B5A59E,0x00726058,0x00D3BEB6,0x00EAD5CE,0x00EAD5CD,0x00E4D1C6,0x00DECAC2,0x00E1CDC6,0x00DECAC3,0x00E2CDC6,0x00E3CDC6 +dd 0x0059463E,0x004E4037,0x008A7C73,0x0091837A,0x008F8178,0x00907C75,0x008F7872,0x00907A73,0x008C766F,0x0087726B,0x0086716A,0x0086746C,0x005C4F45,0x0056463D,0x009E8B84,0x00B3A199,0x00AEA297,0x00AB9E94,0x00A9948D,0x009E8981,0x009C9285,0x00969182,0x007C7768,0x005A5447,0x007A7466,0x007F796B,0x00706D60,0x006C6A61,0x00747267,0x007A766B,0x00858075,0x008C877C,0x008B877B,0x00838174,0x007E7C70,0x00878276,0x00978E84,0x00A59A8F,0x00B3A796,0x00B3A796,0x00AD9E91,0x0092847A,0x00544B3E,0x00898273,0x00A39C8C,0x009E9187,0x0093857E,0x008A7C75,0x00877B74,0x007A6F69,0x00726660,0x00736761,0x006D635C,0x00625852,0x00695E56,0x008D7F76,0x008E7E79,0x0086776E,0x007C7061,0x00675B50,0x0067594F,0x006A5750,0x006D5851,0x006E5750 +dd 0x00725E55,0x0076665D,0x0084766C,0x00807368,0x0062544B,0x006A574F,0x007F6961,0x0087716A,0x00856E67,0x00846F68,0x00867169,0x008E7D75,0x00867A70,0x007D7065,0x006E6155,0x00898075,0x00A3A192,0x00A9A698,0x00ABA095,0x00A5988D,0x00A19A8C,0x00999385,0x00918B7D,0x008F897B,0x00938D7F,0x00888275,0x00444135,0x0045453C,0x00605F55,0x0066645A,0x00757368,0x007F7C72,0x007A786D,0x006C6B61,0x005C5A50,0x00514F43,0x00535045,0x00625D51,0x00716A5B,0x00736C5E,0x00776C60,0x00776A5F,0x00685E52,0x006E695C,0x006C695B,0x00474138,0x00534C46,0x0069615B,0x00776F69,0x0078706B,0x00746D67,0x0077706A,0x0077706A,0x0079726D,0x00988F87,0x0090847A,0x006D5F5B,0x004C3F35,0x006F6454,0x0071645A,0x0072635A,0x00746058,0x00776058,0x007C655D +dd 0x00E3CFC6,0x00E5D6CC,0x00E6D9CF,0x00D9CBC1,0x0096897F,0x00AF9D94,0x00D2BCB4,0x00D5BEB6,0x00D5BEB7,0x00DBC4BD,0x00DBC5BE,0x00DCCAC2,0x00D5C8BE,0x00CBC1B5,0x00938D81,0x00AAA397,0x00D0C5B9,0x00D4C8BD,0x00CBC4B7,0x00C7C2B4,0x00C5C0B2,0x00BFBAAC,0x00B9B4A7,0x00B8B2A5,0x00B5AFA1,0x00A9A295,0x00555145,0x007E7C72,0x00ADA99E,0x00B3ACA0,0x00BCB3A7,0x00C7BCB1,0x00CBC0B5,0x00CBC1B7,0x00C7BEB2,0x00C0B8AB,0x00BCB3A6,0x00C3BBAD,0x00CCC4B7,0x00D0C9BB,0x00D6CBBF,0x00D9CBC0,0x00DACBC1,0x00DFCFC6,0x00D6CCC3,0x00877E78,0x00A9A29C,0x00D7CFC9,0x00DDD6D0,0x00DCD4CF,0x00DAD3CD,0x00DAD2CC,0x00D7CFC9,0x00D7CEC8,0x00E1D6CD,0x00E0D3C8,0x00AFA19C,0x0074665D,0x00C9BEAD,0x00E1D4CA,0x00E6D8CF,0x00E3CFC7,0x00E0C9C1,0x00E5D0C7 +dd 0x00EAD7CD,0x00ECDAD1,0x00EDDDD2,0x00E0D0C4,0x0093877E,0x00B4A59D,0x00DAC7BF,0x00D8C5BC,0x00DBC9C0,0x00E2CFC6,0x00E4D1C8,0x00E2D1C8,0x00D8CAC0,0x00CFC4B9,0x00939286,0x00AAA193,0x00D3C4B8,0x00D4C6BB,0x00C8C2B5,0x00C4C1B3,0x00CAC7BB,0x00C8C5BB,0x00BEBBB1,0x00B6B5A9,0x00B1ADA2,0x00A8A196,0x00655F53,0x009A9588,0x00C3BAAC,0x00CDC0B1,0x00D7C6B7,0x00DFCCBF,0x00E1D0C3,0x00E3D3C8,0x00E4D7C9,0x00E5D8CA,0x00E3D6C7,0x00E2D7C8,0x00E5DACD,0x00E5DBCD,0x00E7DBCE,0x00E6D8CC,0x00E4D5CB,0x00ECDDD3,0x00EBE0D6,0x009C928C,0x00B6B0AA,0x00E2DBD5,0x00E5DED8,0x00E0D9D3,0x00E1D9D3,0x00E5DDD7,0x00E0D8D2,0x00E2DAD4,0x00E6DAD2,0x00E9DCD2,0x00CABFB8,0x0080746C,0x00D7C8BA,0x00E7D8CE,0x00EADAD0,0x00E7D2C8,0x00E3CCC3,0x00E4D1C8 +dd 0x00F1E1D8,0x00ECD8D0,0x00EAD3CB,0x00E0CBBE,0x0092867D,0x00A89D96,0x00D7C9C0,0x00DACBC1,0x00DFD1C7,0x00E0D3C8,0x00E0D2C8,0x00DDCEC4,0x00D9CBC1,0x00D6CBC0,0x009A998F,0x00A69C8C,0x00CBC1B2,0x00CEC7BA,0x00C9C4B6,0x00C8C3B6,0x00CECCC2,0x00CDCEC5,0x00BFC0B8,0x00B2B4AA,0x00ADABA3,0x00ACA39C,0x007C746A,0x00AEA898,0x00CCC1B1,0x00D9C7B7,0x00E4CFBF,0x00EBD4C5,0x00EDD6C8,0x00EDD8CB,0x00EDDBCE,0x00EDDCCE,0x00EBDACB,0x00E9D9CB,0x00E9DBCC,0x00E5D9CA,0x00E8DACC,0x00E8DACD,0x00E4DACC,0x00E2DECF,0x00DEDBCC,0x00938D83,0x00B2ABA5,0x00E1D9D3,0x00E2DAD4,0x00DBD4CE,0x00DED7D1,0x00E7E0DA,0x00E2DAD4,0x00E0D8D2,0x00E3D9D2,0x00E4DBD3,0x00CEC7C0,0x00766A65,0x00D4BFB9,0x00E7D1CB,0x00E3CFC5,0x00E0CCBD,0x00DDC9BA,0x00DECEC4 +dd 0x00F7E8DF,0x00EBD7CE,0x00E7D0C8,0x00DCC7B9,0x008C7F76,0x009E948C,0x00D8CAC0,0x00DBCDC3,0x00DED0C6,0x00DCCFC5,0x00DED0C6,0x00D8CAC0,0x00D6C8BE,0x00D4CABE,0x009C9C92,0x00A09686,0x00C7BEAE,0x00CFCABC,0x00D1CBBE,0x00D0C9BC,0x00CFCDC3,0x00CCCEC5,0x00C0C2B9,0x00B2B4AA,0x00AFADA5,0x00A8A09A,0x00746C63,0x00A9A394,0x00C8BCAD,0x00D5C2B3,0x00E2CCBC,0x00EAD3C4,0x00ECD6C7,0x00EBD7CA,0x00EBDACC,0x00ECDBCC,0x00E9D6C6,0x00E7D5C4,0x00E8DAC7,0x00E5D8C4,0x00E8DDC9,0x00E7DDC8,0x00E5DBC7,0x00E7DBCB,0x00E0D3C5,0x0081776F,0x00ABA39E,0x00E1D9D3,0x00DFD8D2,0x00DBD4CE,0x00DCD5CF,0x00E4DDD7,0x00E1DAD4,0x00DDD6D0,0x00DED7D1,0x00E1DAD3,0x00CCC7C1,0x00786C68,0x00D6C0BD,0x00E5CFC8,0x00E0CBC1,0x00E2CDBE,0x00DFCCBC,0x00E0D1C6 +dd 0x00F4E5DB,0x00ECD8CF,0x00E3CDC4,0x00DBC6B8,0x0093877E,0x00A19890,0x00DACCC1,0x00DACCC2,0x00D7C9BF,0x00D4C6BC,0x00D6C9BE,0x00D1C4B9,0x00D3C5BB,0x00D3C9BE,0x009E9D93,0x009F9685,0x00C5BBAA,0x00CEC8BB,0x00D4CEC1,0x00CBC5B8,0x00CAC9BF,0x00C7C9C0,0x00B8BAB2,0x00AFB1A7,0x00AEADA4,0x00AAA29C,0x00756F66,0x00A29F8F,0x00BBB2A3,0x00C2B3A4,0x00CEBCAD,0x00D9C6B8,0x00DDCBBE,0x00DCCDC2,0x00DED1C6,0x00E4D7C8,0x00E4D4C2,0x00E3D3C0,0x00E5D8C4,0x00E2D7C4,0x00E5D7C5,0x00E8D7C6,0x00E7D7C8,0x00E5D7CD,0x00D9CEC5,0x00746B65,0x00A7A09B,0x00E4DDD7,0x00E1DAD4,0x00E1D9D3,0x00E0D9D2,0x00DFD8D2,0x00DCD5CF,0x00DBD4CE,0x00DBD4CE,0x00DDD5CF,0x00C8C2BC,0x007F726E,0x00D7C0BC,0x00E1CAC3,0x00DCC6BC,0x00E1CBBC,0x00DFCBBB,0x00E3D2C7 +dd 0x00D9C9C1,0x00DBCAC3,0x00D3C1BA,0x00CBB9AE,0x00897D74,0x008D837B,0x00C5B8AE,0x00CCC0B6,0x00CBBEB6,0x00C8BCB1,0x00C4B9AB,0x00BEB4A7,0x00C1B7AF,0x00BEB7AF,0x008B8B82,0x00858070,0x009B9587,0x009D9A91,0x00AEADA6,0x00ACACA6,0x00A8A9A3,0x00A6A7A0,0x009C9F9A,0x0091938D,0x00939088,0x008E8780,0x00635D54,0x00838274,0x009F9B8D,0x00A19A8C,0x00A79F91,0x00B3A89D,0x00BDB3A9,0x00C3BDB4,0x00C9C2B9,0x00CDC6B9,0x00D0C8B9,0x00D4CBBC,0x00DAD0C3,0x00DED3C7,0x00DCCFC4,0x00DBCBC2,0x00DACDC6,0x00D4CECB,0x00C6C2BF,0x00706B67,0x00A39D96,0x00E1DAD4,0x00DBD4CE,0x00DAD2CC,0x00D8D1CB,0x00D5CEC8,0x00D2CAC4,0x00D3CBC6,0x00D4CCC6,0x00D3CBC5,0x00BDB7B1,0x007E716D,0x00C6B0AE,0x00D4BFB9,0x00D3BDB6,0x00D5C1B3,0x00D6C4B5,0x00D9CCC0 +dd 0x0064504D,0x006D6160,0x006E6A68,0x006D6761,0x00484039,0x003E362F,0x00514842,0x005A524D,0x00685F59,0x006E665D,0x00635C52,0x005D584F,0x00565450,0x004F4E4C,0x00343431,0x00303126,0x003D3D37,0x00414240,0x004D5254,0x0052585A,0x004C4E4E,0x004C4C4A,0x004A4D4D,0x002E302E,0x002F2922,0x003D3630,0x003B362E,0x003F3E34,0x00434439,0x0042463A,0x0044473D,0x004C4D46,0x005C5E58,0x006B6F6B,0x0070726D,0x0068675E,0x0066655B,0x006D6C62,0x00706A64,0x007C736F,0x00807C76,0x006E7069,0x00757974,0x00767979,0x00737476,0x004B4A49,0x00635F5B,0x00807B77,0x007F7773,0x00807774,0x0074716E,0x006F6D6A,0x00636260,0x00666665,0x006B6866,0x00615E5B,0x00565450,0x004D4947,0x00797173,0x00857D80,0x0083797C,0x007D726B,0x00756A61,0x0069645C +dd 0x00210F0E,0x002F2727,0x004B4C4B,0x004C4B48,0x003D3B38,0x00312F2C,0x001D1A19,0x00141310,0x00414038,0x00625F5C,0x00535056,0x004E4D54,0x00474B4E,0x003D4245,0x001F2024,0x00141915,0x00393E3E,0x004A4E51,0x004F5559,0x004F5558,0x00474B4E,0x00424547,0x003E4346,0x00202322,0x0021201B,0x00333532,0x003F3F3A,0x003C3E39,0x003A3E38,0x00393F38,0x00353B35,0x00323934,0x00333A36,0x0027322F,0x00252F2D,0x00393E3A,0x003A403C,0x003C433F,0x002B2C2C,0x002F2D2F,0x00383C3A,0x00242E2C,0x003B464A,0x0039424A,0x003A434B,0x0039434A,0x00384148,0x0025292E,0x001B1515,0x002D2729,0x003C4045,0x003E4449,0x002F353A,0x00383F44,0x00393C3F,0x00212121,0x00262525,0x00505050,0x005B5A5E,0x0056555D,0x004D4B52,0x0045413F,0x003F3A35,0x0027201B +dd 0x002E221E,0x00353230,0x00535455,0x00505355,0x00464A4D,0x00414648,0x002C3034,0x00111311,0x00494E44,0x00717570,0x0064676D,0x005B5F68,0x00565E65,0x00515963,0x002F323A,0x0013191A,0x0040494D,0x00566065,0x005E6568,0x005F6465,0x00585E62,0x004F575C,0x00464D52,0x002A2E2D,0x002A2E2B,0x00434949,0x00545857,0x005F6662,0x00656C67,0x00616663,0x00585C59,0x00515753,0x004D5653,0x00313E3D,0x00192525,0x003C494A,0x003F4D4F,0x003D4B4E,0x00313C40,0x0022282E,0x00161E1F,0x001F2729,0x0049515D,0x00434F5B,0x00424F5A,0x0047555F,0x00495761,0x00323A42,0x00181617,0x00353336,0x00575C62,0x00525960,0x00454D53,0x0050585E,0x0046494C,0x001F2020,0x00242424,0x00505050,0x00545457,0x0056565E,0x0052535A,0x00494B4D,0x00474849,0x002E2222 +dd 0x005A534E,0x00545556,0x0054595F,0x0051575D,0x004A5158,0x00424A51,0x00353C44,0x00101413,0x003F483F,0x0067716A,0x00656E6C,0x0061696B,0x00626C72,0x0057616A,0x0030373F,0x0012191B,0x003E474E,0x00576169,0x00636A6E,0x006A6E6F,0x00676C70,0x005E676C,0x0052595E,0x00353938,0x00353A37,0x004F5554,0x005F6563,0x00727773,0x007E817D,0x00767A77,0x006B6E6C,0x00616663,0x00596260,0x00424D4E,0x001E2929,0x00404E50,0x00495659,0x00475458,0x00475357,0x00383F45,0x001C2326,0x00232B2D,0x00525A65,0x00505B67,0x004C5863,0x004E5A66,0x0053606B,0x00424C52,0x001D2121,0x00393D3D,0x00555B5F,0x004F565D,0x00495057,0x004A5156,0x00414447,0x00181919,0x00232424,0x004D4E4F,0x00515155,0x005A5A61,0x005A5C63,0x004E5459,0x003B3F45,0x0028191C +dd 0x0056575B,0x004D545C,0x0049525B,0x004B545D,0x004A535D,0x00444D57,0x003A424A,0x00141C1C,0x0038413E,0x005C6565,0x00606A6A,0x0062696C,0x00676D71,0x00596167,0x00313A3C,0x00161D1E,0x00424950,0x005E636B,0x00696D72,0x00707377,0x00717578,0x006B7173,0x005F6568,0x003F4443,0x003C413E,0x00565C5B,0x00696E6C,0x00797C79,0x00828480,0x007C807C,0x00737774,0x00666B69,0x005A6262,0x004A5556,0x002C3839,0x004C595C,0x00546266,0x00515F62,0x00535F63,0x004F585E,0x0030393E,0x001E282B,0x004A545C,0x00525D66,0x00535E67,0x004E5A64,0x004D5962,0x003E4A4E,0x00151E1D,0x002D3536,0x00464D51,0x00464E54,0x00464E54,0x004B5156,0x004F5255,0x00262B2C,0x00242A2C,0x00505457,0x005B5B5F,0x00606064,0x005A5C61,0x0051555B,0x002C2F38,0x001F1419 +dd 0x004B555D,0x0046515B,0x00434E59,0x00454F5A,0x00454F59,0x00464F58,0x00475054,0x00232C2D,0x00333B40,0x004F585E,0x00576065,0x005C6368,0x005B6368,0x00555E63,0x00353F40,0x001F2828,0x00495156,0x0063686C,0x006B7073,0x006E7376,0x006E7477,0x006B7074,0x0060666C,0x003F4547,0x003A4140,0x00565E5E,0x006B716F,0x00767A77,0x007B7E7B,0x00787D7A,0x00727775,0x00666C6A,0x00565F60,0x00485255,0x00344041,0x00515E62,0x00566468,0x00526064,0x00525F63,0x004F5D60,0x00364145,0x00162225,0x003D4A50,0x00505B62,0x00586167,0x004F5860,0x00465059,0x003C474C,0x00151F20,0x002B3437,0x00464E53,0x00444E54,0x00464D53,0x004A4F55,0x00505559,0x003A4144,0x002F3638,0x0055595E,0x005C5D61,0x005D5E61,0x005A5C61,0x0055585C,0x00272B31,0x00202528 +dd 0x00505E62,0x004D5961,0x0046505B,0x0045515A,0x00424E57,0x003F4A54,0x00434D54,0x00293337,0x00303A41,0x004B555D,0x00555E64,0x005B6368,0x00565E64,0x00525B61,0x00364043,0x00222C2E,0x00465057,0x00565E64,0x005E656A,0x00636A6F,0x00676E73,0x00636B70,0x005A6268,0x00373F41,0x00333B3C,0x004E5758,0x00626967,0x006B726E,0x00707673,0x006D7371,0x00676E6B,0x005C6463,0x004E5758,0x003E484B,0x00313C3D,0x00525E62,0x00576469,0x004F5E63,0x004E5B60,0x004B585C,0x00384448,0x00192529,0x003B474F,0x004A555E,0x004D5860,0x0048525A,0x00444D55,0x003D484C,0x00182021,0x00343839,0x00595D60,0x004C5359,0x00474D53,0x00474C52,0x004B5156,0x0041464A,0x00313638,0x0055585C,0x00585A5F,0x00585A5E,0x005A5C62,0x0056595E,0x00262B31,0x00232B30 +dd 0x00505C5F,0x00505C5F,0x00475159,0x00455058,0x00414B54,0x0037414B,0x002E363C,0x001F2729,0x00283034,0x00475057,0x004C555A,0x004E555C,0x004E565C,0x004E5659,0x002F3738,0x00192123,0x003C474D,0x00465157,0x004A5357,0x004F575B,0x00575F63,0x00535C61,0x004B565B,0x002A3436,0x00242E31,0x003D484C,0x004C5556,0x00575F60,0x005E6666,0x0057605F,0x00515A5A,0x004B5555,0x00455052,0x003B4549,0x00283233,0x00485658,0x0048565A,0x003E4B50,0x00374246,0x002F393C,0x00222C2F,0x00141E21,0x00323D41,0x00404C52,0x003F4C52,0x003E4A51,0x00404A51,0x00364146,0x000F1617,0x00272C2C,0x00565A5C,0x00494F51,0x0043484D,0x0042474C,0x00464C51,0x00383E42,0x00252B2D,0x00494D50,0x00535558,0x00515355,0x004D5255,0x00454B4F,0x0023292D,0x00252B2D +dd 0x003C403C,0x00454A46,0x004A4E4C,0x004B4F50,0x003E4245,0x00313438,0x00201F1F,0x000D0C0B,0x000F100F,0x00363835,0x00404240,0x0043444A,0x004B4C50,0x004E504C,0x0031342E,0x00191E1B,0x00353E42,0x00373F41,0x0027302F,0x00242C2A,0x002B3332,0x00394242,0x00364143,0x00162223,0x00182326,0x00323D45,0x003F484F,0x00454C4F,0x0042494A,0x00313C39,0x00293531,0x00293530,0x00323C39,0x003C4747,0x00242F2E,0x002C3B37,0x00293935,0x002C3936,0x0017201E,0x00101614,0x00131716,0x00131716,0x001F2725,0x00303837,0x002C3332,0x002E302F,0x00333635,0x002C3032,0x00121515,0x00161A1B,0x002D302F,0x00393732,0x003B3635,0x003C383A,0x00424446,0x002C3231,0x001B1E1C,0x00333532,0x003B3C37,0x0037352E,0x00232824,0x001B2120,0x00191C1A,0x00181C17 +dd 0x007B7A71,0x00868379,0x00908778,0x00948B7C,0x00828079,0x00757673,0x006F6B67,0x003D3732,0x002D2923,0x005B5A52,0x0062645A,0x00666760,0x006E6F67,0x0075766D,0x006E7168,0x00606661,0x006C7573,0x006E7674,0x00616A66,0x004F5855,0x002D3532,0x00555D5A,0x005E6968,0x003C4849,0x00536061,0x006B777B,0x006F787B,0x006A6E6C,0x005F6561,0x00535D56,0x00505A52,0x00515850,0x00595E56,0x006A6F6A,0x00717874,0x0082908A,0x0083948E,0x00798782,0x00363F3C,0x00404945,0x006C746B,0x007B8479,0x00798276,0x007E8179,0x007E7D76,0x00857C77,0x00847A76,0x007C7876,0x006D6D6D,0x00545555,0x00423A37,0x008D7A6F,0x00A18F88,0x009C8E8A,0x0097908A,0x0086857C,0x007F7E75,0x0088867C,0x0088857A,0x00837D6F,0x00494B41,0x003D413A,0x00797970,0x007A7B71 +dd 0x00C4BCAD,0x00C6BDAD,0x00C7B8A4,0x00C8B9A5,0x00BFBBAE,0x00B4B6AB,0x00ABA8A0,0x005D564F,0x00544F48,0x009C9C93,0x00A1A298,0x00A3A498,0x00A2A397,0x009EA096,0x009A9C93,0x00959B96,0x0097A09D,0x0097A09D,0x00939C99,0x00848D8A,0x00414946,0x00777E7B,0x0098A1A1,0x00838C8C,0x0098A09D,0x00A8B0AB,0x00A9AEA8,0x00A3A39B,0x009C9E94,0x009DA198,0x00ABAEA5,0x00B5B5AB,0x00B7B6AC,0x00B6B6AD,0x00BABCB4,0x00BEC7C0,0x00B0BFB8,0x009DAAA5,0x004E5754,0x00727A76,0x00ACB7A8,0x00B7C3AF,0x00B4BEAD,0x00B3B5AB,0x00B2B3AA,0x00B8B5AD,0x00BBB6AF,0x00BBB6B1,0x00BBB5B2,0x00A19B97,0x0074695F,0x00C6B09F,0x00D3BFAF,0x00CCBEB0,0x00C2B7A8,0x00BFB6A5,0x00BDB4A4,0x00BCB4A4,0x00BCB3A3,0x00BCB09C,0x006E695B,0x005A584C,0x00BFB8A9,0x00C9C2B3 +dd 0x00DACDB8,0x00DCD0BD,0x00D6CEC0,0x00CEC8BC,0x00CECDBF,0x00CCCFBD,0x00BAB8AC,0x00645C56,0x00534E47,0x00A6A79D,0x00B0B0AA,0x00AFAFAF,0x00AAAAAB,0x00ABACA6,0x00A8ABA2,0x009CA29E,0x009AA4A1,0x00A0A9A6,0x009FA8A5,0x008A9390,0x00414A46,0x00878E8A,0x00B1B6B5,0x00A7AAA8,0x00AFB0A8,0x00BEBEB2,0x00C4C1B4,0x00C5C0B3,0x00C8C3B6,0x00CBC6BB,0x00D2CDC1,0x00D7D0C5,0x00D6D0C5,0x00D0CCC1,0x00CBCAC0,0x00C4C9C2,0x00B4BEB6,0x00A0ACA2,0x00454B46,0x006D746D,0x00B3BBAD,0x00BBC5B1,0x00BAC1B0,0x00BDBDB3,0x00BDBFB6,0x00BDC3B8,0x00BEC6B9,0x00C0C2B7,0x00C8C0B8,0x00AFA8A0,0x00787565,0x00C5B9A1,0x00D5C6AE,0x00CFC4AE,0x00C4B8A2,0x00C7B9A4,0x00C1B39E,0x00BEB09C,0x00BEB09C,0x00C1AF98,0x00796D5C,0x00635B4C,0x00C8BCA8,0x00D2C4B0 +dd 0x00D6C8B3,0x00DACFBC,0x00D7D3C9,0x00D2D2C9,0x00D1D1C3,0x00CECEBC,0x00BCBAAF,0x006A6762,0x00514F49,0x00A8A8A0,0x00B6B7B3,0x00B1B4BA,0x00ABAFB5,0x00ABB0AE,0x00AAB0A9,0x00A0A7A3,0x009FA9A6,0x00A7B0AD,0x00A7B0AD,0x008D9792,0x00414A41,0x00959A91,0x00C9C9C3,0x00CCC8C2,0x00CFC8BE,0x00D1C8BD,0x00D3C8BD,0x00DACEC2,0x00DFD4C8,0x00E1D5C9,0x00E2D7CA,0x00E2D7CB,0x00E1D6CA,0x00DBD3C7,0x00D3D0C6,0x00CACCC4,0x00BDC4B9,0x00ADB6A5,0x005B5E53,0x0073756D,0x00B9BCB2,0x00C1C4B9,0x00C3C4B8,0x00CBC7BB,0x00CCC8BC,0x00CDCCBE,0x00CDCDBE,0x00CAC8BA,0x00CCC6BA,0x00ADA79C,0x00746E60,0x00C6BBA9,0x00D3C7B2,0x00D2C8B2,0x00C8BAA8,0x00C7B5A4,0x00BEAD97,0x00BEAF9A,0x00C6B8A3,0x00CABBA2,0x00877C6B,0x00746A5A,0x00D0C2A9,0x00D0C2A9 +dd 0x00CFC2AF,0x00D4CAB7,0x00DBD3C6,0x00DCD7CA,0x00D5D0C1,0x00D1CDBE,0x00C2C1B5,0x00676961,0x0052534B,0x00AFB0A7,0x00BCBEB8,0x00B6BEBD,0x00B6BFBE,0x00AEB7B4,0x00AAB3AF,0x00A7B0AD,0x00A7B0AD,0x00A6AFAC,0x00A5AEAC,0x00959E99,0x003F483D,0x00898F83,0x00CCCCC3,0x00D4D0C8,0x00D8D0C7,0x00D9D0C7,0x00DACFC5,0x00DDD2C7,0x00DED3C8,0x00E1D6CA,0x00E0D6C9,0x00DFD4C7,0x00DDD2C6,0x00D9D1C4,0x00D5D0C6,0x00CCCDC5,0x00C2C9BD,0x00B8C0AE,0x0077796E,0x007F8077,0x00BFC0B8,0x00C2C4BC,0x00C6C6BC,0x00CBC6B9,0x00C8C2B5,0x00CBC5B8,0x00CCC7B9,0x00CEC8BB,0x00CFCABC,0x00AAA396,0x006B6055,0x00BAACA1,0x00C9BDAE,0x00CBC0AD,0x00C5B4A4,0x00CDB3A2,0x00CAB298,0x00CDB7A3,0x00D5C1B0,0x00D0C4B0,0x007B7468,0x00635B4E,0x00C9BFA3,0x00D0C6A9 +dd 0x00DACDBB,0x00E3D9C6,0x00E5DFCF,0x00E1DBCD,0x00D1CBBD,0x00D3CDC0,0x00CAC6BA,0x006D6B61,0x005F5F55,0x00B8BAB0,0x00C2C4BC,0x00C3C6C0,0x00C1C5BF,0x00B6BEBA,0x00B4BEBB,0x00B2BBB8,0x00B0B9B6,0x00ADB6B3,0x00A9B2AF,0x009DA6A0,0x00474F44,0x00858C81,0x00C2C4BE,0x00C8C7C1,0x00CCC9C2,0x00D0CCC5,0x00CFC9C1,0x00CDC8BF,0x00CECAC1,0x00D2CEC4,0x00CFCBC1,0x00CEC7BB,0x00CEC6B9,0x00CDC9BB,0x00CDCDC2,0x00C8CBC5,0x00BFC6BC,0x00B4BBAB,0x0075786D,0x007F8078,0x00C5C7BE,0x00C6C8BF,0x00C7C7BD,0x00CAC5B8,0x00C8C2B4,0x00CAC4B7,0x00CFC9BB,0x00D1CBBD,0x00D2CCBE,0x00AFA89B,0x0060544A,0x0096887E,0x00CEC1B2,0x00D4C8B5,0x00CCB9A7,0x00D3B39E,0x00D1B093,0x00D2B5A1,0x00DBC0B2,0x00CBBCAE,0x00635D51,0x00554E3F,0x00C6BCA4,0x00D9CDB5 +dd 0x00DCD0BC,0x00DFD5C2,0x00DAD4C5,0x00D7D2C4,0x00CFC9BB,0x00D0CABD,0x00C4BDAE,0x00766E5C,0x006A6557,0x00B5B6AC,0x00BFC1B7,0x00C4C2B7,0x00C0BFB4,0x00B6BCB8,0x00B4BEBB,0x00B4BEBB,0x00B2BBB8,0x00AEB7B4,0x00A9B2AF,0x009AA49E,0x00475045,0x00737C71,0x00AFB5B0,0x00BCC0BC,0x00BCBFBA,0x00BBBDB9,0x00B6B8B2,0x00B4B6B0,0x00B4B7B1,0x00B1B6AF,0x00AEB3AB,0x00B1B2A7,0x00B9B7AB,0x00B9BBAD,0x00BBC0B7,0x00B4BAB6,0x0098A198,0x00889280,0x00606458,0x0073746C,0x00B9BAB1,0x00B9BBB2,0x00BCBDB4,0x00C4C0B4,0x00C0BAAD,0x00BFB9AC,0x00C7C1B4,0x00CBC5B7,0x00C9C3B6,0x00A69F92,0x0051463A,0x007A6C62,0x00CBBEB0,0x00D1C5B2,0x00CFBFAF,0x00CFB8AB,0x00C8B29B,0x00C5B49F,0x00CCBCAA,0x00B6AB9F,0x00585145,0x005E5646,0x00BFB3A4,0x00D0C3B3 +dd 0x008C806E,0x00877C6B,0x007A7365,0x006E685C,0x00746C5E,0x00746C5E,0x00766B5A,0x00665844,0x005E5442,0x007B796E,0x00838176,0x00888172,0x007E7868,0x00777A72,0x00717874,0x0067716E,0x006A7370,0x006A7370,0x0069726E,0x0058635D,0x00283127,0x00394238,0x00616964,0x00666D6A,0x00626764,0x00626562,0x00585C57,0x00545953,0x00555A53,0x00555C53,0x005C6359,0x0062695F,0x00727770,0x007C827B,0x00777E79,0x005D6562,0x004F5752,0x005C655B,0x004E504A,0x004E4F4B,0x006D6E68,0x006A6B65,0x0073736D,0x00706B63,0x006D675B,0x00757062,0x007D796C,0x008A8579,0x00858075,0x007A7469,0x005A4F45,0x00706259,0x00968A7E,0x009C9284,0x00A59C91,0x00867F7D,0x00736E62,0x006F705A,0x006F7059,0x00696658,0x00413B2E,0x00443C2A,0x0070655B,0x007B6E65 +dd 0x00A8968C,0x00A39087,0x0073645F,0x0046352E,0x00806A54,0x009C876C,0x00A38C73,0x00A18874,0x0099836D,0x00A18F78,0x00A08E78,0x00978671,0x008B7C67,0x008E8471,0x00666155,0x003A423C,0x005E6864,0x0068716E,0x006A7370,0x0067706D,0x0068726E,0x00747D79,0x00727B78,0x00333A38,0x00272623,0x004D4743,0x004D4A44,0x004C4E45,0x004F4F45,0x00504D40,0x00514E41,0x004C5248,0x00505955,0x00727A77,0x00969D9A,0x008A9390,0x00959E9A,0x00A2ABA7,0x00A4A7A5,0x00ABABAB,0x00B5B5B5,0x00B5B5B4,0x00B4B3B3,0x00797474,0x00665E57,0x00A19E91,0x00ABACA1,0x00B4B3AA,0x00B5AEA7,0x00BEB6B0,0x00C2B9B3,0x00C2B8B1,0x00BDB7AF,0x00B8B7AD,0x00BCBAB2,0x0075716D,0x0072675A,0x008D816E,0x00928672,0x009A8C7C,0x009C8C7E,0x00998B7B,0x009A8E86,0x009B9087 +dd 0x00EBD5CC,0x00E6D0C7,0x00AD9B96,0x0075635A,0x00D8C4A6,0x00F1DEBA,0x00E8CCAF,0x00DBBEA9,0x00E2C7AF,0x00F0D9BC,0x00F0D8BC,0x00E9D5BC,0x00EBDCC2,0x00E2D5BD,0x00897D6F,0x004F5751,0x00A0AAA7,0x00ABB4B1,0x00A6AFAC,0x00A2ABA8,0x00A4ADAA,0x00AAB3B0,0x009EA7A4,0x0049524E,0x005E5C56,0x00B0A9A0,0x00B4B0A6,0x00B3B3A9,0x00ACA99F,0x009E9789,0x009C9588,0x009A9F94,0x00717A76,0x006F7875,0x00ABB4B1,0x00A5AEAB,0x00B0B9B6,0x00BDC5C3,0x00C2C6C5,0x00CACACA,0x00CECECE,0x00CECECE,0x00CCCBCB,0x00898385,0x00675F5B,0x00C2BFB3,0x00C9CBC2,0x00C8C8C0,0x00C8C2BC,0x00D7D0CA,0x00E1D9D3,0x00DED6D0,0x00DCD8D0,0x00D1D2CA,0x00C9CAC3,0x00837C76,0x00A99788,0x00E1CBB9,0x00E5CFBF,0x00E4CFC3,0x00E2CDC6,0x00E1CDC5,0x00E1D2C8,0x00E2D6CA +dd 0x00EFDAC9,0x00EED8C8,0x00B6A498,0x00786456,0x00E0C2A1,0x00FBDDB8,0x00F5D6B9,0x00DFC3AE,0x00E0C4AD,0x00F2D8BB,0x00F2D8BB,0x00E0CBB2,0x00ECDAC1,0x00EBD8C0,0x008D7F70,0x00555C55,0x00A9B3B0,0x00B1BAB7,0x00AEB7B4,0x00ADB6B3,0x00A9B2AF,0x00ABB4B1,0x00A7B0AD,0x005E6662,0x00666659,0x00B5B09E,0x00BDBBAC,0x00C1C1B6,0x00BBB7AC,0x00ABA193,0x00A79E91,0x00A9ACA0,0x007A827E,0x00757E7B,0x00B0B9B6,0x00B6BFBC,0x00B8C1BE,0x00BFC8C6,0x00C5C8C7,0x00C9C9C9,0x00CBCBCB,0x00CFCFCF,0x00CFCFCF,0x00979294,0x00655E59,0x00C9C6B9,0x00D0D1C7,0x00C7C8BF,0x00CCC7C1,0x00D9D2CC,0x00DED6D0,0x00DDD5CF,0x00E0DBD4,0x00DADCD3,0x00CDCEC7,0x00817B75,0x00AB988B,0x00EFD8C7,0x00F0DACB,0x00F0DAD0,0x00EFD8D3,0x00EED7D0,0x00F2DECE,0x00F3DECD +dd 0x00E3D0B7,0x00EBD6BE,0x00BEAD99,0x0085745F,0x00E5C5A1,0x00F8D6B2,0x00F5D7BA,0x00E7CAB6,0x00E7CBB4,0x00F4D9BC,0x00F7DDBF,0x00EBD7BE,0x00EDDBC2,0x00E9D7BD,0x00908474,0x00565D55,0x00A4AEAB,0x00ABB4B2,0x00ABB4B1,0x00ACB5B2,0x00A9B2AF,0x00ACB5B2,0x00AAB3B1,0x006E7672,0x006A6A58,0x00B3AF96,0x00C2C0AE,0x00C5C3B9,0x00C2BCB2,0x00BCB1A3,0x00B7AEA0,0x00B3B4A9,0x008F958F,0x008C9390,0x00B3BBB9,0x00C2CAC7,0x00BFC8C5,0x00BDC5C2,0x00C2C7C6,0x00C8C9C9,0x00CDCDCE,0x00CECFCE,0x00CBCBCB,0x00999496,0x0059524E,0x00C5C0B5,0x00D6D6CD,0x00D2D3CA,0x00DBD6CF,0x00E1DAD4,0x00E2DBD5,0x00E6DED9,0x00E3DFD8,0x00E0E2D9,0x00D9DAD2,0x008B867F,0x00A39284,0x00EAD3C1,0x00EAD5C4,0x00E3CFBC,0x00E2CDB8,0x00E2CCB7,0x00EAD1BB,0x00E4C9B4 +dd 0x00E3CEB7,0x00E7D2BC,0x00BBA892,0x00746349,0x00DFBFA0,0x00F9D8BD,0x00FCDBC5,0x00F7D4C4,0x00F4D2BE,0x00FBDBBE,0x00FDE0C1,0x00F6E2C7,0x00F2DBC2,0x00ECD6BA,0x008C8272,0x00525850,0x00A6ACAC,0x00AFB6B8,0x00ACB5B2,0x00ACB5B2,0x00A9B2AF,0x00A6AFAC,0x009FA8A6,0x005D6561,0x00656455,0x00B9B39E,0x00C6C2B6,0x00C4C1BD,0x00C2BDB7,0x00C3BCB1,0x00C2BCB1,0x00B9BBB3,0x008E8F88,0x007C7E7A,0x00B8BAB9,0x00C6CAC9,0x00C1C9C5,0x00BBC4C0,0x00C3CBC8,0x00C8CFCC,0x00CACFCD,0x00CDCFCF,0x00C9CAC9,0x00A5A1A0,0x005C5550,0x00C1BCB2,0x00D7D7CC,0x00D3D5CA,0x00D9D6D1,0x00E0DCD9,0x00E1DCD5,0x00E7E1D6,0x00E5DFD6,0x00E4E1D9,0x00E2E0D8,0x00969089,0x00A28F82,0x00ECD6C3,0x00EFDAC8,0x00E4D0B8,0x00DFCBAC,0x00DFC8AA,0x00E7CAB2,0x00E6C7B3 +dd 0x00EED5CA,0x00EFD7CB,0x00C0A99D,0x006A5B44,0x00DEC4AC,0x00FDE8D4,0x00FFE3D2,0x00FAD4C6,0x00F2CCB9,0x00FCDCC0,0x00FEE3C5,0x00FAE7CB,0x00FBE3C9,0x00F0DCBE,0x00918B7A,0x005E625A,0x00B0B0B2,0x00B4B8BD,0x00AEB7B5,0x00B3BCB9,0x00B1BAB7,0x00A9B3B0,0x00A5AEAB,0x00616965,0x006C6C60,0x00BFBBAC,0x00C4C2B5,0x00C1C1B5,0x00C1C0B4,0x00BDBAB0,0x00BBB9AF,0x00B6B9B3,0x00878880,0x006E6E69,0x00B9BAB9,0x00C3C5C4,0x00C7CECB,0x00C9D2CF,0x00D2DAD7,0x00D7DFDC,0x00D2DAD7,0x00CED1D0,0x00D0D0CF,0x00B5B1AE,0x0069615B,0x00C6C0B9,0x00DEDED6,0x00DADCD3,0x00DBDBD8,0x00E4E3E3,0x00E3E1DA,0x00E8E2D3,0x00E9E3D5,0x00EDE6DE,0x00EBE5DE,0x00948D85,0x008C7B6E,0x00EEDBC8,0x00FAE4D2,0x00F5DECB,0x00EFD8C3,0x00EDD4C0,0x00F1D3C2,0x00F4D6C6 +dd 0x00E0CCC6,0x00D6C2BD,0x00AC9796,0x00685B4F,0x00CFBCA6,0x00EDE1C7,0x00EEDFC4,0x00E9D2B6,0x00E5CDB3,0x00EFDDC7,0x00F1E1CB,0x00EEE5CD,0x00F2E5CF,0x00E2D9C2,0x00868476,0x005D6057,0x00B4B5B0,0x00BBC0BE,0x00B9C2C0,0x00B3BCB9,0x00A5AEAB,0x00A3ACA9,0x0097A09C,0x00585F5C,0x006D6F69,0x00C0C1B9,0x00BCBEAF,0x00B8BBA5,0x00BABCA9,0x00B6B5AA,0x00B1B0A7,0x00AFB4AE,0x0081847C,0x0071716C,0x00B5B6B4,0x00B7B9B8,0x00B7BDBF,0x00BAC1C5,0x00BDC5C6,0x00BFC7C5,0x00BBC4C1,0x00B5B8B7,0x00B4B4B3,0x00969390,0x005E5651,0x00A7A19C,0x00C5C4C0,0x00C7C7C4,0x00CBCCCB,0x00D4D4D5,0x00D3D0CE,0x00D7D0C8,0x00D6CFC7,0x00DAD2CC,0x00D1CBC5,0x007A7773,0x005D534A,0x00D4C7B9,0x00EEDFD0,0x00EDDBCD,0x00ECDACC,0x00ECD8CB,0x00ECD4C8,0x00EED3C8 +dd 0x006A605E,0x00675B5D,0x005C4E57,0x00443D3E,0x00796F66,0x00878375,0x00868373,0x00817963,0x00807865,0x008C8479,0x00989084,0x00989585,0x00988E80,0x00827C71,0x00434339,0x003B3C35,0x00818477,0x0080877B,0x007F8884,0x00666F6C,0x004F5855,0x005C6562,0x004B5350,0x00222725,0x00494E4C,0x00898F8D,0x00848780,0x0085877A,0x00828378,0x007B7C73,0x0073746C,0x006B706C,0x0041443C,0x003A3B35,0x00686868,0x00737475,0x00646870,0x005A616D,0x00586068,0x005A6361,0x005C6561,0x00535655,0x00464645,0x00474441,0x003C352F,0x00443D39,0x00454346,0x00424147,0x0049494C,0x00505050,0x004D4949,0x00504647,0x004F4646,0x00504843,0x004B443F,0x00333435,0x00292421,0x006E645C,0x00817770,0x0080766F,0x00837A71,0x008A7F77,0x0085746E,0x00846F6B +dd 0x00453F44,0x004C464D,0x00534B5B,0x004F4D58,0x00504D55,0x004B4D56,0x0044464A,0x002A2823,0x00201E19,0x002D2B29,0x0032332E,0x00282B21,0x00302B24,0x002C2D29,0x00171B16,0x001E201A,0x00323524,0x002C3223,0x003B4441,0x003A4343,0x003E4747,0x00485150,0x003F4847,0x00333C3A,0x003E4747,0x004B5455,0x00474C4E,0x004A4C4D,0x003F4142,0x00353732,0x00262720,0x00191B18,0x001D201A,0x00434642,0x005D5E60,0x00686A6D,0x0050555F,0x00454B5B,0x00464D58,0x004E5758,0x00565F5E,0x0056595A,0x00484749,0x003B3837,0x00312B26,0x003D3836,0x0035333A,0x00292933,0x00313237,0x0037393B,0x00343134,0x0032292F,0x002E252A,0x00231C18,0x00201B17,0x0025292C,0x00222225,0x00352F2C,0x00413B38,0x0044403C,0x0045403C,0x004D4743,0x003A2D2C,0x002F2121 +dd 0x005E5B62,0x005B5861,0x005F5C68,0x0062616C,0x0064626C,0x00646471,0x0064646F,0x00414144,0x002D2F2D,0x00373C3F,0x00373C40,0x00323439,0x00434349,0x0042474D,0x0032393D,0x0031373B,0x00282924,0x002E302B,0x004E565A,0x00545B61,0x00555E63,0x00586064,0x00565D61,0x00596165,0x00575E65,0x00595E66,0x00595F63,0x00595F61,0x004F5357,0x003A3B3C,0x0023251F,0x00232521,0x00303733,0x005B6461,0x00646B70,0x00636A6F,0x0050575E,0x004D545C,0x004A5158,0x00485055,0x004E555A,0x005C5F65,0x005A5960,0x00393538,0x002D2926,0x00595C5E,0x00525762,0x00464B59,0x004A4F5B,0x004C515C,0x004F505B,0x004F4B55,0x00464249,0x00292727,0x002B2928,0x004E4F54,0x005C5B63,0x00666166,0x00706A6C,0x00777071,0x006E6769,0x006B6466,0x00473E40,0x00362C2D +dd 0x00626068,0x00615F68,0x00626069,0x0065646D,0x006A6971,0x006E6D76,0x006E6D76,0x004C4C4F,0x00363835,0x00484E52,0x00585E64,0x0063646A,0x006D6C73,0x005C6067,0x00444B52,0x003F454C,0x0030302F,0x00323331,0x00525A60,0x00565E64,0x00585F65,0x005B6267,0x005A6166,0x005C646A,0x00585F66,0x005F636B,0x00616669,0x005F6565,0x005C6062,0x00494A4A,0x002E3029,0x00373935,0x00363C3A,0x00495250,0x00555D61,0x006A7177,0x00575F65,0x0051595F,0x00535A60,0x0050575D,0x00545B62,0x005F6169,0x0062606A,0x003E3B3F,0x002A2522,0x00515559,0x00535A66,0x00515765,0x00555B68,0x00535A67,0x00545864,0x00575660,0x004F4E56,0x00333335,0x00333232,0x005E5D63,0x006C6A74,0x006D686F,0x007B7175,0x0081787B,0x0071676B,0x006E6569,0x0050474A,0x00362E30 +dd 0x00636068,0x0063626A,0x0063626B,0x00686770,0x006A6972,0x006C6B74,0x006C6B74,0x004F4F52,0x003B3E39,0x00575E61,0x006B7175,0x00808281,0x00878886,0x006A7073,0x00495157,0x0042494F,0x00333332,0x00262625,0x004B5259,0x00586066,0x005C6369,0x00596065,0x00545C61,0x00535A60,0x00545961,0x005A5F65,0x005E6365,0x005F6464,0x00616567,0x005B5B5B,0x003A3B34,0x00424440,0x00434946,0x00515958,0x005F686B,0x007E858B,0x00676F75,0x0060686E,0x00656C72,0x005C646A,0x00596167,0x005C5E66,0x0066656E,0x004E4B50,0x002E2926,0x00474B4E,0x00565E69,0x005B616F,0x00575D6A,0x00535967,0x00545865,0x005C5B65,0x0057555E,0x003B3B3D,0x003A3A3B,0x006A6A6F,0x0073717A,0x006D686F,0x00786F72,0x007F7578,0x006A6163,0x00655C5F,0x00595053,0x0040383A +dd 0x006B6870,0x00696770,0x00696771,0x006F6D76,0x006C6B74,0x00696870,0x00696871,0x004E4E51,0x003B3F3A,0x005A6264,0x00737A7D,0x008A8C86,0x0083847D,0x00636869,0x00495158,0x00474D53,0x003C3B3B,0x002D2D2C,0x00484F55,0x00565D64,0x00585F65,0x0051595F,0x004C545A,0x004A5258,0x0050565F,0x00565C64,0x005B6064,0x005D6263,0x005A5D60,0x004F4E50,0x00343530,0x00383B37,0x003C4340,0x00535C5A,0x006B7477,0x00798187,0x00676F75,0x00676E75,0x00666D73,0x00565E64,0x0050575E,0x0052555E,0x005E5D66,0x00504D52,0x00373230,0x004D4F53,0x00545C68,0x00525967,0x004A505E,0x00464C59,0x004E515E,0x005C5C66,0x005F5E67,0x00454448,0x00404041,0x006D6E72,0x006C6A73,0x0068626A,0x0072696C,0x00766D70,0x00685F61,0x00665D60,0x00655C5F,0x0051484B +dd 0x00817B86,0x0076707C,0x00716B77,0x0077717C,0x00726C77,0x006D6673,0x0066616E,0x00413F48,0x0038393E,0x005C5F67,0x0074767F,0x007E7E82,0x006E6D70,0x005B5C63,0x00555760,0x004E4B4E,0x00433735,0x003D3838,0x004A5156,0x0051585E,0x0052595F,0x004E575C,0x004D5558,0x004C5558,0x00505661,0x00555B67,0x00565D64,0x00545B5E,0x004F5357,0x00404045,0x00313332,0x002C332C,0x00303737,0x004C525A,0x00747B82,0x00788182,0x006D7676,0x006E7777,0x006D7677,0x005C666B,0x00555E67,0x00555A62,0x005C5C62,0x004F4A4D,0x00403033,0x00524A56,0x00505567,0x004E5567,0x004E5466,0x004B4E60,0x0047495B,0x00515560,0x00585D65,0x0046444A,0x003E3A3D,0x00676568,0x006A6A6E,0x00676464,0x006D6663,0x00676065,0x00655B64,0x00665C65,0x00645B60,0x00534A4D +dd 0x00746B6F,0x0070676B,0x006B626A,0x00685F6A,0x00635863,0x00645965,0x00584E57,0x0033292E,0x0031292B,0x00545353,0x0069696A,0x006F6E73,0x0065646B,0x0065636C,0x00696770,0x00544A4D,0x003A2928,0x00332D2F,0x0041484E,0x00464D53,0x00495156,0x004B5357,0x004C5251,0x00484F4D,0x00444A51,0x00444A54,0x00444B53,0x00444B50,0x00444848,0x00393A34,0x002A2E24,0x00293228,0x00333A3A,0x00424853,0x005C6469,0x005F6966,0x006B7571,0x007A837F,0x007E8783,0x0068706E,0x005F6664,0x005A5F5E,0x00606161,0x00545050,0x004B3738,0x005D4E57,0x0063636E,0x00656B74,0x00646670,0x00605865,0x00514A56,0x00504F53,0x00555758,0x00464240,0x00342D2B,0x00615D5B,0x006B6B6B,0x0062605A,0x00666057,0x00625A5D,0x00665D63,0x00665D61,0x00584F52,0x0041383B +dd 0x003C342E,0x00423A31,0x00403836,0x003D3438,0x003C3338,0x003C3236,0x00362929,0x003A2622,0x0043332B,0x003D3C30,0x003C3E34,0x004D4D4B,0x005F5F60,0x0065646A,0x00595760,0x00383238,0x00271E21,0x0029272C,0x00384046,0x003A4248,0x00343C42,0x002E3337,0x0035352F,0x0031322B,0x00252A2A,0x0020282B,0x001F272C,0x00242B31,0x002B312F,0x002D2F25,0x00252A1D,0x00242D23,0x00222927,0x00283030,0x003E4841,0x00424B47,0x00444D4F,0x00505957,0x005B645F,0x004D5345,0x00434734,0x003C4030,0x00393B35,0x003E3C3F,0x00433A35,0x004A423A,0x004D4B43,0x0052564C,0x00535049,0x005C4A46,0x00594743,0x004D413A,0x00443B32,0x00332A21,0x001E1713,0x0046413D,0x00494948,0x00393835,0x0049403B,0x00564543,0x0050463E,0x004C453C,0x00342C2B,0x00271F22 +dd 0x00554D4D,0x00514847,0x00372E2D,0x002B231F,0x003A322E,0x003C3531,0x00504644,0x00594D4E,0x004D4444,0x003D3C39,0x0031322F,0x0033342E,0x00373832,0x003F3F42,0x0046444E,0x0046454E,0x004B4951,0x00484A50,0x00495056,0x0050565C,0x00474E55,0x00303437,0x00242016,0x00181409,0x0020251F,0x00222B28,0x00222A2B,0x00252C31,0x00303538,0x003A3B3B,0x00383B38,0x00303730,0x00232B26,0x00192316,0x001C2815,0x0018221A,0x001E262F,0x002B3334,0x002A322E,0x00202316,0x001F1C0C,0x00262413,0x0027271D,0x004F4E58,0x0058595E,0x0057554E,0x00524D42,0x005B574D,0x00575047,0x00493D35,0x0052443D,0x00473F3A,0x00393430,0x00302828,0x00292125,0x00403B3C,0x00494A49,0x00434242,0x00584B4B,0x00624443,0x00453633,0x004A413F,0x00463E3F,0x004F464A +dd 0x00827883,0x007F7481,0x00695F63,0x004E4542,0x00645B58,0x00645D59,0x00716C6B,0x006D6D75,0x00696973,0x0061606A,0x0053525A,0x00504D4C,0x00494642,0x004C4A4F,0x0053525B,0x005C5C65,0x00686771,0x00676870,0x0064686B,0x006A6E70,0x00696D70,0x0057585B,0x00342D27,0x002A2517,0x00525751,0x00545D5E,0x005A6266,0x00596065,0x0053585F,0x00595B63,0x00575A5E,0x004C5150,0x003B413E,0x0021291A,0x00131F0D,0x002A3430,0x00555C68,0x00636B6F,0x00525B5B,0x003C3D3A,0x00302A24,0x00423B31,0x00393930,0x005B5C69,0x005C6173,0x00616169,0x005D5558,0x006F676B,0x006F696B,0x003F3E3B,0x004F4D4B,0x00535759,0x00545A61,0x00545060,0x00574C60,0x005A525F,0x005E5B5F,0x00666367,0x0077696E,0x00725555,0x004D3F43,0x005A535D,0x00645B63,0x006E656A +dd 0x00756A76,0x00786F7B,0x00736A72,0x004F4649,0x00655B5E,0x0071696B,0x007E787C,0x0077767F,0x0077767F,0x006C6B74,0x00605E67,0x00605A5E,0x0061585C,0x0059565D,0x00585760,0x0064636C,0x0077757E,0x007D7C82,0x00767677,0x00767576,0x00777777,0x00626062,0x00372F2F,0x0038332A,0x005C6161,0x005A6269,0x0061696F,0x00596065,0x00525960,0x00596068,0x005D6268,0x00595D61,0x0055565A,0x0031332B,0x001E241F,0x00454B53,0x006A707E,0x006F7580,0x00626975,0x004A5058,0x00282729,0x00322D28,0x003D413E,0x00555B66,0x00585C69,0x0062616B,0x005D5A63,0x006A6770,0x006E6D71,0x0041423C,0x00625A57,0x006D6A6B,0x0064646F,0x005B5565,0x005F5463,0x00665B67,0x00625863,0x00706772,0x00756B73,0x00695E5A,0x0045423D,0x0056555A,0x00615A65,0x006B616C +dd 0x00716672,0x00706572,0x00635A63,0x00433A3D,0x005E5558,0x00726A6D,0x0080797D,0x006B6971,0x00626069,0x00615F68,0x00615E66,0x00696266,0x006C6468,0x00605C64,0x005B5A62,0x00696871,0x0075737B,0x0076757A,0x0069696A,0x006E6E6E,0x007C7C7C,0x005D5B5A,0x002D2622,0x00332D27,0x004B4F52,0x00565E64,0x00626A70,0x00474E54,0x003E464D,0x00474E57,0x0051565E,0x00555A5E,0x0057585B,0x002C2D28,0x00222626,0x004F555F,0x00636976,0x00666C7A,0x00676E7C,0x00575E69,0x002D2E32,0x00201B16,0x00414744,0x005C636C,0x005D5F6B,0x00696770,0x0064616B,0x0063626A,0x0065656A,0x003A3B34,0x006A605B,0x007D7777,0x0062616A,0x005E5866,0x00665C68,0x00766B76,0x00716672,0x00796F7B,0x00726771,0x0069625F,0x0046433D,0x005A565B,0x00645D68,0x006F6671 diff --git a/programs/free3d04/trunk/wall7.inc b/programs/free3d04/trunk/wall7.inc new file mode 100644 index 0000000000..483a07b02e --- /dev/null +++ b/programs/free3d04/trunk/wall7.inc @@ -0,0 +1,64 @@ +dd 0x00CADFE3,0x00C1D6DA,0x009DB2B6,0x008A9EA2,0x00A0B4B8,0x009AAEB2,0x00A3B7BB,0x008EA2A6,0x005B6F73,0x0085999D,0x00B5C9CD,0x00B6C5CB,0x00A9B4BC,0x009FAAB2,0x00A3AEB7,0x00B5C0C3,0x00C5D1CC,0x00C7D4CF,0x00C1CEC9,0x00BEC8C4,0x00BBBEBC,0x00888888,0x008B8B8B,0x00979797,0x008F9693,0x00A4B0AC,0x00B5C1BD,0x00B2BEB9,0x0095A1A2,0x0096A0A8,0x008D96A0,0x00869297,0x006E7879,0x006D7472,0x0079837F,0x0079837F,0x00444C48,0x005F6969,0x00788484,0x00859191,0x0098A5A4,0x0097A5A2,0x008E9B97,0x0093A29D,0x0099A7A3,0x009FAEA6,0x00A4B6AA,0x008F9693,0x00676B73,0x0089979D,0x0083969A,0x007F9397,0x009EB2B6,0x009CB0B4,0x0076898E,0x007F9296,0x00819397,0x007C8E94,0x0085999E,0x009DB2B6,0x0095AAAE,0x0095AAAE,0x00A8BDC1,0x00B9CED2 +dd 0x00CADFE3,0x00CDE2E6,0x00A3B8BC,0x008B9FA3,0x009FB3B7,0x00A4B8BD,0x00A2B6BB,0x0090A4A8,0x0075898D,0x0099ADB1,0x00B9CDD1,0x00BFCED4,0x00AEBBC2,0x00A2AEB5,0x00A7B4BC,0x00AEBBC0,0x00B6C2C2,0x00B5C1C0,0x00B2BEBD,0x00BAC4C4,0x00B5B9BB,0x008C8B8C,0x00928E91,0x00ACA9AD,0x00A2A8AA,0x009CAAA9,0x00B2BEBD,0x00B1BDBD,0x0098A4A6,0x00949FA2,0x008C989B,0x008B9697,0x007B8384,0x007A8080,0x00878F8D,0x007E8784,0x00404645,0x004C5555,0x00717C7C,0x007D8989,0x008D9999,0x008D9B9A,0x00869393,0x008F9C9B,0x00919E9E,0x0096A5A0,0x009AABA1,0x00909694,0x006F727B,0x008A979D,0x008DA1A5,0x0096AAAE,0x009DB1B5,0x0082979B,0x00596C71,0x0062767A,0x007D9095,0x0086999E,0x0074888D,0x0084989C,0x0093A7AB,0x00AFC3C7,0x00BFD3D7,0x00B9CED2 +dd 0x00DEF3F7,0x00D9EDF1,0x00ABBFC3,0x00788D91,0x00576C70,0x0053686C,0x00475C60,0x004A5E62,0x004D6165,0x006D8085,0x00778A8E,0x0085989C,0x0076898E,0x0052656A,0x0044575C,0x002A393F,0x00273239,0x00273138,0x003F4A50,0x0068737B,0x007E878E,0x00716E71,0x008D8189,0x00B7ACBA,0x00A8AAB5,0x009DA9B0,0x00ACB7BE,0x00A6B1B9,0x009AA7A9,0x0095A29E,0x008B9995,0x00899691,0x007C8884,0x00798480,0x00828D89,0x0078817D,0x003A3F3E,0x003C4242,0x00464E4E,0x00464C4C,0x00505757,0x004D5757,0x00465353,0x004E5B5B,0x00586465,0x005F6B68,0x005B6864,0x00595F62,0x004B5059,0x00535F67,0x00586C70,0x005F7478,0x00596E72,0x004A5F63,0x00445359,0x0058656B,0x00738187,0x007D8C92,0x006A7A81,0x00879B9F,0x00A6BABE,0x00BFD4D8,0x00C1D5D9,0x00B4C8CC +dd 0x00D8ECF0,0x00CCE1E5,0x009FB4B8,0x0054696D,0x0021363A,0x0024383C,0x00314549,0x003E5357,0x00394C50,0x0056696D,0x005A6E72,0x00788C90,0x005B6F73,0x00394E51,0x003F5357,0x001C2E32,0x00253038,0x00374249,0x004B565E,0x00525D66,0x00737B82,0x006C696A,0x00867C81,0x00A89EAA,0x009DA0AB,0x009BA5AE,0x00A2ACB4,0x009CA7B0,0x009CA7AC,0x009EAAA9,0x00929E9D,0x00899391,0x007D8986,0x00788481,0x007B8684,0x007A8481,0x00565D5C,0x006E7372,0x004F5150,0x00515151,0x006F6F6F,0x00767C7C,0x006F7A7A,0x006B7878,0x00768181,0x005A6263,0x005E676C,0x00727B83,0x00757F87,0x00818D95,0x00889CA0,0x008A9FA3,0x00859A9E,0x007B8F93,0x0068757C,0x00717B83,0x00747F87,0x007B858D,0x0085949B,0x00B1C4C9,0x00BDD2D6,0x00C5DADE,0x00BFD3D7,0x00B3C7CB +dd 0x00CADEE2,0x00C9DDE1,0x0098ACB0,0x003F5357,0x0051656A,0x00788D91,0x0084999D,0x008FA4A8,0x0092A6AA,0x00A5B9BD,0x00A9BDC2,0x00B0C5C9,0x006F8387,0x0051666A,0x0063777B,0x003E5156,0x00404C54,0x00636E75,0x007C868E,0x008B939B,0x00AAADAF,0x006D6C6C,0x007A7879,0x009F9EA1,0x00A0A7AD,0x00A5AFB7,0x00ADB7C0,0x00ADB7C0,0x00AAB5BC,0x00B3BDC4,0x00A8B2B8,0x0090999A,0x0087918F,0x00848D8B,0x00838E8B,0x007F8986,0x00616966,0x00909995,0x005D6361,0x006C7070,0x00919595,0x008A9292,0x00818C8C,0x00838F8F,0x00929F9E,0x00717A7C,0x00919BA2,0x00A4AEB7,0x009EA8B0,0x00A1ACB4,0x00A3B1B7,0x00A4B2B8,0x00A7B5BB,0x00A1B0B5,0x006E7A81,0x00767F87,0x00919BA3,0x00A1AAB2,0x00A5B4BA,0x00B6CACE,0x00B8CCD0,0x00BFD4D8,0x00B9CDD1,0x00B4C8CC +dd 0x00B7CBCF,0x00BFD4D8,0x009EB2B6,0x00576C70,0x00889DA1,0x009FB3B7,0x009BB0B4,0x00AABFC3,0x00B6CCCE,0x00BDD2D6,0x00B3C9CC,0x009FB4B7,0x00667B7E,0x005D7177,0x0084989D,0x007B8C92,0x008B969E,0x009DA7AF,0x0099A3AB,0x00A5ADB4,0x00AFB2B3,0x006D6D6D,0x008F8C8E,0x00BFBDC0,0x00BEC3C8,0x00BAC3CA,0x00C7CFD6,0x00C9D1D9,0x00BCC6CD,0x00B7C2C8,0x00AAB6BB,0x0098A3A3,0x00929D9A,0x008B9694,0x00919C99,0x007B8681,0x004F5653,0x00868E89,0x005E6461,0x00687372,0x00838D8D,0x00818C8C,0x00808C8C,0x00899696,0x0095A2A2,0x007D8789,0x0099A3AA,0x00A1ACB4,0x0099A4AC,0x0099A3AB,0x009DA7AF,0x00A4AEB6,0x00B2BCC5,0x00ACB7BF,0x0069737B,0x00767F87,0x0099A3AB,0x00A4AEB6,0x00A3B3B8,0x00AABEC2,0x00B0C4C8,0x00B4C8CC,0x00B3C7CB,0x00B6CACF +dd 0x00AFC3C7,0x00B8CDD1,0x0099AEB2,0x00556A6E,0x0095A9AD,0x00A3B8BC,0x00A0B5B9,0x00ABC4C6,0x00B6D2D3,0x00BCD9DA,0x00B3D1D2,0x009BB1B5,0x0078858C,0x0068757D,0x00849198,0x008D99A1,0x00B0BBC2,0x00C1CCD4,0x00BDC8D0,0x00BBC5CC,0x00B2BCBA,0x006F7170,0x006C6366,0x00756B6F,0x006C696C,0x00686A6B,0x00909294,0x009D9FA1,0x007F8585,0x005C6765,0x00485653,0x00505B58,0x005F6664,0x00747A78,0x007F8683,0x005F6662,0x0029312D,0x0037413B,0x00343C39,0x00636C6C,0x007C8585,0x008A9494,0x00929F9F,0x009BA7A7,0x00A0ACAC,0x00879192,0x00949FA6,0x0099A4AC,0x0097A0A9,0x009BA5AD,0x009EABB1,0x00A2B0B6,0x00ADBBC2,0x00A5B2B9,0x00758088,0x00818B93,0x00949EA7,0x00A4AEB7,0x00A4B2B8,0x00A6B9BD,0x00ADC1C5,0x00B0C4C8,0x00B1C5C9,0x00B3C7CB +dd 0x00B0C4C8,0x00ACC1C4,0x0094A9AD,0x0071868A,0x00AABEC3,0x00ADC1C6,0x00A8BBC0,0x00A9C5C6,0x00B3D3D4,0x00B7D7D7,0x00B0D0D0,0x00A2B8BC,0x00848E96,0x00646D76,0x006E7881,0x008F99A1,0x00B8C3CB,0x00C0CAD3,0x00C1CBD4,0x00C3CED5,0x00B5BFBF,0x00585A5A,0x0033282C,0x00312629,0x00322D30,0x00302F30,0x005F5F5F,0x00707171,0x00535857,0x002B3633,0x00212E2A,0x00404C48,0x00555B5A,0x006D716F,0x00777B79,0x006E7572,0x00515C58,0x00414A46,0x003D4341,0x006A6C6C,0x00828384,0x00949B9B,0x0097A3A3,0x009BA8A8,0x00A2AEAE,0x00859091,0x008D979E,0x00939EA6,0x00949EA6,0x0095A1A9,0x0098AAAF,0x009AAEB2,0x00A6BABE,0x00A2B4B9,0x00738087,0x007B868D,0x0095A0A7,0x00AAB4BD,0x00A8B6BC,0x00A8BABF,0x00A9BCC0,0x00AABDC1,0x00ABC0C3,0x00B3C6CA +dd 0x0091A0A6,0x0092A0A7,0x0093A2A8,0x00818F95,0x00869499,0x0077858A,0x007B8A8F,0x0090A7AB,0x00A2BBBE,0x0099B2B4,0x008FA9AB,0x008A9FA3,0x00728288,0x00627378,0x00819197,0x00A6B5BC,0x00BEC9D2,0x00B7C1C9,0x00B7C1CA,0x00BEC7CE,0x00B7BCBD,0x00727374,0x006B686A,0x00636061,0x00464446,0x00323232,0x00444444,0x004D4D4D,0x003D4241,0x0035413E,0x00515D5A,0x00798682,0x0086918F,0x0086908C,0x007F8986,0x00828D89,0x0085908C,0x008B8F8E,0x006E6F6F,0x00717171,0x008A8B8B,0x00969C9C,0x00929D9D,0x0097A4A4,0x00A0ACAC,0x00869091,0x00757D84,0x006D757D,0x00686F77,0x00717982,0x0077878B,0x007F9193,0x008C9FA0,0x008A9B9D,0x00616D70,0x007C878A,0x00909A9E,0x009BA5A9,0x009BA9AD,0x00A1B0B6,0x00A0B0B5,0x0098A8AE,0x008B9CA2,0x009CABB1 +dd 0x0014171E,0x001E222A,0x00232A31,0x00171A20,0x00131517,0x00181C1D,0x002F3537,0x0055666A,0x0064787C,0x003D5055,0x0024383D,0x002F4246,0x004F6367,0x006B8083,0x0097ABAF,0x00A7B8BD,0x00B5C0C8,0x00B6BFC7,0x00B8C1C9,0x00B6BFC6,0x00B9BCBE,0x00808080,0x00676767,0x006C6C6C,0x00737373,0x005D5D5D,0x00555555,0x007C7C7C,0x008F9492,0x00889593,0x00909D99,0x008C9995,0x00818C88,0x007A8581,0x007A8683,0x00899591,0x00929D99,0x00949796,0x00757575,0x007B7B7B,0x008B8B8B,0x008B9191,0x008E9A9A,0x0095A2A2,0x0099A5A5,0x007E8688,0x004F515A,0x002F2F3A,0x0023242F,0x0023252E,0x002D3534,0x00414D4A,0x0044514E,0x0045524F,0x0044504D,0x005C6764,0x004E5A57,0x00505C59,0x00505C5E,0x004D5860,0x00545F67,0x00454F58,0x002D3840,0x003A434B +dd 0x001C2024,0x002F353A,0x001F2324,0x000F1011,0x00181B1B,0x00565F60,0x009BA5A7,0x009CAAAC,0x00485858,0x00263232,0x00414F51,0x00617074,0x0076848B,0x0075848A,0x009BABB1,0x00A2B0B7,0x00AEB8C0,0x00B5BEC6,0x00B7C1C9,0x00B1BAC1,0x00B0B3B5,0x00696868,0x00424242,0x005E5E5E,0x007D7D7D,0x006D6D6D,0x006B6B6B,0x00828182,0x008B8E91,0x008B949A,0x0097A2A4,0x00889391,0x007C8784,0x0088948F,0x008A9693,0x008A9692,0x008F9A96,0x008D908F,0x006E6E6F,0x006E6D6D,0x007E7D7D,0x00848A8B,0x008B9797,0x00909D9D,0x0099A6A6,0x007C8486,0x0052525B,0x0053525C,0x0075747E,0x0083838A,0x008C9392,0x008A9591,0x007F8985,0x00868F8D,0x008B9592,0x00858E8B,0x00727B77,0x00808986,0x00768081,0x0058626B,0x00667078,0x005A636C,0x0049535B,0x00444F53 +dd 0x00A2ADAA,0x00A9B5B2,0x00959F9C,0x00798380,0x007C8783,0x00B0BEB9,0x00CCD8D4,0x00AEBAB6,0x005A6663,0x0077817E,0x0099A5A2,0x009CA6A8,0x00848D96,0x00747E88,0x009DA8B0,0x00A2ADB5,0x00ABB5BD,0x00ADB7BF,0x00AFB9C1,0x00AFB8BF,0x00A6A7A9,0x00545454,0x00404040,0x00555555,0x00606060,0x00555656,0x00696A6A,0x00777878,0x00777C7F,0x00899299,0x00939EA3,0x00848E8E,0x0075807D,0x00818D89,0x0085928E,0x00828E8A,0x0085908D,0x008C8F8E,0x00727272,0x006B6B6A,0x00838282,0x00888E8E,0x00889595,0x00879494,0x00909E9E,0x0070797A,0x00494A4D,0x0078787B,0x009C9C9E,0x009E9E9F,0x00969998,0x00898B8A,0x007D7E7E,0x007E7E7E,0x00838483,0x00878888,0x00898A89,0x009E9F9F,0x00909599,0x0088929B,0x0099A3AC,0x00747D85,0x005A646A,0x007E8988 +dd 0x00B6C2BE,0x00B1BDB9,0x00B6C3BF,0x00B4C1BC,0x00ACB8B4,0x00B8C4BF,0x00B3BFB9,0x0099A5A1,0x0065726E,0x008A9691,0x00919D99,0x00919C9C,0x00858E97,0x00858F99,0x00A2ACB5,0x00A6B0B8,0x00A8B2BA,0x00A1ABB3,0x00A4AEB6,0x00ACB5BC,0x00A1A3A4,0x00606161,0x006F6F6F,0x00717171,0x00717476,0x00707579,0x009EA4A8,0x00ADB3B7,0x00929A9F,0x00929BA3,0x008D969E,0x00828B8C,0x007C8684,0x00838E8B,0x00899592,0x00889390,0x0086908D,0x008A8E8C,0x00737372,0x006D6D6D,0x0089898A,0x008B9191,0x00889393,0x00879392,0x00899493,0x00686F6F,0x00494A4A,0x00858585,0x009B9B9B,0x00979797,0x008E8E8E,0x008A8A8A,0x008A898A,0x00838383,0x007A797A,0x006E6D6D,0x00656463,0x00626261,0x0055595B,0x00828C92,0x009FABB0,0x00667177,0x004C575B,0x0099A5A2 +dd 0x00B2BEBA,0x00B8C5C0,0x00BAC8C3,0x00B0BCB8,0x00A9B5B1,0x00B3BFBB,0x00A9B5B1,0x00A0ACA7,0x0075817E,0x008C9894,0x00939F9B,0x009FAAAA,0x008A949B,0x00808A93,0x009DA7AF,0x009FA9B1,0x00939DA5,0x0097A1A9,0x00A4AEB6,0x00A8B1B7,0x009B9E9F,0x00636363,0x00707070,0x00757575,0x009FA4A9,0x00A9B2BA,0x00B8C2CB,0x00B5BDC6,0x00A8B2B9,0x00A2ACB4,0x008A949B,0x008D9797,0x009AA5A1,0x008D9794,0x007F8986,0x00808A87,0x00818D89,0x00818987,0x00757A7A,0x00726F76,0x008C8890,0x00949499,0x008F9293,0x00898C8C,0x00818684,0x00686A6A,0x00696969,0x009B9B9B,0x00A3A3A3,0x00989898,0x00919191,0x008E8E8E,0x00919191,0x008D8D8D,0x00858585,0x00828282,0x00737373,0x006B6C6C,0x007B817F,0x00A9B5B3,0x00A4B1AE,0x00667370,0x005D6966,0x00A3AFAB +dd 0x00B0B9B6,0x00B8C2BE,0x00B3BEBB,0x00A7B3AF,0x00AEBAB6,0x00BAC6C2,0x00BCC8C5,0x00B9C5C3,0x007A8686,0x008B9798,0x0096A2A3,0x00A5AEB2,0x00858E96,0x0079838B,0x0097A1A9,0x0098A2AA,0x00919BA4,0x00A1ABB5,0x00A3ADB5,0x0097A0A7,0x00898C8E,0x00585757,0x00696868,0x008E8E8E,0x00B5B8BB,0x00B5BBBF,0x00BAC0C4,0x00BFC3C8,0x00B6BDC1,0x009CA6A8,0x00646E70,0x00707A78,0x008C9894,0x00798581,0x006F7976,0x0077827E,0x0077837E,0x0077827F,0x00727A79,0x0067656E,0x007B7580,0x008A878C,0x008C8C8C,0x007F7F7F,0x007F807F,0x00676868,0x00616161,0x00949494,0x009C9C9C,0x00959595,0x00949494,0x00949494,0x00979797,0x00919191,0x00878988,0x008D8F8E,0x007A7B7B,0x00737574,0x008B918F,0x00A2ADAA,0x00909C98,0x005C6864,0x00636F6B,0x00A5B0AC +dd 0x00ACADAD,0x00B4B5B5,0x00B1B4B3,0x00A8B2AE,0x00B4C0BC,0x00BAC6C2,0x00C7D4D1,0x00C2CDD0,0x007F888F,0x00838C93,0x00899298,0x008D959C,0x006C757B,0x0071797F,0x00858C93,0x007D848A,0x00798087,0x007E868D,0x007E868D,0x00868D92,0x00818385,0x00595859,0x006E6E6E,0x008F908F,0x00868686,0x00797A7A,0x007F8080,0x008E8F8F,0x007A7F7E,0x00596561,0x001F2A26,0x001E2825,0x00323D39,0x00323E3B,0x00414C4A,0x004C5854,0x00414D49,0x00474E4C,0x00454948,0x003D3B40,0x004A474D,0x00535155,0x00484848,0x003A3A3A,0x005A5A5A,0x00676767,0x006A6A6A,0x00969696,0x00929292,0x00939393,0x00919191,0x00939393,0x00989898,0x00919191,0x00868C8A,0x00838D8A,0x00727B79,0x006F7775,0x0086908C,0x00838F8B,0x007F8C88,0x005B6864,0x00646E6B,0x00A2A6A5 +dd 0x00A7A7A7,0x00ACACAC,0x00AEB0AF,0x00AEB6B3,0x00B3BEBA,0x00BBC5C2,0x00CCD7D4,0x00C3CBCD,0x008A8C8F,0x00696969,0x00504F4F,0x004F4E4D,0x004B4B49,0x005B5958,0x0053514F,0x00343230,0x00343432,0x00272727,0x00333230,0x004E4D49,0x003F403E,0x001C1D1C,0x002A2E2D,0x00454848,0x00393C3C,0x00414443,0x00515655,0x00606664,0x00565E5D,0x00495455,0x003C4848,0x004F5859,0x005F6565,0x005D6362,0x00676E6D,0x00535F5B,0x003A4542,0x004A4F4D,0x005A5C5B,0x00676767,0x00717071,0x007D7D7D,0x007A7979,0x007B7A7A,0x007E7F7F,0x00666666,0x00696969,0x00989898,0x00979797,0x009C9C9C,0x00939393,0x00909090,0x008A8A8A,0x00808181,0x0078807D,0x0078837F,0x006D7875,0x00687370,0x007A8481,0x0078837F,0x008A9591,0x005F6A66,0x00646C6A,0x009A9B9B +dd 0x00A2A2A2,0x009F9F9F,0x00A3A3A3,0x00A9AAAA,0x00ABAEAD,0x00B8BBB9,0x00C1C4C3,0x00B0B2B2,0x008B8A8A,0x00797876,0x006E6C6B,0x006F6E6C,0x007C7C7A,0x00858483,0x007B7979,0x00757473,0x0080807E,0x006D6E6D,0x007C7B7B,0x008B8C8A,0x00676E6B,0x004C5651,0x005C6864,0x00687370,0x00495552,0x0076817E,0x0099A5A1,0x0095A19D,0x00828E8E,0x00586369,0x00616A72,0x008F969B,0x00A1A5A9,0x00979898,0x00919292,0x005E6764,0x00424E4A,0x0068706B,0x007D837C,0x00898F88,0x00899089,0x008E948F,0x008A908D,0x00919896,0x00888F8D,0x00636766,0x00676868,0x00919191,0x00919191,0x00959595,0x008E8E8E,0x00898989,0x00868686,0x00868686,0x00818483,0x007B7F7D,0x00747978,0x00727676,0x007A7D7D,0x00828583,0x00969898,0x005A5C5C,0x00626565,0x009B9C9C +dd 0x008F8F8F,0x00909090,0x00929292,0x00999999,0x009D9D9D,0x00ADADAD,0x00C1C1C1,0x00B7B8B7,0x00838383,0x00828281,0x008E8D8D,0x00A1A1A1,0x00B1B2B2,0x00ACACAC,0x00A5A5A6,0x00A8A8A8,0x00969898,0x008F9193,0x00AAABAE,0x00AAADAF,0x008F9797,0x00909C9A,0x00A7B3B3,0x009EAAA9,0x00687573,0x008E9B97,0x00A7B3AF,0x009FABA7,0x00929D9C,0x00687176,0x00687077,0x00939BA3,0x009AA1A8,0x00939496,0x00909090,0x0059615F,0x00404D48,0x00727F75,0x00869485,0x00899788,0x00889687,0x0088958A,0x0085918C,0x008A9793,0x008F9C98,0x00737A78,0x006C6D6D,0x008D8D8D,0x008E8E8E,0x008E8E8E,0x00898989,0x00898989,0x00868686,0x00808080,0x007B7C7C,0x00797A7A,0x007A7B7B,0x00818281,0x008C8C8D,0x00959595,0x009D9D9D,0x005B5C5C,0x00666667,0x009C9B9C +dd 0x00919191,0x00949494,0x00A5A5A5,0x00AAAAAA,0x00AAAAAA,0x00B7B7B7,0x00C9C9C9,0x00C4C4C3,0x00909090,0x008F8F8F,0x00909090,0x00A3A3A3,0x00B2B3B3,0x00AEAEAE,0x00A9A9A9,0x00ABADAE,0x00939B9F,0x00949DA5,0x00A7AFB7,0x00A2AAB2,0x008E969E,0x00949DA5,0x00A7B1B9,0x008F9AA1,0x005B6769,0x0086938F,0x009AA7A3,0x0099A3A0,0x009BA2A2,0x00979A9C,0x00898B8D,0x0093969B,0x00898F96,0x00929394,0x00949494,0x00666C6A,0x004B5753,0x006D7A72,0x00808F83,0x00879589,0x00859388,0x00808C83,0x00828A87,0x00878F8D,0x008D9492,0x00707474,0x00616061,0x00848484,0x008B8B8B,0x008A8A8A,0x008C8C8C,0x008F8F8F,0x00838383,0x00797A7A,0x007F8383,0x00828987,0x00878E8B,0x008F9693,0x00919996,0x0098A09D,0x009BA3A1,0x00636B68,0x00707675,0x00989998 +dd 0x00969696,0x009A9A9A,0x00A6A6A6,0x00A4A4A4,0x00B0B0B0,0x00BDBDBD,0x00C7C7C7,0x00BEBEBE,0x00888888,0x00828282,0x008B8B8B,0x009F9F9F,0x00B1B1B1,0x00ACACAC,0x00A0A0A0,0x009D9FA0,0x008C949B,0x0097A2AA,0x00A2ADB5,0x00A0AAB2,0x00919BA3,0x0097A2AA,0x00A5AFB7,0x00869098,0x005C6769,0x00889490,0x00909C99,0x00919B9D,0x009AA2A8,0x009FA3A8,0x00959595,0x00939495,0x0092989D,0x00A5A6A8,0x00A0A1A1,0x006F7474,0x003C4844,0x0047524E,0x005B6662,0x0068746F,0x006D7975,0x006F7673,0x00707171,0x00787777,0x00767576,0x00585757,0x00504F4F,0x00757575,0x007D7D7D,0x007D7E7E,0x00848484,0x00878787,0x00848484,0x00898A8A,0x008F9694,0x00899591,0x008E9A96,0x0093A09C,0x008F9C96,0x008F9B96,0x00949F9C,0x006B7672,0x00747D7A,0x00999B9A +dd 0x00888888,0x00919191,0x00A3A3A3,0x009F9F9F,0x00ABABAB,0x00B5B5B5,0x00BEBEBE,0x00B2B2B2,0x00797979,0x00797979,0x008D8D8D,0x009A9A9A,0x00A7A7A7,0x00969696,0x00898989,0x0088898A,0x008C949B,0x009DA7B0,0x009AA4AD,0x00959FA7,0x008F99A1,0x00949EA7,0x00A0AAB2,0x00858E97,0x00636D70,0x008D9A95,0x00919E98,0x00939F9E,0x0097A1A7,0x008C9297,0x00919191,0x00939394,0x00959A9E,0x0097999B,0x008E9193,0x005F676A,0x00131C1B,0x000F1413,0x00191E1C,0x002E3935,0x00424E4A,0x00444C4A,0x00353A38,0x001E2120,0x00191B1A,0x00141616,0x001B1F1E,0x002C3130,0x001F2423,0x002B302E,0x004D4E4E,0x005C5C5C,0x00595959,0x00656566,0x00757877,0x007F8683,0x00787E7B,0x00707875,0x00646C68,0x005A605E,0x00616765,0x004E5451,0x00656A68,0x00939393 +dd 0x00818181,0x008D8D8D,0x009D9D9D,0x00999999,0x00A3A3A3,0x00ABABAB,0x00ABABAB,0x00A9A9A9,0x007C7C7C,0x007A7A7A,0x008D8D8D,0x00979797,0x009C9C9C,0x00959594,0x00939493,0x008F9192,0x00939AA0,0x009DA5AD,0x00919AA2,0x00868F96,0x00818A92,0x008E98A1,0x00929DA5,0x00737C85,0x00646E72,0x008E9B99,0x00909C98,0x0094A19E,0x0097A2A6,0x008F959A,0x00A0A0A1,0x009D9C9C,0x009EA0A2,0x009A999A,0x00949798,0x00626A6D,0x00161C1D,0x00313A39,0x0047514E,0x004F5C57,0x004F5B57,0x004E5A56,0x00485450,0x002C3733,0x00323D39,0x00414D49,0x004E5A56,0x004C5754,0x003E4A46,0x00545F5C,0x00636766,0x00363636,0x00262626,0x00414141,0x00525152,0x00444444,0x00201F1F,0x001D1D1D,0x00252625,0x00424242,0x006E6E6D,0x00646565,0x00717171,0x008F8F8F +dd 0x00959595,0x009A9A9A,0x00979797,0x008E8E8E,0x009B9B9B,0x00A9A9A9,0x00A7A7A7,0x00A5A5A5,0x007C7C7C,0x007A7A7A,0x00909090,0x00959595,0x00919191,0x00929192,0x00989898,0x00979797,0x00919395,0x0095979A,0x008E9093,0x008A8C8F,0x0081878D,0x008B959D,0x00919CA4,0x007A858D,0x00788289,0x00929DA2,0x00929DA2,0x0098A3A8,0x009DA7AD,0x0099A2A7,0x009DA1A2,0x009A9D9F,0x009B9FA3,0x00959596,0x00929394,0x00676D72,0x0030393B,0x00687471,0x00717D79,0x00576460,0x00515D59,0x005C6864,0x006B7874,0x006E7B77,0x00737F7C,0x00707C79,0x00707C78,0x006A7773,0x00717E7A,0x008C9894,0x00858C8A,0x00494D4C,0x005F6362,0x006F7371,0x00585858,0x00292828,0x00282727,0x005B5B5B,0x00858585,0x00A6A6A6,0x00ABABAB,0x007E7E7E,0x00737373,0x00898989 +dd 0x00969696,0x00939393,0x008F8F8F,0x00929292,0x009B9B9B,0x009D9D9D,0x009C9C9C,0x00898989,0x00606060,0x006B6B6B,0x007D7D7D,0x00818181,0x00868686,0x00818181,0x007E7F7F,0x00848585,0x00838383,0x00828282,0x00757575,0x007A7A7B,0x007E8387,0x00949EA5,0x00959EA7,0x007E878F,0x00869199,0x0095A0A7,0x0096A1A9,0x0097A2A9,0x00929EA4,0x0089999D,0x00788689,0x007E888D,0x00899197,0x00919394,0x00939394,0x00696F72,0x00374242,0x00707C78,0x007D8985,0x0066726E,0x005F6B67,0x006A7773,0x00818D89,0x007F8B87,0x007D8985,0x00808C89,0x00818D89,0x0087938F,0x00919E9A,0x00A1AEA9,0x00909C98,0x00606B68,0x00808C88,0x008A9691,0x00888D8B,0x0080807F,0x00929292,0x00AAAAAA,0x00B2B2B2,0x00B6B6B6,0x00A6A6A6,0x007C7C7C,0x006F6F6F,0x008A8A8A +dd 0x006A6A6A,0x00646464,0x00696969,0x00737373,0x005F5F5F,0x00434343,0x00474747,0x00434343,0x002B2B2B,0x00303030,0x00323232,0x00424343,0x00505654,0x003F4544,0x00424846,0x005B605E,0x00525453,0x003E3F3F,0x001C1C1B,0x00161616,0x00333631,0x006B716C,0x00727578,0x00696973,0x0072787E,0x00818C8B,0x008E9A99,0x0095A0A0,0x00929F9E,0x008B9C9C,0x007E8D8F,0x00859196,0x008E989E,0x00A0A3A4,0x009E9F9E,0x00696E70,0x00323D3C,0x0075807D,0x00838F8B,0x00727E7A,0x006F7B77,0x006D7975,0x007B8884,0x00737F7B,0x00737F7B,0x007F8B87,0x0086928E,0x008E9A96,0x0096A39E,0x009AA7A3,0x0086928E,0x005E6A66,0x00798581,0x0086948F,0x0098A09E,0x00A4A5A5,0x00ABABAB,0x00ADADAD,0x00AFAFAF,0x00A9A9A9,0x009E9D9D,0x00797979,0x00585858,0x006A6A6A +dd 0x00919191,0x00858585,0x006F6F6F,0x005D5D5D,0x00595959,0x00636363,0x00757575,0x00757575,0x00707070,0x00808080,0x00878787,0x00888B89,0x0087928F,0x00808D89,0x00818E89,0x00838D89,0x00666967,0x004E4E4E,0x001F1F1F,0x001B1B1A,0x00303229,0x003E4236,0x004B4C4C,0x0064626C,0x0065696F,0x00788280,0x0086928F,0x008D9997,0x00899794,0x008E9E9C,0x00919E9F,0x00939EA2,0x00889398,0x00868A8D,0x00808285,0x00565C62,0x00374244,0x007D8886,0x00838F8B,0x0075817D,0x00727E7A,0x006E7A76,0x006C7874,0x006C7975,0x006D7975,0x0073807C,0x007C8884,0x00828E8A,0x0087938F,0x008E9A96,0x00828E8A,0x005D6965,0x0077837F,0x0086928E,0x00959B99,0x00A1A2A2,0x00ABABAB,0x00AEAEAE,0x00AEAEAE,0x00A5A5A5,0x009E9D9D,0x00868686,0x007D7C7C,0x00989898 +dd 0x00898989,0x00868686,0x006A6A6A,0x00686868,0x00929292,0x00A0A0A0,0x00A5A5A5,0x009F9F9F,0x009C9C9C,0x00A2A2A2,0x00A0A0A0,0x009A9D9B,0x009CA7A4,0x009BA7A3,0x008E9A96,0x00838E8A,0x005D605F,0x00626362,0x00676767,0x00868585,0x00767A7A,0x0048504F,0x0050575B,0x00666B72,0x00646B71,0x006F797C,0x006A7579,0x005F6A6F,0x003F4C4F,0x0047595B,0x00596A6C,0x00637275,0x004E5C5E,0x003C4649,0x00384146,0x00283237,0x00343E40,0x007E8A86,0x008C9894,0x0087938F,0x00808C88,0x007B8783,0x00717E7A,0x006D7A76,0x0065716D,0x00687571,0x006C7874,0x00727E7A,0x0074807C,0x00889590,0x0084918C,0x00606C68,0x006F7B77,0x007A8582,0x008A9190,0x009B9B9B,0x00A6A6A6,0x00A8A8A8,0x00A2A3A3,0x00999D9B,0x00969997,0x007F7F7F,0x007C797A,0x00969496 +dd 0x008C8C8C,0x00959595,0x00777777,0x00787878,0x00979797,0x008F9090,0x00909090,0x00949394,0x00999999,0x009E9F9E,0x00999999,0x00909392,0x00919C98,0x00939F9B,0x0086928E,0x00838E8A,0x00616463,0x006F706F,0x007D7D7C,0x009A9A99,0x0090969B,0x008C989F,0x00929DA4,0x006A7278,0x00586067,0x005A656C,0x005B666E,0x00626E76,0x00535F67,0x00576A6F,0x00677D80,0x007D9496,0x00748A8A,0x00657A7C,0x005C7274,0x004F6364,0x004F5E5C,0x008B9792,0x009AA7A2,0x0095A29E,0x008C9894,0x0085918D,0x007C8884,0x00707D79,0x0074807C,0x00798581,0x006C7975,0x006A7672,0x006E7B77,0x0085928D,0x00788480,0x0055615D,0x005B6763,0x00707B78,0x00868D8B,0x00949595,0x009F9F9F,0x00A0A0A0,0x009DA09F,0x00919B97,0x008B9591,0x00777978,0x00797073,0x00888587 +dd 0x00919192,0x008C8C8D,0x00636363,0x00707070,0x008D8E8E,0x00828485,0x00848585,0x008B8D8C,0x00909190,0x008B8D8C,0x00888A8A,0x00818585,0x00828D8A,0x0084908C,0x007F8B86,0x00848E8A,0x00646A68,0x006A6F6D,0x00767A78,0x00838584,0x007B8184,0x008A949B,0x008D969E,0x0061686F,0x00576167,0x00748389,0x0086979B,0x00899AA0,0x0094A6AB,0x009DB6B9,0x009BB6B8,0x0097B2B3,0x008EA7A8,0x008EA9A9,0x008CA7A7,0x007E9997,0x00697A76,0x0099A4A0,0x009EAAA6,0x008D9995,0x0085928E,0x00828E8A,0x007F8B87,0x007B8783,0x00818D89,0x007E8A86,0x00687571,0x005A6662,0x0063716C,0x0075807D,0x00697571,0x004F5B57,0x00535F5B,0x00707B77,0x007C8482,0x00878A89,0x00939494,0x00939594,0x00919594,0x00828D88,0x00838E8A,0x00787B79,0x00766D71,0x00807E7F +dd 0x008A8E8D,0x008A8E8D,0x006A6B6B,0x00828485,0x0093989C,0x0082888C,0x00878989,0x00818180,0x007D7D7B,0x00717272,0x00828987,0x0087908E,0x008C9894,0x0084908B,0x00808784,0x008A8F8D,0x00808484,0x00828787,0x00878B8A,0x00868988,0x007F8183,0x008C9093,0x008F979A,0x00768082,0x007F8E90,0x0093ABAC,0x0092ABAB,0x008EA7A9,0x0096B1B3,0x009EBBBA,0x009EBBBB,0x0095B1B0,0x0091AAAA,0x0095B1B0,0x0094AEAD,0x0087A09E,0x006B7A78,0x008E9895,0x0086928E,0x006C7874,0x006C7874,0x00707C78,0x00737F7B,0x0076827E,0x00707D79,0x00697571,0x00596561,0x004F5B57,0x00596360,0x00696F6E,0x006C7572,0x0048534F,0x00495451,0x0065716D,0x00717C79,0x007E8986,0x00808A86,0x0079827F,0x00828B89,0x0085908C,0x00889490,0x00808784,0x00767576,0x008A8E8D +dd 0x0094A09C,0x00949F9B,0x00777E7C,0x008B9493,0x0097A2A4,0x008B9497,0x00919595,0x00818282,0x00727372,0x00626463,0x007B8582,0x00838F8B,0x00939F9B,0x0097A29E,0x00959A98,0x00999999,0x009E9E9F,0x00989999,0x00909191,0x00929393,0x00919090,0x00989998,0x00979D9C,0x007E8885,0x00899B98,0x0091ABA9,0x008CA6A5,0x0090ABA9,0x0096B3B2,0x0097B1B1,0x0095B0AF,0x0091ACAA,0x0096B0B0,0x009FB6B5,0x00A5B8B5,0x0093A4A1,0x0064706E,0x006C7573,0x00646F6C,0x0053605C,0x005E6A66,0x00626E6A,0x006A7672,0x006A7672,0x005E6C68,0x00606D69,0x00586460,0x005D6A66,0x005B6663,0x005C6663,0x007C8783,0x00545E5B,0x00525C5A,0x0065716F,0x00667270,0x00727E7C,0x0077837F,0x00747E7A,0x007C8783,0x0086928E,0x008C9994,0x0086928D,0x006F7874,0x00707876 +dd 0x0066736F,0x00616D69,0x0057635F,0x0063716C,0x00596662,0x00404C49,0x003E4A46,0x003F4945,0x003F4845,0x003F4745,0x00495551,0x0047534F,0x00616E69,0x006C7773,0x00666E6C,0x00676C6B,0x00676C6B,0x005B605E,0x00545755,0x00565A59,0x00515553,0x00494F4D,0x00404846,0x00313A36,0x0039483F,0x0043564E,0x00485B54,0x005B7169,0x00768F88,0x007B938E,0x00778D8A,0x00829796,0x008EA1A1,0x00859392,0x00838E8D,0x006C7474,0x00485050,0x004A5352,0x00576161,0x00546160,0x00576260,0x005E6864,0x00636E6B,0x00626D6A,0x00586360,0x0056625E,0x00596461,0x00656F6C,0x004B5452,0x00303B38,0x005C6663,0x00484E4D,0x00515A57,0x00667170,0x005F6B6B,0x00677373,0x00707B7A,0x00717A78,0x00737D79,0x00727C77,0x00737D79,0x0077827E,0x006F7A76,0x004E5A56 +dd 0x004C5854,0x004D5955,0x004D5955,0x00596661,0x004D5954,0x003A4742,0x00293631,0x00182420,0x001C2824,0x00293531,0x00232F2B,0x00313D39,0x0057645F,0x0047534F,0x00374440,0x00434E4B,0x00323E3A,0x001A2320,0x00191D1B,0x001D1F1E,0x00191C1B,0x00161918,0x00161918,0x00101512,0x00253027,0x0055615C,0x00666F6B,0x0067706B,0x006D7972,0x006A766F,0x00697570,0x007E8A87,0x007F8D8C,0x00546466,0x00526266,0x00536267,0x00435458,0x003D4F52,0x004E6063,0x0056686C,0x005C6B6C,0x00545F5C,0x0027312E,0x00111513,0x000D0F0E,0x000D100F,0x000D0F0E,0x00141716,0x00111413,0x000D1110,0x001B211E,0x00141816,0x00252C2A,0x00303738,0x00384045,0x00555D62,0x00687175,0x006F787B,0x00747F7C,0x00727E7A,0x0075817D,0x00838F8B,0x007E8A86,0x00505C58 +dd 0x00697571,0x006F7B77,0x006C7975,0x007E8A86,0x007A8681,0x0075817D,0x00616E6A,0x004E5A56,0x0054605C,0x005A6763,0x005C6864,0x00717D79,0x007B8783,0x004A5652,0x003D4A46,0x005D6965,0x005A6763,0x004E5A56,0x00636E6A,0x00717C78,0x0067726E,0x005E6865,0x00636D6A,0x00424F49,0x004D5D57,0x00909C9F,0x00959C9F,0x008E9293,0x00939898,0x009A9E9F,0x009DA1A2,0x00979898,0x00868B8C,0x004E5E62,0x004A5D61,0x0052666A,0x005B7075,0x006B7F83,0x00809498,0x00879CA0,0x0087999B,0x006A7774,0x00222D29,0x000C100E,0x00070A09,0x00121A17,0x00131716,0x00222B28,0x0035403C,0x004D5855,0x0054605B,0x004F5B56,0x005F6B67,0x004D5857,0x004D5757,0x00687372,0x007A8484,0x00788383,0x0075817E,0x00727E7A,0x0074807C,0x00818D89,0x00788480,0x00586460 +dd 0x00636F6B,0x006B7773,0x0074807C,0x008A9591,0x0086918D,0x00848F8B,0x007B8682,0x0074807C,0x0074807C,0x006D7A76,0x0076827E,0x00838F8B,0x007E8A86,0x00495551,0x003E4B47,0x00626F6B,0x005B6763,0x00535F5B,0x006F7B77,0x00727E7A,0x00626F6A,0x0064706C,0x007A8581,0x00617068,0x0071807A,0x00A4AFB6,0x0098A2AA,0x00939BA2,0x0099A3AA,0x009DA6AD,0x009BA1A6,0x00939494,0x00878B8B,0x00637477,0x006B7E82,0x00788C90,0x0082969B,0x008B9DA1,0x0099ADB1,0x0096ABAF,0x0095A9A9,0x0083918D,0x00434F4C,0x00323B38,0x0036413D,0x005C6865,0x00626D69,0x0067736F,0x00707C78,0x007E8A86,0x00808C88,0x00818E8A,0x00899692,0x0066736F,0x0054605B,0x006B7772,0x0087938F,0x007F8B88,0x00707C78,0x00697672,0x006A7773,0x00788480,0x007F8B87,0x005A6662 +dd 0x0075817D,0x00798480,0x00838A88,0x00949897,0x00959898,0x00939696,0x00858C89,0x00798582,0x007A8682,0x007A8682,0x00828E8A,0x00838F8B,0x00778480,0x004B5753,0x00384641,0x00586561,0x00525F5A,0x005F6C67,0x0074807C,0x0067746F,0x00616D69,0x007D8985,0x008D9995,0x006A7770,0x0074817E,0x00949FA6,0x00939EA6,0x0099A3AB,0x009CA7AF,0x0099A3AB,0x008B9196,0x00929394,0x008B8E8F,0x006B7C7F,0x006B7F83,0x007E9398,0x0085999D,0x008B9DA1,0x0094A9AD,0x0090A5A9,0x0097AAAD,0x00869394,0x00364141,0x00171B1B,0x003E4749,0x00677371,0x0066726E,0x006A7772,0x0075817D,0x007A8782,0x0076837E,0x0076827E,0x007F8B87,0x00697672,0x00606D68,0x006C7974,0x007F8B87,0x0077837F,0x00727E7A,0x0075827E,0x0077837F,0x00828F8B,0x00909D99,0x00606C67 +dd 0x007D8A86,0x007F8B87,0x00878C8B,0x00959595,0x009C9B9B,0x009E9D9E,0x008E9291,0x007C8784,0x00818E8A,0x008D9995,0x0097A39F,0x00A0ABA8,0x00939E9B,0x00596461,0x002B3733,0x0045504D,0x0046514E,0x00697471,0x007C8783,0x00737E7A,0x006F7B77,0x00889490,0x008F9C98,0x006D7973,0x0076817F,0x0096A0A7,0x009CA6AE,0x009DA8B0,0x00A0ABB3,0x009CA6AE,0x0093999F,0x00A3A2A4,0x00949698,0x006A7A7E,0x00677B7F,0x00809498,0x00889CA0,0x0090A4A9,0x0091A6AA,0x008DA1A6,0x0095A8AD,0x00818D94,0x00242D33,0x0015191C,0x00545D62,0x00657270,0x0064716C,0x006F7B77,0x0075827D,0x00687670,0x0062706A,0x00616F69,0x00727E79,0x0063706C,0x0064716D,0x006A7672,0x007C8784,0x00818D89,0x00808C88,0x0086918D,0x008A9692,0x0095A29E,0x0097A49F,0x005F6A66 +dd 0x00868A90,0x0082878C,0x008B8D8F,0x009B999A,0x009C9B9B,0x00979797,0x00919291,0x00838786,0x008F9493,0x00A4A7A7,0x00ABAFAD,0x00A9ADAB,0x00989B9A,0x00666968,0x00474A49,0x006C6F6E,0x006F7272,0x00828584,0x007F8381,0x007A817E,0x0076827E,0x0086928E,0x00929E9A,0x00838F8B,0x00788484,0x00949FA6,0x0097A1AA,0x00959FA8,0x009AA5AD,0x00A1ABB4,0x00A2A8AF,0x00A1A2A4,0x00929698,0x00637477,0x006E8286,0x008A9DA0,0x008EA1A4,0x0096ABAF,0x0099AEB2,0x0098ACB0,0x009DAFB3,0x00849195,0x00283236,0x00363F43,0x006B7578,0x006B7774,0x006D7975,0x00727E7A,0x006E7A76,0x005E6864,0x0058605D,0x005A6260,0x00818986,0x00727A78,0x006A7270,0x007C8380,0x00919795,0x00919896,0x00919795,0x009DA2A0,0x00A1A6A4,0x00A6ABAA,0x009CA0A3,0x00606468 +dd 0x00434249,0x003A3A40,0x004C4C4F,0x00666567,0x00696869,0x00636464,0x006E6E6D,0x006F706F,0x00777878,0x007E7E7F,0x00777777,0x006A6A69,0x00636362,0x00505150,0x004D4D4D,0x007F7F7F,0x00888989,0x00939393,0x008B8A8B,0x00818685,0x00798481,0x00838F8B,0x008D9995,0x0085928E,0x00707B7B,0x009AA4AB,0x009DA6B0,0x0097A2AA,0x0099A4AC,0x009FA9B2,0x00A5AEB6,0x009FA8AE,0x00929DA2,0x0054666A,0x006C8084,0x00889A9E,0x0090A1A5,0x009BAEB2,0x009CB1B5,0x00A1B5B9,0x00A5B7BA,0x008E9B99,0x0037433F,0x004D5956,0x0075807D,0x0077837F,0x00798581,0x007B8783,0x0077827F,0x00727876,0x006E6E6E,0x006C6B6C,0x00838383,0x00606161,0x00343534,0x00474848,0x00666767,0x006A6B6B,0x00727273,0x00727372,0x00696A68,0x005F605E,0x00535255,0x0035333A +dd 0x00292D35,0x002B2F38,0x0041454E,0x00676B74,0x00828690,0x00828690,0x0086888E,0x00818182,0x00848484,0x00858585,0x00767777,0x00666B69,0x00707774,0x006E7774,0x00616866,0x00858787,0x008B8B8B,0x00979797,0x00999799,0x00919795,0x00899490,0x00919D99,0x0099A5A1,0x008F9C98,0x007A8686,0x0099A3AA,0x0097A1AB,0x00959FA8,0x0095A0A8,0x00949EA7,0x0099A3AB,0x00919CA3,0x00869298,0x005E7175,0x008BA0A4,0x009BAFB4,0x009CB0B3,0x009FB3B6,0x009EB2B6,0x00A4B8BC,0x00A6B9BB,0x0097A5A1,0x0047534F,0x00495551,0x00717D79,0x007E8A86,0x007F8B87,0x00798581,0x0074807C,0x00737A76,0x00777774,0x00797976,0x007D7D7A,0x0052524F,0x001F1F1F,0x003E3E3E,0x00555555,0x005D5C5C,0x00626160,0x00373A3C,0x001F2225,0x000E0E0E,0x000F0F11,0x001E2129 +dd 0x00263037,0x004A535C,0x006F7884,0x007A8294,0x008B94A6,0x00858FA1,0x008C929F,0x008A8B8D,0x00878788,0x00929292,0x00939695,0x008E9895,0x0097A39F,0x0084908C,0x005A6461,0x00676B69,0x007C7D7D,0x00919191,0x008F8F8F,0x008B918F,0x008A9592,0x00909D98,0x00929E9A,0x0087938F,0x0072807E,0x00849396,0x008A989D,0x0095A0A7,0x0099A4AA,0x009AA4AA,0x00A1ACB0,0x008F999A,0x00778484,0x00697C7F,0x0096ABAF,0x009DB2B6,0x0099ADB1,0x009AAFB3,0x0099AEB2,0x009DB1B4,0x009EB2B3,0x008C9A97,0x00424E4A,0x003A4642,0x006C7874,0x0076827E,0x00737F7B,0x00727E7A,0x0076817D,0x00777D76,0x007E8074,0x00818377,0x008C8D83,0x006D6D66,0x00676766,0x00AAAAAA,0x00ADADAD,0x00AAA8A7,0x009E9A97,0x00555C61,0x00353F46,0x00101316,0x0016181B,0x00262E36 +dd 0x006C797F,0x007E8B92,0x007C8792,0x00687180,0x00717A88,0x007A8492,0x009197A3,0x0089888D,0x007D7D79,0x0093948E,0x009A9D98,0x00989D9B,0x00A3A9A8,0x00848A88,0x003E4441,0x003A3F3D,0x00626966,0x007C8381,0x007C8280,0x007F8886,0x008C9794,0x008B9793,0x0087938F,0x00818D89,0x0043524E,0x003D4C4B,0x00515F5E,0x00667272,0x0073807F,0x00717E7B,0x00727E7B,0x0066726E,0x00495855,0x00495D5E,0x006D8185,0x00768A8E,0x00718488,0x0076898D,0x006F8184,0x0076898B,0x00819394,0x00707E7A,0x00323E3A,0x002E3A36,0x00697571,0x00707D79,0x006F7B77,0x0076837F,0x00788580,0x00787F78,0x00828479,0x0087887E,0x009B9D92,0x007C7C76,0x007D7D7C,0x00BEBEBE,0x00C3C3C3,0x00C5C4C2,0x00ACA8A5,0x00666D74,0x00606B73,0x00565F66,0x0079858A,0x00808E95 +dd 0x0093A7AB,0x008C9FA3,0x00738288,0x00707A82,0x006B747C,0x0069737C,0x00808791,0x00828188,0x00818279,0x00A0A396,0x00A8AAA1,0x00A9A9A8,0x00B6B5B5,0x00919191,0x00414342,0x00434B48,0x005A6762,0x00727F7B,0x0086928D,0x008E9A96,0x0093A09D,0x00838F8B,0x008D9894,0x0095A09C,0x00505D58,0x005B6965,0x00828F8B,0x008F9B98,0x00889490,0x0076827D,0x0065726D,0x005C6965,0x003F4F4D,0x003F5255,0x0052666A,0x004B5E62,0x00304244,0x00263232,0x001C2322,0x003D4946,0x0054625E,0x00576460,0x0035413D,0x003E4A46,0x0075817D,0x00808C88,0x007B8783,0x00788480,0x0074807C,0x00767D7B,0x007B7C7A,0x00888887,0x00A3A3A1,0x00838383,0x00838383,0x00B7B7B7,0x00BCBCBC,0x00BEBDBB,0x009C9998,0x00485057,0x0048525A,0x006B767D,0x009DADB2,0x00A1B4B9 +dd 0x00A1B5BB,0x008CA0A6,0x008C9CA2,0x0097A2AA,0x0099A3AB,0x0096A1A8,0x009DA6AF,0x008E8F94,0x00817E75,0x00A7A599,0x00AEADA4,0x00B0B0AF,0x00B5B5B5,0x00858585,0x00404140,0x00666B68,0x0088908D,0x009CA3A1,0x00ABB1AF,0x00ABB1AF,0x00A8AEAC,0x009AA09D,0x00A4ABA7,0x00969E9B,0x00616D6A,0x007E8B87,0x00939F9A,0x00909997,0x008E9896,0x009EAAA6,0x00A3AFAB,0x00A3AFAB,0x00808E8D,0x0064767A,0x0065797D,0x00596D71,0x002C3B3D,0x000C1311,0x00202A26,0x005E6B66,0x006F7B76,0x0065726D,0x003A4742,0x0055615D,0x007B8783,0x00808C87,0x007D8884,0x0076817D,0x0076817D,0x00808584,0x00818182,0x00949494,0x00A3A3A4,0x008B8B8C,0x00878788,0x00AFAFAF,0x00B9B9B8,0x00BBBAB8,0x009A9897,0x00495259,0x003B454D,0x006D7880,0x00A0B1B7,0x00AABDC3 +dd 0x009FB1BF,0x0090A4B0,0x0097A5AF,0x0087919A,0x0088929A,0x009AA6AE,0x00ACB7BF,0x0085898C,0x006D665F,0x009C938A,0x00A39D95,0x009F9D9C,0x00989798,0x00717172,0x00585858,0x008F908F,0x00AAABAB,0x00A8A8A8,0x00ACACAD,0x00A8A8A8,0x00ADADAD,0x00A5A5A4,0x00A2A3A2,0x00868787,0x006B7571,0x008B9792,0x0087938D,0x007C8684,0x007A8683,0x00838F8B,0x00818D88,0x00939F9A,0x008E9E9D,0x0075888A,0x00667B7F,0x005E7377,0x00324243,0x00151F1B,0x002C3833,0x00495551,0x0066726E,0x006B7773,0x0047544F,0x00727F7B,0x00808B87,0x007B7F7D,0x00818583,0x00828684,0x00808482,0x00808181,0x00838384,0x0099999A,0x00A8A7A8,0x00939393,0x00828282,0x00A9A9A9,0x00B6B6B6,0x00B7B5B3,0x008E8C8A,0x003C454C,0x004B555E,0x00919CA5,0x00AFBFCA,0x00B0C2CF +dd 0x0090A0AE,0x008E9FAC,0x008E9CA6,0x0089949C,0x009AA5AD,0x009DA7AF,0x009CA6AE,0x0060676C,0x003C3D3E,0x00525354,0x00595A5A,0x00474747,0x00434243,0x003A3A3A,0x00353535,0x004A4949,0x00555454,0x005E5E5E,0x00676767,0x005F5C5D,0x00625E5E,0x00686264,0x00827D7F,0x007B7678,0x00777C7B,0x00949F9B,0x008B9892,0x0085918D,0x008A9692,0x0086928E,0x007E8986,0x008B9692,0x00879592,0x00798B8C,0x006F8387,0x00617578,0x002C3C3E,0x002E3B37,0x0046524E,0x003D4945,0x00515D59,0x005C6864,0x00586360,0x007F8B87,0x00808A86,0x00797C7B,0x00838383,0x008E8E8E,0x00939291,0x009B9A9A,0x00949393,0x00959594,0x00969594,0x00787776,0x006B6A6A,0x008E8E8D,0x00989797,0x009A9796,0x00818180,0x00515B61,0x00717C84,0x00A3AEB6,0x00A7B6C1,0x00A1B2BF +dd 0x00919CA6,0x008B96A0,0x00848F98,0x00869099,0x00A6B0B9,0x00B0BBC3,0x00B8C2CA,0x0088929A,0x00768088,0x0078838B,0x006D767D,0x00555658,0x00626161,0x00626262,0x00575757,0x00656565,0x006A6A6A,0x00686868,0x00585858,0x004D4849,0x00554B4D,0x00817579,0x00B4A8AC,0x00A3979A,0x007C7D7C,0x00838F8C,0x0087938F,0x00899591,0x00919D99,0x008A9693,0x00909D99,0x0099A4A1,0x007D8B88,0x006D8280,0x00718685,0x00667576,0x002E3A3A,0x002D3936,0x00697571,0x007A8682,0x00788580,0x00596562,0x00424949,0x004B5052,0x004E5354,0x00525455,0x00686868,0x00747474,0x00686867,0x004D4D4D,0x00202020,0x00151515,0x001B1A1C,0x001A1A1B,0x001B1C1E,0x00303335,0x004A4E52,0x0067696D,0x00666A6E,0x0069727A,0x0079838B,0x009CA6AE,0x00A2AEB6,0x0097A4AD +dd 0x008C969F,0x007D868F,0x008E98A0,0x00A3AEB6,0x00BBC8D0,0x00C4D1D8,0x00C1CCD4,0x00879199,0x00818B93,0x00929DA5,0x00969FA7,0x00888C8F,0x008E9091,0x00949798,0x009B9D9F,0x009E9FA0,0x00919191,0x008A8A8A,0x00767676,0x00666264,0x006A6265,0x009B9296,0x00C0B7BA,0x00AAA1A4,0x007B7A7A,0x00808B88,0x00818D89,0x007A8783,0x00758482,0x006F7F7E,0x00849392,0x008F9E9C,0x007B8B87,0x00728881,0x00758A84,0x0063706C,0x00232A28,0x002B3632,0x00798581,0x00939F9B,0x0096A29E,0x00687271,0x00515057,0x0056515B,0x004D4A52,0x00515053,0x006B6C6B,0x00686969,0x005F6060,0x00272629,0x00040507,0x00111114,0x00292831,0x00494A55,0x005D646E,0x00747E86,0x007F8A92,0x00869099,0x006A747D,0x006B757E,0x006B757E,0x00919CA4,0x009FA9B1,0x008C979F +dd 0x008A949D,0x0088929A,0x00A3B1B7,0x00B0C3C7,0x00BBCFD4,0x00C2D6DB,0x00BACCD1,0x00808B92,0x007B858D,0x009BA5AD,0x00A4AEB6,0x00949DA4,0x00959EA4,0x0099A3AA,0x009EA6AE,0x00989CA0,0x00949394,0x008D8D8D,0x007F7F7F,0x00747374,0x007A7979,0x009A999A,0x00A2A1A1,0x00989697,0x00818180,0x0097A19D,0x00A2AEAA,0x0097A4A1,0x0092A4A5,0x0094A9AC,0x008B9FA2,0x00758788,0x006A7975,0x006B7C76,0x0073847F,0x005E6965,0x001E2422,0x00515B58,0x0087938F,0x0096A29E,0x009AA5A2,0x00727878,0x00706E73,0x00817D83,0x008A888D,0x00949799,0x009A9F9F,0x0074787A,0x005A595E,0x00131416,0x001E242B,0x00575E66,0x00737882,0x00838A93,0x0088929B,0x00869099,0x00858F98,0x008F99A2,0x0079838C,0x0068727B,0x00707A83,0x0095A0A8,0x009EA8B0,0x00909AA2 +dd 0x00A6B0B8,0x009CA7AF,0x00A4B2B8,0x00B1C5C9,0x00B5CACE,0x00BCCFD4,0x00B8C9CF,0x0077828A,0x006C757D,0x00929CA5,0x00959FA8,0x00949EA6,0x009BA5AD,0x009BA7AF,0x00949FA8,0x008A8F93,0x00959495,0x008B8A8A,0x007F7F7F,0x00868686,0x00939393,0x00969696,0x006F6F6F,0x00717071,0x00807E7E,0x0099A29F,0x00A4B0AC,0x009DA9A6,0x008B9B9B,0x007E8F90,0x006F8082,0x006F7D7D,0x00697470,0x00596660,0x005B6863,0x00495551,0x00293330,0x00727E7A,0x0087938F,0x008D9995,0x0087908E,0x006C6E6D,0x00757576,0x00878687,0x00A5A5A6,0x00AAB1B1,0x00A2ACAD,0x00696E72,0x0036343D,0x00232428,0x00646E75,0x00949EA6,0x0098A2AA,0x00A0AAB2,0x00A6B0B9,0x009FA9B1,0x009DA7AF,0x00A4AEB7,0x00919BA3,0x00747E86,0x008C969F,0x00A9B3BB,0x00B0BAC2,0x00B0BAC2 +dd 0x00A6B0B8,0x00A2ACB4,0x009AA4AC,0x00A1AEB5,0x00A3B0B7,0x00ABB8BF,0x00A5B1B9,0x006F7981,0x00747E86,0x0097A1A9,0x0099A4AC,0x009CA7AF,0x009DA8B0,0x00A0ABB3,0x0096A1A9,0x00969B9F,0x00A3A3A2,0x00969696,0x00929292,0x009F9F9F,0x00AEAEAE,0x00ABABAB,0x00858585,0x008F8D8D,0x008C8789,0x00848D8A,0x0099A6A2,0x0095A29E,0x00818E8A,0x00798682,0x00788581,0x00778480,0x00626D69,0x00535F5B,0x00505B57,0x0047524E,0x00424E4A,0x00808C88,0x0086928E,0x0086928E,0x00798380,0x00717472,0x007C7C7C,0x008F8F8F,0x00AFB0B0,0x00B1B5B6,0x00A1A7A9,0x00646668,0x00515056,0x00686B71,0x00879099,0x0098A3AB,0x0096A0A8,0x00A6B0B8,0x00ABB5BD,0x00A2ACB4,0x00A2ADB5,0x00AEB8C0,0x0096A0A8,0x00737D85,0x0098A2AA,0x00B1BBC3,0x00ADB7BF,0x00B1BBC4 +dd 0x00667079,0x0069747C,0x00566068,0x00545E66,0x00566169,0x00566167,0x00535E65,0x005A646C,0x0079838B,0x008E98A0,0x0096A1A9,0x0096A0A9,0x00939EA6,0x009CA7AF,0x00A0AAB2,0x00A2A7AC,0x009FA1A1,0x00A8AAAB,0x00B3B4B5,0x00B2B2B3,0x00B0B0B0,0x00A9A9A9,0x00A0A0A0,0x00A9A7A8,0x007A7779,0x004B5251,0x006D7875,0x007C8884,0x007F8B86,0x0085908C,0x00838F8B,0x007A8682,0x00717C78,0x00697571,0x005E6965,0x004F5B57,0x004C5854,0x007F8B87,0x0087928F,0x0084908C,0x0086908D,0x00848685,0x00787778,0x00858585,0x00A4A4A5,0x00A3A4A4,0x009B9C9C,0x00747373,0x00717070,0x007E8285,0x007E878F,0x00A0AAB2,0x00A4AEB6,0x009CA7AF,0x009AA5AD,0x00A4AEB6,0x00ACB6BE,0x00B7C1CA,0x0098A2AA,0x00566068,0x00626C74,0x00707B83,0x00667179,0x00616C74 +dd 0x005A646D,0x006B767F,0x00677177,0x00768082,0x00657172,0x004B5757,0x00596566,0x006B757C,0x00757F87,0x008D97A0,0x009EA8B0,0x009AA4AD,0x00949FA7,0x0099A4AC,0x00A0AAB2,0x00A3ACB4,0x009FA8AE,0x00A4ADB3,0x009AA2A8,0x009FA4A9,0x00A1A2A3,0x00979797,0x009D9D9D,0x00ACABAC,0x007B7A7B,0x00575A59,0x00686C6B,0x006C7170,0x00747D7B,0x00727E7A,0x00717E79,0x006E7A76,0x006C7974,0x006F7C77,0x007F8C87,0x0067746F,0x005D6965,0x00848C89,0x00878E8C,0x00858D8A,0x00929997,0x00878987,0x00767979,0x007D8181,0x00949899,0x00949A96,0x00989F99,0x007A7F7D,0x00636869,0x005F676C,0x006A747C,0x0098A2AB,0x00A4AEB6,0x009BA5AD,0x00A1ABB3,0x00A7B1B9,0x00A8B2BA,0x00B6C0C8,0x009EA8B0,0x00535E66,0x00626D75,0x00707B83,0x00606B73,0x00465159 +dd 0x00939EA6,0x009AA4AD,0x007E888C,0x007B8785,0x00717E7A,0x00697672,0x008E9A98,0x00818C92,0x007A848C,0x00919CA4,0x0097A1AB,0x00959EA8,0x00959EA8,0x00939EA6,0x0096A0A9,0x0096A0A8,0x00919BA2,0x00929CA4,0x008E99A0,0x009CA4A9,0x00A4A6A6,0x00A4A4A4,0x00ACACAC,0x00AFAFAF,0x00828282,0x00737373,0x008C8C8C,0x008D8E8E,0x00828A87,0x006F7C78,0x00727F79,0x00788480,0x007C8985,0x00838F8B,0x0085918D,0x005F6B67,0x00535D59,0x007D7F7E,0x008B8B8B,0x008A8B8A,0x008F908E,0x007A7D77,0x00727B79,0x007F8989,0x00919B9C,0x0096A59E,0x009AABA0,0x006F7C78,0x00505A60,0x0058626A,0x00707A82,0x00939DA6,0x00A3ADB5,0x00A4AEB6,0x00A5AFB7,0x00A4AEB6,0x00A7B1B9,0x00B5BFC7,0x0096A0A8,0x00475159,0x00656F77,0x00727C84,0x00757F87,0x007F8991 +dd 0x00A2ACB4,0x0097A1A9,0x006C767C,0x00616B6F,0x00798588,0x00909B9E,0x00ADB8BB,0x0096A6AB,0x008E9EA4,0x0095A5AC,0x0091A0A7,0x0096A2A9,0x009EA8B0,0x009AA5AD,0x00A1ABB2,0x00A1ABAF,0x008B9696,0x008E9998,0x00A1ADAC,0x00B7C0BE,0x00C1C2C2,0x00B7B7B7,0x00ADADAD,0x009F9F9F,0x007B7B7B,0x00696969,0x00808080,0x009FA0A0,0x00A8AFAD,0x009EAAA6,0x009FACA7,0x0099A5A3,0x008E9B97,0x008E9A95,0x007B8783,0x005B6763,0x0057605D,0x00808181,0x008B8B8B,0x00878687,0x00848483,0x00636862,0x00535D5B,0x006A7676,0x007F8B8B,0x0086968F,0x00809286,0x00505E59,0x003E474F,0x00636D75,0x007E8890,0x009BA5AD,0x00A6B0B8,0x00A4AEB6,0x00A0AAB2,0x00A7B1B9,0x00A9B3BB,0x00B7C1C9,0x00A4AEB6,0x006C767E,0x00939DA6,0x0098A2AA,0x009EA8B1,0x00A9B3BB +dd 0x00A3ADB5,0x009BA5AE,0x0059636B,0x00626C74,0x00A0A9B2,0x00AAB4BC,0x00A7B3B9,0x0090A4A7,0x00778B8F,0x008A9FA3,0x0096ABAF,0x009DABB1,0x009CA6AF,0x00A1ACB4,0x00A9B3BA,0x00A6B1B4,0x009EA9A7,0x00B6C2BF,0x00D4E0DC,0x00DEE7E4,0x00E4E6E5,0x00DADBDB,0x00C5C7C6,0x00B0B1B0,0x00868686,0x00818181,0x009C9C9B,0x00BDBEBD,0x00BFC6C3,0x00ABB6B3,0x009AA5A3,0x0094A09E,0x008E9C96,0x008A9792,0x0086928E,0x006F7B77,0x00585F5E,0x006A6A6A,0x00727272,0x00737373,0x00696A69,0x00444C49,0x00242F2E,0x00263232,0x00263232,0x002C3C35,0x00405245,0x00394742,0x004C575D,0x0079838B,0x0089939B,0x00A3ADB5,0x00A2ADB5,0x009CA7AF,0x009FAAB2,0x00ABB6BE,0x00A9B3BB,0x00B2BCC4,0x009DA7AF,0x00677179,0x008A949C,0x0097A2AA,0x0099A3AC,0x009CA7AF +dd 0x009EADB3,0x009DABB1,0x005E6C72,0x007F8D94,0x00AAB8BF,0x00A3B2B9,0x0097A8AE,0x0083979B,0x00708589,0x008DA2A6,0x0097ADB1,0x00A5B3B9,0x00AFB9C1,0x00C8D2DA,0x00CBD5DC,0x00BAC4CA,0x00BAC5C8,0x00CBD6D9,0x00CFDBDE,0x00C8D3D4,0x00C8D1CE,0x00C1C9C6,0x00B9C1BE,0x00B7BEBC,0x00898C8B,0x007B7B7B,0x00999999,0x00BABABA,0x00B0B8B6,0x00A1ACAA,0x008B9795,0x008D9996,0x00808E87,0x00737F7C,0x00778480,0x006F7A77,0x005A5D5F,0x00636465,0x006D706F,0x00767777,0x00727574,0x0065716F,0x005B6968,0x005D6B6A,0x00556362,0x0071817A,0x008C9F92,0x00717F7A,0x006E787F,0x00717D85,0x00838E96,0x009EA8B0,0x009DA8B0,0x009FAAB2,0x00A6B3B9,0x00A6B4BB,0x00A3AFB7,0x00A8B5BD,0x0093A1A7,0x005A666E,0x0076848B,0x00909EA5,0x00919EA6,0x008F9EA5 +dd 0x00ABBFC3,0x00A3B6BB,0x00718589,0x0097ABAF,0x00A6B9BE,0x0094A9AE,0x008DA3A6,0x00869A9E,0x007D9296,0x008A9EA2,0x008A9EA2,0x0098A6AC,0x009FA9B0,0x00A4AEB6,0x009CA5AE,0x008F98A0,0x008F99A2,0x00919AA1,0x00879299,0x00889397,0x00939F9D,0x0095A29D,0x0089918E,0x00626665,0x00353636,0x00414141,0x00606060,0x005F5F5F,0x004B5351,0x0045514E,0x003B4643,0x00454B48,0x003C4541,0x00333E3A,0x002E3B37,0x0036413E,0x00474B4E,0x0062696A,0x006F7979,0x00737C7C,0x00778381,0x00758983,0x00788F86,0x00839B91,0x0089A197,0x00A0B6AA,0x00AEC0B4,0x00889591,0x006C767D,0x005F6A72,0x008D979F,0x00A1ABB3,0x009BA6AE,0x009BA8AF,0x00A1B4B8,0x00A1B5BA,0x00A2B5BA,0x00A8BBC0,0x009AADB2,0x00617479,0x007E9296,0x009BAFB4,0x0099ADB2,0x0092A6AA +dd 0x00B5C9CE,0x00A7BCC0,0x00788D91,0x0098ACB0,0x00A1B5B9,0x0090A5A9,0x009BB0B4,0x008FA3A7,0x004F6468,0x0034494D,0x002E4145,0x0035444A,0x00353F47,0x003B454D,0x002C343C,0x00272D30,0x00293234,0x00262B2C,0x002F3839,0x00424C4D,0x00575D5C,0x00626665,0x00414241,0x00282828,0x00262424,0x00383838,0x003D3C3D,0x00444445,0x0059605E,0x004B5753,0x0026302D,0x00404241,0x005A615E,0x004B5854,0x00202D29,0x001C2420,0x00484C4E,0x007C8687,0x00869492,0x007E8A89,0x007C8A89,0x0071867F,0x00738B81,0x00849E92,0x0098B0A5,0x00ABC1B5,0x00BCCEC1,0x008D9A94,0x00525C63,0x005C666E,0x0097A1A9,0x009FAAB2,0x00A0ABB3,0x009CA9B1,0x009FB2B6,0x00A0B4B8,0x009FB4B9,0x00A1B7BB,0x0098ADB1,0x006E8387,0x0091A5A9,0x00ACC1C5,0x00ACC0C4,0x00ACC0C4 +dd 0x0092A7AB,0x0084999D,0x0074898D,0x009BAFB3,0x009FB3B7,0x0085999D,0x0096AAAE,0x0092A7AB,0x0062777B,0x00697D81,0x0063777B,0x005F6E74,0x00677079,0x008B949D,0x00808992,0x00859092,0x008E9A96,0x0087928D,0x009CA8A4,0x009CA5A1,0x00969797,0x00727171,0x00484848,0x00838383,0x00A3A2A2,0x00A0A1A0,0x00878888,0x008E8E8F,0x00979E9C,0x006F7A76,0x00454E4B,0x007E8180,0x00989F9C,0x006F7C78,0x0037443F,0x003C4643,0x0065696C,0x00899395,0x0083908F,0x007E8A8A,0x00818D8D,0x007F8D8B,0x00849390,0x0098A8A5,0x00A6B5B2,0x009DAEA5,0x00A4B5A9,0x0084908C,0x00576167,0x00768089,0x00959FA7,0x00939DA5,0x00929CA4,0x008C98A0,0x0089999F,0x00839498,0x00819299,0x0085969D,0x0074878C,0x004F6165,0x00687A7D,0x0083989C,0x0096AAAE,0x009BAFB3 +dd 0x0043585C,0x0052676B,0x006D8286,0x008EA3A7,0x0092A6AA,0x007E9296,0x009EB2B6,0x0096AAAE,0x006A7E83,0x00809599,0x00829598,0x009BAAB0,0x00A8B2BA,0x00AAB4BD,0x00949DA6,0x009FA9AC,0x00A6B1AD,0x00A6B2AD,0x00ADBAB6,0x00A7B1AE,0x00B1B2B2,0x007D7D7D,0x00696969,0x00B0B1B1,0x00ADB1AF,0x00989F9C,0x00888F8C,0x008A908E,0x0088918E,0x00788480,0x006E7975,0x00868D8B,0x0088928E,0x0078847F,0x00606E69,0x00515C59,0x0055585E,0x006C7678,0x00677474,0x006D7979,0x00768282,0x00838F8F,0x008C9897,0x009FABAA,0x009EA8A8,0x0097A69F,0x00A5B6AA,0x007D8A86,0x003A434A,0x003B454D,0x00515C63,0x00465259,0x00313C44,0x003F4952,0x0040444E,0x0025282D,0x00282A35,0x003D414C,0x002A353B,0x00111C1F,0x001B2325,0x00334448,0x0055696E,0x005D7175 +dd 0x00374B4F,0x007E9397,0x00809498,0x007A8E92,0x0095A9AD,0x008CA0A5,0x009EB2B6,0x008EA3A7,0x00667A7E,0x00687D81,0x0085989C,0x00B9C6CF,0x00B0BAC2,0x00A4AEB6,0x009CA6AE,0x00A8B3B5,0x00ADB9B4,0x00B3BFBB,0x00B6C1BE,0x00B7C1BE,0x00B7B9B8,0x00797979,0x007B7B7B,0x00ABADAC,0x0097A09D,0x007B8783,0x00798581,0x008F9B96,0x00A0ACA8,0x0098A4A0,0x008E9A95,0x0094A09C,0x00A0ACA8,0x0098A4A0,0x008D9995,0x00707B79,0x0044474D,0x004E575A,0x00546161,0x005F6B6B,0x00768282,0x0084928C,0x0088978F,0x009CACA3,0x0091A198,0x009CADA3,0x00B4C7BA,0x00879590,0x00384249,0x003A464E,0x00596A6F,0x003B4E52,0x00374A4E,0x0063747A,0x005D666E,0x00575E66,0x00717781,0x006A717B,0x0039474E,0x00304347,0x003D4F53,0x0044585C,0x00384A4F,0x001C2A2E +dd 0x0083979C,0x00B9CDD2,0x008B9FA3,0x007D9195,0x00A1B5B9,0x00A0B4B8,0x00ABBFC3,0x0090A5A9,0x004D6165,0x003D5256,0x008CA0A5,0x00BCC9D1,0x00A8B2BA,0x00A6B1B9,0x00A0ABB2,0x00ADB8BB,0x00BECAC7,0x00C6D3CF,0x00BFCBC7,0x00C1CCC8,0x00B5B7B6,0x007E7E7E,0x007D7D7D,0x00898A8A,0x00919B97,0x007F8B87,0x00939F9B,0x00AFBBB7,0x00A8B5B3,0x0098A5A5,0x009AA5A6,0x00AFBAB8,0x00A9B3B3,0x009AA5A5,0x0096A1A2,0x00828D8F,0x004C5055,0x00555E61,0x006B7777,0x00798686,0x00899696,0x00819189,0x00829387,0x0090A396,0x0087998D,0x0099ABA0,0x00AEC0B4,0x0084918D,0x00475159,0x006D7A82,0x00859A9E,0x006D8286,0x00879CA0,0x009DB0B6,0x00667278,0x00798289,0x00A5B0B7,0x008F9AA2,0x007B8A91,0x007A8F93,0x006A7F83,0x005C7175,0x003E5357,0x00394C50 diff --git a/programs/gifview/trunk/build_en.bat b/programs/gifview/trunk/build_en.bat new file mode 100644 index 0000000000..849841631a --- /dev/null +++ b/programs/gifview/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm gifview.asm gifview +@pause \ No newline at end of file diff --git a/programs/gifview/trunk/build_ru.bat b/programs/gifview/trunk/build_ru.bat new file mode 100644 index 0000000000..3b4306afd8 --- /dev/null +++ b/programs/gifview/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm gifview.asm gifview +@pause \ No newline at end of file diff --git a/programs/gifview/trunk/debug.inc b/programs/gifview/trunk/debug.inc new file mode 100644 index 0000000000..45ae9f90c6 --- /dev/null +++ b/programs/gifview/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' \ No newline at end of file diff --git a/programs/gifview/trunk/gif_lite.inc b/programs/gifview/trunk/gif_lite.inc new file mode 100644 index 0000000000..542a80d961 --- /dev/null +++ b/programs/gifview/trunk/gif_lite.inc @@ -0,0 +1,328 @@ +; GIF LITE v2.0 by Willow +; Written in pure assembler by Ivushkin Andrey aka Willow +; +; This include file will contain functions to handle GIF image format +; +; Created: August 15, 2004 +; Last changed: September 9, 2004 + +; Change COLOR_ORDER in your program +; if colors are displayed improperly + +if ~ (COLOR_ORDER in ) +; This message may not appear under MenuetOS, so watch... + display 'Please define COLOR_ORDER: MENUETOS or OTHER',13,10 +end if + +; virtual structure, used internally + +struc GIF_list +{ + .NextImg rd 1 + .Left rw 1 + .Top rw 1 + .Width rw 1 + .Height rw 1 +} + +struc GIF_info +{ + .Left rw 1 + .Top rw 1 + .Width rw 1 + .Height rw 1 +} + +_null fix 0x1000 + +; **************************************** +; FUNCTION GetGIFinfo - retrieve Nth image info +; **************************************** +; in: +; esi - pointer to image list header +; ecx - image_index (0...img_count-1) +; edi - pointer to GIF_info structure to be filled + +; out: +; eax - pointer to RAW data, or 0, if error + +GetGIFinfo: + push esi ecx edi + xor eax,eax + jecxz .eloop + .lp: + mov esi,[esi] + test esi,esi + jz .error + loop .lp + .eloop: + add esi,4 + movsd + movsd + mov eax,esi + .error: + pop edi ecx esi + ret + +; **************************************** +; FUNCTION ReadGIF - unpacks GIF image +; **************************************** +; in: +; esi - pointer to GIF file in memory +; edi - pointer to output image list +; eax - pointer to work area (MIN 16 KB!) + +; out: +; eax - 0, all OK; +; eax - 1, invalid signature; +; eax >=8, unsupported image attributes +; +; ecx - number of images + +ReadGIF: + push esi edi + mov [.table_ptr],eax + mov [.cur_info],edi + xor eax,eax + mov [.globalColor],eax + mov [.img_count],eax + inc eax + cmp dword[esi],'GIF8' + jne .er ; signature + mov ecx,[esi+0xa] + inc eax + add esi,0xd + mov edi,esi + bt ecx,7 + jnc .nextblock + mov [.globalColor],esi + call .Gif_skipmap + .nextblock: + cmp byte[edi],0x21 + jne .noextblock + inc edi + cmp byte[edi],0xf9 ; Graphic Control Ext + jne .no_gc + add edi,7 + jmp .nextblock + .no_gc: + cmp byte[edi],0xfe ; Comment Ext + jne .no_comm + inc edi + .block_skip: + movzx eax,byte[edi] + lea edi,[edi+eax+1] + cmp byte[edi],0 + jnz .block_skip + inc edi + jmp .nextblock + .no_comm: + cmp byte[edi],0xff ; Application Ext + jne .nextblock + add edi,13 + jmp .block_skip + .noextblock: + cmp byte[edi],0x2c ; image beginning + jne .er + inc [.img_count] + inc edi + mov esi,[.cur_info] + add esi,4 + xchg esi,edi + movsd + movsd + push edi + movzx ecx,word[esi] + inc esi + bt ecx,7 + jc .uselocal + push [.globalColor] + mov edi,esi + jmp .setPal + .uselocal: + call .Gif_skipmap + push esi + .setPal: + movzx ecx,byte[edi] + inc ecx + mov [.codesize],ecx + dec ecx + pop [.Palette] + lea esi,[edi+1] + mov edi,[.table_ptr] + xor eax,eax + cld + lodsb ; eax - block_count + add eax,esi + mov [.block_ofs],eax + mov [.bit_count],8 + mov eax,1 + shl eax,cl + mov [.CC],eax + inc eax + mov [.EOI],eax + lea ecx,[eax-1] + mov eax, _null shl 16 + .filltable: + stosd + inc eax + loop .filltable + pop edi + mov [.img_start],edi + .reinit: + mov edx,[.EOI] + inc edx + push [.codesize] + pop [.compsize] + call .Gif_get_sym + cmp eax,[.CC] + je .reinit + call .Gif_output + .cycle: + movzx ebx,ax + call .Gif_get_sym + cmp eax,edx + jae .notintable + cmp eax,[.CC] + je .reinit + cmp eax,[.EOI] + je .end + call .Gif_output + .add: + push eax + mov eax,[.table_ptr] + mov [eax+edx*4],ebx + pop eax + cmp edx,0xFFF + jae .cycle + inc edx + bsr ebx,edx + cmp ebx,[.compsize] + jne .noinc + inc [.compsize] + .noinc: + jmp .cycle + .notintable: + push eax + mov eax,ebx + call .Gif_output + push ebx + movzx eax,bx + call .Gif_output + pop ebx eax + jmp .add + .er: + pop edi + jmp .ex + .end: + mov eax,[.cur_info] + mov [eax],edi + mov [.cur_info],edi + add esi,2 + xchg esi,edi + .nxt: + cmp byte[edi],0 + jnz .continue + inc edi + jmp .nxt + .continue: + cmp byte[edi],0x3b + jne .nextblock + xor eax,eax + stosd + mov ecx,[.img_count] + .ex: + pop edi esi + ret + +.Gif_skipmap: +; in: ecx - image descriptor, esi - pointer to colormap +; out: edi - pointer to area after colormap + + and ecx,111b + inc ecx ; color map size + mov ebx,1 + shl ebx,cl + lea ebx,[ebx*2+ebx] + lea edi,[esi+ebx] + ret + +.Gif_get_sym: + mov ecx,[.compsize] + push ecx + xor eax,eax + .shift: + ror byte[esi],1 + rcr eax,1 + dec [.bit_count] + jnz .loop1 + inc esi + cmp esi,[.block_ofs] + jb .noblock + push eax + xor eax,eax + lodsb + test eax,eax + jnz .nextbl + mov eax,[.EOI] + sub esi,2 + add esp,8 + jmp .exx + .nextbl: + add eax,esi + mov [.block_ofs],eax + pop eax + .noblock: + mov [.bit_count],8 + .loop1: + loop .shift + pop ecx + rol eax,cl + .exx: + xor ecx,ecx + ret + +.Gif_output: + push esi eax edx + mov edx,[.table_ptr] + .next: + push word[edx+eax*4] + mov ax,word[edx+eax*4+2] + inc ecx + cmp ax,_null + jnz .next + shl ebx,16 + mov bx,[esp] + .loop2: + pop ax + + lea esi,[eax+eax*2] + add esi,[.Palette] + + if COLOR_ORDER eq MENUETOS + mov esi,[esi] + bswap esi + shr esi,8 + mov [edi],esi + add edi,3 + else + movsw + movsb + end if + + loop .loop2 + pop edx eax esi + ret + + .globalColor rd 1 + .img_count rd 1 + .cur_info rd 1 ; image table pointer + .img_start rd 1 + .codesize rd 1 + .compsize rd 1 + .bit_count rd 1 + .CC rd 1 + .EOI rd 1 + .Palette rd 1 + .block_ofs rd 1 + .table_ptr rd 1 diff --git a/programs/gifview/trunk/gifview.asm b/programs/gifview/trunk/gifview.asm new file mode 100644 index 0000000000..39aae0114e --- /dev/null +++ b/programs/gifview/trunk/gifview.asm @@ -0,0 +1,314 @@ +; GIF VIEWER FOR MENUET v1.0 +; Written in pure assembler by Ivushkin Andrey aka Willow +; +; Uses GIF_LITE 2.0 +; +; Created: August 31, 2004 +; Last changed: September 9, 2004 +; +; COMPILE WITH FASM + +WND_COLOR equ 0x02aabbcc +; input line dimensions +INP_X equ 10 shl 16+680 +INP_Y equ 25 shl 16+16 +INP_XY equ 15 shl 16+30 + +use32 + + org 0x0 + + db 'MENUET01' + dd 0x01 + dd START + dd I_END + dd 0x300000 + dd 0x27fff0 + dd filename ;0x0 + dd 0x0 + +include 'lang.inc' +include 'macros.inc' ; decrease code size (optional) +;include '/hd/1/meos/debug.inc' +include 'debug.inc' +COLOR_ORDER equ MENUETOS + +DELAY equ 20 ; animation speed + +;include '/hd/1/gif/gif_lite.inc' +include 'gif_lite.inc' + +START: + cmp [filename],byte 0 + jne openfile2 +; jmp openfile2 +openfile: + and [entered],0 + xor eax,eax + mov [imgcount],eax + mov esi,fn_input + mov edi,filename + mov ecx,[inp_pos] + rep movsb + mov byte[edi],al +openfile2: + mov eax,58 + mov ebx,file_info + int 0x40 + cmp eax,6 + je temp + test eax,eax + jnz ok2 +temp: + cmp ebx,64 + jbe ok2 + + and [entered],0 + xor eax,eax + mov [imgcount],eax + mov esi,filename + mov edi,fn_input + mov ecx,256 ;[filename_len] + rep movsb + + mov edi,fn_input + mov ecx,50 + xor eax,eax + repne scasb + sub edi,fn_input + dec edi + mov [inp_pos],edi + inc [inp_pos] + +; test eax,eax +; jnz .ok2 +; cmp ebx,64 +; jbe .ok2 + mov esi,workarea + mov edi,Image + mov eax,hashtable + call ReadGIF + test eax,eax + jz .ok + xor ecx,ecx + .ok: + mov [imgcount],ecx + ok2: + and dword[img_index],0 + +red: + + call draw_window + +still: + mov ebx,DELAY + mov eax,23 + int 0x40 + + cmp eax,1 + je red + cmp eax,2 + je key + cmp eax,3 + je button + mov eax,[imgcount] + cmp eax,1 + je still + inc [img_index] + cmp eax,[img_index] + jne redsub + and [img_index],0 + redsub: + mov ecx,[img_index] + call draw_subimage + jmp still + + key: + mov eax,2 + int 0x40 + cmp ah,13 + je is_input + jmp still + + button: + mov eax,17 + int 0x40 + + cmp ah,1 + jne noclose + _close: + or eax,-1 + int 0x40 + + noclose: + is_input: ; simple input line with backspace feature + inc [entered] ; sorry - no cursor + wait_input: + call draw_input + mov eax,10 + int 0x40 + cmp eax,2 + jne still + mov edi,[inp_pos] + mov eax,2 + int 0x40 + shr eax,8 + cmp eax,27 + je still + cmp eax,13 + je openfile + cmp eax,8 + je backsp + mov [fn_input+edi],al + inc [inp_pos] + jmp wait_input + backsp: + test edi,edi + jz wait_input + dec [inp_pos] + jmp wait_input + jmp still + +;**************************************** +;******* DRAW CONTENTS OF INPUT LINE **** +;**************************************** +draw_input: + push edi + cmp [entered],0 + jne highlight + mov esi,WND_COLOR + jmp di_draw + highlight: + mov esi,0xe0e0e0 + di_draw: + mov eax,8 + mov ebx,INP_X + mov ecx,INP_Y + mov edx,2 + int 0x40 + mov eax,4 + mov ecx,0x00107a30 ; шрифт 1 и цвет ( 0xF0RRGGBB ) + mov ebx,INP_XY + mov edx,fn_input + mov esi,[inp_pos] + int 0x40 + pop edi + ret + +; ********************************************* +; ******* ОПРЕДЕЛЕНИЕ И ОТРИСОВКА ОКНА ******* +; ********************************************* + +draw_window: + + mov eax,12 + mov ebx,1 + int 0x40 + + mov eax,0 + mov ebx,50*65536+700 + mov ecx,50*65536+500 + mov edx,WND_COLOR + mov esi,0x805080d0 + mov edi,0x005080d0 + int 0x40 + + + mov eax,4 + mov ebx,8*65536+8 + mov ecx,0x10ddeeff + mov edx,zagolovok + mov esi,zag_konets-zagolovok + int 0x40 + + mov eax,8 + mov ebx,(700-19)*65536+12 + mov ecx,5*65536+12 + mov edx,1 + mov esi,0x6688dd + int 0x40 + + call draw_input + + xor ecx,ecx + call draw_subimage + cmp [imgcount],1 + je .enddraw + + mov ecx,[img_index] + call draw_subimage + .enddraw: + mov eax,12 + mov ebx,2 + int 0x40 + ret + +draw_subimage: + cmp [imgcount],0 + jz .enddraw + mov esi,Image + mov edi,gif_inf + call GetGIFinfo + test eax,eax + jz .enddraw + movzx ebx,[gif_inf.Width] + shl ebx,16 + movzx ecx,[gif_inf.Height] + add ecx,ebx + mov ebx,eax + movzx eax,[gif_inf.Top] + movzx edx,[gif_inf.Left] + shl edx,16 + add edx,eax + add edx,10 shl 16 +45 + mov eax,7 + int 0x40 + .enddraw: + ret + +; Здесь находятся данные программы: + +; интерфейс программы двуязычный - задайте язык в macros.inc + +zagolovok: ; строка заголовка +if lang eq ru + db 'ПРОСМОТР GIF' +else + db 'GIF VIEWER' +end if +zag_konets: ; и её конец + +inp_pos dd inp_end-fn_input +fn_input: +; db '/hd/1/gif/smileys/sm100000.gif' + db '/rd/1/meos.gif' +; db '/hd/1/1/tex256.gif',0 +; db '/rd/1/tex256.gif' +inp_end: + rb 256-(inp_end-fn_input) + +file_info: + dd 0 + dd 0 + dd 0x100000/512;0x200000 + dd workarea + dd Image;0x100000 +I_END: ; конец программы +filename: +; db '/hd/1/gif/smileys/sm112000.gif',0 +; db '/hd/1/gif/test.gif',0 +; db '/hd/1/gif/explode1.gif',0 +; db '/hd/1/gif/tapeta.gif',0 +; db '/hd/1/gif/meos.gif',0 + rb 256 +;filename_len dd 0 +entered rd 1 + +imgcount rd 1 +img_index rd 1 +gif_inf GIF_info + +hashtable rd 4096 +workarea rb 0x100000 + +Image: diff --git a/programs/gifview/trunk/macros.inc b/programs/gifview/trunk/macros.inc new file mode 100644 index 0000000000..d45b69e6e3 --- /dev/null +++ b/programs/gifview/trunk/macros.inc @@ -0,0 +1,265 @@ +; 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 { ; mike.dld + if ~a eq + mov reg,a + end if +} + +macro mcall a,b,c,d,e,f { ; mike.dld + __mov eax,a + __mov ebx,b + __mov ecx,c + __mov edx,d + __mov esi,e + __mov edi,f + int 0x40 +} + + + + + + + +; optimize the code for size +__regs fix + +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 \ No newline at end of file diff --git a/programs/grscreen/trunk/build_en.bat b/programs/grscreen/trunk/build_en.bat new file mode 100644 index 0000000000..7fba699139 --- /dev/null +++ b/programs/grscreen/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm grscreen.asm grscreen +@pause \ No newline at end of file diff --git a/programs/grscreen/trunk/build_ru.bat b/programs/grscreen/trunk/build_ru.bat new file mode 100644 index 0000000000..ae849ab774 --- /dev/null +++ b/programs/grscreen/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm grscreen.asm grscreen +@pause \ No newline at end of file diff --git a/programs/grscreen/trunk/grscreen.asm b/programs/grscreen/trunk/grscreen.asm new file mode 100644 index 0000000000..d673436e27 --- /dev/null +++ b/programs/grscreen/trunk/grscreen.asm @@ -0,0 +1,131 @@ +; +; NICE BACKGROUND +; +; Compile with FASM for Menuet +; + +;****************************************************************************** + use32 + org 0x0 + + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd I_END ; size of image + dd 0x5000 ; memory for app + dd 0x5000 ; esp + dd 0x0 , 0x0 ; I_Param , I_Icon + +include "lang.inc" +include "macros.inc" +;****************************************************************************** + +;GRADES = 100 ; count of grades +;START_COLOR = 0x8292B4 ;0x0078b000 +;STEP = 0x010101 ;0x00010100 +;xxx equ sub ; from dark to light + +;****************************************************************************** + +db "MenuetOS RE #8",13,10 + +START: + ; load system colors + mcall 58, read_info + + ; set system colors + mcall 48, 2, sc, sizeof.system_colors + + ; set stretch backgound + mcall 15, 4, 2 + + ; set wallpaper + mcall 58, start_info + +;jmp exit +; +;mov eax,image+3 ; generate image +;mov ecx,GRADES-1 +;@@: +;mov ebx,[eax-3] +;xxx ebx,STEP +;mov [eax],ebx +;add eax,3 +;dec ecx +;jnz @b + +;mov eax,15 ; copy image to background memory +;mov ebx,5 +;mov ecx,image +;xor edx,edx +;mov esi,(GRADES+1)*3 +;int 0x40 + +;mov eax,15 ; set stretch backgound +;mov ebx,4 +;mov ecx,2 +;int 0x40 + +;mov eax,15 ; set background size +;mov ebx,1 +;mov ecx,ebx +;mov edx,GRADES +;int 0x40 + +;mov eax,15 ; draw background +;mov ebx,3 +;int 0x40 + +;exit: + +; BEGIN_REDRAW_SCREEN +; mcall 12, 1 + +; mcall 14 +; mov ecx, eax +; shr eax, 16 +; and ecx, 0xFFFF +; mov ebx, eax +; mov edx, 0x01000000 +; mcall 0 + +; mcall 12, 2 +; END_REDRAW_SCREEN + mcall 5,100 + mcall -1 + +;------------------------------------------------------------------------------ + +read_info: + .mode dd 0 + .start_block dd 0 + .blocks dd 1 + .address dd sc + .workarea dd work_area + .path db "/rd/1/myblue.dtp",0 + +start_info: + .mode dd 16 + dd 0 + .params dd boot + dd 0 + .workarea dd work_area + .path db "/rd/1/jpegview",0 + +boot db 'BOOT',0 + +;------------------------------------------------------------------------------ + +;image: +;dd START_COLOR + +I_END: +;rd 256 + +sc system_colors + rb 512-40 + +align 32 +work_area: + +; EOF \ No newline at end of file diff --git a/programs/grscreen/trunk/macros.inc b/programs/grscreen/trunk/macros.inc new file mode 100644 index 0000000000..d45b69e6e3 --- /dev/null +++ b/programs/grscreen/trunk/macros.inc @@ -0,0 +1,265 @@ +; 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 { ; mike.dld + if ~a eq + mov reg,a + end if +} + +macro mcall a,b,c,d,e,f { ; mike.dld + __mov eax,a + __mov ebx,b + __mov ecx,c + __mov edx,d + __mov esi,e + __mov edi,f + int 0x40 +} + + + + + + + +; optimize the code for size +__regs fix + +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 \ No newline at end of file diff --git a/programs/h2d2b/trunk/build_en.bat b/programs/h2d2b/trunk/build_en.bat new file mode 100644 index 0000000000..78bc177eb7 --- /dev/null +++ b/programs/h2d2b/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm h2d2b.asm h2d2b +@pause \ No newline at end of file diff --git a/programs/h2d2b/trunk/build_ru.bat b/programs/h2d2b/trunk/build_ru.bat new file mode 100644 index 0000000000..933a8684e2 --- /dev/null +++ b/programs/h2d2b/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm h2d2b.asm h2d2b +@pause \ No newline at end of file diff --git a/programs/h2d2b/trunk/h2d2b.asm b/programs/h2d2b/trunk/h2d2b.asm new file mode 100644 index 0000000000..2eba5e2545 --- /dev/null +++ b/programs/h2d2b/trunk/h2d2b.asm @@ -0,0 +1,235 @@ + use32 ; тъы■ўшЄ№ 32-сшЄэ√щ Ёхцшь рёёхьсыхЁр + org 0x0 ; рфЁхёрЎш  ё эєы  + + db 'MENUET01' ; 8-срщЄэ√щ шфхэЄшЇшърЄюЁ MenuetOS + dd 0x01 ; тхЁёш  чруюыютър (тёхуфр 1) + dd START ; рфЁхё яхЁтющ ъюьрэф√ + dd I_END ; ЁрчьхЁ яЁюуЁрьь√ + dd 0x1000 ; ъюышўхёЄтю ярь Єш + dd 0x1000 ; рфЁхё тхЁ°шэ√ ёЄ¤ър + dd 0x0 ; рфЁхё сєЇхЁр фы  ярЁрьхЄЁют (эх шёяюы№чєхЄё ) + dd 0x0 ; чрЁхчхЁтшЁютрэю + +include 'lang.inc' +include 'macros.inc' ; ьръЁюё√ юсыхуўр■Є цшчэ№ рёёхьсыхЁ∙шъют! + + +START: +red: + + call draw_window + +still: + mcall 10 ; ЇєэъЎш  10 - цфрЄ№ ёюс√Єш  + + cmp eax,1 ; яхЁхЁшёютрЄ№ юъэю ? + je red ; хёыш фр - эр ьхЄъє red + cmp eax,2 ; эрцрЄр ъыртш°р ? + je key ; хёыш фр - эр key + cmp eax,3 ; эрцрЄр ъэюяър ? + je button ; хёыш фр - эр button + + jmp still ; хёыш фЁєуюх ёюс√Єшх - т эрўрыю Ўшъыр + +;--------------------------------------------------------------------- + + key: ; эрцрЄр ъыртш°р эр ъыртшрЄєЁх + mov eax, 2 + int 0x40 + mov edi, [index] + cmp edi, string1 + jz no_back + + cmp ah, 8 + jnz no_back + + dec edi + mov byte [edi], ' ' + mov [index], edi + call Draw_String + jmp still +no_back: + cmp ah, 13 + jz read_str + + cmp edi, string1_end + jae still + mov al, ah + stosb + mov [index], edi + call Draw_String + jmp still ; тхЁэєЄ№ё  ъ эрўрыє Ўшъыр + +read_str: + dec edi + mov esi, string1 + + call GetBase + + xor ecx, ecx + inc ecx ; ecx = 1 + +make_bin: + xor eax, eax + +next_digit: + xor edx, edx + cmp edi, esi + jb .done + + mov dl, [edi] + cmp dl, '-' + jne @f + neg eax + jmp .done +@@: + cmp dl, 'F' + jbe @f + and dl, 11011111b +@@: + sub dl, '0' + cmp dl, 9 + jbe @f + sub dl, 'A'-'9'-1 +@@: + cmp dl, bl + jb @f + ; ╟фхё№ юсЁрсюЄрЄ№ ю°шсъє + + jmp .done +@@: + push ecx + xchg eax, ecx + mul edx ; edx:eax = eax * edx + add ecx, eax + pop eax + mul ebx + xchg eax, ecx + dec edi + jmp next_digit + +.done: + mov [num], eax + + jmp red + +;--------------------------------------------------------------------- + + button: + mcall 17 ; 17 - яюыєўшЄ№ шфхэЄшЇшърЄюЁ эрцрЄющ ъэюяъш + cmp ah, 1 ; хёыш ═┼ эрцрЄр ъэюяър ё эюьхЁюь 1, + jne still ; тхЁэєЄ№ё  + + .exit: + mcall -1 ; шэрўх ъюэхЎ яЁюуЁрьь√ + +draw_window: + mcall 12, 1 + mcall 0, 200*65536+300, 200*65536+120, 0x02AABBCC, 0x805080D0, 0x005080D0 + mcall 4, 8*65536+8, 0x10DDEEFF, header, header_e - header + mcall , 15*65536+100, 0, numstr, 7 + mcall , 15*65536+72, , hexstr, 4 + mcall , 15*65536+44, , decstr, + mcall , 15*65536+30, , binstr, + mcall , 15*65536+58, ,sdecstr, 10 + + + mcall 8, (300-19)*65536+ 12, 5*65536+ 12, 1, 0x6688DD + + mov ecx, [num] + + mcall 47, 8*65536+256,,240*65536+72,0 ; 16-эр  + + mcall , 10*65536, ,228*65536+44, ; 10-эр  + + mcall , 8*65536+512,,240*65536+30, ; 2-эр  + ror ecx, 8 + mcall , 8*65536+512,,(240-56)*65536+30, + ror ecx, 8 + mcall , 8*65536+512,,(240-56*2)*65536+30, + ror ecx, 8 + mcall , 8*65536+512,,(240-56*3)*65536+30, + ror ecx, 8 + mov byte [minus], '+' + jnc @f + mov byte [minus], '-' + neg ecx +@@: + mcall , 10*65536,,228*65536+58, ; 10-эр  ёю чэръюь + mcall 4, 222*65536+58, 0, minus, 1 + call Draw_String + + + mcall 12, 2 ; ЇєэъЎш  12: ёююс∙шЄ№ ╬╤ юс юЄЁшёютъх юъэр + +ret + +;------------------------------------------------- + Draw_String: +;------------------------------------------------- + mov eax, 13 + mov ebx, 60*65536+ 6*33 + mov ecx, 100*65536+ 9 + mov edx, 0x02AABBCC + int 0x40 + + mov eax,4 + mov ebx,60*65536+100 + mov ecx,0xA40473 + mov edx,string1 + mov esi,33 + int 0x40 +ret + +;------------------------------------------------- + GetBase: +;------------------------------------------------- + mov ebx, 10 + cmp edi, esi + jb .done + + mov al, [edi] + cmp al, 'H' + jbe @f + and al, 11011111b +@@: + cmp al, 'H' + jne @f + mov ebx, 16 + dec edi + jmp .done + +@@: + cmp al, 'D' + jne @f + mov ebx, 10 + dec edi + jmp .done + +@@: + cmp al, 'B' + jne .done + mov ebx, 2 + dec edi + +.done: +ret + +;------------------------------------------------- +string1: + db 34 dup(' ') +string1_end: + index dd string1 +num dd 0 + + +header db 'hex2dec2bin' +header_e: + minus db '-' + numstr db 'Number:' + hexstr db 'hex:' + binstr db 'bin:' + decstr db 'dec:' +sdecstr db 'signed dec:' + +I_END: ; ьхЄър ъюэЎр яЁюуЁрьь√ diff --git a/programs/h2d2b/trunk/macros.inc b/programs/h2d2b/trunk/macros.inc new file mode 100644 index 0000000000..d45b69e6e3 --- /dev/null +++ b/programs/h2d2b/trunk/macros.inc @@ -0,0 +1,265 @@ +; 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 { ; mike.dld + if ~a eq + mov reg,a + end if +} + +macro mcall a,b,c,d,e,f { ; mike.dld + __mov eax,a + __mov ebx,b + __mov ecx,c + __mov edx,d + __mov esi,e + __mov edi,f + int 0x40 +} + + + + + + + +; optimize the code for size +__regs fix + +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 \ No newline at end of file diff --git a/programs/heed/trunk/build_en.bat b/programs/heed/trunk/build_en.bat new file mode 100644 index 0000000000..a19351cd5c --- /dev/null +++ b/programs/heed/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm heed.asm heed +@pause \ No newline at end of file diff --git a/programs/heed/trunk/build_ru.bat b/programs/heed/trunk/build_ru.bat new file mode 100644 index 0000000000..1d3a68f13c --- /dev/null +++ b/programs/heed/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm heed.asm heed +@pause \ No newline at end of file diff --git a/programs/heed/trunk/heed.asm b/programs/heed/trunk/heed.asm new file mode 100644 index 0000000000..83374f986c --- /dev/null +++ b/programs/heed/trunk/heed.asm @@ -0,0 +1,1375 @@ +;constants +;for keys +KEY_ESC equ 27 +KEY_PGDN equ 183 +KEY_PGUP equ 184 +KEY_LNDN equ 177 +KEY_LNUP equ 178 +KEY_RIGHT equ 179 +KEY_LEFT equ 176 +KEY_HOME equ 180 +KEY_END equ 181 +KEY_HOMETOP equ 251 ;Ctrl + '[' +KEY_ENDBOTTOM equ 253 ;Ctrl + ']' + + use32 + org 0x0 + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd I_END ; size of image + dd 0x80000 ; memory for app + dd 0x80000 ; esp + dd 0x0 , 0x0 ; I_Param , I_Icon + + include 'lang.inc' + include 'macros.inc' + + +START: ; start of execution + + mov eax,40 + mov ebx,100111b ;event mouse + int 0x40 + mov dword [process_info+42],540 + mov dword [process_info+46],414 + call draw_window + +still: + mov eax,10 ; wait here for event + int 0x40 + dec al ; redraw request ? + je red + dec al ; key in buffer ? + je key + dec al ; button in buffer ? + je button + ; mouse event received + mouse: + mov eax,37 + mov ebx,2 + int 0x40 + or eax,eax + jz still + cmp [menu_opened],1 + jne still + mov [menu_opened],0 + + red: ; redraw + call redraw_window + jmp still + + key: ; key + mov eax,2 + int 0x40 +; test al,al +; jnz still + cmp ah,KEY_ESC + jz close + mov al,[o_s_flag] + and al,8 ;set bit 3? + jz edit_keys ;not - no output to filename area + cmp ah,8 ;BACKSPACE + jnz no_backspace + dec [name_l] + cmp [name_l],0 + mov edx,filename + je A1 + jg @f + mov [name_l],0 + jmp A1 + @@: + add dl,[name_l] + A1: + sub [x_cursor],0x60000 + mov [edx],byte 0 + cmp [x_cursor],0xb0005 + jge @f + mov [x_cursor],0xb0005 +@@: + call redraw_window + jmp still ;END BACKSPACE + + no_backspace: + cmp ah,0x30 ;'0' + jl A2 + cmp ah,0x39 ;'9' + jle bigsym + cmp ah,65 ;'A' + jbe bigsym + cmp ah,90 ;'Z' + jle bigsym + cmp ah,97 ;'a' + jbe smsym + cmp ah,122;'z' + jle smsym + jmp still + A2: + cmp ah,46 ;'.' + jz bigsym + cmp ah,0x20 + jz bigsym + jmp still + smsym: + sub ah,32 + bigsym: + cmp [name_l],13 ;yes. filename length <13 + jl @f + sub [o_s_flag],8 ;not - disable output to filename area + mov [x_cursor],0x680005; - set x-base & x-size + jmp _end_keys + @@: + mov edx,filename ; + add dl,[name_l] + mov [edx],ah + inc [name_l] + add [x_cursor],0x60000 + _end_keys: + call redraw_window + jmp still + edit_keys: + cmp ah,KEY_PGDN + jnz @f + call PgDn + jmp still + @@: + cmp ah,KEY_PGUP + jnz @f + call PgUp + jmp still + @@: + cmp ah,KEY_HOME ;Home + jnz @f + call Home + jmp still + @@: + cmp ah,KEY_END ;Home + jnz @f + call _End + jmp still + @@: + cmp ah,KEY_HOMETOP + jnz @f + call CtrlHome + jmp still + @@: + cmp ah,KEY_ENDBOTTOM + jnz @f + call CtrlEnd + jmp still + @@: + cmp ah,KEY_LNDN + jnz @f + call LnDn + jmp still + @@: + cmp ah,KEY_LNUP + jnz @f + call LnUp + jmp still + @@: + cmp ah,KEY_RIGHT ;Right + jnz @f + call Right + jmp still + @@: + cmp ah,KEY_LEFT ;Left + jnz @f + call Left + @@: + ;редактирование строки в hex-представлении + mov esi,[current] + mov bl,[posx] + add esi,0x10000 ;0x80000 + cmp ah,0x30 + jl still ;ah<'0' + cmp ah,0x39 + jle A23 ;ah='0'...'9' - перевод из символов в hex +;проверка на коды старших hex-цифр + cmp ah,0x61 ;ah<'a' + jl A27 ;может быть вводятся большие буквы? + cmp ah,0x66 ;ah>'f' + jg still + sub ah,0x20 ;конвертируем в большие буквы + jmp A24 + A27: + cmp ah,0x41 + jl still ;ah<'A' + cmp ah,0x46 + jg still ;ah>'F' + A24: + add ah,9 + A23: + mov dl,[esi];оригинальный байт + and bl,1 ;если нечет - редактируется младший полубайт, чет - старший + jz hi_half_byte + ;младший полубайт + and ah,0x0f ;обнуляем старший полубайт введенной цифры + ;если ah = 0x30...0x39, то все нормально + ;если ah = 0x41...0x46, то на метке А24 получим + ;ah = 0x4A...0x4F и тоже все нормально + and dl,0xf0 ;обнуляем младший полубайт у оригинального байта + jmp patch_byte + hi_half_byte: + ;старший полубайт + shl ah,4 ;одновременно сдвигаем нужное значение в старший полубайт + ;и обнуляем младший + and dl,0x0f ;обнуляем старший полубайт у оригинального байта + patch_byte: + or ah,dl ;объединяем полубайты + mov [esi],ah;патчим в памяти + mov ebx,0x20100 + movzx ecx,ah ;для функции вывода числа + ;теперь надо расчитать координаты вывода для числа + ;edx = x shl 16 + y + mov edx,[x_cursor] + mov edi,[y_cursor] + and edx,0xffff0000 + shr edi,0x10 + xor esi,esi + or edx,edi + mov eax,47 + add edx,8 + int 0x40 + call redraw_window + jmp still + + button: ; button + mov eax,17 ; get id + int 0x40 + dec ah ;close programm button + jne @f + close: + mov eax,-1 ; close this program + int 0x40 + @@: + dec ah + jne @f + call redraw_window + call menufile + jmp still + @@: + dec ah ;menu 'coding' button + jne @f + call redraw_window + call menucoding + jmp still + @@: + dec ah ;menu 'Help' button + jne @f + call redraw_window + call menuhelp + jmp still + @@: + ;now processed low_level menu buttons + ;id m_open = 5 + ;id m_save = 6 + ;id m_exit = 7 + ;id m_win2dos 8 + ;id m_win2koi 9 + ;id m_win2iso 10 + ;id m_dos2win 11 + ;id m_dos2koi 12 + ;id m_dos2iso 13 + ;id m_help 14 + ;id m_about 15 + dec ah ;open? + jne @f + cmp [o_s_flag],0 ;disable 'Open' if flag !=0 + jnz no_open +; call redraw_window + mov [color],0x0072b9fc + call f2 ;set x_cursor & y_cursor for input filename + mov [o_s_flag],8 ;for output to filename area + no_open: + call redraw_window + jmp still + @@: + dec ah ;save? + jne @f + cmp [o_s_flag],1 ;enable save if flag = 1 + jnz no_save + movzx ecx,[name_l] ;begin clear filename string + mov edi,filename + xor al,al + jecxz no_clear + clear: + mov [edi+ecx],al + loop clear + mov [name_l],al ;set filename length = 0 + no_clear: ;ebd clear + call f2 ;set x_cursor & y_cursor for input filename + mov [o_s_flag],9 ;for output to filename area + no_save: + call redraw_window + jmp still + @@: + dec ah ;exit? + jne @f + jmp close + @@: + dec ah ;m_win2dos? + jne @f + push dword WIN_TABLE + push dword DOS_TABLE + call coding + call redraw_window + jmp still + @@: + dec ah ;m_win2koi? + jne @f + push WIN_TABLE + push KOI_TABLE + call coding + call redraw_window + jmp still + @@: + dec ah ;m_win2iso? + jne @f + push WIN_TABLE + push ISO_TABLE + call coding + call redraw_window + jmp still + @@: + dec ah ;m_dos2win? + jne @f + push DOS_TABLE + push WIN_TABLE + call coding + call redraw_window + jmp still + @@: + dec ah ;m_dos2koi? + jne @f + push DOS_TABLE + push KOI_TABLE + call coding + call redraw_window + jmp still + @@: + dec ah ;dos2iso? + jne @f + push DOS_TABLE + push ISO_TABLE + call coding + call redraw_window + jmp still + @@: + dec ah ;m_help? + jne @f + ;create new thread for output help info + ;parameter: address for entry_point thread + push help_thread + call create_process + call redraw_window + jmp still + @@: + dec ah ;m_about? + jne @f + ;create new thread for output about info + ;parameter: address for entry_point thread + push about_thread + call create_process + call redraw_window + jmp still + @@: + ;button 'Go' + and [o_s_flag],1 + jnz _savefile + ;open file + mov eax,6 + mov ebx,filename + xor ecx,ecx + or edx,-1 + mov esi,0x10000 + int 0x40 + inc [o_s_flag] + mov [sizefile],eax + jmp end_Go + _savefile: + ;save file + mov ebx,filename + mov ecx,0x10000 + mov edx,[sizefile] + xor esi,esi + dec edx + mov eax,33 + int 0x40 + end_Go: + call CtrlHome + jmp still + +Right: + pushad + mov al,[posx] + inc al + cmp al,0x20 + jl @f + mov [posx],0 + mov [x_cursor],0x680005 + mov [text_cursor],0x01200000 + sub [current],0xf ;because [current] add 0x10 in LnDn + call LnDn + popad + ret + @@: + mov [posx],al + and al,1 + jnz @f ;not increment [current] + ;increment + add [x_cursor],0xa0000 + sub [text_cursor],0x40000 + inc [current] + jmp end_r + @@: + add [x_cursor],0x60000 + sub [text_cursor],0x60000 + end_r: + call redraw_window + popad + ret + +Left: + pushad + mov al,[posx] + dec al + jge @f + mov [posx],0x1f + mov [x_cursor],0x015e0005 + mov [text_cursor],0x00840000 + add [current],0x0f + call LnUp + popad + ret + @@: + mov [posx],al + and al,1 + jnz @f ;decrement [current] + ;not decrement + sub [x_cursor],0x60000 + add [text_cursor],0x60000 + jmp end_l + @@: + cmp [current],0 + jle end_l + sub [x_cursor],0xa0000 + add [text_cursor],0x40000 + dec [current] + end_l: + call redraw_window + popad + ret + +LnDn: + pushad + add [current],0x10 + movzx ecx,[lines] + cmp cl,[posy] + jl @f ;when counter strings >= number strings in window + add [y_cursor],0xa0000 + inc [posy] + call redraw_window + popad + ret + @@: + mov eax,0x10 + xor edx,edx + imul ecx + sub eax,0x10 + sub [end_str],eax +; mov eax,[sizefile] +; add eax,0x80000 +; cmp eax,[end_str] +; jge @f +; mov [end_str],eax +; @@: + call draw_window + popad + ret + +LnUp: + pushad + sub [current],0x10 + cmp [current],0 + jge @f + mov [current],0 + @@: + cmp [posy],3 + jle @f ;when counter strings < number top string + sub [y_cursor],0xa0000 + dec [posy] + call redraw_window + popad + ret + @@: +; movzx ecx,[lines] +; mov eax,0x10 +; xor edx,edx +; imul ecx +; add eax,0x10 + sub [end_str],0x10 + cmp [end_str],0x10000 + jge @f + mov [end_str],0x10000 + @@: + call redraw_window + popad + ret + +CtrlEnd: + pushad + popad + ret + +CtrlHome: + pushad + mov [x_cursor],0x00680005 ;устанавливаются значения, как при открытии + mov [y_cursor],0x00280008 + mov [text_cursor],0x01200000 + mov [posx],0 + mov [posy],3 + call b_in_screen + mov [end_str],0x10000 + mov [current],0 + call redraw_window + popad + ret + +_End: + pushad + mov [x_cursor],0x015e0005 + mov [posx],0x1f + mov [text_cursor],0x00840000 + or [current],0xf + call b_in_screen + call redraw_window + popad + ret + +Home: + pushad + mov [x_cursor],0x00680005 ;устанавливаются значения для начала строки + mov [posx],0 + mov [text_cursor],0x01200000 + and [current],0xfffffff0 + call b_in_screen + call redraw_window + popad + ret + +PgDn: + pushad + xor edx,edx + movzx ecx,[lines] + mov eax,0x10 + imul ecx + add [current],eax + add [end_str],eax + call redraw_window + popad + ret + +PgUp: + pushad + xor edx,edx + movzx ecx,[lines] + mov eax,0x10 + imul ecx + sub [current],eax + cmp [current],0 + jge @f + mov [current],0 + @@: + sub [end_str],eax + cmp [end_str],0x10000 + jge @f +; call CtrlHome + mov [end_str],0x10000 + @@: + call redraw_window + popad + ret + +b_in_screen: + pushad + call get_process_info + mov eax,[process_info+0x2e] + mov ebx,0x0a + sub eax,0x3c + cmp eax,0x10 ;now + jg @f ;now + mov [lines],0 ;now + jmp C1 ;now + @@: + xor edx,edx + div ebx + mov [lines],al + C1: + popad + ret + + + +output_screen: + pushad + movzx ecx,[lines] + jecxz no_out ;now + cmp [rflag],1 + jz _redraw + mov eax,[end_str] + sub eax,0x80001 + cmp eax,[sizefile] + jl @f + _redraw: + xor edx,edx + mov eax,0x10 + imul ecx + sub [end_str],eax + cmp [end_str],0x10000 + jge A3 + mov [end_str],0x10000 + A3: + mov [rflag],0 + @@: + mov eax,0x28 + @@: + push ecx + push eax + call form_str + mov ebx,0x01880000 + add ebx,eax + mov ecx,0x00ffffff + add eax,10 + mov edx,[end_str] + push eax + sub edx,0x10 + mov esi,0x10 + mov eax,4 + int 0x40 + pop eax + pop ecx + loop @b + no_out: + popad + ret + + + +form_str: + pushad + mov ebp,[end_str] ;последний выведенный байт + xor edi,edi ;счетчик байт <= 16 + ;вывести адрес + mov ecx,ebp + mov ebx,0x80100 ;8 цифр, 16-ричные, число в ecx + sub ecx,0x10000 ;нормализация адреса + mov edx,0x80000 ;начало по Х + add edx,[esp+0x24] ;начало по У + mov esi,0x00ffffff ;цвет + mov eax,47 ;вывести число + int 0x40 + add edx,0x600000 ;0x40 - 8chars + 0x20 - space + mov ebx,0x20100 ;2 цифры, 16-ричные, число в ecx + @@: + mov ecx,[ebp+edi] ;число в ecx + inc edi + and ecx,0xff + cmp edi,0x11 + jz endstr + int 0x40 + add edx,0x100000 + jmp @b + endstr: + dec edi + add ebp,edi + mov [end_str],ebp + popad + ret 4 + + + +draw_cursor: + pushad + mov ebx,[x_cursor] + mov ecx,[esp+0x24] + mov edx,[color] + mov eax,13 + int 0x40 + movzx edi,[o_s_flag] + and edi,8 + jnz @f + add ebx,[text_cursor] + int 0x40 + @@: + popad + ret 4 + +f2: + mov eax,[process_info+46] + mov [x_cursor],0xb0005 + sub eax,0x11 +; mov [text_cursor],-1 + shl eax,0x10 + + mov [y_filename_area],eax + ret + +menufile: + mov [menu_opened],1 + mov ebx,[xf_menu];x-base+x_size for hi-level menu button + mov edx,5;first id button for this group + mov edi,3;counter buttons + call f1 + ;output text for menu + shr ecx,0x10 ;y-base button + and ebx,0xffff0000 + add ecx,0x6000f ;for y-base text + mov esi,4 ;length text + add ebx,ecx ;full base text + mov edx,m_open + mov ecx,[sc.work_button_text] + or ecx,0x10000000 + sub eax,4 + int 0x40 + add ebx,0x0c ;next full base text + add edx,4 ;next string + int 0x40 + add ebx,0x0c + add edx,4 + int 0x40 + ret + +menucoding: + mov [menu_opened],1 + mov ebx,[xe_menu] + mov edx,8 ;first id + mov edi,6 ;counter + add ebx,0x10 ;add width buttons + push edi + call f1 + pop edi + shr ecx,0x10 + and ebx,0xffff0000 + add ecx,0x8000f + mov esi,8 ;length text + add ebx,ecx + mov edx,m_win2dos + mov ecx,[sc.work_button_text] + or ecx,0x10000000 + sub eax,4 + @@: + int 0x40 + add ebx,0x0c + add edx,8 ;next string + dec edi + jnz @b + ret + +menuhelp: + mov [menu_opened],1 + mov ebx,[xh_menu] + mov edx,14 ;first id + add ebx,6 ;add width buttons + mov edi,2 ;counter + call f1 + shr ecx,0x10 + and ebx,0xffff0000 + add ecx,0x8000f + mov esi,4 ;length text + add ebx,ecx + mov edx,m_help + mov ecx,[sc.work_button_text] + or ecx,0x10000000 + sub eax,4 + int 0x40 + add ebx,0x0c + inc esi ;add lebgth output text + add edx,4 + int 0x40 + ret + +f1:;uses for drawing low-level menu buttons + ;counter buttons get into + ;menufile,menucoding,menuhelp funcs. + mov ecx,[y_menu] ;y-base+y_size for hi-level menu button + mov esi,[sc.work_button] ;color buttons + mov eax,8 + push ecx ;for output text + @@: + add ecx,0xc0000 + int 0x40 + inc edx ;id + dec edi ;counter + jnz @b + pop ecx ;for output text + ret + +redraw_window: + call get_process_info + mov [rflag],1 + call draw_window + ret + +;this is debug func +debug: + pushad + mov ecx,[esp+0x24] + mov ebx,0x80100 + mov edx,0x10000a0 + mov eax,47 + mov esi,0x00ffffff + int 0x40 + popad + ret 4 + +; ********************************************* +; ******* WINDOW DEFINITIONS AND DRAW ******** +; ********************************************* + +draw_window: + pushad + 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 + ; [x start] *65536 + [x size] + mov ebx,[process_info+42] + ; [y start] *65536 + [y size] + mov ecx,[process_info+46] + mov 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,labelt ; pointer to text beginning + mov esi,labellen-labelt ; text length + int 0x40 + ;check for only header window output + cmp dword [process_info+46],25 + jle minimaze_view + + ;MENU AREA + mov eax,[process_info+42] ;x-size window + mov ecx,[process_info+46] ;y-size window + push ecx ;for using done + mov ebx,0x40000 + sub eax,8 + mov edi,ecx + add ebx,eax ;x-base + x-size + sub edi,22 ;temporary value for menu area + push ebx ;for drawing buttons area + sub ecx,edi ;y-base menu area + mov edx,[sc.work_graph] + shl ecx,0x10 + mov eax,13 + add ecx,0x10 + int 0x40 + ;MENU BUTTONS + ;now in hi-half ecx register begin Y-coord. menu area + ;in hi-half ebx begin X-coord. + ;menu 'File' + mov esi,edx ;color + and ecx,0xffff0000 + and ebx,0xffff0000 + add ecx,0x1000c + add ebx,0x20028 ;40x12 + mov edx,2 ;menu 'File' id = 2 + mov [y_menu],ecx ;for low-level menus func. + mov [xf_menu],ebx;for low-level menus func. + mov eax,8 + push ebx ;for output buttons texts + int 0x40 + ;registers is't change + ;menu 'Coding' + add ebx,0x290018 ;80x12 + inc edx ;menu 'coding' id = 3 + mov [xe_menu],ebx;for low-level menus func. + int 0x40 + ;menu 'Help' + add ebx,0x40ffe8 ;+0x280000 - 0x28, 40x12 + inc edx ;menu 'Help' id = 4 + mov [xh_menu],ebx;for low-level menus func. + int 0x40 + ;MENU BUTTONS TEXTS + ;'File' + pop ebx + shr ecx,0x10 + and ebx,0xffff0000 + add ecx,3 + mov eax,4 ; function 4 : write text to window + add ebx,0x80000 + mov edx,f_menu + add ebx,ecx ; [x start] *65536 + [y start] + mov esi,4 + mov ecx,[sc.work_button_text] + or ecx,0x10000000 ; font 1 & color ( 0xF0RRGGBB ) + push esi ;for 'Help' menu text + int 0x40 + ;'coding' + ;registers is't change + add ebx,0x2d0000 + ;mov esi,6 + add esi,2 +; mov edx,e_menu + add edx,4 + int 0x40 + ;'Help' + add ebx,0x3b0000 +; mov esi,4 + pop esi +; mov edx,h_menu + add edx,6 + int 0x40 + ;LOW_LEVEL MENU + ;for every hi-level menu exists one procedure + ;in begin programm they are not calls, + ;but when user click on one item hi-level menu + ;or press hot keys, call one func. and after + ;end work this func. she is redraw window - + ;low-level menu is hide. Functions: + ;menufile,menucoding,menuhelp. + ;Thay uses global virables, top-left corner every + ;hi-level menu buttons: [xf_menu],[xe_menu],[xh_menu],[y_menu] + + ;DRAW BUTTONS AREA + pop ebx ;for push ebx into processed menu area: x-bzse + x-size +; mov ecx,[process_info+46] + pop ecx + push ecx + sub ecx,24 + mov edx,[sc.work_graph] + shl ecx,16 ;y start + mov eax,13 + add ecx,20 + int 0x40 + +;filename input area +; mov ecx,[process_info+46] + pop ecx + push ecx ;for info strings + mov ebx,0x0008005a + sub ecx,21 + xor edx,edx + shl ecx,16 + mov [y_filename_area],ecx + dec edx + add ecx,16 + mov eax,13 + push ecx ;for button 'Go' + int 0x40 + +;button 'Go', press in case open/save if filename input complete + ;button size = 24x16 + mov eax,8 + pop ecx ;y-base+y-size + mov ebx,0x00680018;x-base+x-size + dec ecx + mov edx,0xff ;id + mov esi,[sc.work_button] + int 0x40 + shr ecx,0x10 + and ebx,0xffff0000 + add ecx,0x50004 + mov edx,b_go + add ebx,ecx + mov esi,2 + mov ecx,[sc.work_button_text] + or ecx,0x10000000 + sub eax,4 + int 0x40 + +;where output cursor? + mov al,[o_s_flag] + and al,8 + je @f + mov ecx,[y_filename_area] + add ecx,0x40008 + jmp cursor + @@: ;o_s_flag<0 - not output cursor into filename area + mov ecx,[y_cursor] + cursor: + push ecx + call draw_cursor + + mov eax,[y_filename_area] + mov ebx,0xa0000 + mov edx,filename + shr eax,0x10 + and ebx,0xffff0000 + add eax,4 + xor ecx,ecx + add ebx,eax + movzx esi,[name_l] + mov eax,4 + int 0x40 + +;info strings + ; sizefile text +; mov eax,[process_info+46] + pop eax + mov ebx,0x00840000 + sub eax,18 + xor ecx,ecx + add ebx,eax + mov edx,sizestr ; pointer to text beginning + mov eax,4 + mov esi,5 + int 0x40 + add ebx,0x00530000 + inc esi +; mov edx,offst + add edx,5 + inc esi + int 0x40 + ;sizefile + mov ecx,[sizefile] + mov edx,ebx + xor esi,esi + sub edx,0x00350000 + mov eax,47 + mov ebx,0x80100 + int 0x40 + mov ecx,[current] + add edx,0x005f0000 + int 0x40 + + push [text_cursor] ;это позиция курсора в текстовой строке + call draw_cursor + mov ecx,[sizefile] + jecxz minimaze_view + call output_screen + + minimaze_view: + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + popad + ret + + + + + +get_process_info: + pushad + mov eax,9 + mov ebx,process_info + xor ecx,ecx + dec ecx + int 0x40 + popad + ret + +coding: + pushad + mov ebp,0x10000 ;0x80000 + mov edi,[esp+0x28] ;source table + mov esi,[esp+0x24] ;destination table + xor ecx,ecx ;index in file + new_char: + xor ebx,ebx ;index in tables + not_c: + mov ah,[ebp+ecx] ;load char + cmp ah,[edi+ebx] ; + jz @f + inc ebx + cmp ebx,0x40 + jge end_table + jmp not_c + @@: + mov al,[esi+ebx] + inc ebx + mov [ebp+ecx],al + end_table: + inc ecx + cmp ecx,[sizefile] + jle new_char + popad + ret 8 + +create_process: + pushad + mov eax,51 + xor ebx,ebx + mov ecx,[esp+0x24] + inc ebx + mov edx,0x7E000 ;0x1000 + int 0x40 + popad + ret 4 + +help_thread: + call help_window + help_still: + mov eax,10 + int 0x40 + dec eax + jz help_red + dec eax + jz help_key + dec eax + jz help_button + jmp help_still + help_red: + call help_window + jmp help_still + help_key: + inc eax + inc eax + int 0x40 + jmp help_still + help_button: + mov eax,17 + int 0x40 + dec ah + jne help_still + shr eax,8 + dec eax + int 0x40 + +help_window: + pushad + 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,0x500140 ; [x start] *65536 + [x size] + mov ecx,0x700110 ; [y start] *65536 + [y size] + mov 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,0x10ffffff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,help_label ; pointer to text beginning + mov esi,14 ; text length + int 0x40 + ; HELP TEXT + add edx,14 ;help_text addr. + add esi,37 ; = 51 - length 1 line + mov ecx,0x00ffffff + mov edi,15 + @@: + add ebx,0x10 + int 0x40 + add edx,51 + dec edi + jnz @b + + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + popad + ret + +about_thread: + call about_window + about_still: + mov eax,10 + int 0x40 + dec eax + jz about_red + dec eax + jz about_key + dec eax + jz about_button + jmp about_still + about_red: + call about_window + jmp about_still + about_key: + inc eax + inc eax + int 0x40 + jmp about_still + about_button: + mov eax,17 + int 0x40 + dec ah + jne about_still + shr eax,8 + dec eax + int 0x40 + +about_window: + pushad + 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,0x500140 ; [x start] *65536 + [x size] + mov ecx,0x700110 ; [y start] *65536 + [y size] + mov 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.work_button_text] + or ecx,0x10000000 ; font 1 & color ( 0xF0RRGGBB ) + mov edx,about_label ; pointer to text beginning + mov esi,17 ; text length + int 0x40 + ; ABOUT TEXT + add edx,17 ;about_text addr. + add esi,34 ; = 51 - length 1 line + mov ecx,0x00ddeeff + mov edi,15 + @@: + add ebx,0x10 + int 0x40 + add edx,51 + dec edi + jnz @b + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + popad + ret + +; DATA AREA +sizefile dd 0 +current dd 0 ;current offset relative begin file. Uses as offset for patch. +;Coordinates left hi-level menu buttons +;Uses into low-level menu output. +xf_menu dd 0 +xe_menu dd 0 +xh_menu dd 0 +y_menu dd 0 ;top coord. menu +y_filename_area dd 0 ;top coord. filename input area +color dd 0 +y_cursor dd 0x280008 ;y coord. shl 16 + y size for cursor +x_cursor dd 0x680005 ;x coord. shl 16 + x size for cursor +name_l db 0 ;counter chars into filename +o_s_flag db 0 ; +rflag dd 0; +posx db 0 +posy db 3 +lines db 0 +end_str dd 0x10000 ;addr. first byte for output +text_cursor dd 0x01200000 + +filename: rb 13 + +b_go: db 'Go' + +sizestr: db 'SIZE:' + +offst: db 'OFFSET:' + +labelt: db 'HeEd' +labellen: + +;text for hi-level menu buttons +f_menu: db 'File' +e_menu: db 'Coding' +h_menu: db 'Help' +;text for low-level menu buttons +;menu File +m_open: db 'Open' +m_save: db 'Save' +m_exit: db 'Exit' +;menu coding +m_win2dos: db 'Win->Dos' +m_win2koi: db 'Win->Koi' +m_win2iso: db 'Win->Iso' +m_dos2win: db 'Dos->Win' +m_dos2koi: db 'Dos->Koi' +m_dos2iso: db 'Dos->Iso' +;menu Help +m_help: db 'Help' +m_about: db 'About' +;tables for coding +WIN_TABLE: +db 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9 +db 0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3 +db 0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD +db 0xDE,0xDF,0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7 +db 0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1 +db 0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB +db 0xFC,0xFD,0xFE,0xFF +DOS_TABLE: +db 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89 +db 0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93 +db 0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D +db 0x9E,0x9F,0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7 +db 0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xE0,0xE1 +db 0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB +db 0xEC,0xED,0xEE,0xEF +KOI_TABLE: +db 0xE1,0xE2,0xF7,0xE7,0xE4,0xE5,0xF6,0xFA,0xE9,0xEA +db 0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF2,0xF3,0xF4,0xF5 +db 0xE6,0xE8,0xE3,0xFE,0xFB,0xFD,0xFF,0xF9,0xF8,0xFC +db 0xE0,0xF1,0xC1,0xC2,0xD7,0xC7,0xC4,0xC5,0xD6,0xDA +db 0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD2,0xD3 +db 0xD4,0xD5,0xC6,0xC8,0xC3,0xDE,0xDB,0xDD,0xDF,0xD9 +db 0xD8,0xDC,0xC0,0xD1 +ISO_TABLE: +db 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9 +db 0xBA,0xBB,0xBC,0xBD,0xBE,0xBF,0xC0,0xC1,0xC2,0xC3 +db 0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD +db 0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7 +db 0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,0xE0,0xE1 +db 0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB +db 0xEC,0xED,0xEE,0xEF + +;text for help_window +help_label: db 'Help for HeEd.' +help_text: + db '1.HeEd в состоянии открыть файл только один раз и ' + db ' нужное число раз сохранить его. ' + db '2.При открытии файла без расширения надо это расши-' + db ' ширение все равно указывать как три пробела после' + db ' точки. ' + db '3.Само открытие файла происходит при нажатии кнопки' + db ' "Go". ' + db '4.Создание новых файлов в меню не предусмотрено, но' + db ' можно же редактировать... ' + db '5.В файл записывается только количество байт, кото-' + db ' рое было размером файла до открытия. ' + db '6.При нажатии "Go" с пустым полем имени файла выво-' + db ' дится память с адреса 0х80000, но размер файла ' + db ' равен 0xFFFFFFFF. ' + db ' (см. инфо "About") ' +help_end: +;text for about_window +about_label: db 'About this funny.' +about_text: + db 'Некоторая информация для тех, кто захочет дописать ' + db 'сюда что-то свое: код практичкски не оптимизирован,' + db 'так что разобраться будет не так уж сложно. Строки ' + db 'для кнопок меню должны идти прямо друг за другом, ' + db 'т. к. я при выводе использую не mov esi,размер и ' + db 'mov edx,адрес а просто прибавляю смещения. Что ка-' + db 'сается кодировок и размеров файла для сохранения, ' + db 'то остается только добавить кнопки меню с текстом ' + db '(при добавлении надо учитывать, что ID кнопки опоз-' + db 'наются dec ah, а не как cmp ah,ID). Если все же бу-' + db 'дет неприятно разбираться, то можете написать и ' + db 'спросить. Эта программа была написана в ходе разбо-' + db 'рок с GUI MeOS и поэтому не претендует на что-то ' + db 'большее, чем пример. Просто надоела эта тема, а вы-' + db 'кинуть жалко. mailto:babalbes@yandex.ru ' +about_end: + +I_END: + +sc system_colors + +process_info: + rb 1024 +menu_opened db ? +m_text: diff --git a/programs/heed/trunk/macros.inc b/programs/heed/trunk/macros.inc new file mode 100644 index 0000000000..d45b69e6e3 --- /dev/null +++ b/programs/heed/trunk/macros.inc @@ -0,0 +1,265 @@ +; 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 { ; mike.dld + if ~a eq + mov reg,a + end if +} + +macro mcall a,b,c,d,e,f { ; mike.dld + __mov eax,a + __mov ebx,b + __mov ecx,c + __mov edx,d + __mov esi,e + __mov edi,f + int 0x40 +} + + + + + + + +; optimize the code for size +__regs fix + +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 \ No newline at end of file diff --git a/programs/hello/trunk/build_en.bat b/programs/hello/trunk/build_en.bat new file mode 100644 index 0000000000..d6bd90debb --- /dev/null +++ b/programs/hello/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm hello.asm hello +@pause \ No newline at end of file diff --git a/programs/hello/trunk/build_ru.bat b/programs/hello/trunk/build_ru.bat new file mode 100644 index 0000000000..2e433d5a58 --- /dev/null +++ b/programs/hello/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm hello.asm hello +@pause \ No newline at end of file diff --git a/programs/hello/trunk/cmdipc.inc b/programs/hello/trunk/cmdipc.inc new file mode 100644 index 0000000000..53353e0ec2 --- /dev/null +++ b/programs/hello/trunk/cmdipc.inc @@ -0,0 +1,221 @@ +include "macros.inc" + +initipc: + mov eax,9 + mov ebx,prc + mov ecx,-1 + int 0x40 + + mov ecx,eax +loop1: + push ecx + + mov eax,9 + mov ebx,prc + int 0x40 + + cmp word [prc+10],'CM' + jne no_cmd + cmp byte [prc+12],'D' + jne no_cmd + + mov ebx,[prc+30] + mov dword [cmdpid],ebx + + mov dword [cmdnumb],ecx + +no_cmd: + pop ecx + loop loop1 + + cmp dword [cmdpid],0 + jne no_exit + + jmp exit + +no_exit: + mov eax,60 + mov ebx,2 + mov ecx,dword [cmdpid] + mov edx,printf + mov esi,4 + int 0x40 + + call initcmd + +waitcmdinit: + mov eax,40 + mov ebx,01000000b + int 0x40 + + mov eax,23 + mov ebx,100 + int 0x40 + + cmp eax,7 + je cmd_ok + + jmp exit + +cmd_ok: + cmp byte [ipcb+16],'.' + jne exit + + mov eax,18 + mov ebx,3 + mov ecx,dword [cmdnumb] + int 0x40 + + ret + +pause1: + mov eax,5 + mov ebx,1 + int 0x40 + ret + +exit: + mov eax,-1 + int 0x40 + +cls: + mov eax,60 + mov ebx,2 + mov ecx,dword [cmdpid] + mov edx,ipccls + mov esi,4 + int 0x40 + + call pause1 + + ret + +print: + mov ecx,84 +loopprt: + mov edi,stripc + add edi,ecx + mov esi,fill_symbol + movsb + + loop loopprt + + cld + mov ecx,4 + mov edi,stripc + mov esi,printf + rep movsb + + cld + mov edx,79 + sub edx,eax + mov ecx,79 + sub ecx,edx + mov edi,stripc+4 + mov esi,ebx + rep movsb + + mov eax,60 + mov ebx,2 + mov ecx,dword [cmdpid] + mov edx,stripc + mov esi,84 + int 0x40 + + call pause1 + + ret + +eol: + mov eax,60 + mov ebx,2 + mov ecx,dword [cmdpid] + mov edx,ipceol + mov esi,4 + int 0x40 + + call pause1 + + ret + +initcmd: + mov eax,60 + mov ebx,2 + mov ecx,dword [cmdpid] + mov edx,ipckey + mov esi,4 + int 0x40 + + mov eax,60 + mov ebx,1 + mov ecx,ipcb + mov edx,28 + int 0x40 + + cld + mov ecx,28 + mov edi,ipcb + mov esi,ipcc + rep movsb + + ret + +getkey: + call initcmd + +waitagain: + mov eax,40 + mov ebx,01000000b + int 0x40 + + mov eax,10 + int 0x40 + + cmp eax,7 + jne waitagain + + mov edi,key + mov esi,ipcb+16 + movsb + + ret + +endipc: + mov eax,60 + mov ebx,2 + mov ecx,dword [cmdpid] + mov edx,ipcend + mov esi,4 + int 0x40 + + jmp exit + +cmdpid dd 0 +cmdnumb dd 0 + +printf db '~ppp' +ipceol db '~lll' +ipcend db '~eee' +ipccls db '~ccc' +ipckey db '~kkk' + +key db 0 + +ipcb: + db 0 + db 0,0,0 + dd 8 +times 20 db 0 + +ipcc: + db 0 + db 0,0,0 + dd 8 +times 20 db 0 + +stripc: times 84 db 0 + +fill_symbol db 0 + +prc: times 52 db 0 + diff --git a/programs/hello/trunk/hello.asm b/programs/hello/trunk/hello.asm new file mode 100644 index 0000000000..65f4b1941d --- /dev/null +++ b/programs/hello/trunk/hello.asm @@ -0,0 +1,71 @@ +; Hello, World! - Programm example for CMD shell +; Compile with FASM for Menuet +; +; You must run this program from CMD shell only +; + +use32 + + org 0x0 + + db 'MENUET01' + dd 0x01 + dd START + dd I_END + dd 0x100000 + dd 0x7fff0 + dd 0x0 + dd 0x0 + +include "lang.inc" +include "cmdipc.inc" ; Подключить файл CMDIPC.INC + +START: + call initipc ; инициализировать для работы с CMD + + mov eax,26 ; Длина строки + mov ebx,hello_text ; Указатель на строку + call print ; Вывести строку + +again: + call getkey ; Ожидать нажатия клавиши и считать ее в key + + cmp byte [key],'Y' ; Тут программа проверяет, нажата ли нужн. клавиша + je goodday + cmp byte [key],'y' + je goodday + cmp byte [key],'N' + je goodmorning + cmp byte [key],'n' + je goodmorning + + jmp again ; Если нужн. клавиша не нажата, то считать клавишу + ; заново +goodday: ; Вывести приветствие Good Day, World! + call eol ; Пропустить строку + + mov eax,16 + mov ebx,text4 + call print + + call eol ; Пропустить строку + + jmp endipc ; Завершить программу + +goodmorning: ; Вывести приветствие Good Morning, World! + call eol + + mov eax,20 + mov ebx,text5 + call print + + call eol + + jmp endipc ; Заверщить программу + +hello_text db 'Is it after 12 noon? [Y\N]?' + +text4 db 'Good day, World!' +text5 db 'Good morning, World!' + +I_END: diff --git a/programs/hello/trunk/macros.inc b/programs/hello/trunk/macros.inc new file mode 100644 index 0000000000..d45b69e6e3 --- /dev/null +++ b/programs/hello/trunk/macros.inc @@ -0,0 +1,265 @@ +; 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 { ; mike.dld + if ~a eq + mov reg,a + end if +} + +macro mcall a,b,c,d,e,f { ; mike.dld + __mov eax,a + __mov ebx,b + __mov ecx,c + __mov edx,d + __mov esi,e + __mov edi,f + int 0x40 +} + + + + + + + +; optimize the code for size +__regs fix + +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 \ No newline at end of file diff --git a/programs/hexhd/trunk/build_en.bat b/programs/hexhd/trunk/build_en.bat new file mode 100644 index 0000000000..a9ac3eeedf --- /dev/null +++ b/programs/hexhd/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm hexhd.asm hexhd +@pause \ No newline at end of file diff --git a/programs/hexhd/trunk/build_ru.bat b/programs/hexhd/trunk/build_ru.bat new file mode 100644 index 0000000000..097bef2d74 --- /dev/null +++ b/programs/hexhd/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm hexhd.asm hexhd +@pause \ No newline at end of file diff --git a/programs/hexhd/trunk/hexhd.asm b/programs/hexhd/trunk/hexhd.asm new file mode 100644 index 0000000000..4e32583a86 --- /dev/null +++ b/programs/hexhd/trunk/hexhd.asm @@ -0,0 +1,235 @@ +; +; EXAMPLE APPLICATION +; +; 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 0x5000 ; required amount of memory + dd 0x5000 ; esp = 0x7FFF0 + dd 0x00000000 ; reserved=no extended header + +include 'lang.inc' +include 'macros.inc' + +START: ; start of execution + + call open_file + + call draw_window ; at first, draw the 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 + + 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 ? + jne noclose + mov eax,-1 ; close this program + int 0x40 + noclose: + + cmp ah,2 + jne noexam + jmp still + noexam: + + cmp ah,3 + jne noback + mov edi,block + cmp dword [edi],0 + je nonext + dec dword [edi] + call open_file + call draw_window + noback: + + cmp ah,4 + jne nonext + mov edi,block + inc dword [edi] + call open_file + call draw_window + nonext: + + 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,0*65536+400 ; [x start] *65536 + [x size] + mov ecx,0*65536+270+200 ; [y start] *65536 + [y size] + mov edx,0x038899aa;1111cc ; color of work area RRGGBB,8->c + int 0x40 + + mov eax,4 ; function 4 : write text to window + mov ebx,144*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 + + mov eax,47 ;decimal + mov ecx,[block] + mov edx,64*65536+34 + mov ebx,10 + shl ebx,16 + mov esi,0x00ffffff + int 0x40 + + add edx,128*65536 ;hex + mov bh,1 + int 0x40 + + mov eax,8 + mov ebx,280*65536+16*6 + mov ecx,30*65536+14 + + mov edx,2 + mov esi,0x3f49df;5599cc + int 0x40 + + mov ebx,15*65536+32 + add edx,1 + mov eax,8 + int 0x40 + + add ebx,127*65536 + add edx,1 + mov eax,8 + int 0x40 + + + mov eax,4 + mov ebx,14*65536+33 + mov ecx,0xffffff + mov edx,buttons + mov esi,blen-buttons + int 0x40 + + + mov ebx,280*65536+65 ; draw info text with function 4 + mov ecx,0xffffff + mov edx,text + mov esi,16 + mov edi,16*2 + newline: + + pusha ; hext + + mov edi,16 + + mov ecx,edx + + mov edx,ebx + sub edx,265*65536 + + newhex: + + mov eax,47 + mov ebx,0x00020101 + xor esi,0xffff00 + int 0x40 + + add edx,16*65536 + add ecx,1 + + dec edi + jne newhex + + popa + + mov eax,4 ; text + int 0x40 + add ebx,12 + add edx,16 + dec edi + jnz newline + + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + + ret + + + +open_file: + + pusha + + mov eax,58 + mov ebx,fileinfo + int 0x40 + + popa + + ret + + + + +; DATA AREA + +fileinfo: + dd 8 +block dd 0 + dd 1 + dd text + dd os + db '/HARDDISK/FIRST',0 + + +labelt: + db 'EDITOR HEXADECIMAL' +labellen: + +buttons db ' << >> << OPTIONS >> ' +blen: + +os: +times 16384 db ? +text: + +I_END: diff --git a/programs/hexhd/trunk/macros.inc b/programs/hexhd/trunk/macros.inc new file mode 100644 index 0000000000..d45b69e6e3 --- /dev/null +++ b/programs/hexhd/trunk/macros.inc @@ -0,0 +1,265 @@ +; 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 { ; mike.dld + if ~a eq + mov reg,a + end if +} + +macro mcall a,b,c,d,e,f { ; mike.dld + __mov eax,a + __mov ebx,b + __mov ecx,c + __mov edx,d + __mov esi,e + __mov edi,f + int 0x40 +} + + + + + + + +; optimize the code for size +__regs fix + +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 \ No newline at end of file diff --git a/programs/hexview/trunk/build_en.bat b/programs/hexview/trunk/build_en.bat new file mode 100644 index 0000000000..b3b9d04c0f --- /dev/null +++ b/programs/hexview/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm hexview.asm hexview +@pause \ No newline at end of file diff --git a/programs/hexview/trunk/build_ru.bat b/programs/hexview/trunk/build_ru.bat new file mode 100644 index 0000000000..07dbc6a17b --- /dev/null +++ b/programs/hexview/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm hexview.asm hexview +@pause \ No newline at end of file diff --git a/programs/hexview/trunk/hexview.asm b/programs/hexview/trunk/hexview.asm new file mode 100644 index 0000000000..6f48dd312e --- /dev/null +++ b/programs/hexview/trunk/hexview.asm @@ -0,0 +1,219 @@ +; +; EXAMPLE APPLICATION +; +; 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 0x8000 ; required amount of memory + dd 0x8000 ; esp = 0x7FFF0 + dd 0x00000000 ; reserved=no extended header + +include 'lang.inc' +include 'macros.inc' + +begin dd 0 + +START: ; start of execution + + call open_file + +red: + call draw_window ; at first, draw the window + +still: + + mov eax,10 ; wait here for event + int 0x40 + + dec eax ; redraw request ? + je red + dec eax ; key in buffer ? + je key + dec eax ; button in buffer ? + je 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,3 + jne no_up + cmp [begin],16 + jb no_up + + add [begin],-16 + jmp red + no_up: + + cmp ah,4 + jne no_down + add [begin],16 + jmp red + no_down: + + dec ah ; button id=1 ? + jne still + xor eax,eax ; close this program + dec eax + 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 + + ; DRAW WINDOW + xor eax,eax ; function 0 : define and draw window + mov ebx,100*65536+400 ; [x start] *65536 + [x size] + mov ecx,100*65536+270 ; [y start] *65536 + [y size] + mov edx,0x03224466 ; color of work area RRGGBB,8->c + mov esi,0x006688aa ; color of grab bar RRGGBB,8->color gl + mov edi,0x00ffffff ; 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,labelt ; pointer to text beginning + mov esi,labellen-labelt ; text length + int 0x40 + + mov eax,8 + mov ebx,280*65536+16*6 + mov ecx,240*65536+14 + mov edx,2 + mov esi,0x5599cc + int 0x40 + + mov ebx,15*65536+125 + inc edx + int 0x40 + + + add ebx,127*65536 + inc edx + int 0x40 + + + mov eax,4 + mov ebx,15*65536+243 + mov ecx,0xffffff + mov edx,buttons + mov esi,blen-buttons + int 0x40 + + + mov ebx,280*65536+35 ; draw info text with function 4 + mov ecx,0xffffff + mov edx,text + add edx,[begin] + + mov esi,16 + mov edi,esi + newline: + + push ebx ; hext + push edx +push edi + + mov edi,16 + mov ecx,edx + mov edx,ebx + add edx,-265*65536 + + mov eax,47 + mov ebx,0x00020101 + mov esi,0xffff00 + + newhex: + + ; mov ebx,0x00020101 + ; mov esi,0xffff00 + int 0x40 + + add edx,16*65536 + inc ecx + dec edi + jne newhex + +; popa +pop edi +pop edx +pop ebx + + mov eax,4 ; text + mov esi,16 + mov ecx,0xffffff + int 0x40 + add ebx,12 + add edx,16 + dec edi + jnz newline + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + + ret + + + +file_name db 'EXAMPLE.ASM ' + ; db 'EXAMPLE ' + +open_file: + + pusha + + mov eax,6 + mov ebx,file_name + xor ecx,ecx + mov edx,-1 + mov esi,text + int 0x40 + + popa + + ret + + + +; DATA AREA + +labelt: db 'HEXVIEW' +labellen: + +buttons db ' UP DOWN' + db ' EXAMPLE ' +blen: + +text: + +I_END: diff --git a/programs/hexview/trunk/macros.inc b/programs/hexview/trunk/macros.inc new file mode 100644 index 0000000000..d45b69e6e3 --- /dev/null +++ b/programs/hexview/trunk/macros.inc @@ -0,0 +1,265 @@ +; 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 { ; mike.dld + if ~a eq + mov reg,a + end if +} + +macro mcall a,b,c,d,e,f { ; mike.dld + __mov eax,a + __mov ebx,b + __mov ecx,c + __mov edx,d + __mov esi,e + __mov edi,f + int 0x40 +} + + + + + + + +; optimize the code for size +__regs fix + +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 \ No newline at end of file diff --git a/programs/httpc/trunk/build_en.bat b/programs/httpc/trunk/build_en.bat new file mode 100644 index 0000000000..3be905a62c --- /dev/null +++ b/programs/httpc/trunk/build_en.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix en >lang.inc +@fasm httpc.asm httpc +@pause \ No newline at end of file diff --git a/programs/httpc/trunk/build_ru.bat b/programs/httpc/trunk/build_ru.bat new file mode 100644 index 0000000000..dc528bf409 --- /dev/null +++ b/programs/httpc/trunk/build_ru.bat @@ -0,0 +1,4 @@ +@erase lang.inc +@echo lang fix ru >lang.inc +@fasm httpc.asm httpc +@pause \ No newline at end of file diff --git a/programs/httpc/trunk/httpc.asm b/programs/httpc/trunk/httpc.asm new file mode 100644 index 0000000000..7c5ddae5a9 --- /dev/null +++ b/programs/httpc/trunk/httpc.asm @@ -0,0 +1,1529 @@ +; +; HTTPC.ASM +; +; Compile with FASM for Menuet ( v1.40 for DOS ) +; +; This program implements a very simple web browser +; +; Version 0.4 2nd December 2003 Mike Hibbett +; Enabled lowercase/uppcase characters in URL +; Version 0.3 30th November 2003 Mike Hibbett +; Fixed bug with tcp socket opne - uses unique port +; Version 0.2 27th November 2003 Mike Hibbett +; Added user entry of url, and implements url -> IP address +; resolution through DNS +; +; Version 0.1 Ville Mikael Turjanmaa +; Original version + + +; Enabling debugging puts stuff to the debug board +DEBUGGING_ENABLED equ 1 +DEBUGGING_DISABLED equ 0 +DEBUGGING_STATE equ DEBUGGING_DISABLED + +use32 + + org 0x0 + + db 'MENUET00' ; 8 byte id + dd 38 ; required os + dd START ; program start + dd I_END ; program image size + dd 0x100000 ; required amount of memory + dd 0x00000000 ; reserved=no extended header + +include 'lang.inc' +include 'macros.inc' +;include "DEBUG.INC" + +URLMAXLEN equ 50 ; maximum length of url string + +; Memory usage +; webpage source file at 0x10000 +; decoded text page at 0x20000 +; text attribute 0x30000 (1 = normal, 2 = bold, 128+ = link) + +START: ; start of execution + +;dps <"Program started",13,10> + + mov eax,40 ; Report events + mov ebx,10000111b ; Stack 8 + defaults + int 0x40 + + call draw_window + +still: + mov eax,23 ; wait here for event + mov ebx,1 + 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 + + ; Get the web page data from the remote server + call read_incoming_data + + mov eax,[status] + mov [prev_status],eax + + mov eax,53 + mov ebx,6 + mov ecx,[socket] + int 0x40 + + mov [status],eax + + cmp [prev_status],4 + jge no_send + cmp [status],4 + jne no_send + + mov [onoff],1 + + call send_request + +no_send: + call print_status + + cmp [prev_status],4 + jne no_close + cmp [status],4 ; connection closed by server + jbe no_close ; respond to connection close command + ; draw page + + call read_incoming_data + + mov eax,53 + mov ebx,8 + mov ecx,[socket] + int 0x40 + + call draw_page + + mov [onoff],0 + +no_close: + jmp still + +red: ; redraw + call draw_window + jmp still + +key: ; key + mov eax,2 ; just read it and ignore + int 0x40 + shr eax,8 + cmp eax,184 + jne no_down + cmp [display_from],25 + jb no_down + sub [display_from],25 + call display_page + +no_down: + cmp eax,183 + jne no_up + add [display_from],25 + call display_page + +no_up: + jmp still + +button: ; button +;dps <"Button pressed",13,10> + mov eax,17 ; get id + int 0x40 + cmp ah,1 ; button id=1 ? + jne noclose + +;dps "Closing socket before exit... " + + mov eax, 53 + mov ebx, 8 + mov ecx, [socket] + int 0x40 + +;dpd eax +;dps <13,10> + +exit: + or eax,-1 ; close this program + int 0x40 + +noclose: + cmp ah,31 + jne noup + sub [display_from],20 + call display_page + jmp still + +noup: + cmp ah,32 + jne nodown + add [display_from],20 + call display_page + jmp still + +nodown: + cmp ah, 10 ; Enter url + jne nourl + + mov [addr],dword document_user + mov [ya],dword 38 + mov [len],dword URLMAXLEN + + mov ecx,[len] + mov edi,[addr] + mov al,' ' + rep stosb + + call print_text + + mov edi,[addr] + +f11: + mov eax,10 + int 0x40 + cmp eax,2 ; key? + jz fbu + jmp still + +fbu: + mov eax,2 + int 0x40 ; get key + shr eax,8 + cmp eax,8 + jnz nobs + cmp edi,[addr] + jz f11 + sub edi,1 + mov [edi],byte ' ' + call print_text + jmp f11 + +nobs: + cmp eax, dword 10 + je retkey + cmp eax, dword 13 + je retkey + + cmp eax,dword 31 + jbe f11 + +; Removed in v0.4 +; cmp eax,dword 95 +; jb keyok +; sub eax,32 + +keyok: + mov [edi],al + + call print_text + + add edi,1 + mov esi,[addr] + add esi,URLMAXLEN + cmp esi,edi + jnz f11 + + jmp still + +retkey: + mov ah, 22 ; start load + +nourl: + call socket_commands ; opens or closes the connection + jmp still + + +;**************************************************************************** +; Function +; send_request +; +; Description +; Transmits the GET request to the server. +; This is done as GET then URL then HTTP/1.0',13,10,13,10 in 3 packets +; +;**************************************************************************** +send_request: + pusha + mov eax,53 ; 'GET ' + mov ebx,7 + mov ecx,[socket] + mov edx,4 + mov esi,string0 + int 0x40 + + mov edx,0 + +next_edx: + ; Determine the length of the url to send in the GET request + inc edx + cmp [edx+document],byte ' ' + jne next_edx + + mov eax,53 ; document_user + mov ebx,7 + mov ecx,[socket] + mov esi,document + int 0x40 + + mov eax,53 ; ' HTTP/1.0 .. ' + mov ebx,7 + mov ecx,[socket] + mov edx,stringh_end-stringh + mov esi,stringh + int 0x40 + + popa + ret + + +;**************************************************************************** +; Function +; print_status +; +; Description +; displays the socket/data received status information +; +;**************************************************************************** +print_status: + pusha + + mov eax,26 + mov ebx,9 + int 0x40 + + cmp eax,[nextupdate] + jb status_return + + add eax,25 + + mov [nextupdate],eax + + mov eax,13 + mov ebx,5*65536+100 + mov ecx,[winys] + shl ecx,16 + add ecx,-18*65536+10 + mov edx,0xffffff + int 0x40 + + mov eax,47 + mov ebx,3*65536 + mov ecx,[status] + mov edx,12*65536-18 + add edx,[winys] + mov esi,0x000000 + int 0x40 + + mov eax,47 + mov ebx,6*65536 + mov ecx,[pos] + mov edx,40*65536-18 + add edx,[winys] + mov esi,0x000000 + int 0x40 + +status_return: + popa + ret + + +;**************************************************************************** +; Function +; read_incoming_data +; +; Description +; receive the web page from the server, storing it without processing +; +;**************************************************************************** +read_incoming_data: + cmp [onoff],1 + je rid + ret + +rid: + mov ecx,-1 + +newbyteread: + mov eax, 53 + mov ebx, 2 + mov ecx, [socket] + int 0x40 + + cmp eax,0 + je no_more_data + +read_more: + mov eax, 53 + mov ebx, 3 + mov ecx, [socket] + int 0x40 + +yesm: + inc [pos] + mov ecx,[pos] + mov [0x10000+ecx],bl + + call print_status + + cmp eax,0 + jne read_more + + mov eax,5 + mov ebx,50 + int 0x40 + + jmp newbyteread + +no_more_data: + ret + + +;**************************************************************************** +; Function +; draw_page +; +; Description +; parses the web page data, storing displayable data at 0x20000 +; and attributes at 0x30000. It then calls display_page to render +; the data +; +;**************************************************************************** +draw_page: + pusha + mov esi,0 + mov [command_on_off],0 + +newlettercheck: + movzx eax,byte [esi+0x10000] + cmp al,'<' + jne no_c_on + mov [command_on_off],1 + +no_c_on: + cmp al,'>' + jne no_c_off + mov [command_on_off],0 + +no_c_off: + cmp [command_on_off],0 + je no_lower_case + + cmp eax,96 + jg no_lower_case + cmp eax,65 + jb no_lower_case + add eax,32 + +no_lower_case: + mov [esi+0x10000],al + inc esi + cmp esi,[pos] + jbe newlettercheck + mov edi,0x30000 + mov ecx,0x10000 + mov al,0 + cld + rep stosb + mov [text_type],1 + mov [command_on_off],0 + + mov esi,0 + mov ecx,[pos] + + ; search for double lf + +find_dlf: + cmp [0x10000+esi-4],dword 0x0d0a0d0a + je found_dlf + cmp [0x10000+esi-4],dword 0x0a0d0a0d + je found_dlf + cmp [0x10000+esi-2],word 0x0d0d + je found_dlf + cmp [0x10000+esi-2],word 0x0a0a + je found_dlf + + cmp esi,5500 + je found_dlf + + inc esi + + jmp find_dlf + +found_dlf: +newbyte: + mov al,[esi+0x10000] + cmp al,'<' + jne no_command_on + mov [command_on_off],1 + +no_command_on: + cmp al,'>' + jne no_command_off + mov [command_on_off],0 + jmp byte_done + +no_command_off: + mov eax,[esi+0x10000] ; + cmp ax,'->' + jne no_com2_end + mov [com2],0 + inc esi + jmp byte_done + +no_com2_end: + mov eax,[esi+0x10000] ;